summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2009-07-30 20:34:23 +0000
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2009-07-30 20:34:23 +0000
commitd72782347c2ba802cd030feeb23f7eacc4ae8a23 (patch)
treea729476323d0d551c2031b3a666193923ceb08a4
parentc297ef7f5928b0407ab67b9a76ccf166d0a1d3e0 (diff)
parent3b8435d744c504a88493f272068453023585837e (diff)
downloadnavit-svn-wince.tar.gz
Updated wince branch to current versionwince
git-svn-id: http://svn.code.sf.net/p/navit/code/branches/wince/navit@2430 ffa7fe5e-494d-0410-b361-a75ebd5db220
-rw-r--r--AUTHORS7
-rw-r--r--COPYRIGHT2
-rw-r--r--ChangeLog4
-rw-r--r--Doxyfile (renamed from navit/Doxyfile)0
-rw-r--r--Makefile.am108
-rw-r--r--Makefile.inc10
-rw-r--r--README82
-rw-r--r--announcement.c68
-rw-r--r--announcement.h24
-rw-r--r--atom.c27
-rw-r--r--atom.h3
-rw-r--r--attr.c546
-rw-r--r--attr.h165
-rw-r--r--attr_def.h331
-rw-r--r--binding/Makefile.am10
-rw-r--r--binding/dbus/Makefile.am6
-rw-r--r--binding/dbus/binding_dbus.c960
-rwxr-xr-xbinding/dbus/eval.py12
-rw-r--r--binding/dbus/navit.introspect34
-rwxr-xr-xbinding/dbus/test.py11
-rw-r--r--binding/python/Makefile.am6
-rw-r--r--binding/python/attr.c99
-rw-r--r--binding/python/binding_python.c370
-rw-r--r--binding/python/common.h55
-rw-r--r--binding/python/main.c71
-rw-r--r--binding/python/navigation.c82
-rw-r--r--binding/python/navit.c135
-rw-r--r--binding/python/navit.xml.python7
-rw-r--r--binding/python/pcoord.c88
-rw-r--r--binding/python/route.c84
-rw-r--r--binding/python/startup.py8
-rw-r--r--binding/python/template.c96
-rw-r--r--cache.c358
-rw-r--r--cache.h11
-rw-r--r--callback.c268
-rw-r--r--callback.h89
-rw-r--r--color.h27
-rw-r--r--command.c1013
-rw-r--r--command.h20
-rw-r--r--compass.c156
-rw-r--r--compass.h26
-rw-r--r--configure.in592
-rw-r--r--coord.c367
-rw-r--r--coord.h132
-rw-r--r--country.c429
-rw-r--r--country.h41
-rw-r--r--cursor.c194
-rw-r--r--cursor.h34
-rw-r--r--data.h108
-rw-r--r--data_window.c41
-rw-r--r--data_window.h44
-rw-r--r--data_window_int.h31
-rw-r--r--debug.c212
-rw-r--r--debug.h54
-rw-r--r--destination.h29
-rw-r--r--draw_info.h30
-rw-r--r--endianess.h105
-rw-r--r--event.c110
-rw-r--r--event.h64
-rw-r--r--event_glib.c196
-rw-r--r--event_glib.h3
-rw-r--r--fib-1.1/Makefile.am (renamed from navit/fib-1.1/Makefile.am)0
-rw-r--r--fib-1.1/README (renamed from navit/fib-1.1/README)0
-rwxr-xr-xfib-1.1/configure (renamed from navit/fib-1.1/configure)0
-rw-r--r--fib-1.1/configure.in (renamed from navit/fib-1.1/configure.in)0
-rw-r--r--fib-1.1/fh_extractmin.3 (renamed from navit/fib-1.1/fh_extractmin.3)0
-rw-r--r--fib-1.1/fh_makeheap.3 (renamed from navit/fib-1.1/fh_makeheap.3)0
-rw-r--r--fib-1.1/fh_makekeyheap.3 (renamed from navit/fib-1.1/fh_makekeyheap.3)0
-rw-r--r--fib-1.1/fib.c (renamed from navit/fib-1.1/fib.c)0
-rw-r--r--fib-1.1/fib.h (renamed from navit/fib-1.1/fib.h)0
-rw-r--r--fib-1.1/fibpriv.h (renamed from navit/fib-1.1/fibpriv.h)0
-rw-r--r--fib-1.1/fibtest.c (renamed from navit/fib-1.1/fibtest.c)0
-rw-r--r--fib-1.1/fibtest.out (renamed from navit/fib-1.1/fibtest.out)0
-rw-r--r--fib-1.1/fibtest2.c (renamed from navit/fib-1.1/fibtest2.c)0
-rw-r--r--fib-1.1/fibtest2.out (renamed from navit/fib-1.1/fibtest2.out)0
-rw-r--r--fib-1.1/tt.c (renamed from navit/fib-1.1/tt.c)0
-rw-r--r--fib-1.1/tt.out (renamed from navit/fib-1.1/tt.out)0
-rw-r--r--fib-1.1/use.c (renamed from navit/fib-1.1/use.c)0
-rw-r--r--file.c450
-rw-r--r--file.h83
-rw-r--r--font/Makefile.am4
-rw-r--r--font/freetype/Makefile.am9
-rw-r--r--font/freetype/font_freetype.c674
-rw-r--r--font/freetype/font_freetype.h38
-rw-r--r--fonts/LiberationMono-Bold.ttfbin0 -> 104980 bytes
-rw-r--r--fonts/LiberationMono-BoldItalic.ttfbin0 -> 117192 bytes
-rw-r--r--fonts/LiberationMono-Italic.ttfbin0 -> 123228 bytes
-rw-r--r--fonts/LiberationMono-Regular.ttfbin0 -> 107920 bytes
-rw-r--r--fonts/LiberationSans-Bold.ttfbin0 -> 133000 bytes
-rw-r--r--fonts/LiberationSans-BoldItalic.ttfbin0 -> 128828 bytes
-rw-r--r--fonts/LiberationSans-Italic.ttfbin0 -> 155304 bytes
-rw-r--r--fonts/LiberationSans-Regular.ttfbin0 -> 133088 bytes
-rw-r--r--fonts/LiberationSerif-Bold.ttfbin0 -> 141132 bytes
-rw-r--r--fonts/LiberationSerif-BoldItalic.ttfbin0 -> 144184 bytes
-rw-r--r--fonts/LiberationSerif-Italic.ttfbin0 -> 138328 bytes
-rw-r--r--fonts/LiberationSerif-Regular.ttfbin0 -> 146036 bytes
-rw-r--r--fonts/License.txt19
-rw-r--r--fonts/Makefile.am15
-rw-r--r--fonts/README68
-rw-r--r--graphics.c2160
-rw-r--r--graphics.h188
-rw-r--r--graphics/Makefile.am19
-rw-r--r--graphics/gd/Makefile.am9
-rw-r--r--graphics/gd/graphics_gd.c547
-rw-r--r--graphics/gtk_drawing_area/Makefile.am5
-rw-r--r--graphics/gtk_drawing_area/graphics_gtk_drawing_area.c1096
-rw-r--r--graphics/gtk_gl_ext/graphics_gtk_gl_ext.c352
-rw-r--r--graphics/null/Makefile.am9
-rw-r--r--graphics/null/graphics_null.c231
-rw-r--r--graphics/opengl/Makefile.am6
-rw-r--r--graphics/opengl/graphics_opengl.c845
-rw-r--r--graphics/qt_qpainter/Makefile.am10
-rw-r--r--graphics/qt_qpainter/graphics_qt_qpainter.cpp1214
-rw-r--r--graphics/sdl/Makefile.am5
-rw-r--r--graphics/sdl/graphics_sdl.c2146
-rw-r--r--graphics/sdl/raster.c2022
-rw-r--r--graphics/sdl/raster.h25
-rw-r--r--graphics/win32/Makefile.am9
-rw-r--r--graphics/win32/graphics_win32.c1074
-rw-r--r--graphics/win32/graphics_win32.h59
-rw-r--r--graphics/win32/resources/resource.h (renamed from navit/graphics/win32/resources/resource.h)0
-rw-r--r--graphics/win32/xpm2bmp.c588
-rw-r--r--graphics/win32/xpm2bmp.h (renamed from navit/graphics/win32/xpm2bmp.h)0
-rw-r--r--gtkext.h25
-rw-r--r--gui.c154
-rw-r--r--gui.h67
-rw-r--r--gui/Makefile.am10
-rw-r--r--gui/gtk/Makefile.am6
-rw-r--r--gui/gtk/datawindow.c214
-rw-r--r--gui/gtk/destination.c539
-rw-r--r--gui/gtk/gui_gtk.h62
-rw-r--r--gui/gtk/gui_gtk_action.c627
-rw-r--r--gui/gtk/gui_gtk_statusbar.c178
-rw-r--r--gui/gtk/gui_gtk_window.c771
-rw-r--r--gui/internal/Makefile.am6
-rw-r--r--gui/internal/gui_internal.c4978
-rw-r--r--gui/internal/gui_internal.h76
-rw-r--r--gui/win32/Makefile.am10
-rw-r--r--gui/win32/ceglue.c77
-rw-r--r--gui/win32/ceglue.h16
-rw-r--r--gui/win32/gui_win32.c643
-rw-r--r--gui/win32/resources/navit.icobin0 -> 10134 bytes
-rw-r--r--gui/win32/resources/resource.h (renamed from navit/gui/win32/resources/resource.h)0
-rw-r--r--gui/win32/resources/resource.rc (renamed from projs/CodeBlocks/win32gui/resources/resource.rc)0
-rw-r--r--gui/win32/resources/toolbar.bmp (renamed from projs/CodeBlocks/win32gui/resources/toolbar.bmp)bin1398 -> 1398 bytes
-rw-r--r--gui/win32/win32_gui_destination.c412
-rw-r--r--gui/win32/win32_gui_notify.c132
-rw-r--r--gui/win32/win32_gui_notify.h (renamed from navit/gui/win32/win32_gui_notify.h)0
-rw-r--r--intl/VERSION1
-rw-r--r--item.c330
-rw-r--r--item.h133
-rw-r--r--item_def.h525
-rw-r--r--keys.h8
-rw-r--r--layer.h31
-rw-r--r--layout.c343
-rw-r--r--layout.h94
-rw-r--r--linguistics.c153
-rw-r--r--linguistics.h4
-rw-r--r--locations.txt (renamed from navit/locations.txt)0
-rw-r--r--log.c318
-rw-r--r--log.h43
-rw-r--r--main.c300
-rw-r--r--main.h40
-rw-r--r--map-share.h27
-rw-r--r--map.c663
-rw-r--r--map.h261
-rw-r--r--map/Makefile.am11
-rw-r--r--map/binfile/Makefile.am9
-rw-r--r--map/binfile/binfile.c1299
-rw-r--r--map/garmin/Makefile.am33
-rw-r--r--map/garmin/gar2navit.c219
-rw-r--r--map/garmin/gar2navit.h52
-rw-r--r--map/garmin/garmin.c997
-rw-r--r--map/garmin/garmin.h32
-rw-r--r--map/garmin/garmintypes.txt707
-rw-r--r--map/garmin/gentypes.c148
-rw-r--r--map/garmin_img/Makefile.am5
-rw-r--r--map/garmin_img/garmin_img.c1513
-rw-r--r--map/mg/Makefile.am9
-rw-r--r--map/mg/block.c298
-rw-r--r--map/mg/map.c609
-rw-r--r--map/mg/mg.h372
-rw-r--r--map/mg/poly.c265
-rw-r--r--map/mg/street.c1389
-rw-r--r--map/mg/town.c286
-rw-r--r--map/mg/tree.c282
-rw-r--r--map/poi_geodownload/Makefile.am7
-rw-r--r--map/poi_geodownload/libmdb/Makefile.am (renamed from navit/data/poi_geodownload/libmdb/Makefile.am)0
-rw-r--r--map/poi_geodownload/libmdb/backend.c (renamed from navit/data/poi_geodownload/libmdb/backend.c)0
-rw-r--r--map/poi_geodownload/libmdb/catalog.c (renamed from navit/data/poi_geodownload/libmdb/catalog.c)0
-rw-r--r--map/poi_geodownload/libmdb/data.c858
-rw-r--r--map/poi_geodownload/libmdb/dump.c41
-rw-r--r--map/poi_geodownload/libmdb/file.c379
-rw-r--r--map/poi_geodownload/libmdb/iconv.c63
-rw-r--r--map/poi_geodownload/libmdb/include/Makefile.am (renamed from navit/data/poi_geodownload/libmdb/include/Makefile.am)0
-rw-r--r--map/poi_geodownload/libmdb/include/mdbtools.h544
-rw-r--r--map/poi_geodownload/libmdb/index.c907
-rw-r--r--map/poi_geodownload/libmdb/kkd.c151
-rw-r--r--map/poi_geodownload/libmdb/like.c (renamed from navit/data/poi_geodownload/libmdb/like.c)0
-rw-r--r--map/poi_geodownload/libmdb/map.c133
-rw-r--r--map/poi_geodownload/libmdb/mem.c (renamed from navit/data/poi_geodownload/libmdb/mem.c)0
-rw-r--r--map/poi_geodownload/libmdb/money.c140
-rw-r--r--map/poi_geodownload/libmdb/options.c86
-rw-r--r--map/poi_geodownload/libmdb/props.c127
-rw-r--r--map/poi_geodownload/libmdb/sargs.c273
-rw-r--r--map/poi_geodownload/libmdb/stats.c (renamed from navit/data/poi_geodownload/libmdb/stats.c)0
-rw-r--r--map/poi_geodownload/libmdb/table.c370
-rw-r--r--map/poi_geodownload/libmdb/worktable.c (renamed from navit/data/poi_geodownload/libmdb/worktable.c)0
-rw-r--r--map/poi_geodownload/libmdb/write.c883
-rw-r--r--map/poi_geodownload/poi_geodownload.c775
-rw-r--r--map/shapefile/Makefile.am9
-rw-r--r--map/shapefile/dbfopen.c1871
-rw-r--r--map/shapefile/shapefil.h609
-rw-r--r--map/shapefile/shapefile.c748
-rw-r--r--map/shapefile/shpopen.c2284
-rw-r--r--map/shapefile/shptree.c1047
-rw-r--r--map/textfile/Makefile.am9
-rw-r--r--map/textfile/textfile.c405
-rw-r--r--map/textfile/textfile.h51
-rw-r--r--map_data.h54
-rw-r--r--maps/Makefile.am25
-rw-r--r--mapset.c275
-rw-r--r--mapset.h41
-rw-r--r--maptype.c51
-rw-r--r--maptype.h40
-rw-r--r--menu.c47
-rw-r--r--menu.h49
-rw-r--r--messages.c155
-rw-r--r--messages.h41
-rw-r--r--navigation.c2156
-rw-r--r--navigation.h49
-rw-r--r--navit.c2252
-rw-r--r--navit.dtd93
-rw-r--r--navit.h111
-rw-r--r--navit.xml4490
-rw-r--r--navit/Makefile.am43
-rw-r--r--navit/attr.c248
-rw-r--r--navit/attr.h80
-rw-r--r--navit/attr_def.h137
-rw-r--r--navit/binding/Makefile.am10
-rw-r--r--navit/binding/dbus/Makefile.am5
-rw-r--r--navit/binding/dbus/binding_dbus.c267
-rw-r--r--navit/binding/dbus/navit.introspect16
-rwxr-xr-xnavit/binding/dbus/test.py11
-rw-r--r--navit/binding/python/Makefile.am5
-rw-r--r--navit/binding/python/binding_python.c283
-rw-r--r--navit/callback.c173
-rw-r--r--navit/callback.h130
-rw-r--r--navit/color.h8
-rw-r--r--navit/compass.c137
-rw-r--r--navit/compass.h7
-rw-r--r--navit/coord.c251
-rw-r--r--navit/coord.h57
-rw-r--r--navit/country.c413
-rw-r--r--navit/country.h22
-rw-r--r--navit/cursor.c167
-rw-r--r--navit/cursor.h14
-rw-r--r--navit/data.h66
-rw-r--r--navit/data/Makefile.am8
-rw-r--r--navit/data/binfile/Makefile.am4
-rw-r--r--navit/data/binfile/binfile.c645
-rw-r--r--navit/data/garmin/Makefile.am25
-rw-r--r--navit/data/garmin/gar2navit.c291
-rw-r--r--navit/data/garmin/gar2navit.h31
-rw-r--r--navit/data/garmin/garmin.c794
-rw-r--r--navit/data/garmin/garmin.h10
-rw-r--r--navit/data/garmin/garmintypes.txt412
-rw-r--r--navit/data/garmin/gentypes.c195
-rw-r--r--navit/data/garmin_img/Makefile.am4
-rw-r--r--navit/data/garmin_img/garmin_img.c1493
-rw-r--r--navit/data/mg/Makefile.am4
-rw-r--r--navit/data/mg/block.c267
-rw-r--r--navit/data/mg/map.c466
-rw-r--r--navit/data/mg/mg.h295
-rw-r--r--navit/data/mg/poly.c241
-rw-r--r--navit/data/mg/street.c728
-rw-r--r--navit/data/mg/town.c264
-rw-r--r--navit/data/mg/tree.c244
-rw-r--r--navit/data/poi_geodownload/Makefile.am6
-rw-r--r--navit/data/poi_geodownload/libmdb/data.c856
-rw-r--r--navit/data/poi_geodownload/libmdb/dump.c39
-rw-r--r--navit/data/poi_geodownload/libmdb/file.c376
-rw-r--r--navit/data/poi_geodownload/libmdb/iconv.c63
-rw-r--r--navit/data/poi_geodownload/libmdb/include/mdbtools.h536
-rw-r--r--navit/data/poi_geodownload/libmdb/index.c905
-rw-r--r--navit/data/poi_geodownload/libmdb/kkd.c149
-rw-r--r--navit/data/poi_geodownload/libmdb/map.c133
-rw-r--r--navit/data/poi_geodownload/libmdb/money.c139
-rw-r--r--navit/data/poi_geodownload/libmdb/options.c86
-rw-r--r--navit/data/poi_geodownload/libmdb/props.c127
-rw-r--r--navit/data/poi_geodownload/libmdb/sargs.c273
-rw-r--r--navit/data/poi_geodownload/libmdb/table.c368
-rw-r--r--navit/data/poi_geodownload/libmdb/write.c878
-rw-r--r--navit/data/poi_geodownload/poi_geodownload.c756
-rw-r--r--navit/data/textfile/Makefile.am4
-rw-r--r--navit/data/textfile/textfile.c377
-rw-r--r--navit/data/textfile/textfile.h31
-rw-r--r--navit/data_window.c22
-rw-r--r--navit/data_window.h25
-rw-r--r--navit/data_window_int.h12
-rw-r--r--navit/debug.c100
-rw-r--r--navit/debug.h28
-rw-r--r--navit/destination.h10
-rw-r--r--navit/draw_info.h11
-rw-r--r--navit/endianess.h34
-rw-r--r--navit/event.c19
-rw-r--r--navit/event.h2
-rw-r--r--navit/file.c469
-rw-r--r--navit/file.h49
-rw-r--r--navit/graphics.c1021
-rw-r--r--navit/graphics.h146
-rw-r--r--navit/graphics/Makefile.am11
-rw-r--r--navit/graphics/gtk_drawing_area/Makefile.am5
-rw-r--r--navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c916
-rw-r--r--navit/graphics/gtk_gl_ext/graphics_gtk_gl_ext.c333
-rw-r--r--navit/graphics/null/Makefile.am4
-rw-r--r--navit/graphics/null/graphics_null.c208
-rw-r--r--navit/graphics/opengl/Makefile.am5
-rw-r--r--navit/graphics/opengl/graphics_opengl.c826
-rw-r--r--navit/graphics/qt_qpainter/Makefile.am5
-rw-r--r--navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp682
-rw-r--r--navit/graphics/win32/Makefile.am4
-rw-r--r--navit/graphics/win32/graphics_win32.c794
-rw-r--r--navit/graphics/win32/win32_gui.h75
-rw-r--r--navit/graphics/win32/xpm2bmp.c589
-rw-r--r--navit/gtkext.h6
-rw-r--r--navit/gui.c127
-rw-r--r--navit/gui.h46
-rw-r--r--navit/gui/Makefile.am8
-rw-r--r--navit/gui/gtk/Makefile.am5
-rw-r--r--navit/gui/gtk/datawindow.c171
-rw-r--r--navit/gui/gtk/destination.c505
-rw-r--r--navit/gui/gtk/gui_gtk.h36
-rw-r--r--navit/gui/gtk/gui_gtk_action.c569
-rw-r--r--navit/gui/gtk/gui_gtk_statusbar.c162
-rw-r--r--navit/gui/gtk/gui_gtk_window.c564
-rw-r--r--navit/gui/internal/Makefile.am5
-rw-r--r--navit/gui/internal/gui_internal.c407
-rw-r--r--navit/gui/sdl/Makefile.am6
-rw-r--r--navit/gui/sdl/cegui_keyboard.cpp94
-rw-r--r--navit/gui/sdl/cegui_keyboard.h5
-rw-r--r--navit/gui/sdl/datafiles/Makefile.am20
-rwxr-xr-xnavit/gui/sdl/datafiles/fonts/DejaVuSans-10.font2
-rwxr-xr-xnavit/gui/sdl/datafiles/fonts/DejaVuSans-12.font2
-rwxr-xr-xnavit/gui/sdl/datafiles/fonts/DejaVuSans-14.font2
-rwxr-xr-xnavit/gui/sdl/datafiles/fonts/DejaVuSans.ttfbin407768 -> 0 bytes
-rw-r--r--navit/gui/sdl/datafiles/fonts/Font.xsd34
-rw-r--r--navit/gui/sdl/datafiles/imagesets/Imageset.xsd28
-rw-r--r--navit/gui/sdl/datafiles/imagesets/Mineque-Black.imageset37
-rwxr-xr-xnavit/gui/sdl/datafiles/imagesets/TaharezLook.imageset242
-rwxr-xr-xnavit/gui/sdl/datafiles/imagesets/TaharezLook.tgabin63621 -> 0 bytes
-rw-r--r--navit/gui/sdl/datafiles/imagesets/navit-skin-black-imageset.tgabin190107 -> 0 bytes
-rw-r--r--navit/gui/sdl/datafiles/layouts/GUILayout.xsd63
-rw-r--r--navit/gui/sdl/datafiles/layouts/Mineque.layout258
-rwxr-xr-xnavit/gui/sdl/datafiles/layouts/TaharezLook.layout260
-rw-r--r--navit/gui/sdl/datafiles/looknfeel/Falagard.xsd399
-rwxr-xr-xnavit/gui/sdl/datafiles/looknfeel/Mineque.looknfeel1476
-rwxr-xr-xnavit/gui/sdl/datafiles/looknfeel/TaharezLook.looknfeel4534
-rw-r--r--navit/gui/sdl/datafiles/schemes/GUIScheme.xsd54
-rwxr-xr-xnavit/gui/sdl/datafiles/schemes/Mineque.scheme67
-rwxr-xr-xnavit/gui/sdl/datafiles/schemes/TaharezLook.scheme47
-rw-r--r--navit/gui/sdl/gui_sdl.h20
-rw-r--r--navit/gui/sdl/gui_sdl_window.cpp903
-rw-r--r--navit/gui/sdl/sdl_events.cpp810
-rw-r--r--navit/gui/sdl/sdl_events.h40
-rw-r--r--navit/gui/sdl/wmcontrol.c1252
-rw-r--r--navit/gui/sdl/wmcontrol.h7
-rw-r--r--navit/gui/win32/Makefile.am5
-rw-r--r--navit/gui/win32/gui_win32.c549
-rw-r--r--navit/gui/win32/gui_win32.h75
-rw-r--r--navit/gui/win32/win32_gui.h75
-rw-r--r--navit/gui/win32/win32_gui_destination.c407
-rw-r--r--navit/gui/win32/win32_gui_notify.c132
-rw-r--r--navit/item.c153
-rw-r--r--navit/item.h70
-rw-r--r--navit/item_def.h406
-rw-r--r--navit/layer.h12
-rw-r--r--navit/layout.c139
-rw-r--r--navit/layout.h70
-rw-r--r--navit/log.c272
-rw-r--r--navit/log.h15
-rw-r--r--navit/main.c281
-rw-r--r--navit/main.h17
-rw-r--r--navit/map-share.h8
-rw-r--r--navit/map.c250
-rw-r--r--navit/map.h157
-rw-r--r--navit/map_data.h35
-rw-r--r--navit/maps/Makefile.am23
-rw-r--r--navit/mapset.c120
-rw-r--r--navit/mapset.h22
-rw-r--r--navit/maptype.c30
-rw-r--r--navit/maptype.h21
-rw-r--r--navit/menu.c28
-rw-r--r--navit/menu.h30
-rw-r--r--navit/navigation.c986
-rw-r--r--navit/navigation.h29
-rw-r--r--navit/navit.c1655
-rw-r--r--navit/navit.dtd77
-rw-r--r--navit/navit.h80
-rw-r--r--navit/navit.xml2416
-rw-r--r--navit/osd.c100
-rw-r--r--navit/osd.h16
-rw-r--r--navit/osd/core/Makefile.am4
-rw-r--r--navit/osd/core/osd_core.c578
-rw-r--r--navit/osm2navit.c2444
-rw-r--r--navit/param.c46
-rw-r--r--navit/param.h15
-rw-r--r--navit/phrase.c34
-rw-r--r--navit/phrase.h8
-rw-r--r--navit/plugin.c200
-rw-r--r--navit/plugin.h137
-rw-r--r--navit/plugin_def.h11
-rw-r--r--navit/point.h13
-rw-r--r--navit/popup.c260
-rw-r--r--navit/popup.h8
-rw-r--r--navit/profile.c43
-rw-r--r--navit/profile.h17
-rw-r--r--navit/projection.c43
-rw-r--r--navit/projection.h16
-rw-r--r--navit/route.c1780
-rw-r--r--navit/route.h84
-rwxr-xr-xnavit/script/check_itemdef26
-rwxr-xr-xnavit/script/wiki2def37
-rw-r--r--navit/search.c332
-rw-r--r--navit/search.h52
-rw-r--r--navit/speech.c41
-rw-r--r--navit/speech.h19
-rw-r--r--navit/speech/Makefile.am4
-rw-r--r--navit/speech/cmdline/Makefile.am4
-rw-r--r--navit/speech/cmdline/speech_cmdline.c47
-rw-r--r--navit/speech/speech_dispatcher/Makefile.am6
-rw-r--r--navit/speech/speech_dispatcher/speech_speech_dispatcher.c67
-rw-r--r--navit/tools/gpx2navit_txt/README117
-rw-r--r--navit/tools/gpx2navit_txt/src/elementControl.c226
-rw-r--r--navit/tools/gpx2navit_txt/src/emess.h32
-rw-r--r--navit/tools/gpx2navit_txt/src/errorcode.h22
-rw-r--r--navit/tools/gpx2navit_txt/src/geod_for.c108
-rw-r--r--navit/tools/gpx2navit_txt/src/geod_inv.c73
-rw-r--r--navit/tools/gpx2navit_txt/src/geod_set.c95
-rw-r--r--navit/tools/gpx2navit_txt/src/geodesic.h51
-rw-r--r--navit/tools/gpx2navit_txt/src/gpx2navit_txt.h273
-rw-r--r--navit/tools/gpx2navit_txt/src/main.c389
-rw-r--r--navit/tools/gpx2navit_txt/src/misc.c344
-rw-r--r--navit/tools/gpx2navit_txt/src/parser.c148
-rw-r--r--navit/tools/gpx2navit_txt/src/setmeta.c54
-rw-r--r--navit/tools/gpx2navit_txt/src/setpath.c241
-rw-r--r--navit/tools/gpx2navit_txt/src/setwpt.c52
-rw-r--r--navit/tools/gpx2navit_txt/src/utils.c199
-rw-r--r--navit/track.c318
-rw-r--r--navit/track.h26
-rw-r--r--navit/transform.c747
-rw-r--r--navit/transform.h48
-rw-r--r--navit/types.h12
-rw-r--r--navit/util.c55
-rw-r--r--navit/util.h51
-rw-r--r--navit/vehicle.c197
-rw-r--r--navit/vehicle.h32
-rw-r--r--navit/vehicle/Makefile.am4
-rw-r--r--navit/vehicle/demo/Makefile.am4
-rw-r--r--navit/vehicle/demo/vehicle_demo.c176
-rw-r--r--navit/vehicle/file/Makefile.am4
-rw-r--r--navit/vehicle/file/vehicle_file.c500
-rw-r--r--navit/vehicle/gpsd/Makefile.am5
-rw-r--r--navit/vehicle/gpsd/vehicle_gpsd.c285
-rw-r--r--navit/xmlconfig.c1097
-rw-r--r--navit/xmlconfig.h8
-rw-r--r--navit/xpm/Makefile.am8
-rw-r--r--navit/xpm/airport.xpm75
-rw-r--r--navit/xpm/attraction.xpm141
-rw-r--r--navit/xpm/bar.xpm52
-rw-r--r--navit/xpm/bus.xpm165
-rw-r--r--navit/xpm/cafe.xpm25
-rw-r--r--navit/xpm/camping.xpm24
-rw-r--r--navit/xpm/car_dealer.xpm26
-rw-r--r--navit/xpm/church.xpm24
-rw-r--r--navit/xpm/golf.xpm275
-rw-r--r--navit/xpm/heliport.xpm19
-rw-r--r--navit/xpm/information.xpm70
-rw-r--r--navit/xpm/level_crossing.xpm16
-rw-r--r--navit/xpm/picnic.xpm66
-rw-r--r--navit/xpm/skiing.xpm139
-rw-r--r--navit/xpm/sports.xpm95
-rw-r--r--navit/xpm/zoo.xpm40
-rw-r--r--navit/zipfile.h55
-rw-r--r--navit_nls.h23
-rw-r--r--osd.c301
-rw-r--r--osd.h68
-rw-r--r--osd/Makefile.am (renamed from navit/osd/Makefile.am)0
-rw-r--r--osd/core/Makefile.am10
-rw-r--r--osd/core/osd_core.c1243
-rw-r--r--osm2navit.c3460
-rw-r--r--param.c65
-rw-r--r--param.h34
-rw-r--r--phrase.c53
-rw-r--r--phrase.h27
-rw-r--r--plugin.c358
-rw-r--r--plugin.h158
-rw-r--r--plugin_def.h32
-rw-r--r--po/Makefile.am76
-rw-r--r--po/cs.po1745
-rw-r--r--po/da.po1705
-rw-r--r--po/de.po1687
-rw-r--r--po/es.po1760
-rw-r--r--po/fi.po1740
-rw-r--r--po/fr.po1753
-rw-r--r--po/it.po1688
-rw-r--r--po/nl.po1710
-rw-r--r--po/no.po1677
-rw-r--r--po/pl.po1755
-rw-r--r--po/ru.po1711
-rw-r--r--po/sk.po1707
-rw-r--r--point.h32
-rw-r--r--popup.c352
-rw-r--r--popup.h27
-rw-r--r--profile.c62
-rw-r--r--profile.h36
-rw-r--r--projection.c73
-rw-r--r--projection.h36
-rw-r--r--projs/CodeBlocks/.cvsignore15
-rw-r--r--projs/CodeBlocks/Gpx2Navit.cbp127
-rw-r--r--projs/CodeBlocks/LiberationMono-Regular.ttfbin61144 -> 0 bytes
-rw-r--r--projs/CodeBlocks/Navit.cbp300
-rw-r--r--projs/CodeBlocks/Navit.new.cbp256
-rw-r--r--projs/CodeBlocks/Navit.workspace56
-rw-r--r--projs/CodeBlocks/NavitCommonLib.cbp75
-rw-r--r--projs/CodeBlocks/NavitCore.cbp258
-rw-r--r--projs/CodeBlocks/Navit_gtk.cbp130
-rw-r--r--projs/CodeBlocks/Navit_no_plugin.cbp87
-rw-r--r--projs/CodeBlocks/Navit_win32.cbp184
-rw-r--r--projs/CodeBlocks/Osm2Navit.cbp123
-rw-r--r--projs/CodeBlocks/Win32Extra/LiberationSans-Regular.ttfbin110660 -> 0 bytes
-rw-r--r--projs/CodeBlocks/Win32Extra/X11/XF86keysym.h189
-rw-r--r--projs/CodeBlocks/Win32Extra/builtin.c25
-rw-r--r--projs/CodeBlocks/Win32Extra/byteswap.h17
-rw-r--r--projs/CodeBlocks/Win32Extra/config.h417
-rw-r--r--projs/CodeBlocks/Win32Extra/endian.h5
-rw-r--r--projs/CodeBlocks/Win32Extra/libgarmin/libgarmin.abin453238 -> 0 bytes
-rw-r--r--projs/CodeBlocks/Win32Extra/libgarmin/libgarmin.h192
-rw-r--r--projs/CodeBlocks/Win32Extra/navit_gtk.c23
-rw-r--r--projs/CodeBlocks/Win32Extra/navit_win32.c25
-rw-r--r--projs/CodeBlocks/Win32Extra/serial_io.c122
-rw-r--r--projs/CodeBlocks/Win32Extra/serial_io.h9
-rw-r--r--projs/CodeBlocks/Win32Extra/setenv.c21
-rw-r--r--projs/CodeBlocks/Win32Extra/setenv.h9
-rw-r--r--projs/CodeBlocks/Win32Extra/speech_dispatcher_win32.c96
-rw-r--r--projs/CodeBlocks/Win32Extra/sys/mman.c184
-rw-r--r--projs/CodeBlocks/Win32Extra/wordexp.c53
-rw-r--r--projs/CodeBlocks/binfile.cbp89
-rw-r--r--projs/CodeBlocks/data_garmin.cbp74
-rw-r--r--projs/CodeBlocks/data_garmin_img.cbp68
-rw-r--r--projs/CodeBlocks/data_mg.cbp104
-rw-r--r--projs/CodeBlocks/data_poi_geodownload.cbp83
-rw-r--r--projs/CodeBlocks/data_textfile.cbp93
-rw-r--r--projs/CodeBlocks/fib-1.1.cbp63
-rw-r--r--projs/CodeBlocks/gentypes.cbp90
-rw-r--r--projs/CodeBlocks/gtk_gl_ext.cbp76
-rw-r--r--projs/CodeBlocks/gtk_graphics.cbp75
-rw-r--r--projs/CodeBlocks/gtk_gui.cbp82
-rw-r--r--projs/CodeBlocks/gui_sdl.cbp79
-rw-r--r--projs/CodeBlocks/libgarmin.cbp103
-rw-r--r--projs/CodeBlocks/make_builtin7
-rw-r--r--projs/CodeBlocks/makefile_extra134
-rw-r--r--projs/CodeBlocks/makefile_langfiles19
-rw-r--r--projs/CodeBlocks/mdb.cbp118
-rw-r--r--projs/CodeBlocks/navit.xml.distr1006
-rw-r--r--projs/CodeBlocks/speech_speech_dispatcher.cbp72
-rw-r--r--projs/CodeBlocks/vehicle_demo.cbp88
-rw-r--r--projs/CodeBlocks/vehicle_file.cbp88
-rw-r--r--projs/CodeBlocks/win32_gui.cbp87
-rw-r--r--projs/CodeBlocks/win32gui/resources/navit.icobin3310 -> 0 bytes
-rw-r--r--projs/CodeBlocks/win32gui/resources/resource.h4
-rw-r--r--projs/CodeBlocks/win32gui/win32_graphics.c788
-rw-r--r--projs/CodeBlocks/win32gui/win32_gui.c547
-rw-r--r--projs/CodeBlocks/win32gui/win32_gui.h75
-rw-r--r--projs/CodeBlocks/win32gui/win32_gui_destination.c405
-rw-r--r--projs/CodeBlocks/win32gui/win32_gui_notify.c130
-rw-r--r--projs/CodeBlocks/win32gui/win32_gui_notify.h18
-rw-r--r--projs/CodeBlocks/win32gui/window.c149
-rw-r--r--projs/CodeBlocks/win32gui/xpm2bmp.c589
-rw-r--r--projs/CodeBlocks/win32gui/xpm2bmp.h44
-rw-r--r--roadprofile.c79
-rw-r--r--roadprofile.h30
-rw-r--r--route.c3170
-rw-r--r--route.h133
-rwxr-xr-xscript/cabify.sh83
-rwxr-xr-xscript/check_itemdef42
-rw-r--r--script/download_index.html (renamed from navit/script/download_index.html)0
-rwxr-xr-xscript/gensvg266
-rwxr-xr-xscript/geotag (renamed from navit/script/geotag)0
-rwxr-xr-xscript/get_map (renamed from navit/script/get_map)0
-rwxr-xr-xscript/gps_emu (renamed from navit/script/gps_emu)0
-rwxr-xr-xscript/gps_emu2 (renamed from navit/script/gps_emu2)0
-rwxr-xr-xscript/gps_emu3 (renamed from navit/script/gps_emu3)0
-rwxr-xr-xscript/gps_emu4132
-rw-r--r--script/mapExtract.class.php (renamed from navit/script/mapExtract.class.php)0
-rw-r--r--script/map_index.php (renamed from navit/script/map_index.php)0
-rw-r--r--script/mapextract.php (renamed from navit/script/mapextract.php)0
-rwxr-xr-xscript/osm/border_follower.pl139
-rwxr-xr-xscript/osm/osmtool.pl126
-rw-r--r--script/osm2navit_sea/osm2navit_sea.pl1010
-rw-r--r--script/osm2navit_sea/way.pm121
-rwxr-xr-xscript/wiki2def60
-rw-r--r--search.c687
-rw-r--r--search.h88
-rw-r--r--speech.c134
-rw-r--r--speech.h41
-rw-r--r--speech/Makefile.am7
-rw-r--r--speech/cmdline/Makefile.am5
-rw-r--r--speech/cmdline/speech_cmdline.c128
-rw-r--r--speech/speech_dispatcher/Makefile.am6
-rw-r--r--speech/speech_dispatcher/speech_speech_dispatcher.c81
-rw-r--r--start.c187
-rwxr-xr-xstartonce.sh81
-rw-r--r--support/Makefile.am20
-rw-r--r--support/ezxml/Makefile.am4
-rw-r--r--support/ezxml/ezxml.c1015
-rw-r--r--support/ezxml/ezxml.h167
-rw-r--r--support/ezxml/ezxml_init.c6
-rw-r--r--support/glib/Makefile.am9
-rw-r--r--support/glib/fake.c5
-rw-r--r--support/glib/fake.h6
-rw-r--r--support/glib/galias.h (renamed from NEWS)0
-rw-r--r--support/glib/galiasdef.c0
-rw-r--r--support/glib/gatomic.c936
-rw-r--r--support/glib/gerror.c381
-rw-r--r--support/glib/gerror.h92
-rw-r--r--support/glib/ghash.c1202
-rw-r--r--support/glib/ghash.h145
-rw-r--r--support/glib/glib.h40
-rw-r--r--support/glib/glib_init.c6
-rw-r--r--support/glib/glibconfig.h264
-rw-r--r--support/glib/glibintl.h39
-rw-r--r--support/glib/glist.c999
-rw-r--r--support/glib/glist.h120
-rw-r--r--support/glib/gmacros.h273
-rw-r--r--support/glib/gmem.c742
-rw-r--r--support/glib/gmem.h152
-rw-r--r--support/glib/gmessages.c1126
-rw-r--r--support/glib/gmessages.h341
-rw-r--r--support/glib/gprimes.c90
-rw-r--r--support/glib/gprintf.c342
-rw-r--r--support/glib/gprintf.h52
-rw-r--r--support/glib/gprintfint.h59
-rw-r--r--support/glib/gquark.h52
-rw-r--r--support/glib/gslice.c1493
-rw-r--r--support/glib/gslice.h90
-rw-r--r--support/glib/gstrfuncs.c3125
-rw-r--r--support/glib/gstrfuncs.h266
-rw-r--r--support/glib/gstring.c1488
-rw-r--r--support/glib/gthreadprivate.h68
-rw-r--r--support/glib/gtypes.h432
-rw-r--r--support/glib/gunicode.h404
-rw-r--r--support/glib/gutf8.c1866
-rw-r--r--support/glib/gutils.c3416
-rw-r--r--support/libc/Makefile.am4
-rw-r--r--support/libc/errno.h4
-rw-r--r--support/libc/libc.c158
-rw-r--r--support/libc/libc_init.c6
-rw-r--r--support/libc/locale.h12
-rw-r--r--support/libc/signal.h2
-rw-r--r--support/win32/ConvertUTF.c539
-rw-r--r--support/win32/ConvertUTF.h149
-rw-r--r--support/win32/Makefile.am4
-rw-r--r--support/win32/mmap.c43
-rw-r--r--support/win32/sys/mman.h (renamed from projs/CodeBlocks/Win32Extra/sys/mman.h)0
-rw-r--r--support/win32/win32_init.c6
-rw-r--r--support/wordexp/Makefile.am4
-rw-r--r--support/wordexp/glob.c108
-rw-r--r--support/wordexp/glob.h19
-rw-r--r--support/wordexp/wordexp.c134
-rw-r--r--support/wordexp/wordexp.h (renamed from projs/CodeBlocks/Win32Extra/wordexp.h)0
-rw-r--r--support/wordexp/wordexp_init.c6
-rw-r--r--support/zlib/Makefile.am4
-rw-r--r--support/zlib/adler32.c149
-rw-r--r--support/zlib/crc32.c423
-rw-r--r--support/zlib/crc32.h441
-rw-r--r--support/zlib/infback.c623
-rw-r--r--support/zlib/inffast.c318
-rw-r--r--support/zlib/inffast.h11
-rw-r--r--support/zlib/inffixed.h94
-rw-r--r--support/zlib/inflate.c1368
-rw-r--r--support/zlib/inflate.h115
-rw-r--r--support/zlib/inftrees.c329
-rw-r--r--support/zlib/inftrees.h55
-rw-r--r--support/zlib/zconf.h332
-rw-r--r--support/zlib/zlib.h1357
-rw-r--r--support/zlib/zlib_init.c6
-rw-r--r--support/zlib/zutil.c318
-rw-r--r--support/zlib/zutil.h269
-rwxr-xr-xtools/asc2navit135
-rwxr-xr-xtools/cleanattr.sh50
-rw-r--r--tools/gpx2navit_txt/AUTHORS (renamed from navit/tools/gpx2navit_txt/AUTHORS)0
-rw-r--r--tools/gpx2navit_txt/COPYING (renamed from navit/tools/gpx2navit_txt/COPYING)0
-rw-r--r--tools/gpx2navit_txt/ChangeLog (renamed from navit/tools/gpx2navit_txt/ChangeLog)0
-rw-r--r--tools/gpx2navit_txt/INSTALL (renamed from navit/tools/gpx2navit_txt/INSTALL)0
-rw-r--r--tools/gpx2navit_txt/Makefile.am (renamed from navit/tools/gpx2navit_txt/Makefile.am)0
-rw-r--r--tools/gpx2navit_txt/NEWS (renamed from navit/tools/gpx2navit_txt/NEWS)0
-rw-r--r--tools/gpx2navit_txt/README122
-rw-r--r--tools/gpx2navit_txt/TODO (renamed from navit/tools/gpx2navit_txt/TODO)0
-rwxr-xr-xtools/gpx2navit_txt/autogen.sh (renamed from autogen.sh)0
-rw-r--r--tools/gpx2navit_txt/config.guess (renamed from navit/tools/gpx2navit_txt/config.guess)0
-rw-r--r--tools/gpx2navit_txt/config.sub (renamed from navit/tools/gpx2navit_txt/config.sub)0
-rw-r--r--tools/gpx2navit_txt/configure.ac (renamed from navit/tools/gpx2navit_txt/configure.ac)0
-rwxr-xr-xtools/gpx2navit_txt/depcomp (renamed from navit/tools/gpx2navit_txt/depcomp)0
-rw-r--r--tools/gpx2navit_txt/develop/structures.gif (renamed from navit/tools/gpx2navit_txt/develop/structures.gif)bin39033 -> 39033 bytes
-rwxr-xr-xtools/gpx2navit_txt/install-sh (renamed from navit/tools/gpx2navit_txt/install-sh)0
-rw-r--r--tools/gpx2navit_txt/man/Makefile.am (renamed from navit/tools/gpx2navit_txt/man/Makefile.am)0
-rw-r--r--tools/gpx2navit_txt/man/gpx2navit_txt.1 (renamed from navit/tools/gpx2navit_txt/man/gpx2navit_txt.1)0
-rwxr-xr-xtools/gpx2navit_txt/missing (renamed from navit/tools/gpx2navit_txt/missing)0
-rwxr-xr-xtools/gpx2navit_txt/mkinstalldirs (renamed from navit/tools/gpx2navit_txt/mkinstalldirs)0
-rw-r--r--tools/gpx2navit_txt/pinatest2.gpx (renamed from navit/tools/gpx2navit_txt/pinatest2.gpx)0
-rw-r--r--tools/gpx2navit_txt/src/Makefile.am (renamed from navit/tools/gpx2navit_txt/src/Makefile.am)0
-rw-r--r--tools/gpx2navit_txt/src/config.h.in (renamed from navit/tools/gpx2navit_txt/src/config.h.in)0
-rw-r--r--tools/gpx2navit_txt/src/elementControl.c245
-rw-r--r--tools/gpx2navit_txt/src/emess.h51
-rw-r--r--tools/gpx2navit_txt/src/errorcode.h41
-rw-r--r--tools/gpx2navit_txt/src/geod_for.c127
-rw-r--r--tools/gpx2navit_txt/src/geod_inv.c92
-rw-r--r--tools/gpx2navit_txt/src/geod_set.c114
-rw-r--r--tools/gpx2navit_txt/src/geodesic.h70
-rw-r--r--tools/gpx2navit_txt/src/gpx2navit_txt.h292
-rw-r--r--tools/gpx2navit_txt/src/main.c408
-rw-r--r--tools/gpx2navit_txt/src/misc.c363
-rw-r--r--tools/gpx2navit_txt/src/parser.c167
-rw-r--r--tools/gpx2navit_txt/src/setmeta.c73
-rw-r--r--tools/gpx2navit_txt/src/setpath.c260
-rw-r--r--tools/gpx2navit_txt/src/setwpt.c71
-rw-r--r--tools/gpx2navit_txt/src/utils.c218
-rw-r--r--tools/latlon2bookmark/Makefile5
-rw-r--r--tools/latlon2bookmark/latlon2bookmark.c140
-rw-r--r--track.c1006
-rw-r--r--track.h60
-rw-r--r--transform.c1287
-rw-r--r--transform.h98
-rw-r--r--types.h31
-rw-r--r--util.c314
-rw-r--r--util.h40
-rw-r--r--vehicle.c245
-rw-r--r--vehicle.h51
-rw-r--r--vehicle/Makefile.am16
-rw-r--r--vehicle/demo/Makefile.am5
-rw-r--r--vehicle/demo/vehicle_demo.c206
-rw-r--r--vehicle/file/Makefile.am9
-rw-r--r--vehicle/file/vehicle_file.c763
-rw-r--r--vehicle/file/vehicle_pipe.c27
-rw-r--r--vehicle/gpsd/Makefile.am6
-rw-r--r--vehicle/gpsd/vehicle_gpsd.c387
-rw-r--r--vehicle/gypsy/Makefile.am6
-rw-r--r--vehicle/gypsy/vehicle_gypsy.c465
-rw-r--r--vehicle/wince/Makefile.am5
-rw-r--r--vehicle/wince/vehicle_wince.c614
-rw-r--r--vehicleprofile.c127
-rw-r--r--vehicleprofile.h41
-rw-r--r--window.h24
-rw-r--r--xmlconfig.c922
-rw-r--r--xmlconfig.h42
-rw-r--r--xpm/Makefile.am221
-rw-r--r--xpm/airport.svg112
-rw-r--r--xpm/airport.xpm63
-rw-r--r--xpm/attraction.svg108
-rw-r--r--xpm/attraction.xpm22
-rw-r--r--xpm/bank.svg193
-rw-r--r--xpm/bank.xpm (renamed from navit/xpm/bank.xpm)0
-rw-r--r--xpm/bar.svg139
-rw-r--r--xpm/bar.xpm21
-rw-r--r--xpm/bench.xpm21
-rw-r--r--xpm/biergarten.xpm111
-rw-r--r--xpm/boat_ramp.svg94
-rw-r--r--xpm/boat_ramp.xpm (renamed from navit/xpm/boat_ramp.xpm)0
-rw-r--r--xpm/boundary_stone.xpm39
-rw-r--r--xpm/bus.svg198
-rw-r--r--xpm/bus.xpm21
-rw-r--r--xpm/bus_halt.xpm51
-rw-r--r--xpm/cafe.xpm21
-rw-r--r--xpm/camping.xpm22
-rw-r--r--xpm/car_dealer.xpm23
-rw-r--r--xpm/castle.xpm22
-rw-r--r--xpm/cemetery.xpm27
-rw-r--r--xpm/church.svg149
-rw-r--r--xpm/church.xpm23
-rw-r--r--xpm/cinema.svg130
-rw-r--r--xpm/cinema.xpm (renamed from navit/xpm/cinema.xpm)0
-rw-r--r--xpm/country_.svgzbin0 -> 2167 bytes
-rw-r--r--xpm/country_AD.svgzbin0 -> 16542 bytes
-rw-r--r--xpm/country_AE.svgzbin0 -> 321 bytes
-rw-r--r--xpm/country_AF.svgzbin0 -> 46096 bytes
-rw-r--r--xpm/country_AG.svgzbin0 -> 613 bytes
-rw-r--r--xpm/country_AI.svgzbin0 -> 1952 bytes
-rw-r--r--xpm/country_AL.svgzbin0 -> 5624 bytes
-rw-r--r--xpm/country_AM.svgzbin0 -> 320 bytes
-rw-r--r--xpm/country_AN.svgzbin0 -> 494 bytes
-rw-r--r--xpm/country_AO.svgzbin0 -> 2264 bytes
-rw-r--r--xpm/country_AQ.svgzbin0 -> 680 bytes
-rw-r--r--xpm/country_AR.svgzbin0 -> 1170 bytes
-rw-r--r--xpm/country_AS.svgzbin0 -> 8267 bytes
-rw-r--r--xpm/country_AT.svgzbin0 -> 258 bytes
-rw-r--r--xpm/country_AU.svgzbin0 -> 1449 bytes
-rw-r--r--xpm/country_AW.svgzbin0 -> 641 bytes
-rw-r--r--xpm/country_AX.svgzbin0 -> 319 bytes
-rw-r--r--xpm/country_AZ.svgzbin0 -> 645 bytes
-rw-r--r--xpm/country_BA.svgzbin0 -> 708 bytes
-rw-r--r--xpm/country_BB.svgzbin0 -> 1744 bytes
-rw-r--r--xpm/country_BD.svgzbin0 -> 294 bytes
-rw-r--r--xpm/country_BE.svgzbin0 -> 304 bytes
-rw-r--r--xpm/country_BF.svgzbin0 -> 378 bytes
-rw-r--r--xpm/country_BG.svgzbin0 -> 341 bytes
-rw-r--r--xpm/country_BH.svgzbin0 -> 346 bytes
-rw-r--r--xpm/country_BI.svgzbin0 -> 632 bytes
-rw-r--r--xpm/country_BJ.svgzbin0 -> 299 bytes
-rw-r--r--xpm/country_BL.svgzbin0 -> 273 bytes
-rw-r--r--xpm/country_BM.svgzbin0 -> 37210 bytes
-rw-r--r--xpm/country_BN.svgzbin0 -> 12559 bytes
-rw-r--r--xpm/country_BO.svgzbin0 -> 848 bytes
-rw-r--r--xpm/country_BR.svgzbin0 -> 1765 bytes
-rw-r--r--xpm/country_BS.svgzbin0 -> 404 bytes
-rw-r--r--xpm/country_BT.svgzbin0 -> 24770 bytes
-rw-r--r--xpm/country_BV.svgzbin0 -> 282 bytes
-rw-r--r--xpm/country_BW.svgzbin0 -> 309 bytes
-rw-r--r--xpm/country_BY.svgzbin0 -> 2215 bytes
-rw-r--r--xpm/country_BZ.svgzbin0 -> 66107 bytes
-rw-r--r--xpm/country_CA.svgzbin0 -> 835 bytes
-rw-r--r--xpm/country_CC.svgzbin0 -> 5345 bytes
-rw-r--r--xpm/country_CD.svgzbin0 -> 679 bytes
-rw-r--r--xpm/country_CF.svgzbin0 -> 609 bytes
-rw-r--r--xpm/country_CG.svgzbin0 -> 315 bytes
-rw-r--r--xpm/country_CH.svgzbin0 -> 375 bytes
-rw-r--r--xpm/country_CI.svgzbin0 -> 274 bytes
-rw-r--r--xpm/country_CK.svgzbin0 -> 882 bytes
-rw-r--r--xpm/country_CL.svgzbin0 -> 430 bytes
-rw-r--r--xpm/country_CM.svgzbin0 -> 468 bytes
-rw-r--r--xpm/country_CN.svgzbin0 -> 1145 bytes
-rw-r--r--xpm/country_CO.svgzbin0 -> 210 bytes
-rw-r--r--xpm/country_CR.svgzbin0 -> 296 bytes
-rw-r--r--xpm/country_CU.svgzbin0 -> 639 bytes
-rw-r--r--xpm/country_CV.svgzbin0 -> 912 bytes
-rw-r--r--xpm/country_CX.svgzbin0 -> 3919 bytes
-rw-r--r--xpm/country_CY.svgzbin0 -> 2522 bytes
-rw-r--r--xpm/country_CZ.svgzbin0 -> 422 bytes
-rw-r--r--xpm/country_DE.svgzbin0 -> 325 bytes
-rw-r--r--xpm/country_DJ.svgzbin0 -> 1175 bytes
-rw-r--r--xpm/country_DK.svgzbin0 -> 308 bytes
-rw-r--r--xpm/country_DM.svgzbin0 -> 7038 bytes
-rw-r--r--xpm/country_DO.svgzbin0 -> 26339 bytes
-rw-r--r--xpm/country_DZ.svgzbin0 -> 511 bytes
-rw-r--r--xpm/country_EC.svgzbin0 -> 61120 bytes
-rw-r--r--xpm/country_EE.svgzbin0 -> 207 bytes
-rw-r--r--xpm/country_EG.svgzbin0 -> 5583 bytes
-rw-r--r--xpm/country_EH.svgzbin0 -> 622 bytes
-rw-r--r--xpm/country_ER.svgzbin0 -> 5002 bytes
-rw-r--r--xpm/country_ES.svgzbin0 -> 52198 bytes
-rw-r--r--xpm/country_ET.svgzbin0 -> 931 bytes
-rw-r--r--xpm/country_FI.svgzbin0 -> 319 bytes
-rw-r--r--xpm/country_FJ.svgzbin0 -> 14167 bytes
-rw-r--r--xpm/country_FK.svgzbin0 -> 24773 bytes
-rw-r--r--xpm/country_FM.svgzbin0 -> 435 bytes
-rw-r--r--xpm/country_FO.svgzbin0 -> 320 bytes
-rw-r--r--xpm/country_FR.svgzbin0 -> 273 bytes
-rw-r--r--xpm/country_GA.svgzbin0 -> 284 bytes
-rw-r--r--xpm/country_GB.svgzbin0 -> 628 bytes
-rw-r--r--xpm/country_GD.svgzbin0 -> 1375 bytes
-rw-r--r--xpm/country_GE.svgzbin0 -> 537 bytes
-rw-r--r--xpm/country_GF.svgzbin0 -> 273 bytes
-rw-r--r--xpm/country_GG.svgzbin0 -> 346 bytes
-rw-r--r--xpm/country_GH.svgzbin0 -> 411 bytes
-rw-r--r--xpm/country_GI.svgzbin0 -> 6046 bytes
-rw-r--r--xpm/country_GL.svgzbin0 -> 361 bytes
-rw-r--r--xpm/country_GM.svgzbin0 -> 809 bytes
-rw-r--r--xpm/country_GN.svgzbin0 -> 210 bytes
-rw-r--r--xpm/country_GP.svgzbin0 -> 273 bytes
-rw-r--r--xpm/country_GQ.svgzbin0 -> 12153 bytes
-rw-r--r--xpm/country_GR.svgzbin0 -> 949 bytes
-rw-r--r--xpm/country_GS.svgzbin0 -> 27699 bytes
-rw-r--r--xpm/country_GT.svgzbin0 -> 37657 bytes
-rw-r--r--xpm/country_GU.svgzbin0 -> 5490 bytes
-rw-r--r--xpm/country_GW.svgzbin0 -> 410 bytes
-rw-r--r--xpm/country_GY.svgzbin0 -> 636 bytes
-rw-r--r--xpm/country_HK.svgzbin0 -> 790 bytes
-rw-r--r--xpm/country_HM.svgzbin0 -> 1449 bytes
-rw-r--r--xpm/country_HN.svgzbin0 -> 422 bytes
-rw-r--r--xpm/country_HR.svgzbin0 -> 13999 bytes
-rw-r--r--xpm/country_HT.svgzbin0 -> 31729 bytes
-rw-r--r--xpm/country_HU.svgzbin0 -> 229 bytes
-rw-r--r--xpm/country_ID.svgzbin0 -> 184 bytes
-rw-r--r--xpm/country_IE.svgzbin0 -> 220 bytes
-rw-r--r--xpm/country_IL.svgzbin0 -> 981 bytes
-rw-r--r--xpm/country_IM.svgzbin0 -> 7644 bytes
-rw-r--r--xpm/country_IN.svgzbin0 -> 3420 bytes
-rw-r--r--xpm/country_IO.svgzbin0 -> 13180 bytes
-rw-r--r--xpm/country_IQ.svgzbin0 -> 2450 bytes
-rw-r--r--xpm/country_IR.svgzbin0 -> 721 bytes
-rw-r--r--xpm/country_IS.svgzbin0 -> 334 bytes
-rw-r--r--xpm/country_IT.svgzbin0 -> 209 bytes
-rw-r--r--xpm/country_JE.svgzbin0 -> 13121 bytes
-rw-r--r--xpm/country_JM.svgzbin0 -> 313 bytes
-rw-r--r--xpm/country_JO.svgzbin0 -> 752 bytes
-rw-r--r--xpm/country_JP.svgzbin0 -> 271 bytes
-rw-r--r--xpm/country_KE.svgzbin0 -> 683 bytes
-rw-r--r--xpm/country_KG.svgzbin0 -> 3063 bytes
-rw-r--r--xpm/country_KH.svgzbin0 -> 6017 bytes
-rw-r--r--xpm/country_KI.svgzbin0 -> 3554 bytes
-rw-r--r--xpm/country_KM.svgzbin0 -> 887 bytes
-rw-r--r--xpm/country_KN.svgzbin0 -> 557 bytes
-rw-r--r--xpm/country_KP.svgzbin0 -> 615 bytes
-rw-r--r--xpm/country_KR.svgzbin0 -> 475 bytes
-rw-r--r--xpm/country_KW.svgzbin0 -> 215 bytes
-rw-r--r--xpm/country_KY.svgzbin0 -> 22215 bytes
-rw-r--r--xpm/country_KZ.svgzbin0 -> 8180 bytes
-rw-r--r--xpm/country_LA.svgzbin0 -> 208 bytes
-rw-r--r--xpm/country_LB.svgzbin0 -> 10942 bytes
-rw-r--r--xpm/country_LC.svgzbin0 -> 1018 bytes
-rw-r--r--xpm/country_LI.svgzbin0 -> 13590 bytes
-rw-r--r--xpm/country_LK.svgzbin0 -> 6279 bytes
-rw-r--r--xpm/country_LR.svgzbin0 -> 1067 bytes
-rw-r--r--xpm/country_LS.svgzbin0 -> 1517 bytes
-rw-r--r--xpm/country_LT.svgzbin0 -> 214 bytes
-rw-r--r--xpm/country_LU.svgzbin0 -> 194 bytes
-rw-r--r--xpm/country_LV.svgzbin0 -> 268 bytes
-rw-r--r--xpm/country_LY.svgzbin0 -> 239 bytes
-rw-r--r--xpm/country_MA.svgzbin0 -> 1700 bytes
-rw-r--r--xpm/country_MC.svgzbin0 -> 186 bytes
-rw-r--r--xpm/country_MD.svgzbin0 -> 24497 bytes
-rw-r--r--xpm/country_ME.svgzbin0 -> 48825 bytes
-rw-r--r--xpm/country_MF.svgzbin0 -> 273 bytes
-rw-r--r--xpm/country_MG.svgzbin0 -> 211 bytes
-rw-r--r--xpm/country_MH.svgzbin0 -> 1001 bytes
-rw-r--r--xpm/country_MK.svgzbin0 -> 589 bytes
-rw-r--r--xpm/country_ML.svgzbin0 -> 194 bytes
-rw-r--r--xpm/country_MM.svgzbin0 -> 4619 bytes
-rw-r--r--xpm/country_MN.svgzbin0 -> 682 bytes
-rw-r--r--xpm/country_MO.svgzbin0 -> 2739 bytes
-rw-r--r--xpm/country_MP.svgzbin0 -> 20896 bytes
-rw-r--r--xpm/country_MQ.svgzbin0 -> 273 bytes
-rw-r--r--xpm/country_MR.svgzbin0 -> 461 bytes
-rw-r--r--xpm/country_MS.svgzbin0 -> 7097 bytes
-rw-r--r--xpm/country_MT.svgzbin0 -> 16688 bytes
-rw-r--r--xpm/country_MU.svgzbin0 -> 218 bytes
-rw-r--r--xpm/country_MV.svgzbin0 -> 348 bytes
-rw-r--r--xpm/country_MW.svgzbin0 -> 4352 bytes
-rw-r--r--xpm/country_MX.svgzbin0 -> 191629 bytes
-rw-r--r--xpm/country_MY.svgzbin0 -> 889 bytes
-rw-r--r--xpm/country_MZ.svgzbin0 -> 2365 bytes
-rw-r--r--xpm/country_NA.svgzbin0 -> 804 bytes
-rw-r--r--xpm/country_NC.svgzbin0 -> 273 bytes
-rw-r--r--xpm/country_NE.svgzbin0 -> 1097 bytes
-rw-r--r--xpm/country_NF.svgzbin0 -> 16417 bytes
-rw-r--r--xpm/country_NG.svgzbin0 -> 261 bytes
-rw-r--r--xpm/country_NI.svgzbin0 -> 13230 bytes
-rw-r--r--xpm/country_NL.svgzbin0 -> 337 bytes
-rw-r--r--xpm/country_NO.svgzbin0 -> 282 bytes
-rw-r--r--xpm/country_NP.svgzbin0 -> 841 bytes
-rw-r--r--xpm/country_NR.svgzbin0 -> 699 bytes
-rw-r--r--xpm/country_NU.svgzbin0 -> 1756 bytes
-rw-r--r--xpm/country_NZ.svgzbin0 -> 1102 bytes
-rw-r--r--xpm/country_OM.svgzbin0 -> 10171 bytes
-rw-r--r--xpm/country_PA.svgzbin0 -> 495 bytes
-rw-r--r--xpm/country_PE.svgzbin0 -> 268 bytes
-rw-r--r--xpm/country_PF.svgzbin0 -> 5854 bytes
-rw-r--r--xpm/country_PG.svgzbin0 -> 2988 bytes
-rw-r--r--xpm/country_PH.svgzbin0 -> 1919 bytes
-rw-r--r--xpm/country_PK.svgzbin0 -> 451 bytes
-rw-r--r--xpm/country_PL.svgzbin0 -> 271 bytes
-rw-r--r--xpm/country_PM.svgzbin0 -> 273 bytes
-rw-r--r--xpm/country_PN.svgzbin0 -> 11106 bytes
-rw-r--r--xpm/country_PR.svgzbin0 -> 563 bytes
-rw-r--r--xpm/country_PS.svgzbin0 -> 1012 bytes
-rw-r--r--xpm/country_PT.svgzbin0 -> 45410 bytes
-rw-r--r--xpm/country_PW.svgzbin0 -> 287 bytes
-rw-r--r--xpm/country_PY.svgzbin0 -> 23337 bytes
-rw-r--r--xpm/country_QA.svgzbin0 -> 814 bytes
-rw-r--r--xpm/country_RE.svgzbin0 -> 273 bytes
-rw-r--r--xpm/country_RO.svgzbin0 -> 221 bytes
-rw-r--r--xpm/country_RS.svgzbin0 -> 60907 bytes
-rw-r--r--xpm/country_RU.svgzbin0 -> 186 bytes
-rw-r--r--xpm/country_RW.svgzbin0 -> 816 bytes
-rw-r--r--xpm/country_SA.svgzbin0 -> 17866 bytes
-rw-r--r--xpm/country_SB.svgzbin0 -> 553 bytes
-rw-r--r--xpm/country_SC.svgzbin0 -> 270 bytes
-rw-r--r--xpm/country_SD.svgzbin0 -> 233 bytes
-rw-r--r--xpm/country_SE.svgzbin0 -> 257 bytes
-rw-r--r--xpm/country_SG.svgzbin0 -> 582 bytes
-rw-r--r--xpm/country_SH.svgzbin0 -> 30078 bytes
-rw-r--r--xpm/country_SI.svgzbin0 -> 2859 bytes
-rw-r--r--xpm/country_SJ.svgzbin0 -> 282 bytes
-rw-r--r--xpm/country_SK.svgzbin0 -> 1775 bytes
-rw-r--r--xpm/country_SL.svgzbin0 -> 202 bytes
-rw-r--r--xpm/country_SM.svgzbin0 -> 24564 bytes
-rw-r--r--xpm/country_SN.svgzbin0 -> 607 bytes
-rw-r--r--xpm/country_SO.svgzbin0 -> 309 bytes
-rw-r--r--xpm/country_SR.svgzbin0 -> 1141 bytes
-rw-r--r--xpm/country_ST.svgzbin0 -> 566 bytes
-rw-r--r--xpm/country_SV.svgzbin0 -> 95287 bytes
-rw-r--r--xpm/country_SY.svgzbin0 -> 340 bytes
-rw-r--r--xpm/country_SZ.svgzbin0 -> 4646 bytes
-rw-r--r--xpm/country_TC.svgzbin0 -> 7949 bytes
-rw-r--r--xpm/country_TD.svgzbin0 -> 342 bytes
-rw-r--r--xpm/country_TF.svgzbin0 -> 1806 bytes
-rw-r--r--xpm/country_TG.svgzbin0 -> 483 bytes
-rw-r--r--xpm/country_TH.svgzbin0 -> 369 bytes
-rw-r--r--xpm/country_TJ.svgzbin0 -> 1974 bytes
-rw-r--r--xpm/country_TK.svgzbin0 -> 1089 bytes
-rw-r--r--xpm/country_TL.svgzbin0 -> 1024 bytes
-rw-r--r--xpm/country_TM.svgzbin0 -> 17172 bytes
-rw-r--r--xpm/country_TN.svgzbin0 -> 508 bytes
-rw-r--r--xpm/country_TO.svgzbin0 -> 253 bytes
-rw-r--r--xpm/country_TR.svgzbin0 -> 493 bytes
-rw-r--r--xpm/country_TT.svgzbin0 -> 313 bytes
-rw-r--r--xpm/country_TV.svgzbin0 -> 1713 bytes
-rw-r--r--xpm/country_TW.svgzbin0 -> 344 bytes
-rw-r--r--xpm/country_TZ.svgzbin0 -> 416 bytes
-rw-r--r--xpm/country_UA.svgzbin0 -> 266 bytes
-rw-r--r--xpm/country_UG.svgzbin0 -> 2902 bytes
-rw-r--r--xpm/country_UM.svgzbin0 -> 590 bytes
-rw-r--r--xpm/country_US.svgzbin0 -> 590 bytes
-rw-r--r--xpm/country_UY.svgzbin0 -> 918 bytes
-rw-r--r--xpm/country_UZ.svgzbin0 -> 648 bytes
-rw-r--r--xpm/country_VA.svgzbin0 -> 49864 bytes
-rw-r--r--xpm/country_VC.svgzbin0 -> 766 bytes
-rw-r--r--xpm/country_VE.svgzbin0 -> 540 bytes
-rw-r--r--xpm/country_VG.svgzbin0 -> 15568 bytes
-rw-r--r--xpm/country_VI.svgzbin0 -> 9326 bytes
-rw-r--r--xpm/country_VN.svgzbin0 -> 442 bytes
-rw-r--r--xpm/country_VU.svgzbin0 -> 3061 bytes
-rw-r--r--xpm/country_WF.svgzbin0 -> 273 bytes
-rw-r--r--xpm/country_WS.svgzbin0 -> 933 bytes
-rw-r--r--xpm/country_YE.svgzbin0 -> 350 bytes
-rw-r--r--xpm/country_YT.svgzbin0 -> 273 bytes
-rw-r--r--xpm/country_ZA.svgzbin0 -> 465 bytes
-rw-r--r--xpm/country_ZM.svgzbin0 -> 5486 bytes
-rw-r--r--xpm/country_ZW.svgzbin0 -> 1910 bytes
-rw-r--r--xpm/cursor.pngbin0 -> 864 bytes
-rw-r--r--xpm/cursor.svg187
-rw-r--r--xpm/cursor.xml20
-rw-r--r--xpm/cursor.xpm (renamed from navit/xpm/cursor.xpm)0
-rw-r--r--xpm/cursor225.pngbin0 -> 1014 bytes
-rw-r--r--xpm/cursor225.svg200
-rw-r--r--xpm/cursor450.pngbin0 -> 807 bytes
-rw-r--r--xpm/cursor450.svg191
-rw-r--r--xpm/cursor675.pngbin0 -> 1012 bytes
-rw-r--r--xpm/cursor675.svg200
-rw-r--r--xpm/cursor_still.pngbin0 -> 626 bytes
-rw-r--r--xpm/cursor_still.svg217
-rw-r--r--xpm/desktop_icons/128x128/navit.pngbin0 -> 14377 bytes
-rw-r--r--xpm/desktop_icons/22x22/navit.pngbin0 -> 956 bytes
-rw-r--r--xpm/desktop_icons/navit.desktop16
-rw-r--r--xpm/dumping-station.xpm (renamed from navit/xpm/dumping-station.xpm)0
-rw-r--r--xpm/exit.svg167
-rw-r--r--xpm/exit.xpm (renamed from navit/xpm/exit.xpm)0
-rw-r--r--xpm/fastfood.svg217
-rw-r--r--xpm/fastfood.xpm (renamed from navit/xpm/fastfood.xpm)0
-rw-r--r--xpm/firebrigade.svg109
-rw-r--r--xpm/firebrigade.xpm (renamed from navit/xpm/firebrigade.xpm)0
-rw-r--r--xpm/flag_bk_tr.xpm (renamed from navit/xpm/flag_bk_tr.xpm)0
-rw-r--r--xpm/flag_bk_wh.xpm (renamed from navit/xpm/flag_bk_wh.xpm)0
-rw-r--r--xpm/flag_bl_wh.xpm (renamed from navit/xpm/flag_bl_wh.xpm)0
-rw-r--r--xpm/flag_wh_bk.xpm (renamed from navit/xpm/flag_wh_bk.xpm)0
-rw-r--r--xpm/fountain.xpm22
-rw-r--r--xpm/fuel.svg201
-rw-r--r--xpm/fuel.xpm (renamed from navit/xpm/fuel.xpm)0
-rw-r--r--xpm/gc_event.xpm (renamed from navit/xpm/gc_event.xpm)0
-rw-r--r--xpm/gc_multi.xpm (renamed from navit/xpm/gc_multi.xpm)0
-rw-r--r--xpm/gc_mystery.xpm (renamed from navit/xpm/gc_mystery.xpm)0
-rw-r--r--xpm/gc_question.xpm (renamed from navit/xpm/gc_question.xpm)0
-rw-r--r--xpm/gc_reference.xpm (renamed from navit/xpm/gc_reference.xpm)0
-rw-r--r--xpm/gc_stages.xpm (renamed from navit/xpm/gc_stages.xpm)0
-rw-r--r--xpm/gc_tradi.xpm (renamed from navit/xpm/gc_tradi.xpm)0
-rw-r--r--xpm/gc_webcam.xpm (renamed from navit/xpm/gc_webcam.xpm)0
-rw-r--r--xpm/golf.xpm40
-rw-r--r--xpm/gui_actions.svg591
-rw-r--r--xpm/gui_active.svg237
-rw-r--r--xpm/gui_arrow_down.svg70
-rw-r--r--xpm/gui_arrow_left.svg70
-rw-r--r--xpm/gui_arrow_right.svg70
-rw-r--r--xpm/gui_arrow_up.svg70
-rw-r--r--xpm/gui_bookmark.svg470
-rw-r--r--xpm/gui_display.svg1752
-rw-r--r--xpm/gui_fullscreen.svg261
-rw-r--r--xpm/gui_help.svg398
-rw-r--r--xpm/gui_home.svg248
-rw-r--r--xpm/gui_inactive.svg233
-rw-r--r--xpm/gui_leave_fullscreen.svg422
-rw-r--r--xpm/gui_log.svg352
-rw-r--r--xpm/gui_map.svg1015
-rw-r--r--xpm/gui_maps.svg140
-rw-r--r--xpm/gui_menu.svg658
-rw-r--r--xpm/gui_minus.svg83
-rw-r--r--xpm/gui_plus.svg94
-rw-r--r--xpm/gui_quit.svg77
-rw-r--r--xpm/gui_rules.svg562
-rw-r--r--xpm/gui_select_country.svg233
-rw-r--r--xpm/gui_select_street.svg237
-rw-r--r--xpm/gui_select_town.svg233
-rw-r--r--xpm/gui_settings.svg408
-rw-r--r--xpm/gui_sound.svg798
-rw-r--r--xpm/gui_sound_32.xpm204
-rw-r--r--xpm/gui_sound_off.svg771
-rw-r--r--xpm/gui_sound_off_32.xpm198
-rw-r--r--xpm/gui_stop.svg214
-rw-r--r--xpm/gui_strength_0.svg100
-rw-r--r--xpm/gui_strength_1.svg100
-rw-r--r--xpm/gui_strength_2.svg100
-rw-r--r--xpm/gui_strength_3.svg100
-rw-r--r--xpm/gui_strength_4.svg100
-rw-r--r--xpm/gui_strength_5.svg100
-rw-r--r--xpm/gui_tools.svg364
-rw-r--r--xpm/gui_town.svg14
-rw-r--r--xpm/gui_vehicle.svg75
-rw-r--r--xpm/gui_zoom_in.svg554
-rw-r--r--xpm/gui_zoom_out.svg554
-rw-r--r--xpm/heliport.xpm91
-rw-r--r--xpm/highway_exit.xpm (renamed from navit/xpm/highway_exit.xpm)0
-rw-r--r--xpm/hospital.svg100
-rw-r--r--xpm/hospital.xpm (renamed from navit/xpm/hospital.xpm)0
-rw-r--r--xpm/hotel.xpm (renamed from navit/xpm/hotel.xpm)0
-rw-r--r--xpm/hunting_stand.xpm23
-rw-r--r--xpm/information.xpm36
-rw-r--r--xpm/justice.xpm (renamed from navit/xpm/justice.xpm)0
-rw-r--r--xpm/level_crossing.xpm46
-rw-r--r--xpm/library.xpm (renamed from navit/xpm/library.xpm)0
-rw-r--r--xpm/memorial.xpm51
-rw-r--r--xpm/menu.xpm101
-rw-r--r--xpm/military.xpm21
-rw-r--r--xpm/mini_roundabout.xpm (renamed from navit/xpm/mini_roundabout.xpm)0
-rw-r--r--xpm/museum.xpm (renamed from navit/xpm/museum.xpm)0
-rw-r--r--xpm/nav_destination_bk.svg147
-rw-r--r--xpm/nav_destination_wh.svg147
-rw-r--r--xpm/nav_left_1.xpm (renamed from navit/xpm/nav_left_1.xpm)0
-rw-r--r--xpm/nav_left_1_32.xpm41
-rw-r--r--xpm/nav_left_1_bk.svg18
-rw-r--r--xpm/nav_left_1_wh.svg18
-rw-r--r--xpm/nav_left_2.xpm (renamed from navit/xpm/nav_left_2.xpm)0
-rw-r--r--xpm/nav_left_2_32.xpm41
-rw-r--r--xpm/nav_left_2_bk.svg18
-rw-r--r--xpm/nav_left_2_wh.svg18
-rw-r--r--xpm/nav_left_3_bk.svg18
-rw-r--r--xpm/nav_left_3_wh.svg18
-rw-r--r--xpm/nav_right_1.xpm (renamed from navit/xpm/nav_right_1.xpm)0
-rw-r--r--xpm/nav_right_1_32.xpm41
-rw-r--r--xpm/nav_right_1_bk.svg18
-rw-r--r--xpm/nav_right_1_wh.svg18
-rw-r--r--xpm/nav_right_2.xpm (renamed from navit/xpm/nav_right_2.xpm)0
-rw-r--r--xpm/nav_right_2_32.xpm41
-rw-r--r--xpm/nav_right_2_bk.svg18
-rw-r--r--xpm/nav_right_2_wh.svg18
-rw-r--r--xpm/nav_right_3_bk.svg18
-rw-r--r--xpm/nav_right_3_wh.svg18
-rw-r--r--xpm/nav_roundabout_l1_bk.svg20
-rw-r--r--xpm/nav_roundabout_l1_wh.svg20
-rw-r--r--xpm/nav_roundabout_l2_bk.svg20
-rw-r--r--xpm/nav_roundabout_l2_wh.svg20
-rw-r--r--xpm/nav_roundabout_l3_bk.svg20
-rw-r--r--xpm/nav_roundabout_l3_wh.svg20
-rw-r--r--xpm/nav_roundabout_l4_bk.svg20
-rw-r--r--xpm/nav_roundabout_l4_wh.svg20
-rw-r--r--xpm/nav_roundabout_l5_bk.svg20
-rw-r--r--xpm/nav_roundabout_l5_wh.svg20
-rw-r--r--xpm/nav_roundabout_l6_bk.svg20
-rw-r--r--xpm/nav_roundabout_l6_wh.svg20
-rw-r--r--xpm/nav_roundabout_l7_bk.svg20
-rw-r--r--xpm/nav_roundabout_l7_wh.svg20
-rw-r--r--xpm/nav_roundabout_l8_bk.svg20
-rw-r--r--xpm/nav_roundabout_l8_wh.svg20
-rw-r--r--xpm/nav_roundabout_r1_bk.svg20
-rw-r--r--xpm/nav_roundabout_r1_wh.svg20
-rw-r--r--xpm/nav_roundabout_r2_bk.svg20
-rw-r--r--xpm/nav_roundabout_r2_wh.svg20
-rw-r--r--xpm/nav_roundabout_r3_bk.svg20
-rw-r--r--xpm/nav_roundabout_r3_wh.svg20
-rw-r--r--xpm/nav_roundabout_r4_bk.svg20
-rw-r--r--xpm/nav_roundabout_r4_wh.svg20
-rw-r--r--xpm/nav_roundabout_r5_bk.svg20
-rw-r--r--xpm/nav_roundabout_r5_wh.svg20
-rw-r--r--xpm/nav_roundabout_r6_bk.svg20
-rw-r--r--xpm/nav_roundabout_r6_wh.svg20
-rw-r--r--xpm/nav_roundabout_r7_bk.svg20
-rw-r--r--xpm/nav_roundabout_r7_wh.svg20
-rw-r--r--xpm/nav_roundabout_r8_bk.svg20
-rw-r--r--xpm/nav_roundabout_r8_wh.svg20
-rw-r--r--xpm/nav_straight.xpm (renamed from navit/xpm/nav_straight.xpm)0
-rw-r--r--xpm/nav_straight_32.xpm41
-rw-r--r--xpm/nav_straight_bk.svg18
-rw-r--r--xpm/nav_straight_wh.svg18
-rw-r--r--xpm/nav_svg.html54
-rw-r--r--xpm/nav_turnaround_left_bk.svg18
-rw-r--r--xpm/nav_turnaround_left_wh.svg18
-rw-r--r--xpm/nav_turnaround_right_bk.svg18
-rw-r--r--xpm/nav_turnaround_right_wh.svg18
-rwxr-xr-xxpm/navit_svg2png68
-rw-r--r--xpm/osd_minus.pngbin0 -> 329 bytes
-rw-r--r--xpm/osd_plus.pngbin0 -> 353 bytes
-rw-r--r--xpm/parking.xpm (renamed from navit/xpm/parking.xpm)0
-rw-r--r--xpm/peak.svg124
-rw-r--r--xpm/peak.xpm (renamed from navit/xpm/peak.xpm)0
-rw-r--r--xpm/pharmacy.xpm (renamed from navit/xpm/pharmacy.xpm)0
-rw-r--r--xpm/picnic.xpm38
-rw-r--r--xpm/police.svg99
-rw-r--r--xpm/police.xpm (renamed from navit/xpm/police.xpm)0
-rw-r--r--xpm/post.svg88
-rw-r--r--xpm/post.xpm (renamed from navit/xpm/post.xpm)0
-rw-r--r--xpm/potable_water.xpm32
-rw-r--r--xpm/public_office.xpm32
-rw-r--r--xpm/restaurant.xpm (renamed from navit/xpm/restaurant.xpm)0
-rw-r--r--xpm/restroom.xpm (renamed from navit/xpm/restroom.xpm)0
-rw-r--r--xpm/ruins.xpm22
-rw-r--r--xpm/school.xpm94
-rw-r--r--xpm/shelter.xpm42
-rw-r--r--xpm/shopping.svg158
-rw-r--r--xpm/shopping.xpm (renamed from navit/xpm/shopping.xpm)0
-rw-r--r--xpm/skiing.xpm21
-rw-r--r--xpm/sport.xpm75
-rw-r--r--xpm/swimming.xpm (renamed from navit/xpm/swimming.xpm)0
-rw-r--r--xpm/tec_common.svg2953
-rw-r--r--xpm/telephone.xpm (renamed from navit/xpm/telephone.xpm)0
-rw-r--r--xpm/theater.xpm (renamed from navit/xpm/theater.xpm)0
-rw-r--r--xpm/toggle_fullscreen.xpm101
-rw-r--r--xpm/toilets.xpm21
-rw-r--r--xpm/tower.xpm (renamed from navit/xpm/tower.xpm)0
-rw-r--r--xpm/townhall.xpm (renamed from navit/xpm/townhall.xpm)0
-rw-r--r--xpm/traffic_signals.svg132
-rw-r--r--xpm/traffic_signals.xpm (renamed from navit/xpm/traffic_signals.xpm)0
-rw-r--r--xpm/trailerpark.xpm (renamed from navit/xpm/trailerpark.xpm)0
-rw-r--r--xpm/unknown.xpm (renamed from navit/xpm/unknown.xpm)0
-rw-r--r--xpm/viewpoint.xpm21
-rw-r--r--xpm/wifi.xpm21
-rw-r--r--xpm/zoo.xpm83
-rw-r--r--xpm/zoom_in.svg68
-rw-r--r--xpm/zoom_in.xpm102
-rw-r--r--xpm/zoom_out.svg68
-rw-r--r--xpm/zoom_out.xpm101
-rw-r--r--zipfile.h89
1229 files changed, 140541 insertions, 87056 deletions
diff --git a/AUTHORS b/AUTHORS
deleted file mode 100644
index 426de519..00000000
--- a/AUTHORS
+++ /dev/null
@@ -1,7 +0,0 @@
-Michael Farmbauer <horwitz@users.sourceforge.net>
-Martin Schaller <martin-s@users.sourceforge.net>
-Pierre Grandin <kazer_@users.sourceforge.net>
-Alexander Atanasov <aatanasov@gmail.com>
-
-And all the Navit Team members and contributors.
-See http://wiki.navit-project.org/index.php/Navit_project_members_and_contributors for the full list!
diff --git a/COPYRIGHT b/COPYRIGHT
deleted file mode 100644
index 390170bb..00000000
--- a/COPYRIGHT
+++ /dev/null
@@ -1,2 +0,0 @@
-Unless stated otherwise, all files are:
-Copyright 2005 - 2008 Navit Team (see AUTHORS) and are licensed under the GPLv2 or later (see COPYING)
diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index 411115f0..00000000
--- a/ChangeLog
+++ /dev/null
@@ -1,4 +0,0 @@
-Changes and documentation about Navit can be found in the wiki at:
- http://wiki.navit-project.org
-A timeline of opened and closed issue tickets can be found at our trac instance:
- http://trac.navit-project.org
diff --git a/navit/Doxyfile b/Doxyfile
index e2167554..e2167554 100644
--- a/navit/Doxyfile
+++ b/Doxyfile
diff --git a/Makefile.am b/Makefile.am
index 2a28cb58..2212de4f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,106 @@
include $(top_srcdir)/Makefile.inc
-SUBDIRS=navit po intl
-pkgdoc_DATA = README
-EXTRA_DIST = README COPYRIGHT
+DIST_SUBDIRS=binding map fib-1.1 font fonts gui graphics osd speech support vehicle xpm maps
+SUBDIRS=binding map fib-1.1 font gui graphics osd speech support vehicle xpm
+if BUILD_SAMPLEMAP
+ SUBDIRS += maps
+endif
+
+if FONTS
+ SUBDIRS += fonts
+endif
+
+AM_CPPFLAGS = -I$(top_srcdir)/navit/fib-1.1 @NAVIT_CFLAGS@ @ZLIB_CFLAGS@ -DPREFIX=\"@prefix@\" -DLIBDIR=\"@libdir@\" -DMODULE=navit
+BUILT_SOURCES = version.h navit_config.h
+if BUILD_SAMPLEMAP
+ BUILT_SOURCES += osm2navit$(EXEEXT)
+endif
+
+bin_PROGRAMS = navit osm2navit
+
+pkgdata_DATA = navit.xml
+
+EXTRA_DIST = navit.xml
+
+noinst_LTLIBRARIES = libnavit.la
+libnavit_la_SOURCES = announcement.c atom.c attr.c cache.c callback.c command.c compass.c coord.c country.c cursor.c data_window.c debug.c \
+ event.c event_glib.h file.c graphics.c gui.c item.c layout.c log.c main.c map.c \
+ linguistics.c mapset.c maptype.c menu.c messages.c navit.c navigation.c osd.c param.c phrase.c plugin.c popup.c \
+ profile.c projection.c roadprofile.c route.c search.c speech.c transform.c track.c \
+ util.c vehicle.c vehicleprofile.c xmlconfig.c announcement.h atom.h attr.h attr_def.h cache.h callback.h color.h command.h compass.h coord.h country.h \
+ cursor.h data.h data_window.h data_window_int.h debug.h destination.h draw_info.h endianess.h event.h \
+ file.h graphics.h gtkext.h gui.h item.h item_def.h keys.h log.h layer.h layout.h linguistics.h main.h map-share.h map.h\
+ map_data.h mapset.h maptype.h menu.h messages.h navigation.h navit.h osd.h \
+ param.h phrase.h plugin.h point.h plugin_def.h projection.h popup.h route.h profile.h roadprofile.h search.h speech.h \
+ transform.h track.h util.h vehicle.h vehicleprofile.h window.h xmlconfig.h zipfile.h \
+ navit_nls.h
+
+navit_SOURCES = start.c
+navit_LDADD = libnavit.la @NAVIT_LIBS@ @ZLIB_LIBS@ @INTLLIBS@ -Lfib-1.1 -lfib
+
+osm2navit_CPPFLAGS = $(AM_CPPFLAGS) @ZLIB_CFLAGS@ @POSTGRESQL_CFLAGS@
+osm2navit_SOURCES = osm2navit.c
+osm2navit_LDADD = libnavit.la @NAVIT_LIBS@ @ZLIB_LIBS@ @POSTGRESQL_LIBS@ @INTLLIBS@
+
+if EVENT_GLIB
+ libnavit_la_SOURCES += event_glib.c
+endif
+
+if !PLUGINS
+ navit_SOURCES += builtin.c
+ navit_LDADD += $(wildcard $(top_builddir)/navit/*/*/*.la)
+ osm2navit_SOURCES += support-builtin.c
+ osm2navit_LDADD += $(wildcard $(top_builddir)/navit/support/*/*.la)
+endif
+
+if SUPPORT_WIN32
+ navit_LDADD += resource.rsc
+if SUPPORT_WIN32CE
+ navit_LDADD += -lcommctrl
+else
+ navit_LDADD += -lgdi32 -lcomctl32
+endif
+
+resource.rsc: $(top_srcdir)/navit/gui/win32/resources/resource.rc
+ $(WINDRES) -I $(top_srcdir)/navit/gui/win32/resources $(top_srcdir)/navit/gui/win32/resources/resource.rc resource.rsc
+endif
+
+.PHONY: version.h.tmp
+
+version.h.tmp:
+ echo "#include \"config.h\"" >version.h.tmp
+if SOURCE_MODE_SVN
+ echo "#define SVN_VERSION \"$$(LANG=C svnversion 2>/dev/null)\"" >>version.h.tmp
+else
+ echo "#define SVN_VERSION \"@SOURCE_MODE@\"" >>version.h.tmp
+endif
+ echo "#define NAVIT_VARIANT \"@NAVIT_VARIANT@\"" >>version.h.tmp
+ if ! diff version.h.tmp version.h >/dev/null 2>/dev/null; \
+ then \
+ mv version.h.tmp version.h; \
+ fi
+
+version.h: version.h.tmp
+
+navit_config.h: ../config.h
+ cp ../config.h navit_config.h.tmp
+ if ! diff navit_config.h.tmp navit_config.h >/dev/null 2>/dev/null; \
+ then \
+ mv navit_config.h.tmp navit_config.h; \
+ fi
+
+
+distclean-local:
+ rm -f version.h version.h.tmp navit_config.h navit_config.h.tmp builtin.c support-builtin.c
+
+builtin.c: $(top_builddir)/config.h
+ ls $(top_builddir)/navit/*/*/*.la | sed -e "s/.la/_init(void);/" -e "s/.*lib/extern void module_/" >builtin.c
+ echo "extern void builtin_init(void);" >>builtin.c
+ echo "void builtin_init(void) {" >>builtin.c
+ ls $(top_builddir)/navit/*/*/*.la | sed -e "s/.la/_init();/" -e "s/.*\\/lib/ module_/" >>builtin.c
+ echo "}" >>builtin.c
+support-builtin.c: $(top_builddir)/config.h
+ ls $(top_builddir)/navit/support/*/*.la | sed -e "s/.la/_init(void);/" -e "s/.*lib/extern void module_/" >support-builtin.c
+ echo "extern void builtin_init(void);" >>support-builtin.c
+ echo "void builtin_init(void) {" >>support-builtin.c
+ ls $(top_builddir)/navit/support/*/*.la | sed -e "s/.la/_init();/" -e "s/.*\\/lib/ module_/" >>support-builtin.c
+ echo "}" >>support-builtin.c
diff --git a/Makefile.inc b/Makefile.inc
deleted file mode 100644
index 6971d54a..00000000
--- a/Makefile.inc
+++ /dev/null
@@ -1,10 +0,0 @@
-modulebindingdir=$(pkglibdir)/binding
-moduledatadir=$(pkglibdir)/data
-modulegraphicsdir=$(pkglibdir)/graphics
-moduleguidir=$(pkglibdir)/gui
-modulespeechdir=$(pkglibdir)/speech
-moduleosddir=$(pkglibdir)/osd
-modulevehicledir=$(pkglibdir)/vehicle
-pkgdocdir=$(pkgdatadir)
-xpmdir=$(pkgdatadir)/xpm
-mapsdir=$(pkgdatadir)/maps
diff --git a/README b/README
deleted file mode 100644
index af67232f..00000000
--- a/README
+++ /dev/null
@@ -1,82 +0,0 @@
-NavIT
-=====
-
-Navit is a open source (GPL) car navigation system with routing engine.
-
-It's modular design is capable of using vector maps of various formats
-for routing and rendering of the displayed map. It's even possible to
-use multiple maps at a time.
-
-The GTK+ or SDL user interfaces are designed to work well with touch
-screen displays. Points of Interest of various formats are displayed
-on the map.
-
-The current vehicle position is either read from gpsd or directly from
-NMEA GPS sensors.
-
-The routing engine not only calculates an optimal route to your
-destination, but also generates directions and even speaks to you.
-
-Navit currently speaks 12 languages :
-- English
-- German
-- French
-- Polish
-- Italian
-- Spanish
-- Norwegian
-- Czech
-- Finish
-- Danish
-- Dutch
-- Russian
-
-For help or more information, please refer to the wiki :
- http://wiki.navit-project.org
-
-If you don't know where to start, we recommend you to read the
-Interactive Help : http://wiki.navit-project.org/index.php/Interactive_help
-
-
-Maps:
-=====
-
-The best navigation system is useless without maps. Those three maps
-are known to work:
-
-- OpenStreetMaps : display, routing, but street name search isn't complete
- (see http://wiki.navit-project.org/index.php/OpenStreetMaps )
-
-- Grosser Reiseplaner and compliant maps : full support
- (see http://wiki.navit-project.org/index.php/European_maps )
-
-- Garmin maps : display, routing is being worked on
- (see http://wiki.navit-project.org/index.php/Garmin_maps )
-
-
-GPS Support:
-============
-
-Navit read the current vehicle position :
-- directly from a file
-- from gpsd (local or remote)
-- from udp server (friends tracking) (experimental)
-
-
-Routing algorithm
-=================
-
-NavIt uses a Dijkstra algorithm for routing. The routing starts at the
-destination by assigning a value to each point directly connected to
-destination point. The value represents the estimated time needed to
-pass this distance.
-
-Now the point with the lowest value is choosen using the Fibonacci
-heap and a value is assigned to connected points whos are
-unevaluated or whos current value ist greater than the new one.
-
-The search is repeated until the origin is found.
-
-Once the origin is reached, all that needs to be done is to follow the
-points with the lowest values to the destination.
-
diff --git a/announcement.c b/announcement.c
new file mode 100644
index 00000000..9ea367af
--- /dev/null
+++ b/announcement.c
@@ -0,0 +1,68 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include "debug.h"
+#include "item.h"
+#include "announcement.h"
+
+struct announcement {
+ struct attr **attrs;
+};
+
+struct announcement *
+announcement_new(struct attr *parent, struct attr **attrs)
+{
+ struct announcement *this_;
+ struct attr *type_attr;
+ if (! (type_attr=attr_search(attrs, NULL, attr_name))) {
+ return NULL;
+ }
+ this_=g_new0(struct announcement, 1);
+ this_->attrs=attr_list_dup(attrs);
+ return this_;
+}
+
+int
+announcement_get_attr(struct announcement *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
+{
+ return attr_generic_get_attr(this_->attrs, NULL, type, attr, iter);
+}
+
+int
+announcement_set_attr(struct announcement *this_, struct attr *attr)
+{
+ this_->attrs=attr_generic_set_attr(this_->attrs, attr);
+ return 1;
+}
+
+int
+announcement_add_attr(struct announcement *this_, struct attr *attr)
+{
+ this_->attrs=attr_generic_add_attr(this_->attrs, attr);
+ return 1;
+}
+
+int
+announcement_remove_attr(struct announcement *this_, struct attr *attr)
+{
+ this_->attrs=attr_generic_remove_attr(this_->attrs, attr);
+ return 1;
+}
+
diff --git a/announcement.h b/announcement.h
new file mode 100644
index 00000000..695df4b6
--- /dev/null
+++ b/announcement.h
@@ -0,0 +1,24 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+struct announcement * announcement_new(struct attr *parent, struct attr **attrs);
+int announcement_get_attr(struct announcement *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
+int announcement_set_attr(struct announcement *this_, struct attr *attr);
+int announcement_add_attr(struct announcement *this_, struct attr *attr);
+int announcement_remove_attr(struct announcement *this_, struct attr *attr);
diff --git a/atom.c b/atom.c
new file mode 100644
index 00000000..d2257975
--- /dev/null
+++ b/atom.c
@@ -0,0 +1,27 @@
+#include <glib.h>
+#include "atom.h"
+
+static GHashTable *atom_hash;
+
+char *
+atom_lookup(char *name)
+{
+ return g_hash_table_lookup(atom_hash,name);
+}
+
+char *
+atom(char *name)
+{
+ char *id=atom_lookup(name);
+ if (id)
+ return id;
+ id=g_strdup(name);
+ g_hash_table_insert(atom_hash, id, id);
+ return id;
+}
+
+void
+atom_init(void)
+{
+ atom_hash=g_hash_table_new(g_str_hash, g_str_equal);
+}
diff --git a/atom.h b/atom.h
new file mode 100644
index 00000000..0cad37e1
--- /dev/null
+++ b/atom.h
@@ -0,0 +1,3 @@
+char * atom_lookup(char *name);
+char * atom(char *name);
+void atom_init(void);
diff --git a/attr.c b/attr.c
new file mode 100644
index 00000000..f05f9a20
--- /dev/null
+++ b/attr.c
@@ -0,0 +1,546 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <glib.h>
+#include "debug.h"
+#include "item.h"
+#include "coord.h"
+#include "transform.h"
+#include "color.h"
+#include "attr.h"
+#include "map.h"
+#include "config.h"
+#include "endianess.h"
+
+struct attr_name {
+ enum attr_type attr;
+ char *name;
+};
+
+
+static struct attr_name attr_names[]={
+#define ATTR2(x,y) ATTR(y)
+#define ATTR(x) { attr_##x, #x },
+#include "attr_def.h"
+#undef ATTR2
+#undef ATTR
+};
+
+enum attr_type
+attr_from_name(const char *name)
+{
+ int i;
+
+ for (i=0 ; i < sizeof(attr_names)/sizeof(struct attr_name) ; i++) {
+ if (! strcmp(attr_names[i].name, name))
+ return attr_names[i].attr;
+ }
+ return attr_none;
+}
+
+char *
+attr_to_name(enum attr_type attr)
+{
+ int i;
+
+ for (i=0 ; i < sizeof(attr_names)/sizeof(struct attr_name) ; i++) {
+ if (attr_names[i].attr == attr)
+ return attr_names[i].name;
+ }
+ return NULL;
+}
+
+struct attr *
+attr_new_from_text(const char *name, const char *value)
+{
+ enum attr_type attr;
+ struct attr *ret;
+ struct coord_geo *g;
+ struct coord c;
+ char *pos,*type_str,*str,*tok;
+ int min,max,count;
+
+ ret=g_new0(struct attr, 1);
+ dbg(1,"enter name='%s' value='%s'\n", name, value);
+ attr=attr_from_name(name);
+ ret->type=attr;
+ switch (attr) {
+ case attr_item_type:
+ ret->u.item_type=item_from_name(value);
+ break;
+ case attr_item_types:
+ count=0;
+ type_str=g_strdup(value);
+ str=type_str;
+ while ((tok=strtok(str, ","))) {
+ ret->u.item_types=g_realloc(ret->u.item_types, (count+2)*sizeof(enum item_type));
+ ret->u.item_types[count++]=item_from_name(tok);
+ ret->u.item_types[count]=type_none;
+ str=NULL;
+ }
+ g_free(type_str);
+ break;
+ case attr_dash:
+ count=0;
+ type_str=g_strdup(value);
+ str=type_str;
+ while ((tok=strtok(str, ","))) {
+ ret->u.dash=g_realloc(ret->u.dash, (count+2)*sizeof(int));
+ ret->u.dash[count++]=g_ascii_strtoull(tok,NULL,0);
+ ret->u.dash[count]=0;
+ str=NULL;
+ }
+ g_free(type_str);
+ break;
+ case attr_order:
+ case attr_sequence_range:
+ case attr_angle_range:
+ case attr_speed_range:
+ pos=strchr(value, '-');
+ min=0;
+ max=32767;
+ if (! pos) {
+ sscanf(value,"%d",&min);
+ max=min;
+ } else if (pos == value)
+ sscanf(value,"-%d",&max);
+ else
+ sscanf(value,"%d-%d",&min, &max);
+ ret->u.range.min=min;
+ ret->u.range.max=max;
+ break;
+ default:
+ if (attr >= attr_type_string_begin && attr <= attr_type_string_end) {
+ ret->u.str=(char *)value;
+ break;
+ }
+ if (attr >= attr_type_int_begin && attr <= attr_type_int_end) {
+ if (value[0] == '0' && value[1] == 'x')
+ ret->u.num=strtoul(value, NULL, 0);
+ else
+ ret->u.num=strtol(value, NULL, 0);
+
+ if ((attr >= attr_type_rel_abs_begin) && (attr < attr_type_boolean_begin)) {
+ /* Absolute values are from -0x40000000 - 0x40000000, with 0x0 being 0 (who would have thought that?)
+ Relative values are from 0x40000001 - 0x80000000, with 0x60000000 being 0 */
+ if (strchr(value, '%')) {
+ if ((ret->u.num > 0x20000000) || (ret->u.num < -0x1FFFFFFF)) {
+ dbg(0, "Relative possibly-relative attribute with invalid value %i\n", ret->u.num);
+ }
+
+ ret->u.num += 0x60000000;
+ } else {
+ if ((ret->u.num > 0x40000000) || (ret->u.num < -0x40000000)) {
+ dbg(0, "Non-relative possibly-relative attribute with invalid value %i\n", ret->u.num);
+ }
+ }
+ } else if (attr >= attr_type_boolean_begin) { // also check for yes and no
+ if (g_ascii_strcasecmp(value,"no") && g_ascii_strcasecmp(value,"0") && g_ascii_strcasecmp(value,"false"))
+ ret->u.num=1;
+ else
+ ret->u.num=0;
+ }
+ break;
+ }
+ if (attr >= attr_type_color_begin && attr <= attr_type_color_end) {
+ struct color *color=g_new0(struct color, 1);
+ int r,g,b,a;
+ ret->u.color=color;
+ if(strlen(value)==7){
+ sscanf(value,"#%02x%02x%02x", &r, &g, &b);
+ color->r = (r << 8) | r;
+ color->g = (g << 8) | g;
+ color->b = (b << 8) | b;
+ color->a = (65535);
+ } else if(strlen(value)==9){
+ sscanf(value,"#%02x%02x%02x%02x", &r, &g, &b, &a);
+ color->r = (r << 8) | r;
+ color->g = (g << 8) | g;
+ color->b = (b << 8) | b;
+ color->a = (a << 8) | a;
+ } else {
+ dbg(0,"color %s has unknown format\n",value);
+ }
+ break;
+ }
+ if (attr >= attr_type_coord_geo_begin && attr <= attr_type_coord_geo_end) {
+ g=g_new(struct coord_geo, 1);
+ ret->u.coord_geo=g;
+ coord_parse(value, projection_mg, &c);
+ transform_to_geo(projection_mg, &c, g);
+ break;
+ }
+ dbg(1,"default\n");
+ g_free(ret);
+ ret=NULL;
+ }
+ return ret;
+}
+
+char *
+attr_to_text(struct attr *attr, struct map *map, int pretty)
+{
+ char *ret;
+ enum attr_type type=attr->type;
+
+ if (type >= attr_type_item_begin && type <= attr_type_item_end) {
+ struct item *item=attr->u.item;
+ struct attr type, data;
+ if (! item)
+ return g_strdup("(nil)");
+ if (! item->map || !map_get_attr(item->map, attr_type, &type, NULL))
+ type.u.str="";
+ if (! item->map || !map_get_attr(item->map, attr_data, &data, NULL))
+ data.u.str="";
+ return g_strdup_printf("type=0x%x id=0x%x,0x%x map=%p (%s:%s)", item->type, item->id_hi, item->id_lo, item->map, type.u.str, data.u.str);
+ }
+ if (type >= attr_type_string_begin && type <= attr_type_string_end) {
+ if (map) {
+ char *mstr;
+ if (attr->u.str) {
+ mstr=map_convert_string(map, attr->u.str);
+ ret=g_strdup(mstr);
+ map_convert_free(mstr);
+ } else
+ ret=g_strdup("(null)");
+
+ } else
+ ret=g_strdup(attr->u.str);
+ return ret;
+ }
+ if (type == attr_flags)
+ return g_strdup_printf("0x%x", attr->u.num);
+ if (type >= attr_type_int_begin && type <= attr_type_int_end)
+ return g_strdup_printf("%d", attr->u.num);
+ if (type >= attr_type_int64_begin && type <= attr_type_int64_end)
+ return g_strdup_printf("%Ld", *attr->u.num64);
+ if (type >= attr_type_double_begin && type <= attr_type_double_end)
+ return g_strdup_printf("%f", *attr->u.numd);
+ if (type >= attr_type_object_begin && type <= attr_type_object_end)
+ return g_strdup_printf("(object[%s])", attr_to_name(type));
+ return g_strdup_printf("(no text[%s])", attr_to_name(type));
+}
+
+struct attr *
+attr_search(struct attr **attrs, struct attr *last, enum attr_type attr)
+{
+ dbg(1, "enter attrs=%p\n", attrs);
+ while (*attrs) {
+ dbg(1,"*attrs=%p\n", *attrs);
+ if ((*attrs)->type == attr) {
+ return *attrs;
+ }
+ attrs++;
+ }
+ return NULL;
+}
+
+int
+attr_generic_get_attr(struct attr **attrs, struct attr **def_attrs, enum attr_type type, struct attr *attr, struct attr_iter *iter)
+{
+ while (attrs && *attrs) {
+ if ((*attrs)->type == type) {
+ *attr=**attrs;
+ return 1;
+ }
+ attrs++;
+ }
+ while (def_attrs && *def_attrs) {
+ if ((*def_attrs)->type == type) {
+ *attr=**def_attrs;
+ return 1;
+ }
+ def_attrs++;
+ }
+ return 0;
+}
+
+struct attr **
+attr_generic_set_attr(struct attr **attrs, struct attr *attr)
+{
+ struct attr **curr=attrs;
+ int i,count=0;
+ while (curr && *curr) {
+ if ((*curr)->type == attr->type) {
+ attr_free(*curr);
+ *curr=attr_dup(attr);
+ return attrs;
+ }
+ curr++;
+ count++;
+ }
+ curr=g_new0(struct attr *, count+2);
+ for (i = 0 ; i < count ; i++)
+ curr[i]=attrs[i];
+ curr[count]=attr_dup(attr);
+ curr[count+1]=NULL;
+ g_free(attrs);
+ return curr;
+}
+
+struct attr **
+attr_generic_add_attr(struct attr **attrs, struct attr *attr)
+{
+ struct attr **curr=attrs;
+ int i,count=0;
+ while (curr && *curr) {
+ curr++;
+ count++;
+ }
+ curr=g_new0(struct attr *, count+2);
+ for (i = 0 ; i < count ; i++)
+ curr[i]=attrs[i];
+ curr[count]=attr_dup(attr);
+ curr[count+1]=NULL;
+ g_free(attrs);
+ return curr;
+}
+
+struct attr **
+attr_generic_remove_attr(struct attr **attrs, struct attr *attr)
+{
+ struct attr **curr=attrs;
+ int i,j,count=0,found=0;
+ while (curr && *curr) {
+ if ((*curr)->type == attr->type && (*curr)->u.data == attr->u.data)
+ found=1;
+ curr++;
+ count++;
+ }
+ if (!found == -1)
+ return attrs;
+ curr=g_new0(struct attr *, count);
+ j=0;
+ for (i = 0 ; i < count ; i++) {
+ if ((*curr)->type != attr->type || (*curr)->u.data != attr->u.data)
+ curr[j++]=attrs[i];
+ else
+ attr_free(attrs[i]);
+ }
+ curr[j]=NULL;
+ g_free(attrs);
+ return curr;
+}
+
+enum attr_type
+attr_type_begin(enum attr_type type)
+{
+ if (type < attr_type_item_begin)
+ return attr_none;
+ if (type < attr_type_int_begin)
+ return attr_type_item_begin;
+ if (type < attr_type_string_begin)
+ return attr_type_int_begin;
+ if (type < attr_type_special_begin)
+ return attr_type_string_begin;
+ if (type < attr_type_double_begin)
+ return attr_type_special_begin;
+ if (type < attr_type_coord_geo_begin)
+ return attr_type_double_begin;
+ if (type < attr_type_color_begin)
+ return attr_type_coord_geo_begin;
+ if (type < attr_type_object_begin)
+ return attr_type_color_begin;
+ if (type < attr_type_coord_begin)
+ return attr_type_object_begin;
+ if (type < attr_type_pcoord_begin)
+ return attr_type_coord_begin;
+ if (type < attr_type_callback_begin)
+ return attr_type_pcoord_begin;
+ if (type < attr_type_int64_begin)
+ return attr_type_callback_begin;
+ if (type <= attr_type_int64_end)
+ return attr_type_int64_begin;
+ return attr_none;
+}
+
+int
+attr_data_size(struct attr *attr)
+{
+ if (attr->type >= attr_type_string_begin && attr->type <= attr_type_string_end)
+ return strlen(attr->u.str)+1;
+ if (attr->type >= attr_type_int_begin && attr->type <= attr_type_int_end)
+ return sizeof(attr->u.num);
+ if (attr->type >= attr_type_coord_geo_begin && attr->type <= attr_type_coord_geo_end)
+ return sizeof(*attr->u.coord_geo);
+ if (attr->type >= attr_type_color_begin && attr->type <= attr_type_color_end)
+ return sizeof(*attr->u.color);
+ if (attr->type >= attr_type_object_begin && attr->type <= attr_type_object_end)
+ return sizeof(void *);
+ if (attr->type >= attr_type_int64_begin && attr->type <= attr_type_int64_end)
+ return sizeof(*attr->u.num64);
+ if (attr->type == attr_order)
+ return sizeof(attr->u.range);
+ if (attr->type == attr_item_types) {
+ int i=0;
+ while (attr->u.item_types[i++] != type_none);
+ return i*sizeof(enum item_type);
+ }
+ dbg(0,"size for %s unknown\n", attr_to_name(attr->type));
+ return 0;
+}
+
+void *
+attr_data_get(struct attr *attr)
+{
+ if (attr->type >= attr_type_int_begin && attr->type <= attr_type_int_end)
+ return &attr->u.num;
+ if (attr->type == attr_order)
+ return &attr->u.range;
+ return attr->u.data;
+}
+
+void
+attr_data_set(struct attr *attr, void *data)
+{
+ if (attr->type >= attr_type_int_begin && attr->type <= attr_type_int_end)
+ attr->u.num=*((int *)data);
+ else
+ attr->u.data=data;
+}
+
+void
+attr_data_set_le(struct attr * attr, void * data)
+{
+ if (attr->type >= attr_type_int_begin && attr->type <= attr_type_int_end)
+ attr->u.num=le32_to_cpu(*((int *)data));
+ else if (attr->type == attr_order) {
+ attr->u.num=le32_to_cpu(*((int *)data));
+ attr->u.range.min=le16_to_cpu(attr->u.range.min);
+ attr->u.range.max=le16_to_cpu(attr->u.range.max);
+ }
+ else
+/* Fixme: Handle long long */
+ attr->u.data=data;
+
+}
+
+void
+attr_free(struct attr *attr)
+{
+ if (!attr)
+ return;
+ if (attr->type == attr_position_coord_geo)
+ g_free(attr->u.coord_geo);
+ if (attr->type >= attr_type_color_begin && attr->type <= attr_type_color_end)
+ g_free(attr->u.color);
+ g_free(attr);
+}
+
+struct attr *
+attr_dup(struct attr *attr)
+{
+ int size;
+ struct attr *ret=g_new0(struct attr, 1);
+ ret->type=attr->type;
+ if (attr->type >= attr_type_int_begin && attr->type <= attr_type_int_end)
+ ret->u.num=attr->u.num;
+ else if (attr->type >= attr_type_object_begin && attr->type <= attr_type_object_end)
+ ret->u.data=attr->u.data;
+ else {
+ size=attr_data_size(attr);
+ if (size) {
+ ret->u.data=g_malloc(size);
+ memcpy(ret->u.data, attr->u.data, size);
+ }
+ }
+ return ret;
+}
+
+void
+attr_list_free(struct attr **attrs)
+{
+ int count=0;
+ while (attrs && attrs[count]) {
+ attr_free(attrs[count++]);
+ }
+ g_free(attrs);
+}
+
+struct attr **
+attr_list_dup(struct attr **attrs)
+{
+ struct attr **ret=attrs;
+ int i,count=0;
+
+ while (attrs[count])
+ count++;
+ ret=g_new0(struct attr *, count+1);
+ for (i = 0 ; i < count ; i++)
+ ret[i]=attr_dup(attrs[i]);
+ return ret;
+}
+
+
+int
+attr_from_line(char *line, char *name, int *pos, char *val_ret, char *name_ret)
+{
+ int len=0,quoted;
+ char *p,*e,*n;
+
+ dbg(1,"get_tag %s from %s\n", name, line);
+ if (name)
+ len=strlen(name);
+ if (pos)
+ p=line+*pos;
+ else
+ p=line;
+ for(;;) {
+ while (*p == ' ') {
+ p++;
+ }
+ if (! *p)
+ return 0;
+ n=p;
+ e=strchr(p,'=');
+ if (! e)
+ return 0;
+ p=e+1;
+ quoted=0;
+ while (*p) {
+ if (*p == ' ' && !quoted)
+ break;
+ if (*p == '"')
+ quoted=1-quoted;
+ p++;
+ }
+ if (name == NULL || (e-n == len && !strncmp(n, name, len))) {
+ if (name_ret) {
+ len=e-n;
+ strncpy(name_ret, n, len);
+ name_ret[len]='\0';
+ }
+ e++;
+ len=p-e;
+ if (e[0] == '"') {
+ e++;
+ len-=2;
+ }
+ strncpy(val_ret, e, len);
+ val_ret[len]='\0';
+ if (pos)
+ *pos=p-line;
+ return 1;
+ }
+ }
+ return 0;
+}
diff --git a/attr.h b/attr.h
new file mode 100644
index 00000000..c018bd66
--- /dev/null
+++ b/attr.h
@@ -0,0 +1,165 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_ATTR_H
+#define NAVIT_ATTR_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#ifndef ATTR_H
+#define ATTR_H
+
+#include "projection.h"
+
+enum item_type;
+
+enum attr_type {
+#define ATTR2(x,y) attr_##y=x,
+#define ATTR(x) attr_##x,
+#include "attr_def.h"
+#undef ATTR2
+#undef ATTR
+};
+
+#define AF_ONEWAY (1<<0)
+#define AF_ONEWAYREV (1<<1)
+#define AF_NOPASS (AF_ONEWAY|AF_ONEWAYREV)
+#define AF_ONEWAYMASK (AF_ONEWAY|AF_ONEWAYREV)
+#define AF_SEGMENTED (1<<2)
+#define AF_ROUNDABOUT (1<<3)
+#define AF_ROUNDABOUT_VALID (1<<4)
+#define AF_ONEWAY_EXCEPTION (1<<5)
+#define AF_SPEED_LIMIT (1<<6)
+#define AF_TRUCK_SPEED_LIMIT (1<<7)
+#define AF_SIZE_OR_WEIGHT_LIMIT (1<<8)
+#define AF_THROUGH_TRAFFIC (1<<9)
+#define AF_TOLL (1<<10)
+#define AF_SEASONAL (1<<11)
+#define AF_UNPAVED (1<<12)
+#define AF_DANGEROUS_GOODS (1<<19)
+#define AF_EMERGENCY_VEHICLES (1<<20)
+#define AF_TRANSPORT_TRUCK (1<<21)
+#define AF_DELIVERY_TRUCK (1<<22)
+#define AF_PUBLIC_BUS (1<<23)
+#define AF_TAXI (1<<24)
+#define AF_HIGH_OCCUPANCY_CAR (1<<25)
+#define AF_CAR (1<<26)
+#define AF_MOTORCYCLE (1<<27)
+#define AF_MOPED (1<<28)
+#define AF_HORSE (1<<29)
+#define AF_BIKE (1<<30)
+#define AF_PEDESTRIAN (1<<31)
+
+/* Values for attributes that could carry relative values */
+#define ATTR_REL_MAXABS 0x40000000
+#define ATTR_REL_RELSHIFT 0x60000000
+
+enum attr_position_valid {
+ attr_position_valid_invalid,
+ attr_position_valid_static,
+ attr_position_valid_extrapolated_time,
+ attr_position_valid_extrapolated_spatial,
+ attr_position_valid_valid,
+};
+
+struct attr {
+ enum attr_type type;
+ union {
+ char *str;
+ void *data;
+ int num;
+ struct item *item;
+ enum item_type item_type;
+ enum projection projection;
+ double * numd;
+ struct color *color;
+ struct coord_geo *coord_geo;
+ struct navit *navit;
+ struct callback *callback;
+ struct callback_list *callback_list;
+ struct vehicle *vehicle;
+ struct layout *layout;
+ struct layer *layer;
+ struct map *map;
+ struct mapset *mapset;
+ struct log *log;
+ struct route *route;
+ struct navigation *navigation;
+ struct coord *coord;
+ struct pcoord *pcoord;
+ struct gui *gui;
+ struct graphics *graphics;
+ struct tracking *tracking;
+ struct itemgra *itemgra;
+ struct plugin *plugin;
+ struct plugins *plugins;
+ struct polygon *polygon;
+ struct polyline *polyline;
+ struct circle *circle;
+ struct text *text;
+ struct icon *icon;
+ struct image *image;
+ struct arrows *arrows;
+ struct element *element;
+ struct speech *speech;
+ struct cursor *cursor;
+ struct displaylist *displaylist;
+ struct transformation *transformation;
+ struct vehicleprofile *vehicleprofile;
+ struct roadprofile *roadprofile;
+ struct range {
+ short min, max;
+ } range;
+ int *dash;
+ enum item_type *item_types;
+ long long *num64;
+ } u;
+};
+
+/* prototypes */
+enum attr_type;
+struct attr;
+struct attr_iter;
+struct map;
+enum attr_type attr_from_name(const char *name);
+char *attr_to_name(enum attr_type attr);
+struct attr *attr_new_from_text(const char *name, const char *value);
+char *attr_to_text(struct attr *attr, struct map *map, int pretty);
+struct attr *attr_search(struct attr **attrs, struct attr *last, enum attr_type attr);
+int attr_generic_get_attr(struct attr **attrs, struct attr **def_attrs, enum attr_type type, struct attr *attr, struct attr_iter *iter);
+struct attr **attr_generic_set_attr(struct attr **attrs, struct attr *attr);
+struct attr **attr_generic_add_attr(struct attr **attrs, struct attr *attr);
+struct attr **attr_generic_remove_attr(struct attr **attrs, struct attr *attr);
+int attr_data_size(struct attr *attr);
+void *attr_data_get(struct attr *attr);
+void attr_data_set(struct attr *attr, void *data);
+void attr_data_set_le(struct attr * attr, void * data);
+void attr_free(struct attr *attr);
+struct attr *attr_dup(struct attr *attr);
+void attr_list_free(struct attr **attrs);
+struct attr **attr_list_dup(struct attr **attrs);
+int attr_from_line(char *line, char *name, int *pos, char *val_ret, char *name_ret);
+/* end of prototypes */
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/attr_def.h b/attr_def.h
new file mode 100644
index 00000000..331b04f0
--- /dev/null
+++ b/attr_def.h
@@ -0,0 +1,331 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/* prototypes */
+
+/* common */
+ATTR2(0x00000000,none)
+ATTR(any)
+
+ATTR2(0x00010000,type_item_begin)
+ATTR(town_streets_item)
+ATTR(street_name_item)
+ATTR(street_name_numbers_item)
+ATTR(street_item)
+ATTR(street_number_item)
+ATTR(position_sat_item)
+ATTR2(0x0001ffff,type_item_end)
+
+ATTR2(0x00020000,type_int_begin)
+ATTR(h_remove)
+ATTR(id)
+ATTR(flags)
+ATTR(w_remove)
+ATTR(x_remove)
+ATTR(y_remove)
+ATTR(flush_size)
+ATTR(flush_time)
+ATTR(zipfile_ref)
+ATTR(country_id)
+ATTR(position_sats)
+ATTR(position_sats_used)
+ATTR(update)
+ATTR(follow)
+ATTR(length)
+ATTR(time)
+ATTR(destination_length)
+ATTR(destination_time)
+ATTR(speed)
+ATTR(interval)
+ATTR(position_qual)
+ATTR(zoom)
+ATTR(retry_interval)
+ATTR(projection)
+ATTR(offroad)
+ATTR(vocabulary_name)
+ATTR(vocabulary_name_systematic)
+ATTR(vocabulary_distances)
+ATTR(announce_name_systematic_first)
+ATTR(antialias)
+ATTR(order_delta)
+ATTR(baudrate)
+ATTR(font_size_remove)
+ATTR(icon_xs)
+ATTR(icon_l)
+ATTR(icon_s)
+ATTR(spacing)
+ATTR(recent_dest)
+ATTR(destination_distance)
+ATTR(check_version)
+ATTR(details)
+ATTR(width)
+ATTR(offset)
+ATTR(directed)
+ATTR(radius)
+ATTR(text_size)
+ATTR(level)
+ATTR(icon_w)
+ATTR(icon_h)
+ATTR(rotation)
+ATTR(checksum_ignore)
+ATTR(position_fix_type)
+ATTR(timeout)
+ATTR(orientation)
+ATTR(keyboard)
+ATTR(position_sats_signal)
+ATTR(cps)
+ATTR(fast)
+ATTR(osd_configuration)
+ATTR(columns)
+ATTR(align)
+ATTR(sat_prn)
+ATTR(sat_elevation)
+ATTR(sat_azimuth)
+ATTR(sat_snr)
+ATTR(autozoom)
+ATTR(version)
+ATTR(autozoom_min)
+ATTR(maxspeed)
+ATTR(cdf_histsize)
+ATTR(message_maxage)
+ATTR(message_maxnum)
+ATTR(pitch)
+ATTR(roll)
+ATTR(yaw)
+ATTR(route_status)
+ATTR(route_weight)
+ATTR(distance_metric)
+ATTR(route_mode)
+ATTR(maxspeed_handling)
+ATTR(flags_forward_mask)
+ATTR(flags_reverse_mask)
+ATTR(house_number_interpolation)
+ATTR(house_number_left_interpolation)
+ATTR(house_number_right_interpolation)
+ATTR(delay)
+ATTR(lag)
+
+ATTR2(0x00027500,type_rel_abs_begin)
+/* These attributes are int that can either hold relative *
+ * or absolute values. A relative value is indicated by *
+ * adding 0x60000000. *
+ * *
+ * The range of valid absolute values is -0x40000000 to *
+ * 0x40000000, the range of relative values is from *
+ * -0x20000000 to 0x20000000. */
+ATTR(h)
+ATTR(w)
+ATTR(x)
+ATTR(y)
+ATTR(font_size)
+
+ATTR2(0x00028000,type_boolean_begin)
+/* boolean */
+ATTR(overwrite)
+ATTR(active)
+ATTR(follow_cursor)
+ATTR(orientation_removeme)
+ATTR(tracking)
+ATTR(menubar)
+ATTR(statusbar)
+ATTR(toolbar)
+ATTR(animate)
+ATTR(lazy)
+ATTR(mkdir)
+ATTR(predraw)
+ATTR(postdraw)
+ATTR(button)
+ATTR(ondemand)
+ATTR(menu_on_map_click)
+ATTR(direction)
+ATTR(route_follow_straight_REMOVE) // This is to be removed with the next version
+ATTR(gui_speech)
+ATTR(town_id) /* fixme? */
+ATTR(street_id) /* fixme? */
+ATTR(district_id) /* fixme? */
+ATTR(drag_bitmap)
+ATTR(use_mousewheel)
+ATTR(fullscreen)
+ATTR(position_magnetic_direction)
+ATTR(use_overlay)
+ATTR(night_mode)
+ATTR(autozoom_active)
+ATTR(position_valid)
+ATTR2(0x0002ffff,type_int_end)
+ATTR2(0x00030000,type_string_begin)
+ATTR(type)
+ATTR(label)
+ATTR(data)
+ATTR(charset)
+ATTR(country_all)
+ATTR(country_iso3)
+ATTR(country_iso2)
+ATTR(country_car)
+ATTR(country_name)
+ATTR(town_name)
+ATTR(town_postal)
+ATTR(district_name)
+ATTR(street_name)
+ATTR(street_name_systematic)
+ATTR(street_number)
+ATTR(debug)
+ATTR(address)
+ATTR(phone)
+ATTR(entry_fee)
+ATTR(open_hours)
+ATTR(skin)
+ATTR(fullscreen_removeme)
+ATTR(view_mode)
+ATTR(tilt)
+ATTR(media_window_title)
+ATTR(media_cmd)
+ATTR(image_codec)
+/* poi */
+ATTR(icono)
+ATTR(info_html)
+ATTR(price_html)
+/* navigation */
+ATTR(navigation_short)
+ATTR(navigation_long)
+ATTR(navigation_long_exact)
+ATTR(navigation_speech)
+ATTR(name)
+ATTR(source)
+ATTR(description)
+ATTR(gc_type)
+ATTR(layout)
+ATTR(position_nmea)
+ATTR(gpsd_query)
+ATTR(on_eof)
+ATTR(command)
+ATTR(src)
+ATTR(path)
+ATTR(font)
+ATTR(url_local)
+ATTR(gc_size)
+ATTR(gc_difficulty)
+ATTR(gc_terrain)
+ATTR(icon_src)
+ATTR(position_time_iso8601)
+ATTR(house_number)
+ATTR(osm_member)
+ATTR(osm_tag)
+ATTR(municipality_name)
+ATTR(county_name)
+ATTR(state_name)
+ATTR(message)
+ATTR(callbacks)
+ATTR(enable_expression)
+ATTR(fax)
+ATTR(email)
+ATTR(url)
+ATTR(profilename)
+ATTR(projectionname)
+ATTR(town_or_district_name)
+ATTR(postal)
+ATTR(postal_mask)
+ATTR(house_number_first)
+ATTR(house_number_last)
+ATTR(house_number_left_first)
+ATTR(house_number_left_last)
+ATTR(house_number_right_first)
+ATTR(house_number_right_last)
+ATTR(town_name_match)
+ATTR(district_name_match)
+ATTR(street_name_match)
+ATTR2(0x0003ffff,type_string_end)
+ATTR2(0x00040000,type_special_begin)
+ATTR(order)
+ATTR(item_type)
+ATTR(item_types)
+ATTR(dash)
+ATTR(sequence_range)
+ATTR(angle_range)
+ATTR(speed_range)
+ATTR2(0x0004ffff,type_special_end)
+ATTR2(0x00050000,type_double_begin)
+ATTR(position_height)
+ATTR(position_speed)
+ATTR(position_direction)
+ATTR(position_hdop)
+ATTR2(0x0005ffff,type_double_end)
+ATTR2(0x00060000,type_coord_geo_begin)
+ATTR(position_coord_geo)
+ATTR(center)
+ATTR2(0x0006ffff,type_coord_geo_end)
+ATTR2(0x00070000,type_color_begin)
+ATTR(color)
+ATTR(color2)
+ATTR(background_color)
+ATTR(text_color)
+ATTR(background_color2)
+ATTR2(0x0007ffff,type_color_end)
+ATTR2(0x00080000,type_object_begin)
+ATTR(navit)
+ATTR(log)
+ATTR(callback)
+ATTR(route)
+ATTR(navigation)
+ATTR(vehicle)
+ATTR(map)
+ATTR(bookmark_map)
+ATTR(former_destination_map)
+ATTR(graphics)
+ATTR(gui)
+ATTR(trackingo) /* fixme */
+ATTR(plugins)
+ATTR(layer)
+ATTR(itemgra)
+ATTR(polygon)
+ATTR(polyline)
+ATTR(circle)
+ATTR(text)
+ATTR(icon)
+ATTR(image)
+ATTR(arrows)
+ATTR(mapset)
+ATTR(osd)
+ATTR(plugin)
+ATTR(speech)
+ATTR(coord)
+ATTR(private_data)
+ATTR(callback_list)
+ATTR(displaylist)
+ATTR(transformation)
+ATTR(vehicleprofile)
+ATTR(roadprofile)
+ATTR(announcement)
+ATTR(cursor)
+ATTR2(0x0008ffff,type_object_end)
+ATTR2(0x00090000,type_coord_begin)
+ATTR2(0x0009ffff,type_coord_end)
+ATTR2(0x000a0000,type_pcoord_begin)
+ATTR(destination)
+ATTR(position)
+ATTR2(0x000affff,type_pcoord_end)
+ATTR2(0x000b0000,type_callback_begin)
+ATTR(resize)
+ATTR(motion)
+ATTR(keypress)
+ATTR2(0x000bffff,type_callback_end)
+ATTR2(0x000c0000,type_int64_begin)
+ATTR(osm_nodeid)
+ATTR(osm_wayid)
+ATTR(osm_relationid)
+ATTR2(0x000cffff,type_int64_end)
diff --git a/binding/Makefile.am b/binding/Makefile.am
new file mode 100644
index 00000000..48e0a8d6
--- /dev/null
+++ b/binding/Makefile.am
@@ -0,0 +1,10 @@
+SUBDIRS=
+if BINDING_PYTHON
+ SUBDIRS+=python
+endif
+if BINDING_DBUS
+ SUBDIRS+=dbus
+endif
+
+DIST_SUBDIRS=python dbus
+
diff --git a/binding/dbus/Makefile.am b/binding/dbus/Makefile.am
new file mode 100644
index 00000000..06e95ab9
--- /dev/null
+++ b/binding/dbus/Makefile.am
@@ -0,0 +1,6 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ @DBUS_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=binding_dbus
+modulebinding_LTLIBRARIES = libbinding_dbus.la
+libbinding_dbus_la_SOURCES = binding_dbus.c
+libbinding_dbus_la_LIBADD = @DBUS_LIBS@
+libbinding_dbus_la_LDFLAGS = -module -avoid-version
diff --git a/binding/dbus/binding_dbus.c b/binding/dbus/binding_dbus.c
new file mode 100644
index 00000000..0a45d2db
--- /dev/null
+++ b/binding/dbus/binding_dbus.c
@@ -0,0 +1,960 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <string.h>
+#define DBUS_API_SUBJECT_TO_CHANGE
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+#include "config.h"
+#include "main.h"
+#include "navit.h"
+#include "coord.h"
+#include "point.h"
+#include "plugin.h"
+#include "debug.h"
+#include "item.h"
+#include "attr.h"
+#include "layout.h"
+#include "command.h"
+#include "graphics.h"
+#include "util.h"
+
+
+static DBusConnection *connection;
+
+static char *service_name = "org.navit_project.navit";
+static char *object_path = "/org/navit_project/navit";
+char *navitintrospectxml_head1 = "<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n"
+ "\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n"
+ "<node name=\"";
+
+char *navitintrospectxml_head2 = "\">\n"
+ " <interface name=\"org.freedesktop.DBus.Introspectable\">\n"
+ " <method name=\"Introspect\">\n"
+ " <arg direction=\"out\" type=\"s\" />\n"
+ " </method>\n"
+ " </interface>\n";
+
+
+
+GHashTable *object_hash;
+GHashTable *object_count;
+
+static char *
+object_new(char *type, void *object)
+{
+ int id;
+ char *ret;
+ dbg(0,"enter %s\n", type);
+ id=(int)g_hash_table_lookup(object_count, type);
+ g_hash_table_insert(object_count, type, (void *)(id+1));
+ ret=g_strdup_printf("%s/%s/%d", object_path, type, id);
+ g_hash_table_insert(object_hash, ret, object);
+ dbg(0,"return %s\n", ret);
+ return (ret);
+}
+
+static void *
+object_get(const char *path)
+{
+ return g_hash_table_lookup(object_hash, path);
+}
+
+static void *
+resolve_object(const char *opath, char *type)
+{
+ char *prefix;
+ void *ret=NULL;
+ char *def_navit="/default_navit";
+ char *def_graphics="/default_graphics";
+ struct attr attr;
+
+ if (strncmp(opath, object_path, strlen(object_path))) {
+ dbg(0,"wrong object path %s\n",opath);
+ return NULL;
+ }
+ prefix=g_strdup_printf("%s/%s/", object_path, type);
+ if (!strncmp(prefix, opath, strlen(prefix))) {
+ ret=object_get(opath);
+ g_free(prefix);
+ return ret;
+ }
+ g_free(prefix);
+ prefix=opath+strlen(object_path);
+ if (!strncmp(prefix,def_navit,strlen(def_navit))) {
+ prefix+=strlen(def_navit);
+ struct navit *navit=main_get_navit(NULL);
+ if (!prefix[0]) {
+ dbg(0,"default_navit\n");
+ return navit;
+ }
+ if (!strncmp(prefix,def_graphics,strlen(def_graphics))) {
+ if (navit_get_attr(navit, attr_graphics, &attr, NULL)) {
+ return attr.u.graphics;
+ }
+ return NULL;
+ }
+ }
+ return NULL;
+}
+
+static void *
+object_get_from_message_arg(DBusMessage *message, char *type)
+{
+ char *opath;
+ DBusError error;
+
+ dbus_error_init(&error);
+ if (!dbus_message_get_args(message, &error, DBUS_TYPE_OBJECT_PATH, &opath, DBUS_TYPE_INVALID)) {
+ dbus_error_free(&error);
+ dbg(0,"wrong arg type\n");
+ return NULL;
+ }
+ return resolve_object(opath, type);
+}
+
+static void *
+object_get_from_message(DBusMessage *message, char *type)
+{
+ return resolve_object(dbus_message_get_path(message), type);
+}
+
+static DBusHandlerResult
+reply_simple_as_variant(DBusConnection *connection, DBusMessage *message, int value, int dbus_type)
+{
+ DBusMessage *reply;
+
+ reply = dbus_message_new_method_return(message);
+ dbus_message_append_args(reply,
+ dbus_type, &value,
+ DBUS_TYPE_INVALID);
+ dbus_connection_send (connection, reply, NULL);
+ dbus_message_unref (reply);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+static DBusHandlerResult
+empty_reply(DBusConnection *connection, DBusMessage *message)
+{
+ DBusMessage *reply;
+
+ reply = dbus_message_new_method_return(message);
+ dbus_connection_send (connection, reply, NULL);
+ dbus_message_unref (reply);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+static DBusHandlerResult
+request_main_get_navit(DBusConnection *connection, DBusMessage *message)
+{
+ DBusMessage *reply;
+ DBusError error;
+ struct iter *iter;
+ struct navit *navit;
+ char *opath;
+
+ dbus_error_init(&error);
+
+ if (!dbus_message_get_args(message, &error, DBUS_TYPE_OBJECT_PATH, &opath, DBUS_TYPE_INVALID)) {
+ dbg(0,"Error parsing\n");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+ dbg(0,"opath=%s\n", opath);
+ iter=object_get(opath);
+ navit=main_get_navit(iter);
+ if (navit) {
+ reply = dbus_message_new_method_return(message);
+ opath=object_new("navit",navit);
+ dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, &opath, DBUS_TYPE_INVALID);
+ dbus_connection_send (connection, reply, NULL);
+ dbus_message_unref (reply);
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+static DBusHandlerResult
+request_main_iter(DBusConnection *connection, DBusMessage *message)
+{
+ DBusMessage *reply;
+ struct iter *iter=main_iter_new();
+ dbg(0,"iter=%p\n", iter);
+ char *opath=object_new("main_iter",iter);
+ reply = dbus_message_new_method_return(message);
+ dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, &opath, DBUS_TYPE_INVALID);
+ dbus_connection_send (connection, reply, NULL);
+ dbus_message_unref (reply);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+static DBusHandlerResult
+request_main_iter_destroy(DBusConnection *connection, DBusMessage *message)
+{
+ struct iter *iter;
+
+ iter=object_get_from_message_arg(message, "main_iter");
+ if (! iter)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ main_iter_destroy(iter);
+
+ return empty_reply(connection, message);
+}
+
+/**
+ * Extracts a struct pcoord from a DBus message
+ *
+ * @param message The DBus message
+ * @param iter Sort of pointer that points on that (iii)-object in the message
+ * @param pc Pointer where the data should get stored
+ * @returns Returns 1 when everything went right, otherwise 0
+ */
+static int
+pcoord_get_from_message(DBusMessage *message, DBusMessageIter *iter, struct pcoord *pc)
+{
+
+ if(!strcmp(dbus_message_iter_get_signature(iter), "s")) {
+ char *coordstring;
+
+ dbus_message_iter_get_basic(iter, &coordstring);
+ if(!pcoord_parse(coordstring, projection_mg, pc))
+ return 0;
+
+ return 1;
+ } else {
+
+ DBusMessageIter iter2;
+ dbus_message_iter_recurse(iter, &iter2);
+ if(!strcmp(dbus_message_iter_get_signature(iter), "(is)")) {
+ char *coordstring;
+ int projection;
+
+ dbus_message_iter_get_basic(&iter2, &projection);
+
+ dbus_message_iter_next(&iter2);
+ dbus_message_iter_get_basic(&iter2, &coordstring);
+
+ if(!pcoord_parse(coordstring, projection, pc))
+ return 0;
+
+ return 1;
+ } else if(!strcmp(dbus_message_iter_get_signature(iter), "(iii)")) {
+
+ dbus_message_iter_get_basic(&iter2, &pc->pro);
+
+ dbus_message_iter_next(&iter2);
+ dbus_message_iter_get_basic(&iter2, &pc->x);
+
+ dbus_message_iter_next(&iter2);
+ dbus_message_iter_get_basic(&iter2, &pc->y);
+
+ return 1;
+ }
+ }
+ return 0;
+
+}
+
+static DBusHandlerResult
+request_navit_draw(DBusConnection *connection, DBusMessage *message)
+{
+ struct navit *navit;
+
+ navit=object_get_from_message(message, "navit");
+ if (! navit)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ navit_draw(navit);
+
+ return empty_reply(connection, message);
+}
+
+
+/**
+ * Extracts a struct point from a DBus message
+ *
+ * @param message The DBus message
+ * @param iter Sort of pointer that points on that (ii)-object in the message
+ * @param p Pointer where the data should get stored
+ * @returns Returns 1 when everything went right, otherwise 0
+ */
+static int
+point_get_from_message(DBusMessage *message, DBusMessageIter *iter, struct point *p)
+{
+ DBusMessageIter iter2;
+
+ dbg(0,"%s\n", dbus_message_iter_get_signature(iter));
+
+ dbus_message_iter_recurse(iter, &iter2);
+
+ if (dbus_message_iter_get_arg_type(&iter2) != DBUS_TYPE_INT32)
+ return 0;
+ dbus_message_iter_get_basic(&iter2, &p->x);
+
+ dbus_message_iter_next(&iter2);
+
+ if (dbus_message_iter_get_arg_type(&iter2) != DBUS_TYPE_INT32)
+ return 0;
+ dbus_message_iter_get_basic(&iter2, &p->y);
+
+ dbg(0, " x -> %x y -> %x\n", p->x, p->y);
+
+ dbus_message_iter_next(&iter2);
+
+ if (dbus_message_iter_get_arg_type(&iter2) != DBUS_TYPE_INVALID)
+ return 0;
+
+ return 1;
+}
+
+/**
+ * @brief Shows up a message
+ * @param connection The DBusConnection object through which \a message arrived
+ * @param message The DBusMessage containing the coordinates
+ * @returns An empty reply if everything went right, otherwise DBUS_HANDLER_RESULT_NOT_YET_HANDLED
+ */
+
+static DBusHandlerResult
+request_navit_add_message(DBusConnection *connection, DBusMessage *message)
+{
+ struct navit *navit;
+ char *usermessage;
+
+ DBusMessageIter iter;
+
+ navit=object_get_from_message(message, "navit");
+ if (! navit)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ dbus_message_iter_init(message, &iter);
+ dbus_message_iter_get_basic(&iter, &usermessage);
+
+ navit_add_message(navit, usermessage);
+
+ return empty_reply(connection, message);
+}
+
+
+/**
+ * @brief Centers the screen on a specified position \a pc on the world
+ * @param connection The DBusConnection object through which \a message arrived
+ * @param message The DBusMessage containing the coordinates
+ * @returns An empty reply if everything went right, otherwise DBUS_HANDLER_RESULT_NOT_YET_HANDLED
+ */
+
+static DBusHandlerResult
+request_navit_set_center(DBusConnection *connection, DBusMessage *message)
+{
+ struct pcoord pc;
+ struct navit *navit;
+ DBusMessageIter iter;
+
+ navit=object_get_from_message(message, "navit");
+ if (! navit)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ dbus_message_iter_init(message, &iter);
+
+ if (!pcoord_get_from_message(message, &iter, &pc))
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ navit_set_center(navit, &pc, 0);
+ return empty_reply(connection, message);
+}
+
+/**
+ * @brief Centers the screen on a specified position \a p shown on the screen
+ * @param connection The DBusConnection object through which \a message arrived
+ * @param message The DBusMessage containing the x and y value
+ * @returns An empty reply if everything went right, otherwise DBUS_HANDLER_RESULT_NOT_YET_HANDLED
+ */
+static DBusHandlerResult
+request_navit_set_center_screen(DBusConnection *connection, DBusMessage *message)
+{
+ struct point p;
+ struct navit *navit;
+ DBusMessageIter iter;
+
+ navit=object_get_from_message(message, "navit");
+ if (! navit)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ dbus_message_iter_init(message, &iter);
+
+ if (!point_get_from_message(message, &iter, &p))
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ navit_set_center_screen(navit, &p, 0);
+ return empty_reply(connection, message);
+}
+
+/**
+ * @brief Sets the layout to \a new_layout_name extracted from \a message
+ * @param connection The DBusConnection object through which \a message arrived
+ * @param message The DBusMessage containing the name of the layout
+ * @returns An empty reply if everything went right, otherwise DBUS_HANDLER_RESULT_NOT_YET_HANDLED
+ */
+static DBusHandlerResult
+request_navit_set_layout(DBusConnection *connection, DBusMessage *message)
+{
+ char *new_layout_name;
+ struct navit *navit;
+ struct attr attr;
+ struct attr_iter *iter;
+
+ navit=object_get_from_message(message, "navit");
+ if (! navit)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ if (!dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &new_layout_name, DBUS_TYPE_INVALID))
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ iter=navit_attr_iter_new();
+ while(navit_get_attr(navit, attr_layout, &attr, iter)) {
+ if (strcmp(attr.u.layout->name, new_layout_name) == 0) {
+ navit_set_attr(navit, &attr);
+ }
+ }
+ return empty_reply(connection, message);
+}
+
+static DBusHandlerResult
+request_navit_zoom(DBusConnection *connection, DBusMessage *message)
+{
+ int factor;
+ struct point p;
+ struct navit *navit;
+ DBusMessageIter iter;
+
+ navit = object_get_from_message(message, "navit");
+ if (! navit)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ dbus_message_iter_init(message, &iter);
+ dbg(0,"%s\n", dbus_message_iter_get_signature(&iter));
+
+ dbus_message_iter_get_basic(&iter, &factor);
+
+ if (dbus_message_iter_has_next(&iter))
+ {
+ dbus_message_iter_next(&iter);
+ if (!point_get_from_message(message, &iter, &p))
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+
+ if (factor > 1)
+ navit_zoom_in(navit, factor, &p);
+ else if (factor < -1)
+ navit_zoom_out(navit, 0-factor, &p);
+
+ return empty_reply(connection, message);
+
+}
+
+static DBusHandlerResult
+request_navit_resize(DBusConnection *connection, DBusMessage *message)
+{
+ struct navit *navit;
+ int w, h;
+ DBusMessageIter iter;
+
+ navit = object_get_from_message(message, "navit");
+ if (! navit)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ dbus_message_iter_init(message, &iter);
+ dbg(0,"%s\n", dbus_message_iter_get_signature(&iter));
+
+ if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_INT32)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ dbus_message_iter_get_basic(&iter, &w);
+
+ dbus_message_iter_next(&iter);
+
+ if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_INT32)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ dbus_message_iter_get_basic(&iter, &h);
+
+ dbg(0, " w -> %i h -> %i\n", w, h);
+
+ navit_handle_resize(navit, w, h);
+
+ return empty_reply(connection, message);
+
+}
+
+static DBusHandlerResult
+request_navit_get_attr(DBusConnection *connection, DBusMessage *message)
+{
+ struct navit *navit;
+ DBusMessageIter iter;
+ char * attr_type = NULL;
+ struct attr attr;
+ navit = object_get_from_message(message, "navit");
+ if (! navit)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ dbus_message_iter_init(message, &iter);
+ dbus_message_iter_get_basic(&iter, &attr_type);
+ attr.type = attr_from_name(attr_type);
+ dbg(0, "attr value: 0x%x string: %s\n", attr.type, attr_type);
+
+ if (attr.type == attr_none)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ if (attr.type > attr_type_item_begin && attr.type < attr_type_item_end)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ else if (attr.type > attr_type_int_begin && attr.type < attr_type_boolean_begin)
+ {
+ dbg(0, "int detected\n");
+ if(navit_get_attr(navit, attr.type, &attr, NULL)) {
+ dbg(0, "%s = %i\n", attr_type, attr.u.num);
+ return reply_simple_as_variant(connection, message, attr.u.num, DBUS_TYPE_INT32);
+ }
+ }
+
+ else if(attr.type > attr_type_boolean_begin && attr.type < attr_type_int_end)
+ {
+ dbg(0, "bool detected\n");
+ if(navit_get_attr(navit, attr.type, &attr, NULL)) {
+ dbg(0, "%s = %i\n", attr_type, attr.u.num);
+ return reply_simple_as_variant(connection, message, attr.u.num, DBUS_TYPE_BOOLEAN);
+ }
+ }
+
+ else if(attr.type > attr_type_string_begin && attr.type < attr_type_string_end)
+ {
+ dbg(0, "string detected\n");
+ if(navit_get_attr(navit, attr.type, &attr, NULL)) {
+ dbg(0, "%s = %s\n", attr_type, &attr.u.layout);
+ return reply_simple_as_variant(connection, message, &attr.u.layout, DBUS_TYPE_STRING);
+ }
+ }
+
+#if 0
+ else if(attr.type > attr_type_special_begin && attr.type < attr_type_special_end)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ else if(attr.type > attr_type_double_begin && attr.type < attr_type_double_end)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ else if(attr.type > attr_type_coord_geo_begin && attr.type < attr_type_coord_geo_end)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ else if(attr.type > attr_type_color_begin && attr.type < attr_type_color_end)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ else if(attr.type > attr_type_object_begin && attr.type < attr_type_object_end)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ else if(attr.type > attr_type_coord_begin && attr.type < attr_type_coord_end)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ else if(attr.type > attr_type_pcoord_begin && attr.type < attr_type_pcoord_end)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ else if(attr.type > attr_type_callback_begin && attr.type < attr_type_callback_end)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+#endif
+ else {
+ dbg(0, "zomg really unhandled111\n");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+
+static DBusHandlerResult
+request_navit_set_attr(DBusConnection *connection, DBusMessage *message)
+{
+ struct navit *navit;
+ DBusMessageIter iter, iterattr;
+ struct attr attr;
+ char *attr_type;
+
+ navit = object_get_from_message(message, "navit");
+ if (! navit)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ dbus_message_iter_init(message, &iter);
+ dbus_message_iter_get_basic(&iter, &attr_type);
+ attr.type = attr_from_name(attr_type);
+ dbg(0, "attr value: 0x%x string: %s\n", attr.type, attr_type);
+
+ if (attr.type == attr_none)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ dbus_message_iter_next(&iter);
+ dbus_message_iter_recurse(&iter, &iterattr);
+ dbg(0, "seems valid. signature: %s\n", dbus_message_iter_get_signature(&iterattr));
+
+ if (attr.type > attr_type_item_begin && attr.type < attr_type_item_end)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ else if (attr.type > attr_type_int_begin && attr.type < attr_type_boolean_begin) {
+ if (dbus_message_iter_get_arg_type(&iterattr) == DBUS_TYPE_INT32)
+ {
+ dbus_message_iter_get_basic(&iterattr, &attr.u.num);
+ if (navit_set_attr(navit, &attr))
+ return empty_reply(connection, message);
+ }
+ }
+ else if(attr.type > attr_type_boolean_begin && attr.type < attr_type_int_end) {
+ if (dbus_message_iter_get_arg_type(&iterattr) == DBUS_TYPE_BOOLEAN)
+ {
+ dbus_message_iter_get_basic(&iterattr, &attr.u.num);
+ if (navit_set_attr(navit, &attr))
+ return empty_reply(connection, message);
+ }
+ }
+#if 0
+ else if(attr.type > attr_type_string_begin && attr.type < attr_type_string_end)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ else if(attr.type > attr_type_special_begin && attr.type < attr_type_special_end)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ else if(attr.type > attr_type_double_begin && attr.type < attr_type_double_end)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ else if(attr.type > attr_type_coord_geo_begin && attr.type < attr_type_coord_geo_end)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ else if(attr.type > attr_type_color_begin && attr.type < attr_type_color_end)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ else if(attr.type > attr_type_object_begin && attr.type < attr_type_object_end)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ else if(attr.type > attr_type_coord_begin && attr.type < attr_type_coord_end)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ else if(attr.type > attr_type_pcoord_begin && attr.type < attr_type_pcoord_end)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ else if(attr.type > attr_type_callback_begin && attr.type < attr_type_callback_end)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+#endif
+ else {
+ dbg(0, "zomg really unhandled111\n");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+static DBusHandlerResult
+request_navit_set_position(DBusConnection *connection, DBusMessage *message)
+{
+ struct pcoord pc;
+ struct navit *navit;
+ DBusMessageIter iter;
+
+ navit = object_get_from_message(message, "navit");
+ if (! navit)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ dbus_message_iter_init(message, &iter);
+ if (!pcoord_get_from_message(message, &iter, &pc))
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ navit_set_position(navit, &pc);
+ return empty_reply(connection, message);
+}
+
+static DBusHandlerResult
+request_navit_set_destination(DBusConnection *connection, DBusMessage *message)
+{
+ struct pcoord pc;
+ struct navit *navit;
+ DBusMessageIter iter;
+ char *description;
+
+ navit = object_get_from_message(message, "navit");
+ if (! navit)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ dbus_message_iter_init(message, &iter);
+ if (!pcoord_get_from_message(message, &iter, &pc))
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ dbus_message_iter_next(&iter);
+ dbus_message_iter_get_basic(&iter, &description);
+ dbg(0, " destination -> %s\n", description);
+
+ navit_set_destination(navit, &pc, description, 1);
+ return empty_reply(connection, message);
+}
+
+static DBusHandlerResult
+request_navit_evaluate(DBusConnection *connection, DBusMessage *message)
+{
+ struct navit *navit;
+ char *command;
+ char *result;
+ struct attr attr;
+ DBusMessage *reply;
+ int *error;
+
+ navit = object_get_from_message(message, "navit");
+ if (! navit)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ attr.type=attr_navit;
+ attr.u.navit=navit;
+ if (!dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &command, DBUS_TYPE_INVALID))
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ result=command_evaluate_to_string(&attr, command, &error);
+ reply = dbus_message_new_method_return(message);
+ if (error)
+ dbus_message_append_args(reply, DBUS_TYPE_INT32, error, DBUS_TYPE_INVALID);
+ else
+ dbus_message_append_args(reply, DBUS_TYPE_STRING, &result, DBUS_TYPE_INVALID);
+ dbus_connection_send (connection, reply, NULL);
+ dbus_message_unref (reply);
+ return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+static DBusHandlerResult
+request_graphics_get_data(DBusConnection *connection, DBusMessage *message)
+{
+ struct graphics *graphics;
+ char *data;
+ struct graphics_data_image *image;
+ DBusMessage *reply;
+
+ graphics = object_get_from_message(message, "graphics");
+ if (! graphics)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ if (!dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &data, DBUS_TYPE_INVALID))
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ image=graphics_get_data(graphics, data);
+ if (image) {
+ DBusMessageIter iter1,iter2;
+ reply = dbus_message_new_method_return(message);
+#if 0
+ dbus_message_append_args(reply, DBUS_TYPE_STRING, &result, DBUS_TYPE_INVALID);
+#endif
+ dbus_message_iter_init_append(reply, &iter1);
+ dbus_message_iter_open_container(&iter1, DBUS_TYPE_ARRAY, "y", &iter2);
+ if (image->data && image->size)
+ dbus_message_iter_append_fixed_array(&iter2, DBUS_TYPE_BYTE, &image->data, image->size);
+ dbus_message_iter_close_container(&iter1, &iter2);
+ dbus_connection_send (connection, reply, NULL);
+ dbus_message_unref (reply);
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+struct dbus_method {
+ char *path;
+ char *method;
+ char *signature;
+ char *signature_name;
+ char *response;
+ char *response_name;
+ DBusHandlerResult(*func)(DBusConnection *connection, DBusMessage *message);
+} dbus_methods[] = {
+ {"", "iter", "", "", "o", "navit", request_main_iter},
+ {"", "iter_destroy", "o", "navit", "", "", request_main_iter_destroy},
+ {"", "get_navit", "o", "navit", "o", "", request_main_get_navit},
+ {".navit", "draw", "", "", "", "", request_navit_draw},
+ {".navit", "add_message", "s", "message", "", "", request_navit_add_message},
+ {".navit", "set_center", "s", "(coordinates)", "", "", request_navit_set_center},
+ {".navit", "set_center", "(is)", "(projection,coordinates)", "", "", request_navit_set_center},
+ {".navit", "set_center", "(iii)", "(projection,longitude,latitude)", "", "", request_navit_set_center},
+ {".navit", "set_center_screen", "(ii)", "(pixel_x,pixel_y)", "", "", request_navit_set_center_screen},
+ {".navit", "set_layout", "s", "layoutname", "", "", request_navit_set_layout},
+ {".navit", "zoom", "i(ii)", "factor(pixel_x,pixel_y)", "", "", request_navit_zoom},
+ {".navit", "zoom", "i", "factor", "", "", request_navit_zoom},
+ {".navit", "resize", "ii", "upperleft,lowerright", "", "", request_navit_resize},
+ {".navit", "get_attr", "s", "attribute", "v", "value", request_navit_get_attr},
+ {".navit", "set_attr", "sv", "attribute,value", "", "", request_navit_set_attr},
+ {".navit", "set_position", "s", "(coordinates)", "", "", request_navit_set_position},
+ {".navit", "set_position", "(is)", "(projection,coordinated)", "", "", request_navit_set_position},
+ {".navit", "set_position", "(iii)", "(projection,longitude,latitude)", "", "", request_navit_set_position},
+ {".navit", "set_destination", "ss", "coordinates,comment", "", "", request_navit_set_destination},
+ {".navit", "set_destination", "(is)s", "(projection,coordinates)comment", "", "", request_navit_set_destination},
+ {".navit", "set_destination", "(iii)s", "(projection,longitude,latitude)comment", "", "", request_navit_set_destination},
+ {".navit", "evaluate", "s", "command", "s", "", request_navit_evaluate},
+ {".graphics","get_data", "s", "type", "ay", "data", request_graphics_get_data},
+#if 0
+ {".navit", "toggle_announcer", "", "", "", "", request_navit_toggle_announcer},
+ {".navit", "toggle_announcer", "i", "", "", "", request_navit_toggle_announcer},
+#endif
+};
+
+static char *
+introspect_path(char *object)
+{
+ char *ret;
+ int i;
+ char *def=".default_";
+ int def_len=strlen(def);
+ if (strncmp(object, object_path, strlen(object_path)))
+ return NULL;
+ ret=g_strdup(object+strlen(object_path));
+ dbg(0,"path=%s\n",ret);
+ for (i = strlen(ret)-1 ; i >= 0 ; i--) {
+ if (ret[i] == '/' || (ret[i] >= '0' && ret[i] <= '9'))
+ ret[i]='\0';
+ else
+ break;
+ }
+ for (i = 0 ; i < strlen(ret); i++)
+ if (ret[i] == '/')
+ ret[i]='.';
+
+ for (i = strlen(ret)-1 ; i >= 0 ; i--) {
+ if (!strncmp(ret+i, def, def_len)) {
+ memmove(ret+1,ret+i+def_len,strlen(ret+i+def_len)+1);
+ break;
+ }
+ }
+ return ret;
+}
+
+static char *
+generate_navitintrospectxml(char *object)
+{
+ int i,methods_size,n=0;
+ char *navitintrospectxml;
+ char *path=introspect_path(object);
+ if (!path)
+ return NULL;
+ dbg(0,"path=%s\n",path);
+
+ // write header and make navit introspectable
+ navitintrospectxml = g_strdup_printf("%s%s%s\n", navitintrospectxml_head1, object, navitintrospectxml_head2);
+
+ methods_size=sizeof(dbus_methods)/sizeof(struct dbus_method);
+ for (i = 0 ; i < methods_size ; i++) {
+ // start new interface if it's the first method or it changed
+ if (strcmp(dbus_methods[i].path, path))
+ continue;
+ if ((n == 0) || strcmp(dbus_methods[i-1].path, dbus_methods[i].path))
+ navitintrospectxml = g_strconcat_printf(navitintrospectxml, " <interface name=\"%s%s\">\n", service_name, dbus_methods[i].path);
+ n++;
+
+ // start the new method
+ navitintrospectxml = g_strconcat_printf(navitintrospectxml, " <method name=\"%s\">\n", dbus_methods[i].method);
+
+ // set input signature if existent
+ if (strcmp(dbus_methods[i].signature, ""))
+ navitintrospectxml = g_strconcat_printf(navitintrospectxml, " <arg direction=\"in\" name=\"%s\" type=\"%s\" />\n", dbus_methods[i].signature_name, dbus_methods[i].signature);
+
+ // set response signature if existent
+ if (strcmp(dbus_methods[i].response, ""))
+ navitintrospectxml = g_strconcat_printf(navitintrospectxml, " <arg direction=\"out\" name=\"%s\" type=\"%s\" />\n", dbus_methods[i].response_name, dbus_methods[i].response);
+
+ // close the method
+ navitintrospectxml = g_strconcat_printf(navitintrospectxml, " </method>\n");
+
+ // close the interface if we reached the last method or the interface changes
+ if ((methods_size == i+1) || ((methods_size > i+1) && strcmp(dbus_methods[i+1].path, dbus_methods[i].path)))
+ navitintrospectxml = g_strconcat_printf(navitintrospectxml, " </interface>\n\n");
+ }
+ // close the "mother tag"
+ navitintrospectxml = g_strconcat_printf(navitintrospectxml, "</node>\n");
+
+ return navitintrospectxml;
+}
+
+static DBusHandlerResult
+navit_handler_func(DBusConnection *connection, DBusMessage *message, void *user_data)
+{
+ int i;
+ char *path;
+ dbg(0,"type=%s interface=%s path=%s member=%s signature=%s\n", dbus_message_type_to_string(dbus_message_get_type(message)), dbus_message_get_interface(message), dbus_message_get_path(message), dbus_message_get_member(message), dbus_message_get_signature(message));
+ if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Introspectable", "Introspect")) {
+ DBusMessage *reply;
+ char *navitintrospectxml = generate_navitintrospectxml(dbus_message_get_path(message));
+ dbg(0,"Introspect %s:Result:%s\n",dbus_message_get_path(message), navitintrospectxml);
+ if (navitintrospectxml) {
+ reply = dbus_message_new_method_return(message);
+ dbus_message_append_args(reply, DBUS_TYPE_STRING, &navitintrospectxml, DBUS_TYPE_INVALID);
+ dbus_connection_send (connection, reply, NULL);
+ dbus_message_unref (reply);
+ g_free(navitintrospectxml);
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+
+ for (i = 0 ; i < sizeof(dbus_methods)/sizeof(struct dbus_method) ; i++) {
+ path=g_strdup_printf("%s%s", service_name, dbus_methods[i].path);
+ if (dbus_message_is_method_call(message, path, dbus_methods[i].method) &&
+ dbus_message_has_signature(message, dbus_methods[i].signature)) {
+ g_free(path);
+ return dbus_methods[i].func(connection, message);
+ }
+ g_free(path);
+ }
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+static DBusObjectPathVTable dbus_navit_vtable = {
+ NULL,
+ navit_handler_func,
+ NULL
+};
+
+#if 0
+DBusHandlerResult
+filter(DBusConnection *connection, DBusMessage *message, void *user_data)
+{
+ dbg(0,"type=%s interface=%s path=%s member=%s signature=%s\n", dbus_message_type_to_string(dbus_message_get_type(message)), dbus_message_get_interface(message), dbus_message_get_path(message), dbus_message_get_member(message), dbus_message_get_signature(message));
+ if (dbus_message_is_signal(message, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) {
+ }
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+#endif
+
+void plugin_init(void)
+{
+ DBusError error;
+
+ object_hash=g_hash_table_new(g_str_hash, g_str_equal);
+ object_count=g_hash_table_new(g_str_hash, g_str_equal);
+ dbg(0,"enter 1\n");
+ dbus_error_init(&error);
+ connection = dbus_bus_get(DBUS_BUS_SESSION, &error);
+ if (!connection) {
+ dbg(0,"Failed to open connection to session message bus: %s\n", error.message);
+ dbus_error_free(&error);
+ return;
+ }
+ dbus_connection_setup_with_g_main(connection, NULL);
+#if 0
+ dbus_connection_add_filter(connection, filter, NULL, NULL);
+ dbus_bus_add_match(connection, "type='signal',""interface='" DBUS_INTERFACE_DBUS "'", &error);
+#endif
+ dbus_connection_register_fallback(connection, object_path, &dbus_navit_vtable, NULL);
+ dbus_bus_request_name(connection, service_name, 0, &error);
+ if (dbus_error_is_set(&error)) {
+ dbg(0,"Failed to request name: %s", error.message);
+ dbus_error_free (&error);
+ }
+}
diff --git a/binding/dbus/eval.py b/binding/dbus/eval.py
new file mode 100755
index 00000000..2255f968
--- /dev/null
+++ b/binding/dbus/eval.py
@@ -0,0 +1,12 @@
+#! /usr/bin/python
+import dbus
+import sys
+bus = dbus.SessionBus()
+conn = bus.get_object('org.navit_project.navit',
+ '/org/navit_project/navit')
+iface = dbus.Interface(conn, dbus_interface='org.navit_project.navit');
+iter=iface.iter();
+navit=bus.get_object('org.navit_project.navit', conn.get_navit(iter));
+iface.iter_destroy(iter);
+navit_iface = dbus.Interface(navit, dbus_interface='org.navit_project.navit.navit');
+print navit_iface.evaluate(sys.argv[1]);
diff --git a/binding/dbus/navit.introspect b/binding/dbus/navit.introspect
new file mode 100644
index 00000000..9366c0cb
--- /dev/null
+++ b/binding/dbus/navit.introspect
@@ -0,0 +1,34 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node name="/org/navit_project/navit">
+ <interface name="org.freedesktop.DBus.Introspectable">
+ <method name="Introspect">
+ <arg direction="out" type="s" />
+ </method>
+ </interface>
+
+ <interface name="org.navit_project.navit">
+ <method name="get_navit">
+ <arg name="iter" type="o" direction="in"/>
+ <arg name="navit" type="o" direction="out"/>
+ </method>
+ <method name="iter_new">
+ <arg name="iter" type="o" direction="out"/>
+ </method>
+ <method name="iter_destroy">
+ <arg name="iter" type="o" direction="in"/>
+ </method>
+ </interface>
+
+ <interface name="org.navit_project.navit.navit">
+ <method name="zoom">
+ <arg type="i" direction="in" />
+ </method>
+ <method name="zoom">
+ <arg type="i(ii)" direction="in" />
+ </method>
+ <method name="set_center_screen">
+ <arg type="ii" direction="in" />
+ </method>
+ </interface>
+</node>
diff --git a/binding/dbus/test.py b/binding/dbus/test.py
new file mode 100755
index 00000000..6447648c
--- /dev/null
+++ b/binding/dbus/test.py
@@ -0,0 +1,11 @@
+#! /usr/bin/python
+import dbus
+bus = dbus.SessionBus()
+conn = bus.get_object('org.navit_project.navit',
+ '/org/navit_project/navit')
+iface = dbus.Interface(conn, dbus_interface='org.navit_project.navit');
+iter=iface.iter();
+navit=bus.get_object('org.navit_project.navit', conn.get_navit(iter));
+iface.iter_destroy(iter);
+navit_iface = dbus.Interface(navit, dbus_interface='org.navit_project.navit.navit');
+navit_iface.set_center((1,0x138a4a,0x5d773f));
diff --git a/binding/python/Makefile.am b/binding/python/Makefile.am
new file mode 100644
index 00000000..dd74229a
--- /dev/null
+++ b/binding/python/Makefile.am
@@ -0,0 +1,6 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ @PYTHON_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=binding_python
+modulebinding_LTLIBRARIES = libbinding_python.la
+libbinding_python_la_SOURCES = binding_python.c main.c navit.c pcoord.c route.c navigation.c attr.c common.h
+libbinding_python_la_LIBADD = @PYTHON_LIBS@
+libbinding_python_la_LDFLAGS = -module -avoid-version
diff --git a/binding/python/attr.c b/binding/python/attr.c
new file mode 100644
index 00000000..2d5ed92b
--- /dev/null
+++ b/binding/python/attr.c
@@ -0,0 +1,99 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "common.h"
+#include "item.h"
+#include "attr.h"
+
+typedef struct {
+ PyObject_HEAD
+ int ref;
+ struct attr *attr;
+} attrObject;
+
+static PyObject *
+attr_func(attrObject *self, PyObject *args)
+{
+ const char *file;
+ int ret;
+ if (!PyArg_ParseTuple(args, "s", &file))
+ return NULL;
+ ret=0;
+ return Py_BuildValue("i",ret);
+}
+
+
+
+static PyMethodDef attr_methods[] = {
+ {"func", (PyCFunction) attr_func, METH_VARARGS },
+ {NULL, NULL },
+};
+
+
+static PyObject *
+attr_getattr_py(PyObject *self, char *name)
+{
+ return Py_FindMethod(attr_methods, self, name);
+}
+
+static void
+attr_destroy_py(attrObject *self)
+{
+ if (! self->ref)
+ attr_free(self->attr);
+}
+
+PyTypeObject attr_Type = {
+ Obj_HEAD
+ .tp_name="attr",
+ .tp_basicsize=sizeof(attrObject),
+ .tp_dealloc=(destructor)attr_destroy_py,
+ .tp_getattr=attr_getattr_py,
+};
+
+struct attr *
+attr_py_get(PyObject *self)
+{
+ return ((attrObject *)self)->attr;
+}
+
+PyObject *
+attr_new_py(PyObject *self, PyObject *args)
+{
+ attrObject *ret;
+ const char *name,*value;
+ if (!PyArg_ParseTuple(args, "ss", &name, &value))
+ return NULL;
+ ret=PyObject_NEW(attrObject, &attr_Type);
+ ret->attr=attr_new_from_text(name, value);
+ ret->ref=0;
+ return (PyObject *)ret;
+}
+
+PyObject *
+attr_new_py_ref(struct attr *attr)
+{
+ attrObject *ret;
+
+ ret=PyObject_NEW(attrObject, &attr_Type);
+ ret->ref=1;
+ ret->attr=attr;
+ return (PyObject *)ret;
+}
+
diff --git a/binding/python/binding_python.c b/binding/python/binding_python.c
new file mode 100644
index 00000000..6d4fcc78
--- /dev/null
+++ b/binding/python/binding_python.c
@@ -0,0 +1,370 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include <glib.h>
+#include "common.h"
+#include <fcntl.h>
+#include "coord.h"
+#include "projection.h"
+#include "debug.h"
+#include "item.h"
+#include "map.h"
+#include "mapset.h"
+#include "plugin.h"
+#include "debug.h"
+#include "item.h"
+#include "attr.h"
+#include "xmlconfig.h"
+
+#if defined(MS_WINDOWS) || defined(__CYGWIN__)
+#define Obj_HEAD PyObject_HEAD_INIT(NULL);
+#else
+#define Obj_HEAD PyObject_HEAD_INIT(&PyType_Type)
+#endif
+
+/* *** coord *** */
+
+typedef struct {
+ PyObject_HEAD
+ struct coord *c;
+} coordObject;
+
+static void coord_destroy_py(coordObject *self);
+
+PyTypeObject coord_Type = {
+ Obj_HEAD
+ .tp_name="coord",
+ .tp_basicsize=sizeof(coordObject),
+ .tp_dealloc=(destructor)coord_destroy_py,
+};
+
+
+/* *** map *** */
+
+typedef struct {
+ PyObject_HEAD
+ int ref;
+ struct map *m;
+} mapObject;
+
+static void map_destroy_py(mapObject *self);
+static PyObject *map_getattr_py(PyObject *self, char *name);
+
+PyTypeObject map_Type = {
+ Obj_HEAD
+ .tp_name="map",
+ .tp_basicsize=sizeof(mapObject),
+ .tp_dealloc=(destructor)map_destroy_py,
+ .tp_getattr=map_getattr_py,
+};
+
+/* *** IMPLEMENTATIONS *** */
+
+/* *** coord *** */
+
+static PyObject *
+coord_new_py(PyObject *self, PyObject *args)
+{
+ coordObject *ret;
+ int x,y;
+ if (!PyArg_ParseTuple(args, "ii:navit.coord",&x,&y))
+ return NULL;
+ ret=PyObject_NEW(coordObject, &coord_Type);
+ ret->c=coord_new(x,y);
+ return (PyObject *)ret;
+}
+
+static void
+coord_destroy_py(coordObject *self)
+{
+ coord_destroy(self->c);
+}
+
+/* *** coord_rect *** */
+
+typedef struct {
+ PyObject_HEAD
+ struct coord_rect *r;
+} coord_rectObject;
+
+
+static void coord_rect_destroy_py(coord_rectObject *self);
+
+PyTypeObject coord_rect_Type = {
+#if defined(MS_WINDOWS) || defined(__CYGWIN__)
+ PyObject_HEAD_INIT(NULL);
+#else
+ PyObject_HEAD_INIT(&PyType_Type)
+#endif
+ .tp_name="coord_rect",
+ .tp_basicsize=sizeof(coord_rectObject),
+ .tp_dealloc=(destructor)coord_rect_destroy_py,
+};
+
+static PyObject *
+coord_rect_new_py(PyObject *self, PyObject *args)
+{
+ coord_rectObject *ret;
+ coordObject *lu,*rd;
+ if (!PyArg_ParseTuple(args, "O!O!:navit.coord_rect_rect",&coord_Type,&lu,&coord_Type,&rd))
+ return NULL;
+ ret=PyObject_NEW(coord_rectObject, &coord_rect_Type);
+ ret->r=coord_rect_new(lu->c,rd->c);
+ return (PyObject *)ret;
+}
+
+static void
+coord_rect_destroy_py(coord_rectObject *self)
+{
+ coord_rect_destroy(self->r);
+}
+
+/* *** map_rect *** */
+
+typedef struct {
+ PyObject_HEAD
+ struct map_rect *mr;
+} map_rectObject;
+
+
+static void map_rect_destroy_py(map_rectObject *self);
+
+PyTypeObject map_rect_Type = {
+#if defined(MS_WINDOWS) || defined(__CYGWIN__)
+ PyObject_HEAD_INIT(NULL);
+#else
+ PyObject_HEAD_INIT(&PyType_Type)
+#endif
+ .tp_name="map_rect",
+ .tp_basicsize=sizeof(map_rectObject),
+ .tp_dealloc=(destructor)map_rect_destroy_py,
+};
+
+static PyObject *
+map_rect_new_py(mapObject *self, PyObject *args)
+{
+ map_rectObject *ret;
+ coord_rectObject *r;
+ if (!PyArg_ParseTuple(args, "O!:navit.map_rect_rect",&coord_rect_Type,&r))
+ return NULL;
+ ret=PyObject_NEW(map_rectObject, &map_rect_Type);
+ ret->mr=map_rect_new(self->m, NULL);
+ return (PyObject *)ret;
+}
+
+static void
+map_rect_destroy_py(map_rectObject *self)
+{
+ map_rect_destroy(self->mr);
+}
+
+
+/* *** map *** */
+
+static PyObject *
+map_dump_file_py(mapObject *self, PyObject *args)
+{
+ const char *s;
+ if (!PyArg_ParseTuple(args, "s",&s))
+ return NULL;
+ map_dump_file(self->m, s);
+ Py_RETURN_NONE;
+}
+
+
+static PyObject *
+map_set_attr_py(mapObject *self, PyObject *args)
+{
+ PyObject *attr;
+ if (!PyArg_ParseTuple(args, "O!", &attr_Type, &attr))
+ return NULL;
+ map_set_attr(self->m, attr_py_get(attr));
+ Py_RETURN_NONE;
+}
+
+
+
+static PyMethodDef map_methods[] = {
+ {"dump_file", (PyCFunction) map_dump_file_py, METH_VARARGS },
+ {"map_rect_new", (PyCFunction) map_rect_new_py, METH_VARARGS },
+ {"set_attr", (PyCFunction) map_set_attr_py, METH_VARARGS },
+ {NULL, NULL },
+};
+
+static PyObject *
+map_getattr_py(PyObject *self, char *name)
+{
+ return Py_FindMethod(map_methods, self, name);
+}
+
+
+static PyObject *
+map_new_py(PyObject *self, PyObject *args)
+{
+ mapObject *ret;
+ char *type, *filename;
+
+ if (!PyArg_ParseTuple(args, "ss:navit.map", &type, &filename))
+ return NULL;
+ ret=PyObject_NEW(mapObject, &map_Type);
+ ret->m=map_new(NULL,NULL);
+ ret->ref=0;
+ return (PyObject *)ret;
+}
+
+PyObject *
+map_py_ref(struct map *map)
+{
+ mapObject *ret;
+ ret=PyObject_NEW(mapObject, &map_Type);
+ ret->m=map;
+ ret->ref=1;
+ return (PyObject *)ret;
+}
+
+static void
+map_destroy_py(mapObject *self)
+{
+ if (!self->ref)
+ map_destroy(self->m);
+}
+
+/* *** mapset *** */
+
+
+typedef struct {
+ PyObject_HEAD
+ struct mapset *ms;
+} mapsetObject;
+
+
+static void mapset_destroy_py(mapsetObject *self);
+static PyObject *mapset_getattr_py(PyObject *self, char *name);
+
+PyTypeObject mapset_Type = {
+#if defined(MS_WINDOWS) || defined(__CYGWIN__)
+ PyObject_HEAD_INIT(NULL);
+#else
+ PyObject_HEAD_INIT(&PyType_Type)
+#endif
+ .tp_name="mapset",
+ .tp_basicsize=sizeof(mapsetObject),
+ .tp_dealloc=(destructor)mapset_destroy_py,
+ .tp_getattr=mapset_getattr_py,
+};
+
+static PyObject *
+mapset_add_py(mapsetObject *self, PyObject *args)
+{
+ mapObject *map;
+ if (!PyArg_ParseTuple(args, "O:navit.mapset", &map))
+ return NULL;
+ Py_INCREF(map);
+ mapset_add_attr(self->ms, &(struct attr){attr_map,.u.map=map->m});
+ return Py_BuildValue("");
+}
+
+static PyMethodDef mapset_methods[] = {
+ {"add", (PyCFunction) mapset_add_py, METH_VARARGS },
+ {NULL, NULL },
+};
+
+static PyObject *
+mapset_getattr_py(PyObject *self, char *name)
+{
+ return Py_FindMethod(mapset_methods, self, name);
+}
+
+static PyObject *
+mapset_new_py(PyObject *self, PyObject *args)
+{
+ mapsetObject *ret;
+ if (!PyArg_ParseTuple(args, ":navit.mapset"))
+ return NULL;
+ ret=PyObject_NEW(mapsetObject, &mapset_Type);
+ ret->ms=mapset_new(NULL,NULL);
+ return (PyObject *)ret;
+}
+
+static void
+mapset_destroy_py(mapsetObject *self)
+{
+ mapset_destroy(self->ms);
+}
+
+static PyObject *
+config_load_py(PyObject *self, PyObject *args)
+{
+ const char *file;
+ int ret;
+ xmlerror *error;
+ if (!PyArg_ParseTuple(args, "s", &file))
+ return NULL;
+ ret=config_load(file, &error);
+ return Py_BuildValue("i",ret);
+}
+
+static PyMethodDef navitMethods[]={
+ {"attr", attr_new_py, METH_VARARGS},
+ {"coord", coord_new_py, METH_VARARGS, "Create a new coordinate point."},
+ {"coord_rect", coord_rect_new_py, METH_VARARGS, "Create a new coordinate rectangle."},
+ {"map", map_new_py, METH_VARARGS, "Create a new map."},
+ {"mapset", mapset_new_py, METH_VARARGS, "Create a new mapset."},
+ {"config_load", config_load_py, METH_VARARGS, "Load a config"},
+ {"main", main_py, METH_VARARGS, "Get Main Object"},
+ {"pcoord", pcoord_py, METH_VARARGS},
+ {NULL, NULL, 0, NULL}
+};
+
+
+PyObject *
+python_object_from_attr(struct attr *attr)
+{
+ switch (attr->type) {
+ case attr_navigation:
+ return navigation_py_ref(attr->u.navigation);
+ case attr_route:
+ return route_py_ref(attr->u.route);
+ default:
+ return NULL;
+ }
+ return NULL;
+}
+
+
+void
+plugin_init(void)
+{
+ int fd,size;
+ char buffer[65536];
+
+ Py_Initialize();
+ Py_InitModule("navit", navitMethods);
+ fd=open("startup.py",O_RDONLY);
+ if (fd >= 0) {
+ size=read(fd, buffer, 65535);
+ if (size > 0) {
+ buffer[size]='\0';
+ PyRun_SimpleString(buffer);
+ }
+ }
+
+ Py_Finalize();
+}
diff --git a/binding/python/common.h b/binding/python/common.h
new file mode 100644
index 00000000..5c1a270c
--- /dev/null
+++ b/binding/python/common.h
@@ -0,0 +1,55 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <Python.h>
+#include "debug.h"
+
+#if defined(MS_WINDOWS) || defined(__CYGWIN__)
+#define Obj_HEAD PyObject_HEAD_INIT(NULL);
+#else
+#define Obj_HEAD PyObject_HEAD_INIT(&PyType_Type)
+#endif
+
+struct navit;
+struct map;
+
+PyObject * python_object_from_attr(struct attr *attr);
+
+PyObject * main_py(PyObject *self, PyObject *args);
+
+PyObject * map_py_ref(struct map *map);
+
+struct navigation;
+PyObject * navigation_py(PyObject *self, PyObject *args);
+PyObject * navigation_py_ref(struct navigation *navigation);
+
+PyObject * navit_py(PyObject *self, PyObject *args);
+PyObject * navit_py_ref(struct navit *navit);
+extern PyTypeObject pcoord_Type;
+PyObject * pcoord_py(PyObject *self, PyObject *args);
+struct pcoord *pcoord_py_get(PyObject *self);
+
+struct route;
+PyObject * route_py(PyObject *self, PyObject *args);
+PyObject * route_py_ref(struct route *route);
+
+extern PyTypeObject attr_Type;
+PyObject * attr_new_py(PyObject *self, PyObject *args);
+PyObject * attr_new_py_ref(struct attr *attr);
+struct attr * attr_py_get(PyObject *self);
diff --git a/binding/python/main.c b/binding/python/main.c
new file mode 100644
index 00000000..5a782cc7
--- /dev/null
+++ b/binding/python/main.c
@@ -0,0 +1,71 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "common.h"
+#include "main.h"
+
+typedef struct {
+ PyObject_HEAD
+} mainObject;
+
+static PyObject *
+main_navit(PyObject *self, PyObject *args)
+{
+ struct navit *navit;
+ navit=main_get_navit(NULL);
+ return navit_py_ref(navit);
+}
+
+
+
+static PyMethodDef main_methods[] = {
+ {"navit", (PyCFunction) main_navit, METH_VARARGS },
+ {NULL, NULL },
+};
+
+
+static PyObject *
+main_getattr_py(PyObject *self, char *name)
+{
+ return Py_FindMethod(main_methods, self, name);
+}
+
+static void
+main_destroy_py(mainObject *self)
+{
+}
+
+PyTypeObject main_Type = {
+ Obj_HEAD
+ .tp_name="main",
+ .tp_basicsize=sizeof(mainObject),
+ .tp_dealloc=(destructor)main_destroy_py,
+ .tp_getattr=main_getattr_py,
+};
+
+PyObject *
+main_py(PyObject *self, PyObject *args)
+{
+ mainObject *ret;
+
+ dbg(0,"enter\n");
+ ret=PyObject_NEW(mainObject, &main_Type);
+ return (PyObject *)ret;
+}
+
diff --git a/binding/python/navigation.c b/binding/python/navigation.c
new file mode 100644
index 00000000..75a421d5
--- /dev/null
+++ b/binding/python/navigation.c
@@ -0,0 +1,82 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "common.h"
+#include "navigation.h"
+
+typedef struct {
+ PyObject_HEAD
+ struct navigation *navigation;
+} navigationObject;
+
+static PyObject *
+navigation_get_map_py(navigationObject *self, PyObject *args)
+{
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+ return map_py_ref(navigation_get_map(self->navigation));
+}
+
+
+
+static PyMethodDef navigation_methods[] = {
+ {"get_map", (PyCFunction) navigation_get_map_py, METH_VARARGS },
+ {NULL, NULL },
+};
+
+
+static PyObject *
+navigation_getattr_py(PyObject *self, char *name)
+{
+ return Py_FindMethod(navigation_methods, self, name);
+}
+
+static void
+navigation_destroy_py(navigationObject *self)
+{
+}
+
+PyTypeObject navigation_Type = {
+ Obj_HEAD
+ .tp_name="navigation",
+ .tp_basicsize=sizeof(navigationObject),
+ .tp_dealloc=(destructor)navigation_destroy_py,
+ .tp_getattr=navigation_getattr_py,
+};
+
+PyObject *
+navigation_py(PyObject *self, PyObject *args)
+{
+ navigationObject *ret;
+
+ ret=PyObject_NEW(navigationObject, &navigation_Type);
+ return (PyObject *)ret;
+}
+
+PyObject *
+navigation_py_ref(struct navigation *navigation)
+{
+ navigationObject *ret;
+
+ ret=PyObject_NEW(navigationObject, &navigation_Type);
+ ret->navigation=navigation;
+ return (PyObject *)ret;
+}
+
+
diff --git a/binding/python/navit.c b/binding/python/navit.c
new file mode 100644
index 00000000..ada8cd7f
--- /dev/null
+++ b/binding/python/navit.c
@@ -0,0 +1,135 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "common.h"
+#include "item.h"
+#include "navit.h"
+
+typedef struct {
+ PyObject_HEAD
+ struct navit *navit;
+} navitObject;
+
+static PyObject *
+navit_get_attr_py(navitObject *self, PyObject *args)
+{
+ char *name;
+ struct attr attr;
+ if (!PyArg_ParseTuple(args, "s", &name))
+ return NULL;
+ if (!navit_get_attr(self->navit, attr_from_name(name), &attr, NULL)) {
+ dbg(0,"get_attr not ok\n");
+ Py_RETURN_NONE;
+ }
+ dbg(0,"get_attr ok\n");
+ return python_object_from_attr(&attr);
+}
+
+static PyObject *
+navit_set_center_py(navitObject *self, PyObject *args)
+{
+ PyObject *pcoord;
+ if (!PyArg_ParseTuple(args, "O!", &pcoord_Type, &pcoord))
+ return NULL;
+ navit_set_center(self->navit, pcoord_py_get(pcoord), 0);
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+navit_set_destination_py(navitObject *self, PyObject *args)
+{
+ PyObject *pcoord;
+ const char *description;
+ int async;
+ if (!PyArg_ParseTuple(args, "O!si", &pcoord_Type, &pcoord, &description, &async))
+ return NULL;
+ navit_set_destination(self->navit, pcoord_py_get(pcoord), description, async);
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+navit_set_position_py(navitObject *self, PyObject *args)
+{
+ PyObject *pcoord;
+ if (!PyArg_ParseTuple(args, "O!", &pcoord_Type, &pcoord))
+ return NULL;
+ navit_set_position(self->navit, pcoord_py_get(pcoord));
+ Py_RETURN_NONE;
+}
+
+
+static PyObject *
+navit_zoom_to_route_py(navitObject *self, PyObject *args)
+{
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+ navit_zoom_to_route(self->navit,0);
+ Py_RETURN_NONE;
+}
+
+
+
+
+static PyMethodDef navit_methods[] = {
+ {"get_attr", (PyCFunction) navit_get_attr_py, METH_VARARGS },
+ {"set_center", (PyCFunction) navit_set_center_py, METH_VARARGS },
+ {"set_destination", (PyCFunction) navit_set_destination_py, METH_VARARGS },
+ {"set_position", (PyCFunction) navit_set_position_py, METH_VARARGS },
+ {"zoom_to_route", (PyCFunction) navit_zoom_to_route_py, METH_VARARGS },
+ {NULL, NULL },
+};
+
+
+static PyObject *
+navit_getattr_py(PyObject *self, char *name)
+{
+ return Py_FindMethod(navit_methods, self, name);
+}
+
+static void
+navit_destroy_py(navitObject *self)
+{
+}
+
+PyTypeObject navit_Type = {
+ Obj_HEAD
+ .tp_name="navit",
+ .tp_basicsize=sizeof(navitObject),
+ .tp_dealloc=(destructor)navit_destroy_py,
+ .tp_getattr=navit_getattr_py,
+};
+
+PyObject *
+navit_py(PyObject *self, PyObject *args)
+{
+ navitObject *ret;
+
+ dbg(0,"enter\n");
+ ret=PyObject_NEW(navitObject, &navit_Type);
+ return (PyObject *)ret;
+}
+
+PyObject *
+navit_py_ref(struct navit *navit)
+{
+ dbg(0,"navit=%p\n", navit);
+ navitObject *ret=PyObject_NEW(navitObject, &navit_Type);
+ ret->navit=navit;
+ return (PyObject *)ret;
+}
diff --git a/binding/python/navit.xml.python b/binding/python/navit.xml.python
new file mode 100644
index 00000000..ec3e99de
--- /dev/null
+++ b/binding/python/navit.xml.python
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE config SYSTEM "navit.dtd">
+<config xmlns:xi="http://www.w3.org/2001/XInclude">
+ <plugins>
+ <plugin path="$NAVIT_LIBDIR/*/${NAVIT_LIBPREFIX}libbinding_python.so" active="yes"/>
+ </plugins>
+</config>
diff --git a/binding/python/pcoord.c b/binding/python/pcoord.c
new file mode 100644
index 00000000..a4cb2640
--- /dev/null
+++ b/binding/python/pcoord.c
@@ -0,0 +1,88 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "common.h"
+#include "coord.h"
+
+typedef struct {
+ PyObject_HEAD
+ struct pcoord pc;
+} pcoordObject;
+
+static PyObject *
+pcoord_func(pcoordObject *self, PyObject *args)
+{
+ const char *file;
+ int ret=0;
+ if (!PyArg_ParseTuple(args, "s", &file))
+ return NULL;
+ return Py_BuildValue("i",ret);
+}
+
+
+
+static PyMethodDef pcoord_methods[] = {
+ {"func", (PyCFunction) pcoord_func, METH_VARARGS },
+ {NULL, NULL },
+};
+
+
+static PyObject *
+pcoord_getattr_py(PyObject *self, char *name)
+{
+ return Py_FindMethod(pcoord_methods, self, name);
+}
+
+static void
+pcoord_destroy_py(pcoordObject *self)
+{
+}
+
+PyTypeObject pcoord_Type = {
+ Obj_HEAD
+ .tp_name="pcoord",
+ .tp_basicsize=sizeof(pcoordObject),
+ .tp_dealloc=(destructor)pcoord_destroy_py,
+ .tp_getattr=pcoord_getattr_py,
+};
+
+PyObject *
+pcoord_py(PyObject *self, PyObject *args)
+{
+ pcoordObject *ret;
+ const char *str;
+ enum projection pro;
+ struct coord c;
+ if (!PyArg_ParseTuple(args, "si", &str, &pro))
+ return NULL;
+ ret=PyObject_NEW(pcoordObject, &pcoord_Type);
+ coord_parse(str, pro, &c);
+ ret->pc.pro=pro;
+ ret->pc.x=c.x;
+ ret->pc.y=c.y;
+ dbg(0,"0x%x,0x%x\n", c.x, c.y);
+ return (PyObject *)ret;
+}
+
+struct pcoord *
+pcoord_py_get(PyObject *self)
+{
+ return &((pcoordObject *)self)->pc;
+}
+
diff --git a/binding/python/route.c b/binding/python/route.c
new file mode 100644
index 00000000..dfbd08cf
--- /dev/null
+++ b/binding/python/route.c
@@ -0,0 +1,84 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "common.h"
+#include "item.h"
+#include "coord.h"
+#include "route.h"
+
+typedef struct {
+ PyObject_HEAD
+ struct route *route;
+} routeObject;
+
+static PyObject *
+route_get_map_py(routeObject *self, PyObject *args)
+{
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+ return map_py_ref(route_get_map(self->route));
+}
+
+
+
+static PyMethodDef route_methods[] = {
+ {"get_map", (PyCFunction) route_get_map_py, METH_VARARGS },
+ {NULL, NULL },
+};
+
+
+static PyObject *
+route_getattr_py(PyObject *self, char *name)
+{
+ return Py_FindMethod(route_methods, self, name);
+}
+
+static void
+route_destroy_py(routeObject *self)
+{
+}
+
+PyTypeObject route_Type = {
+ Obj_HEAD
+ .tp_name="route",
+ .tp_basicsize=sizeof(routeObject),
+ .tp_dealloc=(destructor)route_destroy_py,
+ .tp_getattr=route_getattr_py,
+};
+
+PyObject *
+route_py(PyObject *self, PyObject *args)
+{
+ routeObject *ret;
+
+ ret=PyObject_NEW(routeObject, &route_Type);
+ return (PyObject *)ret;
+}
+
+PyObject *
+route_py_ref(struct route *route)
+{
+ routeObject *ret;
+
+ ret=PyObject_NEW(routeObject, &route_Type);
+ ret->route=route;
+ return (PyObject *)ret;
+}
+
+
diff --git a/binding/python/startup.py b/binding/python/startup.py
new file mode 100644
index 00000000..02b20700
--- /dev/null
+++ b/binding/python/startup.py
@@ -0,0 +1,8 @@
+import navit
+navit.config_load("navit.xml.local")
+pos=navit.pcoord("5023.7493 N 00730.2898 E",1);
+dest=navit.pcoord("5023.6604 N 00729.8500 E",1);
+inst=navit.main().navit();
+inst.set_position(pos);
+inst.set_destination(dest,"Test");
+inst.set_center(pos);
diff --git a/binding/python/template.c b/binding/python/template.c
new file mode 100644
index 00000000..088cb5ee
--- /dev/null
+++ b/binding/python/template.c
@@ -0,0 +1,96 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "common.h"
+#include "template.h"
+
+typedef struct {
+ PyObject_HEAD
+ int ref;
+ struct template *template;
+} templateObject;
+
+static PyObject *
+template_func(templateObject *self, PyObject *args)
+{
+ const char *file;
+ int ret;
+ if (!PyArg_ParseTuple(args, "s", &file))
+ return NULL;
+ ret=0;
+ return Py_BuildValue("i",ret);
+}
+
+
+
+static PyMethodDef template_methods[] = {
+ {"func", (PyCFunction) template_func, METH_VARARGS },
+ {NULL, NULL },
+};
+
+
+static PyObject *
+template_getattr_py(PyObject *self, char *name)
+{
+ return Py_FindMethod(template_methods, self, name);
+}
+
+static void
+template_destroy_py(templateObject *self)
+{
+ if (! self->ref)
+ template_destroy(self->template);
+}
+
+PyTypeObject template_Type = {
+ Obj_HEAD
+ .tp_name="template",
+ .tp_basicsize=sizeof(templateObject),
+ .tp_dealloc=(destructor)template_destroy_py,
+ .tp_getattr=template_getattr_py,
+};
+
+struct template *
+template_py_get(PyObject *self)
+{
+ return ((templateObject *)self)->template;
+}
+
+PyObject *
+template_new_py(PyObject *self, PyObject *args)
+{
+ templateObject *ret;
+
+ ret=PyObject_NEW(templateObject, &template_Type);
+ ret->template=template_new();
+ ret->ref=0;
+ return (PyObject *)ret;
+}
+
+PyObject *
+template_new_py_ref(struct template *template)
+{
+ templateObject *ret;
+
+ ret=PyObject_NEW(templateObject, &template_Type);
+ ret->ref=1;
+ ret->template=template;
+ return (PyObject *)ret;
+}
+
diff --git a/cache.c b/cache.c
new file mode 100644
index 00000000..cd12a828
--- /dev/null
+++ b/cache.c
@@ -0,0 +1,358 @@
+#include <glib.h>
+#ifdef DEBUG_CACHE
+#include <stdio.h>
+#endif
+#include <string.h>
+#include "debug.h"
+#include "cache.h"
+
+struct cache_entry {
+ int usage;
+ int size;
+ struct cache_entry_list *where;
+ struct cache_entry *next;
+ struct cache_entry *prev;
+ int id[0];
+};
+
+struct cache_entry_list {
+ struct cache_entry *first, *last;
+ int size;
+};
+
+struct cache {
+ struct cache_entry_list t1,b1,t2,b2,*insert;
+ int size,id_size,entry_size;
+ int t1_target;
+ int misses;
+ int hits;
+ GHashTable *hash;
+};
+
+static void
+cache_entry_dump(struct cache *cache, struct cache_entry *entry)
+{
+ int i,size;
+ dbg(0,"Usage: %d size %d\n",entry->usage, entry->size);
+ if (cache)
+ size=cache->id_size;
+ else
+ size=5;
+ for (i = 0 ; i < size ; i++) {
+ dbg(0,"0x%x\n", entry->id[i]);
+ }
+}
+
+static void
+cache_list_dump(char *str, struct cache *cache, struct cache_entry_list *list)
+{
+ struct cache_entry *first=list->first;
+ dbg(0,"dump %s %d\n",str, list->size);
+ while (first) {
+ cache_entry_dump(cache, first);
+ first=first->next;
+ }
+}
+
+static guint
+cache_hash4(gconstpointer key)
+{
+ int *id=(int *)key;
+ return id[0];
+}
+
+static guint
+cache_hash20(gconstpointer key)
+{
+ int *id=(int *)key;
+ return id[0]^id[1]^id[2]^id[3]^id[4];
+}
+
+static gboolean
+cache_equal4(gconstpointer a, gconstpointer b)
+{
+ int *ida=(int *)a;
+ int *idb=(int *)b;
+
+ return ida[0] == idb[0];
+}
+
+static gboolean
+cache_equal20(gconstpointer a, gconstpointer b)
+{
+ int *ida=(int *)a;
+ int *idb=(int *)b;
+
+ return(ida[0] == idb[0] &&
+ ida[1] == idb[1] &&
+ ida[2] == idb[2] &&
+ ida[3] == idb[3] &&
+ ida[4] == idb[4]);
+}
+
+struct cache *
+cache_new(int id_size, int size)
+{
+ struct cache *cache=g_new0(struct cache, 1);
+
+ cache->id_size=id_size/4;
+ cache->entry_size=cache->id_size*sizeof(int)+sizeof(struct cache_entry);
+ cache->size=size;
+ switch (id_size) {
+ case 4:
+ cache->hash=g_hash_table_new(cache_hash4, cache_equal4);
+ break;
+ case 20:
+ cache->hash=g_hash_table_new(cache_hash20, cache_equal20);
+ break;
+ default:
+ dbg(0,"cache with id_size of %d not supported\n", id_size);
+ g_free(cache);
+ cache=NULL;
+ }
+ return cache;
+}
+
+static void
+cache_insert_mru(struct cache *cache, struct cache_entry_list *list, struct cache_entry *entry)
+{
+ entry->prev=NULL;
+ entry->next=list->first;
+ entry->where=list;
+ if (entry->next)
+ entry->next->prev=entry;
+ list->first=entry;
+ if (! list->last)
+ list->last=entry;
+ list->size+=entry->size;
+ if (cache)
+ g_hash_table_insert(cache->hash, (gpointer)entry->id, entry);
+}
+
+static void
+cache_remove_from_list(struct cache_entry_list *list, struct cache_entry *entry)
+{
+ if (entry->prev)
+ entry->prev->next=entry->next;
+ else
+ list->first=entry->next;
+ if (entry->next)
+ entry->next->prev=entry->prev;
+ else
+ list->last=entry->prev;
+ list->size-=entry->size;
+}
+
+static void
+cache_remove(struct cache *cache, struct cache_entry *entry)
+{
+ dbg(1,"remove 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]);
+ g_hash_table_remove(cache->hash, (gpointer)(entry->id));
+ g_free(entry);
+}
+
+static struct cache_entry *
+cache_remove_lru_helper(struct cache_entry_list *list)
+{
+ struct cache_entry *last=list->last;
+ if (! last)
+ return NULL;
+ list->last=last->prev;
+ if (last->prev)
+ last->prev->next=NULL;
+ else
+ list->first=NULL;
+ list->size-=last->size;
+ return last;
+}
+
+static struct cache_entry *
+cache_remove_lru(struct cache *cache, struct cache_entry_list *list)
+{
+ struct cache_entry *last;
+ int seen=0;
+ while (list->last && list->last->usage && seen < list->size) {
+ last=cache_remove_lru_helper(list);
+ cache_insert_mru(NULL, list, last);
+ seen+=last->size;
+ }
+ last=list->last;
+ if (! last || last->usage || seen >= list->size)
+ return NULL;
+ dbg(1,"removing %d\n", last->id[0]);
+ cache_remove_lru_helper(list);
+ if (cache) {
+ cache_remove(cache, last);
+ return NULL;
+ }
+ return last;
+}
+
+void *
+cache_entry_new(struct cache *cache, void *id, int size)
+{
+ size+=cache->entry_size;
+ cache->misses+=size;
+ struct cache_entry *ret=(struct cache_entry *)g_malloc0(size);
+ ret->size=size;
+ ret->usage=1;
+ memcpy(ret->id, id, cache->id_size*sizeof(int));
+ return &ret->id[cache->id_size];
+}
+
+void
+cache_entry_destroy(struct cache *cache, void *data)
+{
+ struct cache_entry *entry=(struct cache_entry *)((char *)data-cache->entry_size);
+ dbg(1,"destroy 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]);
+ entry->usage--;
+}
+
+static struct cache_entry *
+cache_trim(struct cache *cache, struct cache_entry *entry)
+{
+ dbg(1,"trim 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]);
+ return g_realloc(entry, cache->entry_size);
+}
+
+static struct cache_entry *
+cache_move(struct cache *cache, struct cache_entry_list *old, struct cache_entry_list *new)
+{
+ struct cache_entry *entry;
+ entry=cache_remove_lru(NULL, old);
+ if (! entry)
+ return NULL;
+ entry=cache_trim(cache, entry);
+ cache_insert_mru(NULL, new, entry);
+ return entry;
+}
+
+static int
+cache_replace(struct cache *cache)
+{
+ if (cache->t1.size >= MAX(1,cache->t1_target)) {
+ dbg(1,"replace 12\n");
+ if (!cache_move(cache, &cache->t1, &cache->b1))
+ cache_move(cache, &cache->t2, &cache->b2);
+ } else {
+ dbg(1,"replace t2\n");
+ if (!cache_move(cache, &cache->t2, &cache->b2))
+ cache_move(cache, &cache->t1, &cache->b1);
+ }
+#if 0
+ if (! entry) {
+ cache_dump(cache);
+ exit(0);
+ }
+#endif
+ return 1;
+}
+
+
+void *
+cache_lookup(struct cache *cache, void *id) {
+ struct cache_entry *entry;
+
+ dbg(1,"get %d\n", ((int *)id)[0]);
+ entry=g_hash_table_lookup(cache->hash, id);
+ if (entry == NULL) {
+ cache->insert=&cache->t1;
+#ifdef DEBUG_CACHE
+ fprintf(stderr,"-");
+#endif
+ dbg(1,"not in cache\n");
+ return NULL;
+ }
+ dbg(1,"found 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]);
+ if (entry->where == &cache->t1 || entry->where == &cache->t2) {
+ cache->hits+=entry->size;
+#ifdef DEBUG_CACHE
+ if (entry->where == &cache->t1)
+ fprintf(stderr,"h");
+ else
+ fprintf(stderr,"H");
+#endif
+ dbg(1,"in cache %s\n", entry->where == &cache->t1 ? "T1" : "T2");
+ cache_remove_from_list(entry->where, entry);
+ cache_insert_mru(NULL, &cache->t2, entry);
+ entry->usage++;
+ return &entry->id[cache->id_size];
+ } else {
+ if (entry->where == &cache->b1) {
+#ifdef DEBUG_CACHE
+ fprintf(stderr,"m");
+#endif
+ dbg(1,"in phantom cache B1\n");
+ cache->t1_target=MIN(cache->t1_target+MAX(cache->b2.size/cache->b1.size, 1),cache->size);
+ cache_remove_from_list(&cache->b1, entry);
+ } else if (entry->where == &cache->b2) {
+#ifdef DEBUG_CACHE
+ fprintf(stderr,"M");
+#endif
+ dbg(1,"in phantom cache B2\n");
+ cache->t1_target=MAX(cache->t1_target-MAX(cache->b1.size/cache->b2.size, 1),0);
+ cache_remove_from_list(&cache->b2, entry);
+ } else {
+ dbg(0,"**ERROR** invalid where\n");
+ }
+ cache_replace(cache);
+ cache_remove(cache, entry);
+ cache->insert=&cache->t2;
+ return NULL;
+ }
+}
+
+void
+cache_insert(struct cache *cache, void *data)
+{
+ struct cache_entry *entry=(struct cache_entry *)((char *)data-cache->entry_size);
+ dbg(1,"insert 0x%x 0x%x 0x%x 0x%x 0x%x\n", entry->id[0], entry->id[1], entry->id[2], entry->id[3], entry->id[4]);
+ if (cache->insert == &cache->t1) {
+ if (cache->t1.size + cache->b1.size >= cache->size) {
+ if (cache->t1.size < cache->size) {
+ cache_remove_lru(cache, &cache->b1);
+ cache_replace(cache);
+ } else {
+ cache_remove_lru(cache, &cache->t1);
+ }
+ } else {
+ if (cache->t1.size + cache->t2.size + cache->b1.size + cache->b2.size >= cache->size) {
+ if (cache->t1.size + cache->t2.size + cache->b1.size + cache->b2.size >= 2*cache->size)
+ cache_remove_lru(cache, &cache->b2);
+ cache_replace(cache);
+ }
+ }
+ }
+ cache_insert_mru(cache, cache->insert, entry);
+}
+
+void *
+cache_insert_new(struct cache *cache, void *id, int size)
+{
+ void *data=cache_entry_new(cache, id, size);
+ cache_insert(cache, data);
+ return data;
+}
+
+static void
+cache_stats(struct cache *cache)
+{
+ dbg(0,"hits %d misses %d hitratio %d size %d entry_size %d id_size %d T1 target %d\n", cache->hits, cache->misses, cache->hits*100/(cache->hits+cache->misses), cache->size, cache->entry_size, cache->id_size, cache->t1_target);
+ dbg(0,"T1:%d B1:%d T2:%d B2:%d\n", cache->t1.size, cache->b1.size, cache->t2.size, cache->b2.size);
+ cache->hits=0;
+ cache->misses=0;
+}
+
+void
+cache_dump(struct cache *cache)
+{
+ struct cache_entry *first;
+ first=cache->t1.first;
+ cache_stats(cache);
+ cache_list_dump("T1", cache, &cache->t1);
+ cache_list_dump("B1", cache, &cache->b1);
+ cache_list_dump("T2", cache, &cache->t2);
+ cache_list_dump("B2", cache, &cache->b2);
+ dbg(0,"dump end\n");
+}
+
diff --git a/cache.h b/cache.h
new file mode 100644
index 00000000..f67c0c08
--- /dev/null
+++ b/cache.h
@@ -0,0 +1,11 @@
+struct cache_entry;
+struct cache;
+/* prototypes */
+struct cache *cache_new(int id_size, int size);
+void *cache_entry_new(struct cache *cache, void *id, int size);
+void cache_entry_destroy(struct cache *cache, void *data);
+void *cache_lookup(struct cache *cache, void *id);
+void cache_insert(struct cache *cache, void *data);
+void *cache_insert_new(struct cache *cache, void *id, int size);
+void cache_dump(struct cache *cache);
+/* end of prototypes */
diff --git a/callback.c b/callback.c
new file mode 100644
index 00000000..fa2087b9
--- /dev/null
+++ b/callback.c
@@ -0,0 +1,268 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "item.h"
+#include "debug.h"
+#include "callback.h"
+
+struct callback {
+ void (*func)();
+ int pcount;
+ enum attr_type type;
+ void *p[0];
+
+};
+
+struct callback_list {
+ GList *list;
+};
+
+struct callback_list *
+callback_list_new(void)
+{
+ struct callback_list *ret=g_new0(struct callback_list, 1);
+
+ return ret;
+}
+
+struct callback *
+callback_new_attr(void (*func)(void), enum attr_type type, int pcount, void **p)
+{
+ struct callback *ret;
+ int i;
+
+ ret=g_malloc0(sizeof(struct callback)+pcount*sizeof(void *));
+ ret->func=func;
+ ret->pcount=pcount;
+ ret->type=type;
+ for (i = 0 ; i < pcount ; i++) {
+ ret->p[i]=p[i];
+ }
+ return ret;
+}
+
+struct callback *
+callback_new_attr_args(void (*func)(void), enum attr_type type, int count, ...)
+{
+ int i;
+ void *p[count];
+ va_list ap;
+ va_start(ap, count);
+ for (i = 0 ; i < count ; i++)
+ p[i]=va_arg(ap, void *);
+ va_end(ap);
+ return callback_new_attr(func, type, count, p);
+}
+
+struct callback *
+callback_new(void (*func)(void), int pcount, void **p)
+{
+ return callback_new_attr(func, attr_none, pcount, p);
+}
+
+struct callback *
+callback_new_args(void (*func)(void), int count, ...)
+{
+ int i;
+ void *p[count];
+ va_list ap;
+ va_start(ap, count);
+ for (i = 0 ; i < count ; i++)
+ p[i]=va_arg(ap, void *);
+ va_end(ap);
+ return callback_new(func, count, p);
+}
+
+void
+callback_destroy(struct callback *cb)
+{
+ g_free(cb);
+}
+
+void
+callback_set_arg(struct callback *cb, int arg, void *p)
+{
+ if (arg < 0 || arg > cb->pcount)
+ return;
+ cb->p[arg]=p;
+}
+
+void
+callback_list_add(struct callback_list *l, struct callback *cb)
+{
+ l->list=g_list_prepend(l->list, cb);
+}
+
+
+struct callback *
+callback_list_add_new(struct callback_list *l, void (*func)(void), int pcount, void **p)
+{
+ struct callback *ret;
+
+ ret=callback_new(func, pcount, p);
+ callback_list_add(l, ret);
+ return ret;
+}
+
+void
+callback_list_remove(struct callback_list *l, struct callback *cb)
+{
+ l->list=g_list_remove(l->list, cb);
+}
+
+void
+callback_list_remove_destroy(struct callback_list *l, struct callback *cb)
+{
+ callback_list_remove(l, cb);
+ g_free(cb);
+}
+
+void
+callback_call(struct callback *cb, int pcount, void **p)
+{
+ int i;
+ void *pf[8];
+ if (! cb)
+ return;
+ if (cb->pcount + pcount <= 8) {
+ dbg(1,"cb->pcount=%d\n", cb->pcount);
+ if (cb->pcount && cb->p)
+ dbg(1,"cb->p[0]=%p\n", cb->p[0]);
+ dbg(1,"pcount=%d\n", pcount);
+ if (pcount) {
+ dbg_assert(p!=NULL);
+ dbg(1,"p[0]=%p\n", p[0]);
+ }
+ for (i = 0 ; i < cb->pcount ; i++)
+ pf[i]=cb->p[i];
+ for (i = 0 ; i < pcount ; i++)
+ pf[i+cb->pcount]=p[i];
+ switch (cb->pcount+pcount) {
+ case 8:
+ cb->func(pf[0],pf[1],pf[2],pf[3],pf[4],pf[5],pf[6],pf[7]);
+ break;
+ case 7:
+ cb->func(pf[0],pf[1],pf[2],pf[3],pf[4],pf[5],pf[6]);
+ break;
+ case 6:
+ cb->func(pf[0],pf[1],pf[2],pf[3],pf[4],pf[5]);
+ break;
+ case 5:
+ cb->func(pf[0],pf[1],pf[2],pf[3],pf[4]);
+ break;
+ case 4:
+ cb->func(pf[0],pf[1],pf[2],pf[3]);
+ break;
+ case 3:
+ cb->func(pf[0],pf[1],pf[2]);
+ break;
+ case 2:
+ cb->func(pf[0],pf[1]);
+ break;
+ case 1:
+ cb->func(pf[0]);
+ break;
+ case 0:
+ cb->func();
+ break;
+ }
+ } else {
+ dbg(0,"too many parameters for callback (%d+%d)\n", cb->pcount, pcount);
+ }
+}
+
+void
+callback_call_args(struct callback *cb, int count, ...)
+{
+ int i;
+ void *p[count];
+ va_list ap;
+ va_start(ap, count);
+ for (i = 0 ; i < count ; i++)
+ p[i]=va_arg(ap, void *);
+ va_end(ap);
+ callback_call(cb, count, p);
+}
+
+void
+callback_list_call_attr(struct callback_list *l, enum attr_type type, int pcount, void **p)
+{
+ GList *cbi;
+ struct callback *cb;
+
+ if (!l) {
+ return;
+ }
+
+ cbi=l->list;
+ while (cbi) {
+ cb=cbi->data;
+ if (type == attr_any || cb->type == attr_any || cb->type == type)
+ callback_call(cb, pcount, p);
+ cbi=g_list_next(cbi);
+ }
+
+}
+
+void
+callback_list_call_attr_args(struct callback_list *cbl, enum attr_type type, int count, ...)
+{
+ int i;
+ void *p[count];
+ va_list ap;
+ va_start(ap, count);
+ for (i = 0 ; i < count ; i++)
+ p[i]=va_arg(ap, void *);
+ va_end(ap);
+ callback_list_call_attr(cbl, type, count, p);
+}
+
+void
+callback_list_call(struct callback_list *l, int pcount, void **p)
+{
+ callback_list_call_attr(l, attr_any, pcount, p);
+}
+
+void
+callback_list_call_args(struct callback_list *cbl, int count, ...)
+{
+ int i;
+ void *p[count];
+ va_list ap;
+ va_start(ap, count);
+ for (i = 0 ; i < count ; i++)
+ p[i]=va_arg(ap, void *);
+ va_end(ap);
+ callback_list_call(cbl, count, p);
+}
+
+void
+callback_list_destroy(struct callback_list *l)
+{
+ GList *cbi;
+ cbi=l->list;
+ while (cbi) {
+ g_free(cbi->data);
+ cbi=g_list_next(cbi);
+ }
+ g_list_free(l->list);
+ g_free(l);
+}
diff --git a/callback.h b/callback.h
new file mode 100644
index 00000000..b0f4b9f8
--- /dev/null
+++ b/callback.h
@@ -0,0 +1,89 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_CALLBACK_H
+#define NAVIT_CALLBACK_H
+
+#include "item.h"
+#include "attr.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/* prototypes */
+enum attr_type;
+struct callback;
+struct callback_list;
+struct callback_list *callback_list_new(void);
+struct callback *callback_new_attr(void (*func)(void), enum attr_type type, int pcount, void **p);
+struct callback *callback_new_attr_args(void (*func)(void), enum attr_type type, int count, ...);
+struct callback *callback_new(void (*func)(void), int pcount, void **p);
+struct callback *callback_new_args(void (*func)(void), int count, ...);
+void callback_destroy(struct callback *cb);
+void callback_set_arg(struct callback *cb, int arg, void *p);
+void callback_list_add(struct callback_list *l, struct callback *cb);
+struct callback *callback_list_add_new(struct callback_list *l, void (*func)(void), int pcount, void **p);
+void callback_list_remove(struct callback_list *l, struct callback *cb);
+void callback_list_remove_destroy(struct callback_list *l, struct callback *cb);
+void callback_call(struct callback *cb, int pcount, void **p);
+void callback_call_args(struct callback *cb, int count, ...);
+void callback_list_call_attr(struct callback_list *l, enum attr_type type, int pcount, void **p);
+void callback_list_call_attr_args(struct callback_list *cbl, enum attr_type type, int count, ...);
+void callback_list_call(struct callback_list *l, int pcount, void **p);
+void callback_list_call_args(struct callback_list *cbl, int count, ...);
+void callback_list_destroy(struct callback_list *l);
+/* end of prototypes */
+
+#define callback_new_0(func) callback_new_args(func, 0)
+#define callback_new_1(func,p1) callback_new_args(func, 1, p1)
+#define callback_new_2(func,p1,p2) callback_new_args(func, 2, p1, p2)
+#define callback_new_3(func,p1,p2,p3) callback_new_args(func, 3, p1, p2, p3)
+#define callback_new_4(func,p1,p2,p3,p4) callback_new_args(func, 4, p1, p2, p3, p4)
+
+#define callback_new_attr_0(func,type) callback_new_attr_args(func, type, 0)
+#define callback_new_attr_1(func,type,p1) callback_new_attr_args(func, type, 1, p1)
+#define callback_new_attr_2(func,type,p1,p2) callback_new_attr_args(func, type, 2, p1, p2)
+#define callback_new_attr_3(func,type,p1,p2,p3) callback_new_attr_args(func, type, 3, p1, p2, p3)
+#define callback_new_attr_4(func,type,p1,p2,p3,p4) callback_new_attr_args(func, type, 4, p1, p2, p3, p4)
+
+#define callback_call_0(cb) callback_call_args(cb, 0)
+#define callback_call_1(cb,p1) callback_call_args(cb, 1, p1)
+#define callback_call_2(cb,p1,p2) callback_call_args(cb, 2, p1, p2)
+#define callback_call_3(cb,p1,p2,p3) callback_call_args(cb, 3, p1, p2, p3)
+#define callback_call_4(cb,p1,p2,p3,p4) callback_call_args(cb, 4, p1, p2, p3, p4)
+
+#define callback_list_call_0(cbl) callback_list_call_args(cbl, 0)
+#define callback_list_call_1(cbl,p1) callback_list_call_args(cbl, 1, p1)
+#define callback_list_call_2(cbl,p1,p2) callback_list_call_args(cbl, 2, p1, p2)
+#define callback_list_call_3(cbl,p1,p2,p3) callback_list_call_args(cbl, 3, p1, p2, p3)
+#define callback_list_call_4(cbl,p1,p2,p3,p4) callback_list_call_args(cbl, 4, p1, p2, p3, p4)
+
+#define callback_list_call_attr_0(cbl,type) callback_list_call_attr_args(cbl,type, 0)
+#define callback_list_call_attr_1(cbl,type,p1) callback_list_call_attr_args(cbl, type, 1, p1)
+#define callback_list_call_attr_2(cbl,type,p1,p2) callback_list_call_attr_args(cbl, type, 2, p1, p2)
+#define callback_list_call_attr_3(cbl,type,p1,p2,p3) callback_list_call_attr_args(cbl, type, 3, p1, p2, p3)
+#define callback_list_call_attr_4(cbl,type,p1,p2,p3,p4) callback_list_call_attr_args(cbl, type, 4, p1, p2, p3, p4)
+
+#define callback_cast(x) (void (*)(void))(x)
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/color.h b/color.h
new file mode 100644
index 00000000..c41d9884
--- /dev/null
+++ b/color.h
@@ -0,0 +1,27 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_COLOR_H
+#define NAVIT_COLOR_H
+
+struct color {
+ int r,g,b,a;
+};
+
+#endif
diff --git a/command.c b/command.c
new file mode 100644
index 00000000..ec5fb56e
--- /dev/null
+++ b/command.c
@@ -0,0 +1,1013 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <glib.h>
+#include "item.h"
+#include "xmlconfig.h"
+#include "main.h"
+#include "navit.h"
+#include "vehicle.h"
+#include "speech.h"
+#include "gui.h"
+#include "debug.h"
+#include "callback.h"
+#include "command.h"
+#include "event.h"
+
+/*
+gui.fullscreen()
+gui.menu()
+gui.get_data()
+zoom_in()
+zoom_out()
+speech.active=!speech.active
+osd_configuration=1
+Not yet:
+osd[type=="xxx"].active=0;osd[type=="yyy"].active=0
+*/
+
+
+struct result {
+ struct attr attr;
+ double val;
+ char *var;
+ int varlen;
+ char *attrn;
+ int attrnlen;
+ int allocated;
+};
+
+struct context {
+ struct attr *attr;
+ int error;
+ char *expr;
+ struct result res;
+};
+
+struct command_saved_cb {
+ struct callback *cb;
+ struct attr attr;
+};
+
+struct command_saved {
+ struct context ctx;
+ struct result res;
+ char *command; // The command string itself
+ struct event_idle *idle_ev; // Event to update this command
+ struct callback *idle_cb;
+ struct callback *register_cb; // Callback to register all the callbacks
+ struct event_idle *register_ev; // Idle event to register all the callbacks
+ struct attr navit;
+ int num_cbs;
+ struct command_saved_cb *cbs; // List of callbacks for this saved command
+ struct callback *cb; // Callback that should be called when we re-evaluate
+ int error;
+};
+
+enum error {
+ no_error=0,missing_closing_brace, missing_colon, wrong_type, illegal_number_format, illegal_character, missing_closing_bracket, invalid_type, not_ready
+};
+
+static void eval_comma(struct context *ctx, struct result *res);
+static struct attr ** eval_list(struct context *ctx);
+
+static void
+result_free(struct result *res)
+{
+}
+
+static int command_register_callbacks(struct command_saved *cs);
+
+static char *
+get_op(struct context *ctx, int test, ...)
+{
+ char *op,*ret=NULL;
+ va_list ap;
+
+ while (g_ascii_isspace(*ctx->expr)) {
+ ctx->expr++;
+ }
+
+ va_start(ap, test);
+ while ((op = va_arg(ap, char *))) {
+ if (!strncmp(ctx->expr, op, strlen(op))) {
+ ret=ctx->expr;
+ if (! test)
+ ctx->expr+=strlen(op);
+ break;
+ }
+ }
+ va_end(ap);
+ return ret;
+}
+
+static int
+is_int(struct result *res)
+{
+ return 1;
+}
+
+static int
+is_double(struct result *res)
+{
+ return 0;
+}
+
+static void
+dump(struct result *res)
+{
+ char object[res->varlen+1];
+ char attribute[res->attrnlen+1];
+ if (res->var)
+ strncpy(object, res->var, res->varlen);
+ object[res->varlen]='\0';
+ if (res->attrn)
+ strncpy(attribute, res->attrn, res->attrnlen);
+ attribute[res->attrnlen]='\0';
+ dbg(0,"type:%s\n", attr_to_name(res->attr.type));
+ dbg(0,"attribute '%s' from '%s'\n", attribute, object);
+}
+
+static enum attr_type
+command_attr_type(struct result *res)
+{
+ char attrn[res->attrnlen+1];
+
+ strncpy(attrn, res->attrn, res->attrnlen);
+ attrn[res->attrnlen]='\0';
+ return attr_from_name(attrn);
+}
+
+static int
+command_object_get_attr(struct context *ctx, struct attr *object, enum attr_type attr_type, struct attr *ret)
+{
+ struct object_func *func=object_func_lookup(object->type);
+ if (!func || !func->get_attr)
+ return 0;
+ return func->get_attr(object->u.data, attr_type, ret, NULL);
+}
+
+static void
+command_get_attr(struct context *ctx, struct result *res)
+{
+ int result;
+ enum attr_type attr_type=command_attr_type(res);
+ result=command_object_get_attr(ctx, &res->attr, attr_type, &res->attr);
+ if (result) {
+ res->var=res->attrn;
+ res->varlen=res->attrnlen;
+ } else {
+ res->attr.type=attr_none;
+ res->var=NULL;
+ res->varlen=0;
+ }
+ res->attrn=NULL;
+ res->attrnlen=0;
+ dump(res);
+}
+
+static void
+command_set_attr(struct context *ctx, struct result *res, struct result *newres)
+{
+ int result=0;
+ enum attr_type attr_type=command_attr_type(res);
+ struct object_func *func=object_func_lookup(res->attr.type);
+ if (!func || !func->set_attr)
+ return;
+ newres->attr.type=attr_type;
+ result=func->set_attr(res->attr.u.data, &newres->attr);
+ *res=*newres;
+}
+
+static void
+resolve_object(struct context *ctx, struct result *res)
+{
+ if (res->attr.type == attr_none && res->varlen) {
+ res->attr=*ctx->attr;
+ res->attrn=res->var;
+ res->attrnlen=res->varlen;
+ res->var=NULL;
+ res->varlen=0;
+ }
+}
+
+static void
+resolve(struct context *ctx, struct result *res, struct attr *parent) //FIXME What is that parent for?
+{
+ resolve_object(ctx, res);
+ if (res->attr.type >= attr_type_object_begin && res->attr.type <= attr_type_object_end) {
+ if (res->attrn)
+ command_get_attr(ctx, res);
+ return;
+ }
+}
+
+static double
+get_double(struct context *ctx, struct result *res)
+{
+ resolve(ctx, res, NULL);
+ return res->val;
+}
+
+
+
+static int
+get_int(struct context *ctx, struct result *res)
+{
+ resolve(ctx, res, NULL);
+ if (res->attr.type == attr_none)
+ return 0;
+ if (res->attr.type >= attr_type_int_begin && res->attr.type <= attr_type_int_end) {
+ return res->attr.u.num;
+ }
+ if (res->attr.type >= attr_type_double_begin && res->attr.type <= attr_type_double_end) {
+ return (int) (*res->attr.u.numd);
+ }
+ ctx->error=wrong_type;
+ return 0;
+}
+
+
+static char *
+get_string(struct context *ctx, struct result *res)
+{
+ resolve(ctx, res, NULL);
+ return attr_to_text(&res->attr, NULL, 0);
+}
+
+static void
+set_double(struct context *ctx, struct result *res, double val)
+{
+ result_free(res);
+ res->val=val;
+}
+
+static void
+set_int(struct context *ctx, struct result *res, int val)
+{
+ result_free(res);
+ res->attr.type=attr_type_int_begin;
+ res->attr.u.num=val;
+}
+
+
+static void
+eval_value(struct context *ctx, struct result *res) {
+ char *op;
+ int len,dots=0;
+ op=ctx->expr;
+ res->varlen=0;
+ res->var=NULL;
+ res->attrnlen=0;
+ res->attrn=NULL;
+
+ while (g_ascii_isspace(*op)) {
+ op++;
+ }
+
+ if (op[0] >= 'a' && op[0] <= 'z') {
+ res->attr.type=attr_none;
+ res->var=op;
+ while ((op[0] >= 'a' && op[0] <= 'z') || op[0] == '_') {
+ res->varlen++;
+ op++;
+ }
+ ctx->expr=op;
+ return;
+ }
+ if ((op[0] >= '0' && op[0] <= '9') ||
+ (op[0] == '.' && op[1] >= '0' && op[1] <= '9') ||
+ (op[0] == '-' && op[1] >= '0' && op[1] <= '9') ||
+ (op[0] == '-' && op[1] == '.' && op[2] >= '0' && op[2] <= '9')) {
+ while ((op[0] >= '0' && op[0] <= '9') || op[0] == '.' || (res->varlen == 0 && op[0] == '-')) {
+ if (op[0] == '.')
+ dots++;
+ if (dots > 1) {
+ ctx->error=illegal_number_format;
+ return;
+ }
+ res->varlen++;
+ op++;
+ }
+ if (dots) {
+ res->val = strtod(ctx->expr, NULL);
+ res->attr.type=attr_type_double_begin;
+ res->attr.u.numd=&res->val;
+ } else {
+ res->attr.type=attr_type_int_begin;
+ res->attr.u.num=atoi(ctx->expr);
+ }
+ ctx->expr=op;
+ return;
+ }
+ if (op[0] == '"') {
+ do {
+ op++;
+ } while (op[0] != '"');
+ res->attr.type=attr_type_string_begin;
+ len=op-ctx->expr-1;
+ res->attr.u.str=g_malloc(len+1);
+ strncpy(res->attr.u.str, ctx->expr+1, len);
+ res->attr.u.str[len]='\0';
+ op++;
+ ctx->expr=op;
+ return;
+ }
+ ctx->error=illegal_character;
+}
+
+static int
+get_next_object(struct context *ctx, struct result *res) {
+
+ while (*ctx->expr) {
+ res->varlen = 0;
+ ctx->error = 0;
+
+ eval_value(ctx,res);
+
+ if ((res->attr.type == attr_none) && (res->varlen > 0)) {
+ if (ctx->expr[0] != '.') {
+ return 1; // 1 means "this is the final object name"
+ } else {
+ return 2; // 2 means "there are more object names following" (e.g. we just hit 'vehicle' in 'vehicle.position_speed'
+ }
+ }
+
+ if (ctx->error) {
+ // Probably hit an operator
+ ctx->expr++;
+ }
+ }
+
+ return 0;
+}
+
+static void
+eval_brace(struct context *ctx, struct result *res)
+{
+ if (get_op(ctx,0,"(",NULL)) {
+ eval_comma(ctx, res);
+ if (ctx->error) return;
+ if (!get_op(ctx,0,")",NULL))
+ ctx->error=missing_closing_brace;
+ return;
+ }
+ eval_value(ctx, res);
+}
+
+static void
+command_call_function(struct context *ctx, struct result *res)
+{
+ struct attr cbl,**list=NULL;
+ char function[res->attrnlen+1];
+ if (res->attrn)
+ strncpy(function, res->attrn, res->attrnlen);
+ function[res->attrnlen]='\0';
+ dbg(0,"function=%s\n", function);
+ if (ctx->expr[0] != ')') {
+ list=eval_list(ctx);
+ if (ctx->error) return;
+ }
+ if (!get_op(ctx,0,")",NULL)) {
+ ctx->error=missing_closing_brace;
+ return;
+ }
+ if (command_object_get_attr(ctx, &res->attr, attr_callback_list, &cbl)) {
+ int valid;
+ dbg(0,"function call %s from %s\n",function, attr_to_name(res->attr.type));
+ callback_list_call_attr_4(cbl.u.callback_list, attr_command, function, list, NULL, &valid);
+ }
+ res->var=NULL;
+ res->varlen=0;
+ res->attrn=NULL;
+ res->attrnlen=0;
+ res->attr.type=attr_none;
+}
+
+static void
+eval_postfix(struct context *ctx, struct result *res)
+{
+ struct result tmp;
+ char *op;
+
+ eval_brace(ctx, res);
+ if (ctx->error) return;
+ for (;;) {
+ if (!(op=get_op(ctx,0,"[","(",".",NULL)))
+ return;
+ if (op[0] == '.') {
+ eval_brace(ctx, &tmp);
+ if (ctx->error) return;
+ resolve(ctx, res,NULL);
+ if (ctx->error) return;
+ res->attrn=tmp.var;
+ res->attrnlen=tmp.varlen;
+ dump(res);
+ } else if (op[0] == '[') {
+ if (!get_op(ctx,0,"]",NULL)) {
+ ctx->error=missing_closing_bracket;
+ return;
+ }
+ } else if (op[0] == '(') {
+ dbg(0,"function call\n");
+ resolve_object(ctx, res);
+ command_call_function(ctx, res);
+ }
+ }
+}
+
+static void
+eval_unary(struct context *ctx, struct result *res)
+{
+ char *op;
+ op=get_op(ctx,0,"~","!",NULL);
+ if (op) {
+ eval_unary(ctx, res);
+ if (ctx->error) return;
+ if (op[0] == '~')
+ set_int(ctx, res, ~get_int(ctx, res));
+ else
+ set_int(ctx, res, !get_int(ctx, res));
+ } else
+ eval_postfix(ctx, res);
+}
+
+static void
+eval_multiplicative(struct context *ctx, struct result *res)
+{
+ struct result tmp;
+ char *op;
+
+ eval_unary(ctx, res);
+ if (ctx->error) return;
+ for (;;) {
+ if (!(op=get_op(ctx,0,"*","/","%",NULL))) return;
+ eval_unary(ctx, &tmp);
+ if (ctx->error) return;
+ if (is_double(res) || is_double(&tmp)) {
+ if (op[0] == '*')
+ set_double(ctx, res, get_double(ctx, res) * get_double(ctx, &tmp));
+ else if (op[0] == '/')
+ set_double(ctx, res, get_double(ctx, res) / get_double(ctx, &tmp));
+ else {
+ ctx->error=invalid_type;
+ return;
+ }
+ } else {
+ if (op[0] == '*')
+ set_int(ctx, res, get_int(ctx, res) * get_int(ctx, &tmp));
+ else if (op[0] == '/')
+ set_int(ctx, res, get_int(ctx, res) / get_int(ctx, &tmp));
+ else
+ set_int(ctx, res, get_int(ctx, res) % get_int(ctx, &tmp));
+ }
+ if (ctx->error) return;
+ }
+}
+
+static void
+eval_additive(struct context *ctx, struct result *res)
+{
+ struct result tmp;
+ char *op;
+
+ eval_multiplicative(ctx, res);
+ if (ctx->error) return;
+ for (;;) {
+ if (!(op=get_op(ctx,0,"-","+",NULL))) return;
+ eval_multiplicative(ctx, &tmp);
+ if (ctx->error) return;
+ if (is_double(res) || is_double(&tmp)) {
+ if (op[0] == '+')
+ set_double(ctx, res, get_double(ctx, res) + get_double(ctx, &tmp));
+ else
+ set_double(ctx, res, get_double(ctx, res) - get_double(ctx, &tmp));
+ } else {
+ if (op[0] == '+')
+ set_int(ctx, res, get_int(ctx, res) + get_int(ctx, &tmp));
+ else
+ set_int(ctx, res, get_int(ctx, res) - get_int(ctx, &tmp));
+ }
+ if (ctx->error) return;
+ }
+}
+
+static void
+eval_equality(struct context *ctx, struct result *res)
+{
+ struct result tmp;
+ char *op;
+
+ eval_additive(ctx, res);
+ if (ctx->error) return;
+ for (;;) {
+ if (!(op=get_op(ctx,0,"==","!=","<=",">=","<",">",NULL))) return;
+ eval_additive(ctx, &tmp);
+ if (ctx->error) return;
+
+ switch (op[0]) {
+ case '=':
+ set_int(ctx, res, (get_int(ctx, res) == get_int(ctx, &tmp)));
+ break;
+ case '!':
+ set_int(ctx, res, (get_int(ctx, res) != get_int(ctx, &tmp)));
+ break;
+ case '<':
+ if (op[1] == '=') {
+ set_int(ctx, res, (get_int(ctx, res) <= get_int(ctx, &tmp)));
+ } else {
+ set_int(ctx, res, (get_int(ctx, res) < get_int(ctx, &tmp)));
+ }
+ break;
+ case '>':
+ if (op[1] == '=') {
+ set_int(ctx, res, (get_int(ctx, res) >= get_int(ctx, &tmp)));
+ } else {
+ set_int(ctx, res, (get_int(ctx, res) > get_int(ctx, &tmp)));
+ }
+ break;
+ default:
+ break;
+ }
+ result_free(&tmp);
+ }
+}
+
+
+static void
+eval_bitwise_and(struct context *ctx, struct result *res)
+{
+ struct result tmp;
+
+ eval_equality(ctx, res);
+ if (ctx->error) return;
+ for (;;) {
+ if (get_op(ctx,1,"&&",NULL)) return;
+ if (!get_op(ctx,0,"&",NULL)) return;
+ eval_equality(ctx, &tmp);
+ if (ctx->error) return;
+ set_int(ctx, res, get_int(ctx, res) & get_int(ctx, &tmp));
+ if (ctx->error) return;
+ }
+}
+
+static void
+eval_bitwise_xor(struct context *ctx, struct result *res)
+{
+ struct result tmp;
+
+ eval_bitwise_and(ctx, res);
+ if (ctx->error) return;
+ for (;;) {
+ if (!get_op(ctx,0,"^",NULL)) return;
+ eval_bitwise_and(ctx, &tmp);
+ if (ctx->error) return;
+ set_int(ctx, res, get_int(ctx, res) ^ get_int(ctx, &tmp));
+ if (ctx->error) return;
+ }
+}
+
+static void
+eval_bitwise_or(struct context *ctx, struct result *res)
+{
+ struct result tmp;
+
+ eval_bitwise_xor(ctx, res);
+ if (ctx->error) return;
+ for (;;) {
+ if (get_op(ctx,1,"||",NULL)) return;
+ if (!get_op(ctx,0,"|",NULL)) return;
+ eval_bitwise_xor(ctx, &tmp);
+ if (ctx->error) return;
+ set_int(ctx, res, get_int(ctx, res) | get_int(ctx, &tmp));
+ if (ctx->error) return;
+ }
+}
+
+static void
+eval_logical_and(struct context *ctx, struct result *res)
+{
+ struct result tmp;
+
+ eval_bitwise_or(ctx, res);
+ if (ctx->error) return;
+ for (;;) {
+ if (!get_op(ctx,0,"&&",NULL)) return;
+ eval_bitwise_or(ctx, &tmp);
+ if (ctx->error) return;
+ set_int(ctx, res, get_int(ctx, res) && get_int(ctx, &tmp));
+ if (ctx->error) return;
+ }
+}
+
+static void
+eval_logical_or(struct context *ctx, struct result *res)
+{
+ struct result tmp;
+
+ eval_logical_and(ctx, res);
+ if (ctx->error) return;
+ for (;;) {
+ if (!get_op(ctx,0,"||",NULL)) return;
+ eval_logical_and(ctx, &tmp);
+ if (ctx->error) return;
+ set_int(ctx, res, get_int(ctx, res) || get_int(ctx, &tmp));
+ if (ctx->error) return;
+ }
+}
+
+static void
+eval_conditional(struct context *ctx, struct result *res)
+{
+ struct result tmp;
+ int cond;
+
+ eval_logical_or(ctx, res);
+ if (ctx->error) return;
+ if (!get_op(ctx,0,"?",NULL)) return;
+ cond=!!get_int(ctx, res);
+ if (ctx->error) return;
+ eval_logical_or(ctx, &tmp);
+ if (ctx->error) return;
+ if (cond)
+ *res=tmp;
+ if (!get_op(ctx,0,":",NULL)) {
+ ctx->error=missing_colon;
+ return;
+ }
+ eval_logical_or(ctx, &tmp);
+ if (ctx->error) return;
+ if (!cond)
+ *res=tmp;
+}
+
+/* = *= /= %= += -= >>= <<= &= ^= |= */
+
+static void
+eval_assignment(struct context *ctx, struct result *res)
+{
+ struct result tmp;
+ eval_conditional(ctx, res);
+ if (ctx->error) return;
+ if (!get_op(ctx,0,"=",NULL)) return;
+ eval_conditional(ctx, &tmp);
+ if (ctx->error) return;
+ resolve_object(ctx, res);
+ command_set_attr(ctx, res, &tmp);
+}
+
+/* , */
+static void
+eval_comma(struct context *ctx, struct result *res)
+{
+ struct result tmp;
+
+ eval_assignment(ctx, res);
+ if (ctx->error) return;
+ for (;;) {
+ if (!get_op(ctx,0,",",NULL)) return;
+ eval_assignment(ctx, &tmp);
+ if (ctx->error) return;
+ *res=tmp;
+ }
+}
+
+static struct attr **
+eval_list(struct context *ctx)
+{
+ struct result tmp;
+
+ struct attr **ret=NULL;
+ for (;;) {
+ eval_assignment(ctx, &tmp);
+ if (ctx->error) {
+ attr_list_free(ret);
+ return NULL;
+ }
+ ret=attr_generic_add_attr(ret, &tmp.attr);
+ if (!get_op(ctx,0,",",NULL)) return ret;
+ }
+}
+
+#if 0
+
+void command(struct attr *attr, char *expr)
+{
+ struct result res;
+ struct context ctx;
+ memset(&res, 0, sizeof(res));
+ memset(&ctx, 0, sizeof(ctx));
+ ctx.attr=attr;
+ ctx.error=0;
+ ctx.expr=expr;
+ printf("command='%s'\n", expr);
+ eval_comma(&ctx,&res);
+ printf("err=%d %s\n", ctx.error, ctx.expr);
+ dump(&res);
+ printf("***\n");
+ resolve(&ctx, &res, NULL);
+ dump(&res);
+ printf("%s\n", get_string(&ctx, &res));
+}
+#endif
+
+static void
+command_evaluate_to(struct attr *attr, char *expr, struct context *ctx, struct result *res)
+{
+ memset(res, 0, sizeof(*res));
+ memset(ctx, 0, sizeof(*ctx));
+ ctx->attr=attr;
+ ctx->expr=expr;
+ eval_comma(ctx,res);
+}
+
+void
+command_evaluate_to_void(struct attr *attr, char *expr, int **error)
+{
+ struct result res;
+ struct context ctx;
+ command_evaluate_to(attr, expr, &ctx, &res);
+ if (!ctx.error)
+ resolve(&ctx, &res, NULL);
+ if (error)
+ *error=&ctx.error;
+
+}
+
+char *
+command_evaluate_to_string(struct attr *attr, char *expr, int **error)
+{
+ struct result res;
+ struct context ctx;
+ char *ret=NULL;
+
+ command_evaluate_to(attr, expr, &ctx, &res);
+ if (!ctx.error)
+ ret=get_string(&ctx, &res);
+ if (error)
+ *error=&ctx.error;
+ if (ctx.error)
+ return NULL;
+ else
+ return ret;
+}
+
+int
+command_evaluate_to_int(struct attr *attr, char *expr, int **error)
+{
+ struct result res;
+ struct context ctx;
+ int ret=0;
+
+ command_evaluate_to(attr, expr, &ctx, &res);
+ if (!ctx.error)
+ ret=get_int(&ctx, &res);
+ if (error)
+ *error=&ctx.error;
+ if (ctx.error)
+ return 0;
+ else
+ return ret;
+}
+
+void
+command_evaluate(struct attr *attr, char *expr)
+{
+ struct result res;
+ struct context ctx;
+ memset(&res, 0, sizeof(res));
+ memset(&ctx, 0, sizeof(ctx));
+ ctx.attr=attr;
+ ctx.error=0;
+ ctx.expr=expr;
+ for (;;) {
+ eval_comma(&ctx,&res);
+ if (ctx.error)
+ return;
+ resolve(&ctx, &res, NULL);
+ if (ctx.error)
+ return;
+ if (!get_op(&ctx,0,";",NULL)) return;
+ }
+}
+
+#if 0
+void
+command_interpreter(struct attr *attr)
+{
+ char buffer[4096];
+ int size;
+ for (;;) {
+ size=read(0, buffer, 4095);
+ buffer[size]='\0';
+ if (size) {
+ buffer[size-1]='\0';
+ }
+ command(attr, buffer);
+ }
+}
+#endif
+
+static void
+command_table_call(struct command_table *table, int count, void *data, char *command, struct attr **in, struct attr ***out, int *valid)
+{
+ int i;
+ for (i = 0 ; i < count ; i++) {
+ if (!strcmp(command,table->command)) {
+ if (valid)
+ *valid=1;
+ table->func(data, command, in, out);
+ }
+ table++;
+ }
+}
+
+void
+command_add_table(struct callback_list *cbl, struct command_table *table, int count, void *data)
+{
+ struct callback *cb=callback_new_attr_3(callback_cast(command_table_call),attr_command, table, count, data);
+ callback_list_add(cbl, cb);
+}
+
+void
+command_saved_set_cb (struct command_saved *cs, struct callback *cb)
+{
+ cs->cb = cb;
+}
+
+int
+command_saved_get_int (struct command_saved *cs)
+{
+ return get_int(&cs->ctx, &cs->res);
+}
+
+int
+command_saved_error (struct command_saved *cs)
+{
+ return cs->error;
+}
+
+static void
+command_saved_evaluate_idle (struct command_saved *cs)
+{
+ // Only run once at a time
+ if (cs->idle_ev) {
+ event_remove_idle(cs->idle_ev);
+ cs->idle_ev = NULL;
+ }
+
+ command_evaluate_to(&cs->navit, cs->command, &cs->ctx, &cs->res);
+
+ if (!cs->ctx.error) {
+ cs->error = 0;
+
+ if (cs->cb) {
+ callback_call_1(cs->cb, cs);
+ }
+ } else {
+ cs->error = cs->ctx.error;
+ }
+}
+
+static void
+command_saved_evaluate(struct command_saved *cs)
+{
+ if (cs->idle_ev) {
+ // We're already scheduled for reevaluation
+ return;
+ }
+
+ if (!cs->idle_cb) {
+ cs->idle_cb = callback_new_1(callback_cast(command_saved_evaluate_idle), cs);
+ }
+
+ cs->idle_ev = event_add_idle(100, cs->idle_cb);
+}
+
+static void
+command_saved_callbacks_changed(struct command_saved *cs)
+{
+ // For now, we delete each and every callback and then re-create them
+ int i;
+ struct object_func *func;
+ struct attr attr;
+
+ if (cs->register_ev) {
+ event_remove_idle(cs->register_ev);
+ cs->register_ev = NULL;
+ }
+
+ attr.type = attr_callback;
+
+ for (i = 0; i < cs->num_cbs; i++) {
+ func = object_func_lookup(cs->cbs[i].attr.type);
+
+ if (!func->remove_attr) {
+ dbg(0, "Could not remove command-evaluation callback because remove_attr is missing for type %i!\n", cs->cbs[i].attr.type);
+ continue;
+ }
+
+ attr.u.callback = cs->cbs[i].cb;
+
+ func->remove_attr(cs->cbs[i].attr.u.data, &attr);
+ callback_destroy(cs->cbs[i].cb);
+ }
+
+ g_free(cs->cbs);
+ cs->cbs = NULL;
+ cs->num_cbs = 0;
+
+ // Now, re-create all the callbacks
+ command_register_callbacks(cs);
+}
+
+static int
+command_register_callbacks(struct command_saved *cs)
+{
+ struct attr prev,cb_attr,attr;
+ int status;
+ struct object_func *func;
+ struct callback *cb;
+
+ attr = cs->navit;
+ cs->ctx.expr = cs->command;
+ cs->ctx.attr = &attr;
+ prev = cs->navit;
+
+ while ((status = get_next_object(&cs->ctx, &cs->res)) != 0) {
+ resolve(&cs->ctx, &cs->res, NULL);
+
+ if (cs->ctx.error || (cs->res.attr.type == attr_none)) {
+ // We could not resolve an object, perhaps because it has not been created
+ return 0;
+ }
+
+ if (prev.type != attr_none) {
+ func = object_func_lookup(prev.type);
+
+ if (func->add_attr) {
+ if (status == 2) { // This is not the final attribute name
+ cb = callback_new_attr_1(callback_cast(command_saved_callbacks_changed), cs->res.attr.type, (void*)cs);
+ attr = cs->res.attr;
+ } else if (status == 1) { // This is the final attribute name
+ cb = callback_new_attr_1(callback_cast(command_saved_evaluate), cs->res.attr.type, (void*)cs);
+ cs->ctx.attr = &cs->navit;
+ } else {
+ dbg(0, "Error: Strange status returned from get_next_object()\n");
+ }
+
+ cs->num_cbs++;
+ cs->cbs = g_realloc(cs->cbs, (sizeof(struct command_saved_cb) * cs->num_cbs));
+ cs->cbs[cs->num_cbs-1].cb = cb;
+ cs->cbs[cs->num_cbs-1].attr = prev;
+
+ cb_attr.u.callback = cb;
+ cb_attr.type = attr_callback;
+
+ func->add_attr(prev.u.data, &cb_attr);
+
+ } else {
+ dbg(0, "Could not add callback because add_attr is missing for type %i}n", prev.type);
+ }
+ }
+
+ if (status == 2) {
+ prev = cs->res.attr;
+ } else {
+ prev = cs->navit;
+ }
+ }
+
+ command_saved_evaluate_idle(cs);
+
+ return 1;
+}
+
+struct command_saved
+*command_saved_new(char *command, struct navit *navit, struct callback *cb)
+{
+ struct command_saved *ret;
+
+ ret = g_new0(struct command_saved, 1);
+ ret->command = g_strdup(command);
+ ret->navit.u.navit = navit;
+ ret->navit.type = attr_navit;
+ ret->cb = cb;
+ ret->error = not_ready;
+
+ if (!command_register_callbacks(ret)) {
+ // We try this as an idle call again
+ ret->register_cb = callback_new_1(callback_cast(command_saved_callbacks_changed), ret);
+ ret->register_ev = event_add_idle(300, ret->register_cb);
+ }
+
+ return ret;
+}
+
+void
+command_saved_destroy(struct command_saved *cs)
+{
+ g_free(cs->command);
+ g_free(cs);
+}
diff --git a/command.h b/command.h
new file mode 100644
index 00000000..0b3ba746
--- /dev/null
+++ b/command.h
@@ -0,0 +1,20 @@
+
+struct command_table {
+ char *command;
+ int (*func)(void *data, char *cmd, struct attr **in, struct attr ***out);
+};
+
+struct command_saved;
+
+#define command_cast(x) (int (*)(void *, char *, struct attr **, struct attr ***))(x)
+
+void command_evaluate_to_void(struct attr *attr, char *expr, int **error);
+char *command_evaluate_to_string(struct attr *attr, char *expr, int **error);
+int command_evaluate_to_int(struct attr *attr, char *expr, int **error);
+void command_evaluate(struct attr *attr, char *expr);
+void command_add_table(struct callback_list *cbl, struct command_table *table, int count, void *data);
+struct command_saved *command_saved_new(char *command, struct navit *navit, struct callback *cb);
+void command_saved_destroy(struct command_saved *cs);
+int command_saved_get_int(struct command_saved *cs);
+int command_saved_error(struct command_saved *cs);
+void command_saved_set_cb(struct command_saved *cs, struct callback *cb);
diff --git a/compass.c b/compass.c
new file mode 100644
index 00000000..727e0516
--- /dev/null
+++ b/compass.c
@@ -0,0 +1,156 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <math.h>
+#include <stdio.h>
+#include <glib.h>
+#include "point.h"
+#include "coord.h"
+#include "graphics.h"
+#include "transform.h"
+#include "item.h"
+#include "route.h"
+#include "vehicle.h"
+#include "navit.h"
+#include "compass.h"
+
+#if 0
+struct compass {
+ struct graphics *gr;
+ struct graphics_gc *bg;
+ struct graphics_gc *white;
+ struct graphics_gc *green;
+ struct graphics_font *font;
+};
+
+static void
+transform_rotate(struct point *center, int angle, struct point *p, int count)
+{
+ int i,x,y;
+ double dx,dy;
+ for (i = 0 ; i < count ; i++)
+ {
+ dx=sin(M_PI*angle/180.0);
+ dy=cos(M_PI*angle/180.0);
+ x=dy*p->x-dx*p->y;
+ y=dx*p->x+dy*p->y;
+
+ p->x=center->x+x;
+ p->y=center->y+y;
+ p++;
+ }
+}
+
+static void
+handle(struct graphics *gr, struct graphics_gc *gc, struct point *p, int r, int dir)
+{
+ struct point ph[3];
+ int l=r*0.4;
+
+ ph[0].x=0;
+ ph[0].y=r;
+ ph[1].x=0;
+ ph[1].y=-r;
+ transform_rotate(p, dir, ph, 2);
+ gr->draw_lines(gr, gc, ph, 2);
+ ph[0].x=-l;
+ ph[0].y=-r+l;
+ ph[1].x=0;
+ ph[1].y=-r;
+ ph[2].x=l;
+ ph[2].y=-r+l;
+ transform_rotate(p, dir, ph, 3);
+ gr->draw_lines(gr, gc, ph, 3);
+}
+
+void
+compass_draw(struct compass *comp, struct container *co)
+{
+ struct point p;
+ struct coord *pos, *dest;
+ double *vehicle_dir,dir,distance;
+ int dx,dy;
+ char buffer[16];
+
+ if (! co->vehicle)
+ return;
+
+ vehicle_dir=vehicle_dir_get(co->vehicle);
+ comp->gr->draw_mode(comp->gr, draw_mode_begin);
+ p.x=0;
+ p.y=0;
+ comp->gr->draw_rectangle(comp->gr, comp->bg, &p, 60, 80);
+ p.x=30;
+ p.y=30;
+ comp->gr->draw_circle(comp->gr, comp->white, &p, 50);
+ if (co->flags->orient_north)
+ handle(comp->gr,comp->white, &p, 20,0);
+ else
+ handle(comp->gr, comp->white, &p, 20, -*vehicle_dir);
+#if 0 /* FIXME */
+ dest=route_get_destination(co->route);
+ if (dest) {
+ pos=vehicle_pos_get(co->vehicle);
+ dx=dest->x-pos->x;
+ dy=dest->y-pos->y;
+ dir=atan2(dx,dy)*180.0/M_PI;
+#if 0
+ printf("dx %d dy %d dir=%f vehicle_dir=%f\n", dx, dy, dir, *vehicle_dir);
+#endif
+ if (! co->flags->orient_north)
+ dir-=*vehicle_dir;
+ handle(comp->gr, comp->green, &p, 20, dir);
+ p.x=8;
+ p.y=72;
+ distance=transform_distance(projection_mg, pos, dest)/1000.0;
+ if (distance >= 100)
+ sprintf(buffer,"%.0f km", distance);
+ else if (distance >= 10)
+ sprintf(buffer,"%.1f km", distance);
+ else
+ sprintf(buffer,"%.2f km", distance);
+
+ comp->gr->draw_text(comp->gr, comp->green, NULL, comp->font, buffer, &p, 0x10000, 0);
+ }
+#endif
+ comp->gr->draw_mode(comp->gr, draw_mode_end);
+}
+
+struct compass *
+compass_new(struct container *co)
+{
+ struct compass *this=g_new0(struct compass, 1);
+ struct point p;
+ p.x=10;
+ p.y=10;
+ this->gr=co->gra->overlay_new(co->gra, &p, 60, 80);
+ this->bg=this->gr->gc_new(this->gr);
+ this->gr->gc_set_foreground(this->bg, 0, 0, 0);
+ this->white=this->gr->gc_new(this->gr);
+ this->gr->gc_set_foreground(this->white, 0xffff, 0xffff, 0xffff);
+ this->gr->gc_set_linewidth(this->white, 2);
+ this->green=this->gr->gc_new(this->gr);
+ this->gr->gc_set_foreground(this->green, 0x0, 0xffff, 0x0);
+ this->gr->gc_set_linewidth(this->green, 2);
+
+ this->font=this->gr->font_new(this->gr, 200);
+ compass_draw(this, co);
+ return this;
+}
+#endif
diff --git a/compass.h b/compass.h
new file mode 100644
index 00000000..3d6fb40e
--- /dev/null
+++ b/compass.h
@@ -0,0 +1,26 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_COMPASS_H
+#define NAVIT_COMPASS_H
+
+struct compass * compass_new(struct container *co);
+void compass_draw(struct compass *comp, struct container *co);
+
+#endif
diff --git a/configure.in b/configure.in
deleted file mode 100644
index 4d531835..00000000
--- a/configure.in
+++ /dev/null
@@ -1,592 +0,0 @@
-AC_INIT(navit, 0.1.0)
-AM_INIT_AUTOMAKE
-AM_CONFIG_HEADER(config.h)
-AM_MAINTAINER_MODE
-
-
-m4_ifndef([AC_USE_SYSTEM_EXTENSIONS],
- [AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], [AC_GNU_SOURCE])])
-
-AC_USE_SYSTEM_EXTENSIONS
-
-AC_PROG_CC
-if eval "test x$GCC = xyes"; then
- CFLAGS="$CFLAGS -Wall -Wcast-align -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wreturn-type -D_GNU_SOURCE"
-fi
-AC_PROG_CXX
-if eval "test x$GXX = xyes"; then
- CXXFLAGS="$CXXFLAGS -Wall -Wcast-align -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wreturn-type -D_GNU_SOURCE"
-fi
-
-PKG_CHECK_EXISTS
-
-AC_ARG_ENABLE(plugins, [ --disable-plugins disable plugins],
- [
- AC_DISABLE_SHARED
- AC_ENABLE_STATIC
- plugins=$enableval
- ],
- [
- AC_ENABLE_SHARED
- AC_DISABLE_STATIC
- AC_DEFINE(
- [USE_PLUGINS],
- [],
- Define to 1 if you have plugins.
- )
- plugins=yes
- ]
-)
-AC_PROG_LIBTOOL
-
-AC_ARG_ENABLE(avoid-unaligned, [ --enable-avoid-unaligned avoid unaligned accesses], AVOID_UNALIGNED=$enableval, AVOID_UNALIGNED=no)
-test x"${AVOID_UNALIGNED}" = xyes && AC_DEFINE(AVOID_UNALIGNED,[],Define to avoid unaligned access)
-
-AC_ARG_ENABLE(avoid-float, [ --enable-avoid-float avoid floating point calculations], AVOID_FLOAT=$enableval, AVOID_FLOAT=no)
-test x"${AVOID_FLOAT}" = xyes && AC_DEFINE(AVOID_FLOAT,[],Define to avoid floating point)
-
-AC_ARG_ENABLE(hildon, [ --enable-hildon build with maemo/hildon support], enable_hildon=$enableval, enable_hildon=no)
-if test "x${enable_hildon}" = "xyes" ; then
- PKG_CHECK_MODULES(enable_hildon, hildon-libs >= 0.12.24, , [
- AC_MSG_RESULT(no)
- enable_hildon=no
- ])
- if test x"${enable_hildon}" = xyes ; then
- AC_DEFINE(USE_HILDON, 1, [Build with maemo/hildon support])
- AC_SUBST(HILDON_CFLAGS)
- AC_SUBST(HILDON_LIBS)
- fi
-fi
-AM_CONDITIONAL(USE_HILDON, test "${enable_hildon}" = "xyes")
-
-AC_ARG_ENABLE(libgps, [ --disable-libgps don't use libgps], USE_LIBGPS=$enableval, USE_LIBGPS=yes)
-AC_ARG_ENABLE(garmin, [ --disable-garmin disable garmin support], USE_GARMIN=$enableval, USE_GARMIN=yes)
-
-AC_ARG_ENABLE(samplemap, [ --disable-samplemap don't build the samplemap], samplemap=$enableval, samplemap=yes)
-AM_CONDITIONAL(BUILD_SAMPLEMAP, [test "x$samplemap" = "xyes"])
-
-AC_ARG_ENABLE(fastmath, [ --disable-fastmath don't build with fastmath], fastmath=$enableval, fastmath=yes)
-AM_CONDITIONAL(FASTMATH, [test "x$fastmath" = "xyes"])
-
-if test x"$fastmath" = xyes; then
- if eval "test x$GCC = xyes"; then
- CFLAGS="$CFLAGS -ffast-math"
- fi
-fi
-
-X_CFLAGS="-I$x_includes"
-X_LIBS="-L$ac_x_libraries"
-
-PKG_CHECK_MODULES(NAVIT, [glib-2.0 gmodule-2.0 gthread-2.0], [], AC_MSG_ERROR([glib-2.0 or gmodule-2.0 not found. Usually you need to install a package named glib2-devel or libglib2.0-dev]))
-AC_SUBST(NAVIT_CFLAGS)
-AC_SUBST(NAVIT_LIBS)
-
-AC_CHECK_HEADER(
- zlib.h,
- AC_DEFINE(
- [HAVE_ZLIB],
- [],
- Define to 1 if you have the <zlib.h> header file.
- )
- ZLIB_LIBS="-lz",
- AC_MSG_WARN([*** no zlib.h\ -- reduced functionality of osm2navit])
- )
-AC_SUBST(ZLIB_LIBS)
-
-AC_ARG_ENABLE(gui-gtk, [ --disable-gui-gtk don't create gui gtk ], MODULE_GUI_GTK=$enableval, MODULE_GUI_GTK=yes)
-if test "x$MODULE_GUI_GTK" = "xyes"; then
- PKG_CHECK_MODULES(GTK2, [gtk+-2.0], [gtk2_pkgconfig=yes], [gtk2_pkgconfig=no])
- if test "x$gtk2_pkgconfig" = "xyes"; then
- AC_DEFINE(HAVE_GTK2, 1, [Define to 1 if you have gtk2])
- fi
-fi
-
-GTK2_CFLAGS="$GTK2_CFLAGS -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
-
-AC_SUBST(GTK2_CFLAGS)
-AC_SUBST(GTK2_LIBS)
-AM_CONDITIONAL(GUI_GTK, [test "x$gtk2_pkgconfig" = "xyes"])
-AM_CONDITIONAL(GRAPHICS_GTK_DRAWING_AREA, [test "x$gtk2_pkgconfig" = "xyes"])
-AM_CONDITIONAL(PLUGINS, [test "x$plugins" = "xyes"])
-
-AC_ARG_ENABLE(graphics-qt-qpainter, [ --disable-graphics-qt-qpainter don't create graphics qt-qpainter], enable_graphics_qt_qpainter=$enableval, enable_graphics_qt_qpainter=yes)
-if test "x${enable_graphics_qt_qpainter}" = "xyes" ; then
- PKG_CHECK_MODULES(QT_GUI, [QtGui QtCore], ,enable_graphics_qt_qpainter=no);
-fi
-if test "x${enable_graphics_qt_qpainter}" = "xyes" ; then
- AC_DEFINE(USE_GRAPICS_QT_QPAINTER, 1, [Build with graphics qt_qpainter])
- AC_SUBST(QT_GUI_CFLAGS)
- AC_SUBST(QT_GUI_LIBS)
-fi
-AM_CONDITIONAL(USE_GRAPHICS_QT_QPAINTER, test "x${enable_graphics_qt_qpainter}" = "xyes")
-
-PKG_CHECK_MODULES(FREETYPE2, [freetype2], [freetype2_pkgconfig=yes], [freetype2_pkgconfig=no])
-if test "x$freetype2_pkgconfig" = "xyes"; then
- AC_DEFINE(HAVE_FREETYPE2, 1, [Define to 1 if you have freetype2])
-fi
-AC_SUBST(FREETYPE2_CFLAGS)
-AC_SUBST(FREETYPE2_LIBS)
-
-PKG_CHECK_MODULES(FONTCONFIG, [fontconfig], [fontconfig_pkgconfig=yes], [fontconfig_pkgconfig=no])
-if test "x$fontconfig_pkgconfig" = "xyes"; then
- AC_DEFINE(HAVE_FONTCONFIG, 1, [Define to 1 if you have fontconfig])
-fi
-AC_SUBST(FONTCONFIG_CFLAGS)
-AC_SUBST(FONTCONFIG_LIBS)
-
-PKG_CHECK_MODULES(IMLIB2, [imlib2], [imlib2_pkgconfig=yes], [imlib2_pkgconfig=no])
-if test "x$imlib2_pkgconfig" = "xyes"; then
- AC_DEFINE(HAVE_IMLIB2, 1, [Define to 1 if you have imlib2])
-fi
-AC_SUBST(IMLIB2_CFLAGS)
-AC_SUBST(IMLIB2_LIBS)
-
-
-AC_ARG_ENABLE(speech-speechd, [ --disable-speech-speechd don't create speech speechd ], MODULE_SPEECH_SPEECHD=$enableval, MODULE_SPEECH_SPEECHD=yes)
-if test "x$MODULE_SPEECH_SPEECHD" = "xyes"; then
- AC_CHECK_HEADER(libspeechd.h, AC_DEFINE([HAVE_LIBSPEECHD],[],Define to 1 if you have the <libspeechd.h> header file.) SPEECHD_LIBS="-lspeechd" speechd=yes, AC_MSG_WARN([*** no libspeechd.h -- Speech output disabled]))
-fi
-AC_SUBST(SPEECHD_CFLAGS)
-AC_SUBST(SPEECHD_LIBS)
-AM_CONDITIONAL(SPEECH_SPEECH_DISPATCHER, [test "x$speechd" = "xyes"])
-
-
-AC_ARG_ENABLE(gui-sdl, [ --disable-gui-sdl don't create gui sdl ], MODULE_GUI_SDL=$enableval, MODULE_GUI_SDL=yes)
-if test "x$MODULE_GUI_SDL" = "xyes"; then
- AC_CHECK_HEADER(
- SDL/SDL.h,
- AC_DEFINE(
- [HAVE_LIBSDL],
- [],
- Define to 1 if you have the <SDL/SDL.h> header file.
- )
- SDL_LIBS="-lSDL"
- sdl=yes,
- AC_MSG_WARN([*** no SDL/SDL.h -- SDL support disabled])
- )
-fi
-AC_SUBST(SDL_CFLAGS)
-AC_SUBST(SDL_LIBS)
-
-PKG_CHECK_MODULES(
- [CEGUI],
- [CEGUI-OPENGL >= 0.5.0],
- [
- AC_DEFINE(
- [HAVE_CEGUI],
- [],
- [Define to 1 if you have the @<:@CEGUI/CEGUI.h@:>@ header file.])
- cegui=yes
- ],
- [AC_MSG_WARN([*** CEGUI not found -- SDL support disabled])]
-)
-
-AC_CHECK_HEADER(
- X11/Xmu/Xmu.h,
- AC_DEFINE(
- [HAVE_XMU],
- [],
- Define to 1 if you have the <X11/Xmu/Xmu.h> header file.
- )
- xmu=yes,
- AC_MSG_WARN([*** no X11/Xmu/Xmu.h -- opengl and SDL support disabled])
-)
-
-AC_CHECK_HEADER(
- GL/gl.h,
- AC_DEFINE(
- [HAVE_OPENGL],
- [],
- Define to 1 if you have the <GL/gl.h> header file.
- )
- OPENGL_LIBS="$X_LIBS -lGL -lGLU"
- opengl=yes,
- AC_MSG_WARN([*** no GL/gl.h -- opengl and SDL support disabled])
-)
-
-AC_CHECK_HEADER(
- GL/glut.h,
- AC_DEFINE(
- [HAVE_GLUT],
- [],
- Define to 1 if you have the <GL/glut.h> header file.
- )
- glut=yes,
- AC_MSG_WARN([*** no GL/glut.h -- opengl and SDL support disabled])
-)
-
-AC_SUBST(OPENGL_CFLAGS)
-AC_SUBST(OPENGL_LIBS)
-
-AC_CHECK_HEADER(
- GL/glc.h,
- AC_DEFINE(
- [HAVE_GLC],
- [],
- Define to 1 if you have the <GL/glc.h> header file.
- )
- GLC_LIBS="-lGLC"
- glc=yes,
- AC_MSG_WARN([*** no GL/glc.h -- opengl and SDL support disabled])
-)
-AC_SUBST(GLC_CFLAGS)
-AC_SUBST(GLC_LIBS)
-
-if test x"$cegui" = xyes
- then
- # Save the LIBS into a temp var since AC_CHECK_LIB adds the lib into LIBS
- # and we want just to check and use CEGUI_LIBS
- libstemp="$LIBS"
- # For CEGUI, we have to check the presence of some libraries.
- # The following are mandatory (used by navit)
- # If the user installed NavIt without, issue a warning and disable CEGUI
- AC_CHECK_LIB(CEGUIBase, main,
- [],
- [
- echo "Error! Something is wrong with CEGUIBase. Do you have at least cegui-0.5?"
- ])
- AC_CHECK_LIB(CEGUIOpenGLRenderer, main,
- [],
- [
- echo "Error! Something is wrong with CEGUIOpenGLRenderer. Do you have at least cegui-0.5? "
- ], $OPENGL_LIBS )
- AC_CHECK_LIB(CEGUIFalagardWRBase, main,
- [],
- [
- echo "Error! Something is wrong with CEGUIFalagardWRBase. Do you have at least cegui-0.5?"
- ], $OPENGL_LIBS)
- CEGUI_LIBS="-lCEGUIBase -lCEGUIOpenGLRenderer -lCEGUIFalagardWRBase"
-
- # The following are optional, but we need to link against them if cegui was built with them
- AC_CHECK_LIB(CEGUIXercesParser, main,
- [CEGUI_LIBS="$CEGUI_LIBS -lCEGUIXercesParser"],
- [echo "CEGUIXercesParser not found/not working, disabled."],
- $OPENGL_LIBS
- )
-
- AC_CHECK_LIB(CEGUIExpatParser, main,
- [CEGUI_LIBS="$CEGUI_LIBS -lCEGUIExpatParser"],
- [echo "CEGUIExpatParser not found/not working, disabled."],
- $OPENGL_LIBS
- )
-
- AC_CHECK_LIB(CEGUILibxmlParser, main,
- [CEGUI_LIBS="$CEGUI_LIBS -lCEGUILibxmlParser"],
- [echo "CEGUILibxmlParser not found/not working, disabled."],
- $OPENGL_LIBS
- )
-
- AC_CHECK_LIB(CEGUITinyXMLParser, main,
- [CEGUI_LIBS="$CEGUI_LIBS -lCEGUITinyXMLParser"],
- [echo "CEGUITinyXMLParser not found/not working, disabled."],
- $OPENGL_LIBS
- )
-
- AC_CHECK_LIB(CEGUIDevILImageCodec, main,
- [
- CEGUI_LIBS="$CEGUI_LIBS -lCEGUIDevILImageCodec"
- AC_DEFINE([HAVE_LIBCEGUIDEVILIMAGECODEC],[1],Define to 1 to use DevIL codec)
- ],
- [echo "CEGUIDevILImageCodec not found/not working, disabled."],
- $OPENGL_LIBS
- )
-
- AC_CHECK_LIB(CEGUITGAImageCodec, createImageCodec,
- [
- CEGUI_LIBS="$CEGUI_LIBS -lCEGUITGAImageCodec"
- AC_DEFINE(HAVE_LIBCEGUITGAIMAGECODEC,[1],Define to 1 to use the TGA codec)
- ],
- [echo "GUITGAImageCodec not found/not working, disabled."],
- $OPENGL_LIBS
- )
-
- libssilly="$OPENGL_LIBS -lpng"
- AC_CHECK_LIB(CEGUISILLYImageCodec, createImageCodec,
- [
- CEGUI_LIBS="$CEGUI_LIBS -lCEGUISILLYImageCodec"
- AC_DEFINE([HAVE_LIBCEGUISILLYIMAGECODEC],[1],Define to 1 to use SILLY codec)
- ],
- [echo "CEGUISILLYImageCodec not found/not working, disabled."],
- $libssilly
- )
- # Restore the libs
- LIBS="$libstemp"
- echo "CEGUI_LIBS : $CEGUI_LIBS"
- fi
-
-AC_SUBST(CEGUI_CFLAGS)
-AC_SUBST(CEGUI_LIBS)
-
-AM_CONDITIONAL(GUI_SDL, [test "x$sdl" = "xyes" -a "x$cegui" = "xyes" -a "x$opengl" = "xyes" -a "x$glc" = "xyes" -a "x$xmu" = "xyes" ])
-AM_CONDITIONAL(GRAPHICS_OPENGL, [test "x$opengl" = "xyes" -a "x$glc" = "xyes" ])
-
-
-if test x"${USE_LIBGPS}" = xyes
-then
- AC_CHECK_HEADER(gps.h, AC_DEFINE([HAVE_LIBGPS],[],Define to 1 if you have the <gps.h> header file.) GPSD_LIBS="-lgps" gpsd=yes, AC_MSG_WARN([*** no gps.h -- gpsd support disabled]))
-fi
-AC_SUBST(GPSD_CFLAGS)
-AC_SUBST(GPSD_LIBS)
-AM_CONDITIONAL(VEHICLE_GPSD, [test "x$gpsd" = "xyes"])
-
-if test x"${USE_GARMIN}" = xyes
-then
- # check for libgarmin
- PKG_CHECK_MODULES(LIBGARMIN, libgarmin, use_libgarmin=yes, use_libgarmin=no)
- AC_SUBST(LIBGARMIN_CFLAGS)
- AC_SUBST(LIBGARMIN_LIBS)
-fi
- AM_CONDITIONAL(HAVELIBGARMIN, [test "x$use_libgarmin" = "xyes"])
-
-
-# binding python
-AC_ARG_ENABLE(binding-python, [ --disable-binding-python don't create binding python], enable_binding_python=$enableval, enable_binding_python=yes)
-if test "x${enable_binding_python}" = "xyes" ; then
- if test "x${cross_compiling}" = "xyes" ; then
- AC_MSG_WARN([*** cross compiling, support for python disabled])
- enable_binding_python="no"
- fi
-fi
-if test "x${enable_binding_python}" = "xyes"; then
- AC_PATH_PROG(_PATH_PYTHON,[python])
- dnl Libraries and flags for embedded Python.
- dnl FIXME: I wish there was a less icky way to get this.
- if test "x${_PATH_PYTHON}" != "x" ; then
- AC_MSG_CHECKING(for Python linkage)
- py_prefix=`$_PATH_PYTHON -c 'import sys; print sys.prefix'`
- py_ver=`$_PATH_PYTHON -c 'import sys; print sys.version[[:3]]'`
- py_libdir="${py_prefix}/lib/python${py_ver}"
- PYTHON_CFLAGS="-I${py_prefix}/include/python${py_ver}"
- if test -f $py_libdir/config/Makefile -a -f $py_prefix/include/python${py_ver}/Python.h; then
- py_libs=`grep '^LIBS=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
- py_libc=`grep '^LIBC=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
- py_libm=`grep '^LIBM=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
- py_liblocalmod=`grep '^LOCALMODLIBS=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
- py_libbasemod=`grep '^BASEMODLIBS=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
- PYTHON_LIBS="-L$py_libdir/config $py_libs $py_libc $py_libm -lpython$py_ver $py_liblocalmod $py_libbasemod"
- PYTHON_LIBS=`echo $PYTHON_LIBS | sed -e 's/[ \\t]*/ /g'`
- AC_MSG_RESULT($py_libdir)
- else
- AC_MSG_WARN([$py_libdir/config/Makefile or $py_prefix/include/python${py_ver}/Python.h missing, support for python disabled])
- enable_binding_python="no"
- fi
- else
- AC_MSG_WARN([no python found, support for python disabled])
- enable_binding_python="no"
- fi
-fi
-if test "x${enable_binding_python}" = xyes ; then
- AC_DEFINE(USE_BINDING_PYTHON, 1, [Build with binding python])
- AC_SUBST(PYTHON_CFLAGS)
- AC_SUBST(PYTHON_LIBS)
-fi
-AM_CONDITIONAL(USE_BINDING_PYTHON, test "x${enable_binding_python}" = "xyes")
-
-# binding dbus
-AC_ARG_ENABLE(binding-dbus, [ --disable-binding-dbus don't create binding dbus], enable_binding_dbus=$enableval, enable_binding_dbus=yes)
-if test "x${enable_binding_dbus}" = "xyes" ; then
- PKG_CHECK_MODULES(DBUS, [dbus-glib-1], ,enable_binding_dbus=no);
-fi
-if test "x${enable_binding_dbus}" = "xyes" ; then
- AC_DEFINE(USE_BINDING_DBUS, 1, [Build with binding dbus])
- AC_SUBST(DBUS_CFLAGS)
- AC_SUBST(DBUS_LIBS)
-fi
-AM_CONDITIONAL(USE_BINDING_DBUS, test "x${enable_binding_dbus}" = "xyes")
-
-# NLS
-
-AC_ARG_ENABLE(nls,
- [ --disable-nls disable Native Language Support ( gettext/libintl )],
- enable_nls=$enableval, enable_nls=yes)
-
-
-INTLIBS=""
-MOFILES=""
-POFILES=""
-LINGUAS=""
-
-if test x$enable_nls = xyes; then
-
- AC_CHECK_FUNC(gettext, [HAVEGETTEXT="yes"],
- AC_CHECK_LIB(intl, gettext, [INTLIBS="-lintl" HAVEGETTEXT="yes"],
- INTLIBS="" ))
-
- AC_CHECK_PROG(XGETTEXT, xgettext, xgettext)
- AC_CHECK_PROG(MSGMERGE, msgmerge, msgmerge)
- AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt)
-
- if test "$XGETTEXT" != ""; then
- if $XGETTEXT --help 2>&1 | grep illegal >/dev/null ; then
- echo "xgettext isn't GNU version"
- XGETTEXT=""
- fi
- fi
-
- if test "$XGETTEXT" != "" -a "$HAVEGETTEXT" != ""; then
- PO=""
- if test "$LINGUAS" = ""; then
- ling=` (cd $srcdir/po; /bin/ls *.po) `
- for l in $ling; do
- lcode=`basename $l .po`
- LINGUAS="$LINGUAS$lcode "
- done
- fi
- AC_DEFINE(ENABLE_NLS, [1], [NLS Please])
- echo "xgettext and gettext() exist; will build i18n support for $LINGUAS"
- else
- LINGUAS=""
- PO=""
- echo "xgettext and libintl.a don't both exist; will not build i18n support"
- fi
- for lang in $LINGUAS; do
- MOFILES="$MOFILES $lang.mo"
- done
- for lang in $LINGUAS; do
- POFILES="$POFILES $lang.po"
- done
-fi
-
-
-AC_SUBST(INTLIBS)
-AC_SUBST(MOFILES)
-AC_SUBST(POFILES)
-AM_GNU_GETTEXT_VERSION
-AM_GNU_GETTEXT
-
-LIBS="$LIBS -lm -rdynamic"
-
-PACKAGE=navit
-AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
-AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
-AC_SUBST(PACKAGE)
-AC_SUBST(VERSION)
-
-AC_CONFIG_FILES([
-Makefile
-navit/Makefile
-navit/binding/Makefile
-navit/binding/python/Makefile
-navit/binding/dbus/Makefile
-navit/data/Makefile
-navit/data/mg/Makefile
-navit/data/textfile/Makefile
-navit/data/binfile/Makefile
-navit/data/garmin/Makefile
-navit/data/poi_geodownload/Makefile
-navit/data/poi_geodownload/libmdb/Makefile
-navit/data/poi_geodownload/libmdb/include/Makefile
-navit/fib-1.1/Makefile
-navit/graphics/Makefile
-navit/graphics/gtk_drawing_area/Makefile
-navit/graphics/opengl/Makefile
-navit/graphics/null/Makefile
-navit/graphics/qt_qpainter/Makefile
-navit/graphics/win32/Makefile
-navit/gui/Makefile
-navit/gui/gtk/Makefile
-navit/gui/internal/Makefile
-navit/gui/sdl/Makefile
-navit/gui/sdl/datafiles/Makefile
-navit/gui/win32/Makefile
-navit/osd/Makefile
-navit/osd/core/Makefile
-navit/speech/Makefile
-navit/speech/cmdline/Makefile
-navit/speech/speech_dispatcher/Makefile
-navit/vehicle/Makefile
-navit/vehicle/file/Makefile
-navit/vehicle/gpsd/Makefile
-navit/vehicle/demo/Makefile
-navit/xpm/Makefile
-navit/maps/Makefile
-intl/Makefile
-po/Makefile
-])
-#src/data/garmin_img/Makefile
-
-AC_OUTPUT
-
-
-echo ""
-echo ""
-echo "Summary of your installation :"
-if test x"$gtk2_pkgconfig" = xyes
- then
- echo "GTK gui : ENABLED"
- else
- echo "GTK gui : DISABLED : you are missing a dependency. To fix this install a package named gtk2-devel or libgtk2.0-dev"
-fi
-# FIXME : maybe elaborate missing dependencies
-if test x"$sdl" != xyes
- then
- sdl_failures="(libsdl maybe?) "
-fi
-if test x"$xmu" != xyes
- then
- sdl_failures=$sdl_failures"libxmu "
-fi
-if test x"$glut" != xyes
- then
- sdl_failures=$sdl_failures"glut "
-fi
-if test x"$glc" != xyes
- then
- sdl_failures=$sdl_failures"quesoglc "
-fi
-if test x"$cegui" != xyes
- then
- sdl_failures=$sdl_failures"cegui-devel >= 0.5 "
-fi
-if test -z "$sdl_failures"
- then
- echo "OpenGL gui : ENABLED, with $CEGUI_LIBS"
- else
- echo "OpenGL gui : DISABLED : you are missing $sdl_failures"
-fi
-if test x"$enable_hildon" = xyes
- then
- echo "Maemo/Hildon: ENABLED"
- else
- echo "Maemo/Hildon: DISABLED"
-fi
-
-if test x"$gpsd" = xyes
- then
- echo "GPSD support: ENABLED"
- else
- echo "GPSD support: DISABLED"
-fi
-if test x"$speechd" = xyes
- then
- echo "SPEECHD : ENABLED"
- else
- echo "SPEECHD : DISABLED"
-fi
-if test x"${USE_GARMIN}" = xyes
- then
- if test "x$use_libgarmin" = "xyes"
- then
- echo "Garmin IMG : ENABLED"
- else
- echo "Garmin IMG : DISABLED (you don't have libgarmin)"
- fi
- else
- echo "Garmin IMG : DISABLED (you requested it)"
-fi
-if test "x$samplemap" = "xyes"
- then
- echo "Samplemap : ENABLED"
- else
- echo "Samplemap : DISABLED"
-fi
-if [ test x"$gtk2_pkgconfig" != xyes ] && [ test x"$sdl" != xyes ]
- then
- echo ""
- echo ""
- echo "*** WARNING! you have no gui that can be built! ***"
- echo "Please install the dependency for at least gtk or sdl gui"
- echo "For more details, see the wiki at http://wiki.navit-project.org/"
- echo ""
- exit 1
-fi
diff --git a/coord.c b/coord.c
new file mode 100644
index 00000000..b804fb31
--- /dev/null
+++ b/coord.c
@@ -0,0 +1,367 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "debug.h"
+#include "item.h"
+#include "coord.h"
+#include "transform.h"
+#include "projection.h"
+/**
+ * @defgroup coord Coordinate handling functions
+ * @{
+ */
+
+/**
+ * Get a coordinate
+ *
+ * @param p Pointer to the coordinate
+ * @returns the coordinate
+ */
+
+struct coord *
+coord_get(unsigned char **p)
+{
+ struct coord *ret=(struct coord *)(*p);
+ *p += sizeof(*ret);
+ return ret;
+}
+
+struct coord *
+coord_new(int x, int y)
+{
+ struct coord *c=g_new(struct coord, 1);
+
+ c->x=x;
+ c->y=y;
+
+ return c;
+}
+
+struct coord *
+coord_new_from_attrs(struct attr *parent, struct attr **attrs)
+{
+ struct attr *x,*y;
+ x=attr_search(attrs, NULL, attr_x);
+ y=attr_search(attrs, NULL, attr_y);
+ if (!x || !y)
+ return NULL;
+ return coord_new(x->u.num, y->u.num);
+}
+
+
+void
+coord_destroy(struct coord *c)
+{
+ g_free(c);
+}
+
+struct coord_rect *
+coord_rect_new(struct coord *lu, struct coord *rl)
+{
+ struct coord_rect *r=g_new(struct coord_rect, 1);
+
+ dbg_assert(lu->x <= rl->x);
+ dbg_assert(lu->y >= rl->y);
+
+ r->lu=*lu;
+ r->rl=*rl;
+
+ return r;
+
+}
+
+void
+coord_rect_destroy(struct coord_rect *r)
+{
+ g_free(r);
+}
+
+int
+coord_rect_overlap(struct coord_rect *r1, struct coord_rect *r2)
+{
+ dbg_assert(r1->lu.x <= r1->rl.x);
+ dbg_assert(r1->lu.y >= r1->rl.y);
+ dbg_assert(r2->lu.x <= r2->rl.x);
+ dbg_assert(r2->lu.y >= r2->rl.y);
+ dbg(1,"0x%x,0x%x - 0x%x,0x%x vs 0x%x,0x%x - 0x%x,0x%x\n", r1->lu.x, r1->lu.y, r1->rl.x, r1->rl.y, r2->lu.x, r2->lu.y, r2->rl.x, r2->rl.y);
+ if (r1->lu.x > r2->rl.x)
+ return 0;
+ if (r1->rl.x < r2->lu.x)
+ return 0;
+ if (r1->lu.y < r2->rl.y)
+ return 0;
+ if (r1->rl.y > r2->lu.y)
+ return 0;
+ return 1;
+}
+
+int
+coord_rect_contains(struct coord_rect *r, struct coord *c)
+{
+ dbg_assert(r->lu.x <= r->rl.x);
+ dbg_assert(r->lu.y >= r->rl.y);
+ if (c->x < r->lu.x)
+ return 0;
+ if (c->x > r->rl.x)
+ return 0;
+ if (c->y < r->rl.y)
+ return 0;
+ if (c->y > r->lu.y)
+ return 0;
+ return 1;
+}
+
+void
+coord_rect_extend(struct coord_rect *r, struct coord *c)
+{
+ if (c->x < r->lu.x)
+ r->lu.x=c->x;
+ if (c->x > r->rl.x)
+ r->rl.x=c->x;
+ if (c->y < r->rl.y)
+ r->rl.y=c->y;
+ if (c->y > r->lu.y)
+ r->lu.y=c->y;
+}
+
+/**
+ * Parses \c char \a *c_str and writes back the coordinates to \c coord \a *c_ret. Uses \c projection \a pro if no projection is given in \c char \a *c_str.
+ * The format for \a *c_str can be:
+ * \li [Proj:]-0xX [-]0xX
+ * - where Proj can be mg/garmin, defaults to mg
+ * \li [Proj:][D][D]Dmm.ss[S][S] N/S [D][D]DMM.ss[S][S]... E/W
+ * \li [Proj:][-][D]D.d[d]... [-][D][D]D.d[d]
+ * - where Proj can be geo
+ *
+ * @param *c_str String to be parsed
+ * @param pro Projection of the string
+ * @param *pc_ret Where the \a pcoord should get stored
+ * @returns The lenght of the parsed string
+ */
+
+int
+coord_parse(const char *c_str, enum projection pro, struct coord *c_ret)
+{
+ int debug=0;
+ char *proj=NULL,*s,*co;
+ const char *str=c_str;
+ int args,ret = 0;
+ struct coord_geo g;
+ struct coord c;
+ enum projection str_pro=projection_none;
+
+ dbg(1,"enter('%s',%d,%p)\n", c_str, pro, c_ret);
+ s=strchr(str,' ');
+ co=strchr(str,':');
+ if (co && co < s) {
+ proj=malloc(co-str+1);
+ strncpy(proj, str, co-str);
+ proj[co-str]='\0';
+ dbg(1,"projection=%s\n", proj);
+ str=co+1;
+ s=strchr(str,' ');
+ if (!strcmp(proj, "mg"))
+ str_pro = projection_mg;
+ else if (!strcmp(proj, "garmin"))
+ str_pro = projection_garmin;
+ else if (!strcmp(proj, "geo"))
+ str_pro = projection_none;
+ else {
+ dbg(0, "Unknown projection: %s\n", proj);
+ goto out;
+ }
+ }
+ if (! s) {
+ ret=0;
+ goto out;
+ }
+ while (*s == ' ') {
+ s++;
+ }
+ if (!strncmp(s, "0x", 2) || !strncmp(s, "-0x", 3)) {
+ args=sscanf(str, "%i %i%n",&c.x, &c.y, &ret);
+ if (args < 2)
+ goto out;
+ dbg(1,"str='%s' x=0x%x y=0x%x c=%d\n", str, c.x, c.y, ret);
+ dbg(1,"rest='%s'\n", str+ret);
+
+ if (str_pro == projection_none)
+ str_pro=projection_mg;
+ if (str_pro != pro) {
+ transform_to_geo(str_pro, &c, &g);
+ transform_from_geo(pro, &g, &c);
+ }
+ *c_ret=c;
+ } else if (*s == 'N' || *s == 'n' || *s == 'S' || *s == 's') {
+ double lng, lat;
+ char ns, ew;
+ dbg(1,"str='%s'\n", str);
+ args=sscanf(str, "%lf %c %lf %c%n", &lat, &ns, &lng, &ew, &ret);
+ dbg(1,"args=%d\n", args);
+ dbg(1,"lat=%f %c lon=%f %c\n", lat, ns, lng, ew);
+ if (args < 4)
+ goto out;
+ dbg(1,"projection=%d str_pro=%d projection_none=%d\n", pro, str_pro, projection_none);
+ if (str_pro == projection_none) {
+ g.lat=floor(lat/100);
+ lat-=g.lat*100;
+ g.lat+=lat/60;
+ g.lng=floor(lng/100);
+ lng-=g.lng*100;
+ g.lng+=lng/60;
+ if (ns == 's' || ns == 'S')
+ g.lat=-g.lat;
+ if (ew == 'w' || ew == 'W')
+ g.lng=-g.lng;
+ dbg(1,"transform_from_geo(%f,%f)",g.lat,g.lng);
+ transform_from_geo(pro, &g, c_ret);
+ dbg(1,"result 0x%x,0x%x\n", c_ret->x,c_ret->y);
+ }
+ dbg(3,"str='%s' x=%f ns=%c y=%f ew=%c c=%d\n", str, lng, ns, lat, ew, ret);
+ dbg(3,"rest='%s'\n", str+ret);
+ } else {
+ double lng, lat;
+ args=sscanf(str, "%lf %lf%n", &lng, &lat, &ret);
+ if (args < 2)
+ goto out;
+ dbg(1,"str='%s' x=%f y=%f c=%d\n", str, lng, lat, ret);
+ dbg(1,"rest='%s'\n", str+ret);
+ g.lng=lng;
+ g.lat=lat;
+ transform_from_geo(pro, &g, c_ret);
+ }
+ if (debug)
+ printf("rest='%s'\n", str+ret);
+ ret+=str-c_str;
+ if (debug) {
+ printf("args=%d\n", args);
+ printf("ret=%d delta=%d ret_str='%s'\n", ret, str-c_str, c_str+ret);
+ }
+out:
+ if (proj)
+ free(proj);
+ return ret;
+}
+
+/**
+ * A wrapper for pcoord_parse that also return the projection
+ * @param *c_str String to be parsed
+ * @param pro Projection of the string
+ * @param *pc_ret Where the \a pcoord should get stored
+ * @returns The lenght of the parsed string
+ */
+
+int
+pcoord_parse(const char *c_str, enum projection pro, struct pcoord *pc_ret)
+{
+ struct coord c;
+ int ret;
+ ret = coord_parse(c_str, pro, &c);
+ pc_ret->x = c.x;
+ pc_ret->y = c.y;
+ pc_ret->pro = pro;
+ return ret;
+}
+
+void
+coord_print(enum projection pro, struct coord *c, FILE *out) {
+ unsigned int x;
+ unsigned int y;
+ char *sign_x = "";
+ char *sign_y = "";
+
+ if ( c->x < 0 ) {
+ x = -c->x;
+ sign_x = "-";
+ } else {
+ x = c->x;
+ }
+ if ( c->y < 0 ) {
+ y = -c->y;
+ sign_y = "-";
+ } else {
+ y = c->y;
+ }
+ fprintf( out, "%s: %s0x%x %s0x%x\n",
+ projection_to_name( pro , NULL),
+ sign_x, x,
+ sign_y, y );
+ return;
+}
+
+/**
+ * @brief Converts a lat/lon into a text formatted text string.
+ * @param lat The latitude
+ * @param lng The longitude
+ * @param fmt The format to use.
+ * @li DEGREES=>(45.5000N 100.9000S)
+ * @li DEGREES_MINUTES=>(45 30.))00N 100 120.54.0000S)
+ * @li DEGREES_MINUTES_SECONDS=>(4530.0000N 12054.0000S)
+ *
+ *
+ * @param buffer A buffer large enough to hold the output + a terminating NULL (26 bytes)
+ * @param size The size of the buffer
+ *
+ */
+void coord_format(float lat,float lng, enum coord_format fmt, char * buffer, int size)
+{
+
+ char lat_c='N';
+ char lng_c='E';
+ float lat_deg,lat_min,lat_sec;
+ float lng_deg,lng_min,lng_sec;
+
+ if (lng < 0) {
+ lng=-lng;
+ lng_c='W';
+ }
+ if (lat < 0) {
+ lat=-lat;
+ lat_c='S';
+ }
+ lat_deg=lat;
+ lat_min=(lat-floor(lat_deg))*60;
+ lat_sec=fmod(lat*3600,60);
+ lng_deg=lng;
+ lng_min=(lng-floor(lng_deg))*60;
+ lng_sec=fmod(lng*3600,60);
+ switch(fmt)
+ {
+
+ case DEGREES_DECIMAL:
+ snprintf(buffer,size,"%02.6f%c %03.7f%c",lat,lat_c,lng,lng_c);
+ break;
+ case DEGREES_MINUTES:
+ snprintf(buffer,size,"%02.0f %07.4f%c %03.0f %07.4f%c",floor(lat_deg),lat_min , lat_c, floor(lng), lng_min, lng_c);
+ break;
+ case DEGREES_MINUTES_SECONDS:
+ snprintf(buffer,size,"%02.0f%07.4f%c %03.0f%07.4f%c",floor(lat), fmod(lat*60,60), lat_c, floor(lng), fmod(lng*60,60), lng_c);
+ break;
+
+
+ }
+
+}
+
+/** @} */
diff --git a/coord.h b/coord.h
new file mode 100644
index 00000000..fbf3d5a5
--- /dev/null
+++ b/coord.h
@@ -0,0 +1,132 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_COORD_H
+#define NAVIT_COORD_H
+
+#include <stdio.h>
+#include "config.h"
+#include "projection.h"
+
+/*! A integer mercator coordinate */
+struct coord {
+ int x; /*!< X-Value */
+ int y; /*!< Y-Value */
+};
+
+/*! A integer mercator coordinate carrying its projection */
+struct pcoord {
+ enum projection pro;
+ int x; /*!< X-Value */
+ int y; /*!< Y-Value */
+};
+
+struct coord_rect {
+ struct coord lu;
+ struct coord rl;
+};
+
+
+#ifdef AVOID_FLOAT
+/**
+ * On platforms where we are trying to avoid floats, sometimes we can't.
+ * It is better on these platforms to use single precision floating points
+ * over double percision ones since performance is much better.
+ */
+typedef float navit_float;
+#define navit_sin(x) sinf(x)
+#define navit_cos(x) cosf(x)
+#define navit_tan(x) tanf(x)
+#define navit_atan(x) atanf(x)
+#define navit_acos(x) acosf(x)
+#define navit_asin(x) asinf(x)
+#define navit_sqrt(x) sqrtf(x)
+#else
+typedef double navit_float;
+#define navit_sin(x) sin(x)
+#define navit_cos(x) cos(x)
+#define navit_tan(x) tan(x)
+#define navit_atan(x) atan(x)
+#define navit_acos(x) acos(x)
+#define navit_asin(x) asin(x)
+#define navit_sqrt(x) sqrt(x)
+#endif
+
+
+//! A double mercator coordinate
+struct coord_d {
+ double x; /*!< X-Value */
+ double y; /*!< Y-Value */
+};
+
+//! A WGS84 coordinate
+struct coord_geo {
+ navit_float lng; /*!< Longitude */
+ navit_float lat; /*!< Latitude */
+};
+
+//! A cartesian coordinate
+struct coord_geo_cart {
+ navit_float x; /*!< X-Value */
+ navit_float y; /*!< Y-Value */
+ navit_float z; /*!< Z-Value */
+};
+
+/**
+ * An enumeration of formats for printing geographic coordinates in.
+ *
+ */
+enum coord_format
+{
+ /**
+ * Degrees with decimal places.
+ * Ie 20.5000 N 110.5000 E
+ */
+ DEGREES_DECIMAL,
+
+ /**
+ * Degrees and minutes.
+ * ie 20 30.00 N 110 30.00 E
+ */
+ DEGREES_MINUTES,
+ /**
+ * Degrees, minutes and seconds.
+ * ie 20 30 30.00 N 110 30 30 E
+ */
+ DEGREES_MINUTES_SECONDS
+};
+
+enum projection;
+struct attr;
+
+struct coord * coord_get(unsigned char **p);
+struct coord * coord_new(int x, int y);
+struct coord * coord_new_from_attrs(struct attr *parent, struct attr **attrs);
+void coord_destroy(struct coord *c);
+int coord_parse(const char *c_str, enum projection pro, struct coord *c_ret);
+int pcoord_parse(const char *c_str, enum projection pro, struct pcoord *c_ret);
+void coord_print(enum projection pro, struct coord *c, FILE *out);
+struct coord_rect * coord_rect_new(struct coord *lu, struct coord *rl);
+void coord_rect_destroy(struct coord_rect *r);
+int coord_rect_overlap(struct coord_rect *r1, struct coord_rect *r2);
+int coord_rect_contains(struct coord_rect *r, struct coord *c);
+void coord_rect_extend(struct coord_rect *r, struct coord *c);
+void coord_format(float lat,float lng, enum coord_format, char * buffer, int size);
+
+#endif
diff --git a/country.c b/country.c
new file mode 100644
index 00000000..1bcaad14
--- /dev/null
+++ b/country.c
@@ -0,0 +1,429 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <glib.h>
+#include "debug.h"
+#include "item.h"
+#include "country.h"
+#include "search.h"
+#include "navit_nls.h"
+
+struct country {
+ int id;
+ char *car;
+ char *iso2;
+ char *iso3;
+ char *name;
+};
+
+static struct country country[]= {
+ { 20, "AND", "AD", "AND", /* 020 */ _n("Andorra")},
+ {784, "UAE", "AE", "ARE", /* 784 */ _n("United Arab Emirates")},
+ { 4, "AFG", "AF", "AFG", /* 004 */ _n("Afghanistan")},
+ { 28, "AG", "AG", "ATG", /* 028 */ _n("Antigua and Barbuda")},
+ {660, NULL, "AI", "AIA", /* 660 */ _n("Anguilla")},
+ { 8, "AL", "AL", "ALB", /* 008 */ _n("Albania")},
+ { 51, "ARM", "AM", "ARM", /* 051 */ _n("Armenia")},
+ {530, "NA", "AN", "ANT", /* 530 */ _n("Netherlands Antilles")},
+ { 24, "ANG", "AO", "AGO", /* 024 */ _n("Angola")},
+ { 10, NULL, "AQ", "ATA", /* 010 */ _n("Antarctica")},
+ { 32, "RA", "AR", "ARG", /* 032 */ _n("Argentina")},
+ { 16, NULL, "AS", "ASM", /* 016 */ _n("American Samoa")},
+ { 40, "A", "AT", "AUT", /* 040 */ _n("Austria")},
+ { 36, "AUS", "AU", "AUS", /* 036 */ _n("Australia")},
+ {533, "ARU", "AW", "ABW", /* 533 */ _n("Aruba")},
+ {248, "AX", "AX", "ALA", /* 248 */ _n("Aland Islands")},
+ { 31, "AZ", "AZ", "AZE", /* 031 */ _n("Azerbaijan")},
+ { 70, "BiH", "BA", "BIH", /* 070 */ _n("Bosnia and Herzegovina")},
+ { 52, "BDS", "BB", "BRB", /* 052 */ _n("Barbados")},
+ { 50, "BD", "BD", "BGD", /* 050 */ _n("Bangladesh")},
+ { 56, "B", "BE", "BEL", /* 056 */ _n("Belgium")},
+ {854, "BF", "BF", "BFA", /* 854 */ _n("Burkina Faso")},
+ {100, "BG", "BG", "BGR", /* 100 */ _n("Bulgaria")},
+ { 48, "BRN", "BH", "BHR", /* 048 */ _n("Bahrain")},
+ {108, "RU", "BI", "BDI", /* 108 */ _n("Burundi")},
+ {204, "BJ", "BJ", "BEN", /* 204 */ _n("Benin")},
+ {652, NULL, "BL", "BLM", /* 652 */ _n("Saint Barthelemy")},
+ { 60, NULL, "BM", "BMU", /* 060 */ _n("Bermuda")},
+ { 96, "BRU", "BN", "BRN", /* 096 */ _n("Brunei Darussalam")},
+ { 68, "BOL", "BO", "BOL", /* 068 */ _n("Bolivia")},
+ { 76, "BR", "BR", "BRA", /* 076 */ _n("Brazil")},
+ { 44, "BS", "BS", "BHS", /* 044 */ _n("Bahamas")},
+ { 64, "BHT", "BT", "BTN", /* 064 */ _n("Bhutan")},
+ { 74, NULL, "BV", "BVT", /* 074 */ _n("Bouvet Island")},
+ { 72, "RB", "BW", "BWA", /* 072 */ _n("Botswana")},
+ {112, "BY", "BY", "BLR", /* 112 */ _n("Belarus")},
+ { 84, "BZ", "BZ", "BLZ", /* 084 */ _n("Belize")},
+ {124, "CDN", "CA", "CAN", /* 124 */ _n("Canada")},
+ {166, NULL, "CC", "CCK", /* 166 */ _n("Cocos (Keeling) Islands")},
+ {180, "CGO", "CD", "COD", /* 180 */ _n("Congo, Democratic Republic of the")},
+ {140, "RCA", "CF", "CAF", /* 140 */ _n("Central African Republic")},
+ {178, NULL, "CG", "COG", /* 178 */ _n("Congo")},
+ {756, "CH", "CH", "CHE", /* 756 */ _n("Switzerland")},
+ {384, "CI", "CI", "CIV", /* 384 */ _n("Cote d'Ivoire")},
+ {184, NULL, "CK", "COK", /* 184 */ _n("Cook Islands")},
+ {152, "RCH", "CL", "CHL", /* 152 */ _n("Chile")},
+ {120, "CAM", "CM", "CMR", /* 120 */ _n("Cameroon")},
+ {156, "RC", "CN", "CHN", /* 156 */ _n("China")},
+ {170, "CO", "CO", "COL", /* 170 */ _n("Colombia")},
+ {188, "CR", "CR", "CRI", /* 188 */ _n("Costa Rica")},
+ {192, "C", "CU", "CUB", /* 192 */ _n("Cuba")},
+ {132, "CV", "CV", "CPV", /* 132 */ _n("Cape Verde")},
+ {162, NULL, "CX", "CXR", /* 162 */ _n("Christmas Island")},
+ {196, "CY", "CY", "CYP", /* 196 */ _n("Cyprus")},
+ {203, "CZ", "CZ", "CZE", /* 203 */ _n("Czech Republic")},
+ {276, "D", "DE", "DEU", /* 276 */ _n("Germany")},
+ {262, "DJI", "DJ", "DJI", /* 262 */ _n("Djibouti")},
+ {208, "DK", "DK", "DNK", /* 208 */ _n("Denmark")},
+ {212, "WD", "DM", "DMA", /* 212 */ _n("Dominica")},
+ {214, "DOM", "DO", "DOM", /* 214 */ _n("Dominican Republic")},
+ { 12, "DZ", "DZ", "DZA", /* 012 */ _n("Algeria")},
+ {218, "EC", "EC", "ECU", /* 218 */ _n("Ecuador")},
+ {233, "EST", "EE", "EST", /* 233 */ _n("Estonia")},
+ {818, "ET", "EG", "EGY", /* 818 */ _n("Egypt")},
+ {732, "WSA", "EH", "ESH", /* 732 */ _n("Western Sahara")},
+ {232, "ER", "ER", "ERI", /* 232 */ _n("Eritrea")},
+ {724, "E", "ES", "ESP", /* 724 */ _n("Spain")},
+ {231, "ETH", "ET", "ETH", /* 231 */ _n("Ethiopia")},
+ {246, "FIN", "FI", "FIN", /* 246 */ _n("Finland")},
+ {242, "FJI", "FJ", "FJI", /* 242 */ _n("Fiji")},
+ {238, NULL, "FK", "FLK", /* 238 */ _n("Falkland Islands (Malvinas)")},
+ {583, "FSM", "FM", "FSM", /* 583 */ _n("Micronesia, Federated States of")},
+ {234, "FO", "FO", "FRO", /* 234 */ _n("Faroe Islands")},
+ {250, "F", "FR", "FRA", /* 250 */ _n("France")},
+ {266, "G", "GA", "GAB", /* 266 */ _n("Gabon")},
+ {826, "GB", "GB", "GBR", /* 826 */ _n("United Kingdom")},
+ {308, "WG", "GD", "GRD", /* 308 */ _n("Grenada")},
+ {268, "GE", "GE", "GEO", /* 268 */ _n("Georgia")},
+ {254, NULL, "GF", "GUF", /* 254 */ _n("French Guiana")},
+ {831, NULL, "GG", "GGY", /* 831 */ _n("Guernsey")},
+ {288, "GH", "GH", "GHA", /* 288 */ _n("Ghana")},
+ {292, "GBZ", "GI", "GIB", /* 292 */ _n("Gibraltar")},
+ {304, "KN", "GL", "GRL", /* 304 */ _n("Greenland")},
+ {270, "WAG", "GM", "GMB", /* 270 */ _n("Gambia")},
+ {324, "RG", "GN", "GIN", /* 324 */ _n("Guinea")},
+ {312, NULL, "GP", "GLP", /* 312 */ _n("Guadeloupe")},
+ {226, "GQ", "GQ", "GNQ", /* 226 */ _n("Equatorial Guinea")},
+ {300, "GR", "GR", "GRC", /* 300 */ _n("Greece")},
+ {239, NULL, "GS", "SGS", /* 239 */ _n("South Georgia and the South Sandwich Islands")},
+ {320, "GCA", "GT", "GTM", /* 320 */ _n("Guatemala")},
+ {316, NULL, "GU", "GUM", /* 316 */ _n("Guam")},
+ {624, "GUB", "GW", "GNB", /* 624 */ _n("Guinea-Bissau")},
+ {328, "GUY", "GY", "GUY", /* 328 */ _n("Guyana")},
+ {344, "HK", "HK", "HKG", /* 344 */ _n("Hong Kong")},
+ {334, NULL, "HM", "HMD", /* 334 */ _n("Heard Island and McDonald Islands")},
+ {340, "HN", "HN", "HND", /* 340 */ _n("Honduras")},
+ {191, "HR", "HR", "HRV", /* 191 */ _n("Croatia")},
+ {332, "RH", "HT", "HTI", /* 332 */ _n("Haiti")},
+ {348, "H", "HU", "HUN", /* 348 */ _n("Hungary")},
+ {360, "RI", "ID", "IDN", /* 360 */ _n("Indonesia")},
+ {372, "IRL", "IE", "IRL", /* 372 */ _n("Ireland")},
+ {376, "IL", "IL", "ISR", /* 376 */ _n("Israel")},
+ {833, NULL, "IM", "IMN", /* 833 */ _n("Isle of Man")},
+ {356, "IND", "IN", "IND", /* 356 */ _n("India")},
+ { 86, NULL, "IO", "IOT", /* 086 */ _n("British Indian Ocean Territory")},
+ {368, "IRQ", "IQ", "IRQ", /* 368 */ _n("Iraq")},
+ {364, "IR", "IR", "IRN", /* 364 */ _n("Iran, Islamic Republic of")},
+ {352, "IS", "IS", "ISL", /* 352 */ _n("Iceland")},
+ {380, "I", "IT", "ITA", /* 380 */ _n("Italy")},
+ {832, NULL, "JE", "JEY", /* 832 */ _n("Jersey")},
+ {388, "JA", "JM", "JAM", /* 388 */ _n("Jamaica")},
+ {400, "JOR", "JO", "JOR", /* 400 */ _n("Jordan")},
+ {392, "J", "JP", "JPN", /* 392 */ _n("Japan")},
+ {404, "EAK", "KE", "KEN", /* 404 */ _n("Kenya")},
+ {417, "KS", "KG", "KGZ", /* 417 */ _n("Kyrgyzstan")},
+ {116, "K", "KH", "KHM", /* 116 */ _n("Cambodia")},
+ {296, "KIR", "KI", "KIR", /* 296 */ _n("Kiribati")},
+ {174, "COM", "KM", "COM", /* 174 */ _n("Comoros")},
+ {659, "KAN", "KN", "KNA", /* 659 */ _n("Saint Kitts and Nevis")},
+ {408, "KP", "KP", "PRK", /* 408 */ _n("Korea, Democratic People's Republic of")},
+ {410, "ROK", "KR", "KOR", /* 410 */ _n("Korea, Republic of")},
+ {414, "KWT", "KW", "KWT", /* 414 */ _n("Kuwait")},
+ {136, NULL, "KY", "CYM", /* 136 */ _n("Cayman Islands")},
+ {398, "KZ", "KZ", "KAZ", /* 398 */ _n("Kazakhstan")},
+ {418, "LAO", "LA", "LAO", /* 418 */ _n("Lao People's Democratic Republic")},
+ {422, "RL", "LB", "LBN", /* 422 */ _n("Lebanon")},
+ {662, "WL", "LC", "LCA", /* 662 */ _n("Saint Lucia")},
+ {438, "FL", "LI", "LIE", /* 438 */ _n("Liechtenstein")},
+ {144, "CL", "LK", "LKA", /* 144 */ _n("Sri Lanka")},
+ {430, "LB", "LR", "LBR", /* 430 */ _n("Liberia")},
+ {426, "LS", "LS", "LSO", /* 426 */ _n("Lesotho")},
+ {440, "LT", "LT", "LTU", /* 440 */ _n("Lithuania")},
+ {442, "L", "LU", "LUX", /* 442 */ _n("Luxembourg")},
+ {428, "LV", "LV", "LVA", /* 428 */ _n("Latvia")},
+ {434, "LAR", "LY", "LBY", /* 434 */ _n("Libyan Arab Jamahiriya")},
+ {504, "MA", "MA", "MAR", /* 504 */ _n("Morocco")},
+ {492, "MC", "MC", "MCO", /* 492 */ _n("Monaco")},
+ {498, "MD", "MD", "MDA", /* 498 */ _n("Moldova, Republic of")},
+ {499, "MNE", "ME", "MNE", /* 499 */ _n("Montenegro")},
+ {663, NULL, "MF", "MAF", /* 663 */ _n("Saint Martin (French part)")},
+ {450, "RM", "MG", "MDG", /* 450 */ _n("Madagascar")},
+ {584, "MH", "MH", "MHL", /* 584 */ _n("Marshall Islands")},
+ {807, "MK", "MK", "MKD", /* 807 */ _n("Macedonia, the former Yugoslav Republic of")},
+ {466, "RMM", "ML", "MLI", /* 466 */ _n("Mali")},
+ {104, "MYA", "MM", "MMR", /* 104 */ _n("Myanmar")},
+ {496, "MGL", "MN", "MNG", /* 496 */ _n("Mongolia")},
+ {446, NULL, "MO", "MAC", /* 446 */ _n("Macao")},
+ {580, NULL, "MP", "MNP", /* 580 */ _n("Northern Mariana Islands")},
+ {474, NULL, "MQ", "MTQ", /* 474 */ _n("Martinique")},
+ {478, "RIM", "MR", "MRT", /* 478 */ _n("Mauritania")},
+ {500, NULL, "MS", "MSR", /* 500 */ _n("Montserrat")},
+ {470, "M", "MT", "MLT", /* 470 */ _n("Malta")},
+ {480, "MS", "MU", "MUS", /* 480 */ _n("Mauritius")},
+ {462, "MV", "MV", "MDV", /* 462 */ _n("Maldives")},
+ {454, "MW", "MW", "MWI", /* 454 */ _n("Malawi")},
+ {484, "MEX", "MX", "MEX", /* 484 */ _n("Mexico")},
+ {458, "MAL", "MY", "MYS", /* 458 */ _n("Malaysia")},
+ {508, "MOC", "MZ", "MOZ", /* 508 */ _n("Mozambique")},
+ {516, "NAM", "NA", "NAM", /* 516 */ _n("Namibia")},
+ {540, "NCL", "NC", "NCL", /* 540 */ _n("New Caledonia")},
+ {562, "RN", "NE", "NER", /* 562 */ _n("Niger")},
+ {574, NULL, "NF", "NFK", /* 574 */ _n("Norfolk Island")},
+ {566, "NGR", "NG", "NGA", /* 566 */ _n("Nigeria")},
+ {558, "NIC", "NI", "NIC", /* 558 */ _n("Nicaragua")},
+ {528, "NL", "NL", "NLD", /* 528 */ _n("Netherlands")},
+ {578, "N", "NO", "NOR", /* 578 */ _n("Norway")},
+ {524, "NEP", "NP", "NPL", /* 524 */ _n("Nepal")},
+ {520, "NAU", "NR", "NRU", /* 520 */ _n("Nauru")},
+ {570, NULL, "NU", "NIU", /* 570 */ _n("Niue")},
+ {554, "NZ", "NZ", "NZL", /* 554 */ _n("New Zealand")},
+ {512, "OM", "OM", "OMN", /* 512 */ _n("Oman")},
+ {591, "PA", "PA", "PAN", /* 591 */ _n("Panama")},
+ {604, "PE", "PE", "PER", /* 604 */ _n("Peru")},
+ {258, NULL, "PF", "PYF", /* 258 */ _n("French Polynesia")},
+ {598, "PNG", "PG", "PNG", /* 598 */ _n("Papua New Guinea")},
+ {608, "RP", "PH", "PHL", /* 608 */ _n("Philippines")},
+ {586, "PK", "PK", "PAK", /* 586 */ _n("Pakistan")},
+ {616, "PL", "PL", "POL", /* 616 */ _n("Poland")},
+ {666, NULL, "PM", "SPM", /* 666 */ _n("Saint Pierre and Miquelon")},
+ {612, NULL, "PN", "PCN", /* 612 */ _n("Pitcairn")},
+ {630, "PRI", "PR", "PRI", /* 630 */ _n("Puerto Rico")},
+ {275, "AUT", "PS", "PSE", /* 275 */ _n("Palestinian Territory, Occupied")},
+ {620, "P", "PT", "PRT", /* 620 */ _n("Portugal")},
+ {585, "PAL", "PW", "PLW", /* 585 */ _n("Palau")},
+ {600, "PY", "PY", "PRY", /* 600 */ _n("Paraguay")},
+ {634, "Q", "QA", "QAT", /* 634 */ _n("Qatar")},
+ {638, NULL, "RE", "REU", /* 638 */ _n("Reunion")},
+ {642, "RO", "RO", "ROU", /* 642 */ _n("Romania")},
+ {688, "SRB", "RS", "SRB", /* 688 */ _n("Serbia")},
+ {643, "RUS", "RU", "RUS", /* 643 */ _n("Russian Federation")},
+ {646, "RWA", "RW", "RWA", /* 646 */ _n("Rwanda")},
+ {682, "KSA", "SA", "SAU", /* 682 */ _n("Saudi Arabia")},
+ { 90, "SOL", "SB", "SLB", /* 090 */ _n("Solomon Islands")},
+ {690, "SY", "SC", "SYC", /* 690 */ _n("Seychelles")},
+ {736, "SUD", "SD", "SDN", /* 736 */ _n("Sudan")},
+ {752, "S", "SE", "SWE", /* 752 */ _n("Sweden")},
+ {702, "SGP", "SG", "SGP", /* 702 */ _n("Singapore")},
+ {654, NULL, "SH", "SHN", /* 654 */ _n("Saint Helena")},
+ {705, "SLO", "SI", "SVN", /* 705 */ _n("Slovenia")},
+ {744, NULL, "SJ", "SJM", /* 744 */ _n("Svalbard and Jan Mayen")},
+ {703, "SK", "SK", "SVK", /* 703 */ _n("Slovakia")},
+ {694, "WAL", "SL", "SLE", /* 694 */ _n("Sierra Leone")},
+ {674, "RSM", "SM", "SMR", /* 674 */ _n("San Marino")},
+ {686, "SN", "SN", "SEN", /* 686 */ _n("Senegal")},
+ {706, "SO", "SO", "SOM", /* 706 */ _n("Somalia")},
+ {740, "SME", "SR", "SUR", /* 740 */ _n("Suriname")},
+ {678, "STP", "ST", "STP", /* 678 */ _n("Sao Tome and Principe")},
+ {222, "ES", "SV", "SLV", /* 222 */ _n("El Salvador")},
+ {760, "SYR", "SY", "SYR", /* 760 */ _n("Syrian Arab Republic")},
+ {748, "SD", "SZ", "SWZ", /* 748 */ _n("Swaziland")},
+ {796, NULL, "TC", "TCA", /* 796 */ _n("Turks and Caicos Islands")},
+ {148, "TD", "TD", "TCD", /* 148 */ _n("Chad")},
+ {260, "ARK", "TF", "ATF", /* 260 */ _n("French Southern Territories")},
+ {768, "RT", "TG", "TGO", /* 768 */ _n("Togo")},
+ {764, "T", "TH", "THA", /* 764 */ _n("Thailand")},
+ {762, "TJ", "TJ", "TJK", /* 762 */ _n("Tajikistan")},
+ {772, NULL, "TK", "TKL", /* 772 */ _n("Tokelau")},
+ {626, "TL", "TL", "TLS", /* 626 */ _n("Timor-Leste")},
+ {795, "TM", "TM", "TKM", /* 795 */ _n("Turkmenistan")},
+ {788, "TN", "TN", "TUN", /* 788 */ _n("Tunisia")},
+ {776, "TON", "TO", "TON", /* 776 */ _n("Tonga")},
+ {792, "TR", "TR", "TUR", /* 792 */ _n("Turkey")},
+ {780, "TT", "TT", "TTO", /* 780 */ _n("Trinidad and Tobago")},
+ {798, "TUV", "TV", "TUV", /* 798 */ _n("Tuvalu")},
+ {158, NULL, "TW", "TWN", /* 158 */ _n("Taiwan, Province of China")},
+ {834, "EAT", "TZ", "TZA", /* 834 */ _n("Tanzania, United Republic of")},
+ {804, "UA", "UA", "UKR", /* 804 */ _n("Ukraine")},
+ {800, "EAU", "UG", "UGA", /* 800 */ _n("Uganda")},
+ {581, NULL, "UM", "UMI", /* 581 */ _n("United States Minor Outlying Islands")},
+ {840, "USA", "US", "USA", /* 840 */ _n("United States")},
+ {858, "ROU", "UY", "URY", /* 858 */ _n("Uruguay")},
+ {860, "UZ", "UZ", "UZB", /* 860 */ _n("Uzbekistan")},
+ {336, "SCV", "VA", "VAT", /* 336 */ _n("Holy See (Vatican City State)")},
+ {670, "WV", "VC", "VCT", /* 670 */ _n("Saint Vincent and the Grenadines")},
+ {862, "YV", "VE", "VEN", /* 862 */ _n("Venezuela")},
+ { 92, NULL, "VG", "VGB", /* 092 */ _n("Virgin Islands, British")},
+ {850, NULL, "VI", "VIR", /* 850 */ _n("Virgin Islands, U.S.")},
+ {704, "VN", "VN", "VNM", /* 704 */ _n("Viet Nam")},
+ {548, "VAN", "VU", "VUT", /* 548 */ _n("Vanuatu")},
+ {876, NULL, "WF", "WLF", /* 876 */ _n("Wallis and Futuna")},
+ {882, "WS", "WS", "WSM", /* 882 */ _n("Samoa")},
+ {887, "YAR", "YE", "YEM", /* 887 */ _n("Yemen")},
+ {175, NULL, "YT", "MYT", /* 175 */ _n("Mayotte")},
+ {710, "ZA", "ZA", "ZAF", /* 710 */ _n("South Africa") },
+ {894, "Z", "ZM", "ZMB", /* 894 */ _n("Zambia")},
+ {716, "ZW", "ZW", "ZWE", /* 716 */ _n("Zimbabwe")},
+ {999, "*", "*", "*", _n("* Unknown, add is_in tags to those cities")},
+};
+
+
+struct country_search {
+ struct attr search;
+ int len;
+ int partial;
+ struct item item;
+ int count;
+ struct country *country;
+ enum attr_type attr_next;
+};
+
+static int
+country_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
+{
+ struct country_search *this_=priv_data;
+ struct country *country=this_->country;
+
+ attr->type=attr_type;
+ switch (attr_type) {
+ case attr_any:
+ while (this_->attr_next != attr_none) {
+ if (country_attr_get(this_, this_->attr_next, attr))
+ return 1;
+ }
+ return 0;
+ case attr_label:
+ attr->u.str=gettext(country->name);
+ this_->attr_next=attr_country_id;
+ return 1;
+ case attr_country_id:
+ attr->u.num=country->id;
+ this_->attr_next=country->car ? attr_country_car : attr_country_iso2;
+ return 1;
+ case attr_country_car:
+ attr->u.str=country->car;
+ this_->attr_next=attr_country_iso2;
+ return attr->u.str ? 1 : 0;
+ case attr_country_iso2:
+ attr->u.str=country->iso2;
+ this_->attr_next=attr_country_iso3;
+ return 1;
+ case attr_country_iso3:
+ attr->u.str=country->iso3;
+ this_->attr_next=attr_country_name;
+ return 1;
+ case attr_country_name:
+ attr->u.str=gettext(country->name);
+ this_->attr_next=attr_none;
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+
+
+struct item_methods country_meth = {
+ NULL, /* coord_rewind */
+ NULL, /* coord_get */
+ NULL, /* attr_rewind */
+ country_attr_get, /* attr_get */
+};
+
+struct country_search *
+country_search_new(struct attr *search, int partial)
+{
+ struct country_search *ret=g_new(struct country_search, 1);
+ ret->search=*search;
+ if (search->type != attr_country_id)
+ ret->len=strlen(search->u.str);
+ else
+ ret->len=0;
+ ret->partial=partial;
+ ret->count=0;
+
+ ret->item.type=type_country_label;
+ ret->item.id_hi=0;
+ ret->item.map=NULL;
+ ret->item.meth=&country_meth;
+ ret->item.priv_data=ret;
+
+ return ret;
+}
+
+static int
+match(struct country_search *this_, enum attr_type type, const char *name)
+{
+ int ret;
+ if (!name)
+ return 0;
+ if (this_->search.type != type && this_->search.type != attr_country_all)
+ return 0;
+ if (this_->partial)
+ ret=(strncasecmp(this_->search.u.str, name, this_->len) == 0);
+ else
+ ret=(strcasecmp(this_->search.u.str, name) == 0);
+ return ret;
+
+}
+
+
+struct item *
+country_search_get_item(struct country_search *this_)
+{
+ for (;;) {
+ if (this_->count >= sizeof(country)/sizeof(struct country))
+ return NULL;
+ this_->country=&country[this_->count++];
+ if ((this_->search.type == attr_country_id && this_->search.u.num == this_->country->id) ||
+ match(this_, attr_country_iso3, this_->country->iso3) ||
+ match(this_, attr_country_iso2, this_->country->iso2) ||
+ match(this_, attr_country_car, this_->country->car) ||
+ match(this_, attr_country_name, gettext(this_->country->name))) {
+ this_->item.id_lo=this_->country->id;
+ return &this_->item;
+ }
+ }
+}
+
+static struct attr country_default_attr;
+static char iso2[3];
+
+struct attr *
+country_default(void)
+{
+ char *lang;
+ if (country_default_attr.u.str)
+ return &country_default_attr;
+ lang=getenv("LANG");
+ if (!lang || strlen(lang) < 5)
+ return NULL;
+ strncpy(iso2, lang+3, 2);
+ country_default_attr.type=attr_country_iso2;
+ country_default_attr.u.str=iso2;
+ return &country_default_attr;
+}
+
+void
+country_search_destroy(struct country_search *this_)
+{
+ g_free(this_);
+}
diff --git a/country.h b/country.h
new file mode 100644
index 00000000..6f0d4047
--- /dev/null
+++ b/country.h
@@ -0,0 +1,41 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_COUNTRY_H
+#define NAVIT_COUNTRY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* prototypes */
+struct attr;
+struct country_search;
+struct item;
+struct country_search *country_search_new(struct attr *search, int partial);
+struct item *country_search_get_item(struct country_search *this_);
+struct attr *country_default(void);
+void country_search_destroy(struct country_search *this_);
+/* end of prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/cursor.c b/cursor.c
new file mode 100644
index 00000000..a6690883
--- /dev/null
+++ b/cursor.c
@@ -0,0 +1,194 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <math.h>
+#include <glib.h>
+#include "debug.h"
+#include "coord.h"
+#include "transform.h"
+#include "projection.h"
+#include "point.h"
+#include "graphics.h"
+#include "vehicle.h"
+#include "navit.h"
+#include "callback.h"
+#include "color.h"
+#include "cursor.h"
+#include "compass.h"
+#include "item.h"
+#include "layout.h"
+#include "event.h"
+/* #include "track.h" */
+
+
+struct cursor {
+ int w,h;
+ struct graphics *gra;
+ struct callback *animate_callback;
+ struct event_timeout *animate_timer;
+ struct point cursor_pnt;
+ struct graphics_gc *bg;
+ struct attr **attrs;
+ struct transformation *trans;
+ int sequence;
+ int angle;
+ int speed;
+};
+
+
+
+static void
+cursor_draw_do(struct cursor *this_, int lazy)
+{
+ struct point p;
+ int speed=this_->speed;
+ int angle=this_->angle;
+
+ if (!this_->attrs || !this_->gra)
+ return;
+ if (!this_->gra)
+ return;
+ transform_set_yaw(this_->trans, -this_->angle);
+ graphics_draw_mode(this_->gra, draw_mode_begin);
+ p.x=0;
+ p.y=0;
+ graphics_draw_rectangle(this_->gra, this_->bg, &p, this_->w, this_->h);
+ for (;;) {
+ struct attr **attr=this_->attrs;
+ int sequence=this_->sequence;
+ int match=0;
+ while (*attr) {
+ if ((*attr)->type == attr_itemgra) {
+ struct itemgra *itm=(*attr)->u.itemgra;
+ dbg(1,"speed %d-%d %d\n", itm->speed_range.min, itm->speed_range.max, speed);
+ if (speed >= itm->speed_range.min && speed <= itm->speed_range.max &&
+ angle >= itm->angle_range.min && angle <= itm->angle_range.max &&
+ sequence >= itm->sequence_range.min && sequence <= itm->sequence_range.max) {
+ graphics_draw_itemgra(this_->gra, itm, this_->trans);
+ match=1;
+ }
+ }
+ attr++;
+ }
+ if (match) {
+ break;
+ } else {
+ if (this_->sequence)
+ this_->sequence=0;
+ else
+ break;
+ }
+ }
+ graphics_draw_drag(this_->gra, &this_->cursor_pnt);
+ graphics_draw_mode(this_->gra, lazy ? draw_mode_end_lazy : draw_mode_end);
+}
+
+void
+cursor_draw(struct cursor *this_, struct graphics *gra, struct point *pnt, int lazy, int angle, int speed)
+{
+ if (angle < 0)
+ angle+=360;
+ dbg(1,"enter this=%p gra=%p pnt=%p lazy=%d dir=%d speed=%d\n", this_, gra, pnt, lazy, angle, speed);
+ dbg(1,"point %d,%d\n", pnt->x, pnt->y);
+ this_->cursor_pnt=*pnt;
+ this_->cursor_pnt.x-=this_->w/2;
+ this_->cursor_pnt.y-=this_->h/2;
+ this_->angle=angle;
+ this_->speed=speed;
+ if (!this_->gra) {
+ struct color c;
+ this_->gra=graphics_overlay_new(gra, &this_->cursor_pnt, this_->w, this_->h, 65535, 0);
+ if (this_->gra) {
+ this_->bg=graphics_gc_new(this_->gra);
+ c.r=0; c.g=0; c.b=0; c.a=0;
+ graphics_gc_set_foreground(this_->bg, &c);
+ graphics_background_gc(this_->gra, this_->bg);
+ }
+ }
+ cursor_draw_do(this_, lazy);
+}
+
+static void
+cursor_animate(struct cursor * this)
+{
+ this->sequence++;
+ cursor_draw_do(this, 0);
+}
+
+int
+cursor_add_attr(struct cursor *this_, struct attr *attr)
+{
+ int ret=1;
+ switch (attr->type) {
+ case attr_itemgra:
+ break;
+ default:
+ ret=0;
+ }
+ if (ret)
+ this_->attrs=attr_generic_add_attr(this_->attrs, attr);
+ return ret;
+}
+
+struct cursor *
+cursor_new(struct attr *parent, struct attr **attrs)
+{
+ struct cursor *this=g_new0(struct cursor,1);
+ struct attr *w,*h, *interval;
+ struct pcoord center;
+ struct point scenter;
+ w=attr_search(attrs, NULL, attr_w);
+ h=attr_search(attrs, NULL, attr_h);
+ if (! w || ! h)
+ return NULL;
+
+ this->w=w->u.num;
+ this->h=h->u.num;
+ this->trans=transform_new();
+ center.pro=projection_screen;
+ center.x=0;
+ center.y=0;
+ transform_setup(this->trans, &center, 16, 0);
+ scenter.x=this->w/2;
+ scenter.y=this->h/2;
+ transform_set_screen_center(this->trans, &scenter);
+ interval=attr_search(attrs, NULL, attr_interval);
+ if (interval) {
+ this->animate_callback=callback_new_1(callback_cast(cursor_animate), this);
+ this->animate_timer=event_add_timeout(interval->u.num, 1, this->animate_callback);
+ }
+ dbg(2,"ret=%p\n", this);
+ return this;
+}
+
+void
+cursor_destroy(struct cursor *this_)
+{
+ if (this_->animate_callback) {
+ callback_destroy(this_->animate_callback);
+ event_remove_timeout(this_->animate_timer);
+ }
+ transform_destroy(this_->trans);
+ g_free(this_);
+}
diff --git a/cursor.h b/cursor.h
new file mode 100644
index 00000000..e5868cc0
--- /dev/null
+++ b/cursor.h
@@ -0,0 +1,34 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_CURSOR_H
+#define NAVIT_CURSOR_H
+
+/* prototypes */
+struct color;
+struct cursor;
+struct graphics;
+struct point;
+void cursor_draw(struct cursor *this_, struct graphics *gra, struct point *pnt, int lazy, int dir, int speed);
+int cursor_add_attr(struct cursor *this_, struct attr *attr);
+struct cursor *cursor_new(struct attr *parent, struct attr **attrs);
+void cursor_destroy(struct cursor *this_);
+/* end of prototypes */
+
+#endif
diff --git a/data.h b/data.h
new file mode 100644
index 00000000..19928a39
--- /dev/null
+++ b/data.h
@@ -0,0 +1,108 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_DATA_H
+#define NAVIT_DATA_H
+
+#include "config.h"
+
+#ifdef WORDS_BIGENDIAN
+#include <byteswap.h>
+#endif
+
+static inline unsigned char
+get_u8(unsigned char **p)
+{
+ return *((*p)++);
+}
+
+static inline unsigned short
+get_u16(unsigned char **p) {
+ unsigned short ret;
+ ret=*((unsigned short *)*p);
+ *p+=sizeof(unsigned short);
+#ifdef WORDS_BIGENDIAN
+ return __bswap_16(ret);
+#else
+ return ret;
+#endif
+}
+
+static inline unsigned short
+get_u16_unal(unsigned char **p) {
+ unsigned short ret;
+ ret=*(*p)++;
+ ret|=(*(*p)++) << 8;
+ return ret;
+}
+
+
+static inline unsigned int
+get_u24(unsigned char **p) {
+ unsigned long ret;
+ ret=get_u16(p);
+ ret|=*((*p)++) << 16;
+ return ret;
+}
+
+
+static inline unsigned int
+get_u24_unal(unsigned char **p) {
+ unsigned long ret;
+ ret=get_u16_unal(p);
+ ret|=*((*p)++) << 16;
+ return ret;
+}
+
+
+static inline unsigned int
+get_u32(unsigned char **p) {
+ unsigned long ret;
+ ret=*((unsigned int *)*p);
+ *p+=sizeof(unsigned int);
+#ifdef WORDS_BIGENDIAN
+ return __bswap_32(ret);
+#else
+ return ret;
+#endif
+}
+
+static inline unsigned int
+get_u32_unal(unsigned char **p) {
+ unsigned long ret;
+ ret=*(*p)++;
+ ret|=(*(*p)++) << 8;
+ ret|=(*(*p)++) << 16;
+ ret|=(*(*p)++) << 24;
+ return ret;
+}
+
+static inline char *
+get_string(unsigned char **p)
+{
+ char *ret=(char *)(*p);
+ while (**p) (*p)++;
+ (*p)++;
+ return ret;
+}
+
+#define L(x) ({ unsigned char *t=(unsigned char *)&(x); t[0] | (t[1] << 8) | (t[2] << 16) | (t[3] << 24); })
+
+#endif
+
diff --git a/data_window.c b/data_window.c
new file mode 100644
index 00000000..8db7d5d5
--- /dev/null
+++ b/data_window.c
@@ -0,0 +1,41 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include "data_window.h"
+
+void
+datawindow_mode(struct datawindow *win, int start)
+{
+ win->meth.mode(win->priv, start);
+}
+
+void
+datawindow_add(struct datawindow *win, struct param_list *param, int count)
+{
+ win->meth.add(win->priv, param, count);
+}
+
+void
+datawindow_destroy(struct datawindow *win)
+{
+ win->meth.destroy(win->priv);
+ g_free(win);
+}
+
diff --git a/data_window.h b/data_window.h
new file mode 100644
index 00000000..340a7f3e
--- /dev/null
+++ b/data_window.h
@@ -0,0 +1,44 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_DATA_WINDOW_H
+#define NAVIT_DATA_WINDOW_H
+
+struct datawindow;
+struct param_list;
+struct datawindow_priv;
+
+struct datawindow_methods {
+ void (*destroy)(struct datawindow_priv *win);
+ void (*add)(struct datawindow_priv *win, struct param_list *param, int count);
+ void (*mode)(struct datawindow_priv *win, int start);
+};
+
+struct datawindow {
+ struct datawindow_priv *priv;
+ struct datawindow_methods meth;
+};
+
+
+void datawindow_destroy(struct datawindow *win);
+void datawindow_add(struct datawindow *win, struct param_list *param, int count);
+void datawindow_mode(struct datawindow *win, int start);
+
+#endif
+
diff --git a/data_window_int.h b/data_window_int.h
new file mode 100644
index 00000000..6d3ead94
--- /dev/null
+++ b/data_window_int.h
@@ -0,0 +1,31 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_DATA_WINDOW_INT_H
+#define NAVIT_DATA_WINDOW_INT_H
+
+struct data_window {
+ GtkWidget *window;
+ GtkWidget *scrolled_window;
+ GtkWidget *treeview;
+ void(*callback)(struct data_window *, char **cols);
+};
+
+#endif
+
diff --git a/debug.c b/debug.c
new file mode 100644
index 00000000..9b3edaa3
--- /dev/null
+++ b/debug.c
@@ -0,0 +1,212 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <signal.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <sys/time.h>
+#include <glib.h>
+#include "file.h"
+#include "item.h"
+#include "debug.h"
+
+#ifdef DEBUG_WIN32_CE_MESSAGEBOX
+#include <windows.h>
+#include <windowsx.h>
+#endif
+
+int debug_level=0;
+int segv_level=0;
+int timestamp_prefix=0;
+
+static int dummy;
+static GHashTable *debug_hash;
+static const char *gdb_program;
+
+static FILE *debug_fp;
+
+#if defined(_WIN32) || defined(__CEGCC__)
+
+static void sigsegv(int sig)
+{
+}
+
+#else
+#include <unistd.h>
+static void sigsegv(int sig)
+{
+ char buffer[256];
+ if (segv_level > 1)
+ sprintf(buffer, "gdb -ex bt %s %d", gdb_program, getpid());
+ else
+ sprintf(buffer, "gdb -ex bt -ex detach -ex quit %s %d", gdb_program, getpid());
+ system(buffer);
+ exit(1);
+}
+#endif
+
+void
+debug_init(const char *program_name)
+{
+ gdb_program=program_name;
+ signal(SIGSEGV, sigsegv);
+ debug_hash=g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
+ debug_fp = stderr;
+}
+
+
+static void
+debug_update_level(gpointer key, gpointer value, gpointer user_data)
+{
+ if (debug_level < (int) value)
+ debug_level=(int) value;
+}
+
+void
+debug_level_set(const char *name, int level)
+{
+ if (!strcmp(name, "segv")) {
+ segv_level=level;
+ if (segv_level)
+ signal(SIGSEGV, sigsegv);
+ else
+ signal(SIGSEGV, NULL);
+ } else if (!strcmp(name, "timestamps")) {
+ timestamp_prefix=level;
+ } else {
+ debug_level=0;
+ g_hash_table_insert(debug_hash, g_strdup(name), (gpointer) level);
+ g_hash_table_foreach(debug_hash, debug_update_level, NULL);
+ }
+}
+
+struct debug *
+debug_new(struct attr *parent, struct attr **attrs)
+{
+ struct attr *name,*level;
+ name=attr_search(attrs, NULL, attr_name);
+ level=attr_search(attrs, NULL, attr_level);
+ if (!name || !level)
+ return NULL;
+ debug_level_set(name->u.str, level->u.num);
+ return (struct debug *)&dummy;
+}
+
+
+int
+debug_level_get(const char *name)
+{
+ if (!debug_hash)
+ return 0;
+ return (int)(g_hash_table_lookup(debug_hash, name));
+}
+
+static void debug_timestamp(FILE *fp)
+{
+ struct timeval tv;
+
+ if (gettimeofday(&tv, NULL) == -1)
+ return;
+ /* Timestamps are UTC */
+ fprintf(fp,
+ "%02d:%02d:%02d.%03d|",
+ (int)(tv.tv_sec/3600)%24,
+ (int)(tv.tv_sec/60)%60,
+ (int)tv.tv_sec % 60,
+ (int)tv.tv_usec/1000);
+}
+
+void
+debug_vprintf(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, va_list ap)
+{
+#ifdef HAVE_API_WIN32_CE
+ char buffer[4096];
+#else
+ char buffer[mlen+flen+3];
+#endif
+ FILE *fp=debug_fp;
+
+ sprintf(buffer, "%s:%s", module, function);
+ if (debug_level_get(module) >= level || debug_level_get(buffer) >= level) {
+#ifndef DEBUG_WIN32_CE_MESSAGEBOX
+ if (! fp)
+ fp = stderr;
+ if (timestamp_prefix)
+ debug_timestamp(fp);
+ if (prefix)
+ fprintf(fp,"%s:",buffer);
+ vfprintf(fp,fmt, ap);
+ fflush(fp);
+#else
+ wchar_t muni[4096];
+ char xbuffer[4096];
+ int len=0;
+ if (prefix) {
+ strcpy(xbuffer,buffer);
+ len=strlen(buffer);
+ xbuffer[len++]=':';
+ }
+ vsprintf(xbuffer+len,fmt,ap);
+ mbstowcs(muni, xbuffer, strlen(xbuffer)+1);
+ MessageBoxW(NULL, muni, TEXT("Navit - Error"), MB_APPLMODAL|MB_OK|MB_ICONERROR);
+#endif
+ }
+}
+
+void
+debug_printf(int level, const char *module, const int mlen,const char *function, const int flen, int prefix, const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ debug_vprintf(level, module, mlen, function, flen, prefix, fmt, ap);
+ va_end(ap);
+}
+
+void
+debug_assert_fail(char *module, const int mlen,const char *function, const int flen, char *file, int line, char *expr)
+{
+ debug_printf(0,module,mlen,function,flen,1,"%s:%d assertion failed:%s\n", file, line, expr);
+ abort();
+}
+
+void
+debug_destroy(void)
+{
+ if (!debug_fp)
+ return;
+ if (debug_fp == stderr || debug_fp == stdout)
+ return;
+ fclose(debug_fp);
+ debug_fp = NULL;
+}
+
+void debug_set_logfile(const char *path)
+{
+ FILE *fp;
+ fp = fopen(path, "a");
+ if (fp) {
+ debug_destroy();
+ debug_fp = fp;
+ fprintf(debug_fp, "Navit log started\n");
+ fflush(debug_fp);
+ }
+}
diff --git a/debug.h b/debug.h
new file mode 100644
index 00000000..02f11dd9
--- /dev/null
+++ b/debug.h
@@ -0,0 +1,54 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_DEBUG_H
+#define NAVIT_DEBUG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdarg.h>
+#include <string.h>
+extern int debug_level;
+#define dbg_str2(x) #x
+#define dbg_str1(x) dbg_str2(x)
+#define dbg_module dbg_str1(MODULE)
+#define dbg(level,fmt...) ({ if (debug_level >= level) debug_printf(level,dbg_module,strlen(dbg_module),__PRETTY_FUNCTION__, strlen(__PRETTY_FUNCTION__),1,fmt); })
+#define dbg_assert(expr) ((expr) ? (void) 0 : debug_assert_fail(dbg_module,strlen(dbg_module),__PRETTY_FUNCTION__, strlen(__PRETTY_FUNCTION__),__FILE__,__LINE__,dbg_str1(expr)))
+
+/* prototypes */
+struct attr;
+void debug_init(const char *program_name);
+void debug_destroy(void);
+void debug_set_logfile(const char *path);
+void debug_level_set(const char *name, int level);
+int debug_level_get(const char *name);
+struct debug *debug_new(struct attr *parent, struct attr **attrs);
+void debug_vprintf(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, va_list ap);
+void debug_printf(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, ...);
+void debug_assert_fail(char *module, const int mlen,const char *function, const int flen, char *file, int line, char *expr);
+/* end of prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/destination.h b/destination.h
new file mode 100644
index 00000000..41411833
--- /dev/null
+++ b/destination.h
@@ -0,0 +1,29 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_DESTINATION_H
+#define NAVIT_DESTINATION_H
+
+/* prototypes */
+struct navit;
+int destination_address(struct navit *nav);
+/* end of prototypes */
+
+#endif
+
diff --git a/draw_info.h b/draw_info.h
new file mode 100644
index 00000000..0a0467f5
--- /dev/null
+++ b/draw_info.h
@@ -0,0 +1,30 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_DRAW_INFO_H
+#define NAVIT_DRAW_INFO_H
+
+struct draw_info {
+ struct container *co;
+ int display;
+ int limit;
+};
+
+#endif
+
diff --git a/endianess.h b/endianess.h
new file mode 100644
index 00000000..5944575a
--- /dev/null
+++ b/endianess.h
@@ -0,0 +1,105 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef __ENDIANESS_HANDLER__
+
+ /* The following is based on xorg/xserver/GL/glx/glxbyteorder.h
+ * which is (c) IBM Corp. 2006,2007 and originally licensed under the following
+ * BSD-license. All modifications in navit are licensed under the GNU GPL as
+ * described in file "COPYRIGHT".
+ *
+ * Portions also from GNU C Library include/bits/byteswap.h Also licsend
+ * under the GPL.
+ *
+ * --------------------------
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, THE AUTHORS, AND/OR THEIR SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#if HAVE_BYTESWAP_H
+ /* machine dependent versions of byte swapping functions. GNU extension.*/
+ #include <byteswap.h>
+#elif defined(USE_SYS_ENDIAN_H)
+ #include <sys/endian.h>
+#elif defined(__APPLE__)
+ #include <libkern/OSByteOrder.h>
+ #define __bswap_16 OSSwapInt16
+ #define __bswap_32 OSSwapInt32
+ #define __bswap_64 OSSwapInt64
+
+#ifndef __BYTE_ORDER
+ #define __LITTLE_ENDIAN 1234
+ #define __BIG_ENDIAN 4321
+
+ #if defined(__LITTLE_ENDIAN__)
+ #define __BYTE_ORDER __LITTLE_ENDIAN
+ #elif defined(__BIG_ENDIAN__)
+ #define __BYTE_ORDER __BIG_ENDIAN
+ #else
+ #error "No endianness defined for Mac OS!"
+ #endif
+#endif
+
+#elif defined(_WIN32) || defined(__CEGCC__)
+ #define __BIG_ENDIAN 4321
+ #define __LITTLE_ENDIAN 1234
+ #define __BYTE_ORDER __LITTLE_ENDIAN
+#else
+ #define __bswap_16(__bsx) ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8))
+ #define __bswap_32(__bsx) ((((__bsx) & 0xff000000) >> 24) | \
+ (((__bsx) & 0x00ff0000) >> 8) |\
+ (((__bsx) & 0x0000ff00) << 8) | \
+ (((__bsx) & 0x000000ff) << 24))
+
+
+#endif
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+ #define le16_to_cpu(x) __bswap_16 (x)
+ #define le32_to_cpu(x) __bswap_32 (x)
+ #define le64_to_cpu(x) __bswap_64 (x)
+ #define cpu_to_le16(x) __bswap_16 (x)
+ #define cpu_to_le32(x) __bswap_32 (x)
+ #define cpu_to_le64(x) __bswap_64 (x)
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
+ #define le16_to_cpu(x) (x)
+ #define le32_to_cpu(x) (x)
+ #define cpu_to_le16(x) (x)
+ #define cpu_to_le32(x) (x)
+#else
+ #error "Unknown endianess"
+#endif
+
+#define __ENDIANESS_HANDLER__
+#endif
+
diff --git a/event.c b/event.c
new file mode 100644
index 00000000..b772bf14
--- /dev/null
+++ b/event.c
@@ -0,0 +1,110 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <string.h>
+#include <stdlib.h>
+#include "event.h"
+#include "plugin.h"
+#include "debug.h"
+
+static struct event_methods event_methods;
+static const char *e_requestor;
+static const char *e_system;
+
+void event_main_loop_run(void)
+{
+ if (! event_methods.main_loop_run) {
+ dbg(0,"no event system set\n");
+ exit(1);
+ }
+ event_methods.main_loop_run();
+}
+
+void event_main_loop_quit(void)
+{
+ if (event_methods.main_loop_quit)
+ event_methods.main_loop_quit();
+}
+
+struct event_watch *
+event_add_watch(void *fd, enum event_watch_cond cond, struct callback *cb)
+{
+ return event_methods.add_watch(fd, cond, cb);
+}
+
+void
+event_remove_watch(struct event_watch *ev)
+{
+ event_methods.remove_watch(ev);
+}
+
+struct event_timeout *
+event_add_timeout(int timeout, int multi, struct callback *cb)
+{
+ return event_methods.add_timeout(timeout, multi, cb);
+}
+
+void
+event_remove_timeout(struct event_timeout *ev)
+{
+ event_methods.remove_timeout(ev);
+}
+
+struct event_idle *
+event_add_idle(int priority, struct callback *cb)
+{
+ return event_methods.add_idle(priority,cb);
+}
+
+void
+event_remove_idle(struct event_idle *ev)
+{
+ event_methods.remove_idle(ev);
+}
+
+void
+event_call_callback(struct callback_list *cb)
+{
+ event_methods.call_callback(cb);
+}
+
+int
+event_request_system(const char *system, const char *requestor)
+{
+ void (*event_type_new)(struct event_methods *meth);
+ if (e_system) {
+ if (strcmp(e_system, system)) {
+ dbg(0,"system '%s' already requested by '%s', can't set to '%s' as requested from '%s'\n", e_system, e_requestor, system, requestor);
+ return 0;
+ }
+ return 1;
+ }
+ event_type_new=plugin_get_event_type(system);
+ if (! event_type_new) {
+ dbg(0,"unsupported event system '%s' requested from '%s'\n", system, requestor);
+ return 0;
+ }
+ event_type_new(&event_methods);
+ e_system=system;
+ e_requestor=requestor;
+
+ return 1;
+}
+
+
diff --git a/event.h b/event.h
new file mode 100644
index 00000000..739baad0
--- /dev/null
+++ b/event.h
@@ -0,0 +1,64 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct event_idle;
+struct event_timeout;
+struct event_watch;
+struct callback;
+struct callback_list;
+struct file;
+
+enum event_watch_cond {
+ event_watch_cond_read=1,
+ event_watch_cond_write,
+ event_watch_cond_except,
+};
+
+struct event_methods {
+ void (*main_loop_run)(void);
+ void (*main_loop_quit)(void);
+ struct event_watch *(*add_watch)(void *fd, enum event_watch_cond cond, struct callback *cb);
+ void (*remove_watch)(struct event_watch *ev);
+ struct event_timeout *(*add_timeout)(int timeout, int multi, struct callback *cb);
+ void (*remove_timeout)(struct event_timeout *ev);
+ struct event_idle *(*add_idle)(int priority, struct callback *cb);
+ void (*remove_idle)(struct event_idle *ev);
+ void (*call_callback)(struct callback_list *cb);
+};
+
+
+/* prototypes */
+void event_main_loop_run(void);
+void event_main_loop_quit(void);
+struct event_watch *event_add_watch(void *fd, enum event_watch_cond cond, struct callback *cb);
+void event_remove_watch(struct event_watch *ev);
+struct event_timeout *event_add_timeout(int timeout, int multi, struct callback *cb);
+void event_remove_timeout(struct event_timeout *ev);
+struct event_idle *event_add_idle(int priority, struct callback *cb);
+void event_remove_idle(struct event_idle *ev);
+int event_request_system(const char *system, const char *requestor);
+void event_call_callback(struct callback_list *cb);
+/* end of prototypes */
+#ifdef __cplusplus
+}
+#endif
diff --git a/event_glib.c b/event_glib.c
new file mode 100644
index 00000000..4b268464
--- /dev/null
+++ b/event_glib.c
@@ -0,0 +1,196 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include "event.h"
+#include "event_glib.h"
+#include "debug.h"
+#include "callback.h"
+#include "plugin.h"
+
+static GMainLoop *loop;
+
+static void event_glib_main_loop_run(void)
+{
+ loop = g_main_loop_new (NULL, TRUE);
+ if (g_main_loop_is_running (loop))
+ {
+ g_main_loop_run (loop);
+ }
+}
+
+static void event_glib_main_loop_quit(void)
+{
+ if (loop)
+ g_main_loop_quit(loop);
+}
+
+struct event_watch {
+ GIOChannel *iochan;
+ guint source;
+};
+
+static gboolean
+event_glib_call_watch(GIOChannel * iochan, GIOCondition condition, gpointer t)
+{
+ struct callback *cb=t;
+ callback_call_0(cb);
+ return TRUE;
+}
+
+static struct event_watch *
+event_glib_add_watch(void *fd, enum event_watch_cond cond, struct callback *cb)
+{
+ struct event_watch *ret=g_new0(struct event_watch, 1);
+ int flags=0;
+ ret->iochan = g_io_channel_unix_new((int)fd);
+ switch (cond) {
+ case event_watch_cond_read:
+ flags=G_IO_IN;
+ break;
+ case event_watch_cond_write:
+ flags=G_IO_OUT;
+ break;
+ case event_watch_cond_except:
+ flags=G_IO_ERR|G_IO_HUP;
+ break;
+ }
+ ret->source = g_io_add_watch(ret->iochan, cond, event_glib_call_watch, (gpointer)cb);
+ return ret;
+}
+
+static void
+event_glib_remove_watch(struct event_watch *ev)
+{
+ if (! ev)
+ return;
+ g_source_remove(ev->source);
+ g_io_channel_unref(ev->iochan);
+ g_free(ev);
+}
+
+struct event_timeout {
+ guint source;
+ struct callback *cb;
+};
+
+static gboolean
+event_glib_call_timeout_single(struct event_timeout *ev)
+{
+ callback_call_0(ev->cb);
+ g_free(ev);
+ return FALSE;
+}
+
+static gboolean
+event_glib_call_timeout_multi(struct event_timeout *ev)
+{
+ callback_call_0(ev->cb);
+ return TRUE;
+}
+
+
+static struct event_timeout *
+event_glib_add_timeout(int timeout, int multi, struct callback *cb)
+{
+ struct event_timeout *ret=g_new0(struct event_timeout, 1);
+ ret->cb=cb;
+ ret->source = g_timeout_add(timeout, multi ? (GSourceFunc)event_glib_call_timeout_multi : (GSourceFunc)event_glib_call_timeout_single, (gpointer)ret);
+
+ return ret;
+}
+
+static void
+event_glib_remove_timeout(struct event_timeout *ev)
+{
+ if (! ev)
+ return;
+ g_source_remove(ev->source);
+ g_free(ev);
+}
+
+struct event_idle {
+ guint source;
+ struct callback *cb;
+};
+
+static gboolean
+event_glib_call_idle(struct event_idle *ev)
+{
+ callback_call_0(ev->cb);
+ return TRUE;
+}
+
+static struct event_idle *
+event_glib_add_idle(int priority, struct callback *cb)
+{
+ struct event_idle *ret=g_new0(struct event_idle, 1);
+ ret->cb=cb;
+ ret->source = g_idle_add_full(priority+100, (GSourceFunc)event_glib_call_idle, (gpointer)ret, NULL);
+ return ret;
+}
+
+static void
+event_glib_remove_idle(struct event_idle *ev)
+{
+ if (! ev)
+ return;
+ g_source_remove(ev->source);
+ g_free(ev);
+}
+
+static void
+event_glib_call_callback(struct callback_list *cb)
+{
+/*
+ Idea for implementation:
+ Create a pipe then use add_watch
+ add callback to a queue
+ from here write to the pipe to wakeup the pool
+ then from the gui thread process the callback queue
+*/
+}
+
+static struct event_methods event_glib_methods = {
+ event_glib_main_loop_run,
+ event_glib_main_loop_quit,
+ event_glib_add_watch,
+ event_glib_remove_watch,
+ event_glib_add_timeout,
+ event_glib_remove_timeout,
+ event_glib_add_idle,
+ event_glib_remove_idle,
+ event_glib_call_callback,
+};
+
+struct event_priv {
+};
+
+static struct event_priv*
+event_glib_new(struct event_methods *meth)
+{
+ *meth=event_glib_methods;
+ return (struct event_priv *)event_glib_new;
+}
+
+void
+event_glib_init(void)
+{
+ plugin_register_event_type("glib", event_glib_new);
+}
diff --git a/event_glib.h b/event_glib.h
new file mode 100644
index 00000000..9f9b2f52
--- /dev/null
+++ b/event_glib.h
@@ -0,0 +1,3 @@
+/* prototypes */
+void event_glib_init(void);
+/* end of prototypes */
diff --git a/navit/fib-1.1/Makefile.am b/fib-1.1/Makefile.am
index 7c7b2a13..7c7b2a13 100644
--- a/navit/fib-1.1/Makefile.am
+++ b/fib-1.1/Makefile.am
diff --git a/navit/fib-1.1/README b/fib-1.1/README
index eabcd5f8..eabcd5f8 100644
--- a/navit/fib-1.1/README
+++ b/fib-1.1/README
diff --git a/navit/fib-1.1/configure b/fib-1.1/configure
index 62eaa3d0..62eaa3d0 100755
--- a/navit/fib-1.1/configure
+++ b/fib-1.1/configure
diff --git a/navit/fib-1.1/configure.in b/fib-1.1/configure.in
index 82701527..82701527 100644
--- a/navit/fib-1.1/configure.in
+++ b/fib-1.1/configure.in
diff --git a/navit/fib-1.1/fh_extractmin.3 b/fib-1.1/fh_extractmin.3
index e1492b40..e1492b40 100644
--- a/navit/fib-1.1/fh_extractmin.3
+++ b/fib-1.1/fh_extractmin.3
diff --git a/navit/fib-1.1/fh_makeheap.3 b/fib-1.1/fh_makeheap.3
index bd867cd0..bd867cd0 100644
--- a/navit/fib-1.1/fh_makeheap.3
+++ b/fib-1.1/fh_makeheap.3
diff --git a/navit/fib-1.1/fh_makekeyheap.3 b/fib-1.1/fh_makekeyheap.3
index f55d4307..f55d4307 100644
--- a/navit/fib-1.1/fh_makekeyheap.3
+++ b/fib-1.1/fh_makekeyheap.3
diff --git a/navit/fib-1.1/fib.c b/fib-1.1/fib.c
index 276b6bd3..276b6bd3 100644
--- a/navit/fib-1.1/fib.c
+++ b/fib-1.1/fib.c
diff --git a/navit/fib-1.1/fib.h b/fib-1.1/fib.h
index d8564d3c..d8564d3c 100644
--- a/navit/fib-1.1/fib.h
+++ b/fib-1.1/fib.h
diff --git a/navit/fib-1.1/fibpriv.h b/fib-1.1/fibpriv.h
index 3984b261..3984b261 100644
--- a/navit/fib-1.1/fibpriv.h
+++ b/fib-1.1/fibpriv.h
diff --git a/navit/fib-1.1/fibtest.c b/fib-1.1/fibtest.c
index c7be1e9c..c7be1e9c 100644
--- a/navit/fib-1.1/fibtest.c
+++ b/fib-1.1/fibtest.c
diff --git a/navit/fib-1.1/fibtest.out b/fib-1.1/fibtest.out
index 285bd26b..285bd26b 100644
--- a/navit/fib-1.1/fibtest.out
+++ b/fib-1.1/fibtest.out
diff --git a/navit/fib-1.1/fibtest2.c b/fib-1.1/fibtest2.c
index 8a623b63..8a623b63 100644
--- a/navit/fib-1.1/fibtest2.c
+++ b/fib-1.1/fibtest2.c
diff --git a/navit/fib-1.1/fibtest2.out b/fib-1.1/fibtest2.out
index e9d1704f..e9d1704f 100644
--- a/navit/fib-1.1/fibtest2.out
+++ b/fib-1.1/fibtest2.out
diff --git a/navit/fib-1.1/tt.c b/fib-1.1/tt.c
index 26db1d2c..26db1d2c 100644
--- a/navit/fib-1.1/tt.c
+++ b/fib-1.1/tt.c
diff --git a/navit/fib-1.1/tt.out b/fib-1.1/tt.out
index 37a8a47c..37a8a47c 100644
--- a/navit/fib-1.1/tt.out
+++ b/fib-1.1/tt.out
diff --git a/navit/fib-1.1/use.c b/fib-1.1/use.c
index e8db3279..e8db3279 100644
--- a/navit/fib-1.1/use.c
+++ b/fib-1.1/use.c
diff --git a/file.c b/file.c
new file mode 100644
index 00000000..890dcbf1
--- /dev/null
+++ b/file.c
@@ -0,0 +1,450 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#define _FILE_OFFSET_BITS 64
+#define _LARGEFILE_SOURCE
+#define _LARGEFILE64_SOURCE
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include <dirent.h>
+#include <stdio.h>
+#include <wordexp.h>
+#include <glib.h>
+#include <zlib.h>
+#include "debug.h"
+#include "cache.h"
+#include "file.h"
+#include "config.h"
+
+#ifndef O_LARGEFILE
+#define O_LARGEFILE 0
+#endif
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+#ifdef CACHE_SIZE
+static GHashTable *file_name_hash;
+#endif
+
+static struct cache *file_cache;
+
+struct file_cache_id {
+ long long offset;
+ int size;
+ int file_name_id;
+ int method;
+} __attribute__ ((packed));
+
+struct file *
+file_create(char *name)
+{
+ struct stat stat;
+ struct file *file= g_new0(struct file,1);
+
+ file->fd=open(name, O_RDONLY|O_LARGEFILE | O_BINARY);
+ if (file->fd == -1) {
+ g_free(file);
+ return NULL;
+ }
+ dbg(1,"fd=%d\n", file->fd);
+ fstat(file->fd, &stat);
+ file->size=stat.st_size;
+ dbg(1,"size=%Ld\n", file->size);
+ file->name = g_strdup(name);
+ dbg_assert(file != NULL);
+ return file;
+}
+
+int file_is_dir(char *name)
+{
+ struct stat buf;
+ if (! stat(name, &buf)) {
+ return S_ISDIR(buf.st_mode);
+ }
+ return 0;
+
+}
+
+int
+file_size(struct file *file)
+{
+ return file->size;
+}
+
+int file_mkdir(char *name, int pflag)
+{
+ char buffer[strlen(name)+1];
+ int ret;
+ char *next;
+ dbg(1,"enter %s %d\n",name,pflag);
+ if (!pflag) {
+ if (file_is_dir(name))
+ return 0;
+#ifdef HAVE_API_WIN32_BASE
+ return mkdir(name);
+#else
+ return mkdir(name, 0777);
+#endif
+ }
+ strcpy(buffer, name);
+ next=buffer;
+ while ((next=strchr(next, '/'))) {
+ *next='\0';
+ if (*buffer) {
+ ret=file_mkdir(buffer, 0);
+ if (ret)
+ return ret;
+ }
+ *next++='/';
+ }
+ if (pflag == 2)
+ return 0;
+ return file_mkdir(buffer, 0);
+}
+
+int
+file_mmap(struct file *file)
+{
+#if defined(_WIN32) || defined(__CEGCC__)
+ file->begin = (char*)mmap_readonly_win32( file->name, &file->map_handle, &file->map_file );
+#else
+ file->begin=mmap(NULL, file->size, PROT_READ|PROT_WRITE, MAP_PRIVATE, file->fd, 0);
+ dbg_assert(file->begin != NULL);
+ if (file->begin == (void *)0xffffffff) {
+ perror("mmap");
+ return 0;
+ }
+#endif
+ dbg_assert(file->begin != (void *)0xffffffff);
+ file->end=file->begin+file->size;
+
+ return 1;
+}
+
+unsigned char *
+file_data_read(struct file *file, long long offset, int size)
+{
+ void *ret;
+ if (file->begin)
+ return file->begin+offset;
+ if (file_cache) {
+ struct file_cache_id id={offset,size,file->name_id,0};
+ ret=cache_lookup(file_cache,&id);
+ if (ret)
+ return ret;
+ ret=cache_insert_new(file_cache,&id,size);
+ } else
+ ret=g_malloc(size);
+ lseek(file->fd, offset, SEEK_SET);
+ if (read(file->fd, ret, size) != size) {
+ file_data_free(file, ret);
+ ret=NULL;
+ }
+ return ret;
+
+}
+
+unsigned char *
+file_data_read_all(struct file *file)
+{
+ return file_data_read(file, 0, file->size);
+}
+
+int
+file_get_contents(char *name, unsigned char **buffer, int *size)
+{
+ struct file *file;
+ file=file_create(name);
+ if (!file)
+ return 0;
+ *size=file_size(file);
+ *buffer=file_data_read_all(file);
+ file_destroy(file);
+ return 1;
+}
+
+
+static int
+uncompress_int(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
+{
+ z_stream stream;
+ int err;
+
+ stream.next_in = (Bytef*)source;
+ stream.avail_in = (uInt)sourceLen;
+ stream.next_out = dest;
+ stream.avail_out = (uInt)*destLen;
+
+ stream.zalloc = (alloc_func)0;
+ stream.zfree = (free_func)0;
+
+ err = inflateInit2(&stream, -MAX_WBITS);
+ if (err != Z_OK) return err;
+
+ err = inflate(&stream, Z_FINISH);
+ if (err != Z_STREAM_END) {
+ inflateEnd(&stream);
+ if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
+ return Z_DATA_ERROR;
+ return err;
+ }
+ *destLen = stream.total_out;
+
+ err = inflateEnd(&stream);
+ return err;
+}
+
+unsigned char *
+file_data_read_compressed(struct file *file, long long offset, int size, int size_uncomp)
+{
+ void *ret;
+ char *buffer = 0;
+ uLongf destLen=size_uncomp;
+
+ if (file_cache) {
+ struct file_cache_id id={offset,size,file->name_id,1};
+ ret=cache_lookup(file_cache,&id);
+ if (ret)
+ return ret;
+ ret=cache_insert_new(file_cache,&id,size_uncomp);
+ } else
+ ret=g_malloc(size_uncomp);
+ lseek(file->fd, offset, SEEK_SET);
+
+ buffer = (char *)g_malloc(size);
+ if (read(file->fd, buffer, size) != size) {
+ g_free(ret);
+ ret=NULL;
+ } else {
+ if (uncompress_int(ret, &destLen, (Bytef *)buffer, size) != Z_OK) {
+ dbg(0,"uncompress failed\n");
+ g_free(ret);
+ ret=NULL;
+ }
+ }
+ g_free(buffer);
+
+ return ret;
+}
+
+void
+file_data_free(struct file *file, unsigned char *data)
+{
+ if (file->begin && data >= file->begin && data < file->end)
+ return;
+ if (file_cache) {
+ cache_entry_destroy(file_cache, data);
+ } else
+ g_free(data);
+}
+
+int
+file_exists(char *name)
+{
+ struct stat buf;
+ if (! stat(name, &buf))
+ return 1;
+ return 0;
+}
+
+void
+file_remap_readonly(struct file *f)
+{
+#if defined(_WIN32) || defined(__CEGCC__)
+#else
+ void *begin;
+ munmap(f->begin, f->size);
+ begin=mmap(f->begin, f->size, PROT_READ, MAP_PRIVATE, f->fd, 0);
+ if (f->begin != begin)
+ printf("remap failed\n");
+#endif
+}
+
+void
+file_unmap(struct file *f)
+{
+#if defined(_WIN32) || defined(__CEGCC__)
+ mmap_unmap_win32( f->begin, f->map_handle , f->map_file );
+#else
+ munmap(f->begin, f->size);
+#endif
+}
+
+void *
+file_opendir(char *dir)
+{
+ return opendir(dir);
+}
+
+char *
+file_readdir(void *hnd)
+{
+ struct dirent *ent;
+
+ ent=readdir(hnd);
+ if (! ent)
+ return NULL;
+ return ent->d_name;
+}
+
+void
+file_closedir(void *hnd)
+{
+ closedir(hnd);
+}
+
+struct file *
+file_create_caseinsensitive(char *name)
+{
+ char dirname[strlen(name)+1];
+ char *filename;
+ char *p;
+ void *d;
+ struct file *ret;
+
+ ret=file_create(name);
+ if (ret)
+ return ret;
+
+ strcpy(dirname, name);
+ p=dirname+strlen(name);
+ while (p > dirname) {
+ if (*p == '/')
+ break;
+ p--;
+ }
+ *p=0;
+ d=file_opendir(dirname);
+ if (d) {
+ *p++='/';
+ while ((filename=file_readdir(d))) {
+ if (!strcasecmp(filename, p)) {
+ strcpy(p, filename);
+ ret=file_create(dirname);
+ if (ret)
+ break;
+ }
+ }
+ file_closedir(d);
+ }
+ return ret;
+}
+
+void
+file_destroy(struct file *f)
+{
+ close(f->fd);
+
+ if ( f->begin != NULL )
+ {
+ file_unmap( f );
+ }
+
+ g_free(f->name);
+ g_free(f);
+}
+
+struct file_wordexp {
+ int err;
+ wordexp_t we;
+};
+
+struct file_wordexp *
+file_wordexp_new(const char *pattern)
+{
+ struct file_wordexp *ret=g_new0(struct file_wordexp, 1);
+
+ ret->err=wordexp(pattern, &ret->we, 0);
+ if (ret->err)
+ dbg(0,"wordexp('%s') returned %d\n", pattern, ret->err);
+ return ret;
+}
+
+int
+file_wordexp_get_count(struct file_wordexp *wexp)
+{
+ return wexp->we.we_wordc;
+}
+
+char **
+file_wordexp_get_array(struct file_wordexp *wexp)
+{
+ return wexp->we.we_wordv;
+}
+
+void
+file_wordexp_destroy(struct file_wordexp *wexp)
+{
+ if (! wexp->err)
+ wordfree(&wexp->we);
+ g_free(wexp);
+}
+
+
+int
+file_get_param(struct file *file, struct param_list *param, int count)
+{
+ int i=count;
+ param_add_string("Filename", file->name, &param, &count);
+ param_add_hex("Size", file->size, &param, &count);
+ return i-count;
+}
+
+int
+file_version(struct file *file, int byname)
+{
+#ifndef __CEGCC__
+ struct stat st;
+ int error;
+ if (byname)
+ error=stat(file->name, &st);
+ else
+ error=fstat(file->fd, &st);
+ if (error || !file->version || file->mtime != st.st_mtime || file->ctime != st.st_ctime) {
+ file->mtime=st.st_mtime;
+ file->ctime=st.st_ctime;
+ file->version++;
+ dbg(0,"%s now version %d\n", file->name, file->version);
+ }
+ return file->version;
+#else
+ return 0;
+#endif
+}
+
+void *
+file_get_os_handle(struct file *file)
+{
+ return (void *)(file->fd);
+}
+
+void
+file_init(void)
+{
+#ifdef CACHE_SIZE
+ file_name_hash=g_hash_table_new(g_str_hash, g_str_equal);
+ file_cache=cache_new(sizeof(struct file_cache_id), CACHE_SIZE);
+#endif
+}
+
diff --git a/file.h b/file.h
new file mode 100644
index 00000000..f5dae8ea
--- /dev/null
+++ b/file.h
@@ -0,0 +1,83 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_FILE_H
+#define NAVIT_FILE_H
+
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+#ifndef __CEGCC__
+#include <time.h>
+#endif
+#include "param.h"
+
+struct file {
+ struct file *next;
+ unsigned char *begin;
+ unsigned char *end;
+ long long size;
+ int name_id;
+ int fd;
+#ifndef __CEGCC__
+ time_t mtime;
+ time_t ctime;
+ int version;
+#endif
+#if defined(_WIN32) || defined(__CEGCC__)
+ long map_handle;
+ long map_file;
+#endif
+ char *name;
+};
+
+/* prototypes */
+struct file;
+struct file_wordexp;
+struct param_list;
+struct file *file_create(char *name);
+int file_is_dir(char *name);
+int file_size(struct file *file);
+int file_mkdir(char *name, int pflag);
+int file_mmap(struct file *file);
+unsigned char *file_data_read(struct file *file, long long offset, int size);
+unsigned char *file_data_read_all(struct file *file);
+int file_get_contents(char *name, unsigned char **buffer, int *size);
+unsigned char *file_data_read_compressed(struct file *file, long long offset, int size, int size_uncomp);
+void file_data_free(struct file *file, unsigned char *data);
+int file_exists(char *name);
+void file_remap_readonly(struct file *f);
+void file_unmap(struct file *f);
+void *file_opendir(char *dir);
+char *file_readdir(void *hnd);
+void file_closedir(void *hnd);
+struct file *file_create_caseinsensitive(char *name);
+void file_destroy(struct file *f);
+struct file_wordexp *file_wordexp_new(const char *pattern);
+int file_wordexp_get_count(struct file_wordexp *wexp);
+char **file_wordexp_get_array(struct file_wordexp *wexp);
+void file_wordexp_destroy(struct file_wordexp *wexp);
+int file_get_param(struct file *file, struct param_list *param, int count);
+int file_version(struct file *file, int byname);
+void *file_get_os_handle(struct file *file);
+void file_init(void);
+/* end of prototypes */
+
+#endif
+
diff --git a/font/Makefile.am b/font/Makefile.am
new file mode 100644
index 00000000..620280e6
--- /dev/null
+++ b/font/Makefile.am
@@ -0,0 +1,4 @@
+SUBDIRS=
+if FONT_FREETYPE
+ SUBDIRS+=freetype
+endif
diff --git a/font/freetype/Makefile.am b/font/freetype/Makefile.am
new file mode 100644
index 00000000..e5557fe9
--- /dev/null
+++ b/font/freetype/Makefile.am
@@ -0,0 +1,9 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ @FREETYPE2_CFLAGS@ @FONTCONFIG_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=font_freetype
+if PLUGINS
+ modulefont_LTLIBRARIES = libfont_freetype.la
+else
+ noinst_LTLIBRARIES = libfont_freetype.la
+endif
+libfont_freetype_la_SOURCES = font_freetype.c font_freetype.h
+libfont_freetype_la_LDFLAGS = @FREETYPE2_LIBS@ @FONTCONFIG_LIBS@ -module -avoid-version
diff --git a/font/freetype/font_freetype.c b/font/freetype/font_freetype.c
new file mode 100644
index 00000000..313d2798
--- /dev/null
+++ b/font/freetype/font_freetype.c
@@ -0,0 +1,674 @@
+#include "config.h"
+#ifdef HAVE_FONTCONFIG
+#include <fontconfig/fontconfig.h>
+#endif
+#include <ft2build.h>
+#include <glib.h>
+#include FT_FREETYPE_H
+#ifndef USE_CACHING
+#define USE_CACHING 1
+#endif
+#if USE_CACHING
+#include FT_CACHE_H
+#endif
+#include <freetype/ftglyph.h>
+#include "point.h"
+#include "graphics.h"
+#include "debug.h"
+#include "plugin.h"
+#include "color.h"
+#include "atom.h"
+#include "font_freetype.h"
+
+#ifndef HAVE_LOOKUP_SCALER
+#if FREETYPE_MAJOR * 10000 + FREETYPE_MINOR * 100 + FREETYPE_PATCH > 20304
+#define HAVE_LOOKUP_SCALER 1
+#else
+#define HAVE_LOOJUP_SCALER 0
+#endif
+#endif
+
+struct font_freetype_font {
+ int size;
+#if USE_CACHING
+#if HAVE_LOOKUP_SCALER
+ FTC_ScalerRec scaler;
+#else
+ FTC_ImageTypeRec scaler;
+#endif
+ int charmap_index;
+#else
+ FT_Face face;
+#endif
+};
+
+struct font_priv {
+};
+
+static struct font_priv dummy;
+static FT_Library library;
+#if USE_CACHING
+static FTC_Manager manager;
+static FTC_ImageCache image_cache;
+static FTC_CMapCache charmap_cache;
+static FTC_SBitCache sbit_cache;
+#endif
+static int library_init;
+
+
+static void
+font_freetype_get_text_bbox(struct graphics_priv *gr,
+ struct font_freetype_font *font, char *text,
+ int dx, int dy, struct point *ret,
+ int estimate)
+{
+ char *p = text;
+ FT_BBox bbox;
+ FT_UInt glyph_index;
+ FT_Glyph glyph;
+ FT_Matrix matrix;
+ FT_Vector pen;
+ pen.x = 0 * 64;
+ pen.y = 0 * 64;
+ int i;
+ struct point pt;
+#if 0
+ matrix.xx = dx;
+ matrix.xy = dy;
+ matrix.yx = -dy;
+ matrix.yy = dx;
+#else
+ matrix.xx = 0x10000;
+ matrix.xy = 0;
+ matrix.yx = 0;
+ matrix.yy = 0x10000;
+#endif
+ int n, len, x = 0, y = 0;
+
+ len = g_utf8_strlen(text, -1);
+ if (estimate) {
+ bbox.xMin = 0;
+ bbox.yMin = 0;
+ bbox.yMax = 13*font->size/256;
+ bbox.xMax = 9*font->size*len/256;
+ } else {
+ bbox.xMin = bbox.yMin = 32000;
+ bbox.xMax = bbox.yMax = -32000;
+#if !USE_CACHING
+ FT_Set_Transform(font->face, &matrix, &pen);
+#endif
+ for (n = 0; n < len; n++) {
+ FT_BBox glyph_bbox;
+#if USE_CACHING
+ FTC_Node anode = NULL;
+ glyph_index = FTC_CMapCache_Lookup(charmap_cache, font->scaler.face_id, font->charmap_index, g_utf8_get_char(p));
+ FT_Glyph cached_glyph;
+#if HAVE_LOOKUP_SCALER
+ FTC_ImageCache_LookupScaler(image_cache, &font->scaler, FT_LOAD_DEFAULT, glyph_index, &cached_glyph, &anode);
+#else
+ FTC_ImageCache_Lookup(image_cache, &font->scaler, glyph_index, &cached_glyph, &anode);
+#endif
+ FT_Glyph_Copy(cached_glyph, &glyph);
+ FT_Glyph_Transform(glyph, &matrix, &pen);
+#else
+ glyph_index = FT_Get_Char_Index(font->face, g_utf8_get_char(p));
+ FT_Load_Glyph(font->face, glyph_index, FT_LOAD_DEFAULT);
+ FT_Get_Glyph(font->face->glyph, &glyph);
+#endif
+ FT_Glyph_Get_CBox(glyph, ft_glyph_bbox_pixels, &glyph_bbox);
+
+ glyph_bbox.xMin += x >> 6;
+ glyph_bbox.xMax += x >> 6;
+ glyph_bbox.yMin += y >> 6;
+ glyph_bbox.yMax += y >> 6;
+ x += glyph->advance.x >> 10;
+ y -= glyph->advance.y >> 10;
+ if (glyph_bbox.xMin < bbox.xMin)
+ bbox.xMin = glyph_bbox.xMin;
+ if (glyph_bbox.yMin < bbox.yMin)
+ bbox.yMin = glyph_bbox.yMin;
+ if (glyph_bbox.xMax > bbox.xMax)
+ bbox.xMax = glyph_bbox.xMax;
+ if (glyph_bbox.yMax > bbox.yMax)
+ bbox.yMax = glyph_bbox.yMax;
+ p = g_utf8_next_char(p);
+#if USE_CACHING
+ FT_Done_Glyph(glyph);
+ FTC_Node_Unref(anode, manager);
+#else
+ FT_Done_Glyph(glyph);
+#endif
+ }
+ if (bbox.xMin > bbox.xMax) {
+ bbox.xMin = 0;
+ bbox.yMin = 0;
+ bbox.xMax = 0;
+ bbox.yMax = 0;
+ }
+ }
+ ret[0].x = bbox.xMin;
+ ret[0].y = -bbox.yMin;
+ ret[1].x = bbox.xMin;
+ ret[1].y = -bbox.yMax;
+ ret[2].x = bbox.xMax;
+ ret[2].y = -bbox.yMax;
+ ret[3].x = bbox.xMax;
+ ret[3].y = -bbox.yMin;
+ if (dy != 0 || dx != 0x10000) {
+ for (i = 0 ; i < 4 ; i++) {
+ pt=ret[i];
+ ret[i].x=(pt.x*dx-pt.y*dy)/0x10000;
+ ret[i].y=(pt.y*dx+pt.x*dy)/0x10000;
+ }
+ }
+}
+
+static struct font_freetype_text *
+font_freetype_text_new(char *text, struct font_freetype_font *font, int dx,
+ int dy)
+{
+ FT_Matrix matrix;
+ FT_Vector pen;
+ FT_UInt glyph_index;
+ int y, n, len, w, h, pixmap_len;
+ struct font_freetype_text *ret;
+ struct font_freetype_glyph *curr;
+ char *p = text;
+ unsigned char *gl, *pm;
+ FT_BitmapGlyph glyph_bitmap;
+ FT_Glyph glyph;
+
+ len = g_utf8_strlen(text, -1);
+ ret = g_malloc(sizeof(*ret) + len * sizeof(struct text_glyph *));
+ ret->glyph_count = len;
+
+ matrix.xx = dx;
+ matrix.xy = dy;
+ matrix.yx = -dy;
+ matrix.yy = dx;
+
+ pen.x = 0 * 64;
+ pen.y = 0 * 64;
+#if !USE_CACHING
+ FT_Set_Transform(font->face, &matrix, &pen);
+#endif
+
+ for (n = 0; n < len; n++) {
+
+#if USE_CACHING
+ FTC_Node anode=NULL;
+ FT_Glyph cached_glyph;
+ glyph_index = FTC_CMapCache_Lookup(charmap_cache, font->scaler.face_id, font->charmap_index, g_utf8_get_char(p));
+#if HAVE_LOOKUP_SCALER
+ FTC_ImageCache_LookupScaler(image_cache, &font->scaler, FT_LOAD_DEFAULT, glyph_index, &cached_glyph, &anode);
+#else
+ FTC_ImageCache_Lookup(image_cache, &font->scaler, glyph_index, &cached_glyph, &anode);
+#endif
+ FT_Glyph_Copy(cached_glyph, &glyph);
+ FT_Glyph_Transform(glyph, &matrix, &pen);
+ FT_Glyph_To_Bitmap(&glyph, ft_render_mode_normal, NULL, TRUE);
+#else
+ glyph_index = FT_Get_Char_Index(font->face, g_utf8_get_char(p));
+ FT_Load_Glyph(font->face, glyph_index, FT_LOAD_DEFAULT);
+ FT_Get_Glyph(font->face->glyph, &glyph);
+#endif
+ FT_Glyph_To_Bitmap(&glyph, ft_render_mode_normal, NULL, TRUE);
+ glyph_bitmap = (FT_BitmapGlyph)glyph;
+
+ w = glyph_bitmap->bitmap.width;
+ h = glyph_bitmap->bitmap.rows;
+ if (w && h)
+ pixmap_len = (w + 2) * (h + 2);
+ else
+ pixmap_len = 0;
+ curr = g_malloc0(sizeof(*curr) + pixmap_len);
+ if (pixmap_len) {
+ curr->w = w;
+ curr->h = h;
+ }
+ curr->pixmap = (unsigned char *) (curr + 1);
+ ret->glyph[n] = curr;
+
+ curr->x = glyph_bitmap->left << 6;
+ curr->y = -glyph_bitmap->top << 6;
+ for (y = 0; y < h; y++) {
+ gl = glyph_bitmap->bitmap.buffer + y * glyph_bitmap->bitmap.pitch;
+ pm = curr->pixmap + y * w;
+ memcpy(pm, gl, w);
+ }
+
+ curr->dx = glyph->advance.x >> 10;
+ curr->dy = -glyph->advance.y >> 10;
+#if USE_CACHING
+ FT_Done_Glyph(glyph);
+ FTC_Node_Unref(anode, manager);
+#endif
+ p = g_utf8_next_char(p);
+ }
+ ret->glyph_count = len;
+ return ret;
+}
+
+/**
+ * List of font families to use, in order of preference
+ */
+static char *fontfamilies[] = {
+ "Liberation Sans",
+ "Arial",
+ "NcrBI4nh",
+ "luximbi",
+ "FreeSans",
+ "DejaVu Sans",
+ NULL,
+};
+
+static void
+font_destroy(struct graphics_font_priv *font)
+{
+ g_free(font);
+ /* TODO: free font->face */
+}
+
+static struct graphics_font_methods font_methods = {
+ font_destroy
+};
+
+
+static void
+font_freetype_text_destroy(struct font_freetype_text *text)
+{
+ int i;
+ struct font_freetype_glyph **gp;
+
+ gp = text->glyph;
+ i = text->glyph_count;
+ while (i-- > 0)
+ g_free(*gp++);
+ g_free(text);
+}
+
+#if USE_CACHING
+static FT_Error face_requester( FTC_FaceID face_id, FT_Library library, FT_Pointer request_data, FT_Face* aface )
+{
+ FT_Error ret;
+ char *fontfile,*fontindex;
+ if (! face_id)
+ return FT_Err_Invalid_Handle;
+ fontfile=g_strdup((char *)face_id);
+ dbg(1,"fontfile=%s\n", fontfile);
+ fontindex=strrchr(fontfile,'/');
+ if (! fontindex) {
+ g_free(fontfile);
+ return FT_Err_Invalid_Handle;
+ }
+ *fontindex++='\0';
+ dbg(1,"new face %s %d\n", fontfile, atoi(fontindex));
+ ret = FT_New_Face( library, fontfile, atoi(fontindex), aface );
+ if(ret) {
+ dbg(0,"Error while creating freetype face: %d\n", ret);
+ return ret;
+ }
+ if((ret = FT_Select_Charmap(*aface, FT_ENCODING_UNICODE))) {
+ dbg(0,"Error while creating freetype face: %d\n", ret);
+ }
+ return 0;
+}
+#endif
+
+/**
+ * Load a new font using the fontconfig library.
+ * First search for each of the font families and require and exact match on family
+ * If no font found, let fontconfig pick the best match
+ * @param graphics_priv FIXME
+ * @param graphics_font_methods FIXME
+ * @param fontfamily the preferred font family
+ * @param size requested size of fonts
+ * @param flags extra flags for the font (bold,etc)
+ * @returns <>
+*/
+static struct font_freetype_font *
+font_freetype_font_new(struct graphics_priv *gr,
+ struct graphics_font_methods *meth,
+ char *fontfamily, int size, int flags)
+{
+ struct font_freetype_font *font =
+ g_new(struct font_freetype_font, 1);
+
+ *meth = font_methods;
+ int exact, found=0;
+ char **family, **family_sav;
+#if USE_CACHING
+ char *idstr;
+ FT_Face face;
+#endif
+#ifndef HAVE_FONTCONFIG
+ char *name;
+#endif
+
+ if (!library_init) {
+ FT_Init_FreeType(&library);
+#if USE_CACHING
+ FTC_Manager_New( library, 0, 0, 0, &face_requester, NULL, &manager);
+ FTC_ImageCache_New( manager, &image_cache);
+ FTC_CMapCache_New( manager, &charmap_cache);
+ FTC_SBitCache_New( manager, &sbit_cache);
+#endif
+ library_init = 1;
+ }
+ font->size=size;
+#ifdef HAVE_FONTCONFIG
+ dbg(2, " about to search for fonts, prefered = %s\n", fontfamily);
+ family = g_malloc(sizeof(fontfamilies) + sizeof(fontfamily));
+ if (fontfamily) {
+ memcpy(family, &fontfamily, sizeof(fontfamily));
+ memcpy(family + 1, fontfamilies, sizeof(fontfamilies));
+ } else {
+ memcpy(family, fontfamilies, sizeof(fontfamilies));
+ }
+ family_sav=family;
+ for (exact = 1; !found && exact >= 0; exact--) {
+ family=family_sav;
+
+
+ while (*family && !found) {
+ dbg(2, "Looking for font family %s. exact=%d\n",
+ *family, exact);
+ FcPattern *required =
+ FcPatternBuild(NULL, FC_FAMILY, FcTypeString,
+ *family, NULL);
+ if (flags)
+ FcPatternAddInteger(required, FC_WEIGHT,
+ FC_WEIGHT_BOLD);
+ FcConfigSubstitute(FcConfigGetCurrent(), required,
+ FcMatchFont);
+ FcDefaultSubstitute(required);
+ FcResult result;
+ FcPattern *matched =
+ FcFontMatch(FcConfigGetCurrent(), required,
+ &result);
+ if (matched) {
+ FcValue v1, v2;
+ FcChar8 *fontfile;
+ int fontindex;
+ FcPatternGet(required, FC_FAMILY, 0, &v1);
+ FcPatternGet(matched, FC_FAMILY, 0, &v2);
+ FcResult r1 =
+ FcPatternGetString(matched, FC_FILE, 0,
+ &fontfile);
+ FcResult r2 =
+ FcPatternGetInteger(matched, FC_INDEX,
+ 0, &fontindex);
+ if ((r1 == FcResultMatch)
+ && (r2 == FcResultMatch)
+ && (FcValueEqual(v1, v2) || !exact)) {
+ dbg(2,
+ "About to load font from file %s index %d\n",
+ fontfile, fontindex);
+#if USE_CACHING
+ idstr=g_strdup_printf("%s/%d", fontfile, fontindex);
+ font->scaler.face_id=(FTC_FaceID)atom(idstr);
+ g_free(idstr);
+#if HAVE_LOOKUP_SCALER
+ font->scaler.width=0;
+ font->scaler.height=size;
+ font->scaler.pixel=0;
+ font->scaler.x_res=300;
+ font->scaler.y_res=300;
+#else
+ font->scaler.width=size/15;
+ font->scaler.height=size/15;
+ font->scaler.flags=FT_LOAD_DEFAULT;
+#endif
+ FTC_Manager_LookupFace(manager, font->scaler.face_id, &face);
+ font->charmap_index=face->charmap ? FT_Get_Charmap_Index(face->charmap) : 0;
+#else
+ FT_New_Face(library,
+ (char *) fontfile,
+ fontindex,
+ &font->face);
+#endif
+ found = 1;
+ }
+ FcPatternDestroy(matched);
+ }
+ FcPatternDestroy(required);
+ family++;
+ }
+ }
+ g_free(family_sav);
+#else
+ name=g_strdup_printf("%s/fonts/%s-%s.ttf",getenv("NAVIT_SHAREDIR"),"LiberationSans",flags ? "Bold":"Regular");
+#if USE_CACHING
+ idstr=g_strdup_printf("%s/%d", name, 0);
+ font->scaler.face_id=(FTC_FaceID)atom(idstr);
+ g_free(idstr);
+#if HAVE_LOOKUP_SCALER
+ font->scaler.width=0;
+ font->scaler.height=size;
+ font->scaler.pixel=0;
+ font->scaler.x_res=300;
+ font->scaler.y_res=300;
+#else
+ font->scaler.width=size/15;
+ font->scaler.height=size/15;
+ font->scaler.flags=FT_LOAD_DEFAULT;
+#endif
+ found=1;
+#else
+ if (!FT_New_Face(library, name, 0, &font->face))
+ found=1;
+#endif
+ g_free(name);
+#endif
+ if (!found) {
+ dbg(0,"Failed to load font, no labelling\n");
+ g_free(font);
+ return NULL;
+ }
+#if !USE_CACHING
+ FT_Set_Char_Size(font->face, 0, size, 300, 300);
+ FT_Select_Charmap(font->face, FT_ENCODING_UNICODE);
+#endif
+ return font;
+}
+
+static int
+font_freetype_glyph_get_shadow(struct font_freetype_glyph *g,
+ unsigned char *data, int depth, int stride, struct color *foreground, struct color *background)
+{
+ int mask0, mask1, mask2, x, y, w = g->w, h = g->h;
+ unsigned int bg, fg;
+ unsigned char *pm, *psp,*ps,*psn;
+ switch (depth) {
+ case 1:
+ fg=0xff;
+ bg=0x00;
+ break;
+ case 8:
+ fg=foreground->a>>8;
+ bg=background->a>>8;
+ break;
+ case 32:
+ fg=((foreground->a>>8)<<24)|
+ ((foreground->r>>8)<<16)|
+ ((foreground->g>>8)<<8)|
+ ((foreground->b>>8)<<0);
+ bg=((background->a>>8)<<24)|
+ ((background->r>>8)<<16)|
+ ((background->g>>8)<<8)|
+ ((background->b>>8)<<0);
+ break;
+ default:
+ return 0;
+ }
+ for (y = 0; y < h+2; y++) {
+ if (stride) {
+ ps = data + stride * y;
+ } else {
+ unsigned char **dataptr=(unsigned char **)data;
+ ps = dataptr[y];
+ }
+ switch (depth) {
+ case 1:
+ memset(ps, bg, (w+9)/2);
+ break;
+ case 8:
+ memset(ps, bg, w+2);
+ break;
+ case 32:
+ for (x = 0 ; x < w+2 ; x++)
+ ((unsigned int *)ps)[x]=bg;
+ break;
+ }
+ }
+ for (y = 0; y < h; y++) {
+ pm = g->pixmap + y * w;
+ if (stride) {
+ psp = data + stride * y;
+ ps = psp + stride;
+ psn = ps + stride;
+ } else {
+ unsigned char **dataptr=(unsigned char **)data;
+ psp = dataptr[y];
+ ps = dataptr[y+1];
+ psn = dataptr[y+2];
+ }
+ switch (depth) {
+ case 1:
+ mask0 = 0x4000;
+ mask1 = 0xe000;
+ mask2 = 0x4000;
+ for (x = 0; x < w; x++) {
+ if (*pm) {
+ psp[0] |= (mask0 >> 8);
+ if (mask0 & 0xff)
+ psp[1] |= mask0;
+ ps[0] |= (mask1 >> 8);
+ if (mask1 & 0xff)
+ ps[1] |= mask1;
+ psn[0] |= (mask2 >> 8);
+ if (mask2 & 0xff)
+ psn[1] |= mask2;
+ }
+ mask0 >>= 1;
+ mask1 >>= 1;
+ mask2 >>= 1;
+ if (!
+ ((mask0 >> 8) | (mask1 >> 8) |
+ (mask2 >> 8))) {
+ mask0 <<= 8;
+ mask1 <<= 8;
+ mask2 <<= 8;
+ psp++;
+ ps++;
+ psn++;
+ }
+ pm++;
+ }
+ break;
+ case 8:
+ for (x = 0; x < w; x++) {
+ if (*pm) {
+ psp[1] = fg;
+ ps[0] = fg;
+ ps[1] = fg;
+ ps[2] = fg;
+ psn[1] = fg;
+ }
+ psp++;
+ ps++;
+ psn++;
+ pm++;
+ }
+ break;
+ case 32:
+ for (x = 0; x < w; x++) {
+ if (*pm) {
+ ((unsigned int *)psp)[1]=fg;
+ ((unsigned int *)ps)[0]=fg;
+ ((unsigned int *)ps)[1]=fg;
+ ((unsigned int *)ps)[2]=fg;
+ ((unsigned int *)psn)[1]=fg;
+ }
+ psp+=4;
+ ps+=4;
+ psn+=4;
+ pm++;
+ }
+ break;
+ }
+ }
+ return 1;
+}
+
+static int
+font_freetype_glyph_get_glyph(struct font_freetype_glyph *g,
+ unsigned char *data, int depth, int stride, struct color *fg, struct color *bg, struct color *transparent)
+{
+ int x, y, w = g->w, h = g->h;
+ unsigned int tr;
+ unsigned char v,vi,*pm, *ps;
+ switch (depth) {
+ case 32:
+ tr=((transparent->a>>8)<<24)|
+ ((transparent->r>>8)<<16)|
+ ((transparent->g>>8)<<8)|
+ ((transparent->b>>8)<<0);
+ break;
+ default:
+ return 0;
+ }
+ for (y = 0; y < h; y++) {
+ pm = g->pixmap + y * w;
+ if (stride) {
+ ps = data + stride*y;
+ } else {
+ unsigned char **dataptr=(unsigned char **)data;
+ ps = dataptr[y];
+ }
+ switch (depth) {
+ case 32:
+ for (x = 0; x < w; x++) {
+ v=*pm;
+ if (v) {
+ vi=255-v;
+ ((unsigned int *)ps)[0]=
+ ((((fg->a*v+bg->a*vi)/255)>>8)<<24)|
+ ((((fg->r*v+bg->r*vi)/255)>>8)<<16)|
+ ((((fg->g*v+bg->g*vi)/255)>>8)<<8)|
+ ((((fg->b*v+bg->b*vi)/255)>>8)<<0);
+ } else
+ ((unsigned int *)ps)[0]=tr;
+ ps+=4;
+ pm++;
+ }
+ break;
+ }
+ }
+ return 1;
+}
+
+static struct font_freetype_methods methods = {
+ font_freetype_font_new,
+ font_freetype_get_text_bbox,
+ font_freetype_text_new,
+ font_freetype_text_destroy,
+ font_freetype_glyph_get_shadow,
+ font_freetype_glyph_get_glyph,
+};
+
+static struct font_priv *
+font_freetype_new(void *meth)
+{
+ *((struct font_freetype_methods *) meth) = methods;
+ return &dummy;
+}
+
+void
+plugin_init(void)
+{
+ plugin_register_font_type("freetype", font_freetype_new);
+#ifdef HAVE_FONTCONFIG
+ FcInit();
+#endif
+}
diff --git a/font/freetype/font_freetype.h b/font/freetype/font_freetype.h
new file mode 100644
index 00000000..e075d516
--- /dev/null
+++ b/font/freetype/font_freetype.h
@@ -0,0 +1,38 @@
+
+struct font_freetype_font;
+struct font_freetype_glyph;
+
+struct font_freetype_methods {
+ struct font_freetype_font *(*font_new) (struct graphics_priv * gr,
+ struct
+ graphics_font_methods *
+ meth, char *font, int size,
+ int flags);
+ void (*get_text_bbox) (struct graphics_priv * gr,
+ struct font_freetype_font * font,
+ char *text, int dx, int dy,
+ struct point * ret, int estimate);
+ struct font_freetype_text *(*text_new) (char *text,
+ struct font_freetype_font *
+ font, int dx, int dy);
+ void (*text_destroy) (struct font_freetype_text * text);
+ int (*get_shadow) (struct font_freetype_glyph * glyph,
+ unsigned char *data, int depth, int stride, struct color *fg, struct color *tr);
+ int (*get_glyph) (struct font_freetype_glyph * glyph,
+ unsigned char *data, int depth, int stride,
+ struct color * fg, struct color * bg, struct color *tr);
+};
+
+struct font_freetype_glyph {
+ int x, y, w, h, dx, dy;
+ unsigned char *pixmap;
+};
+
+struct font_freetype_text {
+ int x1, y1;
+ int x2, y2;
+ int x3, y3;
+ int x4, y4;
+ int glyph_count;
+ struct font_freetype_glyph *glyph[0];
+};
diff --git a/fonts/LiberationMono-Bold.ttf b/fonts/LiberationMono-Bold.ttf
new file mode 100644
index 00000000..95de7530
--- /dev/null
+++ b/fonts/LiberationMono-Bold.ttf
Binary files differ
diff --git a/fonts/LiberationMono-BoldItalic.ttf b/fonts/LiberationMono-BoldItalic.ttf
new file mode 100644
index 00000000..11ec3e77
--- /dev/null
+++ b/fonts/LiberationMono-BoldItalic.ttf
Binary files differ
diff --git a/fonts/LiberationMono-Italic.ttf b/fonts/LiberationMono-Italic.ttf
new file mode 100644
index 00000000..08f55d63
--- /dev/null
+++ b/fonts/LiberationMono-Italic.ttf
Binary files differ
diff --git a/fonts/LiberationMono-Regular.ttf b/fonts/LiberationMono-Regular.ttf
new file mode 100644
index 00000000..e3024a09
--- /dev/null
+++ b/fonts/LiberationMono-Regular.ttf
Binary files differ
diff --git a/fonts/LiberationSans-Bold.ttf b/fonts/LiberationSans-Bold.ttf
new file mode 100644
index 00000000..53200d95
--- /dev/null
+++ b/fonts/LiberationSans-Bold.ttf
Binary files differ
diff --git a/fonts/LiberationSans-BoldItalic.ttf b/fonts/LiberationSans-BoldItalic.ttf
new file mode 100644
index 00000000..d06deca6
--- /dev/null
+++ b/fonts/LiberationSans-BoldItalic.ttf
Binary files differ
diff --git a/fonts/LiberationSans-Italic.ttf b/fonts/LiberationSans-Italic.ttf
new file mode 100644
index 00000000..07275adf
--- /dev/null
+++ b/fonts/LiberationSans-Italic.ttf
Binary files differ
diff --git a/fonts/LiberationSans-Regular.ttf b/fonts/LiberationSans-Regular.ttf
new file mode 100644
index 00000000..09fac2ff
--- /dev/null
+++ b/fonts/LiberationSans-Regular.ttf
Binary files differ
diff --git a/fonts/LiberationSerif-Bold.ttf b/fonts/LiberationSerif-Bold.ttf
new file mode 100644
index 00000000..3a4ab92a
--- /dev/null
+++ b/fonts/LiberationSerif-Bold.ttf
Binary files differ
diff --git a/fonts/LiberationSerif-BoldItalic.ttf b/fonts/LiberationSerif-BoldItalic.ttf
new file mode 100644
index 00000000..dc75de89
--- /dev/null
+++ b/fonts/LiberationSerif-BoldItalic.ttf
Binary files differ
diff --git a/fonts/LiberationSerif-Italic.ttf b/fonts/LiberationSerif-Italic.ttf
new file mode 100644
index 00000000..d92b5e39
--- /dev/null
+++ b/fonts/LiberationSerif-Italic.ttf
Binary files differ
diff --git a/fonts/LiberationSerif-Regular.ttf b/fonts/LiberationSerif-Regular.ttf
new file mode 100644
index 00000000..d100691a
--- /dev/null
+++ b/fonts/LiberationSerif-Regular.ttf
Binary files differ
diff --git a/fonts/License.txt b/fonts/License.txt
new file mode 100644
index 00000000..f1787287
--- /dev/null
+++ b/fonts/License.txt
@@ -0,0 +1,19 @@
+LICENSE AGREEMENT AND LIMITED PRODUCT WARRANTY
+LIBERATION FONT SOFTWARE
+
+This agreement governs the use of the Software and any updates to the Software, regardless of the delivery mechanism. Subject to the following terms, Red Hat, Inc. ("Red Hat") grants to the user ("Client") a license to this work pursuant to the GNU General Public License v.2 with the exceptions set forth below and such other terms as are set forth in this End User License Agreement.
+
+ 1. The Software and License Exception. LIBERATION font software (the "Software") consists of TrueType-OpenType formatted font software for rendering LIBERATION typefaces in sans-serif, serif, and monospaced character styles. You are licensed to use, modify, copy, and distribute the Software pursuant to the GNU General Public License v.2 with the following exceptions:
+
+ (a) As a special exception, if you create a document which uses this font, and embed this font or unaltered portions of this font into the document, this font does not by itself cause the resulting document to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the document might be covered by the GNU General Public License. If you modify this font, you may extend this exception to your version of the font, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.
+
+ (b) As a further exception, any distribution of the object code of the Software in a physical product must provide you the right to access and modify the source code for the Software and to reinstall that modified version of the Software in object code form on the same physical product on which you received it.
+
+ 2. Intellectual Property Rights. The Software and each of its components, including the source code, documentation, appearance, structure and organization are owned by Red Hat and others and are protected under copyright and other laws. Title to the Software and any component, or to any copy, modification, or merged portion shall remain with the aforementioned, subject to the applicable license. The "LIBERATION" trademark is a trademark of Red Hat, Inc. in the U.S. and other countries. This agreement does not permit Client to distribute modified versions of the Software using Red Hat's trademarks. If Client makes a redistribution of a modified version of the Software, then Client must modify the files names to remove any reference to the Red Hat trademarks and must not use the Red Hat trademarks in any way to reference or promote the modified Software.
+
+ 3. Limited Warranty. To the maximum extent permitted under applicable law, the Software is provided and licensed "as is" without warranty of any kind, expressed or implied, including the implied warranties of merchantability, non-infringement or fitness for a particular purpose. Red Hat does not warrant that the functions contained in the Software will meet Client's requirements or that the operation of the Software will be entirely error free or appear precisely as described in the accompanying documentation.
+
+ 4. Limitation of Remedies and Liability. To the maximum extent permitted by applicable law, Red Hat or any Red Hat authorized dealer will not be liable to Client for any incidental or consequential damages, including lost profits or lost savings arising out of the use or inability to use the Software, even if Red Hat or such dealer has been advised of the possibility of such damages.
+
+ 5. General. If any provision of this agreement is held to be unenforceable, that shall not affect the enforceability of the remaining provisions. This agreement shall be governed by the laws of the State of North Carolina and of the United States, without regard to any conflict of laws provisions, except that the United Nations Convention on the International Sale of Goods shall not apply.
+Copyright © 2007 Red Hat, Inc. All rights reserved. LIBERATION is a trademark of Red Hat, Inc.
diff --git a/fonts/Makefile.am b/fonts/Makefile.am
new file mode 100644
index 00000000..d8ea2633
--- /dev/null
+++ b/fonts/Makefile.am
@@ -0,0 +1,15 @@
+include $(top_srcdir)/Makefile.inc
+
+fonts_DATA =
+fonts_DATA += LiberationMono-Bold.ttf
+fonts_DATA += LiberationMono-BoldItalic.ttf
+fonts_DATA += LiberationMono-Italic.ttf
+fonts_DATA += LiberationMono-Regular.ttf
+fonts_DATA += LiberationSans-Bold.ttf
+fonts_DATA += LiberationSans-BoldItalic.ttf
+fonts_DATA += LiberationSans-Italic.ttf
+fonts_DATA += LiberationSans-Regular.ttf
+fonts_DATA += LiberationSerif-Bold.ttf
+fonts_DATA += LiberationSerif-BoldItalic.ttf
+fonts_DATA += LiberationSerif-Italic.ttf
+fonts_DATA += LiberationSerif-Regular.ttf
diff --git a/fonts/README b/fonts/README
new file mode 100644
index 00000000..51a5329c
--- /dev/null
+++ b/fonts/README
@@ -0,0 +1,68 @@
+1. What's this?
+===============
+
+The Liberation Fonts are intended to be open font replacements for the three
+most commonly used fonts on Microsoft systems: Times New Roman, Arial, and
+Courier New.
+
+
+2. Requirements
+===============
+
+ * fontforge.
+ - http://fontforge.sourceforge.net
+
+
+3. Install
+==========
+
+3.1 Decompress tarball
+
+ You can extract the files by following command:
+
+ $ tar zxvf liberation-fonts-[VERSION].tar.gz
+
+3.2 Build from the source
+
+ Change into directory liberation-fonts-[VERSION]/ and build from sources by
+ following commands:
+
+ $ cd liberation-fonts-[VERSION]
+ $ make
+
+ The built font files will be available in 'build' directory.
+
+3.3 Install to system
+
+ You can manually install the fonts by copying them to ~/.fonts for a
+ particular user, or to /usr/share/fonts/truetype/liberation for system-wide
+ availability
+
+
+4. Usage
+========
+
+The fonts should be installed and detected by the system after installation.
+
+
+5. License
+==========
+
+Read the GPL v2 file 'COPYING' and the Liberation Fonts EULA file 'License.txt'
+for more information.
+
+6. Credits
+==========
+
+Special thanks to all liberation-fonts developers and users!
+
+ * Caius Chance <cchance at redhat.com>
+ - Current project maintainer.
+
+ * Mark Webbink <mwebbink at redhat.com>
+ - Coordinator.
+
+ * Steve Matteson
+ - Ascender Corporation <http://www.ascendercorp.com>
+
+ * And, all other contributors.
diff --git a/graphics.c b/graphics.c
new file mode 100644
index 00000000..ecb199a4
--- /dev/null
+++ b/graphics.c
@@ -0,0 +1,2160 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+//##############################################################################################################
+//#
+//# File: graphics.c
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//#
+//##############################################################################################################
+
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "debug.h"
+#include "string.h"
+#include "draw_info.h"
+#include "point.h"
+#include "graphics.h"
+#include "projection.h"
+#include "item.h"
+#include "map.h"
+#include "coord.h"
+#include "transform.h"
+#include "plugin.h"
+#include "profile.h"
+#include "mapset.h"
+#include "layout.h"
+#include "route.h"
+#include "util.h"
+#include "callback.h"
+#include "file.h"
+#include "event.h"
+
+static char *navit_sharedir;
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+struct graphics
+{
+ struct graphics_priv *priv;
+ struct graphics_methods meth;
+ char *default_font;
+ int font_len;
+ struct graphics_font **font;
+ struct graphics_gc *gc[3];
+ struct attr **attrs;
+ struct callback_list *cbl;
+ struct point_rect r;
+ GList *selection;
+};
+
+struct display_context
+{
+ struct graphics *gra;
+ struct element *e;
+ struct graphics_gc *gc;
+ struct graphics_image *img;
+ enum projection pro;
+ struct transformation *trans;
+};
+
+struct displaylist {
+ GHashTable *dl;
+ int busy;
+ int workload;
+ struct callback *cb;
+ struct layout *layout;
+ struct display_context dc;
+ int order;
+ struct mapset *ms;
+ struct mapset_handle *msh;
+ struct map *m;
+ int conv;
+ struct map_selection *sel;
+ struct map_rect *mr;
+ struct callback *idle_cb;
+ struct event_idle *idle_ev;
+};
+
+
+static void draw_circle(struct point *pnt, int diameter, int scale, int start, int len, struct point *res, int *pos, int dir);
+static void graphics_process_selection(struct graphics *gra, struct displaylist *dl);
+
+void
+graphics_set_rect(struct graphics *gra, struct point_rect *pr)
+{
+ gra->r=*pr;
+}
+
+/**
+ * Creates a new graphics object
+ * attr type required
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+struct graphics * graphics_new(struct attr *parent, struct attr **attrs)
+{
+ struct graphics *this_;
+ struct attr *type_attr;
+ struct graphics_priv * (*graphicstype_new)(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl);
+
+ if (! (type_attr=attr_search(attrs, NULL, attr_type))) {
+ return NULL;
+ }
+
+ graphicstype_new=plugin_get_graphics_type(type_attr->u.str);
+ if (! graphicstype_new)
+ return NULL;
+ this_=g_new0(struct graphics, 1);
+ this_->cbl=callback_list_new();
+ this_->priv=(*graphicstype_new)(parent->u.navit, &this_->meth, attrs, this_->cbl);
+ this_->attrs=attr_list_dup(attrs);
+ return this_;
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+int graphics_get_attr(struct graphics *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
+{
+ return attr_generic_get_attr(this_->attrs, NULL, type, attr, iter);
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+struct graphics * graphics_overlay_new(struct graphics *parent, struct point *p, int w, int h, int alpha, int wraparound)
+{
+ struct graphics *this_;
+ if (!parent->meth.overlay_new)
+ return NULL;
+ this_=g_new0(struct graphics, 1);
+ this_->priv=parent->meth.overlay_new(parent->priv, &this_->meth, p, w, h, alpha, wraparound);
+ if (!this_->priv) {
+ g_free(this_);
+ this_=NULL;
+ }
+ return this_;
+}
+
+/**
+ * @brief Alters the size, position, alpha and wraparound for an overlay
+ *
+ * @param this_ The overlay's graphics struct
+ * @param p The new position of the overlay
+ * @param w The new width of the overlay
+ * @param h The new height of the overlay
+ * @param alpha The new alpha of the overlay
+ * @param wraparound The new wraparound of the overlay
+ */
+void
+graphics_overlay_resize(struct graphics *this_, struct point *p, int w, int h, int alpha, int wraparound)
+{
+ if (! this_->meth.overlay_resize) {
+ return;
+ }
+
+ this_->meth.overlay_resize(this_->priv, p, w, h, alpha, wraparound);
+}
+
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void graphics_init(struct graphics *this_)
+{
+ this_->gc[0]=graphics_gc_new(this_);
+ graphics_gc_set_background(this_->gc[0], &(struct color) { 0xffff, 0xefef, 0xb7b7, 0xffff});
+ graphics_gc_set_foreground(this_->gc[0], &(struct color) { 0xffff, 0xefef, 0xb7b7, 0xffff });
+ this_->gc[1]=graphics_gc_new(this_);
+ graphics_gc_set_background(this_->gc[1], &(struct color) { 0x0000, 0x0000, 0x0000, 0xffff });
+ graphics_gc_set_foreground(this_->gc[1], &(struct color) { 0xffff, 0xffff, 0xffff, 0xffff });
+ this_->gc[2]=graphics_gc_new(this_);
+ graphics_gc_set_background(this_->gc[2], &(struct color) { 0xffff, 0xffff, 0xffff, 0xffff });
+ graphics_gc_set_foreground(this_->gc[2], &(struct color) { 0x0000, 0x0000, 0x0000, 0xffff });
+ graphics_background_gc(this_, this_->gc[0]);
+ navit_sharedir = getenv("NAVIT_SHAREDIR");
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void * graphics_get_data(struct graphics *this_, char *type)
+{
+ return (this_->meth.get_data(this_->priv, type));
+}
+
+void graphics_add_callback(struct graphics *this_, struct callback *cb)
+{
+ callback_list_add(this_->cbl, cb);
+}
+
+void graphics_remove_callback(struct graphics *this_, struct callback *cb)
+{
+ callback_list_remove(this_->cbl, cb);
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+struct graphics_font * graphics_font_new(struct graphics *gra, int size, int flags)
+{
+ struct graphics_font *this_;
+
+ this_=g_new0(struct graphics_font,1);
+ this_->priv=gra->meth.font_new(gra->priv, &this_->meth, gra->default_font, size, flags);
+ return this_;
+}
+
+/**
+ * Free all loaded fonts.
+ * Used when switching layouts.
+ * @param gra The graphics instance
+ * @returns nothing
+ * @author Sarah Nordstrom (05/2008)
+ */
+void graphics_font_destroy_all(struct graphics *gra)
+{
+ int i;
+ for(i = 0 ; i < gra->font_len; i++) {
+ if(!gra->font[i]) continue;
+ gra->font[i]->meth.font_destroy(gra->font[i]->priv);
+ gra->font[i] = NULL;
+ }
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+struct graphics_gc * graphics_gc_new(struct graphics *gra)
+{
+ struct graphics_gc *this_;
+
+ this_=g_new0(struct graphics_gc,1);
+ this_->priv=gra->meth.gc_new(gra->priv, &this_->meth);
+ return this_;
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void graphics_gc_destroy(struct graphics_gc *gc)
+{
+ gc->meth.gc_destroy(gc->priv);
+ g_free(gc);
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void graphics_gc_set_foreground(struct graphics_gc *gc, struct color *c)
+{
+ gc->meth.gc_set_foreground(gc->priv, c);
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void graphics_gc_set_background(struct graphics_gc *gc, struct color *c)
+{
+ gc->meth.gc_set_background(gc->priv, c);
+}
+
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void graphics_gc_set_stipple(struct graphics_gc *gc, struct graphics_image *img)
+{
+ gc->meth.gc_set_stipple(gc->priv, img ? img->priv : NULL);
+}
+
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void graphics_gc_set_linewidth(struct graphics_gc *gc, int width)
+{
+ gc->meth.gc_set_linewidth(gc->priv, width);
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void graphics_gc_set_dashes(struct graphics_gc *gc, int width, int offset, unsigned char dash_list[], int n)
+{
+ if (gc->meth.gc_set_dashes)
+ gc->meth.gc_set_dashes(gc->priv, width, offset, dash_list, n);
+}
+
+/**
+ * Create a new image from file path scaled to w and h pixels
+ * @param gra the graphics instance
+ * @param path path of the image to load
+ * @param w width to rescale to
+ * @param h height to rescale to
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+struct graphics_image * graphics_image_new_scaled(struct graphics *gra, char *path, int w, int h)
+{
+ struct graphics_image *this_;
+
+ this_=g_new0(struct graphics_image,1);
+ this_->height=h;
+ this_->width=w;
+ this_->priv=gra->meth.image_new(gra->priv, &this_->meth, path, &this_->width, &this_->height, &this_->hot, 0);
+ if (! this_->priv) {
+ g_free(this_);
+ this_=NULL;
+ }
+ return this_;
+}
+
+/**
+ * Create a new image from file path scaled to w and h pixels and possibly rotated
+ * @param gra the graphics instance
+ * @param path path of the image to load
+ * @param w width to rescale to
+ * @param h height to rescale to
+ * @param rotate angle to rotate the image. Warning, graphics might only support 90 degree steps here
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+struct graphics_image * graphics_image_new_scaled_rotated(struct graphics *gra, char *path, int w, int h, int rotate)
+{
+ struct graphics_image *this_;
+
+ this_=g_new0(struct graphics_image,1);
+ this_->height=h;
+ this_->width=w;
+ this_->priv=gra->meth.image_new(gra->priv, &this_->meth, path, &this_->width, &this_->height, &this_->hot, rotate);
+ if (! this_->priv) {
+ g_free(this_);
+ this_=NULL;
+ }
+ return this_;
+}
+
+/**
+ * Create a new image from file path
+ * @param gra the graphics instance
+ * @param path path of the image to load
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+struct graphics_image * graphics_image_new(struct graphics *gra, char *path)
+{
+ return graphics_image_new_scaled(gra, path, -1, -1);
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void graphics_image_free(struct graphics *gra, struct graphics_image *img)
+{
+ if (gra->meth.image_free)
+ gra->meth.image_free(gra->priv, img->priv);
+ g_free(img);
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void graphics_draw_restore(struct graphics *this_, struct point *p, int w, int h)
+{
+ this_->meth.draw_restore(this_->priv, p, w, h);
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void graphics_draw_mode(struct graphics *this_, enum draw_mode_num mode)
+{
+ this_->meth.draw_mode(this_->priv, mode);
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void graphics_draw_lines(struct graphics *this_, struct graphics_gc *gc, struct point *p, int count)
+{
+ this_->meth.draw_lines(this_->priv, gc->priv, p, count);
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void graphics_draw_circle(struct graphics *this_, struct graphics_gc *gc, struct point *p, int r)
+{
+ this_->meth.draw_circle(this_->priv, gc->priv, p, r);
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void graphics_draw_rectangle(struct graphics *this_, struct graphics_gc *gc, struct point *p, int w, int h)
+{
+ this_->meth.draw_rectangle(this_->priv, gc->priv, p, w, h);
+}
+
+void graphics_draw_rectangle_rounded(struct graphics *this_, struct graphics_gc *gc, struct point *plu, int w, int h, int r, int fill)
+{
+ struct point p[r*4+32];
+ struct point pi0={plu->x+r,plu->y+r};
+ struct point pi1={plu->x+w-r,plu->y+r};
+ struct point pi2={plu->x+w-r,plu->y+h-r};
+ struct point pi3={plu->x+r,plu->y+h-r};
+ int i=0;
+
+ draw_circle(&pi2, r*2, 0, -1, 258, p, &i, 1);
+ draw_circle(&pi1, r*2, 0, 255, 258, p, &i, 1);
+ draw_circle(&pi0, r*2, 0, 511, 258, p, &i, 1);
+ draw_circle(&pi3, r*2, 0, 767, 258, p, &i, 1);
+ p[i]=p[0];
+ i++;
+ if (fill)
+ this_->meth.draw_polygon(this_->priv, gc->priv, p, i);
+ else
+ this_->meth.draw_lines(this_->priv, gc->priv, p, i);
+}
+
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void graphics_draw_text(struct graphics *this_, struct graphics_gc *gc1, struct graphics_gc *gc2, struct graphics_font *font, char *text, struct point *p, int dx, int dy)
+{
+ this_->meth.draw_text(this_->priv, gc1->priv, gc2 ? gc2->priv : NULL, font->priv, text, p, dx, dy);
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void graphics_get_text_bbox(struct graphics *this_, struct graphics_font *font, char *text, int dx, int dy, struct point *ret, int estimate)
+{
+ this_->meth.get_text_bbox(this_->priv, font->priv, text, dx, dy, ret, estimate);
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void graphics_overlay_disable(struct graphics *this_, int disable)
+{
+ if (this_->meth.overlay_disable)
+ this_->meth.overlay_disable(this_->priv, disable);
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void graphics_draw_image(struct graphics *this_, struct graphics_gc *gc, struct point *p, struct graphics_image *img)
+{
+ this_->meth.draw_image(this_->priv, gc->priv, p, img->priv);
+}
+
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+int
+graphics_draw_drag(struct graphics *this_, struct point *p)
+{
+ if (!this_->meth.draw_drag)
+ return 0;
+ this_->meth.draw_drag(this_->priv, p);
+ return 1;
+}
+
+void
+graphics_background_gc(struct graphics *this_, struct graphics_gc *gc)
+{
+ this_->meth.background_gc(this_->priv, gc ? gc->priv : NULL);
+}
+
+#include "attr.h"
+#include "popup.h"
+#include <stdio.h>
+
+
+#if 0
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void popup_view_html(struct popup_item *item, char *file)
+{
+ char command[1024];
+ sprintf(command,"firefox %s", file);
+ system(command);
+}
+
+struct transformatin *tg;
+enum projection pg;
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void graphics_popup(struct display_list *list, struct popup_item **popup)
+{
+ struct item *item;
+ struct attr attr;
+ struct map_rect *mr;
+ struct coord c;
+ struct popup_item *curr_item,*last=NULL;
+ item=list->data;
+ mr=map_rect_new(item->map, NULL, NULL, 0);
+ printf("id hi=0x%x lo=0x%x\n", item->id_hi, item->id_lo);
+ item=map_rect_get_item_byid(mr, item->id_hi, item->id_lo);
+ if (item) {
+ if (item_attr_get(item, attr_name, &attr)) {
+ curr_item=popup_item_new_text(popup,attr.u.str,1);
+ if (item_attr_get(item, attr_info_html, &attr)) {
+ popup_item_new_func(&last,"HTML Info",1, popup_view_html, g_strdup(attr.u.str));
+ }
+ if (item_attr_get(item, attr_price_html, &attr)) {
+ popup_item_new_func(&last,"HTML Preis",2, popup_view_html, g_strdup(attr.u.str));
+ }
+ curr_item->submenu=last;
+ }
+ }
+ map_rect_destroy(mr);
+}
+#endif
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+struct displayitem {
+ struct item item;
+ char *label;
+ int displayed;
+ int count;
+ struct coord c[0];
+};
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+static int xdisplay_free_list(gpointer key, gpointer value, gpointer user_data)
+{
+ GHashTable *hash=value;
+ if (hash)
+ g_hash_table_destroy(hash);
+ return TRUE;
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+static void xdisplay_free(GHashTable *display_list)
+{
+ g_hash_table_foreach_remove(display_list, xdisplay_free_list, NULL);
+}
+
+static guint
+displayitem_hash(gconstpointer key)
+{
+ const struct displayitem *di=key;
+ return (di->item.id_hi^di->item.id_lo^((int) di->item.map));
+}
+
+static gboolean
+displayitem_equal(gconstpointer a, gconstpointer b)
+{
+ const struct displayitem *dia=a;
+ const struct displayitem *dib=b;
+ if (item_is_equal(dia->item, dib->item))
+ return TRUE;
+ return FALSE;
+}
+
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+static void display_add(struct displaylist *displaylist, struct item *item, int count, struct coord *c, char *label)
+{
+ struct displayitem *di;
+ int len;
+ GHashTable *h;
+ char *p;
+
+ len=sizeof(*di)+count*sizeof(*c);
+ if (label)
+ len+=strlen(label)+1;
+
+ p=g_malloc(len);
+
+ di=(struct displayitem *)p;
+ di->displayed=0;
+ p+=sizeof(*di)+count*sizeof(*c);
+ di->item=*item;
+ if (label) {
+ di->label=p;
+ strcpy(di->label, label);
+ } else
+ di->label=NULL;
+ di->count=count;
+ memcpy(di->c, c, count*sizeof(*c));
+
+ h=g_hash_table_lookup(displaylist->dl, GINT_TO_POINTER(item->type));
+ if (! h) {
+ h=g_hash_table_new_full(displayitem_hash, displayitem_equal, g_free, NULL);
+ g_hash_table_insert(displaylist->dl, GINT_TO_POINTER(item->type), h);
+ }
+ g_hash_table_replace(h, di, di);
+}
+
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+static void label_line(struct graphics *gra, struct graphics_gc *fg, struct graphics_gc *bg, struct graphics_font *font, struct point *p, int count, char *label)
+{
+ int i,x,y,tl,tlm,th,thm,tlsq,l;
+ float lsq;
+ double dx,dy;
+ struct point p_t;
+ struct point pb[5];
+
+ if (gra->meth.get_text_bbox) {
+ gra->meth.get_text_bbox(gra->priv, font->priv, label, 0x10000, 0x0, pb, 1);
+ tl=(pb[2].x-pb[0].x);
+ th=(pb[0].y-pb[1].y);
+ } else {
+ tl=strlen(label)*4;
+ th=8;
+ }
+ tlm=tl*32;
+ thm=th*36;
+ tlsq = tlm*tlm;
+ for (i = 0 ; i < count-1 ; i++) {
+ dx=p[i+1].x-p[i].x;
+ dx*=32;
+ dy=p[i+1].y-p[i].y;
+ dy*=32;
+ lsq = dx*dx+dy*dy;
+ if (lsq > tlsq) {
+ l=(int)sqrtf(lsq);
+ x=p[i].x;
+ y=p[i].y;
+ if (dx < 0) {
+ dx=-dx;
+ dy=-dy;
+ x=p[i+1].x;
+ y=p[i+1].y;
+ }
+ x+=(l-tlm)*dx/l/64;
+ y+=(l-tlm)*dy/l/64;
+ x-=dy*thm/l/64;
+ y+=dx*thm/l/64;
+ p_t.x=x;
+ p_t.y=y;
+#if 0
+ dbg(0,"display_text: '%s', %d, %d, %d, %d %d\n", label, x, y, dx*0x10000/l, dy*0x10000/l, l);
+#endif
+ if (x < gra->r.rl.x && x + tl > gra->r.lu.x && y + tl > gra->r.lu.y && y - tl < gra->r.rl.y)
+ gra->meth.draw_text(gra->priv, fg->priv, bg->priv, font->priv, label, &p_t, dx*0x10000/l, dy*0x10000/l);
+ }
+ }
+}
+
+static void display_draw_arrow(struct point *p, int dx, int dy, int l, struct graphics_gc *gc, struct graphics *gra)
+{
+ struct point pnt[3];
+ pnt[0]=pnt[1]=pnt[2]=*p;
+ pnt[0].x+=-dx*l/65536+dy*l/65536;
+ pnt[0].y+=-dy*l/65536-dx*l/65536;
+ pnt[2].x+=-dx*l/65536-dy*l/65536;
+ pnt[2].y+=-dy*l/65536+dx*l/65536;
+ gra->meth.draw_lines(gra->priv, gc->priv, pnt, 3);
+}
+
+static void display_draw_arrows(struct graphics *gra, struct graphics_gc *gc, struct point *pnt, int count)
+{
+ int i,dx,dy,l;
+ struct point p;
+ for (i = 0 ; i < count-1 ; i++) {
+ dx=pnt[i+1].x-pnt[i].x;
+ dy=pnt[i+1].y-pnt[i].y;
+ l=sqrt(dx*dx+dy*dy);
+ if (l) {
+ dx=dx*65536/l;
+ dy=dy*65536/l;
+ p=pnt[i];
+ p.x+=dx*15/65536;
+ p.y+=dy*15/65536;
+ display_draw_arrow(&p, dx, dy, 10, gc, gra);
+ p=pnt[i+1];
+ p.x-=dx*15/65536;
+ p.y-=dy*15/65536;
+ display_draw_arrow(&p, dx, dy, 10, gc, gra);
+ }
+ }
+}
+
+static int
+intersection(struct point * a1, int adx, int ady, struct point * b1, int bdx, int bdy,
+ struct point * res)
+{
+ int n, a, b;
+ n = bdy * adx - bdx * ady;
+ a = bdx * (a1->y - b1->y) - bdy * (a1->x - b1->x);
+ b = adx * (a1->y - b1->y) - ady * (a1->x - b1->x);
+ if (n < 0) {
+ n = -n;
+ a = -a;
+ b = -b;
+ }
+#if 0
+ if (a < 0 || b < 0)
+ return 0;
+ if (a > n || b > n)
+ return 0;
+#endif
+ if (n == 0)
+ return 0;
+ res->x = a1->x + a * adx / n;
+ res->y = a1->y + a * ady / n;
+ return 1;
+}
+
+struct circle {
+ short x,y,fowler;
+} circle64[]={
+{0,128,0},
+{13,127,13},
+{25,126,25},
+{37,122,38},
+{49,118,53},
+{60,113,67},
+{71,106,85},
+{81,99,104},
+{91,91,128},
+{99,81,152},
+{106,71,171},
+{113,60,189},
+{118,49,203},
+{122,37,218},
+{126,25,231},
+{127,13,243},
+{128,0,256},
+{127,-13,269},
+{126,-25,281},
+{122,-37,294},
+{118,-49,309},
+{113,-60,323},
+{106,-71,341},
+{99,-81,360},
+{91,-91,384},
+{81,-99,408},
+{71,-106,427},
+{60,-113,445},
+{49,-118,459},
+{37,-122,474},
+{25,-126,487},
+{13,-127,499},
+{0,-128,512},
+{-13,-127,525},
+{-25,-126,537},
+{-37,-122,550},
+{-49,-118,565},
+{-60,-113,579},
+{-71,-106,597},
+{-81,-99,616},
+{-91,-91,640},
+{-99,-81,664},
+{-106,-71,683},
+{-113,-60,701},
+{-118,-49,715},
+{-122,-37,730},
+{-126,-25,743},
+{-127,-13,755},
+{-128,0,768},
+{-127,13,781},
+{-126,25,793},
+{-122,37,806},
+{-118,49,821},
+{-113,60,835},
+{-106,71,853},
+{-99,81,872},
+{-91,91,896},
+{-81,99,920},
+{-71,106,939},
+{-60,113,957},
+{-49,118,971},
+{-37,122,986},
+{-25,126,999},
+{-13,127,1011},
+};
+
+static void
+draw_circle(struct point *pnt, int diameter, int scale, int start, int len, struct point *res, int *pos, int dir)
+{
+ struct circle *c;
+
+#if 0
+ dbg(0,"diameter=%d start=%d len=%d pos=%d dir=%d\n", diameter, start, len, *pos, dir);
+#endif
+ int count=64;
+ int end=start+len;
+ int i,step;
+ c=circle64;
+ if (diameter > 128)
+ step=1;
+ else if (diameter > 64)
+ step=2;
+ else if (diameter > 24)
+ step=4;
+ else if (diameter > 8)
+ step=8;
+ else
+ step=16;
+ if (len > 0) {
+ while (start < 0) {
+ start+=1024;
+ end+=1024;
+ }
+ while (end > 0) {
+ i=0;
+ while (i < count && c[i].fowler <= start)
+ i+=step;
+ while (i < count && c[i].fowler < end) {
+ res[*pos].x=pnt->x+((c[i].x*diameter+128)>>8);
+ res[*pos].y=pnt->y+((c[i].y*diameter+128)>>8);
+ (*pos)+=dir;
+ i+=step;
+ }
+ end-=1024;
+ start-=1024;
+ }
+ } else {
+ while (start > 1024) {
+ start-=1024;
+ end-=1024;
+ }
+ while (end < 1024) {
+ i=count-1;
+ while (i >= 0 && c[i].fowler >= start)
+ i-=step;
+ while (i >= 0 && c[i].fowler > end) {
+ res[*pos].x=pnt->x+((c[i].x*diameter+128)>>8);
+ res[*pos].y=pnt->y+((c[i].y*diameter+128)>>8);
+ (*pos)+=dir;
+ i-=step;
+ }
+ start+=1024;
+ end+=1024;
+ }
+ }
+}
+
+
+static int
+fowler(int dy, int dx)
+{
+ int adx, ady; /* Absolute Values of Dx and Dy */
+ int code; /* Angular Region Classification Code */
+
+ adx = (dx < 0) ? -dx : dx; /* Compute the absolute values. */
+ ady = (dy < 0) ? -dy : dy;
+
+ code = (adx < ady) ? 1 : 0;
+ if (dx < 0)
+ code += 2;
+ if (dy < 0)
+ code += 4;
+
+ switch (code) {
+ case 0:
+ return (dx == 0) ? 0 : 128*ady / adx; /* [ 0, 45] */
+ case 1:
+ return (256 - (128*adx / ady)); /* ( 45, 90] */
+ case 3:
+ return (256 + (128*adx / ady)); /* ( 90,135) */
+ case 2:
+ return (512 - (128*ady / adx)); /* [135,180] */
+ case 6:
+ return (512 + (128*ady / adx)); /* (180,225] */
+ case 7:
+ return (768 - (128*adx / ady)); /* (225,270) */
+ case 5:
+ return (768 + (128*adx / ady)); /* [270,315) */
+ case 4:
+ return (1024 - (128*ady / adx));/* [315,360) */
+ }
+ return 0;
+}
+static int
+int_sqrt(unsigned int n)
+{
+ unsigned int h, p= 0, q= 1, r= n;
+ while ( q <= n )
+ q <<= 2;
+ while ( q != 1 ) {
+ q >>= 2;
+ h = p + q;
+ p >>= 1;
+ if ( r >= h ) {
+ p += q;
+ r -= h;
+ }
+ }
+ return p;
+}
+
+struct offset {
+ int px,py,nx,ny;
+};
+
+static void
+calc_offsets(int wi, int l, int dx, int dy, struct offset *res)
+{
+ int x,y;
+
+ x = (dx * wi) / l;
+ y = (dy * wi) / l;
+ if (x < 0) {
+ res->nx = -x/2;
+ res->px = (x-1)/2;
+ } else {
+ res->nx = -(x+1)/2;
+ res->px = x/2;
+ }
+ if (y < 0) {
+ res->ny = -y/2;
+ res->py = (y-1)/2;
+ } else {
+ res->ny = -(y+1)/2;
+ res->py = y/2;
+ }
+}
+
+static void
+graphics_draw_polyline_as_polygon(struct graphics *gra, struct graphics_gc *gc, struct point *pnt, int count, int *width, int step)
+{
+ int maxpoints=200;
+ struct point res[maxpoints], pos, poso, neg, nego;
+ int i, dx=0, dy=0, l=0, dxo=0, dyo=0;
+ struct offset o,oo;
+ int fow=0, fowo=0, delta;
+ int wi, ppos = maxpoints/2, npos = maxpoints/2;
+ int state,prec=5;
+ int max_circle_points=20;
+ int lscale=16;
+ i=0;
+ for (;;) {
+ wi=*width;
+ width+=step;
+ if (i < count - 1) {
+ dx = (pnt[i + 1].x - pnt[i].x);
+ dy = (pnt[i + 1].y - pnt[i].y);
+ l = int_sqrt(dx * dx * lscale * lscale + dy * dy * lscale * lscale);
+ fow=fowler(-dy, dx);
+ }
+ if (! l)
+ l=1;
+ dbg_assert(wi*lscale < 10000);
+ calc_offsets(wi*lscale, l, dx, dy, &o);
+ pos.x = pnt[i].x + o.ny;
+ pos.y = pnt[i].y + o.px;
+ neg.x = pnt[i].x + o.py;
+ neg.y = pnt[i].y + o.nx;
+ if (! i)
+ state=0;
+ else if (i == count-1)
+ state=2;
+ else if (npos < max_circle_points || ppos >= maxpoints-max_circle_points)
+ state=3;
+ else
+ state=1;
+ switch (state) {
+ case 1:
+ if (fowo != fow) {
+ poso.x = pnt[i].x + oo.ny;
+ poso.y = pnt[i].y + oo.px;
+ nego.x = pnt[i].x + oo.py;
+ nego.y = pnt[i].y + oo.nx;
+ delta=fowo-fow;
+ if (delta < 0)
+ delta+=1024;
+ if (delta < 512) {
+ if (intersection(&pos, dx, dy, &poso, dxo, dyo, &res[ppos]))
+ ppos++;
+ res[--npos] = nego;
+ --npos;
+ draw_circle(&pnt[i], wi, prec, fowo-512, -delta, res, &npos, -1);
+ res[npos] = neg;
+ } else {
+ res[ppos++] = poso;
+ draw_circle(&pnt[i], wi, prec, fowo, 1024-delta, res, &ppos, 1);
+ res[ppos++] = pos;
+ if (intersection(&neg, dx, dy, &nego, dxo, dyo, &res[npos - 1]))
+ npos--;
+ }
+ }
+ break;
+ case 2:
+ case 3:
+ res[--npos] = neg;
+ --npos;
+ draw_circle(&pnt[i], wi, prec, fow-512, -512, res, &npos, -1);
+ res[npos] = pos;
+ res[ppos++] = pos;
+ dbg_assert(npos > 0);
+ dbg_assert(ppos < maxpoints);
+ gra->meth.draw_polygon(gra->priv, gc->priv, res+npos, ppos-npos);
+ if (state == 2)
+ break;
+ npos=maxpoints/2;
+ ppos=maxpoints/2;
+ case 0:
+ res[ppos++] = neg;
+ draw_circle(&pnt[i], wi, prec, fow+512, 512, res, &ppos, 1);
+ res[ppos++] = pos;
+ break;
+ }
+ i++;
+ if (i >= count)
+ break;
+ if (step) {
+ wi=*width;
+ calc_offsets(wi*lscale, l, dx, dy, &oo);
+ } else
+ oo=o;
+ dxo = -dx;
+ dyo = -dy;
+ fowo=fow;
+ }
+}
+
+
+struct wpoint {
+ int x,y,w;
+};
+
+static int
+clipcode(struct wpoint *p, struct point_rect *r)
+{
+ int code=0;
+ if (p->x < r->lu.x)
+ code=1;
+ if (p->x > r->rl.x)
+ code=2;
+ if (p->y < r->lu.y)
+ code |=4;
+ if (p->y > r->rl.y)
+ code |=8;
+ return code;
+}
+
+
+static int
+clip_line(struct wpoint *p1, struct wpoint *p2, struct point_rect *r)
+{
+ int code1,code2,ret=1;
+ int dx,dy,dw;
+ code1=clipcode(p1, r);
+ if (code1)
+ ret |= 2;
+ code2=clipcode(p2, r);
+ if (code2)
+ ret |= 4;
+ dx=p2->x-p1->x;
+ dy=p2->y-p1->y;
+ dw=p2->w-p1->w;
+ while (code1 || code2) {
+ if (code1 & code2)
+ return 0;
+ if (code1 & 1) {
+ p1->y+=(r->lu.x-p1->x)*dy/dx;
+ p1->w+=(r->lu.x-p1->x)*dw/dx;
+ p1->x=r->lu.x;
+ } else if (code1 & 2) {
+ p1->y+=(r->rl.x-p1->x)*dy/dx;
+ p1->w+=(r->rl.x-p1->x)*dw/dx;
+ p1->x=r->rl.x;
+ } else if (code1 & 4) {
+ p1->x+=(r->lu.y-p1->y)*dx/dy;
+ p1->w+=(r->lu.y-p1->y)*dw/dy;
+ p1->y=r->lu.y;
+ } else if (code1 & 8) {
+ p1->x+=(r->rl.y-p1->y)*dx/dy;
+ p1->w+=(r->rl.y-p1->y)*dw/dy;
+ p1->y=r->rl.y;
+ }
+ code1=clipcode(p1, r);
+ if (code1 & code2)
+ return 0;
+ if (code2 & 1) {
+ p2->y+=(r->lu.x-p2->x)*dy/dx;
+ p2->w+=(r->lu.x-p2->x)*dw/dx;
+ p2->x=r->lu.x;
+ } else if (code2 & 2) {
+ p2->y+=(r->rl.x-p2->x)*dy/dx;
+ p2->w+=(r->rl.x-p2->x)*dw/dx;
+ p2->x=r->rl.x;
+ } else if (code2 & 4) {
+ p2->x+=(r->lu.y-p2->y)*dx/dy;
+ p2->w+=(r->lu.y-p2->y)*dw/dy;
+ p2->y=r->lu.y;
+ } else if (code2 & 8) {
+ p2->x+=(r->rl.y-p2->y)*dx/dy;
+ p2->w+=(r->rl.y-p2->y)*dw/dy;
+ p2->y=r->rl.y;
+ }
+ code2=clipcode(p2, r);
+ }
+ return ret;
+}
+
+static void
+graphics_draw_polyline_clipped(struct graphics *gra, struct graphics_gc *gc, struct point *pa, int count, int *width, int step, int poly)
+{
+ struct point p[count+1];
+ int w[count*step+1];
+ struct wpoint p1,p2;
+ int i,code,out=0;
+ int wmax;
+ struct point_rect r=gra->r;
+
+ wmax=width[0];
+ if (step) {
+ for (i = 1 ; i < count ; i++) {
+ if (width[i*step] > wmax)
+ wmax=width[i*step];
+ }
+ }
+ if (wmax <= 0)
+ return;
+ r.lu.x-=wmax;
+ r.lu.y-=wmax;
+ r.rl.x+=wmax;
+ r.rl.y+=wmax;
+ for (i = 0 ; i < count ; i++) {
+ if (i) {
+ p1.x=pa[i-1].x;
+ p1.y=pa[i-1].y;
+ p1.w=width[(i-1)*step];
+ p2.x=pa[i].x;
+ p2.y=pa[i].y;
+ p2.w=width[i*step];
+ /* 0 = invisible, 1 = completely visible, 3 = start point clipped, 5 = end point clipped, 7 both points clipped */
+ code=clip_line(&p1, &p2, &r);
+ if (((code == 1 || code == 5) && i == 1) || (code & 2)) {
+ p[out].x=p1.x;
+ p[out].y=p1.y;
+ w[out*step]=p1.w;
+ out++;
+ }
+ if (code) {
+ p[out].x=p2.x;
+ p[out].y=p2.y;
+ w[out*step]=p2.w;
+ out++;
+ }
+ if (i == count-1 || (code & 4)) {
+ if (out > 1) {
+ if (poly) {
+ graphics_draw_polyline_as_polygon(gra, gc, p, out, w, step);
+ } else
+ gra->meth.draw_lines(gra->priv, gc->priv, p, out);
+ out=0;
+ }
+ }
+ }
+ }
+}
+
+static int
+is_inside(struct point *p, struct point_rect *r, int edge)
+{
+ switch(edge) {
+ case 0:
+ return p->x >= r->lu.x;
+ case 1:
+ return p->x <= r->rl.x;
+ case 2:
+ return p->y >= r->lu.y;
+ case 3:
+ return p->y <= r->rl.y;
+ default:
+ return 0;
+ }
+}
+
+static void
+poly_intersection(struct point *p1, struct point *p2, struct point_rect *r, int edge, struct point *ret)
+{
+ int dx=p2->x-p1->x;
+ int dy=p2->y-p1->y;
+ switch(edge) {
+ case 0:
+ ret->y=p1->y+(r->lu.x-p1->x)*dy/dx;
+ ret->x=r->lu.x;
+ break;
+ case 1:
+ ret->y=p1->y+(r->rl.x-p1->x)*dy/dx;
+ ret->x=r->rl.x;
+ break;
+ case 2:
+ ret->x=p1->x+(r->lu.y-p1->y)*dx/dy;
+ ret->y=r->lu.y;
+ break;
+ case 3:
+ ret->x=p1->x+(r->rl.y-p1->y)*dx/dy;
+ ret->y=r->rl.y;
+ break;
+ }
+}
+
+static void
+graphics_draw_polygon_clipped(struct graphics *gra, struct graphics_gc *gc, struct point *pin, int count_in)
+{
+ struct point_rect r=gra->r;
+ struct point *pout,*p,*s,pi;
+ struct point p1[count_in*8+1];
+ struct point p2[count_in*8+1];
+ int count_out,edge=3;
+ int i;
+#if 0
+ r.lu.x+=20;
+ r.lu.y+=20;
+ r.rl.x-=20;
+ r.rl.y-=20;
+#endif
+
+ pout=p1;
+ for (edge = 0 ; edge < 4 ; edge++) {
+ p=pin;
+ s=pin+count_in-1;
+ count_out=0;
+ for (i = 0 ; i < count_in ; i++) {
+ if (is_inside(p, &r, edge)) {
+ if (! is_inside(s, &r, edge)) {
+ poly_intersection(s,p,&r,edge,&pi);
+ pout[count_out++]=pi;
+ }
+ pout[count_out++]=*p;
+ } else {
+ if (is_inside(s, &r, edge)) {
+ poly_intersection(p,s,&r,edge,&pi);
+ pout[count_out++]=pi;
+ }
+ }
+ s=p;
+ p++;
+ }
+ count_in=count_out;
+ if (pin == p1) {
+ pin=p2;
+ pout=p1;
+ } else {
+ pin=p1;
+ pout=p2;
+ }
+ }
+ gra->meth.draw_polygon(gra->priv, gc->priv, pin, count_in);
+}
+
+
+static void
+display_context_free(struct display_context *dc)
+{
+ if (dc->gc)
+ graphics_gc_destroy(dc->gc);
+ if (dc->img)
+ graphics_image_free(dc->gra, dc->img);
+ dc->gc=NULL;
+ dc->img=NULL;
+}
+
+static struct graphics_font *
+get_font(struct graphics *gra, int size)
+{
+ if (size > 64)
+ size=64;
+ if (size >= gra->font_len) {
+ gra->font=g_renew(struct graphics_font *, gra->font, size+1);
+ while (gra->font_len <= size)
+ gra->font[gra->font_len++]=NULL;
+ }
+ if (! gra->font[size])
+ gra->font[size]=graphics_font_new(gra, size*20, 0);
+ return gra->font[size];
+}
+
+
+static void
+displayitem_draw(struct displayitem *di, void *dummy, struct display_context *dc)
+{
+ int width[16384];
+ int i,count;
+ struct point pa[16384];
+ struct graphics *gra=dc->gra;
+ struct graphics_gc *gc=dc->gc;
+ struct element *e=dc->e;
+ struct graphics_image *img=dc->img;
+ struct point p;
+ char path[PATH_MAX];
+
+ di->displayed=1;
+ if (! gc) {
+ gc=graphics_gc_new(gra);
+ gc->meth.gc_set_foreground(gc->priv, &e->color);
+ dc->gc=gc;
+ }
+ if (dc->e->type == element_polyline) {
+ count=transform(dc->trans, dc->pro, di->c, pa, di->count, 1, e->u.polyline.width, width);
+ }
+ else
+ count=transform(dc->trans, dc->pro, di->c, pa, di->count, 1, 0, NULL);
+ switch (e->type) {
+ case element_polygon:
+#if 0
+ {
+ int i;
+ for (i = 0 ; i < count ; i++) {
+ dbg(0,"pa[%d]=%d,%d\n", i, pa[i].x, pa[i].y);
+ }
+ }
+ dbg(0,"element_polygon count=%d\n",count);
+#endif
+#if 1
+ graphics_draw_polygon_clipped(gra, gc, pa, count);
+#endif
+ break;
+ case element_polyline:
+#if 0
+ if (e->u.polyline.width > 1) {
+ graphics_draw_polyline_as_polygon(gra, gc, pa, count, width, 0);
+ } else {
+#else
+ {
+#if 0
+ if (e->u.polyline.width > 1)
+ gc->meth.gc_set_linewidth(gc->priv, e->u.polyline.width);
+#else
+ gc->meth.gc_set_linewidth(gc->priv, 1);
+#endif
+
+
+#endif
+ if (e->u.polyline.width > 0 && e->u.polyline.dash_num > 0)
+ graphics_gc_set_dashes(gc, e->u.polyline.width,
+ e->u.polyline.offset,
+ e->u.polyline.dash_table,
+ e->u.polyline.dash_num);
+#if 0
+ if (di->label && !strcmp(di->label, "Bahnhofstr.") && di->item.type != type_street_1_city) {
+ dbg(0,"0x%x,0x%x %s\n", di->item.id_hi, di->item.id_lo, item_to_name(di->item.type));
+#endif
+ for (i = 0 ; i < count ; i++) {
+ if (width[i] < 2)
+ width[i]=2;
+ }
+ graphics_draw_polyline_clipped(gra, gc, pa, count, width, 1, e->u.polyline.width > 1);
+#if 0
+ }
+#endif
+ }
+ break;
+ case element_circle:
+ if (count) {
+ if (e->u.circle.width > 1)
+ gc->meth.gc_set_linewidth(gc->priv, e->u.polyline.width);
+ gra->meth.draw_circle(gra->priv, gc->priv, pa, e->u.circle.radius);
+ if (di->label && e->text_size) {
+ struct graphics_font *font=get_font(gra, e->text_size);
+ p.x=pa[0].x+3;
+ p.y=pa[0].y+10;
+ if (font)
+ gra->meth.draw_text(gra->priv, gra->gc[2]->priv, gra->gc[1]->priv, font->priv, di->label, &p, 0x10000, 0);
+ else
+ dbg(0,"Failed to get font with size %d\n",e->text_size);
+ }
+ }
+ break;
+ case element_text:
+ if (count && di->label) {
+ struct graphics_font *font=get_font(gra, e->text_size);
+ if (font)
+ label_line(gra, gra->gc[2], gra->gc[1], font, pa, count, di->label);
+ else
+ dbg(0,"Failed to get font with size %d\n",e->text_size);
+ }
+ break;
+ case element_icon:
+ if (count) {
+ if (!img) {
+ if (e->u.icon.src[0] == '/')
+ strcpy(path,e->u.icon.src);
+ else
+ sprintf(path,"%s/xpm/%s", navit_sharedir, e->u.icon.src);
+ img=graphics_image_new_scaled_rotated(gra, path, e->u.icon.width, e->u.icon.height, e->u.icon.rotation);
+ if (img)
+ dc->img=img;
+ else
+ dbg(0,"failed to load icon '%s'\n", e->u.icon.src);
+ }
+ if (img) {
+ p.x=pa[0].x - img->hot.x;
+ p.y=pa[0].y - img->hot.y;
+ gra->meth.draw_image(gra->priv, gra->gc[0]->priv, &p, img->priv);
+ }
+ }
+ break;
+ case element_image:
+ dbg(1,"image: '%s'\n", di->label);
+ if (gra->meth.draw_image_warp)
+ gra->meth.draw_image_warp(gra->priv, gra->gc[0]->priv, pa, count, di->label);
+ else
+ dbg(0,"draw_image_warp not supported by graphics driver drawing '%s'\n", di->label);
+ break;
+ case element_arrows:
+ display_draw_arrows(gra,gc,pa,count);
+ break;
+ default:
+ printf("Unhandled element type %d\n", e->type);
+
+ }
+}
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+static void xdisplay_draw_elements(struct graphics *gra, struct displaylist *display_list, struct itemgra *itm)
+{
+ struct element *e;
+ GList *es,*types;
+ GHashTable *h;
+ enum item_type type;
+
+ es=itm->elements;
+ while (es) {
+ e=es->data;
+ display_list->dc.e=e;
+ types=itm->type;
+ while (types) {
+ type=GPOINTER_TO_INT(types->data);
+ h=g_hash_table_lookup(display_list->dl, GINT_TO_POINTER(type));
+ if (h) {
+ g_hash_table_foreach(h, (GHFunc)displayitem_draw, &display_list->dc);
+ display_context_free(&display_list->dc);
+ }
+ types=g_list_next(types);
+ }
+ es=g_list_next(es);
+ }
+}
+
+void
+graphics_draw_itemgra(struct graphics *gra, struct itemgra *itm, struct transformation *t)
+{
+ GList *es;
+ struct point p;
+ struct coord c;
+#if 0
+ char *label=NULL;
+#endif
+ struct graphics_gc *gc = NULL;
+ struct graphics_image *img;
+ char path[PATH_MAX];
+ es=itm->elements;
+ c.x=0;
+ c.y=0;
+ while (es) {
+ struct element *e=es->data;
+ int count=e->coord_count;
+ struct point pnt[count+1];
+ if (count)
+ transform(t, projection_screen, e->coord, pnt, count, 0, 0, NULL);
+ else {
+ transform(t, projection_screen, &c, pnt, 1, 0, 0, NULL);
+ count=1;
+ }
+ gc=graphics_gc_new(gra);
+ gc->meth.gc_set_foreground(gc->priv, &e->color);
+ switch (e->type) {
+ case element_polyline:
+ if (e->u.polyline.width > 1)
+ gc->meth.gc_set_linewidth(gc->priv, e->u.polyline.width);
+ if (e->u.polyline.width > 0 && e->u.polyline.dash_num > 0)
+ graphics_gc_set_dashes(gc, e->u.polyline.width,
+ e->u.polyline.offset,
+ e->u.polyline.dash_table,
+ e->u.polyline.dash_num);
+ gra->meth.draw_lines(gra->priv, gc->priv, pnt, count);
+ break;
+ case element_polygon:
+ gra->meth.draw_polygon(gra->priv, gc->priv, pnt, count);
+ break;
+ case element_circle:
+ if (e->u.circle.width > 1)
+ gc->meth.gc_set_linewidth(gc->priv, e->u.polyline.width);
+ gra->meth.draw_circle(gra->priv, gc->priv, &pnt[0], e->u.circle.radius);
+ #if 0
+ // Leftover code, displayitem_draw is intended to be merged with with graphics_draw_itemgra
+ if (label && e->text_size) {
+ struct graphics_font *font=get_font(gra, e->text_size);
+ p.x=pnt[0].x+3;
+ p.y=pnt[0].y+10;
+ if (font)
+ gra->meth.draw_text(gra->priv, gra->gc[2]->priv, gra->gc[1]->priv, font->priv, label, &p, 0x10000, 0);
+ else
+ dbg(0,"Failed to get font with size %d\n",e->text_size);
+ }
+ # endif
+ break;
+ case element_icon:
+ if (e->u.icon.src[0] == '/')
+ strcpy(path,e->u.icon.src);
+ else
+ sprintf(path,"%s/xpm/%s", navit_sharedir, e->u.icon.src);
+ img=graphics_image_new_scaled_rotated(gra, path, e->u.icon.width, e->u.icon.height, e->u.icon.rotation);
+ if (! img)
+ dbg(0,"failed to load icon '%s'\n", e->u.icon.src);
+ else {
+ p.x=pnt[0].x - img->hot.x;
+ p.y=pnt[0].y - img->hot.y;
+ gra->meth.draw_image(gra->priv, gc->priv, &p, img->priv);
+ graphics_image_free(gra, img);
+ }
+ break;
+ default:
+ dbg(0,"dont know how to draw %d\n", e->type);
+ }
+ graphics_gc_destroy(gc);
+ es=g_list_next(es);
+ }
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+static void xdisplay_draw_layer(struct displaylist *display_list, struct graphics *gra, struct layer *lay, int order)
+{
+ GList *itms;
+ struct itemgra *itm;
+
+ itms=lay->itemgras;
+ while (itms) {
+ itm=itms->data;
+ if (order >= itm->order.min && order <= itm->order.max)
+ xdisplay_draw_elements(gra, display_list, itm);
+ itms=g_list_next(itms);
+ }
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+static void xdisplay_draw(struct displaylist *display_list, struct graphics *gra, struct layout *l, int order)
+{
+ GList *lays;
+ struct layer *lay;
+
+ lays=l->layers;
+ while (lays) {
+ lay=lays->data;
+ xdisplay_draw_layer(display_list, gra, lay, order);
+ lays=g_list_next(lays);
+ }
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+extern void *route_selection;
+
+static void
+do_draw(struct displaylist *displaylist, int cancel)
+{
+ struct item *item;
+ int count,max=16384,workload=0;
+ struct coord ca[max];
+ struct attr attr;
+
+ while (!cancel) {
+ if (!displaylist->msh)
+ displaylist->msh=mapset_open(displaylist->ms);
+ if (!displaylist->m) {
+ displaylist->m=mapset_next(displaylist->msh, 1);
+ if (!displaylist->m) {
+ mapset_close(displaylist->msh);
+ displaylist->msh=NULL;
+ break;
+ }
+ displaylist->dc.pro=map_projection(displaylist->m);
+ displaylist->conv=map_requires_conversion(displaylist->m);
+ displaylist->sel=transform_get_selection(displaylist->dc.trans, displaylist->dc.pro, displaylist->order);
+ displaylist->mr=map_rect_new(displaylist->m, displaylist->sel);
+ }
+ if (displaylist->mr) {
+ while ((item=map_rect_get_item(displaylist->mr))) {
+ count=item_coord_get_within_selection(item, ca, item->type < type_line ? 1: max, displaylist->sel);
+ if (! count)
+ continue;
+ if (count == max)
+ dbg(0,"point count overflow %d\n", count);
+ if (!item_attr_get(item, attr_label, &attr))
+ attr.u.str=NULL;
+ if (displaylist->conv && attr.u.str && attr.u.str[0]) {
+ char *str=map_convert_string(displaylist->m, attr.u.str);
+ display_add(displaylist, item, count, ca, str);
+ map_convert_free(str);
+ } else
+ display_add(displaylist, item, count, ca, attr.u.str);
+ workload++;
+ if (workload == displaylist->workload)
+ return;
+ }
+ map_rect_destroy(displaylist->mr);
+ }
+ map_selection_destroy(displaylist->sel);
+ displaylist->mr=NULL;
+ displaylist->sel=NULL;
+ displaylist->m=NULL;
+ }
+ event_remove_idle(displaylist->idle_ev);
+ displaylist->idle_ev=NULL;
+ displaylist->busy=0;
+ graphics_process_selection(displaylist->dc.gra, displaylist);
+ if (! cancel)
+ graphics_displaylist_draw(displaylist->dc.gra, displaylist, displaylist->dc.trans, displaylist->layout, 1);
+ map_rect_destroy(displaylist->mr);
+ map_selection_destroy(displaylist->sel);
+ mapset_close(displaylist->msh);
+ displaylist->mr=NULL;
+ displaylist->sel=NULL;
+ displaylist->m=NULL;
+ displaylist->msh=NULL;
+ callback_call_1(displaylist->cb, cancel);
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void graphics_displaylist_draw(struct graphics *gra, struct displaylist *displaylist, struct transformation *trans, struct layout *l, int callback)
+{
+ int order=transform_get_order(trans);
+ displaylist->dc.trans=trans;
+ displaylist->dc.gra=gra;
+ // FIXME find a better place to set the background color
+ if (l) {
+ graphics_gc_set_background(gra->gc[0], &l->color);
+ graphics_gc_set_foreground(gra->gc[0], &l->color);
+ gra->default_font = g_strdup(l->font);
+ }
+ graphics_background_gc(gra, gra->gc[0]);
+ gra->meth.draw_mode(gra->priv, draw_mode_begin);
+ gra->meth.draw_rectangle(gra->priv, gra->gc[0]->priv, &gra->r.lu, gra->r.rl.x-gra->r.lu.x, gra->r.rl.y-gra->r.lu.y);
+ if (l)
+ xdisplay_draw(displaylist, gra, l, order+l->order_delta);
+ if (callback)
+ callback_list_call_attr_0(gra->cbl, attr_postdraw);
+ gra->meth.draw_mode(gra->priv, draw_mode_end);
+}
+
+static void graphics_load_mapset(struct graphics *gra, struct displaylist *displaylist, struct mapset *mapset, struct transformation *trans, struct layout *l, int async, struct callback *cb)
+{
+ int order=transform_get_order(trans);
+
+ dbg(1,"enter");
+ if (displaylist->busy) {
+ if (async == 1)
+ return;
+ do_draw(displaylist, 1);
+ }
+ xdisplay_free(displaylist->dl);
+ dbg(1,"order=%d\n", order);
+
+ displaylist->dc.gra=gra;
+ displaylist->ms=mapset;
+ displaylist->dc.trans=trans;
+ displaylist->workload=async ? 100 : 0;
+ displaylist->cb=cb;
+ if (l)
+ order+=l->order_delta;
+ displaylist->order=order;
+ displaylist->busy=1;
+ displaylist->layout=l;
+ if (async) {
+ if (! displaylist->idle_cb)
+ displaylist->idle_cb=callback_new_2(callback_cast(do_draw), displaylist, 0);
+ displaylist->idle_ev=event_add_idle(50, displaylist->idle_cb);
+ }
+}
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void graphics_draw(struct graphics *gra, struct displaylist *displaylist, struct mapset *mapset, struct transformation *trans, struct layout *l, int async, struct callback *cb)
+{
+ graphics_load_mapset(gra, displaylist, mapset, trans, l, async, cb);
+ if (! async)
+ do_draw(displaylist, 0);
+}
+
+int
+graphics_draw_cancel(struct graphics *gra, struct displaylist *displaylist)
+{
+ if (!displaylist->busy)
+ return 0;
+ do_draw(displaylist, 1);
+ return 1;
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+struct displaylist_handle {
+ GList *hl_head,*hl,*l_head,*l;
+};
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+struct displaylist_handle * graphics_displaylist_open(struct displaylist *displaylist)
+{
+ struct displaylist_handle *ret;
+
+ ret=g_new0(struct displaylist_handle, 1);
+ ret->hl_head=ret->hl=g_hash_to_list(displaylist->dl);
+ ret->l_head=ret->l=g_hash_to_list_keys(ret->hl->data);
+
+ return ret;
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+struct displayitem * graphics_displaylist_next(struct displaylist_handle *dlh)
+{
+ struct displayitem *ret;
+ if (! dlh->l) {
+ dlh->hl=g_list_next(dlh->hl);
+ if (!dlh->hl)
+ return NULL;
+ g_list_free(dlh->l_head);
+ dlh->l_head=dlh->l=g_hash_to_list_keys(dlh->hl->data);
+ }
+ ret=dlh->l->data;
+ dlh->l=g_list_next(dlh->l);
+ return ret;
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+void graphics_displaylist_close(struct displaylist_handle *dlh)
+{
+ g_list_free(dlh->hl_head);
+ g_list_free(dlh->l_head);
+ g_free(dlh);
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+struct displaylist * graphics_displaylist_new(void)
+{
+ struct displaylist *ret=g_new0(struct displaylist, 1);
+
+ ret->dl=g_hash_table_new(NULL,NULL);
+
+ return ret;
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+struct item * graphics_displayitem_get_item(struct displayitem *di)
+{
+ return &di->item;
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+char * graphics_displayitem_get_label(struct displayitem *di)
+{
+ return di->label;
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+static int within_dist_point(struct point *p0, struct point *p1, int dist)
+{
+ if (p0->x == 32767 || p0->y == 32767 || p1->x == 32767 || p1->y == 32767)
+ return 0;
+ if (p0->x == -32768 || p0->y == -32768 || p1->x == -32768 || p1->y == -32768)
+ return 0;
+ if ((p0->x-p1->x)*(p0->x-p1->x) + (p0->y-p1->y)*(p0->y-p1->y) <= dist*dist) {
+ return 1;
+ }
+ return 0;
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+static int within_dist_line(struct point *p, struct point *line_p0, struct point *line_p1, int dist)
+{
+ int vx,vy,wx,wy;
+ int c1,c2;
+ struct point line_p;
+
+ if (line_p0->x < line_p1->x) {
+ if (p->x < line_p0->x - dist)
+ return 0;
+ if (p->x > line_p1->x + dist)
+ return 0;
+ } else {
+ if (p->x < line_p1->x - dist)
+ return 0;
+ if (p->x > line_p0->x + dist)
+ return 0;
+ }
+ if (line_p0->y < line_p1->y) {
+ if (p->y < line_p0->y - dist)
+ return 0;
+ if (p->y > line_p1->y + dist)
+ return 0;
+ } else {
+ if (p->y < line_p1->y - dist)
+ return 0;
+ if (p->y > line_p0->y + dist)
+ return 0;
+ }
+
+ vx=line_p1->x-line_p0->x;
+ vy=line_p1->y-line_p0->y;
+ wx=p->x-line_p0->x;
+ wy=p->y-line_p0->y;
+
+ c1=vx*wx+vy*wy;
+ if ( c1 <= 0 )
+ return within_dist_point(p, line_p0, dist);
+ c2=vx*vx+vy*vy;
+ if ( c2 <= c1 )
+ return within_dist_point(p, line_p1, dist);
+
+ line_p.x=line_p0->x+vx*c1/c2;
+ line_p.y=line_p0->y+vy*c1/c2;
+ return within_dist_point(p, &line_p, dist);
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+static int within_dist_polyline(struct point *p, struct point *line_pnt, int count, int dist, int close)
+{
+ int i;
+ for (i = 0 ; i < count-1 ; i++) {
+ if (within_dist_line(p,line_pnt+i,line_pnt+i+1,dist)) {
+ return 1;
+ }
+ }
+ if (close)
+ return (within_dist_line(p,line_pnt,line_pnt+count-1,dist));
+ return 0;
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+static int within_dist_polygon(struct point *p, struct point *poly_pnt, int count, int dist)
+{
+ int i, j, c = 0;
+ for (i = 0, j = count-1; i < count; j = i++) {
+ if ((((poly_pnt[i].y <= p->y) && ( p->y < poly_pnt[j].y )) ||
+ ((poly_pnt[j].y <= p->y) && ( p->y < poly_pnt[i].y))) &&
+ (p->x < (poly_pnt[j].x - poly_pnt[i].x) * (p->y - poly_pnt[i].y) / (poly_pnt[j].y - poly_pnt[i].y) + poly_pnt[i].x))
+ c = !c;
+ }
+ if (! c)
+ return within_dist_polyline(p, poly_pnt, count, dist, 1);
+ return c;
+}
+
+/**
+ * FIXME
+ * @param <>
+ * @returns <>
+ * @author Martin Schaller (04/2008)
+*/
+int graphics_displayitem_within_dist(struct displaylist *displaylist, struct displayitem *di, struct point *p, int dist)
+{
+ struct point pa[16384];
+ int count;
+
+ count=transform(displaylist->dc.trans, displaylist->dc.pro, di->c, pa, di->count, 1, 0, NULL);
+
+ if (di->item.type < type_line) {
+ return within_dist_point(p, &pa[0], dist);
+ }
+ if (di->item.type < type_area) {
+ return within_dist_polyline(p, pa, count, dist, 0);
+ }
+ return within_dist_polygon(p, pa, count, dist);
+}
+
+
+static enum item_type
+graphics_selection_type(enum item_type type)
+{
+ if (type < type_line)
+ return type_selected_point;
+ if (type < type_area)
+ return type_selected_line;
+ return type_selected_area;
+
+}
+
+
+static void
+graphics_process_selection_item(struct displaylist *dl, struct item *item)
+{
+ struct displayitem di,*di_res;
+ GHashTable *h;
+
+ di.item=*item;
+ di.label=NULL;
+ di.displayed=0;
+ di.count=0;
+ h=g_hash_table_lookup(dl->dl, GINT_TO_POINTER(di.item.type));
+ if (h) {
+ di_res=g_hash_table_lookup(h, &di);
+ if (di_res) {
+ di.item.type=graphics_selection_type(di.item.type);
+ display_add(dl, &di.item, di_res->count, di_res->c, NULL);
+ }
+ }
+}
+
+void
+graphics_add_selection(struct graphics *gra, struct item *item, struct displaylist *dl)
+{
+ struct item *item_dup=g_new(struct item, 1);
+ *item_dup=*item;
+ gra->selection=g_list_append(gra->selection, item_dup);
+ if (dl)
+ graphics_process_selection_item(dl, item_dup);
+}
+
+void
+graphics_remove_selection(struct graphics *gra, struct item *item, struct displaylist *dl)
+{
+ GList *curr;
+ int found;
+
+ for (;;) {
+ curr=gra->selection;
+ found=0;
+ while (curr) {
+ struct item *sitem=curr->data;
+ if (item_is_equal(*item,*sitem)) {
+ if (dl) {
+ struct displayitem di;
+ GHashTable *h;
+ di.item=*sitem;
+ di.label=NULL;
+ di.displayed=0;
+ di.count=0;
+ di.item.type=graphics_selection_type(di.item.type);
+ h=g_hash_table_lookup(dl->dl, GINT_TO_POINTER(di.item.type));
+ if (h)
+ g_hash_table_remove(h, &di);
+ }
+ g_free(sitem);
+ gra->selection=g_list_remove(gra->selection, curr->data);
+ found=1;
+ break;
+ }
+ }
+ if (!found)
+ return;
+ }
+}
+
+void
+graphics_clear_selection(struct graphics *gra, struct displaylist *dl)
+{
+ while (gra->selection)
+ graphics_remove_selection(gra, (struct item *)gra->selection->data, dl);
+}
+
+static void
+graphics_process_selection(struct graphics *gra, struct displaylist *dl)
+{
+ GList *curr;
+
+ curr=gra->selection;
+ while (curr) {
+ struct item *item=curr->data;
+ graphics_process_selection_item(dl, item);
+ curr=g_list_next(curr);
+ }
+}
diff --git a/graphics.h b/graphics.h
new file mode 100644
index 00000000..447243b9
--- /dev/null
+++ b/graphics.h
@@ -0,0 +1,188 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_GRAPHICS_H
+#define NAVIT_GRAPHICS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+struct point;
+struct container;
+struct color;
+struct graphics;
+struct graphics_gc;
+struct graphics_font;
+struct graphics_image;
+struct transformation;
+struct display_list;
+struct mapset;
+
+enum draw_mode_num {
+ draw_mode_begin, draw_mode_end, draw_mode_cursor, draw_mode_end_lazy
+};
+
+struct graphics_priv;
+struct graphics_font_priv;
+struct graphics_image_priv;
+struct graphics_gc_priv;
+struct graphics_font_methods;
+struct graphics_gc_methods;
+struct graphics_image_methods;
+
+struct graphics_methods {
+ void (*graphics_destroy)(struct graphics_priv *gr);
+ void (*draw_mode)(struct graphics_priv *gr, enum draw_mode_num mode);
+ void (*draw_lines)(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count);
+ void (*draw_polygon)(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count);
+ void (*draw_rectangle)(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h);
+ void (*draw_circle)(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r);
+ void (*draw_text)(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy);
+ void (*draw_image)(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img);
+ void (*draw_image_warp)(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, int count, char *data);
+ void (*draw_restore)(struct graphics_priv *gr, struct point *p, int w, int h);
+ void (*draw_drag)(struct graphics_priv *gr, struct point *p);
+ struct graphics_font_priv *(*font_new)(struct graphics_priv *gr, struct graphics_font_methods *meth, char *font, int size, int flags);
+ struct graphics_gc_priv *(*gc_new)(struct graphics_priv *gr, struct graphics_gc_methods *meth);
+ void (*background_gc)(struct graphics_priv *gr, struct graphics_gc_priv *gc);
+ struct graphics_priv *(*overlay_new)(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int alpha, int wraparound);
+ struct graphics_image_priv *(*image_new)(struct graphics_priv *gr, struct graphics_image_methods *meth, char *path, int *w, int *h, struct point *hot, int rotation);
+ void *(*get_data)(struct graphics_priv *gr, char *type);
+ void (*image_free)(struct graphics_priv *gr, struct graphics_image_priv *priv);
+ void (*get_text_bbox)(struct graphics_priv *gr, struct graphics_font_priv *font, char *text, int dx, int dy, struct point *ret, int estimate);
+ void (*overlay_disable)(struct graphics_priv *gr, int disable);
+ void (*overlay_resize)(struct graphics_priv *gr, struct point *p, int w, int h, int alpha, int wraparound);
+};
+
+
+struct graphics_font_methods {
+ void (*font_destroy)(struct graphics_font_priv *font);
+};
+
+struct graphics_font {
+ struct graphics_font_priv *priv;
+ struct graphics_font_methods meth;
+};
+
+struct graphics_gc_methods {
+ void (*gc_destroy)(struct graphics_gc_priv *gc);
+ void (*gc_set_linewidth)(struct graphics_gc_priv *gc, int width);
+ void (*gc_set_dashes)(struct graphics_gc_priv *gc, int width, int offset, unsigned char dash_list[], int n);
+ void (*gc_set_foreground)(struct graphics_gc_priv *gc, struct color *c);
+ void (*gc_set_background)(struct graphics_gc_priv *gc, struct color *c);
+ void (*gc_set_stipple)(struct graphics_gc_priv *gc, struct graphics_image_priv *img);
+};
+
+struct graphics_gc {
+ struct graphics_gc_priv *priv;
+ struct graphics_gc_methods meth;
+};
+
+struct graphics_image_methods {
+ void (*image_destroy)(struct graphics_image_priv *img);
+};
+
+struct graphics_image {
+ struct graphics_image_priv *priv;
+ struct graphics_image_methods meth;
+ int width;
+ int height;
+ struct point hot;
+};
+
+struct graphics_data_image {
+ void *data;
+ int size;
+};
+
+/* prototypes */
+enum attr_type;
+enum draw_mode_num;
+struct attr;
+struct attr_iter;
+struct callback;
+struct color;
+struct displayitem;
+struct displaylist;
+struct displaylist_handle;
+struct graphics;
+struct graphics_font;
+struct graphics_gc;
+struct graphics_image;
+struct item;
+struct itemgra;
+struct layout;
+struct point;
+struct point_rect;
+struct transformation;
+void graphics_set_rect(struct graphics *gra, struct point_rect *pr);
+struct graphics *graphics_new(struct attr *parent, struct attr **attrs);
+int graphics_get_attr(struct graphics *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
+struct graphics *graphics_overlay_new(struct graphics *parent, struct point *p, int w, int h, int alpha, int wraparound);
+void graphics_init(struct graphics *this_);
+void *graphics_get_data(struct graphics *this_, char *type);
+void graphics_add_callback(struct graphics *this_, struct callback *cb);
+void graphics_remove_callback(struct graphics *this_, struct callback *cb);
+struct graphics_font *graphics_font_new(struct graphics *gra, int size, int flags);
+void graphics_font_destroy_all(struct graphics *gra);
+struct graphics_gc *graphics_gc_new(struct graphics *gra);
+void graphics_gc_destroy(struct graphics_gc *gc);
+void graphics_gc_set_foreground(struct graphics_gc *gc, struct color *c);
+void graphics_gc_set_background(struct graphics_gc *gc, struct color *c);
+void graphics_gc_set_stipple(struct graphics_gc *gc, struct graphics_image *img);
+void graphics_gc_set_linewidth(struct graphics_gc *gc, int width);
+void graphics_gc_set_dashes(struct graphics_gc *gc, int width, int offset, unsigned char dash_list[], int n);
+struct graphics_image *graphics_image_new_scaled(struct graphics *gra, char *path, int w, int h);
+struct graphics_image *graphics_image_new_scaled_rotated(struct graphics *gra, char *path, int w, int h, int rotate);
+struct graphics_image *graphics_image_new(struct graphics *gra, char *path);
+void graphics_image_free(struct graphics *gra, struct graphics_image *img);
+void graphics_draw_restore(struct graphics *this_, struct point *p, int w, int h);
+void graphics_draw_mode(struct graphics *this_, enum draw_mode_num mode);
+void graphics_draw_lines(struct graphics *this_, struct graphics_gc *gc, struct point *p, int count);
+void graphics_draw_circle(struct graphics *this_, struct graphics_gc *gc, struct point *p, int r);
+void graphics_draw_rectangle(struct graphics *this_, struct graphics_gc *gc, struct point *p, int w, int h);
+void graphics_draw_rectangle_rounded(struct graphics *this_, struct graphics_gc *gc, struct point *plu, int w, int h, int r, int fill);
+void graphics_draw_text(struct graphics *this_, struct graphics_gc *gc1, struct graphics_gc *gc2, struct graphics_font *font, char *text, struct point *p, int dx, int dy);
+void graphics_get_text_bbox(struct graphics *this_, struct graphics_font *font, char *text, int dx, int dy, struct point *ret, int estimate);
+void graphics_overlay_disable(struct graphics *this_, int disable);
+void graphics_overlay_resize(struct graphics *this_, struct point *p, int w, int h, int alpha, int wraparound);
+void graphics_draw_image(struct graphics *this_, struct graphics_gc *gc, struct point *p, struct graphics_image *img);
+int graphics_draw_drag(struct graphics *this_, struct point *p);
+void graphics_background_gc(struct graphics *this_, struct graphics_gc *gc);
+void graphics_draw_itemgra(struct graphics *gra, struct itemgra *itm, struct transformation *t);
+void graphics_displaylist_draw(struct graphics *gra, struct displaylist *displaylist, struct transformation *trans, struct layout *l, int callback);
+void graphics_draw(struct graphics *gra, struct displaylist *displaylist, struct mapset *mapset, struct transformation *trans, struct layout *l, int async, struct callback *cb);
+int graphics_draw_cancel(struct graphics *gra, struct displaylist *displaylist);
+struct displaylist_handle *graphics_displaylist_open(struct displaylist *displaylist);
+struct displayitem *graphics_displaylist_next(struct displaylist_handle *dlh);
+void graphics_displaylist_close(struct displaylist_handle *dlh);
+struct displaylist *graphics_displaylist_new(void);
+struct item *graphics_displayitem_get_item(struct displayitem *di);
+char *graphics_displayitem_get_label(struct displayitem *di);
+int graphics_displayitem_within_dist(struct displaylist *displaylist, struct displayitem *di, struct point *p, int dist);
+void graphics_add_selection(struct graphics *gra, struct item *item, struct displaylist *dl);
+void graphics_remove_selection(struct graphics *gra, struct item *item, struct displaylist *dl);
+void graphics_clear_selection(struct graphics *gra, struct displaylist *dl);
+/* end of prototypes */
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/graphics/Makefile.am b/graphics/Makefile.am
new file mode 100644
index 00000000..af999d00
--- /dev/null
+++ b/graphics/Makefile.am
@@ -0,0 +1,19 @@
+SUBDIRS=null
+if GRAPHICS_GTK_DRAWING_AREA
+ SUBDIRS+=gtk_drawing_area
+endif
+if GRAPHICS_OPENGL
+ SUBDIRS+=opengl
+endif
+if GRAPHICS_QT_QPAINTER
+ SUBDIRS+=qt_qpainter
+endif
+if USE_GRAPHICS_SDL
+ SUBDIRS+=sdl
+endif
+if GRAPHICS_WIN32
+ SUBDIRS+=win32
+endif
+if GRAPHICS_GD
+ SUBDIRS+=gd
+endif
diff --git a/graphics/gd/Makefile.am b/graphics/gd/Makefile.am
new file mode 100644
index 00000000..67fc270a
--- /dev/null
+++ b/graphics/gd/Makefile.am
@@ -0,0 +1,9 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ @GD_CFLAGS@ -I$(top_srcdir) -I$(top_srcdir)/navit -DMODULE=graphics_gd
+libgraphics_gd_la_LDFLAGS = @GD_LIBS@ -module -avoid-version
+if PLUGINS
+modulegraphics_LTLIBRARIES = libgraphics_gd.la
+else
+noinst_LTLIBRARIES = libgraphics_gd.la
+endif
+libgraphics_gd_la_SOURCES = graphics_gd.c
diff --git a/graphics/gd/graphics_gd.c b/graphics/gd/graphics_gd.c
new file mode 100644
index 00000000..d53fcb62
--- /dev/null
+++ b/graphics/gd/graphics_gd.c
@@ -0,0 +1,547 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include <gd.h>
+#include "config.h"
+#include "point.h"
+#include "graphics.h"
+#include "color.h"
+#include "plugin.h"
+#include "callback.h"
+#include "window.h"
+#include "navit.h"
+#include "debug.h"
+#include "navit/font/freetype/font_freetype.h"
+
+#define NAVIT_GD_XPM_TRANSPARENCY_HACK
+
+#ifdef NAVIT_GD_XPM_TRANSPARENCY_HACK
+#include <X11/xpm.h>
+
+BGD_DECLARE(gdImagePtr) gdImageCreateFromXpm (char *filename)
+{
+ XpmInfo info;
+ XpmImage image;
+ int i, j, k, number;
+ char buf[5];
+ gdImagePtr im = 0;
+ int *pointer;
+ int red = 0, green = 0, blue = 0, alpha = 0;
+ int *colors;
+ int ret;
+
+ ret = XpmReadFileToXpmImage (filename, &image, &info);
+ if (ret != XpmSuccess)
+ return 0;
+
+ if (!(im = gdImageCreate (image.width, image.height)))
+ return 0;
+
+ number = image.ncolors;
+ if (overflow2(sizeof (int), number)) {
+ return 0;
+ }
+ colors = (int *) gdMalloc (sizeof (int) * number);
+ if (colors == NULL)
+ return (0);
+ for (i = 0; i < number; i++)
+ {
+ alpha = 0;
+ switch (strlen (image.colorTable[i].c_color))
+ {
+ case 4:
+ if (!strcasecmp(image.colorTable[i].c_color,"none")) {
+ red = 0;
+ green = 0;
+ blue = 0;
+ alpha = 127;
+ } else {
+ buf[1] = '\0';
+ buf[0] = image.colorTable[i].c_color[1];
+ red = strtol (buf, NULL, 16);
+
+ buf[0] = image.colorTable[i].c_color[3];
+ green = strtol (buf, NULL, 16);
+
+ buf[0] = image.colorTable[i].c_color[5];
+ blue = strtol (buf, NULL, 16);
+ }
+ break;
+ case 7:
+ buf[2] = '\0';
+ buf[0] = image.colorTable[i].c_color[1];
+ buf[1] = image.colorTable[i].c_color[2];
+ red = strtol (buf, NULL, 16);
+
+ buf[0] = image.colorTable[i].c_color[3];
+ buf[1] = image.colorTable[i].c_color[4];
+ green = strtol (buf, NULL, 16);
+
+ buf[0] = image.colorTable[i].c_color[5];
+ buf[1] = image.colorTable[i].c_color[6];
+ blue = strtol (buf, NULL, 16);
+ break;
+ case 10:
+ buf[3] = '\0';
+ buf[0] = image.colorTable[i].c_color[1];
+ buf[1] = image.colorTable[i].c_color[2];
+ buf[2] = image.colorTable[i].c_color[3];
+ red = strtol (buf, NULL, 16);
+ red /= 64;
+
+ buf[0] = image.colorTable[i].c_color[4];
+ buf[1] = image.colorTable[i].c_color[5];
+ buf[2] = image.colorTable[i].c_color[6];
+ green = strtol (buf, NULL, 16);
+ green /= 64;
+
+ buf[0] = image.colorTable[i].c_color[7];
+ buf[1] = image.colorTable[i].c_color[8];
+ buf[2] = image.colorTable[i].c_color[9];
+ blue = strtol (buf, NULL, 16);
+ blue /= 64;
+ break;
+ case 13:
+ buf[4] = '\0';
+ buf[0] = image.colorTable[i].c_color[1];
+ buf[1] = image.colorTable[i].c_color[2];
+ buf[2] = image.colorTable[i].c_color[3];
+ buf[3] = image.colorTable[i].c_color[4];
+ red = strtol (buf, NULL, 16);
+ red /= 256;
+
+ buf[0] = image.colorTable[i].c_color[5];
+ buf[1] = image.colorTable[i].c_color[6];
+ buf[2] = image.colorTable[i].c_color[7];
+ buf[3] = image.colorTable[i].c_color[8];
+ green = strtol (buf, NULL, 16);
+ green /= 256;
+
+ buf[0] = image.colorTable[i].c_color[9];
+ buf[1] = image.colorTable[i].c_color[10];
+ buf[2] = image.colorTable[i].c_color[11];
+ buf[3] = image.colorTable[i].c_color[12];
+ blue = strtol (buf, NULL, 16);
+ blue /= 256;
+ break;
+ }
+
+
+ colors[i] = gdImageColorResolveAlpha(im, red, green, blue, alpha);
+ if (colors[i] == -1)
+ fprintf (stderr, "ARRRGH\n");
+ }
+
+ pointer = (int *) image.data;
+ for (i = 0; i < image.height; i++)
+ {
+ for (j = 0; j < image.width; j++)
+ {
+ k = *pointer++;
+ gdImageSetPixel (im, j, i, colors[k]);
+ }
+ }
+ gdFree (colors);
+ return (im);
+}
+#endif
+
+
+struct graphics_priv {
+ gdImagePtr im;
+ int w,h;
+ struct callback *cb;
+ struct callback_list *cbl;
+ struct navit *nav;
+ struct graphics_gc_priv *background;
+ struct font_freetype_methods freetype_methods;
+ struct window window;
+ struct graphics_data_image image;
+};
+
+struct graphics_gc_priv {
+ struct graphics_priv *gr;
+ int color;
+ int bgcolor;
+ int width;
+ unsigned char *dash_list;
+ int dash_count;
+ int dash_list_len;
+};
+
+struct graphics_image_priv {
+ gdImagePtr im;
+};
+
+
+static void
+graphics_destroy(struct graphics_priv *gr)
+{
+ g_free(gr);
+}
+
+static void
+gc_destroy(struct graphics_gc_priv *gc)
+{
+ if (gc->color != -1)
+ gdImageColorDeallocate(gc->gr->im, gc->color);
+ if (gc->bgcolor != -1)
+ gdImageColorDeallocate(gc->gr->im, gc->bgcolor);
+ g_free(gc->dash_list);
+ g_free(gc);
+}
+
+static void
+gc_set_linewidth(struct graphics_gc_priv *gc, int w)
+{
+ gc->width=w;
+}
+
+static void
+gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n)
+{
+ int i,count=0;
+ g_free(gc->dash_list);
+ gc->dash_list=g_new(unsigned char, n);
+ for (i = 0 ; i < n ; i++) {
+ gc->dash_list[i]=dash_list[i];
+ count+=dash_list[i];
+ }
+ gc->dash_list_len=n;
+ gc->dash_count=count;
+}
+
+static void
+gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
+{
+ gc->color=gdImageColorAllocate(gc->gr->im, c->r>>8, c->g>>8, c->b>>8);
+}
+
+static void
+gc_set_background(struct graphics_gc_priv *gc, struct color *c)
+{
+ gc->bgcolor=gdImageColorAllocate(gc->gr->im, c->r>>8, c->g>>8, c->b>>8);
+}
+
+static struct graphics_gc_methods gc_methods = {
+ gc_destroy,
+ gc_set_linewidth,
+ gc_set_dashes,
+ gc_set_foreground,
+ gc_set_background
+};
+
+static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth)
+{
+ struct graphics_gc_priv *ret=g_new0(struct graphics_gc_priv, 1);
+ ret->gr=gr;
+ ret->width=1;
+ ret->color=-1;
+ ret->bgcolor=-1;
+ *meth=gc_methods;
+ return ret;
+}
+
+
+static struct graphics_image_priv *
+image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h, struct point *hot, int rotation)
+{
+ FILE *file;
+ struct graphics_image_priv *ret=NULL;
+ gdImagePtr im=NULL;
+ int len;
+
+ if (! name)
+ return NULL;
+ len=strlen(name);
+ if (len < 4)
+ return NULL;
+ file=fopen(name,"r");
+ if (file) {
+ if (!strcmp(name+len-4,".png"))
+ im=gdImageCreateFromPng(file);
+ else if (!strcmp(name+len-4,".xpm"))
+ im=gdImageCreateFromXpm(name);
+ fclose(file);
+ }
+ if (im) {
+ ret=g_new0(struct graphics_image_priv, 1);
+ ret->im=im;
+ *w=im->sx;
+ *h=im->sy;
+ hot->x=im->sx/2;
+ hot->y=im->sy/2;
+ }
+ return ret;
+}
+
+static void
+draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
+{
+ int color[gc->dash_count],cc;
+ int i,j,k=0;
+
+ if (gc->dash_count) {
+ cc=gc->color;
+ for (i = 0 ; i < gc->dash_list_len ; i++) {
+ for (j = 0 ; j < gc->dash_list[i] ; j++) {
+ color[k++]=cc;
+ }
+ if (cc == gdTransparent)
+ cc=gc->color;
+ else
+ cc=gdTransparent;
+ }
+ gdImageSetStyle(gr->im, color, gc->dash_count);
+ }
+ gdImageSetThickness(gr->im, gc->width);
+ gdImageOpenPolygon(gr->im, (gdPointPtr) p, count, gc->dash_count ? gdStyled : gc->color);
+}
+
+static void
+draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
+{
+
+ gdImageFilledPolygon(gr->im, (gdPointPtr) p, count, gc->color);
+}
+
+static void
+draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
+{
+ gdImageFilledRectangle(gr->im, p->x, p->y, p->x+w, p->y+h, gc->color);
+}
+
+static void
+draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r)
+{
+ gdImageSetThickness(gr->im, gc->width);
+ gdImageArc(gr->im, p->x, p->y, r, r, 0, 360, gc->color);
+}
+
+
+static void
+draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
+{
+ struct font_freetype_text *t;
+ struct font_freetype_glyph *g, **gp;
+ gdImagePtr im;
+ int i,x,y,w,h;
+ t=gr->freetype_methods.text_new(text, (struct font_freetype_font *)font, dx, dy);
+ struct color transparent = {0x0, 0x0, 0x0, 0x7f7f};
+ struct color white = {0xffff, 0xffff, 0xffff, 0x0};
+ struct color black = {0x0, 0x0, 0x0, 0x0};
+
+ x=p->x << 6;
+ y=p->y << 6;
+ gp=t->glyph;
+ i=t->glyph_count;
+ while (i-- > 0)
+ {
+ g=*gp++;
+ w=g->w;
+ h=g->h;
+ if (w && h) {
+ im=gdImageCreateTrueColor(w+2, h+2);
+ gr->freetype_methods.get_shadow(g,(unsigned char *)(im->tpixels),32,0,&white,&transparent);
+ gdImageCopy(gr->im, im, ((x+g->x)>>6)-1, ((y+g->y)>>6)-1, 0, 0, w+2, h+2);
+ gdImageDestroy(im);
+ }
+ x+=g->dx;
+ y+=g->dy;
+ }
+ x=p->x << 6;
+ y=p->y << 6;
+ gp=t->glyph;
+ i=t->glyph_count;
+ while (i-- > 0)
+ {
+ g=*gp++;
+ w=g->w;
+ h=g->h;
+ if (w && h) {
+ im=gdImageCreateTrueColor(w, h);
+ gr->freetype_methods.get_glyph(g,(unsigned char *)(im->tpixels),32,0,&black,&white,&transparent);
+ gdImageCopy(gr->im, im, (x+g->x)>>6, (y+g->y)>>6, 0, 0, w, h);
+ gdImageDestroy(im);
+ }
+ x+=g->dx;
+ y+=g->dy;
+ }
+ gr->freetype_methods.text_destroy(t);
+}
+
+static void
+draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
+{
+ gdImageCopy(gr->im, img->im, p->x, p->y, 0, 0, img->im->sx, img->im->sy);
+}
+
+static void
+draw_image_warp(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, int count, char *data)
+{
+}
+
+static void
+draw_restore(struct graphics_priv *gr, struct point *p, int w, int h)
+{
+}
+
+static void
+background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
+{
+ gr->background=gc;
+}
+
+static void
+draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
+{
+ FILE *pngout;
+#if 0
+ if (mode == draw_mode_begin && gr->background) {
+ gdImageFilledRectangle(gr->im, 0, 0, gr->w, gr->h, gr->background->color);
+ }
+#endif
+ if (mode == draw_mode_end) {
+ rename("test.png","test.png.old");
+ pngout=fopen("test.png", "wb");
+ gdImagePng(gr->im, pngout);
+ fclose(pngout);
+ }
+}
+
+static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int alpha);
+
+static void *
+get_data(struct graphics_priv *this, char *type)
+{
+ int b;
+ struct point p;
+ if (!strcmp(type,"window"))
+ return &this->window;
+ if (!strcmp(type,"image_png")) {
+ if (this->image.data)
+ gdFree(this->image.data);
+ this->image.data=gdImagePngPtr(this->im, &this->image.size);
+ return &this->image;
+ }
+ if (sscanf(type,"click_%d_%d_%d",&p.x,&p.y,&b) == 3) {
+ if (this->image.data)
+ gdFree(this->image.data);
+ this->image.data=0;
+ this->image.size=0;
+
+ callback_list_call_attr_3(this->cbl, attr_button, (void *)b, (void *)1, (void *)&p);
+
+ return &this->image;
+ }
+ return NULL;
+}
+
+
+static void
+image_free(struct graphics_priv *gr, struct graphics_image_priv *priv)
+{
+ gdImageDestroy(priv->im);
+ g_free(priv);
+}
+
+static void
+overlay_disable(struct graphics_priv *gr, int disable)
+{
+ dbg(0,"enter\n");
+}
+
+
+
+static struct graphics_methods graphics_methods = {
+ graphics_destroy,
+ draw_mode,
+ draw_lines,
+ draw_polygon,
+ draw_rectangle,
+ draw_circle,
+ draw_text,
+ draw_image,
+ draw_image_warp,
+ draw_restore,
+ NULL,
+ NULL,
+ gc_new,
+ background_gc,
+ overlay_new,
+ image_new,
+ get_data,
+ image_free,
+ NULL,
+ overlay_disable,
+};
+
+static struct graphics_priv *
+overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int alpha)
+{
+ *meth=graphics_methods;
+ return NULL;
+}
+
+static void
+emit_callback(struct graphics_priv *priv)
+{
+ callback_list_call_attr_2(priv->cbl, attr_resize, (void *)priv->w, (void *)priv->h);
+}
+
+
+static struct graphics_priv *
+graphics_gd_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl)
+{
+ struct font_priv * (*font_freetype_new)(void *meth);
+ struct graphics_priv *ret;
+ struct attr *attr;
+ event_request_system("glib","graphics_gtk_drawing_area_new");
+ font_freetype_new=plugin_get_font_type("freetype");
+ if (!font_freetype_new)
+ return NULL;
+ *meth=graphics_methods;
+ ret=g_new0(struct graphics_priv, 1);
+ font_freetype_new(&ret->freetype_methods);
+ meth->font_new=(struct graphics_font_priv *(*)(struct graphics_priv *, struct graphics_font_methods *, char *, int, int))ret->freetype_methods.font_new;
+ meth->get_text_bbox=ret->freetype_methods.get_text_bbox;
+ ret->cb=callback_new_attr_1(callback_cast(emit_callback), attr_navit, ret);
+ navit_add_callback(nav, ret->cb);
+ ret->cbl=cbl;
+ ret->nav=nav;
+ attr=attr_search(attrs, NULL, attr_w);
+ if (attr)
+ ret->w=attr->u.num;
+ else
+ ret->w=800;
+ attr=attr_search(attrs, NULL, attr_h);
+ if (attr)
+ ret->h=attr->u.num;
+ else
+ ret->h=600;
+ ret->im=gdImageCreateTrueColor(ret->w,ret->h);
+ return ret;
+}
+
+void
+plugin_init(void)
+{
+ plugin_register_graphics_type("gd", graphics_gd_new);
+}
diff --git a/graphics/gtk_drawing_area/Makefile.am b/graphics/gtk_drawing_area/Makefile.am
new file mode 100644
index 00000000..79da228d
--- /dev/null
+++ b/graphics/gtk_drawing_area/Makefile.am
@@ -0,0 +1,5 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @GTK2_CFLAGS@ -I$(top_srcdir) -I$(top_srcdir)/navit -DMODULE=graphics_gtk_drawing_area
+modulegraphics_LTLIBRARIES = libgraphics_gtk_drawing_area.la
+libgraphics_gtk_drawing_area_la_SOURCES = graphics_gtk_drawing_area.c
+libgraphics_gtk_drawing_area_la_LDFLAGS = @GTK2_LIBS@ @IMLIB2_LIBS@ -module -avoid-version
diff --git a/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c b/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c
new file mode 100644
index 00000000..f9020067
--- /dev/null
+++ b/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c
@@ -0,0 +1,1096 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#define GDK_ENABLE_BROKEN
+#include "config.h"
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <sys/time.h>
+#if !defined(GDK_Book) || !defined(GDK_Calendar)
+#include <X11/XF86keysym.h>
+#endif
+#ifdef HAVE_IMLIB2
+#include <Imlib2.h>
+#endif
+
+#ifndef _WIN32
+#include <gdk/gdkx.h>
+#endif
+#include "event.h"
+#include "debug.h"
+#include "point.h"
+#include "graphics.h"
+#include "color.h"
+#include "item.h"
+#include "window.h"
+#include "callback.h"
+#include "keys.h"
+#include "plugin.h"
+#include "navit/font/freetype/font_freetype.h"
+#include "navit.h"
+
+#ifndef GDK_Book
+#define GDK_Book XF86XK_Book
+#endif
+#ifndef GDK_Calendar
+#define GDK_Calendar XF86XK_Calendar
+#endif
+
+
+struct graphics_priv {
+ GdkEventButton button_event;
+ int button_timeout;
+ GtkWidget *widget;
+ GtkWidget *win;
+ struct window window;
+ GdkDrawable *drawable;
+ GdkDrawable *background;
+ int background_ready;
+ GdkColormap *colormap;
+ struct point p;
+ struct point pclean;
+ int cleanup;
+ int width;
+ int height;
+ int win_w;
+ int win_h;
+ int visible;
+ int overlay_disabled;
+ int overlay_autodisabled;
+ int a;
+ int wraparound;
+ struct graphics_priv *parent;
+ struct graphics_priv *overlays;
+ struct graphics_priv *next;
+ struct graphics_gc_priv *background_gc;
+ enum draw_mode_num mode;
+ struct callback_list *cbl;
+ struct font_freetype_methods freetype_methods;
+ struct navit *nav;
+ int pid;
+ struct timeval button_press[8];
+ struct timeval button_release[8];
+};
+
+
+struct graphics_gc_priv {
+ GdkGC *gc;
+ GdkPixmap *pixmap;
+ struct graphics_priv *gr;
+ int level;
+ unsigned char r,g,b,a;
+};
+
+struct graphics_image_priv {
+ GdkPixbuf *pixbuf;
+ int w;
+ int h;
+};
+
+static void
+graphics_destroy(struct graphics_priv *gr)
+{
+}
+
+static void
+gc_destroy(struct graphics_gc_priv *gc)
+{
+ g_object_unref(gc->gc);
+ g_free(gc);
+}
+
+static void
+gc_set_linewidth(struct graphics_gc_priv *gc, int w)
+{
+ gdk_gc_set_line_attributes(gc->gc, w, GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_ROUND);
+}
+
+static void
+gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n)
+{
+ gdk_gc_set_dashes(gc->gc, offset, (gint8 *)dash_list, n);
+ gdk_gc_set_line_attributes(gc->gc, w, GDK_LINE_ON_OFF_DASH, GDK_CAP_ROUND, GDK_JOIN_ROUND);
+}
+
+static void
+gc_set_color(struct graphics_gc_priv *gc, struct color *c, int fg)
+{
+ GdkColor gdkc;
+ gdkc.pixel=0;
+ gdkc.red=c->r;
+ gdkc.green=c->g;
+ gdkc.blue=c->b;
+ gdk_colormap_alloc_color(gc->gr->colormap, &gdkc, FALSE, TRUE);
+ gdk_colormap_query_color(gc->gr->colormap, gdkc.pixel, &gdkc);
+ gc->r=gdkc.red >> 8;
+ gc->g=gdkc.green >> 8;
+ gc->b=gdkc.blue >> 8;
+ gc->a=c->a >> 8;
+ if (fg) {
+ gdk_gc_set_foreground(gc->gc, &gdkc);
+ gc->level=(c->r+c->g+c->b)/3;
+ } else
+ gdk_gc_set_background(gc->gc, &gdkc);
+}
+
+static void
+gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
+{
+ gc_set_color(gc, c, 1);
+}
+
+static void
+gc_set_background(struct graphics_gc_priv *gc, struct color *c)
+{
+ gc_set_color(gc, c, 0);
+}
+
+static void
+gc_set_stipple(struct graphics_gc_priv *gc, struct graphics_image_priv *img)
+{
+ char data[2]={0x2,0x1};
+ gdk_gc_set_fill(gc->gc, GDK_STIPPLED);
+ gc->pixmap=gdk_bitmap_create_from_data(gc->gr->widget->window, data, 2, 2);
+ gdk_gc_set_stipple(gc->gc, gc->pixmap);
+}
+
+static struct graphics_gc_methods gc_methods = {
+ gc_destroy,
+ gc_set_linewidth,
+ gc_set_dashes,
+ gc_set_foreground,
+ gc_set_background,
+ gc_set_stipple,
+};
+
+static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth)
+{
+ struct graphics_gc_priv *gc=g_new(struct graphics_gc_priv, 1);
+
+ *meth=gc_methods;
+ gc->gc=gdk_gc_new(gr->widget->window);
+ gc->gr=gr;
+ return gc;
+}
+
+static struct graphics_image_priv *
+image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h, struct point *hot, int rotation)
+{
+ GdkPixbuf *pixbuf;
+ struct graphics_image_priv *ret;
+ const char *option;
+
+ if (*w == -1 && *h == -1)
+ pixbuf=gdk_pixbuf_new_from_file(name, NULL);
+ else
+ pixbuf=gdk_pixbuf_new_from_file_at_size(name, *w, *h, NULL);
+ if (! pixbuf)
+ return NULL;
+ if (rotation) {
+ GdkPixbuf *tmp;
+ switch (rotation) {
+ case 90:
+ rotation=270;
+ break;
+ case 180:
+ break;
+ case 270:
+ rotation=90;
+ break;
+ default:
+ return NULL;
+ }
+ tmp=gdk_pixbuf_rotate_simple(pixbuf, rotation);
+ g_object_unref(pixbuf);
+ if (! tmp) {
+ return NULL;
+ }
+ pixbuf=tmp;
+ }
+ ret=g_new0(struct graphics_image_priv, 1);
+ ret->pixbuf=pixbuf;
+ ret->w=gdk_pixbuf_get_width(pixbuf);
+ ret->h=gdk_pixbuf_get_height(pixbuf);
+ *w=ret->w;
+ *h=ret->h;
+ if (hot) {
+ option=gdk_pixbuf_get_option(pixbuf, "x_hot");
+ if (option)
+ hot->x=atoi(option);
+ else
+ hot->x=ret->w/2-1;
+ option=gdk_pixbuf_get_option(pixbuf, "y_hot");
+ if (option)
+ hot->y=atoi(option);
+ else
+ hot->y=ret->h/2-1;
+ }
+ return ret;
+}
+
+static void
+image_free(struct graphics_priv *gr, struct graphics_image_priv *priv)
+{
+ if (priv->pixbuf)
+ g_object_unref(priv->pixbuf);
+ g_free(priv);
+}
+
+static void
+draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
+{
+ if (gr->mode == draw_mode_begin || gr->mode == draw_mode_end)
+ gdk_draw_lines(gr->drawable, gc->gc, (GdkPoint *)p, count);
+ if (gr->mode == draw_mode_end || gr->mode == draw_mode_cursor)
+ gdk_draw_lines(gr->widget->window, gc->gc, (GdkPoint *)p, count);
+}
+
+static void
+draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
+{
+ if (gr->mode == draw_mode_begin || gr->mode == draw_mode_end)
+ gdk_draw_polygon(gr->drawable, gc->gc, TRUE, (GdkPoint *)p, count);
+ if (gr->mode == draw_mode_end || gr->mode == draw_mode_cursor)
+ gdk_draw_polygon(gr->widget->window, gc->gc, TRUE, (GdkPoint *)p, count);
+}
+
+static void
+draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
+{
+ gdk_draw_rectangle(gr->drawable, gc->gc, TRUE, p->x, p->y, w, h);
+}
+
+static void
+draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r)
+{
+ if (gr->mode == draw_mode_begin || gr->mode == draw_mode_end)
+ gdk_draw_arc(gr->drawable, gc->gc, FALSE, p->x-r/2, p->y-r/2, r, r, 0, 64*360);
+ if (gr->mode == draw_mode_end || gr->mode == draw_mode_cursor)
+ gdk_draw_arc(gr->widget->window, gc->gc, FALSE, p->x-r/2, p->y-r/2, r, r, 0, 64*360);
+}
+
+static void
+display_text_draw(struct font_freetype_text *text, struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct point *p)
+{
+ int i,x,y;
+ struct font_freetype_glyph *g, **gp;
+ unsigned char *shadow;
+ struct color transparent={0x0,0x0,0x0,0x0};
+ struct color white={0xffff,0xffff,0xffff,0xffff};
+
+ gp=text->glyph;
+ i=text->glyph_count;
+ x=p->x << 6;
+ y=p->y << 6;
+ while (i-- > 0)
+ {
+ g=*gp++;
+ if (g->w && g->h && bg ) {
+#if 1
+ shadow=g_malloc((g->w+2)*(g->h+2));
+ if (gr->freetype_methods.get_shadow(g, shadow, 8, g->w+2, &white, &transparent))
+ gdk_draw_gray_image(gr->drawable, bg->gc, ((x+g->x)>>6)-1, ((y+g->y)>>6)-1, g->w+2, g->h+2, GDK_RGB_DITHER_NONE, shadow, g->w+2);
+ g_free(shadow);
+#else
+ GdkImage *image;
+ stride=(g->w+9)/8;
+ shadow=malloc(stride*(g->h+2));
+
+ gr->freetype_methods.get_shadow(g, shadow, 1, stride);
+ image=gdk_image_new_bitmap(gdk_visual_get_system(),shadow,g->w+2, g->h+2);
+ gdk_draw_image(gr->drawable, bg->gc, image, 0, 0, ((x+g->x)>>6)-1, ((y+g->y)>>6)-1, g->w+2, g->h+2);
+ g_object_unref(image);
+#endif
+
+ }
+ x+=g->dx;
+ y+=g->dy;
+ }
+ x=p->x << 6;
+ y=p->y << 6;
+ gp=text->glyph;
+ i=text->glyph_count;
+ while (i-- > 0)
+ {
+ g=*gp++;
+ if (g->w && g->h)
+ gdk_draw_gray_image(gr->drawable, fg->gc, (x+g->x)>>6, (y+g->y)>>6, g->w, g->h, GDK_RGB_DITHER_NONE, g->pixmap, g->w);
+ x+=g->dx;
+ y+=g->dy;
+ }
+}
+
+static void
+draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
+{
+ struct font_freetype_text *t;
+
+ if (! font)
+ {
+ dbg(0,"no font, returning\n");
+ return;
+ }
+#if 0 /* Temporarily disabled because it destroys text rendering of overlays and in gui internal in some places */
+ /*
+ This needs an improvement, no one checks if the strings are visible
+ */
+ if (p->x > gr->width-50 || p->y > gr->height-50) {
+ return;
+ }
+ if (p->x < -50 || p->y < -50) {
+ return;
+ }
+#endif
+
+ if (bg) {
+ if (bg->level > 32767) {
+ gdk_gc_set_function(fg->gc, GDK_AND_INVERT);
+ gdk_gc_set_function(bg->gc, GDK_OR);
+ } else {
+ gdk_gc_set_function(fg->gc, GDK_OR);
+ gdk_gc_set_function(bg->gc, GDK_AND_INVERT);
+ }
+ }
+
+ t=gr->freetype_methods.text_new(text, (struct font_freetype_font *)font, dx, dy);
+ display_text_draw(t, gr, fg, bg, p);
+ gr->freetype_methods.text_destroy(t);
+ if (bg) {
+ gdk_gc_set_function(fg->gc, GDK_COPY);
+ gdk_gc_set_function(bg->gc, GDK_COPY);
+ }
+#if 0
+ {
+ struct point pnt[5];
+ int i;
+ gr->freetype_methods.get_text_bbox(gr, font, text, dx, dy, pnt, 1);
+ for (i = 0 ; i < 4 ; i++) {
+ pnt[i].x+=p->x;
+ pnt[i].y+=p->y;
+ }
+ pnt[4]=pnt[0];
+ gdk_draw_lines(gr->drawable, fg->gc, (GdkPoint *)pnt, 5);
+ }
+#endif
+}
+
+static void
+draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
+{
+ gdk_draw_pixbuf(gr->drawable, fg->gc, img->pixbuf, 0, 0, p->x, p->y,
+ img->w, img->h, GDK_RGB_DITHER_NONE, 0, 0);
+}
+
+#ifdef HAVE_IMLIB2
+static void
+draw_image_warp(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, int count, char *data)
+{
+ void *image;
+ int w,h;
+ dbg(1,"draw_image_warp data=%s\n", data);
+ image = imlib_load_image(data);
+ imlib_context_set_display(gdk_x11_drawable_get_xdisplay(gr->widget->window));
+ imlib_context_set_colormap(gdk_x11_colormap_get_xcolormap(gtk_widget_get_colormap(gr->widget)));
+ imlib_context_set_visual(gdk_x11_visual_get_xvisual(gtk_widget_get_visual(gr->widget)));
+ imlib_context_set_drawable(gdk_x11_drawable_get_xid(gr->drawable));
+ imlib_context_set_image(image);
+ w = imlib_image_get_width();
+ h = imlib_image_get_height();
+ if (count == 3) {
+ /* 0 1
+ 2 */
+ imlib_render_image_on_drawable_skewed(0, 0, w, h, p[0].x, p[0].y, p[1].x-p[0].x, p[1].y-p[0].y, p[2].x-p[0].x, p[2].y-p[0].y);
+ }
+ if (count == 2) {
+ /* 0
+ 1 */
+ imlib_render_image_on_drawable_skewed(0, 0, w, h, p[0].x, p[0].y, p[1].x-p[0].x, 0, 0, p[1].y-p[0].y);
+ }
+ if (count == 1) {
+ /*
+ 0
+ */
+ imlib_render_image_on_drawable_skewed(0, 0, w, h, p[0].x-w/2, p[0].y-h/2, w, 0, 0, h);
+ }
+ imlib_free_image();
+}
+#endif
+
+static void
+overlay_rect(struct graphics_priv *parent, struct graphics_priv *overlay, int clean, GdkRectangle *r)
+{
+ if (clean) {
+ r->x=overlay->pclean.x;
+ r->y=overlay->pclean.y;
+ } else {
+ r->x=overlay->p.x;
+ r->y=overlay->p.y;
+ }
+ r->width=overlay->width;
+ r->height=overlay->height;
+ if (!overlay->wraparound)
+ return;
+ if (r->x < 0)
+ r->x += parent->width;
+ if (r->y < 0)
+ r->y += parent->height;
+ if (r->width < 0)
+ r->width += parent->width;
+ if (r->height < 0)
+ r->height += parent->height;
+}
+
+static void
+overlay_draw(struct graphics_priv *parent, struct graphics_priv *overlay, GdkRectangle *r, GdkPixmap *pixmap, GdkGC *gc)
+{
+ GdkPixbuf *pixbuf,*pixbuf2;
+ guchar *pixels1, *pixels2, *p1, *p2;
+ int x,y;
+ int rowstride1,rowstride2;
+ int n_channels1,n_channels2;
+ GdkRectangle or,ir;
+ struct graphics_gc_priv *bg=overlay->background_gc;
+
+ if (parent->overlay_disabled || overlay->overlay_disabled || overlay->overlay_autodisabled)
+ return;
+ dbg(1,"r->x=%d r->y=%d r->width=%d r->height=%d\n", r->x, r->y, r->width, r->height);
+ overlay_rect(parent, overlay, 0, &or);
+ dbg(1,"or.x=%d or.y=%d or.width=%d or.height=%d\n", or.x, or.y, or.width, or.height);
+ if (! gdk_rectangle_intersect(r, &or, &ir))
+ return;
+ or.x-=r->x;
+ or.y-=r->y;
+ pixbuf=gdk_pixbuf_get_from_drawable(NULL, overlay->drawable, NULL, 0, 0, 0, 0, or.width, or.height);
+ pixbuf2=gdk_pixbuf_new(gdk_pixbuf_get_colorspace(pixbuf), TRUE, gdk_pixbuf_get_bits_per_sample(pixbuf),
+ or.width, or.height);
+ rowstride1 = gdk_pixbuf_get_rowstride (pixbuf);
+ rowstride2 = gdk_pixbuf_get_rowstride (pixbuf2);
+ pixels1=gdk_pixbuf_get_pixels (pixbuf);
+ pixels2=gdk_pixbuf_get_pixels (pixbuf2);
+ n_channels1 = gdk_pixbuf_get_n_channels (pixbuf);
+ n_channels2 = gdk_pixbuf_get_n_channels (pixbuf2);
+ for (y = 0 ; y < or.height ; y++) {
+ for (x = 0 ; x < or.width ; x++) {
+ p1 = pixels1 + y * rowstride1 + x * n_channels1;
+ p2 = pixels2 + y * rowstride2 + x * n_channels2;
+ p2[0]=p1[0];
+ p2[1]=p1[1];
+ p2[2]=p1[2];
+ if (bg && p1[0] == bg->r && p1[1] == bg->g && p1[2] == bg->b)
+ p2[3]=bg->a;
+ else
+ p2[3]=overlay->a;
+ }
+ }
+ gdk_draw_pixbuf(pixmap, gc, pixbuf2, 0, 0, or.x, or.y, or.width, or.height, GDK_RGB_DITHER_NONE, 0, 0);
+ g_object_unref(pixbuf);
+ g_object_unref(pixbuf2);
+}
+
+static void
+draw_restore(struct graphics_priv *gr, struct point *p, int w, int h)
+{
+ GtkWidget *widget=gr->widget;
+ gdk_draw_drawable(widget->window,
+ widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
+ gr->drawable,
+ p->x, p->y, p->x, p->y, w, h);
+
+}
+
+static void
+draw_drag(struct graphics_priv *gr, struct point *p)
+{
+ if (!gr->cleanup) {
+ gr->pclean=gr->p;
+ gr->cleanup=1;
+ }
+ if (p)
+ gr->p=*p;
+ else {
+ gr->p.x=0;
+ gr->p.y=0;
+ }
+}
+
+
+static void
+background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
+{
+ gr->background_gc=gc;
+}
+
+static void
+gtk_drawing_area_draw(struct graphics_priv *gr, GdkRectangle *r)
+{
+ GdkPixmap *pixmap;
+ GtkWidget *widget=gr->widget;
+ GdkGC *gc=widget->style->fg_gc[GTK_WIDGET_STATE(widget)];
+ struct graphics_priv *overlay;
+
+ if (! gr->drawable)
+ return;
+ pixmap = gdk_pixmap_new(widget->window, r->width, r->height, -1);
+ if ((gr->p.x || gr->p.y) && gr->background_gc)
+ gdk_draw_rectangle(pixmap, gr->background_gc->gc, TRUE, 0, 0, r->width, r->height);
+ gdk_draw_drawable(pixmap, gc, gr->drawable, r->x, r->y, gr->p.x, gr->p.y, r->width, r->height);
+ overlay=gr->overlays;
+ while (overlay) {
+ overlay_draw(gr,overlay,r,pixmap,gc);
+ overlay=overlay->next;
+ }
+ gdk_draw_drawable(widget->window, gc, pixmap, 0, 0, r->x, r->y, r->width, r->height);
+ g_object_unref(pixmap);
+}
+
+static void
+draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
+{
+ GdkRectangle r;
+ struct graphics_priv *overlay;
+#if 0
+ if (mode == draw_mode_begin) {
+ if (! gr->parent && gr->background_gc)
+ gdk_draw_rectangle(gr->drawable, gr->background_gc->gc, TRUE, 0, 0, gr->width, gr->height);
+ }
+#endif
+ if (mode == draw_mode_end && gr->mode != draw_mode_cursor) {
+ if (gr->parent) {
+ if (gr->cleanup) {
+ overlay_rect(gr->parent, gr, 1, &r);
+ gtk_drawing_area_draw(gr->parent, &r);
+ gr->cleanup=0;
+ }
+ overlay_rect(gr->parent, gr, 0, &r);
+ gtk_drawing_area_draw(gr->parent, &r);
+ } else {
+ r.x=0;
+ r.y=0;
+ r.width=gr->width;
+ r.height=gr->height;
+ gtk_drawing_area_draw(gr, &r);
+ overlay=gr->overlays;
+ while (overlay) {
+ overlay->cleanup=0;
+ overlay=overlay->next;
+ }
+ }
+ }
+ gr->mode=mode;
+}
+
+/* Events */
+
+static gint
+configure(GtkWidget * widget, GdkEventConfigure * event, gpointer user_data)
+{
+ struct graphics_priv *gra=user_data;
+ if (! gra->visible)
+ return TRUE;
+ if (gra->drawable != NULL) {
+ g_object_unref(gra->drawable);
+ }
+ if(gra->background_ready && gra->background != NULL) {
+ g_object_unref(gra->background);
+ gra->background_ready = 0;
+ }
+#ifndef _WIN32
+ dbg(1,"window=%d\n", GDK_WINDOW_XID(widget->window));
+#endif
+ gra->width=widget->allocation.width;
+ gra->height=widget->allocation.height;
+ gra->drawable = gdk_pixmap_new(widget->window, gra->width, gra->height, -1);
+ callback_list_call_attr_2(gra->cbl, attr_resize, (void *)gra->width, (void *)gra->height);
+ return TRUE;
+}
+
+static gint
+expose(GtkWidget * widget, GdkEventExpose * event, gpointer user_data)
+{
+ struct graphics_priv *gra=user_data;
+
+ gra->visible=1;
+ if (! gra->drawable)
+ configure(widget, NULL, user_data);
+ gtk_drawing_area_draw(gra, &event->area);
+#if 0
+ gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
+ gra->drawable, event->area.x, event->area.y,
+ event->area.x, event->area.y,
+ event->area.width, event->area.height);
+#endif
+
+ return FALSE;
+}
+
+#if 0
+static gint
+button_timeout(gpointer user_data)
+{
+#if 0
+ struct container *co=user_data;
+ int x=co->gra->gra->button_event.x;
+ int y=co->gra->gra->button_event.y;
+ int button=co->gra->gra->button_event.button;
+
+ co->gra->gra->button_timeout=0;
+ popup(co, x, y, button);
+
+ return FALSE;
+#endif
+}
+#endif
+
+static int
+tv_delta(struct timeval *old, struct timeval *new)
+{
+ if (new->tv_sec-old->tv_sec >= INT_MAX/1000)
+ return INT_MAX;
+ return (new->tv_sec-old->tv_sec)*1000+(new->tv_usec-old->tv_usec)/1000;
+}
+
+static gint
+button_press(GtkWidget * widget, GdkEventButton * event, gpointer user_data)
+{
+ struct graphics_priv *this=user_data;
+ struct point p;
+ struct timeval tv;
+ struct timezone tz;
+
+ gettimeofday(&tv, &tz);
+
+ if (event->button < 8) {
+ if (tv_delta(&this->button_press[event->button], &tv) < 100)
+ return FALSE;
+ this->button_press[event->button]= tv;
+ this->button_release[event->button].tv_sec=0;
+ this->button_release[event->button].tv_usec=0;
+ }
+ p.x=event->x;
+ p.y=event->y;
+ callback_list_call_attr_3(this->cbl, attr_button, (void *)1, (void *)event->button, (void *)&p);
+ return FALSE;
+}
+
+static gint
+button_release(GtkWidget * widget, GdkEventButton * event, gpointer user_data)
+{
+ struct graphics_priv *this=user_data;
+ struct point p;
+ struct timeval tv;
+ struct timezone tz;
+
+ gettimeofday(&tv, &tz);
+
+ if (event->button < 8) {
+ if (tv_delta(&this->button_release[event->button], &tv) < 100)
+ return FALSE;
+ this->button_release[event->button]= tv;
+ this->button_press[event->button].tv_sec=0;
+ this->button_press[event->button].tv_usec=0;
+ }
+ p.x=event->x;
+ p.y=event->y;
+ callback_list_call_attr_3(this->cbl, attr_button, (void *)0, (void *)event->button, (void *)&p);
+ return FALSE;
+}
+
+
+
+static gint
+scroll(GtkWidget * widget, GdkEventScroll * event, gpointer user_data)
+{
+ struct graphics_priv *this=user_data;
+ struct point p;
+ int button;
+
+ p.x=event->x;
+ p.y=event->y;
+ switch (event->direction) {
+ case GDK_SCROLL_UP:
+ button=4;
+ break;
+ case GDK_SCROLL_DOWN:
+ button=5;
+ break;
+ default:
+ button=-1;
+ break;
+ }
+ if (button != -1) {
+ callback_list_call_attr_3(this->cbl, attr_button, (void *)1, (void *)button, (void *)&p);
+ callback_list_call_attr_3(this->cbl, attr_button, (void *)0, (void *)button, (void *)&p);
+ }
+ return FALSE;
+}
+
+static gint
+motion_notify(GtkWidget * widget, GdkEventMotion * event, gpointer user_data)
+{
+ struct graphics_priv *this=user_data;
+ struct point p;
+
+ p.x=event->x;
+ p.y=event->y;
+ callback_list_call_attr_1(this->cbl, attr_motion, (void *)&p);
+ return FALSE;
+}
+
+/* *
+ * * Exit navit (X pressed)
+ * * @param widget active widget
+ * * @param event the event (delete_event)
+ * * @param nav our Navit context
+ * * @returns TRUE
+ * */
+static gint
+delete(GtkWidget *widget, GdkEventKey *event, struct navit *nav)
+{
+ navit_destroy(nav);
+ return TRUE;
+}
+
+static gint
+keypress(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
+{
+ struct graphics_priv *this=user_data;
+ int len,ucode;
+ char key[8];
+ ucode=gdk_keyval_to_unicode(event->keyval);
+ len=g_unichar_to_utf8(ucode, key);
+ key[len]='\0';
+
+ switch (event->keyval) {
+ case GDK_Up:
+ key[0]=NAVIT_KEY_UP;
+ key[1]='\0';
+ break;
+ case GDK_Down:
+ key[0]=NAVIT_KEY_DOWN;
+ key[1]='\0';
+ break;
+ case GDK_Left:
+ key[0]=NAVIT_KEY_LEFT;
+ key[1]='\0';
+ break;
+ case GDK_Right:
+ key[0]=NAVIT_KEY_RIGHT;
+ key[1]='\0';
+ break;
+ case GDK_BackSpace:
+ key[0]=NAVIT_KEY_BACKSPACE;
+ key[1]='\0';
+ break;
+ case GDK_Return:
+ case GDK_KP_Enter:
+ key[0]=NAVIT_KEY_RETURN;
+ key[1]='\0';
+ break;
+ case GDK_Book:
+#ifdef USE_HILDON
+ case GDK_F7:
+#endif
+ key[0]=NAVIT_KEY_ZOOM_IN;
+ key[1]='\0';
+ break;
+ case GDK_Calendar:
+#ifdef USE_HILDON
+ case GDK_F8:
+#endif
+ key[0]=NAVIT_KEY_ZOOM_OUT;
+ key[1]='\0';
+ break;
+ }
+ if (key[0])
+ callback_list_call_attr_1(this->cbl, attr_keypress, (void *)key);
+ else
+ dbg(0,"keyval 0x%x\n", event->keyval);
+
+ return FALSE;
+}
+
+static struct graphics_priv *graphics_gtk_drawing_area_new_helper(struct graphics_methods *meth);
+
+static void
+overlay_disable(struct graphics_priv *gr, int disabled)
+{
+ gr->overlay_disabled=disabled;
+}
+
+static void
+overlay_resize(struct graphics_priv *this, struct point *p, int w, int h, int alpha, int wraparound)
+{
+ int changed = 0;
+ int w2,h2;
+
+ if (w == 0) {
+ w2 = 1;
+ } else {
+ w2 = w;
+ }
+
+ if (h == 0) {
+ h2 = 1;
+ } else {
+ h2 = h;
+ }
+
+ this->p = *p;
+ if (this->width != w2) {
+ this->width = w2;
+ changed = 1;
+ }
+
+ if (this->height != h2) {
+ this->height = h2;
+ changed = 1;
+ }
+
+ this->a = alpha >> 8;
+ this->wraparound = wraparound;
+
+ if (changed) {
+ // Set the drawables to the right sizes
+ g_object_unref(this->drawable);
+ g_object_unref(this->background);
+
+ this->drawable=gdk_pixmap_new(this->parent->widget->window, w2, h2, -1);
+ this->background=gdk_pixmap_new(this->parent->widget->window, w2, h2, -1);
+
+ if ((w == 0) || (h == 0)) {
+ this->overlay_autodisabled = 1;
+ } else {
+ this->overlay_autodisabled = 0;
+ }
+
+ callback_list_call_attr_2(this->cbl, attr_resize, (void *)this->width, (void *)this->height);
+ }
+}
+
+static struct graphics_priv *
+overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int alpha, int wraparound)
+{
+ int w2,h2;
+ struct graphics_priv *this=graphics_gtk_drawing_area_new_helper(meth);
+ this->colormap=gr->colormap;
+ this->widget=gr->widget;
+ this->p=*p;
+ this->width=w;
+ this->height=h;
+ this->parent=gr;
+
+ /* If either height or width is 0, we set it to 1 to avoid warnings, and
+ * disable the overlay. */
+ if (h == 0) {
+ h2 = 1;
+ } else {
+ h2 = h;
+ }
+
+ if (w == 0) {
+ w2 = 1;
+ } else {
+ w2 = w;
+ }
+
+ this->background=gdk_pixmap_new(gr->widget->window, w2, h2, -1);
+ this->drawable=gdk_pixmap_new(gr->widget->window, w2, h2, -1);
+
+ if ((w == 0) || (h == 0)) {
+ this->overlay_autodisabled = 1;
+ } else {
+ this->overlay_autodisabled = 0;
+ }
+
+ this->next=gr->overlays;
+ this->a=alpha >> 8;
+ this->wraparound=wraparound;
+ gr->overlays=this;
+ return this;
+}
+
+static int gtk_argc;
+static char **gtk_argv={NULL};
+
+
+static int
+graphics_gtk_drawing_area_fullscreen(struct window *w, int on)
+{
+ struct graphics_priv *gr=w->priv;
+ if (on)
+ gtk_window_fullscreen(GTK_WINDOW(gr->win));
+ else
+ gtk_window_unfullscreen(GTK_WINDOW(gr->win));
+ return 1;
+}
+
+static void
+graphics_gtk_drawing_area_disable_suspend(struct window *w)
+{
+ struct graphics_priv *gr=w->priv;
+
+#ifndef _WIN32
+ if (gr->pid)
+ kill(gr->pid, SIGWINCH);
+#else
+ dbg(1, "failed to kill() under Windows\n");
+#endif
+}
+
+static void *
+get_data(struct graphics_priv *this, char *type)
+{
+ FILE *f;
+ if (!strcmp(type,"gtk_widget"))
+ return this->widget;
+#ifndef _WIN32
+ if (!strcmp(type,"xwindow_id"))
+ return (void *)GDK_WINDOW_XID(this->widget->window);
+#endif
+ if (!strcmp(type,"window")) {
+ char *cp = getenv("NAVIT_XID");
+ unsigned xid = 0;
+ if (cp)
+ xid = strtol(cp, NULL, 0);
+ if (!xid)
+ this->win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ else
+ this->win = gtk_plug_new(xid);
+ gtk_window_set_default_size(GTK_WINDOW(this->win), this->win_w, this->win_h);
+ dbg(1,"h= %i, w= %i\n",this->win_h, this->win_w);
+ gtk_window_set_title(GTK_WINDOW(this->win), "Navit");
+ gtk_window_set_wmclass (GTK_WINDOW (this->win), "navit", "Navit");
+ gtk_widget_realize(this->win);
+ gtk_container_add(GTK_CONTAINER(this->win), this->widget);
+ gtk_widget_show_all(this->win);
+ GTK_WIDGET_SET_FLAGS (this->widget, GTK_CAN_FOCUS);
+ gtk_widget_set_sensitive(this->widget, TRUE);
+ gtk_widget_grab_focus(this->widget);
+ g_signal_connect(G_OBJECT(this->widget), "key-press-event", G_CALLBACK(keypress), this);
+ g_signal_connect(G_OBJECT(this->win), "delete_event", G_CALLBACK(delete), this->nav);
+ this->window.fullscreen=graphics_gtk_drawing_area_fullscreen;
+ this->window.disable_suspend=graphics_gtk_drawing_area_disable_suspend;
+ this->window.priv=this;
+#if !defined(_WIN32) && !defined(__CEGCC__)
+ f=popen("pidof /usr/bin/ipaq-sleep","r");
+ if (f) {
+ fscanf(f,"%d",&this->pid);
+ dbg(1,"ipaq_sleep pid=%d\n", this->pid);
+ pclose(f);
+ }
+#endif
+ return &this->window;
+ }
+ return NULL;
+}
+
+static struct graphics_methods graphics_methods = {
+ graphics_destroy,
+ draw_mode,
+ draw_lines,
+ draw_polygon,
+ draw_rectangle,
+ draw_circle,
+ draw_text,
+ draw_image,
+#ifdef HAVE_IMLIB2
+ draw_image_warp,
+#else
+ NULL,
+#endif
+ draw_restore,
+ draw_drag,
+ NULL,
+ gc_new,
+ background_gc,
+ overlay_new,
+ image_new,
+ get_data,
+ image_free,
+ NULL,
+ overlay_disable,
+ overlay_resize,
+};
+
+static struct graphics_priv *
+graphics_gtk_drawing_area_new_helper(struct graphics_methods *meth)
+{
+ struct font_priv * (*font_freetype_new)(void *meth);
+ font_freetype_new=plugin_get_font_type("freetype");
+ if (!font_freetype_new)
+ return NULL;
+ struct graphics_priv *this=g_new0(struct graphics_priv,1);
+ font_freetype_new(&this->freetype_methods);
+ *meth=graphics_methods;
+ meth->font_new=(struct graphics_font_priv *(*)(struct graphics_priv *, struct graphics_font_methods *, char *, int, int))this->freetype_methods.font_new;
+ meth->get_text_bbox=this->freetype_methods.get_text_bbox;
+
+ return this;
+}
+
+static struct graphics_priv *
+graphics_gtk_drawing_area_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl)
+{
+ int i;
+ GtkWidget *draw;
+ struct attr *attr;
+
+ if (! event_request_system("glib","graphics_gtk_drawing_area_new"))
+ return NULL;
+
+ draw=gtk_drawing_area_new();
+ struct graphics_priv *this=graphics_gtk_drawing_area_new_helper(meth);
+ this->nav = nav;
+ this->widget=draw;
+ this->win_w=792;
+ if ((attr=attr_search(attrs, NULL, attr_w)))
+ this->win_w=attr->u.num;
+ this->win_h=547;
+ if ((attr=attr_search(attrs, NULL, attr_h)))
+ this->win_h=attr->u.num;
+ this->cbl=cbl;
+ this->colormap=gdk_colormap_new(gdk_visual_get_system(),FALSE);
+ gtk_widget_set_events(draw, GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK|GDK_POINTER_MOTION_MASK|GDK_KEY_PRESS_MASK);
+ g_signal_connect(G_OBJECT(draw), "expose_event", G_CALLBACK(expose), this);
+ g_signal_connect(G_OBJECT(draw), "configure_event", G_CALLBACK(configure), this);
+ g_signal_connect(G_OBJECT(draw), "button_press_event", G_CALLBACK(button_press), this);
+ g_signal_connect(G_OBJECT(draw), "button_release_event", G_CALLBACK(button_release), this);
+ g_signal_connect(G_OBJECT(draw), "scroll_event", G_CALLBACK(scroll), this);
+ g_signal_connect(G_OBJECT(draw), "motion_notify_event", G_CALLBACK(motion_notify), this);
+ g_signal_connect(G_OBJECT(draw), "delete_event", G_CALLBACK(delete), nav);
+
+ for (i = 0; i < 8; i++) {
+ this->button_press[i].tv_sec = 0;
+ this->button_press[i].tv_usec = 0;
+ this->button_release[i].tv_sec = 0;
+ this->button_release[i].tv_usec = 0;
+ }
+
+ return this;
+}
+
+void
+plugin_init(void)
+{
+ gtk_init(&gtk_argc, &gtk_argv);
+ gtk_set_locale();
+ plugin_register_graphics_type("gtk_drawing_area", graphics_gtk_drawing_area_new);
+}
diff --git a/graphics/gtk_gl_ext/graphics_gtk_gl_ext.c b/graphics/gtk_gl_ext/graphics_gtk_gl_ext.c
new file mode 100644
index 00000000..7c94e0bd
--- /dev/null
+++ b/graphics/gtk_gl_ext/graphics_gtk_gl_ext.c
@@ -0,0 +1,352 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdlib.h>
+#include <gtk/gtk.h>
+#include <gtk/gtkgl.h>
+#include <GL/gl.h>
+#include <GL/glu.h>
+#include "point.h"
+#include "graphics.h"
+#include "container.h"
+
+
+struct graphics_gra {
+ GtkWidget *widget;
+ int width;
+ int height;
+ int library_init;
+ int visible;
+ int buffer;
+};
+
+struct graphics_font {
+};
+
+struct graphics_gc {
+ double fr,fg,fb;
+ double br,bg,bb;
+ double width;
+ struct graphics_gra *gra;
+};
+
+static struct graphics_font *font_new(struct graphics *gr, int size)
+{
+ struct graphics_font *font=g_new(struct graphics_font, 1);
+ return font;
+}
+
+static struct graphics_gc *gc_new(struct graphics *gr)
+{
+ struct graphics_gc *gc=g_new(struct graphics_gc, 1);
+
+ gc->fr=1;
+ gc->fg=1;
+ gc->fb=1;
+ gc->br=0;
+ gc->bg=0;
+ gc->bb=0;
+ gc->width=1;
+ gc->gra=gr->gra;
+ return gc;
+}
+
+static void
+gc_set_linewidth(struct graphics_gc *gc, int w)
+{
+ gc->width=w;
+}
+
+static void
+gc_set_foreground(struct graphics_gc *gc, int r, int g, int b)
+{
+ gc->fr=r/65535.0;
+ gc->fg=g/65535.0;
+ gc->fb=b/65535.0;
+}
+
+static void
+gc_set_background(struct graphics_gc *gc, int r, int g, int b)
+{
+ gc->br=r/65535.0;
+ gc->bg=g/65535.0;
+ gc->bb=b/65535.0;
+}
+
+static void
+vertex(struct point *p)
+{
+ double x,y;
+ x=p->x;
+ y=p->y;
+ x/=792;
+ y/=469;
+ x-=0.5;
+ y=0.5-y;
+ glVertex3f(x,y,0);
+}
+
+static void
+draw_lines(struct graphics *gr, struct graphics_gc *gc, struct point *p, int count)
+{
+ int i;
+
+ glLineWidth(gc->width);
+ glColor3f(gc->fr, gc->fg, gc->fb);
+ glBegin(GL_LINE_STRIP);
+ for (i=0 ; i < count ; i++)
+ vertex(p++);
+ glEnd();
+}
+
+static void
+draw_polygon(struct graphics *gr, struct graphics_gc *gc, struct point *p, int count)
+{
+ int i;
+ double x,y;
+ glColor3f(gc->fr, gc->fg, gc->fb);
+ glBegin(GL_POLYGON);
+ for (i=0 ; i < count ; i++)
+ vertex(p++);
+ glEnd();
+}
+
+
+static void
+draw_circle(struct graphics *gr, struct graphics_gc *gc, struct point *p, int r)
+{
+
+}
+
+static void
+draw_text(struct graphics *gr, struct graphics_gc *fg, struct graphics_gc *bg, struct graphics_font *font, unsigned char *text, int x, int y, int dx, int dy)
+{
+}
+
+static void
+draw_begin(struct graphics *gr)
+{
+ printf("draw_begin\n");
+ glClearColor(gr->gc[0]->br, gr->gc[0]->bg, gr->gc[0]->bb, 0);
+ glNewList(1, GL_COMPILE);
+ gr->gra->buffer=1;
+}
+
+static void
+draw_end(struct graphics *gr)
+{
+ printf("draw_end\n");
+ glEndList();
+ gr->gra->buffer=0;
+}
+
+static void realize(GtkWidget * widget, gpointer data)
+{
+ GdkGLContext *glcontext = gtk_widget_get_gl_context(widget);
+ GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable(widget);
+
+ GLUquadricObj *qobj;
+ static GLfloat light_diffuse[] = { 1.0, 0.0, 0.0, 1.0 };
+ static GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 };
+
+ /*** OpenGL BEGIN ***/
+ if (!gdk_gl_drawable_gl_begin(gldrawable, glcontext))
+ return;
+
+ qobj = gluNewQuadric();
+ gluQuadricDrawStyle(qobj, GLU_FILL);
+#if 0
+ glNewList(1, GL_COMPILE);
+ gluSphere(qobj, 1.0, 20, 20);
+ glBegin(GL_LINE_STRIP);
+ glVertex3f(0.0,0.1,0.0);
+ glVertex3f(0.1,0.1,0.0);
+ glVertex3f(0.1,0.2,0.0);
+ glVertex3f(0.2,0.2,0.0);
+ glEnd();
+ glEndList();
+#endif
+
+#if 0
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
+ glLightfv(GL_LIGHT0, GL_POSITION, light_position);
+ glEnable(GL_LIGHTING);
+ glEnable(GL_LIGHT0);
+ glEnable(GL_DEPTH_TEST);
+#endif
+
+ glClearColor(1.0, 1.0, 1.0, 1.0);
+ glClearDepth(1.0);
+
+ glViewport(0, 0,
+ widget->allocation.width, widget->allocation.height);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluPerspective(19.0, 1.0, 1.0, 10.0);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ gluLookAt(0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
+ glTranslatef(0.0, 0.0, 0.0);
+
+ gdk_gl_drawable_gl_end(gldrawable);
+ /*** OpenGL END ***/
+}
+
+static gboolean
+configure(GtkWidget * widget, GdkEventConfigure * event, gpointer user_data)
+{
+ GdkGLContext *glcontext = gtk_widget_get_gl_context(widget);
+ GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable(widget);
+ struct container *co=user_data;
+ struct graphics_gra *gra=co->gra->gra;
+
+
+ printf("configure %d %d\n",gra->width, gra->height);
+ gra->width=widget->allocation.width;
+ gra->height=widget->allocation.height;
+
+ /*** OpenGL BEGIN ***/
+ if (!gdk_gl_drawable_gl_begin(gldrawable, glcontext))
+ return FALSE;
+
+ glViewport(0, 0,
+ widget->allocation.width, widget->allocation.height);
+
+ gdk_gl_drawable_gl_end(gldrawable);
+ /*** OpenGL END ***/
+ if (gra->visible)
+ graphics_resize(co, gra->width, gra->height);
+
+ return TRUE;
+}
+
+static gboolean
+expose(GtkWidget * widget, GdkEventExpose * event, gpointer user_data)
+{
+ GdkGLContext *glcontext = gtk_widget_get_gl_context(widget);
+ GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable(widget);
+ struct container *co=user_data;
+ struct graphics_gra *gra=co->gra->gra;
+
+ printf("expose\n");
+ if (! gra->visible) {
+ gra->visible=1;
+ configure(widget, NULL, user_data);
+ }
+ /*** OpenGL BEGIN ***/
+ if (!gdk_gl_drawable_gl_begin(gldrawable, glcontext))
+ return FALSE;
+
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ glCallList(1);
+
+ if (gdk_gl_drawable_is_double_buffered(gldrawable))
+ gdk_gl_drawable_swap_buffers(gldrawable);
+ else
+ glFlush();
+
+ gdk_gl_drawable_gl_end(gldrawable);
+ /*** OpenGL END ***/
+
+ return TRUE;
+}
+
+
+struct graphics *
+graphics_gtk_gl_area_new(struct container *co, GtkWidget **widget)
+{
+ GdkGLConfig *glconfig;
+ gint major, minor;
+ GtkWidget *drawing_area;
+
+ struct graphics *this=g_new0(struct graphics,1);
+ this->draw_lines=draw_lines;
+ this->draw_polygon=draw_polygon;
+ this->draw_circle=draw_circle;
+ this->draw_text=draw_text;
+#if 0
+ this->draw_begin=draw_begin;
+ this->draw_end=draw_end;
+#endif
+ this->gc_new=gc_new;
+ this->gc_set_linewidth=gc_set_linewidth;
+ this->gc_set_foreground=gc_set_foreground;
+ this->gc_set_background=gc_set_background;
+ this->font_new=font_new;
+ this->gra=g_new0(struct graphics_gra, 1);
+
+ /*
+ * Init GtkGLExt.
+ */
+
+ gtk_gl_init(NULL, NULL);
+
+ /*
+ * Query OpenGL extension version.
+ */
+
+ gdk_gl_query_version(&major, &minor);
+ g_print("OpenGL extension version - %d.%d\n", major, minor);
+
+ /*
+ * Configure OpenGL-capable visual.
+ */
+
+ /* Try double-buffered visual */
+ glconfig = gdk_gl_config_new_by_mode(GDK_GL_MODE_RGB |
+ GDK_GL_MODE_DEPTH |
+ GDK_GL_MODE_DOUBLE);
+ if (glconfig == NULL) {
+ g_print("*** Cannot find the double-buffered visual.\n");
+ g_print("*** Trying single-buffered visual.\n");
+
+ /* Try single-buffered visual */
+ glconfig = gdk_gl_config_new_by_mode(GDK_GL_MODE_RGB |
+ GDK_GL_MODE_DEPTH);
+ if (glconfig == NULL) {
+ g_print
+ ("*** No appropriate OpenGL-capable visual found.\n");
+ exit(1);
+ }
+ }
+
+
+ drawing_area = gtk_drawing_area_new();
+
+ /* Set OpenGL-capability to the widget. */
+ gtk_widget_set_gl_capability(drawing_area,
+ glconfig,
+ NULL, TRUE, GDK_GL_RGBA_TYPE);
+
+ g_signal_connect_after(G_OBJECT(drawing_area), "realize",
+ G_CALLBACK(realize), NULL);
+ g_signal_connect(G_OBJECT(drawing_area), "configure_event",
+ G_CALLBACK(configure), co);
+ g_signal_connect(G_OBJECT(drawing_area), "expose_event",
+ G_CALLBACK(expose), co);
+
+ *widget=drawing_area;
+ this->gra->widget=drawing_area;
+ return this;
+}
+
+
diff --git a/graphics/null/Makefile.am b/graphics/null/Makefile.am
new file mode 100644
index 00000000..9fe6ffc1
--- /dev/null
+++ b/graphics/null/Makefile.am
@@ -0,0 +1,9 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=graphics_null
+if PLUGINS
+modulegraphics_LTLIBRARIES = libgraphics_null.la
+else
+noinst_LTLIBRARIES = libgraphics_null.la
+endif
+libgraphics_null_la_SOURCES = graphics_null.c
+libgraphics_null_la_LDFLAGS = -module -avoid-version
diff --git a/graphics/null/graphics_null.c b/graphics/null/graphics_null.c
new file mode 100644
index 00000000..f1936475
--- /dev/null
+++ b/graphics/null/graphics_null.c
@@ -0,0 +1,231 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include "config.h"
+#include "point.h"
+#include "graphics.h"
+#include "color.h"
+#include "plugin.h"
+
+static int dummy;
+static struct graphics_priv {
+ int dummy;
+} graphics_priv;
+
+static struct graphics_font_priv {
+ int dummy;
+} graphics_font_priv;
+
+static struct graphics_gc_priv {
+ int dummy;
+} graphics_gc_priv;
+
+static struct graphics_image_priv {
+ int dummy;
+} graphics_image_priv;
+
+static void
+graphics_destroy(struct graphics_priv *gr)
+{
+}
+
+static void font_destroy(struct graphics_font_priv *font)
+{
+
+}
+
+static struct graphics_font_methods font_methods = {
+ font_destroy
+};
+
+static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, char *font, int size, int flags)
+{
+ *meth=font_methods;
+ return &graphics_font_priv;
+}
+
+static void
+gc_destroy(struct graphics_gc_priv *gc)
+{
+}
+
+static void
+gc_set_linewidth(struct graphics_gc_priv *gc, int w)
+{
+}
+
+static void
+gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n)
+{
+}
+
+static void
+gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
+{
+}
+
+static void
+gc_set_background(struct graphics_gc_priv *gc, struct color *c)
+{
+}
+
+static struct graphics_gc_methods gc_methods = {
+ gc_destroy,
+ gc_set_linewidth,
+ gc_set_dashes,
+ gc_set_foreground,
+ gc_set_background
+};
+
+static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth)
+{
+ *meth=gc_methods;
+ return &graphics_gc_priv;
+}
+
+static struct graphics_image_priv *
+image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *path, int *w, int *h, struct point *hot, int rotation)
+{
+ return &graphics_image_priv;
+}
+
+static void
+draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
+{
+}
+
+static void
+draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
+{
+}
+
+static void
+draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
+{
+}
+
+static void
+draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r)
+{
+}
+
+
+static void
+draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
+{
+}
+
+static void
+draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
+{
+}
+
+static void
+draw_image_warp(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, int count, char *data)
+{
+}
+
+static void
+draw_restore(struct graphics_priv *gr, struct point *p, int w, int h)
+{
+}
+
+static void draw_drag(struct graphics_priv *gr, struct point *p)
+{
+}
+
+static void
+background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
+{
+}
+
+static void
+draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
+{
+}
+
+static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int alpha, int wraparound);
+
+static void *
+get_data(struct graphics_priv *this, char *type)
+{
+ return &dummy;
+}
+
+static void image_free(struct graphics_priv *gr, struct graphics_image_priv *priv)
+{
+}
+
+static void get_text_bbox(struct graphics_priv *gr, struct graphics_font_priv *font, char *text, int dx, int dy, struct point *ret, int estimate)
+{
+}
+
+static void overlay_disable(struct graphics_priv *gr, int disable)
+{
+}
+
+static void overlay_resize(struct graphics_priv *gr, struct point *p, int w, int h, int alpha, int wraparound)
+{
+}
+
+static struct graphics_methods graphics_methods = {
+ graphics_destroy,
+ draw_mode,
+ draw_lines,
+ draw_polygon,
+ draw_rectangle,
+ draw_circle,
+ draw_text,
+ draw_image,
+ draw_image_warp,
+ draw_restore,
+ draw_drag,
+ font_new,
+ gc_new,
+ background_gc,
+ overlay_new,
+ image_new,
+ get_data,
+ image_free,
+ get_text_bbox,
+ overlay_disable,
+ overlay_resize,
+};
+
+static struct graphics_priv *
+overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int alpha, int wraparound)
+{
+ *meth=graphics_methods;
+ return &graphics_priv;
+}
+
+
+static struct graphics_priv *
+graphics_null_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl)
+{
+ *meth=graphics_methods;
+ return &graphics_priv;
+}
+
+void
+plugin_init(void)
+{
+ plugin_register_graphics_type("null", graphics_null_new);
+}
diff --git a/graphics/opengl/Makefile.am b/graphics/opengl/Makefile.am
new file mode 100644
index 00000000..02d356dd
--- /dev/null
+++ b/graphics/opengl/Makefile.am
@@ -0,0 +1,6 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ @OPENGL_CFLAGS@ @GLC_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=graphics_opengl
+modulegraphics_LTLIBRARIES = libgraphics_opengl.la
+libgraphics_opengl_la_SOURCES = graphics_opengl.c
+libgraphics_opengl_la_LIBADD = @OPENGL_LIBS@ @GLC_LIBS@
+libgraphics_opengl_la_LDFLAGS = -module -avoid-version
diff --git a/graphics/opengl/graphics_opengl.c b/graphics/opengl/graphics_opengl.c
new file mode 100644
index 00000000..a7163035
--- /dev/null
+++ b/graphics/opengl/graphics_opengl.c
@@ -0,0 +1,845 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <math.h>
+#include <glib.h>
+#include "config.h"
+#include <GL/glc.h>
+#include "point.h"
+#include "graphics.h"
+#include "color.h"
+#include "plugin.h"
+
+#include "debug.h"
+
+#include <GL/glut.h>
+
+
+void CALLBACK tessBeginCB(GLenum which);
+void CALLBACK tessEndCB();
+void CALLBACK tessErrorCB(GLenum errorCode);
+void CALLBACK tessVertexCB(const GLvoid *data);
+void CALLBACK tessVertexCB2(const GLvoid *data);
+void CALLBACK tessCombineCB(const GLdouble newVertex[3], const GLdouble *neighborVertex[4],
+ const GLfloat neighborWeight[4], GLdouble **outData);
+
+
+struct graphics_priv {
+ int button_timeout;
+ struct point p;
+ int width;
+ int height;
+ int library_init;
+ int visible;
+ struct graphics_priv *parent;
+ struct graphics_priv *overlays;
+ struct graphics_priv *next;
+ struct graphics_gc_priv *background_gc;
+ enum draw_mode_num mode;
+ void (*resize_callback)(void *data, int w, int h);
+ void *resize_callback_data;
+ void (*motion_callback)(void *data, struct point *p);
+ void *motion_callback_data;
+ void (*button_callback)(void *data, int press, int button, struct point *p);
+ void *button_callback_data;
+ GLuint DLid;
+};
+
+struct graphics_font_priv {
+#if 0
+ FT_Face face;
+#endif
+};
+
+struct graphics_gc_priv {
+ struct graphics_priv *gr;
+ float fr,fg,fb,fa;
+ float br,bg,bb,ba;
+ int linewidth;
+};
+
+struct graphics_image_priv {
+ int w;
+ int h;
+};
+
+static void
+graphics_destroy(struct graphics_priv *gr)
+{
+}
+
+int frame=0;
+
+// http://quesoglc.sourceforge.net/tutorial.php
+
+
+static void font_destroy(struct graphics_font_priv *font)
+{
+ g_free(font);
+ /* TODO: free font->face */
+}
+
+static struct graphics_font_methods font_methods = {
+ font_destroy
+};
+
+static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, char *fontfamily, int size)
+{
+#if 0
+ char **filename=fontlist;
+ struct graphics_font_priv *font=g_new(struct graphics_font_priv, 1);
+
+ *meth=font_methods;
+
+ if (!gr->library_init) {
+ FT_Init_FreeType( &gr->library );
+ gr->library_init=1;
+ }
+
+ while (*filename) {
+ if (!FT_New_Face( gr->library, *filename, 0, &font->face ))
+ break;
+ filename++;
+ }
+ if (! *filename) {
+ g_warning("Failed to load font, no labelling");
+ g_free(font);
+ return NULL;
+ }
+ FT_Set_Char_Size(font->face, 0, size, 300, 300);
+ FT_Select_Charmap(font->face, FT_ENCODING_UNICODE);
+ return font;
+#endif
+ return NULL;
+}
+
+static void
+gc_destroy(struct graphics_gc_priv *gc)
+{
+ g_free(gc);
+}
+
+static void
+gc_set_linewidth(struct graphics_gc_priv *gc, int w)
+{
+ gc->linewidth=w;
+}
+
+static void
+gc_set_dashes(struct graphics_gc_priv *gc, int width, int offset, unsigned char *dash_list, int n)
+{
+#if 0
+ gdk_gc_set_dashes(gc->gc, offset, (gint8 *)dash_list, n);
+ gdk_gc_set_line_attributes(gc->gc, width, GDK_LINE_ON_OFF_DASH, GDK_CAP_ROUND, GDK_JOIN_ROUND);
+#endif
+}
+
+
+static void
+gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
+{
+ gc->fr=c->r/65535.0;
+ gc->fg=c->g/65535.0;
+ gc->fb=c->b/65535.0;
+ gc->fa=c->a/65535.0;
+// printf("new alpha : %i\n",c->a);
+}
+
+static void
+gc_set_background(struct graphics_gc_priv *gc, struct color *c)
+{
+ gc->br=c->r/65535.0;
+ gc->bg=c->g/65535.0;
+ gc->bb=c->b/65535.0;
+ gc->ba=c->a/65535.0;
+}
+
+static struct graphics_gc_methods gc_methods = {
+ gc_destroy,
+ gc_set_linewidth,
+ gc_set_dashes,
+ gc_set_foreground,
+ gc_set_background
+};
+
+static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth)
+{
+ struct graphics_gc_priv *gc=g_new(struct graphics_gc_priv, 1);
+
+ *meth=gc_methods;
+ gc->gr=gr;
+ gc->linewidth=1;
+ return gc;
+}
+
+
+static struct graphics_image_priv *
+image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h)
+{
+#if 0
+ GdkPixbuf *pixbuf;
+ struct graphics_image_priv *ret;
+
+ pixbuf=gdk_pixbuf_new_from_file(name, NULL);
+ if (! pixbuf)
+ return NULL;
+ ret=g_new0(struct graphics_image_priv, 1);
+ ret->pixbuf=pixbuf;
+ ret->w=gdk_pixbuf_get_width(pixbuf);
+ ret->h=gdk_pixbuf_get_height(pixbuf);
+ *w=ret->w;
+ *h=ret->h;
+ return ret;
+#endif
+ return NULL;
+}
+
+static void
+draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
+{
+ int i;
+/*
+ if (gr->mode == draw_mode_begin || gr->mode == draw_mode_end)
+ gdk_draw_lines(gr->drawable, gc->gc, (GdkPoint *)p, count);
+ if (gr->mode == draw_mode_end || gr->mode == draw_mode_cursor)
+ gdk_draw_lines(gr->widget->window, gc->gc, (GdkPoint *)p, count);
+*/
+ /*
+ if(gr->mode == draw_mode_begin){
+ printf("B");
+ } else if (gr->mode == draw_mode_end){
+ printf("E");
+ } else {
+ printf("x");
+ }
+*/
+
+ for (i = 0 ; i < count-1 ; i++) {
+
+// glEnable( GL_POLYGON_SMOOTH );
+// glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+// glEnable( GL_BLEND );
+
+ float dx=p[i+1].x-p[i].x;
+ float dy=p[i+1].y-p[i].y;
+
+ float cx=(p[i+1].x+p[i].x)/2;
+ float cy=(p[i+1].y+p[i].y)/2;
+// printf("(%lx,%lx) -> (%lx,%lx) : (%lx,%lx)\n",p[i].x,p[i].y,p[i+1].x,p[i+1].y,dx,dy);
+
+ int w=round(sqrt(pow((dx),2)+pow((dy),2)));
+
+ float angle=atan (dy/dx) * 180 / M_PI;
+
+ glPushMatrix();
+ glTranslatef(cx,cy,1);
+ // glColor4f( 0,0,0,1);
+ // glRasterPos2f( 1,1 );
+ glRotatef(angle,0.0,0.0,1.0);
+
+ glColor4f( gc->fr, gc->fg, gc->fb, gc->fa);
+
+ int linewidth=gc->linewidth;
+
+ glBegin( GL_POLYGON );
+ glVertex2f( -w/2,-linewidth/2 );
+ glVertex2f( -w/2-4,0 );
+ glVertex2f( -w/2,+linewidth/2 );
+ glVertex2f( +w/2,+linewidth/2 );
+ glVertex2f( +w/2+4,0 );
+ glVertex2f( +w/2,-linewidth/2 );
+ glVertex2f( -w/2,+linewidth/2 );
+ glEnd();
+
+
+ // FIXME Roads label can maybe be drawn here, avoid the display_label loop, when playing with Z axis position.
+ /*
+ if(attr==1){
+ glcRenderStyle(GLC_TEXTURE);
+ glColor3f(0., 0., 0.);
+ glScalef(12, 12, 0.);
+ glcRenderString(">>");
+ } else if(attr==-1){
+ glcRenderStyle(GLC_TEXTURE);
+ glColor3f(0., 0., 0.);
+ glScalef(12, 12, 0.);
+ glcRenderString("<<");
+ }
+
+ */
+ glPopMatrix();
+ }
+// glDisable( GL_BLEND );
+// glDisable( GL_POLYGON_SMOOTH );
+
+/*
+ if(label){
+ if((strlen(label)*6)<w){
+ SDL_print(label,cx, cy,-angle);
+ }
+ }
+*/
+}
+
+
+const char* getPrimitiveType(GLenum type)
+{
+ switch(type)
+ {
+ case 0x0000:
+ return "GL_POINTS";
+ break;
+ case 0x0001:
+ return "GL_LINES";
+ break;
+ case 0x0002:
+ return "GL_LINE_LOOP";
+ break;
+ case 0x0003:
+ return "GL_LINE_STRIP";
+ break;
+ case 0x0004:
+ return "GL_TRIANGLES";
+ break;
+ case 0x0005:
+ return "GL_TRIANGLE_STRIP";
+ break;
+ case 0x0006:
+ return "GL_TRIANGLE_FAN";
+ break;
+ case 0x0007:
+ return "GL_QUADS";
+ break;
+ case 0x0008:
+ return "GL_QUAD_STRIP";
+ break;
+ case 0x0009:
+ return "GL_POLYGON";
+ break;
+ }
+}
+
+void CALLBACK tessBeginCB(GLenum which)
+{
+ glBegin(which);
+
+ dbg(1,"glBegin( %s );\n",getPrimitiveType(which));
+}
+
+
+
+void CALLBACK tessEndCB()
+{
+ glEnd();
+
+ dbg(1,"glEnd();\n");
+}
+
+
+
+void CALLBACK tessVertexCB(const GLvoid *data)
+{
+ // cast back to double type
+ const GLdouble *ptr = (const GLdouble*)data;
+
+ glVertex3dv(ptr);
+
+ dbg(1," glVertex3d();\n");
+}
+
+
+static void
+draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
+{
+ int i;
+
+ GLUtesselator *tess = gluNewTess(); // create a tessellator
+ if(!tess) return 0; // failed to create tessellation object, return 0
+
+ GLdouble quad1[count][3];
+ for (i = 0 ; i < count ; i++) {
+ quad1[i][0]=(GLdouble)(p[i].x);
+ quad1[i][1]=(GLdouble)(p[i].y);
+ quad1[i][2]=0;
+ }
+
+
+ // register callback functions
+ gluTessCallback(tess, GLU_TESS_BEGIN, (void (*)(void))tessBeginCB);
+ gluTessCallback(tess, GLU_TESS_END, (void (*)(void))tessEndCB);
+ // gluTessCallback(tess, GLU_TESS_ERROR, (void (*)(void))tessErrorCB);
+ gluTessCallback(tess, GLU_TESS_VERTEX, (void (*)(void))tessVertexCB);
+
+ // tessellate and compile a concave quad into display list
+ // gluTessVertex() takes 3 params: tess object, pointer to vertex coords,
+ // and pointer to vertex data to be passed to vertex callback.
+ // The second param is used only to perform tessellation, and the third
+ // param is the actual vertex data to draw. It is usually same as the second
+ // param, but It can be more than vertex coord, for example, color, normal
+ // and UV coords which are needed for actual drawing.
+ // Here, we are looking at only vertex coods, so the 2nd and 3rd params are
+ // pointing same address.
+ glColor4f( gc->fr, gc->fg, gc->fb, gc->fa);
+ gluTessBeginPolygon(tess, 0); // with NULL data
+ gluTessBeginContour(tess);
+ for (i = 0 ; i < count ; i++) {
+ gluTessVertex(tess, quad1[i], quad1[i]);
+ }
+ gluTessEndContour(tess);
+ gluTessEndPolygon(tess);
+
+ gluDeleteTess(tess); // delete after tessellation
+
+}
+
+static void
+draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
+{
+#if 0
+ gdk_draw_rectangle(gr->drawable, gc->gc, TRUE, p->x, p->y, w, h);
+#endif
+}
+
+static void
+draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r)
+{
+#if 0
+ if (gr->mode == draw_mode_begin || gr->mode == draw_mode_end)
+ gdk_draw_arc(gr->drawable, gc->gc, FALSE, p->x-r/2, p->y-r/2, r, r, 0, 64*360);
+ if (gr->mode == draw_mode_end || gr->mode == draw_mode_cursor)
+ gdk_draw_arc(gr->widget->window, gc->gc, FALSE, p->x-r/2, p->y-r/2, r, r, 0, 64*360);
+#endif
+}
+
+
+
+void SDL_print(char * label,int x, int y, double angle)
+{
+ glPushMatrix();
+ glcRenderStyle(GLC_TEXTURE);
+ glColor4f(0,0,0,1);
+ glTranslatef(x, y, 1);
+ glRotatef(180,1,0,0);
+ glRotatef(angle,0,0,1);
+
+ glScalef(14, 14, 14);
+ // FIXME : add some error checking : glcGetError()
+ glcRenderString(label);
+ glPopMatrix();
+
+}
+
+static void
+draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
+{
+// dbg(0,"%s : %i,%i, %f\n",text,dx,dy,(180*atan2(dx,dy)/3.14));
+ SDL_print(text,p->x,p->y,(180*atan2(dx,dy)/3.14)-90);
+}
+
+static void
+draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
+{
+#if 0
+ gdk_draw_pixbuf(gr->drawable, fg->gc, img->pixbuf, 0, 0, p->x, p->y,
+ img->w, img->h, GDK_RGB_DITHER_NONE, 0, 0);
+#endif
+}
+
+#ifdef HAVE_IMLIB2
+static void
+draw_image_warp(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, int count, char *data)
+{
+#if 0
+ void *image;
+ int w,h;
+ printf("draw_image_warp data=%s\n", data);
+ image = imlib_load_image(data);
+ imlib_context_set_display(gdk_x11_drawable_get_xdisplay(gr->widget->window));
+ imlib_context_set_colormap(gdk_x11_colormap_get_xcolormap(gtk_widget_get_colormap(gr->widget)));
+ imlib_context_set_visual(gdk_x11_visual_get_xvisual(gtk_widget_get_visual(gr->widget)));
+ imlib_context_set_drawable(gdk_x11_drawable_get_xid(gr->drawable));
+ imlib_context_set_image(image);
+ w = imlib_image_get_width();
+ h = imlib_image_get_height();
+ if (count == 3) {
+ imlib_render_image_on_drawable_skewed(0, 0, w, h, p[0].x, p[0].y, p[1].x-p[0].x, p[1].y-p[0].y, p[2].x-p[0].x, p[2].y-p[0].y);
+ }
+ if (count == 2) {
+ imlib_render_image_on_drawable_skewed(0, 0, w, h, p[0].x, p[0].y, p[1].x-p[0].x, 0, 0, p[1].y-p[0].y);
+ }
+#endif
+}
+#endif
+
+static void
+overlay_draw(struct graphics_priv *parent, struct graphics_priv *overlay, int window)
+{
+#if 0
+ GdkPixbuf *pixbuf,*pixbuf2;
+ GtkWidget *widget=parent->widget;
+ guchar *pixels1, *pixels2, *p1, *p2;
+ int x,y;
+ int rowstride1,rowstride2;
+ int n_channels1,n_channels2;
+
+ if (! parent->drawable)
+ return;
+
+ pixbuf=gdk_pixbuf_get_from_drawable(NULL, overlay->drawable, NULL, 0, 0, 0, 0, overlay->width, overlay->height);
+ pixbuf2=gdk_pixbuf_new(gdk_pixbuf_get_colorspace(pixbuf), TRUE, gdk_pixbuf_get_bits_per_sample(pixbuf),
+ gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf));
+
+ rowstride1 = gdk_pixbuf_get_rowstride (pixbuf);
+ rowstride2 = gdk_pixbuf_get_rowstride (pixbuf2);
+ pixels1=gdk_pixbuf_get_pixels (pixbuf);
+ pixels2=gdk_pixbuf_get_pixels (pixbuf2);
+ n_channels1 = gdk_pixbuf_get_n_channels (pixbuf);
+ n_channels2 = gdk_pixbuf_get_n_channels (pixbuf2);
+ for (y = 0 ; y < overlay->height ; y++) {
+ for (x = 0 ; x < overlay->width ; x++) {
+ p1 = pixels1 + y * rowstride1 + x * n_channels1;
+ p2 = pixels2 + y * rowstride2 + x * n_channels2;
+ p2[0]=p1[0];
+ p2[1]=p1[1];
+ p2[2]=p1[2];
+ p2[3]=127;
+ }
+ }
+ if (window)
+ gdk_draw_pixmap(parent->drawable, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], overlay->background, 0, 0, overlay->p.x, overlay->p.y, overlay->width, overlay->height);
+ else
+ gdk_draw_pixmap(overlay->background, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], parent->drawable, overlay->p.x, overlay->p.y, 0, 0, overlay->width, overlay->height);
+ gdk_draw_pixbuf(parent->drawable, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], pixbuf2, 0, 0, overlay->p.x, overlay->p.y, overlay->width, overlay->height, GDK_RGB_DITHER_NONE, 0, 0);
+ if (window)
+ gdk_draw_pixmap(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], parent->drawable, overlay->p.x, overlay->p.y, overlay->p.x, overlay->p.y, overlay->width, overlay->height);
+#if 0
+ gdk_draw_pixmap(gr->gra->drawable,
+ gr->gra->widget->style->fg_gc[GTK_WIDGET_STATE(gr->gra->widget)],
+ img->gra->drawable,
+ 0, 0, p->x, p->y, img->gra->width, img->gra->height);
+#endif
+#endif
+}
+
+static void
+draw_restore(struct graphics_priv *gr, struct point *p, int w, int h)
+{
+#if 0
+ GtkWidget *widget=gr->widget;
+ gdk_draw_pixmap(widget->window,
+ widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
+ gr->drawable,
+ p->x, p->y, p->x, p->y, w, h);
+#endif
+
+}
+
+static void
+background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
+{
+ gr->background_gc=gc;
+}
+
+static void
+draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
+{
+ if (gr->DLid) {
+ if (mode == draw_mode_begin)
+ glNewList(gr->DLid,GL_COMPILE);
+ if (mode == draw_mode_end)
+ glEndList();
+ }
+
+#if 0
+ struct graphics_priv *overlay;
+ GtkWidget *widget=gr->widget;
+
+ if (mode == draw_mode_begin) {
+ if (! gr->parent && gr->background_gc)
+ gdk_draw_rectangle(gr->drawable, gr->background_gc->gc, TRUE, 0, 0, gr->width, gr->height);
+ }
+ if (mode == draw_mode_end && gr->mode == draw_mode_begin) {
+ if (gr->parent) {
+ overlay_draw(gr->parent, gr, 1);
+ } else {
+ overlay=gr->overlays;
+ while (overlay) {
+ overlay_draw(gr, overlay, 0);
+ overlay=overlay->next;
+ }
+ gdk_draw_pixmap(widget->window,
+ widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
+ gr->drawable,
+ 0, 0, 0, 0, gr->width, gr->height);
+ }
+ }
+ gr->mode=mode;
+#endif
+}
+
+#if 0
+/* Events */
+
+static gint
+configure(GtkWidget * widget, GdkEventConfigure * event, gpointer user_data)
+{
+ struct graphics_priv *gra=user_data;
+ if (! gra->visible)
+ return TRUE;
+ if (gra->drawable != NULL) {
+ gdk_pixmap_unref(gra->drawable);
+ }
+ gra->width=widget->allocation.width;
+ gra->height=widget->allocation.height;
+ gra->drawable = gdk_pixmap_new(widget->window, gra->width, gra->height, -1);
+ if (gra->resize_callback)
+ (*gra->resize_callback)(gra->resize_callback_data, gra->width, gra->height);
+ return TRUE;
+}
+
+static gint
+expose(GtkWidget * widget, GdkEventExpose * event, gpointer user_data)
+{
+ struct graphics_priv *gra=user_data;
+
+ gra->visible=1;
+ if (! gra->drawable)
+ configure(widget, NULL, user_data);
+ gdk_draw_pixmap(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
+ gra->drawable, event->area.x, event->area.y,
+ event->area.x, event->area.y,
+ event->area.width, event->area.height);
+
+ return FALSE;
+}
+
+#if 0
+static gint
+button_timeout(gpointer user_data)
+{
+#if 0
+ struct container *co=user_data;
+ int x=co->gra->gra->button_event.x;
+ int y=co->gra->gra->button_event.y;
+ int button=co->gra->gra->button_event.button;
+
+ co->gra->gra->button_timeout=0;
+ popup(co, x, y, button);
+
+ return FALSE;
+#endif
+}
+#endif
+
+static gint
+button_press(GtkWidget * widget, GdkEventButton * event, gpointer user_data)
+{
+ struct graphics_priv *this=user_data;
+ struct point p;
+
+ p.x=event->x;
+ p.y=event->y;
+ if (this->button_callback)
+ (*this->button_callback)(this->button_callback_data, 1, event->button, &p);
+ return FALSE;
+}
+
+static gint
+button_release(GtkWidget * widget, GdkEventButton * event, gpointer user_data)
+{
+ struct graphics_priv *this=user_data;
+ struct point p;
+
+ p.x=event->x;
+ p.y=event->y;
+ if (this->button_callback)
+ (*this->button_callback)(this->button_callback_data, 0, event->button, &p);
+ return FALSE;
+}
+
+static gint
+scroll(GtkWidget * widget, GdkEventScroll * event, gpointer user_data)
+{
+ struct graphics_priv *this=user_data;
+ struct point p;
+ int button;
+
+ p.x=event->x;
+ p.y=event->y;
+ if (this->button_callback) {
+ switch (event->direction) {
+ case GDK_SCROLL_UP:
+ button=4;
+ break;
+ case GDK_SCROLL_DOWN:
+ button=5;
+ break;
+ default:
+ button=-1;
+ break;
+ }
+ if (button != -1) {
+ (*this->button_callback)(this->button_callback_data, 1, button, &p);
+ (*this->button_callback)(this->button_callback_data, 0, button, &p);
+ }
+ }
+ return FALSE;
+}
+
+static gint
+motion_notify(GtkWidget * widget, GdkEventMotion * event, gpointer user_data)
+{
+ struct graphics_priv *this=user_data;
+ struct point p;
+
+ p.x=event->x;
+ p.y=event->y;
+ if (this->motion_callback)
+ (*this->motion_callback)(this->motion_callback_data, &p);
+ return FALSE;
+}
+
+#endif
+
+
+static struct graphics_priv *
+overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h)
+{
+#if 0
+ struct graphics_priv *this=graphics_gtk_drawing_area_new_helper(meth);
+ this->drawable=gdk_pixmap_new(gr->widget->window, w, h, -1);
+ this->colormap=gr->colormap;
+ this->widget=gr->widget;
+ this->p=*p;
+ this->width=w;
+ this->height=h;
+ this->parent=gr;
+ this->background=gdk_pixmap_new(gr->widget->window, w, h, -1);
+ this->next=gr->overlays;
+ gr->overlays=this;
+ return this;
+#endif
+ return NULL;
+}
+
+static void *
+get_data(struct graphics_priv *this, char *type)
+{
+ if (strcmp(type,"opengl_displaylist"))
+ return NULL;
+#if 0
+ dbg(1,"Creating the DL from driver\n");
+ this->DLid = glGenLists(1);
+#endif
+ return &this->DLid;
+}
+
+static void
+register_resize_callback(struct graphics_priv *this, void (*callback)(void *data, int w, int h), void *data)
+{
+ this->resize_callback=callback;
+ this->resize_callback_data=data;
+}
+
+static void
+register_motion_callback(struct graphics_priv *this, void (*callback)(void *data, struct point *p), void *data)
+{
+ this->motion_callback=callback;
+ this->motion_callback_data=data;
+}
+
+static void
+register_button_callback(struct graphics_priv *this, void (*callback)(void *data, int press, int button, struct point *p), void *data)
+{
+ this->button_callback=callback;
+ this->button_callback_data=data;
+}
+
+static struct graphics_methods graphics_methods = {
+ graphics_destroy,
+ draw_mode,
+ draw_lines,
+ draw_polygon,
+ draw_rectangle,
+ draw_circle,
+ draw_text,
+ draw_image,
+#ifdef HAVE_IMLIB2
+ draw_image_warp,
+#else
+ NULL,
+#endif
+ draw_restore,
+ font_new,
+ gc_new,
+ background_gc,
+ overlay_new,
+ image_new,
+ get_data,
+ register_resize_callback,
+ register_button_callback,
+ register_motion_callback,
+ NULL, // image_free
+};
+
+static struct graphics_priv *
+graphics_opengl_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs)
+{
+ struct graphics_priv *this=g_new0(struct graphics_priv,1);
+ *meth=graphics_methods;
+
+// GtkWidget *draw;
+
+// draw=gtk_drawnig_area_new();
+
+
+ // Initialize the fonts
+ int ctx = 0;
+ int font = 0;
+ ctx = glcGenContext();
+ glcContext(ctx);
+ font = glcNewFontFromFamily(glcGenFontID(), "Verdana");
+ glcFont(font);
+ glcStringType(GLC_UTF8_QSO);
+// glcFontFace(font, "Italic");
+
+
+/*
+ this->widget=draw;
+
+ this->colormap=gdk_colormap_new(gdk_visual_get_system(),FALSE);
+ gtk_widget_set_events(draw, GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK|GDK_POINTER_MOTION_MASK|GDK_KEY_PRESS_MASK);
+ g_signal_connect(G_OBJECT(draw), "expose_event", G_CALLBACK(expose), this);
+ g_signal_connect(G_OBJECT(draw), "configure_event", G_CALLBACK(configure), this);
+#if 0
+ g_signal_connect(G_OBJECT(draw), "realize_event", G_CALLBACK(realize), co);
+#endif
+ g_signal_connect(G_OBJECT(draw), "button_press_event", G_CALLBACK(button_press), this);
+ g_signal_connect(G_OBJECT(draw), "button_release_event", G_CALLBACK(button_release), this);
+ g_signal_connect(G_OBJECT(draw), "scroll_event", G_CALLBACK(scroll), this);
+ g_signal_connect(G_OBJECT(draw), "motion_notify_event", G_CALLBACK(motion_notify), this);
+ */
+ return this;
+}
+
+void
+plugin_init(void)
+{
+ plugin_register_graphics_type("opengl", graphics_opengl_new);
+}
diff --git a/graphics/qt_qpainter/Makefile.am b/graphics/qt_qpainter/Makefile.am
new file mode 100644
index 00000000..b222328e
--- /dev/null
+++ b/graphics/qt_qpainter/Makefile.am
@@ -0,0 +1,10 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @QT_GUI_CFLAGS@ @NAVIT_CFLAGS@ -I$(top_srcdir) -I$(top_srcdir)/navit -DMODULE=graphics_qt_qpainter
+modulegraphics_LTLIBRARIES = libgraphics_qt_qpainter.la
+libgraphics_qt_qpainter_la_SOURCES = graphics_qt_qpainter.cpp graphics_qt_qpainter.moc
+libgraphics_qt_qpainter_la_LDFLAGS = @QT_GUI_LIBS@ -module -avoid-version
+if GRAPHICS_QT_QPAINTER
+BUILT_SOURCES = graphics_qt_qpainter.moc
+graphics_qt_qpainter.moc:
+ @MOC@ $(srcdir)/graphics_qt_qpainter.cpp >graphics_qt_qpainter.moc
+endif
diff --git a/graphics/qt_qpainter/graphics_qt_qpainter.cpp b/graphics/qt_qpainter/graphics_qt_qpainter.cpp
new file mode 100644
index 00000000..9c05e8e8
--- /dev/null
+++ b/graphics/qt_qpainter/graphics_qt_qpainter.cpp
@@ -0,0 +1,1214 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+//##############################################################################################################
+//#
+//# File: graphics_qt_qpainter.cpp
+//# Description: Graphics interface for internal GUI using Qt (Trolltech.com)
+//# Comment:
+//# Authors: Martin Schaller (04/2008), Stefan Klumpp (04/2008)
+//#
+//##############################################################################################################
+
+
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+#include "point.h"
+#include "item.h"
+#include "graphics.h"
+#include "color.h"
+#include "debug.h"
+#include "plugin.h"
+#include "callback.h"
+#include "event.h"
+#include "window.h"
+#include "keys.h"
+#include "navit/font/freetype/font_freetype.h"
+
+#include <qglobal.h>
+#if QT_VERSION < 0x040000
+#include <qwidget.h>
+#include <qapplication.h>
+#include <qpainter.h>
+#include <qpen.h>
+#include <qbrush.h>
+#include <qimage.h>
+#include <qpixmap.h>
+#include <qlistview.h>
+#include <qobject.h>
+#include <qsocketnotifier.h>
+#ifdef HAVE_QPE
+#include <qpe/qpeapplication.h>
+#endif
+#else
+#include <QResizeEvent>
+#include <QApplication>
+#include <QGraphicsScene>
+#include <QGraphicsView>
+#include <QPainter>
+#include <QPen>
+#include <QBrush>
+#include <QPixmap>
+#include <QWidget>
+#include <QPolygonF>
+#include <QtGui>
+#endif
+
+
+//##############################################################################################################
+//# Description: RenderArea (QWidget) class for the main window (map, menu, ...)
+//# Comment:
+//# Authors: Martin Schaller (04/2008), Stefan Klumpp (04/2008)
+//##############################################################################################################
+class RenderArea : public QWidget
+ {
+ Q_OBJECT
+ public:
+ RenderArea(struct graphics_priv *priv, QWidget *parent = 0, int w=800, int h=800, int overlay=0);
+ QPixmap *pixmap;
+ struct callback_list *cbl;
+ struct graphics_priv *gra;
+
+#if QT_VERSION < 0x040000
+ GHashTable *timer_type;
+ GHashTable *timer_callback;
+ GHashTable *watches;
+#endif
+ protected:
+ int is_overlay;
+ QSize sizeHint() const;
+ void paintEvent(QPaintEvent *event);
+ void resizeEvent(QResizeEvent *event);
+ void mouseEvent(int pressed, QMouseEvent *event);
+ void mousePressEvent(QMouseEvent *event);
+ void mouseReleaseEvent(QMouseEvent *event);
+ void mouseMoveEvent(QMouseEvent *event);
+ void wheelEvent(QWheelEvent *event);
+ void keyPressEvent(QKeyEvent *event);
+#if QT_VERSION < 0x040000
+ void timerEvent(QTimerEvent *event);
+#endif
+ protected slots:
+ void watchEvent(int fd);
+ };
+
+
+#include "graphics_qt_qpainter.moc"
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+struct graphics_gc_priv {
+ QPen *pen;
+ QBrush *brush;
+ struct color c;
+};
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+struct graphics_priv {
+#ifdef HAVE_QPE
+ QPEApplication *app;
+#else
+ QApplication *app;
+#endif
+ RenderArea *widget;
+ QPainter *painter;
+ struct graphics_gc_priv *background_gc;
+ unsigned char rgba[4];
+ enum draw_mode_num mode;
+ struct graphics_priv *parent,*overlays,*next;
+ struct point p,pclean;
+ int cleanup;
+ int overlay_disable;
+ int wraparound;
+ struct font_priv * (*font_freetype_new)(void *meth);
+ struct font_freetype_methods freetype_methods;
+ int w,h;
+};
+
+static void
+overlay_rect(struct graphics_priv *parent, struct graphics_priv *overlay, int clean, QRect *r)
+{
+ struct point p;
+ int w,h;
+ if (clean) {
+ p=overlay->pclean;
+ } else {
+ p=overlay->p;;
+ }
+ w=overlay->widget->pixmap->width();
+ h=overlay->widget->pixmap->height();
+ if (overlay->wraparound) {
+ if (p.x < 0)
+ p.x+=parent->widget->pixmap->width();
+ if (p.y < 0)
+ p.y+=parent->widget->pixmap->height();
+ if (w < 0)
+ w += parent->widget->pixmap->width();
+ if (h < 0)
+ h += parent->widget->pixmap->height();
+ }
+ r->setRect(p.x, p.y, w, h);
+}
+
+static void
+qt_qpainter_draw(struct graphics_priv *gr, const QRect *r, int paintev)
+{
+ if (!paintev) {
+ dbg(1,"update %d,%d %d x %d\n", r->x(), r->y(), r->width(), r->height());
+ if (r->x() <= -r->width())
+ return;
+ if (r->y() <= -r->height())
+ return;
+ if (r->x() > gr->widget->pixmap->width())
+ return;
+ if (r->y() > gr->widget->pixmap->height())
+ return;
+ dbg(1,"update valid %d,%d %dx%d\n", r->x(), r->y(), r->width(), r->height());
+ gr->widget->update(*r);
+ return;
+ }
+ QPixmap pixmap(r->width(),r->height());
+ QPainter painter(&pixmap);
+ struct graphics_priv *overlay=NULL;
+ if (! gr->overlay_disable)
+ overlay=gr->overlays;
+ if ((gr->p.x || gr->p.y) && gr->background_gc) {
+ painter.setPen(*gr->background_gc->pen);
+ painter.fillRect(0, 0, gr->widget->pixmap->width(), gr->widget->pixmap->height(), *gr->background_gc->brush);
+ }
+ painter.drawPixmap(QPoint(gr->p.x,gr->p.y), *gr->widget->pixmap, *r);
+ while (overlay) {
+ QRect ovr;
+ overlay_rect(gr, overlay, 0, &ovr);
+ if (!overlay->overlay_disable && r->intersects(ovr)) {
+ unsigned char *data;
+ int i,size=ovr.width()*ovr.height();
+#if QT_VERSION < 0x040000
+ QImage img=overlay->widget->pixmap->convertToImage();
+ img.setAlphaBuffer(1);
+#else
+ QImage img=overlay->widget->pixmap->toImage().convertToFormat(QImage::Format_ARGB32);
+#endif
+ data=img.bits();
+ for (i = 0 ; i < size ; i++) {
+ if (data[0] == overlay->rgba[0] && data[1] == overlay->rgba[1] && data[2] == overlay->rgba[2])
+ data[3]=overlay->rgba[3];
+ data+=4;
+ }
+#if QT_VERSION < 0x040000
+ painter.drawImage(QPoint(ovr.x()-r->x(),ovr.y()-r->y()), img, 0);
+#else
+ painter.drawImage(QPoint(ovr.x()-r->x(),ovr.y()-r->y()), img);
+#endif
+ }
+ overlay=overlay->next;
+ }
+ QPainter painterw(gr->widget);
+ painterw.drawPixmap(r->x(), r->y(), pixmap);
+}
+
+
+//##############################################################################################################
+//# Description: Constructor
+//# Comment: Using a QPixmap for rendering the graphics
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+RenderArea::RenderArea(struct graphics_priv *priv, QWidget *parent, int w, int h, int overlay)
+ : QWidget(parent)
+{
+ pixmap = new QPixmap(w, h);
+ if (!overlay) {
+#if QT_VERSION >= 0x040000
+ setWindowTitle("Navit");
+#else
+ setCaption("Navit");
+#endif
+ }
+ is_overlay=overlay;
+ gra=priv;
+#if QT_VERSION < 0x040000
+ timer_type=g_hash_table_new(NULL, NULL);
+ timer_callback=g_hash_table_new(NULL, NULL);
+ watches=g_hash_table_new(NULL, NULL);
+ setBackgroundMode(NoBackground);
+#endif
+}
+
+//##############################################################################################################
+//# Description: QWidget:sizeHint
+//# Comment: This property holds the recommended size for the widget
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+QSize RenderArea::sizeHint() const
+{
+ return QSize(gra->w, gra->h);
+}
+
+//##############################################################################################################
+//# Description: QWidget:paintEvent
+//# Comment: A paint event is a request to repaint all or part of the widget.
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+void RenderArea::paintEvent(QPaintEvent * event)
+{
+ qt_qpainter_draw(gra, &event->rect(), 1);
+#if 0
+ QPainter painter(this);
+ painter.drawPixmap(0, 0, *pixmap);
+#endif
+}
+
+
+//##############################################################################################################
+//# Description: QWidget::resizeEvent()
+//# Comment: When resizeEvent() is called, the widget already has its new geometry.
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+void RenderArea::resizeEvent(QResizeEvent * event)
+{
+ if (!this->is_overlay) {
+ QSize size=event->size();
+ delete pixmap;
+ pixmap=new QPixmap(size);
+ pixmap->fill();
+ QPainter painter(pixmap);
+ QBrush brush;
+ painter.fillRect(0, 0, size.width(), size.height(), brush);
+ dbg(0,"size %dx%d\n", size.width(), size.height());
+ dbg(0,"pixmap %p %dx%d\n", pixmap, pixmap->width(), pixmap->height());
+ callback_list_call_attr_2(this->cbl, attr_resize, (void *)size.width(), (void *)size.height());
+ }
+}
+
+//##############################################################################################################
+//# Description: Method to handle mouse clicks
+//# Comment: Delegate of QWidget::mousePressEvent and QWidget::mouseReleaseEvent (see below)
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+void RenderArea::mouseEvent(int pressed, QMouseEvent *event)
+{
+ struct point p;
+ p.x=event->x();
+ p.y=event->y();
+ switch (event->button()) {
+ case Qt::LeftButton:
+ callback_list_call_attr_3(this->cbl, attr_button, (void *)pressed, (void *)1, (void *)&p);
+ break;
+ case Qt::MidButton:
+ callback_list_call_attr_3(this->cbl, attr_button, (void *)pressed, (void *)2, (void *)&p);
+ break;
+ case Qt::RightButton:
+ callback_list_call_attr_3(this->cbl, attr_button, (void *)pressed, (void *)3, (void *)&p);
+ break;
+ default:
+ break;
+ }
+}
+
+void RenderArea::mousePressEvent(QMouseEvent *event)
+{
+ mouseEvent(1, event);
+}
+
+void RenderArea::mouseReleaseEvent(QMouseEvent *event)
+{
+ mouseEvent(0, event);
+}
+
+//##############################################################################################################
+//# Description: QWidget::mouseMoveEvent
+//# Comment: If mouse tracking is switched on, mouse move events occur even if no mouse button is pressed.
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+void RenderArea::mouseMoveEvent(QMouseEvent *event)
+{
+ struct point p;
+ p.x=event->x();
+ p.y=event->y();
+ callback_list_call_attr_1(this->cbl, attr_motion, (void *)&p);
+}
+
+
+//##############################################################################################################
+//# Description: Qt Event :: Zoom in/out with the mouse's scrollwheel
+//# Comment:
+//# Authors: Stefan Klumpp (04/2008)
+//##############################################################################################################
+void RenderArea::wheelEvent(QWheelEvent *event)
+{
+ struct point p;
+ int button;
+
+ p.x=event->x(); // xy-coordinates of the mouse pointer
+ p.y=event->y();
+
+ if (event->delta() > 0) // wheel movement away from the person
+ button=4;
+ else if (event->delta() < 0) // wheel movement towards the person
+ button=5;
+ else
+ button=-1;
+
+ if (button != -1) {
+ callback_list_call_attr_3(this->cbl, attr_button, (void *)1, (void *)button, (void *)&p);
+ callback_list_call_attr_3(this->cbl, attr_button, (void *)0, (void *)button, (void *)&p);
+ }
+
+ event->accept();
+}
+
+void RenderArea::keyPressEvent(QKeyEvent *event)
+{
+#if QT_VERSION < 0x040000
+ QString str=event->text();
+ QCString cstr=str.utf8();
+ const char *text=cstr;
+ dbg(0,"enter text='%s' 0x%x (%d) key=%d\n", text, text[0], strlen(text), event->key());
+ if (!text || !text[0] || text[0] == 0x7f) {
+ dbg(0,"special key\n");
+ switch (event->key()) {
+ case 4099:
+ {
+ text=(char []){NAVIT_KEY_BACKSPACE,'\0'};
+ }
+ break;
+ case 4101:
+ {
+ text=(char []){NAVIT_KEY_RETURN,'\0'};
+ }
+ break;
+ case 4114:
+ {
+ text=(char []){NAVIT_KEY_LEFT,'\0'};
+ }
+ break;
+ case 4115:
+ {
+ text=(char []){NAVIT_KEY_UP,'\0'};
+ }
+ break;
+ case 4116:
+ {
+ text=(char []){NAVIT_KEY_RIGHT,'\0'};
+ }
+ break;
+ case 4117:
+ {
+ text=(char []){NAVIT_KEY_DOWN,'\0'};
+ }
+ break;
+ }
+ }
+ callback_list_call_attr_1(this->cbl, attr_keypress, (void *)text);
+ event->accept();
+#endif
+}
+//##############################################################################################################
+// General comments:
+// -----------------
+// gr = graphics = draw area
+// gc = graphics context = pen to paint on the draw area
+//##############################################################################################################
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+struct graphics_font_priv {
+ QFont *font;
+};
+
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+struct graphics_image_priv {
+ QImage *image;
+};
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void graphics_destroy(struct graphics_priv *gr)
+{
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void font_destroy(struct graphics_font_priv *font)
+{
+
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static struct graphics_font_methods font_methods = {
+ font_destroy
+};
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, char *fontfamily, int size, int flags)
+{
+ struct graphics_font_priv *ret=g_new0(struct graphics_font_priv, 1);
+ ret->font=new QFont("Arial",size/20);
+ *meth=font_methods;
+ return ret;
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void gc_destroy(struct graphics_gc_priv *gc)
+{
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void gc_set_linewidth(struct graphics_gc_priv *gc, int w)
+{
+ gc->pen->setWidth(w);
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n)
+{
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
+{
+#if QT_VERSION >= 0x040000
+ QColor col(c->r >> 8, c->g >> 8, c->b >> 8 /* , c->a >> 8 */);
+#else
+ QColor col(c->r >> 8, c->g >> 8, c->b >> 8);
+#endif
+ gc->pen->setColor(col);
+ gc->brush->setColor(col);
+ gc->c=*c;
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void gc_set_background(struct graphics_gc_priv *gc, struct color *c)
+{
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static struct graphics_gc_methods gc_methods = {
+ gc_destroy,
+ gc_set_linewidth,
+ gc_set_dashes,
+ gc_set_foreground,
+ gc_set_background
+};
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth)
+{
+ *meth=gc_methods;
+ struct graphics_gc_priv *ret=g_new0(struct graphics_gc_priv, 1);
+ ret->pen=new QPen();
+ ret->brush=new QBrush(Qt::SolidPattern);
+ return ret;
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static struct graphics_image_priv * image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *path, int *w, int *h, struct point *hot, int rotation)
+{
+ struct graphics_image_priv *ret;
+
+ ret=g_new0(struct graphics_image_priv, 1);
+
+ ret->image=new QImage(path);
+ if (ret->image->isNull()) {
+ delete(ret->image);
+ g_free(ret);
+ return NULL;
+ }
+ *w=ret->image->width();
+ *h=ret->image->height();
+ if (hot) {
+ hot->x=*w/2;
+ hot->y=*h/2;
+ }
+ return ret;
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
+{
+ int i;
+#if QT_VERSION >= 0x040000
+ QPolygon polygon;
+#else
+ QPointArray polygon;
+#endif
+
+ for (i = 0 ; i < count ; i++)
+ polygon.putPoints(i, 1, p[i].x, p[i].y);
+ gr->painter->setPen(*gc->pen);
+ gr->painter->drawPolyline(polygon);
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
+{
+ int i;
+#if QT_VERSION >= 0x040000
+ QPolygon polygon;
+#else
+ QPointArray polygon;
+#endif
+
+ for (i = 0 ; i < count ; i++)
+ polygon.putPoints(i, 1, p[i].x, p[i].y);
+ gr->painter->setPen(*gc->pen);
+ gr->painter->setBrush(*gc->brush);
+ gr->painter->drawPolygon(polygon);
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
+{
+ dbg(1,"gr=%p gc=%p %d,%d,%d,%d\n", gr, gc, p->x, p->y, w, h);
+ gr->painter->fillRect(p->x,p->y, w, h, *gc->brush);
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r)
+{
+ gr->painter->setPen(*gc->pen);
+ gr->painter->drawArc(p->x-r/2, p->y-r/2, r, r, 0, 360*16);
+
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
+{
+ QPainter *painter=gr->painter;
+#if 0
+ QString tmp=QString::fromUtf8(text);
+#ifndef QT_NO_TRANSFORMATIONS
+#if QT_VERSION >= 0x040000
+ QMatrix sav=gr->painter->worldMatrix();
+ QMatrix m(dx/65535.0,dy/65535.0,-dy/65535.0,dx/65535.0,p->x,p->y);
+ painter->setWorldMatrix(m,TRUE);
+#else
+ QWMatrix sav=gr->painter->worldMatrix();
+ QWMatrix m(dx/65535.0,dy/65535.0,-dy/65535.0,dx/65535.0,p->x,p->y);
+ painter->setWorldMatrix(m,TRUE);
+#endif
+ painter->setPen(*fg->pen);
+ painter->setFont(*font->font);
+ painter->drawText(0, 0, tmp);
+ painter->setWorldMatrix(sav);
+#else
+ painter->setPen(*fg->pen);
+ painter->setFont(*font->font);
+ painter->drawText(p->x, p->y, tmp);
+#endif
+#else
+ struct font_freetype_text *t;
+ struct font_freetype_glyph *g, **gp;
+ struct color transparent = {0x0000, 0x0000, 0x0000, 0x0000};
+ struct color *fgc=&fg->c, *bgc=&bg->c;
+
+ int i,x,y;
+
+ if (! font)
+ return;
+ t=gr->freetype_methods.text_new(text, (struct font_freetype_font *)font, dx, dy);
+ x=p->x << 6;
+ y=p->y << 6;
+ gp=t->glyph;
+ i=t->glyph_count;
+ if (bg) {
+ while (i-- > 0) {
+ g=*gp++;
+ if (g->w && g->h) {
+ unsigned char *data;
+#if QT_VERSION < 0x040000
+ QImage img(g->w+2, g->h+2, 32);
+ img.setAlphaBuffer(1);
+ data=img.bits();
+ gr->freetype_methods.get_shadow(g,(unsigned char *)(img.jumpTable()),32,0,bgc,&transparent);
+#else
+ QImage img(g->w+2, g->h+2, QImage::Format_ARGB32);
+ data=img.bits();
+ gr->freetype_methods.get_shadow(g,(unsigned char *)data,32,img.bytesPerLine(),bgc,&transparent);
+#endif
+
+ painter->drawImage(((x+g->x)>>6)-1, ((y+g->y)>>6)-1, img);
+ }
+ x+=g->dx;
+ y+=g->dy;
+ }
+ } else
+ bgc=&transparent;
+ x=p->x << 6;
+ y=p->y << 6;
+ gp=t->glyph;
+ i=t->glyph_count;
+ while (i-- > 0) {
+ g=*gp++;
+ if (g->w && g->h) {
+ unsigned char *data;
+#if QT_VERSION < 0x040000
+ QImage img(g->w, g->h, 32);
+ img.setAlphaBuffer(1);
+ data=img.bits();
+ gr->freetype_methods.get_glyph(g,(unsigned char *)(img.jumpTable()),32,0,fgc,bgc,&transparent);
+#else
+ QImage img(g->w, g->h, QImage::Format_ARGB32);
+ data=img.bits();
+ gr->freetype_methods.get_glyph(g,(unsigned char *)data,32,img.bytesPerLine(),fgc,bgc,&transparent);
+#endif
+ painter->drawImage((x+g->x)>>6, (y+g->y)>>6, img);
+ }
+ x+=g->dx;
+ y+=g->dy;
+ }
+ gr->freetype_methods.text_destroy(t);
+#endif
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
+{
+ gr->painter->drawImage(p->x, p->y, *img->image);
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void draw_image_warp(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, int count, char *data)
+{
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void draw_restore(struct graphics_priv *gr, struct point *p, int w, int h)
+{
+}
+
+
+static void
+draw_drag(struct graphics_priv *gr, struct point *p)
+{
+ if (!gr->cleanup) {
+ gr->pclean=gr->p;
+ gr->cleanup=1;
+ }
+ if (p)
+ gr->p=*p;
+ else {
+ gr->p.x=0;
+ gr->p.y=0;
+ }
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
+{
+ gr->background_gc=gc;
+ gr->rgba[2]=gc->c.r >> 8;
+ gr->rgba[1]=gc->c.g >> 8;
+ gr->rgba[0]=gc->c.b >> 8;
+ gr->rgba[3]=gc->c.a >> 8;
+}
+
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
+{
+ dbg(1,"mode for %p %d\n", gr, mode);
+ QRect r;
+ if (mode == draw_mode_begin) {
+ gr->painter->begin(gr->widget->pixmap);
+#if 0
+ gr->painter->fillRect(QRect(QPoint(0,0), gr->widget->size()), *gr->background_gc->brush);
+#endif
+ }
+#if QT_VERSION < 0x040000
+ if (mode == draw_mode_cursor) {
+ gr->painter->begin(gr->widget);
+ }
+#endif
+ if (mode == draw_mode_end) {
+#if 0
+ if (gr->mode == draw_mode_begin) {
+#endif
+ gr->painter->end();
+ if (gr->parent) {
+ if (gr->cleanup) {
+ overlay_rect(gr->parent, gr, 1, &r);
+ qt_qpainter_draw(gr->parent, &r, 0);
+ gr->cleanup=0;
+ }
+ overlay_rect(gr->parent, gr, 0, &r);
+ qt_qpainter_draw(gr->parent, &r, 0);
+ } else {
+ r.setRect(0, 0, gr->widget->pixmap->width(), gr->widget->pixmap->height());
+ qt_qpainter_draw(gr, &r, 0);
+ }
+#if 0
+ } else {
+#if QT_VERSION < 0x040000
+ gr->painter->end();
+#endif
+ }
+#endif
+ }
+#if QT_VERSION >= 0x040000
+ if (mode == draw_mode_end_lazy)
+ gr->painter->end();
+#endif
+ gr->mode=mode;
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h,int alpha, int wraparound);
+
+static int argc=1;
+static char *argv[]={(char *)"navit",NULL};
+
+static int
+fullscreen(struct window *win, int on)
+{
+ struct graphics_priv *this_=(struct graphics_priv *)win->priv;
+ if (on)
+ this_->widget->showFullScreen();
+ else
+ this_->widget->showMaximized();
+ return 1;
+}
+
+static void
+disable_suspend(struct window *win)
+{
+#ifdef HAVE_QPE
+ struct graphics_priv *this_=(struct graphics_priv *)win->priv;
+ this_->app->setTempScreenSaverMode(QPEApplication::DisableLightOff);
+#endif
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void * get_data(struct graphics_priv *this_, char *type)
+{
+ struct window *win;
+ if (strcmp(type, "window"))
+ return NULL;
+ win=g_new(struct window, 1);
+ this_->painter=new QPainter;
+ if (this_->w && this_->h)
+ this_->widget->show();
+ else
+ this_->widget->showMaximized();
+ win->priv=this_;
+ win->fullscreen=fullscreen;
+ win->disable_suspend=disable_suspend;
+ return win;
+}
+
+static void
+image_free(struct graphics_priv *gr, struct graphics_image_priv *priv)
+{
+ delete priv->image;
+ g_free(priv);
+}
+
+static void
+get_text_bbox(struct graphics_priv *gr, struct graphics_font_priv *font, char *text, int dx, int dy, struct point *ret, int estimate)
+{
+ QPainter *painter=gr->painter;
+ QString tmp=QString::fromUtf8(text);
+ painter->setFont(*font->font);
+ QRect r=painter->boundingRect(0,0,gr->widget->width(),gr->widget->height(),0,tmp);
+ ret[0].x=0;
+ ret[0].y=-r.height();
+ ret[1].x=0;
+ ret[1].y=0;
+ ret[2].x=r.width();
+ ret[2].y=0;
+ ret[3].x=r.width();
+ ret[3].y=-r.height();
+}
+
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void overlay_disable(struct graphics_priv *gr, int disable)
+{
+ gr->overlay_disable=disable;
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static struct graphics_methods graphics_methods = {
+ graphics_destroy,
+ draw_mode,
+ draw_lines,
+ draw_polygon,
+ draw_rectangle,
+ draw_circle,
+ draw_text,
+ draw_image,
+ draw_image_warp,
+ draw_restore,
+ draw_drag,
+ font_new,
+ gc_new,
+ background_gc,
+ overlay_new,
+ image_new,
+ get_data,
+ image_free,
+ get_text_bbox,
+ overlay_disable,
+};
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h,int alpha,int wraparound)
+{
+ *meth=graphics_methods;
+ struct graphics_priv *ret=g_new0(struct graphics_priv, 1);
+ if (gr->font_freetype_new) {
+ ret->font_freetype_new=gr->font_freetype_new;
+ gr->font_freetype_new(&ret->freetype_methods);
+ meth->font_new=(struct graphics_font_priv *(*)(struct graphics_priv *, struct graphics_font_methods *, char *, int, int))ret->freetype_methods.font_new;
+ meth->get_text_bbox=(void (*)(struct graphics_priv*, struct graphics_font_priv*, char*, int, int, struct point*, int))ret->freetype_methods.get_text_bbox;
+ }
+ ret->widget= new RenderArea(ret,NULL,w,h,1);
+ ret->wraparound=wraparound;
+ ret->painter=new QPainter;
+ ret->p=*p;
+ ret->parent=gr;
+ ret->next=gr->overlays;
+ gr->overlays=ret;
+ return ret;
+}
+
+#if QT_VERSION < 0x040000
+
+
+static struct graphics_priv *event_gr;
+
+static void
+event_qt_main_loop_run(void)
+{
+ event_gr->app->exec();
+}
+
+static void event_qt_main_loop_quit(void)
+{
+ dbg(0,"enter\n");
+ exit(0);
+}
+
+struct event_watch {
+ QSocketNotifier *sn;
+ struct callback *cb;
+ void *fd;
+};
+
+static struct event_watch *
+event_qt_add_watch(void *fd, enum event_watch_cond cond, struct callback *cb)
+{
+ dbg(1,"enter fd=%d\n",(int)(long)fd);
+ struct event_watch *ret=g_new0(struct event_watch, 1);
+ ret->fd=fd;
+ ret->cb=cb;
+ g_hash_table_insert(event_gr->widget->watches, fd, ret);
+ ret->sn=new QSocketNotifier((int)(long)fd, QSocketNotifier::Read, event_gr->widget);
+ QObject::connect(ret->sn, SIGNAL(activated(int)), event_gr->widget, SLOT(watchEvent(int)));
+ return ret;
+}
+
+static void
+event_qt_remove_watch(struct event_watch *ev)
+{
+ g_hash_table_remove(event_gr->widget->watches, ev->fd);
+ delete(ev->sn);
+ g_free(ev);
+
+}
+
+static struct event_timeout *
+event_qt_add_timeout(int timeout, int multi, struct callback *cb)
+{
+ int id;
+ id=event_gr->widget->startTimer(timeout);
+ g_hash_table_insert(event_gr->widget->timer_callback, (void *)id, cb);
+ g_hash_table_insert(event_gr->widget->timer_type, (void *)id, (void *)!!multi);
+ return (struct event_timeout *)id;
+}
+
+static void
+event_qt_remove_timeout(struct event_timeout *ev)
+{
+ event_gr->widget->killTimer((int)(long)ev);
+ g_hash_table_remove(event_gr->widget->timer_callback, ev);
+ g_hash_table_remove(event_gr->widget->timer_type, ev);
+}
+
+static struct event_idle *
+event_qt_add_idle(int priority, struct callback *cb)
+{
+ dbg(0,"enter\n");
+ return (struct event_idle *)event_qt_add_timeout(0, 1, cb);
+}
+
+static void
+event_qt_remove_idle(struct event_idle *ev)
+{
+ dbg(0,"enter\n");
+ event_qt_remove_timeout((struct event_timeout *) ev);
+}
+
+static void
+event_qt_call_callback(struct callback_list *cb)
+{
+ dbg(0,"enter\n");
+}
+
+static struct event_methods event_qt_methods = {
+ event_qt_main_loop_run,
+ event_qt_main_loop_quit,
+ event_qt_add_watch,
+ event_qt_remove_watch,
+ event_qt_add_timeout,
+ event_qt_remove_timeout,
+ event_qt_add_idle,
+ event_qt_remove_idle,
+ event_qt_call_callback,
+};
+
+struct event_priv {
+};
+
+struct event_priv *
+event_qt_new(struct event_methods *meth)
+{
+ dbg(0,"enter\n");
+ *meth=event_qt_methods;
+ return NULL;
+}
+
+void RenderArea::timerEvent(QTimerEvent *event)
+{
+ int id=event->timerId();
+ struct callback *cb=(struct callback *)g_hash_table_lookup(timer_callback, (void *)id);
+ if (cb)
+ callback_call_0(cb);
+ if (!g_hash_table_lookup(timer_type, (void *)id))
+ event_qt_remove_timeout((struct event_timeout *)id);
+}
+#endif
+
+void RenderArea::watchEvent(int fd)
+{
+#if QT_VERSION < 0x040000
+ struct event_watch *ev=(struct event_watch *)g_hash_table_lookup(watches, (void *)fd);
+ dbg(1,"fd=%d ev=%p cb=%p\n", fd, ev, ev->cb);
+ callback_call_0(ev->cb);
+#endif
+}
+
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static struct graphics_priv * graphics_qt_qpainter_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl)
+{
+ struct graphics_priv *ret;
+ struct font_priv * (*font_freetype_new)(void *meth);
+ struct attr *attr;
+
+ dbg(0,"enter\n");
+#if QT_VERSION < 0x040000
+ if (event_gr)
+ return NULL;
+ if (! event_request_system("qt","graphics_qt_qpainter_new"))
+ return NULL;
+#else
+ if (! event_request_system("glib","graphics_qt_qpainter_new"))
+ return NULL;
+#endif
+#if 1
+ font_freetype_new=(struct font_priv *(*)(void *))plugin_get_font_type("freetype");
+ if (!font_freetype_new)
+ return NULL;
+#endif
+ ret=g_new0(struct graphics_priv, 1);
+ ret->font_freetype_new=font_freetype_new;
+ *meth=graphics_methods;
+#if 1
+ font_freetype_new(&ret->freetype_methods);
+ meth->font_new=(struct graphics_font_priv *(*)(struct graphics_priv *, struct graphics_font_methods *, char *, int, int))ret->freetype_methods.font_new;
+ meth->get_text_bbox=(void (*)(struct graphics_priv*, struct graphics_font_priv*, char*, int, int, struct point*, int))ret->freetype_methods.get_text_bbox;
+#endif
+
+#ifdef HAVE_QPE
+ ret->app = new QPEApplication(argc, argv);
+#else
+ ret->app = new QApplication(argc, argv);
+#endif
+ ret->widget= new RenderArea(ret);
+ ret->widget->cbl=cbl;
+#if QT_VERSION < 0x040000
+ event_gr=ret;
+#endif
+ ret->w=800;
+ ret->h=600;
+ if ((attr=attr_search(attrs, NULL, attr_w)))
+ ret->w=attr->u.num;
+ if ((attr=attr_search(attrs, NULL, attr_h)))
+ ret->h=attr->u.num;
+
+ dbg(0,"return\n");
+ return ret;
+}
+
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+void plugin_init(void)
+{
+ plugin_register_graphics_type("qt_qpainter", graphics_qt_qpainter_new);
+#if QT_VERSION < 0x040000
+ plugin_register_event_type("qt", event_qt_new);
+#endif
+}
+
+
+
+
+// *** EOF ***
diff --git a/graphics/sdl/Makefile.am b/graphics/sdl/Makefile.am
new file mode 100644
index 00000000..084bf3e9
--- /dev/null
+++ b/graphics/sdl/Makefile.am
@@ -0,0 +1,5 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ @SDL_CFLAGS@ @FREETYPE2_CFLAGS@ @FONTCONFIG_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=graphics_sdl
+modulegraphics_LTLIBRARIES = libgraphics_sdl.la
+libgraphics_sdl_la_SOURCES = graphics_sdl.c raster.c raster.h
+libgraphics_sdl_la_LDFLAGS = @SDL_LIBS@ @SDL_IMAGE_LIBS@ @FREETYPE2_LIBS@ @FONTCONFIG_LIBS@ -module -avoid-version
diff --git a/graphics/sdl/graphics_sdl.c b/graphics/sdl/graphics_sdl.c
new file mode 100644
index 00000000..c30bc121
--- /dev/null
+++ b/graphics/sdl/graphics_sdl.c
@@ -0,0 +1,2146 @@
+/* graphics_sdl.c -- barebones sdl graphics layer
+
+ copyright (c) 2008 bryan rittmeyer <bryanr@bryanr.org>
+ license: GPLv2
+
+ TODO:
+ - dashed lines
+ - ifdef DEBUG -> dbg()
+ - proper image transparency (libsdl-image xpm does not work)
+ - valgrind
+
+ revision history:
+ 2008-06-01 initial
+ 2008-06-15 SDL_DOUBLEBUF+SDL_Flip for linux fb. fix FT leaks.
+ 2008-06-18 defer initial resize_callback
+ 2008-06-21 linux touchscreen
+ 2008-07-04 custom rastering
+*/
+
+#include <glib.h>
+#include "config.h"
+#include "debug.h"
+#include "point.h"
+#include "graphics.h"
+#include "color.h"
+#include "plugin.h"
+#include "window.h"
+#include "navit.h"
+#include "keys.h"
+#include "item.h"
+#include "attr.h"
+#include "callback.h"
+
+#include <SDL/SDL.h>
+#include <math.h>
+
+#define RASTER
+#undef SDL_SGE
+#undef SDL_GFX
+#undef ALPHA
+
+#undef SDL_TTF
+#define SDL_IMAGE
+#undef LINUX_TOUCHSCREEN
+
+#define DISPLAY_W 800
+#define DISPLAY_H 600
+
+
+#undef DEBUG
+#undef PROFILE
+
+#define OVERLAY_MAX 16
+
+#ifdef RASTER
+#include "raster.h"
+#endif
+
+#ifdef SDL_SGE
+#include <SDL/sge.h>
+#endif
+
+#ifdef SDL_GFX
+#include <SDL/SDL_gfxPrimitives.h>
+#endif
+
+#ifdef SDL_TTF
+#include <SDL/SDL_ttf.h>
+#else
+#include <fontconfig/fontconfig.h>
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include <freetype/ftglyph.h>
+#endif
+#include <event.h>
+
+#ifdef SDL_IMAGE
+#include <SDL/SDL_image.h>
+#endif
+
+#ifdef LINUX_TOUCHSCREEN
+/* we use Linux evdev directly for the touchscreen. */
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <linux/input.h>
+#endif
+
+#include <alloca.h>
+
+#ifdef PROFILE
+#include <sys/time.h>
+#include <time.h>
+#endif
+
+
+/* TODO: union overlay + non-overlay to reduce size */
+struct graphics_priv;
+struct graphics_priv {
+ SDL_Surface *screen;
+ int aa;
+
+ /* <overlay> */
+ int overlay_mode;
+ int overlay_x;
+ int overlay_y;
+ struct graphics_priv *overlay_parent;
+ int overlay_idx;
+ /* </overlay> */
+
+ /* <main> */
+ struct graphics_priv *overlay_array[OVERLAY_MAX];
+ int overlay_enable;
+ enum draw_mode_num draw_mode;
+
+ int resize_callback_initial;
+
+ struct navit *nav;
+ struct callback_list *cbl;
+
+#ifdef LINUX_TOUCHSCREEN
+ int ts_fd;
+ int32_t ts_hit;
+ uint32_t ts_x;
+ uint32_t ts_y;
+#endif
+
+#ifndef SDL_TTF
+ FT_Library library;
+#endif
+
+#ifdef PROFILE
+ struct timeval draw_begin_tv;
+ unsigned long draw_time_peak;
+#endif
+ /* </main> */
+};
+
+static int dummy;
+
+
+struct graphics_font_priv {
+#ifdef SDL_TTF
+ TTF_Font *font;
+#else
+ FT_Face face;
+#endif
+};
+
+struct graphics_gc_priv {
+ struct graphics_priv *gr;
+ Uint8 fore_r;
+ Uint8 fore_g;
+ Uint8 fore_b;
+ Uint8 fore_a;
+ Uint8 back_r;
+ Uint8 back_g;
+ Uint8 back_b;
+ Uint8 back_a;
+ int linewidth;
+};
+
+struct graphics_image_priv {
+ SDL_Surface *img;
+};
+
+
+#ifdef LINUX_TOUCHSCREEN
+static int input_ts_exit(struct graphics_priv *gr);
+#endif
+
+static void
+graphics_destroy(struct graphics_priv *gr)
+{
+ dbg(0, "graphics_destroy %p %u\n", gr, gr->overlay_mode);
+
+ if(gr->overlay_mode)
+ {
+ SDL_FreeSurface(gr->screen);
+ gr->overlay_parent->overlay_array[gr->overlay_idx] = NULL;
+ }
+ else
+ {
+#ifdef SDL_TTF
+ TTF_Quit();
+#else
+ FT_Done_FreeType(gr->library);
+ FcFini();
+#endif
+#ifdef LINUX_TOUCHSCREEN
+ input_ts_exit(gr);
+#endif
+ SDL_Quit();
+ }
+
+ g_free(gr);
+}
+
+/* graphics_font */
+static char *fontfamilies[]={
+ "Liberation Mono",
+ "Arial",
+ "DejaVu Sans",
+ "NcrBI4nh",
+ "luximbi",
+ "FreeSans",
+ NULL,
+};
+
+static void font_destroy(struct graphics_font_priv *gf)
+{
+#ifdef SDL_TTF
+#else
+ FT_Done_Face(gf->face);
+#endif
+ g_free(gf);
+}
+
+static struct graphics_font_methods font_methods = {
+ font_destroy
+};
+
+static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, char *fontfamily, int size, int flags)
+{
+ struct graphics_font_priv *gf=g_new(struct graphics_font_priv, 1);
+
+#ifdef SDL_TTF
+ /* 'size' is in pixels, TTF_OpenFont wants pts. */
+ size = size / 15;
+
+// gf->font = TTF_OpenFont("/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf", size);
+ if(flags)
+ {
+ gf->font = TTF_OpenFont("/usr/share/fonts/truetype/LiberationMono-Bold.ttf", size);
+ }
+ else
+ {
+ gf->font = TTF_OpenFont("/usr/share/fonts/truetype/LiberationMono-Regular.ttf", size);
+ }
+
+ if(gf->font == NULL)
+ {
+ g_free(gf);
+ return NULL;
+ }
+
+ if(flags)
+ {
+ /* apparently just means bold right now */
+ TTF_SetFontStyle(gf->font, TTF_STYLE_BOLD);
+ }
+ else
+ {
+ TTF_SetFontStyle(gf->font, TTF_STYLE_NORMAL);
+ }
+#else
+ /* copy-pasted from graphics_gtk_drawing_area.c
+
+ FIXME: figure out some way to share this b/t gtk and sdl graphics plugin.
+ new 'font' plugin type that uses an abstracted bitmap fmt to pass to gfx plugin?
+ */
+
+ int exact, found;
+ char **family;
+
+ if(gr->overlay_mode)
+ {
+ gr = gr->overlay_parent;
+ }
+
+ found=0;
+ for (exact=1;!found && exact>=0;exact--) {
+ family=fontfamilies;
+ while (*family && !found) {
+ dbg(1, "Looking for font family %s. exact=%d\n", *family, exact);
+ FcPattern *required = FcPatternBuild(NULL, FC_FAMILY, FcTypeString, *family, NULL);
+ if (flags)
+ FcPatternAddInteger(required,FC_WEIGHT,FC_WEIGHT_BOLD);
+ FcConfigSubstitute(FcConfigGetCurrent(), required, FcMatchFont);
+ FcDefaultSubstitute(required);
+ FcResult result;
+ FcPattern *matched = FcFontMatch(FcConfigGetCurrent(), required, &result);
+ if (matched) {
+ FcValue v1, v2;
+ FcChar8 *fontfile;
+ int fontindex;
+ FcPatternGet(required, FC_FAMILY, 0, &v1);
+ FcPatternGet(matched, FC_FAMILY, 0, &v2);
+ FcResult r1 = FcPatternGetString(matched, FC_FILE, 0, &fontfile);
+ FcResult r2 = FcPatternGetInteger(matched, FC_INDEX, 0, &fontindex);
+ if ((r1 == FcResultMatch) && (r2 == FcResultMatch) && (FcValueEqual(v1,v2) || !exact)) {
+ dbg(2, "About to load font from file %s index %d\n", fontfile, fontindex);
+ FT_New_Face( gr->library, (char *)fontfile, fontindex, &gf->face );
+ found=1;
+ }
+ FcPatternDestroy(matched);
+ }
+ FcPatternDestroy(required);
+ family++;
+ }
+ }
+ if (!found) {
+ g_warning("Failed to load font, no labelling");
+ g_free(gf);
+ return NULL;
+ }
+ FT_Set_Char_Size(gf->face, 0, size, 300, 300);
+ FT_Select_Charmap(gf->face, FT_ENCODING_UNICODE);
+#endif
+
+ *meth=font_methods;
+
+ return gf;
+}
+
+
+/* graphics_gc */
+
+static void
+gc_destroy(struct graphics_gc_priv *gc)
+{
+ g_free(gc);
+}
+
+static void
+gc_set_linewidth(struct graphics_gc_priv *gc, int w)
+{
+#ifdef DEBUG
+ printf("gc_set_linewidth %p %d\n", gc, w);
+#endif
+ gc->linewidth = w;
+}
+
+static void
+gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n)
+{
+ /* TODO */
+}
+
+static void
+gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
+{
+#ifdef DEBUG
+ printf("gc_set_foreground: %p %d %d %d %d\n", gc, c->a, c->r, c->g, c->b);
+#endif
+ gc->fore_r = c->r/256;
+ gc->fore_g = c->g/256;
+ gc->fore_b = c->b/256;
+ gc->fore_a = c->a/256;
+}
+
+static void
+gc_set_background(struct graphics_gc_priv *gc, struct color *c)
+{
+#ifdef DEBUG
+ printf("gc_set_background: %p %d %d %d %d\n", gc, c->a, c->r, c->g, c->b);
+#endif
+ gc->back_r = c->r/256;
+ gc->back_g = c->g/256;
+ gc->back_b = c->b/256;
+ gc->back_a = c->a/256;
+}
+
+static struct graphics_gc_methods gc_methods = {
+ gc_destroy,
+ gc_set_linewidth,
+ gc_set_dashes,
+ gc_set_foreground,
+ gc_set_background
+};
+
+static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth)
+{
+ struct graphics_gc_priv *gc=g_new0(struct graphics_gc_priv, 1);
+ *meth=gc_methods;
+ gc->gr=gr;
+ gc->linewidth=1; /* upper layer should override anyway? */
+ return gc;
+}
+
+
+#if 0 /* unused by core? */
+static void image_destroy(struct graphics_image_priv *gi)
+{
+#ifdef SDL_IMAGE
+ SDL_FreeSurface(gi->img);
+ g_free(gi);
+#endif
+}
+
+static struct graphics_image_methods gi_methods =
+{
+ image_destroy
+};
+#endif
+
+static struct graphics_image_priv *
+image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h,
+ struct point *hot, int rotation)
+{
+#ifdef SDL_IMAGE
+ struct graphics_image_priv *gi;
+
+ /* FIXME: meth is not used yet.. so gi leaks. at least xpm is small */
+
+ gi = g_new0(struct graphics_image_priv, 1);
+ gi->img = IMG_Load(name);
+ if(gi->img)
+ {
+ /* TBD: improves blit performance? */
+ SDL_SetColorKey(gi->img, SDL_RLEACCEL, gi->img->format->colorkey);
+ *w=gi->img->w;
+ *h=gi->img->h;
+ hot->x=*w/2;
+ hot->y=*h/2;
+ }
+ else
+ {
+ /* TODO: debug "colour parse errors" on xpm */
+ printf("graphics_sdl: image_new on '%s' failed: %s\n", name, IMG_GetError());
+ g_free(gi);
+ gi = NULL;
+ }
+
+ return gi;
+#else
+ return NULL;
+#endif
+}
+
+static void
+image_free(struct graphics_priv *gr, struct graphics_image_priv * gi)
+{
+#ifdef SDL_IMAGE
+ SDL_FreeSurface(gi->img);
+ g_free(gi);
+#endif
+}
+
+static void
+get_text_bbox(struct graphics_priv *gr, struct graphics_font_priv *font, char *text, int dx, int dy, struct point *ret, int estimate)
+{
+ char *p=text;
+ FT_BBox bbox;
+ FT_UInt glyph_index;
+ FT_GlyphSlot slot = font->face->glyph; // a small shortcut
+ FT_Glyph glyph;
+ FT_Matrix matrix;
+ FT_Vector pen;
+ pen.x = 0 * 64;
+ pen.y = 0 * 64;
+ matrix.xx = dx;
+ matrix.xy = dy;
+ matrix.yx = -dy;
+ matrix.yy = dx;
+ int n,len,x=0,y=0;
+
+ bbox.xMin = bbox.yMin = 32000;
+ bbox.xMax = bbox.yMax = -32000;
+ FT_Set_Transform( font->face, &matrix, &pen );
+ len=g_utf8_strlen(text, -1);
+ for ( n = 0; n < len; n++ ) {
+ FT_BBox glyph_bbox;
+ glyph_index = FT_Get_Char_Index(font->face, g_utf8_get_char(p));
+ p=g_utf8_next_char(p);
+ FT_Load_Glyph(font->face, glyph_index, FT_LOAD_DEFAULT );
+ FT_Get_Glyph(font->face->glyph, &glyph);
+ FT_Glyph_Get_CBox(glyph, ft_glyph_bbox_pixels, &glyph_bbox );
+ FT_Done_Glyph(glyph);
+ glyph_bbox.xMin += x >> 6;
+ glyph_bbox.xMax += x >> 6;
+ glyph_bbox.yMin += y >> 6;
+ glyph_bbox.yMax += y >> 6;
+ x += slot->advance.x;
+ y -= slot->advance.y;
+ if ( glyph_bbox.xMin < bbox.xMin )
+ bbox.xMin = glyph_bbox.xMin;
+ if ( glyph_bbox.yMin < bbox.yMin )
+ bbox.yMin = glyph_bbox.yMin;
+ if ( glyph_bbox.xMax > bbox.xMax )
+ bbox.xMax = glyph_bbox.xMax;
+ if ( glyph_bbox.yMax > bbox.yMax )
+ bbox.yMax = glyph_bbox.yMax;
+ }
+ if ( bbox.xMin > bbox.xMax ) {
+ bbox.xMin = 0;
+ bbox.yMin = 0;
+ bbox.xMax = 0;
+ bbox.yMax = 0;
+ }
+ ret[0].x=bbox.xMin;
+ ret[0].y=-bbox.yMin;
+ ret[1].x=bbox.xMin;
+ ret[1].y=-bbox.yMax;
+ ret[2].x=bbox.xMax;
+ ret[2].y=-bbox.yMax;
+ ret[3].x=bbox.xMax;
+ ret[3].y=-bbox.yMin;
+}
+
+static void
+draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
+{
+ Sint16 *vx, *vy;
+ Sint16 x, y;
+ int i;
+
+ vx = alloca(count * sizeof(Sint16));
+ vy = alloca(count * sizeof(Sint16));
+
+ for(i = 0; i < count; i++)
+ {
+ x = (Sint16)p[i].x;
+ y = (Sint16)p[i].y;
+
+#if 0
+ if(x < 0)
+ {
+ x = 0;
+ }
+ if(y < 0)
+ {
+ y = 0;
+ }
+#endif
+
+ vx[i] = x;
+ vy[i] = y;
+
+#ifdef DEBUG
+ printf("draw_polygon: %p %i %d,%d\n", gc, i, p[i].x, p[i].y);
+#endif
+ }
+
+#ifdef RASTER
+ if(gr->aa)
+ {
+ raster_aapolygon(gr->screen, count, vx, vy,
+ SDL_MapRGB(gr->screen->format,
+ gc->fore_r,
+ gc->fore_g,
+ gc->fore_b));
+ }
+ else
+ {
+ raster_polygon(gr->screen, count, vx, vy,
+ SDL_MapRGB(gr->screen->format,
+ gc->fore_r,
+ gc->fore_g,
+ gc->fore_b));
+ }
+#else
+#ifdef SDL_SGE
+#ifdef ALPHA
+ sge_FilledPolygonAlpha(gr->screen, count, vx, vy,
+ SDL_MapRGB(gr->screen->format,
+ gc->fore_r,
+ gc->fore_g,
+ gc->fore_b),
+ gc->fore_a);
+#else
+#ifdef ANTI_ALIAS
+ sge_AAFilledPolygon(gr->screen, count, vx, vy,
+ SDL_MapRGB(gr->screen->format,
+ gc->fore_r,
+ gc->fore_g,
+ gc->fore_b));
+#else
+ sge_FilledPolygon(gr->screen, count, vx, vy,
+ SDL_MapRGB(gr->screen->format,
+ gc->fore_r,
+ gc->fore_g,
+ gc->fore_b));
+#endif
+#endif
+#else
+ filledPolygonRGBA(gr->screen, vx, vy, count,
+ gc->fore_r, gc->fore_g, gc->fore_b, gc->fore_a);
+#endif
+#endif
+}
+
+
+
+static void
+draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
+{
+#ifdef DEBUG
+ printf("draw_rectangle: %d %d %d %d r=%d g=%d b=%d a=%d\n", p->x, p->y, w, h,
+ gc->fore_r, gc->fore_g, gc->fore_b, gc->fore_a);
+#endif
+ if(w > gr->screen->w)
+ {
+ w = gr->screen->w;
+ }
+ if(h > gr->screen->h)
+ {
+ h = gr->screen->h;
+ }
+
+#ifdef RASTER
+ raster_rect(gr->screen, p->x, p->y, w, h,
+ SDL_MapRGB(gr->screen->format,
+ gc->fore_r,
+ gc->fore_g,
+ gc->fore_b));
+#else
+#ifdef SDL_SGE
+#ifdef ALPHA
+ sge_FilledRectAlpha(gr->screen, p->x, p->y, p->x + w, p->y + h,
+ SDL_MapRGB(gr->screen->format,
+ gc->fore_r,
+ gc->fore_g,
+ gc->fore_b),
+ gc->fore_a);
+#else
+ /* no AA -- should use poly instead for that */
+ sge_FilledRect(gr->screen, p->x, p->y, p->x + w, p->y + h,
+ SDL_MapRGB(gr->screen->format,
+ gc->fore_r,
+ gc->fore_g,
+ gc->fore_b));
+#endif
+#else
+ boxRGBA(gr->screen, p->x, p->y, p->x + w, p->y + h,
+ gc->fore_r, gc->fore_g, gc->fore_b, gc->fore_a);
+#endif
+#endif
+
+}
+
+static void
+draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r)
+{
+#if 0
+ if(gc->fore_a != 0xff)
+ {
+ dbg(0, "%d %d %d %u %u:%u:%u:%u\n", p->x, p->y, r, gc->linewidth,
+ gc->fore_a, gc->fore_r, gc->fore_g, gc->fore_b);
+ }
+#endif
+
+ /* FIXME: does not quite match gtk */
+
+ /* hack for osd compass.. why is this needed!? */
+ if(gr->overlay_mode)
+ {
+ r = r / 2;
+ }
+
+#ifdef RASTER
+ if(gr->aa)
+ {
+ raster_aacircle(gr->screen, p->x, p->y, r,
+ SDL_MapRGB(gr->screen->format,
+ gc->fore_r, gc->fore_g, gc->fore_b));
+ }
+ else
+ {
+ raster_circle(gr->screen, p->x, p->y, r,
+ SDL_MapRGB(gr->screen->format,
+ gc->fore_r, gc->fore_g, gc->fore_b));
+ }
+#else
+#ifdef SDL_SGE
+#ifdef ALPHA
+ sge_FilledCircleAlpha(gr->screen, p->x, p->y, r,
+ SDL_MapRGB(gr->screen->format,
+ gc->fore_r, gc->fore_g, gc->fore_b),
+ gc->fore_a);
+#else
+#ifdef ANTI_ALIAS
+ sge_AAFilledCircle(gr->screen, p->x, p->y, r,
+ SDL_MapRGB(gr->screen->format,
+ gc->fore_r, gc->fore_g, gc->fore_b));
+#else
+ sge_FilledCircle(gr->screen, p->x, p->y, r,
+ SDL_MapRGB(gr->screen->format,
+ gc->fore_r, gc->fore_g, gc->fore_b));
+#endif
+#endif
+#else
+#ifdef ANTI_ALIAS
+ aacircleRGBA(gr->screen, p->x, p->y, r,
+ gc->fore_r, gc->fore_g, gc->fore_b, gc->fore_a);
+#else
+ filledCircleRGBA(gr->screen, p->x, p->y, r,
+ gc->fore_r, gc->fore_g, gc->fore_b, gc->fore_a);
+#endif
+#endif
+#endif
+}
+
+
+static void
+draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
+{
+ /* you might expect lines to be simpler than the other shapes.
+ but, that would be wrong. 1 line can generate 1 polygon + 2 circles
+ and even worse, we have to calculate their parameters!
+ go dust off your trigonometry hat.
+ */
+#if 0
+ int i, l, x_inc, y_inc, lw;
+
+ lw = gc->linewidth;
+
+ for(i = 0; i < count-1; i++)
+ {
+#ifdef DEBUG
+ printf("draw_lines: %p %d %d,%d->%d,%d %d\n", gc, i, p[i].x, p[i].y, p[i+1].x, p[i+1].y, gc->linewidth);
+#endif
+ for(l = 0; l < lw; l++)
+ {
+ /* FIXME: center? */
+#if 1
+ if(p[i].x != p[i+1].x)
+ {
+ x_inc = l - (lw/2);
+ }
+ else
+ {
+ x_inc = 0;
+ }
+
+ if(p[i].y != p[i+1].y)
+ {
+ y_inc = l - (lw/2);
+ }
+ else
+ {
+ y_inc = 0;
+ }
+#else
+ x_inc = 0;
+ y_inc = 0;
+#endif
+
+#ifdef ANTI_ALIAS
+ aalineRGBA(gr->screen, p[i].x + x_inc, p[i].y + y_inc, p[i+1].x + x_inc, p[i+1].y + y_inc,
+ gc->fore_r, gc->fore_g, gc->fore_b, gc->fore_a);
+#else
+ lineRGBA(gr->screen, p[i].x + x_inc, p[i].y + y_inc, p[i+1].x + x_inc, p[i+1].y + y_inc,
+ gc->fore_r, gc->fore_g, gc->fore_b, gc->fore_a);
+#endif
+ }
+ }
+#else
+ /* sort of based on graphics_opengl.c::draw_lines */
+ /* FIXME: should honor ./configure flag for no fp.
+ this could be 100% integer code pretty easily,
+ except that i am lazy
+ */
+ struct point vert[4];
+ int lw = gc->linewidth;
+ //int lw = 1;
+ int i;
+
+ for(i = 0; i < count-1; i++)
+ {
+ float dx=p[i+1].x-p[i].x;
+ float dy=p[i+1].y-p[i].y;
+
+#if 0
+ float cx=(p[i+1].x+p[i].x)/2;
+ float cy=(p[i+1].y+p[i].y)/2;
+#endif
+
+ float angle;
+
+ int x_lw_adj, y_lw_adj;
+
+ if(lw == 1)
+ {
+#ifdef RASTER
+ if(gr->aa)
+ {
+ raster_aaline(gr->screen, p[i].x, p[i].y, p[i+1].x, p[i+1].y,
+ SDL_MapRGB(gr->screen->format,
+ gc->fore_r, gc->fore_g, gc->fore_b));
+ }
+ else
+ {
+ raster_line(gr->screen, p[i].x, p[i].y, p[i+1].x, p[i+1].y,
+ SDL_MapRGB(gr->screen->format,
+ gc->fore_r, gc->fore_g, gc->fore_b));
+ }
+#else
+#ifdef SDL_SGE
+#ifdef ALPHA
+ sge_LineAlpha(gr->screen, p[i].x, p[i].y, p[i+1].x, p[i+1].y,
+ SDL_MapRGB(gr->screen->format,
+ gc->fore_r, gc->fore_g, gc->fore_b),
+ gc->fore_a);
+#else
+#ifdef ANTI_ALIAS
+ sge_AALine(gr->screen, p[i].x, p[i].y, p[i+1].x, p[i+1].y,
+ SDL_MapRGB(gr->screen->format,
+ gc->fore_r, gc->fore_g, gc->fore_b));
+#else
+ sge_Line(gr->screen, p[i].x, p[i].y, p[i+1].x, p[i+1].y,
+ SDL_MapRGB(gr->screen->format,
+ gc->fore_r, gc->fore_g, gc->fore_b));
+#endif
+#endif
+#else
+#ifdef ANTI_ALIAS
+ aalineRGBA(gr->screen, p[i].x, p[i].y, p[i+1].x, p[i+1].y,
+ gc->fore_r, gc->fore_g, gc->fore_b, gc->fore_a);
+#else
+ lineRGBA(gr->screen, p[i].x, p[i].y, p[i+1].x, p[i+1].y,
+ gc->fore_r, gc->fore_g, gc->fore_b, gc->fore_a);
+#endif
+#endif
+#endif
+ }
+ else
+ {
+ /* there is probably a much simpler way but this works ok */
+
+ /* FIXME: float + double mixture */
+ /* FIXME: lrint(round())? */
+ if(dy == 0.0)
+ {
+ angle = 0.0;
+ x_lw_adj = 0;
+ y_lw_adj = round((float)lw/2.0);
+ }
+ else if(dx == 0.0)
+ {
+ angle = 0.0;
+ x_lw_adj = round((float)lw/2.0);
+ y_lw_adj = 0;
+ }
+ else
+ {
+ angle = (M_PI/2.0) - atan(abs(dx)/abs(dy));
+ x_lw_adj = round(sin(angle)*(float)lw/2.0);
+ y_lw_adj = round(cos(angle)*(float)lw/2.0);
+ if((x_lw_adj < 0) || (y_lw_adj < 0))
+ {
+ printf("i=%d\n", i);
+ printf(" %d,%d->%d,%d\n", p[i].x, p[i].y, p[i+1].x, p[i+1].y);
+ printf(" lw=%d angle=%f\n", lw, 180.0 * angle / M_PI);
+ printf(" x_lw_adj=%d y_lw_adj=%d\n", x_lw_adj, y_lw_adj);
+ }
+ }
+
+ if(p[i+1].x > p[i].x)
+ {
+ x_lw_adj = -x_lw_adj;
+ }
+ if(p[i+1].y > p[i].y)
+ {
+ y_lw_adj = -y_lw_adj;
+ }
+
+#if 0
+ if(((y_lw_adj*y_lw_adj)+(x_lw_adj*x_lw_adj)) != (lw/2)*(lw/2))
+ {
+ printf("i=%d\n", i);
+ printf(" %d,%d->%d,%d\n", p[i].x, p[i].y, p[i+1].x, p[i+1].y);
+ printf(" lw=%d angle=%f\n", lw, 180.0 * angle / M_PI);
+ printf(" x_lw_adj=%d y_lw_adj=%d\n", x_lw_adj, y_lw_adj);
+ }
+#endif
+
+ /* FIXME: draw a circle/square if p[i]==p[i+1]? */
+ /* FIXME: clipping, check for neg values. hoping sdl-gfx does this */
+ vert[0].x = p[i].x + x_lw_adj;
+ vert[0].y = p[i].y - y_lw_adj;
+ vert[1].x = p[i].x - x_lw_adj;
+ vert[1].y = p[i].y + y_lw_adj;
+ vert[2].x = p[i+1].x - x_lw_adj;
+ vert[2].y = p[i+1].y + y_lw_adj;
+ vert[3].x = p[i+1].x + x_lw_adj;
+ vert[3].y = p[i+1].y - y_lw_adj;
+
+ draw_polygon(gr, gc, vert, 4);
+
+ /* draw small circles at the ends. this looks better than nothing, and slightly
+ * better than the triangle used by graphics_opengl, but is more expensive.
+ * should have an ifdef/xml attr?
+ */
+
+ /* FIXME: should just draw a half circle */
+
+ /* now some circular endcaps, if the width is over 2 */
+ if(lw > 2)
+ {
+ if(i == 0)
+ {
+ draw_circle(gr, gc, &p[i], lw/2);
+ }
+ /* we truncate on the divide on purpose, so we don't go outside the line */
+ draw_circle(gr, gc, &p[i+1], lw/2);
+ }
+ }
+ }
+#endif
+}
+
+
+#ifdef SDL_TTF
+static void
+draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *gf, char *text, struct point *p, int dx, int dy)
+{
+ SDL_Surface *ss;
+ SDL_Color f, b;
+ SDL_Rect r;
+
+#if 0
+ /* correct? */
+ f.r = bg->back_r;
+ f.g = bg->back_g;
+ f.b = bg->back_b;
+ b.r = bg->back_r;
+ b.g = bg->back_g;
+ b.b = bg->back_b;
+#else
+ f.r = 0xff;
+ f.g = 0xff;
+ f.b = 0xff;
+ b.r = 0x00;
+ b.g = 0x00;
+ b.b = 0x00;
+#endif
+
+ /* TODO: dx + dy? */
+
+ ss = TTF_RenderUTF8_Solid(gf->font, text, b);
+ if(ss)
+ {
+ r.x = p->x;
+ r.y = p->y;
+ r.w = ss->w;
+ r.h = ss->h;
+ //SDL_SetAlpha(ss, SDL_SRCALPHA, SDL_ALPHA_OPAQUE);
+ SDL_BlitSurface(ss, NULL, gr->screen, &r);
+ }
+}
+#else
+
+struct text_glyph {
+ int x,y,w,h;
+ unsigned char *shadow;
+ unsigned char pixmap[0];
+};
+
+struct text_render {
+ int x1,y1;
+ int x2,y2;
+ int x3,y3;
+ int x4,y4;
+ int glyph_count;
+ struct text_glyph *glyph[0];
+};
+
+static unsigned char *
+display_text_render_shadow(struct text_glyph *g)
+{
+ int mask0, mask1, mask2, x, y, w=g->w, h=g->h;
+ int str=(g->w+9)/8;
+ unsigned char *shadow;
+ unsigned char *p, *pm=g->pixmap;
+
+ shadow=malloc(str*(g->h+2));
+ memset(shadow, 0, str*(g->h+2));
+ for (y = 0 ; y < h ; y++) {
+ p=shadow+str*y;
+ mask0=0x4000;
+ mask1=0xe000;
+ mask2=0x4000;
+ for (x = 0 ; x < w ; x++) {
+ if (pm[x+y*w]) {
+ p[0]|=(mask0 >> 8);
+ if (mask0 & 0xff)
+ p[1]|=mask0;
+
+ p[str]|=(mask1 >> 8);
+ if (mask1 & 0xff)
+ p[str+1]|=mask1;
+ p[str*2]|=(mask2 >> 8);
+ if (mask2 & 0xff)
+ p[str*2+1]|=mask2;
+ }
+ mask0 >>= 1;
+ mask1 >>= 1;
+ mask2 >>= 1;
+ if (!((mask0 >> 8) | (mask1 >> 8) | (mask2 >> 8))) {
+ mask0<<=8;
+ mask1<<=8;
+ mask2<<=8;
+ p++;
+ }
+ }
+ }
+ return shadow;
+}
+
+
+static struct text_render *
+display_text_render(char *text, struct graphics_font_priv *font, int dx, int dy, int x, int y)
+{
+ FT_GlyphSlot slot = font->face->glyph; // a small shortcut
+ FT_Matrix matrix;
+ FT_Vector pen;
+ FT_UInt glyph_index;
+ int n,len;
+ struct text_render *ret;
+ struct text_glyph *curr;
+ char *p=text;
+
+ len=g_utf8_strlen(text, -1);
+ ret=g_malloc(sizeof(*ret)+len*sizeof(struct text_glyph *));
+ ret->glyph_count=len;
+
+ matrix.xx = dx;
+ matrix.xy = dy;
+ matrix.yx = -dy;
+ matrix.yy = dx;
+
+ pen.x = 0 * 64;
+ pen.y = 0 * 64;
+ x <<= 6;
+ y <<= 6;
+ FT_Set_Transform( font->face, &matrix, &pen );
+
+ for ( n = 0; n < len; n++ )
+ {
+
+ glyph_index = FT_Get_Char_Index(font->face, g_utf8_get_char(p));
+ FT_Load_Glyph(font->face, glyph_index, FT_LOAD_DEFAULT );
+ FT_Render_Glyph(font->face->glyph, ft_render_mode_normal );
+
+ curr=g_malloc(sizeof(*curr)+slot->bitmap.rows*slot->bitmap.pitch);
+ ret->glyph[n]=curr;
+
+ curr->x=(x>>6)+slot->bitmap_left;
+ curr->y=(y>>6)-slot->bitmap_top;
+ curr->w=slot->bitmap.width;
+ curr->h=slot->bitmap.rows;
+ if (slot->bitmap.width && slot->bitmap.rows) {
+ memcpy(curr->pixmap, slot->bitmap.buffer, slot->bitmap.rows*slot->bitmap.pitch);
+ curr->shadow=display_text_render_shadow(curr);
+ }
+ else
+ curr->shadow=NULL;
+#if 0
+ printf("height=%d\n", slot->metrics.height);
+ printf("height2=%d\n", face->height);
+ printf("bbox %d %d %d %d\n", face->bbox.xMin, face->bbox.yMin, face->bbox.xMax, face->bbox.yMax);
+#endif
+#if 0
+ printf("slot->advance x %d y %d\n",
+ slot->advance.x,
+ slot->advance.y);
+#endif
+
+ x += slot->advance.x;
+ y -= slot->advance.y;
+ p=g_utf8_next_char(p);
+ }
+ return ret;
+}
+
+#if 0
+static void hexdump(unsigned char *buf, unsigned int w, unsigned int h)
+{
+ int x, y;
+ printf("hexdump %u %u\n", w, h);
+ for(y = 0; y < h; y++)
+ {
+ for(x = 0; x < w; x++)
+ {
+ printf("%02x ", buf[y*w+x]);
+ }
+ printf("\n");
+ }
+}
+
+static void bitdump(unsigned char *buf, unsigned int w, unsigned int h)
+{
+ int x, pos;
+ printf("bitdump %u %u\n", w, h);
+ pos = 0;
+ for(x = 0; x < h * w; x++)
+ {
+ if(buf[pos] & (1 << (x&0x7)))
+ {
+ printf("00 ");
+ }
+ else
+ {
+ printf("ff ");
+ }
+
+ if((x & 0x7) == 0x7)
+ {
+ pos++;
+ }
+
+ if((x % w) == (w-1))
+ {
+ printf("\n");
+ }
+ }
+ printf("\n");
+}
+#endif
+
+#if 0
+static void sdl_inv_grayscale_pal_set(SDL_Surface *ss)
+{
+ SDL_Color c;
+ int i;
+
+ for(i = 0; i < 256; i++)
+ {
+ c.r = 255-i;
+ c.g = 255-i;
+ c.b = 255-i;
+ SDL_SetPalette(ss, SDL_LOGPAL, &c, i, 1);
+ }
+}
+
+static void sdl_scale_pal_set(SDL_Surface *ss, Uint8 r, Uint8 g, Uint8 b)
+{
+ SDL_Color c;
+ int i;
+
+ for(i = 0; i < 256; i++)
+ {
+ c.r = (i * r) / 256;
+ c.g = (i * g) / 256;
+ c.b = (i * b) / 256;
+ SDL_SetPalette(ss, SDL_LOGPAL, &c, i, 1);
+ }
+}
+#endif
+
+#if 0
+static void sdl_fixed_pal_set(SDL_Surface *ss, Uint8 r, Uint8 g, Uint8 b)
+{
+ SDL_Color c;
+ int i;
+
+ c.r = r;
+ c.g = g;
+ c.b = b;
+ for(i = 0; i < 256; i++)
+ {
+ SDL_SetPalette(ss, SDL_LOGPAL, &c, i, 1);
+ }
+}
+#endif
+
+static void
+display_text_draw(struct text_render *text, struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg)
+{
+ int i, x, y, poff, soff, col_lev;
+ struct text_glyph *gly, **gp;
+ Uint32 pix;
+ Uint8 r, g, b;
+
+#if 0
+ dbg(0,"%u %u %u %u, %u %u %u %u\n",
+ fg->fore_a, fg->fore_r, fg->fore_g, fg->fore_b,
+ fg->back_a, fg->back_r, fg->back_g, fg->back_b);
+
+ dbg(0,"%u %u %u %u, %u %u %u %u\n",
+ bg->fore_a, bg->fore_r, bg->fore_g, bg->fore_b,
+ bg->back_a, bg->back_r, bg->back_g, bg->back_b);
+#endif
+
+ if(bg)
+ {
+ col_lev = bg->fore_r + bg->fore_g + bg->fore_b;
+ }
+ else
+ {
+ col_lev = 0;
+ }
+
+ /* TODO: lock/unlock in draw_mode() to reduce overhead */
+ SDL_LockSurface(gr->screen);
+ gp=text->glyph;
+ i=text->glyph_count;
+ while (i-- > 0)
+ {
+ gly=*gp++;
+ if (gly->w && gly->h)
+ {
+#if 0
+ if(gly->shadow && bg)
+ {
+ hexdump(gly->pixmap, gly->w, gly->h);
+ bitdump(gly->shadow, gly->w+2, gly->h+2);
+ }
+#endif
+
+ for(y = 0; y < gly->h + 2; y++)
+ {
+ if(gly->y - 1 + y < 0)
+ {
+ continue;
+ }
+
+ if(((gly->y-1) + y) >= gr->screen->h)
+ {
+ break;
+ }
+
+ for(x = 0; x < gly->w + 2; x++)
+ {
+ if(gly->x - 1 + x < 0)
+ {
+ continue;
+ }
+
+ if(((gly->x-1) + x) >= gr->screen->w)
+ {
+ break;
+ }
+
+ poff = gr->screen->w * ((gly->y-1) + y) + ((gly->x-1) + x);
+ poff = poff * gr->screen->format->BytesPerPixel;
+
+ switch(gr->screen->format->BytesPerPixel)
+ {
+ case 2:
+ {
+ pix = *(Uint16 *)((Uint8*)gr->screen->pixels + poff);
+ break;
+ }
+ case 4:
+ {
+ pix = *(Uint32 *)((Uint8*)gr->screen->pixels + poff);
+ break;
+ }
+ default:
+ {
+ pix = 0;
+ break;
+ }
+ }
+
+ SDL_GetRGB(pix,
+ gr->screen->format,
+ &r,
+ &g,
+ &b);
+
+#ifdef DEBUG
+ printf("%u %u -> %u off\n",
+ gly->x,
+ gly->y,
+ off);
+
+ printf("%u,%u: %u %u %u in\n",
+ x, y,
+ r, g, b, off);
+#endif
+
+
+
+ if(gly->shadow && bg)
+ {
+ soff = (8 * ((gly->w+9)/8) * y) + x;
+ pix = gly->shadow[soff/8];
+
+ if(pix & (1 << (7-(soff&0x7))))
+ {
+ if(col_lev >= 3*0x80)
+ {
+ r |= bg->fore_r;
+ g |= bg->fore_g;
+ b |= bg->fore_b;
+ }
+ else
+ {
+ r &= ~bg->fore_r;
+ g &= ~bg->fore_g;
+ b &= ~bg->fore_b;
+ }
+ }
+ }
+
+ /* glyph */
+ if((x > 0) && (x <= gly->w) &&
+ (y > 0) && (y <= gly->h))
+ {
+ if(bg && (col_lev >= 3*0x80))
+ {
+ r &= ~gly->pixmap[gly->w * (y-1) + (x-1)];
+ g &= ~gly->pixmap[gly->w * (y-1) + (x-1)];
+ b &= ~gly->pixmap[gly->w * (y-1) + (x-1)];
+ }
+ else
+ {
+ r |= gly->pixmap[gly->w * (y-1) + (x-1)];
+ g |= gly->pixmap[gly->w * (y-1) + (x-1)];
+ b |= gly->pixmap[gly->w * (y-1) + (x-1)];
+ }
+ }
+
+#ifdef DEBUG
+ printf("%u,%u: %u %u %u out\n",
+ x, y,
+ r, g, b);
+#endif
+
+ pix = SDL_MapRGB(gr->screen->format,
+ r,
+ g,
+ b);
+
+ switch(gr->screen->format->BytesPerPixel)
+ {
+ case 2:
+ {
+ *(Uint16 *)((Uint8*)gr->screen->pixels + poff) = pix;
+ break;
+ }
+ case 4:
+ {
+ *(Uint32 *)((Uint8*)gr->screen->pixels + poff) = pix;
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+ }
+
+ //dbg(0, "glyph %d %d %d %d\n", g->x, g->y, g->w, g->h);
+ }
+ }
+ SDL_UnlockSurface(gr->screen);
+}
+
+static void
+display_text_free(struct text_render *text)
+{
+ int i;
+ struct text_glyph **gp;
+
+ gp=text->glyph;
+ i=text->glyph_count;
+ while (i-- > 0) {
+ if ((*gp)->shadow) {
+ free((*gp)->shadow);
+ }
+ g_free(*gp++);
+ }
+ g_free(text);
+}
+
+static void
+draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
+{
+ struct text_render *t;
+
+ if (! font)
+ return;
+
+#if 0
+ if (bg) {
+ gdk_gc_set_function(fg->gc, GDK_AND_INVERT);
+ gdk_gc_set_function(bg->gc, GDK_OR);
+ }
+#endif
+
+ t=display_text_render(text, font, dx, dy, p->x, p->y);
+ display_text_draw(t, gr, fg, bg);
+ display_text_free(t);
+#if 0
+ if (bg) {
+ gdk_gc_set_function(fg->gc, GDK_COPY);
+ gdk_gc_set_function(bg->gc, GDK_COPY);
+ }
+#endif
+}
+#endif
+
+
+
+static void
+draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
+{
+#ifdef SDL_IMAGE
+ SDL_Rect r;
+
+ r.x = p->x;
+ r.y = p->y;
+ r.w = img->img->w;
+ r.h = img->img->h;
+
+ SDL_BlitSurface(img->img, NULL, gr->screen, &r);
+#endif
+}
+
+static void
+draw_image_warp(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, int count, char *data)
+{
+ /* TODO */
+}
+
+static void
+draw_restore(struct graphics_priv *gr, struct point *p, int w, int h)
+{
+#ifdef DEBUG
+ printf("draw_restore\n");
+#endif
+}
+
+static void
+background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
+{
+#ifdef DEBUG
+ printf("background_gc\n");
+#endif
+}
+
+
+static void
+draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
+{
+#ifdef PROFILE
+ struct timeval now;
+ unsigned long elapsed;
+#endif
+ struct graphics_priv *ov;
+ SDL_Rect rect;
+ int i;
+
+ if(gr->overlay_mode)
+ {
+ /* will be drawn below */
+ }
+ else
+ {
+#ifdef DEBUG
+ printf("draw_mode: %d\n", mode);
+#endif
+
+#ifdef PROFILE
+ if(mode == draw_mode_begin)
+ {
+ gettimeofday(&gr->draw_begin_tv, NULL);
+ }
+#endif
+
+ if(mode == draw_mode_end)
+ {
+ if((gr->draw_mode == draw_mode_begin) && gr->overlay_enable)
+ {
+ for(i = 0; i < OVERLAY_MAX; i++)
+ {
+ ov = gr->overlay_array[i];
+ if(ov)
+ {
+ rect.x = ov->overlay_x;
+ rect.y = ov->overlay_y;
+ rect.w = ov->screen->w;
+ rect.h = ov->screen->h;
+ SDL_BlitSurface(ov->screen, NULL,
+ gr->screen, &rect);
+ }
+ }
+ }
+
+ SDL_Flip(gr->screen);
+
+#ifdef PROFILE
+ gettimeofday(&now, NULL);
+ elapsed = 1000000 * (now.tv_sec - gr->draw_begin_tv.tv_sec);
+ elapsed += (now.tv_usec - gr->draw_begin_tv.tv_usec);
+ if(elapsed >= gr->draw_time_peak)
+ {
+ dbg(0, "draw elapsed %u usec\n", elapsed);
+ gr->draw_time_peak = elapsed;
+ }
+#endif
+ }
+
+ gr->draw_mode = mode;
+ }
+}
+
+static void overlay_disable(struct graphics_priv *gr, int disable)
+{
+ gr->overlay_enable = !disable;
+}
+
+static struct graphics_priv *
+overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int alpha, int wraparound);
+
+static int window_fullscreen(struct window *win, int on)
+{
+ /* TODO */
+ return 0;
+}
+
+static struct window sdl_win =
+{
+ NULL,
+ window_fullscreen
+
+};
+
+static void *
+get_data(struct graphics_priv *this, char *type)
+{
+ printf("get_data: %s\n", type);
+
+ if(strcmp(type, "window") == 0)
+ {
+ return &sdl_win;
+ }
+ else
+ {
+ return &dummy;
+ }
+}
+
+static void draw_drag(struct graphics_priv *gr, struct point *p)
+{
+ // FIXME
+}
+
+static struct graphics_methods graphics_methods = {
+ graphics_destroy,
+ draw_mode,
+ draw_lines,
+ draw_polygon,
+ draw_rectangle,
+ draw_circle,
+ draw_text,
+ draw_image,
+ draw_image_warp,
+ draw_restore,
+ draw_drag,
+ font_new,
+ gc_new,
+ background_gc,
+ overlay_new,
+ image_new,
+ get_data,
+// register_resize_callback,
+// register_button_callback,
+// register_motion_callback,
+ image_free,
+ get_text_bbox,
+ overlay_disable,
+// register_keypress_callback
+};
+
+static struct graphics_priv *
+overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h,int alpha, int wraparound)
+{
+ struct graphics_priv *ov;
+ int i, x, y;
+
+ for(i = 0; i < OVERLAY_MAX; i++)
+ {
+ if(gr->overlay_array[i] == NULL)
+ {
+ break;
+ }
+ }
+ if(i == OVERLAY_MAX)
+ {
+ dbg(0, "too many overlays! increase OVERLAY_MAX\n");
+ return NULL;
+ }
+ dbg(0, "x %d y %d\n", p->x, p->y);
+
+ if(p->x < 0)
+ {
+ x = gr->screen->w + p->x;
+ }
+ else
+ {
+ x = p->x;
+ }
+ if(p->y < 0)
+ {
+ y = gr->screen->h + p->y;
+ }
+ else
+ {
+ y = p->y;
+ }
+
+ dbg(1, "overlay_new %d %d %d %u %u\n", i,
+ x,
+ y,
+ w,
+ h);
+
+ ov = g_new0(struct graphics_priv, 1);
+
+ ov->screen = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA,
+ w, h,
+#if 1
+ gr->screen->format->BitsPerPixel,
+ gr->screen->format->Rmask,
+ gr->screen->format->Gmask,
+ gr->screen->format->Bmask,
+ 0x00000000);
+#else
+ 0x00ff0000,
+ 0x0000ff00,
+ 0x000000ff,
+ 0xff000000);
+#endif
+ SDL_SetAlpha(ov->screen, SDL_SRCALPHA, 128);
+
+ ov->overlay_mode = 1;
+ ov->overlay_x = x;
+ ov->overlay_y = y;
+ ov->overlay_parent = gr;
+ ov->overlay_idx = i;
+
+ gr->overlay_array[i] = ov;
+
+ *meth=graphics_methods;
+
+ return ov;
+}
+
+
+#ifdef LINUX_TOUCHSCREEN
+
+#define EVFN "/dev/input/eventX"
+
+static int input_ts_init(struct graphics_priv *gr)
+{
+ struct input_id ii;
+ char fn[32];
+#if 0
+ char name[64];
+#endif
+ int n, fd, ret;
+
+ gr->ts_fd = -1;
+ gr->ts_hit = -1;
+ gr->ts_x = 0;
+ gr->ts_y = 0;
+
+ strcpy(fn, EVFN);
+ n = 0;
+ while(1)
+ {
+ fn[sizeof(EVFN)-2] = '0' + n;
+
+ fd = open(fn, O_RDONLY);
+ if(fd >= 0)
+ {
+#if 0
+ ret = ioctl(fd, EVIOCGNAME(64), (void *)name);
+ if(ret > 0)
+ {
+ printf("input_ts: %s\n", name);
+ }
+#endif
+
+ ret = ioctl(fd, EVIOCGID, (void *)&ii);
+ if(ret == 0)
+ {
+#if 1
+ printf("bustype %04x vendor %04x product %04x version %04x\n",
+ ii.bustype,
+ ii.vendor,
+ ii.product,
+ ii.version);
+#endif
+
+ if((ii.bustype == BUS_USB) &&
+ (ii.vendor == 0x0eef) &&
+ (ii.product == 0x0001))
+ {
+ ret = fcntl(fd, F_SETFL, O_NONBLOCK);
+ if(ret == 0)
+ {
+ gr->ts_fd = fd;
+ }
+ else
+ {
+ close(fd);
+ }
+
+ break;
+ }
+ }
+
+ close(fd);
+ }
+
+ n = n + 1;
+
+ /* FIXME: should check all 32 minors */
+ if(n == 10)
+ {
+ /* not found */
+ ret = -1;
+ break;
+ }
+ }
+
+ return ret;
+}
+
+
+/* returns 0-based display coordinate for the given ts coord */
+static void input_ts_map(int *disp_x, int *disp_y,
+ uint32_t ts_x, uint32_t ts_y)
+{
+ /* Dynamix 7" (eGalax TS)
+ top left = 1986,103
+ top right = 61,114
+ bot left = 1986,1897
+ bot right = 63,1872
+
+ calibrate your TS using input_event_dump
+ and touching all four corners. use the most extreme values.
+ */
+
+#define INPUT_TS_LEFT 1978
+#define INPUT_TS_RIGHT 48
+#define INPUT_TS_TOP 115
+#define INPUT_TS_BOT 1870
+
+ /* clamp first */
+ if(ts_x > INPUT_TS_LEFT)
+ {
+ ts_x = INPUT_TS_LEFT;
+ }
+ if(ts_x < INPUT_TS_RIGHT)
+ {
+ ts_x = INPUT_TS_RIGHT;
+ }
+
+ ts_x = ts_x - INPUT_TS_RIGHT;
+
+ *disp_x = ((DISPLAY_W-1) * ts_x) / (INPUT_TS_LEFT - INPUT_TS_RIGHT);
+ *disp_x = (DISPLAY_W-1) - *disp_x;
+
+
+ if(ts_y > INPUT_TS_BOT)
+ {
+ ts_y = INPUT_TS_BOT;
+ }
+ if(ts_y < INPUT_TS_TOP)
+ {
+ ts_y = INPUT_TS_TOP;
+ }
+
+ ts_y = ts_y - INPUT_TS_TOP;
+
+ *disp_y = ((DISPLAY_H-1) * ts_y) / (INPUT_TS_BOT - INPUT_TS_TOP);
+/* *disp_y = (DISPLAY_H-1) - *disp_y; */
+}
+
+#if 0
+static void input_event_dump(struct input_event *ie)
+{
+ printf("input_event:\n"
+ "\ttv_sec\t%u\n"
+ "\ttv_usec\t%lu\n"
+ "\ttype\t%u\n"
+ "\tcode\t%u\n"
+ "\tvalue\t%d\n",
+ (unsigned int)ie->time.tv_sec,
+ ie->time.tv_usec,
+ ie->type,
+ ie->code,
+ ie->value);
+}
+#endif
+
+static int input_ts_exit(struct graphics_priv *gr)
+{
+ close(gr->ts_fd);
+ gr->ts_fd = -1;
+
+ return 0;
+}
+#endif
+
+
+static gboolean graphics_sdl_idle(void *data)
+{
+ struct graphics_priv *gr = (struct graphics_priv *)data;
+ struct point p;
+ SDL_Event ev;
+#ifdef LINUX_TOUCHSCREEN
+ struct input_event ie;
+ ssize_t ss;
+#endif
+ int ret, key;
+ char keybuf[2];
+
+ /* generate the initial resize callback, so the gui knows W/H
+
+ its unsafe to do this directly inside register_resize_callback;
+ graphics_gtk does it during Configure, but SDL does not have
+ an equivalent event, so we use our own flag
+ */
+ if(gr->resize_callback_initial != 0)
+ {
+ callback_list_call_attr_2(gr->cbl, attr_resize, (void *)gr->screen->w, (void *)gr->screen->h);
+ gr->resize_callback_initial = 0;
+ }
+
+#ifdef LINUX_TOUCHSCREEN
+ if(gr->ts_fd >= 0)
+ {
+ ss = read(gr->ts_fd, (void *)&ie, sizeof(ie));
+ if(ss == sizeof(ie))
+ {
+ /* we (usually) get three events on a touchscreen hit:
+ 1: type =EV_KEY
+ code =330 [BTN_TOUCH]
+ value=1
+
+ 2: type =EV_ABS
+ code =0 [X]
+ value=X pos
+
+ 3: type =EV_ABS
+ code =1 [Y]
+ value=Y pos
+
+ 4: type =EV_SYN
+
+ once hit, if the contact point changes, we'll get more
+ EV_ABS (for 1 or both axes), followed by an EV_SYN.
+
+ and, on a lift:
+
+ 5: type =EV_KEY
+ code =330 [BTN_TOUCH]
+ value=0
+
+ 6: type =EV_SYN
+ */
+ switch(ie.type)
+ {
+ case EV_KEY:
+ {
+ if(ie.code == BTN_TOUCH)
+ {
+ gr->ts_hit = ie.value;
+ }
+
+ break;
+ }
+
+ case EV_ABS:
+ {
+ if(ie.code == 0)
+ {
+ gr->ts_x = ie.value;
+ }
+ else if(ie.code == 1)
+ {
+ gr->ts_y = ie.value;
+ }
+
+ break;
+ }
+
+ case EV_SYN:
+ {
+ input_ts_map(&p.x, &p.y, gr->ts_x, gr->ts_y);
+
+ /* always send MOUSE_MOTION (first) */
+ callback_list_call_attr_1(gr->cbl, attr_motion, (void *)&p);
+ if(gr->ts_hit > 0)
+ {
+ callback_list_call_attr_3(gr->cbl, attr_button, (void *)1, (void *)SDL_BUTTON_LEFT, (void *)&p);
+ }
+ else if(gr->ts_hit == 0)
+ {
+ callback_list_call_attr_3(gr->cbl, attr_button, (void *)0, (void *)SDL_BUTTON_LEFT, (void *)&p);
+ }
+
+ /* reset ts_hit */
+ gr->ts_hit = -1;
+
+ break;
+ }
+
+ default:
+ {
+ break;
+ }
+ }
+ }
+ }
+#endif
+
+ while(1)
+ {
+ ret = SDL_PollEvent(&ev);
+ if(ret == 0)
+ {
+ break;
+ }
+
+ switch(ev.type)
+ {
+ case SDL_MOUSEMOTION:
+ {
+ p.x = ev.motion.x;
+ p.y = ev.motion.y;
+ callback_list_call_attr_1(gr->cbl, attr_motion, (void *)&p);
+ break;
+ }
+
+ case SDL_KEYDOWN:
+ {
+ switch(ev.key.keysym.sym)
+ {
+ case SDLK_LEFT:
+ {
+ key = NAVIT_KEY_LEFT;
+ break;
+ }
+ case SDLK_RIGHT:
+ {
+ key = NAVIT_KEY_RIGHT;
+ break;
+ }
+ case SDLK_BACKSPACE:
+ {
+ key = NAVIT_KEY_BACKSPACE;
+ break;
+ }
+ case SDLK_RETURN:
+ {
+ key = NAVIT_KEY_RETURN;
+ break;
+ }
+ case SDLK_DOWN:
+ {
+ key = NAVIT_KEY_DOWN;
+ break;
+ }
+ case SDLK_PAGEUP:
+ {
+ key = NAVIT_KEY_ZOOM_OUT;
+ break;
+ }
+ case SDLK_UP:
+ {
+ key = NAVIT_KEY_UP;
+ break;
+ }
+ case SDLK_PAGEDOWN:
+ {
+ key = NAVIT_KEY_ZOOM_IN;
+ break;
+ }
+ default:
+ {
+ key = 0;
+ break;
+ }
+ }
+
+ keybuf[0] = key;
+ keybuf[1] = '\0';
+ callback_list_call_attr_1(gr->cbl, attr_keypress, (void *)keybuf);
+
+ break;
+ }
+
+ case SDL_KEYUP:
+ {
+ break;
+ }
+
+ case SDL_MOUSEBUTTONDOWN:
+ {
+#ifdef DEBUG
+ printf("SDL_MOUSEBUTTONDOWN %d %d %d %d %d\n",
+ ev.button.which,
+ ev.button.button,
+ ev.button.state,
+ ev.button.x,
+ ev.button.y);
+#endif
+
+ p.x = ev.button.x;
+ p.y = ev.button.y;
+ callback_list_call_attr_3(gr->cbl, attr_button, (void *)1, (void *)(int)ev.button.button, (void *)&p);
+ break;
+ }
+
+ case SDL_MOUSEBUTTONUP:
+ {
+#ifdef DEBUG
+ printf("SDL_MOUSEBUTTONUP %d %d %d %d %d\n",
+ ev.button.which,
+ ev.button.button,
+ ev.button.state,
+ ev.button.x,
+ ev.button.y);
+#endif
+
+ p.x = ev.button.x;
+ p.y = ev.button.y;
+ callback_list_call_attr_3(gr->cbl, attr_button, (void *)0, (void *)(int)ev.button.button, (void *)&p);
+ break;
+ }
+
+ case SDL_QUIT:
+ {
+ navit_destroy(gr->nav);
+ break;
+ }
+
+ case SDL_VIDEORESIZE:
+ {
+
+ gr->screen = SDL_SetVideoMode(ev.resize.w, ev.resize.h, 16, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_RESIZABLE);
+ if(gr->screen == NULL)
+ {
+ navit_destroy(gr->nav);
+ }
+ else
+ {
+ callback_list_call_attr_2(gr->cbl, attr_resize, (void *)gr->screen->w, (void *)gr->screen->h);
+ }
+
+ break;
+ }
+
+ default:
+ {
+#ifdef DEBUG
+ printf("SDL_Event %d\n", ev.type);
+#endif
+ break;
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+
+static struct graphics_priv *
+graphics_sdl_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl)
+{
+ struct graphics_priv *this=g_new0(struct graphics_priv, 1);
+ struct attr *attr;
+ int ret;
+ int w=DISPLAY_W,h=DISPLAY_H;
+
+ this->nav = nav;
+ this->cbl = cbl;
+
+ ret = SDL_Init(SDL_INIT_VIDEO);
+ if(ret < 0)
+ {
+ g_free(this);
+ return NULL;
+ }
+
+#ifdef SDL_TTF
+ ret = TTF_Init();
+ if(ret < 0)
+ {
+ g_free(this);
+ SDL_Quit();
+ return NULL;
+ }
+#else
+ FT_Init_FreeType( &this->library );
+#endif
+
+ if (! event_request_system("glib","graphics_sdl_new"))
+ return NULL;
+
+
+ /* TODO: xml params for BPP */
+ if ((attr=attr_search(attrs, NULL, attr_w)))
+ w=attr->u.num;
+ if ((attr=attr_search(attrs, NULL, attr_h)))
+ h=attr->u.num;
+
+
+ this->screen = SDL_SetVideoMode(w, h, 16, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_RESIZABLE);
+ if(this->screen == NULL)
+ {
+ g_free(this);
+ SDL_Quit();
+ return NULL;
+ }
+
+ SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
+
+ SDL_WM_SetCaption("navit", NULL);
+
+#ifdef LINUX_TOUCHSCREEN
+ input_ts_init(this);
+ if(this->ts_fd >= 0)
+ {
+ /* mouse cursor does not always display correctly in Linux FB.
+ anyway, it is unnecessary w/ a touch screen
+ */
+ SDL_ShowCursor(0);
+ }
+#endif
+
+#ifdef SDL_SGE
+ sge_Update_OFF();
+ sge_Lock_ON();
+#endif
+
+ *meth=graphics_methods;
+
+ g_timeout_add(10, graphics_sdl_idle, this);
+
+ this->overlay_enable = 1;
+
+ this->aa = 1;
+ if((attr=attr_search(attrs, NULL, attr_antialias)))
+ this->aa = attr->u.num;
+
+ this->resize_callback_initial=1;
+ return this;
+}
+
+void
+plugin_init(void)
+{
+ plugin_register_graphics_type("sdl", graphics_sdl_new);
+}
+
diff --git a/graphics/sdl/raster.c b/graphics/sdl/raster.c
new file mode 100644
index 00000000..dd54cd4a
--- /dev/null
+++ b/graphics/sdl/raster.c
@@ -0,0 +1,2022 @@
+/* raster.c -- line/rect/circle/poly rasterization
+
+ copyright (c) 2008 bryan rittmeyer <bryanr@bryanr.org>
+ license: LGPLv2
+
+ based on SDL_gfx (c) A. Schiffler
+ and SGE (c)1999-2003 Anders Lindström
+
+ + added filled anti-aliased polygons
+ + fixed some bugs and improved performance
+
+ revision history
+ 2008-07-05 initial
+ 2008-07-06 aacircle
+*/
+
+
+#include <math.h>
+
+#include "raster.h"
+
+#undef DEBUG
+#undef PARANOID
+
+
+/* raster_rect */
+
+static inline void raster_rect_inline(SDL_Surface *dst, int16_t x1, int16_t y1, int16_t w, int16_t h, uint32_t color)
+{
+ /* sge */
+ SDL_Rect rect;
+
+#if 1
+ if((w <= 0) || (h <= 0))
+ {
+ return;
+ }
+
+#if 0
+ if(x1 < 0)
+ {
+ if((x1 + w) < 0)
+ {
+ return;
+ }
+ else
+ {
+ w = w + x1;
+ x1 = 0;
+ }
+ }
+ if(y1 < 0)
+ {
+ if((y1 + h) < 0)
+ {
+ return;
+ }
+ else
+ {
+ h = h + y1;
+ y1 = 0;
+ }
+ }
+
+ if(x1 + w >= dst->w)
+ {
+ w = dst->w - x1;
+ }
+ if(y1 + h >= dst->h)
+ {
+ h = dst->h - y1;
+ }
+#endif
+
+ rect.x = x1;
+ rect.y = y1;
+ rect.w = w;
+ rect.h = h;
+
+ /* will clip internally */
+ SDL_FillRect(dst, &rect, color);
+
+#else
+
+ x2 = x1 + w;
+ y2 = y1 + h;
+
+ /*
+ * Order coordinates to ensure that
+ * x1<=x2 and y1<=y2
+ */
+ if (x1 > x2) {
+ tmp = x1;
+ x1 = x2;
+ x2 = tmp;
+ }
+ if (y1 > y2) {
+ tmp = y1;
+ y1 = y2;
+ y2 = tmp;
+ }
+
+ /*
+ * Get clipping boundary and
+ * check visibility
+ */
+ left = dst->clip_rect.x;
+ if (x2<left) {
+ return(0);
+ }
+ right = dst->clip_rect.x + dst->clip_rect.w - 1;
+ if (x1>right) {
+ return(0);
+ }
+ top = dst->clip_rect.y;
+ if (y2<top) {
+ return(0);
+ }
+ bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
+ if (y1>bottom) {
+ return(0);
+ }
+
+ /* Clip all points */
+ if (x1<left) {
+ x1=left;
+ } else if (x1>right) {
+ x1=right;
+ }
+ if (x2<left) {
+ x2=left;
+ } else if (x2>right) {
+ x2=right;
+ }
+ if (y1<top) {
+ y1=top;
+ } else if (y1>bottom) {
+ y1=bottom;
+ }
+ if (y2<top) {
+ y2=top;
+ } else if (y2>bottom) {
+ y2=bottom;
+ }
+
+#if 0
+ /*
+ * Test for special cases of straight line or single point
+ */
+ if (x1 == x2) {
+ if (y1 == y2) {
+ return (pixelColor(dst, x1, y1, color));
+ } else {
+ return (vlineColor(dst, x1, y1, y2, color));
+ }
+ }
+ if (y1 == y2) {
+ return (hlineColor(dst, x1, x2, y1, color));
+ }
+#endif
+
+ /*
+ * Calculate width&height
+ */
+ w = x2 - x1;
+ h = y2 - y1;
+
+ /*
+ * No alpha-blending required
+ */
+
+#if 0
+ /*
+ * Setup color
+ */
+ colorptr = (Uint8 *) & color;
+ if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
+ color = SDL_MapRGBA(dst->format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]);
+ } else {
+ color = SDL_MapRGBA(dst->format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]);
+ }
+#endif
+
+ /*
+ * Lock surface
+ */
+ SDL_LockSurface(dst);
+
+ /*
+ * More variable setup
+ */
+ dx = w;
+ dy = h;
+ pixx = dst->format->BytesPerPixel;
+ pixy = dst->pitch;
+ pixel = ((Uint8 *) dst->pixels) + pixx * (int) x1 + pixy * (int) y1;
+ pixellast = pixel + pixx * dx + pixy * dy;
+ dx++;
+
+ /*
+ * Draw
+ */
+ switch (dst->format->BytesPerPixel) {
+ case 1:
+ for (; pixel <= pixellast; pixel += pixy) {
+ memset(pixel, (Uint8) color, dx);
+ }
+ break;
+ case 2:
+ pixy -= (pixx * dx);
+ for (; pixel <= pixellast; pixel += pixy) {
+ for (x = 0; x < dx; x++) {
+ *(Uint16*) pixel = color;
+ pixel += pixx;
+ }
+ }
+ break;
+ case 3:
+ pixy -= (pixx * dx);
+ for (; pixel <= pixellast; pixel += pixy) {
+ for (x = 0; x < dx; x++) {
+ if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
+ pixel[0] = (color >> 16) & 0xff;
+ pixel[1] = (color >> 8) & 0xff;
+ pixel[2] = color & 0xff;
+ } else {
+ pixel[0] = color & 0xff;
+ pixel[1] = (color >> 8) & 0xff;
+ pixel[2] = (color >> 16) & 0xff;
+ }
+ pixel += pixx;
+ }
+ }
+ break;
+ default: /* case 4 */
+ pixy -= (pixx * dx);
+ for (; pixel <= pixellast; pixel += pixy) {
+ for (x = 0; x < dx; x++) {
+ *(Uint32 *) pixel = color;
+ pixel += pixx;
+ }
+ }
+ break;
+ }
+
+ /*
+ * Unlock surface
+ */
+ SDL_UnlockSurface(dst);
+
+#endif
+}
+
+void raster_rect(SDL_Surface *s, int16_t x, int16_t y, int16_t w, int16_t h, uint32_t col)
+{
+ raster_rect_inline(s, x, y, w, h, col);
+}
+
+#define raster_rect_inline raster_rect
+
+
+/* raster :: pixel */
+
+#define MODIFIED_ALPHA_PIXEL_ROUTINE
+
+
+#define clip_xmin(surface) surface->clip_rect.x
+#define clip_xmax(surface) surface->clip_rect.x+surface->clip_rect.w-1
+#define clip_ymin(surface) surface->clip_rect.y
+#define clip_ymax(surface) surface->clip_rect.y+surface->clip_rect.h-1
+
+
+static void raster_PutPixel(SDL_Surface *surface, Sint16 x, Sint16 y, Uint32 color)
+{
+ if(x>=clip_xmin(surface) && x<=clip_xmax(surface) && y>=clip_ymin(surface) && y<=clip_ymax(surface)){
+ switch (surface->format->BytesPerPixel) {
+ case 1: { /* Assuming 8-bpp */
+ *((Uint8 *)surface->pixels + y*surface->pitch + x) = color;
+ }
+ break;
+
+ case 2: { /* Probably 15-bpp or 16-bpp */
+ *((Uint16 *)surface->pixels + y*surface->pitch/2 + x) = color;
+ }
+ break;
+
+ case 3: { /* Slow 24-bpp mode, usually not used */
+ Uint8 *pix = (Uint8 *)surface->pixels + y * surface->pitch + x*3;
+
+ /* Gack - slow, but endian correct */
+ *(pix+surface->format->Rshift/8) = color>>surface->format->Rshift;
+ *(pix+surface->format->Gshift/8) = color>>surface->format->Gshift;
+ *(pix+surface->format->Bshift/8) = color>>surface->format->Bshift;
+ *(pix+surface->format->Ashift/8) = color>>surface->format->Ashift;
+ }
+ break;
+
+ case 4: { /* Probably 32-bpp */
+ *((Uint32 *)surface->pixels + y*surface->pitch/4 + x) = color;
+ }
+ break;
+ }
+ }
+}
+
+/* PutPixel routine with alpha blending, input color in destination format */
+
+/* New, faster routine - default blending pixel */
+
+static void raster_PutPixelAlpha(SDL_Surface * surface, Sint16 x, Sint16 y, Uint32 color, Uint8 alpha)
+{
+ /* sdl-gfx */
+ Uint32 Rmask = surface->format->Rmask, Gmask =
+ surface->format->Gmask, Bmask = surface->format->Bmask, Amask = surface->format->Amask;
+ Uint32 R = 0, G = 0, B = 0, A = 0;
+
+ if (x >= clip_xmin(surface) && x <= clip_xmax(surface)
+ && y >= clip_ymin(surface) && y <= clip_ymax(surface)) {
+
+ switch (surface->format->BytesPerPixel) {
+ case 1:{ /* Assuming 8-bpp */
+ if (alpha == 255) {
+ *((Uint8 *) surface->pixels + y * surface->pitch + x) = color;
+ } else {
+ Uint8 *pixel = (Uint8 *) surface->pixels + y * surface->pitch + x;
+
+ Uint8 dR = surface->format->palette->colors[*pixel].r;
+ Uint8 dG = surface->format->palette->colors[*pixel].g;
+ Uint8 dB = surface->format->palette->colors[*pixel].b;
+ Uint8 sR = surface->format->palette->colors[color].r;
+ Uint8 sG = surface->format->palette->colors[color].g;
+ Uint8 sB = surface->format->palette->colors[color].b;
+
+ dR = dR + ((sR - dR) * alpha >> 8);
+ dG = dG + ((sG - dG) * alpha >> 8);
+ dB = dB + ((sB - dB) * alpha >> 8);
+
+ *pixel = SDL_MapRGB(surface->format, dR, dG, dB);
+ }
+ }
+ break;
+
+ case 2:{ /* Probably 15-bpp or 16-bpp */
+ if (alpha == 255) {
+ *((Uint16 *) surface->pixels + y * surface->pitch / 2 + x) = color;
+ } else {
+ Uint16 *pixel = (Uint16 *) surface->pixels + y * surface->pitch / 2 + x;
+ Uint32 dc = *pixel;
+
+ R = ((dc & Rmask) + (((color & Rmask) - (dc & Rmask)) * alpha >> 8)) & Rmask;
+ G = ((dc & Gmask) + (((color & Gmask) - (dc & Gmask)) * alpha >> 8)) & Gmask;
+ B = ((dc & Bmask) + (((color & Bmask) - (dc & Bmask)) * alpha >> 8)) & Bmask;
+ if (Amask)
+ A = ((dc & Amask) + (((color & Amask) - (dc & Amask)) * alpha >> 8)) & Amask;
+
+ *pixel = R | G | B | A;
+ }
+ }
+ break;
+
+ case 3:{ /* Slow 24-bpp mode, usually not used */
+ Uint8 *pix = (Uint8 *) surface->pixels + y * surface->pitch + x * 3;
+ Uint8 rshift8 = surface->format->Rshift / 8;
+ Uint8 gshift8 = surface->format->Gshift / 8;
+ Uint8 bshift8 = surface->format->Bshift / 8;
+ Uint8 ashift8 = surface->format->Ashift / 8;
+
+
+ if (alpha == 255) {
+ *(pix + rshift8) = color >> surface->format->Rshift;
+ *(pix + gshift8) = color >> surface->format->Gshift;
+ *(pix + bshift8) = color >> surface->format->Bshift;
+ *(pix + ashift8) = color >> surface->format->Ashift;
+ } else {
+ Uint8 dR, dG, dB, dA = 0;
+ Uint8 sR, sG, sB, sA = 0;
+
+ pix = (Uint8 *) surface->pixels + y * surface->pitch + x * 3;
+
+ dR = *((pix) + rshift8);
+ dG = *((pix) + gshift8);
+ dB = *((pix) + bshift8);
+ dA = *((pix) + ashift8);
+
+ sR = (color >> surface->format->Rshift) & 0xff;
+ sG = (color >> surface->format->Gshift) & 0xff;
+ sB = (color >> surface->format->Bshift) & 0xff;
+ sA = (color >> surface->format->Ashift) & 0xff;
+
+ dR = dR + ((sR - dR) * alpha >> 8);
+ dG = dG + ((sG - dG) * alpha >> 8);
+ dB = dB + ((sB - dB) * alpha >> 8);
+ dA = dA + ((sA - dA) * alpha >> 8);
+
+ *((pix) + rshift8) = dR;
+ *((pix) + gshift8) = dG;
+ *((pix) + bshift8) = dB;
+ *((pix) + ashift8) = dA;
+ }
+ }
+ break;
+
+#ifdef ORIGINAL_ALPHA_PIXEL_ROUTINE
+
+ case 4:{ /* Probably :-) 32-bpp */
+ if (alpha == 255) {
+ *((Uint32 *) surface->pixels + y * surface->pitch / 4 + x) = color;
+ } else {
+ Uint32 Rshift, Gshift, Bshift, Ashift;
+ Uint32 *pixel = (Uint32 *) surface->pixels + y * surface->pitch / 4 + x;
+ Uint32 dc = *pixel;
+
+ Rshift = surface->format->Rshift;
+ Gshift = surface->format->Gshift;
+ Bshift = surface->format->Bshift;
+ Ashift = surface->format->Ashift;
+
+ R = ((dc & Rmask) + (((((color & Rmask) - (dc & Rmask)) >> Rshift) * alpha >> 8) << Rshift)) & Rmask;
+ G = ((dc & Gmask) + (((((color & Gmask) - (dc & Gmask)) >> Gshift) * alpha >> 8) << Gshift)) & Gmask;
+ B = ((dc & Bmask) + (((((color & Bmask) - (dc & Bmask)) >> Bshift) * alpha >> 8) << Bshift)) & Bmask;
+ if (Amask)
+ A = ((dc & Amask) + (((((color & Amask) - (dc & Amask)) >> Ashift) * alpha >> 8) << Ashift)) & Amask;
+
+ *pixel = R | G | B | A;
+ }
+ }
+ break;
+#endif
+
+#ifdef MODIFIED_ALPHA_PIXEL_ROUTINE
+
+ case 4:{ /* Probably :-) 32-bpp */
+ if (alpha == 255) {
+ *((Uint32 *) surface->pixels + y * surface->pitch / 4 + x) = color;
+ } else {
+ Uint32 Rshift, Gshift, Bshift, Ashift;
+ Uint32 *pixel = (Uint32 *) surface->pixels + y * surface->pitch / 4 + x;
+ Uint32 dc = *pixel;
+ Uint32 dR = (color & Rmask), dG = (color & Gmask), dB = (color & Bmask);
+ Uint32 surfaceAlpha, preMultR, preMultG, preMultB;
+ Uint32 aTmp;
+
+ Rshift = surface->format->Rshift;
+ Gshift = surface->format->Gshift;
+ Bshift = surface->format->Bshift;
+ Ashift = surface->format->Ashift;
+
+ preMultR = (alpha * (dR>>Rshift));
+ preMultG = (alpha * (dG>>Gshift));
+ preMultB = (alpha * (dB>>Bshift));
+
+ surfaceAlpha = ((dc & Amask) >> Ashift);
+ aTmp = (255 - alpha);
+ if ((A = 255 - ((aTmp * (255 - surfaceAlpha)) >> 8 ))) {
+ aTmp *= surfaceAlpha;
+ R = (preMultR + ((aTmp * ((dc & Rmask) >> Rshift)) >> 8)) / A << Rshift & Rmask;
+ G = (preMultG + ((aTmp * ((dc & Gmask) >> Gshift)) >> 8)) / A << Gshift & Gmask;
+ B = (preMultB + ((aTmp * ((dc & Bmask) >> Bshift)) >> 8)) / A << Bshift & Bmask;
+ }
+ *pixel = R | G | B | (A << Ashift & Amask);
+
+ }
+ }
+ break;
+#endif
+ }
+ }
+}
+
+
+/* FIXME: eliminate these 2 functions */
+
+static int raster_pixelColorNolock(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color)
+{
+ int result = 0;
+
+#if 0
+ /*
+ * Setup color
+ */
+ alpha = color & 0x000000ff;
+ mcolor =
+ SDL_MapRGBA(dst->format, (color & 0xff000000) >> 24,
+ (color & 0x00ff0000) >> 16, (color & 0x0000ff00) >> 8, alpha);
+#endif
+
+ /*
+ * Draw
+ */
+ raster_PutPixel(dst, x, y, color);
+
+ return (result);
+}
+
+
+/* Pixel - using alpha weight on color for AA-drawing - no locking */
+
+static int raster_pixelColorWeightNolock(SDL_Surface * dst, Sint16 x, Sint16 y, Uint32 color, Uint32 weight)
+{
+#if 0
+ Uint32 a;
+
+ /*
+ * Get alpha
+ */
+ a = (color & (Uint32) 0x000000ff);
+
+ /*
+ * Modify Alpha by weight
+ */
+ a = ((a * weight) >> 8);
+#endif
+
+ raster_PutPixelAlpha(dst, x, y, color, weight);
+
+ return 0;
+}
+
+
+/* raster :: line */
+
+
+
+static inline void raster_hline(SDL_Surface * dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
+{
+#if 1
+ SDL_Rect l;
+
+ /* sge */
+ if(x1>x2){Sint16 tmp=x1; x1=x2; x2=tmp;}
+
+ l.x=x1; l.y=y; l.w=x2-x1+1; l.h=1;
+
+ SDL_FillRect(dst, &l, color);
+
+#else
+ /* sdl_gfx */
+ Sint16 left, right, top, bottom;
+ Uint8 *pixel, *pixellast;
+ int dx;
+ int pixx, pixy;
+ Sint16 w;
+ Sint16 xtmp;
+ int result = -1;
+#if 0
+ int i;
+ union
+ {
+ double d;
+ uint16_t col[4];
+ } doub;
+
+ for(i = 0; i < 4; i++)
+ {
+ doub.col[i] = color;
+ }
+#endif
+
+ /*
+ * Check visibility of clipping rectangle
+ */
+ if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
+ return(0);
+ }
+
+ /*
+ * Swap x1, x2 if required to ensure x1<=x2
+ */
+ if (x1 > x2) {
+ xtmp = x1;
+ x1 = x2;
+ x2 = xtmp;
+ }
+
+ /*
+ * Get clipping boundary and
+ * check visibility of hline
+ */
+ left = dst->clip_rect.x;
+ if (x2<left) {
+ return(0);
+ }
+ right = dst->clip_rect.x + dst->clip_rect.w - 1;
+ if (x1>right) {
+ return(0);
+ }
+ top = dst->clip_rect.y;
+ bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
+ if ((y<top) || (y>bottom)) {
+ return (0);
+ }
+
+ /*
+ * Clip x
+ */
+ if (x1 < left) {
+ x1 = left;
+ }
+ if (x2 > right) {
+ x2 = right;
+ }
+
+ /*
+ * Calculate width
+ */
+ w = x2 - x1;
+
+#if 0
+ printf("raster_hline %d %d %d %d\n", x1, x2, y, w);
+#endif
+
+ /*
+ * Lock surface
+ */
+ if (SDL_MUSTLOCK(dst)) {
+ SDL_LockSurface(dst);
+ }
+
+ /*
+ * More variable setup
+ */
+ dx = w;
+ pixx = dst->format->BytesPerPixel;
+ pixy = dst->pitch;
+ pixel = ((Uint8 *) dst->pixels) + pixx * (int) x1 + pixy * (int) y;
+
+ /*
+ * Draw
+ */
+ switch (dst->format->BytesPerPixel) {
+ case 1:
+ memset(pixel, color, dx);
+ break;
+ case 2:
+ pixellast = pixel + dx + dx;
+#if 0
+ for (; (pixel+3) <= pixellast; pixel += 4*pixx)
+ {
+ *(double *)pixel = doub.d;
+ }
+#endif
+ for (; pixel <= pixellast; pixel += pixx) {
+ *(Uint16 *) pixel = color;
+ }
+ break;
+ case 3:
+ pixellast = pixel + dx + dx + dx;
+ for (; pixel <= pixellast; pixel += pixx) {
+ if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
+ pixel[0] = (color >> 16) & 0xff;
+ pixel[1] = (color >> 8) & 0xff;
+ pixel[2] = color & 0xff;
+ } else {
+ pixel[0] = color & 0xff;
+ pixel[1] = (color >> 8) & 0xff;
+ pixel[2] = (color >> 16) & 0xff;
+ }
+ }
+ break;
+ default: /* case 4 */
+ dx = dx + dx;
+ pixellast = pixel + dx + dx;
+ for (; pixel <= pixellast; pixel += pixx) {
+ *(Uint32 *) pixel = color;
+ }
+ break;
+ }
+
+ /*
+ * Unlock surface
+ */
+ if (SDL_MUSTLOCK(dst)) {
+ SDL_UnlockSurface(dst);
+ }
+
+ /*
+ * Set result code
+ */
+ result = 0;
+
+ return (result);
+#endif
+}
+
+static void raster_vline(SDL_Surface *dst, Sint16 x, Sint16 y1, Sint16 y2, Uint32 color)
+{
+ SDL_Rect l;
+
+ if(y1>y2){Sint16 tmp=y1; y1=y2; y2=tmp;}
+
+ l.x=x; l.y=y1; l.w=1; l.h=y2-y1+1;
+
+ SDL_FillRect(dst, &l, color);
+}
+
+
+
+/* raster_line */
+#define CLIP_LEFT_EDGE 0x1
+#define CLIP_RIGHT_EDGE 0x2
+#define CLIP_BOTTOM_EDGE 0x4
+#define CLIP_TOP_EDGE 0x8
+#define CLIP_INSIDE(a) (!a)
+#define CLIP_REJECT(a,b) (a&b)
+#define CLIP_ACCEPT(a,b) (!(a|b))
+
+static int clipEncode(Sint16 x, Sint16 y, Sint16 left, Sint16 top, Sint16 right, Sint16 bottom)
+{
+ int code = 0;
+
+ if (x < left) {
+ code |= CLIP_LEFT_EDGE;
+ } else if (x > right) {
+ code |= CLIP_RIGHT_EDGE;
+ }
+ if (y < top) {
+ code |= CLIP_TOP_EDGE;
+ } else if (y > bottom) {
+ code |= CLIP_BOTTOM_EDGE;
+ }
+ return code;
+}
+
+static int clipLine(SDL_Surface * dst, Sint16 * x1, Sint16 * y1, Sint16 * x2, Sint16 * y2)
+{
+ Sint16 left, right, top, bottom;
+ int code1, code2;
+ int draw = 0;
+ Sint16 swaptmp;
+ float m;
+
+ /*
+ * Get clipping boundary
+ */
+ left = dst->clip_rect.x;
+ right = dst->clip_rect.x + dst->clip_rect.w - 1;
+ top = dst->clip_rect.y;
+ bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
+
+ while (1) {
+ code1 = clipEncode(*x1, *y1, left, top, right, bottom);
+ code2 = clipEncode(*x2, *y2, left, top, right, bottom);
+ if (CLIP_ACCEPT(code1, code2)) {
+ draw = 1;
+ break;
+ } else if (CLIP_REJECT(code1, code2))
+ break;
+ else {
+ if (CLIP_INSIDE(code1)) {
+ swaptmp = *x2;
+ *x2 = *x1;
+ *x1 = swaptmp;
+ swaptmp = *y2;
+ *y2 = *y1;
+ *y1 = swaptmp;
+ swaptmp = code2;
+ code2 = code1;
+ code1 = swaptmp;
+ }
+ if (*x2 != *x1) {
+ m = (*y2 - *y1) / (float) (*x2 - *x1);
+ } else {
+ m = 1.0f;
+ }
+ if (code1 & CLIP_LEFT_EDGE) {
+ *y1 += (Sint16) ((left - *x1) * m);
+ *x1 = left;
+ } else if (code1 & CLIP_RIGHT_EDGE) {
+ *y1 += (Sint16) ((right - *x1) * m);
+ *x1 = right;
+ } else if (code1 & CLIP_BOTTOM_EDGE) {
+ if (*x2 != *x1) {
+ *x1 += (Sint16) ((bottom - *y1) / m);
+ }
+ *y1 = bottom;
+ } else if (code1 & CLIP_TOP_EDGE) {
+ if (*x2 != *x1) {
+ *x1 += (Sint16) ((top - *y1) / m);
+ }
+ *y1 = top;
+ }
+ }
+ }
+
+ return draw;
+}
+
+
+void raster_line(SDL_Surface *dst, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint32_t color)
+{
+ /* sdl-gfx */
+ int pixx, pixy;
+ int x, y;
+ int dx, dy;
+ int sx, sy;
+ int swaptmp;
+ Uint8 *pixel;
+
+ /*
+ * Clip line and test if we have to draw
+ */
+ if (!(clipLine(dst, &x1, &y1, &x2, &y2))) {
+ return;
+ }
+
+ /*
+ * Test for special cases of straight lines or single point
+ */
+ if (x1 == x2) {
+ if (y1 < y2) {
+ raster_vline(dst, x1, y1, y2, color);
+ return;
+ } else if (y1 > y2) {
+ raster_vline(dst, x1, y2, y1, color);
+ return;
+ } else {
+ raster_PutPixel(dst, x1, y1, color);
+ return;
+ }
+ }
+ if (y1 == y2) {
+ if (x1 < x2) {
+ raster_hline(dst, x1, x2, y1, color);
+ return;
+ } else if (x1 > x2) {
+ raster_hline(dst, x2, x1, y1, color);
+ return;
+ }
+ }
+
+
+ /*
+ * Variable setup
+ */
+ dx = x2 - x1;
+ dy = y2 - y1;
+ sx = (dx >= 0) ? 1 : -1;
+ sy = (dy >= 0) ? 1 : -1;
+
+ /* Lock surface */
+ if (SDL_MUSTLOCK(dst)) {
+ if (SDL_LockSurface(dst) < 0) {
+ return;
+ }
+ }
+
+ /*
+ * No alpha blending - use fast pixel routines
+ */
+
+#if 0
+ /*
+ * Setup color
+ */
+ colorptr = (Uint8 *) & color;
+ if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
+ color = SDL_MapRGBA(dst->format, colorptr[0], colorptr[1], colorptr[2], colorptr[3]);
+ } else {
+ color = SDL_MapRGBA(dst->format, colorptr[3], colorptr[2], colorptr[1], colorptr[0]);
+ }
+#endif
+
+ /*
+ * More variable setup
+ */
+ dx = sx * dx + 1;
+ dy = sy * dy + 1;
+ pixx = dst->format->BytesPerPixel;
+ pixy = dst->pitch;
+ pixel = ((Uint8 *) dst->pixels) + pixx * (int) x1 + pixy * (int) y1;
+ pixx *= sx;
+ pixy *= sy;
+ if (dx < dy) {
+ swaptmp = dx;
+ dx = dy;
+ dy = swaptmp;
+ swaptmp = pixx;
+ pixx = pixy;
+ pixy = swaptmp;
+ }
+
+ /*
+ * Draw
+ */
+ x = 0;
+ y = 0;
+ switch (dst->format->BytesPerPixel) {
+ case 1:
+ for (; x < dx; x++, pixel += pixx) {
+ *pixel = color;
+ y += dy;
+ if (y >= dx) {
+ y -= dx;
+ pixel += pixy;
+ }
+ }
+ break;
+ case 2:
+ for (; x < dx; x++, pixel += pixx) {
+ *(Uint16 *) pixel = color;
+ y += dy;
+ if (y >= dx) {
+ y -= dx;
+ pixel += pixy;
+ }
+ }
+ break;
+ case 3:
+ for (; x < dx; x++, pixel += pixx) {
+ if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
+ pixel[0] = (color >> 16) & 0xff;
+ pixel[1] = (color >> 8) & 0xff;
+ pixel[2] = color & 0xff;
+ } else {
+ pixel[0] = color & 0xff;
+ pixel[1] = (color >> 8) & 0xff;
+ pixel[2] = (color >> 16) & 0xff;
+ }
+ y += dy;
+ if (y >= dx) {
+ y -= dx;
+ pixel += pixy;
+ }
+ }
+ break;
+ default: /* case 4 */
+ for (; x < dx; x++, pixel += pixx) {
+ *(Uint32 *) pixel = color;
+ y += dy;
+ if (y >= dx) {
+ y -= dx;
+ pixel += pixy;
+ }
+ }
+ break;
+ }
+
+ /* Unlock surface */
+ if (SDL_MUSTLOCK(dst)) {
+ SDL_UnlockSurface(dst);
+ }
+
+ return;
+}
+
+
+#define AAlevels 256
+#define AAbits 8
+
+static void raster_aalineColorInt(SDL_Surface * dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color, int draw_endpoint)
+{
+ Sint32 xx0, yy0, xx1, yy1;
+ int result;
+ Uint32 intshift, erracc, erradj;
+ Uint32 erracctmp, wgt, wgtcompmask;
+ int dx, dy, tmp, xdir, y0p1, x0pxdir;
+
+ /*
+ * Check visibility of clipping rectangle
+ */
+ if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
+ return;
+ }
+
+ /*
+ * Clip line and test if we have to draw
+ */
+ if (!(clipLine(dst, &x1, &y1, &x2, &y2))) {
+ return;
+ }
+
+ /*
+ * Keep on working with 32bit numbers
+ */
+ xx0 = x1;
+ yy0 = y1;
+ xx1 = x2;
+ yy1 = y2;
+
+ /*
+ * Reorder points if required
+ */
+ if (yy0 > yy1) {
+ tmp = yy0;
+ yy0 = yy1;
+ yy1 = tmp;
+ tmp = xx0;
+ xx0 = xx1;
+ xx1 = tmp;
+ }
+
+ /*
+ * Calculate distance
+ */
+ dx = xx1 - xx0;
+ dy = yy1 - yy0;
+
+ /*
+ * Adjust for negative dx and set xdir
+ */
+ if (dx >= 0) {
+ xdir = 1;
+ } else {
+ xdir = -1;
+ dx = (-dx);
+ }
+
+ /*
+ * Check for special cases
+ */
+ if (dx == 0) {
+ /*
+ * Vertical line
+ */
+ raster_vline(dst, x1, y1, y2, color);
+ return;
+ } else if (dy == 0) {
+ /*
+ * Horizontal line
+ */
+ raster_hline(dst, x1, x2, y1, color);
+ return;
+ } else if (dx == dy) {
+ /*
+ * Diagonal line
+ */
+ raster_line(dst, x1, y1, x2, y2, color);
+ return;
+ }
+
+ /*
+ * Line is not horizontal, vertical or diagonal
+ */
+ result = 0;
+
+ /*
+ * Zero accumulator
+ */
+ erracc = 0;
+
+ /*
+ * # of bits by which to shift erracc to get intensity level
+ */
+ intshift = 32 - AAbits;
+ /*
+ * Mask used to flip all bits in an intensity weighting
+ */
+ wgtcompmask = AAlevels - 1;
+
+ /* Lock surface */
+ if (SDL_MUSTLOCK(dst)) {
+ if (SDL_LockSurface(dst) < 0) {
+ return;
+ }
+ }
+
+ /*
+ * Draw the initial pixel in the foreground color
+ */
+ raster_pixelColorNolock(dst, x1, y1, color);
+
+ /*
+ * x-major or y-major?
+ */
+ if (dy > dx) {
+
+ /*
+ * y-major. Calculate 16-bit fixed point fractional part of a pixel that
+ * X advances every time Y advances 1 pixel, truncating the result so that
+ * we won't overrun the endpoint along the X axis
+ */
+ /*
+ * Not-so-portable version: erradj = ((Uint64)dx << 32) / (Uint64)dy;
+ */
+ erradj = ((dx << 16) / dy) << 16;
+
+ /*
+ * draw all pixels other than the first and last
+ */
+ x0pxdir = xx0 + xdir;
+ while (--dy) {
+ erracctmp = erracc;
+ erracc += erradj;
+ if (erracc <= erracctmp) {
+ /*
+ * rollover in error accumulator, x coord advances
+ */
+ xx0 = x0pxdir;
+ x0pxdir += xdir;
+ }
+ yy0++; /* y-major so always advance Y */
+
+ /*
+ * the AAbits most significant bits of erracc give us the intensity
+ * weighting for this pixel, and the complement of the weighting for
+ * the paired pixel.
+ */
+ wgt = (erracc >> intshift) & 255;
+ raster_pixelColorWeightNolock (dst, xx0, yy0, color, 255 - wgt);
+ raster_pixelColorWeightNolock (dst, x0pxdir, yy0, color, wgt);
+ }
+
+ } else {
+
+ /*
+ * x-major line. Calculate 16-bit fixed-point fractional part of a pixel
+ * that Y advances each time X advances 1 pixel, truncating the result so
+ * that we won't overrun the endpoint along the X axis.
+ */
+ /*
+ * Not-so-portable version: erradj = ((Uint64)dy << 32) / (Uint64)dx;
+ */
+ erradj = ((dy << 16) / dx) << 16;
+
+ /*
+ * draw all pixels other than the first and last
+ */
+ y0p1 = yy0 + 1;
+ while (--dx) {
+
+ erracctmp = erracc;
+ erracc += erradj;
+ if (erracc <= erracctmp) {
+ /*
+ * Accumulator turned over, advance y
+ */
+ yy0 = y0p1;
+ y0p1++;
+ }
+ xx0 += xdir; /* x-major so always advance X */
+ /*
+ * the AAbits most significant bits of erracc give us the intensity
+ * weighting for this pixel, and the complement of the weighting for
+ * the paired pixel.
+ */
+ wgt = (erracc >> intshift) & 255;
+ raster_pixelColorWeightNolock (dst, xx0, yy0, color, 255 - wgt);
+ raster_pixelColorWeightNolock (dst, xx0, y0p1, color, wgt);
+ }
+ }
+
+ /*
+ * Do we have to draw the endpoint
+ */
+ if (draw_endpoint) {
+ /*
+ * Draw final pixel, always exactly intersected by the line and doesn't
+ * need to be weighted.
+ */
+ raster_pixelColorNolock (dst, x2, y2, color);
+ }
+
+ /* Unlock surface */
+ if (SDL_MUSTLOCK(dst)) {
+ SDL_UnlockSurface(dst);
+ }
+}
+
+void raster_aaline(SDL_Surface *s, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint32_t col)
+{
+ raster_aalineColorInt(s, x1, y1, x2, y2, col, 1);
+}
+
+
+
+/* raster :: circle */
+
+void raster_circle(SDL_Surface *dst, int16_t x, int16_t y, int16_t r, uint32_t color)
+{
+ /* sdl-gfx */
+ Sint16 left, right, top, bottom;
+ int result;
+ Sint16 x1, y1, x2, y2;
+ Sint16 cx = 0;
+ Sint16 cy = r;
+ Sint16 ocx = (Sint16) 0xffff;
+ Sint16 ocy = (Sint16) 0xffff;
+ Sint16 df = 1 - r;
+ Sint16 d_e = 3;
+ Sint16 d_se = -2 * r + 5;
+ Sint16 xpcx, xmcx, xpcy, xmcy;
+ Sint16 ypcy, ymcy, ypcx, ymcx;
+
+ /*
+ * Check visibility of clipping rectangle
+ */
+ if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
+ return;
+ }
+
+ /*
+ * Sanity check radius
+ */
+ if (r < 0) {
+ return;
+ }
+
+ /*
+ * Special case for r=0 - draw a point
+ */
+ if (r == 0) {
+ return (raster_PutPixel(dst, x, y, color));
+ }
+
+ /*
+ * Get circle and clipping boundary and
+ * test if bounding box of circle is visible
+ */
+ x2 = x + r;
+ left = dst->clip_rect.x;
+ if (x2<left) {
+ return;
+ }
+ x1 = x - r;
+ right = dst->clip_rect.x + dst->clip_rect.w - 1;
+ if (x1>right) {
+ return;
+ }
+ y2 = y + r;
+ top = dst->clip_rect.y;
+ if (y2<top) {
+ return;
+ }
+ y1 = y - r;
+ bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
+ if (y1>bottom) {
+ return;
+ }
+
+ /*
+ * Draw
+ */
+ result = 0;
+ do {
+ xpcx = x + cx;
+ xmcx = x - cx;
+ xpcy = x + cy;
+ xmcy = x - cy;
+ if (ocy != cy) {
+ if (cy > 0) {
+ ypcy = y + cy;
+ ymcy = y - cy;
+ raster_hline(dst, xmcx, xpcx, ypcy, color);
+ raster_hline(dst, xmcx, xpcx, ymcy, color);
+// raster_rect_inline(dst, xmcx, ypcy, 2*cx, 1, color);
+// raster_rect_inline(dst, xmcx, ymcy, 2*cx, 1, color);
+
+ } else {
+ raster_hline(dst, xmcx, xpcx, y, color);
+// raster_rect_inline(dst, xmcx, y, 2*cx, 1, color);
+ }
+ ocy = cy;
+ }
+ if (ocx != cx) {
+ if (cx != cy) {
+ if (cx > 0) {
+ ypcx = y + cx;
+ ymcx = y - cx;
+ raster_hline(dst, xmcy, xpcy, ymcx, color);
+ raster_hline(dst, xmcy, xpcy, ypcx, color);
+ //raster_rect_inline(dst, xmcy, ymcx, 2*cy, 1, color);
+ //raster_rect_inline(dst, xmcy, ypcx, 2*cy, 1, color);
+ } else {
+ raster_hline(dst, xmcy, xpcy, y, color);
+ //raster_rect_inline(dst, xmcy, y, 2*cy, 1, color);
+ }
+ }
+ ocx = cx;
+ }
+ /*
+ * Update
+ */
+ if (df < 0) {
+ df += d_e;
+ d_e += 2;
+ d_se += 2;
+ } else {
+ df += d_se;
+ d_e += 2;
+ d_se += 4;
+ cy--;
+ }
+ cx++;
+ } while (cx <= cy);
+}
+
+
+/* FIXME: convert to fixed pt */
+static void raster_AAFilledEllipse(SDL_Surface *surface, Sint16 xc, Sint16 yc, Sint16 rx, Sint16 ry, Uint32 color)
+{
+ /* sge */
+ /* Sanity check */
+ if (rx < 1)
+ rx = 1;
+ if (ry < 1)
+ ry = 1;
+
+ int a2 = rx * rx;
+ int b2 = ry * ry;
+
+ int ds = 2 * a2;
+ int dt = 2 * b2;
+
+ int dxt = (int)(a2 / sqrt(a2 + b2));
+
+ int t = 0;
+ int s = -2 * a2 * ry;
+ int d = 0;
+
+ Sint16 x = xc;
+ Sint16 y = yc - ry;
+
+ Sint16 xs, ys, dyt;
+ float cp, is, ip, imax = 1.0;
+
+ /* Lock surface */
+ if ( SDL_MUSTLOCK(surface) )
+ if ( SDL_LockSurface(surface) < 0 )
+ return;
+
+ /* "End points" */
+ raster_PutPixel(surface, x, y, color);
+ raster_PutPixel(surface, 2*xc-x, y, color);
+
+ raster_PutPixel(surface, x, 2*yc-y, color);
+ raster_PutPixel(surface, 2*xc-x, 2*yc-y, color);
+
+ /* unlock surface */
+ if (SDL_MUSTLOCK(surface) )
+ SDL_UnlockSurface(surface);
+
+ raster_vline(surface, x, y+1, 2*yc-y-1, color);
+
+ int i;
+
+ for (i = 1; i <= dxt; i++)
+ {
+ x--;
+ d += t - b2;
+
+ if (d >= 0)
+ ys = y - 1;
+ else if ((d - s - a2) > 0)
+ {
+ if ((2 * d - s - a2) >= 0)
+ ys = y + 1;
+ else
+ {
+ ys = y;
+ y++;
+ d -= s + a2;
+ s += ds;
+ }
+ }
+ else
+ {
+ y++;
+ ys = y + 1;
+ d -= s + a2;
+ s += ds;
+ }
+
+ t -= dt;
+
+ /* Calculate alpha */
+ cp = (float) abs(d) / abs(s);
+ is = cp * imax;
+ ip = imax - is;
+
+
+ /* Lock surface */
+ if ( SDL_MUSTLOCK(surface) )
+ if ( SDL_LockSurface(surface) < 0 )
+ return;
+
+ /* Upper half */
+ raster_PutPixelAlpha(surface, x, y, color, (Uint8)(ip*255));
+ raster_PutPixelAlpha(surface, 2*xc-x, y, color, (Uint8)(ip*255));
+
+ raster_PutPixelAlpha(surface, x, ys, color, (Uint8)(is*255));
+ raster_PutPixelAlpha(surface, 2*xc-x, ys, color, (Uint8)(is*255));
+
+
+ /* Lower half */
+ raster_PutPixelAlpha(surface, x, 2*yc-y, color, (Uint8)(ip*255));
+ raster_PutPixelAlpha(surface, 2*xc-x, 2*yc-y, color, (Uint8)(ip*255));
+
+ raster_PutPixelAlpha(surface, x, 2*yc-ys, color, (Uint8)(is*255));
+ raster_PutPixelAlpha(surface, 2*xc-x, 2*yc-ys, color, (Uint8)(is*255));
+
+ /* unlock surface */
+ if (SDL_MUSTLOCK(surface) )
+ SDL_UnlockSurface(surface);
+
+
+ /* Fill */
+ raster_vline(surface, x, y+1, 2*yc-y-1, color);
+ raster_vline(surface, 2*xc-x, y+1, 2*yc-y-1, color);
+ raster_vline(surface, x, ys+1, 2*yc-ys-1, color);
+ raster_vline(surface, 2*xc-x, ys+1, 2*yc-ys-1, color);
+ }
+
+ dyt = abs(y - yc);
+
+ for (i = 1; i <= dyt; i++)
+ {
+ y++;
+ d -= s + a2;
+
+ if (d <= 0)
+ xs = x + 1;
+ else if ((d + t - b2) < 0)
+ {
+ if ((2 * d + t - b2) <= 0)
+ xs = x - 1;
+ else
+ {
+ xs = x;
+ x--;
+ d += t - b2;
+ t -= dt;
+ }
+ }
+ else
+ {
+ x--;
+ xs = x - 1;
+ d += t - b2;
+ t -= dt;
+ }
+
+ s += ds;
+
+ /* Calculate alpha */
+ cp = (float) abs(d) / abs(t);
+ is = cp * imax;
+ ip = imax - is;
+
+
+ /* Lock surface */
+ if ( SDL_MUSTLOCK(surface) )
+ if ( SDL_LockSurface(surface) < 0 )
+ return;
+
+ /* Upper half */
+ raster_PutPixelAlpha(surface, x, y, color, (Uint8)(ip*255));
+ raster_PutPixelAlpha(surface, 2*xc-x, y, color, (Uint8)(ip*255));
+
+ raster_PutPixelAlpha(surface, xs, y, color, (Uint8)(is*255));
+ raster_PutPixelAlpha(surface, 2*xc-xs, y, color, (Uint8)(is*255));
+
+
+ /* Lower half*/
+ raster_PutPixelAlpha(surface, x, 2*yc-y, color, (Uint8)(ip*255));
+ raster_PutPixelAlpha(surface, 2*xc-x, 2*yc-y, color, (Uint8)(ip*255));
+
+ raster_PutPixelAlpha(surface, xs, 2*yc-y, color, (Uint8)(is*255));
+ raster_PutPixelAlpha(surface, 2*xc-xs, 2*yc-y, color, (Uint8)(is*255));
+
+ /* unlock surface */
+ if (SDL_MUSTLOCK(surface) )
+ SDL_UnlockSurface(surface);
+
+ /* Fill */
+ raster_hline(surface, x+1, 2*xc-x-1, y, color);
+ raster_hline(surface, xs+1, 2*xc-xs-1, y, color);
+ raster_hline(surface, x+1, 2*xc-x-1, 2*yc-y, color);
+ raster_hline(surface, xs+1, 2*xc-xs-1, 2*yc-y, color);
+ }
+}
+
+void raster_aacircle(SDL_Surface *s, int16_t x, int16_t y, int16_t r, uint32_t col)
+{
+ raster_AAFilledEllipse(s, x, y, r, r, col);
+}
+
+#if 0
+void raster_aacircle(SDL_Surface *s, int16_t x, int16_t y, int16_t r, uint32_t col)
+{
+ /* sdl-gfx */
+ Sint16 left, right, top, bottom;
+ int result;
+ Sint16 x1, y1, x2, y2;
+ Sint16 cx = 0;
+ Sint16 cy = r;
+ Sint16 ocx = (Sint16) 0xffff;
+ Sint16 ocy = (Sint16) 0xffff;
+ Sint16 df = 1 - r;
+ Sint16 d_e = 3;
+ Sint16 d_se = -2 * r + 5;
+ Sint16 xpcx, xmcx, xpcy, xmcy;
+ Sint16 ypcy, ymcy, ypcx, ymcx;
+
+ /*
+ * Check visibility of clipping rectangle
+ */
+ if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
+ return;
+ }
+
+ /*
+ * Sanity check radius
+ */
+ if (r < 0) {
+ return;
+ }
+
+#if 0
+ /*
+ * Special case for r=0 - draw a point
+ */
+ if (r == 0) {
+ return (pixelColor(dst, x, y, color));
+ }
+#endif
+
+ /*
+ * Get circle and clipping boundary and
+ * test if bounding box of circle is visible
+ */
+ x2 = x + r;
+ left = dst->clip_rect.x;
+ if (x2<left) {
+ return;
+ }
+ x1 = x - r;
+ right = dst->clip_rect.x + dst->clip_rect.w - 1;
+ if (x1>right) {
+ return;
+ }
+ y2 = y + r;
+ top = dst->clip_rect.y;
+ if (y2<top) {
+ return;
+ }
+ y1 = y - r;
+ bottom = dst->clip_rect.y + dst->clip_rect.h - 1;
+ if (y1>bottom) {
+ return;
+ }
+
+ /*
+ * Draw
+ */
+ result = 0;
+ do {
+ xpcx = x + cx;
+ xmcx = x - cx;
+ xpcy = x + cy;
+ xmcy = x - cy;
+ if (ocy != cy) {
+ if (cy > 0) {
+ ypcy = y + cy;
+ ymcy = y - cy;
+ raster_hlineColor(dst, xmcx, xpcx, ypcy, color);
+ raster_hlineColor(dst, xmcx, xpcx, ymcy, color);
+// raster_rect_inline(dst, xmcx, ypcy, 2*cx, 1, color);
+// raster_rect_inline(dst, xmcx, ymcy, 2*cx, 1, color);
+
+ } else {
+ raster_hlineColor(dst, xmcx, xpcx, y, color);
+// raster_rect_inline(dst, xmcx, y, 2*cx, 1, color);
+ }
+ ocy = cy;
+ }
+ if (ocx != cx) {
+ if (cx != cy) {
+ if (cx > 0) {
+ ypcx = y + cx;
+ ymcx = y - cx;
+ raster_hlineColor(dst, xmcy, xpcy, ymcx, color);
+ raster_hlineColor(dst, xmcy, xpcy, ypcx, color);
+ //raster_rect_inline(dst, xmcy, ymcx, 2*cy, 1, color);
+ //raster_rect_inline(dst, xmcy, ypcx, 2*cy, 1, color);
+ } else {
+ raster_hlineColor(dst, xmcy, xpcy, y, color);
+ //raster_rect_inline(dst, xmcy, y, 2*cy, 1, color);
+ }
+ }
+ ocx = cx;
+ }
+ /*
+ * Update
+ */
+ if (df < 0) {
+ df += d_e;
+ d_e += 2;
+ d_se += 2;
+ } else {
+ df += d_se;
+ d_e += 2;
+ d_se += 4;
+ cy--;
+ }
+ cx++;
+ } while (cx <= cy);
+#if 0
+ /* sge */
+ Sint16 cx = 0;
+ Sint16 cy = r;
+ int draw=1;
+ Sint16 df = 1 - r;
+ Sint16 d_e = 3;
+ Sint16 d_se = -2 * r + 5;
+
+#ifdef DEBUG
+ printf("raster_circle %d %d %d\n", x, y, r);
+#endif
+
+ if(r < 0)
+ {
+ return;
+ }
+
+ do {
+ if(draw)
+ {
+ raster_rect_inline(s, x-cx, y+cy, 2*cx, 1, col);
+ raster_rect_inline(s, x-cx, y-cy, 2*cx, 1, col);
+ draw=0;
+ }
+ if(cx!=cy)
+ {
+ if(cx)
+ {
+ raster_rect_inline(s, x-cy, y-cx, 2*cy, 1, col);
+ raster_rect_inline(s, x-cy, y+cx, 2*cy, 1, col);
+ }
+ else
+ {
+ raster_rect_inline(s, x-cy, y, 2*cy, 1, col);
+ }
+ }
+
+ if (df < 0)
+ {
+ df += d_e;
+ d_e += 2;
+ d_se += 2;
+ }
+ else
+ {
+ df += d_se;
+ d_e += 2;
+ d_se += 4;
+ cy--;
+ draw=1;
+ }
+ cx++;
+ } while(cx <= cy);
+#endif
+}
+#endif
+
+
+
+/* raster :: poly */
+
+
+/* ---- Filled Polygon */
+
+/* Helper qsort callback for polygon drawing */
+
+static int gfxPrimitivesCompareInt(const void *a, const void *b)
+{
+ return (*(const int *) a) - (*(const int *) b);
+}
+
+
+/* Global vertex array to use if optional parameters are not given in polygon calls. */
+static int *gfxPrimitivesPolyIntsGlobal = NULL;
+static int gfxPrimitivesPolyAllocatedGlobal = 0;
+
+/* (Note: The last two parameters are optional; but required for multithreaded operation.) */
+
+static inline int raster_filledPolygonColorMT(SDL_Surface * dst, const Sint16 * vx, const Sint16 * vy, int n, Uint32 color, int **polyInts, int *polyAllocated)
+{
+ /* sdl-gfx */
+ int result;
+ int i;
+ int y, xa, xb;
+ int miny, maxy;
+ int x1, y1;
+ int x2, y2;
+ int ind1, ind2;
+ int ints;
+ int *gfxPrimitivesPolyInts = NULL;
+ int gfxPrimitivesPolyAllocated = 0;
+
+ /*
+ * Check visibility of clipping rectangle
+ */
+ if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
+ return(0);
+ }
+
+ /*
+ * Sanity check number of edges
+ */
+ if (n < 3) {
+ return -1;
+ }
+
+ /*
+ * Map polygon cache
+ */
+ if ((polyInts==NULL) || (polyAllocated==NULL)) {
+ /* Use global cache */
+ gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsGlobal;
+ gfxPrimitivesPolyAllocated = gfxPrimitivesPolyAllocatedGlobal;
+ } else {
+ /* Use local cache */
+ gfxPrimitivesPolyInts = *polyInts;
+ gfxPrimitivesPolyAllocated = *polyAllocated;
+ }
+
+ /*
+ * Allocate temp array, only grow array
+ */
+ if (!gfxPrimitivesPolyAllocated) {
+ gfxPrimitivesPolyInts = (int *) malloc(sizeof(int) * n);
+ gfxPrimitivesPolyAllocated = n;
+ } else {
+ if (gfxPrimitivesPolyAllocated < n) {
+ gfxPrimitivesPolyInts = (int *) realloc(gfxPrimitivesPolyInts, sizeof(int) * n);
+ gfxPrimitivesPolyAllocated = n;
+ }
+ }
+
+ /*
+ * Check temp array
+ */
+ if (gfxPrimitivesPolyInts==NULL) {
+ gfxPrimitivesPolyAllocated = 0;
+ }
+
+ /*
+ * Update cache variables
+ */
+ if ((polyInts==NULL) || (polyAllocated==NULL)) {
+ gfxPrimitivesPolyIntsGlobal = gfxPrimitivesPolyInts;
+ gfxPrimitivesPolyAllocatedGlobal = gfxPrimitivesPolyAllocated;
+ } else {
+ *polyInts = gfxPrimitivesPolyInts;
+ *polyAllocated = gfxPrimitivesPolyAllocated;
+ }
+
+ /*
+ * Check temp array again
+ */
+ if (gfxPrimitivesPolyInts==NULL) {
+ return(-1);
+ }
+
+ /*
+ * Determine Y maxima
+ */
+ miny = vy[0];
+ maxy = vy[0];
+ for (i = 1; (i < n); i++) {
+ if (vy[i] < miny) {
+ miny = vy[i];
+ } else if (vy[i] > maxy) {
+ maxy = vy[i];
+ }
+ }
+
+ /*
+ * Draw, scanning y
+ */
+ result = 0;
+ for (y = miny; (y <= maxy); y++) {
+ ints = 0;
+ for (i = 0; (i < n); i++) {
+ if (!i) {
+ ind1 = n - 1;
+ ind2 = 0;
+ } else {
+ ind1 = i - 1;
+ ind2 = i;
+ }
+ y1 = vy[ind1];
+ y2 = vy[ind2];
+ if (y1 < y2) {
+ x1 = vx[ind1];
+ x2 = vx[ind2];
+ } else if (y1 > y2) {
+ y2 = vy[ind1];
+ y1 = vy[ind2];
+ x2 = vx[ind1];
+ x1 = vx[ind2];
+ } else {
+ continue;
+ }
+ if ( ((y >= y1) && (y < y2)) || ((y == maxy) && (y > y1) && (y <= y2)) ) {
+ gfxPrimitivesPolyInts[ints++] = ((65536 * (y - y1)) / (y2 - y1)) * (x2 - x1) + (65536 * x1);
+ }
+ }
+
+ qsort(gfxPrimitivesPolyInts, ints, sizeof(int), gfxPrimitivesCompareInt);
+
+ for (i = 0; (i < ints); i += 2) {
+ xa = gfxPrimitivesPolyInts[i] + 1;
+ xa = (xa >> 16) + ((xa & 32768) >> 15);
+ xb = gfxPrimitivesPolyInts[i+1] - 1;
+ xb = (xb >> 16) + ((xb & 32768) >> 15);
+ raster_hline(dst, xa, xb, y, color);
+// raster_rect_inline(dst, xa, y, xb - xa, 1, color);
+ }
+ }
+
+ return (result);
+}
+
+void raster_polygon(SDL_Surface *s, int16_t n, int16_t *vx, int16_t *vy, uint32_t col)
+{
+ raster_filledPolygonColorMT(s, vx, vy, n, col, NULL, NULL);
+}
+
+
+void raster_aapolygon(SDL_Surface *dst, int16_t n, int16_t *vx, int16_t *vy, uint32_t color)
+{
+ /* sdl-gfx + sge w/ rphlx changes: basically, draw aaline border,
+ then fill.
+
+ the output is not perfect yet but usually looks better than aliasing
+ */
+ int result;
+ int i;
+ int y, xa, xb;
+ int miny, maxy;
+ int x1, y1;
+ int x2, y2;
+ int ind1, ind2;
+ int ints;
+ int *gfxPrimitivesPolyInts = NULL;
+ int gfxPrimitivesPolyAllocated = 0;
+ const Sint16 *px1, *py1, *px2, *py2;
+ int **polyInts;
+ int *polyAllocated;
+
+ polyInts = NULL;
+ polyAllocated = NULL;
+
+ /*
+ * Check visibility of clipping rectangle
+ */
+ if ((dst->clip_rect.w==0) || (dst->clip_rect.h==0)) {
+ return;
+ }
+
+ /*
+ * Sanity check number of edges
+ */
+ if (n < 3) {
+ return;
+ }
+
+
+ /*
+ * Pointer setup
+ */
+ px1 = px2 = vx;
+ py1 = py2 = vy;
+ px2++;
+ py2++;
+
+ /*
+ * Draw
+ */
+ result = 0;
+ for (i = 1; i < n; i++) {
+ raster_aalineColorInt(dst, *px1, *py1, *px2, *py2, color, 0);
+ px1 = px2;
+ py1 = py2;
+ px2++;
+ py2++;
+ }
+ raster_aalineColorInt(dst, *px1, *py1, *vx, *vy, color, 0);
+
+ /*
+ * Map polygon cache
+ */
+ if ((polyInts==NULL) || (polyAllocated==NULL)) {
+ /* Use global cache */
+ gfxPrimitivesPolyInts = gfxPrimitivesPolyIntsGlobal;
+ gfxPrimitivesPolyAllocated = gfxPrimitivesPolyAllocatedGlobal;
+ } else {
+ /* Use local cache */
+ gfxPrimitivesPolyInts = *polyInts;
+ gfxPrimitivesPolyAllocated = *polyAllocated;
+ }
+
+ /*
+ * Allocate temp array, only grow array
+ */
+ if (!gfxPrimitivesPolyAllocated) {
+ gfxPrimitivesPolyInts = (int *) malloc(sizeof(int) * n);
+ gfxPrimitivesPolyAllocated = n;
+ } else {
+ if (gfxPrimitivesPolyAllocated < n) {
+ gfxPrimitivesPolyInts = (int *) realloc(gfxPrimitivesPolyInts, sizeof(int) * n);
+ gfxPrimitivesPolyAllocated = n;
+ }
+ }
+
+ /*
+ * Check temp array
+ */
+ if (gfxPrimitivesPolyInts==NULL) {
+ gfxPrimitivesPolyAllocated = 0;
+ }
+
+ /*
+ * Update cache variables
+ */
+ if ((polyInts==NULL) || (polyAllocated==NULL)) {
+ gfxPrimitivesPolyIntsGlobal = gfxPrimitivesPolyInts;
+ gfxPrimitivesPolyAllocatedGlobal = gfxPrimitivesPolyAllocated;
+ } else {
+ *polyInts = gfxPrimitivesPolyInts;
+ *polyAllocated = gfxPrimitivesPolyAllocated;
+ }
+
+ /*
+ * Check temp array again
+ */
+ if (gfxPrimitivesPolyInts==NULL) {
+ return;
+ }
+
+ /*
+ * Determine Y maxima
+ */
+ miny = vy[0];
+ maxy = vy[0];
+ for (i = 1; (i < n); i++) {
+ if (vy[i] < miny) {
+ miny = vy[i];
+ } else if (vy[i] > maxy) {
+ maxy = vy[i];
+ }
+ }
+
+ /*
+ * Draw, scanning y
+ */
+ result = 0;
+ for (y = miny; (y <= maxy); y++) {
+ ints = 0;
+ for (i = 0; (i < n); i++) {
+ if (!i) {
+ ind1 = n - 1;
+ ind2 = 0;
+ } else {
+ ind1 = i - 1;
+ ind2 = i;
+ }
+ y1 = vy[ind1];
+ y2 = vy[ind2];
+ if (y1 < y2) {
+ x1 = vx[ind1];
+ x2 = vx[ind2];
+ } else if (y1 > y2) {
+ y2 = vy[ind1];
+ y1 = vy[ind2];
+ x2 = vx[ind1];
+ x1 = vx[ind2];
+ } else {
+ continue;
+ }
+ if ( ((y >= y1) && (y < y2)) || ((y == maxy) && (y > y1) && (y <= y2)) ) {
+ gfxPrimitivesPolyInts[ints++] = ((65536 * (y - y1)) / (y2 - y1)) * (x2 - x1) + (65536 * x1);
+ }
+ }
+
+ qsort(gfxPrimitivesPolyInts, ints, sizeof(int), gfxPrimitivesCompareInt);
+
+// o = p = -1;
+ for (i = 0; (i < ints); i +=2) {
+#if 0
+ xa = gfxPrimitivesPolyInts[i] + 1;
+ xa = (xa >> 16) + ((xa & 32768) >> 15);
+ xb = gfxPrimitivesPolyInts[i+1] - 1;
+ xb = (xb >> 16) + ((xb & 32768) >> 15);
+#else
+ xa = (gfxPrimitivesPolyInts[i] >> 16);
+ xb = (gfxPrimitivesPolyInts[i+1] >> 16);
+#endif
+
+#if 0
+ if(o < 0)
+ {
+ o = xa+1;
+ }
+ else if(p < 0)
+ {
+ p = xa;
+ }
+
+ if( (o >= 0) && (p >= 0))
+ {
+ if(p-o < 0)
+ {
+ o = p = -1;
+ continue;
+ }
+
+ raster_hlineColor(dst, o, p, y, color);
+
+ o = p = -1;
+ }
+#else
+
+ raster_hline(dst, xa+1, xb, y, color);
+#endif
+
+// raster_rect_inline(dst, xa, y, xb - xa, 1, color);
+ }
+ }
+}
+
diff --git a/graphics/sdl/raster.h b/graphics/sdl/raster.h
new file mode 100644
index 00000000..8f50b271
--- /dev/null
+++ b/graphics/sdl/raster.h
@@ -0,0 +1,25 @@
+/* raster.h -- line/rect/circle/poly rasterization
+
+ copyright (c) 2008 bryan rittmeyer <bryanr@bryanr.org>
+
+ license: LGPLv2
+*/
+
+#ifndef __RASTER_H
+#define __RASTER_H
+
+#include <stdint.h>
+#include <SDL/SDL.h>
+
+void raster_rect(SDL_Surface *s, int16_t x, int16_t y, int16_t w, int16_t h, uint32_t col);
+
+void raster_line(SDL_Surface *s, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint32_t col);
+void raster_circle(SDL_Surface *s, int16_t x, int16_t y, int16_t r, uint32_t col);
+void raster_polygon(SDL_Surface *s, int16_t n, int16_t *vx, int16_t *vy, uint32_t col);
+
+void raster_aaline(SDL_Surface *s, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint32_t col);
+void raster_aacircle(SDL_Surface *s, int16_t x, int16_t y, int16_t r, uint32_t col);
+void raster_aapolygon(SDL_Surface *s, int16_t n, int16_t *vx, int16_t *vy, uint32_t col);
+
+#endif /* __RASTER_H */
+
diff --git a/graphics/win32/Makefile.am b/graphics/win32/Makefile.am
new file mode 100644
index 00000000..a6fb52f9
--- /dev/null
+++ b/graphics/win32/Makefile.am
@@ -0,0 +1,9 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=graphics_win32
+if PLUGINS
+modulegraphics_LTLIBRARIES = libgraphics_win32.la
+else
+noinst_LTLIBRARIES = libgraphics_win32.la
+endif
+libgraphics_win32_la_SOURCES = graphics_win32.c xpm2bmp.c
+libgraphics_win32_la_LDFLAGS = -module -avoid-version
diff --git a/graphics/win32/graphics_win32.c b/graphics/win32/graphics_win32.c
new file mode 100644
index 00000000..b740b8d8
--- /dev/null
+++ b/graphics/win32/graphics_win32.c
@@ -0,0 +1,1074 @@
+#include <windows.h>
+#include <wingdi.h>
+#include <glib.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "config.h"
+#include "debug.h"
+#include "point.h"
+#include "graphics.h"
+#include "color.h"
+#include "callback.h"
+#include "plugin.h"
+#include "item.h"
+#include "window.h"
+#include "graphics_win32.h"
+#include "xpm2bmp.h"
+#include "support/win32/ConvertUTF.h"
+
+struct graphics_priv {
+ struct navit *nav;
+ struct window window;
+ struct point p;
+ int width;
+ int height;
+ int library_init;
+ int visible;
+ HANDLE wnd_parent_handle;
+ HANDLE wnd_handle;
+ COLORREF bg_color;
+ struct callback_list *cbl;
+ enum draw_mode_num mode;
+};
+
+static HWND g_hwnd;
+
+#ifndef GET_WHEEL_DELTA_WPARAM
+ #define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam))
+#endif
+
+
+static GHashTable *image_cache_hash = NULL;
+
+
+HFONT EzCreateFont (HDC hdc, TCHAR * szFaceName, int iDeciPtHeight,
+ int iDeciPtWidth, int iAttributes, BOOL fLogRes) ;
+
+#define EZ_ATTR_BOLD 1
+#define EZ_ATTR_ITALIC 2
+#define EZ_ATTR_UNDERLINE 4
+#define EZ_ATTR_STRIKEOUT 8
+
+HFONT EzCreateFont (HDC hdc, TCHAR * szFaceName, int iDeciPtHeight,
+ int iDeciPtWidth, int iAttributes, BOOL fLogRes)
+{
+ FLOAT cxDpi, cyDpi ;
+ HFONT hFont ;
+ LOGFONT lf ;
+ POINT pt ;
+ TEXTMETRIC tm ;
+
+ SaveDC (hdc) ;
+
+#ifndef HAVE_API_WIN32_CE
+ SetGraphicsMode (hdc, GM_ADVANCED) ;
+ ModifyWorldTransform (hdc, NULL, MWT_IDENTITY) ;
+#endif
+ SetViewportOrgEx (hdc, 0, 0, NULL) ;
+#ifndef HAVE_API_WIN32_CE
+ SetWindowOrgEx (hdc, 0, 0, NULL) ;
+#endif
+
+ if (fLogRes)
+ {
+ cxDpi = (FLOAT) GetDeviceCaps (hdc, LOGPIXELSX) ;
+ cyDpi = (FLOAT) GetDeviceCaps (hdc, LOGPIXELSY) ;
+ }
+ else
+ {
+ cxDpi = (FLOAT) (25.4 * GetDeviceCaps (hdc, HORZRES) /
+ GetDeviceCaps (hdc, HORZSIZE)) ;
+
+ cyDpi = (FLOAT) (25.4 * GetDeviceCaps (hdc, VERTRES) /
+ GetDeviceCaps (hdc, VERTSIZE)) ;
+ }
+
+ pt.x = (int) (iDeciPtWidth * cxDpi / 72) ;
+ pt.y = (int) (iDeciPtHeight * cyDpi / 72) ;
+
+#ifndef HAVE_API_WIN32_CE
+ DPtoLP (hdc, &pt, 1) ;
+#endif
+ lf.lfHeight = - (int) (fabs (pt.y) / 10.0 + 0.5) ;
+ lf.lfWidth = 0 ;
+ lf.lfEscapement = 0 ;
+ lf.lfOrientation = 0 ;
+ lf.lfWeight = iAttributes & EZ_ATTR_BOLD ? 700 : 0 ;
+ lf.lfItalic = iAttributes & EZ_ATTR_ITALIC ? 1 : 0 ;
+ lf.lfUnderline = iAttributes & EZ_ATTR_UNDERLINE ? 1 : 0 ;
+ lf.lfStrikeOut = iAttributes & EZ_ATTR_STRIKEOUT ? 1 : 0 ;
+ lf.lfCharSet = DEFAULT_CHARSET ;
+ lf.lfOutPrecision = 0 ;
+ lf.lfClipPrecision = 0 ;
+ lf.lfQuality = 0 ;
+ lf.lfPitchAndFamily = 0 ;
+
+ lstrcpy (lf.lfFaceName, szFaceName) ;
+
+ hFont = CreateFontIndirect (&lf) ;
+
+ if (iDeciPtWidth != 0)
+ {
+ hFont = (HFONT) SelectObject (hdc, hFont) ;
+
+ GetTextMetrics (hdc, &tm) ;
+
+ DeleteObject (SelectObject (hdc, hFont)) ;
+
+ lf.lfWidth = (int) (tm.tmAveCharWidth *
+ fabs (pt.x) / fabs (pt.y) + 0.5) ;
+
+ hFont = CreateFontIndirect (&lf) ;
+ }
+
+ RestoreDC (hdc, -1) ;
+ return hFont ;
+}
+
+struct graphics_image_priv {
+ PXPM2BMP pxpm;
+};
+
+
+static void ErrorExit(LPTSTR lpszFunction)
+{
+ // Retrieve the system error message for the last-error code
+
+ LPVOID lpMsgBuf;
+ LPVOID lpDisplayBuf;
+ DWORD dw = GetLastError();
+
+ FormatMessage(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ dw,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) &lpMsgBuf,
+ 0, NULL );
+
+ lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT,
+ (lstrlen((LPCTSTR)lpMsgBuf)+lstrlen((LPCTSTR)lpszFunction)+40)*sizeof(TCHAR));
+ wprintf((LPTSTR)lpDisplayBuf, TEXT("%s failed with error %d: %s"), lpszFunction, dw, lpMsgBuf);
+
+ dbg(0, "%s failed with error %d: %s", lpszFunction, dw, lpMsgBuf);
+ MessageBox(NULL, (LPCTSTR)lpDisplayBuf, TEXT("Error"), MB_OK);
+
+ LocalFree(lpMsgBuf);
+ LocalFree(lpDisplayBuf);
+ ExitProcess(dw);
+}
+
+
+
+struct graphics_gc_priv {
+ HWND hwnd;
+ int line_width;
+ COLORREF fg_color;
+ COLORREF bg_color;
+ struct graphics_priv *gr;
+};
+
+
+//struct graphics_priv *g_gra;
+
+static HDC hMemDC;
+static HBITMAP hBitmap;
+static HBITMAP hOldBitmap;
+
+// Fills the region 'rgn' in graded colours
+static void MakeMemoryDC(HANDLE hWnd, HDC hdc )
+{
+ if ( hMemDC )
+ {
+ if ( hOldBitmap )
+ {
+ SelectObject( hMemDC, hOldBitmap );
+ DeleteObject( hBitmap );
+ hBitmap = NULL;
+ hOldBitmap = NULL;
+ }
+ }
+
+ // Creates memory DC
+ hMemDC = CreateCompatibleDC(hdc);
+ if ( hMemDC )
+ {
+ RECT rectRgn;
+ GetClientRect( hWnd, &rectRgn );
+
+ int Width = rectRgn.right - rectRgn.left;
+ int Height = rectRgn.bottom - rectRgn.top;
+ dbg(0, "resize memDC to: %d %d \n", Width, Height );
+
+ hBitmap = CreateCompatibleBitmap(hdc, Width, Height );
+
+ if ( hBitmap )
+ {
+ hOldBitmap = (HBITMAP) SelectObject( hMemDC, hBitmap);
+ }
+ }
+}
+
+static void HandleButtonClick( struct graphics_priv *gra_priv, int updown, int button, long lParam )
+{
+ POINTS p = MAKEPOINTS(lParam);
+ struct point pt;
+ pt.x = p.x;
+ pt.y = p.y;
+ callback_list_call_attr_3(gra_priv->cbl, attr_button, (void *)updown, (void *)button, (void *)&pt);
+}
+
+static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
+{
+
+//if ( Message != 15 )
+//printf( "CHILD %d %d %d \n", Message, wParam, lParam );
+
+ struct graphics_priv* gra_priv = (struct graphics_priv*)GetWindowLongPtr( hwnd , DWLP_USER );
+
+ switch(Message)
+ {
+ case WM_CREATE:
+ {
+ HDC hdc;
+ hdc = GetDC( hwnd );
+ MakeMemoryDC(hwnd, hdc );
+ ReleaseDC( hwnd, hdc );
+ }
+ break;
+ case WM_COMMAND:
+ switch(LOWORD(wParam))
+ {
+ case WM_USER + 1:
+ break;
+ }
+ break;
+ case WM_CLOSE:
+ DestroyWindow(hwnd);
+ break;
+ case WM_USER+1:
+ if ( gra_priv )
+ {
+ RECT rc ;
+ HDC hdc;
+
+ GetClientRect( hwnd, &rc );
+ gra_priv->width = rc.right;
+ gra_priv->height = rc.bottom;
+
+ hdc = GetDC( hwnd );
+ MakeMemoryDC(hwnd, hdc );
+ ReleaseDC( hwnd, hdc );
+ callback_list_call_attr_2(gra_priv->cbl, attr_resize, (void *)gra_priv->width, (void *)gra_priv->height);
+ }
+ break;
+ case WM_USER+2:
+ {
+ struct callback_list *cbl = wParam;
+#ifdef HAVE_API_WIN32_CE
+ /* FIXME: Reset the idle timer need a better place */
+ SystemIdleTimerReset();
+#endif
+ callback_list_call_0(cbl);
+ }
+ break;
+
+ case WM_SIZE:
+ /*
+ if ( gra_priv )
+ {
+ //graphics = GetWindowLong( hwnd, DWL_USER, 0 );
+
+
+ {
+ HDC hdc;
+ hdc = GetDC( hwnd );
+ MakeMemoryDC(hwnd, hdc );
+ ReleaseDC( hwnd, hdc );
+ }
+ (*gra_priv->resize_callback)(gra_priv->resize_callback_data, gra_priv->width, gra_priv->height);
+
+
+ }
+ */
+ if ( gra_priv )
+ {
+ gra_priv->width = LOWORD( lParam );
+ gra_priv->height = HIWORD( lParam );
+ dbg(0, "resize gfx to: %d %d \n", gra_priv->width, gra_priv->height );
+ }
+ break;
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ //exit( 0 );
+ break;
+ case WM_PAINT:
+ if ( gra_priv )
+ {
+ PAINTSTRUCT ps = { 0 };
+ HDC hdc = BeginPaint(hwnd, &ps);
+ if ( hMemDC )
+ {
+ BitBlt( hdc, 0, 0, gra_priv->width , gra_priv->height, hMemDC, 0, 0, SRCCOPY );
+ }
+ EndPaint(hwnd, &ps);
+ }
+ break;
+ case WM_MOUSEMOVE:
+ {
+ POINTS p = MAKEPOINTS(lParam);
+ struct point pt;
+ pt.x = p.x;
+ pt.y = p.y;
+
+ //dbg(1, "WM_MOUSEMOVE: %d %d \n", p.x, p.y );
+ callback_list_call_attr_1(gra_priv->cbl, attr_motion, (void *)&pt);
+ }
+ break;
+
+ case WM_LBUTTONDOWN:
+ {
+ dbg(1, "LBUTTONDOWN\n");
+ HandleButtonClick( gra_priv, 1, 1, lParam);
+ }
+ break;
+ case WM_LBUTTONUP:
+ {
+ dbg(1, "LBUTTONUP\n");
+ HandleButtonClick( gra_priv, 0, 1, lParam);
+ }
+ break;
+ case WM_RBUTTONDOWN:
+ HandleButtonClick( gra_priv, 1, 3,lParam );
+ break;
+ case WM_RBUTTONUP:
+ HandleButtonClick( gra_priv, 0, 3,lParam );
+ break;
+ case WM_LBUTTONDBLCLK:
+ dbg(1, "LBUTTONDBLCLK\n");
+ HandleButtonClick( gra_priv, 1, 6,lParam );
+ break;
+ default:
+ return DefWindowProc(hwnd, Message, wParam, lParam);
+ }
+ return 0;
+}
+
+
+static const wchar_t g_szClassName[] = {'N','A','V','G','R','A','\0'};
+
+static HANDLE CreateGraphicsWindows( struct graphics_priv* gr )
+{
+#ifdef HAVE_API_WIN32_CE
+ WNDCLASS wc;
+#else
+ WNDCLASSEX wc;
+ wc.cbSize = sizeof(WNDCLASSEX);
+ wc.hIconSm = NULL;
+#endif
+ HWND hwnd;
+ RECT rcParent;
+
+ wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
+ wc.lpfnWndProc = WndProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 64;
+ wc.hInstance = GetModuleHandle(NULL);
+ wc.hIcon = NULL;
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = g_szClassName;
+
+ GetClientRect( gr->wnd_parent_handle,&rcParent);
+
+#ifdef HAVE_API_WIN32_CE
+ if(!RegisterClass(&wc))
+#else
+ if(!RegisterClassEx(&wc))
+#endif
+ {
+ ErrorExit( TEXT("Window Registration Failed!") );
+ return NULL;
+ }
+
+ gr->width = rcParent.right - rcParent.left;
+ gr->height = rcParent.bottom - rcParent.top;
+ callback_list_call_attr_2(gr->cbl, attr_resize, (void *)gr->width, (void *)gr->height);
+
+ g_hwnd = hwnd = CreateWindow(g_szClassName,
+ TEXT(""),
+#ifdef HAVE_API_WIN32_CE
+ WS_VISIBLE,
+#elif 1
+ WS_CHILD,
+#else
+ WS_OVERLAPPEDWINDOW,
+#endif
+ 0,
+ 0,
+ gr->width,
+ gr->height,
+#if 1
+ gr->wnd_parent_handle,
+#else
+ NULL,
+#endif
+#if 1
+ (HMENU)ID_CHILD_GFX,
+#else
+ NULL,
+#endif
+ GetModuleHandle(NULL),
+ NULL);
+
+ if(hwnd == NULL)
+ {
+ ErrorExit( TEXT("Window Creation Failed!") );
+ return NULL;
+ }
+ gr->wnd_handle = hwnd;
+
+ SetWindowLongPtr( hwnd , DWLP_USER, gr );
+
+ ShowWindow( hwnd, TRUE );
+ UpdateWindow( hwnd );
+
+
+ PostMessage( gr->wnd_parent_handle, WM_USER + 1, 0, 0 );
+
+ return hwnd;
+}
+
+
+
+static void graphics_destroy(struct graphics_priv *gr)
+{
+ g_free( gr );
+}
+
+
+static void gc_destroy(struct graphics_gc_priv *gc)
+{
+ g_free( gc );
+}
+
+static void gc_set_linewidth(struct graphics_gc_priv *gc, int w)
+{
+ gc->line_width = w;
+}
+
+static void gc_set_dashes(struct graphics_gc_priv *gc, int width, int offset, unsigned char dash_list[], int n)
+{
+// gdk_gc_set_dashes(gc->gc, 0, (gint8 *)dash_list, n);
+// gdk_gc_set_line_attributes(gc->gc, 1, GDK_LINE_ON_OFF_DASH, GDK_CAP_ROUND, GDK_JOIN_ROUND);
+}
+
+
+
+static void gc_set_color(struct graphics_gc_priv *gc, struct color *c, int fg)
+{
+
+ gc->fg_color = RGB( c->r, c->g, c->b );
+}
+
+static void gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
+{
+ gc->fg_color = RGB( c->r, c->g, c->b );
+}
+
+static void gc_set_background(struct graphics_gc_priv *gc, struct color *c)
+{
+ gc->bg_color = RGB( c->r, c->g, c->b );
+ if ( hMemDC )
+ SetBkColor( hMemDC, gc->bg_color );
+
+}
+
+static struct graphics_gc_methods gc_methods = {
+ gc_destroy,
+ gc_set_linewidth,
+ gc_set_dashes,
+ gc_set_foreground,
+ gc_set_background
+};
+
+static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth)
+{
+ struct graphics_gc_priv *gc=g_new(struct graphics_gc_priv, 1);
+ *meth=gc_methods;
+ gc->hwnd = gr->wnd_handle;
+ gc->line_width = 1;
+ gc->fg_color = RGB( 0,0,0 );
+ gc->bg_color = RGB( 255,255,255 );
+ return gc;
+}
+
+
+static void draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
+{
+ int i;
+ HPEN holdpen;
+ HPEN hpen;
+
+ hpen = CreatePen( PS_SOLID, gc->line_width, gc->fg_color );
+ holdpen = SelectObject( hMemDC, hpen );
+
+ SetBkColor( hMemDC, gc->bg_color );
+
+ int first = 1;
+ for ( i = 0; i< count; i++ )
+ {
+ if ( first )
+ {
+ first = 0;
+ MoveToEx( hMemDC, p[0].x, p[0].y, NULL );
+ }
+ else
+ {
+ LineTo( hMemDC, p[i].x, p[i].y );
+ }
+ }
+
+ SelectObject( hMemDC, holdpen );
+ DeleteObject( hpen );
+}
+
+static void draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
+{
+
+ //if (gr->mode == draw_mode_begin || gr->mode == draw_mode_end)
+ {
+ int i;
+ POINT points[ count ];
+ for ( i=0;i< count; i++ )
+ {
+ points[i].x = p[i].x;
+ points[i].y = p[i].y;
+ }
+ HPEN hpen;
+ HBRUSH holdbrush;
+ HBRUSH hbrush;
+
+ SetBkColor( hMemDC, gc->bg_color );
+
+ hpen = CreatePen( PS_NULL, gc->line_width, gc->fg_color );
+ SelectObject( hMemDC, hpen );
+ hbrush = CreateSolidBrush( gc->fg_color );
+ holdbrush = SelectObject( hMemDC, hbrush );
+
+ Polygon( hMemDC, points,count );
+
+ SelectObject( hMemDC, holdbrush );
+ DeleteObject( hbrush );
+ DeleteObject( hbrush );
+ }
+}
+
+
+static void draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
+{
+// gdk_draw_rectangle(gr->drawable, gc->gc, TRUE, p->x, p->y, w, h);
+}
+
+static void draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r)
+{
+ HDC dc = hMemDC;
+
+ HPEN holdpen;
+ HPEN hpen;
+
+ hpen = CreatePen( PS_SOLID, gc->line_width, gc->fg_color );
+ holdpen = SelectObject( dc, hpen );
+
+ SetBkColor( hMemDC, gc->bg_color );
+
+ Ellipse( dc, p->x - r, p->y -r, p->x + r, p->y + r );
+
+ SelectObject( dc, holdpen );
+ DeleteObject( hpen );
+
+// if (gr->mode == draw_mode_begin || gr->mode == draw_mode_end)
+// gdk_draw_arc(gr->drawable, gc->gc, FALSE, p->x-r/2, p->y-r/2, r, r, 0, 64*360);
+// if (gr->mode == draw_mode_end || gr->mode == draw_mode_cursor)
+// gdk_draw_arc(gr->widget->window, gc->gc, FALSE, p->x-r/2, p->y-r/2, r, r, 0, 64*360);
+}
+
+
+
+static void draw_restore(struct graphics_priv *gr, struct point *p, int w, int h)
+{
+ InvalidateRect( gr->wnd_handle, NULL, FALSE );
+}
+
+static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
+{
+ // printf( "set draw_mode to %d\n", (int)mode );
+
+ if ( mode == draw_mode_begin )
+ {
+ if ( gr->wnd_handle == NULL )
+ {
+ CreateGraphicsWindows( gr );
+ }
+ if ( gr->mode != draw_mode_begin )
+ {
+ if ( hMemDC )
+ {
+ RECT rcClient;
+ HBRUSH bgBrush = CreateSolidBrush( gr->bg_color );
+ GetClientRect( gr->wnd_handle, &rcClient );
+ FillRect( hMemDC, &rcClient, bgBrush );
+ DeleteObject( bgBrush );
+ }
+ }
+ }
+
+ // force paint
+ if (mode == draw_mode_end && gr->mode == draw_mode_begin)
+ {
+ InvalidateRect( gr->wnd_handle, NULL, FALSE );
+ }
+
+ gr->mode=mode;
+
+}
+
+
+static void * get_data(struct graphics_priv *this_, char *type)
+{
+ if ( strcmp( "wnd_parent_handle_ptr", type ) == 0 ) {
+ return &( this_->wnd_parent_handle );
+ }
+ if ( strcmp( "START_CLIENT", type ) == 0 ) {
+ CreateGraphicsWindows( this_ );
+ return NULL;
+ }
+ if (!strcmp(type, "window")) {
+#ifdef HAVE_API_WIN32_CE
+ WNDCLASS wc;
+#else
+ WNDCLASSEX wc;
+ wc.cbSize = sizeof(WNDCLASSEX);
+ wc.hIconSm = NULL;
+#endif
+ HWND hwnd;
+ RECT rcParent;
+
+ wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
+ wc.lpfnWndProc = WndProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 64;
+ wc.hInstance = GetModuleHandle(NULL);
+ wc.hIcon = NULL;
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = g_szClassName;
+
+ GetClientRect( this_->wnd_parent_handle,&rcParent);
+
+#ifdef HAVE_API_WIN32_CE
+ if(!RegisterClass(&wc))
+#else
+ if(!RegisterClassEx(&wc))
+#endif
+ {
+ ErrorExit( TEXT("Window Registration Failed!") );
+ return NULL;
+ }
+
+ callback_list_call_attr_2(this_->cbl, attr_resize, (void *)this_->width, (void *)this_->height);
+
+ g_hwnd = hwnd = CreateWindow(g_szClassName,
+ TEXT(""),
+#ifdef HAVE_API_WIN32_CE
+ WS_VISIBLE,
+#else
+ WS_OVERLAPPEDWINDOW,
+#endif
+ 0,
+ 0,
+ this_->width,
+ this_->height,
+ this_->wnd_parent_handle,
+ NULL,
+ GetModuleHandle(NULL),
+ NULL);
+
+ if(hwnd == NULL)
+ {
+ ErrorExit( TEXT("Window Creation Failed!") );
+ return NULL;
+ }
+ this_->wnd_handle = hwnd;
+
+ SetWindowLongPtr( hwnd , DWLP_USER, this_ );
+
+ ShowWindow( hwnd, TRUE );
+ UpdateWindow( hwnd );
+
+
+ PostMessage( this_->wnd_parent_handle, WM_USER + 1, 0, 0 );
+
+ this_->window.priv=this_;
+ return &this_->window;
+ }
+ return NULL;
+}
+
+
+static void background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
+{
+ RECT rcClient;
+ HBRUSH bgBrush = CreateSolidBrush( gc->bg_color );
+ GetClientRect( gr->wnd_handle, &rcClient );
+ FillRect( hMemDC, &rcClient, bgBrush );
+ DeleteObject( bgBrush );
+ gr->bg_color = gc->bg_color;
+}
+
+struct graphics_font_priv {
+ LOGFONT lf;
+ HFONT hfont;
+ int size;
+};
+
+static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
+{
+ RECT rcClient;
+ GetClientRect( gr->wnd_handle, &rcClient );
+
+ int prevBkMode = SetBkMode( hMemDC, TRANSPARENT );
+
+ if ( NULL == font->hfont )
+ {
+#ifdef WIN_USE_SYSFONT
+ font->hfont = (HFONT) GetStockObject (SYSTEM_FONT);
+ GetObject (font->hfont, sizeof (LOGFONT), &font->lf);
+#else
+ font->hfont = EzCreateFont (hMemDC, TEXT ("Arial"), font->size/2, 0, 0, TRUE);
+ GetObject ( font->hfont, sizeof (LOGFONT), &font->lf) ;
+#endif
+ }
+
+
+ double angle = -atan2( dy, dx ) * 180 / 3.14159 ;
+ if (angle < 0)
+ angle += 360;
+
+ SetTextAlign (hMemDC, TA_BASELINE) ;
+ SetViewportOrgEx (hMemDC, p->x, p->y, NULL) ;
+ font->lf.lfEscapement = font->lf.lfOrientation = ( angle * 10 ) ;
+ DeleteObject (font->hfont) ;
+
+ font->hfont = CreateFontIndirect (&font->lf);
+ HFONT hOldFont = SelectObject(hMemDC, font->hfont );
+
+ {
+ wchar_t utf16[1024];
+ const UTF8 *utf8 = (UTF8 *)text;
+ UTF16 *utf16p = (UTF16 *) utf16;
+ SetBkMode (hMemDC, TRANSPARENT);
+ if (ConvertUTF8toUTF16(&utf8, utf8+strlen(text),
+ &utf16p, utf16p+sizeof(utf16),
+ lenientConversion) == conversionOK) {
+#ifdef _WIN32_WCE
+ ExtTextOut (hMemDC, 0, 0, 0, NULL,
+ utf16, (wchar_t*) utf16p - utf16, NULL);
+#else
+ ExtTextOutW(hMemDC, 0, 0, 0, NULL,
+ utf16, (wchar_t*) utf16p - utf16, NULL);
+#endif
+ }
+ }
+
+
+ SelectObject(hMemDC, hOldFont);
+ DeleteObject (font->hfont) ;
+
+ SetBkMode( hMemDC, prevBkMode );
+
+ SetViewportOrgEx (hMemDC, 0, 0, NULL) ;
+}
+
+static void font_destroy(struct graphics_font_priv *font)
+{
+ if ( font->hfont )
+ {
+ DeleteObject(font->hfont);
+ }
+ g_free(font);
+}
+
+static struct graphics_font_methods font_methods = {
+ font_destroy
+};
+
+static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, char *name, int size, int flags)
+{
+ struct graphics_font_priv *font=g_new(struct graphics_font_priv, 1);
+ *meth = font_methods;
+
+ font->hfont = NULL;
+ font->size = size;
+ // FontFamily fontFamily( "Liberation Mono");
+//font( &fontFamily, size, FontStyleRegular, UnitPoint );
+ return font;
+}
+
+static void image_cache_hash_add( const char* key, struct graphics_image_priv* val_ptr)
+{
+ if ( image_cache_hash == NULL ) {
+ image_cache_hash = g_hash_table_new(g_str_hash, g_str_equal);
+ }
+
+ if ( g_hash_table_lookup(image_cache_hash, key ) == NULL )
+ {
+ g_hash_table_insert(image_cache_hash, g_strdup( key ), (gpointer)val_ptr );
+ }
+
+}
+
+static struct graphics_image_priv* image_cache_hash_lookup( const char* key )
+{
+ struct graphics_image_priv* val_ptr = NULL;
+
+ if ( image_cache_hash != NULL )
+ {
+ val_ptr = g_hash_table_lookup(image_cache_hash, key );
+ }
+ return val_ptr;
+}
+
+
+
+static struct graphics_image_priv *image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h, struct point *hot, int rotation)
+{
+ struct graphics_image_priv* ret;
+
+ if ( NULL == ( ret = image_cache_hash_lookup( name ) ) )
+ {
+ ret = g_new( struct graphics_image_priv, 1 );
+ dbg(2, "loading image '%s'\n", name );
+ ret->pxpm = Xpm2bmp_new();
+ Xpm2bmp_load( ret->pxpm, name );
+ image_cache_hash_add( name, ret );
+ }
+
+ return ret;
+}
+
+static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
+{
+ Xpm2bmp_paint( img->pxpm , hMemDC, p->x, p->y );
+}
+
+static struct graphics_methods graphics_methods = {
+ graphics_destroy,
+ draw_mode,
+ draw_lines,
+ draw_polygon,
+ draw_rectangle,
+ draw_circle,
+ draw_text,
+ draw_image,
+#ifdef HAVE_IMLIB2
+ NULL, // draw_image_warp,
+#else
+ NULL,
+#endif
+ draw_restore,
+ NULL, // draw_drag
+ font_new,
+ gc_new,
+ background_gc,
+ NULL, // overlay_new,
+ image_new,
+ get_data,
+};
+
+static struct graphics_priv *
+graphics_win32_new_helper(struct graphics_methods *meth)
+{
+ struct graphics_priv *this_=g_new0(struct graphics_priv,1);
+ *meth=graphics_methods;
+ this_->mode = -1;
+ return this_;
+}
+
+static struct graphics_priv*
+graphics_win32_new( struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl)
+{
+ struct attr *attr;
+
+ struct graphics_priv* this_;
+ if (!event_request_system("win32","graphics_win32"))
+ return NULL;
+ this_=graphics_win32_new_helper(meth);
+ this_->nav=nav;
+ this_->width=792;
+ if ((attr=attr_search(attrs, NULL, attr_w)))
+ this_->width=attr->u.num;
+ this_->height=547;
+ if ((attr=attr_search(attrs, NULL, attr_h)))
+ this_->height=attr->u.num;
+
+ this_->cbl=cbl;
+ return this_;
+}
+
+static void
+event_win32_main_loop_run(void)
+{
+ MSG msg;
+
+ dbg(0,"enter\n");
+ while (GetMessage(&msg, 0, 0, 0)) {
+ TranslateMessage(&msg); /* Keyboard input. */
+ DispatchMessage(&msg);
+ }
+
+}
+
+static void event_win32_main_loop_quit(void)
+{
+ dbg(0,"enter\n");
+ PostQuitMessage(0);
+}
+
+static struct event_watch *
+event_win32_add_watch(void *h, enum event_watch_cond cond, struct callback *cb)
+{
+ dbg(0,"enter\n");
+ return NULL;
+}
+
+static void
+event_win32_remove_watch(struct event_watch *ev)
+{
+ dbg(0,"enter\n");
+}
+
+static GList *timers;
+struct event_timeout {
+ UINT_PTR timer_id;
+ int multi;
+ struct callback *cb;
+ struct event_timeout *next;
+};
+
+static void run_timer(UINT_PTR idEvent)
+{
+ GList *l;
+ struct event_timeout *t;
+ l = timers;
+ while (l) {
+ t = l->data;
+ if (t->timer_id == idEvent) {
+ dbg(1, "run timer:%d\n", idEvent);
+ callback_call_0(t->cb);
+ if (!t->multi) {
+ KillTimer(NULL, t->timer_id);
+ timers = g_list_remove(timers, t);
+ free(t);
+ }
+ return;
+ }
+ l = g_list_next(l);
+ }
+ dbg(0, "timer %d not found\n", idEvent);
+}
+
+static VOID CALLBACK win32_timer_cb(HWND hwnd, UINT uMsg,
+ UINT_PTR idEvent,
+ DWORD dwTime)
+{
+ run_timer(idEvent);
+}
+
+static struct event_timeout *
+event_win32_add_timeout(int timeout, int multi, struct callback *cb)
+{
+ struct event_timeout *t;
+ t = calloc(1, sizeof(*t));
+ if (!t)
+ return t;
+ t->multi = multi;
+ timers = g_list_prepend(timers, t);
+ t->cb = cb;
+ t->timer_id = SetTimer(NULL, 0, timeout, win32_timer_cb);
+ dbg(1, "Started timer %d for %d\n", t->timer_id, timeout);
+ return t;
+}
+
+static void
+event_win32_remove_timeout(struct event_timeout *to)
+{
+ GList *l;
+ struct event_timeout *t=NULL;
+ dbg(1,"enter:%d\n", t->timer_id);
+ l = timers;
+ while (l) {
+ t = l->data;
+ /* Use the pointer not the ID, IDs are reused */
+ if (t == to) {
+ KillTimer(NULL, t->timer_id);
+ timers = g_list_remove(timers, t);
+ free(t);
+ return;
+ }
+ l = g_list_next(l);
+ }
+ dbg(0, "Timer %d not found\n", to->timer_id);
+ free(to);
+}
+
+static struct event_idle *
+event_win32_add_idle(struct callback *cb)
+{
+ dbg(0,"enter\n");
+ return NULL;
+}
+
+static void
+event_win32_remove_idle(struct event_idle *ev)
+{
+ dbg(0,"enter\n");
+}
+
+static void
+event_win32_call_callback(struct callback_list *cb)
+{
+ PostMessage(g_hwnd, WM_USER+2, (WPARAM)cb , (LPARAM)0);
+}
+
+static struct event_methods event_win32_methods = {
+ event_win32_main_loop_run,
+ event_win32_main_loop_quit,
+ event_win32_add_watch,
+ event_win32_remove_watch,
+ event_win32_add_timeout,
+ event_win32_remove_timeout,
+ event_win32_add_idle,
+ event_win32_remove_idle,
+ event_win32_call_callback,
+};
+
+static struct event_priv *
+event_win32_new(struct event_methods *meth)
+{
+ *meth=event_win32_methods;
+ return NULL;
+}
+
+void
+plugin_init(void)
+{
+ plugin_register_graphics_type("win32", graphics_win32_new);
+ plugin_register_event_type("win32", event_win32_new);
+}
diff --git a/graphics/win32/graphics_win32.h b/graphics/win32/graphics_win32.h
new file mode 100644
index 00000000..9aab62ae
--- /dev/null
+++ b/graphics/win32/graphics_win32.h
@@ -0,0 +1,59 @@
+#ifndef WIN32_GUI_INCLUDED
+#define WIN32_GUI_INCLUDED
+
+#include "resources/resource.h"
+#include "coord.h"
+#include "point.h"
+#include "graphics.h"
+#include "event.h"
+
+#define ID_CHILD_GFX 100
+#define ID_CHILD_TOOLBAR (ID_CHILD_GFX + 1)
+#define ID_CHILD_1 (ID_CHILD_TOOLBAR + 1)
+#define ID_CHILD_2 (ID_CHILD_1 + 1)
+#define ID_CHILD_3 (ID_CHILD_2 + 1)
+#define ID_CHILD_4 (ID_CHILD_4 + 1)
+
+#define ID_DISPLAY_ZOOMIN 200
+#define ID_DISPLAY_ZOOMOUT 201
+#define ID_DISPLAY_REFRESH 202
+#define ID_DISPLAY_CURSOR 203
+#define ID_DISPLAY_ORIENT 204
+
+#define ID_FILE_EXIT 9001
+#define ID_STUFF_GO 9002
+
+//#define _(text) gettext(text)
+
+#define POPUP_MENU_OFFSET 4000
+
+struct statusbar_methods;
+struct menu_methods;
+struct datawindow_methods;
+struct navit;
+struct callback;
+
+
+struct menu_priv {
+ HWND wnd_handle;
+ HMENU hMenu;
+ struct callback* cb;
+};
+
+struct gui_priv {
+ struct navit *nav;
+ HANDLE hwnd;
+};
+
+
+struct graphics_priv;
+
+struct menu_priv *gui_gtk_menubar_new(struct gui_priv *gui, struct menu_methods *meth);
+struct menu_priv *gui_gtk_toolbar_new(struct gui_priv *gui, struct menu_methods *meth);
+struct statusbar_priv *gui_gtk_statusbar_new(struct gui_priv *gui, struct statusbar_methods *meth);
+struct menu_priv *gui_gtk_popup_new(struct gui_priv *gui, struct menu_methods *meth);
+struct datawindow_priv *gui_gtk_datawindow_new(struct gui_priv *gui, char *name, struct callback *click, struct callback *close, struct datawindow_methods *meth);
+
+struct graphics_priv* win32_graphics_new( struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl);
+
+#endif
diff --git a/navit/graphics/win32/resources/resource.h b/graphics/win32/resources/resource.h
index 55bcc2d7..55bcc2d7 100644
--- a/navit/graphics/win32/resources/resource.h
+++ b/graphics/win32/resources/resource.h
diff --git a/graphics/win32/xpm2bmp.c b/graphics/win32/xpm2bmp.c
new file mode 100644
index 00000000..95214d9c
--- /dev/null
+++ b/graphics/win32/xpm2bmp.c
@@ -0,0 +1,588 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <windows.h>
+#include <wingdi.h>
+#include "xpm2bmp.h"
+
+/* #define _DBG */
+
+// function prototypes
+static int CreateBitmapFromXpm( const char* filename, PXPM2BMP pXpm2bmp );
+
+// typedefs
+static XPMCOLORENTRY theRGBRecords[] =
+{
+ {"ALICEBLUE", 240, 248, 255},
+ {"ANTIQUEWHITE", 250, 235, 215},
+ {"AQUAMARINE", 50, 191, 193},
+ {"AZURE", 240, 255, 255},
+ {"BEIGE", 245, 245, 220},
+ {"BISQUE", 255, 228, 196},
+ {"BLACK", 0, 0, 0},
+ {"BLANCHEDALMOND", 255, 235, 205},
+ {"BLUE", 0, 0, 255},
+ {"BLUEVIOLET", 138, 43, 226},
+ {"BROWN", 165, 42, 42},
+ {"BURLYWOOD", 222, 184, 135},
+ {"CADETBLUE", 95, 146, 158},
+ {"CHARTREUSE", 127, 255, 0},
+ {"CHOCOLATE", 210, 105, 30},
+ {"CORAL", 255, 114, 86},
+ {"CORNFLOWERBLUE", 34, 34, 152},
+ {"CORNSILK", 255, 248, 220},
+ {"CYAN", 0, 255, 255},
+ {"DARKGOLDENROD", 184, 134, 11},
+ {"DARKGREEN", 0, 86, 45},
+ {"DARKKHAKI", 189, 183, 107},
+ {"DARKOLIVEGREEN", 85, 86, 47},
+ {"DARKORANGE", 255, 140, 0},
+ {"DARKORCHID", 139, 32, 139},
+ {"DARKSALMON", 233, 150, 122},
+ {"DARKSEAGREEN", 143, 188, 143},
+ {"DARKSLATEBLUE", 56, 75, 102},
+ {"DARKSLATEGRAY", 47, 79, 79},
+ {"DARKTURQUOISE", 0, 166, 166},
+ {"DARKVIOLET", 148, 0, 211},
+ {"DEEPPINK", 255, 20, 147},
+ {"DEEPSKYBLUE", 0, 191, 255},
+ {"DIMGRAY", 84, 84, 84},
+ {"DODGERBLUE", 30, 144, 255},
+ {"FIREBRICK", 142, 35, 35},
+ {"FLORALWHITE", 255, 250, 240},
+ {"FORESTGREEN", 80, 159, 105},
+ {"GAINSBORO", 220, 220, 220},
+ {"GHOSTWHITE", 248, 248, 255},
+ {"GOLD", 218, 170, 0},
+ {"GOLDENROD", 239, 223, 132},
+ {"GRAY", 126, 126, 126},
+ {"GRAY0", 0, 0, 0},
+ {"GRAY1", 3, 3, 3},
+ {"GRAY10", 26, 26, 26},
+ {"GRAY100", 255, 255, 255},
+ {"GRAY11", 28, 28, 28},
+ {"GRAY12", 31, 31, 31},
+ {"GRAY13", 33, 33, 33},
+ {"GRAY14", 36, 36, 36},
+ {"GRAY15", 38, 38, 38},
+ {"GRAY16", 41, 41, 41},
+ {"GRAY17", 43, 43, 43},
+ {"GRAY18", 46, 46, 46},
+ {"GRAY19", 48, 48, 48},
+ {"GRAY2", 5, 5, 5},
+ {"GRAY20", 51, 51, 51},
+ {"GRAY21", 54, 54, 54},
+ {"GRAY22", 56, 56, 56},
+ {"GRAY23", 59, 59, 59},
+ {"GRAY24", 61, 61, 61},
+ {"GRAY25", 64, 64, 64},
+ {"GRAY26", 66, 66, 66},
+ {"GRAY27", 69, 69, 69},
+ {"GRAY28", 71, 71, 71},
+ {"GRAY29", 74, 74, 74},
+ {"GRAY3", 8, 8, 8},
+ {"GRAY30", 77, 77, 77},
+ {"GRAY31", 79, 79, 79},
+ {"GRAY32", 82, 82, 82},
+ {"GRAY33", 84, 84, 84},
+ {"GRAY34", 87, 87, 87},
+ {"GRAY35", 89, 89, 89},
+ {"GRAY36", 92, 92, 92},
+ {"GRAY37", 94, 94, 94},
+ {"GRAY38", 97, 97, 97},
+ {"GRAY39", 99, 99, 99},
+ {"GRAY4", 10, 10, 10},
+ {"GRAY40", 102, 102, 102},
+ {"GRAY41", 105, 105, 105},
+ {"GRAY42", 107, 107, 107},
+ {"GRAY43", 110, 110, 110},
+ {"GRAY44", 112, 112, 112},
+ {"GRAY45", 115, 115, 115},
+ {"GRAY46", 117, 117, 117},
+ {"GRAY47", 120, 120, 120},
+ {"GRAY48", 122, 122, 122},
+ {"GRAY49", 125, 125, 125},
+ {"GRAY5", 13, 13, 13},
+ {"GRAY50", 127, 127, 127},
+ {"GRAY51", 130, 130, 130},
+ {"GRAY52", 133, 133, 133},
+ {"GRAY53", 135, 135, 135},
+ {"GRAY54", 138, 138, 138},
+ {"GRAY55", 140, 140, 140},
+ {"GRAY56", 143, 143, 143},
+ {"GRAY57", 145, 145, 145},
+ {"GRAY58", 148, 148, 148},
+ {"GRAY59", 150, 150, 150},
+ {"GRAY6", 15, 15, 15},
+ {"GRAY60", 153, 153, 153},
+ {"GRAY61", 156, 156, 156},
+ {"GRAY62", 158, 158, 158},
+ {"GRAY63", 161, 161, 161},
+ {"GRAY64", 163, 163, 163},
+ {"GRAY65", 166, 166, 166},
+ {"GRAY66", 168, 168, 168},
+ {"GRAY67", 171, 171, 171},
+ {"GRAY68", 173, 173, 173},
+ {"GRAY69", 176, 176, 176},
+ {"GRAY7", 18, 18, 18},
+ {"GRAY70", 179, 179, 179},
+ {"GRAY71", 181, 181, 181},
+ {"GRAY72", 184, 184, 184},
+ {"GRAY73", 186, 186, 186},
+ {"GRAY74", 189, 189, 189},
+ {"GRAY75", 191, 191, 191},
+ {"GRAY76", 194, 194, 194},
+ {"GRAY77", 196, 196, 196},
+ {"GRAY78", 199, 199, 199},
+ {"GRAY79", 201, 201, 201},
+ {"GRAY8", 20, 20, 20},
+ {"GRAY80", 204, 204, 204},
+ {"GRAY81", 207, 207, 207},
+ {"GRAY82", 209, 209, 209},
+ {"GRAY83", 212, 212, 212},
+ {"GRAY84", 214, 214, 214},
+ {"GRAY85", 217, 217, 217},
+ {"GRAY86", 219, 219, 219},
+ {"GRAY87", 222, 222, 222},
+ {"GRAY88", 224, 224, 224},
+ {"GRAY89", 227, 227, 227},
+ {"GRAY9", 23, 23, 23},
+ {"GRAY90", 229, 229, 229},
+ {"GRAY91", 232, 232, 232},
+ {"GRAY92", 235, 235, 235},
+ {"GRAY93", 237, 237, 237},
+ {"GRAY94", 240, 240, 240},
+ {"GRAY95", 242, 242, 242},
+ {"GRAY96", 245, 245, 245},
+ {"GRAY97", 247, 247, 247},
+ {"GRAY98", 250, 250, 250},
+ {"GRAY99", 252, 252, 252},
+ {"GREEN", 0, 255, 0},
+ {"GREENYELLOW", 173, 255, 47},
+ {"HONEYDEW", 240, 255, 240},
+ {"HOTPINK", 255, 105, 180},
+ {"INDIANRED", 107, 57, 57},
+ {"IVORY", 255, 255, 240},
+ {"KHAKI", 179, 179, 126},
+ {"LAVENDER", 230, 230, 250},
+ {"LAVENDERBLUSH", 255, 240, 245},
+ {"LAWNGREEN", 124, 252, 0},
+ {"LEMONCHIFFON", 255, 250, 205},
+ {"LIGHTBLUE", 176, 226, 255},
+ {"LIGHTCORAL", 240, 128, 128},
+ {"LIGHTCYAN", 224, 255, 255},
+ {"LIGHTGOLDENROD", 238, 221, 130},
+ {"LIGHTGOLDENRODYELLOW", 250, 250, 210},
+ {"LIGHTGRAY", 168, 168, 168},
+ {"LIGHTPINK", 255, 182, 193},
+ {"LIGHTSALMON", 255, 160, 122},
+ {"LIGHTSEAGREEN", 32, 178, 170},
+ {"LIGHTSKYBLUE", 135, 206, 250},
+ {"LIGHTSLATEBLUE", 132, 112, 255},
+ {"LIGHTSLATEGRAY", 119, 136, 153},
+ {"LIGHTSTEELBLUE", 124, 152, 211},
+ {"LIGHTYELLOW", 255, 255, 224},
+ {"LIMEGREEN", 0, 175, 20},
+ {"LINEN", 250, 240, 230},
+ {"MAGENTA", 255, 0, 255},
+ {"MAROON", 143, 0, 82},
+ {"MEDIUMAQUAMARINE", 0, 147, 143},
+ {"MEDIUMBLUE", 50, 50, 204},
+ {"MEDIUMFORESTGREEN", 50, 129, 75},
+ {"MEDIUMGOLDENROD", 209, 193, 102},
+ {"MEDIUMORCHID", 189, 82, 189},
+ {"MEDIUMPURPLE", 147, 112, 219},
+ {"MEDIUMSEAGREEN", 52, 119, 102},
+ {"MEDIUMSLATEBLUE", 106, 106, 141},
+ {"MEDIUMSPRINGGREEN", 35, 142, 35},
+ {"MEDIUMTURQUOISE", 0, 210, 210},
+ {"MEDIUMVIOLETRED", 213, 32, 121},
+ {"MIDNIGHTBLUE", 47, 47, 100},
+ {"MINTCREAM", 245, 255, 250},
+ {"MISTYROSE", 255, 228, 225},
+ {"MOCCASIN", 255, 228, 181},
+ {"NAVAJOWHITE", 255, 222, 173},
+ {"NAVY", 35, 35, 117},
+ {"NAVYBLUE", 35, 35, 117},
+ {"OLDLACE", 253, 245, 230},
+ {"OLIVEDRAB", 107, 142, 35},
+ {"ORANGE", 255, 135, 0},
+ {"ORANGERED", 255, 69, 0},
+ {"ORCHID", 239, 132, 239},
+ {"PALEGOLDENROD", 238, 232, 170},
+ {"PALEGREEN", 115, 222, 120},
+ {"PALETURQUOISE", 175, 238, 238},
+ {"PALEVIOLETRED", 219, 112, 147},
+ {"PAPAYAWHIP", 255, 239, 213},
+ {"PEACHPUFF", 255, 218, 185},
+ {"PERU", 205, 133, 63},
+ {"PINK", 255, 181, 197},
+ {"PLUM", 197, 72, 155},
+ {"POWDERBLUE", 176, 224, 230},
+ {"PURPLE", 160, 32, 240},
+ {"RED", 255, 0, 0},
+ {"ROSYBROWN", 188, 143, 143},
+ {"ROYALBLUE", 65, 105, 225},
+ {"SADDLEBROWN", 139, 69, 19},
+ {"SALMON", 233, 150, 122},
+ {"SANDYBROWN", 244, 164, 96},
+ {"SEAGREEN", 82, 149, 132},
+ {"SEASHELL", 255, 245, 238},
+ {"SIENNA", 150, 82, 45},
+ {"SKYBLUE", 114, 159, 255},
+ {"SLATEBLUE", 126, 136, 171},
+ {"SLATEGRAY", 112, 128, 144},
+ {"SNOW", 255, 250, 250},
+ {"SPRINGGREEN", 65, 172, 65},
+ {"STEELBLUE", 84, 112, 170},
+ {"TAN", 222, 184, 135},
+ {"THISTLE", 216, 191, 216},
+ {"TOMATO", 255, 99, 71},
+ {"TRANSPARENT", 0, 0, 1},
+ {"TURQUOISE", 25, 204, 223},
+ {"VIOLET", 156, 62, 206},
+ {"VIOLETRED", 243, 62, 150},
+ {"WHEAT", 245, 222, 179},
+ {"WHITE", 255, 255, 255},
+ {"WHITESMOKE", 245, 245, 245},
+ {"YELLOW", 255, 255, 0},
+ {"YELLOWGREEN", 50, 216, 56}
+};
+
+
+PXPM2BMP Xpm2bmp_new()
+{
+ PXPM2BMP preturn = (PXPM2BMP)calloc( sizeof( XPM2BMP ) , 1 );
+ return preturn;
+}
+
+
+int Xpm2bmp_load( PXPM2BMP pXpm2bmp, const char* filename )
+{
+ return CreateBitmapFromXpm( filename, pXpm2bmp );
+}
+
+int Xpm2bmp_paint( PXPM2BMP pXpm2bmp, HDC hdc, int x1,int y1 )
+{
+ StretchDIBits(hdc,
+ x1, y1, pXpm2bmp->size_x, pXpm2bmp->size_y,
+ 0, 0, pXpm2bmp->size_x, pXpm2bmp->size_y,
+ pXpm2bmp->wimage_data_trans,
+ (BITMAPINFO *)pXpm2bmp->bmih_trans,
+ DIB_RGB_COLORS,
+ SRCAND );
+
+ StretchDIBits(hdc,
+ x1, y1, pXpm2bmp->size_x, pXpm2bmp->size_y,
+ 0, 0, pXpm2bmp->size_x, pXpm2bmp->size_y,
+ pXpm2bmp->wimage_data,
+ (BITMAPINFO *)pXpm2bmp->bmih,
+ DIB_RGB_COLORS,
+ SRCPAINT );
+
+ return 0;
+}
+
+static int parse_line_values( const char* line, PXPM2BMP pXpm2bmp )
+{
+ int return_value = 0;
+ char* parse_line = (char*)line;
+ char* tok;
+ int value_pos = 0;
+
+ parse_line = strchr( parse_line, '"' );
+ parse_line++;
+
+ tok = strtok( parse_line, " \t\n" );
+
+ while ( tok != 0 )
+ {
+ int val = atoi( tok );
+ switch ( value_pos )
+ {
+ case 0: pXpm2bmp->size_x = val; break;
+ case 1: pXpm2bmp->size_y = val; break;
+ case 2: pXpm2bmp->colors = val; break;
+ case 3: pXpm2bmp->chars_per_pixel = val; break;
+ case 4: pXpm2bmp->hotspot_x = val; break;
+ case 5: pXpm2bmp->hotspot_y = val; break;
+ }
+ tok = strtok( NULL, " \t" );
+ value_pos ++;
+
+ }
+
+ return return_value;
+}
+
+static int hex2int( char c )
+{
+ if ((c >= '0') && (c <='9' )) return c - '0';
+ if ((c >= 'A') && (c <= 'F')) return c - 'A' + 10;
+ if ((c >= 'a') && (c <= 'f')) return c - 'a' + 10;
+ return -1;
+}
+
+static DWORD string2hex16( const char* str )
+{
+ int i1 = hex2int( str[0] );
+ int i2 = hex2int( str[1] );
+ if ( ( i1 >= 0 ) && ( i2 >= 0 ) )
+ return i1*16+i2;
+ return -1;
+}
+
+static int parse_color_values( const char* line, PXPM2BMP pXpm2bmp )
+{
+ int return_value = 0;
+ char* cq = strchr( line, '"' );
+ char* cchar = strchr( cq+pXpm2bmp->chars_per_pixel+1, 'c' );
+ char* chash = strchr( cq+pXpm2bmp->chars_per_pixel+1, '#' );
+ char* qe = strchr( cq+pXpm2bmp->chars_per_pixel+1, '"' );
+
+ cq++;
+
+ if ( cq )
+ {
+ memcpy( pXpm2bmp->color_entires[ pXpm2bmp-> color_entires_size].color_str, cq, pXpm2bmp->chars_per_pixel + 1 );
+ pXpm2bmp->color_entires[ pXpm2bmp-> color_entires_size].color_str[ pXpm2bmp->chars_per_pixel ] = '\0';
+
+
+ if ( cchar && chash && qe)
+ {
+ chash++;
+ *qe = 0;
+ int len = strlen( chash );
+
+ pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].r = string2hex16( &chash[0] );
+ pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].g = string2hex16( &chash[len / 3] );
+ pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].b = string2hex16( &chash[len * 2 / 3] );
+#ifdef _DBG
+printf( "adding color %s => %d RGB %x %x %x to index %d\n",
+ line,
+ pXpm2bmp->color_entires_size,
+ pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].r,
+ pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].g,
+ pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].b,
+ pXpm2bmp->color_entires_size );
+#endif
+ }
+ else
+ {
+ int q;
+ char *start = cchar + 1;
+ char *end = start;
+
+ while ( *start != 0 )
+ {
+ if ( ( *start != '\t' ) && ( *start != ' ' ) )
+ {
+ break;
+ }
+ start++;
+ }
+
+ end = start;
+ while ( *end != 0 )
+ {
+ if ( ( *end == '\t' ) || ( *end == ' ' ) || ( *end == '"' ))
+ {
+ *end = 0;
+ }
+ end++;
+ }
+
+ start = _strupr( start );
+
+ for ( q=0; q < sizeof( theRGBRecords ) / sizeof( theRGBRecords[0] ); q++ )
+ {
+
+ if ( 0 == strcmp( start, theRGBRecords[q].color_str ) )
+ {
+ pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].r = theRGBRecords[q].r;
+ pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].g = theRGBRecords[q].g;
+ pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].b = theRGBRecords[q].b;
+ }
+ }
+ if ( 0 == strcmp( start, "NONE" ) )
+ {
+ pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].r = 255;
+ pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].g = 0;
+ pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].b = 255;
+ }
+ }
+ }
+ pXpm2bmp->color_entires_size++;
+
+ return return_value;
+}
+
+static int vv = 0;
+
+static int parse_pixel_line_values( const char* line, PXPM2BMP pXpm2bmp, unsigned char* pixel_data, unsigned char* pixel_data_trans )
+{
+ int return_value = 0;
+ int i,j;
+
+
+ char* cq = strchr( line, '"' );
+ int pix_idx = 0;
+ int size_x = pXpm2bmp->size_x;
+ int len = strlen( cq );
+
+ cq++;
+
+ if ( len > pXpm2bmp->chars_per_pixel * size_x )
+ {
+ for ( i=0; i< size_x; i++ )
+ {
+ int found = 0;
+ char* cmp = &cq[ i * pXpm2bmp->chars_per_pixel];
+
+ for ( j=0; j< pXpm2bmp-> color_entires_size; j++ )
+ {
+ if ( strncmp( cmp, pXpm2bmp->color_entires[ j ].color_str, pXpm2bmp->chars_per_pixel ) == 0 )
+ {
+ int r = pXpm2bmp->color_entires[ j ].r;
+ int g = pXpm2bmp->color_entires[ j ].g;
+ int b = pXpm2bmp->color_entires[ j ].b;
+
+ if ( ( r == 255 ) && ( g == 0 ) && ( r == 255 ) )
+ {
+ r=g=b=0;
+ pixel_data_trans[ pix_idx ] = 255;
+ pixel_data_trans[ pix_idx+1 ] = 255;
+ pixel_data_trans[ pix_idx+2 ] = 255;
+ }
+ else
+ {
+ pixel_data_trans[ pix_idx ] = 0;
+ pixel_data_trans[ pix_idx+1 ] = 0;
+ pixel_data_trans[ pix_idx+2 ] = 0;
+ }
+
+ // pixel_data[ pix_idx++ ] = pXpm2bmp->color_entires[ j ].r;
+ // pixel_data[ pix_idx++ ] = pXpm2bmp->color_entires[ j ].g;
+ // pixel_data[ pix_idx++ ] = pXpm2bmp->color_entires[ j ].b;
+ pixel_data[ pix_idx++ ] = b;
+ pixel_data[ pix_idx++ ] = g;
+ pixel_data[ pix_idx++ ] = r;
+ found = 1;
+ vv++;
+ break;
+ }
+ }
+ if ( !found )
+ {
+ fprintf( stderr, "XPMLIB: error color not found\n" );
+ }
+
+ }
+ }
+ else
+ {
+ return_value = -1;
+ fprintf( stderr, "XPMLIB: invalid line length\n" );
+ }
+ return return_value;
+}
+
+
+static int CreateBitmapFromXpm( const char* filename, PXPM2BMP pXpm2bmp )
+{
+ int return_val = 0;
+ unsigned char i, row;
+ char line[ 1024 ];
+ int nbytes ;
+ FILE* file_xpm = fopen( filename, "r" );
+
+ int phase = 0;
+ row = 0;
+
+ if ( file_xpm )
+ {
+ while ( fgets(line, sizeof( line ), file_xpm ) )
+ {
+#ifdef _DBG
+ printf( "PARSING: %s\n", line );
+#endif
+ if ( line[ 0 ] != '"' )
+ continue;
+
+ switch ( phase )
+ {
+ case 0:
+ parse_line_values( line, pXpm2bmp );
+#ifdef _DBG
+ printf( "size_x %d\n", pXpm2bmp->size_x );
+ printf( "size_y %d\n", pXpm2bmp->size_y );
+#endif
+ phase = 1;
+
+ pXpm2bmp->color_entires_size = 0;
+ nbytes = ( pXpm2bmp->chars_per_pixel + 1 ) * pXpm2bmp->colors;
+
+ pXpm2bmp->color_entires = calloc( sizeof( XPMCOLORENTRY ), pXpm2bmp->colors + 100 );
+ pXpm2bmp->color_entires[0].color_str = calloc( nbytes, pXpm2bmp->colors );
+ for ( i = 1; i< pXpm2bmp->colors; i++ )
+ {
+ pXpm2bmp->color_entires[i].color_str = pXpm2bmp->color_entires[0].color_str + ( pXpm2bmp->chars_per_pixel + 1 ) * i;
+ }
+
+ if (!(pXpm2bmp->dib = (unsigned char *)malloc(sizeof(BITMAPINFOHEADER) + pXpm2bmp->size_x * pXpm2bmp->size_y * 3)))
+ {
+ return 4;
+ }
+ if (!(pXpm2bmp->dib_trans = (unsigned char *)calloc(sizeof(BITMAPINFOHEADER) + pXpm2bmp->size_x * pXpm2bmp->size_y * 3,1)))
+ {
+ return 4;
+ }
+
+ memset(pXpm2bmp->dib, 0, sizeof(BITMAPINFOHEADER));
+ pXpm2bmp->bmih = (BITMAPINFOHEADER *)pXpm2bmp->dib;
+ pXpm2bmp->bmih->biSize = sizeof(BITMAPINFOHEADER);
+ pXpm2bmp->bmih->biWidth = pXpm2bmp->size_x;
+ pXpm2bmp->bmih->biHeight = -((long)pXpm2bmp->size_y);
+ pXpm2bmp->bmih->biPlanes = 1;
+ pXpm2bmp->bmih->biBitCount = 24;
+ pXpm2bmp->bmih->biCompression = 0;
+ pXpm2bmp->wimage_data = pXpm2bmp->dib + sizeof(BITMAPINFOHEADER);
+
+
+ pXpm2bmp->bmih_trans = (BITMAPINFOHEADER *)pXpm2bmp->dib_trans;
+ pXpm2bmp->bmih_trans->biSize = sizeof(BITMAPINFOHEADER);
+ pXpm2bmp->bmih_trans->biWidth = pXpm2bmp->size_x;
+ pXpm2bmp->bmih_trans->biHeight = -((long)pXpm2bmp->size_y);
+ pXpm2bmp->bmih_trans->biPlanes = 1;
+ pXpm2bmp->bmih_trans->biBitCount = 24;
+ pXpm2bmp->bmih_trans->biCompression = 0;
+ pXpm2bmp->wimage_data_trans = pXpm2bmp->dib_trans + sizeof(BITMAPINFOHEADER);
+// memset( pXpm2bmp->wimage_data_trans, 255, 5* 22 * 3 );
+
+ break;
+ case 1:
+ parse_color_values( line, pXpm2bmp );
+ if ( pXpm2bmp->color_entires_size >= pXpm2bmp->colors )
+ {
+ phase = 2;
+ }
+
+ break;
+ case 2:
+ parse_pixel_line_values( line, pXpm2bmp,
+ pXpm2bmp->wimage_data + row * pXpm2bmp->size_x * 3,
+ pXpm2bmp->wimage_data_trans + row * pXpm2bmp->size_x * 3 );
+
+ row++;
+ if ( row >= pXpm2bmp->size_y )
+ {
+ phase = 3;
+ }
+ break;
+ }
+
+ }
+
+ fclose( file_xpm );
+ }
+ return return_val;
+}
diff --git a/navit/graphics/win32/xpm2bmp.h b/graphics/win32/xpm2bmp.h
index 2fa028f1..2fa028f1 100644
--- a/navit/graphics/win32/xpm2bmp.h
+++ b/graphics/win32/xpm2bmp.h
diff --git a/gtkext.h b/gtkext.h
new file mode 100644
index 00000000..c00f78f3
--- /dev/null
+++ b/gtkext.h
@@ -0,0 +1,25 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_GTKEXT_H
+#define NAVIT_GTKEXT_H
+
+void gdk_gc_set_fill_rule(GdkGC *gc, GdkFillRule fill_rule);
+
+#endif
diff --git a/gui.c b/gui.c
new file mode 100644
index 00000000..3f4b9316
--- /dev/null
+++ b/gui.c
@@ -0,0 +1,154 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "debug.h"
+#include "callback.h"
+#include "gui.h"
+#include "menu.h"
+#include "data_window.h"
+#include "item.h"
+#include "plugin.h"
+
+struct gui {
+ struct gui_methods meth;
+ struct gui_priv *priv;
+ struct attr **attrs;
+};
+
+struct gui *
+gui_new(struct attr *parent, struct attr **attrs)
+{
+ struct gui *this_;
+ struct attr *type_attr;
+ struct gui_priv *(*guitype_new)(struct navit *nav, struct gui_methods *meth, struct attr **attrs);
+ struct attr cbl;
+ if (! (type_attr=attr_search(attrs, NULL, attr_type))) {
+ return NULL;
+ }
+
+ guitype_new=plugin_get_gui_type(type_attr->u.str);
+ if (! guitype_new)
+ return NULL;
+
+ this_=g_new0(struct gui, 1);
+ this_->attrs=attr_list_dup(attrs);
+ cbl.type=attr_callback_list;
+ cbl.u.callback_list=callback_list_new();
+ this_->attrs=attr_generic_add_attr(this_->attrs, &cbl);
+ this_->priv=guitype_new(parent->u.navit, &this_->meth, this_->attrs);
+ return this_;
+}
+
+int
+gui_get_attr(struct gui *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
+{
+ return attr_generic_get_attr(this_->attrs, NULL, type, attr, iter);
+}
+
+struct menu *
+gui_menubar_new(struct gui *gui)
+{
+ struct menu *this_;
+ if (! gui->meth.menubar_new)
+ return NULL;
+ this_=g_new0(struct menu, 1);
+ this_->priv=gui->meth.menubar_new(gui->priv, &this_->meth);
+ if (! this_->priv) {
+ g_free(this_);
+ return NULL;
+ }
+ return this_;
+}
+
+struct menu *
+gui_popup_new(struct gui *gui)
+{
+ struct menu *this_;
+ if (! gui->meth.popup_new)
+ return NULL;
+ this_=g_new0(struct menu, 1);
+ this_->priv=gui->meth.popup_new(gui->priv, &this_->meth);
+ if (! this_->priv) {
+ g_free(this_);
+ return NULL;
+ }
+ return this_;
+}
+
+struct datawindow *
+gui_datawindow_new(struct gui *gui, char *name, struct callback *click, struct callback *close)
+{
+ struct datawindow *this_;
+ if (! gui->meth.datawindow_new)
+ return NULL;
+ this_=g_new0(struct datawindow, 1);
+ this_->priv=gui->meth.datawindow_new(gui->priv, name, click, close, &this_->meth);
+ if (! this_->priv) {
+ g_free(this_);
+ return NULL;
+ }
+ return this_;
+}
+
+int
+gui_add_bookmark(struct gui *gui, struct pcoord *c, char *description)
+{
+ int ret;
+ dbg(2,"enter\n");
+ if (! gui->meth.add_bookmark)
+ return 0;
+ ret=gui->meth.add_bookmark(gui->priv, c, description);
+
+ dbg(2,"ret=%d\n", ret);
+ return ret;
+}
+
+int
+gui_set_graphics(struct gui *this_, struct graphics *gra)
+{
+ if (! this_->meth.set_graphics)
+ return 1;
+ return this_->meth.set_graphics(this_->priv, gra);
+}
+
+void
+gui_disable_suspend(struct gui *this_)
+{
+ if (this_->meth.disable_suspend)
+ this_->meth.disable_suspend(this_->priv);
+}
+
+int
+gui_has_main_loop(struct gui *this_)
+{
+ if (! this_->meth.run_main_loop)
+ return 0;
+ return 1;
+}
+
+int
+gui_run_main_loop(struct gui *this_)
+{
+ if (! gui_has_main_loop(this_))
+ return 1;
+ return this_->meth.run_main_loop(this_->priv);
+}
+
diff --git a/gui.h b/gui.h
new file mode 100644
index 00000000..419582aa
--- /dev/null
+++ b/gui.h
@@ -0,0 +1,67 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_GUI_H
+#define NAVIT_GUI_H
+
+struct navit;
+struct gui_priv;
+struct menu_methods;
+struct datawindow_methods;
+struct callback;
+struct graphics;
+struct coord;
+struct pcoord;
+
+struct gui_methods {
+ struct menu_priv *(*menubar_new)(struct gui_priv *priv, struct menu_methods *meth);
+ struct menu_priv *(*popup_new)(struct gui_priv *priv, struct menu_methods *meth);
+ int (*set_graphics)(struct gui_priv *priv, struct graphics *gra);
+ int (*run_main_loop)(struct gui_priv *priv);
+ struct datawindow_priv *(*datawindow_new)(struct gui_priv *priv, char *name, struct callback *click, struct callback *close, struct datawindow_methods *meth);
+ int (*add_bookmark)(struct gui_priv *priv, struct pcoord *c, char *description);
+ void (*disable_suspend)(struct gui_priv *priv);
+};
+
+
+/* prototypes */
+enum attr_type;
+struct attr;
+struct attr_iter;
+struct callback;
+struct datawindow;
+struct graphics;
+struct gui;
+struct menu;
+struct navit;
+struct pcoord;
+struct gui *gui_new(struct attr *parent, struct attr **attrs);
+int gui_get_attr(struct gui *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
+struct menu *gui_menubar_new(struct gui *gui);
+struct menu *gui_popup_new(struct gui *gui);
+struct datawindow *gui_datawindow_new(struct gui *gui, char *name, struct callback *click, struct callback *close);
+int gui_add_bookmark(struct gui *gui, struct pcoord *c, char *description);
+int gui_set_graphics(struct gui *this_, struct graphics *gra);
+void gui_disable_suspend(struct gui *this_);
+int gui_has_main_loop(struct gui *this_);
+int gui_run_main_loop(struct gui *this_);
+/* end of prototypes */
+
+#endif
+
diff --git a/gui/Makefile.am b/gui/Makefile.am
new file mode 100644
index 00000000..320cd81c
--- /dev/null
+++ b/gui/Makefile.am
@@ -0,0 +1,10 @@
+SUBDIRS=
+if GUI_INTERNAL
+ SUBDIRS += internal
+endif
+if GUI_GTK
+ SUBDIRS += gtk
+endif
+if GUI_WIN32
+ SUBDIRS += win32
+endif
diff --git a/gui/gtk/Makefile.am b/gui/gtk/Makefile.am
new file mode 100644
index 00000000..1588bfe8
--- /dev/null
+++ b/gui/gtk/Makefile.am
@@ -0,0 +1,6 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = -I$(top_srcdir)/navit @NAVIT_CFLAGS@ @HILDON_CFLAGS@ @GTK2_CFLAGS@ -DMODULE=gui_gtk
+modulegui_LTLIBRARIES = libgui_gtk.la
+libgui_gtk_la_SOURCES = datawindow.c destination.c gui_gtk_statusbar.c gui_gtk_action.c gui_gtk_window.c gui_gtk.h
+libgui_gtk_la_LIBADD = @GTK2_LIBS@
+libgui_gtk_la_LDFLAGS = -module -avoid-version
diff --git a/gui/gtk/datawindow.c b/gui/gtk/datawindow.c
new file mode 100644
index 00000000..75f43a80
--- /dev/null
+++ b/gui/gtk/datawindow.c
@@ -0,0 +1,214 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtk.h>
+#include "debug.h"
+#include "callback.h"
+#include "param.h"
+#include "data_window.h"
+#include "gui_gtk.h"
+
+struct datawindow_priv {
+ GtkWidget *window;
+ GtkWidget *scrolled_window;
+ GtkWidget *treeview;
+ GtkWidget *button;
+ GtkListStore *liststore;
+ GtkTreeModel *sortmodel;
+ struct callback *click, *close;
+ struct gui_priv *gui;
+};
+
+static GValue value;
+static void
+select_row(GtkTreeView *tree, GtkTreePath *path, GtkTreeViewColumn *column, struct datawindow_priv *win)
+{
+ char *cols[20];
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+ int i;
+
+ dbg(0,"win=%p\n", win);
+
+ model=gtk_tree_view_get_model(tree);
+ gtk_tree_model_get_iter(model, &iter, path);
+
+ for (i=0;i<gtk_tree_model_get_n_columns(model);i++) {
+ gtk_tree_model_get_value(model, &iter, i, &value);
+ cols[i]=g_strdup_value_contents(&value)+1;
+ cols[i][strlen(cols[i])-1]='\0';
+ g_value_unset(&value);
+ }
+ callback_call_1(win->click, cols);
+}
+
+static void
+gui_gtk_datawindow_add(struct datawindow_priv *win, struct param_list *param, int count)
+{
+ int i;
+ GtkCellRenderer *cell;
+ GtkTreeIter iter;
+ GType types[count];
+
+ if (! win->treeview) {
+ win->treeview=gtk_tree_view_new();
+ gtk_tree_view_set_model (GTK_TREE_VIEW (win->treeview), NULL);
+ gtk_container_add(GTK_CONTAINER(win->scrolled_window), win->treeview);
+ gtk_widget_show_all(GTK_WIDGET(win->window));
+ gtk_widget_grab_focus(GTK_WIDGET(win->treeview));
+
+ /* add column names to treeview */
+ for(i=0;i<count;i++) {
+ if (param[i].name) {
+ cell=gtk_cell_renderer_text_new();
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (win->treeview),-1,param[i].name,
+ cell,"text",i, NULL);
+ }
+ }
+#if 0
+ g_signal_connect(G_OBJECT(win->treeview), "click-column", G_CALLBACK(click_column), NULL);
+#endif
+ g_signal_connect(G_OBJECT(win->treeview), "row-activated", G_CALLBACK(select_row), win);
+ }
+
+ /* find data storage and create a new one if none is there */
+ if (gtk_tree_view_get_model(GTK_TREE_VIEW (win->treeview)) == NULL) {
+ for(i=0;i<count;i++) {
+ if (param[i].name && !strcmp(param[i].name, "Distance"))
+ types[i]=G_TYPE_INT;
+ else
+ types[i]=G_TYPE_STRING;
+ }
+ win->liststore=gtk_list_store_newv(count,types);
+ if (! strcmp(param[0].name, "Distance")) {
+ win->sortmodel=gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(win->liststore));
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (win->sortmodel), 0, GTK_SORT_ASCENDING);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (win->treeview), GTK_TREE_MODEL(win->sortmodel));
+ } else
+ gtk_tree_view_set_model (GTK_TREE_VIEW (win->treeview), GTK_TREE_MODEL(win->liststore));
+ }
+
+ gtk_list_store_append(win->liststore,&iter);
+
+ /* add data to data storage */
+ for(i=0;i<count;i++) {
+ if (param[i].name && !strcmp(param[i].name, "Distance")) {
+ gtk_list_store_set(win->liststore,&iter,i,atoi(param[i].value),-1);
+ } else {
+ gtk_list_store_set(win->liststore,&iter,i,param[i].value,-1);
+ }
+ }
+}
+
+static void
+gui_gtk_datawindow_mode(struct datawindow_priv *win, int start)
+{
+ if (start) {
+ if (win && win->treeview) {
+ gtk_tree_view_set_model (GTK_TREE_VIEW (win->treeview), NULL);
+ }
+ }
+}
+
+static gboolean
+gui_gtk_datawindow_delete(GtkWidget *widget, GdkEvent *event, struct datawindow_priv *win)
+{
+ callback_call_0(win->close);
+
+ if (win->button) {
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION(win->button), FALSE);
+ }
+
+ return FALSE;
+}
+
+void
+gui_gtk_datawindow_destroy(struct datawindow_priv *win)
+{
+ if ((!win->gui) || (!win->gui->datawindow)) {
+ return;
+ }
+
+ gui_gtk_datawindow_delete(NULL, NULL, win);
+ gtk_widget_destroy(win->window);
+ win->gui->datawindow = NULL;
+
+ return;
+}
+
+void
+gui_gtk_datawindow_set_button(struct datawindow_priv *this_, GtkWidget *btn)
+{
+ this_->button = btn;
+}
+
+static gboolean
+keypress(GtkWidget *widget, GdkEventKey *event, struct datawindow_priv *win)
+{
+ if (event->type != GDK_KEY_PRESS)
+ return FALSE;
+ if (event->keyval == GDK_Cancel) {
+ gui_gtk_datawindow_delete(widget, (GdkEvent *)event, win);
+ gtk_widget_destroy(win->window);
+ }
+ return FALSE;
+}
+
+
+static struct datawindow_methods gui_gtk_datawindow_meth = {
+ gui_gtk_datawindow_destroy,
+ gui_gtk_datawindow_add,
+ gui_gtk_datawindow_mode,
+};
+
+struct datawindow_priv *
+gui_gtk_datawindow_new(struct gui_priv *gui, char *name, struct callback *click, struct callback *close, struct datawindow_methods *meth)
+{
+ struct datawindow_priv *win;
+
+ if (!gui)
+ return NULL;
+ *meth=gui_gtk_datawindow_meth;
+ win=g_new0(struct datawindow_priv, 1);
+ win->window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_default_size(GTK_WINDOW(win->window), 320, 200);
+ gtk_window_set_title(GTK_WINDOW(win->window), name);
+ gtk_window_set_wmclass (GTK_WINDOW (win->window), "navit", "Navit");
+
+ win->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (win->scrolled_window),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_container_add(GTK_CONTAINER(win->window), win->scrolled_window);
+ g_signal_connect(G_OBJECT(win->window), "key-press-event", G_CALLBACK(keypress), win);
+ win->treeview=NULL;
+ win->click=click;
+ win->close=close;
+ gtk_window_set_transient_for(GTK_WINDOW((GtkWidget *)(win->window)), GTK_WINDOW(gui->win));
+ g_signal_connect(G_OBJECT(win->window), "delete-event", G_CALLBACK(gui_gtk_datawindow_delete), win);
+ gtk_widget_show_all(win->window);
+
+ win->gui = gui;
+ gui->datawindow = win;
+ return win;
+}
+
diff --git a/gui/gtk/destination.c b/gui/gtk/destination.c
new file mode 100644
index 00000000..a9c5b2cd
--- /dev/null
+++ b/gui/gtk/destination.c
@@ -0,0 +1,539 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <gtk/gtk.h>
+#include "debug.h"
+#include "destination.h"
+#include "navit.h"
+#include "item.h"
+#include "coord.h"
+#include "track.h"
+#include "country.h"
+#include "search.h"
+#include "projection.h"
+#include "navit_nls.h"
+
+#define COL_COUNT 8
+
+static struct search_param {
+ struct navit *nav;
+ struct mapset *ms;
+ struct search_list *sl;
+ struct attr attr;
+ int partial;
+ GtkWidget *entry_country, *entry_postal, *entry_city, *entry_district;
+ GtkWidget *entry_street, *entry_number;
+ GtkWidget *listbox;
+ GtkWidget *treeview;
+ GtkListStore *liststore;
+ GtkTreeModel *liststore2;
+} search_param;
+
+static void button_map(GtkWidget *widget, struct search_param *search)
+{
+ GtkTreePath *path;
+ GtkTreeViewColumn *focus_column;
+ struct pcoord *c=NULL;
+ GtkTreeIter iter;
+
+ gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview), &path, &focus_column);
+ if(!path)
+ return;
+ if(!gtk_tree_model_get_iter(search->liststore2, &iter, path))
+ return;
+ gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), &iter, COL_COUNT, &c, -1);
+ if (c) {
+ navit_set_center(search->nav, c, 1);
+ }
+}
+
+static char *description(struct search_param *search, GtkTreeIter *iter)
+{
+ char *desc,*car,*postal,*town,*street;
+ char empty='\0';
+
+ gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), iter, 0, &car, -1);
+ gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), iter, 1, &postal, -1);
+ gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), iter, 2, &town, -1);
+ gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), iter, 4, &street, -1);
+
+ /* protect against nulls */
+ if (car==0) car=&empty;
+ if (postal==0) postal=&empty;
+ if (town==0) town=&empty;
+ if (street==0) street=&empty;
+
+ if (search->attr.type == attr_town_name)
+ desc=g_strdup_printf("%s-%s %s", car, postal, town);
+ else
+ desc=g_strdup_printf("%s-%s %s, %s", car, postal, town, street);
+ return desc;
+}
+
+static void button_destination(GtkWidget *widget, struct search_param *search)
+{
+ struct pcoord *c=NULL;
+ GtkTreeIter iter;
+ char *desc;
+
+ if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (search->liststore2), &iter))
+ return;
+ gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), &iter, COL_COUNT, &c, -1);
+ if (c) {
+ desc=description(search, &iter);
+ navit_set_destination(search->nav, c, desc, 1);
+ g_free(desc);
+ }
+}
+
+static void button_bookmark(GtkWidget *widget, struct search_param *search)
+{
+ struct pcoord *c=NULL;
+ GtkTreeIter iter;
+ char *desc;
+
+ if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (search->liststore2), &iter))
+ return;
+ gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), &iter, COL_COUNT, &c, -1);
+ if (c) {
+ desc=description(search, &iter);
+ navit_add_bookmark(search->nav, c, desc);
+ g_free(desc);
+ }
+}
+
+
+char **columns_text[] = {
+ (char *[]){_n("Car"),_n("Iso2"),_n("Iso3"),_n("Country"),NULL},
+ (char *[]){_n("Car"),_n("Postal"),_n("Town"),_n("District"),NULL},
+ (char *[]){_n("Car"),_n("Postal"),_n("Town"),_n("District"),_n("Street"),NULL},
+ (char *[]){_n("Car"),_n("Postal"),_n("Town"),_n("District"),_n("Street"),_n("Number"),NULL},
+};
+
+static void set_columns(struct search_param *param, int mode)
+{
+ GList *columns_list,*columns;
+ char **column_text=columns_text[mode];
+ int i=0;
+
+ columns_list=gtk_tree_view_get_columns(GTK_TREE_VIEW(param->treeview));
+ columns=columns_list;
+ while (columns) {
+ gtk_tree_view_remove_column(GTK_TREE_VIEW(param->treeview), columns->data);
+ columns=g_list_next(columns);
+ }
+ g_list_free(columns_list);
+ while (*column_text) {
+ GtkCellRenderer *cell=gtk_cell_renderer_text_new();
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (param->treeview),-1, gettext(*column_text), cell, "text", i, NULL);
+ i++;
+ column_text++;
+ }
+
+}
+
+static void row_activated(GtkWidget *widget, GtkTreePath *p1, GtkTreeViewColumn *c, struct search_param *search)
+{
+ GtkTreePath *path;
+ GtkTreeViewColumn *focus_column;
+ GtkTreeIter iter;
+ GtkWidget *entry_widget;
+ char *str;
+ int column;
+
+ dbg(0,"enter\n");
+ gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview), &path, &focus_column);
+ if(!path)
+ return;
+ if(!gtk_tree_model_get_iter(search->liststore2, &iter, path))
+ return;
+ switch(search->attr.type) {
+ case attr_country_all:
+ entry_widget=search->entry_country;
+ column=3;
+ break;
+ case attr_town_name:
+ entry_widget=search->entry_city;
+ column=2;
+ break;
+ case attr_street_name:
+ entry_widget=search->entry_street;
+ column=4;
+ break;
+ default:
+ dbg(0,"Unknown mode\n");
+ return;
+ }
+ gtk_tree_model_get(search->liststore2, &iter, column, &str, -1);
+ dbg(0,"str=%s\n", str);
+ search->partial=0;
+ gtk_entry_set_text(GTK_ENTRY(entry_widget), str);
+}
+
+static void tree_view_button_release(GtkWidget *widget, GdkEventButton *event, struct search_param *search)
+{
+ GtkTreePath *path;
+ GtkTreeViewColumn *column;
+ gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview), &path, &column);
+ gtk_tree_view_row_activated(GTK_TREE_VIEW(search->treeview), path, column);
+
+}
+static void
+next_focus(struct search_param *search, GtkWidget *widget)
+{
+ if (widget == search->entry_country)
+ gtk_widget_grab_focus(search->entry_city);
+ if (widget == search->entry_city)
+ gtk_widget_grab_focus(search->entry_street);
+ if (widget == search->entry_street)
+ gtk_widget_grab_focus(search->entry_number);
+
+}
+
+static void changed(GtkWidget *widget, struct search_param *search)
+{
+ struct search_list_result *res;
+ GtkTreeIter iter;
+
+ search->attr.u.str=(char *)gtk_entry_get_text(GTK_ENTRY(widget));
+ printf("changed %s partial %d\n", search->attr.u.str, search->partial);
+ if (widget == search->entry_country) {
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (search->liststore2), 3, GTK_SORT_ASCENDING);
+ dbg(0,"country\n");
+ search->attr.type=attr_country_all;
+ set_columns(search, 0);
+ }
+ if (widget == search->entry_postal) {
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (search->liststore2), 1, GTK_SORT_ASCENDING);
+ dbg(0,"postal\n");
+ search->attr.type=attr_town_postal;
+ if (strlen(search->attr.u.str) < 2)
+ return;
+ set_columns(search, 1);
+ }
+ if (widget == search->entry_city) {
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (search->liststore2), 2, GTK_SORT_ASCENDING);
+ dbg(0,"town\n");
+ search->attr.type=attr_town_name;
+ if (strlen(search->attr.u.str) < 3)
+ return;
+ set_columns(search, 1);
+ }
+ if (widget == search->entry_street) {
+ dbg(0,"street\n");
+ search->attr.type=attr_street_name;
+ set_columns(search, 2);
+ }
+
+
+ search_list_search(search->sl, &search->attr, search->partial);
+ gtk_list_store_clear(search->liststore);
+ while((res=search_list_get_result(search->sl))) {
+ gtk_list_store_append(search->liststore,&iter);
+ gtk_list_store_set(search->liststore,&iter,COL_COUNT,res->c,-1);
+ if (widget == search->entry_country) {
+ if (res->country) {
+ gtk_list_store_set(search->liststore,&iter,0,res->country->car,-1);
+ gtk_list_store_set(search->liststore,&iter,1,res->country->iso3,-1);
+ gtk_list_store_set(search->liststore,&iter,2,res->country->iso2,-1);
+ gtk_list_store_set(search->liststore,&iter,3,res->country->name,-1);
+ }
+ } else {
+ if (res->country)
+ gtk_list_store_set(search->liststore,&iter,0,res->country->car,-1);
+ else
+ gtk_list_store_set(search->liststore,&iter,0,"",-1);
+ if (res->town) {
+ gtk_list_store_set(search->liststore,&iter,1,res->town->common.postal,-1);
+ gtk_list_store_set(search->liststore,&iter,2,res->town->name,-1);
+ gtk_list_store_set(search->liststore,&iter,3,res->town->district,-1);
+ } else {
+ gtk_list_store_set(search->liststore,&iter,1,"",-1);
+ gtk_list_store_set(search->liststore,&iter,2,"",-1);
+ gtk_list_store_set(search->liststore,&iter,3,"",-1);
+ }
+ if (res->street)
+ gtk_list_store_set(search->liststore,&iter,4,res->street->name,-1);
+ else
+ gtk_list_store_set(search->liststore,&iter,4,"",-1);
+
+ }
+ }
+ if (! search->partial)
+ next_focus(search, widget);
+ search->partial=1;
+}
+
+/* borrowed from gpe-login */
+
+
+#define MAX_ARGS 8
+
+static void
+parse_xkbd_args (const char *cmd, char **argv)
+{
+ const char *p = cmd;
+ char buf[strlen (cmd) + 1], *bufp = buf;
+ int nargs = 0;
+ int escape = 0, squote = 0, dquote = 0;
+
+ while (*p)
+ {
+ if (escape)
+ {
+ *bufp++ = *p;
+ escape = 0;
+ }
+ else
+ {
+ switch (*p)
+ {
+ case '\\':
+ escape = 1;
+ break;
+ case '"':
+ if (squote)
+ *bufp++ = *p;
+ else
+ dquote = !dquote;
+ break;
+ case '\'':
+ if (dquote)
+ *bufp++ = *p;
+ else
+ squote = !squote;
+ break;
+ case ' ':
+ if (!squote && !dquote)
+ {
+ *bufp = 0;
+ if (nargs < MAX_ARGS)
+ argv[nargs++] = strdup (buf);
+ bufp = buf;
+ break;
+ }
+ default:
+ *bufp++ = *p;
+ break;
+ }
+ }
+ p++;
+ }
+
+ if (bufp != buf)
+ {
+ *bufp = 0;
+ if (nargs < MAX_ARGS)
+ argv[nargs++] = strdup (buf);
+ }
+ argv[nargs] = NULL;
+}
+
+int kbd_pid;
+
+static int
+spawn_xkbd (char *xkbd_path, char *xkbd_str)
+{
+#ifdef _WIN32 // AF FIXME for WIN32
+ #ifndef F_SETFD
+ #define F_SETFD 2
+ #endif
+#else
+ char *xkbd_args[MAX_ARGS + 1];
+ int fd[2];
+ char buf[256];
+ char c;
+ int a = 0;
+ size_t n;
+
+ pipe (fd);
+ kbd_pid = fork ();
+ if (kbd_pid == 0)
+ {
+ close (fd[0]);
+ if (dup2 (fd[1], 1) < 0)
+ perror ("dup2");
+ close (fd[1]);
+ if (fcntl (1, F_SETFD, 0))
+ perror ("fcntl");
+ xkbd_args[0] = (char *)xkbd_path;
+ xkbd_args[1] = "-xid";
+ if (xkbd_str)
+ parse_xkbd_args (xkbd_str, xkbd_args + 2);
+ else
+ xkbd_args[2] = NULL;
+ execvp (xkbd_path, xkbd_args);
+ perror (xkbd_path);
+ _exit (1);
+ }
+ close (fd[1]);
+ do {
+ n = read (fd[0], &c, 1);
+ if (n)
+ {
+ buf[a++] = c;
+ }
+ } while (n && (c != 10) && (a < (sizeof (buf) - 1)));
+
+ if (a)
+ {
+ buf[a] = 0;
+ return atoi (buf);
+ }
+#endif
+ return 0;
+}
+
+int destination_address(struct navit *nav)
+{
+
+ GtkWidget *window2, *keyboard, *vbox, *table;
+ GtkWidget *label_country;
+ GtkWidget *label_postal, *label_city, *label_district;
+ GtkWidget *label_street, *label_number;
+ GtkWidget *hseparator1,*hseparator2;
+ GtkWidget *button1,*button2,*button3;
+ int i;
+ struct search_param *search=&search_param;
+ struct attr search_attr, country_name, *country_attr;
+ struct tracking *tracking;
+ struct country_search *cs;
+ struct item *item;
+
+
+ search->nav=nav;
+ search->ms=navit_get_mapset(nav);
+ search->sl=search_list_new(search->ms);
+
+ window2 = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title(GTK_WINDOW(window2),_("Enter Destination"));
+ gtk_window_set_wmclass (GTK_WINDOW (window2), "navit", "Navit");
+ vbox = gtk_vbox_new(FALSE, 0);
+ table = gtk_table_new(3, 8, FALSE);
+
+ search->entry_country = gtk_entry_new();
+ label_country = gtk_label_new(_("Country"));
+ search->entry_postal = gtk_entry_new();
+ gtk_widget_set_sensitive(GTK_WIDGET(search->entry_postal), FALSE);
+ label_postal = gtk_label_new(_("Zip Code"));
+ search->entry_city = gtk_entry_new();
+ label_city = gtk_label_new(_("City"));
+ search->entry_district = gtk_entry_new();
+ gtk_widget_set_sensitive(GTK_WIDGET(search->entry_district), FALSE);
+ label_district = gtk_label_new(_("District/Township"));
+ hseparator1 = gtk_vseparator_new();
+ search->entry_street = gtk_entry_new();
+ label_street = gtk_label_new(_("Street"));
+ search->entry_number = gtk_entry_new();
+ label_number = gtk_label_new(_("Number"));
+ search->treeview=gtk_tree_view_new();
+ search->listbox = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (search->listbox),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
+ gtk_tree_view_set_model (GTK_TREE_VIEW (search->treeview), NULL);
+ gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(search->listbox),search->treeview);
+ {
+ GType types[COL_COUNT+1];
+ for(i=0;i<COL_COUNT;i++)
+ types[i]=G_TYPE_STRING;
+ types[i]=G_TYPE_POINTER;
+ search->liststore=gtk_list_store_newv(COL_COUNT+1,types);
+ search->liststore2=gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(search->liststore));
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (search->liststore2), 3, GTK_SORT_ASCENDING);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (search->treeview), GTK_TREE_MODEL(search->liststore2));
+ }
+
+
+
+
+ hseparator2 = gtk_vseparator_new();
+ button1 = gtk_button_new_with_label(_("Map"));
+ button2 = gtk_button_new_with_label(_("Bookmark"));
+ button3 = gtk_button_new_with_label(_("Destination"));
+
+ gtk_table_attach(GTK_TABLE(table), label_country, 0, 1, 0, 1, 0, GTK_FILL, 0, 0);
+ gtk_table_attach(GTK_TABLE(table), label_postal, 1, 2, 0, 1, 0, GTK_FILL, 0, 0);
+ gtk_table_attach(GTK_TABLE(table), label_city, 2, 3, 0, 1, 0, GTK_FILL, 0, 0);
+
+ gtk_table_attach(GTK_TABLE(table), search->entry_country, 0, 1, 1, 2, 0, GTK_FILL, 0, 0);
+ gtk_table_attach(GTK_TABLE(table), search->entry_postal, 1, 2, 1, 2, 0, GTK_FILL, 0, 0);
+ gtk_table_attach(GTK_TABLE(table), search->entry_city, 2, 3, 1, 2, 0, GTK_FILL, 0, 0);
+
+ gtk_table_attach(GTK_TABLE(table), label_district, 0, 1, 2, 3, 0, GTK_FILL, 0, 0);
+ gtk_table_attach(GTK_TABLE(table), label_street, 1, 2, 2, 3, 0, GTK_FILL, 0, 0);
+ gtk_table_attach(GTK_TABLE(table), label_number, 2, 3, 2, 3, 0, GTK_FILL, 0, 0);
+
+ gtk_table_attach(GTK_TABLE(table), search->entry_district, 0, 1, 3, 4, 0, GTK_FILL, 0, 0);
+ gtk_table_attach(GTK_TABLE(table), search->entry_street, 1, 2, 3, 4, 0, GTK_FILL, 0, 0);
+ gtk_table_attach(GTK_TABLE(table), search->entry_number, 2, 3, 3, 4, 0, GTK_FILL, 0, 0);
+
+ gtk_table_attach(GTK_TABLE(table), search->listbox, 0, 3, 4, 5, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0);
+
+ gtk_table_attach(GTK_TABLE(table), button1, 0, 1, 5, 6, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_table_attach(GTK_TABLE(table), button2, 1, 2, 5, 6, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_table_attach(GTK_TABLE(table), button3, 2, 3, 5, 6, GTK_FILL, GTK_FILL, 0, 0);
+
+ g_signal_connect(G_OBJECT(search->entry_country), "changed", G_CALLBACK(changed), search);
+ g_signal_connect(G_OBJECT(search->entry_postal), "changed", G_CALLBACK(changed), search);
+ g_signal_connect(G_OBJECT(search->entry_city), "changed", G_CALLBACK(changed), search);
+ g_signal_connect(G_OBJECT(search->entry_district), "changed", G_CALLBACK(changed), search);
+ g_signal_connect(G_OBJECT(search->entry_street), "changed", G_CALLBACK(changed), search);
+ g_signal_connect(G_OBJECT(search->entry_number), "changed", G_CALLBACK(changed), search);
+ g_signal_connect(G_OBJECT(button1), "clicked", G_CALLBACK(button_map), search);
+ g_signal_connect(G_OBJECT(button2), "clicked", G_CALLBACK(button_bookmark), search);
+ g_signal_connect(G_OBJECT(button3), "clicked", G_CALLBACK(button_destination), search);
+ g_signal_connect(G_OBJECT(search->treeview), "button-release-event", G_CALLBACK(tree_view_button_release), search);
+ g_signal_connect(G_OBJECT(search->treeview), "row_activated", G_CALLBACK(row_activated), search);
+
+ gtk_widget_grab_focus(search->entry_city);
+
+ gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0);
+ keyboard=gtk_socket_new();
+ gtk_box_pack_end(GTK_BOX(vbox), keyboard, FALSE, FALSE, 0);
+ gtk_container_add(GTK_CONTAINER(window2), vbox);
+#if 0
+ g_signal_connect(G_OBJECT(listbox), "select-row", G_CALLBACK(select_row), NULL);
+#endif
+ gtk_widget_show_all(window2);
+
+#ifndef _WIN32
+ gtk_socket_steal(GTK_SOCKET(keyboard), spawn_xkbd("xkbd","-geometry 200x100"));
+#endif
+
+ country_attr=country_default();
+ tracking=navit_get_tracking(nav);
+ if (tracking && tracking_get_attr(tracking, attr_country_id, &search_attr, NULL))
+ country_attr=&search_attr;
+ if (country_attr) {
+ cs=country_search_new(country_attr, 0);
+ item=country_search_get_item(cs);
+ if (item && item_attr_get(item, attr_country_name, &country_name))
+ gtk_entry_set_text(GTK_ENTRY(search->entry_country), country_name.u.str);
+ country_search_destroy(cs);
+ } else {
+ dbg(0,"warning: no default country found\n");
+ }
+ search->partial=1;
+ return 0;
+}
diff --git a/gui/gtk/gui_gtk.h b/gui/gtk/gui_gtk.h
new file mode 100644
index 00000000..6168b9ae
--- /dev/null
+++ b/gui/gtk/gui_gtk.h
@@ -0,0 +1,62 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "coord.h"
+
+struct menu_methods;
+struct datawindow_methods;
+struct navit;
+struct callback;
+struct statusbar_priv;
+
+struct gui_priv {
+ struct navit *nav;
+ GtkWidget *win;
+ GtkWidget *dialog_win;
+ GtkWidget *dialog_entry;
+ struct pcoord dialog_coord;
+ GtkWidget *vbox;
+ GtkWidget *menubar;
+ GtkActionGroup *base_group;
+ GtkActionGroup *debug_group;
+ GtkActionGroup *dyn_group;
+ GtkUIManager *ui_manager;
+ GSList *layout_group;
+ GSList *projection_group;
+ GSList *vehicle_group;
+ GList *dest_menuitems;
+ GList *bookmarks_menuitems;
+ GList *vehicle_menuitems;
+ GtkUIManager *menu_manager; // old
+ struct statusbar_priv *statusbar;
+ int menubar_enable;
+ int toolbar_enable;
+ int statusbar_enable;
+ int dyn_counter;
+ struct datawindow_priv *datawindow;
+};
+
+void gui_gtk_ui_init(struct gui_priv *this);
+struct menu_priv *gui_gtk_menubar_new(struct gui_priv *gui, struct menu_methods *meth);
+struct statusbar_priv *gui_gtk_statusbar_new(struct gui_priv *gui);
+struct menu_priv *gui_gtk_popup_new(struct gui_priv *gui, struct menu_methods *meth);
+struct datawindow_priv *gui_gtk_datawindow_new(struct gui_priv *gui, char *name, struct callback *click, struct callback *close, struct datawindow_methods *meth);
+void gui_gtk_datawindow_destroy(struct datawindow_priv *win);
+void gui_gtk_datawindow_set_button(struct datawindow_priv *this_, GtkWidget *btn);
+
diff --git a/gui/gtk/gui_gtk_action.c b/gui/gtk/gui_gtk_action.c
new file mode 100644
index 00000000..144a8270
--- /dev/null
+++ b/gui/gtk/gui_gtk_action.c
@@ -0,0 +1,627 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <string.h>
+#include <gtk/gtk.h>
+#include "navit.h"
+#include "gui_gtk.h"
+#include "menu.h"
+#include "coord.h"
+#include "item.h"
+#include "attr.h"
+#include "callback.h"
+#include "debug.h"
+#include "destination.h"
+
+#define gettext_noop(String) String
+#define _(STRING) gettext(STRING)
+#define _n(STRING) gettext_noop(STRING)
+
+struct menu_priv {
+ char *path;
+ GtkAction *action;
+ struct gui_priv *gui;
+ enum menu_type type;
+ struct callback *cb;
+ struct menu_priv *child;
+ struct menu_priv *sibling;
+ gulong handler_id;
+ guint merge_id;
+ GtkWidget *widget;
+};
+
+/* Create callbacks that implement our Actions */
+
+static void
+zoom_in_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
+{
+ navit_zoom_in(gui->nav, 2, NULL);
+}
+
+static void
+zoom_out_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
+{
+ navit_zoom_out(gui->nav, 2, NULL);
+}
+
+static void
+refresh_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
+{
+ navit_draw(gui->nav);
+}
+
+// Forward declarations, these should not be visible outside the GUI, so
+// they are not in the header files, but here
+void gui_gtk_datawindow_set_button(struct datawindow_priv *this_, GtkWidget *btn);
+void gui_gtk_datawindow_destroy(struct datawindow_priv *win);
+
+static void
+roadbook_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
+{
+
+ if (! gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w))) {
+ gui_gtk_datawindow_destroy(gui->datawindow);
+ } else {
+ navit_window_roadbook_new(gui->nav);
+ if (gui->datawindow) {
+ gui_gtk_datawindow_set_button(gui->datawindow, w);
+ }
+ }
+}
+
+static void
+autozoom_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
+{
+ struct attr autozoom_attr;
+
+ autozoom_attr.type = attr_autozoom_active;
+ if (! gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w))) {
+ autozoom_attr.u.num = 0;
+ } else {
+ autozoom_attr.u.num = 1;
+ }
+
+ navit_set_attr(gui->nav, &autozoom_attr);
+}
+
+static void
+cursor_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
+{
+ struct attr attr;
+
+ attr.type=attr_cursor;
+ attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
+ if(!navit_set_attr(gui->nav, &attr)) {
+ dbg(0, "Failed to set attr_cursor\n");
+ }
+}
+
+static void
+tracking_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
+{
+ struct attr attr;
+
+ attr.type=attr_tracking;
+ attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
+ if(!navit_set_attr(gui->nav, &attr)) {
+ dbg(0, "Failed to set attr_tracking\n");
+ }
+}
+
+static void
+orient_north_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
+{
+ struct attr attr;
+
+ attr.type=attr_orientation;
+ attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w)) ? 0:-1;
+ if(!navit_set_attr(gui->nav, &attr)) {
+ dbg(0, "Failed to set attr_orientation\n");
+ }
+}
+
+static void
+window_fullscreen_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
+{
+ if(gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w)))
+ gtk_window_fullscreen(GTK_WINDOW(gui->win));
+ else
+ gtk_window_unfullscreen(GTK_WINDOW(gui->win));
+}
+
+#include <stdlib.h>
+#include "point.h"
+#include "transform.h"
+
+static void
+info_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
+{
+ char buffer[512];
+ int mw,mh;
+ struct coord lt, rb;
+ struct point p;
+ struct transformation *t;
+
+ t=navit_get_trans(gui->nav);
+ transform_get_size(t, &mw, &mh);
+ p.x=0;
+ p.y=0;
+ transform_reverse(t, &p, &lt);
+ p.x=mw;
+ p.y=mh;
+ transform_reverse(t, &p, &rb);
+
+ sprintf(buffer,"./info.sh %d,%d 0x%x,0x%x 0x%x,0x%x", mw, mh, lt.x, lt.y, rb.x, rb.y);
+ system(buffer);
+
+}
+
+
+static void
+route_clear_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
+{
+ navit_set_destination(gui->nav, NULL, NULL, 0);
+}
+
+static void
+destination_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
+{
+ destination_address(gui->nav);
+}
+
+static void
+quit_action (GtkWidget *w, struct gui_priv *gui, void *dummy)
+{
+ navit_destroy(gui->nav);
+}
+
+static GtkActionEntry entries[] =
+{
+ { "DisplayMenuAction", NULL, _n("Display") },
+ { "RouteMenuAction", NULL, _n("Route") },
+ { "FormerDestinationMenuAction", NULL, _n("Former Destinations") },
+ { "BookmarkMenuAction", NULL, _n("Bookmarks") },
+ { "MapMenuAction", NULL, _n("Map") },
+ { "LayoutMenuAction", NULL, _n("Layout") },
+ { "ProjectionMenuAction", NULL, _n("Projection") },
+ { "VehicleMenuAction", NULL, _n("Vehicle") },
+ { "ZoomOutAction", GTK_STOCK_ZOOM_OUT, _n("ZoomOut"), NULL, NULL, G_CALLBACK(zoom_out_action) },
+ { "ZoomInAction", GTK_STOCK_ZOOM_IN, _n("ZoomIn"), NULL, NULL, G_CALLBACK(zoom_in_action) },
+ { "RefreshAction", GTK_STOCK_REFRESH, _n("Recalculate"), NULL, NULL, G_CALLBACK(refresh_action) },
+#ifdef GTK_STOCK_INFO
+ { "InfoAction", GTK_STOCK_INFO, _n("Info"), NULL, NULL, G_CALLBACK(info_action) },
+#else
+ { "InfoAction", NULL, _n("Info"), NULL, NULL, G_CALLBACK(info_action) },
+#endif /*GTK_STOCK_INFO*/
+ { "DestinationAction", "flag_icon", _n("Destination"), NULL, NULL, G_CALLBACK(destination_action) },
+ { "RouteClearAction", NULL, _n("Stop Navigation"), NULL, NULL, G_CALLBACK(route_clear_action) },
+ { "Test", NULL, _n("Test"), NULL, NULL, G_CALLBACK(destination_action) },
+ { "QuitAction", GTK_STOCK_QUIT, _n("_Quit"), "<control>Q",NULL, G_CALLBACK (quit_action) }
+};
+
+static guint n_entries = G_N_ELEMENTS (entries);
+
+static GtkToggleActionEntry toggleentries[] =
+{
+ { "CursorAction", "cursor_icon",_n("Cursor"), NULL, NULL, G_CALLBACK(cursor_action),TRUE },
+ { "TrackingAction", NULL ,_n("Lock on Road"), NULL, NULL, G_CALLBACK(tracking_action),TRUE },
+ { "OrientationAction", "orientation_icon", _n("Northing"), NULL, NULL, G_CALLBACK(orient_north_action),FALSE },
+ { "RoadbookAction", GTK_STOCK_JUSTIFY_FILL, _n("Roadbook"), NULL, NULL, G_CALLBACK(roadbook_action), FALSE },
+ { "AutozoomAction", GTK_STOCK_ZOOM_FIT, _n("Autozoom"), NULL, NULL, G_CALLBACK(autozoom_action), FALSE },
+#ifdef GTK_STOCK_FULLSCREEN
+ { "FullscreenAction",GTK_STOCK_FULLSCREEN, _n("Fullscreen"), NULL, NULL, G_CALLBACK(window_fullscreen_action), FALSE }
+#else
+ { "FullscreenAction", NULL, _n("Fullscreen"), NULL, NULL, G_CALLBACK(window_fullscreen_action), FALSE }
+#endif /*GTK_STOCK_FULLSCREEN*/
+};
+
+static guint n_toggleentries = G_N_ELEMENTS (toggleentries);
+
+static GtkActionEntry debug_entries[] =
+{
+ { "DataMenuAction", NULL, _n("Data") },
+};
+
+static guint n_debug_entries = G_N_ELEMENTS (debug_entries);
+
+
+static const char * cursor_xpm[] = {
+"22 22 2 1",
+" c None",
+". c #0000FF",
+" ",
+" ",
+" ",
+" .. ",
+" .. .. ",
+" .. .. ",
+" . . ",
+" . . ",
+" . ... . ",
+" . ... . . ",
+" . ... . . ",
+" . .. . . ",
+" . . . ",
+" . . . ",
+" . . . ",
+" . . . ",
+" .. .. ",
+" .. .. ",
+" .. ",
+" ",
+" ",
+" "};
+
+
+static const char * north_xpm[] = {
+"22 22 2 1",
+" c None",
+". c #000000",
+" ",
+" ",
+" . ",
+" ... ",
+" . . . ",
+" . . . ",
+" . ",
+" .... . .... ",
+" .... . .... ",
+" .... . .. ",
+" .. .. .. ",
+" .. .. .. ",
+" .. .. .. ",
+" .. .. .. ",
+" .. . .... ",
+" .... . .... ",
+" .... . .... ",
+" . ",
+" . ",
+" . ",
+" ",
+" "};
+
+
+static const char * flag_xpm[] = {
+"22 22 2 1",
+" c None",
+"+ c #000000",
+"+++++++ ",
+"+ +++++++++ ",
+"+ +++ +++++++++ ",
+"+ +++ +++ +++ ",
+"++++ +++ +++ ",
+"++++ +++ +++ ",
+"++++ +++ +++ + ",
+"+ ++++++ +++ + ",
+"+ +++ ++++++ + ",
+"+ +++ +++ +++ ",
+"++++ +++ +++ ",
+"++++ +++ +++ ",
+"++++++++++ +++ + ",
+"+ +++++++++ + ",
+"+ ++++++ ",
+"+ ",
+"+ ",
+"+ ",
+"+ ",
+"+ ",
+"+ ",
+"+ "};
+
+
+
+static struct {
+ gchar *stockid;
+ const char **icon_xpm;
+} stock_icons[] = {
+ {"cursor_icon", cursor_xpm },
+ {"orientation_icon", north_xpm },
+ {"flag_icon", flag_xpm }
+};
+
+
+static gint n_stock_icons = G_N_ELEMENTS (stock_icons);
+
+
+static void
+register_my_stock_icons (void)
+{
+ GtkIconFactory *icon_factory;
+ GtkIconSet *icon_set;
+ GdkPixbuf *pixbuf;
+ gint i;
+
+ icon_factory = gtk_icon_factory_new ();
+
+ for (i = 0; i < n_stock_icons; i++)
+ {
+ pixbuf = gdk_pixbuf_new_from_xpm_data(stock_icons[i].icon_xpm);
+ icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
+ g_object_unref(pixbuf);
+ gtk_icon_factory_add (icon_factory, stock_icons[i].stockid, icon_set);
+ gtk_icon_set_unref (icon_set);
+ }
+
+ gtk_icon_factory_add_default(icon_factory);
+
+ g_object_unref(icon_factory);
+}
+
+
+static char layout[] =
+ "<ui>\
+ <menubar name=\"MenuBar\">\
+ <menu name=\"Display\" action=\"DisplayMenuAction\">\
+ <menuitem name=\"Zoom in\" action=\"ZoomInAction\" />\
+ <menuitem name=\"Zoom out\" action=\"ZoomOutAction\" />\
+ <menuitem name=\"Cursor\" action=\"CursorAction\"/>\
+ <menuitem name=\"Tracking\" action=\"TrackingAction\"/>\
+ <menuitem name=\"Orientation\" action=\"OrientationAction\"/>\
+ <menuitem name=\"Roadbook\" action=\"RoadbookAction\"/>\
+ <menuitem name=\"Autozoom\" action=\"AutozoomAction\"/>\
+ <menuitem name=\"Fullscreen\" action=\"FullscreenAction\"/>\
+ <menuitem name=\"Quit\" action=\"QuitAction\" />\
+ <placeholder name=\"RouteMenuAdditions\" />\
+ </menu>\
+ <menu name=\"Data\" action=\"DataMenuAction\">\
+ <placeholder name=\"DataMenuAdditions\" />\
+ </menu>\
+ <menu name=\"Route\" action=\"RouteMenuAction\">\
+ <menuitem name=\"Refresh\" action=\"RefreshAction\" />\
+ <menuitem name=\"Destination\" action=\"DestinationAction\" />\
+ <menuitem name=\"Clear\" action=\"RouteClearAction\" />\
+ <menu name=\"FormerDestinations\" action=\"FormerDestinationMenuAction\">\
+ <placeholder name=\"FormerDestinationMenuAdditions\" />\
+ </menu>\
+ <menu name=\"Bookmarks\" action=\"BookmarkMenuAction\">\
+ <placeholder name=\"BookmarkMenuAdditions\" />\
+ </menu>\
+ <placeholder name=\"RouteMenuAdditions\" />\
+ </menu>\
+ <menu name=\"Map\" action=\"MapMenuAction\">\
+ <menu name=\"Layout\" action=\"LayoutMenuAction\">\
+ <placeholder name=\"LayoutMenuAdditions\" />\
+ </menu>\
+ <menu name=\"Projection\" action=\"ProjectionMenuAction\">\
+ <placeholder name=\"ProjectionMenuAdditions\" />\
+ </menu>\
+ <menu name=\"Vehicle\" action=\"VehicleMenuAction\">\
+ <placeholder name=\"VehicleMenuAdditions\" />\
+ </menu>\
+ <placeholder name=\"MapMenuAdditions\" />\
+ </menu>\
+ </menubar>\
+ <toolbar name=\"ToolBar\" action=\"BaseToolbar\" action=\"BaseToolbarAction\">\
+ <placeholder name=\"ToolItems\">\
+ <separator/>\
+ <toolitem name=\"Zoom in\" action=\"ZoomInAction\"/>\
+ <toolitem name=\"Zoom out\" action=\"ZoomOutAction\"/>\
+ <toolitem name=\"Refresh\" action=\"RefreshAction\"/>\
+ <toolitem name=\"Cursor\" action=\"CursorAction\"/>\
+ <toolitem name=\"Orientation\" action=\"OrientationAction\"/>\
+ <toolitem name=\"Destination\" action=\"DestinationAction\"/>\
+ <!-- <toolitem name=\"Info\" action=\"InfoAction\"/> -->\
+ <toolitem name=\"Roadbook\" action=\"RoadbookAction\"/>\
+ <toolitem name=\"Autozoom\" action=\"AutozoomAction\"/>\
+ <toolitem name=\"Quit\" action=\"QuitAction\"/>\
+ <separator/>\
+ </placeholder>\
+ </toolbar>\
+ <popup name=\"PopUp\">\
+ </popup>\
+ </ui>";
+
+
+static void
+activate(void *dummy, struct menu_priv *menu)
+{
+ if (menu->cb)
+ callback_call_0(menu->cb);
+}
+
+static struct menu_methods menu_methods;
+
+static struct menu_priv *
+add_menu(struct menu_priv *menu, struct menu_methods *meth, char *name, enum menu_type type, struct callback *cb)
+{
+ struct menu_priv *ret;
+ char *dynname;
+
+ ret=g_new0(struct menu_priv, 1);
+ *meth=menu_methods;
+ if (! strcmp(menu->path, "/ui/MenuBar") && !strcmp(name,"Route")) {
+ dynname=g_strdup("Route");
+ } else if (! strcmp(menu->path, "/ui/MenuBar") && !strcmp(name,"Data")) {
+ dynname=g_strdup("Data");
+ } else {
+ dynname=g_strdup_printf("%d", menu->gui->dyn_counter++);
+ if (type == menu_type_toggle)
+ ret->action=GTK_ACTION(gtk_toggle_action_new(dynname, name, NULL, NULL));
+ else
+ ret->action=gtk_action_new(dynname, name, NULL, NULL);
+ if (cb)
+ ret->handler_id=g_signal_connect(ret->action, "activate", G_CALLBACK(activate), ret);
+ gtk_action_group_add_action(menu->gui->dyn_group, ret->action);
+ ret->merge_id=gtk_ui_manager_new_merge_id(menu->gui->ui_manager);
+ gtk_ui_manager_add_ui( menu->gui->ui_manager, ret->merge_id, menu->path, dynname, dynname, type == menu_type_submenu ? GTK_UI_MANAGER_MENU : GTK_UI_MANAGER_MENUITEM, FALSE);
+ }
+ ret->gui=menu->gui;
+ ret->path=g_strdup_printf("%s/%s", menu->path, dynname);
+ ret->type=type;
+ ret->cb=cb;
+ ret->sibling=menu->child;
+ menu->child=ret;
+ g_free(dynname);
+ return ret;
+
+}
+
+static void
+remove_menu(struct menu_priv *item, int recursive)
+{
+
+ if (recursive) {
+ struct menu_priv *next,*child=item->child;
+ while (child) {
+ next=child->sibling;
+ remove_menu(child, recursive);
+ child=next;
+ }
+ }
+ if (item->action) {
+ gtk_ui_manager_remove_ui(item->gui->ui_manager, item->merge_id);
+ gtk_action_group_remove_action(item->gui->dyn_group, item->action);
+#if 0
+ if (item->callback)
+ g_signal_handler_disconnect(item->action, item->handler_id);
+#endif
+ g_object_unref(item->action);
+ }
+ g_free(item->path);
+ g_free(item);
+}
+
+static void
+set_toggle(struct menu_priv *menu, int active)
+{
+ gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(menu->action), active);
+}
+
+static int
+get_toggle(struct menu_priv *menu)
+{
+ return gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(menu->action));
+}
+
+static struct menu_methods menu_methods = {
+#if 1
+ add_menu,
+ set_toggle,
+ get_toggle,
+#else
+ NULL,
+ NULL,
+ NULL
+#endif
+};
+
+
+static void
+popup_deactivate(GtkWidget *widget, struct menu_priv *menu)
+{
+ g_signal_handler_disconnect(widget, menu->handler_id);
+ remove_menu(menu, 1);
+}
+
+static void
+popup_activate(struct menu_priv *menu)
+{
+#ifdef _WIN32
+ menu->widget=gtk_ui_manager_get_widget(menu->gui->ui_manager, menu->path );
+#endif
+ gtk_menu_popup(GTK_MENU(menu->widget), NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time ());
+ menu->handler_id=g_signal_connect(menu->widget, "selection-done", G_CALLBACK(popup_deactivate), menu);
+}
+
+void
+gui_gtk_ui_init(struct gui_priv *this)
+{
+ GError *error = NULL;
+ struct attr attr;
+ GtkToggleAction *toggle_action;
+
+ this->base_group = gtk_action_group_new ("BaseActions");
+ this->debug_group = gtk_action_group_new ("DebugActions");
+ this->dyn_group = gtk_action_group_new ("DynamicActions");
+ register_my_stock_icons();
+ this->ui_manager = gtk_ui_manager_new ();
+ gtk_action_group_set_translation_domain(this->base_group,"navit");
+ gtk_action_group_set_translation_domain(this->debug_group,"navit");
+ gtk_action_group_set_translation_domain(this->dyn_group,"navit");
+ gtk_action_group_add_actions (this->base_group, entries, n_entries, this);
+ gtk_action_group_add_toggle_actions (this->base_group, toggleentries, n_toggleentries, this);
+ gtk_ui_manager_insert_action_group (this->ui_manager, this->base_group, 0);
+ gtk_action_group_add_actions (this->debug_group, debug_entries, n_debug_entries, this);
+ gtk_ui_manager_insert_action_group (this->ui_manager, this->debug_group, 0);
+ gtk_ui_manager_add_ui_from_string (this->ui_manager, layout, strlen(layout), &error);
+ gtk_ui_manager_insert_action_group (this->ui_manager, this->dyn_group, 0);
+ if (error) {
+ g_message ("building menus failed: %s", error->message);
+ g_error_free (error);
+ }
+ if (navit_get_attr(this->nav, attr_cursor, &attr, NULL)) {
+ toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "CursorAction"));
+ gtk_toggle_action_set_active(toggle_action, attr.u.num);
+ }
+ if (navit_get_attr(this->nav, attr_orientation, &attr, NULL)) {
+ toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "OrientationAction"));
+ gtk_toggle_action_set_active(toggle_action, attr.u.num != -1);
+ }
+ if (navit_get_attr(this->nav, attr_tracking, &attr, NULL)) {
+ toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "TrackingAction"));
+ gtk_toggle_action_set_active(toggle_action, attr.u.num);
+ }
+ toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "RoadbookAction"));
+ gtk_toggle_action_set_active(toggle_action, 0);
+
+ if (navit_get_attr(this->nav, attr_autozoom_active, &attr, NULL)) {
+ toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "AutozoomAction"));
+ gtk_toggle_action_set_active(toggle_action, attr.u.num);
+ }
+
+}
+
+static struct menu_priv *
+gui_gtk_ui_new (struct gui_priv *this, struct menu_methods *meth, char *path, int popup, GtkWidget **widget_ret)
+{
+ struct menu_priv *ret;
+ GtkWidget *widget;
+
+ *meth=menu_methods;
+ ret=g_new0(struct menu_priv, 1);
+ ret->path=g_strdup(path);
+ ret->gui=this;
+
+ widget=gtk_ui_manager_get_widget(this->ui_manager, path);
+ GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS);
+ if (widget_ret)
+ *widget_ret=widget;
+ if (! popup) {
+ gtk_box_pack_start (GTK_BOX(this->vbox), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+ } else {
+ ret->widget=widget;
+ meth->popup=popup_activate;
+ }
+ return ret;
+}
+
+#if 0
+struct menu_priv *
+gui_gtk_menubar_new(struct gui_priv *this, struct menu_methods *meth)
+{
+ return gui_gtk_ui_new(this, meth, "/ui/MenuBar", 0, &this->menubar);
+}
+#endif
+
+struct menu_priv *
+gui_gtk_popup_new(struct gui_priv *this, struct menu_methods *meth)
+{
+ return gui_gtk_ui_new(this, meth, "/ui/PopUp", 1, NULL);
+}
diff --git a/gui/gtk/gui_gtk_statusbar.c b/gui/gtk/gui_gtk_statusbar.c
new file mode 100644
index 00000000..f31cf078
--- /dev/null
+++ b/gui/gtk/gui_gtk_statusbar.c
@@ -0,0 +1,178 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <math.h>
+#include <gtk/gtk.h>
+#include "item.h"
+#include "coord.h"
+#include "debug.h"
+#include "vehicle.h"
+#include "callback.h"
+#include "route.h"
+#include "transform.h"
+#include "navit.h"
+#include "map.h"
+#include "navigation.h"
+#include "gui_gtk.h"
+#include "navit_nls.h"
+
+struct statusbar_priv {
+ struct gui_priv *gui;
+ GtkWidget *hbox;
+ char gps_text[128];
+ GtkWidget *gps;
+ char route_text[128];
+ GtkWidget *route;
+ struct callback *vehicle_cb;
+};
+
+#if 0
+static void
+statusbar_destroy(struct statusbar_priv *this)
+{
+ g_free(this);
+}
+
+static void
+statusbar_gps_update(struct statusbar_priv *this, int sats, int qual, double lng, double lat, double height, double direction, double speed)
+{
+ char *dirs[]={_("N"),_("NE"),_("E"),_("SE"),_("S"),_("SW"),_("W"),_("NW"),_("N")};
+ char *dir;
+ int dir_idx;
+ char pos_text[26];
+
+ coord_format(lat,lng,DEGREES_MINUTES_SECONDS,pos_text,sizeof(pos_text));
+ dir=dirs[dir_idx];
+ sprintf(this->gps_text, "GPS %02d/%02d %s %4.0fm %3.0f°%-2s %3.0fkm/h", sats, qual, pos_text, height, direction, dir, speed);
+ gtk_label_set_text(GTK_LABEL(this->gps), this->gps_text);
+
+}
+#endif
+
+static char *status_fix2str(int type)
+{
+ switch(type) {
+ case 0: return _("No");
+ case 1: return _("2D");
+ case 3: return _("3D");
+ default:
+ return _("OT");
+ }
+}
+
+static void
+statusbar_route_update(struct statusbar_priv *this, struct navit *navit, struct vehicle *v)
+{
+ struct navigation *nav=NULL;
+ struct map *map=NULL;
+ struct map_rect *mr=NULL;
+ struct item *item=NULL;
+ struct attr attr;
+ double route_len=0;
+ time_t eta;
+ struct tm *eta_tm=NULL;
+ char buffer[128];
+ double lng, lat, direction=0, height=0, speed=0, hdop=0;
+ int sats=0, qual=0;
+ int status=0;
+ char *dirs[]={_("N"),_("NE"),_("E"),_("SE"),_("S"),_("SW"),_("W"),_("NW"),_("N")};
+ char *dir;
+ int dir_idx;
+
+ if (navit)
+ nav=navit_get_navigation(navit);
+ if (nav)
+ map=navigation_get_map(nav);
+ if (map)
+ mr=map_rect_new(map, NULL);
+ if (mr)
+ item=map_rect_get_item(mr);
+ if (item) {
+ if (item_attr_get(item, attr_destination_length, &attr))
+ route_len=attr.u.num;
+ if (item_attr_get(item, attr_destination_time, &attr)) {
+ eta=time(NULL)+attr.u.num/10;
+ eta_tm=localtime(&eta);
+ }
+ }
+ if (mr)
+ map_rect_destroy(mr);
+ sprintf(buffer,_("Route %4.0fkm %02d:%02d ETA" ),route_len/1000, eta_tm ? eta_tm->tm_hour : 0 , eta_tm ? eta_tm->tm_min : 0);
+ if (strcmp(buffer, this->route_text)) {
+ strcpy(this->route_text, buffer);
+ gtk_label_set_text(GTK_LABEL(this->route), this->route_text);
+ }
+ if (!vehicle_get_attr(v, attr_position_coord_geo, &attr, NULL))
+ return;
+ lng=attr.u.coord_geo->lng;
+ lat=attr.u.coord_geo->lat;
+ if (vehicle_get_attr(v, attr_position_fix_type, &attr, NULL))
+ status=attr.u.num;
+ if (vehicle_get_attr(v, attr_position_direction, &attr, NULL))
+ direction=*(attr.u.numd);
+ direction=fmod(direction,360);
+ if (direction < 0)
+ direction+=360;
+ dir_idx=(direction+22.5)/45;
+ dir=dirs[dir_idx];
+ if (vehicle_get_attr(v, attr_position_height, &attr, NULL))
+ height=*(attr.u.numd);
+ if (vehicle_get_attr(v, attr_position_hdop, &attr, NULL))
+ hdop=*(attr.u.numd);
+ if (vehicle_get_attr(v, attr_position_speed, &attr, NULL))
+ speed=*(attr.u.numd);
+ if (vehicle_get_attr(v, attr_position_sats_used, &attr, NULL))
+ sats=attr.u.num;
+ if (vehicle_get_attr(v, attr_position_qual, &attr, NULL))
+ qual=attr.u.num;
+ coord_format(lat,lng,DEGREES_MINUTES_SECONDS,buffer,sizeof(buffer));
+ sprintf(this->gps_text,"GPS:%s %02d/%02d HD:%02.2f %s %4.0fm %3.0f°%-2s %3.0fkm/h",
+ status_fix2str(status),
+ sats, qual, hdop, buffer, height,
+ direction, dir, speed);
+ gtk_label_set_text(GTK_LABEL(this->gps), this->gps_text);
+}
+
+struct statusbar_priv *
+gui_gtk_statusbar_new(struct gui_priv *gui)
+{
+ struct statusbar_priv *this=g_new0(struct statusbar_priv, 1);
+
+ this->gui=gui;
+ this->hbox=gtk_hbox_new(FALSE, 1);
+ this->gps=gtk_label_new( "GPS 00/0 0000.0000N 00000.0000E 0000m 000°NO 000km/h" );
+ gtk_label_set_justify(GTK_LABEL(this->gps), GTK_JUSTIFY_LEFT);
+ this->route=gtk_label_new( _( "Route 0000km 0+00:00 ETA" ) );
+ gtk_label_set_justify(GTK_LABEL(this->route), GTK_JUSTIFY_LEFT);
+ gtk_box_pack_start(GTK_BOX(this->hbox), this->gps, TRUE, TRUE, 2);
+ gtk_box_pack_start(GTK_BOX(this->hbox), gtk_vseparator_new(), TRUE, TRUE, 2);
+ gtk_box_pack_start(GTK_BOX(this->hbox), this->route, TRUE, TRUE, 2);
+ GTK_WIDGET_UNSET_FLAGS (this->hbox, GTK_CAN_FOCUS);
+
+ gtk_box_pack_end(GTK_BOX(gui->vbox), this->hbox, FALSE, FALSE, 0);
+ gtk_widget_show_all(this->hbox);
+ /* add a callback for position updates */
+ this->vehicle_cb=callback_new_attr_1(callback_cast(statusbar_route_update), attr_position_coord_geo, this);
+ navit_add_callback(gui->nav, this->vehicle_cb);
+ return this;
+}
+
diff --git a/gui/gtk/gui_gtk_window.c b/gui/gtk/gui_gtk_window.c
new file mode 100644
index 00000000..a95b8e1b
--- /dev/null
+++ b/gui/gtk/gui_gtk_window.c
@@ -0,0 +1,771 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <math.h>
+#include <gdk/gdkkeysyms.h>
+#if !defined(GDK_Book) || !defined(GDK_Calendar)
+#include <X11/XF86keysym.h>
+#endif
+#include <gtk/gtk.h>
+#include "config.h"
+#include "item.h"
+#include "navit.h"
+#include "debug.h"
+#include "gui.h"
+#include "coord.h"
+#include "point.h"
+#include "plugin.h"
+#include "graphics.h"
+#include "gui_gtk.h"
+#include "transform.h"
+#include "config.h"
+#include "callback.h"
+#include "layout.h"
+#include "vehicle.h"
+#include "map.h"
+#include "coord.h"
+#include "event.h"
+#include "navit_nls.h"
+
+#ifdef USE_HILDON
+#include "hildon/hildon-defines.h"
+#define KEY_ZOOM_IN HILDON_HARDKEY_INCREASE
+#define KEY_ZOOM_OUT HILDON_HARDKEY_DECREASE
+#define KEY_UP HILDON_HARDKEY_UP
+#define KEY_DOWN HILDON_HARDKEY_DOWN
+#define KEY_LEFT HILDON_HARDKEY_LEFT
+#define KEY_RIGHT HILDON_HARDKEY_RIGHT
+#else
+#ifndef GDK_Book
+#define GDK_Book XF86XK_Book
+#endif
+#ifndef GDK_Calendar
+#define GDK_Calendar XF86XK_Calendar
+#endif
+#define KEY_ZOOM_IN GDK_Book
+#define KEY_ZOOM_OUT GDK_Calendar
+#define KEY_UP GDK_Up
+#define KEY_DOWN GDK_Down
+#define KEY_LEFT GDK_Left
+#define KEY_RIGHT GDK_Right
+#endif
+
+static gboolean
+keypress(GtkWidget *widget, GdkEventKey *event, struct gui_priv *this)
+{
+ int w,h;
+ struct transformation *t;
+ #ifdef USE_HILDON
+ GtkToggleAction *action;
+ gboolean *fullscreen;
+ #endif /*HILDON*/
+ struct point p;
+ if (event->type != GDK_KEY_PRESS)
+ return FALSE;
+ dbg(1,"keypress 0x%x\n", event->keyval);
+ transform_get_size(navit_get_trans(this->nav), &w, &h);
+ switch (event->keyval) {
+ case GDK_KP_Enter:
+ gtk_menu_shell_select_first(GTK_MENU_SHELL(this->menubar), TRUE);
+ break;
+ case KEY_UP:
+ p.x=w/2;
+ p.y=0;
+ navit_set_center_screen(this->nav, &p, 1);
+ break;
+ case KEY_DOWN:
+ p.x=w/2;
+ p.y=h;
+ navit_set_center_screen(this->nav, &p, 1);
+ break;
+ case KEY_LEFT:
+ p.x=0;
+ p.y=h/2;
+ navit_set_center_screen(this->nav, &p, 1);
+ break;
+ case KEY_RIGHT:
+ p.x=w;
+ p.y=h/2;
+ navit_set_center_screen(this->nav, &p, 1);
+ break;
+ case KEY_ZOOM_IN:
+ navit_zoom_in(this->nav, 2, NULL);
+ break;
+ case KEY_ZOOM_OUT:
+ navit_zoom_out(this->nav, 2, NULL);
+ break;
+ case 'a':
+ t=navit_get_trans(this->nav);
+ transform_set_yaw(t, (transform_get_yaw(t)+15)%360);
+ navit_draw(this->nav);
+ break;
+ case 'd':
+ t=navit_get_trans(this->nav);
+ transform_set_yaw(t, (transform_get_yaw(t)-15)%360);
+ navit_draw(this->nav);
+ break;
+ case 'w':
+ t=navit_get_trans(this->nav);
+ transform_set_pitch(t, (transform_get_pitch(t)+5)%360);
+ navit_draw(this->nav);
+ break;
+ case 'x':
+ t=navit_get_trans(this->nav);
+ transform_set_pitch(t, (transform_get_pitch(t)-5)%360);
+ navit_draw(this->nav);
+ break;
+ case 'r':
+ t=navit_get_trans(this->nav);
+ transform_set_distance(t, (transform_get_distance(t)-5));
+ navit_draw(this->nav);
+ break;
+ case 'f':
+ t=navit_get_trans(this->nav);
+ transform_set_distance(t, (transform_get_distance(t)+5));
+ navit_draw(this->nav);
+ break;
+ case 'z':
+ t=navit_get_trans(this->nav);
+ transform_set_hog(t, (transform_get_hog(t)+1));
+ navit_draw(this->nav);
+ break;
+ case 'h':
+ t=navit_get_trans(this->nav);
+ transform_set_hog(t, (transform_get_hog(t)-1));
+ navit_draw(this->nav);
+ break;
+ case 't':
+ {
+ struct coord *p;
+ struct pcoord pc;
+ t=navit_get_trans(this->nav);
+ p=transform_center(t);
+ pc.pro=projection_mg;
+ p->y+=50*cos(transform_get_yaw(t)*M_PI/180);
+ p->x+=50*sin(transform_get_yaw(t)*M_PI/180);
+ pc.x=p->x;
+ pc.y=p->y;
+ navit_set_center(this->nav, &pc, 1);
+ }
+ break;
+ case 'g':
+ {
+ struct coord *p;
+ struct pcoord pc;
+ t=navit_get_trans(this->nav);
+ p=transform_center(t);
+ pc.pro=projection_mg;
+ p->y-=50*cos(transform_get_yaw(t)*M_PI/180);
+ p->x-=50*sin(transform_get_yaw(t)*M_PI/180);
+ pc.x=p->x;
+ pc.y=p->y;
+ navit_set_center(this->nav, &pc, 1);
+ }
+ break;
+ #ifdef USE_HILDON
+ case HILDON_HARDKEY_FULLSCREEN:
+ action = GTK_TOGGLE_ACTION (gtk_action_group_get_action (this->base_group, "FullscreenAction"));
+
+ if ( gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)))
+ {
+ fullscreen = 0;
+ } else {
+ fullscreen = 1;
+ }
+ gtk_toggle_action_set_active (action, fullscreen);
+ break;
+ #endif /*HILDON*/
+ default:
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static int
+gui_gtk_set_graphics(struct gui_priv *this, struct graphics *gra)
+{
+ GtkWidget *graphics;
+
+ graphics=graphics_get_data(gra, "gtk_widget");
+ if (! graphics)
+ return 1;
+ GTK_WIDGET_SET_FLAGS (graphics, GTK_CAN_FOCUS);
+ gtk_widget_set_sensitive(graphics, TRUE);
+ g_signal_connect(G_OBJECT(graphics), "key-press-event", G_CALLBACK(keypress), this);
+ gtk_box_pack_end(GTK_BOX(this->vbox), graphics, TRUE, TRUE, 0);
+ gtk_widget_show_all(graphics);
+ gtk_widget_grab_focus(graphics);
+
+ return 0;
+}
+
+static void
+gui_gtk_add_bookmark_do(struct gui_priv *gui)
+{
+ navit_add_bookmark(gui->nav, &gui->dialog_coord, gtk_entry_get_text(GTK_ENTRY(gui->dialog_entry)));
+ gtk_widget_destroy(gui->dialog_win);
+}
+
+static int
+gui_gtk_add_bookmark(struct gui_priv *gui, struct pcoord *c, char *description)
+{
+ GtkWidget *button_ok,*button_cancel,*label,*vbox,*hbox;
+
+ gui->dialog_coord=*c;
+ gui->dialog_win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ vbox=gtk_vbox_new(FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (gui->dialog_win), vbox);
+ gtk_window_set_title(GTK_WINDOW(gui->dialog_win),_("Add Bookmark"));
+ gtk_window_set_wmclass (GTK_WINDOW (gui->dialog_win), "navit", "Navit");
+ gtk_window_set_transient_for(GTK_WINDOW(gui->dialog_win), GTK_WINDOW(gui->win));
+ gtk_window_set_modal(GTK_WINDOW(gui->dialog_win), TRUE);
+ label=gtk_label_new(_("Name"));
+ gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
+ gui->dialog_entry=gtk_entry_new();
+ gtk_entry_set_text(GTK_ENTRY(gui->dialog_entry), description);
+ gtk_box_pack_start(GTK_BOX(vbox), gui->dialog_entry, TRUE, TRUE, 0);
+ hbox=gtk_hbox_new(FALSE, 0);
+ button_ok = gtk_button_new_from_stock (GTK_STOCK_OK);
+ gtk_box_pack_start(GTK_BOX(hbox), button_ok, TRUE, TRUE, 10);
+ button_cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
+ gtk_box_pack_start(GTK_BOX(hbox), button_cancel, TRUE, TRUE, 10);
+ gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 10);
+ gtk_widget_show_all(gui->dialog_win);
+ GTK_WIDGET_SET_FLAGS (button_ok, GTK_CAN_DEFAULT);
+ gtk_widget_grab_default(button_ok);
+ g_signal_connect_swapped (G_OBJECT (button_cancel), "clicked", G_CALLBACK (gtk_widget_destroy), G_OBJECT (gui->dialog_win));
+ g_signal_connect_swapped (G_OBJECT (gui->dialog_entry), "activate", G_CALLBACK (gui_gtk_add_bookmark_do), gui);
+
+ g_signal_connect_swapped(G_OBJECT (button_ok), "clicked", G_CALLBACK (gui_gtk_add_bookmark_do), gui);
+
+ return 1;
+}
+
+struct gui_methods gui_gtk_methods = {
+ NULL,
+ gui_gtk_popup_new,
+ gui_gtk_set_graphics,
+ NULL,
+ gui_gtk_datawindow_new,
+ gui_gtk_add_bookmark,
+};
+
+static gboolean
+gui_gtk_delete(GtkWidget *widget, GdkEvent *event, struct navit *nav)
+{
+ /* FIXME remove attr_navit callback */
+ navit_destroy(nav);
+
+ return TRUE;
+}
+
+static void
+gui_gtk_toggle_init(struct gui_priv *this)
+{
+ struct attr attr;
+ GtkToggleAction *toggle_action;
+
+ if (navit_get_attr(this->nav, attr_cursor, &attr, NULL)) {
+ toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "CursorAction"));
+ gtk_toggle_action_set_active(toggle_action, attr.u.num);
+ } else {
+ dbg(1, "Unable to locate CursorAction\n");
+ }
+ if (navit_get_attr(this->nav, attr_orientation, &attr, NULL)) {
+ toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "OrientationAction"));
+ gtk_toggle_action_set_active(toggle_action, attr.u.num != -1);
+ } else {
+ dbg(0, "Unable to locate OrientationAction\n");
+ }
+ if (navit_get_attr(this->nav, attr_tracking, &attr, NULL)) {
+ toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "TrackingAction"));
+ gtk_toggle_action_set_active(toggle_action, attr.u.num);
+ } else {
+ dbg(0, "Unable to locate TrackingAction\n");
+ }
+}
+
+struct action_cb_data {
+ struct gui_priv *gui;
+ struct attr attr;
+};
+
+static void
+gui_gtk_action_activate(GtkAction *action, struct action_cb_data *data)
+{
+ if(data->attr.type == attr_destination) {
+ char * label;
+ g_object_get(G_OBJECT(action), "label", &label,NULL);
+ navit_set_destination(data->gui->nav, data->attr.u.pcoord, label, 1);
+ g_free(label);
+ }
+}
+
+struct gui_menu_info {
+ guint merge_id;
+ GtkAction *action;
+};
+
+static void
+gui_gtk_del_menu(struct gui_priv *this, struct gui_menu_info *meninfo)
+{
+ gtk_action_group_remove_action(this->dyn_group, meninfo->action);
+ gtk_ui_manager_remove_ui(this->ui_manager, meninfo->merge_id);
+}
+
+static struct gui_menu_info
+gui_gtk_add_menu(struct gui_priv *this, char *name, char *label, char *path, int submenu, struct action_cb_data *data)
+{
+ struct gui_menu_info meninfo;
+ GtkAction *action;
+ guint merge_id;
+
+ action=gtk_action_new(name, label, NULL, NULL);
+ meninfo.action = action;
+ if (data)
+ g_signal_connect(action, "activate", G_CALLBACK(gui_gtk_action_activate), data);
+ gtk_action_group_add_action(this->dyn_group, action);
+ merge_id =gtk_ui_manager_new_merge_id(this->ui_manager);
+ meninfo.merge_id = merge_id;
+ gtk_ui_manager_add_ui(this->ui_manager, merge_id, path, name, name, submenu ? GTK_UI_MANAGER_MENU : GTK_UI_MANAGER_MENUITEM, FALSE);
+
+ return meninfo;
+}
+
+static void
+gui_gtk_action_toggled(GtkToggleAction *action, struct action_cb_data *data)
+{
+ struct attr active;
+ active.type=attr_active;
+ active.u.num=gtk_toggle_action_get_active(action);
+ map_set_attr(data->attr.u.map, &active);
+ navit_draw(data->gui->nav);
+}
+
+static void
+gui_gtk_add_toggle_menu(struct gui_priv *this, char *name, char *label, char *path, struct action_cb_data *data, gboolean active)
+{
+ GtkToggleAction *toggle_action;
+ guint merge_id;
+
+ toggle_action=gtk_toggle_action_new(name, label, NULL, NULL);
+ gtk_toggle_action_set_active(toggle_action, active);
+ g_signal_connect(GTK_ACTION(toggle_action), "toggled", G_CALLBACK(gui_gtk_action_toggled), data);
+ gtk_action_group_add_action(this->dyn_group, GTK_ACTION(toggle_action));
+ merge_id=gtk_ui_manager_new_merge_id(this->ui_manager);
+ gtk_ui_manager_add_ui(this->ui_manager, merge_id, path, name, name, GTK_UI_MANAGER_MENUITEM, FALSE);
+}
+
+static void
+gui_gtk_action_changed(GtkRadioAction *action, GtkRadioAction *current, struct action_cb_data *data)
+{
+ if (action == current) {
+ navit_set_attr(data->gui->nav, &data->attr);
+ }
+}
+
+static struct gui_menu_info
+gui_gtk_add_radio_menu(struct gui_priv *this, char *name, char *label, char *path, struct action_cb_data *data, GSList **g)
+{
+ struct gui_menu_info meninfo;
+ GtkRadioAction *radio_action;
+ guint merge_id;
+
+ radio_action=gtk_radio_action_new(name, label, NULL, NULL, 0);
+ meninfo.action = (GtkAction *)radio_action;
+ gtk_radio_action_set_group(radio_action, *g);
+ *g=gtk_radio_action_get_group(radio_action);
+ g_signal_connect(GTK_ACTION(radio_action), "changed", G_CALLBACK(gui_gtk_action_changed), data);
+ gtk_action_group_add_action(this->dyn_group, GTK_ACTION(radio_action));
+ merge_id=gtk_ui_manager_new_merge_id(this->ui_manager);
+ meninfo.merge_id = merge_id;
+ gtk_ui_manager_add_ui(this->ui_manager, merge_id, path, name, name, GTK_UI_MANAGER_MENUITEM, FALSE);
+
+ return meninfo;
+}
+
+static void
+gui_gtk_layouts_init(struct gui_priv *this)
+{
+ struct attr_iter *iter;
+ struct attr attr;
+ struct action_cb_data *data;
+ int count=0;
+ char *name;
+
+ iter=navit_attr_iter_new();
+ while(navit_get_attr(this->nav, attr_layout, &attr, iter)) {
+ name=g_strdup_printf("Layout %d", count++);
+ data=g_new(struct action_cb_data, 1);
+ data->gui=this;
+ data->attr.type=attr_layout;
+ data->attr.u.layout=attr.u.layout;
+ gui_gtk_add_radio_menu(this, name, attr.u.layout->name, "/ui/MenuBar/Map/Layout/LayoutMenuAdditions", data, &this->layout_group);
+ g_free(name);
+ }
+ navit_attr_iter_destroy(iter);
+}
+
+static void
+gui_gtk_projections_init(struct gui_priv *this)
+{
+ struct action_cb_data *data;
+
+ data=g_new(struct action_cb_data, 1);
+ data->gui=this;
+ data->attr.type=attr_projection;
+ data->attr.u.projection=projection_mg;
+ gui_gtk_add_radio_menu(this, "Projection mg", "Map & Guide", "/ui/MenuBar/Map/Projection/ProjectionMenuAdditions", data, &this->projection_group);
+
+ data=g_new(struct action_cb_data, 1);
+ data->gui=this;
+ data->attr.type=attr_projection;
+ data->attr.u.projection=projection_garmin;
+ gui_gtk_add_radio_menu(this, "Projection garmin", "Garmin", "/ui/MenuBar/Map/Projection/ProjectionMenuAdditions", data, &this->projection_group);
+}
+
+static void
+gui_gtk_vehicles_update(struct gui_priv *this)
+{
+ struct attr_iter *iter;
+ struct attr attr,vattr;
+ struct action_cb_data *data;
+ int count=0;
+ char *name;
+ GList *curr;
+ struct gui_menu_info *meninfo;
+ dbg(1,"enter\n");
+
+ curr = g_list_first(this->vehicle_menuitems);
+
+ while (curr) {
+ gui_gtk_del_menu(this, (struct gui_menu_info *)curr->data);
+ g_free((struct gui_menu_info *)curr->data);
+ curr = g_list_next(curr);
+ };
+
+ g_list_free(this->vehicle_menuitems);
+ this->vehicle_menuitems = NULL;
+
+ iter=navit_attr_iter_new();
+ while(navit_get_attr(this->nav, attr_vehicle, &attr, iter)) {
+ vehicle_get_attr(attr.u.vehicle, attr_name, &vattr, NULL);
+ name=g_strdup_printf("Vehicle %d", count++);
+ data=g_new(struct action_cb_data, 1);
+ data->gui=this;
+ data->attr.type=attr_vehicle;
+ data->attr.u.vehicle=attr.u.vehicle;
+ meninfo = g_new(struct gui_menu_info, 1);
+ *meninfo = gui_gtk_add_radio_menu(this, name, vattr.u.str, "/ui/MenuBar/Map/Vehicle/VehicleMenuAdditions", data, &this->vehicle_group);
+ this->vehicle_menuitems = g_list_prepend(this->vehicle_menuitems, meninfo);
+ g_free(name);
+ }
+ navit_attr_iter_destroy(iter);
+}
+
+static void
+gui_gtk_vehicles_init(struct gui_priv *this)
+{
+ navit_add_callback(this->nav, callback_new_attr_1(callback_cast(gui_gtk_vehicles_update), attr_vehicle, this));
+ gui_gtk_vehicles_update(this);
+}
+
+static void
+gui_gtk_maps_init(struct gui_priv *this)
+{
+ struct attr_iter *iter;
+ struct attr attr,active,type,data;
+ struct action_cb_data *cb_data;
+ int count=0;
+ char *name, *label;
+
+ iter=navit_attr_iter_new();
+ while(navit_get_attr(this->nav, attr_map, &attr, iter)) {
+ name=g_strdup_printf("Map %d", count++);
+ if (! map_get_attr(attr.u.map, attr_type, &type, NULL))
+ type.u.str="";
+ if (! map_get_attr(attr.u.map, attr_data, &data, NULL))
+ data.u.str="";
+ label=g_strdup_printf("%s:%s", type.u.str, data.u.str);
+ cb_data=g_new(struct action_cb_data, 1);
+ cb_data->gui=this;
+ cb_data->attr.type=attr_map;
+ cb_data->attr.u.map=attr.u.map;
+ if (! map_get_attr(attr.u.map, attr_active, &active, NULL))
+ active.u.num=1;
+ gui_gtk_add_toggle_menu(this, name, label, "/ui/MenuBar/Map/MapMenuAdditions", cb_data, active.u.num);
+ g_free(name);
+ g_free(label);
+ }
+ navit_attr_iter_destroy(iter);
+
+}
+
+static void
+gui_gtk_destinations_update(struct gui_priv *this)
+{
+ GList *curr;
+ struct attr attr;
+ struct action_cb_data *data;
+ struct map_rect *mr=NULL;
+ struct item *item;
+ struct gui_menu_info *meninfo;
+ struct coord c;
+ int count=0;
+ char *name, *label;
+
+ curr = g_list_first(this->dest_menuitems);
+
+ while (curr) {
+ gui_gtk_del_menu(this, (struct gui_menu_info *)curr->data);
+ g_free((struct gui_menu_info *)curr->data);
+ curr = g_list_next(curr);
+ };
+
+ g_list_free(this->dest_menuitems);
+ this->dest_menuitems = NULL;
+
+ if(navit_get_attr(this->nav, attr_former_destination_map, &attr, NULL) && attr.u.map && (mr=map_rect_new(attr.u.map, NULL))) {
+ while ((item=map_rect_get_item(mr))) {
+ if (item->type != type_former_destination) continue;
+ name=g_strdup_printf("Destination %d", count++);
+ item_attr_get(item, attr_label, &attr);
+ label=attr.u.str;
+ item_coord_get(item, &c, 1);
+ data=g_new(struct action_cb_data, 1);
+ data->gui=this;
+ data->attr.type=attr_destination;
+ data->attr.u.pcoord=g_new(struct pcoord, 1);
+ data->attr.u.pcoord->pro=projection_mg;
+ data->attr.u.pcoord->x=c.x;
+ data->attr.u.pcoord->y=c.y;
+
+ meninfo = g_new(struct gui_menu_info, 1);
+ *meninfo = gui_gtk_add_menu(this, name, label, "/ui/MenuBar/Route/FormerDestinations/FormerDestinationMenuAdditions",0,data);
+ this->dest_menuitems = g_list_prepend(this->dest_menuitems, meninfo);
+ g_free(name);
+ }
+ map_rect_destroy(mr);
+ }
+}
+
+static void
+gui_gtk_destinations_init(struct gui_priv *this)
+{
+ navit_add_callback(this->nav, callback_new_attr_1(callback_cast(gui_gtk_destinations_update), attr_destination, this));
+ gui_gtk_destinations_update(this);
+}
+
+static void
+gui_gtk_bookmarks_update(struct gui_priv *this)
+{
+ GList *curr;
+ struct attr attr;
+ struct action_cb_data *data;
+ struct map_rect *mr=NULL;
+ struct gui_menu_info *meninfo;
+ struct item *item;
+ struct coord c;
+ int count=0;
+ char *parent, *name, *label, *label_full, *menu_label, *tmp_parent, *s;
+ GHashTable *hash;
+
+ curr = g_list_first(this->bookmarks_menuitems);
+
+ while (curr) {
+ gui_gtk_del_menu(this, (struct gui_menu_info *)curr->data);
+ g_free((struct gui_menu_info *)curr->data);
+ curr = g_list_next(curr);
+ };
+
+ g_list_free(this->bookmarks_menuitems);
+ this->bookmarks_menuitems = NULL;
+
+ if(navit_get_attr(this->nav, attr_bookmark_map, &attr, NULL) && attr.u.map && (mr=map_rect_new(attr.u.map, NULL))) {
+ hash=g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
+ while ((item=map_rect_get_item(mr))) {
+ if (item->type != type_bookmark) continue;
+ item_attr_get(item, attr_label, &attr);
+ label_full=attr.u.str;
+ item_coord_get(item, &c, 1);
+ menu_label=g_malloc(strlen(label_full)+1);
+ label=label_full;
+ parent=g_strdup("/ui/MenuBar/Route/Bookmarks/BookmarkMenuAdditions");
+ while ((s=strchr(label, '/'))) {
+ strcpy(menu_label, label_full);
+ menu_label[s-label_full]='\0';
+ if ((tmp_parent=g_hash_table_lookup(hash, menu_label))) {
+ tmp_parent=g_strdup(tmp_parent);
+ } else {
+ name=g_strdup_printf("Bookmark %d", count++);
+ meninfo = g_new(struct gui_menu_info, 1);
+ *meninfo = gui_gtk_add_menu(this, name, menu_label+(label-label_full),parent,1,NULL);
+ this->bookmarks_menuitems = g_list_prepend(this->bookmarks_menuitems, meninfo);
+ tmp_parent=g_strdup_printf("%s/%s", parent, name);
+ g_hash_table_insert(hash, g_strdup(menu_label), g_strdup(tmp_parent));
+ g_free(name);
+ }
+ g_free(parent);
+ parent=tmp_parent;
+ label=s+1;
+ }
+ g_free(menu_label);
+ data=g_new(struct action_cb_data, 1);
+ data->gui=this;
+ data->attr.type=attr_destination;
+ data->attr.u.pcoord=g_new(struct pcoord, 1);
+ data->attr.u.pcoord->pro=projection_mg;
+ data->attr.u.pcoord->x=c.x;
+ data->attr.u.pcoord->y=c.y;
+ name=g_strdup_printf("Bookmark %d", count++);
+ meninfo = g_new(struct gui_menu_info, 1);
+ *meninfo = gui_gtk_add_menu(this, name, label, parent,0,data);
+ this->bookmarks_menuitems = g_list_prepend(this->bookmarks_menuitems, meninfo);
+ g_free(name);
+ g_free(parent);
+ }
+ g_hash_table_destroy(hash);
+ }
+}
+
+static void
+gui_gtk_bookmarks_init(struct gui_priv *this)
+{
+ navit_add_callback(this->nav, callback_new_attr_1(callback_cast(gui_gtk_bookmarks_update), attr_bookmark_map, this));
+ gui_gtk_bookmarks_update(this);
+}
+
+static void
+gui_gtk_init(struct gui_priv *this, struct navit *nav)
+{
+
+
+ gui_gtk_toggle_init(this);
+ gui_gtk_layouts_init(this);
+ gui_gtk_projections_init(this);
+ gui_gtk_vehicles_init(this);
+ gui_gtk_maps_init(this);
+ gui_gtk_destinations_init(this);
+ gui_gtk_bookmarks_init(this);
+}
+
+static struct gui_priv *
+gui_gtk_new(struct navit *nav, struct gui_methods *meth, struct attr **attrs)
+{
+ struct gui_priv *this;
+ int w=792, h=547;
+ char *cp = getenv("NAVIT_XID");
+ unsigned xid = 0;
+ struct attr *attr;
+ GtkWidget *widget;
+ int fullscreen = 0;
+
+ if (! event_request_system("glib","gui_gtk_new"))
+ return NULL;
+
+ if (cp) {
+ xid = strtol(cp, NULL, 0);
+ }
+
+ this=g_new0(struct gui_priv, 1);
+ this->nav=nav;
+
+ attr = attr_search(attrs, NULL, attr_menubar);
+ if (attr) {
+ this->menubar_enable=attr->u.num;
+ } else {
+ this->menubar_enable=1;
+ }
+ attr=attr_search(attrs, NULL, attr_toolbar);
+ if (attr) {
+ this->toolbar_enable=attr->u.num;
+ } else {
+ this->toolbar_enable=1;
+ }
+ attr=attr_search(attrs, NULL, attr_statusbar);
+ if (attr) {
+ this->statusbar_enable=attr->u.num;
+ } else {
+ this->statusbar_enable=1;
+ }
+
+ *meth=gui_gtk_methods;
+
+ if (!xid)
+ this->win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ else
+ this->win = gtk_plug_new(xid);
+
+
+ g_signal_connect(G_OBJECT(this->win), "delete-event", G_CALLBACK(gui_gtk_delete), nav);
+ this->vbox = gtk_vbox_new(FALSE, 0);
+ gtk_window_set_default_size(GTK_WINDOW(this->win), w, h);
+ gtk_window_set_title(GTK_WINDOW(this->win), "Navit");
+ gtk_window_set_wmclass (GTK_WINDOW (this->win), "navit", "Navit");
+ gtk_widget_realize(this->win);
+ gui_gtk_ui_init(this);
+ if (this->menubar_enable) {
+ widget=gtk_ui_manager_get_widget(this->ui_manager, "/ui/MenuBar");
+ GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS);
+ gtk_box_pack_start (GTK_BOX(this->vbox), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+ this->menubar=widget;
+ }
+ if (this->toolbar_enable) {
+ widget=gtk_ui_manager_get_widget(this->ui_manager, "/ui/ToolBar");
+ GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS);
+ gtk_box_pack_start (GTK_BOX(this->vbox), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+ }
+ if (this->statusbar_enable) {
+ this->statusbar=gui_gtk_statusbar_new(this);
+ }
+ gtk_container_add(GTK_CONTAINER(this->win), this->vbox);
+ gtk_widget_show_all(this->win);
+
+
+ navit_add_callback(nav, callback_new_attr_1(callback_cast(gui_gtk_init), attr_navit, this));
+
+ if ((attr=attr_search(attrs, NULL, attr_fullscreen)))
+ fullscreen=attr->u.num;
+
+ if (fullscreen) {
+ GtkToggleAction *action;
+ action = GTK_TOGGLE_ACTION (gtk_action_group_get_action (this->base_group, "FullscreenAction"));
+ gtk_toggle_action_set_active (action, fullscreen);
+ }
+
+ return this;
+}
+
+static int gtk_argc;
+static char **gtk_argv={NULL};
+
+void
+plugin_init(void)
+{
+ gtk_init(&gtk_argc, &gtk_argv);
+ gtk_set_locale();
+
+
+ plugin_register_gui_type("gtk", gui_gtk_new);
+}
diff --git a/gui/internal/Makefile.am b/gui/internal/Makefile.am
new file mode 100644
index 00000000..abb308f5
--- /dev/null
+++ b/gui/internal/Makefile.am
@@ -0,0 +1,6 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = -I$(top_srcdir)/navit @NAVIT_CFLAGS@ -DMODULE=gui_internal
+modulegui_LTLIBRARIES = libgui_internal.la
+libgui_internal_la_SOURCES = gui_internal.c gui_internal.h
+libgui_internal_la_LIBADD =
+libgui_internal_la_LDFLAGS = -module -avoid-version
diff --git a/gui/internal/gui_internal.c b/gui/internal/gui_internal.c
new file mode 100644
index 00000000..1309f3dc
--- /dev/null
+++ b/gui/internal/gui_internal.c
@@ -0,0 +1,4978 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+//##############################################################################################################
+//#
+//# File: gui_internal.c
+//# Description: New "internal" GUI for use with any graphics library
+//# Comment: Trying to make a touchscreen friendly GUI
+//# Authors: Martin Schaller (04/2008), Stefan Klumpp (04/2008)
+//#
+//##############################################################################################################
+
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <math.h>
+#include <glib.h>
+#include <time.h>
+#include "config.h"
+#include "item.h"
+#include "file.h"
+#include "navit.h"
+#include "navit_nls.h"
+#include "debug.h"
+#include "gui.h"
+#include "coord.h"
+#include "point.h"
+#include "plugin.h"
+#include "graphics.h"
+#include "transform.h"
+#include "color.h"
+#include "map.h"
+#include "layout.h"
+#include "callback.h"
+#include "vehicle.h"
+#include "vehicleprofile.h"
+#include "window.h"
+#include "main.h"
+#include "keys.h"
+#include "mapset.h"
+#include "route.h"
+#include "search.h"
+#include "track.h"
+#include "country.h"
+#include "config.h"
+#include "event.h"
+#include "navit_nls.h"
+#include "navigation.h"
+#include "gui_internal.h"
+#include "command.h"
+
+struct menu_data {
+ struct widget *search_list;
+ struct widget *keyboard;
+ struct widget *button_bar;
+ int keyboard_mode;
+ void (*redisplay)(struct gui_priv *priv, struct widget *widget, void *data);
+ struct widget *redisplay_widget;
+};
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+struct widget {
+ enum widget_type type;
+ struct graphics_gc *background,*text_background;
+ struct graphics_gc *foreground_frame;
+ struct graphics_gc *foreground;
+ char *text;
+ struct graphics_image *img;
+ /**
+ * A function to be invoked on actions.
+ * @li widget The widget that is receiving the button press.
+ *
+ */
+ void (*func)(struct gui_priv *priv, struct widget *widget, void *data);
+ int reason;
+ int datai;
+ void *data;
+ /**
+ * @brief A function to deallocate data
+ */
+ void (*data_free)(void *data);
+
+ /**
+ * @brief a function that will be called as the widget is being destroyed.
+ * This function can act as a destructor for the widget. It allows for
+ * on deallocation actions to be specified on a per widget basis.
+ * This function will call g_free on the widget (if required).
+ */
+ void (*free) (struct gui_priv *this_, struct widget * w);
+ char *prefix;
+ char *name;
+ char *speech;
+ struct pcoord c;
+ struct item item;
+ int selection_id;
+ int state;
+ struct point p;
+ int wmin,hmin;
+ int w,h;
+ int textw,texth;
+ int bl,br,bt,bb,spx,spy;
+ int border;
+ /**
+ * The number of widgets to layout horizontally when doing
+ * a orientation_horizontal_vertical layout
+ */
+ int cols;
+ enum flags flags;
+ void *instance;
+ int (*set_attr)(void *, struct attr *);
+ int (*get_attr)(void *, enum attr_type, struct attr *, struct attr_iter *);
+ void (*remove_cb)(void *, struct callback *cb);
+ struct callback *cb;
+ struct attr on;
+ struct attr off;
+ int deflt;
+ int is_on;
+ int redraw;
+ struct menu_data *menu_data;
+ GList *children;
+};
+
+/**
+ * @brief A structure to store configuration values.
+ *
+ * This structure stores configuration values for how gui elements in the internal GUI
+ * should be drawn.
+ */
+struct gui_config_settings {
+
+ /**
+ * The base size (in fractions of a point) to use for text.
+ */
+ int font_size;
+ /**
+ * The size (in pixels) that xs style icons should be scaled to.
+ */
+ int icon_xs;
+ /**
+ * The size (in pixels) that s style icons (small) should be scaled to
+ */
+ int icon_s;
+ /**
+ * The size (in pixels) that l style icons should be scaled to
+ */
+ int icon_l;
+ /**
+ * The default amount of spacing (in pixels) to place between GUI elements.
+ */
+ int spacing;
+
+};
+
+/**
+ * Indexes into the config_profiles array.
+ */
+const int LARGE_PROFILE=0;
+const int MEDIUM_PROFILE=1;
+const int SMALL_PROFILE=2;
+
+/**
+ * The default config profiles.
+ *
+ * [0] => LARGE_PROFILE (screens 640 in one dimension)
+ * [1] => MEDIUM PROFILE (screens larger than 320 in one dimension
+ * [2] => Small profile (default)
+ */
+static struct gui_config_settings config_profiles[]={
+ {545,32,48,96,10}
+ , {545,32,48,96,5}
+ ,{200,16,32,48,2}
+};
+
+struct route_data {
+ struct widget * route_table;
+ int route_showing;
+
+};
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+struct gui_priv {
+ struct navit *nav;
+ struct window *win;
+ struct graphics *gra;
+ struct graphics_gc *background;
+ struct graphics_gc *background2;
+ struct graphics_gc *highlight_background;
+ struct graphics_gc *foreground;
+ struct graphics_gc *text_foreground;
+ struct graphics_gc *text_background;
+ struct color background_color, background2_color, text_foreground_color, text_background_color;
+ int spacing;
+ int font_size;
+ int fullscreen;
+ struct graphics_font *font;
+ int icon_xs, icon_s, icon_l;
+ int pressed;
+ struct widget *widgets;
+ int widgets_count;
+ int redraw;
+ struct widget root;
+ struct widget *highlighted;
+ struct widget *highlighted_menu;
+ int clickp_valid, vehicle_valid;
+ struct pcoord clickp, vehiclep;
+ struct search_list *sl;
+ int ignore_button;
+ int menu_on_map_click;
+ char *country_iso2;
+ int speech;
+ int keyboard;
+ /**
+ * The setting information read from the configuration file.
+ * values of -1 indicate no value was specified in the config file.
+ */
+ struct gui_config_settings config;
+ struct event_idle *idle;
+ struct callback *motion_cb,*button_cb,*resize_cb,*keypress_cb,*idle_cb, *motion_timeout_callback;
+ struct event_timeout *motion_timeout_event;
+ struct point current;
+
+ struct callback * vehicle_cb;
+ /**
+ * Stores information about the route.
+ */
+ struct route_data route_data;
+
+ struct gui_internal_data data;
+ struct callback_list *cbl;
+ int flags;
+ int cols;
+ struct attr osd_configuration;
+ int pitch;
+};
+
+
+/**
+ * @brief A structure to store information about a table.
+ *
+ * The table_data widget stores pointers to extra information needed by the
+ * table widget.
+ *
+ * The table_data structure needs to be freed with data_free along with the widget.
+ *
+ */
+struct table_data
+{
+ /**
+ * A GList pointer into a widget->children list that indicates the row
+ * currently being rendered at the top of the table.
+ */
+ GList * top_row;
+ /**
+ * A Glist pointer into a widget->children list that indicates the row
+ * currently being rendered at the bottom of the table.
+ */
+ GList * bottom_row;
+
+ /**
+ * A list of table_row widgets that mark the
+ * top rows for each page of the table.
+ * This is needed for the 'previous page' function of the table.
+ */
+ GList * page_headers;
+
+ /**
+ * A container box that is the child of the table widget that contains+groups
+ * the next and previous button.
+ */
+ struct widget * button_box;
+
+ /**
+ * A button widget to handle 'next page' requests
+ */
+ struct widget * next_button;
+ /**
+ * A button widget to handle 'previous page' requests.
+ */
+ struct widget * prev_button;
+
+
+ /**
+ * a pointer to the gui context.
+ * This is needed by the free function to destory the buttons.
+ */
+ struct gui_priv * this;
+};
+
+/**
+ * A data structure that holds information about a column that makes up a table.
+ *
+ *
+ */
+struct table_column_desc
+{
+
+ /**
+ * The computed height of a cell in the table.
+ */
+ int height;
+
+ /**
+ * The computed width of a cell in the table.
+ */
+ int width;
+};
+
+
+static void gui_internal_widget_render(struct gui_priv *this, struct widget *w);
+static void gui_internal_widget_pack(struct gui_priv *this, struct widget *w);
+static struct widget * gui_internal_box_new(struct gui_priv *this, enum flags flags);
+static void gui_internal_widget_append(struct widget *parent, struct widget *child);
+static void gui_internal_widget_destroy(struct gui_priv *this, struct widget *w);
+static void gui_internal_apply_config(struct gui_priv *this);
+
+static struct widget* gui_internal_widget_table_new(struct gui_priv * this, enum flags flags, int buttons);
+static struct widget * gui_internal_widget_table_row_new(struct gui_priv * this, enum flags flags);
+static void gui_internal_table_render(struct gui_priv * this, struct widget * w);
+static void gui_internal_cmd_route(struct gui_priv * this, struct widget * w,void *);
+static void gui_internal_table_pack(struct gui_priv * this, struct widget * w);
+static void gui_internal_table_button_next(struct gui_priv * this, struct widget * wm, void *data);
+static void gui_internal_table_button_prev(struct gui_priv * this, struct widget * wm, void *data);
+static void gui_internal_widget_table_clear(struct gui_priv * this,struct widget * table);
+static struct widget * gui_internal_widget_table_row_new(struct gui_priv * this, enum flags flags);
+static void gui_internal_table_data_free(void * d);
+static void gui_internal_route_update(struct gui_priv * this, struct navit * navit,
+ struct vehicle * v);
+static void gui_internal_route_screen_free(struct gui_priv * this_,struct widget * w);
+static void gui_internal_populate_route_table(struct gui_priv * this,
+ struct navit * navit);
+static void gui_internal_search_idle_end(struct gui_priv *this);
+static void gui_internal_search(struct gui_priv *this, char *what, char *type, int flags);
+static void gui_internal_search_house_number(struct gui_priv *this, struct widget *widget, void *data);
+static void gui_internal_search_house_number_in_street(struct gui_priv *this, struct widget *widget, void *data);
+static void gui_internal_search_street(struct gui_priv *this, struct widget *widget, void *data);
+static void gui_internal_search_street_in_town(struct gui_priv *this, struct widget *widget, void *data);
+static void gui_internal_search_town(struct gui_priv *this, struct widget *wm, void *data);
+static void gui_internal_search_town_in_country(struct gui_priv *this, struct widget *wm);
+static void gui_internal_search_country(struct gui_priv *this, struct widget *widget, void *data);
+static void gui_internal_check_exit(struct gui_priv *this);
+
+static struct widget *gui_internal_keyboard_do(struct gui_priv *this, struct widget *wkbdb, int mode);
+static struct menu_data * gui_internal_menu_data(struct gui_priv *this);
+
+static int gui_internal_is_active_vehicle(struct gui_priv *this, struct vehicle *vehicle);
+
+/*
+ * * Display image scaled to specific size
+ * * searches for scaleable and pre-scaled image
+ * * @param this Our gui context
+ * * @param name image name
+ * * @param w desired width of image
+ * * @param h desired height of image
+ * * @returns image_struct Ptr to scaled image struct or NULL if not scaled or found
+ * */
+static struct graphics_image *
+image_new_scaled(struct gui_priv *this, char *name, int w, int h)
+{
+ struct graphics_image *ret=NULL;
+ char *full_name=NULL;
+ int i;
+
+ for (i = 1 ; i < 6 ; i++) {
+ full_name=NULL;
+ switch (i) {
+ case 3:
+ full_name=g_strdup_printf("%s/xpm/%s.svg", getenv("NAVIT_SHAREDIR"), name);
+ break;
+ case 2:
+ full_name=g_strdup_printf("%s/xpm/%s.svgz", getenv("NAVIT_SHAREDIR"), name);
+ break;
+ case 1:
+ if (w != -1 && h != -1) {
+ full_name=g_strdup_printf("%s/xpm/%s_%d_%d.png", getenv("NAVIT_SHAREDIR"), name, w, h);
+ }
+ break;
+ case 4:
+ full_name=g_strdup_printf("%s/xpm/%s.png", getenv("NAVIT_SHAREDIR"), name);
+ break;
+ case 5:
+ full_name=g_strdup_printf("%s/xpm/%s.xpm", getenv("NAVIT_SHAREDIR"), name);
+ break;
+ }
+ dbg(1,"trying '%s'\n", full_name);
+ if (! full_name)
+ continue;
+ if (!file_exists(full_name)) {
+ g_free(full_name);
+ continue;
+ }
+ ret=graphics_image_new_scaled(this->gra, full_name, w, h);
+ dbg(1,"ret=%p\n", ret);
+ g_free(full_name);
+ if (ret)
+ return ret;
+ }
+ dbg(0,"failed to load %s with %d,%d\n", name, w, h);
+ return NULL;
+}
+
+#if 0
+static struct graphics_image *
+image_new_o(struct gui_priv *this, char *name)
+{
+ return image_new_scaled(this, name, -1, -1);
+}
+#endif
+
+static struct graphics_image *
+image_new_xs(struct gui_priv *this, char *name)
+{
+ return image_new_scaled(this, name, this->icon_xs, this->icon_xs);
+}
+
+
+static struct graphics_image *
+image_new_s(struct gui_priv *this, char *name)
+{
+ return image_new_scaled(this, name, this->icon_s, this->icon_s);
+}
+
+static struct graphics_image *
+image_new_l(struct gui_priv *this, char *name)
+{
+ return image_new_scaled(this, name, this->icon_l, this->icon_l);
+}
+
+static char *
+coordinates(struct pcoord *pc, char sep)
+{
+ char latc='N',lngc='E';
+ int lat_deg,lat_min,lat_sec;
+ int lng_deg,lng_min,lng_sec;
+ struct coord_geo g;
+ struct coord c;
+ c.x=pc->x;
+ c.y=pc->y;
+ transform_to_geo(pc->pro, &c, &g);
+
+ if (g.lat < 0) {
+ g.lat=-g.lat;
+ latc='S';
+ }
+ if (g.lng < 0) {
+ g.lng=-g.lng;
+ lngc='W';
+ }
+ lat_deg=g.lat;
+ lat_min=fmod(g.lat*60,60);
+ lat_sec=fmod(g.lat*3600,60);
+ lng_deg=g.lng;
+ lng_min=fmod(g.lng*60,60);
+ lng_sec=fmod(g.lng*3600,60);
+ return g_strdup_printf("%d°%d'%d\" %c%c%d°%d'%d\" %c",lat_deg,lat_min,lat_sec,latc,sep,lng_deg,lng_min,lng_sec,lngc);
+}
+
+static void
+gui_internal_background_render(struct gui_priv *this, struct widget *w)
+{
+ struct point pnt=w->p;
+ if (w->state & STATE_HIGHLIGHTED)
+ graphics_draw_rectangle(this->gra, this->highlight_background, &pnt, w->w, w->h);
+ else {
+ if (w->background)
+ graphics_draw_rectangle(this->gra, w->background, &pnt, w->w, w->h);
+ }
+}
+static struct widget *
+gui_internal_label_new(struct gui_priv *this, char *text)
+{
+ struct point p[4];
+ int w=0;
+ int h=0;
+
+ struct widget *widget=g_new0(struct widget, 1);
+ widget->type=widget_label;
+ if (text) {
+ widget->text=g_strdup(text);
+ graphics_get_text_bbox(this->gra, this->font, text, 0x10000, 0x0, p, 0);
+ w=p[2].x-p[0].x;
+ h=p[0].y-p[2].y;
+ }
+ widget->h=h+this->spacing;
+ widget->texth=h;
+ widget->w=w+this->spacing;
+ widget->textw=w;
+ widget->flags=gravity_center;
+ widget->foreground=this->text_foreground;
+ widget->text_background=this->text_background;
+
+ return widget;
+}
+
+static struct widget *
+gui_internal_label_new_abbrev(struct gui_priv *this, char *text, int maxwidth)
+{
+ struct widget *ret=NULL;
+ char *tmp=g_malloc(strlen(text)+3);
+ int i;
+
+ i=strlen(text)-1;
+ while (i >= 0) {
+ strcpy(tmp, text);
+ strcpy(tmp+i,"..");
+ ret=gui_internal_label_new(this, tmp);
+ if (ret->w < maxwidth)
+ break;
+ gui_internal_widget_destroy(this, ret);
+ ret=NULL;
+ i--;
+ }
+ g_free(tmp);
+ return ret;
+}
+
+static struct widget *
+gui_internal_image_new(struct gui_priv *this, struct graphics_image *image)
+{
+ struct widget *widget=g_new0(struct widget, 1);
+ widget->type=widget_image;
+ widget->img=image;
+ if (image) {
+ widget->w=image->width;
+ widget->h=image->height;
+ }
+ return widget;
+}
+
+static void
+gui_internal_image_render(struct gui_priv *this, struct widget *w)
+{
+ struct point pnt;
+
+ gui_internal_background_render(this, w);
+ if (w->img) {
+ pnt=w->p;
+ pnt.x+=w->w/2-w->img->hot.x;
+ pnt.y+=w->h/2-w->img->hot.y;
+ graphics_draw_image(this->gra, this->foreground, &pnt, w->img);
+ }
+}
+
+static void
+gui_internal_label_render(struct gui_priv *this, struct widget *w)
+{
+ struct point pnt=w->p;
+ gui_internal_background_render(this, w);
+ if (w->text) {
+ if (w->flags & gravity_right) {
+ pnt.y+=w->h-this->spacing;
+ pnt.x+=w->w-w->textw-this->spacing;
+ graphics_draw_text(this->gra, w->foreground, w->text_background, this->font, w->text, &pnt, 0x10000, 0x0);
+ } else {
+ pnt.y+=w->h-this->spacing;
+ graphics_draw_text(this->gra, w->foreground, w->text_background, this->font, w->text, &pnt, 0x10000, 0x0);
+ }
+ }
+}
+
+/**
+ * @brief A text box is a widget that renders a text string containing newlines.
+ * The string will be broken up into label widgets at each newline with a vertical layout.
+ *
+ */
+static struct widget *
+gui_internal_text_new(struct gui_priv *this, char *text, enum flags flags)
+{
+ char *s=g_strdup(text),*s2,*tok;
+ struct widget *ret=gui_internal_box_new(this, flags);
+ s2=s;
+ while ((tok=strtok(s2,"\n"))) {
+ gui_internal_widget_append(ret, gui_internal_label_new(this, tok));
+ s2=NULL;
+ }
+ gui_internal_widget_pack(this,ret);
+ return ret;
+}
+
+
+static struct widget *
+gui_internal_button_new_with_callback(struct gui_priv *this, char *text, struct graphics_image *image, enum flags flags, void(*func)(struct gui_priv *priv, struct widget *widget, void *data), void *data)
+{
+ struct widget *ret=NULL;
+ ret=gui_internal_box_new(this, flags);
+ if (ret) {
+ if (image)
+ gui_internal_widget_append(ret, gui_internal_image_new(this, image));
+ if (text)
+ gui_internal_widget_append(ret, gui_internal_text_new(this, text, gravity_center|orientation_vertical));
+ ret->func=func;
+ ret->data=data;
+ if (func) {
+ ret->state |= STATE_SENSITIVE;
+ ret->speech=g_strdup(text);
+ }
+ }
+ return ret;
+
+}
+
+static int
+gui_internal_button_attr_update(struct gui_priv *this, struct widget *w)
+{
+ struct widget *wi;
+ int is_on=0;
+ struct attr curr;
+ GList *l;
+
+ if (w->get_attr(w->instance, w->on.type, &curr, NULL))
+ is_on=curr.u.data == w->on.u.data;
+ else
+ is_on=w->deflt;
+ if (is_on != w->is_on) {
+ if (w->redraw)
+ this->redraw=1;
+ w->is_on=is_on;
+ l=g_list_first(w->children);
+ if (l) {
+ wi=l->data;
+ if (wi->img)
+ graphics_image_free(this->gra, wi->img);
+ wi->img=image_new_xs(this, is_on ? "gui_active" : "gui_inactive");
+ }
+ if (w->is_on && w->off.type == attr_none)
+ w->state &= ~STATE_SENSITIVE;
+ else
+ w->state |= STATE_SENSITIVE;
+ return 1;
+ }
+ return 0;
+}
+
+static void
+gui_internal_button_attr_callback(struct gui_priv *this, struct widget *w)
+{
+ if (gui_internal_button_attr_update(this, w))
+ gui_internal_widget_render(this, w);
+}
+static void
+gui_internal_button_attr_pressed(struct gui_priv *this, struct widget *w, void *data)
+{
+ if (w->is_on)
+ w->set_attr(w->instance, &w->off);
+ else
+ w->set_attr(w->instance, &w->on);
+ gui_internal_button_attr_update(this, w);
+
+}
+
+static struct widget *
+gui_internal_button_navit_attr_new(struct gui_priv *this, char *text, enum flags flags, struct attr *on, struct attr *off)
+{
+ struct graphics_image *image=NULL;
+ struct widget *ret;
+ if (!on && !off)
+ return NULL;
+ image=image_new_xs(this, "gui_inactive");
+ ret=gui_internal_button_new_with_callback(this, text, image, flags, gui_internal_button_attr_pressed, NULL);
+ if (on)
+ ret->on=*on;
+ if (off)
+ ret->off=*off;
+ ret->get_attr=(int (*)(void *, enum attr_type, struct attr *, struct attr_iter *))navit_get_attr;
+ ret->set_attr=(int (*)(void *, struct attr *))navit_set_attr;
+ ret->remove_cb=(void (*)(void *, struct callback *))navit_remove_callback;
+ ret->instance=this->nav;
+ ret->cb=callback_new_attr_2(callback_cast(gui_internal_button_attr_callback), on?on->type:off->type, this, ret);
+ navit_add_callback(this->nav, ret->cb);
+ gui_internal_button_attr_update(this, ret);
+ return ret;
+}
+
+static struct widget *
+gui_internal_button_map_attr_new(struct gui_priv *this, char *text, enum flags flags, struct map *map, struct attr *on, struct attr *off, int deflt)
+{
+ struct graphics_image *image=NULL;
+ struct widget *ret;
+ image=image_new_xs(this, "gui_inactive");
+ if (!on && !off)
+ return NULL;
+ ret=gui_internal_button_new_with_callback(this, text, image, flags, gui_internal_button_attr_pressed, NULL);
+ if (on)
+ ret->on=*on;
+ if (off)
+ ret->off=*off;
+ ret->deflt=deflt;
+ ret->get_attr=(int (*)(void *, enum attr_type, struct attr *, struct attr_iter *))map_get_attr;
+ ret->set_attr=(int (*)(void *, struct attr *))map_set_attr;
+ ret->remove_cb=(void (*)(void *, struct callback *))map_remove_callback;
+ ret->instance=map;
+ ret->redraw=1;
+ ret->cb=callback_new_attr_2(callback_cast(gui_internal_button_attr_callback), on?on->type:off->type, this, ret);
+ map_add_callback(map, ret->cb);
+ gui_internal_button_attr_update(this, ret);
+ return ret;
+}
+
+static struct widget *
+gui_internal_button_new(struct gui_priv *this, char *text, struct graphics_image *image, enum flags flags)
+{
+ return gui_internal_button_new_with_callback(this, text, image, flags, NULL, NULL);
+}
+
+#if 0
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void gui_internal_clear(struct gui_priv *this)
+{
+ struct graphics *gra=this->gra;
+ struct point pnt;
+ pnt.x=0;
+ pnt.y=0;
+ graphics_draw_rectangle(gra, this->background, &pnt, this->root.w, this->root.h);
+}
+#endif
+
+static struct widget *
+gui_internal_find_widget(struct widget *wi, struct point *p, int flags)
+{
+ struct widget *ret,*child;
+ GList *l=wi->children;
+
+ if (p) {
+ if (wi->p.x > p->x )
+ return NULL;
+ if (wi->p.y > p->y )
+ return NULL;
+ if ( wi->p.x + wi->w < p->x)
+ return NULL;
+ if ( wi->p.y + wi->h < p->y)
+ return NULL;
+ }
+ if (wi->state & flags)
+ return wi;
+ while (l) {
+ child=l->data;
+ ret=gui_internal_find_widget(child, p, flags);
+ if (ret) {
+ return ret;
+ }
+ l=g_list_next(l);
+ }
+ return NULL;
+
+}
+
+static void
+gui_internal_highlight_do(struct gui_priv *this, struct widget *found)
+{
+ if (found == this->highlighted)
+ return;
+
+ graphics_draw_mode(this->gra, draw_mode_begin);
+ if (this->highlighted) {
+ this->highlighted->state &= ~STATE_HIGHLIGHTED;
+ if (this->root.children && this->highlighted_menu == g_list_last(this->root.children)->data)
+ gui_internal_widget_render(this, this->highlighted);
+ this->highlighted=NULL;
+ this->highlighted_menu=NULL;
+ }
+ if (found) {
+ this->highlighted=found;
+ this->highlighted_menu=g_list_last(this->root.children)->data;
+ this->highlighted->state |= STATE_HIGHLIGHTED;
+ gui_internal_widget_render(this, this->highlighted);
+ dbg(1,"%d,%d %dx%d\n", found->p.x, found->p.y, found->w, found->h);
+ }
+ graphics_draw_mode(this->gra, draw_mode_end);
+}
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void gui_internal_highlight(struct gui_priv *this)
+{
+ struct widget *menu,*found=NULL;
+ if (this->current.x > -1 && this->current.y > -1) {
+ menu=g_list_last(this->root.children)->data;
+ found=gui_internal_find_widget(menu, &this->current, STATE_SENSITIVE);
+ }
+ gui_internal_highlight_do(this, found);
+ this->motion_timeout_event=NULL;
+}
+
+static struct widget *
+gui_internal_box_new_with_label(struct gui_priv *this, enum flags flags, char *label)
+{
+ struct widget *widget=g_new0(struct widget, 1);
+
+ if (label)
+ widget->text=g_strdup(label);
+ widget->type=widget_box;
+ widget->flags=flags;
+ return widget;
+}
+
+static struct widget *
+gui_internal_box_new(struct gui_priv *this, enum flags flags)
+{
+ return gui_internal_box_new_with_label(this, flags, NULL);
+}
+
+
+static void gui_internal_box_render(struct gui_priv *this, struct widget *w)
+{
+ struct widget *wc;
+ GList *l;
+
+ gui_internal_background_render(this, w);
+#if 1
+ if (w->foreground && w->border) {
+ struct point pnt[5];
+ pnt[0]=w->p;
+ pnt[1].x=pnt[0].x+w->w;
+ pnt[1].y=pnt[0].y;
+ pnt[2].x=pnt[0].x+w->w;
+ pnt[2].y=pnt[0].y+w->h;
+ pnt[3].x=pnt[0].x;
+ pnt[3].y=pnt[0].y+w->h;
+ pnt[4]=pnt[0];
+ graphics_gc_set_linewidth(w->foreground, w->border ? w->border : 1);
+ graphics_draw_lines(this->gra, w->foreground, pnt, 5);
+ graphics_gc_set_linewidth(w->foreground, 1);
+ }
+#endif
+
+ l=w->children;
+ while (l) {
+ wc=l->data;
+ gui_internal_widget_render(this, wc);
+ l=g_list_next(l);
+ }
+}
+
+
+/**
+ * @brief Compute the size and location for the widget.
+ *
+ *
+ */
+static void gui_internal_box_pack(struct gui_priv *this, struct widget *w)
+{
+ struct widget *wc;
+ int x0,x=0,y=0,width=0,height=0,owidth=0,oheight=0,expand=0,count=0,rows=0,cols=w->cols ? w->cols : 0;
+ GList *l;
+ int orientation=w->flags & 0xffff0000;
+
+ if (!cols)
+ cols=this->cols;
+ if (!cols) {
+ height=navit_get_height(this->nav);
+ width=navit_get_width(this->nav);
+ if ( (height/width) > 1.0 )
+ cols=3;
+ else
+ cols=2;
+ width=0;
+ height=0;
+ }
+
+
+ /**
+ * count the number of children
+ */
+ l=w->children;
+ while (l) {
+ count++;
+ l=g_list_next(l);
+ }
+ if (orientation == orientation_horizontal_vertical && count <= cols)
+ orientation=orientation_horizontal;
+ switch (orientation) {
+ case orientation_horizontal:
+ /**
+ * For horizontal orientation:
+ * pack each child and find the largest height and
+ * compute the total width. x spacing (spx) is considered
+ *
+ * If any children want to be expanded
+ * we keep track of this
+ */
+ l=w->children;
+ while (l) {
+ wc=l->data;
+ gui_internal_widget_pack(this, wc);
+ if (height < wc->h)
+ height=wc->h;
+ width+=wc->w;
+ if (wc->flags & flags_expand)
+ expand+=wc->w ? wc->w : 1;
+ l=g_list_next(l);
+ if (l)
+ width+=w->spx;
+ }
+ owidth=width;
+ if (expand && w->w) {
+ expand=100*(w->w-width+expand)/expand;
+ owidth=w->w;
+ } else
+ expand=100;
+ break;
+ case orientation_vertical:
+ /**
+ * For vertical layouts:
+ * We pack each child and compute the largest width and
+ * the total height. y spacing (spy) is considered
+ *
+ * If the expand flag is set then teh expansion amount
+ * is computed.
+ */
+ l=w->children;
+ while (l) {
+ wc=l->data;
+ gui_internal_widget_pack(this, wc);
+ if (width < wc->w)
+ width=wc->w;
+ height+=wc->h;
+ if (wc->flags & flags_expand)
+ expand+=wc->h ? wc->h : 1;
+ l=g_list_next(l);
+ if (l)
+ height+=w->spy;
+ }
+ oheight=height;
+ if (expand && w->h) {
+ expand=100*(w->h-height+expand)/expand;
+ oheight=w->h;
+ } else
+ expand=100;
+ break;
+ case orientation_horizontal_vertical:
+ /**
+ * For horizontal_vertical orientation
+ * pack the children.
+ * Compute the largest height and largest width.
+ * Layout the widgets based on having the
+ * number of columns specified by (cols)
+ */
+ count=0;
+ l=w->children;
+ while (l) {
+ wc=l->data;
+ gui_internal_widget_pack(this, wc);
+ if (height < wc->h)
+ height=wc->h;
+ if (width < wc->w)
+ width=wc->w;
+ l=g_list_next(l);
+ count++;
+ }
+ if (count < cols)
+ cols=count;
+ rows=(count+cols-1)/cols;
+ width*=cols;
+ height*=rows;
+ width+=w->spx*(cols-1);
+ height+=w->spy*(rows-1);
+ owidth=width;
+ oheight=height;
+ expand=100;
+ break;
+ default:
+ /**
+ * No orientation was specified.
+ * width and height are both 0.
+ * The width & height of this widget
+ * will be used.
+ */
+ if(!w->w && !w->h)
+ dbg(0,"Warning width and height of a widget are 0");
+ break;
+ }
+ if (! w->w && ! w->h) {
+ w->w=w->bl+w->br+width;
+ w->h=w->bt+w->bb+height;
+ }
+
+ /**
+ * At this stage the width and height of this
+ * widget has been computed.
+ * We now make a second pass assigning heights,
+ * widths and coordinates to each child widget.
+ */
+
+ if (w->flags & gravity_left)
+ x=w->p.x+w->bl;
+ if (w->flags & gravity_xcenter)
+ x=w->p.x+w->w/2-owidth/2;
+ if (w->flags & gravity_right)
+ x=w->p.x+w->w-w->br-owidth;
+ if (w->flags & gravity_top)
+ y=w->p.y+w->bt;
+ if (w->flags & gravity_ycenter)
+ y=w->p.y+w->h/2-oheight/2;
+ if (w->flags & gravity_bottom)
+ y=w->p.y+w->h-w->bb-oheight;
+ l=w->children;
+ switch (orientation) {
+ case orientation_horizontal:
+ l=w->children;
+ while (l) {
+ wc=l->data;
+ wc->p.x=x;
+ if (wc->flags & flags_fill)
+ wc->h=w->h;
+ if (wc->flags & flags_expand) {
+ if (! wc->w)
+ wc->w=1;
+ wc->w=wc->w*expand/100;
+ }
+ if (w->flags & gravity_top)
+ wc->p.y=y;
+ if (w->flags & gravity_ycenter)
+ wc->p.y=y-wc->h/2;
+ if (w->flags & gravity_bottom)
+ wc->p.y=y-wc->h;
+ x+=wc->w+w->spx;
+ l=g_list_next(l);
+ }
+ break;
+ case orientation_vertical:
+ l=w->children;
+ while (l) {
+ wc=l->data;
+ wc->p.y=y;
+ if (wc->flags & flags_fill)
+ wc->w=w->w;
+ if (wc->flags & flags_expand) {
+ if (! wc->h)
+ wc->h=1;
+ wc->h=wc->h*expand/100;
+ }
+ if (w->flags & gravity_left)
+ wc->p.x=x;
+ if (w->flags & gravity_xcenter)
+ wc->p.x=x-wc->w/2;
+ if (w->flags & gravity_right)
+ wc->p.x=x-wc->w;
+ y+=wc->h+w->spy;
+ l=g_list_next(l);
+ }
+ break;
+ case orientation_horizontal_vertical:
+ l=w->children;
+ x0=x;
+ count=0;
+ width/=cols;
+ height/=rows;
+ while (l) {
+ wc=l->data;
+ wc->p.x=x;
+ wc->p.y=y;
+ if (wc->flags & flags_fill) {
+ wc->w=width;
+ wc->h=height;
+ }
+ if (w->flags & gravity_left)
+ wc->p.x=x;
+ if (w->flags & gravity_xcenter)
+ wc->p.x=x+(width-wc->w)/2;
+ if (w->flags & gravity_right)
+ wc->p.x=x+width-wc->w;
+ if (w->flags & gravity_top)
+ wc->p.y=y;
+ if (w->flags & gravity_ycenter)
+ wc->p.y=y+(height-wc->h)/2;
+ if (w->flags & gravity_bottom)
+ wc->p.y=y-height-wc->h;
+ x+=width;
+ if (++count == cols) {
+ count=0;
+ x=x0;
+ y+=height;
+ }
+ l=g_list_next(l);
+ }
+ break;
+ default:
+ break;
+ }
+ /**
+ * Call pack again on each child,
+ * the child has now had its size and coordinates
+ * set so they can repack their children.
+ */
+ l=w->children;
+ while (l) {
+ wc=l->data;
+ gui_internal_widget_pack(this, wc);
+ l=g_list_next(l);
+ }
+}
+
+static void
+gui_internal_widget_append(struct widget *parent, struct widget *child)
+{
+ if (! child)
+ return;
+ if (! child->background)
+ child->background=parent->background;
+ parent->children=g_list_append(parent->children, child);
+}
+
+static void gui_internal_widget_prepend(struct widget *parent, struct widget *child)
+{
+ if (! child->background)
+ child->background=parent->background;
+ parent->children=g_list_prepend(parent->children, child);
+}
+
+static void gui_internal_widget_children_destroy(struct gui_priv *this, struct widget *w)
+{
+ GList *l;
+ struct widget *wc;
+
+ l=w->children;
+ while (l) {
+ wc=l->data;
+ gui_internal_widget_destroy(this, wc);
+ l=g_list_next(l);
+ }
+ g_list_free(w->children);
+ w->children=NULL;
+}
+
+static void gui_internal_widget_destroy(struct gui_priv *this, struct widget *w)
+{
+ gui_internal_widget_children_destroy(this, w);
+ g_free(w->speech);
+ g_free(w->text);
+ if (w->img)
+ graphics_image_free(this->gra, w->img);
+ if (w->prefix)
+ g_free(w->prefix);
+ if (w->name)
+ g_free(w->name);
+ if (w->data_free)
+ w->data_free(w->data);
+ if (w->cb && w->remove_cb)
+ w->remove_cb(w->instance, w->cb);
+ if(w->free)
+ w->free(this,w);
+ else
+ g_free(w);
+}
+
+
+static void
+gui_internal_widget_render(struct gui_priv *this, struct widget *w)
+{
+ if(w->p.x > navit_get_width(this->nav) || w->p.y > navit_get_height(this->nav))
+ return;
+
+ switch (w->type) {
+ case widget_box:
+ gui_internal_box_render(this, w);
+ break;
+ case widget_label:
+ gui_internal_label_render(this, w);
+ break;
+ case widget_image:
+ gui_internal_image_render(this, w);
+ break;
+ case widget_table:
+ gui_internal_table_render(this,w);
+ break;
+ default:
+ break;
+ }
+}
+
+static void
+gui_internal_widget_pack(struct gui_priv *this, struct widget *w)
+{
+ switch (w->type) {
+ case widget_box:
+ gui_internal_box_pack(this, w);
+ break;
+ case widget_table:
+ gui_internal_table_pack(this,w);
+ default:
+ break;
+ }
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void gui_internal_call_highlighted(struct gui_priv *this)
+{
+ if (! this->highlighted || ! this->highlighted->func)
+ return;
+ this->highlighted->reason=1;
+ this->highlighted->func(this, this->highlighted, this->highlighted->data);
+}
+
+static void
+gui_internal_say(struct gui_priv *this, struct widget *w, int questionmark)
+{
+ char *text=w->speech;
+ if (! this->speech)
+ return;
+ if (!text)
+ text=w->text;
+ if (!text)
+ text=w->name;
+ if (text) {
+ text=g_strdup_printf("%s%c", text, questionmark ? '?':'\0');
+ navit_say(this->nav, text);
+ g_free(text);
+ }
+}
+
+static void
+gui_internal_prune_menu(struct gui_priv *this, struct widget *w)
+{
+ GList *l;
+ struct widget *wr;
+ gui_internal_search_idle_end(this);
+ while ((l = g_list_last(this->root.children))) {
+ if (l->data == w) {
+ void (*redisplay)(struct gui_priv *priv, struct widget *widget, void *data);
+ gui_internal_say(this, w, 0);
+ redisplay=w->menu_data->redisplay;
+ wr=w->menu_data->redisplay_widget;
+ if (!w->menu_data->redisplay) {
+ gui_internal_widget_render(this, w);
+ return;
+ }
+ gui_internal_widget_destroy(this, l->data);
+ this->root.children=g_list_remove(this->root.children, l->data);
+ redisplay(this, wr, wr->data);
+ return;
+ }
+ gui_internal_widget_destroy(this, l->data);
+ this->root.children=g_list_remove(this->root.children, l->data);
+ }
+}
+
+static void
+gui_internal_prune_menu_count(struct gui_priv *this, int count, int render)
+{
+ GList *l;
+ gui_internal_search_idle_end(this);
+ while ((l = g_list_last(this->root.children)) && count-- > 0) {
+ gui_internal_widget_destroy(this, l->data);
+ this->root.children=g_list_remove(this->root.children, l->data);
+ }
+ if (l && render) {
+ gui_internal_say(this, l->data, 0);
+ gui_internal_widget_render(this, l->data);
+ }
+}
+
+static void
+gui_internal_back(struct gui_priv *this, struct widget *w, void *data)
+{
+ gui_internal_prune_menu_count(this, 1, 1);
+}
+
+static void
+gui_internal_cmd_return(struct gui_priv *this, struct widget *wm, void *data)
+{
+ gui_internal_prune_menu(this, wm->data);
+}
+
+static void
+gui_internal_cmd_main_menu(struct gui_priv *this, struct widget *wm, void *data)
+{
+ gui_internal_prune_menu(this, this->root.children->data);
+}
+
+static struct widget *
+gui_internal_top_bar(struct gui_priv *this)
+{
+ struct widget *w,*wm,*wh,*wc,*wcn;
+ int dots_len, sep_len;
+ GList *res=NULL,*l;
+ int width,width_used=0,use_sep=0,incomplete=0;
+ struct graphics_gc *foreground=(this->flags & 256 ? this->background : this->text_foreground);
+/* flags
+ 1:Don't expand bar to screen width
+ 2:Don't show Map Icon
+ 4:Don't show Home Icon
+ 8:Show only current menu
+ 16:Don't use menu titles as button
+ 32:Show navit version
+ 64:Show time
+ 128:Show help
+ 256:Use background for menu headline
+ 512:Set osd_configuration and zoom to route when setting position
+*/
+
+ w=gui_internal_box_new(this, gravity_left_center|orientation_horizontal|(this->flags & 1 ? 0:flags_fill));
+ w->bl=this->spacing;
+ w->spx=this->spacing;
+ w->background=this->background2;
+ if ((this->flags & 6) == 6) {
+ w->bl=10;
+ w->br=10;
+ w->bt=6;
+ w->bb=6;
+ }
+ width=this->root.w-w->bl;
+ if (! (this->flags & 2)) {
+ wm=gui_internal_button_new_with_callback(this, NULL,
+ image_new_s(this, "gui_map"), gravity_center|orientation_vertical,
+ gui_internal_cmd_return, NULL);
+ wm->speech=g_strdup(_("Back to map"));
+ gui_internal_widget_pack(this, wm);
+ gui_internal_widget_append(w, wm);
+ width-=wm->w;
+ }
+ if (! (this->flags & 4)) {
+ wh=gui_internal_button_new_with_callback(this, NULL,
+ image_new_s(this, "gui_home"), gravity_center|orientation_vertical,
+ gui_internal_cmd_main_menu, NULL);
+ wh->speech=g_strdup(_("Main Menu"));
+ gui_internal_widget_pack(this, wh);
+ gui_internal_widget_append(w, wh);
+ width-=wh->w;
+ }
+ if (!(this->flags & 6))
+ width-=w->spx;
+ l=g_list_last(this->root.children);
+ wcn=gui_internal_label_new(this,".. »");
+ wcn->foreground=foreground;
+ dots_len=wcn->w;
+ gui_internal_widget_destroy(this, wcn);
+ wcn=gui_internal_label_new(this,"»");
+ wcn->foreground=foreground;
+ sep_len=wcn->w;
+ gui_internal_widget_destroy(this, wcn);
+ while (l) {
+ if (g_list_previous(l) || !g_list_next(l)) {
+ wc=l->data;
+ wcn=gui_internal_label_new(this, wc->text);
+ wcn->foreground=foreground;
+ if (g_list_next(l))
+ use_sep=1;
+ else
+ use_sep=0;
+ dbg(1,"%d (%s) + %d + %d + %d > %d\n", wcn->w, wc->text, width_used, w->spx, use_sep ? sep_len : 0, width);
+ if (wcn->w + width_used + w->spx + (use_sep ? sep_len : 0) + (g_list_previous(l) ? dots_len : 0) > width) {
+ incomplete=1;
+ gui_internal_widget_destroy(this, wcn);
+ break;
+ }
+ if (use_sep) {
+ struct widget *wct=gui_internal_label_new(this, "»");
+ wct->foreground=foreground;
+ res=g_list_prepend(res, wct);
+ width_used+=sep_len+w->spx;
+ }
+ width_used+=wcn->w;
+ if (!(this->flags & 16)) {
+ wcn->func=gui_internal_cmd_return;
+ wcn->data=wc;
+ wcn->state |= STATE_SENSITIVE;
+ }
+ res=g_list_prepend(res, wcn);
+ if (this->flags & 8)
+ break;
+ }
+ l=g_list_previous(l);
+ }
+ if (incomplete) {
+ if (! res) {
+ wcn=gui_internal_label_new_abbrev(this, wc->text, width-width_used-w->spx-dots_len);
+ wcn->foreground=foreground;
+ wcn->func=gui_internal_cmd_return;
+ wcn->data=wc;
+ wcn->state |= STATE_SENSITIVE;
+ res=g_list_prepend(res, wcn);
+ l=g_list_previous(l);
+ wc=l->data;
+ }
+ wcn=gui_internal_label_new(this, ".. »");
+ wcn->foreground=foreground;
+ wcn->func=gui_internal_cmd_return;
+ wcn->data=wc;
+ wcn->state |= STATE_SENSITIVE;
+ res=g_list_prepend(res, wcn);
+ }
+ l=res;
+ while (l) {
+ gui_internal_widget_append(w, l->data);
+ l=g_list_next(l);
+ }
+ if (this->flags & 32) {
+ extern char *version;
+ char *version_text=g_strdup_printf("Navit %s",version);
+ wcn=gui_internal_label_new(this, version_text);
+ g_free(version_text);
+ wcn->flags=gravity_right_center|flags_expand;
+ gui_internal_widget_append(w, wcn);
+ }
+#if 0
+ if (dots)
+ gui_internal_widget_destroy(this, dots);
+#endif
+ return w;
+}
+
+static struct widget *
+gui_internal_time_help(struct gui_priv *this)
+{
+ struct widget *w,*wc,*wcn;
+ char timestr[64];
+ struct tm *tm;
+ time_t timep;
+
+ w=gui_internal_box_new(this, gravity_right_center|orientation_horizontal|flags_fill);
+ w->bl=this->spacing;
+ w->spx=this->spacing;
+ w->spx=10;
+ w->bl=10;
+ w->br=10;
+ w->bt=6;
+ w->bb=6;
+ if (this->flags & 64) {
+ wc=gui_internal_box_new(this, gravity_right_top|orientation_vertical|flags_fill);
+ wc->bl=10;
+ wc->br=20;
+ wc->bt=6;
+ wc->bb=6;
+ timep=time(NULL);
+ tm=localtime(&timep);
+ strftime(timestr, 64, "%H:%M %d.%m.%Y", tm);
+ wcn=gui_internal_label_new(this, timestr);
+ gui_internal_widget_append(wc, wcn);
+ gui_internal_widget_append(w, wc);
+ }
+ if (this->flags & 128) {
+ wcn=gui_internal_button_new_with_callback(this, _("Help"), image_new_l(this, "gui_help"), gravity_center|orientation_vertical|flags_fill, NULL, NULL);
+ gui_internal_widget_append(w, wcn);
+ }
+ return w;
+}
+
+
+/**
+ * Applys the configuration values to this based on the settings
+ * specified in the configuration file (this->config) and
+ * the most approriate default profile based on screen resolution.
+ *
+ * This function should be run after this->root is setup and could
+ * be rerun after the window is resized.
+ *
+ * @authors Steve Singer <ssinger_pg@sympatico.ca> (09/2008)
+ */
+static void gui_internal_apply_config(struct gui_priv *this)
+{
+ struct gui_config_settings * current_config=0;
+
+ dbg(0,"w=%d h=%d\n", this->root.w, this->root.h);
+ /**
+ * Select default values from profile based on the screen.
+ */
+ if((this->root.w > 320 || this->root.h > 320) && this->root.w > 240 && this->root.h > 240)
+ {
+ if((this->root.w > 640 || this->root.h > 640) && this->root.w > 480 && this->root.h > 480 )
+ {
+ current_config = &config_profiles[LARGE_PROFILE];
+ }
+ else
+ {
+ current_config = &config_profiles[MEDIUM_PROFILE];
+ }
+ }
+ else
+ {
+ current_config = &config_profiles[SMALL_PROFILE];
+ }
+
+ /**
+ * Apply override values from config file
+ */
+ if(this->config.font_size == -1 )
+ {
+ this->font_size = current_config->font_size;
+ }
+ else
+ {
+ this->font_size = this->config.font_size;
+ }
+
+ if(this->config.icon_xs == -1 )
+ {
+ this->icon_xs = current_config->icon_xs;
+ }
+ else
+ {
+ this->icon_xs = this->config.icon_xs;
+ }
+
+ if(this->config.icon_s == -1 )
+ {
+ this->icon_s = current_config->icon_s;
+ }
+ else
+ {
+ this->icon_s = this->config.icon_s;
+ }
+ if(this->config.icon_l == -1 )
+ {
+ this->icon_l = current_config->icon_l;
+ }
+ else
+ {
+ this->icon_l = this->config.icon_l;
+ }
+ if(this->config.spacing == -1 )
+ {
+ this->spacing = current_config->spacing;
+ }
+ else
+ {
+ this->spacing = current_config->spacing;
+ }
+
+}
+
+static struct widget *
+gui_internal_button_label(struct gui_priv *this, char *label, int mode)
+{
+ struct widget *wl,*wlb;
+ struct widget *wb=gui_internal_menu_data(this)->button_bar;
+ wlb=gui_internal_box_new(this, gravity_right_center|orientation_vertical);
+ wl=gui_internal_label_new(this, label);
+ wlb->border=1;
+ wlb->foreground=this->text_foreground;
+ wlb->bl=20;
+ wlb->br=20;
+ wlb->bb=6;
+ wlb->bt=6;
+ gui_internal_widget_append(wlb, wl);
+ if (mode == 1)
+ gui_internal_widget_prepend(wb, wlb);
+ if (mode == -1)
+ gui_internal_widget_append(wb, wlb);
+
+ return wlb;
+}
+
+
+static struct widget *
+gui_internal_menu(struct gui_priv *this, char *label)
+{
+ struct widget *menu,*w,*w1,*topbox;
+
+ gui_internal_search_idle_end(this);
+ topbox=gui_internal_box_new_with_label(this, 0, label);
+ topbox->w=this->root.w;
+ topbox->h=this->root.h;
+ gui_internal_widget_append(&this->root, topbox);
+ menu=gui_internal_box_new(this, gravity_left_center|orientation_vertical);
+ menu->w=this->root.w;
+ menu->h=this->root.h;
+ menu->background=this->background;
+ gui_internal_apply_config(this);
+ this->font=graphics_font_new(this->gra,this->font_size,1);
+ topbox->menu_data=g_new0(struct menu_data, 1);
+ gui_internal_widget_append(topbox, menu);
+ w=gui_internal_top_bar(this);
+ gui_internal_widget_append(menu, w);
+ w=gui_internal_box_new(this, gravity_center|orientation_horizontal_vertical|flags_expand|flags_fill);
+ w->spx=4*this->spacing;
+ w->w=menu->w;
+ gui_internal_widget_append(menu, w);
+ if (this->flags & 16) {
+ struct widget *wlb,*wb,*wm=w;
+ wm->flags=gravity_center|orientation_vertical|flags_expand|flags_fill;
+ w=gui_internal_box_new(this, gravity_center|orientation_horizontal|flags_expand|flags_fill);
+ dbg(0,"topbox->menu_data=%p\n", topbox->menu_data);
+ gui_internal_widget_append(wm, w);
+ wb=gui_internal_box_new(this, gravity_right_center|orientation_horizontal|flags_fill);
+ wb->bl=6;
+ wb->br=6;
+ wb->bb=6;
+ wb->bt=6;
+ wb->spx=6;
+ topbox->menu_data->button_bar=wb;
+ gui_internal_widget_append(wm, wb);
+ wlb=gui_internal_button_label(this,_("Back"),1);
+ wlb->func=gui_internal_back;
+ wlb->state |= STATE_SENSITIVE;
+ }
+ if (this->flags & 192) {
+ menu=gui_internal_box_new(this, gravity_left_center|orientation_vertical);
+ menu->w=this->root.w;
+ menu->h=this->root.h;
+ w1=gui_internal_time_help(this);
+ gui_internal_widget_append(menu, w1);
+ w1=gui_internal_box_new(this, gravity_center|orientation_horizontal_vertical|flags_expand|flags_fill);
+ gui_internal_widget_append(menu, w1);
+ gui_internal_widget_append(topbox, menu);
+ menu->background=NULL;
+ }
+ return w;
+}
+
+static struct menu_data *
+gui_internal_menu_data(struct gui_priv *this)
+{
+ GList *l;
+ struct widget *menu;
+
+ l=g_list_last(this->root.children);
+ menu=l->data;
+ return menu->menu_data;
+}
+
+static void
+gui_internal_menu_render(struct gui_priv *this)
+{
+ GList *l;
+ struct widget *menu;
+
+ l=g_list_last(this->root.children);
+ menu=l->data;
+ gui_internal_say(this, menu, 0);
+ gui_internal_widget_pack(this, menu);
+ gui_internal_widget_render(this, menu);
+}
+
+static void
+gui_internal_cmd_set_destination(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct widget *w=wm->data;
+ dbg(0,"c=%d:0x%x,0x%x\n", w->c.pro, w->c.x, w->c.y);
+ navit_set_destination(this->nav, &w->c, w->name, 1);
+ if (this->flags & 512) {
+ struct attr follow;
+ follow.type=attr_follow;
+ follow.u.num=180;
+ navit_set_attr(this->nav, &this->osd_configuration);
+ navit_set_attr(this->nav, &follow);
+ navit_zoom_to_route(this->nav, 0);
+ }
+ gui_internal_prune_menu(this, NULL);
+}
+
+static void
+gui_internal_cmd_set_position(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct widget *w=wm->data;
+ navit_set_position(this->nav, &w->c);
+ gui_internal_prune_menu(this, NULL);
+}
+
+static void
+gui_internal_cmd_add_bookmark_do(struct gui_priv *this, struct widget *widget)
+{
+ GList *l;
+ dbg(0,"text='%s'\n", widget->text);
+ if (widget->text && strlen(widget->text))
+ navit_add_bookmark(this->nav, &widget->c, widget->text);
+ g_free(widget->text);
+ widget->text=NULL;
+ l=g_list_previous(g_list_last(this->root.children));
+ gui_internal_prune_menu(this, l->data);
+}
+
+static void
+gui_internal_cmd_add_bookmark_clicked(struct gui_priv *this, struct widget *widget, void *data)
+{
+ gui_internal_cmd_add_bookmark_do(this, widget->data);
+}
+
+static void
+gui_internal_cmd_add_bookmark_changed(struct gui_priv *this, struct widget *wm, void *data)
+{
+ int len;
+ dbg(1,"enter\n");
+ if (wm->text) {
+ len=strlen(wm->text);
+ dbg(1,"len=%d\n", len);
+ if (len && (wm->text[len-1] == '\n' || wm->text[len-1] == '\r')) {
+ wm->text[len-1]='\0';
+ gui_internal_cmd_add_bookmark_do(this, wm);
+ }
+ }
+}
+
+
+static struct widget * gui_internal_keyboard(struct gui_priv *this, int mode);
+
+static void
+gui_internal_cmd_add_bookmark(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct widget *w,*wb,*wk,*wl,*we,*wnext,*wp=wm->data;
+ wb=gui_internal_menu(this, "Add Bookmark");
+ w=gui_internal_box_new(this, gravity_left_top|orientation_vertical|flags_expand|flags_fill);
+ gui_internal_widget_append(wb, w);
+ we=gui_internal_box_new(this, gravity_left_center|orientation_horizontal|flags_fill);
+ gui_internal_widget_append(w, we);
+ gui_internal_widget_append(we, wk=gui_internal_label_new(this, wp->name ? wp->name : wp->text));
+ wk->state |= STATE_EDIT|STATE_CLEAR;
+ wk->background=this->background;
+ wk->flags |= flags_expand|flags_fill;
+ wk->func = gui_internal_cmd_add_bookmark_changed;
+ wk->c=wm->c;
+ gui_internal_widget_append(we, wnext=gui_internal_image_new(this, image_new_xs(this, "gui_active")));
+ wnext->state |= STATE_SENSITIVE;
+ wnext->func = gui_internal_cmd_add_bookmark_clicked;
+ wnext->data=wk;
+ wl=gui_internal_box_new(this, gravity_left_top|orientation_vertical|flags_expand|flags_fill);
+ gui_internal_widget_append(w, wl);
+ if (this->keyboard)
+ gui_internal_widget_append(w, gui_internal_keyboard(this,2));
+ gui_internal_menu_render(this);
+}
+
+
+static void
+get_direction(char *buffer, int angle, int mode)
+{
+ angle=angle%360;
+ switch (mode) {
+ case 0:
+ sprintf(buffer,"%d",angle);
+ break;
+ case 1:
+ if (angle < 69 || angle > 291)
+ *buffer++='N';
+ if (angle > 111 && angle < 249)
+ *buffer++='S';
+ if (angle > 22 && angle < 158)
+ *buffer++='E';
+ if (angle > 202 && angle < 338)
+ *buffer++='W';
+ *buffer++='\0';
+ break;
+ case 2:
+ angle=(angle+15)/30;
+ if (! angle)
+ angle=12;
+ sprintf(buffer,"%d H", angle);
+ break;
+ }
+}
+
+struct selector {
+ char *icon;
+ char *name;
+ enum item_type *types;
+} selectors[]={
+ {"bank","Bank",(enum item_type []){type_poi_bank,type_poi_bank,type_none}},
+ {"fuel","Fuel",(enum item_type []){type_poi_fuel,type_poi_fuel,type_none}},
+ {"hotel","Hotel",(enum item_type []) {
+ type_poi_hotel,type_poi_camp_rv,
+ type_poi_camping,type_poi_camping,
+ type_poi_resort,type_poi_resort,
+ type_poi_motel,type_poi_hostel,
+ type_none}},
+ {"restaurant","Restaurant",(enum item_type []) {
+ type_poi_bar,type_poi_picnic,
+ type_poi_burgerking,type_poi_fastfood,
+ type_poi_restaurant,type_poi_restaurant,
+ type_none}},
+ {"shopping","Shopping",(enum item_type []) {
+ type_poi_mall,type_poi_mall,
+ type_poi_shop_grocery,type_poi_shop_grocery,
+ type_none}},
+ {"hospital","Service",(enum item_type []) {
+ type_poi_marina,type_poi_marina,
+ type_poi_hospital,type_poi_hospital,
+ type_poi_public_utilities,type_poi_public_utilities,
+ type_poi_police,type_poi_autoservice,
+ type_poi_information,type_poi_information,
+ type_poi_personal_service,type_poi_repair_service,
+ type_poi_rest_room,type_poi_rest_room,
+ type_poi_restroom,type_poi_restroom,
+ type_none}},
+ {"parking","Parking",(enum item_type []){type_poi_car_parking,type_poi_car_parking,type_none}},
+ {"peak","Land Features",(enum item_type []){
+ type_poi_land_feature,type_poi_rock,
+ type_poi_dam,type_poi_dam,
+ type_none}},
+ {"unknown","Other",(enum item_type []){
+ type_point_unspecified,type_poi_land_feature-1,
+ type_poi_rock+1,type_poi_fuel-1,
+ type_poi_marina+1,type_poi_car_parking-1,
+ type_poi_car_parking+1,type_poi_bar-1,
+ type_poi_bank+1,type_poi_dam-1,
+ type_poi_dam+1,type_poi_information-1,
+ type_poi_information+1,type_poi_mall-1,
+ type_poi_mall+1,type_poi_personal_service-1,
+ type_poi_restaurant+1,type_poi_restroom-1,
+ type_poi_restroom+1,type_poi_shop_grocery-1,
+ type_poi_shop_grocery+1,type_poi_motel-1,
+ type_poi_hostel+1,type_selected_point,
+ type_none}},
+};
+
+static void gui_internal_cmd_pois(struct gui_priv *this, struct widget *wm, void *data);
+
+static struct widget *
+gui_internal_cmd_pois_selector(struct gui_priv *this, struct pcoord *c)
+{
+ struct widget *wl,*wb;
+ int i;
+ wl=gui_internal_box_new(this, gravity_left_center|orientation_horizontal|flags_fill);
+ for (i = 0 ; i < sizeof(selectors)/sizeof(struct selector) ; i++) {
+ gui_internal_widget_append(wl, wb=gui_internal_button_new_with_callback(this, NULL,
+ image_new_xs(this, selectors[i].icon), gravity_left_center|orientation_vertical,
+ gui_internal_cmd_pois, &selectors[i]));
+ wb->c=*c;
+ wb->bt=10;
+ }
+ return wl;
+}
+
+static struct widget *
+gui_internal_cmd_pois_item(struct gui_priv *this, struct coord *center, struct item *item, struct coord *c, int dist)
+{
+ char distbuf[32];
+ char dirbuf[32];
+ char *type;
+ struct attr attr;
+ struct widget *wl;
+ char *text;
+
+ wl=gui_internal_box_new(this, gravity_left_center|orientation_horizontal|flags_fill);
+
+ sprintf(distbuf,"%d", dist/1000);
+ get_direction(dirbuf, transform_get_angle_delta(center, c, 0), 1);
+ type=item_to_name(item->type);
+ if (item_attr_get(item, attr_label, &attr)) {
+ wl->name=g_strdup_printf("%s %s",type,attr.u.str);
+ } else {
+ attr.u.str="";
+ wl->name=g_strdup(type);
+ }
+ text=g_strdup_printf("%s %s %s %s", distbuf, dirbuf, type, attr.u.str);
+ gui_internal_widget_append(wl, gui_internal_label_new(this, text));
+ g_free(text);
+
+ return wl;
+}
+
+static gint
+gui_internal_cmd_pois_sort_num(gconstpointer a, gconstpointer b, gpointer user_data)
+{
+ const struct widget *wa=a;
+ const struct widget *wb=b;
+ struct widget *wac=wa->children->data;
+ struct widget *wbc=wb->children->data;
+ int ia,ib;
+ ia=atoi(wac->text);
+ ib=atoi(wbc->text);
+
+ return ia-ib;
+}
+
+static int
+gui_internal_cmd_pois_item_selected(struct selector *sel, enum item_type type)
+{
+ enum item_type *types;
+ if (type >= type_line)
+ return 0;
+ if (! sel || !sel->types)
+ return 1;
+ types=sel->types;
+ while (*types != type_none) {
+ if (type >= types[0] && type <= types[1]) {
+ return 1;
+ }
+ types+=2;
+ }
+ return 0;
+}
+
+static void gui_internal_cmd_position(struct gui_priv *this, struct widget *wm, void *data);
+
+static void
+gui_internal_cmd_pois(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct map_selection *sel,*selm;
+ struct coord c,center;
+ struct mapset_handle *h;
+ struct map *m;
+ struct map_rect *mr;
+ struct item *item;
+ int idist,dist=20000;
+ struct widget *wi,*w,*w2,*wb;
+ enum projection pro=wm->c.pro;
+ struct selector *isel=wm->data;
+
+ wb=gui_internal_menu(this, isel ? isel->name : _("POIs"));
+ w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
+ gui_internal_widget_append(wb, w);
+ if (! isel)
+ gui_internal_widget_append(w, gui_internal_cmd_pois_selector(this,&wm->c));
+ w2=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
+ gui_internal_widget_append(w, w2);
+
+ sel=map_selection_rect_new(&wm->c, dist, 18);
+ center.x=wm->c.x;
+ center.y=wm->c.y;
+ h=mapset_open(navit_get_mapset(this->nav));
+ while ((m=mapset_next(h, 1))) {
+ selm=map_selection_dup_pro(sel, pro, map_projection(m));
+ mr=map_rect_new(m, selm);
+ dbg(2,"mr=%p\n", mr);
+ if (mr) {
+ while ((item=map_rect_get_item(mr))) {
+ if (gui_internal_cmd_pois_item_selected(isel, item->type) &&
+ item_coord_get_pro(item, &c, 1, pro) &&
+ coord_rect_contains(&sel->u.c_rect, &c) &&
+ (idist=transform_distance(pro, &center, &c)) < dist) {
+ gui_internal_widget_append(w2, wi=gui_internal_cmd_pois_item(this, &center, item, &c, idist));
+ wi->func=gui_internal_cmd_position;
+ wi->data=(void *)2;
+ wi->item=*item;
+ wi->state |= STATE_SENSITIVE;
+ wi->c.x=c.x;
+ wi->c.y=c.y;
+ wi->c.pro=pro;
+ }
+ }
+ map_rect_destroy(mr);
+ }
+ map_selection_destroy(selm);
+ }
+ map_selection_destroy(sel);
+ mapset_close(h);
+ w2->children=g_list_sort_with_data(w2->children, gui_internal_cmd_pois_sort_num, (void *)1);
+ gui_internal_menu_render(this);
+}
+
+static void
+gui_internal_cmd_view_on_map(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct widget *w=wm->data;
+ int highlight=(w->data == (void *)2 || w->data == (void *)3 || w->data == (void *)4);
+ if (highlight) {
+ graphics_clear_selection(this->gra, NULL);
+ graphics_add_selection(this->gra, &w->item, NULL);
+ }
+ navit_set_center(this->nav, &w->c, 1);
+ gui_internal_prune_menu(this, NULL);
+}
+
+
+static void
+gui_internal_cmd_view_attributes(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct widget *w,*wb;
+ struct map_rect *mr;
+ struct item *item;
+ struct attr attr;
+ char *text;
+
+ dbg(0,"item=%p 0x%x 0x%x\n", wm->item.map,wm->item.id_hi, wm->item.id_lo);
+ wb=gui_internal_menu(this, "Attributes");
+ w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
+ gui_internal_widget_append(wb, w);
+ mr=map_rect_new(wm->item.map, NULL);
+ item = map_rect_get_item_byid(mr, wm->item.id_hi, wm->item.id_lo);
+ dbg(0,"item=%p\n", item);
+ if (item) {
+ while(item_attr_get(item, attr_any, &attr)) {
+ text=g_strdup_printf("%s:%s", attr_to_name(attr.type), attr_to_text(&attr, wm->item.map, 1));
+ gui_internal_widget_append(w,
+ wb=gui_internal_button_new_with_callback(this, text,
+ NULL, gravity_left_center|orientation_horizontal|flags_fill,
+ gui_internal_cmd_view_attributes, NULL));
+ g_free(text);
+ }
+ }
+ map_rect_destroy(mr);
+ gui_internal_menu_render(this);
+}
+
+static void
+gui_internal_cmd_view_in_browser(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct map_rect *mr;
+ struct item *item;
+ struct attr attr;
+ char *cmd=NULL;
+
+ dbg(0,"item=%p 0x%x 0x%x\n", wm->item.map,wm->item.id_hi, wm->item.id_lo);
+ mr=map_rect_new(wm->item.map, NULL);
+ item = map_rect_get_item_byid(mr, wm->item.id_hi, wm->item.id_lo);
+ dbg(0,"item=%p\n", item);
+ if (item) {
+ while(item_attr_get(item, attr_url_local, &attr)) {
+ if (! cmd)
+ cmd=g_strdup_printf("navit-browser.sh '%s' &",attr.u.str);
+ }
+ }
+ map_rect_destroy(mr);
+ if (cmd) {
+#ifdef HAVE_SYSTEM
+ system(cmd);
+#else
+ dbg(0,"calling external cmd '%s' is not supported\n",cmd);
+#endif
+ g_free(cmd);
+ }
+}
+
+/* wm->data: 0 Nothing special
+ 1 Map Point
+ 2 Item
+ 3 Town
+*/
+
+
+static void
+gui_internal_cmd_position(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct widget *wb,*w,*wc,*wbc;
+ struct coord_geo g;
+ struct coord c;
+ char *coord,*name;
+ int display_attributes=(wm->data == (void *)2);
+ int display_view_on_map=(wm->data != (void *)1);
+ int display_items=(wm->data == (void *)1);
+ int display_streets=(wm->data == (void *)3);
+ int display_house_numbers=1;
+ if (wm->data == (void *)4) {
+ gui_internal_search_town_in_country(this, wm);
+ return;
+ }
+#if 0
+ switch ((int)wm->data) {
+ case 0:
+#endif
+ c.x=wm->c.x;
+ c.y=wm->c.y;
+ dbg(0,"x=0x%x y=0x%x\n", c.x, c.y);
+ transform_to_geo(wm->c.pro, &c, &g);
+#if 0
+ break;
+ case 1:
+ g=this->click;
+ break;
+ case 2:
+ g=this->vehicle;
+ break;
+ }
+#endif
+ name=wm->name ? wm->name : wm->text;
+ wb=gui_internal_menu(this, name);
+ w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
+ gui_internal_widget_append(wb, w);
+ coord=coordinates(&wm->c, ' ');
+ gui_internal_widget_append(w, gui_internal_label_new(this, coord));
+ g_free(coord);
+ if (display_streets) {
+ gui_internal_widget_append(w,
+ wc=gui_internal_button_new_with_callback(this, _("Streets"),
+ image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
+ gui_internal_search_street_in_town, wm));
+ wc->item=wm->item;
+ wc->selection_id=wm->selection_id;
+ }
+ if (display_house_numbers) {
+ gui_internal_widget_append(w,
+ wc=gui_internal_button_new_with_callback(this, _("House numbers"),
+ image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
+ gui_internal_search_house_number_in_street, wm));
+ wc->item=wm->item;
+ wc->selection_id=wm->selection_id;
+ }
+ if (display_attributes) {
+ struct map_rect *mr;
+ struct item *item;
+ struct attr attr;
+ mr=map_rect_new(wm->item.map, NULL);
+ item = map_rect_get_item_byid(mr, wm->item.id_hi, wm->item.id_lo);
+ if (item) {
+ if (item_attr_get(item, attr_description, &attr))
+ gui_internal_widget_append(w, gui_internal_label_new(this, attr.u.str));
+ if (item_attr_get(item, attr_url_local, &attr)) {
+ gui_internal_widget_append(w,
+ wb=gui_internal_button_new_with_callback(this, _("View in Browser"),
+ image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
+ gui_internal_cmd_view_in_browser, NULL));
+ wb->item=wm->item;
+ }
+ gui_internal_widget_append(w,
+ wb=gui_internal_button_new_with_callback(this, _("View Attributes"),
+ image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
+ gui_internal_cmd_view_attributes, NULL));
+ wb->item=wm->item;
+ }
+ map_rect_destroy(mr);
+ }
+ gui_internal_widget_append(w,
+ gui_internal_button_new_with_callback(this, _("Set as destination"),
+ image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
+ gui_internal_cmd_set_destination, wm));
+ gui_internal_widget_append(w,
+ gui_internal_button_new_with_callback(this, _("Set as position"),
+ image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
+ gui_internal_cmd_set_position, wm));
+ gui_internal_widget_append(w,
+ wbc=gui_internal_button_new_with_callback(this, _("Add as bookmark"),
+ image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
+ gui_internal_cmd_add_bookmark, wm));
+ wbc->c=wm->c;
+ gui_internal_widget_append(w,
+ wbc=gui_internal_button_new_with_callback(this, _("POIs"),
+ image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
+ gui_internal_cmd_pois, NULL));
+ wbc->c=wm->c;
+#if 0
+ gui_internal_widget_append(w,
+ gui_internal_button_new(this, "Add to tour",
+ image_new_o(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill));
+ gui_internal_widget_append(w,
+ gui_internal_button_new(this, "Add as bookmark",
+ image_new_o(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill));
+#endif
+ if (display_view_on_map) {
+ gui_internal_widget_append(w,
+ gui_internal_button_new_with_callback(this, _("View on map"),
+ image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
+ gui_internal_cmd_view_on_map, wm));
+ }
+ if (display_items) {
+ int dist=10;
+ struct mapset *ms;
+ struct mapset_handle *h;
+ struct map_rect *mr;
+ struct map *m;
+ struct item *item;
+ struct street_data *data;
+ struct map_selection sel;
+ struct transformation *trans;
+ enum projection pro;
+ struct attr attr;
+ char *label,*text;
+
+ trans=navit_get_trans(this->nav);
+ pro=transform_get_projection(trans);
+ transform_from_geo(pro, &g, &c);
+ ms=navit_get_mapset(this->nav);
+ sel.next=NULL;
+ sel.u.c_rect.lu.x=c.x-dist;
+ sel.u.c_rect.lu.y=c.y+dist;
+ sel.u.c_rect.rl.x=c.x+dist;
+ sel.u.c_rect.rl.y=c.y-dist;
+ sel.order=18;
+ sel.range=item_range_all;
+ h=mapset_open(ms);
+ while ((m=mapset_next(h,1))) {
+ mr=map_rect_new(m, &sel);
+ if (! mr)
+ continue;
+ while ((item=map_rect_get_item(mr))) {
+ data=street_get_data(item);
+ if (transform_within_dist_item(&c, item->type, data->c, data->count, dist)) {
+ if (item_attr_get(item, attr_label, &attr)) {
+ label=map_convert_string(m, attr.u.str);
+ text=g_strdup_printf("%s %s", item_to_name(item->type), label);
+ map_convert_free(label);
+ } else
+ text=g_strdup_printf("%s", item_to_name(item->type));
+ gui_internal_widget_append(w,
+ wc=gui_internal_button_new_with_callback(this, text,
+ image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
+ gui_internal_cmd_position, (void *)2));
+ wc->c.x=data->c[0].x;
+ wc->c.y=data->c[0].y;
+ wc->c.pro=pro;
+ wc->name=g_strdup(text);
+ wc->item=*item;
+ g_free(text);
+ }
+ street_data_free(data);
+ }
+ map_rect_destroy(mr);
+ }
+ mapset_close(h);
+ }
+
+ gui_internal_menu_render(this);
+}
+
+static void
+gui_internal_cmd_bookmarks(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct attr attr,mattr;
+ struct map_rect *mr=NULL;
+ struct item *item;
+ char *label_full,*l,*prefix,*pos;
+ int len,plen,hassub;
+ struct widget *wb,*w,*wbm;
+ GHashTable *hash;
+ struct coord c;
+
+
+ wb=gui_internal_menu(this, wm->text ? wm->text : _("Bookmarks"));
+ w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
+ w->spy=this->spacing*3;
+ gui_internal_widget_append(wb, w);
+
+ prefix=wm->prefix;
+ if (! prefix)
+ prefix="";
+ plen=strlen(prefix);
+
+ if(navit_get_attr(this->nav, attr_bookmark_map, &mattr, NULL) && mattr.u.map && (mr=map_rect_new(mattr.u.map, NULL))) {
+ hash=g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
+ while ((item=map_rect_get_item(mr))) {
+ if (item->type != type_bookmark) continue;
+ if (!item_attr_get(item, attr_label, &attr)) continue;
+ label_full=attr.u.str;
+ if (!strncmp(label_full, prefix, plen)) {
+ pos=strchr(label_full+plen, '/');
+ if (pos) {
+ hassub=1;
+ len=pos-label_full;
+ } else {
+ hassub=0;
+ len=strlen(label_full);
+ }
+ l=g_malloc(len-plen+1);
+ strncpy(l, label_full+plen, len-plen);
+ l[len-plen]='\0';
+ if (!g_hash_table_lookup(hash, l)) {
+ wbm=gui_internal_button_new_with_callback(this, l,
+ image_new_xs(this, hassub ? "gui_inactive" : "gui_active" ), gravity_left_center|orientation_horizontal|flags_fill,
+ hassub ? gui_internal_cmd_bookmarks : gui_internal_cmd_position, NULL);
+ if (item_coord_get(item, &c, 1)) {
+ wbm->c.x=c.x;
+ wbm->c.y=c.y;
+ wbm->c.pro=map_projection(mattr.u.map);
+ wbm->name=g_strdup_printf(_("Bookmark %s"),label_full);
+ wbm->text=g_strdup(l);
+ gui_internal_widget_append(w, wbm);
+ g_hash_table_insert(hash, g_strdup(l), (void *)1);
+ wbm->prefix=g_malloc(len+2);
+ strncpy(wbm->prefix, label_full, len+1);
+ wbm->prefix[len+1]='\0';
+ } else {
+ gui_internal_widget_destroy(this, wbm);
+ }
+ }
+ g_free(l);
+ }
+
+ }
+ g_hash_table_destroy(hash);
+ }
+ gui_internal_menu_render(this);
+}
+
+static void gui_internal_keypress_do(struct gui_priv *this, char *key)
+{
+ struct widget *wi,*menu;
+ int len=0;
+ char *text=NULL;
+
+ menu=g_list_last(this->root.children)->data;
+ wi=gui_internal_find_widget(menu, NULL, STATE_EDIT);
+ if (wi) {
+ if (*key == NAVIT_KEY_BACKSPACE) {
+ dbg(0,"backspace\n");
+ if (wi->text && wi->text[0]) {
+ len=g_utf8_prev_char(wi->text+strlen(wi->text))-wi->text;
+ wi->text[len]=' ';
+ text=g_strdup_printf("%s ", wi->text);
+ }
+ } else {
+ if (wi->state & STATE_CLEAR) {
+ dbg(0,"wi->state=0x%x\n", wi->state);
+ g_free(wi->text);
+ wi->text=NULL;
+ wi->state &= ~STATE_CLEAR;
+ dbg(0,"wi->state=0x%x\n", wi->state);
+ }
+ text=g_strdup_printf("%s%s", wi->text ? wi->text : "", key);
+ }
+ g_free(wi->text);
+ wi->text=text;
+ if (*key == NAVIT_KEY_BACKSPACE && wi->text) {
+ gui_internal_widget_render(this, wi);
+ wi->text[len]='\0';
+ }
+ if (wi->func) {
+ wi->reason=2;
+ wi->func(this, wi, wi->data);
+ }
+ gui_internal_widget_render(this, wi);
+ }
+}
+
+
+static void
+gui_internal_cmd_keypress(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct menu_data *md=gui_internal_menu_data(this);
+ gui_internal_keypress_do(this, (char *) wm->data);
+ if (md->keyboard_mode == 2)
+ gui_internal_keyboard_do(this, md->keyboard, 10);
+ if (md->keyboard_mode == 26)
+ gui_internal_keyboard_do(this, md->keyboard, 34);
+}
+
+static void
+gui_internal_search_idle_end(struct gui_priv *this)
+{
+ if (this->idle) {
+ event_remove_idle(this->idle);
+ this->idle=NULL;
+ }
+ if (this->idle_cb) {
+ callback_destroy(this->idle_cb);
+ this->idle_cb=NULL;
+ }
+}
+
+static void
+gui_internal_search_idle(struct gui_priv *this, char *wm_name, struct widget *search_list, void *param)
+{
+ char *text=NULL,*name=NULL;
+ struct search_list_result *res;
+ struct widget *wc;
+ struct item *item=NULL;
+ GList *l;
+ static int cpt_res = 0;
+ cpt_res ++;
+ static char possible_keys[256]="";
+
+ res=search_list_get_result(this->sl);
+ if (res) {
+ gchar* trunk_name = NULL;
+
+ struct widget *menu=g_list_last(this->root.children)->data;
+ struct widget *wi=gui_internal_find_widget(menu, NULL, STATE_EDIT);
+
+ if (! strcmp(wm_name,"Town"))
+ trunk_name = g_strrstr(res->town->name, wi->text);
+ if (! strcmp(wm_name,"Street"))
+ trunk_name = g_strrstr(name=res->street->name, wi->text);
+
+ if (trunk_name) {
+ char next_char = trunk_name[strlen(wi->text)];
+ int i;
+ int len = strlen(possible_keys);
+ for(i = 0; (i<len) && (possible_keys[i] != next_char) ;i++) ;
+ if (i==len || !len) {
+ possible_keys[len]=trunk_name[strlen(wi->text)];
+ possible_keys[len+1]='\0';
+
+ }
+ dbg(1,"%s %s possible_keys:%s \n", wi->text, res->town->name, possible_keys);
+ }
+ }
+
+ if (! res) {
+ gui_internal_search_idle_end(this);
+ cpt_res = 0;
+
+ struct menu_data *md=gui_internal_menu_data(this);
+ if (md && md->keyboard) {
+ GList *lk=md->keyboard->children;
+ graphics_draw_mode(this->gra, draw_mode_begin);
+ while (lk) {
+ struct widget *child=lk->data;
+ GList *lk2=child->children;
+ while (lk2) {
+ struct widget *child_=lk2->data;
+ lk2=g_list_next(lk2);
+ if (child_->data && strcmp("\b", child_->data)) { // FIXME don't disable special keys
+ if (strlen(possible_keys) == 0)
+ child_->state|= STATE_HIGHLIGHTED|STATE_VISIBLE|STATE_SENSITIVE|STATE_CLEAR ;
+ else if (g_strrstr(possible_keys, child_->data)!=NULL ) {
+ child_->state|= STATE_HIGHLIGHTED|STATE_VISIBLE|STATE_SENSITIVE|STATE_CLEAR ;
+ } else {
+ child_->state&= ~(STATE_HIGHLIGHTED|STATE_VISIBLE|STATE_SELECTED) ;
+ }
+ gui_internal_widget_render(this,child_);
+ }
+ }
+ lk=g_list_next(lk);
+ }
+ gui_internal_widget_render(this,md->keyboard);
+ graphics_draw_mode(this->gra, draw_mode_end);
+ }
+
+ possible_keys[0]='\0';
+ return;
+ }
+
+ if (! strcmp(wm_name,"Country")) {
+ name=res->country->name;
+ item=&res->country->common.item;
+ text=g_strdup_printf("%s", res->country->name);
+ }
+ if (! strcmp(wm_name,"Town")) {
+ name=res->town->name;
+ item=&res->town->common.item;
+ if (res->town->name && res->town->district)
+ text=g_strdup_printf("%s%s%s (%s)", res->town->common.postal_mask ? res->town->common.postal_mask : "", res->town->common.postal_mask ? " ":"", res->town->name, res->town->district);
+ else
+ text=g_strdup_printf("%s%s%s", res->town->common.postal ? res->town->common.postal_mask : "", res->town->common.postal_mask ? " ":"", res->town->name);
+ }
+ if (! strcmp(wm_name,"Street")) {
+ name=res->street->name;
+ item=&res->street->common.item;
+ text=g_strdup_printf("%s %s", res->town->name, res->street->name);
+ }
+ dbg(1,"res->country->flag=%s\n", res->country->flag);
+ if (cpt_res <= 2) {
+ gui_internal_widget_append(search_list,
+ wc=gui_internal_button_new_with_callback(this, text,
+ image_new_xs(this, res->country->flag),
+ gravity_left_center|orientation_horizontal|flags_fill,
+ gui_internal_cmd_position, param));
+ wc->name=g_strdup(name);
+ if (res->c)
+ wc->c=*res->c;
+ wc->selection_id=res->id;
+ if (item)
+ wc->item=*item;
+ gui_internal_widget_pack(this, search_list);
+ l=g_list_last(this->root.children);
+ graphics_draw_mode(this->gra, draw_mode_begin);
+ gui_internal_widget_render(this, l->data);
+ graphics_draw_mode(this->gra, draw_mode_end);
+ }
+ g_free(text);
+}
+
+static void
+gui_internal_search_idle_start(struct gui_priv *this, char *wm_name, struct widget *search_list, void *param)
+{
+ this->idle_cb=callback_new_4(callback_cast(gui_internal_search_idle), this, wm_name, search_list, param);
+ this->idle=event_add_idle(50,this->idle_cb);
+ callback_call_0(this->idle_cb);
+}
+
+
+/**
+ *
+ * @param wm The widget that generated the event for the search changed,
+ * if this was generated by a key on the virtual keyboard then
+ * wm is the key button widget.
+ */
+static void
+gui_internal_search_changed(struct gui_priv *this, struct widget *wm, void *data)
+{
+ GList *l;
+ struct widget *search_list=gui_internal_menu_data(this)->search_list;
+ gui_internal_widget_children_destroy(this, search_list);
+
+ void *param=(void *)3;
+ int minlen=1;
+ if (! strcmp(wm->name,"Country")) {
+ param=(void *)4;
+ minlen=1;
+ }
+ dbg(0,"%s now '%s'\n", wm->name, wm->text);
+
+ gui_internal_search_idle_end(this);
+ if (wm->text && g_utf8_strlen(wm->text, -1) >= minlen) {
+ struct attr search_attr;
+
+ dbg(0,"process\n");
+ if (! strcmp(wm->name,"Country"))
+ search_attr.type=attr_country_all;
+ if (! strcmp(wm->name,"Town"))
+ search_attr.type=attr_town_or_district_name;
+ if (! strcmp(wm->name,"Street"))
+ search_attr.type=attr_street_name;
+ if (! strcmp(wm->name,"House number"))
+ search_attr.type=attr_house_number;
+ search_attr.u.str=wm->text;
+ search_list_search(this->sl, &search_attr, 1);
+ gui_internal_search_idle_start(this, wm->name, search_list, param);
+ }
+ l=g_list_last(this->root.children);
+ gui_internal_widget_render(this, l->data);
+}
+
+static struct widget *
+gui_internal_keyboard_key_data(struct gui_priv *this, struct widget *wkbd, char *text, void(*func)(struct gui_priv *priv, struct widget *widget, void *data), void *data, void (*data_free)(void *data), int w, int h)
+{
+ struct widget *wk;
+ gui_internal_widget_append(wkbd, wk=gui_internal_button_new_with_callback(this, text,
+ NULL, gravity_center|orientation_vertical, func, data));
+ wk->data_free=data_free;
+ wk->background=this->background;
+ wk->bl=w/2;
+ wk->br=0;
+ wk->bt=h/2;
+ wk->bb=0;
+ return wk;
+}
+
+static struct widget *
+gui_internal_keyboard_key(struct gui_priv *this, struct widget *wkbd, char *text, char *key, int w, int h)
+{
+ return gui_internal_keyboard_key_data(this, wkbd, text, gui_internal_cmd_keypress, g_strdup(key), g_free,w,h);
+}
+
+static void gui_internal_keyboard_change(struct gui_priv *this, struct widget *key, void *data);
+
+// Some macros that make the keyboard layout easier to visualise in
+// the source code. The macros are #undef'd after this function.
+#define KEY(x) gui_internal_keyboard_key(this, wkbd, (x), (x), max_w, max_h)
+#define SPACER() gui_internal_keyboard_key_data(this, wkbd, "", NULL, NULL, NULL,max_w,max_h)
+static struct widget *
+gui_internal_keyboard_do(struct gui_priv *this, struct widget *wkbdb, int mode)
+{
+ struct widget *wkbd,*wk;
+ struct menu_data *md=gui_internal_menu_data(this);
+ int i, max_w=navit_get_width(this->nav), max_h=navit_get_height(this->nav);
+ int render=0;
+
+ if (wkbdb) {
+ this->current.x=-1;
+ this->current.y=-1;
+ gui_internal_highlight(this);
+ render=1;
+ gui_internal_widget_children_destroy(this, wkbdb);
+ } else
+ wkbdb=gui_internal_box_new(this, gravity_center|orientation_horizontal_vertical|flags_fill);
+ md->keyboard=wkbdb;
+ md->keyboard_mode=mode;
+ wkbd=gui_internal_box_new(this, gravity_center|orientation_horizontal_vertical|flags_fill);
+ wkbd->background=this->background;
+ wkbd->cols=8;
+ wkbd->spx=3;
+ wkbd->spy=3;
+ max_w=max_w/9;
+ max_h=max_h/6;
+
+ if (mode >= 0 && mode < 8) {
+ for (i = 0 ; i < 26 ; i++) {
+ char text[]={'A'+i,'\0'};
+ KEY(text);
+ }
+ gui_internal_keyboard_key(this, wkbd, "_"," ",max_w,max_h);
+ if (mode == 0) {
+ KEY("-");
+ KEY("'");
+ SPACER();
+ } else {
+ SPACER();
+ wk=gui_internal_keyboard_key_data(this, wkbd, "a", gui_internal_keyboard_change, wkbd, NULL,max_w,max_h);
+ wk->datai=mode+8;
+ wk=gui_internal_keyboard_key_data(this, wkbd, "1", gui_internal_keyboard_change, wkbd, NULL,max_w,max_h);
+ wk->datai=mode+16;
+ }
+ wk=gui_internal_keyboard_key_data(this, wkbd, "Ä",gui_internal_keyboard_change, wkbdb,NULL,max_w,max_h);
+ wk->datai=mode+24;
+ gui_internal_keyboard_key(this, wkbd, "<-","\b",max_w,max_h);
+ }
+ if (mode >= 8 && mode < 16) {
+ for (i = 0 ; i < 26 ; i++) {
+ char text[]={'a'+i,'\0'};
+ KEY(text);
+ }
+ gui_internal_keyboard_key(this, wkbd, "_"," ",max_w,max_h);
+ if (mode == 8) {
+ KEY("-");
+ KEY("'");
+ SPACER();
+ } else {
+ SPACER();
+ wk=gui_internal_keyboard_key_data(this, wkbd, "A", gui_internal_keyboard_change, wkbd, NULL,max_w,max_h);
+ wk->datai=mode-8;
+ wk=gui_internal_keyboard_key_data(this, wkbd, "1", gui_internal_keyboard_change, wkbd, NULL,max_w,max_h);
+ wk->datai=mode+8;
+ }
+ wk=gui_internal_keyboard_key_data(this, wkbd, "ä",gui_internal_keyboard_change,wkbdb,NULL,max_w,max_h);
+ wk->datai=mode+24;
+ gui_internal_keyboard_key(this, wkbd, "<-","\b",max_w,max_h);
+ }
+ if (mode >= 16 && mode < 24) {
+ for (i = 0 ; i < 10 ; i++) {
+ char text[]={'0'+i,'\0'};
+ KEY(text);
+ }
+ KEY("."); KEY("°"); KEY("'"); KEY("\""); KEY("-"); KEY("+");
+ KEY("*"); KEY("/"); KEY("("); KEY(")"); KEY("="); KEY("?");
+
+ for (i = 0 ; i < 5 ; i++) SPACER();
+
+ if (mode == 16) {
+ KEY("-");
+ KEY("'");
+ SPACER();
+ } else {
+ SPACER();
+ wk=gui_internal_keyboard_key_data(this, wkbd, "A", gui_internal_keyboard_change, wkbd, NULL,max_w,max_h);
+ wk->datai=mode-16;
+ wk=gui_internal_keyboard_key_data(this, wkbd, "a", gui_internal_keyboard_change, wkbd, NULL,max_w,max_h);
+ wk->datai=mode-8;
+ }
+ wk=gui_internal_keyboard_key_data(this, wkbd, "Ä",gui_internal_keyboard_change,wkbdb,NULL,max_w,max_h);
+ wk->datai=mode+8;
+ gui_internal_keyboard_key(this, wkbd, "<-","\b",max_w,max_h);
+ }
+ if (mode >= 24 && mode < 32) {
+ KEY("Ä"); KEY("Ë"); KEY("Ã"); KEY("Ö"); KEY("Ãœ"); KEY("Æ"); KEY("Ø"); KEY("Ã…");
+ KEY("Ã"); KEY("É"); KEY("Ã"); KEY("Ó"); KEY("Ú"); KEY("Å "); KEY("ÄŒ"); KEY("Ž");
+ KEY("À"); KEY("È"); KEY("Ì"); KEY("Ò"); KEY("Ù"); KEY("Ś"); KEY("Ć"); KEY("Ź");
+ KEY("Â"); KEY("Ê"); KEY("Î"); KEY("Ô"); KEY("Û"); SPACER();
+
+ wk=gui_internal_keyboard_key_data(this, wkbd, "A",gui_internal_keyboard_change,wkbdb,NULL,max_w,max_h);
+ wk->datai=mode-24;
+
+ gui_internal_keyboard_key(this, wkbd, "<-","\b",max_w,max_h);
+ }
+ if (mode >= 32 && mode < 40) {
+ KEY("ä"); KEY("ë"); KEY("ï"); KEY("ö"); KEY("ü"); KEY("æ"); KEY("ø"); KEY("å");
+ KEY("á"); KEY("é"); KEY("í"); KEY("ó"); KEY("ú"); KEY("Å¡"); KEY("Ä"); KEY("ž");
+ KEY("à"); KEY("è"); KEY("ì"); KEY("ò"); KEY("ù"); KEY("ś"); KEY("ć"); KEY("ź");
+ KEY("â"); KEY("ê"); KEY("î"); KEY("ô"); KEY("û"); SPACER();
+
+ wk=gui_internal_keyboard_key_data(this, wkbd, "a",gui_internal_keyboard_change,wkbdb,NULL,max_w,max_h);
+ wk->datai=mode-24;
+
+ gui_internal_keyboard_key(this, wkbd, "<-","\b",max_w,max_h);
+ }
+ gui_internal_widget_append(wkbdb, wkbd);
+ if (render) {
+ gui_internal_widget_pack(this, wkbdb);
+ gui_internal_widget_render(this, wkbdb);
+ }
+ return wkbdb;
+}
+#undef KEY
+#undef SPACER
+
+static struct widget *
+gui_internal_keyboard(struct gui_priv *this, int mode)
+{
+ if (! this->keyboard)
+ return NULL;
+ return gui_internal_keyboard_do(this, NULL, mode);
+}
+
+static void
+gui_internal_keyboard_change(struct gui_priv *this, struct widget *key, void *data)
+{
+ gui_internal_keyboard_do(this, key->data, key->datai);
+}
+
+static void
+gui_internal_search_list_set_default_country(struct gui_priv *this)
+{
+ struct attr search_attr, country_name, country_iso2, *country_attr;
+ struct item *item;
+ struct country_search *cs;
+ struct tracking *tracking;
+ struct search_list_result *res;
+
+ country_attr=country_default();
+ tracking=navit_get_tracking(this->nav);
+ if (tracking && tracking_get_attr(tracking, attr_country_id, &search_attr, NULL))
+ country_attr=&search_attr;
+ if (country_attr) {
+ cs=country_search_new(country_attr, 0);
+ item=country_search_get_item(cs);
+ if (item && item_attr_get(item, attr_country_name, &country_name)) {
+ search_attr.type=attr_country_all;
+ dbg(0,"country %s\n", country_name.u.str);
+ search_attr.u.str=country_name.u.str;
+ search_list_search(this->sl, &search_attr, 0);
+ while((res=search_list_get_result(this->sl)));
+ g_free(this->country_iso2);
+ if (item_attr_get(item, attr_country_iso2, &country_iso2))
+ this->country_iso2=g_strdup(country_iso2.u.str);
+ }
+ country_search_destroy(cs);
+ } else {
+ dbg(0,"warning: no default country found\n");
+ if (this->country_iso2) {
+ dbg(0,"attempting to use country '%s'\n",this->country_iso2);
+ search_attr.type=attr_country_iso2;
+ search_attr.u.str=this->country_iso2;
+ search_list_search(this->sl, &search_attr, 0);
+ while((res=search_list_get_result(this->sl)));
+ }
+ }
+}
+
+static void
+gui_internal_search_list_new(struct gui_priv *this)
+{
+ struct mapset *ms=navit_get_mapset(this->nav);
+ if (! this->sl) {
+ this->sl=search_list_new(ms);
+ gui_internal_search_list_set_default_country(this);
+ }
+}
+
+static void
+gui_internal_search_list_destroy(struct gui_priv *this)
+{
+ if (this->sl) {
+ search_list_destroy(this->sl);
+ this->sl=NULL;
+ }
+}
+
+
+static void
+gui_internal_search(struct gui_priv *this, char *what, char *type, int flags)
+{
+ struct widget *wb,*wk,*w,*wr,*we,*wl,*wnext=NULL;
+ char *country;
+ gui_internal_search_list_new(this);
+ wb=gui_internal_menu(this, what);
+ w=gui_internal_box_new(this, gravity_center|orientation_vertical|flags_expand|flags_fill);
+ gui_internal_widget_append(wb, w);
+ wr=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
+ gui_internal_widget_append(w, wr);
+ we=gui_internal_box_new(this, gravity_left_center|orientation_horizontal|flags_fill);
+ gui_internal_widget_append(wr, we);
+
+ if (!strcmp(type,"Country")) {
+ wnext=gui_internal_image_new(this, image_new_xs(this, "gui_select_town"));
+ wnext->func=gui_internal_search_town;
+ } else if (!strcmp(type,"Town")) {
+ if (this->country_iso2)
+ country=g_strdup_printf("country_%s", this->country_iso2);
+ else
+ country=strdup("gui_select_country");
+ gui_internal_widget_append(we, wb=gui_internal_image_new(this, image_new_xs(this, country)));
+ wb->state |= STATE_SENSITIVE;
+ if (flags)
+ wb->func = gui_internal_search_country;
+ else
+ wb->func = gui_internal_back;
+ wnext=gui_internal_image_new(this, image_new_xs(this, "gui_select_street"));
+ wnext->func=gui_internal_search_street;
+ g_free(country);
+ } else if (!strcmp(type,"Street")) {
+ gui_internal_widget_append(we, wb=gui_internal_image_new(this, image_new_xs(this, "gui_select_town")));
+ wb->state |= STATE_SENSITIVE;
+ wb->func = gui_internal_back;
+ wnext=gui_internal_image_new(this, image_new_xs(this, "gui_select_house_number"));
+ wnext->func=gui_internal_search_house_number;
+ } else if (!strcmp(type,"House number")) {
+ gui_internal_widget_append(we, wb=gui_internal_image_new(this, image_new_xs(this, "gui_select_street")));
+ wb->state |= STATE_SENSITIVE;
+ wb->func = gui_internal_back;
+ }
+ gui_internal_widget_append(we, wk=gui_internal_label_new(this, NULL));
+ if (wnext) {
+ gui_internal_widget_append(we, wnext);
+ wnext->state |= STATE_SENSITIVE;
+ }
+ wl=gui_internal_box_new(this, gravity_left_top|orientation_vertical|flags_expand|flags_fill);
+ gui_internal_widget_append(wr, wl);
+ gui_internal_menu_data(this)->search_list=wl;
+ wk->state |= STATE_EDIT;
+ wk->background=this->background;
+ wk->flags |= flags_expand|flags_fill;
+ wk->func = gui_internal_search_changed;
+ wk->name=g_strdup(type);
+ if (this->keyboard)
+ gui_internal_widget_append(w, gui_internal_keyboard(this,2));
+ gui_internal_menu_render(this);
+}
+
+static void
+gui_internal_search_house_number(struct gui_priv *this, struct widget *widget, void *data)
+{
+ search_list_select(this->sl, attr_street_name, 0, 0);
+ gui_internal_search(this,_("House number"),"House number",0);
+}
+
+static void
+gui_internal_search_house_number_in_street(struct gui_priv *this, struct widget *widget, void *data)
+{
+ dbg(0,"id %d\n", widget->selection_id);
+ search_list_select(this->sl, attr_street_name, 0, 0);
+ search_list_select(this->sl, attr_street_name, widget->selection_id, 1);
+ gui_internal_search(this,_("House number"),"House number",0);
+}
+
+static void
+gui_internal_search_street(struct gui_priv *this, struct widget *widget, void *data)
+{
+ search_list_select(this->sl, attr_town_or_district_name, 0, 0);
+ gui_internal_search(this,_("Street"),"Street",0);
+}
+
+static void
+gui_internal_search_street_in_town(struct gui_priv *this, struct widget *widget, void *data)
+{
+ dbg(0,"id %d\n", widget->selection_id);
+ search_list_select(this->sl, attr_town_or_district_name, 0, 0);
+ search_list_select(this->sl, attr_town_or_district_name, widget->selection_id, 1);
+ gui_internal_search(this,_("Street"),"Street",0);
+}
+
+static void
+gui_internal_search_town(struct gui_priv *this, struct widget *wm, void *data)
+{
+ if (this->sl)
+ search_list_select(this->sl, attr_country_all, 0, 0);
+ g_free(this->country_iso2);
+ this->country_iso2=NULL;
+ gui_internal_search(this,_("Town"),"Town",0);
+}
+
+static void
+gui_internal_search_town_in_country(struct gui_priv *this, struct widget *widget)
+{
+ struct search_list_common *slc;
+ dbg(0,"id %d\n", widget->selection_id);
+ search_list_select(this->sl, attr_country_all, 0, 0);
+ slc=search_list_select(this->sl, attr_country_all, widget->selection_id, 1);
+ if (slc) {
+ g_free(this->country_iso2);
+ this->country_iso2=((struct search_list_country *)slc)->iso2;
+ }
+ gui_internal_search(this,widget->name,"Town",0);
+}
+
+static void
+gui_internal_search_country(struct gui_priv *this, struct widget *widget, void *data)
+{
+ gui_internal_prune_menu_count(this, 1, 0);
+ gui_internal_search(this,_("Country"),"Country",0);
+}
+
+static void
+gui_internal_cmd_town(struct gui_priv *this, struct widget *wm, void *data)
+{
+ if (this->sl)
+ search_list_select(this->sl, attr_country_all, 0, 0);
+ gui_internal_search(this,_("Town"),"Town",1);
+}
+
+static void
+gui_internal_cmd_layout(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct attr attr;
+ struct widget *w,*wb,*wl;
+ struct attr_iter *iter;
+
+
+ wb=gui_internal_menu(this, _("Layout"));
+ w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
+ w->spy=this->spacing*3;
+ gui_internal_widget_append(wb, w);
+ iter=navit_attr_iter_new();
+ while(navit_get_attr(this->nav, attr_layout, &attr, iter)) {
+ wl=gui_internal_button_navit_attr_new(this, attr.u.layout->name, gravity_left_center|orientation_horizontal|flags_fill,
+ &attr, NULL);
+ gui_internal_widget_append(w, wl);
+ }
+ navit_attr_iter_destroy(iter);
+ gui_internal_menu_render(this);
+}
+
+static void
+gui_internal_cmd_fullscreen(struct gui_priv *this, struct widget *wm, void *data)
+{
+ graphics_draw_mode(this->gra, draw_mode_end);
+ this->fullscreen=!this->fullscreen;
+ this->win->fullscreen(this->win, this->fullscreen);
+ graphics_draw_mode(this->gra, draw_mode_begin);
+}
+
+static void
+gui_internal_cmd_2d(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct transformation *trans=navit_get_trans(this->nav);
+ transform_set_pitch(trans, 0);
+ this->redraw=1;
+}
+
+static void
+gui_internal_cmd_3d(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct transformation *trans=navit_get_trans(this->nav);
+ transform_set_pitch(trans, this->pitch);
+ this->redraw=1;
+}
+
+static void
+gui_internal_cmd_display(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct widget *w;
+ struct transformation *trans;
+
+ w=gui_internal_menu(this, _("Display"));
+ gui_internal_widget_append(w,
+ gui_internal_button_new_with_callback(this, _("Layout"),
+ image_new_l(this, "gui_display"), gravity_center|orientation_vertical,
+ gui_internal_cmd_layout, NULL));
+ if (this->fullscreen) {
+ gui_internal_widget_append(w,
+ gui_internal_button_new_with_callback(this, _("Window Mode"),
+ image_new_l(this, "gui_leave_fullscreen"), gravity_center|orientation_vertical,
+ gui_internal_cmd_fullscreen, NULL));
+ } else {
+ gui_internal_widget_append(w,
+ gui_internal_button_new_with_callback(this, _("Fullscreen"),
+ image_new_l(this, "gui_fullscreen"), gravity_center|orientation_vertical,
+ gui_internal_cmd_fullscreen, NULL));
+ }
+ trans=navit_get_trans(this->nav);
+ if (transform_get_pitch(trans)) {
+ gui_internal_widget_append(w,
+ gui_internal_button_new_with_callback(this, _("2D"),
+ image_new_l(this, "gui_map"), gravity_center|orientation_vertical,
+ gui_internal_cmd_2d, NULL));
+
+ } else {
+ gui_internal_widget_append(w,
+ gui_internal_button_new_with_callback(this, _("3D"),
+ image_new_l(this, "gui_map"), gravity_center|orientation_vertical,
+ gui_internal_cmd_3d, NULL));
+ }
+ gui_internal_menu_render(this);
+}
+
+static void
+gui_internal_cmd_quit(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct navit *nav=this->nav;
+ navit_destroy(nav);
+ main_remove_navit(nav);
+}
+
+static void
+gui_internal_cmd_abort_navigation(struct gui_priv *this, struct widget *wm, void *data)
+{
+ navit_set_destination(this->nav, NULL, NULL, 0);
+}
+
+
+static void
+gui_internal_cmd_actions(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct widget *w,*wc;
+ char *coord;
+
+ w=gui_internal_menu(this, _("Actions"));
+ gui_internal_widget_append(w,
+ gui_internal_button_new_with_callback(this, _("Bookmarks"),
+ image_new_l(this, "gui_bookmark"), gravity_center|orientation_vertical,
+ gui_internal_cmd_bookmarks, NULL));
+ if (this->clickp_valid) {
+ coord=coordinates(&this->clickp, '\n');
+ gui_internal_widget_append(w,
+ wc=gui_internal_button_new_with_callback(this, coord,
+ image_new_l(this, "gui_map"), gravity_center|orientation_vertical,
+ gui_internal_cmd_position, (void *)1));
+ wc->name=g_strdup(_("Map Point"));
+ wc->c=this->clickp;
+ g_free(coord);
+ }
+ if (this->vehicle_valid) {
+ coord=coordinates(&this->vehiclep, '\n');
+ gui_internal_widget_append(w,
+ wc=gui_internal_button_new_with_callback(this, coord,
+ image_new_l(this, "gui_vehicle"), gravity_center|orientation_vertical,
+ gui_internal_cmd_position, NULL));
+ wc->name=g_strdup(_("Vehicle Position"));
+ wc->c=this->vehiclep;
+ g_free(coord);
+ }
+ gui_internal_widget_append(w,
+ gui_internal_button_new_with_callback(this, _("Town"),
+ image_new_l(this, "gui_town"), gravity_center|orientation_vertical,
+ gui_internal_cmd_town, NULL));
+ gui_internal_widget_append(w,
+ gui_internal_button_new_with_callback(this, _("Quit"),
+ image_new_l(this, "gui_quit"), gravity_center|orientation_vertical,
+ gui_internal_cmd_quit, NULL));
+
+ if (navit_check_route(this->nav)) {
+ gui_internal_widget_append(w,
+ gui_internal_button_new_with_callback(this, _("Stop\nNavigation"),
+ image_new_l(this, "gui_stop"), gravity_center|orientation_vertical,
+ gui_internal_cmd_abort_navigation, NULL));
+ }
+ gui_internal_menu_render(this);
+}
+
+static void
+gui_internal_cmd_maps(struct gui_priv *this, struct widget *wm, void *wdata)
+{
+ struct attr attr, on, off, description, type, data;
+ struct widget *w,*wb,*wma;
+ char *label;
+ struct attr_iter *iter;
+
+
+ wb=gui_internal_menu(this, _("Maps"));
+ w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
+ w->spy=this->spacing*3;
+ gui_internal_widget_append(wb, w);
+ iter=navit_attr_iter_new();
+ on.type=off.type=attr_active;
+ on.u.num=1;
+ off.u.num=0;
+ while(navit_get_attr(this->nav, attr_map, &attr, iter)) {
+ if (map_get_attr(attr.u.map, attr_description, &description, NULL)) {
+ label=g_strdup(description.u.str);
+ } else {
+ if (!map_get_attr(attr.u.map, attr_type, &type, NULL))
+ type.u.str="";
+ if (!map_get_attr(attr.u.map, attr_data, &data, NULL))
+ data.u.str="";
+ label=g_strdup_printf("%s:%s", type.u.str, data.u.str);
+ }
+ wma=gui_internal_button_map_attr_new(this, label, gravity_left_center|orientation_horizontal|flags_fill,
+ attr.u.map, &on, &off, 1);
+ gui_internal_widget_append(w, wma);
+ g_free(label);
+ }
+ navit_attr_iter_destroy(iter);
+ gui_internal_menu_render(this);
+
+}
+static void
+gui_internal_cmd_set_active_vehicle(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct attr vehicle = {attr_vehicle,{wm->data}};
+ navit_set_attr(this->nav, &vehicle);
+}
+
+static void
+gui_internal_cmd_show_satellite_status(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct widget *w,*wb,*row;
+ struct attr attr,sat_attr;
+ struct vehicle *v=wm->data;
+ char *str;
+ int i;
+ enum attr_type types[]={attr_sat_prn, attr_sat_elevation, attr_sat_azimuth, attr_sat_snr};
+
+ wb=gui_internal_menu(this, _("Show Satellite Status"));
+ gui_internal_menu_data(this)->redisplay=gui_internal_cmd_show_satellite_status;
+ gui_internal_menu_data(this)->redisplay_widget=wm;
+ w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
+ gui_internal_widget_append(wb, w);
+ w = gui_internal_widget_table_new(this,gravity_center | orientation_vertical | flags_expand | flags_fill, 0);
+ row = gui_internal_widget_table_row_new(this,gravity_left_top);
+ gui_internal_widget_append(row, gui_internal_label_new(this, " PRN "));
+ gui_internal_widget_append(row, gui_internal_label_new(this, " Elevation "));
+ gui_internal_widget_append(row, gui_internal_label_new(this, " Azimuth "));
+ gui_internal_widget_append(row, gui_internal_label_new(this, " SNR "));
+ gui_internal_widget_append(w,row);
+ while (vehicle_get_attr(v, attr_position_sat_item, &attr, NULL)) {
+ row = gui_internal_widget_table_row_new(this,gravity_left_top);
+ for (i = 0 ; i < sizeof(types)/sizeof(enum attr_type) ; i++) {
+ if (item_attr_get(attr.u.item, types[i], &sat_attr))
+ str=g_strdup_printf("%d", sat_attr.u.num);
+ else
+ str=g_strdup("");
+ gui_internal_widget_append(row, gui_internal_label_new(this, str));
+ g_free(str);
+ }
+ gui_internal_widget_append(w,row);
+ }
+ gui_internal_widget_append(wb, w);
+ gui_internal_menu_render(this);
+}
+
+static void
+gui_internal_cmd_show_nmea_data(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct widget *w,*wb;
+ struct attr attr;
+ struct vehicle *v=wm->data;
+ wb=gui_internal_menu(this, _("Show NMEA Data"));
+ gui_internal_menu_data(this)->redisplay=gui_internal_cmd_show_nmea_data;
+ gui_internal_menu_data(this)->redisplay_widget=wm;
+ w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
+ gui_internal_widget_append(wb, w);
+ if (vehicle_get_attr(v, attr_position_nmea, &attr, NULL))
+ gui_internal_widget_append(w, gui_internal_text_new(this, attr.u.str, gravity_left_center|orientation_vertical));
+ gui_internal_menu_render(this);
+}
+
+/**
+ * A container to hold the selected vehicle and the desired profile in
+ * one data item.
+ */
+struct vehicle_and_profilename {
+ struct vehicle *vehicle;
+ char *profilename;
+};
+
+/**
+ * Figures out whether the given vehicle is the active vehicle.
+ *
+ * @return true if the vehicle is active, false otherwise.
+ */
+static int
+gui_internal_is_active_vehicle(struct gui_priv *this, struct vehicle
+ *vehicle)
+{
+ struct attr active_vehicle;
+
+ if (!navit_get_attr(this->nav, attr_vehicle, &active_vehicle, NULL))
+ active_vehicle.u.vehicle=NULL;
+
+ return active_vehicle.u.vehicle == vehicle;
+}
+
+
+/**
+ * Reacts to a button press that changes a vehicle's active profile.
+ *
+ * @see gui_internal_add_vehicle_profile
+ */
+static void
+gui_internal_cmd_set_active_profile(struct gui_priv *this, struct
+ widget *wm, void *data)
+{
+ struct vehicle_and_profilename *vapn = data;
+ struct vehicle *v = vapn->vehicle;
+ char *profilename = vapn->profilename;
+ struct attr vehicle_name_attr;
+ char *vehicle_name = NULL;
+
+ // Get the vehicle name
+ vehicle_get_attr(v, attr_name, &vehicle_name_attr, NULL);
+ vehicle_name = vehicle_name_attr.u.str;
+
+ dbg(0, "Changing vehicle %s to profile %s\n", vehicle_name,
+ profilename);
+
+ // Change the profile name
+ struct attr profilename_attr = {attr_profilename, {profilename}};
+ if(!vehicle_set_attr(v, &profilename_attr, NULL)) {
+ dbg(0, "Unable to set the vehicle's profile name\n");
+ }
+
+ // Notify Navit that the routing should be re-done if this is the
+ // active vehicle.
+ if(gui_internal_is_active_vehicle(this, v)) {
+ struct attr vehicle = {attr_vehicle, {v}};
+ navit_set_attr(this->nav, &vehicle);
+ }
+}
+
+/**
+ * Adds the vehicle profile to the GUI, allowing the user to pick a
+ * profile for the currently selected vehicle.
+ */
+static void
+gui_internal_add_vehicle_profile(struct gui_priv *this, struct widget
+ *parent, struct vehicle *v, struct vehicleprofile *profile)
+{
+ // Just here to show up in the translation file, nice and close to
+ // where the translations are actually used.
+ struct attr profile_attr;
+ struct attr *attr = NULL;
+ char *name = NULL;
+ char *active_profile = NULL;
+ char *label = NULL;
+ int active;
+ struct vehicle_and_profilename *context = NULL;
+
+ static char *__profile_translations[] = {
+ _n("car"), _n("bike"), _n("pedestrian")
+ };
+
+ // Figure out the profile name
+ attr = attr_search(profile->attrs, NULL, attr_name);
+ name = attr->u.str;
+
+ // Determine whether the profile is the active one
+ vehicle_get_attr(v, attr_profilename, &profile_attr, NULL);
+ active_profile = profile_attr.u.str;
+ active = strcmp(name, active_profile) == 0;
+
+ dbg(0, "Adding vehicle profile %s, active=%s/%i\n", name,
+ active_profile, active);
+
+ // Build a translatable label.
+ if(active) {
+ label = g_strdup_printf(_("Current profile: %s"), _(name));
+ } else {
+ label = g_strdup_printf(_("Change profile to: %s"), _(name));
+ }
+
+ // Create the context object (the vehicle and the desired profile)
+ context = g_new0(struct vehicle_and_profilename, 1);
+ context->vehicle = v;
+ context->profilename = name;
+
+ // Add the button
+ gui_internal_widget_append(parent,
+ gui_internal_button_new_with_callback(
+ this, label,
+ image_new_xs(this, active ? "gui_active" : "gui_inactive"),
+ gravity_left_center|orientation_horizontal|flags_fill,
+ gui_internal_cmd_set_active_profile, context));
+
+ free(label);
+}
+
+static void
+gui_internal_cmd_vehicle_settings(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct widget *w,*wb;
+ struct attr attr;
+ struct vehicle *v=wm->data;
+ struct vehicleprofile *profile = NULL;
+
+ wb=gui_internal_menu(this, wm->text);
+ w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
+ gui_internal_widget_append(wb, w);
+
+ // Add the "Set as active" button if this isn't the active
+ // vehicle.
+ if (!gui_internal_is_active_vehicle(this, v)) {
+ gui_internal_widget_append(w,
+ gui_internal_button_new_with_callback(this, _("Set as active"),
+ image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
+ gui_internal_cmd_set_active_vehicle, wm->data));
+ }
+
+ if (vehicle_get_attr(v, attr_position_sat_item, &attr, NULL)) {
+ gui_internal_widget_append(w,
+ gui_internal_button_new_with_callback(this, _("Show Satellite status"),
+ image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
+ gui_internal_cmd_show_satellite_status, wm->data));
+ }
+ if (vehicle_get_attr(v, attr_position_nmea, &attr, NULL)) {
+ gui_internal_widget_append(w,
+ gui_internal_button_new_with_callback(this, _("Show NMEA data"),
+ image_new_xs(this, "gui_active"), gravity_left_center|orientation_horizontal|flags_fill,
+ gui_internal_cmd_show_nmea_data, wm->data));
+ }
+
+ // Add all the possible vehicle profiles to the menu
+ GList *profiles = navit_get_vehicleprofiles(this->nav);
+ while(profiles) {
+ profile = (struct vehicleprofile *)profiles->data;
+ gui_internal_add_vehicle_profile(this, w, v, profile);
+ profiles = g_list_next(profiles);
+ }
+
+ callback_list_call_attr_2(this->cbl, attr_vehicle, w, wm->data);
+ gui_internal_menu_render(this);
+}
+
+static void
+gui_internal_cmd_vehicle(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct attr attr,vattr;
+ struct widget *w,*wb,*wl;
+ struct attr_iter *iter;
+ struct attr active_vehicle;
+
+
+ wb=gui_internal_menu(this, _("Vehicle"));
+ w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
+ w->spy=this->spacing*3;
+ gui_internal_widget_append(wb, w);
+ if (!navit_get_attr(this->nav, attr_vehicle, &active_vehicle, NULL))
+ active_vehicle.u.vehicle=NULL;
+ iter=navit_attr_iter_new();
+ while(navit_get_attr(this->nav, attr_vehicle, &attr, iter)) {
+ vehicle_get_attr(attr.u.vehicle, attr_name, &vattr, NULL);
+ wl=gui_internal_button_new_with_callback(this, vattr.u.str,
+ image_new_l(this, attr.u.vehicle == active_vehicle.u.vehicle ? "gui_active" : "gui_inactive"), gravity_left_center|orientation_horizontal|flags_fill,
+ gui_internal_cmd_vehicle_settings, attr.u.vehicle);
+ wl->text=g_strdup(vattr.u.str);
+ gui_internal_widget_append(w, wl);
+ }
+ navit_attr_iter_destroy(iter);
+ gui_internal_menu_render(this);
+}
+
+
+static void
+gui_internal_cmd_rules(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct widget *wb,*w;
+ struct attr on,off;
+ wb=gui_internal_menu(this, _("Rules"));
+ w=gui_internal_box_new(this, gravity_top_center|orientation_vertical|flags_expand|flags_fill);
+ w->spy=this->spacing*3;
+ gui_internal_widget_append(wb, w);
+ on.u.num=1;
+ off.u.num=0;
+ on.type=off.type=attr_tracking;
+ gui_internal_widget_append(w,
+ gui_internal_button_navit_attr_new(this, _("Lock on road"), gravity_left_center|orientation_horizontal|flags_fill,
+ &on, &off));
+ on.u.num=0;
+ off.u.num=-1;
+ on.type=off.type=attr_orientation;
+ gui_internal_widget_append(w,
+ gui_internal_button_navit_attr_new(this, _("Northing"), gravity_left_center|orientation_horizontal|flags_fill,
+ &on, &off));
+ on.u.num=1;
+ off.u.num=0;
+ on.type=off.type=attr_follow_cursor;
+ gui_internal_widget_append(w,
+ gui_internal_button_navit_attr_new(this, _("Map follows Vehicle"), gravity_left_center|orientation_horizontal|flags_fill,
+ &on, &off));
+ gui_internal_menu_render(this);
+}
+
+static void
+gui_internal_cmd_settings(struct gui_priv *this, struct widget *wm, void *data)
+{
+ struct widget *w;
+
+ w=gui_internal_menu(this, _("Settings"));
+ gui_internal_widget_append(w,
+ gui_internal_button_new_with_callback(this, _("Display"),
+ image_new_l(this, "gui_display"), gravity_center|orientation_vertical,
+ gui_internal_cmd_display, NULL));
+ gui_internal_widget_append(w,
+ gui_internal_button_new_with_callback(this, _("Maps"),
+ image_new_l(this, "gui_maps"), gravity_center|orientation_vertical,
+ gui_internal_cmd_maps, NULL));
+ gui_internal_widget_append(w,
+ gui_internal_button_new_with_callback(this, _("Vehicle"),
+ image_new_l(this, "gui_vehicle"), gravity_center|orientation_vertical,
+ gui_internal_cmd_vehicle, NULL));
+ gui_internal_widget_append(w,
+ gui_internal_button_new_with_callback(this, _("Rules"),
+ image_new_l(this, "gui_rules"), gravity_center|orientation_vertical,
+ gui_internal_cmd_rules, NULL));
+ gui_internal_menu_render(this);
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void gui_internal_motion(void *data, struct point *p)
+{
+
+ struct gui_priv *this=data;
+ if (!this->root.children) {
+ navit_handle_motion(this->nav, p);
+ return;
+ }
+ if (!this->pressed)
+ return;
+ this->current=*p;
+ if(!this->motion_timeout_callback)
+ this->motion_timeout_callback=callback_new_1(callback_cast(gui_internal_highlight), this);
+ if(!this->motion_timeout_event)
+ this->motion_timeout_event=event_add_timeout(100,0, this->motion_timeout_callback);
+}
+
+
+static void gui_internal_menu_root(struct gui_priv *this)
+{
+ struct widget *w;
+
+ graphics_draw_mode(this->gra, draw_mode_begin);
+ w=gui_internal_menu(this, _("Main menu"));
+ w->spx=this->spacing*10;
+ gui_internal_widget_append(w, gui_internal_button_new_with_callback(this, _("Actions"),
+ image_new_l(this, "gui_actions"), gravity_center|orientation_vertical,
+ gui_internal_cmd_actions, NULL));
+ if (this->flags & 2) {
+ gui_internal_widget_append(w, gui_internal_button_new_with_callback(this, _("Show\nMap"),
+ image_new_l(this, "gui_map"), gravity_center|orientation_vertical,
+ gui_internal_cmd_settings, NULL));
+ }
+ gui_internal_widget_append(w, gui_internal_button_new_with_callback(this, _("Settings"),
+ image_new_l(this, "gui_settings"), gravity_center|orientation_vertical,
+ gui_internal_cmd_settings, NULL));
+ gui_internal_widget_append(w, gui_internal_button_new(this, _("Tools"),
+ image_new_l(this, "gui_tools"), gravity_center|orientation_vertical));
+
+ gui_internal_widget_append(w, gui_internal_button_new_with_callback(this, "Route",
+ image_new_l(this, "gui_settings"), gravity_center|orientation_vertical,
+ gui_internal_cmd_route, NULL));
+
+
+ callback_list_call_attr_1(this->cbl, attr_gui, w);
+
+ gui_internal_menu_render(this);
+ graphics_draw_mode(this->gra, draw_mode_end);
+}
+
+static void
+gui_internal_enter(struct gui_priv *this, int ignore)
+{
+ struct graphics *gra=this->gra;
+ this->ignore_button=ignore;
+ this->clickp_valid=this->vehicle_valid=0;
+
+ navit_block(this->nav, 1);
+ graphics_overlay_disable(gra, 1);
+ this->root.p.x=0;
+ this->root.p.y=0;
+ this->root.background=this->background;
+}
+
+static void
+gui_internal_leave(struct gui_priv *this)
+{
+ graphics_draw_mode(this->gra, draw_mode_end);
+}
+
+static void
+gui_internal_cmd_menu(struct gui_priv *this, struct point *p, int ignore)
+{
+ struct transformation *trans;
+ struct coord c;
+ struct attr attr,attrp;
+
+ gui_internal_enter(this, ignore);
+ trans=navit_get_trans(this->nav);
+ if (p) {
+ transform_reverse(trans, p, &c);
+ dbg(0,"x=0x%x y=0x%x\n", c.x, c.y);
+ this->clickp.pro=transform_get_projection(trans);
+ this->clickp.x=c.x;
+ this->clickp.y=c.y;
+ this->clickp_valid=1;
+ }
+ if (navit_get_attr(this->nav, attr_vehicle, &attr, NULL) && attr.u.vehicle
+ && vehicle_get_attr(attr.u.vehicle, attr_position_coord_geo, &attrp, NULL)) {
+ this->vehiclep.pro=transform_get_projection(trans);
+ transform_from_geo(this->vehiclep.pro, attrp.u.coord_geo, &c);
+ this->vehiclep.x=c.x;
+ this->vehiclep.y=c.y;
+ this->vehicle_valid=1;
+ }
+ // draw menu
+ gui_internal_menu_root(this);
+}
+
+static void
+gui_internal_cmd_menu2(struct gui_priv *this)
+{
+ gui_internal_cmd_menu(this, NULL, 1);
+}
+
+
+static void
+gui_internal_cmd_log_do(struct gui_priv *this, struct widget *widget)
+{
+ if (widget->text && strlen(widget->text))
+ navit_textfile_debug_log(this->nav, "type=log_entry label=\"%s\"",widget->text);
+ g_free(widget->text);
+ widget->text=NULL;
+ gui_internal_prune_menu(this, NULL);
+ gui_internal_check_exit(this);
+}
+
+static void
+gui_internal_cmd_log_clicked(struct gui_priv *this, struct widget *widget, void *data)
+{
+ gui_internal_cmd_log_do(this, widget->data);
+}
+
+static void
+gui_internal_cmd_log_changed(struct gui_priv *this, struct widget *wm, void *data)
+{
+ int len;
+ if (wm->text) {
+ len=strlen(wm->text);
+ if (len && (wm->text[len-1] == '\n' || wm->text[len-1] == '\r')) {
+ wm->text[len-1]='\0';
+ gui_internal_cmd_log_do(this, wm);
+ }
+ }
+}
+
+
+static void
+gui_internal_cmd_log(struct gui_priv *this)
+{
+ struct widget *w,*wb,*wk,*wl,*we,*wnext;
+ gui_internal_enter(this, 1);
+ wb=gui_internal_menu(this, "Log Message");
+ w=gui_internal_box_new(this, gravity_left_top|orientation_vertical|flags_expand|flags_fill);
+ gui_internal_widget_append(wb, w);
+ we=gui_internal_box_new(this, gravity_left_center|orientation_horizontal|flags_fill);
+ gui_internal_widget_append(w, we);
+ gui_internal_widget_append(we, wk=gui_internal_label_new(this, _("Message")));
+ wk->state |= STATE_EDIT|STATE_CLEAR;
+ wk->background=this->background;
+ wk->flags |= flags_expand|flags_fill;
+ wk->func = gui_internal_cmd_log_changed;
+ gui_internal_widget_append(we, wnext=gui_internal_image_new(this, image_new_xs(this, "gui_active")));
+ wnext->state |= STATE_SENSITIVE;
+ wnext->func = gui_internal_cmd_log_clicked;
+ wnext->data=wk;
+ wl=gui_internal_box_new(this, gravity_left_top|orientation_vertical|flags_expand|flags_fill);
+ gui_internal_widget_append(w, wl);
+ if (this->keyboard)
+ gui_internal_widget_append(w, gui_internal_keyboard(this,2));
+ gui_internal_menu_render(this);
+ gui_internal_leave(this);
+}
+
+static void
+gui_internal_check_exit(struct gui_priv *this)
+{
+ struct graphics *gra=this->gra;
+ if (! this->root.children) {
+ gui_internal_search_idle_end(this);
+ gui_internal_search_list_destroy(this);
+ graphics_overlay_disable(gra, 0);
+ if (!navit_block(this->nav, 0)) {
+ if (this->redraw)
+ navit_draw(this->nav);
+ else
+ navit_draw_displaylist(this->nav);
+ }
+ }
+}
+
+//##############################################################################################################
+//# Description: Function to handle mouse clicks and scroll wheel movement
+//# Comment:
+//# Authors: Martin Schaller (04/2008), Stefan Klumpp (04/2008)
+//##############################################################################################################
+static void gui_internal_button(void *data, int pressed, int button, struct point *p)
+{
+ struct gui_priv *this=data;
+ struct graphics *gra=this->gra;
+
+ dbg(1,"enter %d %d\n", pressed, button);
+ // if still on the map (not in the menu, yet):
+ if (!this->root.children || this->ignore_button) {
+ this->ignore_button=0;
+ // check whether the position of the mouse changed during press/release OR if it is the scrollwheel
+ if (!navit_handle_button(this->nav, pressed, button, p, NULL) || button >=4) // Maybe there's a better way to do this
+ return;
+ if (this->menu_on_map_click)
+ gui_internal_cmd_menu(this, p, 0);
+ return;
+ }
+
+
+ // if already in the menu:
+ if (pressed) {
+ this->pressed=1;
+ this->current=*p;
+ gui_internal_highlight(this);
+ } else {
+ this->pressed=0;
+ this->current.x=-1;
+ this->current.y=-1;
+ graphics_draw_mode(gra, draw_mode_begin);
+ gui_internal_call_highlighted(this);
+ gui_internal_highlight(this);
+ graphics_draw_mode(gra, draw_mode_end);
+ gui_internal_check_exit(this);
+ }
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void gui_internal_resize(void *data, int w, int h)
+{
+ struct gui_priv *this=data;
+
+ if( this->root.w==w && this->root.h==h)
+ return;
+
+ this->root.w=w;
+ this->root.h=h;
+ dbg(0,"w=%d h=%d children=%p\n", w, h, this->root.children);
+ navit_handle_resize(this->nav, w, h);
+ if (this->root.children) {
+ gui_internal_prune_menu(this, NULL);
+ gui_internal_menu_root(this);
+ }
+}
+
+static void
+gui_internal_keynav_point(struct widget *w, int dx, int dy, struct point *p)
+{
+ p->x=w->p.x+w->w/2;
+ p->y=w->p.y+w->h/2;
+ if (dx < 0)
+ p->x=w->p.x;
+ if (dx > 0)
+ p->x=w->p.x+w->w;
+ if (dy < 0)
+ p->y=w->p.y;
+ if (dy > 0)
+ p->y=w->p.y+w->h;
+}
+
+static void
+gui_internal_keynav_find_closest(struct widget *wi, struct point *p, int dx, int dy, int *distance, struct widget **result)
+{
+ GList *l=wi->children;
+ if (wi->state & STATE_SENSITIVE) {
+ int dist1,dist2;
+ struct point wp;
+ gui_internal_keynav_point(wi, -dx, -dy, &wp);
+ if (dx) {
+ dist1=(wp.x-p->x)*dx;
+ dist2=wp.y-p->y;
+ } else if (dy) {
+ dist1=(wp.y-p->y)*dy;
+ dist2=wp.x-p->x;
+ } else {
+ dist2=wp.x-p->x;
+ dist1=wp.y-p->y;
+ if (dist1 < 0)
+ dist1=-dist1;
+ }
+ dbg(1,"checking %d,%d %d %d against %d,%d-%d,%d result %d,%d\n", p->x, p->y, dx, dy, wi->p.x, wi->p.y, wi->p.x+wi->w, wi->p.y+wi->h, dist1, dist2);
+ if (dist1 >= 0) {
+ if (dist2 < 0)
+ dist1-=dist2;
+ else
+ dist1+=dist2;
+ if (dist1 < *distance) {
+ *result=wi;
+ *distance=dist1;
+ }
+ }
+ }
+ while (l) {
+ struct widget *child=l->data;
+ gui_internal_keynav_find_closest(child, p, dx, dy, distance, result);
+ l=g_list_next(l);
+ }
+}
+
+static void
+gui_internal_keynav_highlight_next(struct gui_priv *this, int dx, int dy)
+{
+ struct widget *result,*menu=g_list_last(this->root.children)->data;
+ struct point p;
+ int distance;
+ if (this->highlighted && this->highlighted_menu == g_list_last(this->root.children)->data)
+ gui_internal_keynav_point(this->highlighted, dx, dy, &p);
+ else {
+ p.x=0;
+ p.y=0;
+ distance=INT_MAX;
+ result=NULL;
+ gui_internal_keynav_find_closest(menu, &p, 0, 0, &distance, &result);
+ if (result) {
+ gui_internal_keynav_point(result, dx, dy, &p);
+ dbg(1,"result origin=%p p=%d,%d\n", result, p.x, p.y);
+ }
+ }
+ result=NULL;
+ distance=INT_MAX;
+ gui_internal_keynav_find_closest(menu, &p, dx, dy, &distance, &result);
+ dbg(1,"result=%p\n", result);
+ if (! result) {
+ if (dx < 0)
+ p.x=this->root.w;
+ if (dx > 0)
+ p.x=0;
+ if (dy < 0)
+ p.y=this->root.h;
+ if (dy > 0)
+ p.y=0;
+ result=NULL;
+ distance=INT_MAX;
+ gui_internal_keynav_find_closest(menu, &p, dx, dy, &distance, &result);
+ dbg(1,"wraparound result=%p\n", result);
+ }
+ gui_internal_highlight_do(this, result);
+ if (result)
+ gui_internal_say(this, result, 1);
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static void gui_internal_keypress(void *data, char *key)
+{
+ struct gui_priv *this=data;
+ int w,h;
+ struct point p;
+ if (!this->root.children) {
+ transform_get_size(navit_get_trans(this->nav), &w, &h);
+ switch (*key) {
+ case NAVIT_KEY_UP:
+ p.x=w/2;
+ p.y=0;
+ navit_set_center_screen(this->nav, &p, 1);
+ break;
+ case NAVIT_KEY_DOWN:
+ p.x=w/2;
+ p.y=h;
+ navit_set_center_screen(this->nav, &p, 1);
+ break;
+ case NAVIT_KEY_LEFT:
+ p.x=0;
+ p.y=h/2;
+ navit_set_center_screen(this->nav, &p, 1);
+ break;
+ case NAVIT_KEY_RIGHT:
+ p.x=w;
+ p.y=h/2;
+ navit_set_center_screen(this->nav, &p, 1);
+ break;
+ case NAVIT_KEY_ZOOM_IN:
+ navit_zoom_in(this->nav, 2, NULL);
+ break;
+ case NAVIT_KEY_ZOOM_OUT:
+ navit_zoom_out(this->nav, 2, NULL);
+ break;
+ case NAVIT_KEY_RETURN:
+ gui_internal_cmd_menu(this, NULL, 0);
+ break;
+ }
+ return;
+ }
+ graphics_draw_mode(this->gra, draw_mode_begin);
+ switch (*key) {
+ case NAVIT_KEY_LEFT:
+ gui_internal_keynav_highlight_next(this,-1,0);
+ break;
+ case NAVIT_KEY_RIGHT:
+ gui_internal_keynav_highlight_next(this,1,0);
+ break;
+ case NAVIT_KEY_UP:
+ gui_internal_keynav_highlight_next(this,0,-1);
+ break;
+ case NAVIT_KEY_DOWN:
+ gui_internal_keynav_highlight_next(this,0,1);
+ break;
+ case NAVIT_KEY_RETURN:
+ if (this->highlighted && this->highlighted_menu == g_list_last(this->root.children)->data)
+ gui_internal_call_highlighted(this);
+ else
+ gui_internal_keypress_do(this, key);
+ break;
+ default:
+ gui_internal_keypress_do(this, key);
+ }
+ graphics_draw_mode(this->gra, draw_mode_end);
+ gui_internal_check_exit(this);
+}
+
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static int gui_internal_set_graphics(struct gui_priv *this, struct graphics *gra)
+{
+ struct window *win;
+ struct color cbh={0x9fff,0x9fff,0x9fff,0xffff};
+ struct color cf={0xbfff,0xbfff,0xbfff,0xffff};
+ struct transformation *trans=navit_get_trans(this->nav);
+
+ win=graphics_get_data(gra, "window");
+ if (! win)
+ return 1;
+ navit_ignore_graphics_events(this->nav, 1);
+ this->gra=gra;
+ this->win=win;
+ navit_ignore_graphics_events(this->nav, 1);
+ transform_get_size(trans, &this->root.w, &this->root.h);
+ this->resize_cb=callback_new_attr_1(callback_cast(gui_internal_resize), attr_resize, this);
+ graphics_add_callback(gra, this->resize_cb);
+ this->button_cb=callback_new_attr_1(callback_cast(gui_internal_button), attr_button, this);
+ graphics_add_callback(gra, this->button_cb);
+ this->motion_cb=callback_new_attr_1(callback_cast(gui_internal_motion), attr_motion, this);
+ graphics_add_callback(gra, this->motion_cb);
+ this->keypress_cb=callback_new_attr_1(callback_cast(gui_internal_keypress), attr_keypress, this);
+ graphics_add_callback(gra, this->keypress_cb);
+ this->background=graphics_gc_new(gra);
+ this->background2=graphics_gc_new(gra);
+ this->highlight_background=graphics_gc_new(gra);
+ graphics_gc_set_foreground(this->highlight_background, &cbh);
+ this->foreground=graphics_gc_new(gra);
+ graphics_gc_set_foreground(this->foreground, &cf);
+ this->text_background=graphics_gc_new(gra);
+ this->text_foreground=graphics_gc_new(gra);
+ graphics_gc_set_foreground(this->background, &this->background_color);
+ graphics_gc_set_foreground(this->background2, &this->background2_color);
+ graphics_gc_set_foreground(this->text_background, &this->text_background_color);
+ graphics_gc_set_foreground(this->text_foreground, &this->text_foreground_color);
+
+ // set fullscreen if needed
+ if (this->fullscreen)
+ this->win->fullscreen(this->win, this->fullscreen);
+ return 0;
+}
+
+static void gui_internal_disable_suspend(struct gui_priv *this)
+{
+ if (this->win->disable_suspend)
+ this->win->disable_suspend(this->win);
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+struct gui_methods gui_internal_methods = {
+ NULL,
+ NULL,
+ gui_internal_set_graphics,
+ NULL,
+ NULL,
+ NULL,
+ gui_internal_disable_suspend,
+};
+
+static void
+gui_internal_get_data(struct gui_priv *priv, char *command, struct attr **in, struct attr ***out)
+{
+ struct attr private_data = (struct attr) { attr_private_data, {(void *)&priv->data}};
+ if (out)
+ *out=attr_generic_add_attr(*out, &private_data);
+}
+
+static void
+gui_internal_add_callback(struct gui_priv *priv, struct callback *cb)
+{
+ callback_list_add(priv->cbl, cb);
+}
+
+static void
+gui_internal_remove_callback(struct gui_priv *priv, struct callback *cb)
+{
+ callback_list_remove(priv->cbl, cb);
+}
+
+
+static struct gui_internal_methods gui_internal_methods_ext = {
+ gui_internal_add_callback,
+ gui_internal_remove_callback,
+ gui_internal_menu_render,
+ image_new_xs,
+ image_new_l,
+};
+
+
+static enum flags
+gui_internal_get_flags(struct widget *widget)
+{
+ return widget->flags;
+}
+
+static void
+gui_internal_set_flags(struct widget *widget, enum flags flags)
+{
+ widget->flags=flags;
+}
+
+static int
+gui_internal_get_state(struct widget *widget)
+{
+ return widget->state;
+}
+
+static void
+gui_internal_set_state(struct widget *widget, int state)
+{
+ widget->state=state;
+}
+
+static void
+gui_internal_set_func(struct widget *widget, void (*func)(struct gui_priv *priv, struct widget *widget, void *data))
+{
+ widget->func=func;
+}
+
+static void
+gui_internal_set_data(struct widget *widget, void *data)
+{
+ widget->data=data;
+}
+
+static void
+gui_internal_set_default_background(struct gui_priv *this, struct widget *widget)
+{
+ widget->background=this->background;
+}
+
+static struct gui_internal_widget_methods gui_internal_widget_methods = {
+ gui_internal_widget_append,
+ gui_internal_button_new,
+ gui_internal_button_new_with_callback,
+ gui_internal_box_new,
+ gui_internal_label_new,
+ gui_internal_image_new,
+ gui_internal_keyboard,
+ gui_internal_menu,
+ gui_internal_get_flags,
+ gui_internal_set_flags,
+ gui_internal_get_state,
+ gui_internal_set_state,
+ gui_internal_set_func,
+ gui_internal_set_data,
+ gui_internal_set_default_background,
+};
+
+static struct command_table commands[] = {
+ {"menu",command_cast(gui_internal_cmd_menu2)},
+ {"fullscreen",command_cast(gui_internal_cmd_fullscreen)},
+ {"get_data",command_cast(gui_internal_get_data)},
+ {"log",command_cast(gui_internal_cmd_log)},
+};
+
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+static struct gui_priv * gui_internal_new(struct navit *nav, struct gui_methods *meth, struct attr **attrs)
+{
+ struct gui_priv *this;
+ struct attr *attr;
+ *meth=gui_internal_methods;
+ this=g_new0(struct gui_priv, 1);
+ this->nav=nav;
+ if ((attr=attr_search(attrs, NULL, attr_menu_on_map_click)))
+ this->menu_on_map_click=attr->u.num;
+ else
+ this->menu_on_map_click=1;
+ if ((attr=attr_search(attrs, NULL, attr_callback_list))) {
+ dbg(0,"register\n");
+ command_add_table(attr->u.callback_list, commands, sizeof(commands)/sizeof(struct command_table), this);
+ }
+
+ if( (attr=attr_search(attrs,NULL,attr_font_size)))
+ {
+ this->config.font_size=attr->u.num;
+ }
+ else
+ {
+ this->config.font_size=-1;
+ }
+ if( (attr=attr_search(attrs,NULL,attr_icon_xs)))
+ {
+ this->config.icon_xs=attr->u.num;
+ }
+ else
+ {
+ this->config.icon_xs=-1;
+ }
+ if( (attr=attr_search(attrs,NULL,attr_icon_l)))
+ {
+ this->config.icon_l=attr->u.num;
+ }
+ else
+ {
+ this->config.icon_l=-1;
+ }
+ if( (attr=attr_search(attrs,NULL,attr_icon_s)))
+ {
+ this->config.icon_s=attr->u.num;
+ }
+ else
+ {
+ this->config.icon_s=-1;
+ }
+ if( (attr=attr_search(attrs,NULL,attr_spacing)))
+ {
+ this->config.spacing=attr->u.num;
+ }
+ else
+ {
+ this->config.spacing=-1;
+ }
+ if( (attr=attr_search(attrs,NULL,attr_gui_speech)))
+ {
+ this->speech=attr->u.num;
+ }
+ if( (attr=attr_search(attrs,NULL,attr_keyboard)))
+ this->keyboard=attr->u.num;
+ else
+ this->keyboard=1;
+
+ if( (attr=attr_search(attrs,NULL,attr_fullscreen)))
+ this->fullscreen=attr->u.num;
+
+ if( (attr=attr_search(attrs,NULL,attr_flags)))
+ this->flags=attr->u.num;
+ if( (attr=attr_search(attrs,NULL,attr_background_color)))
+ this->background_color=*attr->u.color;
+ else
+ this->background_color=(struct color){0x0,0x0,0x0,0xffff};
+ if( (attr=attr_search(attrs,NULL,attr_background_color2)))
+ this->background2_color=*attr->u.color;
+ else
+ this->background2_color=(struct color){0x4141,0x4141,0x4141,0xffff};
+ if( (attr=attr_search(attrs,NULL,attr_text_color)))
+ this->text_foreground_color=*attr->u.color;
+ else
+ this->text_foreground_color=(struct color){0xffff,0xffff,0xffff,0xffff};
+ if( (attr=attr_search(attrs,NULL,attr_columns)))
+ this->cols=attr->u.num;
+ if( (attr=attr_search(attrs,NULL,attr_osd_configuration)))
+ this->osd_configuration=*attr;
+
+ if( (attr=attr_search(attrs,NULL,attr_pitch)))
+ this->pitch=attr->u.num;
+ else
+ this->pitch=20;
+ this->data.priv=this;
+ this->data.gui=&gui_internal_methods_ext;
+ this->data.widget=&gui_internal_widget_methods;
+ this->cbl=callback_list_new();
+
+ return this;
+}
+
+//##############################################################################################################
+//# Description:
+//# Comment:
+//# Authors: Martin Schaller (04/2008)
+//##############################################################################################################
+void plugin_init(void)
+{
+ plugin_register_gui_type("internal", gui_internal_new);
+}
+
+/**
+ * @brief Creates a new table widget.
+ *
+ * Creates and returns a new table widget. This function will
+ * setup next/previous buttons as children.
+ *
+ * @param this The graphics context.
+ * @param flags widget sizing flags.
+ * @returns The newly created widget
+ */
+struct widget * gui_internal_widget_table_new(struct gui_priv * this, enum flags flags, int buttons)
+{
+ struct widget * widget = g_new0(struct widget,1);
+ struct table_data * data = NULL;
+ widget->type=widget_table;
+ widget->flags=flags;
+ widget->data = g_new0(struct table_data,1);
+ widget->data_free=gui_internal_table_data_free;
+ data = (struct table_data*)widget->data;
+
+
+ if (buttons) {
+ data->next_button = gui_internal_button_new_with_callback
+ (this,"Next",image_new_xs(this, "gui_active") ,
+ gravity_left_center |orientation_vertical,
+ gui_internal_table_button_next,NULL);
+ data->next_button->data=widget;
+
+
+ data->prev_button = gui_internal_button_new_with_callback
+ (this,"Prev",
+ image_new_xs(this, "gui_active")
+ ,gravity_right_center |orientation_vertical,
+ gui_internal_table_button_prev,NULL);
+
+ data->prev_button->data=widget;
+
+ data->this=this;
+
+ data->button_box=gui_internal_box_new(this,
+ gravity_center|orientation_horizontal);
+ data->button_box->children=g_list_append(data->button_box->children,
+ data->next_button);
+ data->button_box->children=g_list_append(data->button_box->children,
+ data->prev_button);
+ //data->button_box->background=this->background2;
+ data->button_box->bl=this->spacing;
+ widget->children=g_list_append(widget->children,data->button_box);
+ gui_internal_widget_pack(this,data->button_box);
+ }
+
+ return widget;
+
+}
+
+/**
+ * @brief Clears all the rows from the table.
+ * This function removes all rows from a table.
+ * New rows can later be added to the table.
+ */
+void gui_internal_widget_table_clear(struct gui_priv * this,struct widget * table)
+{
+ GList * iter;
+ struct table_data * table_data = (struct table_data* ) table->data;
+
+ iter = table->children;
+ while(iter ) {
+ if(iter->data != table_data->button_box) {
+ struct widget * child = (struct widget*)iter->data;
+ gui_internal_widget_destroy(this,child);
+ if(table->children == iter) {
+ table->children = g_list_remove(iter,iter->data);
+ iter=table->children;
+ }
+ else
+ iter = g_list_remove(iter,iter->data);
+ }
+ else {
+ iter = g_list_next(iter);
+ }
+
+ }
+ table_data->top_row=NULL;
+ table_data->bottom_row=NULL;
+ if(table_data->page_headers)
+ g_list_free(table_data->page_headers);
+ table_data->page_headers=NULL;
+}
+
+
+/**
+ * Creates a new table_row widget.
+ * @param this The graphics context
+ * @param flags Sizing flags for the row
+ * @returns The new table_row widget.
+ */
+struct widget * gui_internal_widget_table_row_new(struct gui_priv * this, enum flags flags)
+{
+ struct widget * widget = g_new0(struct widget,1);
+ widget->type=widget_table_row;
+ widget->flags=flags;
+ return widget;
+}
+
+
+
+/**
+ * @brief Computes the column dimensions for the table.
+ *
+ * @param w The table widget to compute dimensions for.
+ *
+ * This function examines all of the rows and columns for the table w
+ * and returns a list (GList) of table_column_desc elements that
+ * describe each column of the table.
+ *
+ * The caller is responsible for freeing the returned list.
+ */
+static GList * gui_internal_compute_table_dimensions(struct gui_priv * this,struct widget * w)
+{
+
+ GList * column_desc = NULL;
+ GList * current_desc=NULL;
+ GList * cur_row = w->children;
+ struct widget * cur_row_widget=NULL;
+ GList * cur_column=NULL;
+ struct widget * cell_w=NULL;
+ struct table_column_desc * current_cell=NULL;
+ struct table_data * table_data=NULL;
+ int height=0;
+ int width=0;
+ int total_width=0;
+ int column_count=0;
+
+ /**
+ * Scroll through the the table and
+ * 1. Compute the maximum width + height of each column across all rows.
+ */
+ table_data = (struct table_data*) w->data;
+ for(cur_row=w->children; cur_row ; cur_row = g_list_next(cur_row) )
+ {
+ cur_row_widget = (struct widget*) cur_row->data;
+ current_desc = column_desc;
+ if(cur_row_widget == table_data->button_box)
+ {
+ continue;
+ }
+ column_count=0;
+ for(cur_column = cur_row_widget->children; cur_column;
+ cur_column=g_list_next(cur_column))
+ {
+ cell_w = (struct widget*) cur_column->data;
+ gui_internal_widget_pack(this,cell_w);
+ if(current_desc == 0)
+ {
+ current_cell = g_new0(struct table_column_desc,1);
+ column_desc = g_list_append(column_desc,current_cell);
+ current_desc = g_list_last(column_desc);
+ current_cell->height=cell_w->h;
+ current_cell->width=cell_w->w;
+ total_width+=cell_w->w;
+
+ }
+ else
+ {
+ current_cell = current_desc->data;
+ height = cell_w->h;
+ width = cell_w->w;
+ if(current_cell->height < height )
+ {
+ current_cell->height = height;
+ }
+ if(current_cell->width < width)
+ {
+ total_width += (width-current_cell->width);
+ current_cell->width = width;
+
+
+
+ }
+ current_desc = g_list_next(current_desc);
+ }
+ column_count++;
+
+ }/* column loop */
+
+ } /*row loop */
+
+
+ /**
+ * If the width of all columns is less than the width off
+ * the table expand each cell proportionally.
+ *
+ */
+ if(total_width+(this->spacing*column_count) < w->w ) {
+ for(current_desc=column_desc; current_desc; current_desc=g_list_next(current_desc)) {
+ current_cell = (struct table_column_desc*) current_desc->data;
+ current_cell->width= ( (current_cell->width+this->spacing)/(float)total_width) * w->w ;
+ }
+ }
+
+ return column_desc;
+}
+
+
+/**
+ * @brief Computes the height and width for the table.
+ *
+ * The height and widht are computed to display all cells in the table
+ * at the requested height/width.
+ *
+ * @param this The graphics context
+ * @param w The widget to pack.
+ *
+ */
+void gui_internal_table_pack(struct gui_priv * this, struct widget * w)
+{
+
+ int height=0;
+ int width=0;
+ int count=0;
+ GList * column_data = gui_internal_compute_table_dimensions(this,w);
+ GList * current=0;
+ struct table_column_desc * cell_desc=0;
+ struct table_data * table_data = (struct table_data*)w->data;
+
+ for(current = column_data; current; current=g_list_next(current))
+ {
+ if(table_data->button_box == current->data )
+ {
+ continue;
+ }
+ cell_desc = (struct table_column_desc *) current->data;
+ width = width + cell_desc->width + this->spacing;
+ if(height < cell_desc->height)
+ {
+ height = cell_desc->height ;
+ }
+ }
+
+
+
+ for(current=w->children; current; current=g_list_next(current))
+ {
+ if(current->data!= table_data->button_box)
+ {
+ count++;
+ }
+ }
+ if (table_data->button_box)
+ gui_internal_widget_pack(this,table_data->button_box);
+
+
+
+ if(w->h + w->c.y > this->root.h )
+ {
+ /**
+ * Do not allow the widget to exceed the screen.
+ *
+ */
+ w->h = this->root.h- w->c.y - height;
+ }
+ w->w = width;
+
+ /**
+ * Deallocate column descriptions.
+ */
+ current = column_data;
+ while( (current = g_list_last(current)) )
+ {
+ current = g_list_remove(current,current->data);
+ }
+
+}
+
+
+
+/**
+ * @brief Renders a table widget.
+ *
+ * @param this The graphics context
+ * @param w The table widget to render.
+ */
+void gui_internal_table_render(struct gui_priv * this, struct widget * w)
+{
+
+ int x;
+ int y;
+ GList * column_desc=NULL;
+ GList * cur_row = NULL;
+ GList * current_desc=NULL;
+ struct table_data * table_data = (struct table_data*)w->data;
+ int is_skipped=0;
+ int is_first_page=1;
+ struct table_column_desc * dim=NULL;
+
+ dbg_assert(table_data);
+ column_desc = gui_internal_compute_table_dimensions(this,w);
+ y=w->p.y;
+
+ /**
+ * Skip rows that are on previous pages.
+ */
+ cur_row = w->children;
+ if(table_data->top_row && table_data->top_row != w->children )
+ {
+ cur_row = table_data->top_row;
+ is_first_page=0;
+ }
+
+
+ /**
+ * Loop through each row. Drawing each cell with the proper sizes,
+ * at the proper positions.
+ */
+ for(table_data->top_row=cur_row; cur_row; cur_row = g_list_next(cur_row))
+ {
+ GList * cur_column=NULL;
+ current_desc = column_desc;
+ struct widget * cur_row_widget = (struct widget*)cur_row->data;
+ int max_height=0;
+ x =w->p.x+this->spacing;
+ if(cur_row_widget == table_data->button_box )
+ {
+ continue;
+ }
+ dim = (struct table_column_desc*)current_desc->data;
+
+ if( y + dim->height + (table_data->button_box ? table_data->button_box->h : 0) + this->spacing >= w->p.y + w->h )
+ {
+ /*
+ * No more drawing space left.
+ */
+ is_skipped=1;
+ break;
+
+ }
+ for(cur_column = cur_row_widget->children; cur_column;
+ cur_column=g_list_next(cur_column))
+ {
+ struct widget * cur_widget = (struct widget*) cur_column->data;
+ dim = (struct table_column_desc*)current_desc->data;
+
+ cur_widget->p.x=x;
+ cur_widget->w=dim->width;
+ cur_widget->p.y=y;
+ cur_widget->h=dim->height;
+ x=x+cur_widget->w;
+ max_height = dim->height;
+ /* We pack the widget before rendering to ensure that the x and y
+ * coordinates get pushed down.
+ */
+ gui_internal_widget_pack(this,cur_widget);
+ gui_internal_widget_render(this,cur_widget);
+
+ if(dim->height > max_height)
+ {
+ max_height = dim->height;
+ }
+ }
+ y = y + max_height;
+ table_data->bottom_row=cur_row;
+ current_desc = g_list_next(current_desc);
+ }
+ if(table_data->button_box && (is_skipped || !is_first_page) )
+ {
+ table_data->button_box->p.y =w->p.y+w->h-table_data->button_box->h -
+ this->spacing;
+ if(table_data->button_box->p.y < y )
+ {
+ table_data->button_box->p.y=y;
+ }
+ table_data->button_box->p.x = w->p.x;
+ table_data->button_box->w = w->w;
+ // table_data->button_box->h = w->h - y;
+ // table_data->next_button->h=table_data->button_box->h;
+ // table_data->prev_button->h=table_data->button_box->h;
+ // table_data->next_button->c.y=table_data->button_box->c.y;
+ // table_data->prev_button->c.y=table_data->button_box->c.y;
+
+ gui_internal_widget_pack(this,table_data->button_box);
+ if(table_data->next_button->p.y > w->p.y + w->h + table_data->next_button->h)
+ {
+
+ table_data->button_box->p.y = w->p.y + w->h -
+ table_data->button_box->h;
+ }
+ if(is_skipped)
+ {
+ table_data->next_button->state|= STATE_SENSITIVE;
+ }
+ else
+ {
+ table_data->next_button->state&= ~STATE_SENSITIVE;
+ }
+
+ if(table_data->top_row != w->children)
+ {
+ table_data->prev_button->state|= STATE_SENSITIVE;
+ }
+ else
+ {
+ table_data->prev_button->state&= ~STATE_SENSITIVE;
+ }
+ gui_internal_widget_render(this,table_data->button_box);
+
+
+ }
+
+ /**
+ * Deallocate column descriptions.
+ */
+ current_desc = column_desc;
+ while( (current_desc = g_list_last(current_desc)) )
+ {
+ current_desc = g_list_remove(current_desc,current_desc->data);
+ }
+}
+
+
+/**
+ * @brief Displays Route information
+ *
+ * @li The name of the active vehicle
+ * @param wm The button that was pressed.
+ * @param v Unused
+ */
+static void
+gui_internal_cmd_route_description(struct gui_priv * this, struct widget * wm,void *v)
+{
+
+
+ struct widget * menu;
+ struct widget * row;
+
+
+ if(! this->vehicle_cb)
+ {
+ /**
+ * Register the callback on vehicle updates.
+ */
+ this->vehicle_cb = callback_new_attr_1(callback_cast(gui_internal_route_update),
+ attr_position_coord_geo,this);
+ navit_add_callback(this->nav,this->vehicle_cb);
+ }
+
+ this->route_data.route_table = gui_internal_widget_table_new(this,gravity_left_top | flags_fill | flags_expand |orientation_vertical,1);
+ row = gui_internal_widget_table_row_new(this,gravity_left | orientation_horizontal | flags_fill);
+
+ row = gui_internal_widget_table_row_new(this,gravity_left | orientation_horizontal | flags_fill);
+
+
+ menu=gui_internal_menu(this,"Route Description");
+
+ menu->free=gui_internal_route_screen_free;
+ this->route_data.route_showing=1;
+ this->route_data.route_table->spx = this->spacing;
+
+
+ struct widget * box = gui_internal_box_new(this, gravity_left_top| orientation_vertical | flags_fill | flags_expand);
+
+ // gui_internal_widget_append(box,gui_internal_box_new_with_label(this,"Test"));
+ gui_internal_widget_append(box,this->route_data.route_table);
+ box->w=menu->w;
+ box->spx = this->spacing;
+ this->route_data.route_table->w=box->w;
+ gui_internal_widget_append(menu,box);
+ gui_internal_populate_route_table(this,this->nav);
+ gui_internal_menu_render(this);
+
+}
+
+static int
+line_intersection(struct coord* a1, struct coord *a2, struct coord * b1, struct coord *b2, struct coord *res)
+{
+ int n, a, b;
+ int adx=a2->x-a1->x;
+ int ady=a2->y-a1->y;
+ int bdx=b2->x-b1->x;
+ int bdy=b2->y-b1->y;
+ n = bdy * adx - bdx * ady;
+ a = bdx * (a1->y - b1->y) - bdy * (a1->x - b1->x);
+ b = adx * (a1->y - b1->y) - ady * (a1->x - b1->x);
+ if (n < 0) {
+ n = -n;
+ a = -a;
+ b = -b;
+ }
+ if (a < 0 || b < 0)
+ return 0;
+ if (a > n || b > n)
+ return 0;
+ if (n == 0) {
+ dbg(0,"a=%d b=%d n=%d\n", a, b, n);
+ dbg(0,"a1=0x%x,0x%x ad %d,%d\n", a1->x, a1->y, adx, ady);
+ dbg(0,"b1=0x%x,0x%x bd %d,%d\n", b1->x, b1->y, bdx, bdy);
+ dbg_assert(n != 0);
+ }
+ res->x = a1->x + a * adx / n;
+ res->y = a1->y + a * ady / n;
+ return 1;
+}
+
+struct heightline {
+ struct heightline *next;
+ int height;
+ struct coord_rect bbox;
+ int count;
+ struct coord c[0];
+};
+
+struct diagram_point {
+ struct diagram_point *next;
+ struct coord c;
+};
+
+static struct heightline *
+item_get_heightline(struct item *item)
+{
+ struct heightline *ret=NULL;
+ struct street_data *sd;
+ struct attr attr;
+ int i,height;
+
+ if (item_attr_get(item, attr_label, &attr)) {
+ height=atoi(attr.u.str);
+ sd=street_get_data(item);
+ if (sd && sd->count > 1) {
+ ret=g_malloc(sizeof(struct heightline)+sd->count*sizeof(struct coord));
+ ret->bbox.lu=sd->c[0];
+ ret->bbox.rl=sd->c[0];
+ ret->count=sd->count;
+ ret->height=height;
+ for (i = 0 ; i < sd->count ; i++) {
+ ret->c[i]=sd->c[i];
+ coord_rect_extend(&ret->bbox, sd->c+i);
+ }
+ }
+ street_data_free(sd);
+ }
+ return ret;
+}
+
+
+/**
+ * @brief Displays Route Height Profile
+ *
+ * @li The name of the active vehicle
+ * @param wm The button that was pressed.
+ * @param v Unused
+ */
+static void gui_internal_cmd_route_height_profile(struct gui_priv * this, struct widget * wm,void *v)
+{
+
+
+ struct widget * menu, *box;
+
+ struct map * map=NULL;
+ struct map_rect * mr=NULL;
+ struct route * route;
+ struct item * item =NULL;
+ struct mapset *ms;
+ struct mapset_handle *msh;
+ int x,i,first=1,dist=0;
+ struct coord c,last,res;
+ struct coord_rect rbbox,dbbox;
+ struct map_selection sel;
+ struct heightline *heightline,*heightlines=NULL;
+ struct diagram_point *min,*diagram_point,*diagram_points=NULL;
+ sel.next=NULL;
+ sel.order=18;
+ sel.range.min=type_height_line_1;
+ sel.range.max=type_height_line_3;
+
+
+ menu=gui_internal_menu(this,_("Height Profile"));
+ box = gui_internal_box_new(this, gravity_left_top| orientation_vertical | flags_fill | flags_expand);
+ gui_internal_widget_append(menu, box);
+ route = navit_get_route(this->nav);
+ if (route)
+ map = route_get_map(route);
+ if(map)
+ mr = map_rect_new(map,NULL);
+ if(mr) {
+ while((item = map_rect_get_item(mr))) {
+ while (item_coord_get(item, &c, 1)) {
+ if (first) {
+ first=0;
+ sel.u.c_rect.lu=c;
+ sel.u.c_rect.rl=c;
+ } else
+ coord_rect_extend(&sel.u.c_rect, &c);
+ }
+ }
+ map_rect_destroy(mr);
+ ms=navit_get_mapset(this->nav);
+ if (!first && ms) {
+ msh=mapset_open(ms);
+ while ((map=mapset_next(msh, 1))) {
+ mr=map_rect_new(map, &sel);
+ if (mr) {
+ while((item = map_rect_get_item(mr))) {
+ if (item->type >= sel.range.min && item->type <= sel.range.max) {
+ heightline=item_get_heightline(item);
+ if (heightline) {
+ heightline->next=heightlines;
+ heightlines=heightline;
+ }
+ }
+ }
+ map_rect_destroy(mr);
+ }
+ }
+ mapset_close(msh);
+ }
+ }
+ map=NULL;
+ mr=NULL;
+ if (route)
+ map = route_get_map(route);
+ if(map)
+ mr = map_rect_new(map,NULL);
+ if(mr && heightlines) {
+ while((item = map_rect_get_item(mr))) {
+ first=1;
+ while (item_coord_get(item, &c, 1)) {
+ if (first)
+ first=0;
+ else {
+ heightline=heightlines;
+ rbbox.lu=last;
+ rbbox.rl=last;
+ coord_rect_extend(&rbbox, &c);
+ while (heightline) {
+ if (coord_rect_overlap(&rbbox, &heightline->bbox)) {
+ for (i = 0 ; i < heightline->count - 1; i++) {
+ if (heightline->c[i].x != heightline->c[i+1].x || heightline->c[i].y != heightline->c[i+1].y) {
+ if (line_intersection(heightline->c+i, heightline->c+i+1, &last, &c, &res)) {
+ diagram_point=g_new(struct diagram_point, 1);
+ diagram_point->c.x=dist+transform_distance(projection_mg, &last, &res);
+ diagram_point->c.y=heightline->height;
+ diagram_point->next=diagram_points;
+ diagram_points=diagram_point;
+ dbg(0,"%d %d\n", diagram_point->c.x, diagram_point->c.y);
+ }
+ }
+ }
+ }
+ heightline=heightline->next;
+ }
+ dist+=transform_distance(projection_mg, &last, &c);
+ }
+ last=c;
+ }
+
+ }
+ map_rect_destroy(mr);
+ }
+
+
+ gui_internal_menu_render(this);
+ first=1;
+ diagram_point=diagram_points;
+ while (diagram_point) {
+ if (first) {
+ dbbox.lu=diagram_point->c;
+ dbbox.rl=diagram_point->c;
+ first=0;
+ } else
+ coord_rect_extend(&dbbox, &diagram_point->c);
+ diagram_point=diagram_point->next;
+ }
+ dbg(0,"%d %d %d %d\n", dbbox.lu.x, dbbox.lu.y, dbbox.rl.x, dbbox.rl.y);
+ if (dbbox.rl.x > dbbox.lu.x && dbbox.lu.x*100/(dbbox.rl.x-dbbox.lu.x) <= 25)
+ dbbox.lu.x=0;
+ if (dbbox.lu.y > dbbox.rl.y && dbbox.rl.y*100/(dbbox.lu.y-dbbox.rl.y) <= 25)
+ dbbox.rl.y=0;
+ dbg(0,"%d,%d %dx%d\n", box->p.x, box->p.y, box->w, box->h);
+ x=dbbox.lu.x;
+ first=1;
+ for (;;) {
+ struct point p[2];
+ min=NULL;
+ diagram_point=diagram_points;
+ while (diagram_point) {
+ if (diagram_point->c.x >= x && (!min || min->c.x > diagram_point->c.x))
+ min=diagram_point;
+ diagram_point=diagram_point->next;
+ }
+ if (! min)
+ break;
+ p[1].x=(min->c.x-dbbox.lu.x)*(box->w-10)/(dbbox.rl.x-dbbox.lu.x)+box->p.x+5;
+ p[1].y=(min->c.y-dbbox.rl.y)*(box->h-10)/(dbbox.lu.y-dbbox.rl.y)+box->p.y+5;
+ dbg(0,"%d,%d=%d,%d\n",min->c.x, min->c.y, p[1].x,p[1].y);
+ graphics_draw_circle(this->gra, this->foreground, &p[1], 2);
+ if (first)
+ first=0;
+ else
+ graphics_draw_lines(this->gra, this->foreground, p, 2);
+ p[0]=p[1];
+ x=min->c.x+1;
+ }
+
+
+}
+
+/**
+ * @brief Displays Route information
+ *
+ * @li The name of the active vehicle
+ * @param wm The button that was pressed.
+ * @param v Unused
+ */
+void gui_internal_cmd_route(struct gui_priv * this, struct widget * wm,void *v)
+{
+ struct widget *w;
+
+ graphics_draw_mode(this->gra, draw_mode_begin);
+ w=gui_internal_menu(this, _("Route"));
+ w->spx=this->spacing*10;
+ gui_internal_widget_append(w, gui_internal_button_new_with_callback(this, _("Description"),
+ image_new_l(this, "gui_actions"), gravity_center|orientation_vertical,
+ gui_internal_cmd_route_description, NULL));
+ gui_internal_widget_append(w, gui_internal_button_new_with_callback(this, _("Height Profile"),
+ image_new_l(this, "gui_actions"), gravity_center|orientation_vertical,
+ gui_internal_cmd_route_height_profile, NULL));
+ gui_internal_menu_render(this);
+ gui_internal_menu_render(this);
+ graphics_draw_mode(this->gra, draw_mode_end);
+
+}
+
+
+
+/**
+ * @brief handles the 'next page' table event.
+ * A callback function that is invoked when the 'next page' button is pressed
+ * to advance the contents of a table widget.
+ *
+ * @param this The graphics context.
+ * @param wm The button widget that was pressed.
+ */
+static void gui_internal_table_button_next(struct gui_priv * this, struct widget * wm, void *data)
+{
+ struct widget * table_widget = (struct widget * ) wm->data;
+ struct table_data * table_data = NULL;
+ int found=0;
+ GList * iterator;
+
+ if(table_widget)
+ {
+ table_data = (struct table_data*) table_widget->data;
+
+ }
+ if(table_data)
+ {
+ /**
+ * Before advancing to the next page we need to ensure
+ * that the current top_row is in the list of previous top_rows
+ * so previous page can work.
+ *
+ */
+ for(iterator=table_data->page_headers; iterator != NULL;
+ iterator = g_list_next(iterator) )
+ {
+ if(iterator->data == table_data->top_row)
+ {
+ found=1;
+ break;
+ }
+
+ }
+ if( ! found)
+ {
+ table_data->page_headers=g_list_append(table_data->page_headers,
+ table_data->top_row);
+ }
+
+ table_data->top_row = g_list_next(table_data->bottom_row);
+ }
+ wm->state&= ~STATE_HIGHLIGHTED;
+ gui_internal_menu_render(this);
+}
+
+
+
+/**
+ * @brief handles the 'previous page' table event.
+ * A callback function that is invoked when the 'previous page' button is pressed
+ * to go back in the contents of a table widget.
+ *
+ * @param this The graphics context.
+ * @param wm The button widget that was pressed.
+ */
+static void gui_internal_table_button_prev(struct gui_priv * this, struct widget * wm, void *data)
+{
+ struct widget * table_widget = (struct widget * ) wm->data;
+ struct table_data * table_data = NULL;
+ GList * current_page_top=NULL;
+
+ GList * iterator;
+ if(table_widget)
+ {
+ table_data = (struct table_data*) table_widget->data;
+ if(table_data)
+ {
+ current_page_top = table_data->top_row;
+ for(iterator = table_data->page_headers; iterator != NULL;
+ iterator = g_list_next(iterator))
+ {
+ if(current_page_top == iterator->data)
+ {
+ break;
+ }
+ table_data->top_row = (GList*) iterator->data;
+ }
+ }
+ }
+ wm->state&= ~STATE_HIGHLIGHTED;
+ gui_internal_menu_render(this);
+}
+
+
+/**
+ * @brief deallocates a table_data structure.
+ *
+ */
+void gui_internal_table_data_free(void * p)
+{
+
+
+ /**
+ * @note button_box and its children (next_button,prev_button)
+ * have their memory managed by the table itself.
+ */
+ struct table_data * table_data = (struct table_data*) p;
+ g_list_free(table_data->page_headers);
+ g_free(p);
+
+
+}
+
+
+/**
+ * @brief Called when the route is updated.
+ */
+void gui_internal_route_update(struct gui_priv * this, struct navit * navit, struct vehicle *v)
+{
+
+ if(this->route_data.route_showing) {
+ gui_internal_populate_route_table(this,navit);
+ graphics_draw_mode(this->gra, draw_mode_begin);
+ gui_internal_menu_render(this);
+ graphics_draw_mode(this->gra, draw_mode_end);
+ }
+
+
+}
+
+
+/**
+ * @brief Called when the route screen is closed (deallocated).
+ *
+ * The main purpose of this function is to remove the widgets from
+ * references route_data because those widgets are about to be freed.
+ */
+void gui_internal_route_screen_free(struct gui_priv * this_,struct widget * w)
+{
+ if(this_) {
+ this_->route_data.route_showing=0;
+ this_->route_data.route_table=NULL;
+ g_free(w);
+ }
+
+}
+
+/**
+ * @brief Populates the route table with route information
+ *
+ * @param this The gui context
+ * @param navit The navit object
+ */
+void gui_internal_populate_route_table(struct gui_priv * this,
+ struct navit * navit)
+{
+ struct map * map=NULL;
+ struct map_rect * mr=NULL;
+ struct navigation * nav = NULL;
+ struct item * item =NULL;
+ struct attr attr;
+ struct widget * label = NULL;
+ struct widget * row = NULL;
+ nav = navit_get_navigation(navit);
+ if(!nav) {
+ return;
+ }
+ map = navigation_get_map(nav);
+ if(map)
+ mr = map_rect_new(map,NULL);
+ if(mr) {
+ gui_internal_widget_table_clear(this,this->route_data.route_table);
+ while((item = map_rect_get_item(mr))) {
+ if(item_attr_get(item,attr_navigation_long,&attr)) {
+ label = gui_internal_label_new(this,attr.u.str);
+ row = gui_internal_widget_table_row_new(this,
+ gravity_left
+ | flags_fill
+ | orientation_horizontal);
+ row->children=g_list_append(row->children,label);
+ gui_internal_widget_append(this->route_data.route_table,row);
+ }
+
+ }
+
+ }
+}
diff --git a/gui/internal/gui_internal.h b/gui/internal/gui_internal.h
new file mode 100644
index 00000000..f407034f
--- /dev/null
+++ b/gui/internal/gui_internal.h
@@ -0,0 +1,76 @@
+struct widget; // defined in gui_internal.h
+struct graphics_image;
+
+#define STATE_VISIBLE 1
+#define STATE_SELECTED 2
+#define STATE_HIGHLIGHTED 4
+#define STATE_SENSITIVE 8
+#define STATE_EDIT 16
+#define STATE_CLEAR 32
+
+enum widget_type {
+ widget_box=1,
+ widget_button,
+ widget_label,
+ widget_image,
+ widget_table,
+ widget_table_row
+};
+
+enum flags {
+ gravity_none=0x00,
+ gravity_left=1,
+ gravity_xcenter=2,
+ gravity_right=4,
+ gravity_top=8,
+ gravity_ycenter=16,
+ gravity_bottom=32,
+ gravity_left_top=gravity_left|gravity_top,
+ gravity_top_center=gravity_xcenter|gravity_top,
+ gravity_right_top=gravity_right|gravity_top,
+ gravity_left_center=gravity_left|gravity_ycenter,
+ gravity_center=gravity_xcenter|gravity_ycenter,
+ gravity_right_center=gravity_right|gravity_ycenter,
+ gravity_left_bottom=gravity_left|gravity_bottom,
+ gravity_bottom_center=gravity_xcenter|gravity_bottom,
+ gravity_right_bottom=gravity_right|gravity_bottom,
+ flags_expand=0x100,
+ flags_fill=0x200,
+ orientation_horizontal=0x10000,
+ orientation_vertical=0x20000,
+ orientation_horizontal_vertical=0x40000,
+};
+
+
+struct gui_internal_methods {
+ void (*add_callback)(struct gui_priv *priv, struct callback *cb);
+ void (*remove_callback)(struct gui_priv *priv, struct callback *cb);
+ void (*menu_render)(struct gui_priv *this);
+ struct graphics_image * (*image_new_xs)(struct gui_priv *this, char *name);
+ struct graphics_image * (*image_new_l)(struct gui_priv *this, char *name);
+};
+
+struct gui_internal_widget_methods {
+ void (*append)(struct widget *parent, struct widget *child);
+ struct widget * (*button_new)(struct gui_priv *this, char *text, struct graphics_image *image, enum flags flags);
+ struct widget * (*button_new_with_callback)(struct gui_priv *this, char *text, struct graphics_image *image, enum flags flags, void(*func)(struct gui_priv *priv, struct widget *widget, void *data), void *data);
+ struct widget * (*box_new)(struct gui_priv *this, enum flags flags);
+ struct widget * (*label_new)(struct gui_priv *this, char *text);
+ struct widget * (*image_new)(struct gui_priv *this, struct graphics_image *image);
+ struct widget * (*keyboard)(struct gui_priv *this, int mode);
+ struct widget * (*menu)(struct gui_priv *this, char *label);
+ enum flags (*get_flags)(struct widget *widget);
+ void (*set_flags)(struct widget *widget, enum flags flags);
+ int (*get_state)(struct widget *widget);
+ void (*set_state)(struct widget *widget, int state);
+ void (*set_func)(struct widget *widget, void (*func)(struct gui_priv *priv, struct widget *widget, void *data));
+ void (*set_data)(struct widget *widget, void *data);
+ void (*set_default_background)(struct gui_priv *this, struct widget *widget);
+
+};
+
+struct gui_internal_data {
+ struct gui_priv *priv;
+ struct gui_internal_methods *gui;
+ struct gui_internal_widget_methods *widget;
+};
diff --git a/gui/win32/Makefile.am b/gui/win32/Makefile.am
new file mode 100644
index 00000000..06d91fac
--- /dev/null
+++ b/gui/win32/Makefile.am
@@ -0,0 +1,10 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = -I$(top_srcdir)/navit -I$(top_srcdir)/navit/graphics/win32 @NAVIT_CFLAGS@ -DMODULE=gui_win32
+if PLUGINS
+modulegui_LTLIBRARIES = libgui_win32.la
+else
+noinst_LTLIBRARIES = libgui_win32.la
+endif
+libgui_win32_la_SOURCES = gui_win32.c win32_gui_destination.c win32_gui_notify.c ceglue.h ceglue.c
+libgui_win32_la_LIBADD =
+libgui_win32_la_LDFLAGS = -module -avoid-version
diff --git a/gui/win32/ceglue.c b/gui/win32/ceglue.c
new file mode 100644
index 00000000..a0817f93
--- /dev/null
+++ b/gui/win32/ceglue.c
@@ -0,0 +1,77 @@
+#include <windows.h>
+#include "ceglue.h"
+
+BOOL FAR (*SHFullScreenPtr)(HWND hwnd, DWORD state) = NULL;
+
+void InitCeGlue (void)
+{
+ HINSTANCE ayg = LoadLibraryW (TEXT ("aygshell.dll"));
+ if (ayg != NULL) {
+ SHFullScreenPtr = (BOOL (*)(HWND, DWORD))
+ GetProcAddressW (ayg, TEXT ("SHFullScreen"));
+ }
+}
+
+// code to turn of screen adopted from
+// http://msdn.microsoft.com/en-us/library/ms838354.aspx
+
+// GDI Escapes for ExtEscape()
+#define QUERYESCSUPPORT 8
+
+// The following are unique to CE
+#define GETVFRAMEPHYSICAL 6144
+#define GETVFRAMELEN 6145
+#define DBGDRIVERSTAT 6146
+#define SETPOWERMANAGEMENT 6147
+#define GETPOWERMANAGEMENT 6148
+
+
+typedef enum _VIDEO_POWER_STATE {
+ VideoPowerOn = 1,
+ VideoPowerStandBy,
+ VideoPowerSuspend,
+ VideoPowerOff
+} VIDEO_POWER_STATE, *PVIDEO_POWER_STATE;
+
+
+typedef struct _VIDEO_POWER_MANAGEMENT {
+ ULONG Length;
+ ULONG DPMSVersion;
+ ULONG PowerState;
+} VIDEO_POWER_MANAGEMENT, *PVIDEO_POWER_MANAGEMENT;
+
+
+int CeEnableBacklight(int enable)
+{
+ HDC gdc;
+ int iESC=SETPOWERMANAGEMENT;
+
+ gdc = GetDC(NULL);
+ if (ExtEscape(gdc, QUERYESCSUPPORT, sizeof(int), (LPCSTR)&iESC,
+ 0, NULL)==0)
+ {
+ MessageBox(NULL,
+ L"Sorry, your Pocket PC does not support DisplayOff",
+ L"Pocket PC Display Off Feature",
+ MB_OK);
+ ReleaseDC(NULL, gdc);
+ return FALSE;
+ }
+ else
+ {
+ VIDEO_POWER_MANAGEMENT vpm;
+ vpm.Length = sizeof(VIDEO_POWER_MANAGEMENT);
+ vpm.DPMSVersion = 0x0001;
+ if (enable) {
+ vpm.PowerState = VideoPowerOn;
+ } else {
+ vpm.PowerState = VideoPowerOff;
+ }
+ // Power off the display
+ ExtEscape(gdc, SETPOWERMANAGEMENT, vpm.Length, (LPCSTR) &vpm,
+ 0, NULL);
+ ReleaseDC(NULL, gdc);
+ return TRUE;
+ }
+}
+
diff --git a/gui/win32/ceglue.h b/gui/win32/ceglue.h
new file mode 100644
index 00000000..b0dc79d4
--- /dev/null
+++ b/gui/win32/ceglue.h
@@ -0,0 +1,16 @@
+#ifndef CEGLUE_H
+#define CEGLUE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern BOOL (*SHFullScreenPtr)(HWND hwnd, DWORD state);
+void InitCeGlue (void);
+
+int CeEnableBacklight(int enable);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/gui/win32/gui_win32.c b/gui/win32/gui_win32.c
new file mode 100644
index 00000000..3596496a
--- /dev/null
+++ b/gui/win32/gui_win32.c
@@ -0,0 +1,643 @@
+#include <stdlib.h>
+#include <process.h>
+#include <windows.h>
+#include <glib.h>
+#include "config.h"
+#include "plugin.h"
+#include "gui.h"
+#include "graphics_win32.h"
+#include "point.h"
+#include "menu.h"
+#include "item.h"
+#include "attr.h"
+#include "callback.h"
+#include <commctrl.h>
+#include "debug.h"
+#include "util.h"
+#include "navit.h"
+#include "navit_nls.h"
+#ifdef __CEGCC__
+#include <sipapi.h>
+#include <aygshell.h>
+#include "ceglue.h"
+
+static int ce_backlight = 1;
+static int ce_fullscreen;
+#endif
+
+#ifdef HAVE_GLIB
+//static GHashTable *popup_callback_hash = NULL;
+static GArray *popup_menu_array;
+#endif
+
+const TCHAR g_szClassName[] = TEXT("navit_gui_class");
+
+
+static UINT_PTR menu_id = 0;
+
+#if 0
+static gboolean message_pump( gpointer data )
+{
+ MSG messages;
+
+ Sleep( 1 );
+
+ if (GetMessage (&messages, NULL, 0, 0))
+ {
+ TranslateMessage(&messages);
+ DispatchMessage(&messages);
+ }
+ else{
+ exit( 0 );
+ }
+ return TRUE;
+}
+
+static BOOL CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam)
+{
+ LPRECT rcParent;
+ int idChild;
+
+ idChild = GetWindowLong(hwndChild, GWL_ID);
+
+ if ( idChild == ID_CHILD_GFX )
+ {
+ rcParent = (LPRECT) lParam;
+
+ MoveWindow( hwndChild, 0, 0, rcParent->right, rcParent->bottom, TRUE );
+ PostMessage( hwndChild, WM_USER+1, 0, 0 );
+ }
+
+ return TRUE;
+}
+#endif
+
+#ifndef GET_WHEEL_DELTA_WPARAM
+ #define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam))
+#endif
+
+static void CreateToolBar(HWND hwnd)
+{
+ // Create Toolbar
+ HWND hTool;
+ TBBUTTON tbb[8];
+ TBADDBITMAP tbab;
+#if 0 /* def _WIN32_WCE */
+ /* Have to initialize common controls under CE */
+ INITCOMMONCONTROLSEX iccex;
+ iccex.dwSize = sizeof (INITCOMMONCONTROLSEX);
+ iccex.dwICC = ICC_BAR_CLASSES;
+ InitCommonControlsEx (&iccex);
+#else
+ InitCommonControls();
+#endif
+
+ hTool = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0,
+ hwnd, (HMENU)ID_CHILD_TOOLBAR, GetModuleHandle(NULL), NULL);
+
+ if(hTool == NULL)
+ MessageBox(hwnd, TEXT("Could not create tool bar."), TEXT("Error"), MB_OK | MB_ICONERROR);
+
+ SendMessage(hTool, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
+
+ tbab.hInst = GetModuleHandle(NULL);
+ tbab.nID = IDB_NAVITTOOLBAR;
+ int iImageOffset = SendMessage(hTool, TB_ADDBITMAP, 10, (LPARAM) &tbab);
+
+ int iStr;
+
+ ZeroMemory(tbb, sizeof(tbb));
+
+ tbb[0].iBitmap = iImageOffset;
+ tbb[0].fsState = TBSTATE_ENABLED;
+ tbb[0].fsStyle = TBSTYLE_BUTTON;
+ tbb[0].idCommand = ID_DISPLAY_ZOOMIN;
+ iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"ZoomIn" );
+ tbb[0].iString = iStr;
+
+ tbb[1].iBitmap = iImageOffset+1;
+ tbb[1].fsState = TBSTATE_ENABLED;
+ tbb[1].fsStyle = TBSTYLE_BUTTON;
+ tbb[1].idCommand = ID_DISPLAY_ZOOMOUT;
+ iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"ZoomOut" );
+ tbb[1].iString = iStr;
+
+ tbb[2].iBitmap = iImageOffset+4;
+ tbb[2].fsState = TBSTATE_ENABLED;
+ tbb[2].fsStyle = TBSTYLE_BUTTON;
+ tbb[2].idCommand = ID_DISPLAY_REFRESH;
+ iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"Refresh" );
+ tbb[2].iString = iStr;
+
+ tbb[3].iBitmap = iImageOffset+2;
+ tbb[3].fsState = TBSTATE_ENABLED;
+ tbb[3].fsStyle = TBSTYLE_BUTTON;
+ tbb[3].idCommand = ID_DISPLAY_ZOOMIN;
+ iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"Cursor" );
+ tbb[3].iString = iStr;
+
+ tbb[4].iBitmap = iImageOffset+5;
+ tbb[4].fsState = TBSTATE_ENABLED;
+ tbb[4].fsStyle = TBSTYLE_BUTTON;
+ tbb[4].idCommand = ID_DISPLAY_ORIENT;
+ iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"Orientation" );
+ tbb[4].iString = iStr;
+
+ tbb[5].iBitmap = iImageOffset+8;
+ tbb[5].fsState = TBSTATE_ENABLED;
+ tbb[5].fsStyle = TBSTYLE_BUTTON;
+ tbb[5].idCommand = ID_DISPLAY_ZOOMIN;
+ iStr= SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"Destination" );
+ tbb[5].iString = iStr;
+
+ tbb[6].iBitmap = iImageOffset+3;
+ tbb[6].fsState = TBSTATE_ENABLED;
+ tbb[6].fsStyle = TBSTYLE_BUTTON;
+ tbb[6].idCommand = ID_DISPLAY_ZOOMIN;
+ iStr= SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"Roadbook" );
+ tbb[6].iString = iStr;
+
+ tbb[7].iBitmap = iImageOffset+9;
+ tbb[7].fsState = TBSTATE_ENABLED;
+ tbb[7].fsStyle = TBSTYLE_BUTTON;
+ tbb[7].idCommand = ID_FILE_EXIT;
+ iStr= SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"_Quit" );
+ tbb[7].iString = iStr;
+
+ SendMessage(hTool, TB_ADDBUTTONS, sizeof(tbb)/sizeof(TBBUTTON), (LPARAM)&tbb);
+}
+
+static void window_layout( HWND hwnd )
+{
+#ifndef HAVE_API_WIN32_CE
+ RECT rcClient;
+ RECT rcTool;
+ int iToolHeight;
+
+ HWND hChild = GetDlgItem(hwnd, ID_CHILD_TOOLBAR);
+ SendMessage(hChild, TB_AUTOSIZE, 0, 0);
+
+ GetWindowRect(hChild, &rcTool);
+ iToolHeight = rcTool.bottom - rcTool.top;
+
+ GetClientRect(hwnd, &rcClient);
+ //printf( "BEFORE resize gui to: %d %d %d %d \n", rcClient.left, rcClient.right, rcClient.top, rcClient.bottom );
+
+ rcClient.top += iToolHeight;
+
+ dbg(0, "resize gui to: %d %d %d %d \n", rcClient.left, rcClient.right, rcClient.top, rcClient.bottom );
+
+
+ hChild = GetDlgItem(hwnd, ID_CHILD_GFX);
+ if ( hChild )
+ {
+ MoveWindow( hChild, rcClient.left, rcClient.top, rcClient.right- rcClient.left, rcClient.bottom - rcClient.top, TRUE );
+ PostMessage( hChild, WM_USER+1, 0, 0 );
+ }
+#endif
+}
+#ifdef __CEGCC__
+static void toggle_fullscreen(HWND mWnd)
+{
+ if (SHFullScreenPtr) {
+ if (!ce_fullscreen) {
+ (*SHFullScreenPtr)(mWnd, SHFS_HIDETASKBAR |
+ SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON);
+ } else {
+ (*SHFullScreenPtr)(mWnd, SHFS_HIDESIPBUTTON);
+ }
+ ce_fullscreen = !ce_fullscreen;
+ }
+}
+
+static void toggle_backlight(void)
+{
+ if (ce_backlight)
+ if (CeEnableBacklight(FALSE))
+ ce_backlight = 0;
+ else
+ if (CeEnableBacklight(TRUE))
+ ce_backlight = 1;
+}
+#endif
+
+static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
+{
+ RECT rcClient;
+
+// printf( "PARENT %d %d %d \n", Message, wParam, lParam );
+
+ switch(Message)
+ {
+ case WM_CREATE:
+ {
+ HMENU hMenu, hSubMenu;
+
+ CreateToolBar( hwnd );
+
+ hMenu = CreateMenu();
+ // g_this_->hwnd = hwnd;
+
+ hSubMenu = CreatePopupMenu();
+
+ AppendMenuW(hSubMenu, MF_STRING, ID_DISPLAY_ZOOMIN, L"ZoomIn" );
+ AppendMenuW(hSubMenu, MF_STRING, ID_DISPLAY_ZOOMOUT, L"ZoomOut" );
+ AppendMenuW(hSubMenu, MF_STRING, ID_DISPLAY_REFRESH, L"Refresh" );
+ AppendMenuW(hSubMenu, MF_SEPARATOR, 0, NULL );
+ AppendMenuW(hSubMenu, MF_STRING, ID_FILE_EXIT, L"_Quit" );
+
+ AppendMenuW(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, L"Display" );
+ hSubMenu = CreatePopupMenu();
+ AppendMenu(hSubMenu, MF_STRING, ID_STUFF_GO, TEXT("&Go"));
+ AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, TEXT("&Stuff"));
+
+#ifndef HAVE_API_WIN32_CE
+ SetMenu(hwnd, hMenu);
+#endif
+
+ window_layout( hwnd );
+
+ }
+ break;
+ case WM_COMMAND:
+ {
+ printf( "WM_COMMAND %d\n", LOWORD(wParam) );
+ struct gui_priv* gui = (struct gui_priv*)GetWindowLongPtr( hwnd , DWLP_USER );
+
+
+ switch(LOWORD(wParam))
+ {
+ case ID_DISPLAY_ZOOMIN:
+ navit_zoom_in(gui->nav, 2, NULL);
+ return 0;
+ break;
+ case ID_DISPLAY_ZOOMOUT:
+ navit_zoom_out(gui->nav, 2, NULL);
+ return 0;
+ break;
+ case ID_DISPLAY_REFRESH:
+ navit_draw(gui->nav);
+ return 0;
+ break;
+ case ID_DISPLAY_CURSOR:
+ {
+ struct attr attr;
+ attr.type=attr_cursor;
+ // TODO attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
+ if(!navit_set_attr(gui->nav, &attr)) {
+ dbg(0, "Failed to set attr_cursor\n");
+ }
+ return 0;
+ }
+ break;
+ case ID_DISPLAY_ORIENT:
+ {
+ struct attr attr;
+
+ attr.type=attr_orientation;
+ // attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
+ attr.u.num = 0; // TODO
+ if(!navit_set_attr(gui->nav, &attr)) {
+ dbg(0, "Failed to set attr_orientation\n");
+ }
+ return 0;
+ }
+
+ case ID_FILE_EXIT:
+ PostMessage(hwnd, WM_CLOSE, 0, 0);
+ return 0;
+ break;
+ }
+#if HAVE_GLIB
+ if ( popup_menu_array )
+ {
+ struct menu_priv* priv = (struct menu_priv*)g_array_index( popup_menu_array, gint, LOWORD(wParam) - POPUP_MENU_OFFSET );
+
+ if ( priv )
+ {
+ struct callback* cb = priv->cb;
+ if ( priv->cb )
+ {
+ callback_call_0( priv->cb );
+ return 0;
+ }
+ }
+ }
+#endif
+ }
+ break;
+ case WM_USER+ 1:
+ GetClientRect(hwnd, &rcClient);
+ printf( "resize gui to: %d %d \n", rcClient.right, rcClient.bottom );
+
+ window_layout( hwnd );
+ //EnumChildWindows(hwnd, EnumChildProc, (LPARAM) &rcClient);
+ return 0;
+ break;
+ case WM_CLOSE:
+ DestroyWindow(hwnd);
+ break;
+ case WM_SIZE:
+ window_layout( hwnd );
+ return 0;
+ break;
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ break;
+
+
+ case WM_MOUSEWHEEL:
+ {
+ struct gui_priv* gui = (struct gui_priv*)GetWindowLongPtr( hwnd , DWLP_USER );
+
+ short delta = GET_WHEEL_DELTA_WPARAM( wParam );
+ if ( delta > 0 )
+ {
+ navit_zoom_in(gui->nav, 2, NULL);
+ }
+ else{
+ navit_zoom_out(gui->nav, 2, NULL);
+ }
+ }
+ break;
+#ifdef HAVE_API_WIN32_CE
+ case WM_KEYDOWN:
+ {
+ struct point p;
+ int w,h;
+ struct gui_priv* gui = (struct gui_priv*)GetWindowLongPtr( hwnd , DWLP_USER );
+ transform_get_size(navit_get_trans(gui->nav), &w, &h);
+
+ if (wParam == VK_LEFT || wParam == '4') {
+ p.x=0;
+ p.y=h/2;
+ navit_set_center_screen(gui->nav, &p, 1);
+ } else if (wParam == VK_RIGHT || wParam == '6') {
+ p.x=w;
+ p.y=h/2;
+ navit_set_center_screen(gui->nav, &p, 1);
+ } else if (wParam == VK_UP || wParam == '2') {
+ p.x=w/2;
+ p.y=0;
+ navit_set_center_screen(gui->nav, &p, 1);
+ } else if (wParam == VK_DOWN || wParam == '8') {
+ p.x=w/2;
+ p.y=h;
+ navit_set_center_screen(gui->nav, &p, 1);
+ } else if (wParam == '1') {
+ navit_zoom_in(gui->nav, 2, NULL);
+ } else if (wParam == '3') {
+ navit_zoom_out(gui->nav, 2, NULL);
+ } else if (wParam == '7') {
+#if 0
+ toggle_backlight();
+#endif
+ } else if (wParam == '9') {
+#if 0
+ toggle_fullscreen(hwnd);
+#endif
+ }
+ }
+ break;
+#endif
+ default:
+ return DefWindowProc(hwnd, Message, wParam, lParam);
+ }
+ return 0;
+}
+
+static HANDLE CreateWin32Window( void )
+{
+#ifdef HAVE_API_WIN32_CE
+ WNDCLASS wc;
+#else
+ WNDCLASSEX wc;
+ wc.cbSize = sizeof(WNDCLASSEX);
+ wc.hIconSm = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_NAVIT));
+#endif
+ HWND hwnd;
+// MSG Msg;
+
+ wc.style = 0;
+ wc.lpfnWndProc = WndProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 32;
+ wc.hInstance = NULL;
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = g_szClassName;
+ wc.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_NAVIT));
+
+#ifdef HAVE_API_WIN32_CE
+ if(!RegisterClass(&wc))
+#else
+ if(!RegisterClassEx(&wc))
+#endif
+
+ {
+ MessageBox(NULL, TEXT("Window Registration Failed!"), TEXT("Error!"), MB_ICONEXCLAMATION | MB_OK);
+ return 0;
+ }
+
+ hwnd = CreateWindowEx(
+ WS_EX_CLIENTEDGE,
+ g_szClassName,
+ TEXT( "Navit" ),
+#ifdef HAVE_API_WIN32_CE
+ WS_SYSMENU | WS_CLIPCHILDREN,
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+#else
+
+ WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
+ CW_USEDEFAULT, CW_USEDEFAULT, 800, 600,
+#endif
+ NULL, NULL, NULL, NULL);
+
+ if(hwnd == NULL)
+ {
+ MessageBox(NULL, TEXT("Window Creation Failed!"), TEXT("Error!"), MB_ICONEXCLAMATION | MB_OK);
+ return 0;
+ }
+
+ ShowWindow(hwnd, TRUE);
+ UpdateWindow(hwnd);
+
+#if 0
+ g_idle_add (message_pump, NULL);
+#endif
+
+ return hwnd;
+}
+
+
+static int win32_gui_set_graphics(struct gui_priv *this_, struct graphics *gra)
+{
+ HANDLE* wndHandle_ptr = graphics_get_data(gra, "wnd_parent_handle_ptr");
+ *wndHandle_ptr = this_->hwnd;
+ graphics_get_data(gra, "START_CLIENT");
+ return 0;
+}
+
+
+static void win32_gui_add_bookmark_do(struct gui_priv *gui)
+{
+// navit_add_bookmark(gui->nav, &gui->dialog_coord, gtk_entry_get_text(GTK_ENTRY(gui->dialog_entry)));
+// gtk_widget_destroy(gui->dialog_win);
+}
+
+static int win32_gui_add_bookmark(struct gui_priv *gui, struct pcoord *c, char *description)
+{
+ return 1;
+}
+
+
+static struct menu_methods menu_methods;
+
+
+static struct menu_priv *add_menu( struct menu_priv *menu,
+ struct menu_methods *meth,
+ char *name,
+ enum menu_type type,
+ struct callback *cb)
+{
+ struct menu_priv* ret = NULL;
+
+ ret = g_new0(struct menu_priv, 1);
+
+ *ret = *menu;
+ *meth = menu_methods;
+
+ TCHAR *menuname = newSysString(name);
+
+ if ( type == menu_type_submenu )
+ {
+ HMENU hSubMenu = NULL;
+ hSubMenu = CreatePopupMenu();
+ AppendMenu(menu->hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, menuname );
+ ret->hMenu = hSubMenu;
+ }
+ else
+ {
+ AppendMenu( menu->hMenu, MF_STRING, menu_id, name );
+ }
+
+ // g_hash_table_insert( popup_callback_hash, GINT_TO_POINTER( menu_id ), (gpointer)cb );
+#if HAVE_GLIB
+ g_array_append_val( popup_menu_array, ret );
+#endif
+
+ ret->cb = cb;
+
+ menu_id++;
+
+ return ret;
+
+}
+
+static void set_toggle(struct menu_priv *menu, int active)
+{
+ // gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(menu->action), active);
+}
+
+static int get_toggle(struct menu_priv *menu)
+{
+ // return gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(menu->action));
+ return 0;
+}
+
+static struct menu_methods menu_methods = {
+ add_menu,
+ set_toggle,
+ get_toggle,
+};
+
+static void popup_activate(struct menu_priv *menu)
+{
+ POINT pnt;
+ GetCursorPos( &pnt );
+
+ if (menu->hMenu)
+ {
+ TrackPopupMenu( menu->hMenu, 0, pnt.x, pnt.y, 0, menu->wnd_handle, NULL );
+ DestroyMenu( menu->hMenu );
+ }
+}
+
+
+static void popup_deactivate( struct menu_priv *menu )
+{
+ DestroyMenu( menu->hMenu );
+}
+
+static struct menu_priv* win32_gui_popup_new(struct gui_priv *this_, struct menu_methods *meth)
+{
+ struct menu_priv* ret = NULL;
+
+ ret = g_new0(struct menu_priv, 1);
+ *meth = menu_methods;
+
+ menu_id = POPUP_MENU_OFFSET;
+
+#if HAVE_GLIB
+ if ( popup_menu_array )
+ {
+ g_array_free (popup_menu_array, TRUE);
+ popup_menu_array = NULL;
+ }
+
+ popup_menu_array = g_array_new (FALSE, FALSE, sizeof (gint));
+#endif
+
+ ret->cb = NULL;
+ ret->hMenu = CreatePopupMenu();
+ ret->wnd_handle = this_->hwnd;
+ meth->popup=popup_activate;
+
+printf( "create popup menu %d \n", ret->hMenu );
+
+ return ret;
+}
+
+struct gui_methods win32_gui_methods = {
+ NULL, // win32_gui_menubar_new,
+ win32_gui_popup_new,
+ win32_gui_set_graphics,
+ NULL,
+ NULL, // win32_gui_datawindow_new,
+ win32_gui_add_bookmark,
+};
+
+
+
+static struct gui_priv *win32_gui_new( struct navit *nav, struct gui_methods *meth, struct attr **attrs)
+{
+ struct gui_priv *this_;
+#ifdef HAVE_API_WIN32_CE
+ /* Do not run multiple instances under CE */
+ HWND prev;
+ prev = FindWindow(g_szClassName, NULL);
+ if (prev) {
+ ShowWindow(prev, SW_RESTORE);
+ SetForegroundWindow(prev);
+ InvalidateRect (prev, NULL, FALSE);
+ exit(0);
+ }
+ InitCeGlue();
+#endif
+
+ *meth=win32_gui_methods;
+
+ this_=g_new0(struct gui_priv, 1);
+ this_->nav=nav;
+
+ this_->hwnd = CreateWin32Window();
+ SetWindowLongPtr( this_->hwnd , DWLP_USER, (LONG_PTR)this_ );
+
+ return this_;
+}
+
+void plugin_init(void)
+{
+ plugin_register_gui_type("win32", win32_gui_new);
+}
diff --git a/gui/win32/resources/navit.ico b/gui/win32/resources/navit.ico
new file mode 100644
index 00000000..6fd707da
--- /dev/null
+++ b/gui/win32/resources/navit.ico
Binary files differ
diff --git a/navit/gui/win32/resources/resource.h b/gui/win32/resources/resource.h
index 55bcc2d7..55bcc2d7 100644
--- a/navit/gui/win32/resources/resource.h
+++ b/gui/win32/resources/resource.h
diff --git a/projs/CodeBlocks/win32gui/resources/resource.rc b/gui/win32/resources/resource.rc
index d31d89c1..d31d89c1 100644
--- a/projs/CodeBlocks/win32gui/resources/resource.rc
+++ b/gui/win32/resources/resource.rc
diff --git a/projs/CodeBlocks/win32gui/resources/toolbar.bmp b/gui/win32/resources/toolbar.bmp
index 17381d83..17381d83 100644
--- a/projs/CodeBlocks/win32gui/resources/toolbar.bmp
+++ b/gui/win32/resources/toolbar.bmp
Binary files differ
diff --git a/gui/win32/win32_gui_destination.c b/gui/win32/win32_gui_destination.c
new file mode 100644
index 00000000..67eae07c
--- /dev/null
+++ b/gui/win32/win32_gui_destination.c
@@ -0,0 +1,412 @@
+#include <windows.h>
+#include <windowsx.h>
+#include <commctrl.h>
+#include <glib.h>
+#include "item.h"
+#include "attr.h"
+#include "navit.h"
+#include "search.h"
+#include "debug.h"
+#include "util.h"
+#include "win32_gui_notify.h"
+#include "resources/resource.h"
+
+static const TCHAR g_szDestinationClassName[] = TEXT("navit_gui_destinationwindow_class");
+
+struct datawindow_priv
+{
+ HWND hwnd;
+ HWND hwndLabel;
+ HWND hwndEdit;
+ HWND hwndList;
+ HWND hwndButtonPrev;
+ HWND hwndButtonNext;
+ enum attr_type currentSearchState;
+ struct search_list *sl;
+ struct navit *nav;
+ struct notify_priv *notifications;
+};
+
+static void setlayout(struct datawindow_priv *datawindow)
+{
+ LVCOLUMN lvc;
+ lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
+
+ RECT winrect;
+ GetWindowRect (datawindow->hwndList, &winrect);
+
+ lvc.iSubItem = 1;
+ lvc.cx = (winrect.right - winrect.left) - 52 ;
+ lvc.fmt = LVCFMT_LEFT; // left-aligned column
+
+ switch (datawindow->currentSearchState)
+ {
+ case attr_country_name:
+ {
+ Edit_SetText(datawindow->hwndLabel, TEXT("Country"));
+ lvc.pszText = TEXT("Country");
+ }
+ break;
+ case attr_town_name:
+ {
+ Edit_SetText(datawindow->hwndLabel, TEXT("Postal or Town"));
+ lvc.pszText = TEXT("Town");
+ }
+ break;
+ case attr_street_name:
+ {
+ Edit_SetText(datawindow->hwndLabel, TEXT("Street"));
+ lvc.pszText = TEXT("Street");
+ }
+ break;
+ default:
+ break;
+
+ }
+
+ (void)ListView_SetColumn(datawindow->hwndList, 1, &lvc);
+
+ Edit_SetText(datawindow->hwndEdit, TEXT(""));
+ SetFocus(datawindow->hwndEdit);
+}
+
+static void notify_apply(struct datawindow_priv *datawindow, int index, int param2)
+{
+ TCHAR txtBuffer[1024];
+ char search_string[1024];
+ struct attr search_attr;
+ struct search_list_result *res;
+
+
+ if ( index >= 0 )
+ {
+ ListView_GetItemText(datawindow->hwndList, index, 1, txtBuffer, 1024);
+
+ TCHAR_TO_UTF8(txtBuffer, search_string);
+
+ search_attr.type = datawindow->currentSearchState;
+ search_attr.u.str = search_string;
+
+ search_list_search(datawindow->sl, &search_attr, 0);
+ res=search_list_get_result(datawindow->sl);
+ }
+
+ switch (datawindow->currentSearchState)
+ {
+ case attr_country_name:
+ {
+ datawindow->currentSearchState = attr_town_name;
+ }
+ break;
+ case attr_town_name:
+ {
+ datawindow->currentSearchState = attr_street_name;
+ }
+ break;
+ case attr_street_name:
+ {
+ navit_set_destination(datawindow->nav, res->c, "Mein Test", 1);
+ DestroyWindow(datawindow->hwnd);
+ }
+ break;
+ default:
+ break;
+
+ }
+
+ setlayout(datawindow);
+
+}
+
+static void notify_back(struct datawindow_priv *datawindow, int param1, int param2)
+{
+ switch (datawindow->currentSearchState)
+ {
+ case attr_country_name:
+ break;
+ case attr_town_name:
+ {
+ datawindow->currentSearchState = attr_country_name;
+ }
+ break;
+ case attr_street_name:
+ {
+ datawindow->currentSearchState = attr_town_name;
+ }
+ break;
+ default:
+ break;
+
+ }
+
+ setlayout(datawindow);
+}
+
+static void notify_textchange(struct datawindow_priv *datawindow, int param1, int param2)
+{
+
+ struct attr search_attr;
+ struct search_list_result *res;
+ char search_string[1024];
+ TCHAR converted_iso2[32];
+
+
+ int lineLength = Edit_LineLength(datawindow->hwndEdit, 0);
+ TCHAR line[lineLength + 1];
+ (void)Edit_GetLine(datawindow->hwndEdit, 0, line, lineLength + 1);
+ line[lineLength] = 0;
+
+
+ (void)ListView_DeleteAllItems( datawindow->hwndList);
+
+ TCHAR_TO_UTF8(line, search_string);
+
+ search_attr.type = datawindow->currentSearchState;
+ search_attr.u.str = search_string;
+
+ if (lineLength<1)
+ return;
+
+ search_list_search(datawindow->sl, &search_attr, 1);
+
+
+ TCHAR *tcharBuffer = NULL;
+ int listIndex = 0;
+ LVITEM lvI;
+
+ lvI.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE;
+ lvI.state = 0;
+ lvI.stateMask = 0;
+
+ while ((res=search_list_get_result(datawindow->sl)) && listIndex < 50)
+ {
+
+ switch (search_attr.type)
+ {
+ case attr_country_name:
+ tcharBuffer = newSysString(res->country->name);
+ break;
+ case attr_town_name:
+ tcharBuffer = newSysString(res->town->name);
+ break;
+ case attr_street_name:
+ if (res->street->name)
+ {
+ tcharBuffer = newSysString(res->street->name);
+ }
+ else
+ {
+ continue;
+ }
+ break;
+ default:
+ dbg(0, "Unhandled search type");
+ }
+
+ lvI.iItem = listIndex;
+ lvI.iImage = listIndex;
+ lvI.iSubItem = 0;
+ lvI.lParam = (LPARAM) res->country->iso2;
+ UTF8_TO_TCHAR(res->country->iso2, converted_iso2);
+ lvI.pszText = converted_iso2;//LPSTR_TEXTCALLBACK; // sends an LVN_GETDISP message.
+ (void)ListView_InsertItem(datawindow->hwndList, &lvI);
+ ListView_SetItemText(datawindow->hwndList, listIndex, 1, tcharBuffer);
+ g_free(tcharBuffer);
+ dbg(0,"%s\n", res->country->name);
+ listIndex++;
+ }
+}
+
+static void notify_destroy(struct datawindow_priv *datawindow, int param1, int param2)
+{
+ if ( datawindow )
+ {
+ search_list_destroy(datawindow->sl);
+ g_free(datawindow);
+ }
+}
+
+static void notify_size(struct datawindow_priv *datawindow, int width, int height)
+{
+ if (datawindow)
+ {
+ MoveWindow(datawindow->hwndLabel,
+ 0, 0, // starting x- and y-coordinates
+ width, // width of client area
+ 20, // height of client area
+ TRUE); // repaint window
+ MoveWindow(datawindow->hwndEdit,
+ 0, 20, // starting x- and y-coordinates
+ width, // width of client area
+ 20, // height of client area
+ TRUE); // repaint window
+ MoveWindow(datawindow->hwndList,
+ 0, 40, // starting x- and y-coordinates
+ width, // width of client area
+ height - 60, // height of client area
+ TRUE); // repaint window
+ MoveWindow(datawindow->hwndButtonPrev,
+ 0, height - 20, // starting x- and y-coordinates
+ width/2, // width of client area
+ 20, // height of client area
+ TRUE); // repaint window
+ MoveWindow(datawindow->hwndButtonNext,
+ width/2, height - 20, // starting x- and y-coordinates
+ width/2, // width of client area
+ 20, // height of client area
+ TRUE); // repaint window
+
+ setlayout(datawindow);
+
+ }
+}
+
+static BOOL init_lv_columns(HWND hWndListView)
+{
+
+// struct LVCOLUMN lvc = {LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM,
+// LVCFMT_LEFT, 100, szText[iCol], 0, iCol, 0, 0 };
+
+ TCHAR szText[][8] = {TEXT("Iso"),TEXT("Country")}; // temporary buffer
+ LVCOLUMN lvc;
+ int iCol;
+
+ lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
+
+ for (iCol = 0; iCol < 2; iCol++)
+ {
+ lvc.iSubItem = iCol;
+ lvc.pszText = szText[iCol];
+ lvc.cx = 50; // width of column in pixels
+
+ if ( iCol < 2 )
+ lvc.fmt = LVCFMT_LEFT; // left-aligned column
+ else
+ lvc.fmt = LVCFMT_RIGHT; // right-aligned column
+
+ if (ListView_InsertColumn(hWndListView, iCol, &lvc) == -1)
+ return FALSE;
+ }
+ return TRUE;
+}
+
+BOOL register_destination_window()
+{
+ WNDCLASS wc;
+
+ wc.style = 0;
+ wc.lpfnWndProc = message_handler;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 32;
+ wc.hInstance = NULL;
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = g_szDestinationClassName;
+ wc.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_NAVIT));
+
+ if (!RegisterClass(&wc))
+ {
+ dbg(0, "Window Registration Failed!\n");
+ return FALSE;
+ }
+ return TRUE;
+}
+
+HANDLE create_destination_window( struct navit *nav )
+{
+
+
+ struct datawindow_priv *this_;
+
+ this_=g_new0(struct datawindow_priv, 1);
+ this_->nav = nav;
+ this_->currentSearchState = attr_country_name;
+ this_->sl=search_list_new(navit_get_mapset(this_->nav));
+
+ this_->hwnd = CreateWindowEx(
+ WS_EX_CLIENTEDGE,
+ g_szDestinationClassName,
+ TEXT("Destination Input"),
+#if defined(__CEGCC__)
+ WS_SYSMENU | WS_CLIPCHILDREN,
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+#else
+ WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
+ CW_USEDEFAULT, CW_USEDEFAULT, 640, 480,
+#endif
+ NULL, NULL, NULL, NULL);
+
+ if (this_->hwnd == NULL)
+ {
+ dbg(0, "Window Creation Failed!\n");
+ return 0;
+ }
+
+ this_->notifications = win32_gui_notify_new(this_);
+ SetWindowLongPtr( this_->hwnd , DWLP_USER, (LONG_PTR) this_->notifications );
+
+ this_->hwndLabel = CreateWindow(WC_STATIC, // predefined class
+ TEXT("Country"), // no window title
+ WS_CHILD | WS_VISIBLE | ES_LEFT , //| WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL
+ 0, 0, 0, 0, // set size in WM_SIZE message
+ this_->hwnd, // parent window
+ NULL,//(HMENU) ID_EDITCHILD, // edit control ID
+ (HINSTANCE) GetWindowLong(this_->hwnd, GWL_HINSTANCE),
+ NULL); // pointer not needed
+
+ this_->hwndEdit = CreateWindow(WC_EDIT, // predefined class
+ NULL, // no window title
+ WS_CHILD | WS_VISIBLE | ES_LEFT | WS_BORDER , //| WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL
+ 0, 0, 0, 0, // set size in WM_SIZE message
+ this_->hwnd, // parent window
+ NULL,//(HMENU) ID_EDITCHILD, // edit control ID
+ (HINSTANCE) GetWindowLong(this_->hwnd, GWL_HINSTANCE),
+ NULL); // pointer not needed
+
+ this_->hwndList = CreateWindow(WC_LISTVIEW, // predefined class
+ NULL, // no window title
+ WS_CHILD | WS_VISIBLE | ES_LEFT | WS_BORDER | LVS_REPORT , //| WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL
+ 0, 0, 0, 0, // set size in WM_SIZE message
+ this_->hwnd, // parent window
+ NULL,//(HMENU) ID_EDITCHILD, // edit control ID
+ (HINSTANCE) GetWindowLong(this_->hwnd, GWL_HINSTANCE),
+ NULL); // pointer not needed
+
+ this_->hwndButtonPrev = CreateWindow(WC_BUTTON, // predefined class
+ TEXT("<<"), // no window title
+ WS_CHILD | WS_VISIBLE | ES_LEFT | WS_BORDER | LVS_REPORT , //| WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL
+ 0, 0, 0, 0, // set size in WM_SIZE message
+ this_->hwnd, // parent window
+ NULL,//(HMENU) ID_EDITCHILD, // edit control ID
+ (HINSTANCE) GetWindowLong(this_->hwnd, GWL_HINSTANCE),
+ NULL); // pointer not needed
+ this_->hwndButtonNext = CreateWindow(WC_BUTTON, // predefined class
+ TEXT(">>"), // no window title
+ WS_CHILD | WS_VISIBLE | ES_LEFT | WS_BORDER | LVS_REPORT , //| WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL
+ 0, 0, 0, 0, // set size in WM_SIZE message
+ this_->hwnd, // parent window
+ NULL,//(HMENU) ID_EDITCHILD, // edit control ID
+ (HINSTANCE) GetWindowLong(this_->hwnd, GWL_HINSTANCE),
+ NULL); // pointer not needed
+#ifdef LVS_EX_FULLROWSELECT
+ (void)ListView_SetExtendedListViewStyle(this_->hwndList,LVS_EX_FULLROWSELECT);
+#endif
+
+
+ win32_gui_notify( this_->notifications, this_->hwndEdit, CHANGE, notify_textchange);
+ win32_gui_notify( this_->notifications, NULL, WINDOW_SIZE, notify_size);
+ win32_gui_notify( this_->notifications, this_->hwndList, DBLCLICK, notify_apply);
+ win32_gui_notify( this_->notifications, this_->hwnd, WINDOW_DESTROY, notify_destroy);
+
+ win32_gui_notify( this_->notifications, this_->hwndButtonNext, BUTTON_CLICK, notify_apply);
+ win32_gui_notify( this_->notifications, this_->hwndButtonPrev, BUTTON_CLICK, notify_back);
+
+ init_lv_columns(this_->hwndList);
+ SetFocus(this_->hwndEdit);
+ ShowWindow(this_->hwnd, TRUE);
+ UpdateWindow(this_->hwnd);
+
+ return this_->hwnd;
+}
+
diff --git a/gui/win32/win32_gui_notify.c b/gui/win32/win32_gui_notify.c
new file mode 100644
index 00000000..c801e9da
--- /dev/null
+++ b/gui/win32/win32_gui_notify.c
@@ -0,0 +1,132 @@
+#include <windows.h>
+#include <windowsx.h>
+#include <commctrl.h>
+#include <glib.h>
+#include "win32_gui_notify.h"
+
+struct window_data
+{
+ HWND hwnd;
+ UINT message;
+ void(*func)(struct datawindow_priv *parent, int param1, int param2);
+};
+
+struct notify_priv
+{
+ GList *window_list;
+ struct datawindow_priv *parent;
+
+};
+
+
+void win32_gui_notify(struct notify_priv* notify, HWND hwnd, int message_id, void(*func)(struct datawindow_priv *parent, int param1, int param2))
+{
+ struct window_data *wnd_data = g_new( struct window_data,1);
+
+ wnd_data->hwnd = hwnd;
+ wnd_data->message = message_id;
+ wnd_data->func = func;
+
+ notify->window_list = g_list_append( notify->window_list, (gpointer) wnd_data );
+
+}
+
+struct notify_priv* win32_gui_notify_new(struct datawindow_priv *parent)
+{
+ struct notify_priv* notify = g_new0(struct notify_priv,1);
+ notify->parent = parent;
+ return notify;
+}
+
+LRESULT CALLBACK message_handler(HWND hwnd, UINT win_message, WPARAM wParam, LPARAM lParam)
+{
+ enum message_id message = INVALID;
+ int param1 = -1;
+ int param2 = -1;
+ HWND hwndDlg = hwnd;
+
+ switch (win_message)
+ {
+ case WM_CREATE:
+ {
+ message = WINDOW_CREATE;
+ }
+ break;
+ case WM_SIZE:
+ {
+ message = WINDOW_SIZE;
+ param1 = LOWORD(lParam);
+ param2 = HIWORD(lParam);
+ }
+ break;
+ case WM_DESTROY:
+ {
+ message = WINDOW_DESTROY;
+ }
+ break;
+ case WM_NOTIFY:
+ {
+ hwndDlg = (((LPNMHDR)lParam)->hwndFrom);
+ switch (((LPNMHDR)lParam)->code)
+ {
+ case NM_DBLCLK:
+ {
+ message = DBLCLICK;
+#ifdef LPNMITEMACTIVATE
+ param1 = ((LPNMITEMACTIVATE)lParam)->iItem;
+#endif
+ }
+ break;
+ case NM_CLICK:
+ message = CLICK;
+ break;
+ }
+ }
+ break;
+ case WM_COMMAND:
+ {
+ hwndDlg = (HWND)lParam;
+
+ switch (HIWORD(wParam))
+ {
+ case EN_CHANGE:
+ {
+ message = CHANGE;
+ }
+ break;
+ case BN_CLICKED:
+ {
+ message = BUTTON_CLICK;
+ }
+ break;
+ }
+ }
+ break;
+
+ default:
+ return DefWindowProc(hwnd, win_message, wParam, lParam);
+ }
+
+ struct notify_priv* notify_data = (struct notify_priv*)GetWindowLongPtr( hwnd , DWLP_USER );
+
+ if ( message != INVALID && notify_data && notify_data->window_list )
+ {
+
+ GList* current_element = g_list_first(notify_data->window_list);
+
+
+ struct window_data* wnd_data = NULL;
+ while (current_element != NULL)
+ {
+ wnd_data = current_element->data;
+
+ if ( (wnd_data->hwnd == hwndDlg || wnd_data->hwnd == NULL) && message == wnd_data->message)
+ {
+ wnd_data->func(notify_data->parent, param1, param2);
+ }
+
+ current_element = g_list_next(current_element);
+ }
+ }
+ return FALSE;
+}
diff --git a/navit/gui/win32/win32_gui_notify.h b/gui/win32/win32_gui_notify.h
index 7c791e15..7c791e15 100644
--- a/navit/gui/win32/win32_gui_notify.h
+++ b/gui/win32/win32_gui_notify.h
diff --git a/intl/VERSION b/intl/VERSION
deleted file mode 100644
index b4b846ca..00000000
--- a/intl/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-GNU gettext library from gettext-0.14.1
diff --git a/item.c b/item.c
new file mode 100644
index 00000000..ec20514f
--- /dev/null
+++ b/item.c
@@ -0,0 +1,330 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+#include "coord.h"
+#include "debug.h"
+#include "item.h"
+#include "map.h"
+#include "transform.h"
+
+struct item_name {
+ enum item_type item;
+ char *name;
+};
+
+struct item_range item_range_all = { type_none, type_last };
+
+#define AF_PBH (AF_PEDESTRIAN|AF_BIKE|AF_HORSE)
+#define AF_MOTORIZED_FAST (AF_MOTORCYCLE|AF_CAR|AF_HIGH_OCCUPANCY_CAR|AF_TAXI|AF_PUBLIC_BUS|AF_DELIVERY_TRUCK|AF_TRANSPORT_TRUCK|AF_EMERGENCY_VEHICLES|AF_DANGEROUS_GOODS)
+#define AF_ALL (AF_PBH|AF_MOPED|AF_MOTORIZED_FAST)
+
+
+struct default_flags {
+ enum item_type type;
+ int flags;
+};
+
+struct default_flags default_flags2[]={
+ {type_street_nopass, AF_PBH},
+ {type_street_0, AF_ALL},
+ {type_street_1_city, AF_ALL},
+ {type_street_2_city, AF_ALL},
+ {type_street_3_city, AF_ALL},
+ {type_street_4_city, AF_ALL},
+ {type_highway_city, AF_MOTORIZED_FAST},
+ {type_street_1_land, AF_ALL},
+ {type_street_2_land, AF_ALL},
+ {type_street_3_land, AF_ALL},
+ {type_street_4_land, AF_ALL},
+ {type_street_n_lanes, AF_MOTORIZED_FAST},
+ {type_highway_land, AF_MOTORIZED_FAST},
+ {type_ramp, AF_MOTORIZED_FAST},
+ {type_roundabout, AF_ALL},
+ {type_ferry, AF_ALL},
+ {type_cycleway, AF_PBH},
+ {type_track_paved, AF_ALL},
+ {type_track_gravelled, AF_ALL},
+ {type_track_unpaved, AF_ALL},
+ {type_track_ground, AF_ALL},
+ {type_track_grass, AF_ALL},
+ {type_footway, AF_PBH},
+ {type_living_street, AF_ALL},
+ {type_street_service, AF_ALL},
+ {type_bridleway, AF_PBH},
+ {type_path, AF_PBH},
+};
+
+
+
+struct item_name item_names[]={
+#define ITEM2(x,y) ITEM(y)
+#define ITEM(x) { type_##x, #x },
+#include "item_def.h"
+#undef ITEM2
+#undef ITEM
+};
+
+static GHashTable *default_flags_hash;
+
+int *
+item_get_default_flags(enum item_type type)
+{
+ if (!default_flags_hash) {
+ int i;
+ default_flags_hash=g_hash_table_new(NULL, NULL);
+ for (i = 0 ; i < sizeof(default_flags2)/sizeof(struct default_flags); i++) {
+ g_hash_table_insert(default_flags_hash, (void *)(long)default_flags2[i].type, &default_flags2[i].flags);
+ }
+ }
+ return g_hash_table_lookup(default_flags_hash, (void *)(long)type);
+}
+
+void
+item_coord_rewind(struct item *it)
+{
+ it->meth->item_coord_rewind(it->priv_data);
+}
+
+int
+item_coord_get(struct item *it, struct coord *c, int count)
+{
+ return it->meth->item_coord_get(it->priv_data, c, count);
+}
+
+int
+item_coord_set(struct item *it, struct coord *c, int count, enum change_mode mode)
+{
+ if (!it->meth->item_coord_set)
+ return 0;
+ return it->meth->item_coord_set(it->priv_data, c, count, mode);
+}
+
+int
+item_coord_get_within_selection(struct item *it, struct coord *c, int count, struct map_selection *sel)
+{
+ int i,ret=it->meth->item_coord_get(it->priv_data, c, count);
+ struct coord_rect r;
+ struct map_selection *curr;
+ if (ret <= 0 || !sel)
+ return ret;
+ r.lu=c[0];
+ r.rl=c[0];
+ for (i = 1 ; i < ret ; i++) {
+ if (r.lu.x > c[i].x)
+ r.lu.x=c[i].x;
+ if (r.rl.x < c[i].x)
+ r.rl.x=c[i].x;
+ if (r.rl.y > c[i].y)
+ r.rl.y=c[i].y;
+ if (r.lu.y < c[i].y)
+ r.lu.y=c[i].y;
+ }
+ curr=sel;
+ while (curr) {
+ struct coord_rect *sr=&curr->u.c_rect;
+ if (r.lu.x <= sr->rl.x && r.rl.x >= sr->lu.x &&
+ r.lu.y >= sr->rl.y && r.rl.y <= sr->lu.y)
+ return ret;
+ curr=curr->next;
+ }
+ return 0;
+}
+
+int
+item_coord_get_pro(struct item *it, struct coord *c, int count, enum projection to)
+{
+ int ret=item_coord_get(it, c, count);
+ int i;
+ enum projection from=map_projection(it->map);
+ if (from != to)
+ for (i = 0 ; i < count ; i++)
+ transform_from_to(c+i, from, c+i, to);
+ return ret;
+}
+
+int
+item_coord_is_node(struct item *it)
+{
+ if (it->meth->item_coord_is_node)
+ return it->meth->item_coord_is_node(it->priv_data);
+ return 0;
+}
+
+void
+item_attr_rewind(struct item *it)
+{
+ it->meth->item_attr_rewind(it->priv_data);
+}
+
+int
+item_attr_get(struct item *it, enum attr_type attr_type, struct attr *attr)
+{
+ return it->meth->item_attr_get(it->priv_data, attr_type, attr);
+}
+
+int
+item_attr_set(struct item *it, struct attr *attr, enum change_mode mode)
+{
+ if (!it->meth->item_attr_set)
+ return 0;
+ return it->meth->item_attr_set(it->priv_data, attr, mode);
+}
+
+struct item * item_new(char *type, int zoom)
+{
+ struct item * it;
+
+ it = g_new0(struct item, 1);
+
+ /* FIXME evaluate arguments */
+
+ return it;
+}
+
+enum item_type
+item_from_name(const char *name)
+{
+ int i;
+
+ for (i=0 ; i < sizeof(item_names)/sizeof(struct item_name) ; i++) {
+ if (! strcmp(item_names[i].name, name))
+ return item_names[i].item;
+ }
+ return type_none;
+}
+
+char *
+item_to_name(enum item_type item)
+{
+ int i;
+
+ for (i=0 ; i < sizeof(item_names)/sizeof(struct item_name) ; i++) {
+ if (item_names[i].item == item)
+ return item_names[i].name;
+ }
+ return NULL;
+}
+
+struct item_hash {
+ GHashTable *h;
+};
+
+static guint
+item_hash_hash(gconstpointer key)
+{
+ const struct item *itm=key;
+ gconstpointer hashkey=(gconstpointer)(itm->id_hi^itm->id_lo^((int) itm->map));
+ return g_direct_hash(hashkey);
+}
+
+static gboolean
+item_hash_equal(gconstpointer a, gconstpointer b)
+{
+ const struct item *itm_a=a;
+ const struct item *itm_b=b;
+ if (item_is_equal(*itm_a, *itm_b))
+ return TRUE;
+ return FALSE;
+}
+
+
+
+struct item_hash *
+item_hash_new(void)
+{
+ struct item_hash *ret=g_new(struct item_hash, 1);
+
+ ret->h=g_hash_table_new_full(item_hash_hash, item_hash_equal, g_free, NULL);
+ return ret;
+}
+
+void
+item_hash_insert(struct item_hash *h, struct item *item, void *val)
+{
+ struct item *hitem=g_new(struct item, 1);
+ *hitem=*item;
+ dbg(2,"inserting (0x%x,0x%x) into %p\n", item->id_hi, item->id_lo, h->h);
+ g_hash_table_insert(h->h, hitem, val);
+}
+
+int
+item_hash_remove(struct item_hash *h, struct item *item)
+{
+ int ret;
+
+ dbg(2,"removing (0x%x,0x%x) from %p\n", item->id_hi, item->id_lo, h->h);
+ ret=g_hash_table_remove(h->h, item);
+ dbg(2,"ret=%d\n", ret);
+
+ return ret;
+}
+
+void *
+item_hash_lookup(struct item_hash *h, struct item *item)
+{
+ return g_hash_table_lookup(h->h, item);
+}
+
+
+void
+item_hash_destroy(struct item_hash *h)
+{
+ g_hash_table_destroy(h->h);
+ g_free(h);
+}
+
+int
+item_range_intersects_range(struct item_range *range1, struct item_range *range2)
+{
+ if (range1->max < range2->min)
+ return 0;
+ if (range1->min > range2->max)
+ return 0;
+ return 1;
+}
+int
+item_range_contains_item(struct item_range *range, enum item_type type)
+{
+ if (type >= range->min && type <= range->max)
+ return 1;
+ return 0;
+}
+
+void
+item_dump_filedesc(struct item *item, struct map *map, FILE *out)
+{
+
+ int i,count,max=16384;
+ struct coord ca[max];
+ struct attr attr;
+
+ count=item_coord_get(item, ca, item->type < type_line ? 1: max);
+ if (item->type < type_line)
+ fprintf(out,"mg:0x%x 0x%x ", ca[0].x, ca[0].y);
+ fprintf(out,"type=%s", item_to_name(item->type));
+ while (item_attr_get(item, attr_any, &attr))
+ fprintf(out," %s='%s'", attr_to_name(attr.type), attr_to_text(&attr, map, 1));
+ fprintf(out,"\n");
+ if (item->type >= type_line)
+ for (i = 0 ; i < count ; i++)
+ fprintf(out,"mg:0x%x 0x%x\n", ca[i].x, ca[i].y);
+}
diff --git a/item.h b/item.h
new file mode 100644
index 00000000..7445a57e
--- /dev/null
+++ b/item.h
@@ -0,0 +1,133 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_ITEM_H
+#define NAVIT_ITEM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+enum item_type {
+#define ITEM2(x,y) type_##y=x,
+#define ITEM(x) type_##x,
+#include "item_def.h"
+#undef ITEM2
+#undef ITEM
+};
+
+#define route_item_first type_street_0
+#define route_item_last type_ferry
+extern int default_flags[];
+
+#include "attr.h"
+
+
+/* NOTE: we treat districts as towns for now, since
+ a) navit does not implement district search yet
+ b) OSM "place=suburb" maps to type_district in osm2navit. with the OSM USA maps,
+ there are many "suburbs" that users will consider towns (not districts/counties);
+ we want navit's town search to find them
+*/
+#define item_is_town(item) ((item).type >= type_town_label && (item).type <= type_district_label_1e7)
+#define item_is_district(item) ((item).type >= type_district_label && (item).type <= type_district_label_1e7)
+
+#define item_is_equal_id(a,b) ((a).id_hi == (b).id_hi && (a).id_lo == (b).id_lo)
+#define item_is_equal(a,b) (item_is_equal_id(a,b) && (a).map == (b).map)
+
+struct coord;
+
+enum change_mode {
+ change_mode_delete,
+ change_mode_modify,
+ change_mode_append,
+ change_mode_prepend,
+};
+
+struct item_methods {
+ void (*item_coord_rewind)(void *priv_data);
+ int (*item_coord_get)(void *priv_data, struct coord *c, int count);
+ void (*item_attr_rewind)(void *priv_data);
+ int (*item_attr_get)(void *priv_data, enum attr_type attr_type, struct attr *attr);
+ int (*item_coord_is_node)(void *priv_data);
+ int (*item_attr_set)(void *priv_data, struct attr *attr, enum change_mode mode);
+ int (*item_coord_set)(void *priv_data, struct coord *c, int count, enum change_mode mode);
+ int (*item_type_set)(void *priv_data, enum item_type type);
+};
+
+struct item_id {
+ int id_hi;
+ int id_lo;
+};
+
+struct item {
+ enum item_type type;
+ int id_hi;
+ int id_lo;
+ struct map *map;
+ struct item_methods *meth;
+ void *priv_data;
+};
+
+extern struct item_range {
+ enum item_type min,max;
+} item_range_all;
+
+/* prototypes */
+enum attr_type;
+enum item_type;
+struct attr;
+struct coord;
+struct item;
+struct item_hash;
+struct map_selection;
+int *item_get_default_flags(enum item_type type);
+void item_coord_rewind(struct item *it);
+int item_coord_get(struct item *it, struct coord *c, int count);
+int item_coord_set(struct item *it, struct coord *c, int count, enum change_mode mode);
+int item_coord_get_within_selection(struct item *it, struct coord *c, int count, struct map_selection *sel);
+int item_coord_get_pro(struct item *it, struct coord *c, int count, enum projection pro);
+/* does the next returned coordinate mark a node */
+int item_coord_is_node(struct item *it);
+void item_attr_rewind(struct item *it);
+int item_attr_get(struct item *it, enum attr_type attr_type, struct attr *attr);
+int item_attr_set(struct item *it, struct attr *attr, enum change_mode mode);
+struct item *item_new(char *type, int zoom);
+enum item_type item_from_name(const char *name);
+char *item_to_name(enum item_type item);
+struct item_hash *item_hash_new(void);
+void item_hash_insert(struct item_hash *h, struct item *item, void *val);
+int item_hash_remove(struct item_hash *h, struct item *item);
+void *item_hash_lookup(struct item_hash *h, struct item *item);
+void item_hash_destroy(struct item_hash *h);
+int item_range_intersects_range(struct item_range *range1, struct item_range *range2);
+int item_range_contains_item(struct item_range *range, enum item_type type);
+void item_dump_filedesc(struct item *item, struct map *map, FILE *out);
+/* end of prototypes */
+
+
+#ifdef __cplusplus
+}
+/* __cplusplus */
+#endif
+
+/* NAVIT_ITEM_H */
+#endif
diff --git a/item_def.h b/item_def.h
new file mode 100644
index 00000000..b8327314
--- /dev/null
+++ b/item_def.h
@@ -0,0 +1,525 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/* This file is generated from http://wiki.navit-project.org/index.php/Item_def.h, do not edit it, edit the wiki page instead */
+ITEM2(0x00000000,none)
+ITEM2(0x00000001,point_unspecified)
+ITEM(town_streets)
+ITEM(street_name)
+ITEM(street_name_numbers)
+ITEM(street_number)
+ITEM(position_sat)
+/* Point */
+ITEM2(0x00010000,town_label)
+ITEM2(0x00010001,town_label_0e0)
+ITEM2(0x00010002,town_label_1e0)
+ITEM2(0x00010003,town_label_2e0)
+ITEM2(0x00010004,town_label_5e0)
+ITEM2(0x00010005,town_label_1e1)
+ITEM2(0x00010006,town_label_2e1)
+ITEM2(0x00010007,town_label_5e1)
+ITEM2(0x00010008,town_label_1e2)
+ITEM2(0x00010009,town_label_2e2)
+ITEM2(0x0001000a,town_label_5e2)
+ITEM2(0x0001000b,town_label_1e3)
+ITEM2(0x0001000c,town_label_2e3)
+ITEM2(0x0001000d,town_label_5e3)
+ITEM2(0x0001000e,town_label_1e4)
+ITEM2(0x0001000f,town_label_2e4)
+ITEM2(0x00010010,town_label_5e4)
+ITEM2(0x00010011,town_label_1e5)
+ITEM2(0x00010012,town_label_2e5)
+ITEM2(0x00010013,town_label_5e5)
+ITEM2(0x00010014,town_label_1e6)
+ITEM2(0x00010015,town_label_2e6)
+ITEM2(0x00010016,town_label_5e6)
+ITEM2(0x00010017,town_label_1e7)
+ITEM2(0x00010100,district_label)
+ITEM2(0x00010101,district_label_0e0)
+ITEM2(0x00010102,district_label_1e0)
+ITEM2(0x00010103,district_label_2e0)
+ITEM2(0x00010104,district_label_5e0)
+ITEM2(0x00010105,district_label_1e1)
+ITEM2(0x00010106,district_label_2e1)
+ITEM2(0x00010107,district_label_5e1)
+ITEM2(0x00010108,district_label_1e2)
+ITEM2(0x00010109,district_label_2e2)
+ITEM2(0x0001010a,district_label_5e2)
+ITEM2(0x0001010b,district_label_1e3)
+ITEM2(0x0001010c,district_label_2e3)
+ITEM2(0x0001010d,district_label_5e3)
+ITEM2(0x0001010e,district_label_1e4)
+ITEM2(0x0001010f,district_label_2e4)
+ITEM2(0x00010110,district_label_5e4)
+ITEM2(0x00010111,district_label_1e5)
+ITEM2(0x00010112,district_label_2e5)
+ITEM2(0x00010113,district_label_5e5)
+ITEM2(0x00010114,district_label_1e6)
+ITEM2(0x00010115,district_label_2e6)
+ITEM2(0x00010116,district_label_5e6)
+ITEM2(0x00010117,district_label_1e7)
+ITEM(country_label)
+ITEM(town_ghost)
+ITEM(highway_exit_label)
+ITEM(port_label)
+ITEM(label_unkn)
+ITEM(highway_exit)
+ITEM(poi_lake)
+ITEM(poi_island)
+ITEM(poi)
+ITEM(waypoint)
+ITEM(trackpoint)
+ITEM(bookmark)
+ITEM(former_destination)
+ITEM(poi_land_feature)
+ITEM(poi_cape)
+ITEM(poi_rock)
+ITEM(poi_airport)
+ITEM(poi_toll_booth)
+ITEM(poi_fuel)
+ITEM(poi_hotel)
+ITEM(poi_camp_rv)
+ITEM(poi_marina)
+ITEM(poi_attraction)
+ITEM(poi_museum_history)
+ITEM(poi_shopping)
+ITEM(poi_car_dealer_parts)
+ITEM(poi_car_parking)
+ITEM(poi_wreck)
+ITEM(poi_building)
+ITEM(poi_bridge)
+ITEM(poi_park)
+ITEM(poi_water_feature)
+ITEM(poi_bar)
+ITEM(poi_picnic)
+ITEM(poi_hospital)
+ITEM(poi_camping)
+ITEM(poi_public_utilities)
+ITEM(poi_burgerking)
+ITEM(poi_kfc)
+ITEM(poi_mcdonalds)
+ITEM(poi_wienerwald)
+ITEM(poi_dining)
+ITEM(poi_fastfood)
+ITEM(poi_police)
+ITEM(poi_auto_club)
+ITEM(poi_autoservice)
+ITEM(poi_bank)
+ITEM(poi_bay)
+ITEM(poi_bend)
+ITEM(poi_boat_ramp)
+ITEM(poi_border_station)
+ITEM(poi_bowling)
+ITEM(poi_bus_station)
+ITEM(poi_bus_stop)
+ITEM(poi_bussines_service)
+ITEM(poi_car_rent)
+ITEM(poi_car_wash)
+ITEM(poi_casino)
+ITEM(poi_cemetery)
+ITEM(poi_church)
+ITEM(poi_cinema)
+ITEM(poi_civil)
+ITEM(poi_communication)
+ITEM(poi_concert)
+ITEM(poi_cove)
+ITEM(poi_crossing)
+ITEM(poi_dam)
+ITEM(poi_danger_area)
+ITEM(poi_dangerous)
+ITEM(poi_daymark)
+ITEM(poi_diving)
+ITEM(poi_drinking_water)
+ITEM(poi_emergency)
+ITEM(poi_fair)
+ITEM(poi_firebrigade)
+ITEM(poi_fish)
+ITEM(poi_forbiden_area)
+ITEM(poi_garmin)
+ITEM(poi_golf)
+ITEM(poi_goverment_building)
+ITEM(poi_height)
+ITEM(poi_heliport)
+ITEM(poi_hotspring)
+ITEM(poi_icesport)
+ITEM(poi_information)
+ITEM(poi_justice)
+ITEM(poi_landmark)
+ITEM(poi_levee)
+ITEM(poi_library)
+ITEM(poi_locale)
+ITEM(poi_loudspeaker)
+ITEM(poi_mall)
+ITEM(poi_manmade_feature)
+ITEM(poi_marine)
+ITEM(poi_marine_type)
+ITEM(poi_mark)
+ITEM(poi_military)
+ITEM(poi_mine)
+ITEM(poi_nondangerous)
+ITEM(poi_oil_field)
+ITEM(poi_personal_service)
+ITEM(poi_pharmacy)
+ITEM(poi_post)
+ITEM(poi_public_office)
+ITEM(poi_repair_service)
+ITEM(poi_resort)
+ITEM(poi_rest_room)
+ITEM(poi_restaurant)
+ITEM(poi_restricted_area)
+ITEM(poi_restroom)
+ITEM(poi_sailing)
+ITEM(poi_scenic_area)
+ITEM(poi_school)
+ITEM(poi_service)
+ITEM(poi_shop_apparel)
+ITEM(poi_shop_computer)
+ITEM(poi_shop_department)
+ITEM(poi_shop_furnish)
+ITEM(poi_shop_grocery)
+ITEM(poi_shop_handg)
+ITEM(poi_shop_merchandise)
+ITEM(poi_shop_retail)
+ITEM(poi_shower)
+ITEM(poi_skiing)
+ITEM(poi_social_service)
+ITEM(poi_sounding)
+ITEM(poi_sport)
+ITEM(poi_stadium)
+ITEM(poi_subdivision)
+ITEM(poi_swimming)
+ITEM(poi_telephone)
+ITEM(poi_theater)
+ITEM(poi_tide)
+ITEM(poi_tower)
+ITEM(poi_trail)
+ITEM(poi_truck_stop)
+ITEM(poi_tunnel)
+ITEM(poi_wine)
+ITEM(poi_worship)
+ITEM(poi_wrecker)
+ITEM(poi_zoo)
+ITEM(rg_point)
+ITEM(point_unkn)
+ITEM(traffic_signals)
+ITEM(poi_gc_multi)
+ITEM(poi_gc_tradi)
+ITEM(poi_gc_event)
+ITEM(poi_gc_mystery)
+ITEM(poi_gc_question)
+ITEM(poi_gc_stages)
+ITEM(poi_gc_reference)
+ITEM(poi_gc_webcam)
+ITEM(poi_cafe)
+ITEM(nav_straight)
+ITEM(nav_turnaround)
+ITEM(nav_right_1)
+ITEM(nav_right_2)
+ITEM(nav_right_3)
+ITEM(nav_left_1)
+ITEM(nav_left_2)
+ITEM(nav_left_3)
+ITEM(nav_roundabout_r1)
+ITEM(nav_roundabout_r2)
+ITEM(nav_roundabout_r3)
+ITEM(nav_roundabout_r4)
+ITEM(nav_roundabout_r5)
+ITEM(nav_roundabout_r6)
+ITEM(nav_roundabout_r7)
+ITEM(nav_roundabout_r8)
+ITEM(nav_roundabout_l1)
+ITEM(nav_roundabout_l2)
+ITEM(nav_roundabout_l3)
+ITEM(nav_roundabout_l4)
+ITEM(nav_roundabout_l5)
+ITEM(nav_roundabout_l6)
+ITEM(nav_roundabout_l7)
+ITEM(nav_roundabout_l8)
+ITEM(poi_peak)
+ITEM(poi_rail_station)
+ITEM(poi_image)
+ITEM(mini_roundabout)
+ITEM(turning_circle)
+ITEM(poi_townhall)
+ITEM(poi_level_crossing)
+ITEM(poi_rail_halt)
+ITEM(poi_rail_tram_stop)
+ITEM(poi_wifi)
+ITEM(poi_bench)
+ITEM(poi_biergarten)
+ITEM(poi_boundary_stone)
+ITEM(poi_castle)
+ITEM(poi_hunting_stand)
+ITEM(poi_memorial)
+ITEM(poi_monument)
+ITEM(poi_shelter)
+ITEM(poi_fountain)
+ITEM(poi_potable_water)
+ITEM(poi_toilets)
+ITEM(poi_viewpoint)
+ITEM(poi_ruins)
+ITEM(nav_none)
+ITEM(nav_position)
+ITEM(nav_destination)
+ITEM(tec_common)
+ITEM(trackpoint_tracked)
+ITEM(announcement)
+ITEM(poi_post_box)
+ITEM(poi_post_office)
+ITEM(poi_school_university)
+ITEM(poi_school_college)
+ITEM(poi_motel)
+ITEM(poi_guesthouse)
+ITEM(poi_hostel)
+ITEM(poi_taxi)
+ITEM(poi_prison)
+ITEM(poi_kindergarten)
+ITEM(poi_shop_butcher)
+ITEM(poi_shop_baker)
+ITEM(poi_shop_kiosk)
+ITEM(poi_soccer)
+ITEM(poi_basketball)
+ITEM(poi_baseball)
+ITEM(poi_climbing)
+ITEM(poi_motor_sport)
+ITEM(poi_tennis)
+ITEM(house_number)
+ITEM(route_start)
+ITEM(route_end)
+ITEM(selected_point)
+ITEM(power_tower)
+ITEM(route_start_reverse)
+ITEM(log_entry)
+/* Line */
+ITEM2(0x80000000,line)
+ITEM2(0x80000001,line_unspecified)
+ITEM(border_country)
+ITEM(border_state)
+ITEM(rail)
+ITEM(water_line)
+ITEM(street_nopass)
+ITEM(street_0)
+ITEM(street_1_city)
+ITEM(street_2_city)
+ITEM(street_3_city)
+ITEM(street_4_city)
+ITEM(highway_city)
+ITEM(street_1_land)
+ITEM(street_2_land)
+ITEM(street_3_land)
+ITEM(street_4_land)
+ITEM(street_n_lanes)
+ITEM(highway_land)
+ITEM(ramp)
+ITEM(roundabout)
+ITEM(ferry)
+ITEM(roadbook)
+ITEM(street_unkn)
+ITEM(street_route)
+ITEM(height_line_1)
+ITEM(height_line_2)
+ITEM(track)
+ITEM(height_line_3)
+ITEM(depth_line_1)
+ITEM(depth_line_2)
+ITEM(depth_line_3)
+ITEM(powerline)
+ITEM(pipeline)
+ITEM(time_zone)
+ITEM(marine_boundary)
+ITEM(marine_hazard)
+ITEM(rg_segment)
+ITEM(aeroway_runway)
+ITEM(aeroway_taxiway)
+ITEM(street_service)
+ITEM(coverage)
+ITEM(street_pedestrian)
+ITEM(bridge)
+ITEM(tunnel)
+ITEM(bridleway)
+ITEM(cycleway)
+ITEM(footway)
+ITEM(steps)
+ITEM(track_paved)
+ITEM(track_gravelled)
+ITEM(track_unpaved)
+ITEM(track_ground)
+ITEM(track_grass)
+ITEM(rail_narrow_gauge)
+ITEM(rail_light)
+ITEM(rail_subway)
+ITEM(rail_mono)
+ITEM(rail_tram)
+ITEM(rail_preserved)
+ITEM(rail_disused)
+ITEM(rail_abandoned)
+ITEM(lift_cable_car)
+ITEM(lift_chair)
+ITEM(lift_drag)
+ITEM(living_street)
+ITEM(bus_guideway)
+ITEM(street_construction)
+ITEM(border_civil)
+ITEM(border_political)
+ITEM(border_national_park)
+ITEM(water_river)
+ITEM(water_canal)
+ITEM(water_stream)
+ITEM(water_drain)
+ITEM(path)
+ITEM(hiking)
+ITEM(hiking_mountain)
+ITEM(hiking_mountain_demanding)
+ITEM(hiking_alpine)
+ITEM(hiking_alpine_demanding)
+ITEM(hiking_alpine_difficult)
+ITEM(street_parking_lane)
+ITEM(piste_nordic)
+ITEM(piste_downhill_novice)
+ITEM(piste_downhill_easy)
+ITEM(piste_downhill_intermediate)
+ITEM(piste_downhill_advanced)
+ITEM(piste_downhill_expert)
+ITEM(piste_downhill_freeride)
+ITEM(footway_and_piste_nordic)
+ITEM(tracking_0)
+ITEM(tracking_10)
+ITEM(tracking_20)
+ITEM(tracking_30)
+ITEM(tracking_40)
+ITEM(tracking_50)
+ITEM(tracking_60)
+ITEM(tracking_70)
+ITEM(tracking_80)
+ITEM(tracking_90)
+ITEM(tracking_100)
+ITEM(track_tracked)
+ITEM(house_number_interpolation_even)
+ITEM(house_number_interpolation_odd)
+ITEM(house_number_interpolation_all)
+ITEM(house_number_interpolation_alphabetic)
+ITEM(ditch)
+ITEM(hedge)
+ITEM(fence)
+ITEM(wall)
+ITEM(retaining_wall)
+ITEM(city_wall)
+ITEM(street_turn_restriction_no)
+ITEM(street_turn_restriction_only)
+ITEM(border_city)
+ITEM(border_county)
+ITEM(selected_line)
+ITEM(traffic_distortion)
+/* Area */
+ITEM2(0xc0000000,area)
+ITEM2(0xc0000001,area_unspecified)
+ITEM(poly_wood)
+ITEM(poly_water)
+ITEM(poly_town)
+ITEM(poly_cemetery)
+ITEM(poly_car_parking)
+ITEM(poly_industry)
+ITEM(poly_airport)
+ITEM(poly_hospital)
+ITEM(poly_park)
+ITEM(poly_sport)
+ITEM(poly_museum)
+ITEM(image)
+ITEM(image_path)
+ITEM(poly_commercial_center)
+ITEM(poly_golf_course)
+ITEM(poly_university)
+ITEM(poly_national_park)
+ITEM(poly_nature_park)
+ITEM(poly_flats)
+ITEM(poly_scrub)
+ITEM(poly_military_zone)
+ITEM(poly_marine)
+ITEM(plantation)
+ITEM(tundra)
+ITEM(tile)
+ITEM(submap)
+ITEM(poly_building)
+ITEM(poly_place)
+ITEM(poly_station)
+ITEM(poly_farm)
+ITEM(poly_sport_tennis)
+ITEM(poly_apron)
+ITEM(poly_terminal)
+ITEM(countryindex)
+ITEM(poly_sports_centre)
+ITEM(poly_sports_stadium)
+ITEM(poly_sports_track)
+ITEM(poly_sports_pitch)
+ITEM(poly_water_park)
+ITEM(poly_marina)
+ITEM(poly_fishing)
+ITEM(poly_theme_park)
+ITEM(poly_attraction)
+ITEM(poly_ruins)
+ITEM(poly_archaeological_site)
+ITEM(poly_artwork)
+ITEM(poly_zoo)
+ITEM(poly_camp_site)
+ITEM(poly_caravan_site)
+ITEM(poly_picnic_site)
+ITEM(poly_playground)
+ITEM(poly_allotments)
+ITEM(poly_village_green)
+ITEM(poly_recreation_ground)
+ITEM(poly_common)
+ITEM(poly_garden)
+ITEM(poly_nature_reserve)
+ITEM(poly_glacier)
+ITEM(poly_scree)
+ITEM(poly_fell)
+ITEM(poly_heath)
+ITEM(poly_marsh)
+ITEM(poly_mud)
+ITEM(poly_land)
+ITEM(poly_beach)
+ITEM(poly_quarry)
+ITEM(poly_landfill)
+ITEM(poly_retail)
+ITEM(poly_commercial)
+ITEM(poly_brownfield)
+ITEM(poly_greenfield)
+ITEM(poly_construction)
+ITEM(poly_railway)
+ITEM(poly_military)
+ITEM(poly_airfield)
+ITEM(poly_barracks)
+ITEM(poly_danger_area)
+ITEM(poly_range)
+ITEM(poly_naval_base)
+ITEM(poly_basin)
+ITEM(poly_reservoir)
+ITEM(poly_college)
+ITEM(poly_battlefield)
+ITEM(poly_pedestrian)
+ITEM(poly_plaza)
+ITEM(poly_service)
+ITEM(poly_street_1)
+ITEM(poly_street_2)
+ITEM(poly_street_3)
+ITEM(poly_wetland)
+ITEM(poly_aeroway_runway)
+ITEM(map_information)
+ITEM(selected_area)
+ITEM2(0xffffffff,last)
diff --git a/keys.h b/keys.h
new file mode 100644
index 00000000..57af500a
--- /dev/null
+++ b/keys.h
@@ -0,0 +1,8 @@
+#define NAVIT_KEY_LEFT 2
+#define NAVIT_KEY_RIGHT 6
+#define NAVIT_KEY_BACKSPACE 8
+#define NAVIT_KEY_RETURN 13
+#define NAVIT_KEY_DOWN 14
+#define NAVIT_KEY_ZOOM_OUT 15
+#define NAVIT_KEY_UP 16
+#define NAVIT_KEY_ZOOM_IN 17
diff --git a/layer.h b/layer.h
new file mode 100644
index 00000000..dc995a66
--- /dev/null
+++ b/layer.h
@@ -0,0 +1,31 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_LAYER_H
+#define NAVIT_LAYER_H
+
+enum layer_type {
+ layer_town=0,
+ layer_street,
+ layer_poly,
+ layer_end,
+};
+
+#endif
+
diff --git a/layout.c b/layout.c
new file mode 100644
index 00000000..a183fe8f
--- /dev/null
+++ b/layout.c
@@ -0,0 +1,343 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "item.h"
+#include "attr.h"
+#include "layout.h"
+#include "coord.h"
+#include "debug.h"
+
+struct layout * layout_new(struct attr *parent, struct attr **attrs)
+{
+ struct layout *l;
+ struct color def_color = {0xffff, 0xefef, 0xb7b7, 0xffff};
+ struct attr *name_attr,*color_attr,*order_delta_attr,*font_attr;
+
+ if (! (name_attr=attr_search(attrs, NULL, attr_name)))
+ return NULL;
+ l = g_new0(struct layout, 1);
+ l->name = g_strdup(name_attr->u.str);
+ if ((font_attr=attr_search(attrs, NULL, attr_font))) {
+ l->font = g_strdup(font_attr->u.str);
+ }
+ if ((color_attr=attr_search(attrs, NULL, attr_color)))
+ l->color = *color_attr->u.color;
+ else
+ l->color = def_color;
+ if ((order_delta_attr=attr_search(attrs, NULL, attr_order_delta)))
+ l->order_delta=order_delta_attr->u.num;
+ return l;
+}
+
+int
+layout_add_attr(struct layout *layout, struct attr *attr)
+{
+ switch (attr->type) {
+ case attr_layer:
+ layout->layers = g_list_append(layout->layers, attr->u.layer);
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+
+
+struct layer * layer_new(struct attr *parent, struct attr **attrs)
+{
+ struct layer *l;
+
+ struct attr *name, *details;
+ l = g_new0(struct layer, 1);
+ name=attr_search(attrs, NULL, attr_name);
+ if (name)
+ l->name = g_strdup(name->u.str);
+ details=attr_search(attrs, NULL, attr_details);
+ if (details)
+ l->details = details->u.num;
+ return l;
+}
+
+int
+layer_add_attr(struct layer *layer, struct attr *attr)
+{
+ switch (attr->type) {
+ case attr_itemgra:
+ layer->itemgras = g_list_append(layer->itemgras, attr->u.itemgra);
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+
+struct itemgra * itemgra_new(struct attr *parent, struct attr **attrs)
+{
+ struct itemgra *itm;
+ struct attr *order, *item_types, *speed_range, *angle_range, *sequence_range;
+ enum item_type *type;
+ struct range defrange;
+
+ itm = g_new0(struct itemgra, 1);
+ order=attr_search(attrs, NULL, attr_order);
+ item_types=attr_search(attrs, NULL, attr_item_types);
+ speed_range=attr_search(attrs, NULL, attr_speed_range);
+ angle_range=attr_search(attrs, NULL, attr_angle_range);
+ sequence_range=attr_search(attrs, NULL, attr_sequence_range);
+ defrange.min=0;
+ defrange.max=32767;
+ if (order)
+ itm->order=order->u.range;
+ else
+ itm->order=defrange;
+ if (speed_range)
+ itm->speed_range=speed_range->u.range;
+ else
+ itm->speed_range=defrange;
+ if (angle_range)
+ itm->angle_range=angle_range->u.range;
+ else
+ itm->angle_range=defrange;
+ if (sequence_range)
+ itm->sequence_range=sequence_range->u.range;
+ else
+ itm->sequence_range=defrange;
+ if (item_types) {
+ type=item_types->u.item_types;
+ while (type && *type != type_none) {
+ itm->type=g_list_append(itm->type, GINT_TO_POINTER(*type));
+ type++;
+ }
+ }
+ return itm;
+}
+int
+itemgra_add_attr(struct itemgra *itemgra, struct attr *attr)
+{
+ switch (attr->type) {
+ case attr_polygon:
+ case attr_polyline:
+ case attr_circle:
+ case attr_text:
+ case attr_icon:
+ case attr_image:
+ case attr_arrows:
+ itemgra->elements = g_list_append(itemgra->elements, attr->u.element);
+ return 1;
+ default:
+ dbg(0,"unknown: %s\n", attr_to_name(attr->type));
+ return 0;
+ }
+}
+
+static void
+element_set_color(struct element *e, struct attr **attrs)
+{
+ struct attr *color;
+ color=attr_search(attrs, NULL, attr_color);
+ if (color)
+ e->color=*color->u.color;
+}
+
+static void
+element_set_text_size(struct element *e, struct attr **attrs)
+{
+ struct attr *text_size;
+ text_size=attr_search(attrs, NULL, attr_text_size);
+ if (text_size)
+ e->text_size=text_size->u.num;
+}
+
+static void
+element_set_polyline_width(struct element *e, struct attr **attrs)
+{
+ struct attr *width;
+ width=attr_search(attrs, NULL, attr_width);
+ if (width)
+ e->u.polyline.width=width->u.num;
+}
+
+static void
+element_set_polyline_directed(struct element *e, struct attr **attrs)
+{
+ struct attr *directed;
+ directed=attr_search(attrs, NULL, attr_directed);
+ if (directed)
+ e->u.polyline.directed=directed->u.num;
+}
+
+static void
+element_set_polyline_dash(struct element *e, struct attr **attrs)
+{
+ struct attr *dash;
+ int i;
+
+ dash=attr_search(attrs, NULL, attr_dash);
+ if (dash) {
+ for (i=0; i<4; i++) {
+ if (!dash->u.dash[i])
+ break;
+ e->u.polyline.dash_table[i] = dash->u.dash[i];
+ }
+ e->u.polyline.dash_num=i;
+ }
+}
+
+static void
+element_set_polyline_offset(struct element *e, struct attr **attrs)
+{
+ struct attr *offset;
+ offset=attr_search(attrs, NULL, attr_offset);
+ if (offset)
+ e->u.polyline.offset=offset->u.num;
+}
+
+static void
+element_set_circle_width(struct element *e, struct attr **attrs)
+{
+ struct attr *width;
+ width=attr_search(attrs, NULL, attr_width);
+ if (width)
+ e->u.circle.width=width->u.num;
+}
+
+static void
+element_set_circle_radius(struct element *e, struct attr **attrs)
+{
+ struct attr *radius;
+ radius=attr_search(attrs, NULL, attr_radius);
+ if (radius)
+ e->u.circle.radius=radius->u.num;
+}
+
+struct polygon *
+polygon_new(struct attr *parent, struct attr **attrs)
+{
+ struct element *e;
+ e = g_new0(struct element, 1);
+ e->type=element_polygon;
+ element_set_color(e, attrs);
+
+ return (struct polygon *)e;
+}
+
+struct polyline *
+polyline_new(struct attr *parent, struct attr **attrs)
+{
+ struct element *e;
+
+ e = g_new0(struct element, 1);
+ e->type=element_polyline;
+ element_set_color(e, attrs);
+ element_set_polyline_width(e, attrs);
+ element_set_polyline_directed(e, attrs);
+ element_set_polyline_dash(e, attrs);
+ element_set_polyline_offset(e, attrs);
+ return (struct polyline *)e;
+}
+
+struct circle *
+circle_new(struct attr *parent, struct attr **attrs)
+{
+ struct element *e;
+
+ e = g_new0(struct element, 1);
+ e->type=element_circle;
+ element_set_color(e, attrs);
+ element_set_text_size(e, attrs);
+ element_set_circle_width(e, attrs);
+ element_set_circle_radius(e, attrs);
+
+ return (struct circle *)e;
+}
+
+struct text *
+text_new(struct attr *parent, struct attr **attrs)
+{
+ struct element *e;
+
+ e = g_new0(struct element, 1);
+ e->type=element_text;
+ element_set_text_size(e, attrs);
+
+ return (struct text *)e;
+}
+
+struct icon *
+icon_new(struct attr *parent, struct attr **attrs)
+{
+ struct element *e;
+ struct attr *src,*w,*h,*rotation;
+ src=attr_search(attrs, NULL, attr_src);
+ if (! src)
+ return NULL;
+
+ e = g_malloc0(sizeof(*e)+strlen(src->u.str)+1);
+ e->type=element_icon;
+ e->u.icon.src=(char *)(e+1);
+ if ((w=attr_search(attrs, NULL, attr_w)))
+ e->u.icon.width=w->u.num;
+ else
+ e->u.icon.width=-1;
+ if ((h=attr_search(attrs, NULL, attr_h)))
+ e->u.icon.height=h->u.num;
+ else
+ e->u.icon.height=-1;
+ if ((rotation=attr_search(attrs, NULL, attr_rotation)))
+ e->u.icon.rotation=rotation->u.num;
+ strcpy(e->u.icon.src,src->u.str);
+
+ return (struct icon *)e;
+}
+
+struct image *
+image_new(struct attr *parent, struct attr **attrs)
+{
+ struct element *e;
+
+ e = g_malloc0(sizeof(*e));
+ e->type=element_image;
+
+ return (struct image *)e;
+}
+
+struct arrows *
+arrows_new(struct attr *parent, struct attr **attrs)
+{
+ struct element *e;
+ e = g_malloc0(sizeof(*e));
+ e->type=element_arrows;
+ element_set_color(e, attrs);
+ return (struct arrows *)e;
+}
+
+int
+element_add_attr(struct element *e, struct attr *attr)
+{
+ switch (attr->type) {
+ case attr_coord:
+ e->coord=g_realloc(e->coord,(e->coord_count+1)*sizeof(struct coord));
+ e->coord[e->coord_count++]=*attr->u.coord;
+ return 1;
+ default:
+ return 0;
+ }
+}
diff --git a/layout.h b/layout.h
new file mode 100644
index 00000000..a0254d4e
--- /dev/null
+++ b/layout.h
@@ -0,0 +1,94 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_LAYOUT_H
+#define NAVIT_LAYOUT_H
+
+#include "item.h"
+#include "color.h"
+
+struct element_line;
+struct element_text;
+
+struct element {
+ enum { element_point, element_polyline, element_polygon, element_circle, element_text, element_icon, element_image, element_arrows } type;
+ struct color color;
+ int text_size;
+ union {
+ struct element_point {
+ } point;
+ struct element_polyline {
+ int width;
+ int directed;
+ int dash_num;
+ int offset;
+ unsigned char dash_table[4];
+ } polyline;
+ struct element_polygon {
+ } polygon;
+ struct element_circle {
+ int width;
+ int radius;
+ } circle;
+ struct element_icon {
+ char *src;
+ int width;
+ int height;
+ int rotation;
+ } icon;
+ } u;
+ int coord_count;
+ struct coord *coord;
+};
+
+
+struct itemgra {
+ struct range order,sequence_range,speed_range,angle_range;
+ GList *type;
+ GList *elements;
+};
+
+struct color;
+
+struct layer { char *name; int details; GList *itemgras; };
+
+struct layout { char *name; char *font; struct color color; GList *layers; int order_delta; };
+
+/* prototypes */
+enum item_type;
+struct element;
+struct itemgra;
+struct layer;
+struct layout;
+struct layout *layout_new(struct attr *parent, struct attr **attrs);
+int layout_add_attr(struct layout *layout, struct attr *attr);
+struct layer *layer_new(struct attr *parent, struct attr **attrs);
+int layer_add_attr(struct layer *layer, struct attr *attr);
+struct itemgra *itemgra_new(struct attr *parent, struct attr **attrs);
+int itemgra_add_attr(struct itemgra *itemgra, struct attr *attr);
+struct polygon *polygon_new(struct attr *parent, struct attr **attrs);
+struct polyline *polyline_new(struct attr *parent, struct attr **attrs);
+struct circle *circle_new(struct attr *parent, struct attr **attrs);
+struct text *text_new(struct attr *parent, struct attr **attrs);
+struct icon *icon_new(struct attr *parent, struct attr **attrs);
+struct image *image_new(struct attr *parent, struct attr **attrs);
+struct arrows *arrows_new(struct attr *parent, struct attr **attrs);
+int element_add_attr(struct element *e, struct attr *attr);
+#endif
+
diff --git a/linguistics.c b/linguistics.c
new file mode 100644
index 00000000..800ac5fd
--- /dev/null
+++ b/linguistics.c
@@ -0,0 +1,153 @@
+#include <string.h>
+#include <stdio.h>
+#include <glib.h>
+#include "debug.h"
+#include "linguistics.h"
+
+static const char *special[][3]={
+/* Capital Diacritics */
+/* ¨ Diaresis */
+{"Ä","A","AE"},
+{"Ö","O","OE"},
+{"Ü","U","UE"},
+/* Ë Double Acute Accent */
+{"Å","O"},
+{"Å°","U"},
+/* ´ Acute Accent */
+{"Ã","A"},
+{"Ć","C"},
+{"É","E"},
+{"Ã","I"},
+{"Ń","N"},
+{"Ó","O"},
+{"Åš","S"},
+{"Ú","U"},
+{"Ã","Y"},
+{"Ź","Z"},
+/* Ë› Ogonek */
+{"Ä„","A"},
+{"Ę","E"},
+/* Ë™ Dot */
+{"Å»","Z"},
+/* – Stroke */
+{"Å","L"},
+/* Ëš Ring */
+{"Ã…","A","AA"},
+{"Å®","U"},
+/* ˇ Caron */
+{"Č","C"},
+{"ÄŽ","D"},
+{"Äš","E"},
+{"Ň","N"},
+{"Ř","R"},
+{"Å ","S"},
+{"Ť","T"},
+{"Ž","Z"},
+/* / Slash */
+{"Ø","O","OE"},
+/* ligatures */
+{"Æ","A","AE"},
+/* Small Diacritics */
+/* ¨ Diaresis */
+{"ä","a","ae"},
+{"ö","o","oe"},
+{"ü","u","ue"},
+/* Ë Double Acute Accent */
+{"Å‘","o"},
+{"ű","u"},
+/* ´ Acute Accent */
+{"á","a"},
+{"ć","c"},
+{"é","e"},
+{"í","i"},
+{"Å„","n"},
+{"ó","o"},
+{"Å›","s"},
+{"ú","u"},
+{"ý","y"},
+{"ź","z"},
+/* Ë› Ogonek */
+{"Ä…","a"},
+{"Ä™","e"},
+/* Ë™ Dot */
+{"ż","z"},
+/* – Stroke */
+{"Å‚","l"},
+/* Ëš Ring */
+{"ů","u"},
+{"Ã¥","a", "aa"},
+/* ˇ Caron */
+{"Ä","c"},
+{"Ä","d"},
+{"Ä›","e"},
+{"Ň","N"},
+{"Å™","r"},
+{"Å¡","s"},
+{"Å¥","t"},
+{"ž","z"},
+/* / Slash */
+{"ø","o", "oe"},
+/* ligatures */
+{"æ","a","ae"},
+{"ß","s","ss"},
+};
+
+char *
+linguistics_expand_special(char *str, int mode)
+{
+ char *in=str;
+ char *out,*ret;
+ int found=0;
+ out=ret=g_strdup(str);
+ if (!mode)
+ return ret;
+ while (*in) {
+ char *next=g_utf8_find_next_char(in, NULL);
+ int i,len=next-in;
+ int match=0;
+ if (len > 1) {
+ for (i = 0 ; i < sizeof(special)/sizeof(special[0]); i++) {
+ const char *search=special[i][0];
+ if (!strncmp(in,search,len)) {
+ const char *replace=special[i][mode];
+ if (replace) {
+ int replace_len=strlen(replace);
+ dbg_assert(replace_len <= len);
+ dbg(1,"found %s %s %d %s %d\n",in,search,len,replace,replace_len);
+ strcpy(out, replace);
+ out+=replace_len;
+ match=1;
+ break;
+ }
+ }
+ }
+ }
+ if (match) {
+ found=1;
+ in=next;
+ } else {
+ while (len-- > 0)
+ *out++=*in++;
+ }
+ }
+ *out++='\0';
+ if (!found) {
+ g_free(ret);
+ ret=NULL;
+ }
+ return ret;
+}
+
+char *
+linguistics_next_word(char *str)
+{
+ int len=strcspn(str, " -");
+ if (!str[len] || !str[len+1])
+ return NULL;
+ return str+len+1;
+}
+
+void
+linguistics_init(void)
+{
+}
diff --git a/linguistics.h b/linguistics.h
new file mode 100644
index 00000000..5fe534f1
--- /dev/null
+++ b/linguistics.h
@@ -0,0 +1,4 @@
+char *linguistics_expand_special(char *str, int mode);
+char *linguistics_next_word(char *str);
+void linguistics_init(void);
+
diff --git a/navit/locations.txt b/locations.txt
index 739f93b2..739f93b2 100644
--- a/navit/locations.txt
+++ b/locations.txt
diff --git a/log.c b/log.c
new file mode 100644
index 00000000..95b34e67
--- /dev/null
+++ b/log.c
@@ -0,0 +1,318 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <time.h>
+#include <sys/time.h>
+#include <glib.h>
+#include "file.h"
+#include "item.h"
+#include "event.h"
+#include "callback.h"
+#include "debug.h"
+#include "log.h"
+
+struct log_data {
+ int len;
+ int max_len;
+ char *data;
+};
+
+struct log {
+ FILE *f;
+ int overwrite;
+ int empty;
+ int lazy;
+ int mkdir;
+ int flush_size;
+ int flush_time;
+ struct event_timeout *timer;
+ struct callback *timer_callback;
+ struct timeval last_flush;
+ char *filename;
+ char *filename_ex1;
+ char *filename_ex2;
+ struct log_data header;
+ struct log_data data;
+ struct log_data trailer;
+ struct attr **attrs;
+};
+
+static void
+strftime_localtime(char *buffer, int size, char *fmt)
+{
+ time_t t;
+ struct tm *tm;
+
+ t=time(NULL);
+ tm=localtime(&t);
+ strftime(buffer, 4096, fmt, tm);
+}
+
+static void
+expand_filenames(struct log *this_)
+{
+ char buffer[4096];
+ int i;
+
+ strftime_localtime(buffer, 4096, this_->filename);
+ this_->filename_ex1=g_strdup(buffer);
+ if (strstr(this_->filename_ex1,"%i")) {
+ i=0;
+ do {
+ g_free(this_->filename_ex2);
+ this_->filename_ex2=g_strdup_printf(this_->filename_ex1,i++);
+ } while (file_exists(this_->filename_ex2));
+ } else
+ this_->filename_ex2=g_strdup(this_->filename_ex1);
+}
+
+static void
+log_set_last_flush(struct log *this_)
+{
+ gettimeofday(&this_->last_flush, NULL);
+}
+
+static void
+log_open(struct log *this_)
+{
+ char *mode;
+ if (this_->overwrite)
+ mode="w";
+ else
+ mode="r+";
+ if (this_->mkdir)
+ file_mkdir(this_->filename_ex2, 2);
+ this_->f=fopen(this_->filename_ex2, mode);
+ if (! this_->f)
+ this_->f=fopen(this_->filename_ex2, "w");
+ if (! this_->f)
+ return;
+ if (!this_->overwrite)
+ fseek(this_->f, 0, SEEK_END);
+ this_->empty = !ftell(this_->f);
+ log_set_last_flush(this_);
+}
+
+static void
+log_close(struct log *this_)
+{
+ if (! this_->f)
+ return;
+ if (this_->trailer.len)
+ fwrite(this_->trailer.data, 1, this_->trailer.len, this_->f);
+ fflush(this_->f);
+ fclose(this_->f);
+ this_->f=NULL;
+}
+
+static void
+log_flush(struct log *this_)
+{
+ long pos;
+ if (this_->lazy && !this_->f) {
+ if (!this_->data.len)
+ return;
+ log_open(this_);
+ }
+ if (! this_->f)
+ return;
+ if (this_->empty) {
+ if (this_->header.len)
+ fwrite(this_->header.data, 1, this_->header.len, this_->f);
+ if (this_->header.len || this_->data.len)
+ this_->empty=0;
+ }
+ fwrite(this_->data.data, 1, this_->data.len, this_->f);
+ if (this_->trailer.len) {
+ pos=ftell(this_->f);
+ if (pos > 0) {
+ fwrite(this_->trailer.data, 1, this_->trailer.len, this_->f);
+ fseek(this_->f, pos, SEEK_SET);
+ }
+ }
+
+ fflush(this_->f);
+ g_free(this_->data.data);
+ this_->data.data=NULL;
+ this_->data.max_len=this_->data.len=0;
+ log_set_last_flush(this_);
+}
+
+static int
+log_flush_required(struct log *this_)
+{
+ return this_->data.len > this_->flush_size;
+}
+
+
+static void
+log_change(struct log *this_)
+{
+ log_flush(this_);
+ log_close(this_);
+ expand_filenames(this_);
+ if (! this_->lazy)
+ log_open(this_);
+}
+
+static int
+log_change_required(struct log *this_)
+{
+ char buffer[4096];
+
+ strftime_localtime(buffer, 4096, this_->filename);
+ return (strcmp(this_->filename_ex1, buffer) != 0);
+}
+
+static void
+log_timer(struct log *this_)
+{
+ struct timeval tv;
+ int delta;
+ gettimeofday(&tv, NULL);
+ delta=(tv.tv_sec-this_->last_flush.tv_sec)*1000+(tv.tv_usec-this_->last_flush.tv_usec)/1000;
+ dbg(1,"delta=%d flush_time=%d\n", delta, this_->flush_time);
+ if (this_->flush_time && delta >= this_->flush_time*1000)
+ log_flush(this_);
+}
+
+int
+log_get_attr(struct log *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
+{
+ return attr_generic_get_attr(this_->attrs, NULL, type, attr, iter);
+}
+
+
+struct log *
+log_new(struct attr * parent,struct attr **attrs)
+{
+ struct log *ret=g_new0(struct log, 1);
+ struct attr *data,*overwrite,*lazy,*mkdir,*flush_size,*flush_time;
+ struct file_wordexp *wexp;
+ char *filename, **wexp_data;
+
+ dbg(1,"enter\n");
+ data=attr_search(attrs, NULL, attr_data);
+ if (! data)
+ return NULL;
+ filename=data->u.str;
+ wexp=file_wordexp_new(filename);
+ if (wexp && file_wordexp_get_count(wexp) > 0) {
+ wexp_data=file_wordexp_get_array(wexp);
+ filename=wexp_data[0];
+ }
+ if (filename)
+ ret->filename=g_strdup(filename);
+ if (wexp)
+ file_wordexp_destroy(wexp);
+ overwrite=attr_search(attrs, NULL, attr_overwrite);
+ if (overwrite)
+ ret->overwrite=overwrite->u.num;
+ lazy=attr_search(attrs, NULL, attr_lazy);
+ if (lazy)
+ ret->lazy=lazy->u.num;
+ mkdir=attr_search(attrs, NULL, attr_mkdir);
+ if (mkdir)
+ ret->mkdir=mkdir->u.num;
+ flush_size=attr_search(attrs, NULL, attr_flush_size);
+ if (flush_size)
+ ret->flush_size=flush_size->u.num;
+ flush_time=attr_search(attrs, NULL, attr_flush_time);
+ if (flush_time)
+ ret->flush_time=flush_time->u.num;
+ if (ret->flush_time) {
+ dbg(1,"interval %d\n", ret->flush_time*1000);
+ ret->timer_callback=callback_new_1(callback_cast(log_timer), ret);
+ ret->timer=event_add_timeout(ret->flush_time*1000, 1, ret->timer_callback);
+ }
+ expand_filenames(ret);
+ if (ret->lazy)
+ log_set_last_flush(ret);
+ else
+ log_open(ret);
+ ret->attrs=attr_list_dup(attrs);
+ return ret;
+}
+
+void
+log_set_header(struct log *this_, char *data, int len)
+{
+ this_->header.data=g_malloc(len);
+ this_->header.max_len=this_->header.len=len;
+ memcpy(this_->header.data, data, len);
+}
+
+void
+log_set_trailer(struct log *this_, char *data, int len)
+{
+ this_->trailer.data=g_malloc(len);
+ this_->trailer.max_len=this_->trailer.len=len;
+ memcpy(this_->trailer.data, data, len);
+}
+
+void
+log_write(struct log *this_, char *data, int len)
+{
+ dbg(1,"enter\n");
+ if (log_change_required(this_)) {
+ dbg(1,"log_change");
+ log_change(this_);
+ }
+ if (this_->data.len + len > this_->data.max_len) {
+ dbg(2,"overflow\n");
+ this_->data.max_len+=16384;
+ this_->data.data=g_realloc(this_->data.data,this_->data.max_len);
+ }
+ memcpy(this_->data.data+this_->data.len, data, len);
+ this_->data.len+=len;
+ if (log_flush_required(this_))
+ log_flush(this_);
+}
+
+void
+log_printf(struct log *this_, char *fmt, ...)
+{
+ char buffer[LOG_BUFFER_SIZE];
+ int size;
+ va_list ap;
+
+ va_start(ap, fmt);
+
+ // Format the string and write it to the log
+ size = vsnprintf(buffer, LOG_BUFFER_SIZE, fmt, ap);
+ log_write(this_, buffer, size);
+
+ va_end(ap);
+}
+
+void
+log_destroy(struct log *this_)
+{
+ callback_destroy(this_->timer_callback);
+ event_remove_timeout(this_->timer);
+ log_flush(this_);
+ log_close(this_);
+ g_free(this_);
+}
diff --git a/log.h b/log.h
new file mode 100644
index 00000000..edb4433f
--- /dev/null
+++ b/log.h
@@ -0,0 +1,43 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_LOG_H
+#define NAVIT_LOG_H
+/* prototypes */
+enum attr_type;
+struct attr;
+struct attr_iter;
+struct log;
+int log_get_attr(struct log *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
+struct log *log_new(struct attr * parent,struct attr **attrs);
+void log_set_header(struct log *this_, char *data, int len);
+void log_set_trailer(struct log *this_, char *data, int len);
+void log_write(struct log *this_, char *data, int len);
+void log_destroy(struct log *this_);
+
+#define LOG_BUFFER_SIZE 256
+/**
+ * printf-style writing to the log file. A buffer of LOG_BUFFER_SIZE
+ * bytes is preallocated for the complete format message, longer
+ * messages will be truncated.
+ */
+void log_printf(struct log *this_, char *fmt, ...);
+
+/* end of prototypes */
+#endif
diff --git a/main.c b/main.c
new file mode 100644
index 00000000..7881a3b0
--- /dev/null
+++ b/main.c
@@ -0,0 +1,300 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <locale.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <getopt.h>
+#include <string.h>
+#include <signal.h>
+#include <glib.h>
+#include <sys/types.h>
+
+#ifndef _WIN32
+#include <sys/wait.h>
+#include <signal.h>
+#endif
+
+#include <unistd.h>
+#include "config.h"
+#include "file.h"
+#include "debug.h"
+#include "main.h"
+#include "navit.h"
+#include "gui.h"
+#include "item.h"
+#include "xmlconfig.h"
+#include "coord.h"
+#include "route.h"
+#include "navigation.h"
+#include "event.h"
+#include "callback.h"
+#include "navit_nls.h"
+#if HAVE_API_WIN32_BASE
+#include <windows.h>
+#include <winbase.h>
+#endif
+
+
+struct map_data *map_data_default;
+
+struct callback_list *cbl;
+
+
+static void sigchld(int sig)
+{
+#if !defined(_WIN32) && !defined(__CEGCC__)
+ int status;
+ while (waitpid(-1, &status, WNOHANG) > 0);
+#endif
+}
+
+#if 0
+static gchar *get_home_directory(void)
+{
+ static gchar *homedir = NULL;
+
+ if (homedir) return homedir;
+ homedir = getenv("HOME");
+ if (!homedir)
+ {
+ dbg(0,"Could not find home directory. Using current directory as home directory.\n");
+ homedir =g_strdup(".");
+ } else {
+ homedir=g_strdup(homedir);
+ }
+ return homedir;
+}
+#endif
+
+static GList *navit;
+
+struct iter {
+ GList *list;
+};
+
+struct iter *
+main_iter_new(void)
+{
+ struct iter *ret=g_new0(struct iter, 1);
+ ret->list=navit;
+ return ret;
+}
+
+void
+main_iter_destroy(struct iter *iter)
+{
+ g_free(iter);
+}
+
+struct navit *
+main_get_navit(struct iter *iter)
+{
+ GList *list;
+ struct navit *ret=NULL;
+ if (iter)
+ list=iter->list;
+ else
+ list=navit;
+ if (list) {
+ ret=(struct navit *)(list->data);
+ if (iter)
+ iter->list=g_list_next(iter->list);
+ }
+ return ret;
+
+}
+void
+main_add_navit(struct navit *nav)
+{
+ navit=g_list_prepend(navit, nav);
+ callback_list_call_2(cbl, nav, 1);
+}
+
+void
+main_remove_navit(struct navit *nav)
+{
+ navit=g_list_remove(navit, nav);
+ callback_list_call_2(cbl, nav, 0);
+ if (! navit)
+ event_main_loop_quit();
+}
+
+int
+main_add_attr(struct attr *attr)
+{
+ switch (attr->type)
+ {
+ case attr_callback:
+ callback_list_add(cbl, attr->u.callback);
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+int
+main_remove_attr(struct attr *attr)
+{
+ switch (attr->type)
+ {
+ case attr_callback:
+ callback_list_remove(cbl, attr->u.callback);
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+
+#ifdef HAVE_API_WIN32
+void
+setenv(char *var, char *val, int overwrite)
+{
+ char *str=g_strdup_printf("%s=%s",var,val);
+ if (overwrite || !getenv(var))
+ putenv(str);
+ g_free(str);
+}
+#endif
+
+static char *environment_vars[][4]={
+ {"NAVIT_LIBDIR", ":", "::/navit", ":/lib"},
+ {"NAVIT_SHAREDIR", ":", ":/share/navit", ":"},
+ {"NAVIT_LOCALEDIR", ":/../locale", ":/share/locale", ":/locale"},
+ {"NAVIT_USER_DATADIR", ":", "~/.navit", ":/data"},
+ {"NAVIT_LOGFILE", NULL, NULL, ":/navit.log"},
+ {"NAVIT_LIBPREFIX", "*/.libs/", NULL, NULL},
+ {NULL, NULL, NULL, NULL},
+};
+
+static void
+main_setup_environment(int mode)
+{
+ int i=0;
+ char *var,*val;
+ while ((var=environment_vars[i][0])) {
+ val=environment_vars[i][mode+1];
+ if (val) {
+ switch (val[0]) {
+ case ':':
+ if (val[1] == ':')
+ val=g_strdup_printf("%s/%s%s", getenv("NAVIT_PREFIX"), LIBDIR+sizeof(PREFIX), val+2);
+ else
+ val=g_strdup_printf("%s%s", getenv("NAVIT_PREFIX"), val+1);
+ break;
+ case '~':
+ val=g_strdup_printf("%s%s", getenv("HOME"), val+1);
+ break;
+ default:
+ val=g_strdup(val);
+ break;
+ }
+ setenv(var, val, 0);
+ g_free(val);
+ }
+ i++;
+ }
+}
+
+void
+main_init(char *program)
+{
+ char *s;
+ int l;
+
+#ifndef _WIN32
+ signal(SIGCHLD, sigchld);
+#endif
+ cbl=callback_list_new();
+ setenv("LC_NUMERIC","C",1);
+ setlocale(LC_ALL,"");
+ setlocale(LC_NUMERIC,"C");
+ if (file_exists("navit.c") || file_exists("navit.o") || file_exists("navit.lo")) {
+ char buffer[PATH_MAX];
+ printf(_("Running from source directory\n"));
+ getcwd(buffer, PATH_MAX);
+ setenv("NAVIT_PREFIX", buffer, 0);
+ main_setup_environment(0);
+ } else {
+ if (!getenv("NAVIT_PREFIX")) {
+ int progpath_len;
+#ifdef HAVE_API_WIN32_BASE
+ wchar_t filename[MAX_PATH + 1];
+ char program[MAX_PATH + 1];
+ char *cp;
+ int sz;
+#ifdef HAVE_API_WIN32
+ char *progpath="\\bin\\navit.exe";
+ sz = GetModuleFileNameW(NULL, filename, MAX_PATH);
+#else
+ char *progpath="\\navit.exe";
+ sz = GetModuleFileName(NULL, filename, MAX_PATH);
+#endif
+ if (sz > 0)
+ wcstombs(program, filename, sz + 1);
+ else
+ strcpy(program, PREFIX);
+#else
+ char *progpath="/bin/navit";
+#endif
+ l=strlen(program);
+ progpath_len=strlen(progpath);
+ if (l > progpath_len && !strcmp(program+l-progpath_len,progpath)) {
+ s=g_strdup(program);
+ s[l-progpath_len]='\0';
+ if (strcmp(s, PREFIX))
+ printf(_("setting '%s' to '%s'\n"), "NAVIT_PREFIX", s);
+ setenv("NAVIT_PREFIX", s, 0);
+ g_free(s);
+ } else
+ setenv("NAVIT_PREFIX", PREFIX, 0);
+ }
+#ifdef HAVE_API_WIN32_BASE
+ setenv("HOME", getenv("NAVIT_PREFIX"), 0);
+#endif
+
+#ifdef HAVE_API_WIN32_CE
+ main_setup_environment(2);
+#else
+ main_setup_environment(1);
+#endif
+ }
+ if (getenv("LC_ALL"))
+ dbg(0,"Warning: LC_ALL is set, this might lead to problems (e.g. strange positions from GPS)\n");
+ s = getenv("NAVIT_WID");
+ if (s) {
+ setenv("SDL_WINDOWID", s, 0);
+ }
+}
+
+void
+main_init_nls(void)
+{
+#ifdef ENABLE_NLS
+#ifdef FORCE_LOCALE
+#define STRINGIFY2(x) #x
+#define STRINGIFY(x) STRINGIFY2(x)
+ setlocale(LC_MESSAGES,STRINGIFY(FORCE_LOCALE));
+#endif
+ bindtextdomain(PACKAGE, getenv("NAVIT_LOCALEDIR"));
+ bind_textdomain_codeset (PACKAGE, "UTF-8");
+ textdomain(PACKAGE);
+#endif
+}
diff --git a/main.h b/main.h
new file mode 100644
index 00000000..4c631fe3
--- /dev/null
+++ b/main.h
@@ -0,0 +1,40 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_MAIN_H
+#define NAVIT_MAIN_H
+
+/* prototypes */
+struct navit;
+struct iter;
+struct attr;
+struct iter * main_iter_new(void);
+void main_iter_destroy(struct iter *iter);
+struct navit * main_get_navit(struct iter *iter);
+void main_add_navit(struct navit *nav);
+void main_remove_navit(struct navit *nav);
+int main_add_attr(struct attr *attr);
+int main_remove_attr(struct attr *attr);
+void main_init(char *program);
+void main_init_nls(void);
+int main(int argc, char **argv);
+/* end of prototypes */
+
+#endif
+
diff --git a/map-share.h b/map-share.h
new file mode 100644
index 00000000..0ba97542
--- /dev/null
+++ b/map-share.h
@@ -0,0 +1,27 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_MAP_SHARE_H
+#define NAVIT_MAP_SHARE_H
+
+void map_srv_start_poa(CORBA_ORB orb, CORBA_Environment * ev);
+CORBA_Object map_srv_start_object(CORBA_Environment * ev, struct container *co);
+
+#endif
+
diff --git a/map.c b/map.c
new file mode 100644
index 00000000..404090d7
--- /dev/null
+++ b/map.c
@@ -0,0 +1,663 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/** @file
+ *
+ * @brief Contains code that makes navit able to load maps
+ *
+ * This file contains the code that makes navit able to load maps. Because
+ * navit is able to open maps in different formats, this code does not handle
+ * any map format itself. This is done by map plugins which register to this
+ * code by calling plugin_register_map_type().
+ *
+ * When opening a new map, the map plugin will return a pointer to a map_priv
+ * struct, which can be defined by the map plugin and contains whatever private
+ * data the map plugin needs to access the map. This pointer will also be used
+ * as a "handle" to access the map opened.
+ *
+ * A common task is to create a "map rect". A map rect is a rectangular part of
+ * the map, that one can for example retrieve items from. It is not possible to
+ * retrieve items directly from the complete map. Creating a map rect returns a
+ * pointer to a map_rect_priv, which contains private data for the map rect and
+ * will be used as "handle" for this map rect.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "debug.h"
+#include "coord.h"
+#include "projection.h"
+#include "item.h"
+#include "map.h"
+#include "maptype.h"
+#include "transform.h"
+#include "plugin.h"
+#include "callback.h"
+#include "country.h"
+
+/**
+ * @brief Holds information about a map
+ *
+ * This structure holds information about a map.
+ */
+struct map {
+ struct map_methods meth; /**< Structure with pointers to the map plugin's functions */
+ struct map_priv *priv; /**< Private data of the map, only known to the map plugin */
+ struct attr **attrs; /**< Attributes of this map */
+ struct callback_list *attr_cbl; /**< List of callbacks that are called when attributes change */
+};
+
+/**
+ * @brief Describes a rectangular extract of a map
+ *
+ * This structure describes a rectangular extract of a map.
+ */
+struct map_rect {
+ struct map *m; /**< The map this extract is from */
+ struct map_rect_priv *priv; /**< Private data of this map rect, only known to the map plugin */
+};
+
+/**
+ * @brief Opens a new map
+ *
+ * This function opens a new map based on the attributes passed. This function
+ * takes the attribute "attr_type" to determine which type of map to open and passes
+ * all attributes to the map plugin's function that was specified in the
+ * plugin_register_new_map_type()-call.
+ *
+ * Note that every plugin should accept an attribute of type "attr_data" to be passed
+ * with the filename of the map to be opened as value.
+ *
+ * @param attrs Attributes specifying which map to open, see description
+ * @return The opened map or NULL on failure
+ */
+struct map *
+map_new(struct attr *parent, struct attr **attrs)
+{
+ struct map *m;
+ struct map_priv *(*maptype_new)(struct map_methods *meth, struct attr **attrs);
+ struct attr *type=attr_search(attrs, NULL, attr_type);
+
+ if (! type) {
+ dbg(0,"missing type\n");
+ return NULL;
+ }
+ maptype_new=plugin_get_map_type(type->u.str);
+ if (! maptype_new) {
+ dbg(0,"invalid type '%s'\n", type->u.str);
+ return NULL;
+ }
+
+ m=g_new0(struct map, 1);
+ m->attrs=attr_list_dup(attrs);
+ m->priv=maptype_new(&m->meth, attrs);
+ if (! m->priv) {
+ g_free(m);
+ m=NULL;
+ }
+ if (m)
+ m->attr_cbl=callback_list_new();
+ return m;
+}
+
+/**
+ * @brief Gets an attribute from a map
+ *
+ * @param this_ The map the attribute should be read from
+ * @param type The type of the attribute to be read
+ * @param attr Pointer to an attrib-structure where the attribute should be written to
+ * @param iter (NOT IMPLEMENTED) Used to iterate through all attributes of a type. Set this to NULL to get the first attribute, set this to an attr_iter to get the next attribute
+ * @return True if the attribute type was found, false if not
+ */
+int
+map_get_attr(struct map *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
+{
+ return attr_generic_get_attr(this_->attrs, NULL, type, attr, iter);
+}
+
+/**
+ * @brief Sets an attribute of a map
+ *
+ * This sets an attribute of a map, overwriting an attribute of the same type if it
+ * already exists. This function also calls all the callbacks that are registred
+ * to be called when attributes change.
+ *
+ * @param this_ The map to set the attribute of
+ * @param attr The attribute to set
+ * @return True if the attr could be set, false otherwise
+ */
+int
+map_set_attr(struct map *this_, struct attr *attr)
+{
+ this_->attrs=attr_generic_set_attr(this_->attrs, attr);
+ callback_list_call_attr_2(this_->attr_cbl, attr->type, this_, attr);
+ return 1;
+}
+
+/**
+ * @brief Registers a new callback for attribute-change
+ *
+ * This function registers a new callback function that should be called if the attributes
+ * of the map change.
+ *
+ * @param this_ The map to associate the callback with
+ * @param cb The callback to add
+ */
+void
+map_add_callback(struct map *this_, struct callback *cb)
+{
+ callback_list_add(this_->attr_cbl, cb);
+}
+
+/**
+ * @brief Removes a callback from the list of attribute-change callbacks
+ *
+ * This function removes one callback from the list of callbacks functions that should be called
+ * when attributes of the map change.
+ *
+ * @param this_ The map to remove the callback from
+ * @param cb The callback to remove
+ */
+void
+map_remove_callback(struct map *this_, struct callback *cb)
+{
+ callback_list_remove(this_->attr_cbl, cb);
+}
+
+
+/**
+ * @brief Checks if strings from a map have to be converted
+ *
+ * @param this_ Map to be checked for the need to convert strings
+ * @return True if strings from the map have to be converted, false otherwise
+ */
+int
+map_requires_conversion(struct map *this_)
+{
+ return (this_->meth.charset != NULL && strcmp(this_->meth.charset, "utf-8"));
+}
+
+/**
+ * @brief Converts a string from a map
+ *
+ * @param this_ The map the string to be converted is from
+ * @param str The string to be converted
+ * @return The converted string. It has to be map_convert_free()d after use.
+ */
+char *
+map_convert_string(struct map *this_, char *str)
+{
+ return g_convert(str, -1,"utf-8",this_->meth.charset,NULL,NULL,NULL);
+}
+
+/**
+ * @brief Frees the memory allocated for a converted string
+ *
+ * @param str The string to be freed
+ */
+void
+map_convert_free(char *str)
+{
+ g_free(str);
+}
+
+/**
+ * @brief Returns the projection of a map
+ *
+ * @param this_ The map to return the projection of
+ * @return The projection of the map
+ */
+enum projection
+map_projection(struct map *this_)
+{
+ return this_->meth.pro;
+}
+
+/**
+ * @brief Sets the projection of a map
+ *
+ * @param this_ The map to set the projection of
+ * @param pro The projection to be set
+ */
+void
+map_set_projection(struct map *this_, enum projection pro)
+{
+ this_->meth.pro=pro;
+}
+
+/**
+ * @brief Destroys an opened map
+ *
+ * @param m The map to be destroyed
+ */
+void
+map_destroy(struct map *m)
+{
+ m->meth.map_destroy(m->priv);
+ attr_list_free(m->attrs);
+ g_free(m);
+}
+
+/**
+ * @brief Creates a new map rect
+ *
+ * This creates a new map rect, which can be used to retrieve items from a map. If
+ * sel is a linked-list of selections, all of them will be used. If you pass NULL as
+ * sel, this means "get me the whole map".
+ *
+ * @param m The map to build the rect on
+ * @param sel Map selection to choose the rectangle - may be NULL, see description
+ * @return A new map rect
+ */
+struct map_rect *
+map_rect_new(struct map *m, struct map_selection *sel)
+{
+ struct map_rect *mr;
+
+#if 0
+ printf("map_rect_new 0x%x,0x%x-0x%x,0x%x\n", r->lu.x, r->lu.y, r->rl.x, r->rl.y);
+#endif
+ mr=g_new0(struct map_rect, 1);
+ mr->m=m;
+ mr->priv=m->meth.map_rect_new(m->priv, sel);
+ if (! mr->priv) {
+ g_free(mr);
+ mr=NULL;
+ }
+
+ return mr;
+}
+
+/**
+ * @brief Gets the next item from a map rect
+ *
+ * Returns an item from a map rect and advances the "item pointer" one step further,
+ * so that at the next call the next item is returned. Returns NULL if there are no more items.
+ *
+ * @param mr The map rect to return an item from
+ * @return An item from the map rect
+ */
+struct item *
+map_rect_get_item(struct map_rect *mr)
+{
+ struct item *ret;
+ dbg_assert(mr != NULL);
+ dbg_assert(mr->m != NULL);
+ dbg_assert(mr->m->meth.map_rect_get_item != NULL);
+ ret=mr->m->meth.map_rect_get_item(mr->priv);
+ if (ret)
+ ret->map=mr->m;
+ return ret;
+}
+
+/**
+ * @brief Returns the item specified by the ID
+ *
+ * @param mr The map rect to search for the item
+ * @param id_hi High part of the ID to be found
+ * @param id_lo Low part of the ID to be found
+ * @return The item with the specified ID or NULL if not found
+ */
+struct item *
+map_rect_get_item_byid(struct map_rect *mr, int id_hi, int id_lo)
+{
+ struct item *ret=NULL;
+ dbg_assert(mr != NULL);
+ dbg_assert(mr->m != NULL);
+ if (mr->m->meth.map_rect_get_item_byid)
+ ret=mr->m->meth.map_rect_get_item_byid(mr->priv, id_hi, id_lo);
+ if (ret)
+ ret->map=mr->m;
+ return ret;
+}
+
+/**
+ * @brief Destroys a map rect
+ *
+ * @param mr The map rect to be destroyed
+ */
+void
+map_rect_destroy(struct map_rect *mr)
+{
+ if (mr) {
+ mr->m->meth.map_rect_destroy(mr->priv);
+ g_free(mr);
+ }
+}
+
+/**
+ * @brief Holds information about a search on a map
+ *
+ * This structure holds information about a search performed on a map. This can be
+ * used as "handle" to retrieve items from a search.
+ */
+struct map_search {
+ struct map *m;
+ struct attr search_attr;
+ void *priv;
+};
+
+/**
+ * @brief Starts a search on a map
+ *
+ * This function starts a search on a map. What attributes one can search for depends on the
+ * map plugin.
+ *
+ * The OSM/binfile plugin currently supports: attr_town_name, attr_street_name
+ * The MG plugin currently supports: ttr_town_postal, attr_town_name, attr_street_name
+ *
+ * If you enable partial matches bear in mind that the search matches only the begin of the
+ * strings - a search for a street named "street" would match to "streetfoo", but not to
+ * "somestreet". Search is case insensitive.
+ *
+ * The item passed to this function specifies a "superior item" to "search within" - e.g. a town
+ * in which we want to search for a street, or a country in which to search for a town.
+ *
+ * Please also note that the search for countries is not handled by map plugins but by navit internally -
+ * have a look into country.c for details. Because of that every map plugin has to accept a country item
+ * to be passed as "superior item".
+ *
+ * Note: If you change something here, please make shure to also update the documentation of mapset_search_new()
+ * in mapset.c!
+ *
+ * @param m The map that should be searched
+ * @param item Specifies a superior item to "search within" (see description)
+ * @param search_attr Attribute specifying what to search for. See description.
+ * @param partial Set this to true to also have partial matches. See description.
+ * @return A new map search struct for this search
+ */
+struct map_search *
+map_search_new(struct map *m, struct item *item, struct attr *search_attr, int partial)
+{
+ struct map_search *this_;
+ dbg(1,"enter(%p,%p,%p,%d)\n", m, item, search_attr, partial);
+ dbg(1,"0x%x 0x%x 0x%x\n", attr_country_all, search_attr->type, attr_country_name);
+ this_=g_new0(struct map_search,1);
+ this_->m=m;
+ this_->search_attr=*search_attr;
+ if (search_attr->type >= attr_country_all && search_attr->type <= attr_country_name)
+ this_->priv=country_search_new(&this_->search_attr, partial);
+ else {
+ if (m->meth.map_search_new) {
+ if (m->meth.charset)
+ this_->search_attr.u.str=g_convert(this_->search_attr.u.str, -1,m->meth.charset,"utf-8",NULL,NULL,NULL);
+ this_->priv=m->meth.map_search_new(m->priv, item, &this_->search_attr, partial);
+ if (! this_->priv) {
+ g_free(this_);
+ this_=NULL;
+ }
+ } else {
+ g_free(this_);
+ this_=NULL;
+ }
+ }
+ return this_;
+}
+
+/**
+ * @brief Returns an item from a map search
+ *
+ * This returns an item of the result of a search on a map and advances the "item pointer" one step,
+ * so that at the next call the next item will be returned. If there are no more items in the result
+ * NULL is returned.
+ *
+ * @param this_ Map search struct of the search
+ * @return One item of the result
+ */
+struct item *
+map_search_get_item(struct map_search *this_)
+{
+ struct item *ret;
+
+ if (! this_)
+ return NULL;
+ if (this_->search_attr.type >= attr_country_all && this_->search_attr.type <= attr_country_name)
+ return country_search_get_item(this_->priv);
+ ret=this_->m->meth.map_search_get_item(this_->priv);
+ if (ret)
+ ret->map=this_->m;
+ return ret;
+}
+
+/**
+ * @brief Destroys a map search struct
+ *
+ * @param this_ The map search struct to be destroyed
+ */
+void
+map_search_destroy(struct map_search *this_)
+{
+ if (! this_)
+ return;
+ if (this_->search_attr.type >= attr_country_all && this_->search_attr.type <= attr_country_name)
+ country_search_destroy(this_->priv);
+ else {
+ if (this_->m->meth.charset)
+ g_free(this_->search_attr.u.str);
+ this_->m->meth.map_search_destroy(this_->priv);
+ }
+ g_free(this_);
+}
+
+/**
+ * @brief Creates a new rectangular map selection
+ *
+ * @param center Coordinates of the center of the new rectangle
+ * @param distance Distance of the rectangle's borders from the center
+ * @param order Desired order of the new selection
+ * @return The new map selection
+ */
+struct map_selection *
+map_selection_rect_new(struct pcoord *center, int distance, int order)
+{
+ struct map_selection *ret=g_new0(struct map_selection, 1);
+ ret->order=order;
+ ret->range=item_range_all;
+ ret->u.c_rect.lu.x=center->x-distance;
+ ret->u.c_rect.lu.y=center->y+distance;
+ ret->u.c_rect.rl.x=center->x+distance;
+ ret->u.c_rect.rl.y=center->y-distance;
+ return ret;
+}
+
+/**
+ * @brief Duplicates a map selection, transforming coordinates
+ *
+ * This duplicates a map selection and at the same time transforms the internal
+ * coordinates of the selection from one projection to another.
+ *
+ * @param sel The map selection to be duplicated
+ * @param from The projection used for the selection at the moment
+ * @param to The projection that should be used for the duplicated selection
+ * @return A duplicated, transformed map selection
+ */
+struct map_selection *
+map_selection_dup_pro(struct map_selection *sel, enum projection from, enum projection to)
+{
+ struct map_selection *next,**last;
+ struct map_selection *ret=NULL;
+ last=&ret;
+ while (sel) {
+ next = g_new(struct map_selection, 1);
+ *next=*sel;
+ if (from != projection_none || to != projection_none) {
+ transform_from_to(&sel->u.c_rect.lu, from, &next->u.c_rect.lu, to);
+ transform_from_to(&sel->u.c_rect.rl, from, &next->u.c_rect.rl, to);
+ }
+ *last=next;
+ last=&next->next;
+ sel = sel->next;
+ }
+ return ret;
+}
+
+/**
+ * @brief Duplicates a map selection
+ *
+ * @param sel The map selection to duplicate
+ * @return The duplicated map selection
+ */
+struct map_selection *
+map_selection_dup(struct map_selection *sel)
+{
+ return map_selection_dup_pro(sel, projection_none, projection_none);
+}
+
+/**
+ * @brief Destroys a map selection
+ *
+ * @param sel The map selection to be destroyed
+ */
+void
+map_selection_destroy(struct map_selection *sel)
+{
+ struct map_selection *next;
+ while (sel) {
+ next = sel->next;
+ g_free(sel);
+ sel = next;
+ }
+}
+
+/**
+ * @brief Checks if a selection contains a rectangle containing an item
+ *
+ * This function checks if a selection contains a rectangle which exactly contains
+ * an item. The rectangle is automatically built around the given item.
+ *
+ * @param sel The selection to be checked
+ * @param item The item that the rectangle should be built around
+ * @return True if the rectangle is within the selection, false otherwise
+ */
+int
+map_selection_contains_item_rect(struct map_selection *sel, struct item *item)
+{
+ struct coord c;
+ struct coord_rect r;
+ int count=0;
+ while (item_coord_get(item, &c, 1)) {
+ if (! count) {
+ r.lu=c;
+ r.rl=c;
+ } else
+ coord_rect_extend(&r, &c);
+ count++;
+ }
+ if (! count)
+ return 0;
+ return map_selection_contains_rect(sel, &r);
+
+}
+
+
+/**
+ * @brief Checks if a selection contains a item range
+ *
+ * This function checks if a selection contains at least one of the items in range
+ *
+ * @param sel The selection to be checked
+ * @param follow Whether the next pointer of the selection should be followed
+ * @param ranges The item ranges to be checked
+ * @count the number of elements in ranges
+ * @return True if there is a match, false otherwise
+ */
+
+int
+map_selection_contains_item_range(struct map_selection *sel, int follow, struct item_range *range, int count)
+{
+ int i;
+ if (! sel)
+ return 1;
+ while (sel) {
+ for (i = 0 ; i < count ; i++) {
+ if (item_range_intersects_range(&sel->range, &range[i]))
+ return 1;
+ }
+ if (! follow)
+ break;
+ sel=sel->next;
+ }
+ return 0;
+}
+/**
+ * @brief Checks if a selection contains a item
+ *
+ * This function checks if a selection contains a item type
+ *
+ * @param sel The selection to be checked
+ * @param follow Whether the next pointer of the selection should be followed
+ * @param item The item type to be checked
+ * @return True if there is a match, false otherwise
+ */
+
+int
+map_selection_contains_item(struct map_selection *sel, int follow, enum item_type type)
+{
+ if (! sel)
+ return 1;
+ while (sel) {
+ if (item_range_contains_item(&sel->range, type))
+ return 1;
+ if (! follow)
+ break;
+ sel=sel->next;
+ }
+ return 0;
+}
+
+
+
+/**
+ * @brief Checks if a pointer points to the private data of a map
+ *
+ * @param map The map whose private data should be checked.
+ * @param priv The private data that should be checked.
+ * @return True if priv is the private data of map
+ */
+int
+map_priv_is(struct map *map, struct map_priv *priv)
+{
+ return (map->priv == priv);
+}
+
+void
+map_dump_filedesc(struct map *map, FILE *out)
+{
+ struct map_rect *mr=map_rect_new(map, NULL);
+ struct item *item;
+
+ while ((item = map_rect_get_item(mr)))
+ item_dump_filedesc(item, map, out);
+ map_rect_destroy(mr);
+}
+
+void
+map_dump_file(struct map *map, const char *file)
+{
+ FILE *f;
+ f=fopen(file,"w");
+ map_dump_filedesc(map, f);
+ fclose(f);
+}
+
+void
+map_dump(struct map *map)
+{
+ map_dump_filedesc(map, stdout);
+}
diff --git a/map.h b/map.h
new file mode 100644
index 00000000..b43313b5
--- /dev/null
+++ b/map.h
@@ -0,0 +1,261 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/** @file
+ *
+ * @brief Contains exported functions / structures for map.c
+ *
+ * This file contains code that works together with map.c and that is exported
+ * to other modules.
+ */
+
+#ifndef NAVIT_MAP_H
+#define NAVIT_MAP_H
+
+struct map_priv;
+struct attr;
+#include "coord.h"
+#include "point.h"
+#include "layer.h"
+#include "debug.h"
+
+/**
+ * @brief Used to select data from a map
+ *
+ * This struct is used to select data from a map. This one the one hand builds a
+ * rectangle on the map and on the other hand selects an order for items of each
+ * layer. Note that passing NULL instead of a pointer to such a struct often means
+ * "get me everything".
+ *
+ * It's possible to link multiple selections in a linked list, see below.
+ */
+struct map_selection {
+ struct map_selection *next; /**< Linked-List pointer */
+ union {
+ struct coord_rect c_rect; /**< For building the rectangle based on coordinates */
+ struct point_rect p_rect; /**< For building the rectangle based on points */
+ } u;
+ int order; /**< Holds the order */
+ struct item_range range; /**< Range of items which should be delivered */
+};
+
+/**
+ * @brief Holds all functions a map plugin has to implement to be useable
+ *
+ * This structure holds pointers to a map plugin's functions navit's core will call
+ * to communicate with the plugin. For further information look into map.c - there exist
+ * functions with the same names acting more or less as "wrappers" around the functions here.
+ * Especially the arguments (and their meaning) of each function will be described there.
+ */
+struct map_methods {
+ enum projection pro; /**< The projection used for that type of map */
+ char *charset; /**< The charset this map uses - e.g. "iso8859-1" or "utf-8". Please specify this in a form so that g_convert() can handle it. */
+ void (*map_destroy)(struct map_priv *priv); /**< Function used to destroy ("close") a map. */
+ struct map_rect_priv * (*map_rect_new)(struct map_priv *map, struct map_selection *sel); /**< Function to create a new map rect on the map. */
+ void (*map_rect_destroy)(struct map_rect_priv *mr); /**< Function to destroy a map rect */
+ struct item * (*map_rect_get_item)(struct map_rect_priv *mr); /**< Function to return the next item from a map rect */
+ struct item * (*map_rect_get_item_byid)(struct map_rect_priv *mr, int id_hi, int id_lo); /**< Function to get an item with a specific ID from a map rect */
+ struct map_search_priv *(*map_search_new)(struct map_priv *map, struct item *item, struct attr *search, int partial); /**< Function to start a new search on the map */
+ void (*map_search_destroy)(struct map_search_priv *ms); /**< Function to destroy a map search struct */
+ struct item * (*map_search_get_item)(struct map_search_priv *ms); /**< Function to get the next item of a search on the map */
+ struct item * (*map_rect_create_item)(struct map_rect_priv *mr, enum item_type type); /**< Function to create a new item in the map */
+};
+
+/**
+ * @brief Checks if a coordinate is within a map selection
+ *
+ * Checks if a coordinate is within a map selection. Note that since a selection of NULL
+ * means "select everything", with sel = NULL this will always return true. If there are
+ * more than one selection in a linked-list, it is sufficient if only one of the selections
+ * contains the coordinate.
+ *
+ * @param sel The selection to check if the point is within
+ * @param c Coordinate to check if it is within the selection
+ * @return True if the coordinate is within one of the selections, False otherwise
+ */
+static inline int
+map_selection_contains_point(struct map_selection *sel, struct coord *c)
+{
+ struct map_selection *curr=sel;
+ while (curr) {
+ struct coord_rect *r=&curr->u.c_rect;
+ if (c->x >= r->lu.x && c->x <= r->rl.x &&
+ c->y <= r->lu.y && c->y >= r->rl.y)
+ return 1;
+ curr=curr->next;
+ }
+ return sel ? 0:1;
+}
+
+/**
+ * @brief Checks if a polyline is within a map selection
+ *
+ * @sa Please refer to map_selection_contains_point()
+ *
+ * @param sel The selection to check if the polyline is within
+ * @param c Coordinates of the polyline to check if it is within the selection
+ * @param count Number of coordinates in c
+ * @return True if the polyline is within one of the selections, False otherwise
+ */
+static inline int
+map_selection_contains_polyline(struct map_selection *sel, struct coord *c, int count)
+{
+ int i,x_mi,x_ma,y_mi,y_ma;
+ struct map_selection *curr;
+
+ if (! sel)
+ return 1;
+ for (i = 0 ; i < count-1 ; i++) {
+ x_mi=c[i].x;
+ if (c[i+1].x < x_mi)
+ x_mi=c[i+1].x;
+ x_ma=c[i].x;
+ if (c[i+1].x > x_ma)
+ x_ma=c[i+1].x;
+ y_mi=c[i].y;
+ if (c[i+1].y < y_mi)
+ y_mi=c[i+1].y;
+ y_ma=c[i].y;
+ if (c[i+1].y > y_ma)
+ y_ma=c[i+1].y;
+ curr=sel;
+ while (curr) {
+ struct coord_rect *sr=&curr->u.c_rect;
+ if (x_mi <= sr->rl.x && x_ma >= sr->lu.x &&
+ y_ma >= sr->rl.y && y_mi <= sr->lu.y)
+ return 1;
+ curr=curr->next;
+ }
+ }
+ return 0;
+}
+
+/**
+ * @brief Checks if a rectangle is within a map selection
+ *
+ * @sa Please refer to map_selection_contains_point()
+ *
+ * @param sel The selection to check if the rectangle is within
+ * @param r Rectangle to be checked for
+ * @return True if the rectangle is within one of the selections, False otherwise
+ */
+static inline int
+map_selection_contains_rect(struct map_selection *sel, struct coord_rect *r)
+{
+ struct map_selection *curr;
+
+ dbg_assert(r->lu.x <= r->rl.x);
+ dbg_assert(r->lu.y >= r->rl.y);
+
+ if (! sel)
+ return 1;
+ curr=sel;
+ while (curr) {
+ struct coord_rect *sr=&curr->u.c_rect;
+ dbg_assert(sr->lu.x <= sr->rl.x);
+ dbg_assert(sr->lu.y >= sr->rl.y);
+ if (r->lu.x <= sr->rl.x && r->rl.x >= sr->lu.x &&
+ r->lu.y >= sr->rl.y && r->rl.y <= sr->lu.y)
+ return 1;
+ curr=curr->next;
+ }
+ return 0;
+}
+
+
+/**
+ * @brief Checks if a polygon is within a map selection
+ *
+ * @sa Please refer to map_selection_contains_point()
+ *
+ * @param sel The selection to check if the polygon is within
+ * @param c Pointer to coordinates of the polygon
+ * @param count Number of coordinates in c
+ * @return True if the polygon is within one of the selections, False otherwise
+ */
+static inline int
+map_selection_contains_polygon(struct map_selection *sel, struct coord *c, int count)
+{
+ struct coord_rect r;
+ int i;
+
+ if (! sel)
+ return 1;
+ if (! count)
+ return 0;
+ r.lu=c[0];
+ r.rl=c[0];
+ for (i = 1 ; i < count ; i++) {
+ if (c[i].x < r.lu.x)
+ r.lu.x=c[i].x;
+ if (c[i].x > r.rl.x)
+ r.rl.x=c[i].x;
+ if (c[i].y < r.rl.y)
+ r.rl.y=c[i].y;
+ if (c[i].y > r.lu.y)
+ r.lu.y=c[i].y;
+ }
+ return map_selection_contains_rect(sel, &r);
+}
+
+/* prototypes */
+enum attr_type;
+enum projection;
+struct attr;
+struct attr_iter;
+struct callback;
+struct item;
+struct map;
+struct map_priv;
+struct map_rect;
+struct map_search;
+struct map_selection;
+struct pcoord;
+struct map *map_new(struct attr *parent, struct attr **attrs);
+int map_get_attr(struct map *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
+int map_set_attr(struct map *this_, struct attr *attr);
+void map_add_callback(struct map *this_, struct callback *cb);
+void map_remove_callback(struct map *this_, struct callback *cb);
+int map_requires_conversion(struct map *this_);
+char *map_convert_string(struct map *this_, char *str);
+void map_convert_free(char *str);
+enum projection map_projection(struct map *this_);
+void map_set_projection(struct map *this_, enum projection pro);
+void map_destroy(struct map *m);
+struct map_rect *map_rect_new(struct map *m, struct map_selection *sel);
+struct item *map_rect_get_item(struct map_rect *mr);
+struct item *map_rect_get_item_byid(struct map_rect *mr, int id_hi, int id_lo);
+void map_rect_destroy(struct map_rect *mr);
+struct map_search *map_search_new(struct map *m, struct item *item, struct attr *search_attr, int partial);
+struct item *map_search_get_item(struct map_search *this_);
+void map_search_destroy(struct map_search *this_);
+struct map_selection *map_selection_rect_new(struct pcoord *center, int distance, int order);
+struct map_selection *map_selection_dup_pro(struct map_selection *sel, enum projection from, enum projection to);
+struct map_selection *map_selection_dup(struct map_selection *sel);
+void map_selection_destroy(struct map_selection *sel);
+int map_selection_contains_item_rect(struct map_selection *sel, struct item *item);
+int map_selection_contains_item_range(struct map_selection *sel, int follow, struct item_range *range, int count);
+int map_selection_contains_item(struct map_selection *sel, int follow, enum item_type type);
+int map_priv_is(struct map *map, struct map_priv *priv);
+void map_dump_filedesc(struct map *map, FILE *out);
+void map_dump_file(struct map *map, const char *file);
+void map_dump(struct map *map);
+/* end of prototypes */
+
+#endif
diff --git a/map/Makefile.am b/map/Makefile.am
new file mode 100644
index 00000000..9de73d27
--- /dev/null
+++ b/map/Makefile.am
@@ -0,0 +1,11 @@
+SUBDIRS=mg textfile binfile shapefile
+# garmin_img
+if HAVELIBGARMIN
+SUBDIRS+=garmin
+endif
+if MAP_POI_GEODOWNLOAD
+SUBDIRS+=poi_geodownload
+endif
+
+DIST_SUBDIRS=mg textfile poi_geodownload binfile garmin shapefile
+
diff --git a/map/binfile/Makefile.am b/map/binfile/Makefile.am
new file mode 100644
index 00000000..e35e18bf
--- /dev/null
+++ b/map/binfile/Makefile.am
@@ -0,0 +1,9 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=map_binfile
+if PLUGINS
+ modulemap_LTLIBRARIES = libmap_binfile.la
+else
+ noinst_LTLIBRARIES = libmap_binfile.la
+endif
+libmap_binfile_la_SOURCES = binfile.c
+libmap_binfile_la_LDFLAGS = -module -avoid-version
diff --git a/map/binfile/binfile.c b/map/binfile/binfile.c
new file mode 100644
index 00000000..4bf27909
--- /dev/null
+++ b/map/binfile/binfile.c
@@ -0,0 +1,1299 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include "config.h"
+#include "debug.h"
+#include "plugin.h"
+#include "projection.h"
+#include "item.h"
+#include "map.h"
+#include "maptype.h"
+#include "attr.h"
+#include "coord.h"
+#include "transform.h"
+#include "file.h"
+#include "zipfile.h"
+#include "linguistics.h"
+#include "endianess.h"
+
+static int map_id;
+
+struct tile {
+ int *start;
+ int *end;
+ int *pos;
+ int *pos_coord_start;
+ int *pos_coord;
+ int *pos_attr_start;
+ int *pos_attr;
+ int *pos_next;
+ int zipfile_num;
+ int mode;
+};
+
+struct map_priv {
+ int id;
+ char *filename;
+ char *cachedir;
+ struct file *fi;
+ struct zip_cd *index_cd;
+ int index_offset;
+ int cde_size;
+ struct zip_eoc *eoc;
+ int zip_members;
+ unsigned char *search_data;
+ int search_offset;
+ int search_size;
+ int version;
+ int check_version;
+ int map_version;
+ GHashTable *changes;
+};
+
+struct map_rect_priv {
+ int *start;
+ int *end;
+ enum attr_type attr_last;
+ int label;
+ int *label_attr[4];
+ struct map_selection *sel;
+ struct map_priv *m;
+ struct item item;
+ int tile_depth;
+ struct tile tiles[8];
+ struct tile *t;
+ int country_id;
+ char *url;
+#ifdef DEBUG_SIZE
+ int size;
+#endif
+};
+
+struct map_search_priv {
+ struct map_rect_priv *mr;
+ struct attr *search;
+ struct map_selection *ms;
+ int partial;
+ GHashTable *search_results;
+};
+
+
+static void push_tile(struct map_rect_priv *mr, struct tile *t);
+static void setup_pos(struct map_rect_priv *mr);
+
+static void lfh_to_cpu(struct zip_lfh *lfh) {
+ dbg_assert(lfh != NULL);
+ lfh->ziplocsig = le32_to_cpu(lfh->ziplocsig);
+ lfh->zipver = le16_to_cpu(lfh->zipver);
+ lfh->zipgenfld = le16_to_cpu(lfh->zipgenfld);
+ lfh->zipmthd = le16_to_cpu(lfh->zipmthd);
+ lfh->ziptime = le16_to_cpu(lfh->ziptime);
+ lfh->zipdate = le16_to_cpu(lfh->zipdate);
+ lfh->zipcrc = le32_to_cpu(lfh->zipcrc);
+ lfh->zipsize = le32_to_cpu(lfh->zipsize);
+ lfh->zipuncmp = le32_to_cpu(lfh->zipuncmp);
+ lfh->zipfnln = le16_to_cpu(lfh->zipfnln);
+ lfh->zipxtraln = le16_to_cpu(lfh->zipxtraln);
+}
+
+static void cd_to_cpu(struct zip_cd *zcd) {
+ dbg_assert(zcd != NULL);
+ zcd->zipcensig = le32_to_cpu(zcd->zipcensig);
+ zcd->zipccrc = le32_to_cpu(zcd->zipccrc);
+ zcd->zipcsiz = le32_to_cpu(zcd->zipcsiz);
+ zcd->zipcunc = le32_to_cpu(zcd->zipcunc);
+ zcd->zipcfnl = le16_to_cpu(zcd->zipcfnl);
+ zcd->zipcxtl = le16_to_cpu(zcd->zipcxtl);
+ zcd->zipccml = le16_to_cpu(zcd->zipccml);
+ zcd->zipdsk = le16_to_cpu(zcd->zipdsk);
+ zcd->zipint = le16_to_cpu(zcd->zipint);
+ zcd->zipext = le32_to_cpu(zcd->zipext);
+ zcd->zipofst = le32_to_cpu(zcd->zipofst);
+}
+
+static void eoc_to_cpu(struct zip_eoc *eoc) {
+ dbg_assert(eoc != NULL);
+ eoc->zipesig = le32_to_cpu(eoc->zipesig);
+ eoc->zipedsk = le16_to_cpu(eoc->zipedsk);
+ eoc->zipecen = le16_to_cpu(eoc->zipecen);
+ eoc->zipenum = le16_to_cpu(eoc->zipenum);
+ eoc->zipecenn = le16_to_cpu(eoc->zipecenn);
+ eoc->zipecsz = le32_to_cpu(eoc->zipecsz);
+ eoc->zipeofst = le32_to_cpu(eoc->zipeofst);
+ eoc->zipecoml = le16_to_cpu(eoc->zipecoml);
+}
+
+static void binfile_check_version(struct map_priv *m);
+
+static struct zip_eoc *
+binfile_read_eoc(struct file *fi)
+{
+ struct zip_eoc *eoc;
+ eoc=(struct zip_eoc *)file_data_read(fi,fi->size-sizeof(struct zip_eoc), sizeof(struct zip_eoc));
+ if (eoc) {
+ eoc_to_cpu(eoc);
+ dbg(1,"sig 0x%x\n", eoc->zipesig);
+ if (eoc->zipesig != zip_eoc_sig) {
+ file_data_free(fi,(unsigned char *)eoc);
+ eoc=NULL;
+ }
+ }
+ return eoc;
+}
+
+static struct zip_cd *
+binfile_read_cd(struct map_priv *m, int offset, int len)
+{
+ struct zip_cd *cd;
+ if (len == -1) {
+ cd=(struct zip_cd *)file_data_read(m->fi,m->eoc->zipeofst+offset, sizeof(*cd));
+ cd_to_cpu(m->index_cd);
+ len=cd->zipcfnl;
+ file_data_free(m->fi,(unsigned char *)cd);
+ }
+ cd=(struct zip_cd *)file_data_read(m->fi,m->eoc->zipeofst+offset, sizeof(*cd)+len);
+ if (cd) {
+ cd_to_cpu(cd);
+ dbg(1,"sig 0x%x\n", cd->zipcensig);
+ if (cd->zipcensig != zip_cd_sig) {
+ file_data_free(m->fi,(unsigned char *)cd);
+ cd=NULL;
+ }
+ }
+ return cd;
+}
+
+static struct zip_lfh *
+binfile_read_lfh(struct file *fi, unsigned int offset)
+{
+ struct zip_lfh *lfh;
+
+ lfh=(struct zip_lfh *)(file_data_read(fi,offset,sizeof(struct zip_lfh)));
+ if (lfh) {
+ lfh_to_cpu(lfh);
+ if (lfh->ziplocsig != zip_lfh_sig) {
+ file_data_free(fi,(unsigned char *)lfh);
+ lfh=NULL;
+ }
+ }
+ return lfh;
+}
+
+static unsigned char *
+binfile_read_content(struct file *fi, int offset, struct zip_lfh *lfh)
+{
+ offset+=sizeof(struct zip_lfh)+lfh->zipfnln+lfh->zipxtraln;
+ switch (lfh->zipmthd) {
+ case 0:
+ return file_data_read(fi,offset, lfh->zipuncmp);
+ case 8:
+ return file_data_read_compressed(fi,offset, lfh->zipsize, lfh->zipuncmp);
+ default:
+ dbg(0,"Unknown compression method %d\n", lfh->zipmthd);
+ return NULL;
+ }
+}
+
+static int
+binfile_search_cd(struct map_priv *m, int offset, char *name, int partial, int skip)
+{
+ int size=4096;
+ int end=m->eoc->zipecsz;
+ int len=strlen(name);
+ struct zip_cd *cd;
+#if 0
+ dbg(0,"end=%d\n",end);
+#endif
+ while (offset < end) {
+ cd=(struct zip_cd *)(m->search_data+offset-m->search_offset);
+ if (! m->search_data ||
+ m->search_offset > offset ||
+ offset-m->search_offset+sizeof(*cd) > m->search_size ||
+ offset-m->search_offset+sizeof(*cd)+cd->zipcfnl > m->search_size
+ ) {
+#if 0
+ dbg(0,"reload %p %d %d\n", m->search_data, m->search_offset, offset);
+#endif
+ if (m->search_data)
+ file_data_free(m->fi,m->search_data);
+ m->search_offset=offset;
+ m->search_size=end-offset;
+ if (m->search_size > size)
+ m->search_size=size;
+ m->search_data=file_data_read(m->fi,m->eoc->zipeofst+m->search_offset,m->search_size);
+ cd=(struct zip_cd *)m->search_data;
+ }
+#if 0
+ dbg(0,"offset=%d search_offset=%d search_size=%d search_data=%p cd=%p\n", offset, m->search_offset, m->search_size, m->search_data, cd);
+ dbg(0,"offset=%d fn='%s'\n",offset,cd->zipcfn);
+#endif
+ if (!skip &&
+ (partial || cd->zipcfnl == len) &&
+ !strncmp(cd->zipcfn, name, len))
+ return offset;
+ skip=0;
+ offset+=sizeof(*cd)+cd->zipcfnl+cd->zipcxtl+cd->zipccml;
+;
+ }
+ return -1;
+}
+
+static void
+map_destroy_binfile(struct map_priv *m)
+{
+ dbg(1,"map_destroy_binfile\n");
+ g_free(m);
+}
+
+static void
+binfile_coord_rewind(void *priv_data)
+{
+ struct map_rect_priv *mr=priv_data;
+ struct tile *t=mr->t;
+ t->pos_coord=t->pos_coord_start;
+}
+
+static int
+binfile_coord_get(void *priv_data, struct coord *c, int count)
+{
+ struct map_rect_priv *mr=priv_data;
+ struct tile *t=mr->t;
+ int ret=0;
+ dbg(2,"binfile_coord_get %d\n",count);
+ while (count--) {
+ dbg(2,"%p vs %p\n", t->pos_coord, t->pos_attr_start);
+ if (t->pos_coord >= t->pos_attr_start)
+ break;
+ c->x=le32_to_cpu(*(t->pos_coord++));
+ c->y=le32_to_cpu(*(t->pos_coord++));
+ c++;
+ ret++;
+ }
+ return ret;
+}
+
+static void
+binfile_attr_rewind(void *priv_data)
+{
+ struct map_rect_priv *mr=priv_data;
+ struct tile *t=mr->t;
+ t->pos_attr=t->pos_attr_start;
+ mr->label=0;
+ memset(mr->label_attr, 0, sizeof(mr->label_attr));
+
+}
+
+static char *
+binfile_extract(struct map_priv *m, char *dir, char *filename, int partial)
+{
+ char *full,*fulld,*sep;
+ unsigned char *start;
+ int len,offset=m->index_offset;
+ struct zip_cd *cd;
+ struct zip_lfh *lfh;
+ FILE *f;
+
+ for (;;) {
+ offset=binfile_search_cd(m, offset, filename, partial, 1);
+ if (offset == -1)
+ break;
+ cd=binfile_read_cd(m, offset, -1);
+ len=strlen(dir)+1+cd->zipcfnl+1;
+ full=g_malloc(len);
+ strcpy(full,dir);
+ strcpy(full+strlen(full),"/");
+ strncpy(full+strlen(full),cd->zipcfn,cd->zipcfnl);
+ full[len-1]='\0';
+ fulld=g_strdup(full);
+ sep=strrchr(fulld, '/');
+ if (sep) {
+ *sep='\0';
+ file_mkdir(fulld, 1);
+ }
+ if (full[len-2] != '/') {
+ lfh=binfile_read_lfh(m->fi, cd->zipofst);
+ start=binfile_read_content(m->fi, cd->zipofst, lfh);
+ dbg(0,"fopen '%s'\n", full);
+ f=fopen(full,"w");
+ fwrite(start, lfh->zipuncmp, 1, f);
+ fclose(f);
+ file_data_free(m->fi, start);
+ file_data_free(m->fi, (unsigned char *)lfh);
+ }
+ file_data_free(m->fi, (unsigned char *)cd);
+ g_free(fulld);
+ g_free(full);
+ if (! partial)
+ break;
+ }
+
+ return g_strdup_printf("%s/%s",dir,filename);
+}
+
+static int
+binfile_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
+{
+ struct map_rect_priv *mr=priv_data;
+ struct tile *t=mr->t;
+ enum attr_type type;
+ int i,size;
+
+ if (attr_type != mr->attr_last) {
+ t->pos_attr=t->pos_attr_start;
+ mr->attr_last=attr_type;
+ }
+ while (t->pos_attr < t->pos_next) {
+ size=le32_to_cpu(*(t->pos_attr++));
+ type=le32_to_cpu(t->pos_attr[0]);
+ if (type == attr_label)
+ mr->label=1;
+ if (type == attr_house_number)
+ mr->label_attr[0]=t->pos_attr;
+ if (type == attr_street_name)
+ mr->label_attr[1]=t->pos_attr;
+ if (type == attr_street_name_systematic)
+ mr->label_attr[2]=t->pos_attr;
+ if (type == attr_town_name && mr->item.type < type_line)
+ mr->label_attr[3]=t->pos_attr;
+ if (type == attr_type || attr_type == attr_any) {
+ if (attr_type == attr_any) {
+ dbg(1,"pos %p attr %s size %d\n", t->pos_attr-1, attr_to_name(type), size);
+ }
+ attr->type=type;
+ attr_data_set_le(attr, t->pos_attr+1);
+ if (type == attr_url_local) {
+ g_free(mr->url);
+ mr->url=binfile_extract(mr->m, mr->m->cachedir, attr->u.str, 1);
+ attr->u.str=mr->url;
+ }
+ if (type == attr_flags && mr->m->map_version < 1)
+ attr->u.num |= AF_CAR;
+ t->pos_attr+=size;
+ return 1;
+ } else {
+ t->pos_attr+=size;
+ }
+ }
+ if (!mr->label && (attr_type == attr_any || attr_type == attr_label)) {
+ for (i = 0 ; i < sizeof(mr->label_attr)/sizeof(int *) ; i++) {
+ if (mr->label_attr[i]) {
+ mr->label=1;
+ attr->type=attr_label;
+ attr_data_set_le(attr,mr->label_attr[i]+1);
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+struct binfile_hash_entry {
+ struct item_id id;
+ int flags;
+ int data[0];
+};
+
+static guint
+binfile_hash_entry_hash(gconstpointer key)
+{
+ const struct binfile_hash_entry *entry=key;
+ return (entry->id.id_hi ^ entry->id.id_lo);
+}
+
+static gboolean
+binfile_hash_entry_equal(gconstpointer a, gconstpointer b)
+{
+ const struct binfile_hash_entry *entry1=a,*entry2=b;
+ return (entry1->id.id_hi==entry2->id.id_hi && entry1->id.id_lo == entry2->id.id_lo);
+}
+
+static int *
+binfile_item_dup(struct map_priv *m, struct item *item, struct tile *t, int extend)
+{
+ int size=le32_to_cpu(t->pos[0]);
+ struct binfile_hash_entry *entry=g_malloc(sizeof(struct binfile_hash_entry)+(size+1+extend)*sizeof(int));
+ void *ret=entry->data;
+ entry->id.id_hi=item->id_hi;
+ entry->id.id_lo=item->id_lo;
+ entry->flags=1;
+ dbg(0,"id 0x%x,0x%x\n",entry->id.id_hi,entry->id.id_lo);
+
+ memcpy(ret, t->pos, (size+1)*sizeof(int));
+ if (!m->changes)
+ m->changes=g_hash_table_new_full(binfile_hash_entry_hash, binfile_hash_entry_equal, g_free, NULL);
+ g_hash_table_replace(m->changes, entry, entry);
+ dbg(0,"ret %p\n",ret);
+ return ret;
+}
+
+static int
+binfile_coord_set(void *priv_data, struct coord *c, int count, enum change_mode mode)
+{
+ struct map_rect_priv *mr=priv_data;
+ struct tile *t=mr->t,*tn,new;
+ int i,delta,move_len;
+ int write_offset,move_offset,aoffset,coffset,clen;
+ int *data;
+
+ {
+ int *i=t->pos,j=0;
+ dbg(0,"Before: pos_coord=%d\n",t->pos_coord-i);
+ while (i < t->pos_next)
+ dbg(0,"%d:0x%x\n",j++,*i++);
+
+ }
+ aoffset=t->pos_attr-t->pos_attr_start;
+ coffset=t->pos_coord-t->pos_coord_start-2;
+ clen=t->pos_attr_start-t->pos_coord+2;
+ dbg(0,"coffset=%d clen=%d\n",coffset,clen);
+ switch (mode) {
+ case change_mode_delete:
+ if (count*2 > clen)
+ count=clen/2;
+ delta=-count*2;
+ move_offset=coffset+count*2;
+ move_len=t->pos_next-t->pos_coord_start-move_offset;
+ write_offset=0;
+ break;
+ case change_mode_modify:
+ write_offset=coffset;
+ if (count*2 > clen) {
+ delta=count*2-clen;
+ move_offset=t->pos_attr_start-t->pos_coord_start;
+ move_len=t->pos_next-t->pos_coord_start-move_offset;
+ } else {
+ move_len=0;
+ move_offset=0;
+ delta=0;
+ }
+ break;
+ case change_mode_prepend:
+ delta=count*2;
+ move_offset=coffset-2;
+ move_len=t->pos_next-t->pos_coord_start-move_offset;
+ write_offset=coffset-2;
+ break;
+ case change_mode_append:
+ delta=count*2;
+ move_offset=coffset;
+ move_len=t->pos_next-t->pos_coord_start-move_offset;
+ write_offset=coffset;
+ break;
+ default:
+ return 0;
+ }
+ dbg(0,"delta %d\n",delta);
+ data=binfile_item_dup(mr->m, &mr->item, t, delta > 0 ? delta:0);
+ data[0]=cpu_to_le32(le32_to_cpu(data[0])+delta);
+ data[2]=cpu_to_le32(le32_to_cpu(data[2])+delta);
+ new.pos=new.start=data;
+ new.zipfile_num=t->zipfile_num;
+ new.mode=2;
+ push_tile(mr, &new);
+ setup_pos(mr);
+ tn=mr->t;
+ tn->pos_coord=tn->pos_coord_start+coffset;
+ tn->pos_attr=tn->pos_attr_start+aoffset;
+ dbg(0,"moving %d ints from offset %d to %d\n",move_len,tn->pos_coord_start+move_offset-data,tn->pos_coord_start+move_offset+delta-data);
+ memmove(tn->pos_coord_start+move_offset+delta, tn->pos_coord_start+move_offset, move_len*4);
+ {
+ int *i=tn->pos,j=0;
+ dbg(0,"After move: pos_coord=%d\n",tn->pos_coord-i);
+ while (i < tn->pos_next)
+ dbg(0,"%d:0x%x\n",j++,*i++);
+ }
+ if (mode != change_mode_append)
+ tn->pos_coord+=move_offset;
+ if (mode != change_mode_delete) {
+ dbg(0,"writing %d ints at offset %d\n",count*2,write_offset+tn->pos_coord_start-data);
+ for (i = 0 ; i < count ; i++) {
+ tn->pos_coord_start[write_offset++]=c[i].x;
+ tn->pos_coord_start[write_offset++]=c[i].y;
+ }
+
+ }
+ {
+ int *i=tn->pos,j=0;
+ dbg(0,"After: pos_coord=%d\n",tn->pos_coord-i);
+ while (i < tn->pos_next)
+ dbg(0,"%d:0x%x\n",j++,*i++);
+ }
+ return 1;
+}
+
+static int
+binfile_attr_set(void *priv_data, struct attr *attr, enum change_mode mode)
+{
+ struct map_rect_priv *mr=priv_data;
+ struct tile *t=mr->t,*tn,new;
+ int extend,offset,delta,move_len;
+ int write_offset,move_offset,naoffset,coffset,oattr_len;
+ int nattr_size,nattr_len,pad;
+ int *data;
+
+ {
+ int *i=t->pos,j=0;
+ dbg(0,"Before: pos_attr=%d\n",t->pos_attr-i);
+ while (i < t->pos_next)
+ dbg(0,"%d:0x%x\n",j++,*i++);
+
+ }
+
+ write_offset=0;
+ naoffset=t->pos_attr-t->pos_attr_start;
+ coffset=t->pos_coord-t->pos_coord_start;
+ offset=0;
+ oattr_len=0;
+ if (!naoffset) {
+ if (mode == change_mode_delete || mode == change_mode_modify) {
+ dbg(0,"no attribute selected\n");
+ return 0;
+ }
+ if (mode == change_mode_append)
+ naoffset=t->pos_next-t->pos_attr_start;
+ }
+ while (offset < naoffset) {
+ oattr_len=le32_to_cpu(t->pos_attr_start[offset])+1;
+ dbg(0,"len %d\n",oattr_len);
+ write_offset=offset;
+ offset+=oattr_len;
+ }
+ move_len=t->pos_next-t->pos_attr_start-offset;
+ move_offset=offset;
+ switch (mode) {
+ case change_mode_delete:
+ nattr_size=0;
+ nattr_len=0;
+ pad=0;
+ extend=0;
+ break;
+ case change_mode_modify:
+ case change_mode_prepend:
+ case change_mode_append:
+ nattr_size=attr_data_size(attr);
+ pad=(4-(nattr_size%4))%4;
+ nattr_len=(nattr_size+pad)/4+2;
+ if (mode == change_mode_prepend) {
+ move_offset=write_offset;
+ move_len+=oattr_len;
+ }
+ if (mode == change_mode_append) {
+ write_offset=move_offset;
+ }
+ break;
+ default:
+ return 0;
+ }
+ if (mode == change_mode_delete || mode == change_mode_modify)
+ delta=nattr_len-oattr_len;
+ else
+ delta=nattr_len;
+ dbg(0,"delta %d oattr_len %d nattr_len %d\n",delta,oattr_len, nattr_len);
+ data=binfile_item_dup(mr->m, &mr->item, t, delta > 0 ? delta:0);
+ data[0]=cpu_to_le32(le32_to_cpu(data[0])+delta);
+ new.pos=new.start=data;
+ new.zipfile_num=t->zipfile_num;
+ new.mode=2;
+ push_tile(mr, &new);
+ setup_pos(mr);
+ tn=mr->t;
+ tn->pos_coord=tn->pos_coord_start+coffset;
+ tn->pos_attr=tn->pos_attr_start+offset;
+ dbg(0,"attr start %d offset %d\n",tn->pos_attr_start-data,offset);
+ dbg(0,"moving %d ints from offset %d to %d\n",move_len,tn->pos_attr_start+move_offset-data,tn->pos_attr_start+move_offset+delta-data);
+ memmove(tn->pos_attr_start+move_offset+delta, tn->pos_attr_start+move_offset, move_len*4);
+ if (mode != change_mode_append)
+ tn->pos_attr+=delta;
+ {
+ int *i=tn->pos,j=0;
+ dbg(0,"After move: pos_attr=%d\n",tn->pos_attr-i);
+ while (i < tn->pos_next)
+ dbg(0,"%d:0x%x\n",j++,*i++);
+ }
+ if (nattr_len) {
+ int *nattr=tn->pos_attr_start+write_offset;
+ dbg(0,"writing %d ints at %d\n",nattr_len,nattr-data);
+ nattr[0]=cpu_to_le32(nattr_len-1);
+ nattr[1]=cpu_to_le32(attr->type);
+ memcpy(nattr+2, attr_data_get(attr), nattr_size);
+ memset((unsigned char *)(nattr+2)+nattr_size, 0, pad);
+ }
+ {
+ int *i=tn->pos,j=0;
+ dbg(0,"After: pos_attr=%d\n",tn->pos_attr-i);
+ while (i < tn->pos_next)
+ dbg(0,"%d:0x%x\n",j++,*i++);
+ }
+ return 1;
+}
+
+static struct item_methods methods_binfile = {
+ binfile_coord_rewind,
+ binfile_coord_get,
+ binfile_attr_rewind,
+ binfile_attr_get,
+ NULL,
+ binfile_attr_set,
+ binfile_coord_set,
+};
+
+static void
+push_tile(struct map_rect_priv *mr, struct tile *t)
+{
+ dbg_assert(mr->tile_depth < 8);
+ mr->t=&mr->tiles[mr->tile_depth++];
+ *(mr->t)=*t;
+ mr->t->pos=mr->t->pos_next=mr->t->start;
+}
+
+static int
+pop_tile(struct map_rect_priv *mr)
+{
+ if (mr->tile_depth <= 1)
+ return 0;
+ if (mr->t->mode < 2)
+ file_data_free(mr->m->fi, (unsigned char *)(mr->t->start));
+ mr->t=&mr->tiles[--mr->tile_depth-1];
+ return 1;
+}
+
+
+static int
+zipfile_to_tile(struct file *f, struct zip_cd *cd, struct tile *t)
+{
+ char buffer[1024];
+ struct zip_lfh *lfh;
+ char *zipfn;
+ dbg(1,"enter %p %p %p\n", f, cd, t);
+ dbg(1,"cd->zipofst=0x%x\n", cd->zipofst);
+ t->start=NULL;
+ t->mode=1;
+ lfh=binfile_read_lfh(f, cd->zipofst);
+ zipfn=(char *)(file_data_read(f,cd->zipofst+sizeof(struct zip_lfh), lfh->zipfnln));
+ strncpy(buffer, zipfn, lfh->zipfnln);
+ buffer[lfh->zipfnln]='\0';
+ t->start=(int *)binfile_read_content(f, cd->zipofst, lfh);
+ t->end=t->start+lfh->zipuncmp/4;
+ dbg(1,"0x%x '%s' %d %d,%d\n", lfh->ziplocsig, buffer, sizeof(*cd)+cd->zipcfnl, lfh->zipsize, lfh->zipuncmp);
+ file_data_free(f, (unsigned char *)zipfn);
+ file_data_free(f, (unsigned char *)lfh);
+ return t->start != NULL;
+}
+
+static void
+push_zipfile_tile(struct map_rect_priv *mr, int zipfile)
+{
+ struct map_priv *m=mr->m;
+ struct file *f=m->fi;
+ struct tile t;
+ struct zip_cd *cd=(struct zip_cd *)(file_data_read(f, m->eoc->zipeofst + zipfile*m->cde_size, sizeof(struct zip_cd)));
+ cd_to_cpu(cd);
+ dbg(1,"enter %p %d\n", mr, zipfile);
+#ifdef DEBUG_SIZE
+ mr->size+=cd->zipcunc;
+#endif
+ t.zipfile_num=zipfile;
+ if (zipfile_to_tile(f, cd, &t))
+ push_tile(mr, &t);
+ file_data_free(f, (unsigned char *)cd);
+}
+
+static struct map_rect_priv *
+map_rect_new_binfile(struct map_priv *map, struct map_selection *sel)
+{
+ struct map_rect_priv *mr;
+ struct tile t={};
+
+ binfile_check_version(map);
+ dbg(1,"map_rect_new_binfile\n");
+ mr=g_new0(struct map_rect_priv, 1);
+ mr->m=map;
+ mr->sel=sel;
+ mr->item.id_hi=0;
+ mr->item.id_lo=0;
+ dbg(1,"zip_members=%d\n", map->zip_members);
+ if (map->eoc)
+ push_zipfile_tile(mr, map->zip_members-1);
+ else {
+ unsigned char *d=file_data_read(map->fi, 0, map->fi->size);
+ t.start=(int *)d;
+ t.end=(int *)(d+map->fi->size);
+ t.zipfile_num=0;
+ t.mode=0;
+ push_tile(mr, &t);
+ }
+ mr->item.meth=&methods_binfile;
+ mr->item.priv_data=mr;
+ return mr;
+}
+
+static void
+write_changes_do(gpointer key, gpointer value, gpointer user_data)
+{
+ struct binfile_hash_entry *entry=key;
+ FILE *out=user_data;
+ if (entry->flags) {
+ entry->flags=0;
+ fwrite(entry, sizeof(*entry)+(le32_to_cpu(entry->data[0])+1)*4, 1, out);
+ dbg(0,"yes\n");
+ }
+}
+
+static void
+write_changes(struct map_priv *m)
+{
+ FILE *changes;
+ char *changes_file;
+ if (!m->changes)
+ return;
+ changes_file=g_strdup_printf("%s.log",m->filename);
+ changes=fopen(changes_file,"ab");
+ g_hash_table_foreach(m->changes, write_changes_do, changes);
+ fclose(changes);
+ g_free(changes_file);
+}
+
+static void
+load_changes(struct map_priv *m)
+{
+ FILE *changes;
+ char *changes_file;
+ struct binfile_hash_entry entry,*e;
+ int size;
+ changes_file=g_strdup_printf("%s.log",m->filename);
+ changes=fopen(changes_file,"rb");
+ if (! changes)
+ return;
+ m->changes=g_hash_table_new_full(binfile_hash_entry_hash, binfile_hash_entry_equal, g_free, NULL);
+ while (fread(&entry, sizeof(entry), 1, changes) == 1) {
+ if (fread(&size, sizeof(size), 1, changes) != 1)
+ break;
+ e=g_malloc(sizeof(struct binfile_hash_entry)+(le32_to_cpu(size)+1)*4);
+ *e=entry;
+ e->data[0]=size;
+ if (fread(e->data+1, le32_to_cpu(size)*4, 1, changes) != 1)
+ break;
+ g_hash_table_replace(m->changes, e, e);
+ }
+ fclose(changes);
+ g_free(changes_file);
+}
+
+
+static void
+map_rect_destroy_binfile(struct map_rect_priv *mr)
+{
+ write_changes(mr->m);
+ while (pop_tile(mr));
+#ifdef DEBUG_SIZE
+ dbg(0,"size=%d kb\n",mr->size/1024);
+#endif
+ file_data_free(mr->m->fi, (unsigned char *)(mr->tiles[0].start));
+ g_free(mr->url);
+ g_free(mr);
+}
+
+static void
+setup_pos(struct map_rect_priv *mr)
+{
+ int size,coord_size;
+ struct tile *t=mr->t;
+ size=le32_to_cpu(t->pos[0]);
+ if (size > 1024*1024 || size < 0) {
+ dbg(0,"size=0x%x\n", size);
+#if 0
+ fprintf(stderr,"offset=%d\n", (unsigned char *)(mr->pos)-mr->m->f->begin);
+#endif
+ dbg(0,"size error");
+ }
+ t->pos_next=t->pos+size+1;
+ mr->item.type=le32_to_cpu(t->pos[1]);
+ coord_size=le32_to_cpu(t->pos[2]);
+ t->pos_coord_start=t->pos+3;
+ t->pos_attr_start=t->pos_coord_start+coord_size;
+}
+
+static int
+selection_contains(struct map_selection *sel, struct coord_rect *r, struct range *mima)
+{
+ int order;
+ if (! sel)
+ return 1;
+ while (sel) {
+ if (coord_rect_overlap(r, &sel->u.c_rect)) {
+ order=sel->order;
+ dbg(1,"min %d max %d order %d\n", mima->min, mima->max, order);
+ if (!mima->min && !mima->max)
+ return 1;
+ if (order >= mima->min && order <= mima->max)
+ return 1;
+ }
+ sel=sel->next;
+ }
+ return 0;
+}
+
+static void
+map_parse_country_binfile(struct map_rect_priv *mr)
+{
+ struct attr at;
+ if (binfile_attr_get(mr->item.priv_data, attr_country_id, &at)) {
+ if (at.u.num == mr->country_id)
+ {
+ if (binfile_attr_get(mr->item.priv_data, attr_zipfile_ref, &at))
+ {
+ push_zipfile_tile(mr, at.u.num);
+ }
+ }
+ }
+}
+
+static void
+map_parse_submap(struct map_rect_priv *mr)
+{
+ struct coord_rect r;
+ struct coord c[2];
+ struct attr at;
+ if (binfile_coord_get(mr->item.priv_data, c, 2) != 2)
+ return;
+ r.lu.x=c[0].x;
+ r.lu.y=c[1].y;
+ r.rl.x=c[1].x;
+ r.rl.y=c[0].y;
+ if (!binfile_attr_get(mr->item.priv_data, attr_order, &at))
+ return;
+ if (!mr->m->eoc || !selection_contains(mr->sel, &r, &at.u.range))
+ return;
+ if (!binfile_attr_get(mr->item.priv_data, attr_zipfile_ref, &at))
+ return;
+ dbg(1,"pushing zipfile %d from %d\n", at.u.num, mr->t->zipfile_num);
+ push_zipfile_tile(mr, at.u.num);
+}
+
+static int
+push_modified_item(struct map_rect_priv *mr)
+{
+ struct item_id id;
+ struct binfile_hash_entry *entry;
+ id.id_hi=mr->item.id_hi;
+ id.id_lo=mr->item.id_lo;
+ entry=g_hash_table_lookup(mr->m->changes, &id);
+ if (entry) {
+ struct tile tn;
+ tn.pos_next=tn.pos=tn.start=entry->data;
+ tn.zipfile_num=mr->item.id_hi;
+ tn.mode=2;
+ tn.end=tn.start+le32_to_cpu(entry->data[0])+1;
+ push_tile(mr, &tn);
+ return 1;
+ }
+ return 0;
+}
+
+static struct item *
+map_rect_get_item_binfile(struct map_rect_priv *mr)
+{
+ struct tile *t;
+ for (;;) {
+ t=mr->t;
+ if (! t)
+ return NULL;
+ t->pos=t->pos_next;
+ if (t->pos >= t->end) {
+ if (pop_tile(mr))
+ continue;
+ return NULL;
+ }
+ setup_pos(mr);
+ binfile_coord_rewind(mr);
+ binfile_attr_rewind(mr);
+ if ((mr->item.type == type_submap) && (!mr->country_id)) {
+ map_parse_submap(mr);
+ continue;
+ }
+ if (t->mode != 2) {
+ mr->item.id_hi=t->zipfile_num;
+ mr->item.id_lo=t->pos-t->start;
+ if (mr->m->changes && push_modified_item(mr))
+ continue;
+ }
+ if (mr->country_id)
+ {
+ if (mr->item.type == type_countryindex) {
+ map_parse_country_binfile(mr);
+ }
+ if (item_is_town(mr->item))
+ {
+ return &mr->item;
+ } else {
+ continue;
+ }
+ }
+ return &mr->item;
+ }
+}
+
+static struct item *
+map_rect_get_item_byid_binfile(struct map_rect_priv *mr, int id_hi, int id_lo)
+{
+ struct tile *t;
+ if (mr->m->eoc)
+ push_zipfile_tile(mr, id_hi);
+ t=mr->t;
+ t->pos=t->start+id_lo;
+ mr->item.id_hi=id_hi;
+ mr->item.id_lo=id_lo;
+ if (mr->m->changes)
+ push_modified_item(mr);
+ setup_pos(mr);
+ binfile_coord_rewind(mr);
+ binfile_attr_rewind(mr);
+ return &mr->item;
+}
+
+static struct map_search_priv *
+binmap_search_new(struct map_priv *map, struct item *item, struct attr *search, int partial)
+{
+ struct map_rect_priv *map_rec;
+ struct map_search_priv *msp;
+ struct map_selection *ms;
+ struct item *town;
+
+ /*
+ * NOTE: If you implement search for other attributes than attr_town_name and attr_street_name,
+ * please update this comment and the documentation for map_search_new() in map.c
+ */
+ switch (search->type) {
+ case attr_country_name:
+ break;
+ case attr_town_name:
+ case attr_town_or_district_name:
+ msp = g_new(struct map_search_priv, 1);
+ msp->search_results = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
+ map_rec = map_rect_new_binfile(map, NULL);
+ map_rec->country_id = item->id_lo;
+ msp->mr = map_rec;
+ msp->search = search;
+ msp->partial = partial;
+ return msp;
+ break;
+ case attr_town_postal:
+ break;
+ case attr_street_name:
+ if (! item->map)
+ break;
+ if (!map_priv_is(item->map, map))
+ break;
+ ms = g_new(struct map_selection, 1);
+ ms->next = NULL;
+ ms->range = item_range_all; /* FIXME */
+ ms->order = 18;
+ map_rec = map_rect_new_binfile(map, ms);
+ town = map_rect_get_item_byid_binfile(map_rec, item->id_hi, item->id_lo);
+ if (town) {
+ struct map_search_priv *msp = g_new(struct map_search_priv, 1);
+ struct coord *c = g_new(struct coord, 1);
+ int size = 10000;
+ switch (town->type) {
+ case type_town_label_2e5:
+ size = 10000;
+ break;
+ case type_town_label_2e4:
+ size = 5000;
+ break;
+ case type_town_label_2e3:
+ size = 2500;
+ break;
+ case type_town_label_2e2:
+ size = 1000;
+ break;
+ default:
+ break;
+ }
+ item_coord_get(town, c, 1);
+ ms->u.c_rect.lu.x = c->x-size;
+ ms->u.c_rect.lu.y = c->y+size;
+ ms->u.c_rect.rl.x = c->x+size;
+ ms->u.c_rect.rl.y = c->y-size;
+
+ map_rect_destroy_binfile(map_rec);
+ map_rec = map_rect_new_binfile(map, ms);
+ msp->mr = map_rec;
+ msp->search = search;
+ msp->partial = partial;
+ msp->search_results = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
+ return msp;
+ }
+ map_rect_destroy_binfile(map_rec);
+ g_free(ms);
+ break;
+ default:
+ break;
+ }
+ return NULL;
+}
+static int
+ascii_cmp(char *name, char *match, int partial)
+{
+ if (partial)
+ return g_ascii_strncasecmp(name, match, strlen(match));
+ else
+ return g_ascii_strcasecmp(name, match);
+}
+
+static struct item *
+binmap_search_get_item(struct map_search_priv *map_search)
+{
+ struct item* it;
+ while ((it = map_rect_get_item_binfile(map_search->mr))) {
+ switch (map_search->search->type) {
+ case attr_town_name:
+ case attr_district_name:
+ case attr_town_or_district_name:
+ if (item_is_town(*it) && map_search->search->type != attr_district_name) {
+ struct attr at;
+ if (binfile_attr_get(it->priv_data, attr_town_name_match, &at) || binfile_attr_get(it->priv_data, attr_town_name, &at)) {
+ if (!ascii_cmp(at.u.str, map_search->search->u.str, map_search->partial)) {
+ return it;
+ }
+ }
+ }
+ if (item_is_district(*it) && map_search->search->type != attr_town_name) {
+ struct attr at;
+ if (binfile_attr_get(it->priv_data, attr_district_name_match, &at) || binfile_attr_get(it->priv_data, attr_district_name, &at)) {
+ if (!ascii_cmp(at.u.str, map_search->search->u.str, map_search->partial)) {
+ return it;
+ }
+ }
+ }
+ break;
+ case attr_street_name:
+ if ((it->type == type_street_3_city) || (it->type == type_street_2_city) || (it->type == type_street_1_city)) {
+ struct attr at;
+ if (map_selection_contains_item_rect(map_search->mr->sel, it) && binfile_attr_get(it->priv_data, attr_label, &at)) {
+ int i,match=0;
+ char *str=g_strdup(at.u.str);
+ char *word=str;
+ do {
+ for (i = 0 ; i < 3 ; i++) {
+ char *name=linguistics_expand_special(word,i);
+ if (name && !ascii_cmp(name, map_search->search->u.str, map_search->partial))
+ match=1;
+ g_free(name);
+ if (match)
+ break;
+ }
+ if (match)
+ break;
+ word=linguistics_next_word(word);
+ } while (word);
+ g_free(str);
+ if (match && !g_hash_table_lookup(map_search->search_results, at.u.str)) {
+ item_coord_rewind(it);
+ item_attr_rewind(it);
+ g_hash_table_insert(map_search->search_results, g_strdup(at.u.str), "");
+ return it;
+ }
+ }
+ }
+ break;
+ default:
+ return NULL;
+ }
+ }
+ return NULL;
+}
+
+static void
+binmap_search_destroy(struct map_search_priv *ms)
+{
+ g_hash_table_destroy(ms->search_results);
+ g_free(ms->mr->sel);
+ map_rect_destroy_binfile(ms->mr);
+ g_free(ms);
+}
+
+static struct map_methods map_methods_binfile = {
+ projection_mg,
+ "utf-8",
+ map_destroy_binfile,
+ map_rect_new_binfile,
+ map_rect_destroy_binfile,
+ map_rect_get_item_binfile,
+ map_rect_get_item_byid_binfile,
+ binmap_search_new,
+ binmap_search_destroy,
+ binmap_search_get_item
+};
+
+static int
+binfile_get_index(struct map_priv *m)
+{
+ int len;
+ int cde_index_size;
+ int offset;
+ struct zip_cd *cd;
+
+ len = strlen("index");
+ cde_index_size = sizeof(struct zip_cd)+len;
+ offset = m->eoc->zipecsz-cde_index_size;
+ cd = binfile_read_cd(m, offset, len);
+
+ if (cd) {
+ if (cd->zipcfnl == len && !strncmp(cd->zipcfn, "index", len)) {
+ m->index_offset=offset;
+ m->index_cd=cd;
+ return 1;
+ }
+ }
+ offset=binfile_search_cd(m, 0, "index", 0, 0);
+ if (offset == -1)
+ return 0;
+ cd=binfile_read_cd(m, offset, len);
+ if (!cd)
+ return 0;
+ m->index_offset=offset;
+ m->index_cd=cd;
+ return 1;
+}
+
+static int
+map_binfile_open(struct map_priv *m)
+{
+ int *magic;
+ struct zip_cd *first_cd;
+ struct map_rect_priv *mr;
+ struct item *item;
+ struct attr attr;
+
+ dbg(1,"file_create %s\n", m->filename);
+ m->fi=file_create(m->filename);
+ if (! m->fi) {
+ dbg(0,"Failed to load '%s'\n", m->filename);
+ return 0;
+ }
+ if (m->check_version)
+ m->version=file_version(m->fi, m->check_version == 2);
+ magic=(int *)file_data_read(m->fi, 0, 4);
+ *magic = le32_to_cpu(*magic);
+ if (*magic == zip_lfh_sig) {
+ if ((m->eoc=binfile_read_eoc(m->fi)) && binfile_get_index(m) && (first_cd=binfile_read_cd(m, 0, 0))) {
+ m->cde_size=sizeof(struct zip_cd)+first_cd->zipcfnl;
+ m->zip_members=m->index_offset/m->cde_size+1;
+ dbg(1,"cde_size %d\n", m->cde_size);
+ dbg(1,"members %d\n",m->zip_members);
+ file_data_free(m->fi, (unsigned char *)first_cd);
+ } else {
+ dbg(0,"invalid file format for '%s'\n", m->filename);
+ return 0;
+ }
+ } else
+ file_mmap(m->fi);
+ file_data_free(m->fi, (unsigned char *)magic);
+ m->cachedir="/tmp/navit";
+ m->map_version=0;
+ mr=map_rect_new_binfile(m, NULL);
+ if (mr) {
+ item=map_rect_get_item_binfile(mr);
+ if (item && item->type == type_map_information)
+ if (binfile_attr_get(item->priv_data, attr_version, &attr))
+ m->map_version=attr.u.num;
+ map_rect_destroy_binfile(mr);
+ if (m->map_version >= 16) {
+ dbg(0,"Warning: This map is incompatible with your navit version. Please update navit.\n");
+ return 0;
+ }
+ }
+ return 1;
+}
+
+static void
+map_binfile_close(struct map_priv *m)
+{
+ file_data_free(m->fi, (unsigned char *)m->index_cd);
+ file_data_free(m->fi, (unsigned char *)m->eoc);
+ file_destroy(m->fi);
+}
+
+static void
+map_binfile_destroy(struct map_priv *m)
+{
+ g_free(m->filename);
+ g_free(m);
+}
+
+
+static void
+binfile_check_version(struct map_priv *m)
+{
+ int version;
+ if (!m->check_version)
+ return;
+ version=file_version(m->fi, m->check_version == 2);
+ if (version != m->version) {
+ map_binfile_close(m);
+ map_binfile_open(m);
+ }
+}
+
+
+static struct map_priv *
+map_new_binfile(struct map_methods *meth, struct attr **attrs)
+{
+ struct map_priv *m;
+ struct attr *data=attr_search(attrs, NULL, attr_data);
+ struct attr *check_version;
+ struct file_wordexp *wexp;
+ char **wexp_data;
+ if (! data)
+ return NULL;
+
+ wexp=file_wordexp_new(data->u.str);
+ wexp_data=file_wordexp_get_array(wexp);
+ dbg(1,"map_new_binfile %s\n", data->u.str);
+ *meth=map_methods_binfile;
+
+ m=g_new0(struct map_priv, 1);
+ m->id=++map_id;
+ m->filename=g_strdup(wexp_data[0]);
+ file_wordexp_destroy(wexp);
+ check_version=attr_search(attrs, NULL, attr_check_version);
+ if (check_version)
+ m->check_version=check_version->u.num;
+ if (!map_binfile_open(m)) {
+ map_binfile_destroy(m);
+ m=NULL;
+ } else {
+ load_changes(m);
+ }
+ return m;
+}
+
+void
+plugin_init(void)
+{
+ dbg(1,"binfile: plugin_init\n");
+ plugin_register_map_type("binfile", map_new_binfile);
+}
+
diff --git a/map/garmin/Makefile.am b/map/garmin/Makefile.am
new file mode 100644
index 00000000..be15a148
--- /dev/null
+++ b/map/garmin/Makefile.am
@@ -0,0 +1,33 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=map_garmin
+AM_CPPFLAGS+= @LIBGARMIN_CFLAGS@
+INCLUDES=-I$(top_srcdir)/navit/map/garmin/libgarmin
+AM_CPPFLAGS+=-I$(top_srcdir)/navit/map/garmin/libgarmin
+AM_CPPFLAGS+=-I$(srcdir)
+
+modulemap_LTLIBRARIES = libmap_garmin.la
+libmap_garmin_la_SOURCES = garmin.c garmin.h gar2navit.c gar2navit.h
+libmap_garmin_la_LIBADD = @LIBGARMIN_LIBS@
+libmap_garmin_la_LDFLAGS = -module -avoid-version
+nodist_libmap_garmin_la_SOURCES = g2nbuiltin.h
+builddir = @builddir@
+
+gar2navit.l$(OBJEXT): g2nbuiltin.h
+
+CLEANFILES = g2nbuiltin.h
+
+noinst_PROGRAMS=gentypes$(EXEEXT)
+gentypes_SOURCES=gentypes.c
+
+gentypes.$(OBJEXT): gentypes.c
+ $(CC_FOR_BUILD) -I$(top_srcdir)/navit -c -o $@ $<
+
+gentypes$(EXEEXT): $(gentypes_OBJECTS) $(gentypes_DEPENDENCIES)
+ @rm -f gentypes$(EXEEXT)
+ $(CCLD_FOR_BUILD) -o $@ $(gentypes_OBJECTS)
+
+g2nbuiltin.h: gentypes$(EXEEXT) garmintypes.txt
+ ./gentypes$(EXEEXT) $(top_srcdir)/navit/map/garmin/garmintypes.txt $@
+
+EXTRA_DIST = garmintypes.txt
+
diff --git a/map/garmin/gar2navit.c b/map/garmin/gar2navit.c
new file mode 100644
index 00000000..7c445040
--- /dev/null
+++ b/map/garmin/gar2navit.c
@@ -0,0 +1,219 @@
+/*
+ Copyright (C) 2007 Alexander Atanasov <aatanasov@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; version 2 of the License.
+
+ 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, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301 USA
+
+ Garmin and MapSource are registered trademarks or trademarks
+ of Garmin Ltd. or one of its subsidiaries.
+
+*/
+
+/*
+File format is:
+
+POINT
+GROUP,0x0100 = town_label_1e5, Megapolis (10M +)
+GROUP,0x0200 = town_label_5e4, Megapolis (5-10M)
+...
+GROUP,0x1e00-0x1e3f = district_label, District, Province, State Name
+...
+POLYLINE
+GROUP,0x00 = ALL, street_1_land, Road
+GROUP,0x01 = MCTL, highway_land, Major HWY thick
+GROUP,0x02 = MCTL, street_4_land, Principal HWY-thick
+GROUP,0x03 = MCTL, street_2_land, Principal HWY-medium
+....
+POLYGONE
+GROUP,0x01 = town_poly, City (>200k)
+GROUP,0x02 = town_poly, City (<200k)
+GROUP,0x03 = town_poly, Village
+
+GROUP is
+0 - RGN1
+1 - RGN2-4
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <malloc.h>
+#include "item.h"
+#include "attr.h"
+#include "garmin.h"
+#include "gar2navit.h"
+
+static int add_def(struct gar2nav_conv *conv, int type, unsigned short minid,
+ unsigned short maxid, unsigned int group, char *ntype,
+ char *descr)
+{
+ enum item_type it;
+ struct gar2navit *g2n;
+ dlog(11, "group=%d type=%d routable=%u min=%04X max=%04X ntype=%s descr=%s\n",
+ group, type, minid, maxid, ntype, descr);
+ it = item_from_name(ntype);
+ if (it==type_none) {
+ dlog(1, "Please define: %s\n", ntype);
+ }
+ g2n = calloc(1, sizeof(*g2n));
+ if (!g2n)
+ return -1;
+ g2n->id = minid;
+ g2n->maxid = maxid;
+ g2n->ntype = it;
+ g2n->descr = strdup(descr);
+ g2n->group = group;
+ if (type == 1) {
+ g2n->next = conv->points;
+ conv->points = g2n;
+ } else if (type == 2) {
+ g2n->next = conv->polylines;
+ conv->polylines = g2n;
+ } else if (type == 3) {
+ g2n->next = conv->polygons;
+ conv->polygons = g2n;
+ }
+ return 0;
+}
+
+static int load_types_file(char *file, struct gar2nav_conv *conv)
+{
+ char buf[4096];
+ char descr[4096];
+ char ntype[4096];
+ FILE *fp;
+ unsigned int minid, maxid, group;
+ int rc;
+ int type = -1;
+
+ fp = fopen(file, "r");
+ if (!fp)
+ return -1;
+ while (fgets(buf, sizeof(buf), fp)) {
+ if (*buf == '#' || *buf == '\n')
+ continue;
+ if (!strncasecmp(buf, "POINT", 5)) {
+ type = 1;
+ continue;
+ } else if (!strncasecmp(buf, "POI", 3)) {
+ type = 1;
+ continue;
+ } else if (!strncasecmp(buf, "POLYLINE", 8)) {
+ type = 2;
+ continue;
+ } else if (!strncasecmp(buf, "POLYGONE", 8)) {
+ type = 3;
+ continue;
+ }
+ // assume only lines are routable
+ rc = sscanf(buf, "%d, 0x%04X - 0x%04X = %[^\t , ] , %[^\n]",
+ &group, &minid, &maxid, ntype, descr);
+ if (rc != 5) {
+ maxid = 0;
+ rc = sscanf(buf, "%d,0x%04X = %[^\t, ], %[^\n]",
+ &group, &minid, ntype, descr);
+ if (rc != 4) {
+ dlog(1, "Invalid line rc=%d:[%s]\n",rc, buf);
+ dlog(1, "minid=%04X ntype=[%s] des=[%s]\n",
+ minid, ntype, descr);
+ continue;
+ }
+ }
+ add_def(conv, type, minid, maxid, group, ntype, descr);
+ }
+ fclose(fp);
+ return 1;
+}
+
+struct gar2nav_conv *g2n_conv_load(char *file)
+{
+ struct gar2nav_conv *c;
+ int rc;
+
+ c = calloc(1, sizeof(*c));
+ if (!c)
+ return c;
+ rc = load_types_file(file, c);
+ if (rc < 0) {
+ dlog(1, "Failed to load: [%s]\n", file);
+ free(c);
+ return NULL;
+ }
+ return c;
+}
+
+enum item_type g2n_get_type(struct gar2nav_conv *c, unsigned int type, unsigned short id)
+{
+ struct gar2navit *def = NULL;
+ int group;
+ group = (type >> G2N_KIND_SHIFT);
+ type &= ~G2N_KIND_MASK;
+ if (type == G2N_POINT)
+ def = c->points;
+ else if (type == G2N_POLYLINE)
+ def = c->polylines;
+ else if (type == G2N_POLYGONE)
+ def = c->polygons;
+ else {
+ dlog(1, "Unknown conversion type:%d\n", type);
+ return type_none;
+ }
+
+ if (!def) {
+ dlog(5, "No conversion data for %d\n", type);
+ return type_none;
+ }
+
+ while (def) {
+ if (def->group == group &&
+ ((!def->maxid && def->id == id) ||
+ (def->id <= id && id <= def->maxid)))
+ return def->ntype;
+ def = def->next;
+ }
+ dlog(5, "Type[%d]:ID:[%04X] unknown\n", type, id);
+ return type == G2N_POINT ? type_point_unkn : type_street_unkn;
+}
+
+char *g2n_get_descr(struct gar2nav_conv *c, int type, unsigned short id)
+{
+ struct gar2navit *def = NULL;
+ if (type == G2N_POINT)
+ def = c->points;
+ else if (type == G2N_POLYLINE)
+ def = c->polylines;
+ else if (type == G2N_POLYGONE)
+ def = c->polygons;
+ else {
+ dlog(1, "Unknown conversion type:%d\n", type);
+ return NULL;
+ }
+ while (def) {
+ if ((!def->maxid && def->id == id) ||
+ (def->id <= id && id <= def->maxid))
+ return def->descr;
+ def = def->next;
+ }
+ dlog(5, "Type[%d]:ID:[%04X] unknown\n", type, id);
+ return NULL;
+}
+
+#if 0
+int main(int argc, char **argv)
+{
+ load_types_file(argv[1], NULL);
+ return 0;
+}
+#endif
+
+#include "g2nbuiltin.h"
diff --git a/map/garmin/gar2navit.h b/map/garmin/gar2navit.h
new file mode 100644
index 00000000..27c5f65e
--- /dev/null
+++ b/map/garmin/gar2navit.h
@@ -0,0 +1,52 @@
+/*
+ Copyright (C) 2007 Alexander Atanasov <aatanasov@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; version 2 of the License.
+
+ 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, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301 USA
+
+ Garmin and MapSource are registered trademarks or trademarks
+ of Garmin Ltd. or one of its subsidiaries.
+
+*/
+
+#define GROUP_RGN1 0
+#define GROUP_RGN2 1
+
+struct gar2navit {
+ unsigned short id;
+ unsigned short maxid;
+ enum item_type ntype;
+ unsigned group;
+ char *descr;
+ struct gar2navit *next;
+};
+
+#define G2N_POINT 1
+#define G2N_POLYLINE 2
+#define G2N_POLYGONE 3
+#define G2N_KIND_MASK 0xF0000000
+#define G2N_KIND_SHIFT 28
+#define G2N_RGN1 (GROUP_RGN1<<29)
+#define G2N_RGN2 (GROUP_RGN2<<29)
+
+struct gar2nav_conv {
+ struct gar2navit *points;
+ struct gar2navit *polylines;
+ struct gar2navit *polygons;
+};
+
+struct gar2nav_conv *g2n_conv_load(char *file);
+enum item_type g2n_get_type(struct gar2nav_conv *c, unsigned int type, unsigned short id);
+char *g2n_get_descr(struct gar2nav_conv *c, int type, unsigned short id);
+struct gar2nav_conv *g2n_default_conv(void);
diff --git a/map/garmin/garmin.c b/map/garmin/garmin.c
new file mode 100644
index 00000000..da0f5804
--- /dev/null
+++ b/map/garmin/garmin.c
@@ -0,0 +1,997 @@
+/*
+ Copyright (C) 2007 Alexander Atanasov <aatanasov@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; version 2 of the License.
+
+ 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, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301 USA
+
+ Garmin and MapSource are registered trademarks or trademarks
+ of Garmin Ltd. or one of its subsidiaries.
+
+*/
+
+#include <glib.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include "config.h"
+#include "plugin.h"
+#include "data.h"
+#include "projection.h"
+#include "item.h"
+#include "debug.h"
+#include "map.h"
+#include "maptype.h"
+#include "attr.h"
+#include "coord.h"
+#include "transform.h"
+#include <stdio.h>
+#include "attr.h"
+#include "coord.h"
+#include <libgarmin.h>
+#include "garmin.h"
+#include "gar2navit.h"
+
+
+static int map_id;
+
+struct map_priv {
+ int id;
+ char *filename;
+ struct gar2nav_conv *conv;
+ struct gar *g;
+};
+
+struct map_rect_priv {
+ int id;
+ struct coord_rect r;
+ char *label; // FIXME: Register all strings for searches
+ int limit;
+ struct map_priv *mpriv;
+ struct gmap *gmap;
+ struct gobject *cobj;
+ struct gobject *objs;
+ struct item item;
+ unsigned int last_coord;
+ void *last_itterated;
+ struct coord last_c;
+ void *last_oattr;
+ unsigned int last_attr;
+ struct gar_search *search;
+};
+
+int garmin_debug = 10;
+
+void
+logfn(char *file, int line, int level, char *fmt, ...)
+{
+ va_list ap;
+ char fileline[256];
+ int sz;
+ if (level > garmin_debug)
+ return;
+ va_start(ap, fmt);
+ sz = sprintf(fileline, "%s:%d:%d|", file, line, level);
+ debug_vprintf(0, "", strlen(""), fileline, sz,
+ 1, fmt, ap);
+ va_end(ap);
+}
+// need a base map and a map
+struct gscale {
+ char *label;
+ float scale;
+ int bits;
+};
+
+static struct gscale mapscales[] = {
+ {"7000 km", 70000.0, 8}
+ ,{"5000 km", 50000.0, 8}
+ ,{"3000 km", 30000.0, 9}
+ ,{"2000 km", 20000.0, 9}
+ ,{"1500 km", 15000.0, 10}
+ ,{"1000 km", 10000.0, 10}
+ ,{"700 km", 7000.0, 11}
+ ,{"500 km", 5000.0, 11}
+ ,{"300 km", 3000.0, 13}
+ ,{"200 km", 2000.0, 13}
+ ,{"150 km", 1500.0, 13}
+ ,{"100 km", 1000.0, 14}
+ ,{"70 km", 700.0, 15}
+ ,{"50 km", 500.0, 16}
+ ,{"30 km", 300.0, 16}
+ ,{"20 km", 200.0, 17}
+ ,{"15 km", 150.0, 17}
+ ,{"10 km", 100.0, 18}
+ ,{"7 km", 70.0, 18}
+ ,{"5 km", 50.0, 19}
+ ,{"3 km", 30.0, 19}
+ ,{"2 km", 20.0, 20}
+ ,{"1.5 km", 15.0, 22}
+ ,{"1 km", 10.0, 24}
+ ,{"700 m", 7.0, 24}
+ ,{"500 m", 5.0, 24}
+ ,{"300 m", 3.0, 24}
+ ,{"200 m", 2.0, 24}
+ ,{"150 m", 1.5, 24}
+ ,{"100 m", 1.0, 24}
+ ,{"70 m", 0.7, 24}
+ ,{"50 m", 0.5, 24}
+ ,{"30 m", 0.3, 24}
+ ,{"20 m", 0.2, 24}
+ ,{"15 m", 0.1, 24}
+ ,{"10 m", 0.15, 24}
+};
+
+
+static int
+garmin_object_label(struct gobject *o, struct attr *attr)
+{
+ struct map_rect_priv *mr = o->priv_data;
+ char *codepage;
+ char *label;
+ if (!mr) {
+ dlog(1, "Error object do not have priv_data!!\n");
+ return 0;
+ }
+ if (mr->label) {
+ free(mr->label);
+ }
+ label = gar_get_object_lbl(o);
+ if (label) {
+ codepage = gar_obj_codepage(o);
+ if (*codepage != 'a') {
+ mr->label = g_convert(label, -1,"utf-8",codepage,NULL,NULL,NULL);
+ free(label);
+ } else
+ mr->label = label;
+ } else {
+ mr->label = NULL;
+ return 0;
+ }
+ if (mr->label) {
+ char *cp = mr->label;
+#warning FIXME Process label and give only the visible part
+ if (*mr->label == '@' || *mr->label == '^')
+ cp++;
+ /* FIXME: If zoomlevel is high convert ^ in the string to spaces */
+ attr->u.str = cp;
+ return 1;
+ }
+ return 0;
+}
+
+static int
+garmin_object_debug(struct gobject *o, struct attr *attr)
+{
+ struct map_rect_priv *mr = o->priv_data;
+ if (!mr) {
+ dlog(1, "Error object do not have priv_data!!\n");
+ return 0;
+ }
+ if (mr->label)
+ free(mr->label);
+ mr->label = gar_object_debug_str(o);
+ if (mr->label) {
+ attr->u.str = mr->label;
+ return 1;
+ }
+ return 0;
+}
+
+
+static struct map_search_priv *
+gmap_search_new(struct map_priv *map, struct item *item, struct attr *search, int partial)
+{
+ struct map_rect_priv *mr=g_new0(struct map_rect_priv, 1);
+ struct gar_search *gs;
+ int rc;
+
+ dlog(1, "Called!\n");
+ mr->mpriv=map;
+ gs = g_new0(struct gar_search,1);
+ if (!gs) {
+ dlog(1, "Can not init search \n");
+ free(mr);
+ return NULL;
+ }
+ mr->search = gs;
+ switch (search->type) {
+ case attr_country_name:
+ gs->type = GS_COUNTRY;
+ break;
+ case attr_town_name:
+ gs->type = GS_CITY;
+ break;
+ case attr_town_postal:
+ gs->type = GS_ZIP;
+ break;
+ case attr_street_name:
+ gs->type = GS_ROAD;
+ break;
+#if someday
+ case attr_region_name:
+ case attr_intersection:
+ case attr_housenumber:
+#endif
+ default:
+ dlog(1, "Don't know how to search for %d\n", search->type);
+ goto out_err;
+ }
+ gs->match = partial ? GM_START : GM_EXACT;
+ gs->needle = strdup(search->u.str);
+ dlog(5, "Needle: %s\n", gs->needle);
+
+ mr->gmap = gar_find_subfiles(mr->mpriv->g, gs, GO_GET_SEARCH);
+ if (!mr->gmap) {
+ dlog(1, "Can not init search \n");
+ goto out_err;
+ }
+ rc = gar_get_objects(mr->gmap, 0, gs, &mr->objs, GO_GET_SEARCH);
+ if (rc < 0) {
+ dlog(1, "Error loading objects\n");
+ goto out_err;
+ }
+ mr->cobj = mr->objs;
+ dlog(4, "Loaded %d objects\n", rc);
+ return (struct map_search_priv *)mr;
+
+out_err:
+ free(gs);
+ free(mr);
+ return NULL;
+}
+
+/* Assumes that only one item will be itterated at time! */
+static void
+coord_rewind(void *priv_data)
+{
+ struct gobject *g = priv_data;
+ struct map_rect_priv *mr = g->priv_data;
+ mr->last_coord = 0;
+};
+
+static void
+attr_rewind(void *priv_data)
+{
+ struct gobject *g = priv_data;
+ struct map_rect_priv *mr = g->priv_data;
+ mr->last_attr = 0;
+};
+
+static int
+point_coord_get(void *priv_data, struct coord *c, int count)
+{
+ struct gobject *g = priv_data;
+ struct map_rect_priv *mr = g->priv_data;
+ struct gcoord gc;
+ if (!count)
+ return 0;
+ if (g != mr->last_itterated) {
+ mr->last_itterated = g;
+ mr->last_coord = 0;
+ }
+
+ if (mr->last_coord > 0)
+ return 0;
+
+ gar_get_object_coord(mr->gmap, g, &gc);
+ c->x = gc.x;
+ c->y = gc.y;
+ mr->last_coord++;
+// dlog(1,"point: x=%d y=%d\n", c->x, c->y);
+ // dlog(1, "point: x=%f y=%f\n", GARDEG(c->x), GARDEG(c->y));
+ return 1;
+}
+
+static int
+coord_is_node(void *priv_data)
+{
+ struct gobject *g = priv_data;
+ struct map_rect_priv *mr = g->priv_data;
+
+ return gar_is_object_dcoord_node(mr->gmap, g, mr->last_coord);
+}
+
+static int
+poly_coord_get(void *priv_data, struct coord *c, int count)
+{
+ struct gobject *g = priv_data;
+ struct map_rect_priv *mr = g->priv_data;
+ int ndeltas = 0, total = 0;
+ struct gcoord dc;
+
+ if (!count)
+ return 0;
+
+ if (g != mr->last_itterated) {
+ mr->last_itterated = g;
+ mr->last_coord = 0;
+ }
+ ndeltas = gar_get_object_deltas(g);
+ if (mr->last_coord > ndeltas + 1)
+ return 0;
+ while (count --) {
+ if (mr->last_coord == 0) {
+ gar_get_object_coord(mr->gmap, g, &dc);
+ mr->last_c.x = dc.x;
+ mr->last_c.y = dc.y;
+ } else {
+ if (!gar_get_object_dcoord(mr->gmap, g, mr->last_coord - 1, &dc)) {
+ mr->last_coord = ndeltas + 2;
+ return total;
+ }
+ mr->last_c.x += dc.x;
+ mr->last_c.y += dc.y;
+ }
+ c->x = mr->last_c.x;
+ c->y = mr->last_c.y;
+ ddlog(1, "poly: x=%f y=%f\n", GARDEG(c->x), GARDEG(c->y));
+// dlog(1,"poly: x=%d y=%d\n", c->x, c->y);
+ c++;
+ total++;
+ mr->last_coord ++;
+ }
+ return total;
+}
+
+// for _any we must return one by one
+static int
+point_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
+{
+ struct gobject *g = priv_data;
+ struct map_rect_priv *mr = g->priv_data;
+ int rc;
+ switch (attr_type) {
+ case attr_any:
+ if (g != mr->last_oattr) {
+ mr->last_oattr = g;
+ mr->last_attr = 0;
+ }
+ switch(mr->last_attr) {
+ case 0:
+ mr->last_attr++;
+ attr->type = attr_label;
+ rc = garmin_object_label(g, attr);
+ if (rc)
+ return rc;
+ case 1:
+ mr->last_attr++;
+ attr->type = attr_debug;
+ rc = garmin_object_debug(g, attr);
+ if (rc)
+ return rc;
+ case 2:
+ mr->last_attr++;
+ if (g->type == GO_POLYLINE) {
+ attr->type = attr_street_name;
+ rc = garmin_object_label(g, attr);
+ if (rc)
+ return rc;
+ }
+ case 3:
+ mr->last_attr++;
+ attr->type = attr_flags;
+ attr->u.num = 0;
+ rc = gar_object_flags(g);
+ if (rc & F_ONEWAY)
+ attr->u.num |= AF_ONEWAY;
+ if (rc & F_SEGMENTED)
+ attr->u.num |= AF_SEGMENTED;
+ return 1;
+ default:
+ return 0;
+ }
+ break;
+ case attr_label:
+ attr->type = attr_label;
+ return garmin_object_label(g, attr);
+ case attr_town_name:
+ attr->type = attr_town_name;
+ return garmin_object_label(g, attr);
+ case attr_street_name:
+ attr->type = attr_type;
+ return garmin_object_label(g, attr);
+ case attr_street_name_systematic:
+ /* TODO: Get secondary labels of roads */
+ return 0;
+ case attr_flags:
+ attr->type = attr_flags;
+ attr->u.num = 0;
+ rc = gar_object_flags(g);
+ if (rc & F_ONEWAY)
+ attr->u.num |= AF_ONEWAY;
+ if (rc & F_SEGMENTED)
+ attr->u.num |= AF_SEGMENTED;
+ return 1;
+ default:
+ dlog(1, "Dont know about attribute %d[%04X]=%s yet\n", attr_type,attr_type, attr_to_name(attr_type));
+ }
+
+ return 0;
+}
+
+static struct item_methods methods_garmin_point = {
+ coord_rewind,
+ point_coord_get,
+ attr_rewind,
+ point_attr_get,
+};
+
+static struct item_methods methods_garmin_poly = {
+ coord_rewind,
+ poly_coord_get,
+ attr_rewind, // point_attr_rewind,
+ point_attr_get, // poly_attr_get,
+ coord_is_node,
+};
+
+static int
+search_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
+{
+ struct gobject *g = priv_data;
+ struct map_rect_priv *mr = g->priv_data;
+ int rc;
+ switch (attr_type) {
+ case attr_any:
+ if (g != mr->last_oattr) {
+ mr->last_oattr = g;
+ mr->last_attr = 0;
+ }
+ switch(mr->last_attr) {
+ case 0:
+ mr->last_attr++;
+ attr->type = attr_label;
+ rc = garmin_object_label(g, attr);
+ if (rc)
+ return rc;
+ case 1:
+ mr->last_attr++;
+ attr->type = attr_debug;
+ rc = garmin_object_debug(g, attr);
+ if (rc)
+ return rc;
+ case 2:
+ mr->last_attr++;
+ if (g->type == GO_POLYLINE) {
+ attr->type = attr_street_name;
+ rc = garmin_object_label(g, attr);
+ if (rc)
+ return rc;
+ }
+ case 3:
+ mr->last_attr++;
+ attr->type = attr_flags;
+ attr->u.num = 0;
+ rc = gar_object_flags(g);
+ if (rc & F_ONEWAY)
+ attr->u.num |= AF_ONEWAY;
+ if (rc & F_SEGMENTED)
+ attr->u.num |= AF_SEGMENTED;
+ return 1;
+ default:
+ return 0;
+ }
+ break;
+ case attr_label:
+ attr->type = attr_label;
+ return garmin_object_label(g, attr);
+ case attr_town_name:
+ attr->type = attr_town_name;
+ if (mr->label)
+ free(mr->label);
+ mr->label = gar_srch_get_city(g);
+ attr->u.str = mr->label;
+ if (attr->u.str)
+ return 1;
+ return 0;
+ case attr_town_id:
+ rc = gar_srch_get_cityid(g);
+ if (rc) {
+ attr->type = attr_town_id;
+ attr->u.num = rc;
+ return 1;
+ }
+ return 0;
+ case attr_town_postal:
+ attr->type = attr_town_postal;
+ attr->u.str = gar_srch_get_zip(g);
+ if (attr->u.str)
+ return 1;
+ return 0;
+ case attr_street_name:
+ attr->type = attr_street_name;
+ if (mr->label)
+ free(mr->label);
+ mr->label = gar_srch_get_roadname(g);
+ attr->u.str = mr->label;
+ if (attr->u.str)
+ return 1;
+ return 0;
+ case attr_street_id:
+ attr->type = attr_street_id;
+ attr->u.num = gar_srch_get_roadid(g);
+ if (attr->u.num)
+ return 1;
+ return 0;
+ case attr_flags:
+ attr->type = attr_flags;
+ attr->u.num = 0;
+ rc = gar_object_flags(g);
+ if (rc & F_ONEWAY)
+ attr->u.num |= AF_ONEWAY;
+ if (rc & F_SEGMENTED)
+ attr->u.num |= AF_SEGMENTED;
+ return 1;
+ case attr_country_id:
+ rc = gar_srch_get_countryid(g);
+ if (rc) {
+ attr->type = attr_country_id;
+ attr->u.num = rc;
+ return 1;
+ }
+ return 0;
+ case attr_country_name:
+ attr->type = attr_country_name;
+ attr->u.str = gar_srch_get_country(g);
+ if (attr->u.str)
+ return 1;
+ return 0;
+ case attr_district_id:
+ rc = gar_srch_get_regionid(g);
+ if (rc) {
+ attr->type = attr_district_id;
+ attr->u.num = rc;
+ return 1;
+ }
+ return 0;
+ case attr_district_name:
+ attr->type = attr_district_name;
+ attr->u.str = gar_srch_get_region(g);
+ if (attr->u.str)
+ return 1;
+ return 0;
+ case attr_town_streets_item:
+ return 0;
+ default:
+ dlog(1, "Dont know about attribute %d[%04X]=%s yet\n",
+ attr_type,attr_type, attr_to_name(attr_type));
+ }
+
+ return 0;
+}
+
+static int
+search_coord_get(void *priv_data, struct coord *c, int count)
+{
+ struct gobject *g = priv_data;
+ struct map_rect_priv *mr = g->priv_data;
+ struct gcoord gc;
+ if (!count)
+ return 0;
+ if (g != mr->last_itterated) {
+ mr->last_itterated = g;
+ mr->last_coord = 0;
+ }
+
+ if (mr->last_coord > 0)
+ return 0;
+
+ if (gar_get_object_coord(mr->gmap, g, &gc)) {
+ c->x = gc.x;
+ c->y = gc.y;
+ mr->last_coord++;
+ return 1;
+ }
+ return 0;
+}
+
+static struct item_methods methods_garmin_search = {
+ coord_rewind,
+ search_coord_get,
+ attr_rewind,
+ search_attr_get,
+};
+
+
+static struct item *
+garmin_poi2item(struct map_rect_priv *mr, struct gobject *o, unsigned short otype)
+{
+ if (mr->mpriv->conv) {
+ int mask = gar_object_group(o) << G2N_KIND_SHIFT;
+ mr->item.type = g2n_get_type(mr->mpriv->conv, G2N_POINT|mask, otype);
+ }
+ mr->item.meth = &methods_garmin_point;
+ return &mr->item;
+}
+
+static struct item *
+garmin_pl2item(struct map_rect_priv *mr, struct gobject *o, unsigned short otype)
+{
+ if (mr->mpriv->conv) {
+ int mask = gar_object_group(o) << G2N_KIND_SHIFT;
+ mr->item.type = g2n_get_type(mr->mpriv->conv, G2N_POLYLINE|mask, otype);
+ }
+ mr->item.meth = &methods_garmin_poly;
+ return &mr->item;
+}
+
+static struct item *
+garmin_pg2item(struct map_rect_priv *mr, struct gobject *o, unsigned short otype)
+{
+ if (mr->mpriv->conv) {
+ int mask = gar_object_group(o) << G2N_KIND_SHIFT;
+ mr->item.type = g2n_get_type(mr->mpriv->conv, G2N_POLYGONE|mask, otype);
+ }
+ mr->item.meth = &methods_garmin_poly;
+ return &mr->item;
+}
+
+static struct item *
+garmin_srch2item(struct map_rect_priv *mr, struct gobject *o, unsigned short otype)
+{
+ mr->item.type = type_country_label;
+ mr->item.meth = &methods_garmin_search;
+ return &mr->item;
+}
+
+static struct item *
+garmin_obj2item(struct map_rect_priv *mr, struct gobject *o)
+{
+ unsigned short otype;
+ otype = gar_obj_type(o);
+ mr->item.type = type_none;
+ switch (o->type) {
+ case GO_POINT:
+ return garmin_poi2item(mr, o, otype);
+ case GO_POLYLINE:
+ return garmin_pl2item(mr, o, otype);
+ case GO_POLYGON:
+ return garmin_pg2item(mr, o, otype);
+ case GO_ROAD:
+ return garmin_pl2item(mr, o, otype);
+#if 0
+ case GO_SEARCH:
+ return garmin_srch2item(mr, o, otype);
+#endif
+ default:
+ dlog(1, "Unknown garmin object type:%d\n",
+ o->type);
+ }
+ return NULL;
+}
+
+static struct item *
+gmap_rect_get_item_byid(struct map_rect_priv *mr, int id_hi, int id_lo)
+{
+ struct gobject *o;
+ o = mr->objs = gar_get_object_by_id(mr->mpriv->g, id_hi, id_lo);
+ if (!o) {
+ dlog(1, "Can not find object\n");
+ return NULL;
+ }
+
+ mr->item.id_hi = id_hi;
+ mr->item.id_lo = id_lo;
+ mr->item.priv_data = o;
+ mr->item.type = type_none;
+ o->priv_data = mr;
+ if (!garmin_obj2item(mr, o))
+ return NULL;
+ return &mr->item;
+}
+
+static struct item *
+gmap_rect_get_item(struct map_rect_priv *mr)
+{
+ struct gobject *o;
+ if (!mr->objs)
+ return NULL;
+ if (!mr->cobj)
+ return NULL;
+ // mr->cobj = mr->objs;
+ o = mr->cobj;
+// dlog(1, "gi:o=%p\n", o);
+ mr->cobj = mr->cobj->next;
+ if (o) {
+ mr->item.id_hi = gar_object_mapid(o);
+ mr->item.id_lo = gar_object_index(o);
+ mr->item.priv_data = o;
+ mr->item.type = type_none;
+ o->priv_data = mr;
+ if (!garmin_obj2item(mr, o))
+ return NULL;
+ return &mr->item;
+ }
+ return NULL;
+}
+
+#define max(a,b) ((a) > (b) ? (a) : (b))
+struct nl2gl_t {
+ int g;
+ int bits;
+ char *descr;
+};
+
+struct nl2gl_t nl2gl_1[] = {
+ { /* 0 */ .g = 12, .descr = "0-120m", },
+ { /* 1 */ .g = 11, .descr = "0-120m", },
+ { /* 2 */ .g = 10, .descr = "0-120m", },
+ { /* 3 */ .g = 9, .descr = "0-120m", },
+ { /* 4 */ .g = 8, .descr = "0-120m", },
+ { /* 5 */ .g = 7, .descr = "0-120m", },
+ { /* 6 */ .g = 6, .descr = "0-120m", },
+ { /* 7 */ .g = 5, .descr = "0-120m", },
+ { /* 8 */ .g = 4, .descr = "0-120m", },
+ { /* 9 */ .g = 4, .descr = "0-120m", },
+ { /* 10 */ .g = 3, .descr = "0-120m", },
+ { /* 11 */ .g = 3, .descr = "0-120m", },
+ { /* 12 */ .g = 2, .descr = "0-120m", },
+ { /* 13 */ .g = 2, .descr = "0-120m", },
+ { /* 14 */ .g = 2, .descr = "0-120m", },
+ { /* 15 */ .g = 1, .descr = "0-120m", },
+ { /* 16 */ .g = 1, .descr = "0-120m", },
+ { /* 17 */ .g = 1, .descr = "0-120m", },
+ { /* 18 */ .g = 0, .descr = "0-120m", },
+};
+
+struct nl2gl_t nl2gl[] = {
+ { /* 0 */ .g = 9, .descr = "0-120m", },
+ { /* 1 */ .g = 9, .descr = "0-120m", },
+ { /* 2 */ .g = 8, .descr = "0-120m", },
+ { /* 3 */ .g = 8, .descr = "0-120m", },
+ { /* 4 */ .g = 7, .descr = "0-120m", },
+ { /* 5 */ .g = 7, .descr = "0-120m", },
+ { /* 6 */ .g = 6, .descr = "0-120m", },
+ { /* 7 */ .g = 6, .descr = "0-120m", },
+ { /* 8 */ .g = 5, .descr = "0-120m", },
+ { /* 9 */ .g = 5, .descr = "0-120m", },
+ { /* 10 */ .g = 4, .descr = "0-120m", },
+ { /* 11 */ .g = 4, .descr = "0-120m", },
+ { /* 12 */ .g = 3, .descr = "0-120m", },
+ { /* 13 */ .g = 3, .descr = "0-120m", },
+ { /* 14 */ .g = 2, .descr = "0-120m", },
+ { /* 15 */ .g = 2, .descr = "0-120m", },
+ { /* 16 */ .g = 1, .descr = "0-120m", },
+ { /* 17 */ .g = 1, .descr = "0-120m", },
+ { /* 18 */ .g = 0, .descr = "0-120m", },
+};
+
+static int
+get_level(struct map_selection *sel)
+{
+ return sel->order;
+}
+
+static int
+garmin_get_selection(struct map_rect_priv *map, struct map_selection *sel)
+{
+ struct gar_rect r;
+ struct gmap *gm;
+ struct gobject **glast = NULL;
+ int rc;
+ int sl, el;
+ int level = 0; // 18; /* max level for maps, overview maps can have bigger
+ /* levels we do not deal w/ them
+ */
+ int flags = 0;
+ if (sel && sel->range.min == type_street_0 && sel->range.max == type_ferry) {
+ // Get all roads
+ flags = GO_GET_ROUTABLE;
+ } else if (sel)
+ flags = GO_GET_SORTED;
+
+ if (sel) {
+ r.lulat = sel->u.c_rect.lu.y;
+ r.lulong = sel->u.c_rect.lu.x;
+ r.rllat = sel->u.c_rect.rl.y;
+ r.rllong = sel->u.c_rect.rl.x;
+ level = get_level(sel);
+// level = nl2gl[level].g;
+ dlog(2, "Looking level=%d for %f %f %f %f\n",
+ level, r.lulat, r.lulong, r.rllat, r.rllong);
+ }
+ gm = gar_find_subfiles(map->mpriv->g, sel ? &r : NULL, flags);
+ if (!gm) {
+ if (sel) {
+ dlog(1, "Can not find map data for the area: %f %f %f %f\n",
+ r.lulat, r.lulong, r.rllat, r.rllong);
+ } else {
+ dlog(1, "Can not find map data\n");
+ }
+ return -1;
+ }
+#if 0
+ sl = (18-(gm->maxlevel - gm->minlevel))/2;
+ el = sl + (gm->maxlevel - gm->minlevel);
+ if (level < sl)
+ level = sl;
+ if (level > el)
+ level = el;
+ level = level - sl;
+ level = (gm->maxlevel - gm->minlevel) - level;
+ dlog(3, "sl=%d el=%d level=%d\n", sl, el, level);
+#endif
+ sl = (18-gm->zoomlevels)/2;
+ el = sl + gm->zoomlevels;
+ if (level < sl)
+ level = sl;
+ if (level > el)
+ level = el;
+ level = level - sl;
+ level = gm->basebits + level;
+ dlog(3, "sl=%d el=%d level=%d\n", sl, el, level);
+ map->gmap = gm;
+ glast = &map->objs;
+ while (*glast) {
+ if ((*glast)->next) {
+ *glast = (*glast)->next;
+ } else
+ break;
+ }
+ rc = gar_get_objects(gm, level, sel ? &r : NULL, glast, flags);
+ if (rc < 0) {
+ dlog(1, "Error loading objects\n");
+ return -1;
+ }
+ map->cobj = map->objs;
+ dlog(2, "Loaded %d objects\n", rc);
+ return rc;
+}
+// Can not return NULL, navit segfaults
+static struct map_rect_priv *
+gmap_rect_new(struct map_priv *map, struct map_selection *sel)
+{
+ struct map_selection *ms = sel;
+ struct map_rect_priv *mr;
+
+ if (!map)
+ return NULL;
+ mr = calloc(1, sizeof(*mr));
+ if (!mr)
+ return mr;
+ mr->mpriv = map;
+ if (!sel) {
+ return mr;
+ } else {
+ while (ms) {
+ dlog(2, "order %d\n", ms->order);
+ if (garmin_get_selection(mr, ms) < 0) {
+ // free(mr);
+ // return NULL;
+ }
+ ms = ms->next;
+ }
+ }
+ return mr;
+}
+
+static void
+gmap_rect_destroy(struct map_rect_priv *mr)
+{
+ dlog(11,"destroy maprect\n");
+ if (mr->gmap)
+ gar_free_gmap(mr->gmap);
+ if (mr->objs)
+ gar_free_objects(mr->objs);
+ if (mr->label)
+ free(mr->label);
+ free(mr);
+}
+
+static void
+gmap_search_destroy(struct map_search_priv *ms)
+{
+ gmap_rect_destroy((struct map_rect_priv *)ms);
+}
+
+static void
+gmap_destroy(struct map_priv *m)
+{
+ dlog(5, "garmin_map_destroy\n");
+ if (m->g)
+ gar_free(m->g);
+ if (m->filename)
+ free(m->filename);
+ free(m);
+}
+
+static struct map_methods map_methods = {
+ projection_garmin,
+ "utf-8",
+ gmap_destroy,
+ gmap_rect_new,
+ gmap_rect_destroy,
+ gmap_rect_get_item,
+ gmap_rect_get_item_byid,
+ gmap_search_new,
+ gmap_search_destroy,
+ gmap_rect_get_item,
+};
+
+static struct map_priv *
+gmap_new(struct map_methods *meth, struct attr **attrs)
+{
+ struct map_priv *m;
+ struct attr *data;
+ struct attr *debug;
+ struct attr *flags;
+ char buf[PATH_MAX];
+ struct stat st;
+ int dl = 1;
+ struct gar_config cfg;
+ int debugmask = 0;
+
+ data=attr_search(attrs, NULL, attr_data);
+ if (! data)
+ return NULL;
+ debug=attr_search(attrs, NULL, attr_debug);
+ if (debug) {
+ dl = atoi(debug->u.str);
+ if (!dl)
+ dl = 1;
+ }
+ flags=attr_search(attrs, NULL, attr_flags);
+ if (flags) {
+ debugmask = flags->u.num;
+ }
+ m=g_new(struct map_priv, 1);
+ m->id=++map_id;
+ m->filename = strdup(data->u.str);
+ if (!m->filename) {
+ g_free(m);
+ return NULL;
+ }
+ memset(&cfg, 0, sizeof(struct gar_config));
+ cfg.opm = OPM_GPS;
+ cfg.debuglevel = dl;
+ cfg.debugmask = debugmask;
+ garmin_debug = dl;
+ m->g = gar_init_cfg(NULL, logfn, &cfg);
+ if (!m->g) {
+ g_free(m->filename);
+ g_free(m);
+ return NULL;
+ }
+ // we want the data now, later we can load only what's necessery
+ if (gar_img_load(m->g, m->filename, 1) < 0) {
+ gar_free(m->g);
+ g_free(m->filename);
+ g_free(m);
+ return NULL;
+ }
+ m->conv = NULL;
+ snprintf(buf, sizeof(buf), "%s.types", m->filename);
+ if (!stat(buf, &st)) {
+ dlog(1, "Loading custom types from %s\n", buf);
+ m->conv = g2n_conv_load(buf);
+ }
+ if (!m->conv) {
+ dlog(1, "Using builtin types\n");
+ m->conv = g2n_default_conv();
+ }
+ if (!m->conv) {
+ dlog(1, "Failed to load map types\n");
+ }
+ *meth=map_methods;
+ return m;
+}
+
+void
+plugin_init(void)
+{
+ plugin_register_map_type("garmin", gmap_new);
+}
diff --git a/map/garmin/garmin.h b/map/garmin/garmin.h
new file mode 100644
index 00000000..94e893b1
--- /dev/null
+++ b/map/garmin/garmin.h
@@ -0,0 +1,32 @@
+/*
+ Copyright (C) 2007 Alexander Atanasov <aatanasov@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; version 2 of the License.
+
+ 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, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301 USA
+
+ Garmin and MapSource are registered trademarks or trademarks
+ of Garmin Ltd. or one of its subsidiaries.
+
+*/
+
+#define dlog(x,y ...) logfn(__FILE__,__LINE__,x, ##y)
+#ifdef HARDDEBUG
+#define ddlog(x,y ...) logfn(__FILE__,__LINE__,x, ##y)
+#else
+#define ddlog(x,y ...)
+#endif
+
+extern int garmin_debug;
+void logfn(char *file, int line, int level, char *fmt, ...);
+
diff --git a/map/garmin/garmintypes.txt b/map/garmin/garmintypes.txt
new file mode 100644
index 00000000..7df6831d
--- /dev/null
+++ b/map/garmin/garmintypes.txt
@@ -0,0 +1,707 @@
+#
+#
+#
+POINT
+0, 0x0000 = label_unkn, Unknown label
+0, 0x0100 = town_label_1e5, Megapolis (10M +)
+0, 0x0200 = town_label_5e4, Megapolis (5-10M)
+0, 0x0300 = town_label_2e4, Big City (2-5M)
+0, 0x0400 = town_label_1e4, Big City (1-2M)
+0, 0x0500 = town_label_5e3, Big City (0.5-1M)
+0, 0x0600 = town_label_2e3, City (200-500k)
+0, 0x0700 = town_label_1e3, City (100-200k)
+0, 0x0800 = town_label_5e2, City (50-100k)
+0, 0x0900 = town_label_2e2, City (20-50k)
+0, 0x0a00 = town_label_1e2, City (10-20k)
+0, 0x0b00 = town_label_5e1, Small City (5-10k)
+0, 0x0c00 = town_label_2e1, Small City (2-5k)
+0, 0x0d00 = town_label_1e1, Village (1-2k)
+0, 0x0e00 = town_label_5e0, Village (500-1000)
+0, 0x0f00 = town_label_2e0, Village (200-500)
+0, 0x1000 = town_label_1e0, Village (100-200)
+0, 0x1100 = town_label_0e0, Village (0-100)
+
+0, 0x1200 = port_label, Port with services
+0, 0x1300 = label_unkn, Unknown label2
+0, 0x1400-0x14FF = country_label, Large Country Name
+0, 0x1500-0x15FF = country_label, Country Name
+0, 0x1c00 = poi_wreck, Unclassified Obstruction
+0, 0x1c01 = poi_wreck, Wreck
+0, 0x1c02 = poi_dangerous, submerged wreck, dangerous
+0, 0x1c03 = poi_nondangerous, submerged wreck, non-dangerous
+0, 0x1c04 = poi_wreck, Wreck, cleared by wire drag
+0, 0x1c05 = poi_rock, Obstruction, visible at high water
+0, 0x1c06 = poi_rock, Obstruction, awash
+0, 0x1c07 = poi_rock, Obstruction, submerged
+0, 0x1c08 = poi_rock, Obstruction, cleared by wire drag
+0, 0x1c09 = poi_rock, Rock, awash
+0, 0x1c0a = poi_rock, Rock, submerged at low Water
+0, 0x1c0b = poi_sounding, Sounding
+0, 0x1d00 = poi_tide, Tide Prediction
+
+0, 0x1e00-0x1e3f = district_label, District, Province, State Name
+0, 0x1f00 = district_label_0e0, Region, District Name
+
+# Fixme if it has label how to change to highway_exit_with_label ??
+0, 0x2000-0x203F = highway_exit, Exit
+0, 0x2100-0x213F = highway_exit, Exit with Services
+0, 0x2200-0x223F = highway_exit, Exit with Restroom
+0, 0x2300-0x233F = highway_exit, Exit with Convinience Store
+0, 0x2400-0x243F = highway_exit, Exit with Weight Station
+0, 0x2500-0x253F = highway_exit, Exit with Toolbooth Booth
+0, 0x2600-0x263F = highway_exit, Exit with Information
+0, 0x2700-0x273F = highway_exit, Exit
+
+0, 0x2800-0x283F = district_label_1e0, Region Name
+
+0, 0x2900 = poi_public_utilities, Services
+
+0, 0x2A00 = poi_dining, Dining(Other)
+0, 0x2A01 = poi_dining, Dining(American)
+0, 0x2A02 = poi_dining, Dining(Asian)
+0, 0x2A03 = poi_dining, Dining(Barbecue)
+0, 0x2A04 = poi_dining, Dining(Chinese)
+0, 0x2A05 = poi_dining, Dining(Deli/Bakery)
+0, 0x2A06 = poi_dining, Dining(International)
+0, 0x2A07 = poi_fastfood, Fast Food
+0, 0x2A08 = poi_dining, Dining(Italian)
+0, 0x2A09 = poi_dining, Dining(Mexican)
+0, 0x2A0A = poi_dining, Dining(Pizza)
+0, 0x2A0B = poi_dining, Dining(Sea Food)
+0, 0x2A0C = poi_dining, Dining(Steak/Grill)
+0, 0x2A0D = poi_dining, Dining(Bagel/Donut)
+0, 0x2A0E = poi_dining, Dining(Cafe/Diner)
+0, 0x2A0F = poi_dining, Dining(French)
+0, 0x2A10 = poi_dining, Dining(German)
+0, 0x2A11 = poi_dining, Dining(British Isles)
+0, 0x2A12 = poi_dining, Dining(Special Foods)
+
+0, 0x2B00 = poi_hotel, Hotel(Other)
+0, 0x2B01 = poi_hotel, Hotel/Motel
+0, 0x2B02 = poi_hotel, Bed & Breakfast inn
+0, 0x2B03 = poi_camp_rv, Camping/RV-Park
+0, 0x2B04 = poi_resort, Resort
+
+0, 0x2C00 = poi_attraction, Amusement Park
+0, 0x2C01 = poi_attraction, Amusement Park
+0, 0x2C02 = poi_museum_history, Museum/History
+0, 0x2C03 = poi_library, Libraries
+0, 0x2C04 = poi_landmark, Land Mark
+0, 0x2C05 = poi_school, School
+0, 0x2C06 = poi_park, Park
+0, 0x2C07 = poi_zoo, Zoo
+0, 0x2C08 = poi_stadium, Sportpark, Stadium,(point)
+0, 0x2C09 = poi_fair, Fair, Conference(point)
+0, 0x2C0A = poi_wine, Wine restaurant(point)
+0, 0x2C0B = poi_worship, Place of Worship
+0, 0x2C0C = poi_hotspring, Hot Spring
+
+0, 0x2D00 = poi_theater, Theater
+0, 0x2D01 = poi_theater, Theater
+0, 0x2D02 = poi_bar, Bar
+0, 0x2D03 = poi_cinema, Cinema
+0, 0x2D04 = poi_casino, Casino
+0, 0x2D05 = poi_golf, Golf
+0, 0x2D06 = poi_skiing, Skiing Center
+0, 0x2D07 = poi_bowling, Bowling
+0, 0x2D08 = poi_icesport, Ice/Sporting
+0, 0x2D09 = poi_swimming, Swimming
+0, 0x2D0A = poi_sport, Sports(point)
+0, 0x2D0B = poi_sailing, Sailing Airport
+
+0, 0x2E00 = poi_shopping, Shoping general
+0, 0x2E01 = poi_shop_department, Department Store
+0, 0x2E02 = poi_shop_grocery, Grocery
+0, 0x2E03 = poi_shop_merchandise, General Merchandiser
+0, 0x2E04 = poi_mall, Shopping Center
+0, 0x2E05 = poi_pharmacy, Pharmacy
+0, 0x2E06 = poi_shopping, Convenience
+0, 0x2E07 = poi_shop_apparel, Apparel
+0, 0x2E08 = poi_shop_handg, House and Garden
+0, 0x2E09 = poi_shop_furnish, Home Furnishing
+0, 0x2E0a = poi_shop_retail, Special Retail
+0, 0x2E0b = poi_shop_computer, Computer/Software
+0, 0x2E0c = poi_shop_computer, Mobile Communications
+
+0, 0x2F00 = poi_service, generic service
+0, 0x2F01 = poi_fuel, Fuel/Gas
+0, 0x2F02 = poi_car_rent, Car Rental
+0, 0x2F03 = poi_autoservice, Car Repair
+0, 0x2F04 = poi_airport, Airport
+0, 0x2F05 = poi_post, Post Office
+0, 0x2F06 = poi_bank, Bank
+0, 0x2F07 = poi_car_dealer_parts, Car Dealer(point)
+0, 0x2F08 = poi_bus_station, Bus Station
+0, 0x2F09 = poi_marina, Marina
+0, 0x2F0A = poi_wrecker, Wrecker Service
+0, 0x2F0B = poi_car_parking, Parking
+0, 0x2F0C = poi_rest_room, Restroom
+0, 0x2F0D = poi_auto_club, Automobile Club
+0, 0x2F0E = poi_car_wash, Car Wash
+0, 0x2F0F = poi_garmin, Garmin Dealer
+0, 0x2F10 = poi_personal_service, Personal Service
+0, 0x2F11 = poi_bussines_service, Business Service
+0, 0x2F12 = poi_communication, Communication
+0, 0x2F13 = poi_repair_service, Repair Service
+0, 0x2F14 = poi_social_service, Social Service
+0, 0x2F15 = poi_public_utilities, Utility
+0, 0x2F16 = poi_truck_stop, Truck Stop
+0, 0x2F17 = poi_bus_stop, Bus Stop
+
+0, 0x3000 = poi_emergency, generic emergency/government
+0, 0x3001 = poi_police, Police Station
+0, 0x3002 = poi_hospital, Hospital
+0, 0x3003 = poi_public_office, Public Office
+0, 0x3004 = poi_justice, Justice
+0, 0x3005 = poi_concert, Concert hall(point)
+0, 0x3006 = poi_border_station, Border Station(point)
+0, 0x3007 = poi_goverment_building, Goverment Building
+0, 0x3008 = poi_firebrigade, FireFighters Station
+
+0, 0x4000-0x403F = poi_golf, Golf
+0, 0x4100-0x413F = poi_fish, Fish
+0, 0x4200-0x423F = poi_wreck, Wreck
+0, 0x4300-0x433F = poi_marina, Marina
+0, 0x4400-0x443F = poi_fuel, Gas
+0, 0x4500-0x453F = poi_restaurant, Restaurant
+0, 0x4600-0x463F = poi_bar, Bar
+0, 0x4700-0x473F = poi_boat_ramp, Boat Ramp
+0, 0x4800-0x483F = poi_camping, Camping
+0, 0x4900-0x493F = poi_park, Park
+0, 0x4A00-0x4A3F = poi_picnic, Picnic Area
+0, 0x4B00-0x4B3F = poi_hospital, Hospital
+0, 0x4C00-0x4C3F = poi_information, Information
+0, 0x4D00-0x4D3F = poi_car_parking, Parking
+0, 0x4E00-0x4E3F = poi_restroom, Restroom
+0, 0x4F00-0x4F3F = poi_shower, Shower
+0, 0x5000-0x503F = poi_drinking_water, Drinking Water
+0, 0x5100-0x513F = poi_telephone, Telephone
+0, 0x5200-0x523F = poi_scenic_area, Scenic Area
+0, 0x5300-0x533F = poi_skiing, Skiing
+0, 0x5400-0x543F = poi_swimming, Swimming
+0, 0x5500-0x553F = poi_dam, Dam
+
+0, 0x5600-0x563F = poi_forbiden_area, Forbiden Area
+0, 0x5700-0x573F = poi_danger_area, Danger Area
+0, 0x5800-0x583F = poi_restricted_area, Restricted Area
+
+0, 0x5900 = poi_airport, Generic Airport
+0, 0x5901 = poi_airport, Large Airport
+0, 0x5902 = poi_airport, Medium Airport
+0, 0x5903 = poi_airport, Small Airport
+0, 0x5904 = poi_heliport, Heliport
+0, 0x5905-0x593F = poi_airport, Airport
+
+0, 0x5a00 = poi_mark, Kilometer Pole
+0, 0x5b00 = poi_mark, Kolokol
+0, 0x5c00 = poi_diving, Diving Place
+
+0, 0x5D00-0x5D3F = poi_daymark, Daymark,Green Square
+0, 0x5E00-0x5E3F = poi_daymark, Daymark,Red Triangle
+
+0, 0x6000 = poi_loudspeaker, LoudSpeaker
+0, 0x6100 = poi_building, House
+
+0, 0x6200 = poi_height, Height with point in feet one decimal place
+0, 0x6300 = poi_height, Height without point in feet no decimal place
+0, 0x6400 = poi_manmade_feature, Manmade Feature
+0, 0x6401 = poi_bridge, Bridge
+0, 0x6402 = poi_building, Building
+0, 0x6403 = poi_cemetery, Cemetery
+0, 0x6404 = poi_church, Church
+0, 0x6405 = poi_civil, Civil
+0, 0x6406 = poi_crossing, Crossing
+0, 0x6407 = poi_dam, Dam
+0, 0x6408 = poi_hospital, Hospital
+0, 0x6409 = poi_levee, Levee
+0, 0x640A = poi_locale, Locale
+0, 0x640B = poi_military, Military
+0, 0x640C = poi_mine, Mine
+0, 0x640D = poi_oil_field, Oil Field
+0, 0x640E = poi_park, Park
+0, 0x640F = poi_post, Post
+0, 0x6410 = poi_school, School
+0, 0x6411 = poi_tower, Tower
+0, 0x6412 = poi_trail, Trail
+0, 0x6413 = poi_tunnel, Tunnel
+0, 0x6414 = poi_drinking_water, Drink water
+0, 0x6415 = town_ghost, Ghost Town
+0, 0x6416 = poi_subdivision, Subdivision
+
+0, 0x6500 = poi_water_feature, Water Feature
+0, 0x6501 = poi_water_feature, Arroyo
+0, 0x6502 = poi_water_feature, Sand Bar
+0, 0x6503 = poi_bay, Bay
+0, 0x6504 = poi_bend, Bend
+0, 0x6505 = poi_water_feature, Canal
+0, 0x6506 = poi_water_feature, Channel
+0, 0x6507 = poi_cove, Cove
+0, 0x6508 = poi_water_feature, Falls
+0, 0x6509 = poi_water_feature, Geyser
+0, 0x650A = poi_water_feature, Glacier
+0, 0x650B = poi_marine, Harbour
+0, 0x650C = poi_island, Island
+0, 0x650D = poi_water_feature, Lake
+0, 0x650E = poi_water_feature, Rapids
+0, 0x650F = poi_water_feature, Reservoir
+0, 0x6510 = poi_water_feature, Sea
+0, 0x6511 = poi_water_feature, Spring
+0, 0x6512 = poi_water_feature, Stream
+0, 0x6513 = poi_water_feature, Swamp
+
+0, 0x6600 = poi_land_feature, Land Feature
+0, 0x6601 = poi_land_feature, Arch
+0, 0x6602 = poi_land_feature, Area
+0, 0x6603 = poi_land_feature, Basin
+0, 0x6604 = poi_land_feature, Beach
+0, 0x6605 = poi_land_feature, Bench
+0, 0x6606 = poi_land_feature, Cape
+0, 0x6607 = poi_land_feature, Cliff
+0, 0x6608 = poi_land_feature, Crater
+0, 0x6609 = poi_land_feature, Flat
+0, 0x660A = poi_land_feature, Forest
+0, 0x660B = poi_land_feature, Gap
+0, 0x660C = poi_land_feature, Gut
+0, 0x660D = poi_land_feature, Isthmus
+0, 0x660E = poi_land_feature, Lava
+0, 0x660F = poi_land_feature, Pillar
+0, 0x6610 = poi_land_feature, Plain
+0, 0x6611 = poi_land_feature, Range
+0, 0x6612 = poi_land_feature, Reserve
+0, 0x6613 = poi_land_feature, Ridge
+0, 0x6614 = poi_land_feature, Rock
+0, 0x6615 = poi_land_feature, Slope
+0, 0x6616 = poi_land_feature, Summit
+0, 0x6617 = poi_land_feature, Valley
+0, 0x6618 = poi_land_feature, Woods
+
+# This are dublicated to 0x1700, 0x1800, 0x1900, 0x1A00, 0x1B00
+# fix them if you need them
+0, 0x1600 = poi_marine_type, Beakon
+0, 0x1601 = poi_marine_type, Fog Horn
+0, 0x1602 = poi_marine_type, Radio Beacon
+0, 0x1603 = poi_marine_type, Racon
+0, 0x1604 = poi_marine_type, Day Beacon, red triangle
+0, 0x1605 = poi_marine_type, Day Beacon, green square
+0, 0x1606 = poi_marine_type, Day Beacon, white diamond
+0, 0x1607 = poi_marine_type, unlit Navaid, white
+0, 0x1608 = poi_marine_type, unlit Navaid, red
+0, 0x1609 = poi_marine_type, unlit Navaid, green
+0, 0x160a = poi_marine_type, unlit Navaid, black
+0, 0x160b = poi_marine_type, unlit Navaid, yellow or amber
+0, 0x160c = poi_marine_type, unlit Navaid, orange
+0, 0x160d = poi_marine_type, unlit Navaid, multi colored
+0, 0x160e = poi_marine_type, Navaid, unknown
+0, 0x160f = poi_marine_type, lighted Navaid, white
+0, 0x1610 = poi_marine_type, lighted Navaid, red
+0, 0x1611 = poi_marine_type, lighted Navaid, green
+0, 0x1612 = poi_marine_type, lighted Navaid, yellow or amber
+0, 0x1613 = poi_marine_type, lighted Navaid, orange
+0, 0x1614 = poi_marine_type, lighted Navaid, violet
+0, 0x1615 = poi_marine_type, lighted Navaid, blue
+0, 0x1616 = poi_marine_type, lighted Navaid, multi colored
+# RGN2-4 types
+# Marine types start
+1, 0x0100 = point_unkn, Light
+1, 0x0102 = point_unkn, Light with north topmark
+1, 0x0103 = point_unkn, Light with south topmark
+1, 0x0104 = point_unkn, Light with east topmark
+1, 0x0105 = point_unkn, Light with west topmark
+1, 0x0106 = point_unkn, Isolated danger light
+1, 0x0107 = point_unkn, Port hand light
+1, 0x0108 = point_unkn, Starboard hand light
+1, 0x0109 = point_unkn, Special purpose light
+1, 0x010a = point_unkn, Safe water light
+1, 0x0200 = point_unkn, Buoy
+1, 0x0201 = point_unkn, Buoy
+1, 0x0202 = point_unkn, Buoy with north topmark
+1, 0x0203 = point_unkn, Buoy with south topmark
+1, 0x0204 = point_unkn, Buoy with east topmark
+1, 0x0205 = point_unkn, Buoy with west topmark
+1, 0x0206 = point_unkn, Beacon
+1, 0x0207 = point_unkn, Spar buoy
+1, 0x0208 = point_unkn, Isolated danger buoy
+1, 0x0209 = point_unkn, Port hand buoy
+1, 0x020a = point_unkn, Starboard hand buoy
+1, 0x020b = point_unkn, Special purpose buoy
+1, 0x020c = point_unkn, Safe water buoy
+1, 0x020d = point_unkn, Platform buoy
+1, 0x020e = point_unkn, Beacon with north topmark
+1, 0x020f = point_unkn, Beacon with south north topmark
+1, 0x0210 = point_unkn, Beacon with east topmark
+1, 0x0211 = point_unkn, Beacon with west topmark
+1, 0x0212 = point_unkn, Isolated danger beacon
+1, 0x0213 = point_unkn, Port hand beacon
+1, 0x0214 = point_unkn, Starboard hand beacon
+1, 0x0215 = point_unkn, Special purpose beacon
+1, 0x0216 = point_unkn, Mooring buoy
+1, 0x0217 = point_unkn, Fixed point
+1, 0x0218 = point_unkn, Pole
+1, 0x0300 = point_unkn, Depth point
+1, 0x0301 = point_unkn, Depth point invisible
+1, 0x0302 = point_unkn, Depth point underscore
+1, 0x0303 = point_unkn, Spot height
+1, 0x0304 = point_unkn, Building
+1, 0x0305 = point_unkn, Chimney
+1, 0x0306 = point_unkn, Church
+1, 0x0307 = point_unkn, Tanks
+1, 0x0308 = point_unkn, Tower
+1, 0x0309 = point_unkn, Rock
+1, 0x030a = point_unkn, Triangulation point
+1, 0x030b = point_unkn, Radio mast
+1, 0x0400 = point_unkn, Isolated danger
+1, 0x0401 = point_unkn, Obstruction
+1, 0x0402 = point_unkn, Wreck
+1, 0x0403 = point_unkn, Exposed wreck
+1, 0x0404 = point_unkn, Well
+1, 0x0405 = point_unkn, Foul
+1, 0x0406 = point_unkn, Explosive
+1, 0x0407 = point_unkn, Fish haven
+1, 0x0408 = point_unkn, Obstruction that covers
+1, 0x0409 = point_unkn, Marine farm
+1, 0x040a = point_unkn, Dangerous rock
+1, 0x040b = point_unkn, No bottom found
+1, 0x040c = point_unkn, Exposed rock
+1, 0x040d = point_unkn, Dangerous rock
+1, 0x040e = point_unkn, Underwater rock (non-dangerous rock)
+1, 0x040f = point_unkn, Shoal
+1, 0x0500 = point_unkn, Label point
+1, 0x0600 = point_unkn, Centered label
+1, 0x0700 = point_unkn, Miscellaneous point
+1, 0x0701 = point_unkn, Recommended anchorage
+1, 0x0702 = point_unkn, Pilot boarding place
+1, 0x0703 = point_unkn, Yacht harbour
+1, 0x0704 = point_unkn, Pile
+1, 0x0705 = point_unkn, Anchoring prohibited
+1, 0x0706 = point_unkn, Fishing prohibited
+1, 0x0707 = point_unkn, Precautionary area
+1, 0x0708 = point_unkn, Radio report point
+1, 0x0709 = point_unkn, Anchorage berths
+1, 0x070a = point_unkn, Rescue station
+1, 0x070b = point_unkn, Fishing harbour
+1, 0x070c = point_unkn, Airport
+1, 0x0800 = point_unkn, Information
+1, 0x0901 = point_unkn, Bottom conditions
+1, 0x0902 = point_unkn, Fishing information
+1, 0x0903 = point_unkn, Facility
+# NT types start
+1, 0x0b00 = poi_dining, Dining(Other)
+1, 0x0b04 = poi_dining, Dining(Chinese)
+1, 0x0b05 = poi_dining, Dining (Deli/Bakery)
+1, 0x0b06 = poi_dining, Dining (International)
+1, 0x0b07 = poi_fastfood, Fast Food
+1, 0x0b09 = poi_dining, Dining(Mexican)
+1, 0x0b0a = poi_dining, Dining(Pizza)
+1, 0x0b0b = poi_dining, Dining (Sea Food)
+1, 0x0b0c = poi_dining, Dining (Steak/Grill)
+1, 0x0b0d = poi_dining, Dining(Bagel/Donut)
+1, 0x0b0e = poi_dining, Dining(Cafe/Diner)
+1, 0x0c01 = poi_hotel, Hotel/Motel
+1, 0x0c02 = poi_hotel, Bed & Breakfast inn
+1, 0x0c03 = poi_camp_rv, Camping/RV-Park
+1, 0x0c04 = poi_resort, Resort
+1, 0x0d01 = poi_attraction, Amusement Park
+1, 0x0d02 = poi_museum_history, Museum/History
+1, 0x0d03 = poi_fair, Fair, Conference(point)
+1, 0x0d04 = poi_scenic_area, Scenic Area
+1, 0x0d05 = poi_school, School
+1, 0x0d06 = poi_park, Park
+1, 0x0d07 = poi_zoo, Zoo
+1, 0x0d08 = poi_stadium, Sportpark, Stadium
+1, 0x0d0a = poi_bar, Wine Bar
+1, 0x0d14 = poi_hospital, Hospital
+1, 0x0e01 = poi_theater, Theater
+1, 0x0e02 = poi_bar, Bar
+1, 0x0e03 = poi_cinema, Cinema
+1, 0x0e04 = poi_casino, Casino
+1, 0x0e05 = poi_golf, Golf
+1, 0x0e06 = poi_skiing, Skiing Center/Lift
+1, 0x0e07 = poi_bar, Night Bar/Piano
+1, 0x0e08 = poi_icesport, Ice/Sporting
+1, 0x0e09 = poi_swimming, Swimming
+1, 0x0e0a = poi_sport, Sports(point)
+1, 0x0f00 = poi_hotel, Hotel(Other)
+1, 0x0f01 = poi_shop_department, Department Store
+1, 0x0f02 = poi_shop_grocery, Grocery
+1, 0x0f03 = poi_hotel, Hotel/Motel
+1, 0x0f04 = poi_resort, Resort
+1, 0x0f05 = poi_pharmacy, Pharmacy
+1, 0x1001 = poi_fuel, Fuel/Gas
+1, 0x1002 = poly_car_parking, Parking Lot
+1, 0x1003 = poi_autoservice, Car Repair
+1, 0x1004 = poi_airport, Airport
+1, 0x1005 = poi_post, Post Office
+1, 0x1006 = poi_bank, Bank
+1, 0x1008 = poi_bus_station, Bus station
+1, 0x1009 = poi_marina, SeaPort
+1, 0x100a = poi_wrecker, Wrecker Service
+1, 0x100b = poi_car_parking, Parking
+1, 0x100d = poi_car_dealer_parts, Car Dealer(point)
+1, 0x100e = poi_car_wash, Car Wash
+1, 0x1011 = poi_bussines_service, Business Service
+1, 0x1012 = poi_communication, Communication
+1, 0x1013 = poi_repair_service, Repair Service
+1, 0x1014 = poi_social_service, Social Service
+1, 0x1015 = poi_public_utilities, Utility
+1, 0x1101 = poi_police, Police Station
+1, 0x1102 = poi_hospital, Hospital
+1, 0x1104 = poi_justice, Justice
+1, 0x1107 = poi_public_office, Public Office
+1, 0x1400 = town_label_1e5, Megapolis (10M +)
+1, 0x1401 = town_label_5e4, Megapolis (5-10M)
+1, 0x1402 = town_label_2e4, Big City (2-5M)
+1, 0x1403 = town_label_5e3, Big City (0.5-1M)
+1, 0x1404 = town_label_2e3, City (200-500k)
+1, 0x1405 = town_label_1e3, City (100-200k)
+1, 0x1406 = town_label_5e2, City (50-100k)
+1, 0x1405 = town_label_2e2, City (20-50k)
+1, 0x1406 = town_label_1e2, City (10-20k)
+1, 0x1407 = town_label_5e1, Small City (5-10k)
+1, 0x1408 = town_label_2e1, Small City (2-5k)
+1, 0x1409 = town_label_1e1, Village (1-2k)
+1, 0x140a = town_label_5e0, Village (500-1000)
+1, 0x140b = town_label_2e0, Village (200-500)
+1, 0x140c = town_label_1e0, Village (100-200)
+1, 0x140d = town_label_0e0, Village (0-100)
+1, 0x1500 = poi_personal_service, Personal Service
+1, 0x1501 = poi_bussines_service, Bussines Service
+
+
+POLYLINE
+0, 0x00 = street_1_land, Road
+0, 0x01 = highway_land, Major HWY thick
+0, 0x02 = street_4_land, Principal HWY-thick
+0, 0x03 = street_2_land, Principal HWY-medium
+0, 0x04 = street_3_city, Arterial Road-medium
+0, 0x05 = street_4_city, Arterial Road-thick
+0, 0x06 = street_2_city, Road-thin
+0, 0x07 = street_1_city, Alley-thick
+0, 0x08 = ramp, Ramp
+0, 0x09 = ramp, Ramp highspeed
+0, 0x0a = street_0, Unpaved Road-thin
+0, 0x0b = ramp, Major HWY Connector-thick
+0, 0x0c = roundabout, Roundabout
+0, 0x0d = street_unkn, Custom defined street 1
+0, 0x0e = street_unkn, Custom defined street 2
+0, 0x0f = street_unkn, Custom defined street 3
+0, 0x10 = street_unkn, Custom defined street 4
+0, 0x11 = street_unkn, Custom defined street 5
+0, 0x12 = street_unkn, Custom defined street 6
+0, 0x13 = street_unkn, Custom defined street 7
+0, 0x14 = rail, Railroad
+0, 0x15 = water_line, Shoreline
+0, 0x16 = street_nopass, Trail
+0, 0x18 = water_line, Stream-thin
+0, 0x19 = time_zone, Time-Zone
+0, 0x1a = ferry, Ferry
+0, 0x1b = ferry, Ferry
+0, 0x1c = border_country, Political Boundary
+0, 0x1d = border_country, County Boundary
+0, 0x1e = border_country, Intl. Boundary
+0, 0x1f = water_line, River
+0, 0x20 = height_line_1, Land Contour (thin) Height in feet
+0, 0x21 = height_line_2, Land Contour (medium) Height in feet
+0, 0x22 = height_line_3, Land Contour (thick) Height in feet
+0, 0x23 = depth_line_1, Depth Contour (thin) Depth in feet
+0, 0x24 = depth_line_2, Depth Contour (medium) Depth in feet
+0, 0x25 = depth_line_3, Depth Contour (thick) Depth in feet
+0, 0x26 = water_line, Intermittent River
+0, 0x27 = street_nopass, Airport Runway
+0, 0x28 = pipeline, Pipeline
+0, 0x29 = powerline, Powerline
+0, 0x2a = marine_boundary, Marine Boundary (no line)
+0, 0x2b = marine_hazard, Marine Hazard (no line)
+# RGN2-4
+# Marine
+1, 0x0100 = street_unkn, Miscellaneous line
+1, 0x0101 = street_unkn, Line
+1, 0x0102 = street_unkn, Cartographic line
+1, 0x0103 = street_unkn, Road
+1, 0x0104 = street_unkn, Clearing line
+1, 0x0105 = street_unkn, Contour line
+1, 0x0106 = street_unkn, Overhead cable
+1, 0x0107 = street_unkn, Bridge
+1, 0x0108 = street_unkn, Recommended route
+1, 0x0109 = street_unkn, Chart border
+1, 0x0300 = street_unkn, Depth contour
+1, 0x0301 = street_unkn, Depth contour value
+1, 0x0307 = street_unkn, Intertidal zone border
+1, 0x0400 = street_unkn, Obstruction line
+1, 0x0401 = street_unkn, Submarine cable
+1, 0x0402 = street_unkn, Submarine pipeline
+1, 0x0403 = street_unkn, Pile barrier
+1, 0x0404 = street_unkn, Fishing stakes
+1, 0x0405 = street_unkn, Supply pipeline area
+1, 0x0406 = street_unkn, Submarine cable area
+1, 0x0407 = street_unkn, Dumping ground
+1, 0x0408 = street_unkn, Explosive dumping ground
+1, 0x0409 = street_unkn, Danger line
+1, 0x040a = street_unkn, Overhead cable
+1, 0x040b = street_unkn, Submerged construction
+1, 0x040c = street_unkn, Pier/jetty
+1, 0x0500 = street_unkn, Restriction
+1, 0x0501 = street_unkn, Anchoring prohibited
+1, 0x0502 = street_unkn, Fishing prohibited
+1, 0x0503 = street_unkn, Prohibited area
+1, 0x0504 = street_unkn, Military practice area
+1, 0x0505 = street_unkn, Anchoring and fishing prohibited
+1, 0x0506 = street_unkn, Limit of nature reservation
+1, 0x0507 = street_unkn, Restricted area
+1, 0x0508 = street_unkn, Minefield
+1, 0x0600 = street_unkn, Miscellaneous line
+1, 0x0601 = street_unkn, Cartographic line
+1, 0x0602 = street_unkn, Traffic separation line
+1, 0x0603 = street_unkn, International maritime boundary
+1, 0x0604 = street_unkn, Straight territorial sea baseline
+1, 0x0605 = street_unkn, Seaward limit of territorial sea
+1, 0x0606 = street_unkn, Anchorage area
+1, 0x0607 = street_unkn, Quarantine anchorage area
+1, 0x0608 = street_unkn, Fishery zone
+1, 0x0609 = street_unkn, Swept area
+1, 0x060a = street_unkn, Traffic separation zone
+1, 0x060b = street_unkn, Limit of exclusive economic zone
+1, 0x060c = street_unkn, Established direction of traffic flow
+1, 0x060d = street_unkn, Recommended direction of traffic flow
+1, 0x060e = street_unkn, Harbour limit
+1, 0x060f = street_unkn, Inadequately surveyed area
+1, 0x0610 = street_unkn, Inshore traffic zone
+1, 0x0611 = street_unkn, Limit of traffic lane
+1, 0x0701 = street_unkn, River channel
+1, 0x0702 = street_unkn, Submerged object
+1, 0x0703 = street_unkn, Submerged object
+1, 0x0704 = street_unkn, Submerged object
+1, 0x0705 = street_unkn, Submerged object
+1, 0x0706 = street_unkn, Chart boundary
+# NT types
+1, 0x0a00 = water_line, River
+1, 0x0a01 = water_line, Small River
+1, 0x0a19 = street_unkn, Dry Creek
+1, 0x0b04 = border_country, Country Border
+
+
+POLYGONE
+0, 0x01 = poly_town, City (>200k)
+0, 0x02 = poly_town, City (<200k)
+0, 0x03 = poly_town, Village
+0, 0x04 = poly_military_zone, Military
+0, 0x05 = poly_car_parking, Parking Lot
+0, 0x06 = poly_car_parking, Parking Garage
+0, 0x07 = poly_airport, Airport
+0, 0x08 = poly_commercial_center, Shopping Center
+0, 0x09 = poly_marine, Marina
+0, 0x0a = poly_university, University/College
+0, 0x0b = poly_hospital, Hospital
+0, 0x0c = poly_industry, Industrial
+0, 0x0d = area, Reservation
+0, 0x0e = poly_airport, Airport Runway
+0, 0x13 = area_unspecified, Man made area
+0, 0x14 = poly_national_park, National park
+0, 0x15 = poly_national_park, National park
+0, 0x16 = poly_nature_park, National park
+0, 0x17 = poly_park, City Park
+0, 0x18 = poly_golf_course, Golf
+0, 0x19 = poly_sport, Sport
+0, 0x1a = poly_cemetery, Cemetery
+0, 0x1e = poly_nature_park, State Park
+0, 0x1f = poly_park, State Park
+0, 0x20 = poly_park, State Park
+0, 0x28 = poly_water, Ocean
+0, 0x29 = poly_water, Water Reservour
+0, 0x32 = poly_water, Sea
+0, 0x3b = poly_water, Water Reservour
+0, 0x3c = poly_water, Lake (250-600 km2)
+0, 0x3d = poly_water, Lake (77-250 km2)
+0, 0x3e = poly_water, Lake (25-77 km2)
+0, 0x3f = poly_water, Lake (11-25 km2)
+0, 0x40 = poly_water, Lake (0.25-11 km2)
+0, 0x41 = poly_water, Lake (<0.25 km2)
+0, 0x42 = poly_water, Lake (>3.3k km2)
+0, 0x43 = poly_water, Lake (1.1-3.3k km2)
+0, 0x44 = poly_water, Lake (0.6-1.1k km2)
+0, 0x45 = poly_water, Water Reservour
+0, 0x46 = poly_water, River (>1km)
+0, 0x47 = poly_water, River (200m-1km)
+0, 0x48 = poly_water, River (40-200m)
+0, 0x49 = poly_water, River (<40m)
+0, 0x4a = area, Definition Area
+0, 0x4b = area, Background
+0, 0x4c = poly_water, Intermittent River/Lake
+0, 0x4d = poly_glacier, Glaciers
+0, 0x4e = plantation, Orchard or plantation
+0, 0x4f = poly_scrub, Scrub
+0, 0x50 = poly_wood, Woods
+0, 0x51 = poly_wetland, Wetland
+0, 0x52 = tundra, Tundra
+0, 0x53 = poly_flats, Flats
+# RGN2-4
+# Marine
+1, 0x0100 = street_unkn, Land - white
+1, 0x0101 = street_unkn, Land - non-urban
+1, 0x0102 = street_unkn, Land - urban
+1, 0x0103 = street_unkn, Chart exclusion area
+1, 0x0104 = street_unkn, Chart background
+1, 0x0105 = street_unkn, Bridge
+1, 0x0300 = street_unkn, Depth area - white 1
+1, 0x0301 = street_unkn, Intertidal zone
+1, 0x0302 = street_unkn, Depth area - blue 1
+1, 0x0303 = street_unkn, Depth area - blue 2
+1, 0x0304 = street_unkn, Depth area - blue 3
+1, 0x0305 = street_unkn, Depth area - blue 4
+1, 0x0306 = street_unkn, Depth area - blue 5
+1, 0x0307 = street_unkn, Depth area - white
+1, 0x0400 = street_unkn, Obstruction (invisible)
+1, 0x0401 = street_unkn, Submarine cable (invisible)
+1, 0x0402 = street_unkn, Submarine pipeline (invisible)
+1, 0x0403 = street_unkn, Pile barrier (invisible)
+1, 0x0404 = street_unkn, Fishing stakes (invisible)
+1, 0x0405 = street_unkn, Supply pipeline area/line (invisible)
+1, 0x0406 = street_unkn, Submarine cable area/line (invisible)
+1, 0x0407 = street_unkn, Dumping ground (invisible)
+1, 0x0408 = street_unkn, Explosive dumping ground (invisible)
+1, 0x0409 = street_unkn, Danger line (invisible)
+1, 0x040a = street_unkn, Overhead cable (invisible)
+1, 0x040b = street_unkn, Submerged construction (invisible)
+1, 0x040c = street_unkn, Pier/jetty (invisible)
+1, 0x0500 = street_unkn, Restriction area/line (invisible)
+1, 0x0501 = street_unkn, Anchoring prohibited (invisible)
+1, 0x0502 = street_unkn, Fishing prohibited (invisible)
+1, 0x0503 = street_unkn, Prohibited area (invisible)
+1, 0x0504 = street_unkn, Military practice area (invisible)
+1, 0x0505 = street_unkn, Anchoring and fishing prohibited (invisible)
+1, 0x0506 = street_unkn, Limit of nature reservation (invisible)
+1, 0x0507 = street_unkn, Restricted area (invisible)
+1, 0x0508 = street_unkn, Minefield (invisible)
+1, 0x0600 = street_unkn, Miscellaneous area
+1, 0x0601 = street_unkn, Cartographic area
+1, 0x0602 = street_unkn, Traffic separation area
+1, 0x0603 = street_unkn, International maritime boundary
+1, 0x0604 = street_unkn, Straight territorial sea baseline
+1, 0x0605 = street_unkn, Seaward limit of territorial sea
+1, 0x0606 = street_unkn, Anchorage area
+1, 0x0607 = street_unkn, Quarantine anchorage area
+1, 0x0608 = street_unkn, Fishery zone
+1, 0x0609 = street_unkn, Swept area
+1, 0x060a = street_unkn, Traffic separation zone
+1, 0x060b = street_unkn, Limit of exclusive economic zone
+1, 0x060c = street_unkn, Established direction of traffic flow
+1, 0x0701 = street_unkn, Fishing area
+1, 0x0702 = street_unkn, Restricted area
+1, 0x0703 = street_unkn, Anchorage area
+1, 0x0704 = street_unkn, Fishing Hot Spots chart
+# NT types
+1, 0x0800 = poly_town, Large City
+1, 0x0801 = poly_town, City
+1, 0x0900 = poly_plaza, Square/Place
+1, 0x0902 = poly_car_parking, Car Park (Parking Lot)
+1, 0x0904 = poly_airport, Airport
+1, 0x090d = poly_sports_stadium, Stage like circus/sport/stadium
+1, 0x090e = poly_cemetery, Graveyard/Cemetery
+1, 0x0a01 = poly_national_park, National Park
+1, 0x0a04 = poly_park, City Park
+1, 0x0a05 = poly_nature_park, Nature Park
+1, 0x0a06 = street_unkn, Dam/Man made/ ??
+1, 0x0b02 = poly_water, Sea
+1, 0x0b03 = poly_water, Water Reservour
+1, 0x0b07 = poly_water, Dam/Lake
+1, 0x0b08 = poly_water, Dam/Lake
+1, 0x0b0c = poly_water, River
diff --git a/map/garmin/gentypes.c b/map/garmin/gentypes.c
new file mode 100644
index 00000000..16682a55
--- /dev/null
+++ b/map/garmin/gentypes.c
@@ -0,0 +1,148 @@
+/*
+ Copyright (C) 2007 Alexander Atanasov <aatanasov@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; version 2 of the License.
+
+ 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, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301 USA
+
+ Garmin and MapSource are registered trademarks or trademarks
+ of Garmin Ltd. or one of its subsidiaries.
+
+*/
+
+/*
+File format is:
+
+POINT
+GROUP,0x0100 = town_label_1e5, Megapolis (10M +)
+GROUP,0x0200 = town_label_5e4, Megapolis (5-10M)
+...
+GROUP,0x1e00-0x1e3f = district_label, District, Province, State Name
+...
+POLYLINE
+GROUP,0x00 = street_1_land, Road
+GROUP,0x01 = highway_land, Major HWY thick
+GROUP,0x02 = street_4_land, Principal HWY-thick
+GROUP,0x03 = street_2_land, Principal HWY-medium
+....
+POLYGONE
+GROUP,0x01 = town_poly, City (>200k)
+GROUP,0x02 = town_poly, City (<200k)
+GROUP,0x03 = town_poly, Village
+
+GROUP is
+0 - good old garmin types in RGN1
+1 - NT types in RGN2-4 5 is completely unknown yet
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <malloc.h>
+#include <unistd.h>
+#include "item.h"
+#include "gar2navit.h"
+
+#define dlog(x, y...) fprintf(stderr, ## y)
+/*
+static int add_def(struct gar2nav_conv *conv, int type, unsigned short minid,
+ unsigned short maxid, unsigned int routable, char *ntype,
+ char *descr)
+*/
+
+static void print_header(FILE *fp)
+{
+ fprintf(fp, "// This is autogenerated file -- DO NOT EDIT\n");
+ fprintf(fp, "struct gar2nav_conv *g2n_default_conv(void)\n"
+ "{\n"
+ "\tstruct gar2nav_conv *conv;\n"
+ "\n"
+ "\tconv = calloc(1, sizeof(*conv));\n"
+ "\tif (!conv)\n"
+ "\t\treturn conv;\n");
+}
+
+static int load_types_file(char *file, char *out)
+{
+ char buf[4096];
+ char descr[4096];
+ char ntype[4096];
+ FILE *fp;
+ unsigned int minid, maxid, group;
+ int rc;
+ int type = -1;
+ FILE *fpout = stdout;
+
+ fp = fopen(file, "r");
+ if (!fp)
+ return -1;
+ if (out) {
+ fpout = fopen(out, "w");
+ if (!fpout)
+ return -1;
+ }
+ print_header(fpout);
+ while (fgets(buf, sizeof(buf), fp)) {
+ if (*buf == '#' || *buf == '\n')
+ continue;
+ if (!strncasecmp(buf, "POINT", 5)) {
+ type = 1;
+ continue;
+ } else if (!strncasecmp(buf, "POI", 3)) {
+ type = 1;
+ continue;
+ } else if (!strncasecmp(buf, "POLYLINE", 8)) {
+ type = 2;
+ continue;
+ } else if (!strncasecmp(buf, "POLYGONE", 8)) {
+ type = 3;
+ continue;
+ }
+
+ rc = sscanf(buf, "%d, 0x%04X - 0x%04X = %[^\t , ] , %[^\n]",
+ &group, &minid, &maxid, ntype, descr);
+ if (rc != 5) {
+ maxid = 0;
+ rc = sscanf(buf, "%d, 0x%04X = %[^\t, ], %[^\n]",
+ &group,&minid, ntype, descr);
+ if (rc != 4) {
+ dlog(1, "Invalid line rc=%d:[%s]\n",rc, buf);
+ dlog(1, "minid=%04X ntype=[%s] des=[%s]\n",
+ minid, ntype, descr);
+ continue;
+ }
+ }
+
+ fprintf(fpout, "\tadd_def(conv, %d, %#.04x, %#.04x, %d, \"%s\", \"%s\");\n",
+ type, minid, maxid, group, ntype, descr);
+ }
+ fprintf(fpout, "\treturn conv;\n");
+ fprintf(fpout, "}\n");
+ fclose(fp);
+ if (out)
+ fclose(fpout);
+ return 1;
+}
+
+int main(int argc, char **argv)
+{
+ if (argc!=3) {
+ fprintf(stderr, "Usage: %s garmintypes.txt outfile.c\n",
+ argv[0]);
+ return -1;
+ }
+ if (load_types_file(argv[1], argv[2]) < 0) {
+ unlink(argv[2]);
+ return -1;
+ }
+ return 0;
+}
diff --git a/map/garmin_img/Makefile.am b/map/garmin_img/Makefile.am
new file mode 100644
index 00000000..dbbcd9b5
--- /dev/null
+++ b/map/garmin_img/Makefile.am
@@ -0,0 +1,5 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=map_garmin_img
+modulemap_LTLIBRARIES = libmap_garmin_img.la
+libmap_garmin_img_la_SOURCES = garmin_img.c
+libmap_garmin_img_la_LDFLAGS = -module -avoid-version
diff --git a/map/garmin_img/garmin_img.c b/map/garmin_img/garmin_img.c
new file mode 100644
index 00000000..58fe489d
--- /dev/null
+++ b/map/garmin_img/garmin_img.c
@@ -0,0 +1,1513 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include "config.h"
+#include "plugin.h"
+#include "data.h"
+#include "projection.h"
+#include "map.h"
+#include "maptype.h"
+#include "item.h"
+#include "attr.h"
+#include "coord.h"
+#include "transform.h"
+#include <stdio.h>
+#include "attr.h"
+#include "coord.h"
+
+struct file {
+ FILE *f;
+ int offset;
+};
+
+
+int shift=5;
+int subdiv_next=0x10;
+
+
+static void *
+file_read(struct file *f, int offset, int size)
+{
+ void *ptr;
+ int ret;
+
+ ptr=calloc(size, 1);
+ if (! ptr)
+ return ptr;
+ fseek(f->f, f->offset+offset, SEEK_SET);
+ ret=fread(ptr, size, 1, f->f);
+ if (ret != 1) {
+ printf("fread %d vs %d offset %d+%d(0x%x)\n", ret, size, f->offset, offset,offset);
+ g_assert(1==0);
+ }
+ return ptr;
+}
+
+static void
+file_free(void *ptr)
+{
+ free(ptr);
+}
+
+struct offset_len {
+ int offset;
+ int length;
+} __attribute ((packed));
+
+static void
+dump_offset_len(struct offset_len *off_len)
+{
+ printf("offset: 0x%x(%d) length 0x%x(%d)\n", off_len->offset, off_len->offset, off_len->length, off_len->length);
+}
+
+struct timestamp {
+ short creation_year;
+ char creation_month;
+ char creation_day;
+ char creation_hour;
+ char creation_minute;
+ char creation_second;
+} __attribute__((packed));
+
+struct img_header {
+ char xor;
+ char zero1[9];
+ char update_month;
+ char update_year;
+ char zero2[3];
+ char checksum[1];
+ char signature[7];
+ char unknown1[1];
+ char unknown2[2];
+ char unknown3[2];
+ char unknown4[2];
+ char unknown5[2];
+ char zero3[25];
+ struct timestamp ts;
+ char unknown6;
+ char map_file_identifier[7];
+ char unknown12;
+ char map_description1[20];
+ short unknown13;
+ short unknown14;
+ char e1;
+ char e2;
+ char other[413];
+ char zero4[512];
+ char unknown7;
+ char unknown8[11];
+ int file_offset;
+ char unknown9;
+ char unknown10[15];
+ char unknown11[480];
+} __attribute__((packed));
+
+static void
+dump_ts(struct timestamp *ts)
+{
+ printf("%d-%02d-%02d %02d:%02d:%02d\n", ts->creation_year, ts->creation_month, ts->creation_day, ts->creation_hour, ts->creation_minute, ts->creation_second);
+}
+
+#if 0
+static void
+dump_img(struct img_header *img_hdr)
+{
+ printf("signature: '%s'\n", img_hdr->signature);
+ printf("creation: ");
+ dump_ts(&img_hdr->ts);
+ printf("map_file_identifier: '%s'\n", img_hdr->map_file_identifier);
+ printf("file_offset: 0x%x\n", img_hdr->file_offset);
+ printf("e1: 0x%x(%d)\n", img_hdr->e1, img_hdr->e1);
+ printf("e2: 0x%x(%d)\n", img_hdr->e2, img_hdr->e2);
+ printf("offset 0x%x\n", (int) &img_hdr->e1 - (int) img_hdr);
+ printf("size %d\n", sizeof(*img_hdr));
+}
+#endif
+
+struct fat_block {
+ char flag;
+ char filename[8];
+ char type[3];
+ int size;
+ char zero1;
+ char part;
+ char zero[14];
+ unsigned short blocks[240];
+} __attribute__((packed));
+
+#if 0
+static void
+dump_fat_block(struct fat_block *fat_blk)
+{
+ int i=0;
+ char name[9];
+ char type[4];
+ printf("flag: 0x%x(%d)\n", fat_blk->flag, fat_blk->flag);
+ strcpy(name, fat_blk->filename);
+ name[8]='\0';
+ strcpy(type, fat_blk->type);
+ type[3]='\0';
+ printf("name: '%s.%s'\n", name, type);
+ printf("size: 0x%x(%d)\n", fat_blk->size, fat_blk->size);
+ printf("part: 0x%x(%d)\n", fat_blk->part, fat_blk->part);
+ printf("blocks: ");
+ while (i < 240) {
+ printf("0x%x(%d) ",fat_blk->blocks[i], fat_blk->blocks[i]);
+ if (fat_blk->blocks[i] == 0xffff)
+ break;
+ i++;
+ }
+ printf("size: %d\n", sizeof(*fat_blk));
+
+}
+#endif
+
+struct file_header {
+ short header_len;
+ char type[10];
+ char unknown1;
+ char unknown2;
+ struct timestamp ts;
+} __attribute__((packed));
+
+static void
+dump_file(struct file_header *fil_hdr)
+{
+ printf("header_len: %d\n", fil_hdr->header_len);
+ printf("type: '%s'\n", fil_hdr->type);
+ printf("unknown1: 0x%x(%d)\n", fil_hdr->unknown1, fil_hdr->unknown1);
+ printf("unknown2: 0x%x(%d)\n", fil_hdr->unknown2, fil_hdr->unknown2);
+ printf("creation: ");
+ dump_ts(&fil_hdr->ts);
+ printf("size %d\n", sizeof(*fil_hdr));
+}
+
+struct region_header {
+ struct file_header fil_hdr;
+ struct offset_len offset_len;
+} __attribute__((packed));
+
+#if 0
+static void
+dump_region(struct region_header *rgn_hdr)
+{
+ dump_offset_len(&rgn_hdr->offset_len);
+}
+#endif
+
+struct map_priv {
+ int id;
+ char *filename;
+};
+
+struct map_rect_priv {
+ struct coord_rect r;
+ int limit;
+
+ struct file tre;
+ struct tree_header *tre_hdr;
+ struct file rgn;
+ struct region_header *rgn_hdr;
+ struct file lbl;
+ struct label_header *lbl_hdr;
+ char *label;
+
+ int subdiv_level_count;
+ int subdiv_pos;
+ char *subdiv;
+
+ int rgn_offset;
+ int rgn_end;
+ struct rgn_point *pnt;
+ struct rgn_poly *ply;
+ unsigned char *ply_data;
+ int ply_bitpos;
+ int ply_bitcount;
+ int ply_lngbits;
+ int ply_latbits;
+ int ply_lng;
+ int ply_lat;
+ int ply_lnglimit;
+ int ply_latlimit;
+ int ply_lngsign;
+ int ply_latsign;
+ struct offset_len rgn_items[4];
+ int rgn_type;
+
+ int count;
+
+ FILE *f;
+ long pos;
+ char line[256];
+ int attr_pos;
+ enum attr_type attr_last;
+ char attrs[256];
+ char attr[256];
+ double lat,lng;
+ char lat_c,lng_c;
+ int eoc;
+ struct map_priv *m;
+ struct item item;
+};
+
+static int map_id;
+
+static int
+contains_coord(char *line)
+{
+ return g_ascii_isdigit(line[0]);
+}
+
+static int debug=1;
+
+static int
+get_tag(char *line, char *name, int *pos, char *ret)
+{
+ int len,quoted;
+ char *p,*e,*n;
+
+ if (debug)
+ printf("get_tag %s from %s\n", name, line);
+ if (! name)
+ return 0;
+ len=strlen(name);
+ if (pos)
+ p=line+*pos;
+ else
+ p=line;
+ for(;;) {
+ while (*p == ' ') {
+ p++;
+ }
+ if (! *p)
+ return 0;
+ n=p;
+ e=index(p,'=');
+ if (! e)
+ return 0;
+ p=e+1;
+ quoted=0;
+ while (*p) {
+ if (*p == ' ' && !quoted)
+ break;
+ if (*p == '"')
+ quoted=1-quoted;
+ p++;
+ }
+ if (e-n == len && !strncmp(n, name, len)) {
+ e++;
+ len=p-e;
+ if (e[0] == '"') {
+ e++;
+ len-=2;
+ }
+ strncpy(ret, e, len);
+ ret[len]='\0';
+ if (pos)
+ *pos=p-line;
+ return 1;
+ }
+ }
+ return 0;
+}
+
+static void
+get_line(struct map_rect_priv *mr)
+{
+ mr->pos=ftell(mr->f);
+ fgets(mr->line, 256, mr->f);
+}
+
+static void
+map_destroy_garmin_img(struct map_priv *m)
+{
+ if (debug)
+ printf("map_destroy_garmin_img\n");
+ g_free(m);
+}
+
+static char *
+map_charset_garmin_img(struct map_priv *m)
+{
+ return "iso8859-1";
+}
+
+static enum projection
+map_projection_garmin_img(struct map_priv *m)
+{
+ return projection_garmin;
+}
+
+struct label_data_offset {
+ struct offset_len offset_len;
+ char multiplier;
+ char data;
+} __attribute ((packed));
+
+#if 0
+static void
+dump_label_data_offset(struct label_data_offset *lbl_dat)
+{
+ dump_offset_len(&lbl_dat->offset_len);
+ printf("multiplier 0x%x(%d)\n", lbl_dat->multiplier, lbl_dat->multiplier);
+ printf("data 0x%x(%d)\n", lbl_dat->data, lbl_dat->data);
+}
+#endif
+
+struct label_data {
+ struct offset_len offset_len;
+ short size;
+ int zero;
+} __attribute ((packed));
+
+static void
+dump_label_data(struct label_data *lbl_dat)
+{
+ dump_offset_len(&lbl_dat->offset_len);
+ printf("size 0x%x(%d)\n", lbl_dat->size, lbl_dat->size);
+}
+
+struct tree_header {
+ struct file_header fil_hdr;
+ char boundary[12];
+ struct offset_len level;
+ struct offset_len subdivision;
+ struct label_data copyright;
+ struct offset_len tre7;
+ short unknown1;
+ char zero1;
+ struct label_data polyline;
+ struct label_data polygon;
+ struct label_data point;
+ int mapid;
+};
+
+static void
+dump_tree_header(struct tree_header *tre_hdr)
+{
+ printf("tree_header:\n");
+ dump_file(&tre_hdr->fil_hdr);
+ printf("level: "); dump_offset_len(&tre_hdr->level);
+ printf("subdivision: "); dump_offset_len(&tre_hdr->subdivision);
+ printf("copyright: "); dump_label_data(&tre_hdr->copyright);
+ printf("polyline: "); dump_label_data(&tre_hdr->polyline);
+ printf("polygon: "); dump_label_data(&tre_hdr->polygon);
+ printf("point: "); dump_label_data(&tre_hdr->point);
+ printf("len: 0x%x(%d)\n", sizeof(*tre_hdr), sizeof(*tre_hdr));
+}
+
+struct label_header {
+ struct file_header fil_hdr;
+ struct label_data_offset label;
+ struct label_data country;
+ struct label_data region;
+ struct label_data city;
+ struct label_data poi_index;
+ struct label_data_offset poi_properties;
+ short zero1;
+ char zero2;
+ struct label_data poi_types;
+ struct label_data zip;
+ struct label_data hway;
+ struct label_data exit;
+ struct label_data hway_data;
+ int unknown1;
+ short unknown2;
+ struct offset_len sort_descriptor;
+ struct label_data lbl13;
+ struct label_data lbl14;
+} __attribute((packed));
+
+#if 0
+static void
+dump_label(struct label_header *lbl_hdr)
+{
+ dump_file(&lbl_hdr->fil_hdr);
+ printf("label:\n");
+ dump_label_data_offset(&lbl_hdr->label);
+ printf("country:\n");
+ dump_label_data(&lbl_hdr->country);
+ printf("region:\n");
+ dump_label_data(&lbl_hdr->region);
+ printf("city:\n");
+ dump_label_data(&lbl_hdr->city);
+ printf("poi_index:\n");
+ dump_label_data(&lbl_hdr->poi_index);
+ printf("poi_properties:\n");
+ dump_label_data_offset(&lbl_hdr->poi_properties);
+ printf("poi_types:\n");
+ dump_label_data(&lbl_hdr->poi_types);
+ printf("zip:\n");
+ dump_label_data(&lbl_hdr->zip);
+ printf("hway:\n");
+ dump_label_data(&lbl_hdr->hway);
+ printf("exit:\n");
+ dump_label_data(&lbl_hdr->exit);
+ printf("hway_data:\n");
+ dump_label_data(&lbl_hdr->hway_data);
+ printf("lbl13:\n");
+ dump_label_data(&lbl_hdr->lbl13);
+ printf("lbl14:\n");
+ dump_label_data(&lbl_hdr->lbl14);
+ printf("len: 0x%x(%d)\n", sizeof(*lbl_hdr), sizeof(*lbl_hdr));
+}
+#endif
+
+struct triple {
+ unsigned char data[3];
+} __attribute((packed));
+
+static unsigned int
+triple_u(struct triple *t)
+{
+ return t->data[0] | (t->data[1] << 8) | (t->data[2] << 16);
+}
+
+static int
+triple(struct triple *t)
+{
+ int ret=t->data[0] | (t->data[1] << 8) | (t->data[2] << 16);
+ if (ret > 1<<23)
+ ret=ret-(1<<24);
+ return ret;
+}
+
+static void
+dump_triple_u(struct triple *t)
+{
+ int val=triple_u(t);
+ printf("0x%x(%d)\n", val, val);
+}
+
+struct tcoord {
+ struct triple lng,lat;
+} __attribute((packed));
+
+static void
+dump_tcoord(struct tcoord *t)
+{
+ printf ("0x%x(%d),0x%x(%d)\n", triple_u(&t->lng), triple_u(&t->lng), triple_u(&t->lat), triple_u(&t->lat));
+}
+
+struct level {
+ unsigned char zoom;
+ unsigned char bits_per_coord;
+ unsigned short subdivisions;
+} __attribute((packed));
+
+static void
+dump_level(struct level *lvl)
+{
+ printf("level:\n");
+ printf("\tzoom 0x%x(%d)\n", lvl->zoom, lvl->zoom);
+ printf("\tbits_per_coord 0x%x(%d)\n", lvl->bits_per_coord, lvl->bits_per_coord);
+ printf("\tsubdivisions 0x%x(%d)\n", lvl->subdivisions, lvl->subdivisions);
+}
+
+struct subdivision {
+ struct triple rgn_offset;
+ unsigned char types;
+ struct tcoord center;
+ unsigned short width;
+ unsigned short height;
+ unsigned short next;
+} __attribute((packed));
+
+static void
+dump_subdivision(struct subdivision *sub)
+{
+ printf("subdivision:\n");
+ printf("\trgn_offset: "); dump_triple_u(&sub->rgn_offset);
+ printf("\ttypes: 0x%x(%d)\n", sub->types, sub->types);
+ printf("\tcenter: "); dump_tcoord(&sub->center);
+ printf("\tsize: 0x%x(%d)x0x%x(%d) %s\n",sub->width & 0x7fff, sub->width & 0x7fff, sub->height, sub->height, sub->width & 0x8000 ? "Terminating" : "");
+ printf("\tnext: 0x%x(%d)\n",sub->next, sub->next);
+
+ printf("\tlen: 0x%x(%d)\n", sizeof(*sub), sizeof(*sub));
+}
+
+struct rgn_point {
+ unsigned char info;
+ struct triple lbl_offset;
+ short lng_delta;
+ short lat_delta;
+ unsigned char subtype;
+} __attribute((packed));
+
+static void
+dump_point(struct rgn_point *pnt)
+{
+ printf("point:\n");
+ printf("\tinfo 0x%x(%d)\n", pnt->info, pnt->info);
+ printf("\tlbl_offset 0x%x(%d)\n", triple_u(&pnt->lbl_offset), triple_u(&pnt->lbl_offset));
+ printf("\tlng_delta 0x%x(%d)\n", pnt->lng_delta, pnt->lng_delta);
+ printf("\tlat_delta 0x%x(%d)\n", pnt->lat_delta, pnt->lat_delta);
+ printf("\tsubtype 0x%x(%d)\n", pnt->subtype, pnt->subtype);
+ printf("\tlen: 0x%x(%d)\n", sizeof(*pnt), sizeof(*pnt));
+}
+
+struct rgn_poly {
+ unsigned char info;
+ struct triple lbl_offset;
+ short lng_delta;
+ short lat_delta;
+ union {
+ struct {
+ unsigned char bitstream_len;
+ unsigned char bitstream_info;
+ } __attribute((packed)) p1;
+ struct {
+ unsigned short bitstream_len;
+ unsigned char bitstream_info;
+ } __attribute((packed)) p2;
+ } __attribute((packed)) u;
+} __attribute((packed));
+
+static void
+dump_poly(struct rgn_poly *ply)
+{
+ printf("poly:\n");
+ printf("\tinfo 0x%x(%d)\n", ply->info, ply->info);
+ printf("\tlbl_offset 0x%x(%d)\n", triple_u(&ply->lbl_offset), triple_u(&ply->lbl_offset));
+ printf("\tlng_delta 0x%x(%d)\n", ply->lng_delta, ply->lng_delta);
+ printf("\tlat_delta 0x%x(%d)\n", ply->lat_delta, ply->lat_delta);
+ if (ply->info & 0x80) {
+ printf("\tbitstream_len 0x%x(%d)\n", ply->u.p2.bitstream_len, ply->u.p2.bitstream_len);
+ printf("\tbitstream_info 0x%x(%d)\n", ply->u.p2.bitstream_info, ply->u.p2.bitstream_info);
+ } else {
+ printf("\tbitstream_len 0x%x(%d)\n", ply->u.p1.bitstream_len, ply->u.p1.bitstream_len);
+ printf("\tbitstream_info 0x%x(%d)\n", ply->u.p1.bitstream_info, ply->u.p1.bitstream_info);
+ }
+ printf("\tlen: 0x%x(%d)\n", sizeof(*ply), sizeof(*ply));
+}
+
+static void
+dump_hex(void *ptr, int len)
+{
+ unsigned char *c=ptr;
+ while (len--) {
+ printf("%02x ", *c++);
+ }
+ printf("\n");
+}
+
+static void
+dump_hex_r(void *ptr, int len, int rec)
+{
+ unsigned char *c=ptr;
+ int l=rec;
+ while (len--) {
+ printf("%02x ", *c++);
+ if (! --l) {
+ printf("\n");
+ l=rec;
+ }
+ }
+ printf("\n");
+}
+
+#if 0
+static void
+dump_label_offset(struct map_rect_priv *mr, int offset)
+{
+ void *p;
+ p=file_read(&mr->lbl, mr->lbl_hdr->label.offset_len.offset+offset, 128);
+ printf("%s\n", (char *)p);
+}
+#endif
+
+
+#if 0
+static void
+dump_region_item(struct subdivision *sub, struct file *rgn, struct map_rect_priv *mr)
+{
+ int offset,item_offset,i,j;
+ unsigned short count=0;
+ unsigned short *offsets[4];
+ unsigned short *file_offsets;
+ struct rgn_point *pnt;
+
+ offset=triple_u(&sub->rgn_offset)+mr->rgn_hdr->offset_len.offset;
+ file_offsets=file_read(rgn, offset, 90*sizeof(unsigned short));
+ printf("0x%x ", offset); dump_hex(file_offsets, 90);
+ for (i=0 ; i < 4 ; i++) {
+ printf("i=%d\n", i);
+ if (sub->types & (0x10 << i)) {
+ if (count) {
+ offsets[i]=&file_offsets[count-1];
+ } else
+ offsets[i]=&count;
+ count++;
+ } else
+ offsets[i]=NULL;
+
+ }
+ count--;
+ count*=2;
+ for (i=0 ; i < 4 ; i++) {
+ printf("i=%d\n", i);
+ if (offsets[i]) {
+ printf("offset[%d]=0x%x(%d)\n", i, *offsets[i], *offsets[i]);
+ switch (i) {
+ case 0:
+ printf("point\n");
+ break;
+ case 1:
+ printf("indexed point\n");
+ break;
+ case 2:
+ printf("polyline\n");
+ break;
+ case 3:
+ printf("polygon\n");
+ break;
+ }
+ item_offset=offset+*offsets[i];
+ switch (i) {
+ case 0:
+ case 1:
+ for (j = 0 ; j < 10 ; j++) {
+ struct coord_geo g;
+ char buffer[1024];
+ double conv=180.0/(1UL<<23);
+ pnt=file_read(rgn, item_offset, sizeof(*pnt)*20);
+ // printf("0x%x ", item_offset); dump_hex(pnt, 32);
+ dump_point(pnt);
+ g.lng=(triple(&sub->center.lng)+(pnt->lng_delta << shift))*conv;
+ g.lat=(triple(&sub->center.lat)+(pnt->lat_delta << shift))*conv;
+ printf("%f %f\n", g.lng, g.lat);
+ coord_format(g.lat,g.lng,DEGREES_MINUTES_SECONDS,
+ buffer,sizeof(buffer));
+ printf("%s\n", buffer);
+ dump_label_offset(mr, triple_u(&pnt->lbl_offset));
+ if (pnt->info & 0x80)
+ item_offset+=sizeof(*pnt);
+ else
+ item_offset+=sizeof(*pnt)-1;
+ }
+ }
+ } else {
+ printf("offset[%d] doesn't exist\n", i);
+ }
+ }
+ file_free(file_offsets);
+}
+
+#endif
+
+static void
+dump_levels(struct map_rect_priv *mr)
+{
+ int i,offset;
+ struct level *lvl;
+
+ offset=mr->tre_hdr->level.offset;
+ for (i = 0 ; i < mr->tre_hdr->level.length/sizeof(*lvl) ; i++) {
+ lvl=file_read(&mr->tre, offset, sizeof(*lvl));
+ dump_level(lvl);
+ offset+=sizeof(*lvl);
+ }
+}
+
+#if 0
+static void
+dump_tree(struct file *f, struct file *rgn, struct map_rect_priv *mr)
+{
+ struct tree_header *tre_hdr;
+ struct subdivision *sub;
+ int i,offset;
+
+ tre_hdr=file_read(f, 0, sizeof(*tre_hdr));
+ dump_tree_header(tre_hdr);
+ offset=tre_hdr->subdivision.offset;
+ sub=file_read(f, offset, sizeof(*sub));
+ dump_subdivision(sub);
+ offset+=sizeof(*sub);
+ for (i = 1 ; i < tre_hdr->subdivision.length/sizeof(*sub) ; i++) {
+ printf("i=%d\n", i);
+ sub=file_read(f, offset, sizeof(*sub));
+ dump_subdivision(sub);
+ dump_region_item(sub, rgn, mr);
+ if (sub->width & 0x8000)
+ break;
+ offset+=sizeof(*sub);
+ }
+ file_free(tre_hdr);
+}
+#endif
+
+#if 0
+static void
+dump_labels(struct file *f)
+{
+ struct label_header *lbl_hdr;
+
+ lbl_hdr=file_read(f, 0, sizeof(*lbl_hdr));
+ printf("**labels**\n");
+ dump_label(lbl_hdr);
+ file_free(lbl_hdr);
+#if 0
+ labels=alloca(lbl_hdr.label_length);
+ file_read(f, lbl_hdr.label_offset, labels, lbl_hdr.label_length);
+ l=labels;
+ while (l < labels+lbl_hdr.label_length) {
+ printf("'%s'(%d)\n", l, strlen(l));
+ l+=strlen(l)+1;
+ }
+#endif
+
+}
+#endif
+
+static void
+garmin_img_coord_rewind(void *priv_data)
+{
+}
+
+static void
+parse_line(struct map_rect_priv *mr)
+{
+ int pos=0;
+ sscanf(mr->line,"%lf %c %lf %c %n",&mr->lat,&mr->lat_c,&mr->lng,&mr->lng_c,&pos);
+ if (pos < strlen(mr->line)) {
+ strcpy(mr->attrs, mr->line+pos);
+ }
+}
+
+static int
+get_bits(struct map_rect_priv *mr, int bits)
+{
+ unsigned long ret;
+ ret=L(*((unsigned long *)(mr->ply_data+mr->ply_bitpos/8)));
+ ret >>= (mr->ply_bitpos & 7);
+ ret &= (1 << bits)-1;
+ mr->ply_bitpos+=bits;
+ return ret;
+}
+
+static int
+garmin_img_coord_get(void *priv_data, struct coord *c, int count)
+{
+ struct map_rect_priv *mr=priv_data;
+ struct subdivision *sub=(struct subdivision *)(mr->subdiv+mr->subdiv_pos);
+ int ret=0;
+ int debug=0;
+ if (debug)
+ printf("garmin_img_coord_get %d\n",count);
+ if (debug)
+ dump_subdivision(sub);
+ while (count--) {
+ if (mr->rgn_type < 2) {
+ c->x=triple(&sub->center.lng)+(mr->pnt->lng_delta << shift);
+ c->y=triple(&sub->center.lat)+(mr->pnt->lat_delta << shift);
+ } else {
+ if (! mr->ply_bitpos) {
+ if (mr->ply->info & 0x80) {
+ mr->ply_bitcount=mr->ply->u.p2.bitstream_len*8;
+ mr->ply_lngbits=mr->ply->u.p2.bitstream_info & 0xf;
+ mr->ply_latbits=mr->ply->u.p2.bitstream_info >> 4;
+ } else {
+ mr->ply_bitcount=mr->ply->u.p1.bitstream_len*8;
+ mr->ply_lngbits=mr->ply->u.p1.bitstream_info & 0xf;
+ mr->ply_latbits=mr->ply->u.p1.bitstream_info >> 4;
+ }
+ if (mr->ply_lngbits <= 9)
+ mr->ply_lngbits+=2;
+ if (mr->ply_latbits <= 9)
+ mr->ply_latbits+=2;
+ if (! get_bits(mr,1)) {
+ mr->ply_lngbits+=1;
+ mr->ply_lngsign=0;
+ } else
+ if (get_bits(mr, 1))
+ mr->ply_lngsign=-1;
+ else
+ mr->ply_lngsign=1;
+ if (! get_bits(mr,1)) {
+ mr->ply_latbits+=1;
+ mr->ply_latsign=0;
+ } else
+ if (get_bits(mr, 1))
+ mr->ply_latsign=-1;
+ else
+ mr->ply_latsign=1;
+ mr->ply_lnglimit=1 << (mr->ply_lngbits-1);
+ mr->ply_latlimit=1 << (mr->ply_latbits-1);
+ mr->ply_lng=mr->ply->lng_delta;
+ mr->ply_lat=mr->ply->lat_delta;
+ if (debug)
+ printf("lngbits %d latbits %d bitcount %d\n", mr->ply_lngbits, mr->ply_latbits, mr->ply_bitcount);
+ c->x=0;
+ c->y=0;
+ } else {
+ if (mr->ply_bitpos + mr->ply_lngbits + mr->ply_latbits > mr->ply_bitcount) {
+ if (debug)
+ printf("out of bits %d + %d + %d >= %d\n", mr->ply_bitpos, mr->ply_lngbits, mr->ply_latbits, mr->ply_bitcount);
+ return ret;
+ }
+ c->x=0;
+ c->y=0;
+ int x,y;
+ for (;;) {
+ x=get_bits(mr,mr->ply_lngbits);
+ if (debug)
+ printf("x %d ", x);
+ if (mr->ply_lngsign || x != mr->ply_lnglimit)
+ break;
+ c->x += x-1;
+ }
+ if (mr->ply_lngsign) {
+ c->x=x*mr->ply_lngsign;
+ } else {
+ if (x >= mr->ply_lnglimit)
+ c->x = x - (mr->ply_lnglimit << 1) - c->x;
+ else
+ c->x +=x;
+ }
+ for (;;) {
+ y=get_bits(mr,mr->ply_latbits);
+ if (debug)
+ printf("y %d ", y);
+ if (mr->ply_latsign || y != mr->ply_latlimit)
+ break;
+ c->y += y-1;
+ }
+ if (mr->ply_latsign) {
+ c->y=y*mr->ply_latsign;
+ } else {
+ if (y >= mr->ply_latlimit)
+ c->y = y - (mr->ply_latlimit << 1) - c->y;
+ else
+ c->y +=y;
+ }
+ mr->ply_lng += c->x;
+ mr->ply_lat += c->y;
+ }
+ if (debug)
+ printf(": x %d y %d\n", c->x, c->y);
+
+ c->x=triple(&sub->center.lng)+(mr->ply_lng << shift);
+ c->y=triple(&sub->center.lat)+(mr->ply_lat << shift);
+ }
+#if 0
+ c->x-=0x6f160;
+ c->y-=0x181f59;
+ c->x+=0x168ca1;
+ c->y+=0x68d815;
+#endif
+ c++;
+ ret++;
+ if (mr->rgn_type < 2)
+ return ret;
+ }
+ return ret;
+}
+
+static char *
+get_label_offset(struct map_rect_priv *mr, int offset)
+{
+ g_assert(offset < mr->lbl_hdr->label.offset_len.length);
+ return file_read(&mr->lbl, mr->lbl_hdr->label.offset_len.offset+offset, 128);
+}
+
+static void
+garmin_img_attr_rewind(void *priv_data)
+{
+}
+
+static int
+garmin_img_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
+{
+ struct map_rect_priv *mr=priv_data;
+ int debug=0;
+
+ if (debug)
+ printf("garmin_img_attr_get\n");
+ if (attr_type == attr_label) {
+ if (debug)
+ printf("garmin_img_attr_get label\n");
+ attr->type=attr_type;
+ if (mr->rgn_type < 2) {
+ if (mr->label)
+ file_free(mr->label);
+ mr->label=get_label_offset(mr, triple_u(&mr->pnt->lbl_offset) & 0x3fffff);
+ attr->u.str=mr->label;
+ } else {
+ attr->u.str="";
+ }
+ return 1;
+ }
+ return 0;
+}
+
+static struct item_methods methods_garmin_img = {
+ garmin_img_coord_rewind,
+ garmin_img_coord_get,
+ garmin_img_attr_rewind,
+ garmin_img_attr_get,
+};
+
+static int rgn_next_type(struct map_rect_priv *mr)
+{
+ while (mr->rgn_type < 3) {
+ mr->rgn_type++;
+ if (mr->rgn_items[mr->rgn_type].offset && mr->rgn_items[mr->rgn_type].length != 0) {
+ mr->rgn_offset=mr->rgn_items[mr->rgn_type].offset;
+ mr->rgn_end=mr->rgn_offset+mr->rgn_items[mr->rgn_type].length;
+ return 0;
+ }
+ }
+ return 1;
+}
+
+static int
+sub_next(struct map_rect_priv *mr, int next)
+{
+ int i,offset,first=-1,last=-1,count=-1;
+ int end;
+ unsigned short *offsets;
+ int debug=0;
+
+ if (mr->subdiv_level_count <= 0)
+ return 1;
+ if (debug)
+ printf("%d left\n", mr->subdiv_level_count);
+ mr->subdiv_level_count--;
+
+#if 0
+ if (next && mr->subdiv[mr->subdiv_current].width & 0x8000)
+ return 1;
+#endif
+ if (debug)
+ dump_hex_r(mr->subdiv+mr->subdiv_pos, 64, 14);
+ mr->subdiv_pos+=next;
+ if (debug)
+ printf("subdiv_pos 0x%x\n", mr->subdiv_pos);
+ if (mr->subdiv_pos > mr->tre_hdr->subdivision.length)
+ return 1;
+ struct subdivision *sub=(struct subdivision *)(mr->subdiv+mr->subdiv_pos);
+ offset=triple_u(&sub->rgn_offset)+mr->rgn_hdr->offset_len.offset;
+ if (debug) {
+ printf("offset=0x%x\n", offset);
+ dump_subdivision(sub);
+ }
+ offsets=file_read(&mr->rgn, offset, 3*sizeof(unsigned short));
+
+ if (! next)
+ next=subdiv_next;
+ if (mr->subdiv_pos+next < mr->tre_hdr->subdivision.length)
+ end=triple_u(&((struct subdivision *)(mr->subdiv+mr->subdiv_pos+next))->rgn_offset)+mr->rgn_hdr->offset_len.offset;
+ else
+ end=mr->rgn_hdr->offset_len.offset+mr->rgn_hdr->offset_len.length;
+ if (debug) {
+ dump_subdivision(sub);
+ dump_hex(offsets, 6);
+ }
+ for (i=0 ; i < 4 ; i++) {
+ if (debug)
+ printf("i=%d ", i);
+ if (sub->types & (0x10 << i)) {
+ if (debug)
+ printf("+ ");
+ if (first == -1) {
+ first=i;
+ mr->rgn_items[i].offset=offset;
+ if (debug)
+ printf("\n");
+ } else {
+ mr->rgn_items[i].offset=offset+offsets[count];
+ if (debug)
+ printf("0x%x\n", offsets[count]);
+ mr->rgn_items[last].length=mr->rgn_items[i].offset-mr->rgn_items[last].offset;
+ }
+ last=i;
+ count++;
+ } else {
+ if (debug)
+ printf("-\n");
+ mr->rgn_items[i].offset=0;
+ mr->rgn_items[i].length=0;
+ }
+
+ }
+ if (first != -1) {
+ mr->rgn_items[first].offset+=count*2;
+ mr->rgn_items[first].length-=count*2;
+ mr->rgn_items[last].length=end-mr->rgn_items[last].offset;
+ }
+ if (debug) {
+ for (i=0 ; i < 4 ; i++) {
+ printf("%d 0x%x 0x%x\n", i, mr->rgn_items[i].offset, mr->rgn_items[i].length);
+ }
+ }
+ mr->rgn_type=-1;
+ rgn_next_type(mr);
+ if (debug)
+ printf("*** offset 0x%x\n", mr->rgn_offset);
+ file_free(offsets);
+ return 0;
+}
+
+int item_count;
+
+static struct map_rect_priv *
+map_rect_new_garmin_img(struct map_priv *map, struct coord_rect *r, struct layer *layers, int limit)
+{
+ struct map_rect_priv *mr;
+ struct img_header img;
+
+ if (debug)
+ printf("map_rect_new_garmin_img\n");
+ mr=g_new0(struct map_rect_priv, 1);
+ mr->m=map;
+ if (r)
+ mr->r=*r;
+ mr->limit=limit;
+ mr->item.id_hi=0;
+ mr->item.id_lo=0;
+ mr->item.meth=&methods_garmin_img;
+ mr->item.priv_data=mr;
+ mr->f=fopen(map->filename, "r");
+
+ fread(&img, sizeof(img), 1, mr->f);
+#if 0
+ dump_img(&img);
+ for (i = 0 ; i < (img.file_offset-sizeof(img))/sizeof(fat_blk) ; i++) {
+ fread(&fat_blk, sizeof(fat_blk), 1, mr->f);
+ if (!fat_blk.flag)
+ break;
+ dump_fat_block(&fat_blk);
+ }
+#endif
+ mr->rgn.offset=0xa*2048;
+ mr->rgn.f=mr->f;
+ mr->rgn_hdr=file_read(&mr->rgn, 0, sizeof(*mr->rgn_hdr));
+
+ mr->tre.offset=0x62b*2048;
+ mr->tre.f=mr->f;
+ mr->tre_hdr=file_read(&mr->tre, 0, sizeof(*mr->tre_hdr));
+
+ mr->lbl.offset=0x64a*2048;
+ mr->lbl.f=mr->f;
+ mr->lbl_hdr=file_read(&mr->lbl, 0, sizeof(*mr->lbl_hdr));
+
+ mr->subdiv=file_read(&mr->tre, mr->tre_hdr->subdivision.offset, mr->tre_hdr->subdivision.length);
+#if 0
+ dump_hex_r(mr->subdiv, mr->tre_hdr->subdivision.length, 16);
+#endif
+ dump_tree_header(mr->tre_hdr);
+
+ dump_levels(mr);
+
+
+ printf("limit=%d\n", limit);
+ if (limit < 3) {
+ mr->subdiv_pos=0;
+ mr->subdiv_level_count=1;
+ shift=11;
+ } else if (limit < 6) {
+ mr->subdiv_pos=1*sizeof(struct subdivision);
+ mr->subdiv_level_count=5;
+ shift=9;
+ } else if (limit < 8) {
+ mr->subdiv_pos=6*sizeof(struct subdivision);
+ mr->subdiv_level_count=9;
+ shift=7;
+ } else if (limit < 10) {
+ mr->subdiv_pos=15*sizeof(struct subdivision);
+ mr->subdiv_level_count=143;
+ shift=5;
+ } else {
+ mr->subdiv_pos=158*sizeof(struct subdivision);
+ mr->subdiv_level_count=4190;
+ shift=2;
+ subdiv_next=14;
+ }
+
+#if 0
+ mr->rgn_offset=triple_u(&mr->subdiv[mr->subdiv_current].rgn_offset)+mr->rgn_hdr->offset_len.offset+4;
+ mr->rgn_type=1;
+ mr->rgn_end=mr->rgn_offset+20*8;
+#endif
+ mr->count=0;
+ item_count=0;
+
+#if 0
+ printf("*** offset 0x%x\n", 0x656c-mr->rgn.offset);
+ printf("*** offset 0x%x\n", mr->rgn_offset);
+#endif
+#if 1
+ sub_next(mr, 0);
+#endif
+#if 0
+ {
+ struct rgn_point *pnt;
+ int i;
+ int offset=0x65cc;
+ for (i = 0 ; i < 26 ; i++) {
+ pnt=file_read(&mr->rgn, 0x656c+8*i-mr->rgn.offset, sizeof(*pnt));
+ // dump_hex(pnt, sizeof(*pnt));
+ dump_point(pnt);
+ dump_label_offset(mr, triple_u(&pnt->lbl_offset));
+ }
+ }
+ exit(0);
+#endif
+#if 0
+ dump_tree(&mr->tre,&mr->rgn,mr);
+#endif
+
+#if 0
+ f.offset=0x64a*2048;
+ f.f=mr->f;
+ dump_labels(&f);
+#endif
+#if 0
+ fseek(mr->f, img.file_offset, SEEK_SET);
+ fread(&fil, sizeof(fil), 1, mr->f);
+ dump_file(&fil);
+ fread(&rgn, sizeof(rgn), 1, mr->f);
+ dump_region(&rgn);
+ fseek(mr->f, rgn.data_length, SEEK_CUR);
+ fread(&fil, sizeof(fil), 1, mr->f);
+ dump_file(&fil);
+#endif
+ return mr;
+}
+
+
+static void
+map_rect_destroy_garmin_img(struct map_rect_priv *mr)
+{
+ fclose(mr->f);
+ g_free(mr);
+}
+
+
+static struct item *
+map_rect_get_item_garmin_img(struct map_rect_priv *mr)
+{
+ char *p,type[256];
+ int ptype;
+ int debug=0;
+
+ item_count++;
+
+ if (debug)
+ printf("map_rect_get_item_garmin_img\n");
+ for (;;) {
+ if (mr->rgn_offset < mr->rgn_end) {
+ if (debug)
+ printf("data available\n");
+ if (mr->rgn_type >= 2) {
+ int len;
+ if (debug)
+ printf("polyline %d\n", mr->count);
+ if (mr->ply)
+ file_free(mr->ply);
+ mr->ply=file_read(&mr->rgn, mr->rgn_offset, sizeof(*mr->ply)*3);
+ if(triple_u(&mr->ply->lbl_offset) >= mr->lbl_hdr->label.offset_len.length) {
+ printf("item_count %d\n", item_count);
+ dump_poly(mr->ply);
+ dump_hex(mr->ply, 32);
+ printf("%d vs %d\n", triple_u(&mr->ply->lbl_offset), mr->lbl_hdr->label.offset_len.length);
+ }
+ g_assert(triple_u(&mr->ply->lbl_offset) < mr->lbl_hdr->label.offset_len.length);
+ if (debug) {
+ dump_hex(mr->ply, 16);
+ dump_poly(mr->ply);
+ }
+ if (mr->ply_data)
+ file_free(mr->ply_data);
+ mr->rgn_offset+=10;
+ if (mr->ply->info & 0x80) {
+ mr->rgn_offset++;
+ len=mr->ply->u.p2.bitstream_len;
+ } else
+ len=mr->ply->u.p1.bitstream_len;
+
+ mr->ply_data=file_read(&mr->rgn, mr->rgn_offset, len);
+ mr->rgn_offset += len;
+ mr->ply_bitpos=0;
+ // dump_hex(mr->ply_data, 32);
+ if (mr->rgn_type == 3) {
+ switch(mr->ply->info & 0x7f) {
+ case 0x1: /* large urban area (>200k) */
+ mr->item.type=type_town_poly;
+ break;
+ case 0xd: /* reservation */
+ mr->item.type=type_park_poly;
+ break;
+ case 0xe: /* airport runway */
+ mr->item.type=type_airport_poly;
+ break;
+ case 0x14: /* national park */
+ mr->item.type=type_park_poly;
+ break;
+ case 0x32: /* sea */
+ case 0x3d: /* large lake (77-250km2) */
+ case 0x4c: /* intermittend water */
+ mr->item.type=type_water_poly;
+ break;
+ case 0x4b: /* background */
+ continue;
+ default:
+ printf("unknown polygon: 0x%x\n", mr->ply->info);
+ mr->item.type=type_street_3_city;
+ }
+ } else {
+ switch(mr->ply->info & 0x3f) {
+ case 0x1: /* major highway */
+ mr->item.type=type_highway_land;
+ break;
+ case 0x2: /* principal highway */
+ mr->item.type=type_street_3_land;
+ break;
+ case 0x6: /* residental street */
+ mr->item.type=type_street_2_land;
+ break;
+ case 0x16: /* walkway/trail */
+ mr->item.type=type_street_1_land;
+ break;
+ case 0x1e: /* international boundary */
+ mr->item.type=type_border_country;
+ break;
+ case 0x20: /* minor land contour 1/10 */
+ mr->item.type=type_height_line_1;
+ break;
+ case 0x21: /* major land contour 1/2 */
+ mr->item.type=type_height_line_2;
+ break;
+ default:
+ printf("unknown polyline: 0x%x\n", mr->ply->info);
+ mr->item.type=type_street_3_city;
+ }
+ }
+ return &mr->item;
+ }
+ if (mr->pnt)
+ file_free(mr->pnt);
+ mr->pnt=file_read(&mr->rgn, mr->rgn_offset, sizeof(*mr->pnt));
+ mr->item.type=type_none;
+ int subtype=mr->pnt->subtype;
+ if (mr->pnt->lbl_offset.data[2] & 0x80)
+ mr->rgn_offset+=9;
+ else {
+ mr->rgn_offset+=8;
+ subtype=0;
+ }
+ switch(mr->pnt->info) {
+ case 0x3: /* large city 2-5M */
+ mr->item.type=type_town_label_2e6;
+ break;
+ case 0xa: /* small city/town 10-20k */
+ mr->item.type=type_town_label_1e4;
+ break;
+ case 0xd: /* settlement 1-2K */
+ mr->item.type=type_town_label_1e3;
+ break;
+ case 0x11: /* settlement less 100 */
+ mr->item.type=type_town_label_5e1;
+ break;
+ case 0x1c:
+ switch(subtype) {
+ case 0x01:
+ mr->item.type=type_poi_wreck;
+ break;
+ }
+ break;
+ case 0x20:
+ mr->item.type=type_highway_exit;
+ break;
+ case 0x25:
+ mr->item.type=type_poi_toll_booth;
+ break;
+ case 0x2b:
+ switch(subtype) {
+ case 0x01:
+ mr->item.type=type_poi_hotel;
+ break;
+ case 0x03:
+ mr->item.type=type_poi_camp_rv;
+ break;
+ }
+ break;
+ case 0x2c:
+ switch(subtype) {
+ case 0x00:
+ mr->item.type=type_poi_attraction;
+ break;
+ case 0x02:
+ mr->item.type=type_poi_museum_history;
+ break;
+ }
+ break;
+ case 0x2e:
+ mr->item.type=type_poi_shopping;
+ break;
+ case 0x2f:
+ switch(subtype) {
+ case 0x01:
+ mr->item.type=type_poi_fuel;
+ break;
+ case 0x07:
+ mr->item.type=type_poi_car_dealer_parts;
+ break;
+ case 0x0b:
+ mr->item.type=type_poi_car_parking;
+ break;
+ case 0x15:
+ mr->item.type=type_poi_public_utilities;
+ break;
+ }
+ break;
+ case 0x30:
+ switch(subtype) {
+ case 0x02:
+ mr->item.type=type_poi_hospital;
+ break;
+ }
+ break;
+ case 0x43:
+ mr->item.type=type_poi_marina;
+ break;
+ case 0x46:
+ mr->item.type=type_poi_bar;
+ break;
+ case 0x48:
+ mr->item.type=type_poi_camping;
+ break;
+ case 0x49:
+ mr->item.type=type_poi_park;
+ break;
+ case 0x4a:
+ mr->item.type=type_poi_picnic;
+ break;
+ case 0x59: /* airport */
+ mr->item.type=type_poi_airport;
+ break;
+ case 0x64:
+ switch(subtype) {
+ case 0x1:
+ mr->item.type=type_poi_bridge;
+ break;
+ case 0x2:
+ mr->item.type=type_poi_building;
+ break;
+ case 0x15:
+ mr->item.type=type_town_ghost;
+ break;
+ }
+ break;
+ case 0x65:
+ switch(subtype) {
+ case 0x0:
+ mr->item.type=type_poi_water_feature;
+ break;
+ case 0xc:
+ mr->item.type=type_poi_island;
+ break;
+ case 0xd:
+ mr->item.type=type_poi_lake;
+ break;
+ }
+ break;
+ case 0x66:
+ switch(subtype) {
+ case 0x0:
+ mr->item.type=type_poi_land_feature;
+ break;
+ case 0x6:
+ mr->item.type=type_poi_cape;
+ break;
+ case 0x14:
+ mr->item.type=type_poi_rock;
+ break;
+ }
+ break;
+ }
+ if (mr->item.type == type_none) {
+ printf("unknown point: 0x%x 0x%x\n", mr->pnt->info, mr->pnt->subtype);
+ dump_point(mr->pnt);
+ printf("label: %s\n", get_label_offset(mr, triple_u(&mr->pnt->lbl_offset) & 0x3fffff));
+ mr->item.type=type_town_label;
+ }
+ return &mr->item;
+ }
+ if (debug)
+ printf("out of data for type\n");
+ if (rgn_next_type(mr)) {
+ if (debug)
+ printf("out of data for region\n");
+ if (sub_next(mr, subdiv_next)) {
+ if (debug)
+ printf("out of data for subdivision\n");
+ return NULL;
+ }
+ }
+ }
+}
+
+static struct item *
+map_rect_get_item_byid_garmin_img(struct map_rect_priv *mr, int id_hi, int id_lo)
+{
+ fseek(mr->f, id_lo, SEEK_SET);
+ get_line(mr);
+ mr->item.id_hi=id_hi;
+ return map_rect_get_item_garmin_img(mr);
+}
+
+static struct map_methods map_methods_garmin_img = {
+ projection_garmin,
+ "iso8859-1",
+ map_destroy_garmin_img,
+ map_charset_garmin_img,
+ map_projection_garmin_img,
+ map_rect_new_garmin_img,
+ map_rect_destroy_garmin_img,
+ map_rect_get_item_garmin_img,
+ map_rect_get_item_byid_garmin_img,
+};
+
+static struct map_priv *
+map_new_garmin_img(struct map_methods *meth, struct attr **attrs)
+{
+ struct map_priv *m;
+ struct attr *data=attr_search(attrs, NULL, attr_data);
+ if (! data)
+ return NULL;
+
+ *meth=map_methods_garmin_img;
+ m=g_new(struct map_priv, 1);
+ m->id=++map_id;
+ m->filename=g_strdup(data->u.str);
+ return m;
+}
+
+void
+plugin_init(void)
+{
+ plugin_register_map_type("garmin_img", map_new_garmin_img);
+}
+
diff --git a/map/mg/Makefile.am b/map/mg/Makefile.am
new file mode 100644
index 00000000..7fcef2de
--- /dev/null
+++ b/map/mg/Makefile.am
@@ -0,0 +1,9 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=map_mg
+if PLUGINS
+ modulemap_LTLIBRARIES = libmap_mg.la
+else
+ noinst_LTLIBRARIES = libmap_mg.la
+endif
+libmap_mg_la_SOURCES = map.c block.c town.c tree.c poly.c street.c mg.h
+libmap_mg_la_LDFLAGS = -module -avoid-version
diff --git a/map/mg/block.c b/map/mg/block.c
new file mode 100644
index 00000000..98886572
--- /dev/null
+++ b/map/mg/block.c
@@ -0,0 +1,298 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "debug.h"
+#include "mg.h"
+
+
+int block_lin_count,block_idx_count,block_active_count,block_mem,block_active_mem;
+
+struct block_index_item {
+ /*unsigned int blocknum;
+ unsigned int blocks;*/
+ unsigned char p[8];
+};
+static inline unsigned int block_index_item_get_blocknum(struct block_index_item * blk) { unsigned char *p = blk->p; return get_u32(&p); }
+static inline unsigned int block_index_item_get_blocks(struct block_index_item * blk) { unsigned char *p = blk->p+4; return get_u32(&p); }
+
+struct block_index {
+/* unsigned int blocks;
+ unsigned int size;
+ unsigned int next;
+ struct block_index_item list[0];*/
+ unsigned char p[12];
+};
+static inline unsigned int block_index_get_blocks(struct block_index * blk) { unsigned char *p = blk->p; return get_u32(&p); }
+static inline unsigned int block_index_get_size(struct block_index * blk) { unsigned char *p = blk->p+4; return get_u32(&p); }
+static inline unsigned int block_index_get_next(struct block_index * blk) { unsigned char *p = blk->p+8; return get_u32(&p); }
+static inline struct block_index_item * block_index_get_list(struct block_index * blk) { return (struct block_index_item *)(blk->p+12); }
+
+static struct block *
+block_get(unsigned char **p)
+{
+ struct block *ret=(struct block *)(*p);
+ *p += sizeof(*ret);
+ return ret;
+}
+
+
+static struct block *
+block_get_byid(struct file *file, int id, unsigned char **p_ret)
+{
+ struct block_index *blk_idx;
+ int blk_num,max;
+
+
+ blk_idx=(struct block_index *)(file->begin+0x1000);
+ max=(block_index_get_size(blk_idx)-sizeof(struct block_index))/sizeof(struct block_index_item);
+ block_mem+=24;
+ while (id >= max) {
+ blk_idx=(struct block_index *)(file->begin+block_index_get_next(blk_idx)*512);
+ id-=max;
+ }
+ blk_num=block_index_item_get_blocknum(&block_index_get_list(blk_idx)[id]);
+
+ *p_ret=file->begin+blk_num*512;
+ return block_get(p_ret);
+}
+
+int
+block_get_byindex(struct file *file, int idx, struct block_priv *blk)
+{
+ dbg(1,"idx=%d\n", idx);
+ blk->b=block_get_byid(file, idx, &blk->p);
+ blk->block_start=(unsigned char *)(blk->b);
+ blk->p_start=blk->p;
+ blk->end=blk->block_start+block_get_size(blk->b);
+
+ return 1;
+}
+
+static void
+block_setup_tags(struct map_rect_priv *mr)
+{
+ int len;
+ unsigned char *p,*t;
+ char *str;
+
+ mr->b.binarytree=0;
+
+ p=mr->file->begin+0x0c;
+ while (*p) {
+ str=get_string(&p);
+ len=get_u32_unal(&p);
+ t=p;
+ /* printf("String '%s' len %d\n", str, len); */
+ if (! strcmp(str,"FirstBatBlock")) {
+ /* printf("%ld\n", get_u32_unal(&t)); */
+ } else if (! strcmp(str,"MaxBlockSize")) {
+ /* printf("%ld\n", get_u32_unal(&t)); */
+ } else if (! strcmp(str,"FREE_BLOCK_LIST")) {
+ /* printf("%ld\n", get_u32_unal(&t)); */
+ } else if (! strcmp(str,"TotalRect")) {
+ mr->b.b_rect.lu.x=get_u32_unal(&t);
+ mr->b.b_rect.lu.y=get_u32_unal(&t);
+ mr->b.b_rect.rl.x=get_u32_unal(&t);
+ mr->b.b_rect.rl.y=get_u32_unal(&t);
+ /* printf("0x%x,0x%x-0x%x,0x%x\n", mr->b.b_rect.lu.x, mr->b.b_rect.lu.y, mr->b.b_rect.rl.x, mr->b.b_rect.rl.y); */
+ } else if (! strcmp(str,"Version")) {
+ /* printf("0x%lx\n", get_u32_unal(&t)); */
+ } else if (! strcmp(str,"Categories")) {
+ /* printf("0x%x\n", get_u16(&t)); */
+ } else if (! strcmp(str,"binaryTree")) {
+ mr->b.binarytree=get_u32_unal(&t);
+ /* printf("%d\n", mr->b.binarytree); */
+ } else if (! strcmp(str,"CategorySets")) {
+ /* printf("0x%x\n", get_u16(&t)); */
+ } else if (! strcmp(str,"Kommentar")) {
+ /* printf("%s\n", get_string(&t)); */
+ }
+ p+=len;
+ }
+}
+
+#if 0
+static void
+block_rect_print(struct coord_rect *r)
+{
+ printf ("0x%x,0x%x-0x%x,0x%x (0x%x,0x%x)", r->lu.x, r->lu.y, r->rl.x, r->rl.y, r->lu.x/2+r->rl.x/2,r->lu.y/2+r->rl.y/2);
+}
+#endif
+
+static void
+block_rect_same(struct coord_rect *r1, struct coord_rect *r2)
+{
+ dbg_assert(r1->lu.x==r2->lu.x);
+ dbg_assert(r1->lu.y==r2->lu.y);
+ dbg_assert(r1->rl.x==r2->rl.x);
+ dbg_assert(r1->rl.y==r2->rl.y);
+}
+
+int
+block_init(struct map_rect_priv *mr)
+{
+ mr->b.block_num=-1;
+ mr->b.bt.b=NULL;
+ mr->b.bt.next=0;
+ block_setup_tags(mr);
+ if (mr->b.binarytree) {
+ mr->b.bt.next=mr->b.binarytree;
+ mr->b.bt.p=NULL;
+ mr->b.bt.block_count=0;
+ }
+ if (mr->cur_sel && !coord_rect_overlap(&mr->cur_sel->u.c_rect, &mr->b.b_rect))
+ return 0;
+ return block_next(mr);
+}
+
+
+int
+block_next_lin(struct map_rect_priv *mr)
+{
+ struct coord_rect r;
+ for (;;) {
+ block_lin_count++;
+ block_mem+=sizeof(struct block *);
+ mr->b.block_num++;
+ if (! mr->b.block_num)
+ mr->b.p=mr->file->begin+0x2000;
+ else
+ mr->b.p=mr->b.block_start+block_get_blocks(mr->b.b)*512;
+ if (mr->b.p >= mr->file->end) {
+ dbg(1,"end of blocks %p vs %p\n", mr->b.p, mr->file->end);
+ return 0;
+ }
+ mr->b.block_start=mr->b.p;
+ mr->b.b=block_get(&mr->b.p);
+ mr->b.p_start=mr->b.p;
+ mr->b.end=mr->b.block_start+block_get_size(mr->b.b);
+ if (block_get_count(mr->b.b) == -1) {
+ dbg(1,"empty blocks\n");
+ return 0;
+ }
+ block_get_r(mr->b.b, &r);
+ if (!mr->cur_sel || coord_rect_overlap(&mr->cur_sel->u.c_rect, &r)) {
+ block_active_count++;
+ block_active_mem+=block_get_blocks(mr->b.b)*512-sizeof(struct block *);
+ dbg(1,"block ok\n");
+ return 1;
+ }
+ dbg(2,"block not in cur_sel\n");
+ }
+}
+
+int
+block_next(struct map_rect_priv *mr)
+{
+ int blk_num,coord,r_h,r_w;
+ struct block_bt_priv *bt=&mr->b.bt;
+ struct coord_rect r;
+
+ if (!mr->b.binarytree || ! mr->cur_sel)
+ return block_next_lin(mr);
+ for (;;) {
+ if (! bt->p) {
+ dbg(1,"block 0x%x\n", bt->next);
+ if (bt->next == -1)
+ return 0;
+ bt->b=block_get_byid(mr->file, bt->next, &bt->p);
+ bt->end=(unsigned char *)mr->b.bt.b+block_get_size(mr->b.bt.b);
+ bt->next=block_get_next(bt->b);
+ bt->order=0;
+ dbg(1,"size 0x%x next 0x%x\n", block_get_size(bt->b), block_get_next(bt->b));
+ if (! mr->b.bt.block_count) {
+#if 0
+ if (debug) {
+ printf("idx rect ");
+ block_rect_print(&mr->b.bt.b->r);
+ }
+#endif
+ block_get_r(bt->b, &bt->r);
+ bt->r_curr=bt->r;
+ coord=get_u32(&mr->b.bt.p);
+ } else {
+ bt->p=(unsigned char *)bt->b+0xc;
+ }
+ bt->block_count++;
+ }
+ while (mr->b.bt.p < mr->b.bt.end) {
+ block_idx_count++;
+ blk_num=get_u32(&mr->b.bt.p);
+ coord=get_u32(&mr->b.bt.p);
+ block_mem+=8;
+ dbg(1,"%p vs %p coord 0x%x ", mr->b.bt.end, mr->b.bt.p, coord);
+ dbg(1,"block 0x%x", blk_num);
+
+ r_w=bt->r_curr.rl.x-bt->r_curr.lu.x;
+ r_h=bt->r_curr.lu.y-bt->r_curr.rl.y;
+#if 0
+ if (debug) {
+ printf(" rect1 ");
+ block_rect_print(&bt->r_curr);
+ printf(" %dx%d", r_w, r_h);
+ }
+#endif
+ mr->b.b=NULL;
+ if (blk_num != -1) {
+ block_mem+=8;
+ if (coord_rect_overlap(&mr->cur_sel->u.c_rect, &bt->r_curr)) {
+ mr->b.b=block_get_byid(mr->file, blk_num, &mr->b.p);
+ mr->b.block_num=blk_num;
+ dbg_assert(mr->b.b != NULL);
+ mr->b.block_start=(unsigned char *)(mr->b.b);
+ mr->b.p_start=mr->b.p;
+ mr->b.end=mr->b.block_start+block_get_size(mr->b.b);
+ block_get_r(mr->b.b, &r);
+ block_rect_same(&r, &bt->r_curr);
+ }
+ }
+ if (coord != -1) {
+ bt->stack[bt->stackp]=bt->r_curr;
+ if (r_w > r_h) {
+ bt->r_curr.rl.x=coord;
+ bt->stack[bt->stackp].lu.x=coord+1;
+ } else {
+ bt->r_curr.lu.y=coord;
+ bt->stack[bt->stackp].rl.y=coord+1;
+ }
+ bt->stackp++;
+ dbg_assert(bt->stackp < BT_STACK_SIZE);
+ } else {
+ if (bt->stackp) {
+ bt->stackp--;
+ bt->r_curr=bt->stack[bt->stackp];
+ } else {
+ bt->r_curr=bt->r;
+ bt->order++;
+ if (bt->order > 100)
+ return 0;
+ }
+ }
+ if (mr->b.b) {
+ block_active_count++;
+ block_active_mem+=block_get_blocks(mr->b.b)*512;
+ return 1;
+ }
+ }
+ bt->p=NULL;
+ }
+ return 0;
+}
diff --git a/map/mg/map.c b/map/mg/map.c
new file mode 100644
index 00000000..976d6850
--- /dev/null
+++ b/map/mg/map.c
@@ -0,0 +1,609 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "config.h"
+#include "debug.h"
+#include "plugin.h"
+#include "maptype.h"
+#include "mg.h"
+
+
+GList *maps;
+
+static struct country_isonum {
+ int country;
+ int isonum;
+ int postal_len;
+ char *postal_prefix;
+} country_isonums[]={
+ { 1,203},
+ { 2,703},
+ { 7,674},
+ { 11,233},
+ { 12,268},
+ { 13,428},
+ { 14,440},
+ { 15,498},
+ { 16,643},
+ { 17,804},
+ { 18,112},
+ { 20,818},
+ { 30,300},
+ { 31,528},
+ { 32, 56},
+ { 33,250},
+ { 34,724},
+ { 36,348},
+ { 39,380},
+ { 40,642},
+ { 41,756},
+ { 43, 40},
+ { 44,826},
+ { 45,208},
+ { 46,752},
+ { 47,578},
+ { 48,616},
+ { 49,276,5,"D@@"},
+ { 50,292},
+ { 51,620},
+ { 52,442},
+ { 53,372},
+ { 54,352},
+ { 55, 8},
+ { 56,470},
+ { 57,196},
+ { 58,246},
+ { 59,100},
+ { 61,422},
+ { 62, 20},
+ { 63,760},
+ { 66,682},
+ { 71,434},
+ { 72,376},
+ { 73,275},
+ { 75,438},
+ { 76,504},
+ { 77, 12},
+ { 78,788},
+ { 81,688},
+ { 83,400},
+ { 85,191},
+ { 86,705},
+ { 87, 70},
+ { 89,807},
+ { 90,792},
+ { 93,492},
+ { 94, 31},
+ { 95, 51},
+ { 98,234},
+ { 99,732},
+ {336,774},
+};
+
+struct map_priv * map_new_mg(struct map_methods *meth, struct attr **attrs);
+
+static int map_id;
+
+static char *file[]={
+ [file_border_ply]="border.ply",
+ [file_bridge_ply]="bridge.ply",
+ [file_build_ply]="build.ply",
+ [file_golf_ply]="golf.ply",
+ [file_height_ply]="height.ply",
+ [file_natpark_ply]="natpark.ply",
+ [file_nature_ply]="nature.ply",
+ [file_other_ply]="other.ply",
+ [file_rail_ply]="rail.ply",
+ [file_sea_ply]="sea.ply",
+ [file_street_bti]="street.bti",
+ [file_street_str]="street.str",
+ [file_strname_stn]="strname.stn",
+ [file_town_twn]="town.twn",
+ [file_tunnel_ply]="tunnel.ply",
+ [file_water_ply]="water.ply",
+ [file_woodland_ply]="woodland.ply",
+};
+
+int mg_country_from_isonum(int isonum)
+{
+ int i;
+ for (i = 0 ; i < sizeof(country_isonums)/sizeof(struct country_isonum) ; i++)
+ if (country_isonums[i].isonum == isonum)
+ return country_isonums[i].country;
+ return 0;
+}
+
+int mg_country_to_isonum(int country)
+{
+ int i;
+ for (i = 0 ; i < sizeof(country_isonums)/sizeof(struct country_isonum) ; i++)
+ if (country_isonums[i].country == country)
+ return country_isonums[i].isonum;
+ return 0;
+}
+
+int mg_country_postal_len(int country)
+{
+ int i;
+ for (i = 0 ; i < sizeof(country_isonums)/sizeof(struct country_isonum) ; i++)
+ if (country_isonums[i].country == country)
+ return country_isonums[i].postal_len;
+ return 0;
+}
+
+static char *mg_country_postal_prefix(int isonum)
+{
+ int i;
+ for (i = 0 ; i < sizeof(country_isonums)/sizeof(struct country_isonum) ; i++)
+ if (country_isonums[i].isonum == isonum)
+ return country_isonums[i].postal_prefix;
+ return NULL;
+}
+
+struct item_range town_ranges[]={
+ {type_town_label,type_port_label},
+};
+
+struct item_range street_ranges[]={
+ {type_street_nopass,type_street_unkn},
+};
+
+struct item_range poly_ranges[]={
+ {type_border_country,type_water_line},
+ {type_street_unkn,type_street_unkn},
+ {type_area,type_last},
+};
+
+
+static int
+file_next(struct map_rect_priv *mr)
+{
+ int debug=0;
+
+ for (;;) {
+ mr->current_file++;
+ if (mr->current_file >= file_end)
+ return 0;
+ mr->file=mr->m->file[mr->current_file];
+ if (! mr->file)
+ continue;
+ switch (mr->current_file) {
+ case file_strname_stn:
+ continue;
+ case file_town_twn:
+ if (mr->cur_sel && !map_selection_contains_item_range(mr->cur_sel, 0, town_ranges, sizeof(town_ranges)/sizeof(struct item_range)))
+ continue;
+ break;
+ case file_street_str:
+ if (mr->cur_sel && !map_selection_contains_item_range(mr->cur_sel, 0, street_ranges, sizeof(street_ranges)/sizeof(struct item_range)))
+ continue;
+ break;
+ default:
+ if (mr->cur_sel && !map_selection_contains_item_range(mr->cur_sel, 0, poly_ranges, sizeof(poly_ranges)/sizeof(struct item_range)))
+ continue;
+ break;
+ }
+ if (debug)
+ printf("current file: '%s'\n", file[mr->current_file]);
+ mr->cur_sel=mr->xsel;
+ if (block_init(mr))
+ return 1;
+ }
+}
+
+static void
+map_destroy_mg(struct map_priv *m)
+{
+ int i;
+
+ printf("mg_map_destroy\n");
+ for (i = 0 ; i < file_end ; i++) {
+ if (m->file[i])
+ file_destroy(m->file[i]);
+ }
+}
+
+extern int block_lin_count,block_idx_count,block_active_count,block_mem,block_active_mem;
+
+struct map_rect_priv *
+map_rect_new_mg(struct map_priv *map, struct map_selection *sel)
+{
+ struct map_rect_priv *mr;
+ int i;
+
+ block_lin_count=0;
+ block_idx_count=0;
+ block_active_count=0;
+ block_mem=0;
+ block_active_mem=0;
+ mr=g_new0(struct map_rect_priv, 1);
+ mr->m=map;
+ mr->xsel=sel;
+ mr->current_file=-1;
+ if (sel && sel->next)
+ for (i=0 ; i < file_end ; i++)
+ mr->block_hash[i]=g_hash_table_new(g_int_hash,g_int_equal);
+ file_next(mr);
+ return mr;
+}
+
+
+static struct item *
+map_rect_get_item_mg(struct map_rect_priv *mr)
+{
+ for (;;) {
+ switch (mr->current_file) {
+ case file_town_twn:
+ if (town_get(mr, &mr->town, &mr->item))
+ return &mr->item;
+ break;
+ case file_border_ply:
+ case file_bridge_ply:
+ case file_build_ply:
+ case file_golf_ply:
+ /* case file_height_ply: */
+ case file_natpark_ply:
+ case file_nature_ply:
+ case file_other_ply:
+ case file_rail_ply:
+ case file_sea_ply:
+ /* case file_tunnel_ply: */
+ case file_water_ply:
+ case file_woodland_ply:
+ if (poly_get(mr, &mr->poly, &mr->item))
+ return &mr->item;
+ break;
+ case file_street_str:
+ if (street_get(mr, &mr->street, &mr->item))
+ return &mr->item;
+ break;
+ case file_end:
+ return NULL;
+ default:
+ break;
+ }
+ if (block_next(mr))
+ continue;
+ if (mr->cur_sel->next) {
+ mr->cur_sel=mr->cur_sel->next;
+ if (block_init(mr))
+ continue;
+ }
+ if (file_next(mr))
+ continue;
+ dbg(1,"lin_count %d idx_count %d active_count %d %d kB (%d kB)\n", block_lin_count, block_idx_count, block_active_count, (block_mem+block_active_mem)/1024, block_active_mem/1024);
+ return NULL;
+ }
+}
+
+struct item *
+map_rect_get_item_byid_mg(struct map_rect_priv *mr, int id_hi, int id_lo)
+{
+ mr->current_file = (id_hi >> 16) & 0xff;
+ switch (mr->current_file) {
+ case file_town_twn:
+ if (town_get_byid(mr, &mr->town, id_hi, id_lo, &mr->item))
+ return &mr->item;
+ break;
+ case file_street_str:
+ if (street_get_byid(mr, &mr->street, id_hi, id_lo, &mr->item))
+ return &mr->item;
+ break;
+ default:
+ if (poly_get_byid(mr, &mr->poly, id_hi, id_lo, &mr->item))
+ return &mr->item;
+ break;
+ }
+ return NULL;
+}
+
+
+void
+map_rect_destroy_mg(struct map_rect_priv *mr)
+{
+ int i;
+ for (i=0 ; i < file_end ; i++)
+ if (mr->block_hash[i])
+ g_hash_table_destroy(mr->block_hash[i]);
+ g_free(mr);
+}
+
+static char *
+map_search_mg_convert_special(char *str)
+{
+ char *ret,*c=g_malloc(strlen(str)*2+1);
+
+ ret=c;
+ for (;;) {
+ switch ((unsigned char)(*str)) {
+ case 0xc4:
+ *c++='A';
+ break;
+ case 0xd6:
+ *c++='O';
+ break;
+ case 0xdc:
+ *c++='U';
+ break;
+ case 0xdf:
+ *c++='s';
+ *c++='s';
+ break;
+ case 0xe4:
+ *c++='a';
+ break;
+ case 0xf6:
+ *c++='o';
+ break;
+ case 0xfc:
+ *c++='u';
+ break;
+ default:
+ dbg(1,"0x%x\n", *str);
+ *c++=*str;
+ break;
+ }
+ if (! *str)
+ return ret;
+ str++;
+ }
+}
+
+static int
+map_search_setup(struct map_rect_priv *mr)
+{
+ char *prefix;
+ dbg(1,"%s\n", attr_to_name(mr->search_type));
+ switch (mr->search_type) {
+ case attr_town_postal:
+ if (mr->search_item.type != type_country_label) {
+ dbg(0,"wrong parent type %s\n", item_to_name(mr->search_item.type));
+ return 0;
+ }
+ prefix=mg_country_postal_prefix(mr->search_item.id_lo);
+ if (! prefix)
+ return 0;
+ tree_search_init(mr->m->dirname, "town.b1", &mr->ts, 0);
+ mr->current_file=file_town_twn;
+ mr->search_str=g_strdup_printf("%s%s",prefix,mr->search_attr->u.str);
+ dbg(0,"search_str='%s'\n",mr->search_str);
+ mr->search_country=mg_country_from_isonum(mr->search_item.id_lo);
+ break;
+ case attr_town_name:
+ if (mr->search_item.type != type_country_label) {
+ dbg(0,"wrong parent type %s\n", item_to_name(mr->search_item.type));
+ return 0;
+ }
+ tree_search_init(mr->m->dirname, "town.b2", &mr->ts, 0x1000);
+ mr->current_file=file_town_twn;
+ mr->search_str=map_search_mg_convert_special(mr->search_attr->u.str);
+ mr->search_country=mg_country_from_isonum(mr->search_item.id_lo);
+ break;
+ case attr_district_name:
+ if (mr->search_item.type != type_country_label) {
+ dbg(0,"wrong parent type %s\n", item_to_name(mr->search_item.type));
+ return 0;
+ }
+ tree_search_init(mr->m->dirname, "town.b3", &mr->ts, 0x1000);
+ mr->current_file=file_town_twn;
+ mr->search_str=map_search_mg_convert_special(mr->search_attr->u.str);
+ mr->search_country=mg_country_from_isonum(mr->search_item.id_lo);
+ break;
+ case attr_street_name:
+ if (mr->search_item.type != type_town_streets) {
+ GList *tmp=maps;
+ struct item *item=NULL;
+ struct attr attr;
+ struct map_rect_priv *mr2;
+ while (tmp) {
+ mr2=map_rect_new_mg(tmp->data, NULL);
+ item=map_rect_get_item_byid_mg(mr2, mr->search_item.id_hi, mr->search_item.id_lo);
+ if (item)
+ break;
+ map_rect_destroy_mg(mr2);
+ tmp=g_list_next(tmp);
+ }
+ if (item) {
+ if (item_attr_get(item, attr_town_streets_item, &attr)) {
+ mr->search_item=*attr.u.item;
+ map_rect_destroy_mg(mr2);
+ } else {
+ map_rect_destroy_mg(mr2);
+ return 0;
+ }
+ } else {
+ dbg(0,"wrong parent type %s %p 0x%x 0x%x\n", item_to_name(mr->search_item.type), item, mr->search_item.id_hi, mr->search_item.id_lo);
+ return 0;
+ }
+ }
+ dbg(1,"street_assoc=0x%x\n", mr->search_item.id_lo);
+ tree_search_init(mr->m->dirname, "strname.b1", &mr->ts, 0);
+ mr->current_file=file_strname_stn;
+ mr->search_str=g_strdup(mr->search_attr->u.str);
+ break;
+ case attr_house_number:
+ if (!map_priv_is(mr->search_item.map, mr->m))
+ return 0;
+ if (!housenumber_search_setup(mr)) {
+ dbg(0,"failed to search for attr_house_number\n");
+ return 0;
+ }
+ break;
+ default:
+ dbg(0,"unknown search %s\n",attr_to_name(mr->search_type));
+ return 0;
+ }
+ mr->file=mr->m->file[mr->current_file];
+ block_init(mr);
+ return 1;
+}
+static void map_search_cleanup(struct map_rect_priv *mr);
+
+static struct item * map_search_get_item_mg(struct map_search_priv *ms);
+
+static struct map_search_priv *
+map_search_new_mg(struct map_priv *map, struct item *item, struct attr *search, int partial)
+{
+ struct map_rect_priv *mr=g_new0(struct map_rect_priv, 1);
+ dbg(1,"searching for %s '%s'\n", attr_to_name(search->type), search->u.str);
+ dbg(1,"id_lo=0x%x\n", item->id_lo);
+ dbg(1,"search=%s\n", search->u.str);
+ mr->m=map;
+ mr->search_attr=attr_dup(search);
+ mr->search_type=search->type;
+ mr->search_item=*item;
+ mr->search_partial=partial;
+ if (search->type == attr_town_or_district_name) {
+ mr->search_type=attr_town_name;
+ mr->search_type_next=attr_district_name;
+ }
+ if (!map_search_setup(mr)) {
+ dbg(1,"map_search_new_mg failed\n");
+ g_free(mr);
+ return NULL;
+ }
+ mr->search_mr_tmp=map_rect_new_mg(map, NULL);
+
+ return (struct map_search_priv *)mr;
+}
+
+static void
+map_search_cleanup(struct map_rect_priv *mr)
+{
+ g_free(mr->search_str);
+ mr->search_str=NULL;
+ tree_search_free(&mr->ts);
+ mr->search_linear=0;
+ mr->search_p=NULL;
+ mr->search_blk_count=0;
+ mr->search_blk_off=NULL;
+ mr->search_block=0;
+}
+
+static void
+map_search_destroy_mg(struct map_search_priv *ms)
+{
+ struct map_rect_priv *mr=(struct map_rect_priv *)ms;
+
+ dbg(1,"mr=%p\n", mr);
+ if (! mr)
+ return;
+ map_search_cleanup(mr);
+ if (mr->search_mr_tmp)
+ map_rect_destroy_mg(mr->search_mr_tmp);
+ attr_free(mr->search_attr);
+ g_free(mr);
+}
+
+static struct item *
+map_search_get_item_mg(struct map_search_priv *ms)
+{
+ struct map_rect_priv *mr=(struct map_rect_priv *)ms;
+ struct item *ret=NULL;
+
+ if (! mr)
+ return NULL;
+ switch (mr->search_type) {
+ case attr_town_postal:
+ case attr_town_name:
+ case attr_district_name:
+ ret=town_search_get_item(mr);
+ break;
+ case attr_street_name:
+ ret=street_search_get_item(mr);
+ break;
+ case attr_house_number:
+ ret=housenumber_search_get_item(mr);
+ break;
+ default:
+ dbg(0,"unknown search %s\n",attr_to_name(mr->search_type));
+ break;
+ }
+ if (!ret && mr->search_type_next != attr_none) {
+ mr->search_type=mr->search_type_next;
+ mr->search_type_next=attr_none;
+ map_search_cleanup(mr);
+ map_search_setup(mr);
+ return map_search_get_item_mg(ms);
+ }
+ return ret;
+}
+
+static struct map_methods map_methods_mg = {
+ projection_mg,
+ "iso8859-1",
+ map_destroy_mg,
+ map_rect_new_mg,
+ map_rect_destroy_mg,
+ map_rect_get_item_mg,
+ map_rect_get_item_byid_mg,
+ map_search_new_mg,
+ map_search_destroy_mg,
+ map_search_get_item_mg,
+};
+
+
+struct map_priv *
+map_new_mg(struct map_methods *meth, struct attr **attrs)
+{
+ struct map_priv *m;
+ int i,maybe_missing;
+ struct attr *data=attr_search(attrs, NULL, attr_data);
+ char *filename;
+ struct file_wordexp *wexp;
+ char **wexp_data;
+
+ if (! data)
+ return NULL;
+
+ wexp=file_wordexp_new(data->u.str);
+ wexp_data=file_wordexp_get_array(wexp);
+
+ *meth=map_methods_mg;
+ data=attr_search(attrs, NULL, attr_data);
+
+ m=g_new(struct map_priv, 1);
+ m->id=++map_id;
+ m->dirname=g_strdup(wexp_data[0]);
+ file_wordexp_destroy(wexp);
+ for (i = 0 ; i < file_end ; i++) {
+ if (file[i]) {
+ filename=g_strdup_printf("%s/%s", m->dirname, file[i]);
+ m->file[i]=file_create_caseinsensitive(filename);
+ if (! m->file[i]) {
+ maybe_missing=(i == file_border_ply || i == file_height_ply || i == file_sea_ply);
+ if (! maybe_missing)
+ dbg(0,"Failed to load %s\n", filename);
+ } else
+ file_mmap(m->file[i]);
+ g_free(filename);
+ }
+ }
+ maps=g_list_append(maps, m);
+
+ return m;
+}
+
+void
+plugin_init(void)
+{
+ plugin_register_map_type("mg", map_new_mg);
+}
diff --git a/map/mg/mg.h b/map/mg/mg.h
new file mode 100644
index 00000000..e6febc21
--- /dev/null
+++ b/map/mg/mg.h
@@ -0,0 +1,372 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include "item.h"
+#include "attr.h"
+#include "coord.h"
+#include "data.h"
+#include "projection.h"
+#include "map.h"
+#include "file.h"
+
+struct block_data {
+ struct file *file;
+};
+
+struct block {
+/* int blocks;
+ int size;
+ int next;
+ struct coord_rect r;
+ int count;*/
+ unsigned char p[32];
+};
+static inline int block_get_blocks(struct block * blk) { unsigned char *p = blk->p; return get_u32(&p); }
+static inline int block_get_size(struct block * blk) { unsigned char *p = blk->p+4; return get_u32(&p); }
+static inline int block_get_next(struct block * blk) { unsigned char *p = blk->p+8; return get_u32(&p); }
+static inline int block_get_count(struct block * blk) { unsigned char *p = blk->p+28; return get_u32(&p); }
+static inline void block_get_r(struct block * blk, struct coord_rect * r) { unsigned char *p = blk->p+12; r ->lu.x = get_u32(&p); r ->lu.y = get_u32(&p); r ->rl.x = get_u32(&p); r ->rl.y = get_u32(&p); }
+
+struct item_priv {
+ int cidx;
+ int aidx;
+ unsigned char *cstart,*cp,*cend;
+ unsigned char *astart,*ap,*aend;
+ enum attr_type attr_last;
+ enum attr_type attr_next;
+ struct item item;
+};
+
+struct town_priv {
+ unsigned int id; /*!< Identifier */
+ struct coord c; /*!< Coordinates */
+ char *name; /*!< Name */
+ char *district; /*!< District */
+ char *postal_code1; /*!< Postal code */
+ unsigned char order; /*!< Order (Importance) */
+ unsigned char type; /*!< Type */
+ unsigned short country; /*!< Country */
+ unsigned int unknown2; /*!< Unknown */
+ unsigned char size; /*!< Size of town */
+ unsigned int street_assoc; /*!< Association to streets */
+ unsigned char unknown3; /*!< Unknown */
+ char *postal_code2; /*!< 2nd postal code */
+ unsigned int unknown4; /*!< Unknown */
+
+ int cidx;
+ int aidx;
+ enum attr_type attr_next;
+ char debug[256];
+ char postal[32];
+ struct item town_attr_item;
+};
+
+struct poly_priv {
+ int poly_num;
+ unsigned char *poly_next;
+ int subpoly_num;
+ int subpoly_num_all;
+ unsigned char *subpoly_next;
+ unsigned char *subpoly_start;
+ unsigned char *p;
+ struct coord c[2];
+ char *name;
+ unsigned char order;
+ unsigned char type;
+ unsigned int polys;
+ unsigned int *count;
+ unsigned int count_sum;
+
+ int aidx;
+ enum attr_type attr_next;
+};
+
+struct street_header {
+ /*unsigned char order;
+ int count;*/
+ unsigned char p[5];
+} __attribute__((packed));
+static inline unsigned char street_header_get_order(struct street_header * str) { return *str->p; }
+static inline int street_header_get_count(struct street_header * str) { unsigned char *p = str->p+1; return get_u32_unal(&p); }
+
+struct street_type {
+ /*unsigned char order;
+ unsigned short country;*/
+ unsigned char p[3];
+} __attribute__((packed));
+static inline unsigned char street_type_get_order(struct street_type * str) { return *str->p; }
+static inline unsigned short street_type_get_country(struct street_type * str) { unsigned char *p = str->p+1; return get_u16_unal(&p); }
+
+struct street_header_type {
+ struct street_header *header;
+ int type_count;
+ struct street_type *type;
+};
+
+struct street_str {
+ /*int segid;
+ unsigned char limit;*/ /* 0x03,0x30=One Way,0x33=No Passing */
+ /*unsigned char unknown2;
+ unsigned char unknown3;
+ unsigned char type;
+ unsigned int nameid;*/
+ unsigned char p[12];
+};
+static inline int street_str_get_segid(struct street_str * str) { unsigned char *p = str->p; return get_u32_unal(&p); }
+static inline unsigned char street_str_get_limit(struct street_str * str) { return str->p[4]; }
+static inline unsigned char street_str_get_unknown2(struct street_str * str) { return str->p[5]; }
+static inline unsigned char street_str_get_unknown3(struct street_str * str) { return str->p[6]; }
+static inline unsigned char street_str_get_type(struct street_str * str) { return str->p[7]; }
+static inline unsigned int street_str_get_nameid(struct street_str * str) { unsigned char *p = str->p+8; return get_u32_unal(&p); }
+
+struct street_name_segment {
+ int segid;
+ int country;
+};
+
+struct street_name {
+ int len;
+ int country;
+ int townassoc;
+ char *name1;
+ char *name2;
+ int segment_count;
+ struct street_name_segment *segments;
+ int aux_len;
+ unsigned char *aux_data;
+ int tmp_len;
+ unsigned char *tmp_data;
+};
+
+struct housenumber {
+ int number;
+ char *suffix;
+};
+
+struct street_name_numbers {
+ int len;
+ int tag;
+ int dist;
+ int country;
+ struct coord *c;
+ struct housenumber first;
+ struct housenumber last;
+ int segment_count;
+ struct street_name_segment *segments;
+ int aux_len;
+ unsigned char *aux_data;
+ int tmp_len;
+ unsigned char *tmp_data;
+};
+static inline void street_name_numbers_get_coord(struct street_name_numbers * str, struct coord * c) {
+ unsigned char *p=(unsigned char *)str->c;
+ c->x=get_u32_unal(&p);
+ c->y=get_u32_unal(&p);
+}
+
+struct street_name_number {
+ int len;
+ int tag;
+ struct coord *c;
+ struct housenumber first;
+ struct housenumber last;
+ struct street_name_segment *segment;
+};
+
+
+
+struct street_priv {
+ struct file *name_file;
+ struct street_header *header;
+ int type_count;
+ struct street_type *type;
+ struct street_str *str;
+ struct street_str *str_start;
+ unsigned char *coord_begin;
+ unsigned char *p;
+ unsigned char *p_rewind;
+ unsigned char *end;
+ unsigned char *next;
+ int status;
+ int status_rewind;
+ struct coord_rect ref;
+ int bytes;
+ int more;
+ int flags;
+ int housenumber;
+ int cidx;
+ struct coord hnc[100];
+ struct housenumber hn[100];
+ int hn_count;
+ struct street_name name;
+ struct street_name_numbers name_numbers;
+ struct street_name_number name_number;
+ enum attr_type attr_next;
+ char debug[256];
+ char first_number[32];
+ char last_number[32];
+ char current_number[32];
+ GHashTable *streetname_hash;
+};
+
+enum file_index {
+ file_border_ply=0,
+ file_bridge_ply,
+ file_build_ply,
+ file_golf_ply,
+ file_height_ply,
+ file_natpark_ply,
+ file_nature_ply,
+ file_other_ply,
+ file_rail_ply,
+ file_sea_ply,
+ file_street_bti,
+ file_street_str,
+ file_strname_stn,
+ file_town_twn,
+ file_tunnel_ply,
+ file_water_ply,
+ file_woodland_ply,
+ file_end,
+ file_town_twn_alt1,
+ file_town_twn_alt2,
+ file_street_str_alt1,
+ file_street_str_alt2,
+ file_street_str_alt3,
+ file_street_str_alt4,
+};
+
+struct map_priv {
+ int id;
+ struct file *file[file_end];
+ char *dirname;
+};
+
+#define BT_STACK_SIZE 32
+
+struct block_bt_priv {
+ struct block *b;
+ struct coord_rect r, r_curr;
+ int next;
+ int block_count;
+ struct coord_rect stack[BT_STACK_SIZE];
+ int stackp;
+ int order;
+ unsigned char *p;
+ unsigned char *end;
+};
+
+struct block_priv {
+ int block_num;
+ struct coord_rect b_rect;
+ unsigned char *block_start;
+ struct block *b;
+ unsigned char *p;
+ unsigned char *end;
+ unsigned char *p_start;
+ int binarytree;
+ struct block_bt_priv bt;
+};
+
+struct block_offset {
+/* unsigned short offset;
+ unsigned short block;*/
+ unsigned char p[4];
+};
+static inline unsigned short block_offset_get_offset(struct block_offset * blk) { unsigned char *p = blk->p; return get_u16_unal(&p); }
+static inline unsigned short block_offset_get_block(struct block_offset * blk) { unsigned char *p = blk->p+2; return get_u16_unal(&p); }
+
+struct tree_search_node {
+ struct tree_hdr *hdr;
+ unsigned char *p;
+ unsigned char *last;
+ unsigned char *end;
+ int low;
+ int high;
+ int last_low;
+ int last_high;
+ };
+
+struct tree_search {
+ struct file *f;
+ int last_node;
+ int curr_node;
+ struct tree_search_node nodes[5];
+};
+
+
+struct map_rect_priv {
+ struct map_selection *xsel;
+ struct map_selection *cur_sel;
+
+ struct map_priv *m;
+ enum file_index current_file;
+ struct file *file;
+ struct block_priv b;
+ struct item item;
+ struct town_priv town;
+ struct poly_priv poly;
+ struct street_priv street;
+ struct tree_search ts;
+ int search_country;
+ struct item search_item;
+ struct attr *search_attr;
+ char *search_str;
+ int search_partial;
+ int search_linear;
+ unsigned char *search_p;
+ int search_blk_count;
+ enum attr_type search_type,search_type_next;
+ struct map_rect_priv *search_mr_tmp;
+ struct item *search_item_tmp;
+ struct block_offset *search_blk_off;
+ int search_block;
+ GHashTable *block_hash[file_end];
+ struct item_priv item3;
+};
+
+int mg_country_from_isonum(int isonum);
+int mg_country_to_isonum(int country);
+int mg_country_postal_len(int country);
+
+int block_init(struct map_rect_priv *mr);
+int block_next(struct map_rect_priv *mr);
+int block_get_byindex(struct file *file, int idx, struct block_priv *blk);
+int block_next_lin(struct map_rect_priv *mr);
+
+int tree_search_hv(char *dirname, char *filename, unsigned int search1, unsigned int search2, int *result);
+int town_get(struct map_rect_priv *mr, struct town_priv *poly, struct item *item);
+int town_get_byid(struct map_rect_priv *mr, struct town_priv *twn, int id_hi, int id_lo, struct item *item);
+struct item * town_search_get_item(struct map_rect_priv *mr);
+int poly_get(struct map_rect_priv *mr, struct poly_priv *poly, struct item *item);
+int poly_get_byid(struct map_rect_priv *mr, struct poly_priv *poly, int id_hi, int id_lo, struct item *item);
+int street_get(struct map_rect_priv *mr, struct street_priv *street, struct item *item);
+int street_get_byid(struct map_rect_priv *mr, struct street_priv *street, int id_hi, int id_lo, struct item *item);
+int street_name_get_byid(struct map_rect_priv *mr, struct street_priv *street, int id_hi, int id_lo, struct item *item);
+struct item * street_search_get_item(struct map_rect_priv *mr);
+void tree_search_init(char *dirname, char *filename, struct tree_search *ts, int offset);
+void tree_search_free(struct tree_search *ts);
+int tree_search_next(struct tree_search *ts, unsigned char **p, int dir);
+int tree_search_next_lin(struct tree_search *ts, unsigned char **p);
+struct item * housenumber_search_get_item(struct map_rect_priv *mr);
+struct map_rect_priv * map_rect_new_mg(struct map_priv *map, struct map_selection *sel);
+void map_rect_destroy_mg(struct map_rect_priv *mr);
+struct item *map_rect_get_item_byid_mg(struct map_rect_priv *mr, int id_hi, int id_lo);
+int housenumber_search_setup(struct map_rect_priv *mr);
diff --git a/map/mg/poly.c b/map/mg/poly.c
new file mode 100644
index 00000000..5bd08303
--- /dev/null
+++ b/map/mg/poly.c
@@ -0,0 +1,265 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <string.h>
+#include "debug.h"
+#include "mg.h"
+
+static void
+poly_coord_rewind(void *priv_data)
+{
+ struct poly_priv *poly=priv_data;
+
+ poly->p=poly->subpoly_start;
+
+}
+
+static int
+poly_coord_get(void *priv_data, struct coord *c, int count)
+{
+ struct poly_priv *poly=priv_data;
+ int ret=0;
+
+ while (count--) {
+ if (poly->p >= poly->subpoly_next)
+ break;
+ c->x=get_u32_unal(&poly->p);
+ c->y=get_u32_unal(&poly->p);
+ c++;
+ ret++;
+ }
+ return ret;
+}
+
+static void
+poly_attr_rewind(void *priv_data)
+{
+ struct poly_priv *poly=priv_data;
+
+ poly->aidx=0;
+}
+
+static int
+poly_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
+{
+ struct poly_priv *poly=priv_data;
+
+ attr->type=attr_type;
+ switch (attr_type) {
+ case attr_any:
+ while (poly->attr_next != attr_none) {
+ if (poly_attr_get(poly, poly->attr_next, attr))
+ return 1;
+ }
+ return 0;
+ case attr_label:
+ attr->u.str=poly->name;
+ poly->attr_next=attr_none;
+ if (attr->u.str[0])
+ return 1;
+ return 0;
+ default:
+ return 0;
+ }
+ return 1;
+}
+
+static struct item_methods poly_meth = {
+ poly_coord_rewind,
+ poly_coord_get,
+ poly_attr_rewind,
+ poly_attr_get,
+};
+
+static void
+poly_get_data(struct poly_priv *poly, unsigned char **p)
+{
+ poly->c[0].x=get_u32_unal(p);
+ poly->c[0].y=get_u32_unal(p);
+ poly->c[1].x=get_u32_unal(p);
+ poly->c[1].y=get_u32_unal(p);
+ *p+=sizeof(struct coord);
+ poly->name=(char *)(*p);
+ while (**p) {
+ (*p)++;
+ }
+ (*p)++;
+ poly->order=*(*p)++;
+ poly->type=*(*p)++;
+ poly->polys=get_u32_unal(p);
+ poly->count=(unsigned int *)(*p); (*p)+=poly->polys*sizeof(unsigned int);
+ poly->count_sum=get_u32_unal(p);
+}
+
+int
+poly_get(struct map_rect_priv *mr, struct poly_priv *poly, struct item *item)
+{
+ struct coord_rect r;
+
+ for (;;) {
+ if (mr->b.p >= mr->b.end)
+ return 0;
+ if (mr->b.p == mr->b.p_start) {
+ poly->poly_num=0;
+ poly->subpoly_num=0;
+ poly->subpoly_num_all=0;
+ poly->poly_next=mr->b.p;
+ item->meth=&poly_meth;
+ }
+ if (poly->poly_num >= block_get_count(mr->b.b))
+ return 0;
+ if (!poly->subpoly_num) {
+ mr->b.p=poly->poly_next;
+ item->id_lo=mr->b.p-mr->file->begin;
+ poly_get_data(poly, &mr->b.p);
+ poly->poly_next=mr->b.p+poly->count_sum*sizeof(struct coord);
+ poly->poly_num++;
+ r.lu=poly->c[0];
+ r.rl=poly->c[1];
+ if (mr->cur_sel && (poly->order > mr->cur_sel->order*3 || !coord_rect_overlap(&mr->cur_sel->u.c_rect, &r))) {
+ poly->subpoly_num_all+=poly->polys;
+ mr->b.p=poly->poly_next;
+ continue;
+ }
+ switch(poly->type) {
+ case 0x13:
+ item->type=type_poly_wood;
+ break;
+ case 0x14:
+ item->type=type_poly_town;
+ break;
+ case 0x15:
+ item->type=type_poly_cemetery;
+ break;
+ case 0x16:
+ item->type=type_poly_building;
+ break;
+ case 0x17:
+ item->type=type_poly_museum;
+ break;
+ case 0x19:
+ item->type=type_poly_place;
+ break;
+ case 0x1b:
+ item->type=type_poly_commercial_center;
+ break;
+ case 0x1e:
+ item->type=type_poly_industry;
+ break;
+ case 0x23:
+ /* FIXME: what is this ?*/
+ item->type=type_poly_place;
+ break;
+ case 0x24:
+ item->type=type_poly_car_parking;
+ break;
+ case 0x28:
+ item->type=type_poly_airport;
+ break;
+ case 0x29:
+ item->type=type_poly_station;
+ break;
+ case 0x2d:
+ item->type=type_poly_hospital;
+ break;
+ case 0x2e:
+ item->type=type_poly_hospital;
+ break;
+ case 0x2f:
+ item->type=type_poly_university;
+ break;
+ case 0x30:
+ item->type=type_poly_university;
+ break;
+ case 0x32:
+ item->type=type_poly_park;
+ break;
+ case 0x34:
+ item->type=type_poly_sport;
+ break;
+ case 0x35:
+ item->type=type_poly_sport;
+ break;
+ case 0x37:
+ item->type=type_poly_golf_course;
+ break;
+ case 0x38:
+ item->type=type_poly_national_park;
+ break;
+ case 0x39:
+ item->type=type_poly_nature_park;
+ break;
+ case 0x3c:
+ item->type=type_poly_water;
+ break;
+ case 0xbc:
+ item->type=type_water_line;
+ break;
+ case 0xc3:
+ /* FIXME: what is this ?*/
+ item->type=type_border_state;
+ break;
+ case 0xc6:
+ item->type=type_border_country;
+ break;
+ case 0xc7:
+ item->type=type_border_state;
+ break;
+ case 0xd0:
+ item->type=type_rail;
+ break;
+ default:
+ dbg(0,"Unknown poly type 0x%x '%s' 0x%x,0x%x\n", poly->type,poly->name,r.lu.x,r.lu.y);
+ item->type=type_street_unkn;
+ }
+ if (!map_selection_contains_item(mr->cur_sel, 0, item->type)) {
+ poly->subpoly_num_all+=poly->polys;
+ mr->b.p=poly->poly_next;
+ continue;
+ }
+ } else
+ mr->b.p=poly->subpoly_next;
+ dbg(1,"%d %d %s\n", poly->subpoly_num_all, mr->b.block_num, poly->name);
+ item->id_lo=poly->subpoly_num_all | (mr->b.block_num << 16);
+ item->id_hi=(mr->current_file << 16);
+ dbg(1,"0x%x 0x%x\n", item->id_lo, item->id_hi);
+ poly->subpoly_next=mr->b.p+L(poly->count[poly->subpoly_num])*sizeof(struct coord);
+ poly->subpoly_num++;
+ poly->subpoly_num_all++;
+ if (poly->subpoly_num >= poly->polys)
+ poly->subpoly_num=0;
+ poly->subpoly_start=poly->p=mr->b.p;
+ item->priv_data=poly;
+ poly->attr_next=attr_label;
+ return 1;
+ }
+}
+
+int
+poly_get_byid(struct map_rect_priv *mr, struct poly_priv *poly, int id_hi, int id_lo, struct item *item)
+{
+ int count=id_lo & 0xffff;
+ int ret=0;
+ block_get_byindex(mr->m->file[mr->current_file], id_lo >> 16, &mr->b);
+ while (count-- >= 0) {
+ ret=poly_get(mr, poly, item);
+ }
+ return ret;
+}
+
diff --git a/map/mg/street.c b/map/mg/street.c
new file mode 100644
index 00000000..8260dc56
--- /dev/null
+++ b/map/mg/street.c
@@ -0,0 +1,1389 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include "debug.h"
+#include "mg.h"
+
+int coord_debug;
+
+#if 0
+static void street_name_numbers_get(struct street_name_numbers *name_numbers, unsigned char **p);
+static void street_name_number_get(struct street_name_number *name_number, unsigned char **p);
+
+static void
+street_name_debug(struct street_name *sn, FILE *out)
+{
+ struct street_name_numbers nns;
+ unsigned char *p=sn->aux_data;
+ unsigned char *end=p+sn->aux_len;
+ int i;
+
+ while (p < end) {
+ unsigned char *pn,*pn_end;
+ struct street_name_number nn;
+ street_name_numbers_get(&nns, &p);
+ fprintf(out,"0x%x 0x%x type=town_label label=\"%s(%d):0x%x:%d%s-%d%s\" debug=\"len=0x%x\"",nns.c->x,nns.c->y,sn->name2, sn->segment_count, nns.tag, nns.first.number,nns.first.suffix,nns.last.number,nns.last.suffix,nns.len);
+ for (i = 0 ; i < sn->segment_count ; i++) {
+ fprintf(out," debug=\"segment(%d)=0x%x\"",i,sn->segments[i].segid);
+ }
+ fprintf(out,"\n");
+ pn=nns.aux_data;
+ pn_end=nns.aux_data+nns.aux_len;
+ while (pn < pn_end) {
+ street_name_number_get(&nn, &pn);
+ fprintf(out,"0x%x 0x%x type=town_label label=\"%s:0x%x:%d%s-%d%s\" debug=\"len=0x%x\"\n", nn.c->x, nn.c->y, sn->name2, nn.tag, nn.first.number, nn.first.suffix, nn.last.number,nn.last.suffix,nn.len);
+ }
+ }
+ fflush(out);
+}
+#endif
+
+static void
+street_name_get(struct street_name *name, unsigned char **p)
+{
+#if 0
+ static FILE *out;
+ static GHashTable *hash;
+#endif
+ unsigned char *start=*p;
+ name->len=get_u16_unal(p);
+ name->country=get_u16_unal(p);
+ name->townassoc=get_u32_unal(p);
+ name->name1=get_string(p);
+ name->name2=get_string(p);
+ name->segment_count=get_u32_unal(p);
+ name->segments=(struct street_name_segment *)(*p);
+ (*p)+=(sizeof (struct street_name_segment))*name->segment_count;
+ name->aux_len=name->len-(*p-start);
+ name->aux_data=*p;
+ name->tmp_len=name->aux_len;
+ name->tmp_data=name->aux_data;
+ *p=start+name->len;
+#if 0
+ if (! out) {
+ out=fopen("hn.txt","a");
+ }
+ if (! hash) {
+ hash=g_hash_table_new(NULL,NULL);
+ }
+ if (! g_hash_table_lookup(hash, *p)) {
+ g_hash_table_insert(hash, *p, (void *)1);
+ street_name_debug(name, out);
+ }
+#endif
+}
+
+static int
+street_name_eod(struct street_name *name)
+{
+ return (name->tmp_data >= name->aux_data+name->aux_len);
+}
+
+static void
+street_name_numbers_get(struct street_name_numbers *name_numbers, unsigned char **p)
+{
+ unsigned char *start=*p;
+ name_numbers->len=get_u16_unal(p);
+ name_numbers->tag=get_u8(p);
+ name_numbers->dist=get_u32_unal(p);
+ name_numbers->country=get_u32_unal(p);
+ name_numbers->c=coord_get(p);
+ name_numbers->first.number=get_u16_unal(p);
+ name_numbers->first.suffix=get_string(p);
+ name_numbers->last.number=get_u16_unal(p);
+ name_numbers->last.suffix=get_string(p);
+ name_numbers->segment_count=get_u32_unal(p);
+ name_numbers->segments=(struct street_name_segment *)(*p);
+ (*p)+=sizeof(struct street_name_segment)*name_numbers->segment_count;
+ name_numbers->aux_len=name_numbers->len-(*p-start);
+ name_numbers->aux_data=*p;
+ name_numbers->tmp_len=name_numbers->aux_len;
+ name_numbers->tmp_data=name_numbers->aux_data;
+ *p=start+name_numbers->len;
+}
+
+static int
+street_name_numbers_eod(struct street_name_numbers *name_numbers)
+{
+ return (name_numbers->tmp_data >= name_numbers->aux_data+name_numbers->aux_len);
+}
+
+
+static int
+street_name_numbers_get_byid(struct street_name_numbers *name_numbers, struct street_name *name, int id)
+{
+ unsigned char *p=name->aux_data;
+ unsigned char *end=p+name->aux_len;
+ while (id >= 0) {
+ if (p >= end)
+ return 0;
+ street_name_numbers_get(name_numbers, &p);
+ id--;
+ }
+ return 1;
+}
+
+static void
+street_name_number_get(struct street_name_number *name_number, unsigned char **p)
+{
+ unsigned char *start=*p;
+ name_number->len=get_u16_unal(p);
+ name_number->tag=get_u8(p);
+ name_number->c=coord_get(p);
+ name_number->first.number=get_u16_unal(p);
+ name_number->first.suffix=get_string(p);
+ name_number->last.number=get_u16_unal(p);
+ name_number->last.suffix=get_string(p);
+ name_number->segment=(struct street_name_segment *)p;
+ *p=start+name_number->len;
+}
+
+static int
+street_name_number_get_byid(struct street_name_number *name_number, struct street_name_numbers *name_numbers, int id)
+{
+ unsigned char *p=name_numbers->tmp_data;
+ unsigned char *end=p+name_numbers->tmp_len;
+ while (id >= 0) {
+ if (p >= end)
+ return 0;
+ street_name_number_get(name_number, &p);
+ id--;
+ }
+ return 1;
+}
+
+static void
+street_name_get_by_id(struct street_name *name, struct file *file, unsigned long id)
+{
+ unsigned char *p;
+ if (id) {
+ p=file->begin+id+0x2000;
+ street_name_get(name, &p);
+ }
+}
+
+static int street_get_bytes(struct coord_rect *r)
+{
+ int bytes,dx,dy;
+ bytes=2;
+ dx=r->rl.x-r->lu.x;
+ dy=r->lu.y-r->rl.y;
+ dbg_assert(dx > 0);
+ dbg_assert(dy > 0);
+ if (dx > 32767 || dy > 32767)
+ bytes=3;
+ if (dx > 8388608 || dy > 8388608)
+ bytes=4;
+
+ return bytes;
+}
+
+static int street_get_coord(unsigned char **pos, int bytes, struct coord_rect *ref, struct coord *f)
+{
+ unsigned char *p;
+ int x,y,flags=0;
+
+ p=*pos;
+ x=*p++;
+ x|=(*p++) << 8;
+ if (bytes == 2) {
+ if ( x > 0x7fff) {
+ x=0x10000-x;
+ flags=1;
+ }
+ }
+ else if (bytes == 3) {
+ x|=(*p++) << 16;
+ if ( x > 0x7fffff) {
+ x=0x1000000-x;
+ flags=1;
+ }
+ } else {
+ x|=(*p++) << 16;
+ x|=(*p++) << 24;
+ if (x < 0) {
+ x=-x;
+ flags=1;
+ }
+ }
+ y=*p++;
+ y|=(*p++) << 8;
+ if (bytes == 3) {
+ y|=(*p++) << 16;
+ } else if (bytes == 4) {
+ y|=(*p++) << 16;
+ y|=(*p++) << 24;
+ }
+ if (f) {
+ f->x=ref->lu.x+x;
+ f->y=ref->rl.y+y;
+ dbg(1,"0x%x,0x%x + 0x%x,0x%x = 0x%x,0x%x\n", x, y, ref->lu.x, ref->rl.y, f->x, f->y);
+ }
+ *pos=p;
+ return flags;
+}
+
+static void
+street_coord_get_begin(unsigned char **p)
+{
+ struct street_str *str;
+
+ str=(struct street_str *)(*p);
+ while (street_str_get_segid(str)) {
+ str++;
+ }
+ (*p)=(unsigned char *)str;
+ (*p)+=4;
+}
+
+
+static void
+street_coord_rewind(void *priv_data)
+{
+ struct street_priv *street=priv_data;
+
+ street->p=street->next=NULL;
+ street->status=street->status_rewind;
+}
+
+static int
+street_coord_get_helper(struct street_priv *street, struct coord *c)
+{
+ unsigned char *n;
+ if (street->p+street->bytes*2 >= street->end)
+ return 0;
+ if (street->status >= 4)
+ return 0;
+ n=street->p;
+ if (street_get_coord(&street->p, street->bytes, &street->ref, c)) {
+ if (street->status)
+ street->next=n;
+ street->status+=2;
+ if (street->status == 5)
+ return 0;
+ }
+ return 1;
+}
+
+static int
+street_coord_get(void *priv_data, struct coord *c, int count)
+{
+ struct street_priv *street=priv_data;
+ int ret=0,i,scount;
+#ifdef DEBUG_COORD_GET
+ int segid,debug=0;
+#endif
+
+ if (! street->p && count) {
+ street->p=street->coord_begin;
+ scount=street->str-street->str_start;
+ for (i = 0 ; i < scount ; i++) {
+ street->status=street_str_get_segid(&street->str[i+1]) >= 0 ? 0:1;
+ while (street_coord_get_helper(street, c));
+ street->p=street->next;
+ }
+ street->status_rewind=street->status=street_str_get_segid(&street->str[1]) >= 0 ? 0:1;
+ }
+#ifdef DEBUG_COORD_GET
+ segid=street_str_get_segid(&street->str[0]);
+ if (segid < 0)
+ segid=-segid;
+ if (segid == 0x15)
+ debug=1;
+ if (debug) {
+ dbg(0,"enter 0x%x\n",segid);
+ }
+#endif
+ while (count > 0) {
+ if (street_coord_get_helper(street, c)) {
+#ifdef DEBUG_COORD_GET
+ if (debug) {
+ dbg(0,"0x%x,0x%x\n", c->x, c->y);
+ }
+#endif
+ c++;
+ ret++;
+ count--;
+ } else {
+ street->more=0;
+ return ret;
+ }
+ }
+ return ret;
+}
+
+ static void
+street_attr_rewind(void *priv_data)
+{
+ /* struct street_priv *street=priv_data; */
+
+}
+
+static int
+street_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
+{
+ struct street_priv *street=priv_data;
+ int nameid;
+
+ dbg(1,"segid 0x%x\n", street_str_get_segid(street->str));
+ attr->type=attr_type;
+ switch (attr_type) {
+ case attr_any:
+ while (street->attr_next != attr_none) {
+ if (street_attr_get(street, street->attr_next, attr))
+ return 1;
+ }
+ return 0;
+ case attr_label:
+ street->attr_next=attr_street_name;
+ nameid=street_str_get_nameid(street->str);
+ if (! nameid)
+ return 0;
+ if (! street->name.len)
+ street_name_get_by_id(&street->name,street->name_file,nameid);
+ attr->u.str=street->name.name2;
+ if (attr->u.str && attr->u.str[0])
+ return 1;
+ attr->u.str=street->name.name1;
+ if (attr->u.str && attr->u.str[0])
+ return 1;
+ return 0;
+ case attr_street_name:
+ street->attr_next=attr_street_name_systematic;
+ nameid=street_str_get_nameid(street->str);
+ if (! nameid)
+ return 0;
+ if (! street->name.len)
+ street_name_get_by_id(&street->name,street->name_file,nameid);
+ attr->u.str=street->name.name2;
+ return ((attr->u.str && attr->u.str[0]) ? 1:0);
+ case attr_street_name_systematic:
+ street->attr_next=attr_flags;
+ nameid=street_str_get_nameid(street->str);
+ if (! nameid)
+ return 0;
+ if (! street->name.len)
+ street_name_get_by_id(&street->name,street->name_file,nameid);
+ attr->u.str=street->name.name1;
+ return ((attr->u.str && attr->u.str[0]) ? 1:0);
+ case attr_flags:
+ attr->u.num=street->flags;
+ street->attr_next=attr_country_id;
+ return 1;
+ case attr_country_id:
+ street->attr_next=attr_debug;
+ nameid=street_str_get_nameid(street->str);
+ if (! nameid)
+ return 0;
+ if (! street->name.len)
+ street_name_get_by_id(&street->name,street->name_file,nameid);
+ attr->u.num=mg_country_to_isonum(street->name.country);
+ return 1;
+ case attr_debug:
+ street->attr_next=attr_none;
+ {
+ struct street_str *str=street->str;
+ sprintf(street->debug,"order:0x%x\nsegid:0x%x\nlimit:0x%x\nunknown2:0x%x\nunknown3:0x%x\ntype:0x%x\nnameid:0x%x\ntownassoc:0x%x",street_header_get_order(street->header),street_str_get_segid(str),street_str_get_limit(str),street_str_get_unknown2(str),street_str_get_unknown3(str),street_str_get_type(str),street_str_get_nameid(str), street->name.len ? street->name.townassoc : 0);
+ attr->u.str=street->debug;
+ }
+ return 1;
+ default:
+ return 0;
+ }
+ return 1;
+}
+
+static struct item_methods street_meth = {
+ street_coord_rewind,
+ street_coord_get,
+ street_attr_rewind,
+ street_attr_get,
+};
+
+static void
+street_get_data(struct street_priv *street, unsigned char **p)
+{
+ street->header=(struct street_header *)(*p);
+ (*p)+=sizeof(struct street_header);
+ street->type_count=street_header_get_count(street->header);
+ street->type=(struct street_type *)(*p);
+ (*p)+=street->type_count*sizeof(struct street_type);
+}
+
+
+static void
+street_housenumber_coord_rewind(void *priv_data)
+{
+ struct street_priv *street=priv_data;
+ street->cidx=0;
+}
+
+static void
+street_housenumber_attr_rewind(void *priv_data)
+{
+ /* struct street_priv *street=priv_data; */
+
+}
+
+static int
+street_housenumber_coord_get(void *priv_data, struct coord *c, int count)
+{
+ struct street_priv *street=priv_data;
+ if (street->cidx || !count || !street->name.len)
+ return 0;
+ *c=street->hnc[street->housenumber-2];
+ street->cidx=1;
+ return 1;
+}
+
+static int
+street_housenumber_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
+{
+ struct street_priv *street=priv_data;
+ struct housenumber *hn;
+ attr->type=attr_type;
+ switch (attr_type) {
+ case attr_label:
+ hn=&street->hn[street->housenumber-2];
+ sprintf(street->debug,"%d%s",hn->number,hn->suffix);
+ attr->u.str=street->debug;
+ return 1;
+ default:
+ dbg(0,"unknown item\n");
+ return 0;
+ }
+}
+
+static struct item_methods street_housenumber_meth = {
+ street_housenumber_coord_rewind,
+ street_housenumber_coord_get,
+ street_housenumber_attr_rewind,
+ street_housenumber_attr_get,
+};
+
+static void
+project(struct coord *c, int count, int di, int dlr, struct coord *ch)
+{
+ struct coord cr;
+ int dx,dy;
+ int l;
+
+ if (di > 0) {
+ dx=c[1].x-c[0].x;
+ dy=c[1].y-c[0].y;
+ cr=c[0];
+ } else if (di < 0) {
+ dx=c[count-1].x-c[count-2].x;
+ dy=c[count-1].y-c[count-2].y;
+ cr=c[count-1];
+ } else {
+ dx=c[1].x-c[0].x;
+ dy=c[1].y-c[0].y;
+ di=0;
+ if (count % 2) {
+ cr=c[count/2];
+ } else {
+ cr.x=(c[count/2-1].x+c[count/2].x)/2;
+ cr.y=(c[count/2-1].y+c[count/2].y)/2;
+ }
+ }
+ l=sqrtf(dx*dx+dy*dy);
+ if (!l) {
+ *ch=cr;
+ return;
+ }
+ ch->x=cr.x+(di*dx+dlr*dy)/l;
+ ch->y=cr.y+(di*dy-dlr*dx)/l;
+}
+
+static int
+street_lookup_housenumber(struct street_priv *street)
+{
+ int i,count,scount,maxcount=16384;
+ struct coord c[maxcount];
+ struct street_name_numbers nns;
+ unsigned char *p=street->name.aux_data;
+ unsigned char *end=p+street->name.aux_len;
+ unsigned char *pn,*pn_end;
+
+ street->hn_count=0;
+ street_coord_rewind(street);
+ scount=street_coord_get(street, c, maxcount/2);
+ if (scount >= maxcount/2) {
+ dbg(0,"overflow");
+ }
+ for (i = 0 ; i < scount-1 ; i++) {
+ c[scount+i].x=(c[i].x+c[i+1].x)/2;
+ c[scount+i].y=(c[i].y+c[i+1].y)/2;
+ }
+ count=scount*2-1;
+ while (p < end) {
+ struct street_name_number nn;
+ street_name_numbers_get(&nns, &p);
+ pn=nns.aux_data;
+ pn_end=nns.aux_data+nns.aux_len;
+ while (pn < pn_end) {
+ street_name_number_get(&nn, &pn);
+ for (i = 0 ; i < count ; i++) {
+ int dx=nn.c->x-c[i].x;
+ int dy=nn.c->y-c[i].y;
+ int dlr,dir;
+ if (dx < 3 && dx > -3 && dy < 3 && dy > -3) {
+ dir=15;
+ dlr=15;
+ switch (nn.tag & 0xf) {
+ case 0xa:
+ break;
+ case 0xb:
+ dlr=-dlr;
+ dir=-dir;
+ break;
+ case 0xe:
+ dlr=-dlr;
+ break;
+ case 0xf:
+ dir=-dir;
+ break;
+ default:
+ dbg(0,"unknown tag 0x%x\n",nn.tag);
+#if 0
+ continue;
+#endif
+ }
+ if (street_str_get_type(street->str) & 0x40) {
+ dir=-dir;
+ dlr=-dlr;
+ }
+ if (nn.first.number == nn.last.number && !strcmp(nn.first.suffix, nn.last.suffix))
+ dir=0;
+ project(c, scount, dir, dlr, &street->hnc[street->hn_count]);
+ street->hn[street->hn_count]=nn.first;
+ street->hn_count++;
+ g_assert(street->hn_count < 100);
+ project(c, scount, -dir, dlr, &street->hnc[street->hn_count]);
+ street->hn[street->hn_count]=nn.last;
+ street->hn_count++;
+ g_assert(street->hn_count < 100);
+ dbg(1,"found %d%s %d%s\n",nn.first.number,nn.first.suffix,nn.last.number,nn.last.suffix);
+ }
+ }
+ }
+ }
+ return 1;
+}
+
+static int
+street_get_housenumber(struct map_rect_priv *mr, struct street_priv *street, struct item *item)
+{
+ int nameid;
+ nameid=street_str_get_nameid(street->str);
+ if (! nameid)
+ return 0;
+ if (! street->name.len)
+ street_name_get_by_id(&street->name,street->name_file,nameid);
+ if (! street->name.aux_len)
+ return 0;
+ if (!street->hn_count)
+ street_lookup_housenumber(street);
+ if (street->housenumber > street->hn_count)
+ return 0;
+ item->type=type_town_label;
+ item->id_hi = (item->id_hi & 0xffffff) | (street->housenumber*0x10000000+0x1000000);
+ item->meth=&street_housenumber_meth;
+ street->cidx=0;
+ street->housenumber++;
+ return 1;
+}
+
+ /*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 */
+static unsigned char limit[]={0,0,1,1,1,2,2,4,6,6,12,13,14,20,20,20,20,20,20};
+
+int
+street_get(struct map_rect_priv *mr, struct street_priv *street, struct item *item)
+{
+ int *flags;
+ struct coord_rect r;
+ for (;;) {
+ while (street->more) {
+ struct coord c;
+ street_coord_get(street, &c, 1);
+ }
+#if 0
+ if (street->housenumber) {
+ if (street_get_housenumber(mr, street, item))
+ return 1;
+ street->housenumber=0;
+ }
+#endif
+ if (mr->b.p == mr->b.p_start) {
+ street_get_data(street, &mr->b.p);
+ street->name_file=mr->m->file[file_strname_stn];
+ if (mr->cur_sel && street_header_get_order(street->header) > limit[mr->cur_sel->order])
+ return 0;
+ street->end=mr->b.end;
+ block_get_r(mr->b.b, &r);
+ street->ref=r;
+ street->bytes=street_get_bytes(&r);
+ street->str_start=street->str=(struct street_str *)mr->b.p;
+ street->coord_begin=mr->b.p;
+ street_coord_get_begin(&street->coord_begin);
+ street->p=street->coord_begin;
+ street->type--;
+ item->meth=&street_meth;
+ item->priv_data=street;
+ } else {
+ street->str++;
+ street->p=street->next;
+ }
+ if (! street_str_get_segid(street->str))
+ return 0;
+ if (street_str_get_segid(street->str) < 0)
+ street->type++;
+#if 0
+ dbg_assert(street->p != NULL);
+#endif
+ street->next=NULL;
+ street->status_rewind=street->status=street_str_get_segid(&street->str[1]) >= 0 ? 0:1;
+#if 0
+ if (street->type->country != 0x31) {
+ printf("country=0x%x\n", street->type->country);
+ }
+#endif
+ item->id_hi=street_type_get_country(street->type) | (mr->current_file << 16);
+ item->id_lo=street_str_get_segid(street->str) > 0 ? street_str_get_segid(street->str) : -street_str_get_segid(street->str);
+ switch(street_str_get_type(street->str) & 0x1f) {
+ case 0xf: /* very small street */
+ if (street_str_get_limit(street->str) == 0x33)
+ item->type=type_street_nopass;
+ else
+ item->type=type_street_0;
+ break;
+ case 0xd:
+ item->type=type_ferry;
+ break;
+ case 0xc: /* small street */
+ item->type=type_street_1_city;
+ break;
+ case 0xb:
+ item->type=type_street_2_city;
+ break;
+ case 0xa:
+ if ((street_str_get_limit(street->str) == 0x03 || street_str_get_limit(street->str) == 0x30) && street_header_get_order(street->header) < 4)
+ item->type=type_street_4_city;
+ else
+ item->type=type_street_3_city;
+ break;
+ case 0x9:
+ if (street_header_get_order(street->header) < 5)
+ item->type=type_street_4_city;
+ else if (street_header_get_order(street->header) < 7)
+ item->type=type_street_2_city;
+ else
+ item->type=type_street_1_city;
+ break;
+ case 0x8:
+ item->type=type_street_2_land;
+ break;
+ case 0x7:
+ if ((street_str_get_limit(street->str) == 0x03 || street_str_get_limit(street->str) == 0x30) && street_header_get_order(street->header) < 4)
+ item->type=type_street_4_city;
+ else
+ item->type=type_street_3_land;
+ break;
+ case 0x6:
+ item->type=type_ramp;
+ break;
+ case 0x5:
+ item->type=type_street_4_land;
+ break;
+ case 0x4:
+ item->type=type_street_4_land;
+ break;
+ case 0x3:
+ item->type=type_street_n_lanes;
+ break;
+ case 0x2:
+ item->type=type_highway_city;
+ break;
+ case 0x1:
+ item->type=type_highway_land;
+ break;
+ default:
+ item->type=type_street_unkn;
+ dbg(0,"unknown type 0x%x\n",street_str_get_type(street->str));
+ }
+ flags=item_get_default_flags(item->type);
+ if (flags)
+ street->flags=*flags;
+ else
+ street->flags=0;
+ if (street_str_get_type(street->str) & 0x40) {
+ street->flags|=(street_str_get_limit(street->str) & 0x30) ? AF_ONEWAYREV:0;
+ street->flags|=(street_str_get_limit(street->str) & 0x03) ? AF_ONEWAY:0;
+ } else {
+ street->flags|=(street_str_get_limit(street->str) & 0x30) ? AF_ONEWAY:0;
+ street->flags|=(street_str_get_limit(street->str) & 0x03) ? AF_ONEWAYREV:0;
+ }
+#if 0
+ coord_debug=(street->str->unknown2 != 0x40 || street->str->unknown3 != 0x40);
+ if (coord_debug) {
+ item->type=type_street_unkn;
+ printf("%d %02x %02x %02x %02x\n", street->str->segid, street->str->type, street->str->limit, street->str->unknown2, street->str->unknown3);
+ }
+#endif
+ street->p_rewind=street->p;
+ street->name.len=0;
+ street->attr_next=attr_label;
+ street->more=1;
+ street->housenumber=1;
+ street->hn_count=0;
+ if (!map_selection_contains_item(mr->cur_sel, 0, item->type))
+ continue;
+ item->meth=&street_meth;
+ item->priv_data=street;
+ return 1;
+ }
+}
+
+int
+street_get_byid(struct map_rect_priv *mr, struct street_priv *street, int id_hi, int id_lo, struct item *item)
+{
+ int country=id_hi & 0xffff;
+ int res;
+ struct coord_rect r;
+ dbg(1,"enter(%p,%p,0x%x,0x%x,%p)\n", mr, street, id_hi, id_lo, item);
+ if (! country)
+ return 0;
+ tree_search_hv(mr->m->dirname, "street", (id_lo >> 8) | (country << 24), id_lo & 0xff, &res);
+ dbg(1,"res=0x%x (blk=0x%x)\n", res, res >> 12);
+ block_get_byindex(mr->m->file[mr->current_file], res >> 12, &mr->b);
+ street_get_data(street, &mr->b.p);
+ street->name_file=mr->m->file[file_strname_stn];
+ street->end=mr->b.end;
+ block_get_r(mr->b.b, &r);
+ street->ref=r;
+ street->bytes=street_get_bytes(&r);
+ street->str_start=street->str=(struct street_str *)mr->b.p;
+ street->coord_begin=mr->b.p;
+ street_coord_get_begin(&street->coord_begin);
+ street->p=street->coord_begin;
+ street->type--;
+ item->meth=&street_meth;
+ item->priv_data=street;
+ street->str+=(res & 0xfff)-1;
+ dbg(1,"segid 0x%x\n", street_str_get_segid(&street->str[1]));
+ return street_get(mr, street, item);
+#if 0
+ mr->b.p=mr->b.block_start+(res & 0xffff);
+ return town_get(mr, twn, item);
+#endif
+
+ return 0;
+}
+
+struct street_name_index {
+ int block;
+ unsigned short country;
+ int town_assoc;
+ char name[0];
+} __attribute__((packed));
+
+static unsigned char
+latin1_tolower(unsigned char c)
+{
+ if (c >= 'A' && c <= 'Z')
+ return c - 'A' + 'a';
+ if (c == 0xc4 || c == 0xc9 || c == 0xd6 || c == 0xdc)
+ return c+0x20;
+ return c;
+}
+
+static unsigned char
+latin1_tolower_ascii(unsigned char c)
+{
+ unsigned char ret=latin1_tolower(c);
+ switch (ret) {
+ case 0xe4:
+ return 'a';
+ case 0xe9:
+ return 'e';
+ case 0xf6:
+ return 'o';
+ case 0xfc:
+ return 'u';
+ default:
+ if (ret >= 0x80)
+ dbg(1,"ret=0x%x\n",c);
+ return ret;
+ }
+}
+
+static int
+strncasecmp_latin1(char *str1, char *str2, int len)
+{
+ int d;
+ while (len--) {
+ d=latin1_tolower((unsigned char)(*str1))-latin1_tolower((unsigned char)(*str2));
+ if (d)
+ return d;
+ if (! *str1)
+ return 0;
+ str1++;
+ str2++;
+ }
+ return 0;
+}
+
+static int
+strncasecmp_latin1_ascii(char *str1, char *str2, int len)
+{
+ int d;
+ while (len--) {
+ d=latin1_tolower_ascii((unsigned char)(*str1))-latin1_tolower_ascii((unsigned char)(*str2));
+ if (d)
+ return d;
+ if (! *str1)
+ return 0;
+ str1++;
+ str2++;
+ }
+ return 0;
+}
+
+static int
+street_search_compare_do(struct map_rect_priv *mr, int country, int town_assoc, char *name)
+{
+ int d,len;
+
+ dbg(1,"enter");
+ dbg(1,"country 0x%x town_assoc 0x%x name '%s'\n", country, town_assoc, name);
+ d=(mr->search_item.id_hi & 0xffff)-country;
+ dbg(1,"country %d (%d vs %d)\n", d, mr->search_item.id_hi & 0xffff, country);
+ if (!d) {
+ if (mr->search_item.id_lo == town_assoc ) {
+ dbg(1,"town_assoc match (0x%x)\n", town_assoc);
+ len=mr->search_partial ? strlen(mr->search_str):INT_MAX;
+ d=strncasecmp_latin1(mr->search_str, name, len);
+ if (!strncasecmp_latin1_ascii(mr->search_str, name, len))
+ d=0;
+ dbg(1,"string %d\n", d);
+ } else {
+ if (town_assoc < mr->search_item.id_lo)
+ d=1;
+ else
+ d=-1;
+ dbg(1,"assoc %d 0x%x-0x%x\n",d, mr->search_item.id_lo, town_assoc);
+ }
+ }
+ dbg(1,"d=%d\n", d);
+ return d;
+}
+
+static int
+street_search_compare(unsigned char **p, struct map_rect_priv *mr)
+{
+ struct street_name_index *i;
+ int ret;
+
+ dbg(1,"enter\n");
+ i=(struct street_name_index *)(*p);
+ *p+=sizeof(*i)+strlen(i->name)+1;
+
+ dbg(1,"block 0x%x\n", i->block);
+
+ ret=street_search_compare_do(mr, i->country, i->town_assoc, i->name);
+ if (ret <= 0)
+ mr->search_block=i->block;
+ return ret;
+}
+
+static void
+street_name_numbers_coord_rewind(void *priv_data)
+{
+ /* struct street_priv *street=priv_data; */
+
+}
+
+static void
+street_name_numbers_attr_rewind(void *priv_data)
+{
+ /* struct street_priv *street=priv_data; */
+
+}
+
+static int
+street_name_numbers_coord_get(void *priv_data, struct coord *c, int count)
+{
+ return 0;
+}
+
+static int
+street_name_numbers_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
+{
+ attr->type=attr_type;
+ switch (attr_type) {
+ default:
+ dbg(0,"unknown item\n");
+ return 0;
+ }
+}
+
+
+
+
+
+static struct item_methods street_name_numbers_meth = {
+ street_name_numbers_coord_rewind,
+ street_name_numbers_coord_get,
+ street_name_numbers_attr_rewind,
+ street_name_numbers_attr_get,
+};
+
+
+static void
+street_name_coord_rewind(void *priv_data)
+{
+ /* struct street_priv *street=priv_data; */
+
+}
+
+static void
+street_name_attr_rewind(void *priv_data)
+{
+ /* struct street_priv *street=priv_data; */
+
+}
+
+static int
+street_name_coord_get(void *priv_data, struct coord *c, int count)
+{
+ struct map_rect_priv *mr=priv_data;
+ struct street_name_numbers snns;
+ unsigned char *p=mr->street.name.aux_data;
+
+ dbg(1,"aux_data=%p\n", p);
+ if (count) {
+ street_name_numbers_get(&snns, &p);
+ street_name_numbers_get_coord(&snns, c);
+ return 1;
+ }
+
+ return 0;
+}
+
+#if 0
+static void
+debug(struct map_rect_priv *mr)
+{
+ int i;
+ struct street_name_numbers nns;
+ unsigned char *p=mr->street.name.aux_data;
+ unsigned char *end=p+mr->street.name.aux_len;
+ printf("len=0x%x\n", mr->street.name.aux_len);
+ for (i = 0 ; i < mr->street.name.aux_len ; i++) {
+ printf("%02x ",mr->street.name.aux_data[i]);
+ }
+ printf("\n");
+ {
+ while (p < end) {
+ unsigned char *pn,*pn_end;
+ struct street_name_number nn;
+ street_name_numbers_get(&nns, &p);
+ printf("name_numbers:\n");
+ printf(" len 0x%x\n", nns.len);
+ printf(" tag 0x%x\n", nns.tag);
+ printf(" dist 0x%x\n", nns.dist);
+ printf(" country 0x%x\n", nns.country);
+ printf(" coord 0x%x,0x%x\n", nns.c->x, nns.c->y);
+ printf(" first %d\n", nns.first.number);
+ printf(" last %d\n", nns.last.number);
+ printf(" segment count 0x%x\n", nns.segment_count);
+ printf(" aux_len 0x%x\n", nns.aux_len);
+ pn=nns.aux_data;
+ pn_end=nns.aux_data+nns.aux_len;
+ while (pn < pn_end) {
+ printf(" number:\n");
+ street_name_number_get(&nn, &pn);
+ printf(" len 0x%x\n", nn.len);
+ printf(" tag 0x%x\n", nn.tag);
+ printf(" coord 0x%x,0x%x\n", nn.c->x, nn.c->y);
+ printf(" first %d\n", nn.first.number);
+ printf(" last %d\n", nn.last.number);
+ }
+ }
+ }
+}
+#endif
+
+static int
+street_name_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
+{
+ struct map_rect_priv *mr=priv_data;
+
+ attr->type=attr_type;
+ switch (attr_type) {
+ case attr_street_name:
+ attr->u.str=mr->street.name.name2;
+ return ((attr->u.str && attr->u.str[0]) ? 1:0);
+ case attr_street_name_systematic:
+ attr->u.str=mr->street.name.name1;
+ return ((attr->u.str && attr->u.str[0]) ? 1:0);
+ case attr_town_name:
+ case attr_district_name:
+ case attr_postal:
+ if (!mr->search_item_tmp)
+ mr->search_item_tmp=map_rect_get_item_byid_mg(mr->search_mr_tmp, mr->street.name_numbers.country | (file_town_twn << 16), mr->street.name_numbers.dist);
+ if (!mr->search_item_tmp)
+ return 0;
+ return item_attr_get(mr->search_item_tmp, attr_type, attr);
+ default:
+ dbg(0,"%p\n",mr->street.name_numbers.dist);
+ dbg(0,"unknown attr %s\n",attr_to_name(attr_type));
+ return 0;
+ }
+}
+
+
+
+
+
+static struct item_methods street_name_meth = {
+ street_name_coord_rewind,
+ street_name_coord_get,
+ street_name_attr_rewind,
+ street_name_attr_get,
+};
+
+
+int
+street_name_get_byid(struct map_rect_priv *mr, struct street_priv *street, int id_hi, int id_lo, struct item *item)
+{
+ mr->current_file=id_hi >> 16;
+ street->name_file=mr->m->file[mr->current_file];
+ item->type=type_street_name;
+ item->id_hi=id_hi;
+ item->id_lo=id_lo;
+ item->meth=&street_name_meth;
+ item->map=NULL;
+ item->priv_data=mr;
+ mr->b.p=street->name_file->begin+item->id_lo;
+ dbg(1,"last %p map %p file %d begin %p\n", mr->b.p, mr->m, mr->current_file, mr->m->file[mr->current_file]->begin);
+ street_name_get(&street->name, &mr->b.p);
+ return 1;
+}
+
+static struct item *
+street_search_get_item_street_name(struct map_rect_priv *mr)
+{
+ int dir=1,leaf;
+ unsigned char *last;
+
+ dbg(1,"enter\n");
+ if (! mr->search_blk_count) {
+ dbg(1,"partial 0x%x '%s' ***\n", mr->town.street_assoc, mr->search_str);
+ if (mr->search_linear)
+ return NULL;
+ dbg(1,"tree_search_next\n");
+ mr->search_block=-1;
+ while ((leaf=tree_search_next(&mr->ts, &mr->search_p, dir)) != -1) {
+ dir=street_search_compare(&mr->search_p, mr);
+ }
+ dbg(1,"dir=%d mr->search_block=0x%x\n", dir, mr->search_block);
+ if (mr->search_block == -1)
+ return NULL;
+ mr->search_blk_count=1;
+ block_get_byindex(mr->m->file[file_strname_stn], mr->search_block, &mr->b);
+ mr->b.p=mr->b.block_start+12;
+ }
+ dbg(1,"name id 0x%x\n", mr->b.p-mr->m->file[file_strname_stn]->begin);
+ if (! mr->search_blk_count)
+ return NULL;
+ for (;;) {
+ if (mr->b.p >= mr->b.end) {
+ if (!block_next_lin(mr)) {
+ dbg(1,"end of blocks in %p, %p\n", mr->m->file[file_strname_stn]->begin, mr->m->file[file_strname_stn]->end);
+ return NULL;
+ }
+ mr->b.p=mr->b.block_start+12;
+ }
+ while (mr->b.p < mr->b.end) {
+ last=mr->b.p;
+ street_name_get(&mr->street.name, &mr->b.p);
+ dir=street_search_compare_do(mr, mr->street.name.country, mr->street.name.townassoc, mr->street.name.name2);
+ dbg(1,"country 0x%x assoc 0x%x name1 '%s' name2 '%s' dir=%d\n", mr->street.name.country, mr->street.name.townassoc, mr->street.name.name1, mr->street.name.name2, dir);
+ if (dir < 0) {
+ dbg(1,"end of data\n");
+ mr->search_blk_count=0;
+ return NULL;
+ }
+ if (!dir) {
+ dbg(1,"result country 0x%x assoc 0x%x name1 '%s' name2 '%s' dir=%d aux_data=%p len=0x%x\n", mr->street.name.country, mr->street.name.townassoc, mr->street.name.name1, mr->street.name.name2, dir, mr->street.name.aux_data, mr->street.name.aux_len);
+ mr->item.type = type_street_name;
+ mr->item.id_hi=(file_strname_stn << 16);
+ mr->item.id_lo=last-mr->m->file[file_strname_stn]->begin;
+ dbg(1,"id 0x%x 0x%x last %p map %p file %d begin %p\n", mr->item.id_hi, mr->item.id_lo, last, mr->m, mr->current_file, mr->m->file[mr->current_file]->begin);
+ mr->item.meth=&street_name_meth;
+ mr->item.map=NULL;
+ mr->item.priv_data=mr;
+ /* debug(mr); */
+ dbg(1,"last %p\n",last);
+ return &mr->item;
+ }
+ }
+ }
+}
+
+static void
+district_debug(struct map_rect_priv *mr, int country, int dist)
+{
+ struct map_rect_priv *mrt;
+ struct item *item;
+ struct attr attrn;
+
+ mrt=map_rect_new_mg(mr->m, NULL);
+ item=map_rect_get_item_byid_mg(mrt, country | (file_town_twn << 16), dist);
+ dbg(0,"item=%p\n",item);
+ if (item_attr_get(item, attr_town_postal, &attrn))
+ dbg(0,"postal=%s\n",attrn.u.str);
+ if (item_attr_get(item, attr_town_name, &attrn))
+ dbg(0,"town_name=%s\n",attrn.u.str);
+ if (item_attr_get(item, attr_district_name, &attrn))
+ dbg(0,"district_name=%s\n",attrn.u.str);
+ map_rect_destroy_mg(mrt);
+}
+
+static int
+street_name_numbers_get_next(struct map_rect_priv *mr, struct street_name *name, char *start, char **p, int mode, int *id, struct street_name_numbers *ret)
+{
+ struct street_name_numbers tmp;
+ char *ps,*pt;
+ int found;
+ while (*p < name->aux_data+name->aux_len) {
+ ps=*p;
+ street_name_numbers_get(ret, p);
+ (*id)++;
+ found=0;
+ pt=name->aux_data;
+ while (pt < ps) {
+ street_name_numbers_get(&tmp, &pt);
+ if (tmp.country == ret->country && tmp.dist == ret->dist) {
+ found=1;
+ break;
+ }
+ }
+ if (!found) {
+ dbg(0,"district 0x%x\n",ret->dist);
+ district_debug(mr, ret->country, ret->dist);
+ return 1;
+ }
+ }
+ return 0;
+}
+
+
+static struct item *
+street_search_get_item_street_name_district(struct map_rect_priv *mr, int flag)
+{
+ if (street_name_eod(&mr->street.name))
+ return NULL;
+ if (!street_name_numbers_get_next(mr, &mr->street.name, NULL, &mr->street.name.tmp_data, 1, &mr->item.id_hi, &mr->street.name_numbers))
+ return NULL;
+ return &mr->item;
+}
+
+struct item *
+street_search_get_item(struct map_rect_priv *mr)
+{
+ struct item *item;
+ for (;;) {
+ if (!mr->street.name.tmp_data || street_name_eod(&mr->street.name)) {
+ item=street_search_get_item_street_name(mr);
+ if (!item)
+ return NULL;
+ if (!mr->street.name.aux_len)
+ return item;
+ }
+ mr->item.id_hi++;
+ street_name_numbers_get(&mr->street.name_numbers, &mr->street.name.tmp_data);
+ mr->search_item_tmp=NULL;
+ return &mr->item;
+ }
+}
+
+static int
+street_name_numbers_next(struct map_rect_priv *mr)
+{
+ if (street_name_eod(&mr->street.name))
+ return 0;
+ dbg(1,"%p vs %p\n",mr->street.name.tmp_data, mr->street.name.aux_data);
+ street_name_numbers_get(&mr->street.name_numbers, &mr->street.name.tmp_data);
+ return 1;
+}
+
+static int
+street_name_number_next(struct map_rect_priv *mr)
+{
+ if (street_name_numbers_eod(&mr->street.name_numbers))
+ return 0;
+ street_name_number_get(&mr->street.name_number, &mr->street.name_numbers.tmp_data);
+ sprintf(mr->street.first_number,"%d%s",mr->street.name_number.first.number,mr->street.name_number.first.suffix);
+ sprintf(mr->street.last_number,"%d%s",mr->street.name_number.last.number,mr->street.name_number.last.suffix);
+ mr->street.current_number[0]='\0';
+ return 1;
+}
+
+static void
+housenumber_coord_rewind(void *priv_data)
+{
+ /* struct street_priv *street=priv_data; */
+
+}
+
+static void
+housenumber_attr_rewind(void *priv_data)
+{
+ /* struct street_priv *street=priv_data; */
+
+}
+
+static int
+housenumber_coord_get(void *priv_data, struct coord *c, int count)
+{
+ return 0;
+}
+
+static int
+housenumber_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
+{
+ struct map_rect_priv *mr=priv_data;
+ attr->type=attr_type;
+ switch (attr_type) {
+ case attr_house_number:
+ attr->u.str=mr->street.current_number;
+ return 1;
+ case attr_town_name:
+ case attr_district_name:
+ case attr_postal:
+ if (!mr->search_item_tmp)
+ mr->search_item_tmp=map_rect_get_item_byid_mg(mr->search_mr_tmp, mr->street.name_numbers.country | (file_town_twn << 16), mr->street.name_numbers.dist);
+ if (!mr->search_item_tmp)
+ return 0;
+ return item_attr_get(mr->search_item_tmp, attr_type, attr);
+ default:
+ dbg(0,"unknown attr %s\n",attr_to_name(attr_type));
+ return 0;
+ }
+}
+
+
+static struct item_methods housenumber_meth = {
+ housenumber_coord_rewind,
+ housenumber_coord_get,
+ housenumber_attr_rewind,
+ housenumber_attr_get,
+};
+
+int
+housenumber_search_setup(struct map_rect_priv *mr)
+{
+ dbg(1,"enter (0x%x,0x%x)\n",mr->search_item.id_hi,mr->search_item.id_lo);
+ int id=mr->search_item.id_hi & 0xff;
+ mr->current_file=file_strname_stn;
+ mr->street.name_file=mr->m->file[mr->current_file];
+ mr->b.p=mr->street.name_file->begin+mr->search_item.id_lo;
+ mr->search_str=g_strdup(mr->search_attr->u.str);
+ dbg(1,"last %p\n",mr->b.p);
+ street_name_get(&mr->street.name, &mr->b.p);
+#if 0
+ debug(mr);
+#endif
+ while (id > 0) {
+ id--;
+ dbg(1,"loop\n");
+ if (!street_name_numbers_next(mr))
+ return 0;
+ }
+ mr->item.type=type_house_number;
+ mr->item.priv_data=mr;
+ mr->item.id_hi=mr->search_item.id_hi + 0x100;
+ mr->item.meth=&housenumber_meth;
+ if (!id)
+ mr->item.id_hi+=1;
+ mr->item.id_lo=mr->search_item.id_lo;
+ dbg(1,"getting name_number %p vs %p + %d\n",mr->street.name_numbers.tmp_data,mr->street.name_numbers.aux_data, mr->street.name_numbers.aux_len);
+ if (!street_name_number_next(mr))
+ return 0;
+ dbg(1,"enter\n");
+ // debug(mr);
+ return 1;
+}
+
+static int
+house_number_next(char *number, char *first, char *last, int interpolation, int *percentage)
+{
+ int firstn=atoi(first);
+ int lastn=atoi(last);
+ int current,delta,len=lastn-firstn;
+ if (interpolation) {
+ len/=2;
+ }
+ if (!number[0]) {
+ strcpy(number,first);
+ delta=0;
+ } else {
+ current=atoi(number)+(interpolation ? 2:1);
+ if (current > lastn)
+ return 0;
+ sprintf(number,"%d",current);
+ delta=current-firstn;
+ }
+ if (percentage) {
+ if (len)
+ *percentage=delta*100/len;
+ else
+ *percentage=50;
+ }
+ return 1;
+}
+
+struct item *
+housenumber_search_get_item(struct map_rect_priv *mr)
+{
+ int d;
+ dbg(1,"enter %s %s\n",mr->street.first_number,mr->street.last_number);
+ for (;;) {
+ if (!house_number_next(mr->street.current_number, mr->street.first_number, mr->street.last_number, 0, NULL)) {
+ if (!street_name_number_next(mr))
+ return NULL;
+ continue;
+ }
+ if (mr->search_partial)
+ d=strncasecmp(mr->search_str, mr->street.current_number, strlen(mr->search_str));
+ else
+ d=strcasecmp(mr->search_str, mr->street.current_number);
+ if (!d) {
+ mr->search_item_tmp=NULL;
+ return &mr->item;
+ }
+ }
+}
diff --git a/map/mg/town.c b/map/mg/town.c
new file mode 100644
index 00000000..cee04683
--- /dev/null
+++ b/map/mg/town.c
@@ -0,0 +1,286 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "debug.h"
+#include "mg.h"
+
+
+
+static void
+town_coord_rewind(void *priv_data)
+{
+ struct town_priv *twn=priv_data;
+
+ twn->cidx=0;
+}
+
+static int
+town_coord_get(void *priv_data, struct coord *c, int count)
+{
+ struct town_priv *twn=priv_data;
+
+ if (twn->cidx || count <= 0)
+ return 0;
+ twn->cidx=1;
+ *c=twn->c;
+ return 1;
+}
+
+static void
+town_attr_rewind(void *priv_data)
+{
+ struct town_priv *twn=priv_data;
+
+ twn->aidx=0;
+ twn->attr_next=attr_label;
+}
+
+static int
+town_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
+{
+ struct town_priv *twn=priv_data;
+ int len;
+
+ attr->type=attr_type;
+ switch (attr_type) {
+ case attr_any:
+ while (twn->attr_next != attr_none) {
+ if (town_attr_get(twn, twn->attr_next, attr))
+ return 1;
+ }
+ return 0;
+ case attr_label:
+ attr->u.str=twn->district;
+ twn->attr_next=attr_town_name;
+ if (attr->u.str[0])
+ return 1;
+ attr->u.str=twn->name;
+ return ((attr->u.str && attr->u.str[0]) ? 1:0);
+ case attr_town_name:
+ attr->u.str=twn->name;
+ twn->attr_next=attr_town_postal;
+ return ((attr->u.str && attr->u.str[0]) ? 1:0);
+ case attr_town_postal:
+ case attr_postal:
+ strncpy(twn->postal, twn->postal_code1, 32);
+ attr->u.str=twn->postal;
+ len=mg_country_postal_len(twn->country);
+ if (!len)
+ len=31;
+ twn->postal[len]='\0';
+ twn->attr_next=attr_district_name;
+ return ((attr->u.str && attr->u.str[0]) ? 1:0);
+ case attr_district_name:
+ attr->u.str=twn->district;
+ twn->attr_next=attr_debug;
+ return ((attr->u.str && attr->u.str[0]) ? 1:0);
+ case attr_town_streets_item:
+ twn->town_attr_item.type=type_town_streets;
+ twn->town_attr_item.id_hi=twn->country | (file_town_twn << 16) | 0x10000000;
+ twn->town_attr_item.id_lo=twn->street_assoc;
+ attr->u.item=&twn->town_attr_item;
+ twn->attr_next=attr_debug;
+ return 1;
+ case attr_debug:
+ sprintf(twn->debug, "order %d\nsize %d\nstreet_assoc 0x%x", twn->order, twn->size, twn->street_assoc);
+ attr->u.str=twn->debug;
+ twn->attr_next=attr_none;
+ return 1;
+ default:
+ dbg_assert(1==0);
+ return 0;
+ }
+ return 1;
+}
+
+static struct item_methods town_meth = {
+ town_coord_rewind,
+ town_coord_get,
+ town_attr_rewind,
+ town_attr_get,
+};
+
+static void
+town_get_data(struct town_priv *twn, unsigned char **p)
+{
+ twn->id=get_u32_unal(p);
+ twn->c.x=get_u32_unal(p);
+ twn->c.y=get_u32_unal(p);
+ twn->name=get_string(p);
+ twn->district=get_string(p);
+ twn->postal_code1=get_string(p);
+ twn->order=get_u8(p); /* 1-15 (19) */
+ twn->country=get_u16_unal(p);
+ twn->type=get_u8(p);
+ twn->unknown2=get_u32_unal(p);
+ twn->size=get_u8(p);
+ twn->street_assoc=get_u32_unal(p);
+ twn->unknown3=get_u8(p);
+ twn->postal_code2=get_string(p);
+ twn->unknown4=get_u32_unal(p);
+#if 0
+ printf("%s\t%s\t%s\t%d\t%d\t%d\n",twn->name,twn->district,twn->postal_code1,twn->order, twn->country, twn->type);
+#endif
+}
+ /*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 */
+static unsigned char limit[]={0,1,2,2,4,6,8,10,11,13,14,14,14,20,20,20,20,20,20};
+
+static enum item_type town_item[]={type_town_label_5e1, type_town_label_1e2, type_town_label_2e2, type_town_label_5e2, type_town_label_1e3, type_town_label_1e3, type_town_label_2e3, type_town_label_5e3, type_town_label_1e4, type_town_label_2e4, type_town_label_5e4, type_town_label_1e5, type_town_label_1e5, type_town_label_2e5, type_town_label_5e5, type_town_label_1e6, type_town_label_2e6};
+static enum item_type district_item[]={type_district_label_5e1, type_district_label_1e2, type_district_label_2e2, type_district_label_5e2, type_district_label_1e3, type_district_label_1e3, type_district_label_2e3, type_district_label_5e3, type_district_label_1e4, type_district_label_2e4, type_district_label_5e4, type_district_label_1e5, type_district_label_1e5, type_district_label_2e5, type_district_label_5e5, type_district_label_1e6, type_district_label_2e6};
+int
+town_get(struct map_rect_priv *mr, struct town_priv *twn, struct item *item)
+{
+ int size;
+ for (;;) {
+ if (mr->b.p >= mr->b.end)
+ return 0;
+ town_get_data(twn, &mr->b.p);
+ twn->cidx=0;
+ twn->aidx=0;
+ twn->attr_next=attr_label;
+ if (! mr->cur_sel || (twn->order <= limit[mr->cur_sel->order] && coord_rect_contains(&mr->cur_sel->u.c_rect,&twn->c))) {
+ switch(twn->type) {
+ case 1:
+ size=twn->size;
+ if (size >= sizeof(town_item)/sizeof(enum item_type))
+ size=sizeof(town_item)/sizeof(enum item_type)-1;
+ item->type=town_item[size];
+ break;
+ case 3:
+ size=twn->size;
+ if (size == 6 && twn->order < 14)
+ size++;
+ if (size == 5 && twn->order < 14)
+ size+=2;
+ if (size >= sizeof(district_item)/sizeof(enum item_type))
+ size=sizeof(district_item)/sizeof(enum item_type)-1;
+ item->type=district_item[size];
+ break;
+ case 4:
+ item->type=type_port_label;
+ break;
+ case 9:
+ item->type=type_highway_exit_label;
+ break;
+ default:
+ printf("unknown town type 0x%x '%s' '%s' 0x%x,0x%x\n", twn->type, twn->name, twn->district, twn->c.x, twn->c.y);
+ item->type=type_town_label;
+ }
+ if (map_selection_contains_item(mr->cur_sel, 0, item->type)) {
+ item->id_hi=twn->country | (mr->current_file << 16);
+ item->id_lo=twn->id;
+ item->priv_data=twn;
+ item->meth=&town_meth;
+ return 1;
+ }
+ }
+ }
+}
+
+int
+town_get_byid(struct map_rect_priv *mr, struct town_priv *twn, int id_hi, int id_lo, struct item *item)
+{
+ int country=id_hi & 0xffff;
+ int res;
+ if (!tree_search_hv(mr->m->dirname, "town", (id_lo >> 8) | (country << 24), id_lo & 0xff, &res))
+ return 0;
+ block_get_byindex(mr->m->file[mr->current_file], res >> 16, &mr->b);
+ mr->b.p=mr->b.block_start+(res & 0xffff);
+ return town_get(mr, twn, item);
+}
+
+static int
+town_search_compare(unsigned char **p, struct map_rect_priv *mr)
+{
+ int country, d;
+ char *name;
+
+ if (mr->search_type == attr_town_postal) {
+ mr->search_blk_count=1;
+ mr->search_blk_off=(struct block_offset *)(*p);
+ *p+=4;
+ name=get_string(p);
+ d=0;
+ } else {
+ country=get_u16_unal(p);
+ dbg(1,"country 0x%x ", country);
+ name=get_string(p);
+ dbg(1,"name '%s' ",name);
+ mr->search_blk_count=get_u32_unal(p);
+ mr->search_blk_off=(struct block_offset *)(*p);
+ dbg(1,"len %d ", mr->search_blk_count);
+ (*p)+=mr->search_blk_count*4;
+ d=mr->search_country-country;
+ }
+ if (!d) {
+ if (mr->search_partial)
+ d=strncasecmp(mr->search_str, name, strlen(mr->search_str));
+ else
+ d=strcasecmp(mr->search_str, name);
+ }
+ dbg(1,"%d \n",d);
+ return d;
+
+}
+
+
+
+struct item *
+town_search_get_item(struct map_rect_priv *mr)
+{
+ int dir=1,leaf;
+
+ if (! mr->search_blk_count) {
+ dbg(1,"partial %d 0x%x '%s' ***\n", mr->search_partial, mr->search_country, mr->search_str);
+ if (! mr->search_linear) {
+ while ((leaf=tree_search_next(&mr->ts, &mr->search_p, dir)) != -1) {
+ dir=town_search_compare(&mr->search_p, mr);
+ if (! dir) {
+ mr->search_linear=1;
+ mr->search_p=NULL;
+ break;
+ }
+ }
+ if (! mr->search_linear) {
+ dbg(1,"not found\n");
+ return NULL;
+ }
+ }
+ if (! tree_search_next_lin(&mr->ts, &mr->search_p)) {
+ dbg(1,"linear not found\n");
+ return NULL;
+ }
+ if (town_search_compare(&mr->search_p, mr)) {
+ dbg(1,"no match\n");
+ return NULL;
+ }
+ dbg(1,"found %d blocks\n",mr->search_blk_count);
+ }
+ if (! mr->search_blk_count)
+ return NULL;
+ dbg(1,"block 0x%x offset 0x%x\n", block_offset_get_block(mr->search_blk_off), block_offset_get_offset(mr->search_blk_off));
+ block_get_byindex(mr->m->file[mr->current_file], block_offset_get_block(mr->search_blk_off), &mr->b);
+ mr->b.p=mr->b.block_start+block_offset_get_offset(mr->search_blk_off);
+ town_get(mr, &mr->town, &mr->item);
+ mr->search_blk_off++;
+ mr->search_blk_count--;
+ return &mr->item;
+}
diff --git a/map/mg/tree.c b/map/mg/tree.c
new file mode 100644
index 00000000..9c2bb08e
--- /dev/null
+++ b/map/mg/tree.c
@@ -0,0 +1,282 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "debug.h"
+#include "mg.h"
+
+struct tree_hdr {
+ /*unsigned int addr;
+ unsigned int size;
+ unsigned int low;*/
+ unsigned char p[12];
+};
+static inline unsigned int tree_hdr_get_addr(struct tree_hdr * tree) { unsigned char *p = tree->p; return get_u32(&p); }
+static inline unsigned int tree_hdr_get_size(struct tree_hdr * tree) { unsigned char *p = tree->p+4; return get_u32(&p); }
+static inline unsigned int tree_hdr_get_low(struct tree_hdr * tree) { unsigned char *p = tree->p+8; return get_u32(&p); }
+
+struct tree_hdr_h {
+/* unsigned int addr;
+ unsigned int size;*/
+ unsigned char p[8];
+};
+static inline unsigned int tree_hdr_h_get_addr(struct tree_hdr_h * tree) { unsigned char *p = tree->p; return get_u32(&p); }
+static inline unsigned int tree_hdr_h_get_size(struct tree_hdr_h * tree) { unsigned char *p = tree->p+4; return get_u32(&p); }
+
+struct tree_leaf_h {
+/* unsigned int lower;
+ unsigned int higher;
+ unsigned int match;
+ unsigned int value;*/
+ unsigned char p[16];
+};
+static inline unsigned int tree_leaf_h_get_lower(struct tree_leaf_h * tree) { unsigned char *p = tree->p; return get_u32(&p); }
+static inline unsigned int tree_leaf_h_get_higher(struct tree_leaf_h * tree) { unsigned char *p = tree->p+4; return get_u32(&p); }
+static inline unsigned int tree_leaf_h_get_match(struct tree_leaf_h * tree) { unsigned char *p = tree->p+8; return get_u32(&p); }
+static inline unsigned int tree_leaf_h_get_value(struct tree_leaf_h * tree) { unsigned char *p = tree->p+12; return get_u32(&p); }
+
+
+struct tree_hdr_v {
+ /*unsigned int count;
+ unsigned int next;
+ unsigned int unknown;*/
+ unsigned char p[12];
+};
+static inline unsigned int tree_hdr_v_get_count(struct tree_hdr_v * tree) { unsigned char *p = tree->p; return get_u32_unal(&p); }
+static inline unsigned int tree_hdr_v_get_next(struct tree_hdr_v * tree) { unsigned char *p = tree->p+4; return get_u32_unal(&p); }
+static inline unsigned int tree_hdr_v_get_unknown(struct tree_hdr_v * tree) { unsigned char *p = tree->p+8; return get_u32_unal(&p); }
+
+struct tree_leaf_v {
+ unsigned char key;
+ /*int value;*/
+ unsigned char p[4];
+} __attribute__((packed));
+static inline int tree_leaf_v_get_value(struct tree_leaf_v * tree) { unsigned char *p = tree->p; return get_u32_unal(&p); }
+
+static int
+tree_search_h(struct file *file, unsigned int search)
+{
+ unsigned char *p=file->begin,*end;
+ int last,i=0,value,lower;
+ struct tree_hdr_h *thdr;
+ struct tree_leaf_h *tleaf;
+
+ dbg(1,"enter\n");
+ while (i++ < 1000) {
+ thdr=(struct tree_hdr_h *)p;
+ p+=sizeof(*thdr);
+ end=p+tree_hdr_h_get_size(thdr);
+ dbg(1,"@0x%x\n", p-file->begin);
+ last=0;
+ while (p < end) {
+ tleaf=(struct tree_leaf_h *)p;
+ p+=sizeof(*tleaf);
+ dbg(1,"low:0x%x high:0x%x match:0x%x val:0x%x search:0x%x\n", tree_leaf_h_get_lower(tleaf), tree_leaf_h_get_higher(tleaf), tree_leaf_h_get_match(tleaf), tree_leaf_h_get_value(tleaf), search);
+ value=tree_leaf_h_get_value(tleaf);
+ if (value == search)
+ return tree_leaf_h_get_match(tleaf);
+ if (value > search) {
+ dbg(1,"lower\n");
+ lower=tree_leaf_h_get_lower(tleaf);
+ if (lower)
+ last=lower;
+ break;
+ }
+ last=tree_leaf_h_get_higher(tleaf);
+ }
+ if (! last || last == -1)
+ return 0;
+ p=file->begin+last;
+ }
+ return 0;
+}
+
+static int
+tree_search_v(struct file *file, int offset, int search)
+{
+ unsigned char *p=file->begin+offset;
+ int i=0,count,next;
+ struct tree_hdr_v *thdr;
+ struct tree_leaf_v *tleaf;
+ while (i++ < 1000) {
+ thdr=(struct tree_hdr_v *)p;
+ p+=sizeof(*thdr);
+ count=tree_hdr_v_get_count(thdr);
+ dbg(1,"offset=0x%x count=0x%x\n", p-file->begin, count);
+ while (count--) {
+ tleaf=(struct tree_leaf_v *)p;
+ p+=sizeof(*tleaf);
+ dbg(1,"0x%x 0x%x\n", tleaf->key, search);
+ if (tleaf->key == search)
+ return tree_leaf_v_get_value(tleaf);
+ }
+ next=tree_hdr_v_get_next(thdr);
+ if (! next)
+ break;
+ p=file->begin+next;
+ }
+ return 0;
+}
+
+int
+tree_search_hv(char *dirname, char *filename, unsigned int search_h, unsigned int search_v, int *result)
+{
+ struct file *f_idx_h, *f_idx_v;
+ char buffer[4096];
+ int h,v;
+
+ dbg(1,"enter(%s, %s, 0x%x, 0x%x, %p)\n",dirname, filename, search_h, search_v, result);
+ sprintf(buffer, "%s/%s.h1", dirname, filename);
+ f_idx_h=file_create_caseinsensitive(buffer);
+ if (! f_idx_h)
+ return 0;
+ file_mmap(f_idx_h);
+ sprintf(buffer, "%s/%s.v1", dirname, filename);
+ f_idx_v=file_create_caseinsensitive(buffer);
+ dbg(1,"%p %p\n", f_idx_h, f_idx_v);
+ if (! f_idx_v) {
+ file_destroy(f_idx_h);
+ return 0;
+ }
+ file_mmap(f_idx_v);
+ if ((h=tree_search_h(f_idx_h, search_h))) {
+ dbg(1,"h=0x%x\n", h);
+ if ((v=tree_search_v(f_idx_v, h, search_v))) {
+ dbg(1,"v=0x%x\n", v);
+ *result=v;
+ file_destroy(f_idx_v);
+ file_destroy(f_idx_h);
+ dbg(1,"return 1\n");
+ return 1;
+ }
+ }
+ file_destroy(f_idx_v);
+ file_destroy(f_idx_h);
+ dbg(1,"return 0\n");
+ return 0;
+}
+
+static struct tree_search_node *
+tree_search_enter(struct tree_search *ts, int offset)
+{
+ struct tree_search_node *tsn=&ts->nodes[++ts->curr_node];
+ unsigned char *p;
+ p=ts->f->begin+offset;
+ tsn->hdr=(struct tree_hdr *)p;
+ tsn->p=p+sizeof(struct tree_hdr);
+ tsn->last=tsn->p;
+ tsn->end=p+tree_hdr_get_size(tsn->hdr);
+ tsn->low=tree_hdr_get_low(tsn->hdr);
+ tsn->high=tree_hdr_get_low(tsn->hdr);
+ dbg(1,"pos 0x%x addr 0x%x size 0x%x low 0x%x end 0x%x\n", p-ts->f->begin, tree_hdr_get_addr(tsn->hdr), tree_hdr_get_size(tsn->hdr), tree_hdr_get_low(tsn->hdr), tsn->end-ts->f->begin);
+ return tsn;
+}
+
+int tree_search_next(struct tree_search *ts, unsigned char **p, int dir)
+{
+ struct tree_search_node *tsn=&ts->nodes[ts->curr_node];
+
+ if (! *p)
+ *p=tsn->p;
+ dbg(1,"next *p=%p dir=%d\n", *p, dir);
+ dbg(1,"low1=0x%x high1=0x%x\n", tsn->low, tsn->high);
+ if (dir <= 0) {
+ dbg(1,"down 0x%x\n", tsn->low);
+ if (tsn->low != 0xffffffff) {
+ tsn=tree_search_enter(ts, tsn->low);
+ *p=tsn->p;
+ tsn->high=get_u32(p);
+ ts->last_node=ts->curr_node;
+ dbg(1,"saving last2 %d 0x%x\n", ts->curr_node, tsn->last-ts->f->begin);
+ dbg(1,"high2=0x%x\n", tsn->high);
+ return 0;
+ }
+ return -1;
+ }
+ tsn->low=tsn->high;
+ tsn->last=*p;
+ tsn->high=get_u32_unal(p);
+ dbg(1,"saving last3 %d %p\n", ts->curr_node, tsn->last);
+ if (*p < tsn->end)
+ return (tsn->low == 0xffffffff ? 1 : 0);
+ dbg(1,"end reached high=0x%x\n",tsn->high);
+ if (tsn->low != 0xffffffff) {
+ dbg(1,"low 0x%x\n", tsn->low);
+ tsn=tree_search_enter(ts, tsn->low);
+ *p=tsn->p;
+ tsn->high=get_u32_unal(p);
+ ts->last_node=ts->curr_node;
+ dbg(1,"saving last4 %d 0x%x\n", ts->curr_node, tsn->last-ts->f->begin);
+ dbg(1,"high4=0x%x\n", tsn->high);
+ return 0;
+ }
+ return -1;
+}
+
+int tree_search_next_lin(struct tree_search *ts, unsigned char **p)
+{
+ struct tree_search_node *tsn=&ts->nodes[ts->curr_node];
+ int high;
+
+ dbg(1,"pos=%d 0x%x\n", ts->curr_node, *p-ts->f->begin);
+ if (*p)
+ ts->nodes[ts->last_node].last=*p;
+ *p=tsn->last;
+ for (;;) {
+ high=get_u32_unal(p);
+ if (*p < tsn->end) {
+ ts->last_node=ts->curr_node;
+ while (high != 0xffffffff) {
+ tsn=tree_search_enter(ts, high);
+ dbg(1,"reload %d\n",ts->curr_node);
+ high=tsn->low;
+ }
+ return 1;
+ }
+ dbg(1,"eon %d 0x%x 0x%x\n", ts->curr_node, *p-ts->f->begin, tsn->end-ts->f->begin);
+ if (! ts->curr_node)
+ break;
+ ts->curr_node--;
+ tsn=&ts->nodes[ts->curr_node];
+ *p=tsn->last;
+ }
+
+ return 0;
+}
+
+void
+tree_search_init(char *dirname, char *filename, struct tree_search *ts, int offset)
+{
+ char buffer[4096];
+ sprintf(buffer, "%s/%s", dirname, filename);
+ ts->f=file_create_caseinsensitive(buffer);
+ ts->curr_node=-1;
+ if (ts->f) {
+ file_mmap(ts->f);
+ tree_search_enter(ts, offset);
+ }
+}
+
+void
+tree_search_free(struct tree_search *ts)
+{
+ if (ts->f)
+ file_destroy(ts->f);
+}
diff --git a/map/poi_geodownload/Makefile.am b/map/poi_geodownload/Makefile.am
new file mode 100644
index 00000000..e30f359e
--- /dev/null
+++ b/map/poi_geodownload/Makefile.am
@@ -0,0 +1,7 @@
+SUBDIRS=libmdb
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -I$(srcdir)/libmdb/include -DMODULE=map_poi_geodownload
+modulemap_LTLIBRARIES = libmap_poi_geodownload.la
+libmap_poi_geodownload_la_SOURCES = poi_geodownload.c
+libmap_poi_geodownload_la_LIBADD = -Llibmdb -lmdb
+libmap_poi_geodownload_la_LDFLAGS = -module -avoid-version
diff --git a/navit/data/poi_geodownload/libmdb/Makefile.am b/map/poi_geodownload/libmdb/Makefile.am
index e2e440ba..e2e440ba 100644
--- a/navit/data/poi_geodownload/libmdb/Makefile.am
+++ b/map/poi_geodownload/libmdb/Makefile.am
diff --git a/navit/data/poi_geodownload/libmdb/backend.c b/map/poi_geodownload/libmdb/backend.c
index 902805c3..902805c3 100644
--- a/navit/data/poi_geodownload/libmdb/backend.c
+++ b/map/poi_geodownload/libmdb/backend.c
diff --git a/navit/data/poi_geodownload/libmdb/catalog.c b/map/poi_geodownload/libmdb/catalog.c
index dc08abdd..dc08abdd 100644
--- a/navit/data/poi_geodownload/libmdb/catalog.c
+++ b/map/poi_geodownload/libmdb/catalog.c
diff --git a/map/poi_geodownload/libmdb/data.c b/map/poi_geodownload/libmdb/data.c
new file mode 100644
index 00000000..f8749842
--- /dev/null
+++ b/map/poi_geodownload/libmdb/data.c
@@ -0,0 +1,858 @@
+/* MDB Tools - A library for reading MS Access database file
+ * Copyright (C) 2000 Brian Bruns
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+
+#include "mdbtools.h"
+#include "time.h"
+#include "math.h"
+
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
+
+#define OFFSET_MASK 0x1fff
+
+char *mdb_money_to_string(MdbHandle *mdb, int start, char *s);
+static int _mdb_attempt_bind(MdbHandle *mdb,
+ MdbColumn *col, unsigned char isnull, int offset, int len);
+static char *mdb_num_to_string(MdbHandle *mdb, int start, int datatype, int prec, int scale);
+int mdb_copy_ole(MdbHandle *mdb, char *dest, int start, int size);
+
+static char date_fmt[64] = "%x %X";
+
+void mdb_set_date_fmt(const char *fmt)
+{
+ date_fmt[63] = 0;
+ strncpy(date_fmt, fmt, 63);
+}
+
+void mdb_bind_column(MdbTableDef *table, int col_num, void *bind_ptr)
+{
+MdbColumn *col;
+
+ /*
+ ** the column arrary is 0 based, so decrement to get 1 based parameter
+ */
+ col=g_ptr_array_index(table->columns, col_num - 1);
+ col->bind_ptr = bind_ptr;
+}
+int
+mdb_bind_column_by_name(MdbTableDef *table, gchar *col_name, void *bind_ptr)
+{
+ unsigned int i;
+ int col_num = -1;
+ MdbColumn *col;
+
+ for (i=0;i<table->num_cols;i++) {
+ col=g_ptr_array_index(table->columns,i);
+ if (!strcmp(col->name,col_name)) {
+ col_num = col->col_num + 1;
+ mdb_bind_column(table, col_num, bind_ptr);
+ break;
+ }
+ }
+
+ return col_num;
+}
+void mdb_bind_len(MdbTableDef *table, int col_num, int *len_ptr)
+{
+MdbColumn *col;
+
+ col=g_ptr_array_index(table->columns, col_num - 1);
+ col->len_ptr = len_ptr;
+}
+
+/**
+ * mdb_find_pg_row
+ * @mdb: Database file handle
+ * @pg_row: Lower byte contains the row number, the upper three contain page
+ * @buf: Pointer for returning a pointer to the page
+ * @off: Pointer for returning an offset to the row
+ * @len: Pointer for returning the length of the row
+ *
+ * Returns: 0 on success. 1 on failure.
+ */
+int mdb_find_pg_row(MdbHandle *mdb, int pg_row, unsigned char **buf, int *off, size_t *len)
+{
+ unsigned int pg = pg_row >> 8;
+ unsigned int row = pg_row & 0xff;
+
+ if (mdb_read_alt_pg(mdb, pg) != mdb->fmt->pg_size)
+ return 1;
+ mdb_swap_pgbuf(mdb);
+ *off = mdb_pg_get_int16(mdb, mdb->fmt->row_count_offset + 2 + (row*2));
+ *len = mdb_find_end_of_row(mdb, row) - *off + 1;
+ mdb_swap_pgbuf(mdb);
+ *buf = mdb->alt_pg_buf;
+ return 0;
+}
+
+int
+mdb_find_end_of_row(MdbHandle *mdb, int row)
+{
+ MdbFormatConstants *fmt = mdb->fmt;
+ int row_end;
+
+ /* Search the previous "row start" values for the first non-'lookupflag' one.
+ * If we don't find one, then the end of the page is the correct value.
+ */
+#if 1
+ if (row==0) {
+ row_end = fmt->pg_size - 1;
+ } else {
+ row_end = (mdb_pg_get_int16(mdb, ((fmt->row_count_offset + 2) + (row - 1) * 2)) & OFFSET_MASK) - 1;
+ }
+ return row_end;
+#else
+ int i, row_start;
+
+ /* if lookupflag is not set, it's good (deleteflag is ok) */
+ for (i = row - 1; i >= 0; i--) {
+ row_start = mdb_pg_get_int16(mdb, ((fmt->row_count_offset + 2) + i * 2));
+ if (!(row_start & 0x8000)) {
+ break;
+ }
+ }
+
+ if (i == -1) {
+ row_end = fmt->pg_size - 1;
+ } else {
+ row_end = (row_start & OFFSET_MASK) - 1;
+ }
+ return row_end;
+#endif
+}
+#if 0
+static int mdb_is_null(unsigned char *null_mask, int col_num)
+{
+int byte_num = (col_num - 1) / 8;
+int bit_num = (col_num - 1) % 8;
+
+ if ((1 << bit_num) & null_mask[byte_num]) {
+ return 0;
+ } else {
+ return 1;
+ }
+}
+#endif
+/* bool has to be handled specially because it uses the null bit to store its
+** value*/
+static int
+mdb_xfer_bound_bool(MdbHandle *mdb, MdbColumn *col, int value)
+{
+
+ col->cur_value_len = value;
+ if (col->bind_ptr) {
+ strcpy(col->bind_ptr, value ? "0" : "1");
+ }
+
+ return 0;
+}
+static int mdb_xfer_bound_ole(MdbHandle *mdb, int start, MdbColumn *col, int len)
+{
+ int ret = 0;
+ if (len) {
+ col->cur_value_start = start;
+ col->cur_value_len = len;
+ } else {
+ col->cur_value_start = 0;
+ col->cur_value_len = 0;
+ }
+ if (col->bind_ptr || col->len_ptr) {
+ //ret = mdb_copy_ole(mdb, col->bind_ptr, start, len);
+ memcpy(col->bind_ptr, &mdb->pg_buf[start], MDB_MEMO_OVERHEAD);
+ }
+ if (col->len_ptr) {
+ *col->len_ptr = MDB_MEMO_OVERHEAD;
+ }
+ return ret;
+}
+static int mdb_xfer_bound_data(MdbHandle *mdb, int start, MdbColumn *col, int len)
+{
+int ret;
+ //if (!strcmp("Name",col->name)) {
+ //printf("start %d %d\n",start, len);
+ //}
+ if (len) {
+ col->cur_value_start = start;
+ col->cur_value_len = len;
+ } else {
+ col->cur_value_start = 0;
+ col->cur_value_len = 0;
+ }
+ if (col->bind_ptr) {
+ if (!len) {
+ strcpy(col->bind_ptr, "");
+ } else if (col->col_type == MDB_NUMERIC) {
+ //fprintf(stdout,"len %d size %d\n",len, col->col_size);
+ char *str = mdb_num_to_string(mdb, start, col->col_type,
+ col->col_prec, col->col_scale);
+ strcpy(col->bind_ptr, str);
+ g_free(str);
+ } else {
+ //fprintf(stdout,"len %d size %d\n",len, col->col_size);
+ char *str = mdb_col_to_string(mdb, mdb->pg_buf, start,
+ col->col_type, len);
+ strcpy(col->bind_ptr, str);
+
+ }
+ ret = strlen(col->bind_ptr);
+ if (col->len_ptr) {
+ *col->len_ptr = ret;
+ }
+ return ret;
+ }
+ return 0;
+}
+int mdb_read_row(MdbTableDef *table, unsigned int row)
+{
+ MdbHandle *mdb = table->entry->mdb;
+ MdbFormatConstants *fmt = mdb->fmt;
+ MdbColumn *col;
+ unsigned int i;
+ int rc;
+ int row_start, row_end;
+ int delflag, lookupflag;
+ MdbField fields[256];
+ int num_fields;
+
+ if (table->num_rows <= row)
+ return 0;
+
+ row_start = mdb_pg_get_int16(mdb, (fmt->row_count_offset + 2) + (row*2));
+ row_end = mdb_find_end_of_row(mdb, row);
+
+ delflag = lookupflag = 0;
+ if (row_start & 0x8000) lookupflag++;
+ if (row_start & 0x4000) delflag++;
+ row_start &= OFFSET_MASK; /* remove flags */
+#if MDB_DEBUG
+ fprintf(stdout,"Row %d bytes %d to %d %s %s\n",
+ row, row_start, row_end,
+ lookupflag ? "[lookup]" : "",
+ delflag ? "[delflag]" : "");
+#endif
+
+ if (!table->noskip_del && delflag) {
+ row_end = row_start-1;
+ return 0;
+ }
+
+ num_fields = mdb_crack_row(table, row_start, row_end, fields);
+ if (!mdb_test_sargs(table, fields, num_fields)) return 0;
+
+#if MDB_DEBUG
+ fprintf(stdout,"sarg test passed row %d \n", row);
+#endif
+
+#if MDB_DEBUG
+ buffer_dump(mdb->pg_buf, row_start, row_end);
+#endif
+
+ /* take advantage of mdb_crack_row() to clean up binding */
+ /* use num_cols instead of num_fields -- bsb 03/04/02 */
+ for (i = 0; i < table->num_cols; i++) {
+ col = g_ptr_array_index(table->columns,fields[i].colnum);
+ rc = _mdb_attempt_bind(mdb, col, fields[i].is_null,
+ fields[i].start, fields[i].siz);
+ }
+
+ return 1;
+}
+static int _mdb_attempt_bind(MdbHandle *mdb,
+ MdbColumn *col,
+ unsigned char isnull,
+ int offset,
+ int len)
+{
+ if (col->col_type == MDB_BOOL) {
+ mdb_xfer_bound_bool(mdb, col, isnull);
+ } else if (isnull) {
+ mdb_xfer_bound_data(mdb, 0, col, 0);
+ } else if (col->col_type == MDB_OLE) {
+ mdb_xfer_bound_ole(mdb, offset, col, len);
+ } else {
+ //if (!mdb_test_sargs(mdb, col, offset, len)) {
+ //return 0;
+ //}
+ mdb_xfer_bound_data(mdb, offset, col, len);
+ }
+ return 1;
+}
+static int mdb_read_next_dpg(MdbTableDef *table)
+{
+ MdbCatalogEntry *entry = table->entry;
+ MdbHandle *mdb = entry->mdb;
+ int next_pg;
+
+#ifndef SLOW_READ
+ next_pg = mdb_map_find_next(mdb, table->usage_map,
+ table->map_sz, table->cur_phys_pg);
+
+ if (next_pg >= 0) {
+ if (mdb_read_pg(mdb, next_pg)) {
+ table->cur_phys_pg = next_pg;
+ return table->cur_phys_pg;
+ } else {
+ return 0;
+ }
+ }
+ fprintf(stderr, "Warning: defaulting to brute force read\n");
+#endif
+ /* can't do a fast read, go back to the old way */
+ do {
+ if (!mdb_read_pg(mdb, table->cur_phys_pg++))
+ return 0;
+ } while (mdb->pg_buf[0]!=0x01 || mdb_pg_get_int32(mdb, 4)!=entry->table_pg);
+ /* fprintf(stderr,"returning new page %ld\n", table->cur_phys_pg); */
+ return table->cur_phys_pg;
+}
+int mdb_rewind_table(MdbTableDef *table)
+{
+ table->cur_pg_num=0;
+ table->cur_phys_pg=0;
+ table->cur_row=0;
+
+ return 0;
+}
+int
+mdb_fetch_row(MdbTableDef *table)
+{
+ MdbHandle *mdb = table->entry->mdb;
+ MdbFormatConstants *fmt = mdb->fmt;
+ unsigned int rows;
+ int rc;
+ guint32 pg;
+
+ if (table->num_rows==0)
+ return 0;
+
+ /* initialize */
+ if (!table->cur_pg_num) {
+ table->cur_pg_num=1;
+ table->cur_row=0;
+ if ((!table->is_temp_table)&&(table->strategy!=MDB_INDEX_SCAN))
+ if (!mdb_read_next_dpg(table)) return 0;
+ }
+
+ do {
+ if (table->is_temp_table) {
+ GPtrArray *pages = table->temp_table_pages;
+ rows = mdb_get_int16(
+ g_ptr_array_index(pages, table->cur_pg_num-1),
+ fmt->row_count_offset);
+ if (table->cur_row >= rows) {
+ table->cur_row = 0;
+ table->cur_pg_num++;
+ if (table->cur_pg_num > pages->len)
+ return 0;
+ }
+ memcpy(mdb->pg_buf,
+ g_ptr_array_index(pages, table->cur_pg_num-1),
+ fmt->pg_size);
+ } else if (table->strategy==MDB_INDEX_SCAN) {
+
+ if (!mdb_index_find_next(table->mdbidx, table->scan_idx, table->chain, &pg, (guint16 *) &(table->cur_row))) {
+ mdb_index_scan_free(table);
+ return 0;
+ }
+ mdb_read_pg(mdb, pg);
+ } else {
+ rows = mdb_pg_get_int16(mdb,fmt->row_count_offset);
+
+ /* if at end of page, find a new page */
+ if (table->cur_row >= rows) {
+ table->cur_row=0;
+
+ if (!mdb_read_next_dpg(table)) {
+ return 0;
+ }
+ }
+ }
+
+ /* printf("page %d row %d\n",table->cur_phys_pg, table->cur_row); */
+ rc = mdb_read_row(table, table->cur_row);
+ table->cur_row++;
+ } while (!rc);
+
+ return 1;
+}
+void mdb_data_dump(MdbTableDef *table)
+{
+ unsigned int i;
+ char *bound_values[MDB_MAX_COLS];
+
+ for (i=0;i<table->num_cols;i++) {
+ bound_values[i] = (char *) g_malloc(256);
+ mdb_bind_column(table, i+1, bound_values[i]);
+ }
+ mdb_rewind_table(table);
+ while (mdb_fetch_row(table)) {
+ for (i=0;i<table->num_cols;i++) {
+ fprintf(stdout, "column %d is %s\n", i+1, bound_values[i]);
+ }
+ }
+ for (i=0;i<table->num_cols;i++) {
+ g_free(bound_values[i]);
+ }
+}
+
+int mdb_is_fixed_col(MdbColumn *col)
+{
+ return col->is_fixed;
+}
+#if 0
+static char *mdb_data_to_hex(MdbHandle *mdb, char *text, int start, int size)
+{
+int i;
+
+ for (i=start; i<start+size; i++) {
+ sprintf(&text[(i-start)*2],"%02x", mdb->pg_buf[i]);
+ }
+ text[(i-start)*2]='\0';
+
+ return text;
+}
+#endif
+size_t
+mdb_ole_read_next(MdbHandle *mdb, MdbColumn *col, void *ole_ptr)
+{
+ guint16 ole_len;
+ guint16 ole_flags;
+ unsigned char *buf;
+ int pg_row, row_start;
+ size_t len;
+
+ ole_len = mdb_get_int16(ole_ptr, 0);
+ ole_flags = mdb_get_int16(ole_ptr, 2);
+
+ if (ole_flags == 0x8000) {
+ /* inline fields don't have a next */
+ return 0;
+ } else if (ole_flags == 0x4000) {
+ /* 0x4000 flagged ole's are contained on one page and thus
+ * should be handled entirely with mdb_ole_read() */
+ return 0;
+ } else if (ole_flags == 0x0000) {
+ pg_row = (col->cur_blob_pg << 8) & col->cur_blob_row;
+ if (mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &len)) {
+ return 0;
+ }
+ if (col->bind_ptr)
+ memcpy(col->bind_ptr, buf + row_start, len);
+ pg_row = mdb_get_int32(buf, row_start);
+ col->cur_blob_pg = pg_row >> 8;
+ col->cur_blob_row = pg_row & 0xff;
+
+ return len;
+ }
+ return 0;
+}
+size_t
+mdb_ole_read(MdbHandle *mdb, MdbColumn *col, void *ole_ptr, int chunk_size)
+{
+ guint16 ole_len;
+ guint16 ole_flags;
+ unsigned char *buf;
+ int pg_row, row_start;
+ size_t len;
+
+ ole_len = mdb_get_int16(ole_ptr, 0);
+ ole_flags = mdb_get_int16(ole_ptr, 2);
+ mdb_debug(MDB_DEBUG_OLE,"ole len = %d ole flags = %08x",
+ ole_len, ole_flags);
+
+ col->chunk_size = chunk_size;
+
+ if (ole_flags == 0x8000) {
+ /* inline ole field, if we can satisfy it, then do it */
+ len = col->cur_value_len - MDB_MEMO_OVERHEAD;
+ if (chunk_size >= len) {
+ if (col->bind_ptr)
+ memcpy(col->bind_ptr,
+ &mdb->pg_buf[col->cur_value_start +
+ MDB_MEMO_OVERHEAD],
+ len);
+ return len;
+ } else {
+ return 0;
+ }
+ } else if (ole_flags == 0x4000) {
+ pg_row = mdb_get_int32(ole_ptr, 4);
+ col->cur_blob_pg = pg_row >> 8;
+ col->cur_blob_row = pg_row & 0xff;
+ mdb_debug(MDB_DEBUG_OLE,"ole row = %d ole pg = %ld",
+ col->cur_blob_row, col->cur_blob_pg);
+
+ if (mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &len)) {
+ return 0;
+ }
+ mdb_debug(MDB_DEBUG_OLE,"start %d len %d", row_start, len);
+
+ if (col->bind_ptr) {
+ memcpy(col->bind_ptr, buf + row_start, len);
+ if (mdb_get_option(MDB_DEBUG_OLE))
+ buffer_dump(col->bind_ptr, 0, 16);
+ }
+ return len;
+ } else if (ole_flags == 0x0000) {
+ pg_row = mdb_get_int32(ole_ptr, 4);
+ col->cur_blob_pg = pg_row >> 8;
+ col->cur_blob_row = pg_row & 0xff;
+
+ if (mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &len)) {
+ return 0;
+ }
+
+ if (col->bind_ptr)
+ memcpy(col->bind_ptr, buf + row_start, len);
+
+ pg_row = mdb_get_int32(buf, row_start);
+ col->cur_blob_pg = pg_row >> 8;
+ col->cur_blob_row = pg_row & 0xff;
+
+ return len;
+ } else {
+ fprintf(stderr,"Unhandled ole field flags = %04x\n", ole_flags);
+ return 0;
+ }
+}
+int mdb_copy_ole(MdbHandle *mdb, char *dest, int start, int size)
+{
+ guint16 ole_len;
+ guint16 ole_flags;
+ gint32 row_start, pg_row;
+ size_t len;
+ unsigned char *buf;
+
+ if (size<MDB_MEMO_OVERHEAD) {
+ return 0;
+ }
+
+ /* The 16 bit integer at offset 0 is the length of the memo field.
+ * The 32 bit integer at offset 4 contains page and row information.
+ */
+ ole_len = mdb_pg_get_int16(mdb, start);
+ ole_flags = mdb_pg_get_int16(mdb, start+2);
+
+ if (ole_flags == 0x8000) {
+ len = size - MDB_MEMO_OVERHEAD;
+ /* inline ole field */
+ if (dest) memcpy(dest, &mdb->pg_buf[start + MDB_MEMO_OVERHEAD],
+ size - MDB_MEMO_OVERHEAD);
+ return len;
+ } else if (ole_flags == 0x4000) {
+ pg_row = mdb_get_int32(mdb->pg_buf, start+4);
+ mdb_debug(MDB_DEBUG_OLE,"Reading LVAL page %06x", pg_row >> 8);
+
+ if (mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &len)) {
+ return 0;
+ }
+ mdb_debug(MDB_DEBUG_OLE,"row num %d start %d len %d",
+ pg_row & 0xff, row_start, len);
+
+ if (dest)
+ memcpy(dest, buf + row_start, len);
+ return len;
+ } else if (ole_flags == 0x0000) {
+ int cur = 0;
+ pg_row = mdb_get_int32(mdb->pg_buf, start+4);
+ mdb_debug(MDB_DEBUG_OLE,"Reading LVAL page %06x", pg_row >> 8);
+ do {
+ if (mdb_find_pg_row(mdb,pg_row,&buf,&row_start,&len)) {
+ return 0;
+ }
+
+ mdb_debug(MDB_DEBUG_OLE,"row num %d start %d len %d",
+ pg_row & 0xff, row_start, len);
+
+ if (dest)
+ memcpy(dest+cur, buf + row_start + 4, len - 4);
+ cur += len - 4;
+
+ /* find next lval page */
+ pg_row = mdb_get_int32(buf, row_start);
+ } while ((pg_row >> 8));
+ return cur;
+ } else {
+ fprintf(stderr,"Unhandled ole field flags = %04x\n", ole_flags);
+ return 0;
+ }
+}
+static char *mdb_memo_to_string(MdbHandle *mdb, int start, int size)
+{
+ guint16 memo_len;
+ static char text[MDB_BIND_SIZE];
+ guint16 memo_flags;
+ gint32 row_start, pg_row;
+ size_t len;
+ unsigned char *buf;
+
+ if (size<MDB_MEMO_OVERHEAD) {
+ return "";
+ }
+
+#if MDB_DEBUG
+ buffer_dump(mdb->pg_buf, start, start + 12);
+#endif
+
+ /* The 16 bit integer at offset 0 is the length of the memo field.
+ * The 32 bit integer at offset 4 contains page and row information.
+ */
+ memo_len = mdb_pg_get_int16(mdb, start);
+ memo_flags = mdb_pg_get_int16(mdb, start+2);
+
+ if (memo_flags & 0x8000) {
+ /* inline memo field */
+ strncpy(text, (char *)&mdb->pg_buf[start + MDB_MEMO_OVERHEAD],
+ size - MDB_MEMO_OVERHEAD);
+ text[size - MDB_MEMO_OVERHEAD]='\0';
+ return text;
+ } else if (memo_flags & 0x4000) {
+ pg_row = mdb_get_int32(mdb->pg_buf, start+4);
+#if MDB_DEBUG
+ printf("Reading LVAL page %06x\n", pg_row >> 8);
+#endif
+ if (mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &len)) {
+ return "";
+ }
+#if MDB_DEBUG
+ printf("row num %d start %d len %d\n",
+ pg_row & 0xff, row_start, len);
+ buffer_dump(mdb->pg_buf, row_start, row_start + len);
+#endif
+ if (IS_JET3(mdb)) {
+ strncpy(text, (char*) buf + row_start, len);
+ text[len]='\0';
+ } else {
+ mdb_unicode2ascii(mdb, buf, row_start, len, text);
+ }
+ return text;
+ } else { /* if (memo_flags == 0x0000) { */
+ pg_row = mdb_get_int32(mdb->pg_buf, start+4);
+#if MDB_DEBUG
+ printf("Reading LVAL page %06x\n", pg_row >> 8);
+#endif
+ text[0]='\0';
+ do {
+ if (mdb_find_pg_row(mdb,pg_row,&buf,&row_start,&len)) {
+ return "";
+ }
+#if MDB_DEBUG
+ printf("row num %d start %d len %d\n",
+ pg_row & 0xff, row_start, len);
+#endif
+ strncat(text, (char*) buf + row_start + 4,
+ strlen(text) + len - 4 > MDB_BIND_SIZE ?
+ MDB_BIND_SIZE - strlen(text) : len - 4);
+
+ /* find next lval page */
+ pg_row = mdb_get_int32(mdb->pg_buf, row_start);
+ } while ((pg_row >> 8));
+ return text;
+/*
+ } else {
+ fprintf(stderr,"Unhandled memo field flags = %04x\n", memo_flags);
+ return "";
+*/
+ }
+}
+static char *
+mdb_num_to_string(MdbHandle *mdb, int start, int datatype, int prec, int scale)
+{
+ char *text;
+ gint32 l;
+
+ memcpy(&l, mdb->pg_buf+start+13, 4);
+
+ text = (char *) g_malloc(prec+2);
+ sprintf(text, "%0*" G_GINT32_FORMAT, prec, GINT32_FROM_LE(l));
+ if (scale) {
+ memmove(text+prec-scale, text+prec-scale+1, scale+1);
+ text[prec-scale] = '.';
+ }
+ return text;
+}
+
+static int trim_trailing_zeros(char * buff, int n)
+{
+ char * p = buff + n - 1;
+
+ while (p >= buff && *p == '0')
+ *p-- = '\0';
+
+ if (*p == '.')
+ *p = '\0';
+
+ return 0;
+}
+
+char *mdb_col_to_string(MdbHandle *mdb, unsigned char *buf, int start, int datatype, int size)
+{
+ /* FIX ME -- not thread safe */
+ static char text[MDB_BIND_SIZE];
+ time_t t;
+ int n;
+ float tf;
+ double td;
+
+ switch (datatype) {
+ case MDB_BOOL:
+ /* shouldn't happen. bools are handled specially
+ ** by mdb_xfer_bound_bool() */
+ break;
+ case MDB_BYTE:
+ sprintf(text,"%d",mdb_get_byte(buf, start));
+ return text;
+ break;
+ case MDB_INT:
+ sprintf(text,"%ld",(long)mdb_get_int16(buf, start));
+ return text;
+ break;
+ case MDB_LONGINT:
+ sprintf(text,"%ld",mdb_get_int32(buf, start));
+ return text;
+ break;
+ case MDB_FLOAT:
+ tf = mdb_get_single(mdb->pg_buf, start);
+ n = sprintf(text,"%.*f",FLT_DIG - (int)ceil(log10(tf)), tf);
+ trim_trailing_zeros(text, n);
+ return text;
+ break;
+ case MDB_DOUBLE:
+ td = mdb_get_double(mdb->pg_buf, start);
+ n = sprintf(text,"%.*f",DBL_DIG - (int)ceil(log10(td)), td);
+ trim_trailing_zeros(text, n);
+ return text;
+ break;
+ case MDB_TEXT:
+ if (size<0) {
+ return "";
+ }
+ if (IS_JET4(mdb)) {
+/*
+ int i;
+ for (i=0;i<size;i++) {
+ fprintf(stdout, "%c %02x ", mdb->pg_buf[start+i], mdb->pg_buf[start+i]);
+ }
+ fprintf(stdout, "\n");
+*/
+ mdb_unicode2ascii(mdb, mdb->pg_buf, start, size, text);
+ } else {
+ strncpy(text,(char*) &buf[start], size);
+ text[size]='\0';
+ }
+ return text;
+ break;
+ case MDB_SDATETIME:
+ td = mdb_get_double(mdb->pg_buf, start);
+ if (td > 1) {
+ t = (long int)((td - 25569.0) * 86400.0);
+ } else {
+ t = (long int)(td * 86400.0);
+ }
+ strftime(text, MDB_BIND_SIZE, date_fmt, (struct tm*)gmtime(&t));
+ return text;
+
+ break;
+ case MDB_MEMO:
+ return mdb_memo_to_string(mdb, start, size);
+ break;
+ case MDB_MONEY:
+ mdb_money_to_string(mdb, start, text);
+ return text;
+ case MDB_NUMERIC:
+ break;
+ default:
+ return "";
+ break;
+ }
+ return NULL;
+}
+int mdb_col_disp_size(MdbColumn *col)
+{
+ switch (col->col_type) {
+ case MDB_BOOL:
+ return 1;
+ break;
+ case MDB_BYTE:
+ return 4;
+ break;
+ case MDB_INT:
+ return 6;
+ break;
+ case MDB_LONGINT:
+ return 11;
+ break;
+ case MDB_FLOAT:
+ return 10;
+ break;
+ case MDB_DOUBLE:
+ return 10;
+ break;
+ case MDB_TEXT:
+ return col->col_size;
+ break;
+ case MDB_SDATETIME:
+ return 20;
+ break;
+ case MDB_MEMO:
+ return 255;
+ break;
+ case MDB_MONEY:
+ return 21;
+ break;
+ }
+ return 0;
+}
+int mdb_col_fixed_size(MdbColumn *col)
+{
+ switch (col->col_type) {
+ case MDB_BOOL:
+ return 1;
+ break;
+ case MDB_BYTE:
+ return -1;
+ break;
+ case MDB_INT:
+ return 2;
+ break;
+ case MDB_LONGINT:
+ return 4;
+ break;
+ case MDB_FLOAT:
+ return 4;
+ break;
+ case MDB_DOUBLE:
+ return 8;
+ break;
+ case MDB_TEXT:
+ return -1;
+ break;
+ case MDB_SDATETIME:
+ return 4;
+ break;
+ case MDB_MEMO:
+ return -1;
+ break;
+ case MDB_MONEY:
+ return 8;
+ break;
+ }
+ return 0;
+}
diff --git a/map/poi_geodownload/libmdb/dump.c b/map/poi_geodownload/libmdb/dump.c
new file mode 100644
index 00000000..630ce2ea
--- /dev/null
+++ b/map/poi_geodownload/libmdb/dump.c
@@ -0,0 +1,41 @@
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+#include "mdbtools.h"
+
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
+
+
+void buffer_dump(const unsigned char* buf, int start, int end)
+{
+ char asc[20];
+ int j, k;
+
+ memset(asc, 0, sizeof(asc));
+ k = 0;
+ for (j=start; j<=end; j++) {
+ if (k == 0) {
+ fprintf(stdout, "%04x ", j);
+ }
+ fprintf(stdout, "%02x ", buf[j]);
+ asc[k] = isprint(buf[j]) ? buf[j] : '.';
+ k++;
+ if (k == 8) {
+ fprintf(stdout, " ");
+ }
+ if (k == 16) {
+ fprintf(stdout, " %s\n", asc);
+ memset(asc, 0, sizeof(asc));
+ k = 0;
+ }
+ }
+ for (j=k; j<16; j++) {
+ fprintf(stdout, " ");
+ }
+ if (k < 8) {
+ fprintf(stdout, " ");
+ }
+ fprintf(stdout, " %s\n", asc);
+}
diff --git a/map/poi_geodownload/libmdb/file.c b/map/poi_geodownload/libmdb/file.c
new file mode 100644
index 00000000..29174f22
--- /dev/null
+++ b/map/poi_geodownload/libmdb/file.c
@@ -0,0 +1,379 @@
+/* MDB Tools - A library for reading MS Access database files
+ * Copyright (C) 2000 Brian Bruns
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+
+#include "mdbtools.h"
+
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
+
+/*
+typedef struct {
+ int pg_size;
+ guint16 row_count_offset;
+ guint16 tab_num_rows_offset;
+ guint16 tab_num_cols_offset;
+ guint16 tab_num_idxs_offset;
+ guint16 tab_num_ridxs_offset;
+ guint16 tab_usage_map_offset;
+ guint16 tab_first_dpg_offset;
+ guint16 tab_cols_start_offset;
+ guint16 tab_ridx_entry_size;
+ guint16 col_fixed_offset;
+ guint16 col_size_offset;
+ guint16 col_num_offset;
+ guint16 tab_col_entry_size;
+ guint16 tab_free_map_offset;
+ guint16 tab_col_offset_var;
+ guint16 tab_col_offset_fixed;
+ guint16 tab_row_col_num_offset;
+} MdbFormatConstants;
+*/
+MdbFormatConstants MdbJet4Constants = {
+ 4096, 0x0c, 16, 45, 47, 51, 55, 56, 63, 12, 15, 23, 5, 25, 59, 7, 21, 9
+};
+MdbFormatConstants MdbJet3Constants = {
+ 2048, 0x08, 12, 25, 27, 31, 35, 36, 43, 8, 13, 16, 1, 18, 39, 3, 14, 5 /* not sure on 5, need to check */
+};
+
+static ssize_t _mdb_read_pg(MdbHandle *mdb, unsigned char *pg_buf, unsigned long pg);
+
+/**
+ * mdb_find_file:
+ * @filename: path to MDB (database) file
+ *
+ * Finds and returns the absolute path to an MDB file. Function will first try
+ * to fstat file as passed, then search through the $MDBPATH if not found.
+ *
+ * Return value: gchar pointer to absolute path. Caller is responsible for
+ * freeing.
+ **/
+
+static gchar *mdb_find_file(const char *file_name)
+{
+ struct stat status;
+ gchar *mdbpath, **dir, *tmpfname;
+ unsigned int i = 0;
+
+ /* try the provided file name first */
+ if (!stat(file_name, &status)) {
+ return g_strdup(file_name);
+ }
+
+ /* Now pull apart $MDBPATH and try those */
+ mdbpath = (gchar *) getenv("MDBPATH");
+ /* no path, can't find file */
+ if (!mdbpath || !strlen(mdbpath)) return NULL;
+
+ dir = g_strsplit(mdbpath, ":", 0);
+ while (dir[i]) {
+ if (!strlen(dir[i])) continue;
+ tmpfname = g_strconcat(dir[i++], "/", file_name, NULL);
+ if (!stat(tmpfname, &status)) {
+ g_strfreev(dir);
+ return tmpfname;
+ }
+ g_free(tmpfname);
+ }
+ g_strfreev(dir);
+ return NULL;
+}
+/**
+ * mdb_open:
+ * @filename: path to MDB (database) file
+ * @flags: MDB_NOFLAGS for read-only, MDB_WRITABLE for read/write
+ *
+ * Opens an MDB file and returns an MdbHandle to it. MDB File may be relative
+ * to the current directory, a full path to the file, or relative to a
+ * component of $MDBPATH.
+ *
+ * Return value: pointer to MdbHandle structure.
+ **/
+MdbHandle *mdb_open(const char *filename, MdbFileFlags flags)
+{
+ MdbHandle *mdb;
+
+ mdb = (MdbHandle *) g_malloc0(sizeof(MdbHandle));
+ mdb_set_default_backend(mdb, "access");
+ /* need something to bootstrap with, reassign after page 0 is read */
+ mdb->fmt = &MdbJet3Constants;
+ mdb->f = (MdbFile *) g_malloc0(sizeof(MdbFile));
+ mdb->f->refs = 1;
+ mdb->f->fd = -1;
+ mdb->f->filename = (char *) mdb_find_file(filename);
+ if (!mdb->f->filename) {
+ fprintf(stderr, "Can't alloc filename\n");
+ mdb_close(mdb);
+ return NULL;
+ }
+ if (flags & MDB_WRITABLE) {
+ mdb->f->writable = TRUE;
+ mdb->f->fd = open(mdb->f->filename,O_RDWR);
+ } else {
+ mdb->f->fd = open(mdb->f->filename,O_RDONLY);
+ }
+
+ if (mdb->f->fd==-1) {
+ fprintf(stderr,"Couldn't open file %s\n",mdb->f->filename);
+ mdb_close(mdb);
+ return NULL;
+ }
+ if (!mdb_read_pg(mdb, 0)) {
+ fprintf(stderr,"Couldn't read first page.\n");
+ mdb_close(mdb);
+ return NULL;
+ }
+ if (mdb->pg_buf[0] != 0) {
+ mdb_close(mdb);
+ return NULL;
+ }
+ mdb->f->jet_version = mdb_pg_get_int32(mdb, 0x14);
+ if (IS_JET4(mdb)) {
+ mdb->fmt = &MdbJet4Constants;
+ } else if (IS_JET3(mdb)) {
+ mdb->fmt = &MdbJet3Constants;
+ } else {
+ fprintf(stderr,"Unknown Jet version.\n");
+ mdb_close(mdb);
+ return NULL;
+ }
+
+ return mdb;
+}
+
+/**
+ * mdb_close:
+ * @mdb: Handle to open MDB database file
+ *
+ * Dereferences MDB file, closes if reference count is 0, and destroys handle.
+ *
+ **/
+void
+mdb_close(MdbHandle *mdb)
+{
+ if (!mdb) return;
+ mdb_free_catalog(mdb);
+ g_free(mdb->stats);
+ g_free(mdb->backend_name);
+
+ if (mdb->f) {
+ if (mdb->f->refs > 1) {
+ mdb->f->refs--;
+ } else {
+ if (mdb->f->fd != -1) close(mdb->f->fd);
+ g_free(mdb->f->filename);
+ g_free(mdb->f);
+ }
+ }
+
+ g_free(mdb);
+}
+/**
+ * mdb_clone_handle:
+ * @mdb: Handle to open MDB database file
+ *
+ * Clones an existing database handle. Cloned handle shares the file descriptor
+ * but has its own page buffer, page position, and similar internal variables.
+ *
+ * Return value: new handle to the database.
+ */
+MdbHandle *mdb_clone_handle(MdbHandle *mdb)
+{
+ MdbHandle *newmdb;
+ MdbCatalogEntry *entry, *data;
+ unsigned int i;
+
+ newmdb = (MdbHandle *) g_memdup(mdb, sizeof(MdbHandle));
+ newmdb->stats = NULL;
+ newmdb->catalog = g_ptr_array_new();
+ for (i=0;i<mdb->num_catalog;i++) {
+ entry = g_ptr_array_index(mdb->catalog,i);
+ data = g_memdup(entry,sizeof(MdbCatalogEntry));
+ g_ptr_array_add(newmdb->catalog, data);
+ }
+ mdb->backend_name = NULL;
+ if (mdb->f) {
+ mdb->f->refs++;
+ }
+ return newmdb;
+}
+
+/*
+** mdb_read a wrapper for read that bails if anything is wrong
+*/
+ssize_t mdb_read_pg(MdbHandle *mdb, unsigned long pg)
+{
+ ssize_t len;
+
+ if (pg && mdb->cur_pg == pg) return mdb->fmt->pg_size;
+
+ len = _mdb_read_pg(mdb, mdb->pg_buf, pg);
+ //fprintf(stderr, "read page %d type %02x\n", pg, mdb->pg_buf[0]);
+ mdb->cur_pg = pg;
+ /* kan - reset the cur_pos on a new page read */
+ mdb->cur_pos = 0; /* kan */
+ return len;
+}
+ssize_t mdb_read_alt_pg(MdbHandle *mdb, unsigned long pg)
+{
+ ssize_t len;
+
+ len = _mdb_read_pg(mdb, mdb->alt_pg_buf, pg);
+ return len;
+}
+static ssize_t _mdb_read_pg(MdbHandle *mdb, unsigned char *pg_buf, unsigned long pg)
+{
+ ssize_t len;
+ struct stat status;
+ off_t offset = pg * mdb->fmt->pg_size;
+
+ fstat(mdb->f->fd, &status);
+ if (status.st_size < offset) {
+ fprintf(stderr,"offset %lu is beyond EOF\n",offset);
+ return 0;
+ }
+ if (mdb->stats && mdb->stats->collect)
+ mdb->stats->pg_reads++;
+
+ lseek(mdb->f->fd, offset, SEEK_SET);
+ len = read(mdb->f->fd,pg_buf,mdb->fmt->pg_size);
+ if (len==-1) {
+ perror("read");
+ return 0;
+ }
+ else if (len<mdb->fmt->pg_size) {
+ /* fprintf(stderr,"EOF reached %d bytes returned.\n",len, mdb->fmt->pg_size); */
+ return 0;
+ }
+ return len;
+}
+void mdb_swap_pgbuf(MdbHandle *mdb)
+{
+char tmpbuf[MDB_PGSIZE];
+
+ memcpy(tmpbuf,mdb->pg_buf, MDB_PGSIZE);
+ memcpy(mdb->pg_buf,mdb->alt_pg_buf, MDB_PGSIZE);
+ memcpy(mdb->alt_pg_buf,tmpbuf,MDB_PGSIZE);
+}
+
+
+/* really stupid, just here for consistancy */
+unsigned char mdb_get_byte(unsigned char *buf, int offset)
+{
+ return buf[offset];
+}
+unsigned char mdb_pg_get_byte(MdbHandle *mdb, int offset)
+{
+ if (offset < 0 || offset+1 > mdb->fmt->pg_size) return -1;
+ mdb->cur_pos++;
+ return mdb->pg_buf[offset];
+}
+
+int mdb_get_int16(unsigned char *buf, int offset)
+{
+ return buf[offset+1]*256+buf[offset];
+}
+int mdb_pg_get_int16(MdbHandle *mdb, int offset)
+{
+ if (offset < 0 || offset+2 > mdb->fmt->pg_size) return -1;
+ mdb->cur_pos+=2;
+ return mdb_get_int16(mdb->pg_buf, offset);
+}
+
+gint32 mdb_pg_get_int24_msb(MdbHandle *mdb, int offset)
+{
+ gint32 l = 0;
+ if (offset <0 || offset+3 > mdb->fmt->pg_size) return -1;
+ mdb->cur_pos+=3;
+ memcpy((char *)&l+1, &(mdb->pg_buf[offset]), 3);
+#if 0
+ printf("l=0x%08x 0x%08x\n",l,GINT32_FROM_BE(l));
+#endif
+ return GINT32_FROM_BE(l);
+}
+gint32 mdb_get_int24(unsigned char *buf, int offset)
+{
+ gint32 l = 0;
+ memcpy(&l, &buf[offset], 3);
+ return GINT32_FROM_LE(l);
+}
+gint32 mdb_pg_get_int24(MdbHandle *mdb, int offset)
+{
+ if (offset <0 || offset+3 > mdb->fmt->pg_size) return -1;
+ mdb->cur_pos+=3;
+ return mdb_get_int24(mdb->pg_buf, offset);
+}
+
+long mdb_get_int32(unsigned char *buf, int offset)
+{
+ guint32 l;
+ memcpy(&l, &buf[offset], 4);
+ return (long)GINT32_FROM_LE(l);
+}
+long mdb_pg_get_int32(MdbHandle *mdb, int offset)
+{
+ if (offset <0 || offset+4 > mdb->fmt->pg_size) return -1;
+ mdb->cur_pos+=4;
+ return mdb_get_int32(mdb->pg_buf, offset);
+}
+
+float mdb_get_single(unsigned char *buf, int offset)
+{
+ union {guint32 g; float f;} f;
+ memcpy(&f, &buf[offset], 4);
+ f.g = GUINT32_FROM_LE(f.g);
+ return f.f;
+}
+float mdb_pg_get_single(MdbHandle *mdb, int offset)
+{
+ if (offset <0 || offset+4 > mdb->fmt->pg_size) return -1;
+ mdb->cur_pos+=4;
+ return mdb_get_single(mdb->pg_buf, offset);
+}
+
+double mdb_get_double(unsigned char *buf, int offset)
+{
+ union {guint64 g; double d;} d;
+ memcpy(&d, &buf[offset], 8);
+ d.g = GUINT64_FROM_LE(d.g);
+ return d.d;
+}
+double mdb_pg_get_double(MdbHandle *mdb, int offset)
+{
+ if (offset <0 || offset+8 > mdb->fmt->pg_size) return -1;
+ mdb->cur_pos+=8;
+ return mdb_get_double(mdb->pg_buf, offset);
+}
+
+#if 0
+int
+mdb_set_pos(MdbHandle *mdb, int pos)
+{
+ if (pos<0 || pos >= mdb->fmt->pg_size) return 0;
+
+ mdb->cur_pos=pos;
+ return pos;
+}
+
+int mdb_get_pos(MdbHandle *mdb)
+{
+ return mdb->cur_pos;
+}
+#endif
+
diff --git a/map/poi_geodownload/libmdb/iconv.c b/map/poi_geodownload/libmdb/iconv.c
new file mode 100644
index 00000000..4afb604a
--- /dev/null
+++ b/map/poi_geodownload/libmdb/iconv.c
@@ -0,0 +1,63 @@
+/* MDB Tools - A library for reading MS Access database files
+ * Copyright (C) 2000 Brian Bruns
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+
+#include "mdbtools.h"
+
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
+
+int
+mdb_unicode2ascii(MdbHandle *mdb, unsigned char *buf, int offset, unsigned int len, char *dest)
+{
+ unsigned int i;
+
+ if (buf[offset]==0xff && buf[offset+1]==0xfe) {
+ strncpy(dest, (char*) &buf[offset+2], len-2);
+ dest[len-2]='\0';
+ } else {
+ /* convert unicode to ascii, rather sloppily */
+ for (i=0;i<len;i+=2)
+ dest[i/2] = buf[offset + i];
+ dest[len/2]='\0';
+ }
+ return len;
+}
+
+int
+mdb_ascii2unicode(MdbHandle *mdb, unsigned char *buf, int offset, unsigned int len, char *dest)
+{
+ unsigned int i = 0;
+
+ if (!buf) return 0;
+
+ if (IS_JET3(mdb)) {
+ strncpy(dest, (char*) &buf[offset], len);
+ dest[len]='\0';
+ return strlen(dest);
+ }
+
+ while (i<strlen((char*)&buf[offset]) && (i*2+2)<len) {
+ dest[i*2] = buf[offset+i];
+ dest[i*2+1] = 0;
+ i++;
+ }
+
+ return (i*2);
+}
diff --git a/navit/data/poi_geodownload/libmdb/include/Makefile.am b/map/poi_geodownload/libmdb/include/Makefile.am
index 084a7542..084a7542 100644
--- a/navit/data/poi_geodownload/libmdb/include/Makefile.am
+++ b/map/poi_geodownload/libmdb/include/Makefile.am
diff --git a/map/poi_geodownload/libmdb/include/mdbtools.h b/map/poi_geodownload/libmdb/include/mdbtools.h
new file mode 100644
index 00000000..0f8e9aa6
--- /dev/null
+++ b/map/poi_geodownload/libmdb/include/mdbtools.h
@@ -0,0 +1,544 @@
+/* MDB Tools - A library for reading MS Access database files
+ * Copyright (C) 2000 Brian Bruns
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+#ifndef _mdbtools_h_
+#define _mdbtools_h_
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <string.h>
+#include <glib.h>
+
+#ifdef HAVE_ICONV
+#include <iconv.h>
+#endif
+
+#define MDB_DEBUG 0
+
+#define MDB_PGSIZE 4096
+#define MDB_MAX_OBJ_NAME 256
+#define MDB_MAX_COLS 256
+#define MDB_MAX_IDX_COLS 10
+#define MDB_CATALOG_PG 18
+#define MDB_MEMO_OVERHEAD 12
+#define MDB_BIND_SIZE 16384
+
+enum {
+ MDB_PAGE_DB = 0,
+ MDB_PAGE_DATA,
+ MDB_PAGE_TABLE,
+ MDB_PAGE_INDEX,
+ MDB_PAGE_LEAF,
+ MDB_PAGE_MAP
+};
+enum {
+ MDB_VER_JET3 = 0,
+ MDB_VER_JET4 = 1
+};
+enum {
+ MDB_FORM = 0,
+ MDB_TABLE,
+ MDB_MACRO,
+ MDB_SYSTEM_TABLE,
+ MDB_REPORT,
+ MDB_QUERY,
+ MDB_LINKED_TABLE,
+ MDB_MODULE,
+ MDB_RELATIONSHIP,
+ MDB_UNKNOWN_09,
+ MDB_UNKNOWN_0A,
+ MDB_DATABASE_PROPERTY,
+ MDB_ANY = -1
+};
+enum {
+ MDB_BOOL = 0x01,
+ MDB_BYTE = 0x02,
+ MDB_INT = 0x03,
+ MDB_LONGINT = 0x04,
+ MDB_MONEY = 0x05,
+ MDB_FLOAT = 0x06,
+ MDB_DOUBLE = 0x07,
+ MDB_SDATETIME = 0x08,
+ MDB_TEXT = 0x0a,
+ MDB_OLE = 0x0b,
+ MDB_MEMO = 0x0c,
+ MDB_REPID = 0x0f,
+ MDB_NUMERIC = 0x10
+};
+
+/* SARG operators */
+enum {
+ MDB_OR = 1,
+ MDB_AND,
+ MDB_NOT,
+ MDB_EQUAL,
+ MDB_GT,
+ MDB_LT,
+ MDB_GTEQ,
+ MDB_LTEQ,
+ MDB_LIKE,
+ MDB_ISNULL,
+ MDB_NOTNULL
+};
+
+typedef enum {
+ MDB_TABLE_SCAN,
+ MDB_LEAF_SCAN,
+ MDB_INDEX_SCAN
+} MdbStrategy;
+
+typedef enum {
+ MDB_NOFLAGS = 0x00,
+ MDB_WRITABLE = 0x01
+} MdbFileFlags;
+
+enum {
+ MDB_DEBUG_LIKE = 0x0001,
+ MDB_DEBUG_WRITE = 0x0002,
+ MDB_DEBUG_USAGE = 0x0004,
+ MDB_DEBUG_OLE = 0x0008,
+ MDB_DEBUG_ROW = 0x0010,
+ MDB_USE_INDEX = 0x0020,
+ MDB_NO_MEMO = 0x0040 /* don't follow memo fields */
+};
+
+#define mdb_is_logical_op(x) (x == MDB_OR || \
+ x == MDB_AND || \
+ x == MDB_NOT )
+
+#define mdb_is_relational_op(x) (x == MDB_EQUAL || \
+ x == MDB_GT || \
+ x == MDB_LT || \
+ x == MDB_GTEQ || \
+ x == MDB_LTEQ || \
+ x == MDB_LIKE || \
+ x == MDB_ISNULL || \
+ x == MDB_NOTNULL )
+
+enum {
+ MDB_ASC,
+ MDB_DESC
+};
+
+enum {
+ MDB_IDX_UNIQUE = 0x01,
+ MDB_IDX_IGNORENULLS = 0x02,
+ MDB_IDX_REQUIRED = 0x08
+};
+
+#define IS_JET4(mdb) (mdb->f->jet_version==MDB_VER_JET4)
+#define IS_JET3(mdb) (mdb->f->jet_version==MDB_VER_JET3)
+
+/* hash to store registered backends */
+/* extern GHashTable *mdb_backends; */
+
+/* forward declarations */
+typedef struct mdbindex MdbIndex;
+typedef struct mdbsargtree MdbSargNode;
+
+typedef struct {
+ char *name;
+ unsigned char needs_length; /* or precision */
+ unsigned char needs_scale;
+ unsigned char needs_quotes;
+} MdbBackendType;
+
+typedef struct {
+ MdbBackendType *types_table;
+} MdbBackend;
+
+typedef struct {
+ gboolean collect;
+ unsigned long pg_reads;
+} MdbStatistics;
+
+typedef struct {
+ int fd;
+ gboolean writable;
+ char *filename;
+ guint32 jet_version;
+ guint32 db_key;
+ char db_passwd[14];
+ MdbBackend *default_backend;
+ char *backend_name;
+ MdbStatistics *stats;
+ /* free map */
+ int map_sz;
+ unsigned char *free_map;
+ /* reference count */
+ int refs;
+} MdbFile;
+
+/* offset to row count on data pages...version dependant */
+typedef struct {
+ ssize_t pg_size;
+ guint16 row_count_offset;
+ guint16 tab_num_rows_offset;
+ guint16 tab_num_cols_offset;
+ guint16 tab_num_idxs_offset;
+ guint16 tab_num_ridxs_offset;
+ guint16 tab_usage_map_offset;
+ guint16 tab_first_dpg_offset;
+ guint16 tab_cols_start_offset;
+ guint16 tab_ridx_entry_size;
+ guint16 col_fixed_offset;
+ guint16 col_size_offset;
+ guint16 col_num_offset;
+ guint16 tab_col_entry_size;
+ guint16 tab_free_map_offset;
+ guint16 tab_col_offset_var;
+ guint16 tab_col_offset_fixed;
+ guint16 tab_row_col_num_offset;
+} MdbFormatConstants;
+
+typedef struct {
+ MdbFile *f;
+ guint32 cur_pg;
+ guint16 row_num;
+ unsigned int cur_pos;
+ unsigned char pg_buf[MDB_PGSIZE];
+ unsigned char alt_pg_buf[MDB_PGSIZE];
+ unsigned int num_catalog;
+ GPtrArray *catalog;
+ MdbBackend *default_backend;
+ char *backend_name;
+ MdbFormatConstants *fmt;
+ MdbStatistics *stats;
+#ifdef HAVE_ICONV
+ iconv_t iconv_in;
+ iconv_t iconv_out;
+#endif
+} MdbHandle;
+
+typedef struct {
+ MdbHandle *mdb;
+ char object_name[MDB_MAX_OBJ_NAME+1];
+ int object_type;
+ unsigned long table_pg; /* misnomer since object may not be a table */
+ unsigned long kkd_pg;
+ unsigned int kkd_rowid;
+ int num_props;
+ GArray *props;
+ GArray *columns;
+ int flags;
+} MdbCatalogEntry;
+
+typedef struct {
+ gchar *name;
+ GHashTable *hash;
+} MdbProperties;
+
+typedef union {
+ int i;
+ double d;
+ char s[256];
+} MdbAny;
+
+typedef struct {
+ char name[MDB_MAX_OBJ_NAME+1];
+ int col_type;
+ int col_size;
+ void *bind_ptr;
+ int *len_ptr;
+ GHashTable *properties;
+ unsigned int num_sargs;
+ GPtrArray *sargs;
+ GPtrArray *idx_sarg_cache;
+ unsigned char is_fixed;
+ int query_order;
+ /* col_num is the current column order,
+ * does not include deletes */
+ int col_num;
+ int cur_value_start;
+ int cur_value_len;
+ /* MEMO/OLE readers */
+ guint32 cur_blob_pg;
+ guint32 cur_blob_row;
+ int chunk_size;
+ /* numerics only */
+ int col_prec;
+ int col_scale;
+ MdbProperties *props;
+ /* info needed for handling deleted/added columns */
+ int fixed_offset;
+ unsigned int var_col_num;
+ /* row_col_num is the row column number order,
+ * including deleted columns */
+ int row_col_num;
+} MdbColumn;
+
+struct mdbsargtree {
+ int op;
+ MdbColumn *col;
+ MdbAny value;
+ void *parent;
+ MdbSargNode *left;
+ MdbSargNode *right;
+};
+
+typedef struct {
+ guint32 pg;
+ int start_pos;
+ int offset;
+ int len;
+ guint16 idx_starts[2000];
+ unsigned char cache_value[256];
+} MdbIndexPage;
+
+typedef int (*MdbSargTreeFunc)(MdbSargNode *, gpointer data);
+
+#define MDB_MAX_INDEX_DEPTH 10
+
+typedef struct {
+ int cur_depth;
+ guint32 last_leaf_found;
+ int clean_up_mode;
+ MdbIndexPage pages[MDB_MAX_INDEX_DEPTH];
+} MdbIndexChain;
+
+typedef struct {
+ MdbCatalogEntry *entry;
+ char name[MDB_MAX_OBJ_NAME+1];
+ unsigned int num_cols;
+ GPtrArray *columns;
+ unsigned int num_rows;
+ int index_start;
+ unsigned int num_real_idxs;
+ unsigned int num_idxs;
+ GPtrArray *indices;
+ guint32 first_data_pg;
+ guint32 cur_pg_num;
+ guint32 cur_phys_pg;
+ unsigned int cur_row;
+ int noskip_del; /* don't skip deleted rows */
+ /* object allocation map */
+ guint32 map_base_pg;
+ unsigned int map_sz;
+ unsigned char *usage_map;
+ /* pages with free space left */
+ guint32 freemap_base_pg;
+ unsigned int freemap_sz;
+ unsigned char *free_usage_map;
+ /* query planner */
+ MdbSargNode *sarg_tree;
+ MdbStrategy strategy;
+ MdbIndex *scan_idx;
+ MdbHandle *mdbidx;
+ MdbIndexChain *chain;
+ MdbProperties *props;
+ unsigned int num_var_cols; /* to know if row has variable columns */
+ /* temp table */
+ unsigned int is_temp_table;
+ GPtrArray *temp_table_pages;
+} MdbTableDef;
+
+struct mdbindex {
+ int index_num;
+ char name[MDB_MAX_OBJ_NAME+1];
+ unsigned char index_type;
+ guint32 first_pg;
+ int num_rows; /* number rows in index */
+ unsigned int num_keys;
+ short key_col_num[MDB_MAX_IDX_COLS];
+ unsigned char key_col_order[MDB_MAX_IDX_COLS];
+ unsigned char flags;
+ MdbTableDef *table;
+};
+
+typedef struct {
+ char name[MDB_MAX_OBJ_NAME+1];
+} MdbColumnProp;
+
+typedef struct {
+ void *value;
+ int siz;
+ int start;
+ unsigned char is_null;
+ unsigned char is_fixed;
+ int colnum;
+ int offset;
+} MdbField;
+
+typedef struct {
+ int op;
+ MdbAny value;
+} MdbSarg;
+
+/* mem.c */
+extern void mdb_init(void);
+extern void mdb_exit(void);
+
+/* file.c */
+extern ssize_t mdb_read_pg(MdbHandle *mdb, unsigned long pg);
+extern ssize_t mdb_read_alt_pg(MdbHandle *mdb, unsigned long pg);
+extern unsigned char mdb_get_byte(unsigned char *buf, int offset);
+extern int mdb_get_int16(unsigned char *buf, int offset);
+extern gint32 mdb_get_int24(unsigned char *buf, int offset);
+extern long mdb_get_int32(unsigned char *buf, int offset);
+extern float mdb_get_single(unsigned char *buf, int offset);
+extern double mdb_get_double(unsigned char *buf, int offset);
+extern unsigned char mdb_pg_get_byte(MdbHandle *mdb, int offset);
+extern int mdb_pg_get_int16(MdbHandle *mdb, int offset);
+extern gint32 mdb_pg_get_int24(MdbHandle *mdb, int offset);
+extern long mdb_pg_get_int32(MdbHandle *mdb, int offset);
+extern float mdb_pg_get_single(MdbHandle *mdb, int offset);
+extern double mdb_pg_get_double(MdbHandle *mdb, int offset);
+extern gint32 mdb_pg_get_int24_msb(MdbHandle *mdb, int offset);
+extern MdbHandle *mdb_open(const char *filename, MdbFileFlags flags);
+extern void mdb_close(MdbHandle *mdb);
+extern MdbHandle *mdb_clone_handle(MdbHandle *mdb);
+extern void mdb_swap_pgbuf(MdbHandle *mdb);
+extern long _mdb_get_int32(unsigned char *buf, int offset);
+
+/* catalog.c */
+extern void mdb_free_catalog(MdbHandle *mdb);
+extern GPtrArray *mdb_read_catalog(MdbHandle *mdb, int obj_type);
+extern void mdb_dump_catalog(MdbHandle *mdb, int obj_type);
+extern char *mdb_get_objtype_string(int obj_type);
+
+/* table.c */
+extern MdbTableDef *mdb_alloc_tabledef(MdbCatalogEntry *entry);
+extern void mdb_free_tabledef(MdbTableDef *table);
+extern MdbTableDef *mdb_read_table(MdbCatalogEntry *entry);
+extern MdbTableDef *mdb_read_table_by_name(MdbHandle *mdb, gchar *table_name, int obj_type);
+extern void mdb_append_column(GPtrArray *columns, MdbColumn *in_col);
+extern void mdb_free_columns(GPtrArray *columns);
+extern GPtrArray *mdb_read_columns(MdbTableDef *table);
+extern void mdb_table_dump(MdbCatalogEntry *entry);
+extern guint16 read_pg_if_16(MdbHandle *mdb, int *cur_pos);
+extern guint32 read_pg_if_32(MdbHandle *mdb, int *cur_pos);
+extern int read_pg_if(MdbHandle *mdb, int *cur_pos, int offset);
+extern guint16 read_pg_if_n(MdbHandle *mdb, unsigned char *buf, int *cur_pos, int len);
+extern int mdb_is_user_table(MdbCatalogEntry *entry);
+extern int mdb_is_system_table(MdbCatalogEntry *entry);
+
+/* data.c */
+extern int mdb_bind_column_by_name(MdbTableDef *table, gchar *col_name, void *bind_ptr);
+extern void mdb_data_dump(MdbTableDef *table);
+extern void mdb_bind_column(MdbTableDef *table, int col_num, void *bind_ptr);
+extern int mdb_rewind_table(MdbTableDef *table);
+extern int mdb_fetch_row(MdbTableDef *table);
+extern int mdb_is_fixed_col(MdbColumn *col);
+extern char *mdb_col_to_string(MdbHandle *mdb, unsigned char *buf, int start, int datatype, int size);
+extern int mdb_find_pg_row(MdbHandle *mdb, int pg_row, unsigned char **buf, int *off, size_t *len);
+extern int mdb_find_end_of_row(MdbHandle *mdb, int row);
+extern int mdb_col_fixed_size(MdbColumn *col);
+extern int mdb_col_disp_size(MdbColumn *col);
+extern void mdb_bind_len(MdbTableDef *table, int col_num, int *len_ptr);
+extern size_t mdb_ole_read_next(MdbHandle *mdb, MdbColumn *col, void *ole_ptr);
+extern size_t mdb_ole_read(MdbHandle *mdb, MdbColumn *col, void *ole_ptr, int chunk_size);
+extern void mdb_set_date_fmt(const char *);
+extern int mdb_read_row(MdbTableDef *table, unsigned int row);
+
+/* dump.c */
+extern void buffer_dump(const unsigned char* buf, int start, int end);
+
+/* backend.c */
+extern char *mdb_get_coltype_string(MdbBackend *backend, int col_type);
+extern int mdb_coltype_takes_length(MdbBackend *backend, int col_type);
+extern void mdb_init_backends(void);
+extern void mdb_register_backend(MdbBackendType *backend, char *backend_name);
+extern void mdb_remove_backends(void);
+extern int mdb_set_default_backend(MdbHandle *mdb, char *backend_name);
+extern char *mdb_get_relationships(MdbHandle *mdb);
+
+/* sargs.c */
+extern int mdb_test_sargs(MdbTableDef *table, MdbField *fields, int num_fields);
+extern int mdb_test_sarg(MdbHandle *mdb, MdbColumn *col, MdbSargNode *node, MdbField *field);
+extern void mdb_sql_walk_tree(MdbSargNode *node, MdbSargTreeFunc func, gpointer data);
+extern int mdb_find_indexable_sargs(MdbSargNode *node, gpointer data);
+extern int mdb_add_sarg_by_name(MdbTableDef *table, char *colname, MdbSarg *in_sarg);
+extern int mdb_test_string(MdbSargNode *node, char *s);
+extern int mdb_test_int(MdbSargNode *node, gint32 i);
+extern int mdb_add_sarg(MdbColumn *col, MdbSarg *in_sarg);
+
+
+
+/* index.c */
+extern GPtrArray *mdb_read_indices(MdbTableDef *table);
+extern void mdb_index_dump(MdbTableDef *table, MdbIndex *idx);
+extern void mdb_index_scan_free(MdbTableDef *table);
+extern int mdb_index_find_next_on_page(MdbHandle *mdb, MdbIndexPage *ipg);
+extern int mdb_index_find_next(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain, guint32 *pg, guint16 *row);
+extern void mdb_index_hash_text(guchar *text, guchar *hash);
+extern void mdb_index_scan_init(MdbHandle *mdb, MdbTableDef *table);
+extern int mdb_index_find_row(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain, guint32 pg, guint16 row);
+extern void mdb_index_swap_n(unsigned char *src, int sz, unsigned char *dest);
+extern void mdb_free_indices(GPtrArray *indices);
+void mdb_index_page_reset(MdbIndexPage *ipg);
+extern MdbIndexPage *mdb_index_read_bottom_pg(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain);
+extern MdbIndexPage *mdb_index_unwind(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain);
+extern void mdb_index_page_init(MdbIndexPage *ipg);
+
+
+/* stats.c */
+extern void mdb_stats_on(MdbHandle *mdb);
+extern void mdb_stats_off(MdbHandle *mdb);
+extern void mdb_dump_stats(MdbHandle *mdb);
+
+/* like.c */
+extern int mdb_like_cmp(char *s, char *r);
+
+/* write.c */
+extern int mdb_crack_row(MdbTableDef *table, int row_start, int row_end, MdbField *fields);
+extern guint16 mdb_add_row_to_pg(MdbTableDef *table, unsigned char *row_buffer, int new_row_size);
+extern int mdb_update_index(MdbTableDef *table, MdbIndex *idx, unsigned int num_fields, MdbField *fields, guint32 pgnum, guint16 rownum);
+extern int mdb_pack_row(MdbTableDef *table, unsigned char *row_buffer, unsigned int num_fields, MdbField *fields);
+extern int mdb_replace_row(MdbTableDef *table, int row, unsigned char *new_row, int new_row_size);
+extern int mdb_pg_get_freespace(MdbHandle *mdb);
+extern int mdb_update_row(MdbTableDef *table);
+extern unsigned char *mdb_new_data_pg(MdbCatalogEntry *entry);
+
+/* map.c */
+extern guint32 mdb_map_find_next_freepage(MdbTableDef *table, int row_size);
+extern guint32 mdb_map_find_next(MdbHandle *mdb, unsigned char *map, unsigned int map_sz, guint32 start_pg);
+
+/* props.c */
+extern GPtrArray *mdb_read_props_list(gchar *kkd, int len);
+extern void mdb_free_props(MdbProperties *props);
+extern MdbProperties *mdb_read_props(MdbHandle *mdb, GPtrArray *names, gchar *kkd, int len);
+
+/* worktable.c */
+extern MdbTableDef *mdb_create_temp_table(MdbHandle *mdb, char *name);
+extern void mdb_temp_table_add_col(MdbTableDef *table, MdbColumn *col);
+extern void mdb_fill_temp_col(MdbColumn *tcol, char *col_name, int col_size, int col_type, int is_fixed);
+extern void mdb_fill_temp_field(MdbField *field, void *value, int siz, int is_fixed, int is_null, int start, int column);
+extern void mdb_temp_columns_end(MdbTableDef *table);
+
+/* options.c */
+extern int mdb_get_option(unsigned long optnum);
+extern void mdb_debug(int klass, char *fmt, ...);
+
+/* iconv.c */
+extern int mdb_unicode2ascii(MdbHandle *mdb, unsigned char *buf, int offset, unsigned int len, char *dest);
+extern int mdb_ascii2unicode(MdbHandle *mdb, unsigned char *buf, int offset, unsigned int len, char *dest);
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* _mdbtools_h_ */
diff --git a/map/poi_geodownload/libmdb/index.c b/map/poi_geodownload/libmdb/index.c
new file mode 100644
index 00000000..6da04c47
--- /dev/null
+++ b/map/poi_geodownload/libmdb/index.c
@@ -0,0 +1,907 @@
+/* MDB Tools - A library for reading MS Access database file
+ * Copyright (C) 2000-2004 Brian Bruns
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+
+#include "mdbtools.h"
+
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
+
+MdbIndexPage *mdb_index_read_bottom_pg(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain);
+MdbIndexPage *mdb_chain_add_page(MdbHandle *mdb, MdbIndexChain *chain, guint32 pg);
+
+char idx_to_text[] = {
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0-7 0x00-0x07 */
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 8-15 0x09-0x0f */
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 16-23 0x10-0x17 */
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 24-31 0x19-0x1f */
+' ', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 32-39 0x20-0x27 */
+0x00, 0x00, 0x00, 0x00, 0x00, ' ', ' ', 0x00, /* 40-47 0x29-0x2f */
+'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', /* 48-55 0x30-0x37 */
+'^', '_', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 56-63 0x39-0x3f */
+0x00, '`', 'a', 'b', 'd', 'f', 'g', 'h', /* 64-71 0x40-0x47 */
+'i', 'j', 'k', 'l', 'm', 'o', 'p', 'r', /* 72-79 0x49-0x4f H */
+'s', 't', 'u', 'v', 'w', 'x', 'z', '{', /* 80-87 0x50-0x57 P */
+'|', '}', '~', '5', '6', '7', '8', '9', /* 88-95 0x59-0x5f */
+0x00, '`', 'a', 'b', 'd', 'f', 'g', 'h', /* 96-103 0x60-0x67 */
+'i', 'j', 'k', 'l', 'm', 'o', 'p', 'r', /* 014-111 0x69-0x6f h */
+'s', 't', 'u', 'v', 'w', 'x', 'z', '{', /* 112-119 0x70-0x77 p */
+'|', '}', '~', 0x00, 0x00, 0x00, 0x00, 0x00, /* 120-127 0x78-0x7f */
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 128-135 0x80-0x87 */
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */
+0x00, 0x00, 0x00, 0x00, 0x00, '`', 0x00, 0x00, /* 0xc0-0xc7 */
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */
+0x00, '`', 0x00, '`', '`', '`', 0x00, 0x00, /* 0xe0-0xe7 */
+'f', 'f', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */
+0x00, 0x00, 0x00, 'r', 0x00, 0x00, 'r', 0x00, /* 0xf0-0xf7 */
+0x81, 0x00, 0x00, 0x00, 'x', 0x00, 0x00, 0x00, /* 0xf8-0xff */
+};
+
+
+GPtrArray *
+mdb_read_indices(MdbTableDef *table)
+{
+ MdbCatalogEntry *entry = table->entry;
+ MdbHandle *mdb = entry->mdb;
+ MdbFormatConstants *fmt = mdb->fmt;
+ MdbIndex *pidx;
+ unsigned int i, j;
+ int idx_num, key_num, col_num;
+ int cur_pos, name_sz, idx2_sz, type_offset;
+ int index_start_pg = mdb->cur_pg;
+ guchar *tmpbuf;
+
+ table->indices = g_ptr_array_new();
+
+ if (IS_JET4(mdb)) {
+ cur_pos = table->index_start + 52 * table->num_real_idxs;
+ idx2_sz = 28;
+ type_offset = 23;
+ } else {
+ cur_pos = table->index_start + 39 * table->num_real_idxs;
+ idx2_sz = 20;
+ type_offset = 19;
+ }
+
+ tmpbuf = (guchar *) g_malloc(idx2_sz);
+ for (i=0;i<table->num_idxs;i++) {
+ read_pg_if_n(mdb, tmpbuf, &cur_pos, idx2_sz);
+ cur_pos += idx2_sz;
+ pidx = (MdbIndex *) g_malloc0(sizeof(MdbIndex));
+ pidx->table = table;
+ pidx->index_num = mdb_get_int16(tmpbuf, 4);
+ pidx->index_type = tmpbuf[type_offset];
+ g_ptr_array_add(table->indices, pidx);
+ }
+ g_free(tmpbuf);
+
+ for (i=0;i<table->num_idxs;i++) {
+ pidx = g_ptr_array_index (table->indices, i);
+ if (IS_JET4(mdb)) {
+ name_sz=read_pg_if_16(mdb, &cur_pos);
+ cur_pos += 2;
+ tmpbuf = g_malloc(name_sz);
+ read_pg_if_n(mdb, tmpbuf, &cur_pos, name_sz);
+ cur_pos += name_sz;
+ mdb_unicode2ascii(mdb, tmpbuf, 0, name_sz, pidx->name);
+ g_free(tmpbuf);
+ } else {
+ read_pg_if(mdb, &cur_pos, 0);
+ name_sz=mdb->pg_buf[cur_pos++];
+ read_pg_if_n(mdb, (unsigned char *) pidx->name, &cur_pos, name_sz);
+ cur_pos += name_sz;
+ pidx->name[name_sz]='\0';
+ }
+ //fprintf(stderr, "index name %s\n", pidx->name);
+ }
+
+ mdb_read_alt_pg(mdb, entry->table_pg);
+ mdb_read_pg(mdb, index_start_pg);
+ cur_pos = table->index_start;
+ idx_num=0;
+ for (i=0;i<table->num_real_idxs;i++) {
+ if (IS_JET4(mdb)) cur_pos += 4;
+ do {
+ pidx = g_ptr_array_index (table->indices, idx_num++);
+ } while (pidx && pidx->index_type==2);
+
+ /* if there are more real indexes than index entries left after
+ removing type 2's decrement real indexes and continue. Happens
+ on Northwind Orders table.
+ */
+ if (!pidx) {
+ table->num_real_idxs--;
+ continue;
+ }
+
+ pidx->num_rows = mdb_get_int32(mdb->alt_pg_buf,
+ fmt->tab_cols_start_offset +
+ (i*fmt->tab_ridx_entry_size));
+
+ key_num=0;
+ for (j=0;j<MDB_MAX_IDX_COLS;j++) {
+ col_num=read_pg_if_16(mdb,&cur_pos);
+ cur_pos += 2;
+ read_pg_if(mdb, &cur_pos, 0);
+ cur_pos++;
+ if (col_num == 0xFFFF)
+ continue;
+ /* set column number to a 1 based column number and store */
+ pidx->key_col_num[key_num] = col_num + 1;
+ pidx->key_col_order[key_num] =
+ (mdb->pg_buf[cur_pos-1]) ? MDB_ASC : MDB_DESC;
+ key_num++;
+ }
+ pidx->num_keys = key_num;
+
+ cur_pos += 4;
+ pidx->first_pg = read_pg_if_32(mdb, &cur_pos);
+ cur_pos += 4;
+ read_pg_if(mdb, &cur_pos, 0);
+ pidx->flags = mdb->pg_buf[cur_pos++];
+ if (IS_JET4(mdb)) cur_pos += 9;
+ }
+ return NULL;
+}
+void
+mdb_index_hash_text(guchar *text, guchar *hash)
+{
+ unsigned int k;
+
+ for (k=0;k<strlen((char*) text);k++) {
+ hash[k] = idx_to_text[text[k]];
+ if (!(hash[k])) fprintf(stderr,
+ "No translation available for %02x %d\n",
+ text[k],text[k]);
+ }
+ hash[strlen((char*) text)]=0;
+}
+void
+mdb_index_swap_n(unsigned char *src, int sz, unsigned char *dest)
+{
+ int i, j = 0;
+
+ for (i = sz; i > 0; i--) {
+ dest[j++] = src[i];
+ }
+}
+static void
+mdb_index_cache_sarg(MdbColumn *col, MdbSarg *sarg, MdbSarg *idx_sarg)
+{
+ //guint32 cache_int;
+ unsigned char *c;
+
+ switch (col->col_type) {
+ case MDB_TEXT:
+ mdb_index_hash_text((unsigned char*) sarg->value.s, (unsigned char*) idx_sarg->value.s);
+ break;
+
+ case MDB_LONGINT:
+ idx_sarg->value.i = GUINT32_SWAP_LE_BE(sarg->value.i);
+ //cache_int = sarg->value.i * -1;
+ c = (unsigned char *) &(idx_sarg->value.i);
+ c[0] |= 0x80;
+ //printf("int %08x %02x %02x %02x %02x\n", sarg->value.i, c[0], c[1], c[2], c[3]);
+ break;
+
+ case MDB_INT:
+ break;
+
+ default:
+ break;
+ }
+}
+#if 0
+int
+mdb_index_test_sarg(MdbHandle *mdb, MdbColumn *col, MdbSarg *sarg, int offset, int len)
+{
+char tmpbuf[256];
+int lastchar;
+
+ switch (col->col_type) {
+ case MDB_BYTE:
+ return mdb_test_int(sarg, mdb_pg_get_byte(mdb, offset));
+ break;
+ case MDB_INT:
+ return mdb_test_int(sarg, mdb_pg_get_int16(mdb, offset));
+ break;
+ case MDB_LONGINT:
+ return mdb_test_int(sarg, mdb_pg_get_int32(mdb, offset));
+ break;
+ case MDB_TEXT:
+ strncpy(tmpbuf, &mdb->pg_buf[offset],255);
+ lastchar = len > 255 ? 255 : len;
+ tmpbuf[lastchar]='\0';
+ return mdb_test_string(sarg, tmpbuf);
+ default:
+ fprintf(stderr, "Calling mdb_test_sarg on unknown type. Add code to mdb_test_sarg() for type %d\n",col->col_type);
+ break;
+ }
+ return 1;
+}
+#endif
+static int
+mdb_index_test_sargs(MdbHandle *mdb, MdbIndex *idx, unsigned char *buf, int len)
+{
+ unsigned int i, j;
+ MdbColumn *col;
+ MdbTableDef *table = idx->table;
+ MdbSarg *idx_sarg;
+ MdbSarg *sarg;
+ MdbField field;
+ MdbSargNode node;
+ //int c_offset = 0,
+ int c_len;
+
+#if 0
+ fprintf(stderr,"mdb_index_test_sargs called on ");
+ for (i=0;i<len;i++)
+ fprintf(stderr,"%02x ",buf[i]); //mdb->pg_buf[offset+i]);
+ fprintf(stderr,"\n");
+#endif
+ for (i=0;i<idx->num_keys;i++) {
+ //c_offset++; /* the per column null indicator/flags */
+ col=g_ptr_array_index(table->columns,idx->key_col_num[i]-1);
+ /*
+ * This will go away eventually
+ */
+ if (col->col_type==MDB_TEXT) {
+ //c_len = strlen(&mdb->pg_buf[offset + c_offset]);
+ c_len = strlen((char*) buf);
+ } else {
+ c_len = col->col_size;
+ //fprintf(stderr,"Only text types currently supported. How did we get here?\n");
+ }
+ /*
+ * If we have no cached index values for this column,
+ * create them.
+ */
+ if (col->num_sargs && !col->idx_sarg_cache) {
+ col->idx_sarg_cache = g_ptr_array_new();
+ for (j=0;j<col->num_sargs;j++) {
+ sarg = g_ptr_array_index (col->sargs, j);
+ idx_sarg = g_memdup(sarg,sizeof(MdbSarg));
+ //printf("calling mdb_index_cache_sarg\n");
+ mdb_index_cache_sarg(col, sarg, idx_sarg);
+ g_ptr_array_add(col->idx_sarg_cache, idx_sarg);
+ }
+ }
+
+ for (j=0;j<col->num_sargs;j++) {
+ sarg = g_ptr_array_index (col->idx_sarg_cache, j);
+ /* XXX - kludge */
+ node.op = sarg->op;
+ node.value = sarg->value;
+ //field.value = &mdb->pg_buf[offset + c_offset];
+ field.value = buf;
+ field.siz = c_len;
+ field.is_null = FALSE;
+ if (!mdb_test_sarg(mdb, col, &node, &field)) {
+ /* sarg didn't match, no sense going on */
+ return 0;
+ }
+ }
+ }
+ return 1;
+}
+#if 0
+/*
+ * pack the pages bitmap
+ */
+int
+mdb_index_pack_bitmap(MdbHandle *mdb, MdbIndexPage *ipg)
+{
+ int mask_bit = 0;
+ int mask_pos = 0x16;
+ int mask_byte = 0;
+ int elem = 0;
+ int len, start, i;
+
+ start = ipg->idx_starts[elem++];
+
+ while (start) {
+ len = ipg->idx_starts[elem] - start;
+ fprintf(stdout, "len is %d\n", len);
+ for (i=0; i < len; i++) {
+ mask_bit++;
+ if (mask_bit==8) {
+ mask_bit=0;
+ mdb->pg_buf[mask_pos++] = mask_byte;
+ mask_byte = 0;
+ }
+ /* upon reaching the len, set the bit */
+ }
+ mask_byte = (1 << mask_bit) | mask_byte;
+ fprintf(stdout, "mask byte is %02x at %d\n", mask_byte, mask_pos);
+ start = ipg->idx_starts[elem++];
+ }
+ /* flush the last byte if any */
+ mdb->pg_buf[mask_pos++] = mask_byte;
+ /* remember to zero the rest of the bitmap */
+ for (i = mask_pos; i < 0xf8; i++) {
+ mdb->pg_buf[mask_pos++] = 0;
+ }
+ return 0;
+}
+#endif
+/*
+ * unpack the pages bitmap
+ */
+static int
+mdb_index_unpack_bitmap(MdbHandle *mdb, MdbIndexPage *ipg)
+{
+ int mask_bit = 0;
+ int mask_pos = 0x16;
+ int mask_byte;
+ int start = 0xf8;
+ int elem = 0;
+ int len = 0;
+
+ ipg->idx_starts[elem++]=start;
+
+#if 0
+ fprintf(stdout, "Unpacking index page %u\n", ipg->pg);
+#endif
+ do {
+ len = 0;
+ do {
+ mask_bit++;
+ if (mask_bit==8) {
+ mask_bit=0;
+ mask_pos++;
+ }
+ mask_byte = mdb->pg_buf[mask_pos];
+ len++;
+ } while (mask_pos <= 0xf8 && !((1 << mask_bit) & mask_byte));
+ //fprintf(stdout, "%d %d %d %d\n", mask_pos, mask_bit, mask_byte, len);
+
+ start += len;
+ if (mask_pos < 0xf8) ipg->idx_starts[elem++]=start;
+
+ } while (mask_pos < 0xf8);
+
+ /* if we zero the next element, so we don't pick up the last pages starts*/
+ ipg->idx_starts[elem]=0;
+
+ return elem;
+}
+/*
+ * find the next entry on a page (either index or leaf). Uses state information
+ * stored in the MdbIndexPage across calls.
+ */
+int
+mdb_index_find_next_on_page(MdbHandle *mdb, MdbIndexPage *ipg)
+{
+ if (!ipg->pg) return 0;
+
+ /* if this page has not been unpacked to it */
+ if (!ipg->idx_starts[0]){
+ //fprintf(stdout, "Unpacking page %d\n", ipg->pg);
+ mdb_index_unpack_bitmap(mdb, ipg);
+ }
+
+
+ if (ipg->idx_starts[ipg->start_pos + 1]==0) return 0;
+ ipg->len = ipg->idx_starts[ipg->start_pos+1] - ipg->idx_starts[ipg->start_pos];
+ ipg->start_pos++;
+ //fprintf(stdout, "Start pos %d\n", ipg->start_pos);
+
+ return ipg->len;
+}
+void mdb_index_page_reset(MdbIndexPage *ipg)
+{
+ ipg->offset = 0xf8; /* start byte of the index entries */
+ ipg->start_pos=0;
+ ipg->len = 0;
+ ipg->idx_starts[0]=0;
+}
+void mdb_index_page_init(MdbIndexPage *ipg)
+{
+ memset(ipg, 0, sizeof(MdbIndexPage));
+ mdb_index_page_reset(ipg);
+}
+/*
+ * find the next leaf page if any given a chain. Assumes any exhausted leaf
+ * pages at the end of the chain have been peeled off before the call.
+ */
+static MdbIndexPage *
+mdb_find_next_leaf(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain)
+{
+ MdbIndexPage *ipg, *newipg;
+ guint32 pg;
+ guint passed = 0;
+
+ ipg = mdb_index_read_bottom_pg(mdb, idx, chain);
+
+ /*
+ * If we are at the first page deep and it's not an index page then
+ * we are simply done. (there is no page to find
+ */
+
+ if (mdb->pg_buf[0]==MDB_PAGE_LEAF) {
+ /* Indexes can have leaves at the end that don't appear
+ * in the upper tree, stash the last index found so
+ * we can follow it at the end. */
+ chain->last_leaf_found = ipg->pg;
+ return ipg;
+ }
+
+ /*
+ * apply sargs here, currently we don't
+ */
+ do {
+ ipg->len = 0;
+ //printf("finding next on pg %lu\n", ipg->pg);
+ if (!mdb_index_find_next_on_page(mdb, ipg)) {
+ //printf("find_next_on_page returned 0\n");
+ return 0;
+ }
+ pg = mdb_pg_get_int24_msb(mdb, ipg->offset + ipg->len - 3);
+ //printf("Looking at pg %lu at %lu %d\n", pg, ipg->offset, ipg->len);
+ ipg->offset += ipg->len;
+
+ /*
+ * add to the chain and call this function
+ * recursively.
+ */
+ newipg = mdb_chain_add_page(mdb, chain, pg);
+ newipg = mdb_find_next_leaf(mdb, idx, chain);
+ //printf("returning pg %lu\n",newipg->pg);
+ return newipg;
+ } while (!passed);
+ /* no more pages */
+ return NULL;
+
+}
+MdbIndexPage *
+mdb_chain_add_page(MdbHandle *mdb, MdbIndexChain *chain, guint32 pg)
+{
+ MdbIndexPage *ipg;
+
+ chain->cur_depth++;
+ if (chain->cur_depth > MDB_MAX_INDEX_DEPTH) {
+ fprintf(stderr,"Error! maximum index depth of %d exceeded. This is probably due to a programming bug, If you are confident that your indexes really are this deep, adjust MDB_MAX_INDEX_DEPTH in mdbtools.h and recompile.\n", MDB_MAX_INDEX_DEPTH);
+ exit(1);
+ }
+ ipg = &(chain->pages[chain->cur_depth - 1]);
+ mdb_index_page_init(ipg);
+ ipg->pg = pg;
+
+ return ipg;
+}
+/*
+ * returns the bottom page of the IndexChain, if IndexChain is empty it
+ * initializes it by reading idx->first_pg (the root page)
+ */
+MdbIndexPage *
+mdb_index_read_bottom_pg(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain)
+{
+ MdbIndexPage *ipg;
+
+ /*
+ * if it's new use the root index page (idx->first_pg)
+ */
+ if (!chain->cur_depth) {
+ ipg = &(chain->pages[0]);
+ mdb_index_page_init(ipg);
+ chain->cur_depth = 1;
+ ipg->pg = idx->first_pg;
+ if (!(ipg = mdb_find_next_leaf(mdb, idx, chain)))
+ return 0;
+ } else {
+ ipg = &(chain->pages[chain->cur_depth - 1]);
+ ipg->len = 0;
+ }
+
+ mdb_read_pg(mdb, ipg->pg);
+
+ return ipg;
+}
+/*
+ * unwind the stack and search for new leaf node
+ */
+MdbIndexPage *
+mdb_index_unwind(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain)
+{
+ MdbIndexPage *ipg;
+
+ //printf("page %lu finished\n",ipg->pg);
+ if (chain->cur_depth==1) {
+ //printf("cur_depth == 1 we're out\n");
+ return NULL;
+ }
+ /*
+ * unwind the stack until we find something or reach
+ * the top.
+ */
+ ipg = NULL;
+ while (chain->cur_depth>1 && ipg==NULL) {
+ //printf("chain depth %d\n", chain->cur_depth);
+ chain->cur_depth--;
+ ipg = mdb_find_next_leaf(mdb, idx, chain);
+ if (ipg) mdb_index_find_next_on_page(mdb, ipg);
+ }
+ if (chain->cur_depth==1) {
+ //printf("last leaf %lu\n", chain->last_leaf_found);
+ return NULL;
+ }
+ return ipg;
+}
+/*
+ * the main index function.
+ * caller provides an index chain which is the current traversal of index
+ * pages from the root page to the leaf. Initially passed as blank,
+ * mdb_index_find_next will store it's state information here. Each invocation
+ * then picks up where the last one left off, allowing us to scroll through
+ * the index one by one.
+ *
+ * Sargs are applied here but also need to be applied on the whole row b/c
+ * text columns may return false positives due to hashing and non-index
+ * columns with sarg values can't be tested here.
+ */
+int
+mdb_index_find_next(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain, guint32 *pg, guint16 *row)
+{
+ MdbIndexPage *ipg;
+ int passed = 0;
+ int idx_sz;
+ int idx_start = 0;
+ MdbColumn *col;
+
+ ipg = mdb_index_read_bottom_pg(mdb, idx, chain);
+
+ /*
+ * loop while the sargs don't match
+ */
+ do {
+ ipg->len = 0;
+ /*
+ * if no more rows on this leaf, try to find a new leaf
+ */
+ if (!mdb_index_find_next_on_page(mdb, ipg)) {
+ if (!chain->clean_up_mode) {
+ if (!(ipg = mdb_index_unwind(mdb, idx, chain)))
+ chain->clean_up_mode = 1;
+ }
+ if (chain->clean_up_mode) {
+ //fprintf(stdout,"in cleanup mode\n");
+
+ if (!chain->last_leaf_found) return 0;
+ mdb_read_pg(mdb, chain->last_leaf_found);
+ chain->last_leaf_found = mdb_pg_get_int24(mdb, 0x0c);
+ //printf("next leaf %lu\n", chain->last_leaf_found);
+ mdb_read_pg(mdb, chain->last_leaf_found);
+ /* reuse the chain for cleanup mode */
+ chain->cur_depth = 1;
+ ipg = &chain->pages[0];
+ mdb_index_page_init(ipg);
+ ipg->pg = chain->last_leaf_found;
+ //printf("next on page %d\n",
+ if (!mdb_index_find_next_on_page(mdb, ipg))
+ return 0;
+ }
+ }
+ *row = mdb->pg_buf[ipg->offset + ipg->len - 1];
+#if 0
+ printf("page: ");
+ buffer_dump(mdb->pg_buf, ipg->offset+ipg->len-4, ipg->offset+ipg->len-2);
+#endif
+ *pg = mdb_pg_get_int24_msb(mdb, ipg->offset + ipg->len - 4);
+#if 0
+ printf("row = %d pg = %lu ipg->pg = %lu offset = %lu len = %d\n", *row, *pg, ipg->pg, ipg->offset, ipg->len);
+#endif
+ col=g_ptr_array_index(idx->table->columns,idx->key_col_num[0]-1);
+ idx_sz = mdb_col_fixed_size(col);
+ /* handle compressed indexes, single key indexes only? */
+ if (idx->num_keys==1 && idx_sz>0 && ipg->len - 4 < idx_sz) {
+#if 0
+ printf("short index found\n");
+ buffer_dump(ipg->cache_value, 0, idx_sz);
+#endif
+ memcpy(&ipg->cache_value[idx_sz - (ipg->len - 4)], &mdb->pg_buf[ipg->offset], ipg->len);
+#if 0
+ buffer_dump(ipg->cache_value, 0, idx_sz);
+#endif
+ } else {
+ idx_start = ipg->offset + (ipg->len - 4 - idx_sz);
+ memcpy(ipg->cache_value, &mdb->pg_buf[idx_start], idx_sz);
+ }
+
+ //idx_start = ipg->offset + (ipg->len - 4 - idx_sz);
+ passed = mdb_index_test_sargs(mdb, idx, ipg->cache_value, idx_sz);
+
+// printf("passed=%d\n", passed);
+
+ buffer_dump(mdb->pg_buf, ipg->offset, ipg->offset+ipg->len-1);
+ ipg->offset += ipg->len;
+
+ } while (!passed);
+
+#if 0
+ fprintf(stdout,"len = %d pos %d\n", ipg->len, ipg->len);
+ buffer_dump(mdb->pg_buf, ipg->offset, ipg->offset+ipg->len-1);
+#endif
+
+ return ipg->len;
+}
+/*
+ * XXX - FIX ME
+ * This function is grossly inefficient. It scans the entire index building
+ * an IndexChain to a specific row. We should be checking the index pages
+ * for matches against the indexed fields to find the proper leaf page, but
+ * getting it working first and then make it fast!
+ */
+int
+mdb_index_find_row(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain, guint32 pg, guint16 row)
+{
+ MdbIndexPage *ipg;
+ int passed = 0;
+ guint32 datapg;
+ guint16 datarow;
+
+ ipg = mdb_index_read_bottom_pg(mdb, idx, chain);
+
+ do {
+ ipg->len = 0;
+ /*
+ * if no more rows on this leaf, try to find a new leaf
+ */
+ if (!mdb_index_find_next_on_page(mdb, ipg)) {
+ /* back to top? We're done */
+ if (chain->cur_depth==1)
+ return 0;
+
+ /*
+ * unwind the stack until we find something or reach
+ * the top.
+ */
+ while (chain->cur_depth>1) {
+ chain->cur_depth--;
+ if (!(ipg = mdb_find_next_leaf(mdb, idx, chain)))
+ return 0;
+ mdb_index_find_next_on_page(mdb, ipg);
+ }
+ if (chain->cur_depth==1)
+ return 0;
+ }
+ /* test row and pg */
+ datarow = mdb->pg_buf[ipg->offset + ipg->len - 1];
+ datapg = mdb_pg_get_int24_msb(mdb, ipg->offset + ipg->len - 4);
+
+ if (datapg == pg && datarow == row) {
+ passed = 1;
+ }
+ ipg->offset += ipg->len;
+ } while (!passed);
+
+ /* index chain from root to leaf should now be in "chain" */
+ return 1;
+}
+
+static void mdb_index_walk(MdbTableDef *table, MdbIndex *idx)
+{
+MdbHandle *mdb = table->entry->mdb;
+int cur_pos = 0;
+unsigned char marker;
+MdbColumn *col;
+unsigned int i;
+
+ if (idx->num_keys!=1) return;
+
+ mdb_read_pg(mdb, idx->first_pg);
+ cur_pos = 0xf8;
+
+ for (i=0;i<idx->num_keys;i++) {
+ marker = mdb->pg_buf[cur_pos++];
+ col=g_ptr_array_index(table->columns,idx->key_col_num[i]-1);
+ //printf("column %d coltype %d col_size %d (%d)\n",i,col->col_type, mdb_col_fixed_size(col), col->col_size);
+ }
+}
+void
+mdb_index_dump(MdbTableDef *table, MdbIndex *idx)
+{
+ unsigned int i;
+ MdbColumn *col;
+
+ fprintf(stdout,"index number %d\n", idx->index_num);
+ fprintf(stdout,"index name %s\n", idx->name);
+ fprintf(stdout,"index first page %d\n", idx->first_pg);
+ fprintf(stdout,"index rows %d\n", idx->num_rows);
+ if (idx->index_type==1) fprintf(stdout,"index is a primary key\n");
+ for (i=0;i<idx->num_keys;i++) {
+ col=g_ptr_array_index(table->columns,idx->key_col_num[i]-1);
+ fprintf(stdout,"Column %s(%d) Sorted %s Unique: %s\n",
+ col->name,
+ idx->key_col_num[i],
+ idx->key_col_order[i]==MDB_ASC ? "ascending" : "descending",
+ idx->flags & MDB_IDX_UNIQUE ? "Yes" : "No"
+ );
+ }
+ mdb_index_walk(table, idx);
+}
+/*
+ * compute_cost tries to assign a cost to a given index using the sargs
+ * available in this query.
+ *
+ * Indexes with no matching sargs are assigned 0
+ * Unique indexes are preferred over non-uniques
+ * Operator preference is equal, like, isnull, others
+ */
+static int mdb_index_compute_cost(MdbTableDef *table, MdbIndex *idx)
+{
+ unsigned int i;
+ MdbColumn *col;
+ MdbSarg *sarg = NULL;
+ int not_all_equal = 0;
+
+ if (!idx->num_keys) return 0;
+ if (idx->num_keys > 1) {
+ for (i=0;i<idx->num_keys;i++) {
+ col=g_ptr_array_index(table->columns,idx->key_col_num[i]-1);
+ if (col->sargs) sarg = g_ptr_array_index (col->sargs, 0);
+ if (!sarg || sarg->op != MDB_EQUAL) not_all_equal++;
+ }
+ }
+
+ col=g_ptr_array_index(table->columns,idx->key_col_num[0]-1);
+ /*
+ * if this is the first key column and there are no sargs,
+ * then this index is useless.
+ */
+ if (!col->num_sargs) return 0;
+
+ sarg = g_ptr_array_index (col->sargs, 0);
+
+ /*
+ * a like with a wild card first is useless as a sarg */
+ if (sarg->op == MDB_LIKE && sarg->value.s[0]=='%')
+ return 0;
+
+ /*
+ * this needs a lot of tweaking.
+ */
+ if (idx->flags & MDB_IDX_UNIQUE) {
+ if (idx->num_keys == 1) {
+ //printf("op is %d\n", sarg->op);
+ switch (sarg->op) {
+ case MDB_EQUAL:
+ return 1; break;
+ case MDB_LIKE:
+ return 4; break;
+ case MDB_ISNULL:
+ return 12; break;
+ default:
+ return 8; break;
+ }
+ } else {
+ switch (sarg->op) {
+ case MDB_EQUAL:
+ if (not_all_equal) return 2;
+ else return 1;
+ break;
+ case MDB_LIKE:
+ return 6; break;
+ case MDB_ISNULL:
+ return 12; break;
+ default:
+ return 9; break;
+ }
+ }
+ } else {
+ if (idx->num_keys == 1) {
+ switch (sarg->op) {
+ case MDB_EQUAL:
+ return 2; break;
+ case MDB_LIKE:
+ return 5; break;
+ case MDB_ISNULL:
+ return 12; break;
+ default:
+ return 10; break;
+ }
+ } else {
+ switch (sarg->op) {
+ case MDB_EQUAL:
+ if (not_all_equal) return 3;
+ else return 2;
+ break;
+ case MDB_LIKE:
+ return 7; break;
+ case MDB_ISNULL:
+ return 12; break;
+ default:
+ return 11; break;
+ }
+ }
+ }
+ return 0;
+}
+/*
+ * choose_index runs mdb_index_compute_cost for each available index and picks
+ * the best.
+ *
+ * Returns strategy to use (table scan, or index scan)
+ */
+static MdbStrategy
+mdb_choose_index(MdbTableDef *table, int *choice)
+{
+ unsigned int i;
+ MdbIndex *idx;
+ int cost = 0;
+ int least = 99;
+
+ *choice = -1;
+ for (i=0;i<table->num_idxs;i++) {
+ idx = g_ptr_array_index (table->indices, i);
+ cost = mdb_index_compute_cost(table, idx);
+ //printf("cost for %s is %d\n", idx->name, cost);
+ if (cost && cost < least) {
+ least = cost;
+ *choice = i;
+ }
+ }
+ /* and the winner is: *choice */
+ if (least==99) return MDB_TABLE_SCAN;
+ return MDB_INDEX_SCAN;
+}
+void
+mdb_index_scan_init(MdbHandle *mdb, MdbTableDef *table)
+{
+ int i;
+
+ if (mdb_get_option(MDB_USE_INDEX) && mdb_choose_index(table, &i) == MDB_INDEX_SCAN) {
+ table->strategy = MDB_INDEX_SCAN;
+ table->scan_idx = g_ptr_array_index (table->indices, i);
+ table->chain = g_malloc0(sizeof(MdbIndexChain));
+ table->mdbidx = mdb_clone_handle(mdb);
+ mdb_read_pg(table->mdbidx, table->scan_idx->first_pg);
+ //printf("best index is %s\n",table->scan_idx->name);
+ }
+ //printf("TABLE SCAN? %d\n", table->strategy);
+}
+void
+mdb_index_scan_free(MdbTableDef *table)
+{
+ if (table->chain) {
+ g_free(table->chain);
+ table->chain = NULL;
+ }
+ if (table->mdbidx) {
+ mdb_close(table->mdbidx);
+ table->mdbidx = NULL;
+ }
+}
+
+void mdb_free_indices(GPtrArray *indices)
+{
+ unsigned int i;
+
+ if (!indices) return;
+ for (i=0; i<indices->len; i++)
+ g_free (g_ptr_array_index(indices, i));
+ g_ptr_array_free(indices, TRUE);
+}
diff --git a/map/poi_geodownload/libmdb/kkd.c b/map/poi_geodownload/libmdb/kkd.c
new file mode 100644
index 00000000..acf38be8
--- /dev/null
+++ b/map/poi_geodownload/libmdb/kkd.c
@@ -0,0 +1,151 @@
+/* MDB Tools - A library for reading MS Access database file
+ * Copyright (C) 2000 Brian Bruns
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+
+#include "mdbtools.h"
+
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
+
+
+/*
+** Note: This code is mostly garbage right now...just a test to parse out the
+** KKD structures.
+*/
+
+#if 0
+static GArray *mdb_get_column_props(MdbCatalogEntry *entry, int start)
+{
+int pos, cnt=0;
+int len, tmp, cplen;
+MdbColumnProp prop;
+MdbHandle *mdb = entry->mdb;
+
+ entry->props = g_array_new(FALSE,FALSE,sizeof(MdbColumnProp));
+ len = mdb_pg_get_int16(mdb,start);
+ pos = start + 6;
+ while (pos < start+len) {
+ tmp = mdb_pg_get_int16(mdb,pos); /* length of string */
+ pos += 2;
+ cplen = tmp > MDB_MAX_OBJ_NAME ? MDB_MAX_OBJ_NAME : tmp;
+ g_memmove(prop.name,&mdb->pg_buf[pos],cplen);
+ prop.name[cplen]='\0';
+ pos += tmp;
+ g_array_append_val(entry->props, prop.name);
+ cnt++;
+ }
+ entry->num_props = cnt;
+ return entry->props;
+}
+
+static GHashTable *mdb_get_column_def(MdbCatalogEntry *entry, int start)
+{
+GHashTable *hash = NULL;
+MdbHandle *mdb = entry->mdb;
+MdbColumnProp prop;
+int tmp, pos, col_num, val_len, i;
+int len, col_type;
+unsigned char c;
+int end;
+
+ fprintf(stdout,"\n data\n");
+ fprintf(stdout,"-------\n");
+ len = mdb_pg_get_int16(mdb,start);
+ fprintf(stdout,"length = %3d\n",len);
+ pos = start + 6;
+ end = start + len;
+ while (pos < end) {
+ fprintf(stdout,"pos = %3d\n",pos);
+ start = pos;
+ tmp = mdb_pg_get_int16(mdb,pos); /* length of field */
+ pos += 2;
+ col_type = mdb_pg_get_int16(mdb,pos); /* ??? */
+ pos += 2;
+ col_num = 0;
+ if (col_type) {
+ col_num = mdb_pg_get_int16(mdb,pos);
+ pos += 2;
+ }
+ val_len = mdb_pg_get_int16(mdb,pos);
+ pos += 2;
+ fprintf(stdout,"length = %3d %04x %2d %2d ",tmp, col_type, col_num, val_len);
+ for (i=0;i<val_len;i++) {
+ c = mdb->pg_buf[pos+i];
+ if (isprint(c))
+ fprintf(stdout," %c",c);
+ else
+ fprintf(stdout," %02x",c);
+
+ }
+ pos = start + tmp;
+ prop = g_array_index(entry->props,MdbColumnProp,col_num);
+ fprintf(stdout," Property %s",prop.name);
+ fprintf(stdout,"\n");
+ }
+ return hash;
+}
+
+static void mdb_kkd_dump(MdbCatalogEntry *entry)
+{
+int rows;
+int kkd_start, kkd_end;
+int i, tmp, pos, row_type, datapos=0;
+MdbColumnProp prop;
+MdbHandle *mdb = entry->mdb;
+int rowid = entry->kkd_rowid;
+
+
+ mdb_read_pg(mdb, entry->kkd_pg);
+ rows = mdb_pg_get_int16(mdb,8);
+ fprintf(stdout,"number of rows = %d\n",rows);
+ kkd_start = mdb_pg_get_int16(mdb,10+rowid*2);
+ fprintf(stdout,"kkd start = %d %04x\n",kkd_start,kkd_start);
+ kkd_end = mdb->fmt->pg_size;
+ for (i=0;i<rows;i++) {
+ tmp = mdb_pg_get_int16(mdb, 10+i*2);
+ if (tmp < mdb->fmt->pg_size &&
+ tmp > kkd_start &&
+ tmp < kkd_end) {
+ kkd_end = tmp;
+ }
+ }
+ fprintf(stdout,"kkd end = %d %04x\n",kkd_end,kkd_end);
+ pos = kkd_start + 4; /* 4 = K K D \0 */
+ while (pos < kkd_end) {
+ tmp = mdb_pg_get_int16(mdb,pos);
+ row_type = mdb_pg_get_int16(mdb,pos+4);
+ fprintf(stdout,"row size = %3d type = 0x%02x\n",tmp,row_type);
+ if (row_type==0x80) {
+ fprintf(stdout,"\nColumn Properties\n");
+ fprintf(stdout,"-----------------\n");
+ mdb_get_column_props(entry,pos);
+ for (i=0;i<entry->num_props;i++) {
+ prop = g_array_index(entry->props,MdbColumnProp,i);
+ fprintf(stdout,"%3d %s\n",i,prop.name);
+ }
+ }
+ if (row_type==0x01) datapos = pos;
+ pos += tmp;
+ }
+
+ if (datapos) {
+ mdb_get_column_def(entry, datapos);
+ }
+}
+#endif
diff --git a/navit/data/poi_geodownload/libmdb/like.c b/map/poi_geodownload/libmdb/like.c
index 0a23d45c..0a23d45c 100644
--- a/navit/data/poi_geodownload/libmdb/like.c
+++ b/map/poi_geodownload/libmdb/like.c
diff --git a/map/poi_geodownload/libmdb/map.c b/map/poi_geodownload/libmdb/map.c
new file mode 100644
index 00000000..aee66269
--- /dev/null
+++ b/map/poi_geodownload/libmdb/map.c
@@ -0,0 +1,133 @@
+/* MDB Tools - A library for reading MS Access database file
+ * Copyright (C) 2000 Brian Bruns
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+
+#include "mdbtools.h"
+
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
+
+static guint32
+mdb_map_find_next0(MdbHandle *mdb, unsigned char *map, unsigned int map_sz, guint32 start_pg)
+{
+ guint32 pgnum, i, usage_bitlen;
+ unsigned char *usage_bitmap;
+
+ pgnum = mdb_get_int32(map, 1);
+ usage_bitmap = map + 5;
+ usage_bitlen = (map_sz - 5) * 8;
+
+ i = (start_pg >= pgnum) ? start_pg-pgnum+1 : 0;
+ for (; i<usage_bitlen; i++) {
+ if (usage_bitmap[i/8] & (1 << (i%8))) {
+ return pgnum + i;
+ }
+ }
+ /* didn't find anything */
+ return 0;
+}
+static int
+mdb_map_find_next1(MdbHandle *mdb, unsigned char *map, unsigned int map_sz, guint32 start_pg)
+{
+ guint32 map_ind, max_map_pgs, offset, usage_bitlen;
+
+ /*
+ * start_pg will tell us where to (re)start the scan
+ * for the next data page. each usage_map entry points to a
+ * 0x05 page which bitmaps (mdb->fmt->pg_size - 4) * 8 pages.
+ *
+ * map_ind gives us the starting usage_map entry
+ * offset gives us a page offset into the bitmap
+ */
+ usage_bitlen = (mdb->fmt->pg_size - 4) * 8;
+ max_map_pgs = (map_sz - 1) / 4;
+ map_ind = (start_pg + 1) / usage_bitlen;
+ offset = (start_pg + 1) % usage_bitlen;
+
+ for (; map_ind<max_map_pgs; map_ind++) {
+ unsigned char *usage_bitmap;
+ guint32 i, map_pg;
+
+ if (!(map_pg = mdb_get_int32(map, (map_ind*4)+1))) {
+ continue;
+ }
+ if(mdb_read_alt_pg(mdb, map_pg) != mdb->fmt->pg_size) {
+ fprintf(stderr, "Oops! didn't get a full page at %d\n", map_pg);
+ exit(1);
+ }
+
+ usage_bitmap = mdb->alt_pg_buf + 4;
+ for (i=offset; i<usage_bitlen; i++) {
+ if (usage_bitmap[i/8] & (1 << (i%8))) {
+ return map_ind*usage_bitlen + i;
+ }
+ }
+ offset = 0;
+ }
+ /* didn't find anything */
+ return 0;
+}
+guint32
+mdb_map_find_next(MdbHandle *mdb, unsigned char *map, unsigned int map_sz, guint32 start_pg)
+{
+ if (map[0] == 0) {
+ return mdb_map_find_next0(mdb, map, map_sz, start_pg);
+ } else if (map[0] == 1) {
+ return mdb_map_find_next1(mdb, map, map_sz, start_pg);
+ }
+
+ fprintf(stderr, "Warning: unrecognized usage map type: %d\n", map[0]);
+ return -1;
+}
+static guint32
+mdb_alloc_page(MdbTableDef *table)
+{
+ printf("Allocating new page\n");
+ return 0;
+}
+guint32
+mdb_map_find_next_freepage(MdbTableDef *table, int row_size)
+{
+ MdbCatalogEntry *entry = table->entry;
+ MdbHandle *mdb = entry->mdb;
+ guint32 pgnum;
+ guint32 cur_pg = 0;
+ int free_space;
+
+ do {
+ pgnum = mdb_map_find_next(mdb,
+ table->free_usage_map,
+ table->freemap_sz, cur_pg);
+ printf("looking at page %d\n", pgnum);
+ if (!pgnum) {
+ /* allocate new page */
+ pgnum = mdb_alloc_page(table);
+ return pgnum;
+ }
+ cur_pg = pgnum;
+
+ mdb_read_pg(mdb, pgnum);
+ free_space = mdb_pg_get_freespace(mdb);
+
+ } while (free_space < row_size);
+
+ printf("page %d has %d bytes left\n", pgnum, free_space);
+
+ return pgnum;
+}
diff --git a/navit/data/poi_geodownload/libmdb/mem.c b/map/poi_geodownload/libmdb/mem.c
index 208757e7..208757e7 100644
--- a/navit/data/poi_geodownload/libmdb/mem.c
+++ b/map/poi_geodownload/libmdb/mem.c
diff --git a/map/poi_geodownload/libmdb/money.c b/map/poi_geodownload/libmdb/money.c
new file mode 100644
index 00000000..415cdf15
--- /dev/null
+++ b/map/poi_geodownload/libmdb/money.c
@@ -0,0 +1,140 @@
+/* MDB Tools - A library for reading MS Access database file
+ * Copyright (C) 1998-1999 Brian Bruns
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+
+#include <stdio.h>
+#include "mdbtools.h"
+
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
+
+#define MAXPRECISION 20
+/*
+** these routines are copied from the freetds project which does something
+** very similiar
+*/
+
+static int multiply_byte(unsigned char *product, int num, unsigned char *multiplier);
+static int do_carry(unsigned char *product);
+static char *array_to_string(unsigned char *array, int unsigned scale, char *s);
+char *mdb_money_to_string(MdbHandle *mdb, int start, char *s);
+
+/**
+ * mdb_money_to_string
+ * @mdb: Handle to open MDB database file
+ * @start: Offset of the field within the current page
+ * @s: String that will receieve the value
+ *
+ * Returns: the string that has received the value.
+ */
+char *mdb_money_to_string(MdbHandle *mdb, int start, char *s)
+{
+ int num_bytes = 8;
+ int i;
+ int neg=0;
+ unsigned char multiplier[MAXPRECISION], temp[MAXPRECISION];
+ unsigned char product[MAXPRECISION];
+ unsigned char money[num_bytes];
+
+ memset(multiplier,0,MAXPRECISION);
+ memset(product,0,MAXPRECISION);
+ multiplier[0]=1;
+ memcpy(money, mdb->pg_buf + start, num_bytes);
+
+ /* Perform two's complement for negative numbers */
+ if (money[7] & 0x80) {
+ neg = 1;
+ for (i=0;i<num_bytes;i++) {
+ money[i] = ~money[i];
+ }
+ for (i=0; i<num_bytes; i++) {
+ money[i] ++;
+ if (money[i]!=0) break;
+ }
+ }
+
+ for (i=0;i<num_bytes;i++) {
+ /* product += multiplier * current byte */
+ multiply_byte(product, money[i], multiplier);
+
+ /* multiplier = multiplier * 256 */
+ memcpy(temp, multiplier, MAXPRECISION);
+ memset(multiplier,0,MAXPRECISION);
+ multiply_byte(multiplier, 256, temp);
+ }
+ if (neg) {
+ s[0]='-';
+ array_to_string(product, 4, &s[1]);
+ } else {
+ array_to_string(product, 4, s);
+ }
+ return s;
+}
+static int multiply_byte(unsigned char *product, int num, unsigned char *multiplier)
+{
+ unsigned char number[3];
+ unsigned int i, j;
+
+ number[0]=num%10;
+ number[1]=(num/10)%10;
+ number[2]=(num/100)%10;
+
+ for (i=0;i<MAXPRECISION;i++) {
+ if (multiplier[i] == 0) continue;
+ for (j=0;j<3;j++) {
+ if (number[j] == 0) continue;
+ product[i+j] += multiplier[i]*number[j];
+ }
+ do_carry(product);
+ }
+ return 0;
+}
+static int do_carry(unsigned char *product)
+{
+ unsigned int j;
+
+ for (j=0;j<MAXPRECISION-1;j++) {
+ if (product[j]>9) {
+ product[j+1]+=product[j]/10;
+ product[j]=product[j]%10;
+ }
+ }
+ if (product[j]>9) {
+ product[j]=product[j]%10;
+ }
+ return 0;
+}
+static char *array_to_string(unsigned char *array, unsigned int scale, char *s)
+{
+ unsigned int top, i, j=0;
+
+ for (top=MAXPRECISION;(top>0) && (top-1>scale) && !array[top-1];top--);
+
+ if (top == 0) {
+ s[j++] = '0';
+ } else {
+ for (i=top; i>0; i--) {
+ if (j == top-scale) s[j++]='.';
+ s[j++]=array[i-1]+'0';
+ }
+ }
+ s[j]='\0';
+
+ return s;
+}
diff --git a/map/poi_geodownload/libmdb/options.c b/map/poi_geodownload/libmdb/options.c
new file mode 100644
index 00000000..62f2a01f
--- /dev/null
+++ b/map/poi_geodownload/libmdb/options.c
@@ -0,0 +1,86 @@
+/* MDB Tools - A library for reading MS Access database file
+ * Copyright (C) 2004 Brian Bruns
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdlib.h>
+
+#include <mdbtools.h>
+
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
+
+#define DEBUG 1
+
+static unsigned long opts;
+static int optset;
+
+static void load_options(void);
+
+void
+mdb_debug(int klass, char *fmt, ...)
+{
+#ifdef DEBUG
+ va_list ap;
+
+ if (!optset) load_options();
+ if (klass & opts) {
+ va_start(ap, fmt);
+ vfprintf (stdout,fmt, ap);
+ va_end(ap);
+ fprintf(stdout,"\n");
+ }
+#endif
+}
+
+static void
+load_options(void)
+{
+ char *opt;
+ char *s;
+
+ if (!optset && (s=getenv("MDBOPTS"))) {
+ opt = strtok(s, ":");
+ do {
+ if (!strcmp(opt, "use_index")) opts |= MDB_USE_INDEX;
+ if (!strcmp(opt, "debug_like")) opts |= MDB_DEBUG_LIKE;
+ if (!strcmp(opt, "debug_write")) opts |= MDB_DEBUG_WRITE;
+ if (!strcmp(opt, "debug_usage")) opts |= MDB_DEBUG_USAGE;
+ if (!strcmp(opt, "debug_ole")) opts |= MDB_DEBUG_OLE;
+ if (!strcmp(opt, "debug_row")) opts |= MDB_DEBUG_ROW;
+ if (!strcmp(opt, "debug_all")) {
+ opts |= MDB_DEBUG_LIKE;
+ opts |= MDB_DEBUG_WRITE;
+ opts |= MDB_DEBUG_USAGE;
+ opts |= MDB_DEBUG_OLE;
+ opts |= MDB_DEBUG_ROW;
+ }
+ opt = strtok(NULL,":");
+ } while (opt);
+ }
+ optset = 1;
+}
+int
+mdb_get_option(unsigned long optnum)
+{
+ if (!optset) load_options();
+ return ((opts & optnum) > 0);
+}
diff --git a/map/poi_geodownload/libmdb/props.c b/map/poi_geodownload/libmdb/props.c
new file mode 100644
index 00000000..aaf7e63f
--- /dev/null
+++ b/map/poi_geodownload/libmdb/props.c
@@ -0,0 +1,127 @@
+/* MDB Tools - A library for reading MS Access database file
+ * Copyright (C) 2000 Brian Bruns
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+
+#include "mdbtools.h"
+
+GPtrArray *
+mdb_read_props_list(gchar *kkd, int len)
+{
+ guint32 record_len;
+ int pos = 0;
+ guchar *name;
+ GPtrArray *names = NULL;
+ int i = 0;
+
+ names = g_ptr_array_new();
+#ifdef MDB_DEBUG
+ buffer_dump((const unsigned char*) kkd, 0, len - 1);
+#endif
+ pos = 0;
+ while (pos < len) {
+ record_len = mdb_get_int16((unsigned char*)kkd, pos);
+ pos += 2;
+#ifdef MDB_DEBUG
+ printf("%02d ",i++);
+ buffer_dump((const unsigned char*)kkd, pos - 2, pos + record_len - 1);
+#endif
+ name = g_malloc(record_len + 1);
+ strncpy((char*)name, (char*)&kkd[pos], record_len);
+ name[record_len] = '\0';
+ pos += record_len;
+ g_ptr_array_add(names, name);
+#ifdef MDB_DEBUG
+ printf("new len = %d\n", names->len);
+#endif
+ }
+ return names;
+}
+void
+mdb_free_props(MdbProperties *props)
+{
+ if (!props) return;
+
+ if (props->name) g_free(props->name);
+ g_free(props);
+}
+static MdbProperties *
+mdb_alloc_props(void)
+{
+ MdbProperties *props;
+
+ props = g_malloc0(sizeof(MdbProperties));
+
+ return props;
+}
+MdbProperties *
+mdb_read_props(MdbHandle *mdb, GPtrArray *names, gchar *kkd, int len)
+{
+ guint32 record_len, name_len;
+ int pos = 0;
+ int elem, dtype, dsize;
+ gchar *name, *value;
+ MdbProperties *props;
+ int i = 0;
+
+#ifdef MDB_DEBUG
+ buffer_dump((const unsigned char*)kkd, 0, len - 1);
+#endif
+ pos = 0;
+
+ /* skip the name record */
+ record_len = mdb_get_int16((unsigned char *)kkd, pos);
+ pos += 4;
+ name_len = mdb_get_int16((unsigned char *)kkd, pos);
+ pos += 2;
+ props = mdb_alloc_props();
+ if (name_len) {
+ props->name = g_malloc(name_len + 1);
+ strncpy(props->name, (char*) &kkd[pos], name_len);
+ props->name[name_len]='\0';
+ }
+ pos += name_len;
+
+ props->hash = g_hash_table_new(g_str_hash, g_str_equal);
+
+ while (pos < len) {
+ record_len = mdb_get_int16((unsigned char *)kkd, pos);
+ elem = mdb_get_int16((unsigned char *)kkd, pos + 4);
+ dtype = kkd[pos + 3];
+ dsize = mdb_get_int16((unsigned char *)kkd, pos + 6);
+ value = g_malloc(dsize + 1);
+ strncpy(value, (char*) &kkd[pos + 8], dsize);
+ value[dsize] = '\0';
+ name = g_ptr_array_index(names,elem);
+#ifdef MDB_DEBUG
+ printf("%02d ",i++);
+ buffer_dump((const unsigned char *)kkd, pos, pos + record_len - 1);
+ printf("elem %d dsize %d dtype %d\n", elem, dsize, dtype);
+#endif
+ if (dtype == MDB_MEMO) dtype = MDB_TEXT;
+ if (dtype == MDB_BOOL) {
+ g_hash_table_insert(props->hash, g_strdup(name), g_strdup(kkd[pos + 8] ? "yes" : "no"));
+ } else {
+ g_hash_table_insert(props->hash, g_strdup(name), g_strdup(mdb_col_to_string(mdb, (unsigned char *)kkd, pos + 8, dtype, dsize)));
+ }
+ g_free(value);
+ pos += record_len;
+ }
+ return props;
+
+}
diff --git a/map/poi_geodownload/libmdb/sargs.c b/map/poi_geodownload/libmdb/sargs.c
new file mode 100644
index 00000000..58d02d43
--- /dev/null
+++ b/map/poi_geodownload/libmdb/sargs.c
@@ -0,0 +1,273 @@
+/* MDB Tools - A library for reading MS Access database file
+ * Copyright (C) 2000 Brian Bruns
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+
+/*
+ * code for handling searchable arguments (sargs) used primary by the sql
+ * engine to support where clause handling. The sargs are configured in
+ * a tree with AND/OR operators connecting the child nodes. NOT operations
+ * have only one child on the left side. Logical operators (=,<,>,etc..)
+ * have no children.
+ *
+ * datatype support is a bit weak at this point. To add more types create
+ * a mdb_test_[type]() function and invoke it from mdb_test_sarg()
+ */
+#include "mdbtools.h"
+
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
+
+void
+mdb_sql_walk_tree(MdbSargNode *node, MdbSargTreeFunc func, gpointer data)
+{
+ if (func(node, data))
+ return;
+ if (node->left) mdb_sql_walk_tree(node->left, func, data);
+ if (node->right) mdb_sql_walk_tree(node->right, func, data);
+}
+int
+mdb_test_string(MdbSargNode *node, char *s)
+{
+int rc;
+
+ if (node->op == MDB_LIKE) {
+ return mdb_like_cmp(s,node->value.s);
+ }
+ rc = strncmp(node->value.s, s, 255);
+ switch (node->op) {
+ case MDB_EQUAL:
+ if (rc==0) return 1;
+ break;
+ case MDB_GT:
+ if (rc<0) return 1;
+ break;
+ case MDB_LT:
+ if (rc>0) return 1;
+ break;
+ case MDB_GTEQ:
+ if (rc<=0) return 1;
+ break;
+ case MDB_LTEQ:
+ if (rc>=0) return 1;
+ break;
+ default:
+ fprintf(stderr, "Calling mdb_test_sarg on unknown operator. Add code to mdb_test_string() for operator %d\n",node->op);
+ break;
+ }
+ return 0;
+}
+int mdb_test_int(MdbSargNode *node, gint32 i)
+{
+ switch (node->op) {
+ case MDB_EQUAL:
+ printf("comparing %x and %x %d\n", i, node->value.i, node->value.i == i);
+ if (node->value.i == i) return 1;
+ break;
+ case MDB_GT:
+ if (node->value.i < i) return 1;
+ break;
+ case MDB_LT:
+ if (node->value.i > i) return 1;
+ break;
+ case MDB_GTEQ:
+ if (node->value.i <= i) return 1;
+ break;
+ case MDB_LTEQ:
+ if (node->value.i >= i) return 1;
+ break;
+ default:
+ fprintf(stderr, "Calling mdb_test_sarg on unknown operator. Add code to mdb_test_int() for operator %d\n",node->op);
+ break;
+ }
+ return 0;
+}
+#if 0
+#endif
+int
+mdb_find_indexable_sargs(MdbSargNode *node, gpointer data)
+{
+ MdbSarg sarg;
+
+ if (node->op == MDB_OR || node->op == MDB_NOT) return 1;
+
+ /*
+ * right now all we do is look for sargs that are anded together from
+ * the root. Later we may put together OR ops into a range, and then
+ * range scan the leaf pages. That is col1 = 2 or col1 = 4 becomes
+ * col1 >= 2 and col1 <= 4 for the purpose of index scans, and then
+ * extra rows are thrown out when the row is tested against the main
+ * sarg tree. range scans are generally only a bit better than table
+ * scanning anyway.
+ *
+ * also, later we should support the NOT operator, but it's generally
+ * a pretty worthless test for indexes, ie NOT col1 = 3, we are
+ * probably better off table scanning.
+ */
+ if (mdb_is_relational_op(node->op) && node->col) {
+ //printf("op = %d value = %s\n", node->op, node->value.s);
+ sarg.op = node->op;
+ sarg.value = node->value;
+ mdb_add_sarg(node->col, &sarg);
+ }
+ return 0;
+}
+int
+mdb_test_sarg(MdbHandle *mdb, MdbColumn *col, MdbSargNode *node, MdbField *field)
+{
+char tmpbuf[256];
+int lastchar;
+
+ if (node->op == MDB_ISNULL) {
+ if (field->is_null) return 0;
+ else return 1;
+ } else if (node->op == MDB_NOTNULL) {
+ if (field->is_null) return 1;
+ else return 0;
+ }
+ switch (col->col_type) {
+ case MDB_BOOL:
+ return mdb_test_int(node, !field->is_null);
+ break;
+ case MDB_BYTE:
+ return mdb_test_int(node, (gint32)((char *)field->value)[0]);
+ break;
+ case MDB_INT:
+ return mdb_test_int(node, (gint32)mdb_get_int16(field->value, 0));
+ break;
+ case MDB_LONGINT:
+ return mdb_test_int(node, (gint32)mdb_get_int32(field->value, 0));
+ break;
+ case MDB_TEXT:
+ if (IS_JET4(mdb)) {
+ mdb_unicode2ascii(mdb, field->value, 0, field->siz, tmpbuf);
+ } else {
+ strncpy(tmpbuf, field->value, 255);
+ lastchar = field->siz > 255 ? 255 : field->siz;
+ tmpbuf[lastchar]='\0';
+ }
+ return mdb_test_string(node, tmpbuf);
+ default:
+ fprintf(stderr, "Calling mdb_test_sarg on unknown type. Add code to mdb_test_sarg() for type %d\n",col->col_type);
+ break;
+ }
+ return 1;
+}
+static int
+mdb_find_field(int col_num, MdbField *fields, int num_fields)
+{
+ int i;
+
+ for (i=0;i<num_fields;i++) {
+ if (fields[i].colnum == col_num) return i;
+ }
+ return -1;
+}
+static int
+mdb_test_sarg_node(MdbHandle *mdb, MdbSargNode *node, MdbField *fields, int num_fields)
+{
+ int elem;
+ MdbColumn *col;
+ int rc;
+
+ if (mdb_is_relational_op(node->op)) {
+ col = node->col;
+ /* for const = const expressions */
+ if (!col) {
+ return (node->value.i);
+ }
+ elem = mdb_find_field(col->col_num, fields, num_fields);
+ if (!mdb_test_sarg(mdb, col, node, &fields[elem]))
+ return 0;
+ } else { /* logical op */
+ switch (node->op) {
+ case MDB_NOT:
+ rc = mdb_test_sarg_node(mdb, node->left, fields, num_fields);
+ return !rc;
+ break;
+ case MDB_AND:
+ if (!mdb_test_sarg_node(mdb, node->left, fields, num_fields))
+ return 0;
+ return mdb_test_sarg_node(mdb, node->right, fields, num_fields);
+ break;
+ case MDB_OR:
+ if (mdb_test_sarg_node(mdb, node->left, fields, num_fields))
+ return 1;
+ return mdb_test_sarg_node(mdb, node->right, fields, num_fields);
+ break;
+ }
+ }
+ return 1;
+}
+int
+mdb_test_sargs(MdbTableDef *table, MdbField *fields, int num_fields)
+{
+ MdbSargNode *node;
+ MdbCatalogEntry *entry = table->entry;
+ MdbHandle *mdb = entry->mdb;
+
+ node = table->sarg_tree;
+
+ /* there may not be a sarg tree */
+ if (!node) return 1;
+
+ return mdb_test_sarg_node(mdb, node, fields, num_fields);
+}
+#if 0
+int mdb_test_sargs(MdbHandle *mdb, MdbColumn *col, int offset, int len)
+{
+MdbSarg *sarg;
+int i;
+
+ for (i=0;i<col->num_sargs;i++) {
+ sarg = g_ptr_array_index (col->sargs, i);
+ if (!mdb_test_sarg(mdb, col, sarg, offset, len)) {
+ /* sarg didn't match, no sense going on */
+ return 0;
+ }
+ }
+
+ return 1;
+}
+#endif
+int mdb_add_sarg(MdbColumn *col, MdbSarg *in_sarg)
+{
+MdbSarg *sarg;
+ if (!col->sargs) {
+ col->sargs = g_ptr_array_new();
+ }
+ sarg = g_memdup(in_sarg,sizeof(MdbSarg));
+ g_ptr_array_add(col->sargs, sarg);
+ col->num_sargs++;
+
+ return 1;
+}
+int mdb_add_sarg_by_name(MdbTableDef *table, char *colname, MdbSarg *in_sarg)
+{
+ MdbColumn *col;
+ unsigned int i;
+
+ for (i=0;i<table->num_cols;i++) {
+ col = g_ptr_array_index (table->columns, i);
+ if (!strcasecmp(col->name,colname)) {
+ return mdb_add_sarg(col, in_sarg);
+ }
+ }
+ /* else didn't find the column return 0! */
+ return 0;
+}
diff --git a/navit/data/poi_geodownload/libmdb/stats.c b/map/poi_geodownload/libmdb/stats.c
index 1abf2857..1abf2857 100644
--- a/navit/data/poi_geodownload/libmdb/stats.c
+++ b/map/poi_geodownload/libmdb/stats.c
diff --git a/map/poi_geodownload/libmdb/table.c b/map/poi_geodownload/libmdb/table.c
new file mode 100644
index 00000000..c1960075
--- /dev/null
+++ b/map/poi_geodownload/libmdb/table.c
@@ -0,0 +1,370 @@
+/* MDB Tools - A library for reading MS Access database file
+ * Copyright (C) 2000 Brian Bruns
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+
+#include "mdbtools.h"
+
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
+
+
+static gint mdb_col_comparer(MdbColumn **a, MdbColumn **b)
+{
+ if ((*a)->col_num > (*b)->col_num)
+ return 1;
+ else if ((*a)->col_num < (*b)->col_num)
+ return -1;
+ else
+ return 0;
+}
+
+#if 0
+static unsigned char mdb_col_needs_size(int col_type)
+{
+ if (col_type == MDB_TEXT) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+#endif
+
+MdbTableDef *mdb_alloc_tabledef(MdbCatalogEntry *entry)
+{
+ MdbTableDef *table;
+
+ table = (MdbTableDef *) g_malloc0(sizeof(MdbTableDef));
+ table->entry=entry;
+ strcpy(table->name, entry->object_name);
+
+ return table;
+}
+void mdb_free_tabledef(MdbTableDef *table)
+{
+ if (!table) return;
+ if (table->is_temp_table) {
+ unsigned int i;
+ for (i=0; i<table->temp_table_pages->len; i++)
+ g_free(g_ptr_array_index(table->temp_table_pages,i));
+ g_ptr_array_free(table->temp_table_pages, TRUE);
+ }
+ mdb_free_columns(table->columns);
+ mdb_free_indices(table->indices);
+ g_free(table->usage_map);
+ g_free(table->free_usage_map);
+ g_free(table);
+}
+MdbTableDef *mdb_read_table(MdbCatalogEntry *entry)
+{
+ MdbTableDef *table;
+ MdbHandle *mdb = entry->mdb;
+ MdbFormatConstants *fmt = mdb->fmt;
+ int len, row_start, pg_row;
+ unsigned char *buf;
+
+ table = mdb_alloc_tabledef(entry);
+
+ mdb_read_pg(mdb, entry->table_pg);
+ if (mdb->pg_buf[0] != 0x02) return NULL; /* not a valid table def page */
+
+ len = mdb_pg_get_int16(mdb,8);
+
+ table->num_rows = mdb_pg_get_int32(mdb, fmt->tab_num_rows_offset);
+ table->num_var_cols = mdb_pg_get_int16(mdb, fmt->tab_num_cols_offset-2);
+ table->num_cols = mdb_pg_get_int16(mdb, fmt->tab_num_cols_offset);
+ table->num_idxs = mdb_pg_get_int32(mdb, fmt->tab_num_idxs_offset);
+ table->num_real_idxs = mdb_pg_get_int32(mdb, fmt->tab_num_ridxs_offset);
+ /* grab a copy of the usage map */
+ pg_row = mdb_pg_get_int32(mdb, fmt->tab_usage_map_offset);
+ mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &(table->map_sz));
+ table->usage_map = g_memdup(buf + row_start, table->map_sz);
+ if (mdb_get_option(MDB_DEBUG_USAGE))
+ buffer_dump(buf, row_start, row_start+table->map_sz-1);
+ mdb_debug(MDB_DEBUG_USAGE,"usage map found on page %ld row %d start %d len %d",
+ pg_row >> 8, pg_row & 0xff, row_start, table->map_sz);
+
+ /* grab a copy of the free space page map */
+ pg_row = mdb_pg_get_int32(mdb, fmt->tab_free_map_offset);
+ mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &(table->freemap_sz));
+ table->free_usage_map = g_memdup(buf + row_start, table->freemap_sz);
+ mdb_debug(MDB_DEBUG_USAGE,"free map found on page %ld row %d start %d len %d\n",
+ pg_row >> 8, pg_row & 0xff, row_start, table->freemap_sz);
+
+ table->first_data_pg = mdb_pg_get_int16(mdb, fmt->tab_first_dpg_offset);
+
+ return table;
+}
+MdbTableDef *mdb_read_table_by_name(MdbHandle *mdb, gchar *table_name, int obj_type)
+{
+ unsigned int i;
+ MdbCatalogEntry *entry;
+
+ mdb_read_catalog(mdb, obj_type);
+
+ for (i=0; i<mdb->num_catalog; i++) {
+ entry = g_ptr_array_index(mdb->catalog, i);
+ if (!strcasecmp(entry->object_name, table_name))
+ return mdb_read_table(entry);
+ }
+
+ return NULL;
+}
+
+/*
+** read the next page if offset is > pg_size
+** return true if page was read
+*/
+int
+read_pg_if(MdbHandle *mdb, int *cur_pos, int offset)
+{
+ if (*cur_pos + offset >= mdb->fmt->pg_size) {
+ mdb_read_pg(mdb, mdb_pg_get_int32(mdb,4));
+ *cur_pos = 8 - (mdb->fmt->pg_size - (*cur_pos));
+ return 1;
+ }
+ return 0;
+}
+guint32
+read_pg_if_32(MdbHandle *mdb, int *cur_pos)
+{
+ unsigned char c[4];
+ int i, rc = 0;
+
+ for (i=0;i<4;i++) {
+ rc += read_pg_if(mdb, cur_pos, i);
+ c[i] = mdb->pg_buf[(*cur_pos) + i];
+ }
+ return mdb_get_int32(c, 0);
+}
+guint16
+read_pg_if_16(MdbHandle *mdb, int *cur_pos)
+{
+ unsigned char low_byte, high_byte;
+ int rc = 0;
+
+ rc += read_pg_if(mdb, cur_pos, 0);
+ low_byte = mdb->pg_buf[*cur_pos];
+ rc += read_pg_if(mdb, cur_pos, 1);
+ high_byte = mdb->pg_buf[(*cur_pos) + 1];
+
+ return (high_byte * 256 + low_byte);
+}
+guint16
+read_pg_if_n(MdbHandle *mdb, unsigned char *buf, int *cur_pos, int len)
+{
+ if (*cur_pos + len < mdb->fmt->pg_size) {
+ memcpy(buf, &mdb->pg_buf[*cur_pos], len);
+ return 0;
+ } else {
+ int half = mdb->fmt->pg_size - *cur_pos;
+ memcpy(buf, &mdb->pg_buf[*cur_pos], half);
+ mdb_read_pg(mdb, mdb_pg_get_int32(mdb,4));
+ memcpy(buf + half, &mdb->pg_buf[8], len - half);
+ *cur_pos = 8 - half;
+ return 1;
+ }
+}
+
+void mdb_append_column(GPtrArray *columns, MdbColumn *in_col)
+{
+ g_ptr_array_add(columns, g_memdup(in_col,sizeof(MdbColumn)));
+}
+void mdb_free_columns(GPtrArray *columns)
+{
+ unsigned int i;
+
+ if (!columns) return;
+ for (i=0; i<columns->len; i++)
+ g_free (g_ptr_array_index(columns, i));
+ g_ptr_array_free(columns, TRUE);
+}
+GPtrArray *mdb_read_columns(MdbTableDef *table)
+{
+ MdbHandle *mdb = table->entry->mdb;
+ MdbFormatConstants *fmt = mdb->fmt;
+ MdbColumn *pcol;
+ unsigned char *col;
+ unsigned int i;
+ int cur_pos, name_sz;
+
+ table->columns = g_ptr_array_new();
+
+ col = (unsigned char *) g_malloc(fmt->tab_col_entry_size);
+
+ cur_pos = fmt->tab_cols_start_offset +
+ (table->num_real_idxs * fmt->tab_ridx_entry_size);
+
+ /* new code based on patch submitted by Tim Nelson 2000.09.27 */
+
+ /*
+ ** column attributes
+ */
+ for (i=0;i<table->num_cols;i++) {
+#ifdef MDB_DEBUG
+ /* printf("column %d\n", i);
+ buffer_dump(mdb->pg_buf, cur_pos ,cur_pos + 18); */
+#endif
+ read_pg_if_n(mdb, col, &cur_pos, fmt->tab_col_entry_size);
+ cur_pos += fmt->tab_col_entry_size;
+ pcol = (MdbColumn *) g_malloc0(sizeof(MdbColumn));
+
+ pcol->col_type = col[0];
+
+ // col_num_offset == 1 or 5
+ pcol->col_num = col[fmt->col_num_offset];
+
+ //fprintf(stdout,"----- column %d -----\n",pcol->col_num);
+ // col_var == 3 or 7
+ pcol->var_col_num = mdb_get_int16(col, fmt->tab_col_offset_var);
+ //fprintf(stdout,"var column pos %d\n",pcol->var_col_num);
+
+ // col_var == 5 or 9
+ pcol->row_col_num = mdb_get_int16(col, fmt->tab_row_col_num_offset);
+ //fprintf(stdout,"row column num %d\n",pcol->row_col_num);
+
+ /* FIXME: can this be right in Jet3 and Jet4? */
+ if (pcol->col_type == MDB_NUMERIC) {
+ pcol->col_prec = col[11];
+ pcol->col_scale = col[12];
+ }
+
+ // col_fixed_offset == 13 or 15
+ pcol->is_fixed = col[fmt->col_fixed_offset] & 0x01 ? 1 : 0;
+
+ // col_fixed_offset == 13 or 15
+ pcol->fixed_offset = mdb_get_int16(col, fmt->tab_col_offset_fixed);
+ //fprintf(stdout,"fixed column offset %d\n",pcol->fixed_offset);
+ //fprintf(stdout,"col type %s\n",pcol->is_fixed ? "fixed" : "variable");
+
+ if (pcol->col_type != MDB_BOOL) {
+ // col_size_offset == 16 or 23
+ pcol->col_size = mdb_get_int16(col, fmt->col_size_offset);
+ } else {
+ pcol->col_size=0;
+ }
+
+ g_ptr_array_add(table->columns, pcol);
+ }
+
+ g_free (col);
+
+ /*
+ ** column names - ordered the same as the column attributes table
+ */
+ for (i=0;i<table->num_cols;i++) {
+ pcol = g_ptr_array_index(table->columns, i);
+
+ if (IS_JET4(mdb)) {
+ unsigned char *tmp_buf;
+ name_sz = read_pg_if_16(mdb, &cur_pos);
+ cur_pos += 2;
+ tmp_buf = (unsigned char *) g_malloc(name_sz);
+ read_pg_if_n(mdb, tmp_buf, &cur_pos, name_sz);
+ mdb_unicode2ascii(mdb, tmp_buf, 0, name_sz, pcol->name);
+ g_free(tmp_buf);
+ cur_pos += name_sz;
+ } else if (IS_JET3(mdb)) {
+ read_pg_if(mdb, &cur_pos, 0);
+ name_sz = mdb->pg_buf[cur_pos];
+ cur_pos++;
+ read_pg_if_n(mdb, (unsigned char*) pcol->name, &cur_pos, name_sz);
+ pcol->name[name_sz]='\0';
+ cur_pos += name_sz;
+ } else {
+ fprintf(stderr,"Unknown MDB version\n");
+ }
+ }
+
+ /* Sort the columns by col_num */
+ g_ptr_array_sort(table->columns, (GCompareFunc)mdb_col_comparer);
+
+ table->index_start = cur_pos;
+ return table->columns;
+}
+
+void mdb_table_dump(MdbCatalogEntry *entry)
+{
+MdbTableDef *table;
+MdbColumn *col;
+int coln;
+MdbIndex *idx;
+MdbHandle *mdb = entry->mdb;
+unsigned int i, bitn;
+guint32 pgnum;
+
+ table = mdb_read_table(entry);
+ fprintf(stdout,"definition page = %lu\n",entry->table_pg);
+ fprintf(stdout,"number of datarows = %d\n",table->num_rows);
+ fprintf(stdout,"number of columns = %d\n",table->num_cols);
+ fprintf(stdout,"number of indices = %d\n",table->num_real_idxs);
+
+ mdb_read_columns(table);
+ mdb_read_indices(table);
+
+ for (i=0;i<table->num_cols;i++) {
+ col = g_ptr_array_index(table->columns,i);
+
+ fprintf(stdout,"column %d Name: %-20s Type: %s(%d)\n",
+ i, col->name,
+ mdb_get_coltype_string(mdb->default_backend, col->col_type),
+ col->col_size);
+ }
+
+ for (i=0;i<table->num_idxs;i++) {
+ idx = g_ptr_array_index (table->indices, i);
+ mdb_index_dump(table, idx);
+ }
+ if (table->usage_map) {
+ printf("pages reserved by this object\n");
+ printf("usage map pg %" G_GUINT32_FORMAT "\n",
+ table->map_base_pg);
+ printf("free map pg %" G_GUINT32_FORMAT "\n",
+ table->freemap_base_pg);
+ pgnum = mdb_get_int32(table->usage_map,1);
+ /* the first 5 bytes of the usage map mean something */
+ coln = 0;
+ for (i=5;i<table->map_sz;i++) {
+ for (bitn=0;bitn<8;bitn++) {
+ if (table->usage_map[i] & 1 << bitn) {
+ coln++;
+ printf("%6" G_GUINT32_FORMAT, pgnum);
+ if (coln==10) {
+ printf("\n");
+ coln = 0;
+ } else {
+ printf(" ");
+ }
+ }
+ pgnum++;
+ }
+ }
+ printf("\n");
+ }
+}
+
+int mdb_is_user_table(MdbCatalogEntry *entry)
+{
+ return ((entry->object_type == MDB_TABLE)
+ && !(entry->flags & 0x80000002)) ? 1 : 0;
+}
+int mdb_is_system_table(MdbCatalogEntry *entry)
+{
+ return ((entry->object_type == MDB_TABLE)
+ && (entry->flags & 0x80000002)) ? 1 : 0;
+}
diff --git a/navit/data/poi_geodownload/libmdb/worktable.c b/map/poi_geodownload/libmdb/worktable.c
index 6f893dcf..6f893dcf 100644
--- a/navit/data/poi_geodownload/libmdb/worktable.c
+++ b/map/poi_geodownload/libmdb/worktable.c
diff --git a/map/poi_geodownload/libmdb/write.c b/map/poi_geodownload/libmdb/write.c
new file mode 100644
index 00000000..a4b82ed6
--- /dev/null
+++ b/map/poi_geodownload/libmdb/write.c
@@ -0,0 +1,883 @@
+/* MDB Tools - A library for reading MS Access database file
+ * Copyright (C) 2000 Brian Bruns
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+
+#include "mdbtools.h"
+#include "time.h"
+#include "math.h"
+
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
+
+
+//static int mdb_copy_index_pg(MdbTableDef *table, MdbIndex *idx, MdbIndexPage *ipg);
+static int mdb_add_row_to_leaf_pg(MdbTableDef *table, MdbIndex *idx, MdbIndexPage *ipg, MdbField *idx_fields);
+
+static void
+_mdb_put_int16(unsigned char *buf, guint32 offset, guint32 value)
+{
+ buf[offset] = value % 256;
+ value /= 256;
+ buf[offset+1] = value % 256;
+}
+static void
+_mdb_put_int32(unsigned char *buf, guint32 offset, guint32 value)
+{
+ buf[offset] = value % 256;
+ value /= 256;
+ buf[offset+1] = value % 256;
+ value /= 256;
+ buf[offset+2] = value % 256;
+ value /= 256;
+ buf[offset+3] = value % 256;
+}
+static ssize_t
+mdb_write_pg(MdbHandle *mdb, unsigned long pg)
+{
+ ssize_t len;
+ struct stat status;
+ off_t offset = pg * mdb->fmt->pg_size;
+
+ fstat(mdb->f->fd, &status);
+ /* is page beyond current size + 1 ? */
+ if (status.st_size < offset + mdb->fmt->pg_size) {
+ fprintf(stderr,"offset %lu is beyond EOF\n",offset);
+ return 0;
+ }
+ lseek(mdb->f->fd, offset, SEEK_SET);
+ len = write(mdb->f->fd,mdb->pg_buf,mdb->fmt->pg_size);
+ if (len==-1) {
+ perror("write");
+ return 0;
+ } else if (len<mdb->fmt->pg_size) {
+ /* fprintf(stderr,"EOF reached %d bytes returned.\n",len, mdb->pg_size); */
+ return 0;
+ }
+ mdb->cur_pos = 0;
+ return len;
+}
+
+static int
+mdb_is_col_indexed(MdbTableDef *table, int colnum)
+{
+ unsigned int i, j;
+ MdbIndex *idx;
+
+ for (i=0;i<table->num_idxs;i++) {
+ idx = g_ptr_array_index (table->indices, i);
+ for (j=0;j<idx->num_keys;j++) {
+ if (idx->key_col_num[j]==colnum) return 1;
+ }
+ }
+ return 0;
+}
+static int
+mdb_crack_row4(MdbTableDef *table, int row_start, int row_end, MdbField *fields)
+{
+ MdbCatalogEntry *entry = table->entry;
+ MdbHandle *mdb = entry->mdb;
+ MdbColumn *col;
+ unsigned char *pg_buf = mdb->pg_buf;
+ unsigned int i;
+ unsigned int row_var_cols=0, row_fixed_cols, row_cols;
+ unsigned int fixed_cols_found;
+ unsigned int col_start;
+ unsigned char *nullmask;
+ unsigned int bitmask_sz;
+ unsigned int byte_num, bit_num;
+ unsigned int *var_col_offsets = NULL;
+
+ if (mdb_get_option(MDB_DEBUG_ROW)) {
+ buffer_dump(pg_buf, row_start, row_end);
+ }
+
+ row_cols = mdb_pg_get_int16(mdb, row_start);
+
+ bitmask_sz = (row_cols + 7) / 8;
+ nullmask = &pg_buf[row_end - bitmask_sz + 1];
+
+ /* read table of variable column locations */
+ if (table->num_var_cols > 0) {
+ row_var_cols = mdb_pg_get_int16(mdb, row_end - bitmask_sz - 1);
+ var_col_offsets = (unsigned int *)g_malloc((row_var_cols+1)*sizeof(int));
+ for (i=0; i<row_var_cols+1; i++) {
+ var_col_offsets[i] = mdb_pg_get_int16(mdb,
+ row_end - bitmask_sz - 3 - (i*2));
+ }
+ }
+ fixed_cols_found = 0;
+ row_fixed_cols = row_cols - row_var_cols;
+
+ /* read information into fields[] */
+ for (i=0;i<table->num_cols;i++) {
+ col = g_ptr_array_index(table->columns,i);
+ fields[i].colnum = i;
+ fields[i].is_fixed = (mdb_is_fixed_col(col)) ? 1 : 0;
+ byte_num = col->col_num / 8;
+ bit_num = col->col_num % 8;
+ /* logic on nulls is reverse, 1 is not null, 0 is null */
+ fields[i].is_null = nullmask[byte_num] & (1 << bit_num) ? 0 : 1;
+
+ if ((fields[i].is_fixed)
+ && (fixed_cols_found < row_fixed_cols)) {
+ col_start = col->fixed_offset + 2;
+ fields[i].start = row_start + col_start;
+ fields[i].value = &pg_buf[row_start + col_start];
+ fields[i].siz = col->col_size;
+ fixed_cols_found++;
+ /* Use col->var_col_num because a deleted column is still
+ * present in the variable column offsets table for the row */
+ } else if ((!fields[i].is_fixed)
+ && (col->var_col_num < row_var_cols)) {
+ col_start = var_col_offsets[col->var_col_num];
+ fields[i].start = row_start + col_start;
+ fields[i].value = &pg_buf[row_start + col_start];
+ fields[i].siz = var_col_offsets[(col->var_col_num)+1] -
+ col_start;
+ } else {
+ fields[i].start = 0;
+ fields[i].value = NULL;
+ fields[i].siz = 0;
+ fields[i].is_null = 1;
+ }
+ }
+ g_free(var_col_offsets);
+
+ return row_cols;
+}
+static int
+mdb_crack_row3(MdbTableDef *table, int row_start, int row_end, MdbField *fields)
+{
+ MdbCatalogEntry *entry = table->entry;
+ MdbHandle *mdb = entry->mdb;
+ MdbColumn *col;
+ unsigned char *pg_buf = mdb->pg_buf;
+ unsigned int i;
+ unsigned int row_var_cols = 0, row_fixed_cols, row_cols;
+ unsigned int fixed_cols_found, var_cols_found;
+ unsigned int col_start;
+ unsigned char *nullmask;
+ unsigned int bitmask_sz;
+ unsigned int byte_num, bit_num;
+ unsigned int *var_col_offsets = NULL;
+ unsigned int num_jumps = 0, jumps_used = 0;
+ unsigned int col_ptr, row_len;
+
+ if (mdb_get_option(MDB_DEBUG_ROW)) {
+ buffer_dump(pg_buf, row_start, row_end);
+ }
+
+ row_cols = pg_buf[row_start];
+
+ bitmask_sz = (row_cols + 7) / 8;
+ nullmask = &pg_buf[row_end - bitmask_sz + 1];
+
+ /* read table of variable column locations */
+ if (table->num_var_cols > 0) {
+ row_var_cols = pg_buf[row_end - bitmask_sz];
+ row_len = row_end - row_start + 1;
+ num_jumps = (row_len - 1) / 256;
+ col_ptr = row_end - bitmask_sz - num_jumps - 1;
+ /* If last jump is a dummy value, ignore it */
+ if ((col_ptr-row_start-row_var_cols)/256 < num_jumps)
+ num_jumps--;
+
+ var_col_offsets = (unsigned int *)g_malloc((row_var_cols+1)*sizeof(int));
+ jumps_used = 0;
+ for (i=0; i<row_var_cols+1; i++) {
+ if ((jumps_used < num_jumps)
+ && (i == pg_buf[row_end-bitmask_sz-jumps_used-1])) {
+ jumps_used++;
+ }
+ var_col_offsets[i] = pg_buf[col_ptr-i]+(jumps_used*256);
+ }
+ }
+ fixed_cols_found = 0;
+ var_cols_found = 0;
+ row_fixed_cols = row_cols - row_var_cols;
+
+ if (mdb_get_option(MDB_DEBUG_ROW)) {
+ fprintf(stdout,"bitmask_sz %d num_jumps %d\n",bitmask_sz, num_jumps);
+ fprintf(stdout,"row_var_cols %d\n", row_var_cols);
+ fprintf(stdout,"row_fixed_cols %d\n", row_fixed_cols);
+ }
+
+ /* read information into fields[] */
+ for (i=0;i<table->num_cols;i++) {
+ col = g_ptr_array_index (table->columns, i);
+ fields[i].colnum = i;
+ fields[i].is_fixed = (mdb_is_fixed_col(col)) ? 1 : 0;
+ byte_num = col->col_num / 8;
+ bit_num = col->col_num % 8;
+ /* logic on nulls is reverse, 1 is not null, 0 is null */
+ fields[i].is_null = nullmask[byte_num] & (1 << bit_num) ? 0 : 1;
+
+ if ((fields[i].is_fixed)
+ && (fixed_cols_found < row_fixed_cols)) {
+ col_start = col->fixed_offset + 1;
+ fields[i].start = row_start + col_start;
+ fields[i].value = &pg_buf[row_start + col_start];
+ fields[i].siz = col->col_size;
+ fixed_cols_found++;
+ } else if ((!fields[i].is_fixed)
+ && (var_cols_found < row_var_cols)) {
+ col_start = var_col_offsets[var_cols_found];
+ fields[i].start = row_start + col_start;
+ fields[i].value = &pg_buf[row_start + col_start];
+ fields[i].siz = var_col_offsets[var_cols_found+1] -
+ col_start;
+ var_cols_found++;
+ } else {
+ fields[i].start = 0;
+ fields[i].value = NULL;
+ fields[i].siz = 0;
+ fields[i].is_null = 1;
+ }
+ }
+ g_free(var_col_offsets);
+
+ return row_cols;
+}
+/**
+ * mdb_crack_row:
+ * @table: Table that the row belongs to
+ * @row_start: offset to start of row on current page
+ * @row_end: offset to end of row on current page
+ * @fields: pointer to MdbField array to be popluated by mdb_crack_row
+ *
+ * Cracks a row buffer apart into its component fields.
+ *
+ * A row buffer is that portion of a data page which contains the values for
+ * that row. Its beginning and end can be found in the row offset table.
+ *
+ * The resulting MdbField array contains pointers into the row for each field
+ * present. Be aware that by modifying field[]->value, you would be modifying
+ * the row buffer itself, not a copy.
+ *
+ * This routine is mostly used internally by mdb_fetch_row() but may have some
+ * applicability for advanced application programs.
+ *
+ * Return value: number of fields present.
+ */
+int
+mdb_crack_row(MdbTableDef *table, int row_start, int row_end, MdbField *fields)
+{
+MdbCatalogEntry *entry = table->entry;
+MdbHandle *mdb = entry->mdb;
+
+ if (IS_JET4(mdb)) {
+ return mdb_crack_row4(table, row_start, row_end, fields);
+ } else {
+ return mdb_crack_row3(table, row_start, row_end, fields);
+ }
+}
+
+static int
+mdb_pack_null_mask(unsigned char *buffer, int num_fields, MdbField *fields)
+{
+ int pos = 0, bit = 0, byte = 0;
+ int i;
+
+ /* 'Not null' bitmap */
+ for (i=0; i<num_fields; i++) {
+ /* column is null if bit is clear (0) */
+ if (!fields[i].is_null) {
+ byte |= 1 << bit;
+ //printf("%d %d %d %d\n", i, bit, 1 << bit, byte);
+ }
+ bit++;
+ if (bit==8) {
+ buffer[pos++] = byte;
+ bit = byte = 0;
+ }
+ }
+ /* if we've written any bits to the current byte, flush it */
+ if (bit)
+ buffer[pos++] = byte;
+
+ return pos;
+}
+/* fields must be ordered with fixed columns first, then vars, subsorted by
+ * column number */
+static int
+mdb_pack_row4(MdbTableDef *table, unsigned char *row_buffer, unsigned int num_fields, MdbField *fields)
+{
+ unsigned int pos = 0;
+ unsigned int var_cols = 0;
+ unsigned int i;
+
+ row_buffer[pos++] = num_fields & 0xff;
+ row_buffer[pos++] = (num_fields >> 8) & 0xff;
+
+ /* Fixed length columns */
+ for (i=0;i<num_fields;i++) {
+ if (fields[i].is_fixed) {
+ fields[i].offset = pos;
+ if (!fields[i].is_null) {
+ memcpy(&row_buffer[pos], fields[i].value, fields[i].siz);
+ }
+ pos += fields[i].siz;
+ }
+ }
+ /* For tables without variable-length columns */
+ if (table->num_var_cols == 0) {
+ pos += mdb_pack_null_mask(&row_buffer[pos], num_fields, fields);
+ return pos;
+ }
+ /* Variable length columns */
+ for (i=0;i<num_fields;i++) {
+ if (!fields[i].is_fixed) {
+ var_cols++;
+ fields[i].offset = pos;
+ if (! fields[i].is_null) {
+ memcpy(&row_buffer[pos], fields[i].value, fields[i].siz);
+ pos += fields[i].siz;
+ }
+ }
+ }
+ /* EOD */
+ row_buffer[pos] = pos & 0xff;
+ row_buffer[pos+1] = (pos >> 8) & 0xff;
+ pos += 2;
+
+ /* Offsets of the variable-length columns */
+ for (i=num_fields; i>0; i--) {
+ if (!fields[i-1].is_fixed) {
+ row_buffer[pos++] = fields[i-1].offset & 0xff;
+ row_buffer[pos++] = (fields[i-1].offset >> 8) & 0xff;
+ }
+ }
+ /* Number of variable-length columns */
+ row_buffer[pos++] = var_cols & 0xff;
+ row_buffer[pos++] = (var_cols >> 8) & 0xff;
+
+ pos += mdb_pack_null_mask(&row_buffer[pos], num_fields, fields);
+ return pos;
+}
+
+static int
+mdb_pack_row3(MdbTableDef *table, unsigned char *row_buffer, unsigned int num_fields, MdbField *fields)
+{
+ unsigned int pos = 0;
+ unsigned int var_cols = 0;
+ unsigned int i, j;
+ unsigned char *offset_high;
+
+ row_buffer[pos++] = num_fields;
+
+ /* Fixed length columns */
+ for (i=0;i<num_fields;i++) {
+ if (fields[i].is_fixed) {
+ fields[i].offset = pos;
+ if (!fields[i].is_null) {
+ memcpy(&row_buffer[pos], fields[i].value, fields[i].siz);
+ }
+ pos += fields[i].siz;
+ }
+ }
+ /* For tables without variable-length columns */
+ if (table->num_var_cols == 0) {
+ pos += mdb_pack_null_mask(&row_buffer[pos], num_fields, fields);
+ return pos;
+ }
+ /* Variable length columns */
+ for (i=0;i<num_fields;i++) {
+ if (!fields[i].is_fixed) {
+ var_cols++;
+ fields[i].offset = pos;
+ if (! fields[i].is_null) {
+ memcpy(&row_buffer[pos], fields[i].value, fields[i].siz);
+ pos += fields[i].siz;
+ }
+ }
+ }
+
+ offset_high = (unsigned char *) g_malloc(var_cols+1);
+ offset_high[0] = (pos << 8) & 0xff;
+ j = 1;
+
+ /* EOD */
+ row_buffer[pos] = pos & 0xff;
+ pos++;
+
+ /* Variable length column offsets */
+ for (i=num_fields; i>0; i--) {
+ if (!fields[i-1].is_fixed) {
+ row_buffer[pos++] = fields[i-1].offset & 0xff;
+ offset_high[j++] = (fields[i-1].offset << 8) & 0xff;
+ }
+ }
+
+ /* Dummy jump table entry */
+ if (offset_high[0] < (pos+(num_fields+7)/8-1)/255) {
+ row_buffer[pos++] = 0xff;
+ }
+ /* Jump table */
+ for (i=0; i<var_cols; i++) {
+ if (offset_high[i] > offset_high[i+1]) {
+ row_buffer[pos++] = var_cols-i;
+ }
+ }
+ g_free(offset_high);
+
+ row_buffer[pos++] = var_cols;
+
+ pos += mdb_pack_null_mask(&row_buffer[pos], num_fields, fields);
+ return pos;
+}
+int
+mdb_pack_row(MdbTableDef *table, unsigned char *row_buffer, int unsigned num_fields, MdbField *fields)
+{
+ if (table->is_temp_table) {
+ unsigned int i;
+ for (i=0; i<num_fields; i++) {
+ MdbColumn *c = g_ptr_array_index(table->columns, i);
+ fields[i].is_null = (fields[i].value) ? 0 : 1;
+ fields[i].colnum = i;
+ fields[i].is_fixed = c->is_fixed;
+ if ((c->col_type != MDB_TEXT)
+ && (c->col_type != MDB_MEMO)) {
+ fields[i].siz = c->col_size;
+ }
+ }
+ }
+ if (IS_JET4(table->entry->mdb)) {
+ return mdb_pack_row4(table, row_buffer, num_fields, fields);
+ } else {
+ return mdb_pack_row3(table, row_buffer, num_fields, fields);
+ }
+}
+int
+mdb_pg_get_freespace(MdbHandle *mdb)
+{
+ int rows, free_start, free_end;
+ int row_count_offset = mdb->fmt->row_count_offset;
+
+ rows = mdb_pg_get_int16(mdb, row_count_offset);
+ free_start = row_count_offset + 2 + (rows * 2);
+ free_end = mdb_pg_get_int16(mdb, row_count_offset + (rows * 2));
+ mdb_debug(MDB_DEBUG_WRITE,"free space left on page = %d", free_end - free_start);
+ return (free_end - free_start);
+}
+static unsigned char *
+mdb_new_leaf_pg(MdbCatalogEntry *entry)
+{
+ MdbHandle *mdb = entry->mdb;
+ unsigned char *new_pg;
+
+ new_pg = (unsigned char *) g_malloc0(mdb->fmt->pg_size);
+
+ new_pg[0]=0x04;
+ new_pg[1]=0x01;
+ _mdb_put_int32(new_pg, 4, entry->table_pg);
+
+ return new_pg;
+}
+unsigned char *
+mdb_new_data_pg(MdbCatalogEntry *entry)
+{
+ MdbFormatConstants *fmt = entry->mdb->fmt;
+ unsigned char *new_pg;
+
+ new_pg = (unsigned char *) g_malloc0(fmt->pg_size);
+
+ new_pg[0]=0x01;
+ new_pg[1]=0x01;
+ _mdb_put_int16(new_pg, 2, fmt->pg_size - fmt->row_count_offset - 2);
+ _mdb_put_int32(new_pg, 4, entry->table_pg);
+
+ return new_pg;
+}
+
+#if 0
+static int
+mdb_update_indexes(MdbTableDef *table, int num_fields, MdbField *fields, guint32 pgnum, guint16 rownum)
+{
+ unsigned int i;
+ MdbIndex *idx;
+
+ for (i=0;i<table->num_idxs;i++) {
+ idx = g_ptr_array_index (table->indices, i);
+ mdb_debug(MDB_DEBUG_WRITE,"Updating %s (%d).", idx->name, idx->index_type);
+ if (idx->index_type==1) {
+ mdb_update_index(table, idx, num_fields, fields, pgnum, rownum);
+ }
+ }
+ return 1;
+}
+
+static int
+mdb_init_index_chain(MdbTableDef *table, MdbIndex *idx)
+{
+ MdbCatalogEntry *entry = table->entry;
+ MdbHandle *mdb = entry->mdb;
+
+ table->scan_idx = idx;
+ table->chain = g_malloc0(sizeof(MdbIndexChain));
+ table->mdbidx = mdb_clone_handle(mdb);
+ mdb_read_pg(table->mdbidx, table->scan_idx->first_pg);
+
+ return 1;
+}
+#endif
+
+int
+mdb_update_index(MdbTableDef *table, MdbIndex *idx, unsigned int num_fields, MdbField *fields, guint32 pgnum, guint16 rownum)
+{
+ MdbCatalogEntry *entry = table->entry;
+ MdbHandle *mdb = entry->mdb;
+ int idx_xref[16];
+ unsigned int i, j;
+ MdbIndexChain *chain;
+ MdbField idx_fields[10];
+
+ for (i = 0; i < idx->num_keys; i++) {
+ for (j = 0; j < num_fields; j++) {
+ // key_col_num is 1 based, can't remember why though
+ if (fields[j].colnum == idx->key_col_num[i]-1) {
+ idx_xref[i] = j;
+ idx_fields[i] = fields[j];
+ }
+ }
+ }
+ for (i = 0; i < idx->num_keys; i++) {
+ fprintf(stdout, "key col %d (%d) is mapped to field %d (%d %d)\n",
+ i, idx->key_col_num[i], idx_xref[i], fields[idx_xref[i]].colnum,
+ fields[idx_xref[i]].siz);
+ }
+ for (i = 0; i < num_fields; i++) {
+ fprintf(stdout, "%d (%d %d)\n",
+ i, fields[i].colnum,
+ fields[i].siz);
+ }
+
+ chain = g_malloc0(sizeof(MdbIndexChain));
+
+ mdb_index_find_row(mdb, idx, chain, pgnum, rownum);
+ printf("chain depth = %d\n", chain->cur_depth);
+ printf("pg = %" G_GUINT32_FORMAT "\n",
+ chain->pages[chain->cur_depth-1].pg);
+ //mdb_copy_index_pg(table, idx, &chain->pages[chain->cur_depth-1]);
+ mdb_add_row_to_leaf_pg(table, idx, &chain->pages[chain->cur_depth-1], idx_fields);
+
+ return 1;
+}
+
+#if 0
+static int
+mdb_insert_row(MdbTableDef *table, int num_fields, MdbField *fields)
+{
+ int new_row_size;
+ unsigned char row_buffer[4096];
+ MdbCatalogEntry *entry = table->entry;
+ MdbHandle *mdb = entry->mdb;
+ MdbFormatConstants *fmt = mdb->fmt;
+ guint32 pgnum;
+ guint16 rownum;
+
+ if (!mdb->f->writable) {
+ fprintf(stderr, "File is not open for writing\n");
+ return 0;
+ }
+ new_row_size = mdb_pack_row(table, row_buffer, num_fields, fields);
+ if (mdb_get_option(MDB_DEBUG_WRITE)) {
+ buffer_dump(row_buffer, 0, new_row_size-1);
+ }
+ pgnum = mdb_map_find_next_freepage(table, new_row_size);
+ if (!pgnum) {
+ fprintf(stderr, "Unable to allocate new page.\n");
+ return 0;
+ }
+
+ rownum = mdb_add_row_to_pg(table, row_buffer, new_row_size);
+
+ if (mdb_get_option(MDB_DEBUG_WRITE)) {
+ buffer_dump(mdb->pg_buf, 0, 39);
+ buffer_dump(mdb->pg_buf, fmt->pg_size - 160, fmt->pg_size-1);
+ }
+ mdb_debug(MDB_DEBUG_WRITE, "writing page %d", pgnum);
+ if (!mdb_write_pg(mdb, pgnum)) {
+ fprintf(stderr, "write failed! exiting...\n");
+ exit(1);
+ }
+
+ mdb_update_indexes(table, num_fields, fields, pgnum, rownum);
+
+ return 1;
+}
+#endif
+
+/*
+ * Assumes caller has verfied space is available on page and adds the new
+ * row to the current pg_buf.
+ */
+guint16
+mdb_add_row_to_pg(MdbTableDef *table, unsigned char *row_buffer, int new_row_size)
+{
+ unsigned char *new_pg;
+ int num_rows, i, pos, row_start, row_end, row_size;
+ MdbCatalogEntry *entry = table->entry;
+ MdbHandle *mdb = entry->mdb;
+ MdbFormatConstants *fmt = mdb->fmt;
+
+ if (table->is_temp_table) {
+ GPtrArray *pages = table->temp_table_pages;
+ if (pages->len == 0) {
+ new_pg = mdb_new_data_pg(entry);
+ g_ptr_array_add(pages, new_pg);
+ } else {
+ new_pg = g_ptr_array_index(pages, pages->len - 1);
+ if (mdb_get_int16(new_pg, 2) < new_row_size + 2) {
+ new_pg = mdb_new_data_pg(entry);
+ g_ptr_array_add(pages, new_pg);
+ }
+ }
+
+ num_rows = mdb_get_int16(new_pg, fmt->row_count_offset);
+ pos = (num_rows == 0) ? fmt->pg_size :
+ mdb_get_int16(new_pg, fmt->row_count_offset + (num_rows*2));
+ } else { /* is not a temp table */
+ new_pg = mdb_new_data_pg(entry);
+
+ num_rows = mdb_pg_get_int16(mdb, fmt->row_count_offset);
+ pos = fmt->pg_size;
+
+ /* copy existing rows */
+ for (i=0;i<num_rows;i++) {
+ row_start = mdb_pg_get_int16(mdb, (fmt->row_count_offset + 2) + (i*2));
+ row_end = mdb_find_end_of_row(mdb, i);
+ row_size = row_end - row_start + 1;
+ pos -= row_size;
+ memcpy(&new_pg[pos], &mdb->pg_buf[row_start], row_size);
+ _mdb_put_int16(new_pg, (fmt->row_count_offset + 2) + (i*2), pos);
+ }
+ }
+
+ /* add our new row */
+ pos -= new_row_size;
+ memcpy(&new_pg[pos], row_buffer, new_row_size);
+ /* add row to the row offset table */
+ _mdb_put_int16(new_pg, (fmt->row_count_offset + 2) + (num_rows*2), pos);
+
+ /* update number rows on this page */
+ num_rows++;
+ _mdb_put_int16(new_pg, fmt->row_count_offset, num_rows);
+
+ /* update the freespace */
+ _mdb_put_int16(new_pg,2,pos - fmt->row_count_offset - 2 - (num_rows*2));
+
+ /* copy new page over old */
+ if (!table->is_temp_table) {
+ memcpy(mdb->pg_buf, new_pg, fmt->pg_size);
+ g_free(new_pg);
+ }
+
+ return num_rows;
+}
+int
+mdb_update_row(MdbTableDef *table)
+{
+int row_start, row_end;
+unsigned int i;
+MdbColumn *col;
+MdbCatalogEntry *entry = table->entry;
+MdbHandle *mdb = entry->mdb;
+MdbFormatConstants *fmt = mdb->fmt;
+MdbField fields[256];
+unsigned char row_buffer[4096];
+int old_row_size, new_row_size, delta;
+unsigned int num_fields;
+
+ if (!mdb->f->writable) {
+ fprintf(stderr, "File is not open for writing\n");
+ return 0;
+ }
+ row_start = mdb_pg_get_int16(mdb, (fmt->row_count_offset + 2) + ((table->cur_row-1)*2));
+ row_end = mdb_find_end_of_row(mdb, table->cur_row-1);
+ old_row_size = row_end - row_start;
+
+ row_start &= 0x0FFF; /* remove flags */
+
+ mdb_debug(MDB_DEBUG_WRITE,"page %lu row %d start %d end %d", (unsigned long) table->cur_phys_pg, table->cur_row-1, row_start, row_end);
+ if (mdb_get_option(MDB_DEBUG_LIKE))
+ buffer_dump(mdb->pg_buf, row_start, row_end);
+
+ for (i=0;i<table->num_cols;i++) {
+ col = g_ptr_array_index(table->columns,i);
+ if (col->bind_ptr && mdb_is_col_indexed(table,i)) {
+ fprintf(stderr, "Attempting to update column that is part of an index\n");
+ return 0;
+ }
+ }
+ num_fields = mdb_crack_row(table, row_start, row_end, fields);
+
+ if (mdb_get_option(MDB_DEBUG_WRITE)) {
+ for (i=0;i<num_fields;i++) {
+ printf("col %d %d start %d siz %d\n", i, fields[i].colnum, fields[i].start, fields[i].siz);
+ }
+ }
+ for (i=0;i<table->num_cols;i++) {
+ col = g_ptr_array_index(table->columns,i);
+ if (col->bind_ptr) {
+ printf("yes\n");
+ fields[i].value = col->bind_ptr;
+ fields[i].siz = *(col->len_ptr);
+ }
+ }
+
+ new_row_size = mdb_pack_row(table, row_buffer, num_fields, fields);
+ if (mdb_get_option(MDB_DEBUG_WRITE))
+ buffer_dump(row_buffer, 0, new_row_size-1);
+ delta = new_row_size - old_row_size;
+ if ((mdb_pg_get_freespace(mdb) - delta) < 0) {
+ fprintf(stderr, "No space left on this page, update will not occur\n");
+ return 0;
+ }
+ /* do it! */
+ mdb_replace_row(table, table->cur_row-1, row_buffer, new_row_size);
+ return 0;
+}
+int
+mdb_replace_row(MdbTableDef *table, int row, unsigned char *new_row, int new_row_size)
+{
+MdbCatalogEntry *entry = table->entry;
+MdbHandle *mdb = entry->mdb;
+MdbFormatConstants *fmt = mdb->fmt;
+unsigned char *new_pg;
+guint16 num_rows;
+int row_start, row_end, row_size;
+int i, pos;
+
+ if (mdb_get_option(MDB_DEBUG_WRITE)) {
+ buffer_dump(mdb->pg_buf, 0, 39);
+ buffer_dump(mdb->pg_buf, fmt->pg_size - 160, fmt->pg_size-1);
+ }
+ mdb_debug(MDB_DEBUG_WRITE,"updating row %d on page %lu", row, (unsigned long) table->cur_phys_pg);
+ new_pg = mdb_new_data_pg(entry);
+
+ num_rows = mdb_pg_get_int16(mdb, fmt->row_count_offset);
+ _mdb_put_int16(new_pg, fmt->row_count_offset, num_rows);
+
+ pos = mdb->fmt->pg_size;
+
+ /* rows before */
+ for (i=0;i<row;i++) {
+ row_start = mdb_pg_get_int16(mdb, (fmt->row_count_offset + 2) + (i*2));
+ row_end = mdb_find_end_of_row(mdb, i);
+ row_size = row_end - row_start + 1;
+ pos -= row_size;
+ memcpy(&new_pg[pos], &mdb->pg_buf[row_start], row_size);
+ _mdb_put_int16(new_pg, (fmt->row_count_offset + 2) + (i*2), pos);
+ }
+
+ /* our row */
+ pos -= new_row_size;
+ memcpy(&new_pg[pos], new_row, new_row_size);
+ _mdb_put_int16(new_pg, (fmt->row_count_offset + 2) + (row*2), pos);
+
+ /* rows after */
+ for (i=row+1;i<num_rows;i++) {
+ row_start = mdb_pg_get_int16(mdb, (fmt->row_count_offset + 2) + (i*2));
+ row_end = mdb_find_end_of_row(mdb, i);
+ row_size = row_end - row_start + 1;
+ pos -= row_size;
+ memcpy(&new_pg[pos], &mdb->pg_buf[row_start], row_size);
+ _mdb_put_int16(new_pg, (fmt->row_count_offset + 2) + (i*2), pos);
+ }
+
+ /* almost done, copy page over current */
+ memcpy(mdb->pg_buf, new_pg, fmt->pg_size);
+
+ g_free(new_pg);
+
+ _mdb_put_int16(mdb->pg_buf, 2, mdb_pg_get_freespace(mdb));
+ if (mdb_get_option(MDB_DEBUG_WRITE)) {
+ buffer_dump(mdb->pg_buf, 0, 39);
+ buffer_dump(mdb->pg_buf, fmt->pg_size - 160, fmt->pg_size-1);
+ }
+ /* drum roll, please */
+ if (!mdb_write_pg(mdb, table->cur_phys_pg)) {
+ fprintf(stderr, "write failed! exiting...\n");
+ exit(1);
+ }
+ return 0;
+}
+static int
+mdb_add_row_to_leaf_pg(MdbTableDef *table, MdbIndex *idx, MdbIndexPage *ipg, MdbField *idx_fields)
+/*, guint32 pgnum, guint16 rownum)
+static int
+mdb_copy_index_pg(MdbTableDef *table, MdbIndex *idx, MdbIndexPage *ipg)
+*/
+{
+ MdbCatalogEntry *entry = table->entry;
+ MdbHandle *mdb = entry->mdb;
+ MdbColumn *col;
+ guint32 pg;
+ guint16 row;
+ unsigned char *new_pg;
+ unsigned char key_hash[256];
+ unsigned char iflag;
+ int keycol;
+
+ new_pg = mdb_new_leaf_pg(entry);
+
+ mdb_index_page_reset(ipg);
+ mdb_read_pg(mdb, ipg->pg);
+
+ /* do we support this index type yet? */
+ if (idx->num_keys > 1) {
+ fprintf(stderr,"multikey indexes not yet supported, aborting\n");
+ return 0;
+ }
+ keycol = idx->key_col_num[0];
+ col = g_ptr_array_index (table->columns, keycol - 1);
+ printf("keycol = %d (%s)\n", keycol, col->name);
+ if (!mdb_is_fixed_col(col)) {
+ fprintf(stderr,"variable length key columns not yet supported, aborting\n");
+ return 0;
+ }
+ printf("col size = %d\n", col->col_size);
+
+ while (mdb_index_find_next_on_page(mdb, ipg)) {
+
+ /* check for compressed indexes. */
+ if (ipg->len < col->col_size + 1) {
+ fprintf(stderr,"compressed indexes not yet supported, aborting\n");
+ return 0;
+ }
+
+ pg = mdb_pg_get_int24_msb(mdb, ipg->offset + ipg->len - 4);
+ row = mdb->pg_buf[ipg->offset + ipg->len - 1];
+ iflag = mdb->pg_buf[ipg->offset];
+ mdb_index_swap_n(&mdb->pg_buf[ipg->offset + 1], col->col_size, key_hash);
+ key_hash[col->col_size - 1] &= 0x7f;
+ printf("length = %d\n", ipg->len);
+ printf("iflag = %d pg = %" G_GUINT32_FORMAT
+ " row = %" G_GUINT16_FORMAT "\n", iflag, pg, row);
+ buffer_dump(mdb->pg_buf, ipg->offset, ipg->offset + ipg->len - 1);
+ buffer_dump(mdb->pg_buf, ipg->offset + 1, ipg->offset + col->col_size);
+ buffer_dump(key_hash, 0, col->col_size - 1);
+ ipg->offset += ipg->len;
+ ipg->len = 0;
+ row++;
+ }
+ g_free(new_pg);
+
+ return ipg->len;
+}
diff --git a/map/poi_geodownload/poi_geodownload.c b/map/poi_geodownload/poi_geodownload.c
new file mode 100644
index 00000000..5b698da3
--- /dev/null
+++ b/map/poi_geodownload/poi_geodownload.c
@@ -0,0 +1,775 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2009 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <mdbtools.h>
+#include "config.h"
+#include "debug.h"
+#include "coord.h"
+#include "projection.h"
+#include "item.h"
+#include "map.h"
+#include "plugin.h"
+
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <dirent.h>
+
+struct map_priv
+{
+ char *filename;
+ MdbHandle *h;
+ MdbHandle *h_idx;
+ MdbTableDef *table;
+ GPtrArray *table_col;
+ MdbColumn **cols;
+ MdbIndex *idx;
+ int idx_size;
+ enum item_type type;
+ int name_col;
+};
+
+struct map_rect_priv
+{
+ struct item item;
+ struct map_priv *m;
+ enum attr_type attr_next;
+ int cidx;
+ char buffer[4096];
+};
+
+#if 0
+struct index_data {
+ unsigned char data[15];
+};
+struct poi {
+ char filename[1024];
+ char icon[1024];
+ long pos;
+ MdbHandle *h;
+ MdbHandle *h_idx;
+ MdbTableDef *table;
+ GPtrArray *table_col;
+ MdbColumn **cols;
+ MdbIndex *idx;
+ int idx_size;
+ struct index_data index_data;
+ MdbIndexChain chain;
+ struct poi *next;
+} *poi_list;
+
+struct poi_data {
+ struct poi *poi;
+ int page;
+ int row;
+};
+
+ char poipath[256];
+ char poibmp[256];
+
+
+#endif
+
+static void
+print_col(MdbHandle *h, MdbColumn *col, char *buffer, int hex)
+{
+ char *s;
+ dbg(1,"type=%d\n", col->col_type);
+ switch (col->col_type) {
+ case MDB_BOOL:
+ strcpy(buffer, mdb_pg_get_byte(h, col->cur_value_start) ? "True" : "False");
+ break;
+ case MDB_BYTE:
+ sprintf(buffer, "%d", mdb_pg_get_byte(h, col->cur_value_start));
+ break;
+ case MDB_LONGINT:
+ if (hex)
+ sprintf(buffer, "0x%lx", mdb_pg_get_int32(h, col->cur_value_start));
+ else
+ sprintf(buffer, "%ld", mdb_pg_get_int32(h, col->cur_value_start));
+ break;
+ case MDB_DOUBLE:
+ sprintf(buffer, "%f", mdb_pg_get_double(h, col->cur_value_start));
+ break;
+ case MDB_TEXT:
+ dbg(1,"pg_buf %p start %d len %d\n", h->pg_buf, col->cur_value_start, col->cur_value_len);
+ if (col->cur_value_len) {
+ s=mdb_col_to_string (h, h->pg_buf, col->cur_value_start, col->col_type, col->cur_value_len);
+ dbg(1,"s=%p\n", s);
+ sprintf(buffer, "%s", s);
+ }
+ break;
+ default:
+ sprintf(buffer, "unknown (%d)", col->col_type);
+ }
+}
+
+#if 0
+
+static void
+setup_idx_data(struct index_data *idx, struct coord *c, unsigned int geoflags, int size)
+{
+ /* 7f 80 1c 91 0a 7f 80 5c f5 41 7f 80 00 00 05 */
+ idx->data[0]=0x7f;
+ idx->data[1]=(c->x >> 24) ^ 0x80;
+ idx->data[2]=c->x >> 16;
+ idx->data[3]=c->x >> 8;
+ idx->data[4]=c->x;
+ idx->data[5]=0x7f;
+ idx->data[6]=(c->y >> 24) ^ 0x80;
+ idx->data[7]=c->y >> 16;
+ idx->data[8]=c->y >> 8;
+ idx->data[9]=c->y;
+ idx->data[10]=0x7f;
+ if (size > 12) {
+ idx->data[11]=0x80 | (geoflags >> 24);
+ idx->data[12]=geoflags >> 16;
+ idx->data[13]=geoflags >> 8;
+ idx->data[14]=geoflags;
+ } else {
+ idx->data[11]=geoflags;
+ }
+}
+
+static void
+setup_idx_rect(struct coord *rect, struct index_data *idx, int size)
+{
+ struct coord r[2];
+ r[0].x=rect[0].x;
+ r[0].y=rect[1].y;
+ r[1].x=rect[1].x;
+ r[1].y=rect[0].y;
+#if 0
+ printf("low 0x%x 0%x\n", r[0].x, r[0].y);
+ printf("high 0x%x 0%x\n", r[1].x, r[1].y);
+#endif
+ setup_idx_data(idx, r, 0, size);
+ setup_idx_data(idx+1, r+1, 0xffffffff, size);
+}
+
+#endif
+
+static int
+load_row(struct map_priv *poi, int pg, int row)
+{
+ int row_start, row_end, offset;
+ unsigned int num_fields, i;
+ MdbField fields[256];
+ MdbFormatConstants *fmt;
+ int debug=0;
+
+ fmt=poi->h->fmt;
+ mdb_read_pg(poi->h, pg);
+ dbg(1, "enter poi=%p pg=%d row=%d\n", poi, pg, row);
+ dbg(1,"Page Type %d row_count_offset %d\n",poi->h->pg_buf[0], fmt->row_count_offset);
+ for (i = 0; i <= row; i++) {
+ offset=(fmt->row_count_offset + 2) + i * 2;
+ dbg(1,"row %d %d 0x%x\n", i, offset, mdb_pg_get_int16(poi->h, offset));
+ }
+ row_start = mdb_pg_get_int16(poi->h, (fmt->row_count_offset + 2) + row * 2);
+ if (row_start & 0x4000)
+ return 1;
+ row_end = mdb_find_end_of_row(poi->h, row);
+ if (debug) {
+ printf("start=0x%x end=0x%x\n", row_start, row_end);
+ buffer_dump(poi->h->pg_buf, row_start, row_end);
+ }
+
+ poi->h->cur_pos=row_start & 0x1fff;
+ poi->table->cur_row=row;
+ num_fields = mdb_crack_row(poi->table, row_start & 0x1fff, row_end, fields);
+ dbg(1,"num_fields=%d\n", num_fields);
+ for (i = 0; i < num_fields; i++) {
+ dbg(1,"i=%d/%d\n", i, num_fields);
+ poi->cols[i]->cur_value_start=fields[i].start;
+ poi->cols[i]->cur_value_len=fields[i].siz;
+ }
+ return 0;
+}
+
+#if 0
+
+static MdbIndexPage *
+index_next_row(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain)
+{
+ MdbIndexPage *ipg;
+
+ ipg = mdb_index_read_bottom_pg(mdb, idx, chain);
+ if (!mdb_index_find_next_on_page(mdb, ipg)) {
+#if 0
+ printf("no next\n");
+#endif
+ if (!chain->clean_up_mode) {
+#if 0
+ printf("no cleanup\n");
+#endif
+ if (!(ipg = mdb_index_unwind(mdb, idx, chain)))
+ chain->clean_up_mode = 1;
+ }
+ if (chain->clean_up_mode) {
+#if 0
+ printf("cleanup\n");
+#endif
+ //fprintf(stdout,"in cleanup mode\n");
+
+ if (!chain->last_leaf_found) {
+ printf("no last_leaf_found\n");
+ return NULL;
+ }
+ mdb_read_pg(mdb, chain->last_leaf_found);
+ chain->last_leaf_found =
+ mdb_pg_get_int24(mdb, 0x0c);
+ //printf("next leaf %lu\n", chain->last_leaf_found);
+ mdb_read_pg(mdb, chain->last_leaf_found);
+ /* reuse the chain for cleanup mode */
+ chain->cur_depth = 1;
+ ipg = &chain->pages[0];
+ mdb_index_page_init(ipg);
+ ipg->pg = chain->last_leaf_found;
+ //printf("next on page %d\n",
+ if (!mdb_index_find_next_on_page(mdb, ipg)) {
+#if 0
+ printf("no find_next_on_page\n");
+#endif
+ return NULL;
+ }
+ }
+ }
+ return ipg;
+}
+
+static int
+index_next(struct poi *poi, struct index_data *idx)
+{
+ MdbIndexPage *ipg;
+ MdbIndexChain *chain = &poi->chain;
+ int row;
+ int pg;
+ int offset;
+ char *cmp, *low, *high;
+ int debug=0;
+
+
+ for(;;) {
+ for(;;) {
+ ipg=index_next_row(poi->h_idx, poi->idx, chain);
+ if (! ipg)
+ return 0;
+ row = poi->h_idx->pg_buf[ipg->offset + ipg->len - 1];
+ pg = mdb_pg_get_int24_msb(poi->h_idx, ipg->offset + ipg->len - 4);
+
+ offset=poi->idx_size+4-ipg->len;
+ memcpy(poi->index_data.data+offset, poi->h_idx->pg_buf+ipg->offset, ipg->len - 4);
+ cmp=poi->index_data.data;
+ low=idx[0].data;
+ high=idx[1].data;
+ if (debug > 1) {
+ buffer_dump(low, 0, poi->idx_size-1);
+ buffer_dump(cmp, 0, poi->idx_size-1);
+ buffer_dump(high, 0, poi->idx_size-1);
+ printf("%d %d %d\n", memcmp(cmp, low, poi->idx_size), memcmp(cmp, high, poi->idx_size), offset);
+ }
+#if 0
+ buffer_dump(poi->h_idx->pg_buf, ipg->offset, ipg->offset+ipg->len-1);
+#endif
+ ipg->offset += ipg->len;
+ if (memcmp(cmp, low, poi->idx_size) >= 0) {
+ if (memcmp(cmp, high, poi->idx_size) <=0 ) {
+ if (debug) {
+ printf("match\n");
+ buffer_dump(low, 0, poi->idx_size-1);
+ buffer_dump(cmp, 0, poi->idx_size-1);
+ buffer_dump(high, 0, poi->idx_size-1);
+ printf("%d %d %d\n", memcmp(cmp, low, poi->idx_size), memcmp(cmp, high, poi->idx_size), offset);
+ }
+ break;
+ } else {
+ return 0;
+ }
+ }
+ if (debug > 1)
+ printf("row=0x%x pg=0x%x len=%d\n", row, pg, ipg->len);
+ }
+ if (debug)
+ printf("match: row=0x%x pg=0x%x len=%d\n", row, pg, ipg->len);
+ if (!load_row(poi, pg, row))
+ break;
+ }
+ return 1;
+}
+
+#endif
+
+static int
+load_poi_table(struct map_priv *m, MdbCatalogEntry *entry)
+{
+ int j;
+ MdbIndex *idx;
+
+ m->h_idx=NULL;
+ m->table = mdb_read_table(entry);
+ m->table_col = mdb_read_columns(m->table);
+ mdb_read_indices(m->table);
+ m->cols = (MdbColumn **) (m->table_col->pdata);
+ if (m->table_col->len < 4 || strcasecmp(m->cols[0]->name, "X") ||
+ strcasecmp(m->cols[1]->name, "Y") || strcasecmp(m->cols[3]->name, "GEOFLAGS"))
+ return 1;
+ m->name_col=-1;
+ for (j = 0; j < m->table_col->len ; j++) {
+ if (!strcasecmp(m->cols[j]->name, "NAME"))
+ m->name_col=j;
+ }
+ for (j = 0; j < m->table->num_idxs; j++) {
+ idx = m->table->indices->pdata[j];
+ if (idx->num_keys == 3 && idx->key_col_num[0] == 1 &&
+ idx->key_col_num[1] == 2 && idx->key_col_num[2] == 4) {
+ m->idx = idx;
+ m->idx_size=3+m->cols[0]->col_size+m->cols[1]->col_size+m->cols[3]->col_size;
+ m->h_idx=mdb_clone_handle(m->h);
+ }
+ }
+ return 0;
+}
+
+#if 0
+
+static void
+load_poi(char *filename, char *icon, int type)
+{
+ int i;
+ MdbCatalogEntry *entry;
+ GPtrArray *catalog;
+ struct poi *new = g_new0(struct poi, 1);
+
+ FILE *fp = fopen(filename,"r");
+ if( fp ) {
+ fclose(fp);
+ } else {
+ printf("ERR : POI file %s does not exists!\n",filename);
+ exit(0);
+ return -1;
+ }
+
+
+ fp = fopen(icon,"r");
+ if( fp ) {
+ fclose(fp);
+ } else {
+ printf("ERR : WARNING INCORRECT PICTURE! %s!\n",icon);
+ exit(0);
+ return -1;
+ }
+
+ strcpy(new->filename,filename);
+ strcpy(new->icon,icon);
+ new->type = type;
+
+
+ if (type == 0) {
+ new->h = mdb_open(filename, MDB_NOFLAGS);
+ catalog = mdb_read_catalog(new->h, MDB_TABLE);
+ for (i = 0; i < catalog->len; i++) {
+ entry = catalog->pdata[i];
+ if (!strcasecmp(entry->object_name, "_INDEXDATA")) {
+ if (load_poi_table(new, entry)) {
+ printf("%s invalid\n", filename);
+ g_free(new);
+ new=NULL;
+ }
+ }
+ }
+ g_ptr_array_free(catalog, 1);
+ }
+ if (new) {
+ new->next = poi_list;
+ poi_list = new;
+ }
+}
+
+static void
+get_coord(struct poi *p, struct coord *c)
+{
+ c->x=mdb_pg_get_int32(p->h, p->cols[0]->cur_value_start);
+ c->y=mdb_pg_get_int32(p->h, p->cols[1]->cur_value_start);
+}
+
+static void
+poi_info(struct display_list *list, struct popup_item **popup)
+{
+ struct poi_data *data=list->data;
+ struct poi *poi=data->poi;
+ struct popup_item *popup_last, *popup_val_last;
+ char *text,buffer[4096];
+ int j;
+ MdbColumn *col;
+ char *v;
+
+ popup_last = *popup;
+
+ popup_val_last = NULL;
+ sprintf(buffer,"File:%s", poi->filename);
+ popup_item_new_text(&popup_val_last, buffer, 1);
+ sprintf(buffer,"Icon:%s", poi->icon);
+ popup_item_new_text(&popup_val_last, buffer, 2);
+ if (poi->type == 0) {
+ printf("poi_info pg=%d row=%d\n", data->page, data->row);
+ load_row(poi, data->page, data->row);
+ sprintf(buffer,"Page:%d", data->page);
+ popup_item_new_text(&popup_val_last, buffer, 3);
+ sprintf(buffer,"Row:%d", data->row);
+ popup_item_new_text(&popup_val_last, buffer, 4);
+ for (j = 0; j < poi->table_col->len; j++) {
+ col = poi->table_col->pdata[j];
+ #if 0
+ printf("start: %d type:%d\n", col->cur_value_start, col->col_type);
+ #endif
+ sprintf(buffer, "%s:", col->name);
+ v = buffer + strlen(buffer);
+ if (!strcasecmp(col->name,"X") || !strcasecmp(col->name,"Y"))
+ print_col(poi->h, col, v, 1);
+ else
+ print_col(poi->h, col, v, 0);
+ #if 0
+ printf("%s\n", buffer);
+ #endif
+ text=g_convert(buffer,-1,"utf-8","iso8859-1",NULL,NULL,NULL);
+ popup_item_new_text(&popup_val_last, buffer, j+10);
+ g_free(text);
+ }
+ }
+ popup_item_new_text(&popup_last, "POI", 20)->submenu = popup_val_last;
+ *popup=popup_last;
+}
+
+static void
+draw_poi(struct poi *p, struct container *co, struct point *pnt)
+{
+ struct poi_data data;
+ data.poi=p;
+ if (p->type == 0) {
+ data.page=p->h->cur_pg;
+ data.row=p->table->cur_row-1;
+ }
+ if (p->type == 1) {
+ data.row=p->pos;
+ }
+ display_add(&co->disp[display_poi], 5, 0, p->icon, 1, pnt, poi_info, &data, sizeof(data));
+}
+
+static void
+plugin_draw(struct container *co)
+{
+ struct coord c;
+ struct point pnt;
+ struct poi *p;
+ struct index_data idx[2];
+ int use_index=0;
+ int debug=1;
+
+ p = poi_list;
+
+ if (co->trans->scale > 1024)
+ return;
+ if (debug) {
+ printf("scale=%ld\n", co->trans->scale);
+ printf("rect 0x%lx,0%lx-0x%lx,0x%lx\n", co->trans->rect[0].x, co->trans->rect[0].y, co->trans->rect[1].x, co->trans->rect[1].y);
+ }
+ while (p) {
+ if (p->type == 0) {
+ if (use_index)
+ setup_idx_rect(co->trans->rect, idx, p->idx_size);
+ if (! use_index) {
+ printf("rewind %s %p\n", p->filename, p->table);
+ mdb_rewind_table(p->table);
+ while (mdb_fetch_row(p->table)) {
+ get_coord(p, &c);
+ if (transform(co->trans, &c, &pnt)) {
+ if (debug)
+ printf("coord 0x%lx,0x%lx pg %d row %d\n", c.x, c.y, p->h->cur_pg, p->table->cur_row);
+ draw_poi(p, co, &pnt);
+ }
+ }
+ } else {
+ memset(&p->chain, 0, sizeof(p->chain));
+ while (index_next(p, idx)) {
+ get_coord(p, &c);
+ if (transform(co->trans, &c, &pnt)) {
+ if (debug)
+ printf("coord 0x%lx,0x%lx pg %d row %d\n", c.x, c.y, p->h->cur_pg, p->table->cur_row);
+ draw_poi(p, co, &pnt);
+ }
+ }
+ }
+ }
+ if (p->type == 1) {
+ FILE *f;
+ char line[1024];
+ struct text_poi tpoi;
+ if(!(f=fopen(p->filename, "r"))){
+ printf("can't open poi file for drawing!\n");
+ exit(0);
+ }
+#if 0
+ printf("opened poi file %s for drawing!\n",p->filename);
+#endif
+ p->pos=ftell(f);
+ fgets(line, 1024, f);
+ while (!feof(f)) {
+ if (strlen(line)) {
+ line[strlen(line)-1]='\0';
+ }
+ if (parse_text_poi(line, &tpoi)) {
+ transform_mercator(&tpoi.lat,&tpoi.lng,&c);
+// printf("%ld %ld\n", c.x, c.y);
+ if (transform(co->trans, &c, &pnt)) {
+ draw_poi(p, co, &pnt);
+ }
+ }
+ p->pos=ftell(f);
+ fgets(line, 1024, f);
+ }
+ fclose(f);
+ }
+ p = p->next;
+ }
+
+}
+
+#endif
+
+static void
+map_destroy_poi_geodownload(struct map_priv *m)
+{
+ dbg(1,"enter\n");
+ g_free(m);
+}
+
+static void
+poi_geodownload_coord_rewind(void *priv_data)
+{
+ struct map_rect_priv *mr=priv_data;
+ mr->cidx=0;
+}
+
+
+static int
+poi_geodownload_coord_get(void *priv_data, struct coord *c, int count)
+{
+ struct map_rect_priv *mr=priv_data;
+ dbg(1,"enter\n");
+ if (mr->cidx || !count)
+ return 0;
+ c->x=mdb_pg_get_int32(mr->m->h, mr->m->cols[0]->cur_value_start);
+ c->y=mdb_pg_get_int32(mr->m->h, mr->m->cols[1]->cur_value_start);
+ dbg(1,"x=0x%x y=0x%x\n", c->x, c->y);
+ return 1;
+}
+
+static void
+poi_geodownload_attr_rewind(void *priv_data)
+{
+ struct map_rect_priv *mr=priv_data;
+ mr->attr_next=attr_label;
+}
+
+static int
+poi_geodownload_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
+{
+ struct map_rect_priv *mr=priv_data;
+ struct map_priv *m=mr->m;
+ MdbColumn *col;
+ char *v;
+ int j;
+
+ dbg(1,"enter\n");
+ attr->type=attr_type;
+ switch (attr_type) {
+ case attr_any:
+ while (mr->attr_next != attr_none) {
+ if (poi_geodownload_attr_get(mr, mr->attr_next, attr))
+ return 1;
+ }
+ return 0;
+ case attr_label:
+ mr->attr_next=attr_debug;
+ if (m->name_col == -1)
+ return 0;
+ col=m->cols[m->name_col];
+ if (col->cur_value_len)
+ attr->u.str=mdb_col_to_string (m->h, m->h->pg_buf, col->cur_value_start, col->col_type, col->cur_value_len);
+ else
+ attr->u.str="";
+ return 1;
+ case attr_debug:
+ mr->attr_next=attr_none;
+ v=mr->buffer;
+ *v='\0';
+ for (j = 0; j < mr->m->table_col->len; j++) {
+ col = mr->m->table_col->pdata[j];
+ printf("start: %d type:%d\n", col->cur_value_start, col->col_type);
+ sprintf(v, "%s:", col->name);
+ v += strlen(v);
+ if (!strcasecmp(col->name,"X") || !strcasecmp(col->name,"Y"))
+ print_col(mr->m->h, col, v, 1);
+ else
+ print_col(mr->m->h, col, v, 0);
+ v += strlen(v);
+ *v++='\n';
+ *v='\0';
+ }
+ attr->u.str=mr->buffer;
+ return 1;
+ default:
+ break;
+ }
+ return 0;
+}
+
+static struct item_methods methods_poi_geodownload = {
+ poi_geodownload_coord_rewind,
+ poi_geodownload_coord_get,
+ poi_geodownload_attr_rewind,
+ poi_geodownload_attr_get,
+};
+
+
+static struct map_rect_priv *
+map_rect_new_poi_geodownload(struct map_priv *map, struct map_selection *sel)
+{
+ struct map_rect_priv *mr;
+
+ dbg(1,"enter\n");
+ mr=g_new0(struct map_rect_priv, 1);
+ mr->item.meth=&methods_poi_geodownload;
+ mr->item.id_hi=0;
+ mr->item.id_lo=0;
+ mr->item.priv_data=mr;
+ mr->item.type=map->type;
+ mr->m=map;
+ mdb_rewind_table(map->table);
+ return mr;
+}
+
+
+static void
+map_rect_destroy_poi_geodownload(struct map_rect_priv *mr)
+{
+ g_free(mr);
+}
+
+static struct item *
+map_rect_get_item_poi_geodownload(struct map_rect_priv *mr)
+{
+ dbg(1,"enter\n");
+ if (mdb_fetch_row(mr->m->table)) {
+ mr->item.id_hi=mr->m->table->cur_phys_pg;
+ mr->item.id_lo=mr->m->table->cur_row-1;
+ poi_geodownload_attr_rewind(mr);
+ return &mr->item;
+ }
+ return NULL;
+}
+
+static struct item *
+map_rect_get_item_byid_poi_geodownload(struct map_rect_priv *mr, int id_hi, int id_lo)
+{
+ char *v, buffer[4096];
+ int j;
+ MdbColumn *col;
+
+ dbg(1,"enter\n");
+ load_row(mr->m, id_hi, id_lo);
+ for (j = 0; j < mr->m->table_col->len; j++) {
+ col = mr->m->table_col->pdata[j];
+ printf("start: %d type:%d\n", col->cur_value_start, col->col_type);
+ sprintf(buffer, "%s:", col->name);
+ v = buffer + strlen(buffer);
+ if (!strcasecmp(col->name,"X") || !strcasecmp(col->name,"Y"))
+ print_col(mr->m->h, col, v, 1);
+ else
+ print_col(mr->m->h, col, v, 0);
+ printf("%s\n", buffer);
+ }
+ dbg(1,"ret=%p\n", &mr->item);
+ poi_geodownload_attr_rewind(mr);
+ return &mr->item;
+}
+
+
+static struct map_methods map_methods_poi_geodownload = {
+ projection_mg,
+ "iso8859-1",
+ map_destroy_poi_geodownload,
+ map_rect_new_poi_geodownload,
+ map_rect_destroy_poi_geodownload,
+ map_rect_get_item_poi_geodownload,
+ map_rect_get_item_byid_poi_geodownload,
+};
+
+static struct map_priv *
+map_new_poi_geodownload(struct map_methods *meth, struct attr **attrs)
+{
+ struct map_priv *m;
+ MdbCatalogEntry *entry;
+ GPtrArray *catalog;
+ int i;
+ struct attr *attr;
+ struct attr *data=attr_search(attrs, NULL, attr_data);
+ char *filename;
+ if (! data)
+ return NULL;
+ filename=data->u.str;
+ dbg(1,"filename %s\n",filename);
+ *meth=map_methods_poi_geodownload;
+
+ m=g_new(struct map_priv, 1);
+ m->filename=g_strdup(filename);
+ m->h = mdb_open(m->filename, MDB_NOFLAGS);
+ m->type=type_none;
+ dbg(1,"attr_search\n");
+ attr=attr_search(attrs, NULL, attr_item_type);
+ dbg(1,"attr_search result %p\n", attr);
+ if (attr)
+ m->type=attr->u.item_type;
+
+
+ catalog = mdb_read_catalog(m->h, MDB_TABLE);
+ for (i = 0; i < catalog->len; i++) {
+ entry = catalog->pdata[i];
+ dbg(1,"object name '%s'\n", entry->object_name);
+ if (!strcasecmp(entry->object_name, "_INDEXDATA")) {
+ if (m && load_poi_table(m, entry)) {
+ printf("%s invalid\n", filename);
+ g_free(m);
+ m=NULL;
+ }
+ }
+ }
+ g_ptr_array_free(catalog, 1);
+ return m;
+}
+
+void
+plugin_init(void)
+{
+ dbg(1,"plugin_init\n");
+ plugin_register_map_type("poi_geodownload", map_new_poi_geodownload);
+ mdb_init();
+}
+
diff --git a/map/shapefile/Makefile.am b/map/shapefile/Makefile.am
new file mode 100644
index 00000000..3483f440
--- /dev/null
+++ b/map/shapefile/Makefile.am
@@ -0,0 +1,9 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=map_shapefile
+if PLUGINS
+ modulemap_LTLIBRARIES = libmap_shapefile.la
+else
+ noinst_LTLIBRARIES = libmap_shapefile.la
+endif
+libmap_shapefile_la_SOURCES = shapefile.c dbfopen.c shpopen.c shptree.c shapefil.h
+libmap_shapefile_la_LDFLAGS = -module -avoid-version
diff --git a/map/shapefile/dbfopen.c b/map/shapefile/dbfopen.c
new file mode 100644
index 00000000..4f682eab
--- /dev/null
+++ b/map/shapefile/dbfopen.c
@@ -0,0 +1,1871 @@
+/******************************************************************************
+ * $Id: dbfopen.c,v 1.83 2008/11/12 14:28:15 fwarmerdam Exp $
+ *
+ * Project: Shapelib
+ * Purpose: Implementation of .dbf access API documented in dbf_api.html.
+ * Author: Frank Warmerdam, warmerdam@pobox.com
+ *
+ ******************************************************************************
+ * Copyright (c) 1999, Frank Warmerdam
+ *
+ * This software is available under the following "MIT Style" license,
+ * or at the option of the licensee under the LGPL (see LICENSE.LGPL). This
+ * option is discussed in more detail in shapelib.html.
+ *
+ * --
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ******************************************************************************
+ *
+ * $Log: dbfopen.c,v $
+ * Revision 1.83 2008/11/12 14:28:15 fwarmerdam
+ * DBFCreateField() now works on files with records
+ *
+ * Revision 1.82 2008/11/11 17:47:09 fwarmerdam
+ * added DBFDeleteField() function
+ *
+ * Revision 1.81 2008/01/03 17:48:13 bram
+ * in DBFCreate, use default code page LDID/87 (= 0x57, ANSI)
+ * instead of LDID/3. This seems to be the same as what ESRI
+ * would be doing by default.
+ *
+ * Revision 1.80 2007/12/30 14:36:39 fwarmerdam
+ * avoid syntax issue with last comment.
+ *
+ * Revision 1.79 2007/12/30 14:35:48 fwarmerdam
+ * Avoid char* / unsigned char* warnings.
+ *
+ * Revision 1.78 2007/12/18 18:28:07 bram
+ * - create hook for client specific atof (bugzilla ticket 1615)
+ * - check for NULL handle before closing cpCPG file, and close after reading.
+ *
+ * Revision 1.77 2007/12/15 20:25:21 bram
+ * dbfopen.c now reads the Code Page information from the DBF file, and exports
+ * this information as a string through the DBFGetCodePage function. This is
+ * either the number from the LDID header field ("LDID/<number>") or as the
+ * content of an accompanying .CPG file. When creating a DBF file, the code can
+ * be set using DBFCreateEx.
+ *
+ * Revision 1.76 2007/12/12 22:21:32 bram
+ * DBFClose: check for NULL psDBF handle before trying to close it.
+ *
+ * Revision 1.75 2007/12/06 13:58:19 fwarmerdam
+ * make sure file offset calculations are done in as SAOffset
+ *
+ * Revision 1.74 2007/12/06 07:00:25 fwarmerdam
+ * dbfopen now using SAHooks for fileio
+ *
+ * Revision 1.73 2007/09/03 19:48:11 fwarmerdam
+ * move DBFReadAttribute() static dDoubleField into dbfinfo
+ *
+ * Revision 1.72 2007/09/03 19:34:06 fwarmerdam
+ * Avoid use of static tuple buffer in DBFReadTuple()
+ *
+ * Revision 1.71 2006/06/22 14:37:18 fwarmerdam
+ * avoid memory leak if dbfopen fread fails
+ *
+ * Revision 1.70 2006/06/17 17:47:05 fwarmerdam
+ * use calloc() for dbfinfo in DBFCreate
+ *
+ * Revision 1.69 2006/06/17 15:34:32 fwarmerdam
+ * disallow creating fields wider than 255
+ *
+ * Revision 1.68 2006/06/17 15:12:40 fwarmerdam
+ * Fixed C++ style comments.
+ *
+ * Revision 1.67 2006/06/17 00:24:53 fwarmerdam
+ * Don't treat non-zero decimals values as high order byte for length
+ * for strings. It causes serious corruption for some files.
+ * http://bugzilla.remotesensing.org/show_bug.cgi?id=1202
+ *
+ * Revision 1.66 2006/03/29 18:26:20 fwarmerdam
+ * fixed bug with size of pachfieldtype in dbfcloneempty
+ *
+ * Revision 1.65 2006/02/15 01:14:30 fwarmerdam
+ * added DBFAddNativeFieldType
+ *
+ * Revision 1.64 2006/02/09 00:29:04 fwarmerdam
+ * Changed to put spaces into string fields that are NULL as
+ * per http://bugzilla.maptools.org/show_bug.cgi?id=316.
+ *
+ * Revision 1.63 2006/01/25 15:35:43 fwarmerdam
+ * check success on DBFFlushRecord
+ *
+ * Revision 1.62 2006/01/10 16:28:03 fwarmerdam
+ * Fixed typo in CPLError.
+ *
+ * Revision 1.61 2006/01/10 16:26:29 fwarmerdam
+ * Push loading record buffer into DBFLoadRecord.
+ * Implement CPL error reporting if USE_CPL defined.
+ *
+ * Revision 1.60 2006/01/05 01:27:27 fwarmerdam
+ * added dbf deletion mark/fetch
+ *
+ * Revision 1.59 2005/03/14 15:20:28 fwarmerdam
+ * Fixed last change.
+ *
+ * Revision 1.58 2005/03/14 15:18:54 fwarmerdam
+ * Treat very wide fields with no decimals as double. This is
+ * more than 32bit integer fields.
+ *
+ * Revision 1.57 2005/02/10 20:16:54 fwarmerdam
+ * Make the pszStringField buffer for DBFReadAttribute() static char [256]
+ * as per bug 306.
+ *
+ * Revision 1.56 2005/02/10 20:07:56 fwarmerdam
+ * Fixed bug 305 in DBFCloneEmpty() - header length problem.
+ *
+ * Revision 1.55 2004/09/26 20:23:46 fwarmerdam
+ * avoid warnings with rcsid and signed/unsigned stuff
+ *
+ * Revision 1.54 2004/09/15 16:26:10 fwarmerdam
+ * Treat all blank numeric fields as null too.
+ */
+
+#include "shapefil.h"
+
+#include <math.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+
+SHP_CVSID("$Id: dbfopen.c,v 1.83 2008/11/12 14:28:15 fwarmerdam Exp $")
+
+#ifndef FALSE
+# define FALSE 0
+# define TRUE 1
+#endif
+
+/************************************************************************/
+/* SfRealloc() */
+/* */
+/* A realloc cover function that will access a NULL pointer as */
+/* a valid input. */
+/************************************************************************/
+
+static void * SfRealloc( void * pMem, int nNewSize )
+
+{
+ if( pMem == NULL )
+ return( (void *) malloc(nNewSize) );
+ else
+ return( (void *) realloc(pMem,nNewSize) );
+}
+
+/************************************************************************/
+/* DBFWriteHeader() */
+/* */
+/* This is called to write out the file header, and field */
+/* descriptions before writing any actual data records. This */
+/* also computes all the DBFDataSet field offset/size/decimals */
+/* and so forth values. */
+/************************************************************************/
+
+static void DBFWriteHeader(DBFHandle psDBF)
+
+{
+ unsigned char abyHeader[XBASE_FLDHDR_SZ];
+ int i;
+
+ if( !psDBF->bNoHeader )
+ return;
+
+ psDBF->bNoHeader = FALSE;
+
+/* -------------------------------------------------------------------- */
+/* Initialize the file header information. */
+/* -------------------------------------------------------------------- */
+ for( i = 0; i < XBASE_FLDHDR_SZ; i++ )
+ abyHeader[i] = 0;
+
+ abyHeader[0] = 0x03; /* memo field? - just copying */
+
+ /* write out a dummy date */
+ abyHeader[1] = 95; /* YY */
+ abyHeader[2] = 7; /* MM */
+ abyHeader[3] = 26; /* DD */
+
+ /* record count preset at zero */
+
+ abyHeader[8] = (unsigned char) (psDBF->nHeaderLength % 256);
+ abyHeader[9] = (unsigned char) (psDBF->nHeaderLength / 256);
+
+ abyHeader[10] = (unsigned char) (psDBF->nRecordLength % 256);
+ abyHeader[11] = (unsigned char) (psDBF->nRecordLength / 256);
+
+ abyHeader[29] = (unsigned char) (psDBF->iLanguageDriver);
+
+/* -------------------------------------------------------------------- */
+/* Write the initial 32 byte file header, and all the field */
+/* descriptions. */
+/* -------------------------------------------------------------------- */
+ psDBF->sHooks.FSeek( psDBF->fp, 0, 0 );
+ psDBF->sHooks.FWrite( abyHeader, XBASE_FLDHDR_SZ, 1, psDBF->fp );
+ psDBF->sHooks.FWrite( psDBF->pszHeader, XBASE_FLDHDR_SZ, psDBF->nFields,
+ psDBF->fp );
+
+/* -------------------------------------------------------------------- */
+/* Write out the newline character if there is room for it. */
+/* -------------------------------------------------------------------- */
+ if( psDBF->nHeaderLength > 32*psDBF->nFields + 32 )
+ {
+ char cNewline;
+
+ cNewline = 0x0d;
+ psDBF->sHooks.FWrite( &cNewline, 1, 1, psDBF->fp );
+ }
+}
+
+/************************************************************************/
+/* DBFFlushRecord() */
+/* */
+/* Write out the current record if there is one. */
+/************************************************************************/
+
+static int DBFFlushRecord( DBFHandle psDBF )
+
+{
+ SAOffset nRecordOffset;
+
+ if( psDBF->bCurrentRecordModified && psDBF->nCurrentRecord > -1 )
+ {
+ psDBF->bCurrentRecordModified = FALSE;
+
+ nRecordOffset =
+ psDBF->nRecordLength * (SAOffset) psDBF->nCurrentRecord
+ + psDBF->nHeaderLength;
+
+ if( psDBF->sHooks.FSeek( psDBF->fp, nRecordOffset, 0 ) != 0
+ || psDBF->sHooks.FWrite( psDBF->pszCurrentRecord,
+ psDBF->nRecordLength,
+ 1, psDBF->fp ) != 1 )
+ {
+#ifdef USE_CPL
+ CPLError( CE_Failure, CPLE_FileIO,
+ "Failure writing DBF record %d.",
+ psDBF->nCurrentRecord );
+#else
+ fprintf( stderr, "Failure writing DBF record %d.",
+ psDBF->nCurrentRecord );
+#endif
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+/************************************************************************/
+/* DBFLoadRecord() */
+/************************************************************************/
+
+static int DBFLoadRecord( DBFHandle psDBF, int iRecord )
+
+{
+ if( psDBF->nCurrentRecord != iRecord )
+ {
+ SAOffset nRecordOffset;
+
+ if( !DBFFlushRecord( psDBF ) )
+ return FALSE;
+
+ nRecordOffset =
+ psDBF->nRecordLength * (SAOffset) iRecord + psDBF->nHeaderLength;
+
+ if( psDBF->sHooks.FSeek( psDBF->fp, nRecordOffset, SEEK_SET ) != 0 )
+ {
+#ifdef USE_CPL
+ CPLError( CE_Failure, CPLE_FileIO,
+ "fseek(%ld) failed on DBF file.\n",
+ (long) nRecordOffset );
+#else
+ fprintf( stderr, "fseek(%ld) failed on DBF file.\n",
+ (long) nRecordOffset );
+#endif
+ return FALSE;
+ }
+
+ if( psDBF->sHooks.FRead( psDBF->pszCurrentRecord,
+ psDBF->nRecordLength, 1, psDBF->fp ) != 1 )
+ {
+#ifdef USE_CPL
+ CPLError( CE_Failure, CPLE_FileIO,
+ "fread(%d) failed on DBF file.\n",
+ psDBF->nRecordLength );
+#else
+ fprintf( stderr, "fread(%d) failed on DBF file.\n",
+ psDBF->nRecordLength );
+#endif
+ return FALSE;
+ }
+
+ psDBF->nCurrentRecord = iRecord;
+ }
+
+ return TRUE;
+}
+
+/************************************************************************/
+/* DBFUpdateHeader() */
+/************************************************************************/
+
+void SHPAPI_CALL
+DBFUpdateHeader( DBFHandle psDBF )
+
+{
+ unsigned char abyFileHeader[32];
+
+ if( psDBF->bNoHeader )
+ DBFWriteHeader( psDBF );
+
+ DBFFlushRecord( psDBF );
+
+ psDBF->sHooks.FSeek( psDBF->fp, 0, 0 );
+ psDBF->sHooks.FRead( abyFileHeader, 32, 1, psDBF->fp );
+
+ abyFileHeader[4] = (unsigned char) (psDBF->nRecords % 256);
+ abyFileHeader[5] = (unsigned char) ((psDBF->nRecords/256) % 256);
+ abyFileHeader[6] = (unsigned char) ((psDBF->nRecords/(256*256)) % 256);
+ abyFileHeader[7] = (unsigned char) ((psDBF->nRecords/(256*256*256)) % 256);
+
+ psDBF->sHooks.FSeek( psDBF->fp, 0, 0 );
+ psDBF->sHooks.FWrite( abyFileHeader, 32, 1, psDBF->fp );
+
+ psDBF->sHooks.FFlush( psDBF->fp );
+}
+
+/************************************************************************/
+/* DBFOpen() */
+/* */
+/* Open a .dbf file. */
+/************************************************************************/
+
+DBFHandle SHPAPI_CALL
+DBFOpen( const char * pszFilename, const char * pszAccess )
+
+{
+ SAHooks sHooks;
+
+ SASetupDefaultHooks( &sHooks );
+
+ return DBFOpenLL( pszFilename, pszAccess, &sHooks );
+}
+
+/************************************************************************/
+/* DBFOpen() */
+/* */
+/* Open a .dbf file. */
+/************************************************************************/
+
+DBFHandle SHPAPI_CALL
+DBFOpenLL( const char * pszFilename, const char * pszAccess, SAHooks *psHooks )
+
+{
+ DBFHandle psDBF;
+ SAFile pfCPG;
+ unsigned char *pabyBuf;
+ int nFields, nHeadLen, iField, i;
+ char *pszBasename, *pszFullname;
+ int nBufSize = 500;
+
+/* -------------------------------------------------------------------- */
+/* We only allow the access strings "rb" and "r+". */
+/* -------------------------------------------------------------------- */
+ if( strcmp(pszAccess,"r") != 0 && strcmp(pszAccess,"r+") != 0
+ && strcmp(pszAccess,"rb") != 0 && strcmp(pszAccess,"rb+") != 0
+ && strcmp(pszAccess,"r+b") != 0 )
+ return( NULL );
+
+ if( strcmp(pszAccess,"r") == 0 )
+ pszAccess = "rb";
+
+ if( strcmp(pszAccess,"r+") == 0 )
+ pszAccess = "rb+";
+
+/* -------------------------------------------------------------------- */
+/* Compute the base (layer) name. If there is any extension */
+/* on the passed in filename we will strip it off. */
+/* -------------------------------------------------------------------- */
+ pszBasename = (char *) malloc(strlen(pszFilename)+5);
+ strcpy( pszBasename, pszFilename );
+ for( i = strlen(pszBasename)-1;
+ i > 0 && pszBasename[i] != '.' && pszBasename[i] != '/'
+ && pszBasename[i] != '\\';
+ i-- ) {}
+
+ if( pszBasename[i] == '.' )
+ pszBasename[i] = '\0';
+
+ pszFullname = (char *) malloc(strlen(pszBasename) + 5);
+ sprintf( pszFullname, "%s.dbf", pszBasename );
+
+ psDBF = (DBFHandle) calloc( 1, sizeof(DBFInfo) );
+ psDBF->fp = psHooks->FOpen( pszFullname, pszAccess );
+ memcpy( &(psDBF->sHooks), psHooks, sizeof(SAHooks) );
+
+ if( psDBF->fp == NULL )
+ {
+ sprintf( pszFullname, "%s.DBF", pszBasename );
+ psDBF->fp = psDBF->sHooks.FOpen(pszFullname, pszAccess );
+ }
+
+ sprintf( pszFullname, "%s.cpg", pszBasename );
+ pfCPG = psHooks->FOpen( pszFullname, "r" );
+ if( pfCPG == NULL )
+ {
+ sprintf( pszFullname, "%s.CPG", pszBasename );
+ pfCPG = psHooks->FOpen( pszFullname, "r" );
+ }
+
+ free( pszBasename );
+ free( pszFullname );
+
+ if( psDBF->fp == NULL )
+ {
+ free( psDBF );
+ if( pfCPG ) psHooks->FClose( pfCPG );
+ return( NULL );
+ }
+
+ psDBF->bNoHeader = FALSE;
+ psDBF->nCurrentRecord = -1;
+ psDBF->bCurrentRecordModified = FALSE;
+
+/* -------------------------------------------------------------------- */
+/* Read Table Header info */
+/* -------------------------------------------------------------------- */
+ pabyBuf = (unsigned char *) malloc(nBufSize);
+ if( psDBF->sHooks.FRead( pabyBuf, 32, 1, psDBF->fp ) != 1 )
+ {
+ psDBF->sHooks.FClose( psDBF->fp );
+ if( pfCPG ) psDBF->sHooks.FClose( pfCPG );
+ free( pabyBuf );
+ free( psDBF );
+ return NULL;
+ }
+
+ psDBF->nRecords =
+ pabyBuf[4] + pabyBuf[5]*256 + pabyBuf[6]*256*256 + pabyBuf[7]*256*256*256;
+
+ psDBF->nHeaderLength = nHeadLen = pabyBuf[8] + pabyBuf[9]*256;
+ psDBF->nRecordLength = pabyBuf[10] + pabyBuf[11]*256;
+ psDBF->iLanguageDriver = pabyBuf[29];
+
+ psDBF->nFields = nFields = (nHeadLen - 32) / 32;
+
+ psDBF->pszCurrentRecord = (char *) malloc(psDBF->nRecordLength);
+
+/* -------------------------------------------------------------------- */
+/* Figure out the code page from the LDID and CPG */
+/* -------------------------------------------------------------------- */
+
+ psDBF->pszCodePage = NULL;
+ if( pfCPG )
+ {
+ size_t n;
+ char *buffer = (char *) pabyBuf;
+ buffer[0] = '\0';
+ psDBF->sHooks.FRead( pabyBuf, nBufSize - 1, 1, pfCPG );
+ n = strcspn( (char *) pabyBuf, "\n\r" );
+ if( n > 0 )
+ {
+ pabyBuf[n] = '\0';
+ psDBF->pszCodePage = (char *) malloc(n + 1);
+ memcpy( psDBF->pszCodePage, pabyBuf, n + 1 );
+ }
+ psDBF->sHooks.FClose( pfCPG );
+ }
+ if( psDBF->pszCodePage == NULL && pabyBuf[29] != 0 )
+ {
+ sprintf( (char *) pabyBuf, "LDID/%d", psDBF->iLanguageDriver );
+ psDBF->pszCodePage = (char *) malloc(strlen((char*)pabyBuf) + 1);
+ strcpy( psDBF->pszCodePage, (char *) pabyBuf );
+ }
+
+/* -------------------------------------------------------------------- */
+/* Read in Field Definitions */
+/* -------------------------------------------------------------------- */
+
+ pabyBuf = (unsigned char *) SfRealloc(pabyBuf,nHeadLen);
+ psDBF->pszHeader = (char *) pabyBuf;
+
+ psDBF->sHooks.FSeek( psDBF->fp, 32, 0 );
+ if( psDBF->sHooks.FRead( pabyBuf, nHeadLen-32, 1, psDBF->fp ) != 1 )
+ {
+ psDBF->sHooks.FClose( psDBF->fp );
+ free( pabyBuf );
+ free( psDBF->pszCurrentRecord );
+ free( psDBF );
+ return NULL;
+ }
+
+ psDBF->panFieldOffset = (int *) malloc(sizeof(int) * nFields);
+ psDBF->panFieldSize = (int *) malloc(sizeof(int) * nFields);
+ psDBF->panFieldDecimals = (int *) malloc(sizeof(int) * nFields);
+ psDBF->pachFieldType = (char *) malloc(sizeof(char) * nFields);
+
+ for( iField = 0; iField < nFields; iField++ )
+ {
+ unsigned char *pabyFInfo;
+
+ pabyFInfo = pabyBuf+iField*32;
+
+ if( pabyFInfo[11] == 'N' || pabyFInfo[11] == 'F' )
+ {
+ psDBF->panFieldSize[iField] = pabyFInfo[16];
+ psDBF->panFieldDecimals[iField] = pabyFInfo[17];
+ }
+ else
+ {
+ psDBF->panFieldSize[iField] = pabyFInfo[16];
+ psDBF->panFieldDecimals[iField] = 0;
+
+/*
+** The following seemed to be used sometimes to handle files with long
+** string fields, but in other cases (such as bug 1202) the decimals field
+** just seems to indicate some sort of preferred formatting, not very
+** wide fields. So I have disabled this code. FrankW.
+ psDBF->panFieldSize[iField] = pabyFInfo[16] + pabyFInfo[17]*256;
+ psDBF->panFieldDecimals[iField] = 0;
+*/
+ }
+
+ psDBF->pachFieldType[iField] = (char) pabyFInfo[11];
+ if( iField == 0 )
+ psDBF->panFieldOffset[iField] = 1;
+ else
+ psDBF->panFieldOffset[iField] =
+ psDBF->panFieldOffset[iField-1] + psDBF->panFieldSize[iField-1];
+ }
+
+ return( psDBF );
+}
+
+/************************************************************************/
+/* DBFClose() */
+/************************************************************************/
+
+void SHPAPI_CALL
+DBFClose(DBFHandle psDBF)
+{
+ if( psDBF == NULL )
+ return;
+
+/* -------------------------------------------------------------------- */
+/* Write out header if not already written. */
+/* -------------------------------------------------------------------- */
+ if( psDBF->bNoHeader )
+ DBFWriteHeader( psDBF );
+
+ DBFFlushRecord( psDBF );
+
+/* -------------------------------------------------------------------- */
+/* Update last access date, and number of records if we have */
+/* write access. */
+/* -------------------------------------------------------------------- */
+ if( psDBF->bUpdated )
+ DBFUpdateHeader( psDBF );
+
+/* -------------------------------------------------------------------- */
+/* Close, and free resources. */
+/* -------------------------------------------------------------------- */
+ psDBF->sHooks.FClose( psDBF->fp );
+
+ if( psDBF->panFieldOffset != NULL )
+ {
+ free( psDBF->panFieldOffset );
+ free( psDBF->panFieldSize );
+ free( psDBF->panFieldDecimals );
+ free( psDBF->pachFieldType );
+ }
+
+ if( psDBF->pszWorkField != NULL )
+ free( psDBF->pszWorkField );
+
+ free( psDBF->pszHeader );
+ free( psDBF->pszCurrentRecord );
+ free( psDBF->pszCodePage );
+
+ free( psDBF );
+}
+
+/************************************************************************/
+/* DBFCreate() */
+/* */
+/* Create a new .dbf file with default code page LDID/87 (0x57) */
+/************************************************************************/
+
+DBFHandle SHPAPI_CALL
+DBFCreate( const char * pszFilename )
+
+{
+ return DBFCreateEx( pszFilename, "LDID/87" ); // 0x57
+}
+
+/************************************************************************/
+/* DBFCreateEx() */
+/* */
+/* Create a new .dbf file. */
+/************************************************************************/
+
+DBFHandle SHPAPI_CALL
+DBFCreateEx( const char * pszFilename, const char* pszCodePage )
+
+{
+ SAHooks sHooks;
+
+ SASetupDefaultHooks( &sHooks );
+
+ return DBFCreateLL( pszFilename, pszCodePage , &sHooks );
+}
+
+/************************************************************************/
+/* DBFCreate() */
+/* */
+/* Create a new .dbf file. */
+/************************************************************************/
+
+DBFHandle SHPAPI_CALL
+DBFCreateLL( const char * pszFilename, const char * pszCodePage, SAHooks *psHooks )
+
+{
+ DBFHandle psDBF;
+ SAFile fp;
+ char *pszFullname, *pszBasename;
+ int i, ldid = -1;
+ char chZero = '\0';
+
+/* -------------------------------------------------------------------- */
+/* Compute the base (layer) name. If there is any extension */
+/* on the passed in filename we will strip it off. */
+/* -------------------------------------------------------------------- */
+ pszBasename = (char *) malloc(strlen(pszFilename)+5);
+ strcpy( pszBasename, pszFilename );
+ for( i = strlen(pszBasename)-1;
+ i > 0 && pszBasename[i] != '.' && pszBasename[i] != '/'
+ && pszBasename[i] != '\\';
+ i-- ) {}
+
+ if( pszBasename[i] == '.' )
+ pszBasename[i] = '\0';
+
+ pszFullname = (char *) malloc(strlen(pszBasename) + 5);
+ sprintf( pszFullname, "%s.dbf", pszBasename );
+
+/* -------------------------------------------------------------------- */
+/* Create the file. */
+/* -------------------------------------------------------------------- */
+ fp = psHooks->FOpen( pszFullname, "wb" );
+ if( fp == NULL )
+ return( NULL );
+
+ psHooks->FWrite( &chZero, 1, 1, fp );
+ psHooks->FClose( fp );
+
+ fp = psHooks->FOpen( pszFullname, "rb+" );
+ if( fp == NULL )
+ return( NULL );
+
+
+ sprintf( pszFullname, "%s.cpg", pszBasename );
+ if( pszCodePage != NULL )
+ {
+ if( strncmp( pszCodePage, "LDID/", 5 ) == 0 )
+ {
+ ldid = atoi( pszCodePage + 5 );
+ if( ldid > 255 )
+ ldid = -1; // don't use 0 to indicate out of range as LDID/0 is a valid one
+ }
+ if( ldid < 0 )
+ {
+ SAFile fpCPG = psHooks->FOpen( pszFullname, "w" );
+ psHooks->FWrite( (char*) pszCodePage, strlen(pszCodePage), 1, fpCPG );
+ psHooks->FClose( fpCPG );
+ }
+ }
+ if( pszCodePage == NULL || ldid >= 0 )
+ {
+ psHooks->Remove( pszFullname );
+ }
+
+ free( pszBasename );
+ free( pszFullname );
+
+/* -------------------------------------------------------------------- */
+/* Create the info structure. */
+/* -------------------------------------------------------------------- */
+ psDBF = (DBFHandle) calloc(1,sizeof(DBFInfo));
+
+ memcpy( &(psDBF->sHooks), psHooks, sizeof(SAHooks) );
+ psDBF->fp = fp;
+ psDBF->nRecords = 0;
+ psDBF->nFields = 0;
+ psDBF->nRecordLength = 1;
+ psDBF->nHeaderLength = 33;
+
+ psDBF->panFieldOffset = NULL;
+ psDBF->panFieldSize = NULL;
+ psDBF->panFieldDecimals = NULL;
+ psDBF->pachFieldType = NULL;
+ psDBF->pszHeader = NULL;
+
+ psDBF->nCurrentRecord = -1;
+ psDBF->bCurrentRecordModified = FALSE;
+ psDBF->pszCurrentRecord = NULL;
+
+ psDBF->bNoHeader = TRUE;
+
+ psDBF->iLanguageDriver = ldid > 0 ? ldid : 0;
+ psDBF->pszCodePage = NULL;
+ if( pszCodePage )
+ {
+ psDBF->pszCodePage = (char * ) malloc( strlen(pszCodePage) + 1 );
+ strcpy( psDBF->pszCodePage, pszCodePage );
+ }
+
+ return( psDBF );
+}
+
+/************************************************************************/
+/* DBFAddField() */
+/* */
+/* Add a field to a newly created .dbf or to an existing one */
+/************************************************************************/
+
+int SHPAPI_CALL
+DBFAddField(DBFHandle psDBF, const char * pszFieldName,
+ DBFFieldType eType, int nWidth, int nDecimals )
+
+{
+ char chNativeType = 'C';
+
+ if( eType == FTLogical )
+ chNativeType = 'L';
+ else if( eType == FTString )
+ chNativeType = 'C';
+ else
+ chNativeType = 'N';
+
+ return DBFAddNativeFieldType( psDBF, pszFieldName, chNativeType,
+ nWidth, nDecimals );
+}
+
+/************************************************************************/
+/* DBFAddField() */
+/* */
+/* Add a field to a newly created .dbf file before any records */
+/* are written. */
+/************************************************************************/
+
+int SHPAPI_CALL
+DBFAddNativeFieldType(DBFHandle psDBF, const char * pszFieldName,
+ char chType, int nWidth, int nDecimals )
+
+{
+ char *pszFInfo;
+ int i;
+ int nOldRecordLength, nOldHeaderLength;
+ char *pszRecord;
+ char chFieldFill;
+ SAOffset nRecordOffset;
+
+/* -------------------------------------------------------------------- */
+/* Do some checking to ensure we can add records to this file. */
+/* -------------------------------------------------------------------- */
+ if( nWidth < 1 )
+ return -1;
+
+ if( nWidth > 255 )
+ nWidth = 255;
+
+ nOldRecordLength = psDBF->nRecordLength;
+ nOldHeaderLength = psDBF->nHeaderLength;
+
+/* -------------------------------------------------------------------- */
+/* SfRealloc all the arrays larger to hold the additional field */
+/* information. */
+/* -------------------------------------------------------------------- */
+ psDBF->nFields++;
+
+ psDBF->panFieldOffset = (int *)
+ SfRealloc( psDBF->panFieldOffset, sizeof(int) * psDBF->nFields );
+
+ psDBF->panFieldSize = (int *)
+ SfRealloc( psDBF->panFieldSize, sizeof(int) * psDBF->nFields );
+
+ psDBF->panFieldDecimals = (int *)
+ SfRealloc( psDBF->panFieldDecimals, sizeof(int) * psDBF->nFields );
+
+ psDBF->pachFieldType = (char *)
+ SfRealloc( psDBF->pachFieldType, sizeof(char) * psDBF->nFields );
+
+/* -------------------------------------------------------------------- */
+/* Assign the new field information fields. */
+/* -------------------------------------------------------------------- */
+ psDBF->panFieldOffset[psDBF->nFields-1] = psDBF->nRecordLength;
+ psDBF->nRecordLength += nWidth;
+ psDBF->panFieldSize[psDBF->nFields-1] = nWidth;
+ psDBF->panFieldDecimals[psDBF->nFields-1] = nDecimals;
+ psDBF->pachFieldType[psDBF->nFields-1] = chType;
+
+/* -------------------------------------------------------------------- */
+/* Extend the required header information. */
+/* -------------------------------------------------------------------- */
+ psDBF->nHeaderLength += 32;
+ psDBF->bUpdated = FALSE;
+
+ psDBF->pszHeader = (char *) SfRealloc(psDBF->pszHeader,psDBF->nFields*32);
+
+ pszFInfo = psDBF->pszHeader + 32 * (psDBF->nFields-1);
+
+ for( i = 0; i < 32; i++ )
+ pszFInfo[i] = '\0';
+
+ if( (int) strlen(pszFieldName) < 10 )
+ strncpy( pszFInfo, pszFieldName, strlen(pszFieldName));
+ else
+ strncpy( pszFInfo, pszFieldName, 10);
+
+ pszFInfo[11] = psDBF->pachFieldType[psDBF->nFields-1];
+
+ if( chType == 'C' )
+ {
+ pszFInfo[16] = (unsigned char) (nWidth % 256);
+ pszFInfo[17] = (unsigned char) (nWidth / 256);
+ }
+ else
+ {
+ pszFInfo[16] = (unsigned char) nWidth;
+ pszFInfo[17] = (unsigned char) nDecimals;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Make the current record buffer appropriately larger. */
+/* -------------------------------------------------------------------- */
+ psDBF->pszCurrentRecord = (char *) SfRealloc(psDBF->pszCurrentRecord,
+ psDBF->nRecordLength);
+
+ /* we're done if dealing with new .dbf */
+ if( psDBF->bNoHeader )
+ return( psDBF->nFields - 1 );
+
+/* -------------------------------------------------------------------- */
+/* For existing .dbf file, shift records */
+/* -------------------------------------------------------------------- */
+
+ /* alloc record */
+ pszRecord = (char *) malloc(sizeof(char) * psDBF->nRecordLength);
+
+ switch (chType)
+ {
+ case 'N':
+ case 'F':
+ chFieldFill = '*';
+ break;
+ case 'D':
+ chFieldFill = '0';
+ break;
+ case 'L':
+ chFieldFill = '?';
+ break;
+ default:
+ chFieldFill = ' ';
+ break;
+ }
+
+ for (i = psDBF->nRecords-1; i >= 0; --i)
+ {
+ nRecordOffset = nOldRecordLength * (SAOffset) i + nOldHeaderLength;
+
+ /* load record */
+ psDBF->sHooks.FSeek( psDBF->fp, nRecordOffset, 0 );
+ psDBF->sHooks.FRead( pszRecord, nOldRecordLength, 1, psDBF->fp );
+
+ /* set new field's value to NULL */
+ memset(pszRecord + nOldRecordLength, chFieldFill, nWidth);
+
+ nRecordOffset = psDBF->nRecordLength * (SAOffset) i + psDBF->nHeaderLength;
+
+ /* move record to the new place*/
+ psDBF->sHooks.FSeek( psDBF->fp, nRecordOffset, 0 );
+ psDBF->sHooks.FWrite( pszRecord, psDBF->nRecordLength, 1, psDBF->fp );
+ }
+
+ /* free record */
+ free(pszRecord);
+
+ /* force update of header with new header, record length and new field */
+ psDBF->bNoHeader = TRUE;
+ DBFUpdateHeader( psDBF );
+
+ return( psDBF->nFields-1 );
+}
+
+/************************************************************************/
+/* DBFReadAttribute() */
+/* */
+/* Read one of the attribute fields of a record. */
+/************************************************************************/
+
+static void *DBFReadAttribute(DBFHandle psDBF, int hEntity, int iField,
+ char chReqType )
+
+{
+ unsigned char *pabyRec;
+ void *pReturnField = NULL;
+
+/* -------------------------------------------------------------------- */
+/* Verify selection. */
+/* -------------------------------------------------------------------- */
+ if( hEntity < 0 || hEntity >= psDBF->nRecords )
+ return( NULL );
+
+ if( iField < 0 || iField >= psDBF->nFields )
+ return( NULL );
+
+/* -------------------------------------------------------------------- */
+/* Have we read the record? */
+/* -------------------------------------------------------------------- */
+ if( !DBFLoadRecord( psDBF, hEntity ) )
+ return NULL;
+
+ pabyRec = (unsigned char *) psDBF->pszCurrentRecord;
+
+/* -------------------------------------------------------------------- */
+/* Ensure we have room to extract the target field. */
+/* -------------------------------------------------------------------- */
+ if( psDBF->panFieldSize[iField] >= psDBF->nWorkFieldLength )
+ {
+ psDBF->nWorkFieldLength = psDBF->panFieldSize[iField] + 100;
+ if( psDBF->pszWorkField == NULL )
+ psDBF->pszWorkField = (char *) malloc(psDBF->nWorkFieldLength);
+ else
+ psDBF->pszWorkField = (char *) realloc(psDBF->pszWorkField,
+ psDBF->nWorkFieldLength);
+ }
+
+/* -------------------------------------------------------------------- */
+/* Extract the requested field. */
+/* -------------------------------------------------------------------- */
+ strncpy( psDBF->pszWorkField,
+ ((const char *) pabyRec) + psDBF->panFieldOffset[iField],
+ psDBF->panFieldSize[iField] );
+ psDBF->pszWorkField[psDBF->panFieldSize[iField]] = '\0';
+
+ pReturnField = psDBF->pszWorkField;
+
+/* -------------------------------------------------------------------- */
+/* Decode the field. */
+/* -------------------------------------------------------------------- */
+ if( chReqType == 'N' )
+ {
+ psDBF->dfDoubleField = psDBF->sHooks.Atof(psDBF->pszWorkField);
+
+ pReturnField = &(psDBF->dfDoubleField);
+ }
+
+/* -------------------------------------------------------------------- */
+/* Should we trim white space off the string attribute value? */
+/* -------------------------------------------------------------------- */
+#ifdef TRIM_DBF_WHITESPACE
+ else
+ {
+ char *pchSrc, *pchDst;
+
+ pchDst = pchSrc = psDBF->pszWorkField;
+ while( *pchSrc == ' ' )
+ pchSrc++;
+
+ while( *pchSrc != '\0' )
+ *(pchDst++) = *(pchSrc++);
+ *pchDst = '\0';
+
+ while( pchDst != psDBF->pszWorkField && *(--pchDst) == ' ' )
+ *pchDst = '\0';
+ }
+#endif
+
+ return( pReturnField );
+}
+
+/************************************************************************/
+/* DBFReadIntAttribute() */
+/* */
+/* Read an integer attribute. */
+/************************************************************************/
+
+int SHPAPI_CALL
+DBFReadIntegerAttribute( DBFHandle psDBF, int iRecord, int iField )
+
+{
+ double *pdValue;
+
+ pdValue = (double *) DBFReadAttribute( psDBF, iRecord, iField, 'N' );
+
+ if( pdValue == NULL )
+ return 0;
+ else
+ return( (int) *pdValue );
+}
+
+/************************************************************************/
+/* DBFReadDoubleAttribute() */
+/* */
+/* Read a double attribute. */
+/************************************************************************/
+
+double SHPAPI_CALL
+DBFReadDoubleAttribute( DBFHandle psDBF, int iRecord, int iField )
+
+{
+ double *pdValue;
+
+ pdValue = (double *) DBFReadAttribute( psDBF, iRecord, iField, 'N' );
+
+ if( pdValue == NULL )
+ return 0.0;
+ else
+ return( *pdValue );
+}
+
+/************************************************************************/
+/* DBFReadStringAttribute() */
+/* */
+/* Read a string attribute. */
+/************************************************************************/
+
+const char SHPAPI_CALL1(*)
+DBFReadStringAttribute( DBFHandle psDBF, int iRecord, int iField )
+
+{
+ return( (const char *) DBFReadAttribute( psDBF, iRecord, iField, 'C' ) );
+}
+
+/************************************************************************/
+/* DBFReadLogicalAttribute() */
+/* */
+/* Read a logical attribute. */
+/************************************************************************/
+
+const char SHPAPI_CALL1(*)
+DBFReadLogicalAttribute( DBFHandle psDBF, int iRecord, int iField )
+
+{
+ return( (const char *) DBFReadAttribute( psDBF, iRecord, iField, 'L' ) );
+}
+
+/************************************************************************/
+/* DBFIsAttributeNULL() */
+/* */
+/* Return TRUE if value for field is NULL. */
+/* */
+/* Contributed by Jim Matthews. */
+/************************************************************************/
+
+int SHPAPI_CALL
+DBFIsAttributeNULL( DBFHandle psDBF, int iRecord, int iField )
+
+{
+ const char *pszValue;
+ int i;
+
+ pszValue = DBFReadStringAttribute( psDBF, iRecord, iField );
+
+ if( pszValue == NULL )
+ return TRUE;
+
+ switch(psDBF->pachFieldType[iField])
+ {
+ case 'N':
+ case 'F':
+ /*
+ ** We accept all asterisks or all blanks as NULL
+ ** though according to the spec I think it should be all
+ ** asterisks.
+ */
+ if( pszValue[0] == '*' )
+ return TRUE;
+
+ for( i = 0; pszValue[i] != '\0'; i++ )
+ {
+ if( pszValue[i] != ' ' )
+ return FALSE;
+ }
+ return TRUE;
+
+ case 'D':
+ /* NULL date fields have value "00000000" */
+ return strncmp(pszValue,"00000000",8) == 0;
+
+ case 'L':
+ /* NULL boolean fields have value "?" */
+ return pszValue[0] == '?';
+
+ default:
+ /* empty string fields are considered NULL */
+ return strlen(pszValue) == 0;
+ }
+}
+
+/************************************************************************/
+/* DBFGetFieldCount() */
+/* */
+/* Return the number of fields in this table. */
+/************************************************************************/
+
+int SHPAPI_CALL
+DBFGetFieldCount( DBFHandle psDBF )
+
+{
+ return( psDBF->nFields );
+}
+
+/************************************************************************/
+/* DBFGetRecordCount() */
+/* */
+/* Return the number of records in this table. */
+/************************************************************************/
+
+int SHPAPI_CALL
+DBFGetRecordCount( DBFHandle psDBF )
+
+{
+ return( psDBF->nRecords );
+}
+
+/************************************************************************/
+/* DBFGetFieldInfo() */
+/* */
+/* Return any requested information about the field. */
+/************************************************************************/
+
+DBFFieldType SHPAPI_CALL
+DBFGetFieldInfo( DBFHandle psDBF, int iField, char * pszFieldName,
+ int * pnWidth, int * pnDecimals )
+
+{
+ if( iField < 0 || iField >= psDBF->nFields )
+ return( FTInvalid );
+
+ if( pnWidth != NULL )
+ *pnWidth = psDBF->panFieldSize[iField];
+
+ if( pnDecimals != NULL )
+ *pnDecimals = psDBF->panFieldDecimals[iField];
+
+ if( pszFieldName != NULL )
+ {
+ int i;
+
+ strncpy( pszFieldName, (char *) psDBF->pszHeader+iField*32, 11 );
+ pszFieldName[11] = '\0';
+ for( i = 10; i > 0 && pszFieldName[i] == ' '; i-- )
+ pszFieldName[i] = '\0';
+ }
+
+ if ( psDBF->pachFieldType[iField] == 'L' )
+ return( FTLogical);
+
+ else if( psDBF->pachFieldType[iField] == 'N'
+ || psDBF->pachFieldType[iField] == 'F' )
+ {
+ if( psDBF->panFieldDecimals[iField] > 0
+ || psDBF->panFieldSize[iField] > 10 )
+ return( FTDouble );
+ else
+ return( FTInteger );
+ }
+ else
+ {
+ return( FTString );
+ }
+}
+
+/************************************************************************/
+/* DBFWriteAttribute() */
+/* */
+/* Write an attribute record to the file. */
+/************************************************************************/
+
+static int DBFWriteAttribute(DBFHandle psDBF, int hEntity, int iField,
+ void * pValue )
+
+{
+ int i, j, nRetResult = TRUE;
+ unsigned char *pabyRec;
+ char szSField[400], szFormat[20];
+
+/* -------------------------------------------------------------------- */
+/* Is this a valid record? */
+/* -------------------------------------------------------------------- */
+ if( hEntity < 0 || hEntity > psDBF->nRecords )
+ return( FALSE );
+
+ if( psDBF->bNoHeader )
+ DBFWriteHeader(psDBF);
+
+/* -------------------------------------------------------------------- */
+/* Is this a brand new record? */
+/* -------------------------------------------------------------------- */
+ if( hEntity == psDBF->nRecords )
+ {
+ if( !DBFFlushRecord( psDBF ) )
+ return FALSE;
+
+ psDBF->nRecords++;
+ for( i = 0; i < psDBF->nRecordLength; i++ )
+ psDBF->pszCurrentRecord[i] = ' ';
+
+ psDBF->nCurrentRecord = hEntity;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Is this an existing record, but different than the last one */
+/* we accessed? */
+/* -------------------------------------------------------------------- */
+ if( !DBFLoadRecord( psDBF, hEntity ) )
+ return FALSE;
+
+ pabyRec = (unsigned char *) psDBF->pszCurrentRecord;
+
+ psDBF->bCurrentRecordModified = TRUE;
+ psDBF->bUpdated = TRUE;
+
+/* -------------------------------------------------------------------- */
+/* Translate NULL value to valid DBF file representation. */
+/* */
+/* Contributed by Jim Matthews. */
+/* -------------------------------------------------------------------- */
+ if( pValue == NULL )
+ {
+ switch(psDBF->pachFieldType[iField])
+ {
+ case 'N':
+ case 'F':
+ /* NULL numeric fields have value "****************" */
+ memset( (char *) (pabyRec+psDBF->panFieldOffset[iField]), '*',
+ psDBF->panFieldSize[iField] );
+ break;
+
+ case 'D':
+ /* NULL date fields have value "00000000" */
+ memset( (char *) (pabyRec+psDBF->panFieldOffset[iField]), '0',
+ psDBF->panFieldSize[iField] );
+ break;
+
+ case 'L':
+ /* NULL boolean fields have value "?" */
+ memset( (char *) (pabyRec+psDBF->panFieldOffset[iField]), '?',
+ psDBF->panFieldSize[iField] );
+ break;
+
+ default:
+ /* empty string fields are considered NULL */
+ memset( (char *) (pabyRec+psDBF->panFieldOffset[iField]), ' ',
+ psDBF->panFieldSize[iField] );
+ break;
+ }
+ return TRUE;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Assign all the record fields. */
+/* -------------------------------------------------------------------- */
+ switch( psDBF->pachFieldType[iField] )
+ {
+ case 'D':
+ case 'N':
+ case 'F':
+ if( psDBF->panFieldDecimals[iField] == 0 )
+ {
+ int nWidth = psDBF->panFieldSize[iField];
+
+ if( (int) sizeof(szSField)-2 < nWidth )
+ nWidth = sizeof(szSField)-2;
+
+ sprintf( szFormat, "%%%dd", nWidth );
+ sprintf(szSField, szFormat, (int) *((double *) pValue) );
+ if( (int)strlen(szSField) > psDBF->panFieldSize[iField] )
+ {
+ szSField[psDBF->panFieldSize[iField]] = '\0';
+ nRetResult = FALSE;
+ }
+
+ strncpy((char *) (pabyRec+psDBF->panFieldOffset[iField]),
+ szSField, strlen(szSField) );
+ }
+ else
+ {
+ int nWidth = psDBF->panFieldSize[iField];
+
+ if( (int) sizeof(szSField)-2 < nWidth )
+ nWidth = sizeof(szSField)-2;
+
+ sprintf( szFormat, "%%%d.%df",
+ nWidth, psDBF->panFieldDecimals[iField] );
+ sprintf(szSField, szFormat, *((double *) pValue) );
+ if( (int) strlen(szSField) > psDBF->panFieldSize[iField] )
+ {
+ szSField[psDBF->panFieldSize[iField]] = '\0';
+ nRetResult = FALSE;
+ }
+ strncpy((char *) (pabyRec+psDBF->panFieldOffset[iField]),
+ szSField, strlen(szSField) );
+ }
+ break;
+
+ case 'L':
+ if (psDBF->panFieldSize[iField] >= 1 &&
+ (*(char*)pValue == 'F' || *(char*)pValue == 'T'))
+ *(pabyRec+psDBF->panFieldOffset[iField]) = *(char*)pValue;
+ break;
+
+ default:
+ if( (int) strlen((char *) pValue) > psDBF->panFieldSize[iField] )
+ {
+ j = psDBF->panFieldSize[iField];
+ nRetResult = FALSE;
+ }
+ else
+ {
+ memset( pabyRec+psDBF->panFieldOffset[iField], ' ',
+ psDBF->panFieldSize[iField] );
+ j = strlen((char *) pValue);
+ }
+
+ strncpy((char *) (pabyRec+psDBF->panFieldOffset[iField]),
+ (char *) pValue, j );
+ break;
+ }
+
+ return( nRetResult );
+}
+
+/************************************************************************/
+/* DBFWriteAttributeDirectly() */
+/* */
+/* Write an attribute record to the file, but without any */
+/* reformatting based on type. The provided buffer is written */
+/* as is to the field position in the record. */
+/************************************************************************/
+
+int SHPAPI_CALL
+DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField,
+ void * pValue )
+
+{
+ int i, j;
+ unsigned char *pabyRec;
+
+/* -------------------------------------------------------------------- */
+/* Is this a valid record? */
+/* -------------------------------------------------------------------- */
+ if( hEntity < 0 || hEntity > psDBF->nRecords )
+ return( FALSE );
+
+ if( psDBF->bNoHeader )
+ DBFWriteHeader(psDBF);
+
+/* -------------------------------------------------------------------- */
+/* Is this a brand new record? */
+/* -------------------------------------------------------------------- */
+ if( hEntity == psDBF->nRecords )
+ {
+ if( !DBFFlushRecord( psDBF ) )
+ return FALSE;
+
+ psDBF->nRecords++;
+ for( i = 0; i < psDBF->nRecordLength; i++ )
+ psDBF->pszCurrentRecord[i] = ' ';
+
+ psDBF->nCurrentRecord = hEntity;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Is this an existing record, but different than the last one */
+/* we accessed? */
+/* -------------------------------------------------------------------- */
+ if( !DBFLoadRecord( psDBF, hEntity ) )
+ return FALSE;
+
+ pabyRec = (unsigned char *) psDBF->pszCurrentRecord;
+
+/* -------------------------------------------------------------------- */
+/* Assign all the record fields. */
+/* -------------------------------------------------------------------- */
+ if( (int)strlen((char *) pValue) > psDBF->panFieldSize[iField] )
+ j = psDBF->panFieldSize[iField];
+ else
+ {
+ memset( pabyRec+psDBF->panFieldOffset[iField], ' ',
+ psDBF->panFieldSize[iField] );
+ j = strlen((char *) pValue);
+ }
+
+ strncpy((char *) (pabyRec+psDBF->panFieldOffset[iField]),
+ (char *) pValue, j );
+
+ psDBF->bCurrentRecordModified = TRUE;
+ psDBF->bUpdated = TRUE;
+
+ return( TRUE );
+}
+
+/************************************************************************/
+/* DBFWriteDoubleAttribute() */
+/* */
+/* Write a double attribute. */
+/************************************************************************/
+
+int SHPAPI_CALL
+DBFWriteDoubleAttribute( DBFHandle psDBF, int iRecord, int iField,
+ double dValue )
+
+{
+ return( DBFWriteAttribute( psDBF, iRecord, iField, (void *) &dValue ) );
+}
+
+/************************************************************************/
+/* DBFWriteIntegerAttribute() */
+/* */
+/* Write a integer attribute. */
+/************************************************************************/
+
+int SHPAPI_CALL
+DBFWriteIntegerAttribute( DBFHandle psDBF, int iRecord, int iField,
+ int nValue )
+
+{
+ double dValue = nValue;
+
+ return( DBFWriteAttribute( psDBF, iRecord, iField, (void *) &dValue ) );
+}
+
+/************************************************************************/
+/* DBFWriteStringAttribute() */
+/* */
+/* Write a string attribute. */
+/************************************************************************/
+
+int SHPAPI_CALL
+DBFWriteStringAttribute( DBFHandle psDBF, int iRecord, int iField,
+ const char * pszValue )
+
+{
+ return( DBFWriteAttribute( psDBF, iRecord, iField, (void *) pszValue ) );
+}
+
+/************************************************************************/
+/* DBFWriteNULLAttribute() */
+/* */
+/* Write a string attribute. */
+/************************************************************************/
+
+int SHPAPI_CALL
+DBFWriteNULLAttribute( DBFHandle psDBF, int iRecord, int iField )
+
+{
+ return( DBFWriteAttribute( psDBF, iRecord, iField, NULL ) );
+}
+
+/************************************************************************/
+/* DBFWriteLogicalAttribute() */
+/* */
+/* Write a logical attribute. */
+/************************************************************************/
+
+int SHPAPI_CALL
+DBFWriteLogicalAttribute( DBFHandle psDBF, int iRecord, int iField,
+ const char lValue)
+
+{
+ return( DBFWriteAttribute( psDBF, iRecord, iField, (void *) (&lValue) ) );
+}
+
+/************************************************************************/
+/* DBFWriteTuple() */
+/* */
+/* Write an attribute record to the file. */
+/************************************************************************/
+
+int SHPAPI_CALL
+DBFWriteTuple(DBFHandle psDBF, int hEntity, void * pRawTuple )
+
+{
+ int i;
+ unsigned char *pabyRec;
+
+/* -------------------------------------------------------------------- */
+/* Is this a valid record? */
+/* -------------------------------------------------------------------- */
+ if( hEntity < 0 || hEntity > psDBF->nRecords )
+ return( FALSE );
+
+ if( psDBF->bNoHeader )
+ DBFWriteHeader(psDBF);
+
+/* -------------------------------------------------------------------- */
+/* Is this a brand new record? */
+/* -------------------------------------------------------------------- */
+ if( hEntity == psDBF->nRecords )
+ {
+ if( !DBFFlushRecord( psDBF ) )
+ return FALSE;
+
+ psDBF->nRecords++;
+ for( i = 0; i < psDBF->nRecordLength; i++ )
+ psDBF->pszCurrentRecord[i] = ' ';
+
+ psDBF->nCurrentRecord = hEntity;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Is this an existing record, but different than the last one */
+/* we accessed? */
+/* -------------------------------------------------------------------- */
+ if( !DBFLoadRecord( psDBF, hEntity ) )
+ return FALSE;
+
+ pabyRec = (unsigned char *) psDBF->pszCurrentRecord;
+
+ memcpy ( pabyRec, pRawTuple, psDBF->nRecordLength );
+
+ psDBF->bCurrentRecordModified = TRUE;
+ psDBF->bUpdated = TRUE;
+
+ return( TRUE );
+}
+
+/************************************************************************/
+/* DBFReadTuple() */
+/* */
+/* Read a complete record. Note that the result is only valid */
+/* till the next record read for any reason. */
+/************************************************************************/
+
+const char SHPAPI_CALL1(*)
+DBFReadTuple(DBFHandle psDBF, int hEntity )
+
+{
+ if( hEntity < 0 || hEntity >= psDBF->nRecords )
+ return( NULL );
+
+ if( !DBFLoadRecord( psDBF, hEntity ) )
+ return NULL;
+
+ return (const char *) psDBF->pszCurrentRecord;
+}
+
+/************************************************************************/
+/* DBFCloneEmpty() */
+/* */
+/* Read one of the attribute fields of a record. */
+/************************************************************************/
+
+DBFHandle SHPAPI_CALL
+DBFCloneEmpty(DBFHandle psDBF, const char * pszFilename )
+{
+ DBFHandle newDBF;
+
+ newDBF = DBFCreateEx ( pszFilename, psDBF->pszCodePage );
+ if ( newDBF == NULL ) return ( NULL );
+
+ newDBF->nFields = psDBF->nFields;
+ newDBF->nRecordLength = psDBF->nRecordLength;
+ newDBF->nHeaderLength = psDBF->nHeaderLength;
+
+ newDBF->pszHeader = (char *) malloc ( newDBF->nHeaderLength );
+ memcpy ( newDBF->pszHeader, psDBF->pszHeader, newDBF->nHeaderLength );
+
+ newDBF->panFieldOffset = (int *) malloc ( sizeof(int) * psDBF->nFields );
+ memcpy ( newDBF->panFieldOffset, psDBF->panFieldOffset, sizeof(int) * psDBF->nFields );
+ newDBF->panFieldSize = (int *) malloc ( sizeof(int) * psDBF->nFields );
+ memcpy ( newDBF->panFieldSize, psDBF->panFieldSize, sizeof(int) * psDBF->nFields );
+ newDBF->panFieldDecimals = (int *) malloc ( sizeof(int) * psDBF->nFields );
+ memcpy ( newDBF->panFieldDecimals, psDBF->panFieldDecimals, sizeof(int) * psDBF->nFields );
+ newDBF->pachFieldType = (char *) malloc ( sizeof(char) * psDBF->nFields );
+ memcpy ( newDBF->pachFieldType, psDBF->pachFieldType, sizeof(char)*psDBF->nFields );
+
+ newDBF->bNoHeader = TRUE;
+ newDBF->bUpdated = TRUE;
+
+ DBFWriteHeader ( newDBF );
+ DBFClose ( newDBF );
+
+ newDBF = DBFOpen ( pszFilename, "rb+" );
+
+ return ( newDBF );
+}
+
+/************************************************************************/
+/* DBFGetNativeFieldType() */
+/* */
+/* Return the DBase field type for the specified field. */
+/* */
+/* Value can be one of: 'C' (String), 'D' (Date), 'F' (Float), */
+/* 'N' (Numeric, with or without decimal), */
+/* 'L' (Logical), */
+/* 'M' (Memo: 10 digits .DBT block ptr) */
+/************************************************************************/
+
+char SHPAPI_CALL
+DBFGetNativeFieldType( DBFHandle psDBF, int iField )
+
+{
+ if( iField >=0 && iField < psDBF->nFields )
+ return psDBF->pachFieldType[iField];
+
+ return ' ';
+}
+
+/************************************************************************/
+/* str_to_upper() */
+/************************************************************************/
+
+static void str_to_upper (char *string)
+{
+ int len;
+ short i = -1;
+
+ len = strlen (string);
+
+ while (++i < len)
+ if (isalpha(string[i]) && islower(string[i]))
+ string[i] = (char) toupper ((int)string[i]);
+}
+
+/************************************************************************/
+/* DBFGetFieldIndex() */
+/* */
+/* Get the index number for a field in a .dbf file. */
+/* */
+/* Contributed by Jim Matthews. */
+/************************************************************************/
+
+int SHPAPI_CALL
+DBFGetFieldIndex(DBFHandle psDBF, const char *pszFieldName)
+
+{
+ char name[12], name1[12], name2[12];
+ int i;
+
+ strncpy(name1, pszFieldName,11);
+ name1[11] = '\0';
+ str_to_upper(name1);
+
+ for( i = 0; i < DBFGetFieldCount(psDBF); i++ )
+ {
+ DBFGetFieldInfo( psDBF, i, name, NULL, NULL );
+ strncpy(name2,name,11);
+ str_to_upper(name2);
+
+ if(!strncmp(name1,name2,10))
+ return(i);
+ }
+ return(-1);
+}
+
+/************************************************************************/
+/* DBFIsRecordDeleted() */
+/* */
+/* Returns TRUE if the indicated record is deleted, otherwise */
+/* it returns FALSE. */
+/************************************************************************/
+
+int SHPAPI_CALL DBFIsRecordDeleted( DBFHandle psDBF, int iShape )
+
+{
+/* -------------------------------------------------------------------- */
+/* Verify selection. */
+/* -------------------------------------------------------------------- */
+ if( iShape < 0 || iShape >= psDBF->nRecords )
+ return TRUE;
+
+/* -------------------------------------------------------------------- */
+/* Have we read the record? */
+/* -------------------------------------------------------------------- */
+ if( !DBFLoadRecord( psDBF, iShape ) )
+ return FALSE;
+
+/* -------------------------------------------------------------------- */
+/* '*' means deleted. */
+/* -------------------------------------------------------------------- */
+ return psDBF->pszCurrentRecord[0] == '*';
+}
+
+/************************************************************************/
+/* DBFMarkRecordDeleted() */
+/************************************************************************/
+
+int SHPAPI_CALL DBFMarkRecordDeleted( DBFHandle psDBF, int iShape,
+ int bIsDeleted )
+
+{
+ char chNewFlag;
+
+/* -------------------------------------------------------------------- */
+/* Verify selection. */
+/* -------------------------------------------------------------------- */
+ if( iShape < 0 || iShape >= psDBF->nRecords )
+ return FALSE;
+
+/* -------------------------------------------------------------------- */
+/* Is this an existing record, but different than the last one */
+/* we accessed? */
+/* -------------------------------------------------------------------- */
+ if( !DBFLoadRecord( psDBF, iShape ) )
+ return FALSE;
+
+/* -------------------------------------------------------------------- */
+/* Assign value, marking record as dirty if it changes. */
+/* -------------------------------------------------------------------- */
+ if( bIsDeleted )
+ chNewFlag = '*';
+ else
+ chNewFlag = ' ';
+
+ if( psDBF->pszCurrentRecord[0] != chNewFlag )
+ {
+ psDBF->bCurrentRecordModified = TRUE;
+ psDBF->bUpdated = TRUE;
+ psDBF->pszCurrentRecord[0] = chNewFlag;
+ }
+
+ return TRUE;
+}
+
+/************************************************************************/
+/* DBFGetCodePage */
+/************************************************************************/
+
+const char SHPAPI_CALL1(*)
+DBFGetCodePage(DBFHandle psDBF )
+{
+ if( psDBF == NULL )
+ return NULL;
+ return psDBF->pszCodePage;
+}
+
+/************************************************************************/
+/* DBFDeleteField() */
+/* */
+/* Remove a field from a .dbf file */
+/************************************************************************/
+
+int SHPAPI_CALL
+DBFDeleteField(DBFHandle psDBF, int iField)
+{
+ int nOldRecordLength, nOldHeaderLength;
+ int nDeletedFieldOffset, nDeletedFieldSize;
+ SAOffset nRecordOffset;
+ char* pszRecord;
+ int i, iRecord;
+
+ if (iField < 0 || iField >= psDBF->nFields)
+ return FALSE;
+
+ /* make sure that everything is written in .dbf */
+ if( !DBFFlushRecord( psDBF ) )
+ return FALSE;
+
+ /* get information about field to be deleted */
+ nOldRecordLength = psDBF->nRecordLength;
+ nOldHeaderLength = psDBF->nHeaderLength;
+ nDeletedFieldOffset = psDBF->panFieldOffset[iField];
+ nDeletedFieldSize = psDBF->panFieldSize[iField];
+
+ /* update fields info */
+ for (i = iField + 1; i < psDBF->nFields; i++)
+ {
+ psDBF->panFieldOffset[i-1] = psDBF->panFieldOffset[i] - nDeletedFieldSize;
+ psDBF->panFieldSize[i-1] = psDBF->panFieldSize[i];
+ psDBF->panFieldDecimals[i-1] = psDBF->panFieldDecimals[i];
+ psDBF->pachFieldType[i-1] = psDBF->pachFieldType[i];
+ }
+
+ /* resize fields arrays */
+ psDBF->nFields--;
+
+ psDBF->panFieldOffset = (int *)
+ SfRealloc( psDBF->panFieldOffset, sizeof(int) * psDBF->nFields );
+
+ psDBF->panFieldSize = (int *)
+ SfRealloc( psDBF->panFieldSize, sizeof(int) * psDBF->nFields );
+
+ psDBF->panFieldDecimals = (int *)
+ SfRealloc( psDBF->panFieldDecimals, sizeof(int) * psDBF->nFields );
+
+ psDBF->pachFieldType = (char *)
+ SfRealloc( psDBF->pachFieldType, sizeof(char) * psDBF->nFields );
+
+ /* update header information */
+ psDBF->nHeaderLength -= 32;
+ psDBF->nRecordLength -= nDeletedFieldSize;
+
+ /* overwrite field information in header */
+ memcpy(psDBF->pszHeader + iField*32,
+ psDBF->pszHeader + (iField+1)*32,
+ sizeof(char) * (psDBF->nFields - iField)*32);
+
+ psDBF->pszHeader = (char *) SfRealloc(psDBF->pszHeader,psDBF->nFields*32);
+
+ /* update size of current record appropriately */
+ psDBF->pszCurrentRecord = (char *) SfRealloc(psDBF->pszCurrentRecord,
+ psDBF->nRecordLength);
+
+ /* we're done if we're dealing with not yet created .dbf */
+ if ( psDBF->bNoHeader && psDBF->nRecords == 0 )
+ return TRUE;
+
+ /* force update of header with new header and record length */
+ psDBF->bNoHeader = TRUE;
+ DBFUpdateHeader( psDBF );
+
+ /* alloc record */
+ pszRecord = (char *) malloc(sizeof(char) * nOldRecordLength);
+
+ /* shift records to their new positions */
+ for (iRecord = 0; iRecord < psDBF->nRecords; iRecord++)
+ {
+ nRecordOffset =
+ nOldRecordLength * (SAOffset) iRecord + nOldHeaderLength;
+
+ /* load record */
+ psDBF->sHooks.FSeek( psDBF->fp, nRecordOffset, 0 );
+ psDBF->sHooks.FRead( pszRecord, nOldRecordLength, 1, psDBF->fp );
+
+ nRecordOffset =
+ psDBF->nRecordLength * (SAOffset) iRecord + psDBF->nHeaderLength;
+
+ /* move record in two steps */
+ psDBF->sHooks.FSeek( psDBF->fp, nRecordOffset, 0 );
+ psDBF->sHooks.FWrite( pszRecord, nDeletedFieldOffset, 1, psDBF->fp );
+ psDBF->sHooks.FWrite( pszRecord + nDeletedFieldOffset + nDeletedFieldSize,
+ nOldRecordLength - nDeletedFieldOffset - nDeletedFieldSize,
+ 1, psDBF->fp );
+
+ }
+
+ /* TODO: truncate file */
+
+ /* free record */
+ free(pszRecord);
+
+ return TRUE;
+}
diff --git a/map/shapefile/shapefil.h b/map/shapefile/shapefil.h
new file mode 100644
index 00000000..059244b0
--- /dev/null
+++ b/map/shapefile/shapefil.h
@@ -0,0 +1,609 @@
+#ifndef SHAPEFILE_H_INCLUDED
+#define SHAPEFILE_H_INCLUDED
+
+/******************************************************************************
+ * $Id: shapefil.h 15715 2008-11-12 15:15:21Z warmerdam $
+ *
+ * Project: Shapelib
+ * Purpose: Primary include file for Shapelib.
+ * Author: Frank Warmerdam, warmerdam@pobox.com
+ *
+ ******************************************************************************
+ * Copyright (c) 1999, Frank Warmerdam
+ *
+ * This software is available under the following "MIT Style" license,
+ * or at the option of the licensee under the LGPL (see LICENSE.LGPL). This
+ * option is discussed in more detail in shapelib.html.
+ *
+ * --
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ******************************************************************************
+ *
+ * $Log: shapefil.h,v $
+ * Revision 1.46 2008/11/12 14:28:15 fwarmerdam
+ * DBFCreateField() now works on files with records
+ *
+ * Revision 1.45 2008/11/11 17:47:10 fwarmerdam
+ * added DBFDeleteField() function
+ *
+ * Revision 1.44 2008/01/16 20:05:19 bram
+ * Add file hooks that accept UTF-8 encoded filenames on some platforms. Use SASetupUtf8Hooks
+ * tosetup the hooks and check SHPAPI_UTF8_HOOKS for its availability. Currently, this
+ * is only available on the Windows platform that decodes the UTF-8 filenames to wide
+ * character strings and feeds them to _wfopen and _wremove.
+ *
+ * Revision 1.43 2008/01/10 16:35:30 fwarmerdam
+ * avoid _ prefix on #defined symbols (bug 1840)
+ *
+ * Revision 1.42 2007/12/18 18:28:14 bram
+ * - create hook for client specific atof (bugzilla ticket 1615)
+ * - check for NULL handle before closing cpCPG file, and close after reading.
+ *
+ * Revision 1.41 2007/12/15 20:25:32 bram
+ * dbfopen.c now reads the Code Page information from the DBF file, and exports
+ * this information as a string through the DBFGetCodePage function. This is
+ * either the number from the LDID header field ("LDID/<number>") or as the
+ * content of an accompanying .CPG file. When creating a DBF file, the code can
+ * be set using DBFCreateEx.
+ *
+ * Revision 1.40 2007/12/06 07:00:25 fwarmerdam
+ * dbfopen now using SAHooks for fileio
+ *
+ * Revision 1.39 2007/12/04 20:37:56 fwarmerdam
+ * preliminary implementation of hooks api for io and errors
+ *
+ * Revision 1.38 2007/11/21 22:39:56 fwarmerdam
+ * close shx file in readonly mode (GDAL #1956)
+ *
+ * Revision 1.37 2007/10/27 03:31:14 fwarmerdam
+ * limit default depth of tree to 12 levels (gdal ticket #1594)
+ *
+ * Revision 1.36 2007/09/10 23:33:15 fwarmerdam
+ * Upstreamed support for visibility flag in SHPAPI_CALL for the needs
+ * of GDAL (gdal ticket #1810).
+ *
+ * Revision 1.35 2007/09/03 19:48:10 fwarmerdam
+ * move DBFReadAttribute() static dDoubleField into dbfinfo
+ *
+ * Revision 1.34 2006/06/17 15:33:32 fwarmerdam
+ * added pszWorkField - bug 1202 (rso)
+ *
+ * Revision 1.33 2006/02/15 01:14:30 fwarmerdam
+ * added DBFAddNativeFieldType
+ *
+ * Revision 1.32 2006/01/26 15:07:32 fwarmerdam
+ * add bMeasureIsUsed flag from Craig Bruce: Bug 1249
+ *
+ * Revision 1.31 2006/01/05 01:27:27 fwarmerdam
+ * added dbf deletion mark/fetch
+ *
+ * Revision 1.30 2005/01/03 22:30:13 fwarmerdam
+ * added support for saved quadtrees
+ *
+ * Revision 1.29 2004/09/26 20:09:35 fwarmerdam
+ * avoid rcsid warnings
+ *
+ * Revision 1.28 2003/12/29 06:02:18 fwarmerdam
+ * added cpl_error.h option
+ *
+ * Revision 1.27 2003/04/21 18:30:37 warmerda
+ * added header write/update public methods
+ *
+ * Revision 1.26 2002/09/29 00:00:08 warmerda
+ * added FTLogical and logical attribute read/write calls
+ *
+ * Revision 1.25 2002/05/07 13:46:30 warmerda
+ * added DBFWriteAttributeDirectly().
+ *
+ * Revision 1.24 2002/04/10 16:59:54 warmerda
+ * added SHPRewindObject
+ *
+ * Revision 1.23 2002/01/15 14:36:07 warmerda
+ * updated email address
+ *
+ * Revision 1.22 2002/01/15 14:32:00 warmerda
+ * try to improve SHPAPI_CALL docs
+ */
+
+#include <stdio.h>
+
+#ifdef USE_DBMALLOC
+#include <dbmalloc.h>
+#endif
+
+#ifdef USE_CPL
+#include "cpl_error.h"
+#include "cpl_vsi.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/************************************************************************/
+/* Configuration options. */
+/************************************************************************/
+
+/* -------------------------------------------------------------------- */
+/* Should the DBFReadStringAttribute() strip leading and */
+/* trailing white space? */
+/* -------------------------------------------------------------------- */
+#define TRIM_DBF_WHITESPACE
+
+/* -------------------------------------------------------------------- */
+/* Should we write measure values to the Multipatch object? */
+/* Reportedly ArcView crashes if we do write it, so for now it */
+/* is disabled. */
+/* -------------------------------------------------------------------- */
+#define DISABLE_MULTIPATCH_MEASURE
+
+/* -------------------------------------------------------------------- */
+/* SHPAPI_CALL */
+/* */
+/* The following two macros are present to allow forcing */
+/* various calling conventions on the Shapelib API. */
+/* */
+/* To force __stdcall conventions (needed to call Shapelib */
+/* from Visual Basic and/or Dephi I believe) the makefile could */
+/* be modified to define: */
+/* */
+/* /DSHPAPI_CALL=__stdcall */
+/* */
+/* If it is desired to force export of the Shapelib API without */
+/* using the shapelib.def file, use the following definition. */
+/* */
+/* /DSHAPELIB_DLLEXPORT */
+/* */
+/* To get both at once it will be necessary to hack this */
+/* include file to define: */
+/* */
+/* #define SHPAPI_CALL __declspec(dllexport) __stdcall */
+/* #define SHPAPI_CALL1 __declspec(dllexport) * __stdcall */
+/* */
+/* The complexity of the situtation is partly caused by the */
+/* peculiar requirement of Visual C++ that __stdcall appear */
+/* after any "*"'s in the return value of a function while the */
+/* __declspec(dllexport) must appear before them. */
+/* -------------------------------------------------------------------- */
+
+#ifdef SHAPELIB_DLLEXPORT
+# define SHPAPI_CALL __declspec(dllexport)
+# define SHPAPI_CALL1(x) __declspec(dllexport) x
+#endif
+
+#ifndef SHPAPI_CALL
+# if defined(USE_GCC_VISIBILITY_FLAG)
+# define SHPAPI_CALL __attribute__ ((visibility("default")))
+# define SHPAPI_CALL1(x) __attribute__ ((visibility("default"))) x
+# else
+# define SHPAPI_CALL
+# endif
+#endif
+
+#ifndef SHPAPI_CALL1
+# define SHPAPI_CALL1(x) x SHPAPI_CALL
+#endif
+
+/* -------------------------------------------------------------------- */
+/* Macros for controlling CVSID and ensuring they don't appear */
+/* as unreferenced variables resulting in lots of warnings. */
+/* -------------------------------------------------------------------- */
+#ifndef DISABLE_CVSID
+# define SHP_CVSID(string) static char cpl_cvsid[] = string; \
+static char *cvsid_aw() { return( cvsid_aw() ? ((char *) NULL) : cpl_cvsid ); }
+#else
+# define SHP_CVSID(string)
+#endif
+
+/* -------------------------------------------------------------------- */
+/* On some platforms, additional file IO hooks are defined that */
+/* UTF-8 encoded filenames Unicode filenames */
+/* -------------------------------------------------------------------- */
+#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+# define SHPAPI_WINDOWS
+# define SHPAPI_UTF8_HOOKS
+#endif
+
+/* -------------------------------------------------------------------- */
+/* IO/Error hook functions. */
+/* -------------------------------------------------------------------- */
+typedef int *SAFile;
+
+#ifndef SAOffset
+typedef unsigned long SAOffset;
+#endif
+
+typedef struct {
+ SAFile (*FOpen) ( const char *filename, const char *access);
+ SAOffset (*FRead) ( void *p, SAOffset size, SAOffset nmemb, SAFile file);
+ SAOffset (*FWrite)( void *p, SAOffset size, SAOffset nmemb, SAFile file);
+ SAOffset (*FSeek) ( SAFile file, SAOffset offset, int whence );
+ SAOffset (*FTell) ( SAFile file );
+ int (*FFlush)( SAFile file );
+ int (*FClose)( SAFile file );
+ int (*Remove) ( const char *filename );
+
+ void (*Error) ( const char *message );
+ double (*Atof) ( const char *str );
+} SAHooks;
+
+void SHPAPI_CALL SASetupDefaultHooks( SAHooks *psHooks );
+#ifdef SHPAPI_UTF8_HOOKS
+void SHPAPI_CALL SASetupUtf8Hooks( SAHooks *psHooks );
+#endif
+
+/************************************************************************/
+/* SHP Support. */
+/************************************************************************/
+typedef struct
+{
+ SAHooks sHooks;
+
+ SAFile fpSHP;
+ SAFile fpSHX;
+
+ int nShapeType; /* SHPT_* */
+
+ int nFileSize; /* SHP file */
+
+ int nRecords;
+ int nMaxRecords;
+ int *panRecOffset;
+ int *panRecSize;
+
+ double adBoundsMin[4];
+ double adBoundsMax[4];
+
+ int bUpdated;
+
+ unsigned char *pabyRec;
+ int nBufSize;
+} SHPInfo;
+
+typedef SHPInfo * SHPHandle;
+
+/* -------------------------------------------------------------------- */
+/* Shape types (nSHPType) */
+/* -------------------------------------------------------------------- */
+#define SHPT_NULL 0
+#define SHPT_POINT 1
+#define SHPT_ARC 3
+#define SHPT_POLYGON 5
+#define SHPT_MULTIPOINT 8
+#define SHPT_POINTZ 11
+#define SHPT_ARCZ 13
+#define SHPT_POLYGONZ 15
+#define SHPT_MULTIPOINTZ 18
+#define SHPT_POINTM 21
+#define SHPT_ARCM 23
+#define SHPT_POLYGONM 25
+#define SHPT_MULTIPOINTM 28
+#define SHPT_MULTIPATCH 31
+
+
+/* -------------------------------------------------------------------- */
+/* Part types - everything but SHPT_MULTIPATCH just uses */
+/* SHPP_RING. */
+/* -------------------------------------------------------------------- */
+
+#define SHPP_TRISTRIP 0
+#define SHPP_TRIFAN 1
+#define SHPP_OUTERRING 2
+#define SHPP_INNERRING 3
+#define SHPP_FIRSTRING 4
+#define SHPP_RING 5
+
+/* -------------------------------------------------------------------- */
+/* SHPObject - represents on shape (without attributes) read */
+/* from the .shp file. */
+/* -------------------------------------------------------------------- */
+typedef struct
+{
+ int nSHPType;
+
+ int nShapeId; /* -1 is unknown/unassigned */
+
+ int nParts;
+ int *panPartStart;
+ int *panPartType;
+
+ int nVertices;
+ double *padfX;
+ double *padfY;
+ double *padfZ;
+ double *padfM;
+
+ double dfXMin;
+ double dfYMin;
+ double dfZMin;
+ double dfMMin;
+
+ double dfXMax;
+ double dfYMax;
+ double dfZMax;
+ double dfMMax;
+
+ int bMeasureIsUsed;
+} SHPObject;
+
+/* -------------------------------------------------------------------- */
+/* SHP API Prototypes */
+/* -------------------------------------------------------------------- */
+
+/* If pszAccess is read-only, the fpSHX field of the returned structure */
+/* will be NULL as it is not necessary to keep the SHX file open */
+SHPHandle SHPAPI_CALL
+ SHPOpen( const char * pszShapeFile, const char * pszAccess );
+SHPHandle SHPAPI_CALL
+ SHPOpenLL( const char *pszShapeFile, const char *pszAccess,
+ SAHooks *psHooks );
+SHPHandle SHPAPI_CALL
+ SHPCreate( const char * pszShapeFile, int nShapeType );
+SHPHandle SHPAPI_CALL
+ SHPCreateLL( const char * pszShapeFile, int nShapeType,
+ SAHooks *psHooks );
+void SHPAPI_CALL
+ SHPGetInfo( SHPHandle hSHP, int * pnEntities, int * pnShapeType,
+ double * padfMinBound, double * padfMaxBound );
+
+SHPObject SHPAPI_CALL1(*)
+ SHPReadObject( SHPHandle hSHP, int iShape );
+int SHPAPI_CALL
+ SHPWriteObject( SHPHandle hSHP, int iShape, SHPObject * psObject );
+
+void SHPAPI_CALL
+ SHPDestroyObject( SHPObject * psObject );
+void SHPAPI_CALL
+ SHPComputeExtents( SHPObject * psObject );
+SHPObject SHPAPI_CALL1(*)
+ SHPCreateObject( int nSHPType, int nShapeId, int nParts,
+ const int * panPartStart, const int * panPartType,
+ int nVertices,
+ const double * padfX, const double * padfY,
+ const double * padfZ, const double * padfM );
+SHPObject SHPAPI_CALL1(*)
+ SHPCreateSimpleObject( int nSHPType, int nVertices,
+ const double * padfX,
+ const double * padfY,
+ const double * padfZ );
+
+int SHPAPI_CALL
+ SHPRewindObject( SHPHandle hSHP, SHPObject * psObject );
+
+void SHPAPI_CALL SHPClose( SHPHandle hSHP );
+void SHPAPI_CALL SHPWriteHeader( SHPHandle hSHP );
+
+const char SHPAPI_CALL1(*)
+ SHPTypeName( int nSHPType );
+const char SHPAPI_CALL1(*)
+ SHPPartTypeName( int nPartType );
+
+/* -------------------------------------------------------------------- */
+/* Shape quadtree indexing API. */
+/* -------------------------------------------------------------------- */
+
+/* this can be two or four for binary or quad tree */
+#define MAX_SUBNODE 4
+
+/* upper limit of tree levels for automatic estimation */
+#define MAX_DEFAULT_TREE_DEPTH 12
+
+typedef struct shape_tree_node
+{
+ /* region covered by this node */
+ double adfBoundsMin[4];
+ double adfBoundsMax[4];
+
+ /* list of shapes stored at this node. The papsShapeObj pointers
+ or the whole list can be NULL */
+ int nShapeCount;
+ int *panShapeIds;
+ SHPObject **papsShapeObj;
+
+ int nSubNodes;
+ struct shape_tree_node *apsSubNode[MAX_SUBNODE];
+
+} SHPTreeNode;
+
+typedef struct
+{
+ SHPHandle hSHP;
+
+ int nMaxDepth;
+ int nDimension;
+ int nTotalCount;
+
+ SHPTreeNode *psRoot;
+} SHPTree;
+
+SHPTree SHPAPI_CALL1(*)
+ SHPCreateTree( SHPHandle hSHP, int nDimension, int nMaxDepth,
+ double *padfBoundsMin, double *padfBoundsMax );
+void SHPAPI_CALL
+ SHPDestroyTree( SHPTree * hTree );
+
+int SHPAPI_CALL
+ SHPWriteTree( SHPTree *hTree, const char * pszFilename );
+SHPTree SHPAPI_CALL
+ SHPReadTree( const char * pszFilename );
+
+int SHPAPI_CALL
+ SHPTreeAddObject( SHPTree * hTree, SHPObject * psObject );
+int SHPAPI_CALL
+ SHPTreeAddShapeId( SHPTree * hTree, SHPObject * psObject );
+int SHPAPI_CALL
+ SHPTreeRemoveShapeId( SHPTree * hTree, int nShapeId );
+
+void SHPAPI_CALL
+ SHPTreeTrimExtraNodes( SHPTree * hTree );
+
+int SHPAPI_CALL1(*)
+ SHPTreeFindLikelyShapes( SHPTree * hTree,
+ double * padfBoundsMin,
+ double * padfBoundsMax,
+ int * );
+int SHPAPI_CALL
+ SHPCheckBoundsOverlap( double *, double *, double *, double *, int );
+
+int SHPAPI_CALL1(*)
+SHPSearchDiskTree( FILE *fp,
+ double *padfBoundsMin, double *padfBoundsMax,
+ int *pnShapeCount );
+
+/************************************************************************/
+/* DBF Support. */
+/************************************************************************/
+typedef struct
+{
+ SAHooks sHooks;
+
+ SAFile fp;
+
+ int nRecords;
+
+ int nRecordLength;
+ int nHeaderLength;
+ int nFields;
+ int *panFieldOffset;
+ int *panFieldSize;
+ int *panFieldDecimals;
+ char *pachFieldType;
+
+ char *pszHeader;
+
+ int nCurrentRecord;
+ int bCurrentRecordModified;
+ char *pszCurrentRecord;
+
+ int nWorkFieldLength;
+ char *pszWorkField;
+
+ int bNoHeader;
+ int bUpdated;
+
+ double dfDoubleField;
+
+ int iLanguageDriver;
+ char *pszCodePage;
+} DBFInfo;
+
+typedef DBFInfo * DBFHandle;
+
+typedef enum {
+ FTString,
+ FTInteger,
+ FTDouble,
+ FTLogical,
+ FTInvalid
+} DBFFieldType;
+
+#define XBASE_FLDHDR_SZ 32
+
+
+DBFHandle SHPAPI_CALL
+ DBFOpen( const char * pszDBFFile, const char * pszAccess );
+DBFHandle SHPAPI_CALL
+ DBFOpenLL( const char * pszDBFFile, const char * pszAccess,
+ SAHooks *psHooks );
+DBFHandle SHPAPI_CALL
+ DBFCreate( const char * pszDBFFile );
+DBFHandle SHPAPI_CALL
+ DBFCreateEx( const char * pszDBFFile, const char * pszCodePage );
+DBFHandle SHPAPI_CALL
+ DBFCreateLL( const char * pszDBFFile, const char * pszCodePage, SAHooks *psHooks );
+
+int SHPAPI_CALL
+ DBFGetFieldCount( DBFHandle psDBF );
+int SHPAPI_CALL
+ DBFGetRecordCount( DBFHandle psDBF );
+int SHPAPI_CALL
+ DBFAddField( DBFHandle hDBF, const char * pszFieldName,
+ DBFFieldType eType, int nWidth, int nDecimals );
+
+int SHPAPI_CALL
+ DBFAddNativeFieldType( DBFHandle hDBF, const char * pszFieldName,
+ char chType, int nWidth, int nDecimals );
+
+int SHPAPI_CALL
+ DBFDeleteField( DBFHandle hDBF, int iField );
+
+DBFFieldType SHPAPI_CALL
+ DBFGetFieldInfo( DBFHandle psDBF, int iField,
+ char * pszFieldName, int * pnWidth, int * pnDecimals );
+
+int SHPAPI_CALL
+ DBFGetFieldIndex(DBFHandle psDBF, const char *pszFieldName);
+
+int SHPAPI_CALL
+ DBFReadIntegerAttribute( DBFHandle hDBF, int iShape, int iField );
+double SHPAPI_CALL
+ DBFReadDoubleAttribute( DBFHandle hDBF, int iShape, int iField );
+const char SHPAPI_CALL1(*)
+ DBFReadStringAttribute( DBFHandle hDBF, int iShape, int iField );
+const char SHPAPI_CALL1(*)
+ DBFReadLogicalAttribute( DBFHandle hDBF, int iShape, int iField );
+int SHPAPI_CALL
+ DBFIsAttributeNULL( DBFHandle hDBF, int iShape, int iField );
+
+int SHPAPI_CALL
+ DBFWriteIntegerAttribute( DBFHandle hDBF, int iShape, int iField,
+ int nFieldValue );
+int SHPAPI_CALL
+ DBFWriteDoubleAttribute( DBFHandle hDBF, int iShape, int iField,
+ double dFieldValue );
+int SHPAPI_CALL
+ DBFWriteStringAttribute( DBFHandle hDBF, int iShape, int iField,
+ const char * pszFieldValue );
+int SHPAPI_CALL
+ DBFWriteNULLAttribute( DBFHandle hDBF, int iShape, int iField );
+
+int SHPAPI_CALL
+ DBFWriteLogicalAttribute( DBFHandle hDBF, int iShape, int iField,
+ const char lFieldValue);
+int SHPAPI_CALL
+ DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField,
+ void * pValue );
+const char SHPAPI_CALL1(*)
+ DBFReadTuple(DBFHandle psDBF, int hEntity );
+int SHPAPI_CALL
+ DBFWriteTuple(DBFHandle psDBF, int hEntity, void * pRawTuple );
+
+int SHPAPI_CALL DBFIsRecordDeleted( DBFHandle psDBF, int iShape );
+int SHPAPI_CALL DBFMarkRecordDeleted( DBFHandle psDBF, int iShape,
+ int bIsDeleted );
+
+DBFHandle SHPAPI_CALL
+ DBFCloneEmpty(DBFHandle psDBF, const char * pszFilename );
+
+void SHPAPI_CALL
+ DBFClose( DBFHandle hDBF );
+void SHPAPI_CALL
+ DBFUpdateHeader( DBFHandle hDBF );
+char SHPAPI_CALL
+ DBFGetNativeFieldType( DBFHandle hDBF, int iField );
+
+const char SHPAPI_CALL1(*)
+ DBFGetCodePage(DBFHandle psDBF );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ndef SHAPEFILE_H_INCLUDED */
diff --git a/map/shapefile/shapefile.c b/map/shapefile/shapefile.c
new file mode 100644
index 00000000..41cc37b5
--- /dev/null
+++ b/map/shapefile/shapefile.c
@@ -0,0 +1,748 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <unistd.h>
+#include "config.h"
+#include "debug.h"
+#include "plugin.h"
+#include "projection.h"
+#include "item.h"
+#include "map.h"
+#include "maptype.h"
+#include "attr.h"
+#include "transform.h"
+#include "file.h"
+#include "shapefil.h"
+
+
+struct map_priv {
+ int id;
+ char *filename;
+ char *charset;
+ SHPHandle hSHP;
+ DBFHandle hDBF;
+ int nShapeType, nEntities, nFields;
+ double adfMinBound[4], adfMaxBound[4];
+ struct longest_match *lm;
+ char *dbfmap_data;
+ struct coord offset;
+ enum projection pro;
+};
+
+
+struct map_rect_priv {
+ struct map_selection *sel;
+ struct map_priv *m;
+ struct item item;
+ int idx;
+ int cidx;
+ int aidx;
+ enum attr_type anext;
+ SHPObject *psShape;
+ char *str;
+ char *line;
+ int attr_pos;
+ struct attr *attr;
+};
+
+static void
+map_destroy_shapefile(struct map_priv *m)
+{
+ dbg(1,"map_destroy_shapefile\n");
+ g_free(m);
+}
+
+static void
+shapefile_coord_rewind(void *priv_data)
+{
+ struct map_rect_priv *mr=priv_data;
+ mr->cidx=0;
+}
+
+static int
+shapefile_coord_get(void *priv_data, struct coord *c, int count)
+{
+ struct map_rect_priv *mr=priv_data;
+ struct coord cs;
+ int ret=0;
+ int idx;
+
+ struct coord_geo g;
+ SHPObject *psShape=mr->psShape;
+ while (count) {
+ idx=mr->cidx;
+ if (idx >= psShape->nVertices)
+ break;
+ cs.x=psShape->padfX[idx]+mr->m->offset.x;
+ cs.y=psShape->padfY[idx]+mr->m->offset.y;
+ if (!mr->m->pro) {
+ g.lng=cs.x;
+ g.lat=cs.y;
+ transform_from_geo(projection_mg, &g, c);
+ } else
+ transform_from_to(&cs, mr->m->pro, c, projection_mg);
+ mr->cidx++;
+ ret++;
+ c++;
+ count--;
+ }
+ return ret;
+}
+
+static void
+shapefile_attr_rewind(void *priv_data)
+{
+ struct map_rect_priv *mr=priv_data;
+ mr->aidx=0;
+ mr->attr_pos=0;
+ mr->anext=attr_debug;
+}
+
+
+struct longest_match_list_item {
+ void *data;
+ int match_idx_count;
+ int *match_idx;
+};
+
+struct longest_match_list {
+ GList *longest_match_list_items;
+};
+
+
+struct longest_match {
+ GHashTable *match_hash;
+ char *match_present;
+ int match_present_count;
+ GList *longest_match_lists;
+ int longest_match_list_count;
+};
+
+static void
+longest_match_add_match(struct longest_match *lm, struct longest_match_list_item *lmi, char *match)
+{
+ int idx;
+ if (!(idx=(int)(long)g_hash_table_lookup(lm->match_hash, match))) {
+ idx=lm->match_present_count++;
+ lm->match_present=g_renew(char, lm->match_present, lm->match_present_count);
+ g_hash_table_insert(lm->match_hash, g_strdup(match), (gpointer)(long)idx);
+ }
+ lmi->match_idx=g_renew(int, lmi->match_idx, lmi->match_idx_count+1);
+ lmi->match_idx[lmi->match_idx_count++]=idx;
+}
+
+static void
+longest_match_item_destroy(struct longest_match_list_item *lmi, long flags)
+{
+ if (!lmi)
+ return;
+ if (flags & 2) {
+ g_free(lmi->data);
+ }
+ g_free(lmi->match_idx);
+ g_free(lmi);
+}
+
+static struct longest_match_list_item *
+longest_match_item_new(struct longest_match_list *lml, void *data)
+{
+ struct longest_match_list_item *ret=g_new0(struct longest_match_list_item,1);
+ lml->longest_match_list_items=g_list_append(lml->longest_match_list_items, ret);
+ ret->data=data;
+
+ return ret;
+}
+
+static struct longest_match_list *
+longest_match_list_new(struct longest_match *lm)
+{
+ struct longest_match_list *ret=g_new0(struct longest_match_list,1);
+ lm->longest_match_lists=g_list_append(lm->longest_match_lists, ret);
+ return ret;
+}
+
+static void
+longest_match_list_destroy(struct longest_match_list *lml, long flags)
+{
+ if (!lml)
+ return;
+ if (flags & 1) {
+ g_list_foreach(lml->longest_match_list_items, (GFunc)longest_match_item_destroy, (gpointer)flags);
+ g_list_free(lml->longest_match_list_items);
+ }
+ g_free(lml);
+}
+
+static struct longest_match_list *
+longest_match_get_list(struct longest_match *lm, int list)
+{
+ GList *l=lm->longest_match_lists;
+ while (l && list > 0) {
+ l=g_list_next(l);
+ list++;
+ }
+ if (l)
+ return l->data;
+ return NULL;
+}
+
+static struct longest_match *
+longest_match_new(void)
+{
+ struct longest_match *ret=g_new0(struct longest_match,1);
+ ret->match_hash=g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
+ ret->match_present_count=1;
+ return ret;
+}
+
+static void
+longest_match_destroy(struct longest_match *lm, long flags)
+{
+ if (!lm)
+ return;
+ if (flags & 1) {
+ g_list_foreach(lm->longest_match_lists, (GFunc)longest_match_list_destroy, (gpointer)flags);
+ g_list_free(lm->longest_match_lists);
+ }
+ g_hash_table_destroy(lm->match_hash);
+ g_free(lm->match_present);
+ g_free(lm);
+}
+
+static void
+longest_match_clear(struct longest_match *lm)
+{
+ if (lm->match_present)
+ memset(lm->match_present, 0, lm->match_present_count);
+}
+
+static void
+longest_match_add_key_value(struct longest_match *lm, char *k, char *v)
+{
+ char buffer[strlen(k)+strlen(v)+2];
+ int idx;
+
+ strcpy(buffer,"*=*");
+ if ((idx=(int)(long)g_hash_table_lookup(lm->match_hash, buffer)))
+ lm->match_present[idx]=1;
+
+ sprintf(buffer,"%s=*", k);
+ if ((idx=(int)(long)g_hash_table_lookup(lm->match_hash, buffer)))
+ lm->match_present[idx]=2;
+
+ sprintf(buffer,"*=%s", v);
+ if ((idx=(int)(long)g_hash_table_lookup(lm->match_hash, buffer)))
+ lm->match_present[idx]=2;
+
+ sprintf(buffer,"%s=%s", k, v);
+ if ((idx=(int)(long)g_hash_table_lookup(lm->match_hash, buffer)))
+ lm->match_present[idx]=4;
+}
+
+static int
+longest_match_list_find(struct longest_match *lm, struct longest_match_list *lml, void **list, int max_list_len)
+{
+ int j,longest=0,ret=0,sum,val;
+ struct longest_match_list_item *curr;
+ GList *l=lml->longest_match_list_items;
+
+
+ while (l) {
+ sum=0;
+ curr=l->data;
+ for (j = 0 ; j < curr->match_idx_count ; j++) {
+ val=lm->match_present[curr->match_idx[j]];
+ if (val)
+ sum+=val;
+ else {
+ sum=-1;
+ break;
+ }
+ }
+ if (sum > longest) {
+ longest=sum;
+ ret=0;
+ }
+ if (sum > 0 && sum == longest && ret < max_list_len)
+ list[ret++]=curr->data;
+ l=g_list_next(l);
+ }
+ return ret;
+}
+
+
+static void
+build_match(struct longest_match *lm, struct longest_match_list *lml, char *line)
+{
+ char *kvl=NULL,*i=NULL,*p,*kv;
+ dbg(1,"line=%s\n",line);
+ struct longest_match_list_item *lmli;
+ kvl=line;
+ p=strchr(line,'\t');
+ if (p) {
+ while (*p == '\t')
+ *p++='\0';
+ i=p;
+ }
+ lmli=longest_match_item_new(lml,g_strdup(i));
+ while ((kv=strtok(kvl, ","))) {
+ kvl=NULL;
+ longest_match_add_match(lm, lmli, kv);
+ }
+}
+
+static void
+build_matches(struct map_priv *m,char *matches)
+{
+ char *matches2=g_strdup(matches);
+ char *l=matches2,*p;
+ struct longest_match_list *lml;
+
+ m->lm=longest_match_new();
+ lml=longest_match_list_new(m->lm);
+ while (l) {
+ p=strchr(l,'\n');
+ if (p)
+ *p++='\0';
+ if (strlen(l))
+ build_match(m->lm,lml,l);
+ l=p;
+ }
+ g_free(matches2);
+}
+
+static void
+process_fields(struct map_priv *m, int id)
+{
+ int i;
+ char szTitle[12],*pszTypeName,*str;
+ int nWidth, nDecimals;
+
+ for (i = 0 ; i < m->nFields ; i++) {
+
+ switch (DBFGetFieldInfo(m->hDBF, i, szTitle, &nWidth, &nDecimals )) {
+ case FTString:
+ pszTypeName = "String";
+ str=g_strdup(DBFReadStringAttribute( m->hDBF, id, i ));
+ break;
+ case FTInteger:
+ pszTypeName = "Integer";
+ str=g_strdup_printf("%d",DBFReadIntegerAttribute( m->hDBF, id, i ));
+ break;
+ case FTDouble:
+ pszTypeName = "Double";
+ str=g_strdup_printf("%lf",DBFReadDoubleAttribute( m->hDBF, id, i ));
+ break;
+ case FTInvalid:
+ pszTypeName = "Invalid";
+ str=NULL;
+ break;
+ default:
+ pszTypeName = "Unknown";
+ str=NULL;
+ }
+ longest_match_add_key_value(m->lm, szTitle, str);
+ }
+}
+
+static int
+attr_resolve(struct map_rect_priv *mr, enum attr_type attr_type, struct attr *attr)
+{
+ char name[1024];
+ char value[1024];
+ char szTitle[12];
+ const char *str;
+ char *col,*type=NULL;
+ int i,len, nWidth, nDecimals;
+ if (!mr->line)
+ return 0;
+ if (attr_type != attr_any)
+ type=attr_to_name(attr_type);
+ if (attr_from_line(mr->line,type,&mr->attr_pos,value,name)) {
+ len=strlen(value);
+ if (value[0] == '$' && value[1] == '{' && value[len-1] == '}') {
+ value[len-1]='\0';
+ col=value+2;
+ for (i = 0 ; i < mr->m->nFields ; i++) {
+ if (DBFGetFieldInfo(mr->m->hDBF, i, szTitle, &nWidth, &nDecimals ) == FTString && !strcmp(szTitle,col)) {
+ str=DBFReadStringAttribute( mr->m->hDBF, mr->item.id_lo, i);
+ strcpy(value,str);
+ break;
+ }
+ }
+ }
+ if (!value[0])
+ return -1;
+ dbg(1,"name=%s value=%s\n",name,value);
+ attr_free(mr->attr);
+ mr->attr=attr_new_from_text(name,value);
+ if (mr->attr) {
+ *attr=*mr->attr;
+ return 1;
+ }
+ return -1;
+ }
+ return 0;
+}
+
+static int
+shapefile_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
+{
+ struct map_rect_priv *mr=priv_data;
+ struct map_priv *m=mr->m;
+ char szTitle[12],*pszTypeName, *str;
+ int code, ret, nWidth, nDecimals;
+
+ attr->type=attr_type;
+ switch (attr_type) {
+ case attr_any:
+ while ((code=attr_resolve(mr, attr_type, attr))) {
+ if (code == 1)
+ return 1;
+ }
+ while (mr->anext != attr_none) {
+ ret=shapefile_attr_get(priv_data, mr->anext, attr);
+ if (ret)
+ return ret;
+ }
+ return 0;
+ case attr_debug:
+ if (mr->aidx >= m->nFields) {
+ mr->anext=attr_none;
+ return 0;
+ }
+ switch (DBFGetFieldInfo(m->hDBF, mr->aidx, szTitle, &nWidth, &nDecimals )) {
+ case FTString:
+ pszTypeName = "String";
+ str=g_strdup(DBFReadStringAttribute( m->hDBF, mr->item.id_lo, mr->aidx ));
+ break;
+ case FTInteger:
+ pszTypeName = "Integer";
+ str=g_strdup_printf("%d",DBFReadIntegerAttribute( m->hDBF, mr->item.id_lo, mr->aidx ));
+ break;
+ case FTDouble:
+ pszTypeName = "Double";
+ str=g_strdup_printf("%lf",DBFReadDoubleAttribute( m->hDBF, mr->item.id_lo, mr->aidx ));
+ break;
+ case FTInvalid:
+ pszTypeName = "Invalid";
+ str=NULL;
+ break;
+ default:
+ pszTypeName = "Unknown";
+ str=NULL;
+ }
+ g_free(mr->str);
+ mr->str=attr->u.str=g_strdup_printf("%s=%s(%s)",szTitle,str,pszTypeName);
+ g_free(str);
+ mr->aidx++;
+ return 1;
+ default:
+ return attr_resolve(mr, attr_type, attr);
+ }
+}
+
+static struct item_methods methods_shapefile = {
+ shapefile_coord_rewind,
+ shapefile_coord_get,
+ shapefile_attr_rewind,
+ shapefile_attr_get,
+};
+
+static struct map_rect_priv *
+map_rect_new_shapefile(struct map_priv *map, struct map_selection *sel)
+{
+ struct map_rect_priv *mr;
+ char *dbfmapfile=g_strdup_printf("%s.dbfmap", map->filename);
+ void *data;
+ struct file *file;
+ int size;
+ int changed=0;
+ if ((file=file_create(dbfmapfile))) {
+ size=file_size(file);
+ data=file_data_read_all(file);
+ if (data) {
+ if (!map->dbfmap_data || size != strlen(map->dbfmap_data) || strncmp(data,map->dbfmap_data,size)) {
+ g_free(map->dbfmap_data);
+ map->dbfmap_data=g_malloc(size+1);
+ memcpy(map->dbfmap_data, data, size);
+ map->dbfmap_data[size]='\0';
+ changed=1;
+ }
+ file_data_free(file, data);
+ }
+ file_destroy(file);
+ } else {
+ if (map->dbfmap_data) {
+ changed=1;
+ g_free(map->dbfmap_data);
+ map->dbfmap_data=NULL;
+ }
+ }
+ dbg(1,"%s changed %d old %p\n",dbfmapfile,changed,map->dbfmap_data);
+ if (changed) {
+ longest_match_destroy(map->lm,1);
+ map->lm=NULL;
+ if (map->dbfmap_data) {
+ build_matches(map,map->dbfmap_data);
+ }
+ }
+ dbg(1,"map_rect_new_shapefile\n");
+ mr=g_new0(struct map_rect_priv, 1);
+ mr->m=map;
+ mr->idx=0;
+ mr->item.id_lo=0;
+ mr->item.id_hi=0;
+ mr->item.meth=&methods_shapefile;
+ mr->item.priv_data=mr;
+ g_free(dbfmapfile);
+ return mr;
+}
+
+
+static void
+map_rect_destroy_shapefile(struct map_rect_priv *mr)
+{
+ if (mr->psShape)
+ SHPDestroyObject(mr->psShape);
+ attr_free(mr->attr);
+ g_free(mr->str);
+ g_free(mr);
+}
+
+static struct item *
+map_rect_get_item_shapefile(struct map_rect_priv *mr)
+{
+ struct map_priv *m=mr->m;
+ void *lines[5];
+ struct longest_match_list *lml;
+ int count;
+ char type[1024];
+
+ if (mr->idx >= m->nEntities)
+ return NULL;
+ mr->item.id_lo=mr->idx;
+ if (mr->psShape)
+ SHPDestroyObject(mr->psShape);
+ mr->psShape=SHPReadObject(m->hSHP, mr->idx);
+ if (mr->psShape->nVertices > 1)
+ mr->item.type=type_street_unkn;
+ else
+ mr->item.type=type_point_unkn;
+ if (m->lm) {
+ longest_match_clear(m->lm);
+ process_fields(m, mr->idx);
+
+ lml=longest_match_get_list(m->lm, 0);
+ count=longest_match_list_find(m->lm, lml, lines, sizeof(lines)/sizeof(void *));
+ if (count) {
+ mr->line=lines[0];
+ if (attr_from_line(mr->line,"type",NULL,type,NULL)) {
+ dbg(1,"type='%s'\n", type);
+ mr->item.type=item_from_name(type);
+ if (mr->item.type == type_none)
+ dbg(0,"Warning: type '%s' unknown\n", type);
+ }
+ } else
+ mr->line=NULL;
+ }
+ mr->idx++;
+ shapefile_coord_rewind(mr);
+ shapefile_attr_rewind(mr);
+ return &mr->item;
+}
+
+static struct item *
+map_rect_get_item_byid_shapefile(struct map_rect_priv *mr, int id_hi, int id_lo)
+{
+ mr->idx=id_lo;
+ return map_rect_get_item_shapefile(mr);
+}
+
+static struct map_methods map_methods_shapefile = {
+ projection_mg,
+ "iso8859-1",
+ map_destroy_shapefile,
+ map_rect_new_shapefile,
+ map_rect_destroy_shapefile,
+ map_rect_get_item_shapefile,
+ map_rect_get_item_byid_shapefile,
+};
+
+static struct map_priv *
+map_new_shapefile(struct map_methods *meth, struct attr **attrs)
+{
+ struct map_priv *m;
+ struct attr *data=attr_search(attrs, NULL, attr_data);
+ struct attr *charset=attr_search(attrs, NULL, attr_charset);
+ struct attr *projectionname=attr_search(attrs, NULL, attr_projectionname);
+ struct file_wordexp *wexp;
+ char *wdata;
+ char **wexp_data;
+ char *shapefile,*dbffile;
+ if (! data)
+ return NULL;
+ dbg(1,"map_new_shapefile %s\n", data->u.str);
+ wdata=g_strdup(data->u.str);
+ wexp=file_wordexp_new(wdata);
+ wexp_data=file_wordexp_get_array(wexp);
+ *meth=map_methods_shapefile;
+
+ m=g_new0(struct map_priv, 1);
+ m->filename=g_strdup(wexp_data[0]);
+ shapefile=g_strdup_printf("%s.shp", m->filename);
+ m->hSHP=SHPOpen(shapefile, "rb" );
+ SHPGetInfo( m->hSHP, &m->nEntities, &m->nShapeType, m->adfMinBound, m->adfMaxBound );
+ g_free(shapefile);
+ dbffile=g_strdup_printf("%s.dbf", m->filename);
+ m->hDBF=DBFOpen(dbffile, "rb");
+ m->nFields=DBFGetFieldCount(m->hDBF);
+ g_free(dbffile);
+ dbg(1,"map_new_shapefile %s %s\n", m->filename, wdata);
+ if (charset) {
+ m->charset=g_strdup(charset->u.str);
+ meth->charset=m->charset;
+ }
+ if (projectionname)
+ m->pro=projection_from_name(projectionname->u.str, &m->offset);
+ file_wordexp_destroy(wexp);
+ return m;
+}
+
+void
+plugin_init(void)
+{
+ dbg(1,"shapefile: plugin_init\n");
+ plugin_register_map_type("shapefile", map_new_shapefile);
+}
+
+/************************************************************************/
+/* VSI_SHP_Open() */
+/************************************************************************/
+
+static SAFile VSI_SHP_Open( const char *pszFilename, const char *pszAccess )
+
+{
+ return (SAFile)fopen(pszFilename, pszAccess);
+}
+
+/************************************************************************/
+/* VSI_SHP_Read() */
+/************************************************************************/
+
+static SAOffset VSI_SHP_Read( void *p, SAOffset size, SAOffset nmemb, SAFile file )
+
+{
+ return fread(p, size, nmemb, (FILE *)file);
+}
+
+/************************************************************************/
+/* VSI_SHP_Write() */
+/************************************************************************/
+
+static SAOffset VSI_SHP_Write( void *p, SAOffset size, SAOffset nmemb, SAFile file )
+
+{
+ return fwrite(p, size, nmemb, (FILE *)file);
+}
+
+/************************************************************************/
+/* VSI_SHP_Seek() */
+/************************************************************************/
+
+static SAOffset VSI_SHP_Seek( SAFile file, SAOffset offset, int whence )
+
+{
+ return fseek((FILE *)file, offset, whence);
+}
+
+/************************************************************************/
+/* VSI_SHP_Tell() */
+/************************************************************************/
+
+static SAOffset VSI_SHP_Tell( SAFile file )
+
+{
+ return ftell((FILE *)file);
+}
+
+
+static int VSI_SHP_Flush( SAFile file )
+
+{
+ return fflush((FILE *)file);
+}
+
+/************************************************************************/
+/* VSI_SHP_Close() */
+/************************************************************************/
+
+static int VSI_SHP_Close( SAFile file )
+
+{
+ return fclose((FILE *)file);
+}
+
+/************************************************************************/
+/* SADError() */
+/************************************************************************/
+
+static void VSI_SHP_Error( const char *message )
+
+{
+ dbg(0,"error:%s\n", message);
+}
+
+/************************************************************************/
+/* VSI_SHP_Remove() */
+/************************************************************************/
+
+static int VSI_SHP_Remove( const char *pszFilename )
+
+{
+ return unlink(pszFilename);
+}
+
+/************************************************************************/
+/* SASetupDefaultHooks() */
+/************************************************************************/
+
+void SASetupDefaultHooks( SAHooks *psHooks )
+
+{
+ psHooks->FOpen = VSI_SHP_Open;
+ psHooks->FRead = VSI_SHP_Read;
+ psHooks->FWrite = VSI_SHP_Write;
+ psHooks->FSeek = VSI_SHP_Seek;
+ psHooks->FTell = VSI_SHP_Tell;
+ psHooks->FFlush = VSI_SHP_Flush;
+ psHooks->FClose = VSI_SHP_Close;
+
+ psHooks->Remove = VSI_SHP_Remove;
+ psHooks->Atof = atof;
+
+ psHooks->Error = VSI_SHP_Error;
+}
+
+
diff --git a/map/shapefile/shpopen.c b/map/shapefile/shpopen.c
new file mode 100644
index 00000000..ba0ae849
--- /dev/null
+++ b/map/shapefile/shpopen.c
@@ -0,0 +1,2284 @@
+/******************************************************************************
+ * $Id: shpopen.c,v 1.59 2008/03/14 05:25:31 fwarmerdam Exp $
+ *
+ * Project: Shapelib
+ * Purpose: Implementation of core Shapefile read/write functions.
+ * Author: Frank Warmerdam, warmerdam@pobox.com
+ *
+ ******************************************************************************
+ * Copyright (c) 1999, 2001, Frank Warmerdam
+ *
+ * This software is available under the following "MIT Style" license,
+ * or at the option of the licensee under the LGPL (see LICENSE.LGPL). This
+ * option is discussed in more detail in shapelib.html.
+ *
+ * --
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ******************************************************************************
+ *
+ * $Log: shpopen.c,v $
+ * Revision 1.59 2008/03/14 05:25:31 fwarmerdam
+ * Correct crash on buggy geometries (gdal #2218)
+ *
+ * Revision 1.58 2008/01/08 23:28:26 bram
+ * on line 2095, use a float instead of a double to avoid a compiler warning
+ *
+ * Revision 1.57 2007/12/06 07:00:25 fwarmerdam
+ * dbfopen now using SAHooks for fileio
+ *
+ * Revision 1.56 2007/12/04 20:37:56 fwarmerdam
+ * preliminary implementation of hooks api for io and errors
+ *
+ * Revision 1.55 2007/11/21 22:39:56 fwarmerdam
+ * close shx file in readonly mode (GDAL #1956)
+ *
+ * Revision 1.54 2007/11/15 00:12:47 mloskot
+ * Backported recent changes from GDAL (Ticket #1415) to Shapelib.
+ *
+ * Revision 1.53 2007/11/14 22:31:08 fwarmerdam
+ * checks after mallocs to detect for corrupted/voluntary broken shapefiles.
+ * http://trac.osgeo.org/gdal/ticket/1991
+ *
+ * Revision 1.52 2007/06/21 15:58:33 fwarmerdam
+ * fix for SHPRewindObject when rings touch at one vertex (gdal #976)
+ *
+ * Revision 1.51 2006/09/04 15:24:01 fwarmerdam
+ * Fixed up log message for 1.49.
+ *
+ * Revision 1.50 2006/09/04 15:21:39 fwarmerdam
+ * fix of last fix
+ *
+ * Revision 1.49 2006/09/04 15:21:00 fwarmerdam
+ * MLoskot: Added stronger test of Shapefile reading failures, e.g. truncated
+ * files. The problem was discovered by Tim Sutton and reported here
+ * https://svn.qgis.org/trac/ticket/200
+ *
+ * Revision 1.48 2006/01/26 15:07:32 fwarmerdam
+ * add bMeasureIsUsed flag from Craig Bruce: Bug 1249
+ *
+ * Revision 1.47 2006/01/04 20:07:23 fwarmerdam
+ * In SHPWriteObject() make sure that the record length is updated
+ * when rewriting an existing record.
+ *
+ * Revision 1.46 2005/02/11 17:17:46 fwarmerdam
+ * added panPartStart[0] validation
+ *
+ * Revision 1.45 2004/09/26 20:09:48 fwarmerdam
+ * const correctness changes
+ *
+ * Revision 1.44 2003/12/29 00:18:39 fwarmerdam
+ * added error checking for failed IO and optional CPL error reporting
+ *
+ * Revision 1.43 2003/12/01 16:20:08 warmerda
+ * be careful of zero vertex shapes
+ *
+ * Revision 1.42 2003/12/01 14:58:27 warmerda
+ * added degenerate object check in SHPRewindObject()
+ *
+ * Revision 1.41 2003/07/08 15:22:43 warmerda
+ * avoid warning
+ *
+ * Revision 1.40 2003/04/21 18:30:37 warmerda
+ * added header write/update public methods
+ *
+ * Revision 1.39 2002/08/26 06:46:56 warmerda
+ * avoid c++ comments
+ *
+ * Revision 1.38 2002/05/07 16:43:39 warmerda
+ * Removed debugging printf.
+ *
+ * Revision 1.37 2002/04/10 17:35:22 warmerda
+ * fixed bug in ring reversal code
+ *
+ * Revision 1.36 2002/04/10 16:59:54 warmerda
+ * added SHPRewindObject
+ *
+ * Revision 1.35 2001/12/07 15:10:44 warmerda
+ * fix if .shx fails to open
+ *
+ * Revision 1.34 2001/11/01 16:29:55 warmerda
+ * move pabyRec into SHPInfo for thread safety
+ *
+ * Revision 1.33 2001/07/03 12:18:15 warmerda
+ * Improved cleanup if SHX not found, provied by Riccardo Cohen.
+ *
+ * Revision 1.32 2001/06/22 01:58:07 warmerda
+ * be more careful about establishing initial bounds in face of NULL shapes
+ *
+ * Revision 1.31 2001/05/31 19:35:29 warmerda
+ * added support for writing null shapes
+ *
+ * Revision 1.30 2001/05/28 12:46:29 warmerda
+ * Add some checking on reasonableness of record count when opening.
+ *
+ * Revision 1.29 2001/05/23 13:36:52 warmerda
+ * added use of SHPAPI_CALL
+ *
+ * Revision 1.28 2001/02/06 22:25:06 warmerda
+ * fixed memory leaks when SHPOpen() fails
+ *
+ * Revision 1.27 2000/07/18 15:21:33 warmerda
+ * added better enforcement of -1 for append in SHPWriteObject
+ *
+ * Revision 1.26 2000/02/16 16:03:51 warmerda
+ * added null shape support
+ *
+ * Revision 1.25 1999/12/15 13:47:07 warmerda
+ * Fixed record size settings in .shp file (was 4 words too long)
+ * Added stdlib.h.
+ *
+ * Revision 1.24 1999/11/05 14:12:04 warmerda
+ * updated license terms
+ *
+ * Revision 1.23 1999/07/27 00:53:46 warmerda
+ * added support for rewriting shapes
+ *
+ * Revision 1.22 1999/06/11 19:19:11 warmerda
+ * Cleanup pabyRec static buffer on SHPClose().
+ *
+ * Revision 1.21 1999/06/02 14:57:56 kshih
+ * Remove unused variables
+ *
+ * Revision 1.20 1999/04/19 21:04:17 warmerda
+ * Fixed syntax error.
+ *
+ * Revision 1.19 1999/04/19 21:01:57 warmerda
+ * Force access string to binary in SHPOpen().
+ *
+ * Revision 1.18 1999/04/01 18:48:07 warmerda
+ * Try upper case extensions if lower case doesn't work.
+ *
+ * Revision 1.17 1998/12/31 15:29:39 warmerda
+ * Disable writing measure values to multipatch objects if
+ * DISABLE_MULTIPATCH_MEASURE is defined.
+ *
+ * Revision 1.16 1998/12/16 05:14:33 warmerda
+ * Added support to write MULTIPATCH. Fixed reading Z coordinate of
+ * MULTIPATCH. Fixed record size written for all feature types.
+ *
+ * Revision 1.15 1998/12/03 16:35:29 warmerda
+ * r+b is proper binary access string, not rb+.
+ *
+ * Revision 1.14 1998/12/03 15:47:56 warmerda
+ * Fixed setting of nVertices in SHPCreateObject().
+ *
+ * Revision 1.13 1998/12/03 15:33:54 warmerda
+ * Made SHPCalculateExtents() separately callable.
+ *
+ * Revision 1.12 1998/11/11 20:01:50 warmerda
+ * Fixed bug writing ArcM/Z, and PolygonM/Z for big endian machines.
+ *
+ * Revision 1.11 1998/11/09 20:56:44 warmerda
+ * Fixed up handling of file wide bounds.
+ *
+ * Revision 1.10 1998/11/09 20:18:51 warmerda
+ * Converted to support 3D shapefiles, and use of SHPObject.
+ *
+ * Revision 1.9 1998/02/24 15:09:05 warmerda
+ * Fixed memory leak.
+ *
+ * Revision 1.8 1997/12/04 15:40:29 warmerda
+ * Fixed byte swapping of record number, and record length fields in the
+ * .shp file.
+ *
+ * Revision 1.7 1995/10/21 03:15:58 warmerda
+ * Added support for binary file access, the magic cookie 9997
+ * and tried to improve the int32 selection logic for 16bit systems.
+ *
+ * Revision 1.6 1995/09/04 04:19:41 warmerda
+ * Added fix for file bounds.
+ *
+ * Revision 1.5 1995/08/25 15:16:44 warmerda
+ * Fixed a couple of problems with big endian systems ... one with bounds
+ * and the other with multipart polygons.
+ *
+ * Revision 1.4 1995/08/24 18:10:17 warmerda
+ * Switch to use SfRealloc() to avoid problems with pre-ANSI realloc()
+ * functions (such as on the Sun).
+ *
+ * Revision 1.3 1995/08/23 02:23:15 warmerda
+ * Added support for reading bounds, and fixed up problems in setting the
+ * file wide bounds.
+ *
+ * Revision 1.2 1995/08/04 03:16:57 warmerda
+ * Added header.
+ *
+ */
+
+#include "shapefil.h"
+
+#include <math.h>
+#include <limits.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+SHP_CVSID("$Id: shpopen.c,v 1.59 2008/03/14 05:25:31 fwarmerdam Exp $")
+
+typedef unsigned char uchar;
+
+#if UINT_MAX == 65535
+typedef long int32;
+#else
+typedef int int32;
+#endif
+
+#ifndef FALSE
+# define FALSE 0
+# define TRUE 1
+#endif
+
+#define ByteCopy( a, b, c ) memcpy( b, a, c )
+#ifndef MAX
+# define MIN(a,b) ((a<b) ? a : b)
+# define MAX(a,b) ((a>b) ? a : b)
+#endif
+
+static int bBigEndian;
+
+
+/************************************************************************/
+/* SwapWord() */
+/* */
+/* Swap a 2, 4 or 8 byte word. */
+/************************************************************************/
+
+static void SwapWord( int length, void * wordP )
+
+{
+ int i;
+ uchar temp;
+
+ for( i=0; i < length/2; i++ )
+ {
+ temp = ((uchar *) wordP)[i];
+ ((uchar *)wordP)[i] = ((uchar *) wordP)[length-i-1];
+ ((uchar *) wordP)[length-i-1] = temp;
+ }
+}
+
+/************************************************************************/
+/* SfRealloc() */
+/* */
+/* A realloc cover function that will access a NULL pointer as */
+/* a valid input. */
+/************************************************************************/
+
+static void * SfRealloc( void * pMem, int nNewSize )
+
+{
+ if( pMem == NULL )
+ return( (void *) malloc(nNewSize) );
+ else
+ return( (void *) realloc(pMem,nNewSize) );
+}
+
+/************************************************************************/
+/* SHPWriteHeader() */
+/* */
+/* Write out a header for the .shp and .shx files as well as the */
+/* contents of the index (.shx) file. */
+/************************************************************************/
+
+void SHPWriteHeader( SHPHandle psSHP )
+
+{
+ uchar abyHeader[100];
+ int i;
+ int32 i32;
+ double dValue;
+ int32 *panSHX;
+
+ if (psSHP->fpSHX == NULL)
+ {
+ psSHP->sHooks.Error( "SHPWriteHeader failed : SHX file is closed");
+ return;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Prepare header block for .shp file. */
+/* -------------------------------------------------------------------- */
+ for( i = 0; i < 100; i++ )
+ abyHeader[i] = 0;
+
+ abyHeader[2] = 0x27; /* magic cookie */
+ abyHeader[3] = 0x0a;
+
+ i32 = psSHP->nFileSize/2; /* file size */
+ ByteCopy( &i32, abyHeader+24, 4 );
+ if( !bBigEndian ) SwapWord( 4, abyHeader+24 );
+
+ i32 = 1000; /* version */
+ ByteCopy( &i32, abyHeader+28, 4 );
+ if( bBigEndian ) SwapWord( 4, abyHeader+28 );
+
+ i32 = psSHP->nShapeType; /* shape type */
+ ByteCopy( &i32, abyHeader+32, 4 );
+ if( bBigEndian ) SwapWord( 4, abyHeader+32 );
+
+ dValue = psSHP->adBoundsMin[0]; /* set bounds */
+ ByteCopy( &dValue, abyHeader+36, 8 );
+ if( bBigEndian ) SwapWord( 8, abyHeader+36 );
+
+ dValue = psSHP->adBoundsMin[1];
+ ByteCopy( &dValue, abyHeader+44, 8 );
+ if( bBigEndian ) SwapWord( 8, abyHeader+44 );
+
+ dValue = psSHP->adBoundsMax[0];
+ ByteCopy( &dValue, abyHeader+52, 8 );
+ if( bBigEndian ) SwapWord( 8, abyHeader+52 );
+
+ dValue = psSHP->adBoundsMax[1];
+ ByteCopy( &dValue, abyHeader+60, 8 );
+ if( bBigEndian ) SwapWord( 8, abyHeader+60 );
+
+ dValue = psSHP->adBoundsMin[2]; /* z */
+ ByteCopy( &dValue, abyHeader+68, 8 );
+ if( bBigEndian ) SwapWord( 8, abyHeader+68 );
+
+ dValue = psSHP->adBoundsMax[2];
+ ByteCopy( &dValue, abyHeader+76, 8 );
+ if( bBigEndian ) SwapWord( 8, abyHeader+76 );
+
+ dValue = psSHP->adBoundsMin[3]; /* m */
+ ByteCopy( &dValue, abyHeader+84, 8 );
+ if( bBigEndian ) SwapWord( 8, abyHeader+84 );
+
+ dValue = psSHP->adBoundsMax[3];
+ ByteCopy( &dValue, abyHeader+92, 8 );
+ if( bBigEndian ) SwapWord( 8, abyHeader+92 );
+
+/* -------------------------------------------------------------------- */
+/* Write .shp file header. */
+/* -------------------------------------------------------------------- */
+ if( psSHP->sHooks.FSeek( psSHP->fpSHP, 0, 0 ) != 0
+ || psSHP->sHooks.FWrite( abyHeader, 100, 1, psSHP->fpSHP ) != 1 )
+ {
+ psSHP->sHooks.Error( "Failure writing .shp header" );
+ return;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Prepare, and write .shx file header. */
+/* -------------------------------------------------------------------- */
+ i32 = (psSHP->nRecords * 2 * sizeof(int32) + 100)/2; /* file size */
+ ByteCopy( &i32, abyHeader+24, 4 );
+ if( !bBigEndian ) SwapWord( 4, abyHeader+24 );
+
+ if( psSHP->sHooks.FSeek( psSHP->fpSHX, 0, 0 ) != 0
+ || psSHP->sHooks.FWrite( abyHeader, 100, 1, psSHP->fpSHX ) != 1 )
+ {
+ psSHP->sHooks.Error( "Failure writing .shx header" );
+ return;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Write out the .shx contents. */
+/* -------------------------------------------------------------------- */
+ panSHX = (int32 *) malloc(sizeof(int32) * 2 * psSHP->nRecords);
+
+ for( i = 0; i < psSHP->nRecords; i++ )
+ {
+ panSHX[i*2 ] = psSHP->panRecOffset[i]/2;
+ panSHX[i*2+1] = psSHP->panRecSize[i]/2;
+ if( !bBigEndian ) SwapWord( 4, panSHX+i*2 );
+ if( !bBigEndian ) SwapWord( 4, panSHX+i*2+1 );
+ }
+
+ if( (int)psSHP->sHooks.FWrite( panSHX, sizeof(int32)*2, psSHP->nRecords, psSHP->fpSHX )
+ != psSHP->nRecords )
+ {
+ psSHP->sHooks.Error( "Failure writing .shx contents" );
+ }
+
+ free( panSHX );
+
+/* -------------------------------------------------------------------- */
+/* Flush to disk. */
+/* -------------------------------------------------------------------- */
+ psSHP->sHooks.FFlush( psSHP->fpSHP );
+ psSHP->sHooks.FFlush( psSHP->fpSHX );
+}
+
+/************************************************************************/
+/* SHPOpen() */
+/************************************************************************/
+
+SHPHandle SHPAPI_CALL
+SHPOpen( const char * pszLayer, const char * pszAccess )
+
+{
+ SAHooks sHooks;
+
+ SASetupDefaultHooks( &sHooks );
+
+ return SHPOpenLL( pszLayer, pszAccess, &sHooks );
+}
+
+/************************************************************************/
+/* SHPOpen() */
+/* */
+/* Open the .shp and .shx files based on the basename of the */
+/* files or either file name. */
+/************************************************************************/
+
+SHPHandle SHPAPI_CALL
+SHPOpenLL( const char * pszLayer, const char * pszAccess, SAHooks *psHooks )
+
+{
+ char *pszFullname, *pszBasename;
+ SHPHandle psSHP;
+
+ uchar *pabyBuf;
+ int i;
+ double dValue;
+
+/* -------------------------------------------------------------------- */
+/* Ensure the access string is one of the legal ones. We */
+/* ensure the result string indicates binary to avoid common */
+/* problems on Windows. */
+/* -------------------------------------------------------------------- */
+ if( strcmp(pszAccess,"rb+") == 0 || strcmp(pszAccess,"r+b") == 0
+ || strcmp(pszAccess,"r+") == 0 )
+ pszAccess = "r+b";
+ else
+ pszAccess = "rb";
+
+/* -------------------------------------------------------------------- */
+/* Establish the byte order on this machine. */
+/* -------------------------------------------------------------------- */
+ i = 1;
+ if( *((uchar *) &i) == 1 )
+ bBigEndian = FALSE;
+ else
+ bBigEndian = TRUE;
+
+/* -------------------------------------------------------------------- */
+/* Initialize the info structure. */
+/* -------------------------------------------------------------------- */
+ psSHP = (SHPHandle) calloc(sizeof(SHPInfo),1);
+
+ psSHP->bUpdated = FALSE;
+ memcpy( &(psSHP->sHooks), psHooks, sizeof(SAHooks) );
+
+/* -------------------------------------------------------------------- */
+/* Compute the base (layer) name. If there is any extension */
+/* on the passed in filename we will strip it off. */
+/* -------------------------------------------------------------------- */
+ pszBasename = (char *) malloc(strlen(pszLayer)+5);
+ strcpy( pszBasename, pszLayer );
+ for( i = strlen(pszBasename)-1;
+ i > 0 && pszBasename[i] != '.' && pszBasename[i] != '/'
+ && pszBasename[i] != '\\';
+ i-- ) {}
+
+ if( pszBasename[i] == '.' )
+ pszBasename[i] = '\0';
+
+/* -------------------------------------------------------------------- */
+/* Open the .shp and .shx files. Note that files pulled from */
+/* a PC to Unix with upper case filenames won't work! */
+/* -------------------------------------------------------------------- */
+ pszFullname = (char *) malloc(strlen(pszBasename) + 5);
+ sprintf( pszFullname, "%s.shp", pszBasename ) ;
+ psSHP->fpSHP = psSHP->sHooks.FOpen(pszFullname, pszAccess );
+ if( psSHP->fpSHP == NULL )
+ {
+ sprintf( pszFullname, "%s.SHP", pszBasename );
+ psSHP->fpSHP = psSHP->sHooks.FOpen(pszFullname, pszAccess );
+ }
+
+ if( psSHP->fpSHP == NULL )
+ {
+#ifdef USE_CPL
+ CPLError( CE_Failure, CPLE_OpenFailed,
+ "Unable to open %s.shp or %s.SHP.",
+ pszBasename, pszBasename );
+#endif
+ free( psSHP );
+ free( pszBasename );
+ free( pszFullname );
+ return( NULL );
+ }
+
+ sprintf( pszFullname, "%s.shx", pszBasename );
+ psSHP->fpSHX = psSHP->sHooks.FOpen(pszFullname, pszAccess );
+ if( psSHP->fpSHX == NULL )
+ {
+ sprintf( pszFullname, "%s.SHX", pszBasename );
+ psSHP->fpSHX = psSHP->sHooks.FOpen(pszFullname, pszAccess );
+ }
+
+ if( psSHP->fpSHX == NULL )
+ {
+#ifdef USE_CPL
+ CPLError( CE_Failure, CPLE_OpenFailed,
+ "Unable to open %s.shx or %s.SHX.",
+ pszBasename, pszBasename );
+#endif
+ psSHP->sHooks.FClose( psSHP->fpSHP );
+ free( psSHP );
+ free( pszBasename );
+ free( pszFullname );
+ return( NULL );
+ }
+
+ free( pszFullname );
+ free( pszBasename );
+
+/* -------------------------------------------------------------------- */
+/* Read the file size from the SHP file. */
+/* -------------------------------------------------------------------- */
+ pabyBuf = (uchar *) malloc(100);
+ psSHP->sHooks.FRead( pabyBuf, 100, 1, psSHP->fpSHP );
+
+ psSHP->nFileSize = (pabyBuf[24] * 256 * 256 * 256
+ + pabyBuf[25] * 256 * 256
+ + pabyBuf[26] * 256
+ + pabyBuf[27]) * 2;
+
+/* -------------------------------------------------------------------- */
+/* Read SHX file Header info */
+/* -------------------------------------------------------------------- */
+ if( psSHP->sHooks.FRead( pabyBuf, 100, 1, psSHP->fpSHX ) != 1
+ || pabyBuf[0] != 0
+ || pabyBuf[1] != 0
+ || pabyBuf[2] != 0x27
+ || (pabyBuf[3] != 0x0a && pabyBuf[3] != 0x0d) )
+ {
+ psSHP->sHooks.Error( ".shx file is unreadable, or corrupt." );
+ psSHP->sHooks.FClose( psSHP->fpSHP );
+ psSHP->sHooks.FClose( psSHP->fpSHX );
+ free( psSHP );
+
+ return( NULL );
+ }
+
+ psSHP->nRecords = pabyBuf[27] + pabyBuf[26] * 256
+ + pabyBuf[25] * 256 * 256 + pabyBuf[24] * 256 * 256 * 256;
+ psSHP->nRecords = (psSHP->nRecords*2 - 100) / 8;
+
+ psSHP->nShapeType = pabyBuf[32];
+
+ if( psSHP->nRecords < 0 || psSHP->nRecords > 256000000 )
+ {
+ char szError[200];
+
+ sprintf( szError,
+ "Record count in .shp header is %d, which seems\n"
+ "unreasonable. Assuming header is corrupt.",
+ psSHP->nRecords );
+ psSHP->sHooks.Error( szError );
+ psSHP->sHooks.FClose( psSHP->fpSHP );
+ psSHP->sHooks.FClose( psSHP->fpSHX );
+ free( psSHP );
+ free(pabyBuf);
+
+ return( NULL );
+ }
+
+/* -------------------------------------------------------------------- */
+/* Read the bounds. */
+/* -------------------------------------------------------------------- */
+ if( bBigEndian ) SwapWord( 8, pabyBuf+36 );
+ memcpy( &dValue, pabyBuf+36, 8 );
+ psSHP->adBoundsMin[0] = dValue;
+
+ if( bBigEndian ) SwapWord( 8, pabyBuf+44 );
+ memcpy( &dValue, pabyBuf+44, 8 );
+ psSHP->adBoundsMin[1] = dValue;
+
+ if( bBigEndian ) SwapWord( 8, pabyBuf+52 );
+ memcpy( &dValue, pabyBuf+52, 8 );
+ psSHP->adBoundsMax[0] = dValue;
+
+ if( bBigEndian ) SwapWord( 8, pabyBuf+60 );
+ memcpy( &dValue, pabyBuf+60, 8 );
+ psSHP->adBoundsMax[1] = dValue;
+
+ if( bBigEndian ) SwapWord( 8, pabyBuf+68 ); /* z */
+ memcpy( &dValue, pabyBuf+68, 8 );
+ psSHP->adBoundsMin[2] = dValue;
+
+ if( bBigEndian ) SwapWord( 8, pabyBuf+76 );
+ memcpy( &dValue, pabyBuf+76, 8 );
+ psSHP->adBoundsMax[2] = dValue;
+
+ if( bBigEndian ) SwapWord( 8, pabyBuf+84 ); /* z */
+ memcpy( &dValue, pabyBuf+84, 8 );
+ psSHP->adBoundsMin[3] = dValue;
+
+ if( bBigEndian ) SwapWord( 8, pabyBuf+92 );
+ memcpy( &dValue, pabyBuf+92, 8 );
+ psSHP->adBoundsMax[3] = dValue;
+
+ free( pabyBuf );
+
+/* -------------------------------------------------------------------- */
+/* Read the .shx file to get the offsets to each record in */
+/* the .shp file. */
+/* -------------------------------------------------------------------- */
+ psSHP->nMaxRecords = psSHP->nRecords;
+
+ psSHP->panRecOffset =
+ (int *) malloc(sizeof(int) * MAX(1,psSHP->nMaxRecords) );
+ psSHP->panRecSize =
+ (int *) malloc(sizeof(int) * MAX(1,psSHP->nMaxRecords) );
+ pabyBuf = (uchar *) malloc(8 * MAX(1,psSHP->nRecords) );
+
+ if (psSHP->panRecOffset == NULL ||
+ psSHP->panRecSize == NULL ||
+ pabyBuf == NULL)
+ {
+ char szError[200];
+
+ sprintf(szError,
+ "Not enough memory to allocate requested memory (nRecords=%d).\n"
+ "Probably broken SHP file",
+ psSHP->nRecords );
+ psSHP->sHooks.Error( szError );
+ psSHP->sHooks.FClose( psSHP->fpSHP );
+ psSHP->sHooks.FClose( psSHP->fpSHX );
+ if (psSHP->panRecOffset) free( psSHP->panRecOffset );
+ if (psSHP->panRecSize) free( psSHP->panRecSize );
+ if (pabyBuf) free( pabyBuf );
+ free( psSHP );
+ return( NULL );
+ }
+
+ if( (int) psSHP->sHooks.FRead( pabyBuf, 8, psSHP->nRecords, psSHP->fpSHX )
+ != psSHP->nRecords )
+ {
+ char szError[200];
+
+ sprintf( szError,
+ "Failed to read all values for %d records in .shx file.",
+ psSHP->nRecords );
+ psSHP->sHooks.Error( szError );
+
+ /* SHX is short or unreadable for some reason. */
+ psSHP->sHooks.FClose( psSHP->fpSHP );
+ psSHP->sHooks.FClose( psSHP->fpSHX );
+ free( psSHP->panRecOffset );
+ free( psSHP->panRecSize );
+ free( pabyBuf );
+ free( psSHP );
+
+ return( NULL );
+ }
+
+ /* In read-only mode, we can close the SHX now */
+ if (strcmp(pszAccess, "rb") == 0)
+ {
+ psSHP->sHooks.FClose( psSHP->fpSHX );
+ psSHP->fpSHX = NULL;
+ }
+
+ for( i = 0; i < psSHP->nRecords; i++ )
+ {
+ int32 nOffset, nLength;
+
+ memcpy( &nOffset, pabyBuf + i * 8, 4 );
+ if( !bBigEndian ) SwapWord( 4, &nOffset );
+
+ memcpy( &nLength, pabyBuf + i * 8 + 4, 4 );
+ if( !bBigEndian ) SwapWord( 4, &nLength );
+
+ psSHP->panRecOffset[i] = nOffset*2;
+ psSHP->panRecSize[i] = nLength*2;
+ }
+ free( pabyBuf );
+
+ return( psSHP );
+}
+
+/************************************************************************/
+/* SHPClose() */
+/* */
+/* Close the .shp and .shx files. */
+/************************************************************************/
+
+void SHPAPI_CALL
+SHPClose(SHPHandle psSHP )
+
+{
+ if( psSHP == NULL )
+ return;
+
+/* -------------------------------------------------------------------- */
+/* Update the header if we have modified anything. */
+/* -------------------------------------------------------------------- */
+ if( psSHP->bUpdated )
+ SHPWriteHeader( psSHP );
+
+/* -------------------------------------------------------------------- */
+/* Free all resources, and close files. */
+/* -------------------------------------------------------------------- */
+ free( psSHP->panRecOffset );
+ free( psSHP->panRecSize );
+
+ if ( psSHP->fpSHX != NULL)
+ psSHP->sHooks.FClose( psSHP->fpSHX );
+ psSHP->sHooks.FClose( psSHP->fpSHP );
+
+ if( psSHP->pabyRec != NULL )
+ {
+ free( psSHP->pabyRec );
+ }
+
+ free( psSHP );
+}
+
+/************************************************************************/
+/* SHPGetInfo() */
+/* */
+/* Fetch general information about the shape file. */
+/************************************************************************/
+
+void SHPAPI_CALL
+SHPGetInfo(SHPHandle psSHP, int * pnEntities, int * pnShapeType,
+ double * padfMinBound, double * padfMaxBound )
+
+{
+ int i;
+
+ if( psSHP == NULL )
+ return;
+
+ if( pnEntities != NULL )
+ *pnEntities = psSHP->nRecords;
+
+ if( pnShapeType != NULL )
+ *pnShapeType = psSHP->nShapeType;
+
+ for( i = 0; i < 4; i++ )
+ {
+ if( padfMinBound != NULL )
+ padfMinBound[i] = psSHP->adBoundsMin[i];
+ if( padfMaxBound != NULL )
+ padfMaxBound[i] = psSHP->adBoundsMax[i];
+ }
+}
+
+/************************************************************************/
+/* SHPCreate() */
+/* */
+/* Create a new shape file and return a handle to the open */
+/* shape file with read/write access. */
+/************************************************************************/
+
+SHPHandle SHPAPI_CALL
+SHPCreate( const char * pszLayer, int nShapeType )
+
+{
+ SAHooks sHooks;
+
+ SASetupDefaultHooks( &sHooks );
+
+ return SHPCreateLL( pszLayer, nShapeType, &sHooks );
+}
+
+/************************************************************************/
+/* SHPCreate() */
+/* */
+/* Create a new shape file and return a handle to the open */
+/* shape file with read/write access. */
+/************************************************************************/
+
+SHPHandle SHPAPI_CALL
+SHPCreateLL( const char * pszLayer, int nShapeType, SAHooks *psHooks )
+
+{
+ char *pszBasename, *pszFullname;
+ int i;
+ SAFile fpSHP, fpSHX;
+ uchar abyHeader[100];
+ int32 i32;
+ double dValue;
+
+/* -------------------------------------------------------------------- */
+/* Establish the byte order on this system. */
+/* -------------------------------------------------------------------- */
+ i = 1;
+ if( *((uchar *) &i) == 1 )
+ bBigEndian = FALSE;
+ else
+ bBigEndian = TRUE;
+
+/* -------------------------------------------------------------------- */
+/* Compute the base (layer) name. If there is any extension */
+/* on the passed in filename we will strip it off. */
+/* -------------------------------------------------------------------- */
+ pszBasename = (char *) malloc(strlen(pszLayer)+5);
+ strcpy( pszBasename, pszLayer );
+ for( i = strlen(pszBasename)-1;
+ i > 0 && pszBasename[i] != '.' && pszBasename[i] != '/'
+ && pszBasename[i] != '\\';
+ i-- ) {}
+
+ if( pszBasename[i] == '.' )
+ pszBasename[i] = '\0';
+
+/* -------------------------------------------------------------------- */
+/* Open the two files so we can write their headers. */
+/* -------------------------------------------------------------------- */
+ pszFullname = (char *) malloc(strlen(pszBasename) + 5);
+ sprintf( pszFullname, "%s.shp", pszBasename );
+ fpSHP = psHooks->FOpen(pszFullname, "wb" );
+ if( fpSHP == NULL )
+ {
+ psHooks->Error( "Failed to create file .shp file." );
+ return( NULL );
+ }
+
+ sprintf( pszFullname, "%s.shx", pszBasename );
+ fpSHX = psHooks->FOpen(pszFullname, "wb" );
+ if( fpSHX == NULL )
+ {
+ psHooks->Error( "Failed to create file .shx file." );
+ return( NULL );
+ }
+
+ free( pszFullname );
+ free( pszBasename );
+
+/* -------------------------------------------------------------------- */
+/* Prepare header block for .shp file. */
+/* -------------------------------------------------------------------- */
+ for( i = 0; i < 100; i++ )
+ abyHeader[i] = 0;
+
+ abyHeader[2] = 0x27; /* magic cookie */
+ abyHeader[3] = 0x0a;
+
+ i32 = 50; /* file size */
+ ByteCopy( &i32, abyHeader+24, 4 );
+ if( !bBigEndian ) SwapWord( 4, abyHeader+24 );
+
+ i32 = 1000; /* version */
+ ByteCopy( &i32, abyHeader+28, 4 );
+ if( bBigEndian ) SwapWord( 4, abyHeader+28 );
+
+ i32 = nShapeType; /* shape type */
+ ByteCopy( &i32, abyHeader+32, 4 );
+ if( bBigEndian ) SwapWord( 4, abyHeader+32 );
+
+ dValue = 0.0; /* set bounds */
+ ByteCopy( &dValue, abyHeader+36, 8 );
+ ByteCopy( &dValue, abyHeader+44, 8 );
+ ByteCopy( &dValue, abyHeader+52, 8 );
+ ByteCopy( &dValue, abyHeader+60, 8 );
+
+/* -------------------------------------------------------------------- */
+/* Write .shp file header. */
+/* -------------------------------------------------------------------- */
+ if( psHooks->FWrite( abyHeader, 100, 1, fpSHP ) != 1 )
+ {
+ psHooks->Error( "Failed to write .shp header." );
+ return NULL;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Prepare, and write .shx file header. */
+/* -------------------------------------------------------------------- */
+ i32 = 50; /* file size */
+ ByteCopy( &i32, abyHeader+24, 4 );
+ if( !bBigEndian ) SwapWord( 4, abyHeader+24 );
+
+ if( psHooks->FWrite( abyHeader, 100, 1, fpSHX ) != 1 )
+ {
+ psHooks->Error( "Failed to write .shx header." );
+ return NULL;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Close the files, and then open them as regular existing files. */
+/* -------------------------------------------------------------------- */
+ psHooks->FClose( fpSHP );
+ psHooks->FClose( fpSHX );
+
+ return( SHPOpenLL( pszLayer, "r+b", psHooks ) );
+}
+
+/************************************************************************/
+/* _SHPSetBounds() */
+/* */
+/* Compute a bounds rectangle for a shape, and set it into the */
+/* indicated location in the record. */
+/************************************************************************/
+
+static void _SHPSetBounds( uchar * pabyRec, SHPObject * psShape )
+
+{
+ ByteCopy( &(psShape->dfXMin), pabyRec + 0, 8 );
+ ByteCopy( &(psShape->dfYMin), pabyRec + 8, 8 );
+ ByteCopy( &(psShape->dfXMax), pabyRec + 16, 8 );
+ ByteCopy( &(psShape->dfYMax), pabyRec + 24, 8 );
+
+ if( bBigEndian )
+ {
+ SwapWord( 8, pabyRec + 0 );
+ SwapWord( 8, pabyRec + 8 );
+ SwapWord( 8, pabyRec + 16 );
+ SwapWord( 8, pabyRec + 24 );
+ }
+}
+
+/************************************************************************/
+/* SHPComputeExtents() */
+/* */
+/* Recompute the extents of a shape. Automatically done by */
+/* SHPCreateObject(). */
+/************************************************************************/
+
+void SHPAPI_CALL
+SHPComputeExtents( SHPObject * psObject )
+
+{
+ int i;
+
+/* -------------------------------------------------------------------- */
+/* Build extents for this object. */
+/* -------------------------------------------------------------------- */
+ if( psObject->nVertices > 0 )
+ {
+ psObject->dfXMin = psObject->dfXMax = psObject->padfX[0];
+ psObject->dfYMin = psObject->dfYMax = psObject->padfY[0];
+ psObject->dfZMin = psObject->dfZMax = psObject->padfZ[0];
+ psObject->dfMMin = psObject->dfMMax = psObject->padfM[0];
+ }
+
+ for( i = 0; i < psObject->nVertices; i++ )
+ {
+ psObject->dfXMin = MIN(psObject->dfXMin, psObject->padfX[i]);
+ psObject->dfYMin = MIN(psObject->dfYMin, psObject->padfY[i]);
+ psObject->dfZMin = MIN(psObject->dfZMin, psObject->padfZ[i]);
+ psObject->dfMMin = MIN(psObject->dfMMin, psObject->padfM[i]);
+
+ psObject->dfXMax = MAX(psObject->dfXMax, psObject->padfX[i]);
+ psObject->dfYMax = MAX(psObject->dfYMax, psObject->padfY[i]);
+ psObject->dfZMax = MAX(psObject->dfZMax, psObject->padfZ[i]);
+ psObject->dfMMax = MAX(psObject->dfMMax, psObject->padfM[i]);
+ }
+}
+
+/************************************************************************/
+/* SHPCreateObject() */
+/* */
+/* Create a shape object. It should be freed with */
+/* SHPDestroyObject(). */
+/************************************************************************/
+
+SHPObject SHPAPI_CALL1(*)
+SHPCreateObject( int nSHPType, int nShapeId, int nParts,
+ const int * panPartStart, const int * panPartType,
+ int nVertices, const double *padfX, const double *padfY,
+ const double * padfZ, const double * padfM )
+
+{
+ SHPObject *psObject;
+ int i, bHasM, bHasZ;
+
+ psObject = (SHPObject *) calloc(1,sizeof(SHPObject));
+ psObject->nSHPType = nSHPType;
+ psObject->nShapeId = nShapeId;
+ psObject->bMeasureIsUsed = FALSE;
+
+/* -------------------------------------------------------------------- */
+/* Establish whether this shape type has M, and Z values. */
+/* -------------------------------------------------------------------- */
+ if( nSHPType == SHPT_ARCM
+ || nSHPType == SHPT_POINTM
+ || nSHPType == SHPT_POLYGONM
+ || nSHPType == SHPT_MULTIPOINTM )
+ {
+ bHasM = TRUE;
+ bHasZ = FALSE;
+ }
+ else if( nSHPType == SHPT_ARCZ
+ || nSHPType == SHPT_POINTZ
+ || nSHPType == SHPT_POLYGONZ
+ || nSHPType == SHPT_MULTIPOINTZ
+ || nSHPType == SHPT_MULTIPATCH )
+ {
+ bHasM = TRUE;
+ bHasZ = TRUE;
+ }
+ else
+ {
+ bHasM = FALSE;
+ bHasZ = FALSE;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Capture parts. Note that part type is optional, and */
+/* defaults to ring. */
+/* -------------------------------------------------------------------- */
+ if( nSHPType == SHPT_ARC || nSHPType == SHPT_POLYGON
+ || nSHPType == SHPT_ARCM || nSHPType == SHPT_POLYGONM
+ || nSHPType == SHPT_ARCZ || nSHPType == SHPT_POLYGONZ
+ || nSHPType == SHPT_MULTIPATCH )
+ {
+ psObject->nParts = MAX(1,nParts);
+
+ psObject->panPartStart = (int *)
+ malloc(sizeof(int) * psObject->nParts);
+ psObject->panPartType = (int *)
+ malloc(sizeof(int) * psObject->nParts);
+
+ psObject->panPartStart[0] = 0;
+ psObject->panPartType[0] = SHPP_RING;
+
+ for( i = 0; i < nParts; i++ )
+ {
+ psObject->panPartStart[i] = panPartStart[i];
+
+ if( panPartType != NULL )
+ psObject->panPartType[i] = panPartType[i];
+ else
+ psObject->panPartType[i] = SHPP_RING;
+ }
+
+ if( psObject->panPartStart[0] != 0 )
+ psObject->panPartStart[0] = 0;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Capture vertices. Note that Z and M are optional, but X and */
+/* Y are not. */
+/* -------------------------------------------------------------------- */
+ if( nVertices > 0 )
+ {
+ psObject->padfX = (double *) calloc(sizeof(double),nVertices);
+ psObject->padfY = (double *) calloc(sizeof(double),nVertices);
+ psObject->padfZ = (double *) calloc(sizeof(double),nVertices);
+ psObject->padfM = (double *) calloc(sizeof(double),nVertices);
+
+ assert( padfX != NULL );
+ assert( padfY != NULL );
+
+ for( i = 0; i < nVertices; i++ )
+ {
+ psObject->padfX[i] = padfX[i];
+ psObject->padfY[i] = padfY[i];
+ if( padfZ != NULL && bHasZ )
+ psObject->padfZ[i] = padfZ[i];
+ if( padfM != NULL && bHasM )
+ psObject->padfM[i] = padfM[i];
+ }
+ if( padfM != NULL && bHasM )
+ psObject->bMeasureIsUsed = TRUE;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Compute the extents. */
+/* -------------------------------------------------------------------- */
+ psObject->nVertices = nVertices;
+ SHPComputeExtents( psObject );
+
+ return( psObject );
+}
+
+/************************************************************************/
+/* SHPCreateSimpleObject() */
+/* */
+/* Create a simple (common) shape object. Destroy with */
+/* SHPDestroyObject(). */
+/************************************************************************/
+
+SHPObject SHPAPI_CALL1(*)
+SHPCreateSimpleObject( int nSHPType, int nVertices,
+ const double * padfX, const double * padfY,
+ const double * padfZ )
+
+{
+ return( SHPCreateObject( nSHPType, -1, 0, NULL, NULL,
+ nVertices, padfX, padfY, padfZ, NULL ) );
+}
+
+/************************************************************************/
+/* SHPWriteObject() */
+/* */
+/* Write out the vertices of a new structure. Note that it is */
+/* only possible to write vertices at the end of the file. */
+/************************************************************************/
+
+int SHPAPI_CALL
+SHPWriteObject(SHPHandle psSHP, int nShapeId, SHPObject * psObject )
+
+{
+ int nRecordOffset, i, nRecordSize=0;
+ uchar *pabyRec;
+ int32 i32;
+
+ psSHP->bUpdated = TRUE;
+
+/* -------------------------------------------------------------------- */
+/* Ensure that shape object matches the type of the file it is */
+/* being written to. */
+/* -------------------------------------------------------------------- */
+ assert( psObject->nSHPType == psSHP->nShapeType
+ || psObject->nSHPType == SHPT_NULL );
+
+/* -------------------------------------------------------------------- */
+/* Ensure that -1 is used for appends. Either blow an */
+/* assertion, or if they are disabled, set the shapeid to -1 */
+/* for appends. */
+/* -------------------------------------------------------------------- */
+ assert( nShapeId == -1
+ || (nShapeId >= 0 && nShapeId < psSHP->nRecords) );
+
+ if( nShapeId != -1 && nShapeId >= psSHP->nRecords )
+ nShapeId = -1;
+
+/* -------------------------------------------------------------------- */
+/* Add the new entity to the in memory index. */
+/* -------------------------------------------------------------------- */
+ if( nShapeId == -1 && psSHP->nRecords+1 > psSHP->nMaxRecords )
+ {
+ psSHP->nMaxRecords =(int) ( psSHP->nMaxRecords * 1.3 + 100);
+
+ psSHP->panRecOffset = (int *)
+ SfRealloc(psSHP->panRecOffset,sizeof(int) * psSHP->nMaxRecords );
+ psSHP->panRecSize = (int *)
+ SfRealloc(psSHP->panRecSize,sizeof(int) * psSHP->nMaxRecords );
+ }
+
+/* -------------------------------------------------------------------- */
+/* Initialize record. */
+/* -------------------------------------------------------------------- */
+ pabyRec = (uchar *) malloc(psObject->nVertices * 4 * sizeof(double)
+ + psObject->nParts * 8 + 128);
+
+/* -------------------------------------------------------------------- */
+/* Extract vertices for a Polygon or Arc. */
+/* -------------------------------------------------------------------- */
+ if( psObject->nSHPType == SHPT_POLYGON
+ || psObject->nSHPType == SHPT_POLYGONZ
+ || psObject->nSHPType == SHPT_POLYGONM
+ || psObject->nSHPType == SHPT_ARC
+ || psObject->nSHPType == SHPT_ARCZ
+ || psObject->nSHPType == SHPT_ARCM
+ || psObject->nSHPType == SHPT_MULTIPATCH )
+ {
+ int32 nPoints, nParts;
+ int i;
+
+ nPoints = psObject->nVertices;
+ nParts = psObject->nParts;
+
+ _SHPSetBounds( pabyRec + 12, psObject );
+
+ if( bBigEndian ) SwapWord( 4, &nPoints );
+ if( bBigEndian ) SwapWord( 4, &nParts );
+
+ ByteCopy( &nPoints, pabyRec + 40 + 8, 4 );
+ ByteCopy( &nParts, pabyRec + 36 + 8, 4 );
+
+ nRecordSize = 52;
+
+ /*
+ * Write part start positions.
+ */
+ ByteCopy( psObject->panPartStart, pabyRec + 44 + 8,
+ 4 * psObject->nParts );
+ for( i = 0; i < psObject->nParts; i++ )
+ {
+ if( bBigEndian ) SwapWord( 4, pabyRec + 44 + 8 + 4*i );
+ nRecordSize += 4;
+ }
+
+ /*
+ * Write multipatch part types if needed.
+ */
+ if( psObject->nSHPType == SHPT_MULTIPATCH )
+ {
+ memcpy( pabyRec + nRecordSize, psObject->panPartType,
+ 4*psObject->nParts );
+ for( i = 0; i < psObject->nParts; i++ )
+ {
+ if( bBigEndian ) SwapWord( 4, pabyRec + nRecordSize );
+ nRecordSize += 4;
+ }
+ }
+
+ /*
+ * Write the (x,y) vertex values.
+ */
+ for( i = 0; i < psObject->nVertices; i++ )
+ {
+ ByteCopy( psObject->padfX + i, pabyRec + nRecordSize, 8 );
+ ByteCopy( psObject->padfY + i, pabyRec + nRecordSize + 8, 8 );
+
+ if( bBigEndian )
+ SwapWord( 8, pabyRec + nRecordSize );
+
+ if( bBigEndian )
+ SwapWord( 8, pabyRec + nRecordSize + 8 );
+
+ nRecordSize += 2 * 8;
+ }
+
+ /*
+ * Write the Z coordinates (if any).
+ */
+ if( psObject->nSHPType == SHPT_POLYGONZ
+ || psObject->nSHPType == SHPT_ARCZ
+ || psObject->nSHPType == SHPT_MULTIPATCH )
+ {
+ ByteCopy( &(psObject->dfZMin), pabyRec + nRecordSize, 8 );
+ if( bBigEndian ) SwapWord( 8, pabyRec + nRecordSize );
+ nRecordSize += 8;
+
+ ByteCopy( &(psObject->dfZMax), pabyRec + nRecordSize, 8 );
+ if( bBigEndian ) SwapWord( 8, pabyRec + nRecordSize );
+ nRecordSize += 8;
+
+ for( i = 0; i < psObject->nVertices; i++ )
+ {
+ ByteCopy( psObject->padfZ + i, pabyRec + nRecordSize, 8 );
+ if( bBigEndian ) SwapWord( 8, pabyRec + nRecordSize );
+ nRecordSize += 8;
+ }
+ }
+
+ /*
+ * Write the M values, if any.
+ */
+ if( psObject->bMeasureIsUsed
+ && (psObject->nSHPType == SHPT_POLYGONM
+ || psObject->nSHPType == SHPT_ARCM
+#ifndef DISABLE_MULTIPATCH_MEASURE
+ || psObject->nSHPType == SHPT_MULTIPATCH
+#endif
+ || psObject->nSHPType == SHPT_POLYGONZ
+ || psObject->nSHPType == SHPT_ARCZ) )
+ {
+ ByteCopy( &(psObject->dfMMin), pabyRec + nRecordSize, 8 );
+ if( bBigEndian ) SwapWord( 8, pabyRec + nRecordSize );
+ nRecordSize += 8;
+
+ ByteCopy( &(psObject->dfMMax), pabyRec + nRecordSize, 8 );
+ if( bBigEndian ) SwapWord( 8, pabyRec + nRecordSize );
+ nRecordSize += 8;
+
+ for( i = 0; i < psObject->nVertices; i++ )
+ {
+ ByteCopy( psObject->padfM + i, pabyRec + nRecordSize, 8 );
+ if( bBigEndian ) SwapWord( 8, pabyRec + nRecordSize );
+ nRecordSize += 8;
+ }
+ }
+ }
+
+/* -------------------------------------------------------------------- */
+/* Extract vertices for a MultiPoint. */
+/* -------------------------------------------------------------------- */
+ else if( psObject->nSHPType == SHPT_MULTIPOINT
+ || psObject->nSHPType == SHPT_MULTIPOINTZ
+ || psObject->nSHPType == SHPT_MULTIPOINTM )
+ {
+ int32 nPoints;
+ int i;
+
+ nPoints = psObject->nVertices;
+
+ _SHPSetBounds( pabyRec + 12, psObject );
+
+ if( bBigEndian ) SwapWord( 4, &nPoints );
+ ByteCopy( &nPoints, pabyRec + 44, 4 );
+
+ for( i = 0; i < psObject->nVertices; i++ )
+ {
+ ByteCopy( psObject->padfX + i, pabyRec + 48 + i*16, 8 );
+ ByteCopy( psObject->padfY + i, pabyRec + 48 + i*16 + 8, 8 );
+
+ if( bBigEndian ) SwapWord( 8, pabyRec + 48 + i*16 );
+ if( bBigEndian ) SwapWord( 8, pabyRec + 48 + i*16 + 8 );
+ }
+
+ nRecordSize = 48 + 16 * psObject->nVertices;
+
+ if( psObject->nSHPType == SHPT_MULTIPOINTZ )
+ {
+ ByteCopy( &(psObject->dfZMin), pabyRec + nRecordSize, 8 );
+ if( bBigEndian ) SwapWord( 8, pabyRec + nRecordSize );
+ nRecordSize += 8;
+
+ ByteCopy( &(psObject->dfZMax), pabyRec + nRecordSize, 8 );
+ if( bBigEndian ) SwapWord( 8, pabyRec + nRecordSize );
+ nRecordSize += 8;
+
+ for( i = 0; i < psObject->nVertices; i++ )
+ {
+ ByteCopy( psObject->padfZ + i, pabyRec + nRecordSize, 8 );
+ if( bBigEndian ) SwapWord( 8, pabyRec + nRecordSize );
+ nRecordSize += 8;
+ }
+ }
+
+ if( psObject->bMeasureIsUsed
+ && (psObject->nSHPType == SHPT_MULTIPOINTZ
+ || psObject->nSHPType == SHPT_MULTIPOINTM) )
+ {
+ ByteCopy( &(psObject->dfMMin), pabyRec + nRecordSize, 8 );
+ if( bBigEndian ) SwapWord( 8, pabyRec + nRecordSize );
+ nRecordSize += 8;
+
+ ByteCopy( &(psObject->dfMMax), pabyRec + nRecordSize, 8 );
+ if( bBigEndian ) SwapWord( 8, pabyRec + nRecordSize );
+ nRecordSize += 8;
+
+ for( i = 0; i < psObject->nVertices; i++ )
+ {
+ ByteCopy( psObject->padfM + i, pabyRec + nRecordSize, 8 );
+ if( bBigEndian ) SwapWord( 8, pabyRec + nRecordSize );
+ nRecordSize += 8;
+ }
+ }
+ }
+
+/* -------------------------------------------------------------------- */
+/* Write point. */
+/* -------------------------------------------------------------------- */
+ else if( psObject->nSHPType == SHPT_POINT
+ || psObject->nSHPType == SHPT_POINTZ
+ || psObject->nSHPType == SHPT_POINTM )
+ {
+ ByteCopy( psObject->padfX, pabyRec + 12, 8 );
+ ByteCopy( psObject->padfY, pabyRec + 20, 8 );
+
+ if( bBigEndian ) SwapWord( 8, pabyRec + 12 );
+ if( bBigEndian ) SwapWord( 8, pabyRec + 20 );
+
+ nRecordSize = 28;
+
+ if( psObject->nSHPType == SHPT_POINTZ )
+ {
+ ByteCopy( psObject->padfZ, pabyRec + nRecordSize, 8 );
+ if( bBigEndian ) SwapWord( 8, pabyRec + nRecordSize );
+ nRecordSize += 8;
+ }
+
+ if( psObject->bMeasureIsUsed
+ && (psObject->nSHPType == SHPT_POINTZ
+ || psObject->nSHPType == SHPT_POINTM) )
+ {
+ ByteCopy( psObject->padfM, pabyRec + nRecordSize, 8 );
+ if( bBigEndian ) SwapWord( 8, pabyRec + nRecordSize );
+ nRecordSize += 8;
+ }
+ }
+
+/* -------------------------------------------------------------------- */
+/* Not much to do for null geometries. */
+/* -------------------------------------------------------------------- */
+ else if( psObject->nSHPType == SHPT_NULL )
+ {
+ nRecordSize = 12;
+ }
+
+ else
+ {
+ /* unknown type */
+ assert( FALSE );
+ }
+
+/* -------------------------------------------------------------------- */
+/* Establish where we are going to put this record. If we are */
+/* rewriting and existing record, and it will fit, then put it */
+/* back where the original came from. Otherwise write at the end. */
+/* -------------------------------------------------------------------- */
+ if( nShapeId == -1 || psSHP->panRecSize[nShapeId] < nRecordSize-8 )
+ {
+ if( nShapeId == -1 )
+ nShapeId = psSHP->nRecords++;
+
+ psSHP->panRecOffset[nShapeId] = nRecordOffset = psSHP->nFileSize;
+ psSHP->panRecSize[nShapeId] = nRecordSize-8;
+ psSHP->nFileSize += nRecordSize;
+ }
+ else
+ {
+ nRecordOffset = psSHP->panRecOffset[nShapeId];
+ psSHP->panRecSize[nShapeId] = nRecordSize-8;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Set the shape type, record number, and record size. */
+/* -------------------------------------------------------------------- */
+ i32 = nShapeId+1; /* record # */
+ if( !bBigEndian ) SwapWord( 4, &i32 );
+ ByteCopy( &i32, pabyRec, 4 );
+
+ i32 = (nRecordSize-8)/2; /* record size */
+ if( !bBigEndian ) SwapWord( 4, &i32 );
+ ByteCopy( &i32, pabyRec + 4, 4 );
+
+ i32 = psObject->nSHPType; /* shape type */
+ if( bBigEndian ) SwapWord( 4, &i32 );
+ ByteCopy( &i32, pabyRec + 8, 4 );
+
+/* -------------------------------------------------------------------- */
+/* Write out record. */
+/* -------------------------------------------------------------------- */
+ if( psSHP->sHooks.FSeek( psSHP->fpSHP, nRecordOffset, 0 ) != 0
+ || psSHP->sHooks.FWrite( pabyRec, nRecordSize, 1, psSHP->fpSHP ) < 1 )
+ {
+ psSHP->sHooks.Error( "Error in psSHP->sHooks.FSeek() or fwrite() writing object to .shp file." );
+ free( pabyRec );
+ return -1;
+ }
+
+ free( pabyRec );
+
+/* -------------------------------------------------------------------- */
+/* Expand file wide bounds based on this shape. */
+/* -------------------------------------------------------------------- */
+ if( psSHP->adBoundsMin[0] == 0.0
+ && psSHP->adBoundsMax[0] == 0.0
+ && psSHP->adBoundsMin[1] == 0.0
+ && psSHP->adBoundsMax[1] == 0.0 )
+ {
+ if( psObject->nSHPType == SHPT_NULL || psObject->nVertices == 0 )
+ {
+ psSHP->adBoundsMin[0] = psSHP->adBoundsMax[0] = 0.0;
+ psSHP->adBoundsMin[1] = psSHP->adBoundsMax[1] = 0.0;
+ psSHP->adBoundsMin[2] = psSHP->adBoundsMax[2] = 0.0;
+ psSHP->adBoundsMin[3] = psSHP->adBoundsMax[3] = 0.0;
+ }
+ else
+ {
+ psSHP->adBoundsMin[0] = psSHP->adBoundsMax[0] = psObject->padfX[0];
+ psSHP->adBoundsMin[1] = psSHP->adBoundsMax[1] = psObject->padfY[0];
+ psSHP->adBoundsMin[2] = psSHP->adBoundsMax[2] = psObject->padfZ[0];
+ psSHP->adBoundsMin[3] = psSHP->adBoundsMax[3] = psObject->padfM[0];
+ }
+ }
+
+ for( i = 0; i < psObject->nVertices; i++ )
+ {
+ psSHP->adBoundsMin[0] = MIN(psSHP->adBoundsMin[0],psObject->padfX[i]);
+ psSHP->adBoundsMin[1] = MIN(psSHP->adBoundsMin[1],psObject->padfY[i]);
+ psSHP->adBoundsMin[2] = MIN(psSHP->adBoundsMin[2],psObject->padfZ[i]);
+ psSHP->adBoundsMin[3] = MIN(psSHP->adBoundsMin[3],psObject->padfM[i]);
+ psSHP->adBoundsMax[0] = MAX(psSHP->adBoundsMax[0],psObject->padfX[i]);
+ psSHP->adBoundsMax[1] = MAX(psSHP->adBoundsMax[1],psObject->padfY[i]);
+ psSHP->adBoundsMax[2] = MAX(psSHP->adBoundsMax[2],psObject->padfZ[i]);
+ psSHP->adBoundsMax[3] = MAX(psSHP->adBoundsMax[3],psObject->padfM[i]);
+ }
+
+ return( nShapeId );
+}
+
+/************************************************************************/
+/* SHPReadObject() */
+/* */
+/* Read the vertices, parts, and other non-attribute information */
+/* for one shape. */
+/************************************************************************/
+
+SHPObject SHPAPI_CALL1(*)
+SHPReadObject( SHPHandle psSHP, int hEntity )
+
+{
+ int nEntitySize, nRequiredSize;
+ SHPObject *psShape;
+ char pszErrorMsg[128];
+
+/* -------------------------------------------------------------------- */
+/* Validate the record/entity number. */
+/* -------------------------------------------------------------------- */
+ if( hEntity < 0 || hEntity >= psSHP->nRecords )
+ return( NULL );
+
+/* -------------------------------------------------------------------- */
+/* Ensure our record buffer is large enough. */
+/* -------------------------------------------------------------------- */
+ nEntitySize = psSHP->panRecSize[hEntity]+8;
+ if( nEntitySize > psSHP->nBufSize )
+ {
+ psSHP->pabyRec = (uchar *) SfRealloc(psSHP->pabyRec,nEntitySize);
+ if (psSHP->pabyRec == NULL)
+ {
+ char szError[200];
+
+ /* Reallocate previous successfull size for following features */
+ psSHP->pabyRec = malloc(psSHP->nBufSize);
+
+ sprintf( szError,
+ "Not enough memory to allocate requested memory (nBufSize=%d). "
+ "Probably broken SHP file", psSHP->nBufSize );
+ psSHP->sHooks.Error( szError );
+ return NULL;
+ }
+
+ /* Only set new buffer size after successfull alloc */
+ psSHP->nBufSize = nEntitySize;
+ }
+
+ /* In case we were not able to reallocate the buffer on a previous step */
+ if (psSHP->pabyRec == NULL)
+ {
+ return NULL;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Read the record. */
+/* -------------------------------------------------------------------- */
+ if( psSHP->sHooks.FSeek( psSHP->fpSHP, psSHP->panRecOffset[hEntity], 0 ) != 0
+ || psSHP->sHooks.FRead( psSHP->pabyRec, nEntitySize, 1,
+ psSHP->fpSHP ) != 1 )
+ {
+ /*
+ * TODO - mloskot: Consider detailed diagnostics of shape file,
+ * for example to detect if file is truncated.
+ */
+
+ psSHP->sHooks.Error( "Error in fseek() or fread() reading object from .shp file." );
+ return NULL;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Allocate and minimally initialize the object. */
+/* -------------------------------------------------------------------- */
+ psShape = (SHPObject *) calloc(1,sizeof(SHPObject));
+ psShape->nShapeId = hEntity;
+ psShape->bMeasureIsUsed = FALSE;
+
+ if ( 8 + 4 > nEntitySize )
+ {
+ snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : nEntitySize = %d",
+ hEntity, nEntitySize);
+ psSHP->sHooks.Error( pszErrorMsg );
+ SHPDestroyObject(psShape);
+ return NULL;
+ }
+ memcpy( &psShape->nSHPType, psSHP->pabyRec + 8, 4 );
+
+ if( bBigEndian ) SwapWord( 4, &(psShape->nSHPType) );
+
+/* ==================================================================== */
+/* Extract vertices for a Polygon or Arc. */
+/* ==================================================================== */
+ if( psShape->nSHPType == SHPT_POLYGON || psShape->nSHPType == SHPT_ARC
+ || psShape->nSHPType == SHPT_POLYGONZ
+ || psShape->nSHPType == SHPT_POLYGONM
+ || psShape->nSHPType == SHPT_ARCZ
+ || psShape->nSHPType == SHPT_ARCM
+ || psShape->nSHPType == SHPT_MULTIPATCH )
+ {
+ int32 nPoints, nParts;
+ int i, nOffset;
+
+ if ( 40 + 8 + 4 > nEntitySize )
+ {
+ snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : nEntitySize = %d",
+ hEntity, nEntitySize);
+ psSHP->sHooks.Error( pszErrorMsg );
+ SHPDestroyObject(psShape);
+ return NULL;
+ }
+/* -------------------------------------------------------------------- */
+/* Get the X/Y bounds. */
+/* -------------------------------------------------------------------- */
+ memcpy( &(psShape->dfXMin), psSHP->pabyRec + 8 + 4, 8 );
+ memcpy( &(psShape->dfYMin), psSHP->pabyRec + 8 + 12, 8 );
+ memcpy( &(psShape->dfXMax), psSHP->pabyRec + 8 + 20, 8 );
+ memcpy( &(psShape->dfYMax), psSHP->pabyRec + 8 + 28, 8 );
+
+ if( bBigEndian ) SwapWord( 8, &(psShape->dfXMin) );
+ if( bBigEndian ) SwapWord( 8, &(psShape->dfYMin) );
+ if( bBigEndian ) SwapWord( 8, &(psShape->dfXMax) );
+ if( bBigEndian ) SwapWord( 8, &(psShape->dfYMax) );
+
+/* -------------------------------------------------------------------- */
+/* Extract part/point count, and build vertex and part arrays */
+/* to proper size. */
+/* -------------------------------------------------------------------- */
+ memcpy( &nPoints, psSHP->pabyRec + 40 + 8, 4 );
+ memcpy( &nParts, psSHP->pabyRec + 36 + 8, 4 );
+
+ if( bBigEndian ) SwapWord( 4, &nPoints );
+ if( bBigEndian ) SwapWord( 4, &nParts );
+
+ if (nPoints < 0 || nParts < 0 ||
+ nPoints > 50 * 1000 * 1000 || nParts > 10 * 1000 * 1000)
+ {
+ snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d, nPoints=%d, nParts=%d.",
+ hEntity, nPoints, nParts);
+ psSHP->sHooks.Error( pszErrorMsg );
+ SHPDestroyObject(psShape);
+ return NULL;
+ }
+
+ /* With the previous checks on nPoints and nParts, */
+ /* we should not overflow here and after */
+ /* since 50 M * (16 + 8 + 8) = 1 600 MB */
+ nRequiredSize = 44 + 8 + 4 * nParts + 16 * nPoints;
+ if ( psShape->nSHPType == SHPT_POLYGONZ
+ || psShape->nSHPType == SHPT_ARCZ
+ || psShape->nSHPType == SHPT_MULTIPATCH )
+ {
+ nRequiredSize += 16 + 8 * nPoints;
+ }
+ if( psShape->nSHPType == SHPT_MULTIPATCH )
+ {
+ nRequiredSize += 4 * nParts;
+ }
+ if (nRequiredSize > nEntitySize)
+ {
+ snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d, nPoints=%d, nParts=%d, nEntitySize=%d.",
+ hEntity, nPoints, nParts, nEntitySize);
+ psSHP->sHooks.Error( pszErrorMsg );
+ SHPDestroyObject(psShape);
+ return NULL;
+ }
+
+ psShape->nVertices = nPoints;
+ psShape->padfX = (double *) calloc(nPoints,sizeof(double));
+ psShape->padfY = (double *) calloc(nPoints,sizeof(double));
+ psShape->padfZ = (double *) calloc(nPoints,sizeof(double));
+ psShape->padfM = (double *) calloc(nPoints,sizeof(double));
+
+ psShape->nParts = nParts;
+ psShape->panPartStart = (int *) calloc(nParts,sizeof(int));
+ psShape->panPartType = (int *) calloc(nParts,sizeof(int));
+
+ if (psShape->padfX == NULL ||
+ psShape->padfY == NULL ||
+ psShape->padfZ == NULL ||
+ psShape->padfM == NULL ||
+ psShape->panPartStart == NULL ||
+ psShape->panPartType == NULL)
+ {
+ snprintf(pszErrorMsg, 128,
+ "Not enough memory to allocate requested memory (nPoints=%d, nParts=%d) for shape %d. "
+ "Probably broken SHP file", hEntity, nPoints, nParts );
+ psSHP->sHooks.Error( pszErrorMsg );
+ SHPDestroyObject(psShape);
+ return NULL;
+ }
+
+ for( i = 0; i < nParts; i++ )
+ psShape->panPartType[i] = SHPP_RING;
+
+/* -------------------------------------------------------------------- */
+/* Copy out the part array from the record. */
+/* -------------------------------------------------------------------- */
+ memcpy( psShape->panPartStart, psSHP->pabyRec + 44 + 8, 4 * nParts );
+ for( i = 0; i < nParts; i++ )
+ {
+ if( bBigEndian ) SwapWord( 4, psShape->panPartStart+i );
+
+ /* We check that the offset is inside the vertex array */
+ if (psShape->panPartStart[i] < 0 ||
+ psShape->panPartStart[i] >= psShape->nVertices)
+ {
+ snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : panPartStart[%d] = %d, nVertices = %d",
+ hEntity, i, psShape->panPartStart[i], psShape->nVertices);
+ psSHP->sHooks.Error( pszErrorMsg );
+ SHPDestroyObject(psShape);
+ return NULL;
+ }
+ if (i > 0 && psShape->panPartStart[i] <= psShape->panPartStart[i-1])
+ {
+ snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : panPartStart[%d] = %d, panPartStart[%d] = %d",
+ hEntity, i, psShape->panPartStart[i], i - 1, psShape->panPartStart[i - 1]);
+ psSHP->sHooks.Error( pszErrorMsg );
+ SHPDestroyObject(psShape);
+ return NULL;
+ }
+ }
+
+ nOffset = 44 + 8 + 4*nParts;
+
+/* -------------------------------------------------------------------- */
+/* If this is a multipatch, we will also have parts types. */
+/* -------------------------------------------------------------------- */
+ if( psShape->nSHPType == SHPT_MULTIPATCH )
+ {
+ memcpy( psShape->panPartType, psSHP->pabyRec + nOffset, 4*nParts );
+ for( i = 0; i < nParts; i++ )
+ {
+ if( bBigEndian ) SwapWord( 4, psShape->panPartType+i );
+ }
+
+ nOffset += 4*nParts;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Copy out the vertices from the record. */
+/* -------------------------------------------------------------------- */
+ for( i = 0; i < nPoints; i++ )
+ {
+ memcpy(psShape->padfX + i,
+ psSHP->pabyRec + nOffset + i * 16,
+ 8 );
+
+ memcpy(psShape->padfY + i,
+ psSHP->pabyRec + nOffset + i * 16 + 8,
+ 8 );
+
+ if( bBigEndian ) SwapWord( 8, psShape->padfX + i );
+ if( bBigEndian ) SwapWord( 8, psShape->padfY + i );
+ }
+
+ nOffset += 16*nPoints;
+
+/* -------------------------------------------------------------------- */
+/* If we have a Z coordinate, collect that now. */
+/* -------------------------------------------------------------------- */
+ if( psShape->nSHPType == SHPT_POLYGONZ
+ || psShape->nSHPType == SHPT_ARCZ
+ || psShape->nSHPType == SHPT_MULTIPATCH )
+ {
+ memcpy( &(psShape->dfZMin), psSHP->pabyRec + nOffset, 8 );
+ memcpy( &(psShape->dfZMax), psSHP->pabyRec + nOffset + 8, 8 );
+
+ if( bBigEndian ) SwapWord( 8, &(psShape->dfZMin) );
+ if( bBigEndian ) SwapWord( 8, &(psShape->dfZMax) );
+
+ for( i = 0; i < nPoints; i++ )
+ {
+ memcpy( psShape->padfZ + i,
+ psSHP->pabyRec + nOffset + 16 + i*8, 8 );
+ if( bBigEndian ) SwapWord( 8, psShape->padfZ + i );
+ }
+
+ nOffset += 16 + 8*nPoints;
+ }
+
+/* -------------------------------------------------------------------- */
+/* If we have a M measure value, then read it now. We assume */
+/* that the measure can be present for any shape if the size is */
+/* big enough, but really it will only occur for the Z shapes */
+/* (options), and the M shapes. */
+/* -------------------------------------------------------------------- */
+ if( nEntitySize >= nOffset + 16 + 8*nPoints )
+ {
+ memcpy( &(psShape->dfMMin), psSHP->pabyRec + nOffset, 8 );
+ memcpy( &(psShape->dfMMax), psSHP->pabyRec + nOffset + 8, 8 );
+
+ if( bBigEndian ) SwapWord( 8, &(psShape->dfMMin) );
+ if( bBigEndian ) SwapWord( 8, &(psShape->dfMMax) );
+
+ for( i = 0; i < nPoints; i++ )
+ {
+ memcpy( psShape->padfM + i,
+ psSHP->pabyRec + nOffset + 16 + i*8, 8 );
+ if( bBigEndian ) SwapWord( 8, psShape->padfM + i );
+ }
+ psShape->bMeasureIsUsed = TRUE;
+ }
+ }
+
+/* ==================================================================== */
+/* Extract vertices for a MultiPoint. */
+/* ==================================================================== */
+ else if( psShape->nSHPType == SHPT_MULTIPOINT
+ || psShape->nSHPType == SHPT_MULTIPOINTM
+ || psShape->nSHPType == SHPT_MULTIPOINTZ )
+ {
+ int32 nPoints;
+ int i, nOffset;
+
+ if ( 44 + 4 > nEntitySize )
+ {
+ snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : nEntitySize = %d",
+ hEntity, nEntitySize);
+ psSHP->sHooks.Error( pszErrorMsg );
+ SHPDestroyObject(psShape);
+ return NULL;
+ }
+ memcpy( &nPoints, psSHP->pabyRec + 44, 4 );
+
+ if( bBigEndian ) SwapWord( 4, &nPoints );
+
+ if (nPoints < 0 || nPoints > 50 * 1000 * 1000)
+ {
+ snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : nPoints = %d",
+ hEntity, nPoints);
+ psSHP->sHooks.Error( pszErrorMsg );
+ SHPDestroyObject(psShape);
+ return NULL;
+ }
+
+ nRequiredSize = 48 + nPoints * 16;
+ if( psShape->nSHPType == SHPT_MULTIPOINTZ )
+ {
+ nRequiredSize += 16 + nPoints * 8;
+ }
+ if (nRequiredSize > nEntitySize)
+ {
+ snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : nPoints = %d, nEntitySize = %d",
+ hEntity, nPoints, nEntitySize);
+ psSHP->sHooks.Error( pszErrorMsg );
+ SHPDestroyObject(psShape);
+ return NULL;
+ }
+
+ psShape->nVertices = nPoints;
+ psShape->padfX = (double *) calloc(nPoints,sizeof(double));
+ psShape->padfY = (double *) calloc(nPoints,sizeof(double));
+ psShape->padfZ = (double *) calloc(nPoints,sizeof(double));
+ psShape->padfM = (double *) calloc(nPoints,sizeof(double));
+
+ if (psShape->padfX == NULL ||
+ psShape->padfY == NULL ||
+ psShape->padfZ == NULL ||
+ psShape->padfM == NULL)
+ {
+ snprintf(pszErrorMsg, 128,
+ "Not enough memory to allocate requested memory (nPoints=%d) for shape %d. "
+ "Probably broken SHP file", hEntity, nPoints );
+ psSHP->sHooks.Error( pszErrorMsg );
+ SHPDestroyObject(psShape);
+ return NULL;
+ }
+
+ for( i = 0; i < nPoints; i++ )
+ {
+ memcpy(psShape->padfX+i, psSHP->pabyRec + 48 + 16 * i, 8 );
+ memcpy(psShape->padfY+i, psSHP->pabyRec + 48 + 16 * i + 8, 8 );
+
+ if( bBigEndian ) SwapWord( 8, psShape->padfX + i );
+ if( bBigEndian ) SwapWord( 8, psShape->padfY + i );
+ }
+
+ nOffset = 48 + 16*nPoints;
+
+/* -------------------------------------------------------------------- */
+/* Get the X/Y bounds. */
+/* -------------------------------------------------------------------- */
+ memcpy( &(psShape->dfXMin), psSHP->pabyRec + 8 + 4, 8 );
+ memcpy( &(psShape->dfYMin), psSHP->pabyRec + 8 + 12, 8 );
+ memcpy( &(psShape->dfXMax), psSHP->pabyRec + 8 + 20, 8 );
+ memcpy( &(psShape->dfYMax), psSHP->pabyRec + 8 + 28, 8 );
+
+ if( bBigEndian ) SwapWord( 8, &(psShape->dfXMin) );
+ if( bBigEndian ) SwapWord( 8, &(psShape->dfYMin) );
+ if( bBigEndian ) SwapWord( 8, &(psShape->dfXMax) );
+ if( bBigEndian ) SwapWord( 8, &(psShape->dfYMax) );
+
+/* -------------------------------------------------------------------- */
+/* If we have a Z coordinate, collect that now. */
+/* -------------------------------------------------------------------- */
+ if( psShape->nSHPType == SHPT_MULTIPOINTZ )
+ {
+ memcpy( &(psShape->dfZMin), psSHP->pabyRec + nOffset, 8 );
+ memcpy( &(psShape->dfZMax), psSHP->pabyRec + nOffset + 8, 8 );
+
+ if( bBigEndian ) SwapWord( 8, &(psShape->dfZMin) );
+ if( bBigEndian ) SwapWord( 8, &(psShape->dfZMax) );
+
+ for( i = 0; i < nPoints; i++ )
+ {
+ memcpy( psShape->padfZ + i,
+ psSHP->pabyRec + nOffset + 16 + i*8, 8 );
+ if( bBigEndian ) SwapWord( 8, psShape->padfZ + i );
+ }
+
+ nOffset += 16 + 8*nPoints;
+ }
+
+/* -------------------------------------------------------------------- */
+/* If we have a M measure value, then read it now. We assume */
+/* that the measure can be present for any shape if the size is */
+/* big enough, but really it will only occur for the Z shapes */
+/* (options), and the M shapes. */
+/* -------------------------------------------------------------------- */
+ if( nEntitySize >= nOffset + 16 + 8*nPoints )
+ {
+ memcpy( &(psShape->dfMMin), psSHP->pabyRec + nOffset, 8 );
+ memcpy( &(psShape->dfMMax), psSHP->pabyRec + nOffset + 8, 8 );
+
+ if( bBigEndian ) SwapWord( 8, &(psShape->dfMMin) );
+ if( bBigEndian ) SwapWord( 8, &(psShape->dfMMax) );
+
+ for( i = 0; i < nPoints; i++ )
+ {
+ memcpy( psShape->padfM + i,
+ psSHP->pabyRec + nOffset + 16 + i*8, 8 );
+ if( bBigEndian ) SwapWord( 8, psShape->padfM + i );
+ }
+ psShape->bMeasureIsUsed = TRUE;
+ }
+ }
+
+/* ==================================================================== */
+/* Extract vertices for a point. */
+/* ==================================================================== */
+ else if( psShape->nSHPType == SHPT_POINT
+ || psShape->nSHPType == SHPT_POINTM
+ || psShape->nSHPType == SHPT_POINTZ )
+ {
+ int nOffset;
+
+ psShape->nVertices = 1;
+ psShape->padfX = (double *) calloc(1,sizeof(double));
+ psShape->padfY = (double *) calloc(1,sizeof(double));
+ psShape->padfZ = (double *) calloc(1,sizeof(double));
+ psShape->padfM = (double *) calloc(1,sizeof(double));
+
+ if (20 + 8 + (( psShape->nSHPType == SHPT_POINTZ ) ? 8 : 0)> nEntitySize)
+ {
+ snprintf(pszErrorMsg, 128, "Corrupted .shp file : shape %d : nEntitySize = %d",
+ hEntity, nEntitySize);
+ psSHP->sHooks.Error( pszErrorMsg );
+ SHPDestroyObject(psShape);
+ return NULL;
+ }
+ memcpy( psShape->padfX, psSHP->pabyRec + 12, 8 );
+ memcpy( psShape->padfY, psSHP->pabyRec + 20, 8 );
+
+ if( bBigEndian ) SwapWord( 8, psShape->padfX );
+ if( bBigEndian ) SwapWord( 8, psShape->padfY );
+
+ nOffset = 20 + 8;
+
+/* -------------------------------------------------------------------- */
+/* If we have a Z coordinate, collect that now. */
+/* -------------------------------------------------------------------- */
+ if( psShape->nSHPType == SHPT_POINTZ )
+ {
+ memcpy( psShape->padfZ, psSHP->pabyRec + nOffset, 8 );
+
+ if( bBigEndian ) SwapWord( 8, psShape->padfZ );
+
+ nOffset += 8;
+ }
+
+/* -------------------------------------------------------------------- */
+/* If we have a M measure value, then read it now. We assume */
+/* that the measure can be present for any shape if the size is */
+/* big enough, but really it will only occur for the Z shapes */
+/* (options), and the M shapes. */
+/* -------------------------------------------------------------------- */
+ if( nEntitySize >= nOffset + 8 )
+ {
+ memcpy( psShape->padfM, psSHP->pabyRec + nOffset, 8 );
+
+ if( bBigEndian ) SwapWord( 8, psShape->padfM );
+ psShape->bMeasureIsUsed = TRUE;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Since no extents are supplied in the record, we will apply */
+/* them from the single vertex. */
+/* -------------------------------------------------------------------- */
+ psShape->dfXMin = psShape->dfXMax = psShape->padfX[0];
+ psShape->dfYMin = psShape->dfYMax = psShape->padfY[0];
+ psShape->dfZMin = psShape->dfZMax = psShape->padfZ[0];
+ psShape->dfMMin = psShape->dfMMax = psShape->padfM[0];
+ }
+
+ return( psShape );
+}
+
+/************************************************************************/
+/* SHPTypeName() */
+/************************************************************************/
+
+const char SHPAPI_CALL1(*)
+SHPTypeName( int nSHPType )
+
+{
+ switch( nSHPType )
+ {
+ case SHPT_NULL:
+ return "NullShape";
+
+ case SHPT_POINT:
+ return "Point";
+
+ case SHPT_ARC:
+ return "Arc";
+
+ case SHPT_POLYGON:
+ return "Polygon";
+
+ case SHPT_MULTIPOINT:
+ return "MultiPoint";
+
+ case SHPT_POINTZ:
+ return "PointZ";
+
+ case SHPT_ARCZ:
+ return "ArcZ";
+
+ case SHPT_POLYGONZ:
+ return "PolygonZ";
+
+ case SHPT_MULTIPOINTZ:
+ return "MultiPointZ";
+
+ case SHPT_POINTM:
+ return "PointM";
+
+ case SHPT_ARCM:
+ return "ArcM";
+
+ case SHPT_POLYGONM:
+ return "PolygonM";
+
+ case SHPT_MULTIPOINTM:
+ return "MultiPointM";
+
+ case SHPT_MULTIPATCH:
+ return "MultiPatch";
+
+ default:
+ return "UnknownShapeType";
+ }
+}
+
+/************************************************************************/
+/* SHPPartTypeName() */
+/************************************************************************/
+
+const char SHPAPI_CALL1(*)
+SHPPartTypeName( int nPartType )
+
+{
+ switch( nPartType )
+ {
+ case SHPP_TRISTRIP:
+ return "TriangleStrip";
+
+ case SHPP_TRIFAN:
+ return "TriangleFan";
+
+ case SHPP_OUTERRING:
+ return "OuterRing";
+
+ case SHPP_INNERRING:
+ return "InnerRing";
+
+ case SHPP_FIRSTRING:
+ return "FirstRing";
+
+ case SHPP_RING:
+ return "Ring";
+
+ default:
+ return "UnknownPartType";
+ }
+}
+
+/************************************************************************/
+/* SHPDestroyObject() */
+/************************************************************************/
+
+void SHPAPI_CALL
+SHPDestroyObject( SHPObject * psShape )
+
+{
+ if( psShape == NULL )
+ return;
+
+ if( psShape->padfX != NULL )
+ free( psShape->padfX );
+ if( psShape->padfY != NULL )
+ free( psShape->padfY );
+ if( psShape->padfZ != NULL )
+ free( psShape->padfZ );
+ if( psShape->padfM != NULL )
+ free( psShape->padfM );
+
+ if( psShape->panPartStart != NULL )
+ free( psShape->panPartStart );
+ if( psShape->panPartType != NULL )
+ free( psShape->panPartType );
+
+ free( psShape );
+}
+
+/************************************************************************/
+/* SHPRewindObject() */
+/* */
+/* Reset the winding of polygon objects to adhere to the */
+/* specification. */
+/************************************************************************/
+
+int SHPAPI_CALL
+SHPRewindObject( SHPHandle hSHP, SHPObject * psObject )
+
+{
+ int iOpRing, bAltered = 0;
+
+/* -------------------------------------------------------------------- */
+/* Do nothing if this is not a polygon object. */
+/* -------------------------------------------------------------------- */
+ if( psObject->nSHPType != SHPT_POLYGON
+ && psObject->nSHPType != SHPT_POLYGONZ
+ && psObject->nSHPType != SHPT_POLYGONM )
+ return 0;
+
+ if( psObject->nVertices == 0 || psObject->nParts == 0 )
+ return 0;
+
+/* -------------------------------------------------------------------- */
+/* Process each of the rings. */
+/* -------------------------------------------------------------------- */
+ for( iOpRing = 0; iOpRing < psObject->nParts; iOpRing++ )
+ {
+ int bInner, iVert, nVertCount, nVertStart, iCheckRing;
+ double dfSum, dfTestX, dfTestY;
+
+/* -------------------------------------------------------------------- */
+/* Determine if this ring is an inner ring or an outer ring */
+/* relative to all the other rings. For now we assume the */
+/* first ring is outer and all others are inner, but eventually */
+/* we need to fix this to handle multiple island polygons and */
+/* unordered sets of rings. */
+/* */
+/* -------------------------------------------------------------------- */
+
+ /* Use point in the middle of segment to avoid testing
+ * common points of rings.
+ */
+ dfTestX = ( psObject->padfX[psObject->panPartStart[iOpRing]]
+ + psObject->padfX[psObject->panPartStart[iOpRing] + 1] ) / 2;
+ dfTestY = ( psObject->padfY[psObject->panPartStart[iOpRing]]
+ + psObject->padfY[psObject->panPartStart[iOpRing] + 1] ) / 2;
+
+ bInner = FALSE;
+ for( iCheckRing = 0; iCheckRing < psObject->nParts; iCheckRing++ )
+ {
+ int iEdge;
+
+ if( iCheckRing == iOpRing )
+ continue;
+
+ nVertStart = psObject->panPartStart[iCheckRing];
+
+ if( iCheckRing == psObject->nParts-1 )
+ nVertCount = psObject->nVertices
+ - psObject->panPartStart[iCheckRing];
+ else
+ nVertCount = psObject->panPartStart[iCheckRing+1]
+ - psObject->panPartStart[iCheckRing];
+
+ for( iEdge = 0; iEdge < nVertCount; iEdge++ )
+ {
+ int iNext;
+
+ if( iEdge < nVertCount-1 )
+ iNext = iEdge+1;
+ else
+ iNext = 0;
+
+ /* Rule #1:
+ * Test whether the edge 'straddles' the horizontal ray from the test point (dfTestY,dfTestY)
+ * The rule #1 also excludes edges collinear with the ray.
+ */
+ if ( ( psObject->padfY[iEdge+nVertStart] < dfTestY
+ && dfTestY <= psObject->padfY[iNext+nVertStart] )
+ || ( psObject->padfY[iNext+nVertStart] < dfTestY
+ && dfTestY <= psObject->padfY[iEdge+nVertStart] ) )
+ {
+ /* Rule #2:
+ * Test if edge-ray intersection is on the right from the test point (dfTestY,dfTestY)
+ */
+ double const intersect =
+ ( psObject->padfX[iEdge+nVertStart]
+ + ( dfTestY - psObject->padfY[iEdge+nVertStart] )
+ / ( psObject->padfY[iNext+nVertStart] - psObject->padfY[iEdge+nVertStart] )
+ * ( psObject->padfX[iNext+nVertStart] - psObject->padfX[iEdge+nVertStart] ) );
+
+ if (intersect < dfTestX)
+ {
+ bInner = !bInner;
+ }
+ }
+ }
+ } /* for iCheckRing */
+
+/* -------------------------------------------------------------------- */
+/* Determine the current order of this ring so we will know if */
+/* it has to be reversed. */
+/* -------------------------------------------------------------------- */
+ nVertStart = psObject->panPartStart[iOpRing];
+
+ if( iOpRing == psObject->nParts-1 )
+ nVertCount = psObject->nVertices - psObject->panPartStart[iOpRing];
+ else
+ nVertCount = psObject->panPartStart[iOpRing+1]
+ - psObject->panPartStart[iOpRing];
+
+ dfSum = 0.0;
+ for( iVert = nVertStart; iVert < nVertStart+nVertCount-1; iVert++ )
+ {
+ dfSum += psObject->padfX[iVert] * psObject->padfY[iVert+1]
+ - psObject->padfY[iVert] * psObject->padfX[iVert+1];
+ }
+
+ dfSum += psObject->padfX[iVert] * psObject->padfY[nVertStart]
+ - psObject->padfY[iVert] * psObject->padfX[nVertStart];
+
+/* -------------------------------------------------------------------- */
+/* Reverse if necessary. */
+/* -------------------------------------------------------------------- */
+ if( (dfSum < 0.0 && bInner) || (dfSum > 0.0 && !bInner) )
+ {
+ int i;
+
+ bAltered++;
+ for( i = 0; i < nVertCount/2; i++ )
+ {
+ double dfSaved;
+
+ /* Swap X */
+ dfSaved = psObject->padfX[nVertStart+i];
+ psObject->padfX[nVertStart+i] =
+ psObject->padfX[nVertStart+nVertCount-i-1];
+ psObject->padfX[nVertStart+nVertCount-i-1] = dfSaved;
+
+ /* Swap Y */
+ dfSaved = psObject->padfY[nVertStart+i];
+ psObject->padfY[nVertStart+i] =
+ psObject->padfY[nVertStart+nVertCount-i-1];
+ psObject->padfY[nVertStart+nVertCount-i-1] = dfSaved;
+
+ /* Swap Z */
+ if( psObject->padfZ )
+ {
+ dfSaved = psObject->padfZ[nVertStart+i];
+ psObject->padfZ[nVertStart+i] =
+ psObject->padfZ[nVertStart+nVertCount-i-1];
+ psObject->padfZ[nVertStart+nVertCount-i-1] = dfSaved;
+ }
+
+ /* Swap M */
+ if( psObject->padfM )
+ {
+ dfSaved = psObject->padfM[nVertStart+i];
+ psObject->padfM[nVertStart+i] =
+ psObject->padfM[nVertStart+nVertCount-i-1];
+ psObject->padfM[nVertStart+nVertCount-i-1] = dfSaved;
+ }
+ }
+ }
+ }
+
+ return bAltered;
+}
diff --git a/map/shapefile/shptree.c b/map/shapefile/shptree.c
new file mode 100644
index 00000000..b8f42a77
--- /dev/null
+++ b/map/shapefile/shptree.c
@@ -0,0 +1,1047 @@
+/******************************************************************************
+ * $Id: shptree.c,v 1.12 2008/11/12 15:39:50 fwarmerdam Exp $
+ *
+ * Project: Shapelib
+ * Purpose: Implementation of quadtree building and searching functions.
+ * Author: Frank Warmerdam, warmerdam@pobox.com
+ *
+ ******************************************************************************
+ * Copyright (c) 1999, Frank Warmerdam
+ *
+ * This software is available under the following "MIT Style" license,
+ * or at the option of the licensee under the LGPL (see LICENSE.LGPL). This
+ * option is discussed in more detail in shapelib.html.
+ *
+ * --
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ******************************************************************************
+ *
+ * $Log: shptree.c,v $
+ * Revision 1.12 2008/11/12 15:39:50 fwarmerdam
+ * improve safety in face of buggy .shp file.
+ *
+ * Revision 1.11 2007/10/27 03:31:14 fwarmerdam
+ * limit default depth of tree to 12 levels (gdal ticket #1594)
+ *
+ * Revision 1.10 2005/01/03 22:30:13 fwarmerdam
+ * added support for saved quadtrees
+ *
+ * Revision 1.9 2003/01/28 15:53:41 warmerda
+ * Avoid build warnings.
+ *
+ * Revision 1.8 2002/05/07 13:07:45 warmerda
+ * use qsort() - patch from Bernhard Herzog
+ *
+ * Revision 1.7 2002/01/15 14:36:07 warmerda
+ * updated email address
+ *
+ * Revision 1.6 2001/05/23 13:36:52 warmerda
+ * added use of SHPAPI_CALL
+ *
+ * Revision 1.5 1999/11/05 14:12:05 warmerda
+ * updated license terms
+ *
+ * Revision 1.4 1999/06/02 18:24:21 warmerda
+ * added trimming code
+ *
+ * Revision 1.3 1999/06/02 17:56:12 warmerda
+ * added quad'' subnode support for trees
+ *
+ * Revision 1.2 1999/05/18 19:11:11 warmerda
+ * Added example searching capability
+ *
+ * Revision 1.1 1999/05/18 17:49:20 warmerda
+ * New
+ *
+ */
+
+#include "shapefil.h"
+
+#include <math.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef USE_CPL
+#include <cpl_error.h>
+#endif
+
+#if 0
+SHP_CVSID("$Id: shptree.c,v 1.12 2008/11/12 15:39:50 fwarmerdam Exp $")
+#endif
+
+#ifndef TRUE
+# define TRUE 1
+# define FALSE 0
+#endif
+
+static int bBigEndian = 0;
+
+
+/* -------------------------------------------------------------------- */
+/* If the following is 0.5, nodes will be split in half. If it */
+/* is 0.6 then each subnode will contain 60% of the parent */
+/* node, with 20% representing overlap. This can be help to */
+/* prevent small objects on a boundary from shifting too high */
+/* up the tree. */
+/* -------------------------------------------------------------------- */
+
+#define SHP_SPLIT_RATIO 0.55
+
+/************************************************************************/
+/* SfRealloc() */
+/* */
+/* A realloc cover function that will access a NULL pointer as */
+/* a valid input. */
+/************************************************************************/
+
+static void * SfRealloc( void * pMem, int nNewSize )
+
+{
+ if( pMem == NULL )
+ return( (void *) malloc(nNewSize) );
+ else
+ return( (void *) realloc(pMem,nNewSize) );
+}
+
+/************************************************************************/
+/* SHPTreeNodeInit() */
+/* */
+/* Initialize a tree node. */
+/************************************************************************/
+
+static SHPTreeNode *SHPTreeNodeCreate( double * padfBoundsMin,
+ double * padfBoundsMax )
+
+{
+ SHPTreeNode *psTreeNode;
+
+ psTreeNode = (SHPTreeNode *) malloc(sizeof(SHPTreeNode));
+ if( NULL == psTreeNode )
+ {
+#ifdef USE_CPL
+ CPLError( CE_Fatal, CPLE_OutOfMemory, "Memory allocation failure");
+#endif
+ return NULL;
+ }
+
+ psTreeNode->nShapeCount = 0;
+ psTreeNode->panShapeIds = NULL;
+ psTreeNode->papsShapeObj = NULL;
+
+ psTreeNode->nSubNodes = 0;
+
+ if( padfBoundsMin != NULL )
+ memcpy( psTreeNode->adfBoundsMin, padfBoundsMin, sizeof(double) * 4 );
+
+ if( padfBoundsMax != NULL )
+ memcpy( psTreeNode->adfBoundsMax, padfBoundsMax, sizeof(double) * 4 );
+
+ return psTreeNode;
+}
+
+
+/************************************************************************/
+/* SHPCreateTree() */
+/************************************************************************/
+
+SHPTree SHPAPI_CALL1(*)
+SHPCreateTree( SHPHandle hSHP, int nDimension, int nMaxDepth,
+ double *padfBoundsMin, double *padfBoundsMax )
+
+{
+ SHPTree *psTree;
+
+ if( padfBoundsMin == NULL && hSHP == NULL )
+ return NULL;
+
+/* -------------------------------------------------------------------- */
+/* Allocate the tree object */
+/* -------------------------------------------------------------------- */
+ psTree = (SHPTree *) malloc(sizeof(SHPTree));
+ if( NULL == psTree )
+ {
+#ifdef USE_CPL
+ CPLError( CE_Fatal, CPLE_OutOfMemory, "Memory allocation failure");
+#endif
+ return NULL;
+ }
+
+ psTree->hSHP = hSHP;
+ psTree->nMaxDepth = nMaxDepth;
+ psTree->nDimension = nDimension;
+ psTree->nTotalCount = 0;
+
+/* -------------------------------------------------------------------- */
+/* If no max depth was defined, try to select a reasonable one */
+/* that implies approximately 8 shapes per node. */
+/* -------------------------------------------------------------------- */
+ if( psTree->nMaxDepth == 0 && hSHP != NULL )
+ {
+ int nMaxNodeCount = 1;
+ int nShapeCount;
+
+ SHPGetInfo( hSHP, &nShapeCount, NULL, NULL, NULL );
+ while( nMaxNodeCount*4 < nShapeCount )
+ {
+ psTree->nMaxDepth += 1;
+ nMaxNodeCount = nMaxNodeCount * 2;
+ }
+
+#ifdef USE_CPL
+ CPLDebug( "Shape",
+ "Estimated spatial index tree depth: %d",
+ psTree->nMaxDepth );
+#endif
+
+ /* NOTE: Due to problems with memory allocation for deep trees,
+ * automatically estimated depth is limited up to 12 levels.
+ * See Ticket #1594 for detailed discussion.
+ */
+ if( psTree->nMaxDepth > MAX_DEFAULT_TREE_DEPTH )
+ {
+ psTree->nMaxDepth = MAX_DEFAULT_TREE_DEPTH;
+
+#ifdef USE_CPL
+ CPLDebug( "Shape",
+ "Falling back to max number of allowed index tree levels (%d).",
+ MAX_DEFAULT_TREE_DEPTH );
+#endif
+ }
+ }
+
+/* -------------------------------------------------------------------- */
+/* Allocate the root node. */
+/* -------------------------------------------------------------------- */
+ psTree->psRoot = SHPTreeNodeCreate( padfBoundsMin, padfBoundsMax );
+ if( NULL == psTree->psRoot )
+ {
+ return NULL;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Assign the bounds to the root node. If none are passed in, */
+/* use the bounds of the provided file otherwise the create */
+/* function will have already set the bounds. */
+/* -------------------------------------------------------------------- */
+ assert( NULL != psTree );
+ assert( NULL != psTree->psRoot );
+
+ if( padfBoundsMin == NULL )
+ {
+ SHPGetInfo( hSHP, NULL, NULL,
+ psTree->psRoot->adfBoundsMin,
+ psTree->psRoot->adfBoundsMax );
+ }
+
+/* -------------------------------------------------------------------- */
+/* If we have a file, insert all it's shapes into the tree. */
+/* -------------------------------------------------------------------- */
+ if( hSHP != NULL )
+ {
+ int iShape, nShapeCount;
+
+ SHPGetInfo( hSHP, &nShapeCount, NULL, NULL, NULL );
+
+ for( iShape = 0; iShape < nShapeCount; iShape++ )
+ {
+ SHPObject *psShape;
+
+ psShape = SHPReadObject( hSHP, iShape );
+ if( psShape != NULL )
+ {
+ SHPTreeAddShapeId( psTree, psShape );
+ SHPDestroyObject( psShape );
+ }
+ }
+ }
+
+ return psTree;
+}
+
+/************************************************************************/
+/* SHPDestroyTreeNode() */
+/************************************************************************/
+
+static void SHPDestroyTreeNode( SHPTreeNode * psTreeNode )
+
+{
+ int i;
+
+ assert( NULL != psTreeNode );
+
+ for( i = 0; i < psTreeNode->nSubNodes; i++ )
+ {
+ if( psTreeNode->apsSubNode[i] != NULL )
+ SHPDestroyTreeNode( psTreeNode->apsSubNode[i] );
+ }
+
+ if( psTreeNode->panShapeIds != NULL )
+ free( psTreeNode->panShapeIds );
+
+ if( psTreeNode->papsShapeObj != NULL )
+ {
+ for( i = 0; i < psTreeNode->nShapeCount; i++ )
+ {
+ if( psTreeNode->papsShapeObj[i] != NULL )
+ SHPDestroyObject( psTreeNode->papsShapeObj[i] );
+ }
+
+ free( psTreeNode->papsShapeObj );
+ }
+
+ free( psTreeNode );
+}
+
+/************************************************************************/
+/* SHPDestroyTree() */
+/************************************************************************/
+
+void SHPAPI_CALL
+SHPDestroyTree( SHPTree * psTree )
+
+{
+ SHPDestroyTreeNode( psTree->psRoot );
+ free( psTree );
+}
+
+/************************************************************************/
+/* SHPCheckBoundsOverlap() */
+/* */
+/* Do the given boxes overlap at all? */
+/************************************************************************/
+
+int SHPAPI_CALL
+SHPCheckBoundsOverlap( double * padfBox1Min, double * padfBox1Max,
+ double * padfBox2Min, double * padfBox2Max,
+ int nDimension )
+
+{
+ int iDim;
+
+ for( iDim = 0; iDim < nDimension; iDim++ )
+ {
+ if( padfBox2Max[iDim] < padfBox1Min[iDim] )
+ return FALSE;
+
+ if( padfBox1Max[iDim] < padfBox2Min[iDim] )
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/************************************************************************/
+/* SHPCheckObjectContained() */
+/* */
+/* Does the given shape fit within the indicated extents? */
+/************************************************************************/
+
+static int SHPCheckObjectContained( SHPObject * psObject, int nDimension,
+ double * padfBoundsMin, double * padfBoundsMax )
+
+{
+ if( psObject->dfXMin < padfBoundsMin[0]
+ || psObject->dfXMax > padfBoundsMax[0] )
+ return FALSE;
+
+ if( psObject->dfYMin < padfBoundsMin[1]
+ || psObject->dfYMax > padfBoundsMax[1] )
+ return FALSE;
+
+ if( nDimension == 2 )
+ return TRUE;
+
+ if( psObject->dfZMin < padfBoundsMin[2]
+ || psObject->dfZMax < padfBoundsMax[2] )
+ return FALSE;
+
+ if( nDimension == 3 )
+ return TRUE;
+
+ if( psObject->dfMMin < padfBoundsMin[3]
+ || psObject->dfMMax < padfBoundsMax[3] )
+ return FALSE;
+
+ return TRUE;
+}
+
+/************************************************************************/
+/* SHPTreeSplitBounds() */
+/* */
+/* Split a region into two subregion evenly, cutting along the */
+/* longest dimension. */
+/************************************************************************/
+
+void SHPAPI_CALL
+SHPTreeSplitBounds( double *padfBoundsMinIn, double *padfBoundsMaxIn,
+ double *padfBoundsMin1, double * padfBoundsMax1,
+ double *padfBoundsMin2, double * padfBoundsMax2 )
+
+{
+/* -------------------------------------------------------------------- */
+/* The output bounds will be very similar to the input bounds, */
+/* so just copy over to start. */
+/* -------------------------------------------------------------------- */
+ memcpy( padfBoundsMin1, padfBoundsMinIn, sizeof(double) * 4 );
+ memcpy( padfBoundsMax1, padfBoundsMaxIn, sizeof(double) * 4 );
+ memcpy( padfBoundsMin2, padfBoundsMinIn, sizeof(double) * 4 );
+ memcpy( padfBoundsMax2, padfBoundsMaxIn, sizeof(double) * 4 );
+
+/* -------------------------------------------------------------------- */
+/* Split in X direction. */
+/* -------------------------------------------------------------------- */
+ if( (padfBoundsMaxIn[0] - padfBoundsMinIn[0])
+ > (padfBoundsMaxIn[1] - padfBoundsMinIn[1]) )
+ {
+ double dfRange = padfBoundsMaxIn[0] - padfBoundsMinIn[0];
+
+ padfBoundsMax1[0] = padfBoundsMinIn[0] + dfRange * SHP_SPLIT_RATIO;
+ padfBoundsMin2[0] = padfBoundsMaxIn[0] - dfRange * SHP_SPLIT_RATIO;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Otherwise split in Y direction. */
+/* -------------------------------------------------------------------- */
+ else
+ {
+ double dfRange = padfBoundsMaxIn[1] - padfBoundsMinIn[1];
+
+ padfBoundsMax1[1] = padfBoundsMinIn[1] + dfRange * SHP_SPLIT_RATIO;
+ padfBoundsMin2[1] = padfBoundsMaxIn[1] - dfRange * SHP_SPLIT_RATIO;
+ }
+}
+
+/************************************************************************/
+/* SHPTreeNodeAddShapeId() */
+/************************************************************************/
+
+static int
+SHPTreeNodeAddShapeId( SHPTreeNode * psTreeNode, SHPObject * psObject,
+ int nMaxDepth, int nDimension )
+
+{
+ int i;
+
+/* -------------------------------------------------------------------- */
+/* If there are subnodes, then consider wiether this object */
+/* will fit in them. */
+/* -------------------------------------------------------------------- */
+ if( nMaxDepth > 1 && psTreeNode->nSubNodes > 0 )
+ {
+ for( i = 0; i < psTreeNode->nSubNodes; i++ )
+ {
+ if( SHPCheckObjectContained(psObject, nDimension,
+ psTreeNode->apsSubNode[i]->adfBoundsMin,
+ psTreeNode->apsSubNode[i]->adfBoundsMax))
+ {
+ return SHPTreeNodeAddShapeId( psTreeNode->apsSubNode[i],
+ psObject, nMaxDepth-1,
+ nDimension );
+ }
+ }
+ }
+
+/* -------------------------------------------------------------------- */
+/* Otherwise, consider creating four subnodes if could fit into */
+/* them, and adding to the appropriate subnode. */
+/* -------------------------------------------------------------------- */
+#if MAX_SUBNODE == 4
+ else if( nMaxDepth > 1 && psTreeNode->nSubNodes == 0 )
+ {
+ double adfBoundsMinH1[4], adfBoundsMaxH1[4];
+ double adfBoundsMinH2[4], adfBoundsMaxH2[4];
+ double adfBoundsMin1[4], adfBoundsMax1[4];
+ double adfBoundsMin2[4], adfBoundsMax2[4];
+ double adfBoundsMin3[4], adfBoundsMax3[4];
+ double adfBoundsMin4[4], adfBoundsMax4[4];
+
+ SHPTreeSplitBounds( psTreeNode->adfBoundsMin,
+ psTreeNode->adfBoundsMax,
+ adfBoundsMinH1, adfBoundsMaxH1,
+ adfBoundsMinH2, adfBoundsMaxH2 );
+
+ SHPTreeSplitBounds( adfBoundsMinH1, adfBoundsMaxH1,
+ adfBoundsMin1, adfBoundsMax1,
+ adfBoundsMin2, adfBoundsMax2 );
+
+ SHPTreeSplitBounds( adfBoundsMinH2, adfBoundsMaxH2,
+ adfBoundsMin3, adfBoundsMax3,
+ adfBoundsMin4, adfBoundsMax4 );
+
+ if( SHPCheckObjectContained(psObject, nDimension,
+ adfBoundsMin1, adfBoundsMax1)
+ || SHPCheckObjectContained(psObject, nDimension,
+ adfBoundsMin2, adfBoundsMax2)
+ || SHPCheckObjectContained(psObject, nDimension,
+ adfBoundsMin3, adfBoundsMax3)
+ || SHPCheckObjectContained(psObject, nDimension,
+ adfBoundsMin4, adfBoundsMax4) )
+ {
+ psTreeNode->nSubNodes = 4;
+ psTreeNode->apsSubNode[0] = SHPTreeNodeCreate( adfBoundsMin1,
+ adfBoundsMax1 );
+ psTreeNode->apsSubNode[1] = SHPTreeNodeCreate( adfBoundsMin2,
+ adfBoundsMax2 );
+ psTreeNode->apsSubNode[2] = SHPTreeNodeCreate( adfBoundsMin3,
+ adfBoundsMax3 );
+ psTreeNode->apsSubNode[3] = SHPTreeNodeCreate( adfBoundsMin4,
+ adfBoundsMax4 );
+
+ /* recurse back on this node now that it has subnodes */
+ return( SHPTreeNodeAddShapeId( psTreeNode, psObject,
+ nMaxDepth, nDimension ) );
+ }
+ }
+#endif /* MAX_SUBNODE == 4 */
+
+/* -------------------------------------------------------------------- */
+/* Otherwise, consider creating two subnodes if could fit into */
+/* them, and adding to the appropriate subnode. */
+/* -------------------------------------------------------------------- */
+#if MAX_SUBNODE == 2
+ else if( nMaxDepth > 1 && psTreeNode->nSubNodes == 0 )
+ {
+ double adfBoundsMin1[4], adfBoundsMax1[4];
+ double adfBoundsMin2[4], adfBoundsMax2[4];
+
+ SHPTreeSplitBounds( psTreeNode->adfBoundsMin, psTreeNode->adfBoundsMax,
+ adfBoundsMin1, adfBoundsMax1,
+ adfBoundsMin2, adfBoundsMax2 );
+
+ if( SHPCheckObjectContained(psObject, nDimension,
+ adfBoundsMin1, adfBoundsMax1))
+ {
+ psTreeNode->nSubNodes = 2;
+ psTreeNode->apsSubNode[0] = SHPTreeNodeCreate( adfBoundsMin1,
+ adfBoundsMax1 );
+ psTreeNode->apsSubNode[1] = SHPTreeNodeCreate( adfBoundsMin2,
+ adfBoundsMax2 );
+
+ return( SHPTreeNodeAddShapeId( psTreeNode->apsSubNode[0], psObject,
+ nMaxDepth - 1, nDimension ) );
+ }
+ else if( SHPCheckObjectContained(psObject, nDimension,
+ adfBoundsMin2, adfBoundsMax2) )
+ {
+ psTreeNode->nSubNodes = 2;
+ psTreeNode->apsSubNode[0] = SHPTreeNodeCreate( adfBoundsMin1,
+ adfBoundsMax1 );
+ psTreeNode->apsSubNode[1] = SHPTreeNodeCreate( adfBoundsMin2,
+ adfBoundsMax2 );
+
+ return( SHPTreeNodeAddShapeId( psTreeNode->apsSubNode[1], psObject,
+ nMaxDepth - 1, nDimension ) );
+ }
+ }
+#endif /* MAX_SUBNODE == 2 */
+
+/* -------------------------------------------------------------------- */
+/* If none of that worked, just add it to this nodes list. */
+/* -------------------------------------------------------------------- */
+ psTreeNode->nShapeCount++;
+
+ psTreeNode->panShapeIds = (int *)
+ SfRealloc( psTreeNode->panShapeIds,
+ sizeof(int) * psTreeNode->nShapeCount );
+ psTreeNode->panShapeIds[psTreeNode->nShapeCount-1] = psObject->nShapeId;
+
+ if( psTreeNode->papsShapeObj != NULL )
+ {
+ psTreeNode->papsShapeObj = (SHPObject **)
+ SfRealloc( psTreeNode->papsShapeObj,
+ sizeof(void *) * psTreeNode->nShapeCount );
+ psTreeNode->papsShapeObj[psTreeNode->nShapeCount-1] = NULL;
+ }
+
+ return TRUE;
+}
+
+/************************************************************************/
+/* SHPTreeAddShapeId() */
+/* */
+/* Add a shape to the tree, but don't keep a pointer to the */
+/* object data, just keep the shapeid. */
+/************************************************************************/
+
+int SHPAPI_CALL
+SHPTreeAddShapeId( SHPTree * psTree, SHPObject * psObject )
+
+{
+ psTree->nTotalCount++;
+
+ return( SHPTreeNodeAddShapeId( psTree->psRoot, psObject,
+ psTree->nMaxDepth, psTree->nDimension ) );
+}
+
+/************************************************************************/
+/* SHPTreeCollectShapesIds() */
+/* */
+/* Work function implementing SHPTreeFindLikelyShapes() on a */
+/* tree node by tree node basis. */
+/************************************************************************/
+
+void SHPAPI_CALL
+SHPTreeCollectShapeIds( SHPTree *hTree, SHPTreeNode * psTreeNode,
+ double * padfBoundsMin, double * padfBoundsMax,
+ int * pnShapeCount, int * pnMaxShapes,
+ int ** ppanShapeList )
+
+{
+ int i;
+
+/* -------------------------------------------------------------------- */
+/* Does this node overlap the area of interest at all? If not, */
+/* return without adding to the list at all. */
+/* -------------------------------------------------------------------- */
+ if( !SHPCheckBoundsOverlap( psTreeNode->adfBoundsMin,
+ psTreeNode->adfBoundsMax,
+ padfBoundsMin,
+ padfBoundsMax,
+ hTree->nDimension ) )
+ return;
+
+/* -------------------------------------------------------------------- */
+/* Grow the list to hold the shapes on this node. */
+/* -------------------------------------------------------------------- */
+ if( *pnShapeCount + psTreeNode->nShapeCount > *pnMaxShapes )
+ {
+ *pnMaxShapes = (*pnShapeCount + psTreeNode->nShapeCount) * 2 + 20;
+ *ppanShapeList = (int *)
+ SfRealloc(*ppanShapeList,sizeof(int) * *pnMaxShapes);
+ }
+
+/* -------------------------------------------------------------------- */
+/* Add the local nodes shapeids to the list. */
+/* -------------------------------------------------------------------- */
+ for( i = 0; i < psTreeNode->nShapeCount; i++ )
+ {
+ (*ppanShapeList)[(*pnShapeCount)++] = psTreeNode->panShapeIds[i];
+ }
+
+/* -------------------------------------------------------------------- */
+/* Recurse to subnodes if they exist. */
+/* -------------------------------------------------------------------- */
+ for( i = 0; i < psTreeNode->nSubNodes; i++ )
+ {
+ if( psTreeNode->apsSubNode[i] != NULL )
+ SHPTreeCollectShapeIds( hTree, psTreeNode->apsSubNode[i],
+ padfBoundsMin, padfBoundsMax,
+ pnShapeCount, pnMaxShapes,
+ ppanShapeList );
+ }
+}
+
+/************************************************************************/
+/* SHPTreeFindLikelyShapes() */
+/* */
+/* Find all shapes within tree nodes for which the tree node */
+/* bounding box overlaps the search box. The return value is */
+/* an array of shapeids terminated by a -1. The shapeids will */
+/* be in order, as hopefully this will result in faster (more */
+/* sequential) reading from the file. */
+/************************************************************************/
+
+/* helper for qsort */
+static int
+compare_ints( const void * a, const void * b)
+{
+ return (*(int*)a) - (*(int*)b);
+}
+
+int SHPAPI_CALL1(*)
+SHPTreeFindLikelyShapes( SHPTree * hTree,
+ double * padfBoundsMin, double * padfBoundsMax,
+ int * pnShapeCount )
+
+{
+ int *panShapeList=NULL, nMaxShapes = 0;
+
+/* -------------------------------------------------------------------- */
+/* Perform the search by recursive descent. */
+/* -------------------------------------------------------------------- */
+ *pnShapeCount = 0;
+
+ SHPTreeCollectShapeIds( hTree, hTree->psRoot,
+ padfBoundsMin, padfBoundsMax,
+ pnShapeCount, &nMaxShapes,
+ &panShapeList );
+
+/* -------------------------------------------------------------------- */
+/* Sort the id array */
+/* -------------------------------------------------------------------- */
+
+ qsort(panShapeList, *pnShapeCount, sizeof(int), compare_ints);
+
+ return panShapeList;
+}
+
+/************************************************************************/
+/* SHPTreeNodeTrim() */
+/* */
+/* This is the recurve version of SHPTreeTrimExtraNodes() that */
+/* walks the tree cleaning it up. */
+/************************************************************************/
+
+static int SHPTreeNodeTrim( SHPTreeNode * psTreeNode )
+
+{
+ int i;
+
+/* -------------------------------------------------------------------- */
+/* Trim subtrees, and free subnodes that come back empty. */
+/* -------------------------------------------------------------------- */
+ for( i = 0; i < psTreeNode->nSubNodes; i++ )
+ {
+ if( SHPTreeNodeTrim( psTreeNode->apsSubNode[i] ) )
+ {
+ SHPDestroyTreeNode( psTreeNode->apsSubNode[i] );
+
+ psTreeNode->apsSubNode[i] =
+ psTreeNode->apsSubNode[psTreeNode->nSubNodes-1];
+
+ psTreeNode->nSubNodes--;
+
+ i--; /* process the new occupant of this subnode entry */
+ }
+ }
+
+/* -------------------------------------------------------------------- */
+/* We should be trimmed if we have no subnodes, and no shapes. */
+/* -------------------------------------------------------------------- */
+ return( psTreeNode->nSubNodes == 0 && psTreeNode->nShapeCount == 0 );
+}
+
+/************************************************************************/
+/* SHPTreeTrimExtraNodes() */
+/* */
+/* Trim empty nodes from the tree. Note that we never trim an */
+/* empty root node. */
+/************************************************************************/
+
+void SHPAPI_CALL
+SHPTreeTrimExtraNodes( SHPTree * hTree )
+
+{
+ SHPTreeNodeTrim( hTree->psRoot );
+}
+
+/************************************************************************/
+/* SwapWord() */
+/* */
+/* Swap a 2, 4 or 8 byte word. */
+/************************************************************************/
+
+static void SwapWord( int length, void * wordP )
+
+{
+ int i;
+ unsigned char temp;
+
+ for( i=0; i < length/2; i++ )
+ {
+ temp = ((unsigned char *) wordP)[i];
+ ((unsigned char *)wordP)[i] = ((unsigned char *) wordP)[length-i-1];
+ ((unsigned char *) wordP)[length-i-1] = temp;
+ }
+}
+
+/************************************************************************/
+/* SHPSearchDiskTreeNode() */
+/************************************************************************/
+
+static int
+SHPSearchDiskTreeNode( FILE *fp, double *padfBoundsMin, double *padfBoundsMax,
+ int **ppanResultBuffer, int *pnBufferMax,
+ int *pnResultCount, int bNeedSwap )
+
+{
+ int i;
+ int offset;
+ int numshapes, numsubnodes;
+ double adfNodeBoundsMin[2], adfNodeBoundsMax[2];
+
+/* -------------------------------------------------------------------- */
+/* Read and unswap first part of node info. */
+/* -------------------------------------------------------------------- */
+ fread( &offset, 4, 1, fp );
+ if ( bNeedSwap ) SwapWord ( 4, &offset );
+
+ fread( adfNodeBoundsMin, sizeof(double), 2, fp );
+ fread( adfNodeBoundsMax, sizeof(double), 2, fp );
+ if ( bNeedSwap )
+ {
+ SwapWord( 8, adfNodeBoundsMin + 0 );
+ SwapWord( 8, adfNodeBoundsMin + 1 );
+ SwapWord( 8, adfNodeBoundsMax + 0 );
+ SwapWord( 8, adfNodeBoundsMax + 1 );
+ }
+
+ fread( &numshapes, 4, 1, fp );
+ if ( bNeedSwap ) SwapWord ( 4, &numshapes );
+
+/* -------------------------------------------------------------------- */
+/* If we don't overlap this node at all, we can just fseek() */
+/* pass this node info and all subnodes. */
+/* -------------------------------------------------------------------- */
+ if( !SHPCheckBoundsOverlap( adfNodeBoundsMin, adfNodeBoundsMax,
+ padfBoundsMin, padfBoundsMax, 2 ) )
+ {
+ offset += numshapes*sizeof(int) + sizeof(int);
+ fseek(fp, offset, SEEK_CUR);
+ return TRUE;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Add all the shapeids at this node to our list. */
+/* -------------------------------------------------------------------- */
+ if(numshapes > 0)
+ {
+ if( *pnResultCount + numshapes > *pnBufferMax )
+ {
+ *pnBufferMax = (int) ((*pnResultCount + numshapes + 100) * 1.25);
+ *ppanResultBuffer = (int *)
+ SfRealloc( *ppanResultBuffer, *pnBufferMax * sizeof(int) );
+ }
+
+ fread( *ppanResultBuffer + *pnResultCount,
+ sizeof(int), numshapes, fp );
+
+ if (bNeedSwap )
+ {
+ for( i=0; i<numshapes; i++ )
+ SwapWord( 4, *ppanResultBuffer + *pnResultCount + i );
+ }
+
+ *pnResultCount += numshapes;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Process the subnodes. */
+/* -------------------------------------------------------------------- */
+ fread( &numsubnodes, 4, 1, fp );
+ if ( bNeedSwap ) SwapWord ( 4, &numsubnodes );
+
+ for(i=0; i<numsubnodes; i++)
+ {
+ if( !SHPSearchDiskTreeNode( fp, padfBoundsMin, padfBoundsMax,
+ ppanResultBuffer, pnBufferMax,
+ pnResultCount, bNeedSwap ) )
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/************************************************************************/
+/* SHPSearchDiskTree() */
+/************************************************************************/
+
+int SHPAPI_CALL1(*)
+SHPSearchDiskTree( FILE *fp,
+ double *padfBoundsMin, double *padfBoundsMax,
+ int *pnShapeCount )
+
+{
+ int i, bNeedSwap, nBufferMax = 0;
+ unsigned char abyBuf[16];
+ int *panResultBuffer = NULL;
+
+ *pnShapeCount = 0;
+
+/* -------------------------------------------------------------------- */
+/* Establish the byte order on this machine. */
+/* -------------------------------------------------------------------- */
+ i = 1;
+ if( *((unsigned char *) &i) == 1 )
+ bBigEndian = FALSE;
+ else
+ bBigEndian = TRUE;
+
+/* -------------------------------------------------------------------- */
+/* Read the header. */
+/* -------------------------------------------------------------------- */
+ fseek( fp, 0, SEEK_SET );
+ fread( abyBuf, 16, 1, fp );
+
+ if( memcmp( abyBuf, "SQT", 3 ) != 0 )
+ return NULL;
+
+ if( (abyBuf[3] == 2 && bBigEndian)
+ || (abyBuf[3] == 1 && !bBigEndian) )
+ bNeedSwap = FALSE;
+ else
+ bNeedSwap = TRUE;
+
+/* -------------------------------------------------------------------- */
+/* Search through root node and it's decendents. */
+/* -------------------------------------------------------------------- */
+ if( !SHPSearchDiskTreeNode( fp, padfBoundsMin, padfBoundsMax,
+ &panResultBuffer, &nBufferMax,
+ pnShapeCount, bNeedSwap ) )
+ {
+ if( panResultBuffer != NULL )
+ free( panResultBuffer );
+ *pnShapeCount = 0;
+ return NULL;
+ }
+/* -------------------------------------------------------------------- */
+/* Sort the id array */
+/* -------------------------------------------------------------------- */
+ qsort(panResultBuffer, *pnShapeCount, sizeof(int), compare_ints);
+
+ return panResultBuffer;
+}
+
+/************************************************************************/
+/* SHPGetSubNodeOffset() */
+/* */
+/* Determine how big all the subnodes of this node (and their */
+/* children) will be. This will allow disk based searchers to */
+/* seek past them all efficiently. */
+/************************************************************************/
+
+static int SHPGetSubNodeOffset( SHPTreeNode *node)
+{
+ int i;
+ long offset=0;
+
+ for(i=0; i<node->nSubNodes; i++ )
+ {
+ if(node->apsSubNode[i])
+ {
+ offset += 4*sizeof(double)
+ + (node->apsSubNode[i]->nShapeCount+3)*sizeof(int);
+ offset += SHPGetSubNodeOffset(node->apsSubNode[i]);
+ }
+ }
+
+ return(offset);
+}
+
+/************************************************************************/
+/* SHPWriteTreeNode() */
+/************************************************************************/
+
+static void SHPWriteTreeNode( FILE *fp, SHPTreeNode *node)
+{
+ int i,j;
+ int offset;
+ unsigned char *pabyRec = NULL;
+ assert( NULL != node );
+
+ offset = SHPGetSubNodeOffset(node);
+
+ pabyRec = (unsigned char *)
+ malloc(sizeof(double) * 4
+ + (3 * sizeof(int)) + (node->nShapeCount * sizeof(int)) );
+ if( NULL == pabyRec )
+ {
+#ifdef USE_CPL
+ CPLError( CE_Fatal, CPLE_OutOfMemory, "Memory allocation failure");
+#endif
+ assert( 0 );
+ }
+ assert( NULL != pabyRec );
+
+ memcpy( pabyRec, &offset, 4);
+
+ /* minx, miny, maxx, maxy */
+ memcpy( pabyRec+ 4, node->adfBoundsMin+0, sizeof(double) );
+ memcpy( pabyRec+12, node->adfBoundsMin+1, sizeof(double) );
+ memcpy( pabyRec+20, node->adfBoundsMax+0, sizeof(double) );
+ memcpy( pabyRec+28, node->adfBoundsMax+1, sizeof(double) );
+
+ memcpy( pabyRec+36, &node->nShapeCount, 4);
+ j = node->nShapeCount * sizeof(int);
+ memcpy( pabyRec+40, node->panShapeIds, j);
+ memcpy( pabyRec+j+40, &node->nSubNodes, 4);
+
+ fwrite( pabyRec, 44+j, 1, fp );
+ free (pabyRec);
+
+ for(i=0; i<node->nSubNodes; i++ )
+ {
+ if(node->apsSubNode[i])
+ SHPWriteTreeNode( fp, node->apsSubNode[i]);
+ }
+}
+
+/************************************************************************/
+/* SHPWriteTree() */
+/************************************************************************/
+
+int SHPWriteTree(SHPTree *tree, const char *filename )
+{
+ char signature[4] = "SQT";
+ int i;
+ char abyBuf[32];
+ FILE *fp;
+
+/* -------------------------------------------------------------------- */
+/* Open the output file. */
+/* -------------------------------------------------------------------- */
+ fp = fopen(filename, "wb");
+ if( fp == NULL )
+ {
+ return FALSE;
+ }
+
+/* -------------------------------------------------------------------- */
+/* Establish the byte order on this machine. */
+/* -------------------------------------------------------------------- */
+ i = 1;
+ if( *((unsigned char *) &i) == 1 )
+ bBigEndian = FALSE;
+ else
+ bBigEndian = TRUE;
+
+/* -------------------------------------------------------------------- */
+/* Write the header. */
+/* -------------------------------------------------------------------- */
+ memcpy( abyBuf+0, signature, 3 );
+
+ if( bBigEndian )
+ abyBuf[3] = 2; /* New MSB */
+ else
+ abyBuf[3] = 1; /* New LSB */
+
+ abyBuf[4] = 1; /* version */
+ abyBuf[5] = 0; /* next 3 reserved */
+ abyBuf[6] = 0;
+ abyBuf[7] = 0;
+
+ fwrite( abyBuf, 8, 1, fp );
+
+ fwrite( &(tree->nTotalCount), 4, 1, fp );
+
+ /* write maxdepth */
+
+ fwrite( &(tree->nMaxDepth), 4, 1, fp );
+
+/* -------------------------------------------------------------------- */
+/* Write all the nodes "in order". */
+/* -------------------------------------------------------------------- */
+
+ SHPWriteTreeNode( fp, tree->psRoot );
+
+ fclose( fp );
+
+ return TRUE;
+}
diff --git a/map/textfile/Makefile.am b/map/textfile/Makefile.am
new file mode 100644
index 00000000..a136796f
--- /dev/null
+++ b/map/textfile/Makefile.am
@@ -0,0 +1,9 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=map_textfile
+if PLUGINS
+ modulemap_LTLIBRARIES = libmap_textfile.la
+else
+ noinst_LTLIBRARIES = libmap_textfile.la
+endif
+libmap_textfile_la_SOURCES = textfile.c textfile.h
+libmap_textfile_la_LDFLAGS = -module -avoid-version
diff --git a/map/textfile/textfile.c b/map/textfile/textfile.c
new file mode 100644
index 00000000..2bdf07d9
--- /dev/null
+++ b/map/textfile/textfile.c
@@ -0,0 +1,405 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include "config.h"
+#include "debug.h"
+#include "plugin.h"
+#include "projection.h"
+#include "item.h"
+#include "map.h"
+#include "maptype.h"
+#include "attr.h"
+#include "transform.h"
+#include "file.h"
+
+#include "textfile.h"
+
+static int map_id;
+
+static int
+get_tag(char *line, char *name, int *pos, char *ret, char *name_ret)
+{
+ int len=0,quoted;
+ char *p,*e,*n;
+
+ dbg(1,"get_tag %s from %s\n", name, line);
+ if (name)
+ len=strlen(name);
+ if (pos)
+ p=line+*pos;
+ else
+ p=line;
+ for(;;) {
+ while (*p == ' ') {
+ p++;
+ }
+ if (! *p)
+ return 0;
+ n=p;
+ e=strchr(p,'=');
+ if (! e)
+ return 0;
+ p=e+1;
+ quoted=0;
+ while (*p) {
+ if (*p == ' ' && !quoted)
+ break;
+ if (*p == '"')
+ quoted=1-quoted;
+ p++;
+ }
+ if (name == NULL || (e-n == len && !strncmp(n, name, len))) {
+ if (name_ret) {
+ len=e-n;
+ strncpy(name_ret, n, len);
+ name_ret[len]='\0';
+ }
+ e++;
+ len=p-e;
+ if (e[0] == '"') {
+ e++;
+ len-=2;
+ }
+ strncpy(ret, e, len);
+ ret[len]='\0';
+ if (pos)
+ *pos=p-line;
+ return 1;
+ }
+ }
+ return 0;
+}
+
+static void
+get_line(struct map_rect_priv *mr)
+{
+ if(mr->f) {
+ if (!mr->m->is_pipe)
+ mr->pos=ftell(mr->f);
+ else
+ mr->pos+=mr->lastlen;
+ fgets(mr->line, SIZE, mr->f);
+ mr->lastlen=strlen(mr->line)+1;
+ if (strlen(mr->line) >= SIZE-1)
+ printf("line too long\n");
+ }
+}
+
+static void
+map_destroy_textfile(struct map_priv *m)
+{
+ dbg(1,"map_destroy_textfile\n");
+ g_free(m);
+}
+
+static void
+textfile_coord_rewind(void *priv_data)
+{
+}
+
+static int
+parse_line(struct map_rect_priv *mr, int attr)
+{
+ int pos;
+
+ pos=coord_parse(mr->line, projection_mg, &mr->c);
+ if (pos < strlen(mr->line) && attr) {
+ strcpy(mr->attrs, mr->line+pos);
+ }
+ return pos;
+}
+
+static int
+textfile_coord_get(void *priv_data, struct coord *c, int count)
+{
+ struct map_rect_priv *mr=priv_data;
+ int ret=0;
+ dbg(1,"textfile_coord_get %d\n",count);
+ while (count--) {
+ if (mr->f && !feof(mr->f) && (!mr->item.id_hi || !mr->eoc) && parse_line(mr, mr->item.id_hi)) {
+ *c=mr->c;
+ dbg(1,"c=0x%x,0x%x\n", c->x, c->y);
+ c++;
+ ret++;
+ get_line(mr);
+ if (mr->item.id_hi)
+ mr->eoc=1;
+ } else {
+ mr->more=0;
+ break;
+ }
+ }
+ return ret;
+}
+
+static void
+textfile_attr_rewind(void *priv_data)
+{
+}
+
+static void
+textfile_encode_attr(char *attr_val, enum attr_type attr_type, struct attr *attr)
+{
+ if (attr_type >= attr_type_int_begin && attr_type <= attr_type_int_end)
+ attr->u.num=atoi(attr_val);
+ else
+ attr->u.str=attr_val;
+}
+
+static int
+textfile_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
+{
+ struct map_rect_priv *mr=priv_data;
+ char *str=NULL;
+ dbg(1,"textfile_attr_get mr=%p attrs='%s' ", mr, mr->attrs);
+ if (attr_type != mr->attr_last) {
+ dbg(1,"reset attr_pos\n");
+ mr->attr_pos=0;
+ mr->attr_last=attr_type;
+ }
+ if (attr_type == attr_any) {
+ dbg(1,"attr_any");
+ if (get_tag(mr->attrs,NULL,&mr->attr_pos,mr->attr, mr->attr_name)) {
+ attr_type=attr_from_name(mr->attr_name);
+ dbg(1,"found attr '%s' 0x%x\n", mr->attr_name, attr_type);
+ attr->type=attr_type;
+ textfile_encode_attr(mr->attr, attr_type, attr);
+ return 1;
+ }
+ } else {
+ str=attr_to_name(attr_type);
+ dbg(1,"attr='%s' ",str);
+ if (get_tag(mr->attrs,str,&mr->attr_pos,mr->attr, NULL)) {
+ textfile_encode_attr(mr->attr, attr_type, attr);
+ dbg(1,"found\n");
+ return 1;
+ }
+ }
+ dbg(1,"not found\n");
+ return 0;
+}
+
+static struct item_methods methods_textfile = {
+ textfile_coord_rewind,
+ textfile_coord_get,
+ textfile_attr_rewind,
+ textfile_attr_get,
+};
+
+static struct map_rect_priv *
+map_rect_new_textfile(struct map_priv *map, struct map_selection *sel)
+{
+ struct map_rect_priv *mr;
+
+ dbg(1,"map_rect_new_textfile\n");
+ mr=g_new0(struct map_rect_priv, 1);
+ mr->m=map;
+ mr->sel=sel;
+ mr->item.id_hi=0;
+ mr->item.id_lo=0;
+ mr->item.meth=&methods_textfile;
+ mr->item.priv_data=mr;
+ if (map->is_pipe) {
+ char *oargs,*args=g_strdup(map->filename),*sep=" ";
+ enum layer_type lay;
+ g_free(mr->args);
+ while (sel) {
+ oargs=args;
+ args=g_strdup_printf("%s 0x%x 0x%x 0x%x 0x%x", oargs, sel->u.c_rect.lu.x, sel->u.c_rect.lu.y, sel->u.c_rect.rl.x, sel->u.c_rect.rl.y);
+ g_free(oargs);
+ for (lay=layer_town ; lay < layer_end ; lay++) {
+ oargs=args;
+ args=g_strdup_printf("%s%s%d", oargs, sep, sel->order);
+ g_free(oargs);
+ sep=",";
+ }
+ sel=sel->next;
+ }
+ dbg(1,"popen args %s\n", args);
+ mr->args=args;
+ mr->f=popen(mr->args, "r");
+ mr->pos=0;
+ mr->lastlen=0;
+ } else {
+ mr->f=fopen(map->filename, "r");
+ }
+ if(!mr->f) {
+ printf("map_rect_new_textfile unable to open textfile %s\n",map->filename);
+ }
+ get_line(mr);
+ return mr;
+}
+
+
+static void
+map_rect_destroy_textfile(struct map_rect_priv *mr)
+{
+ if (mr->f) {
+ if (mr->m->is_pipe)
+ pclose(mr->f);
+ else
+ fclose(mr->f);
+ }
+ g_free(mr);
+}
+
+static struct item *
+map_rect_get_item_textfile(struct map_rect_priv *mr)
+{
+ char *p,type[SIZE];
+ dbg(1,"map_rect_get_item_textfile id_hi=%d line=%s", mr->item.id_hi, mr->line);
+ if (!mr->f) {
+ return NULL;
+ }
+ while (mr->more) {
+ struct coord c;
+ textfile_coord_get(mr, &c, 1);
+ }
+ for(;;) {
+ if (feof(mr->f)) {
+ dbg(1,"map_rect_get_item_textfile: eof\n");
+ if (mr->item.id_hi) {
+ return NULL;
+ }
+ mr->item.id_hi++;
+ if (mr->m->is_pipe) {
+ pclose(mr->f);
+ mr->f=popen(mr->args, "r");
+ mr->pos=0;
+ mr->lastlen=0;
+ } else
+ fseek(mr->f, 0, SEEK_SET);
+ get_line(mr);
+ }
+ if ((p=strchr(mr->line,'\n')))
+ *p='\0';
+ if (mr->item.id_hi) {
+ mr->attrs[0]='\0';
+ if (!parse_line(mr, 1)) {
+ get_line(mr);
+ continue;
+ }
+ dbg(1,"map_rect_get_item_textfile: point found\n");
+ mr->eoc=0;
+ mr->item.id_lo=mr->pos;
+ } else {
+ if (parse_line(mr, 1)) {
+ get_line(mr);
+ continue;
+ }
+ dbg(1,"map_rect_get_item_textfile: line found\n");
+ if (! mr->line[0]) {
+ get_line(mr);
+ continue;
+ }
+ mr->item.id_lo=mr->pos;
+ strcpy(mr->attrs, mr->line);
+ get_line(mr);
+ dbg(1,"mr=%p attrs=%s\n", mr, mr->attrs);
+ }
+ dbg(1,"get_attrs %s\n", mr->attrs);
+ if (get_tag(mr->attrs,"type",NULL,type,NULL)) {
+ dbg(1,"type='%s'\n", type);
+ mr->item.type=item_from_name(type);
+ if (mr->item.type == type_none)
+ printf("Warning: type '%s' unknown\n", type);
+ } else {
+ get_line(mr);
+ continue;
+ }
+ mr->attr_last=attr_none;
+ mr->more=1;
+ dbg(1,"return attr='%s'\n", mr->attrs);
+ return &mr->item;
+ }
+}
+
+static struct item *
+map_rect_get_item_byid_textfile(struct map_rect_priv *mr, int id_hi, int id_lo)
+{
+ if (mr->m->is_pipe) {
+ pclose(mr->f);
+ mr->f=popen(mr->args, "r");
+ mr->pos=0;
+ mr->lastlen=0;
+ } else
+ fseek(mr->f, id_lo, SEEK_SET);
+ get_line(mr);
+ mr->item.id_hi=id_hi;
+ return map_rect_get_item_textfile(mr);
+}
+
+static struct map_methods map_methods_textfile = {
+ projection_mg,
+ "iso8859-1",
+ map_destroy_textfile,
+ map_rect_new_textfile,
+ map_rect_destroy_textfile,
+ map_rect_get_item_textfile,
+ map_rect_get_item_byid_textfile,
+};
+
+static struct map_priv *
+map_new_textfile(struct map_methods *meth, struct attr **attrs)
+{
+ struct map_priv *m;
+ struct attr *data=attr_search(attrs, NULL, attr_data);
+ struct attr *charset=attr_search(attrs, NULL, attr_charset);
+ struct file_wordexp *wexp;
+ int len,is_pipe=0;
+ char *wdata;
+ char **wexp_data;
+ if (! data)
+ return NULL;
+ dbg(1,"map_new_textfile %s\n", data->u.str);
+ wdata=g_strdup(data->u.str);
+ len=strlen(wdata);
+ if (len && wdata[len-1] == '|') {
+ wdata[len-1]='\0';
+ is_pipe=1;
+ }
+ wexp=file_wordexp_new(wdata);
+ wexp_data=file_wordexp_get_array(wexp);
+ *meth=map_methods_textfile;
+
+ m=g_new0(struct map_priv, 1);
+ m->id=++map_id;
+ m->filename=g_strdup(wexp_data[0]);
+ m->is_pipe=is_pipe;
+ dbg(1,"map_new_textfile %s %s\n", m->filename, wdata);
+ if (charset) {
+ m->charset=g_strdup(charset->u.str);
+ meth->charset=m->charset;
+ }
+ file_wordexp_destroy(wexp);
+ return m;
+}
+
+void
+plugin_init(void)
+{
+ dbg(1,"textfile: plugin_init\n");
+ plugin_register_map_type("textfile", map_new_textfile);
+}
+
diff --git a/map/textfile/textfile.h b/map/textfile/textfile.h
new file mode 100644
index 00000000..ef97e33a
--- /dev/null
+++ b/map/textfile/textfile.h
@@ -0,0 +1,51 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdio.h>
+#include "attr.h"
+#include "coord.h"
+struct map_priv {
+ int id;
+ char *filename;
+ char *charset;
+ int is_pipe;
+};
+
+#define SIZE 512
+
+struct map_rect_priv {
+ struct map_selection *sel;
+
+ FILE *f;
+ long pos;
+ char line[SIZE];
+ int attr_pos;
+ enum attr_type attr_last;
+ char attrs[SIZE];
+ char attr[SIZE];
+ char attr_name[SIZE];
+ struct coord c;
+ int eoc;
+ int more;
+ struct map_priv *m;
+ struct item item;
+ char *args;
+ int lastlen;
+};
+
diff --git a/map_data.h b/map_data.h
new file mode 100644
index 00000000..656bd80d
--- /dev/null
+++ b/map_data.h
@@ -0,0 +1,54 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_MAP_DATA_H
+#define NAVIT_MAP_DATA_H
+
+enum file_index {
+ file_border_ply=0,
+ file_bridge_ply,
+ file_height_ply,
+ file_other_ply,
+ file_rail_ply,
+ file_sea_ply,
+ file_street_bti,
+ file_street_str,
+ file_strname_stn,
+ file_town_twn,
+ file_tunnel_ply,
+ file_water_ply,
+ file_woodland_ply,
+ file_end
+};
+
+struct map_data {
+ struct file *file[file_end];
+ struct map_data *next;
+};
+
+struct map_data *load_maps(char *map);
+
+struct transformation;
+struct block_info;
+
+void map_data_foreach(struct map_data *mdata, int file, struct transformation *t, int limit,
+ void(*func)(struct block_info *, unsigned char *, unsigned char *, void *), void *data);
+
+#endif
+
diff --git a/maps/Makefile.am b/maps/Makefile.am
new file mode 100644
index 00000000..312e98ad
--- /dev/null
+++ b/maps/Makefile.am
@@ -0,0 +1,25 @@
+include $(top_srcdir)/Makefile.inc
+
+SAMPLE_MAP=osm_bbox_11.3,47.9,11.7,48.2
+
+maps_DATA = $(SAMPLE_MAP).bin $(SAMPLE_MAP).xml
+
+samplemap: $(SAMPLE_MAP).bin
+
+$(SAMPLE_MAP).osm.bz2:
+ echo "Downloading osm sample map"
+ wget -O $(SAMPLE_MAP).osm.bz2.tmp http://www.navit-project.org/maps/$(SAMPLE_MAP).osm.bz2
+ mv $(SAMPLE_MAP).osm.bz2.tmp $(SAMPLE_MAP).osm.bz2
+
+$(SAMPLE_MAP).bin: $(SAMPLE_MAP).osm.bz2 $(top_builddir)/navit/osm2navit
+ echo "Converting osm sample map"
+ bzcat $(SAMPLE_MAP).osm.bz2 | $(top_builddir)/navit/osm2navit --attr-debug-level=5 $(SAMPLE_MAP).bin.tmp
+ mv $(SAMPLE_MAP).bin.tmp $(SAMPLE_MAP).bin
+
+$(SAMPLE_MAP).xml: $(SAMPLE_MAP).bin
+ echo '<map type="binfile" enabled="yes" data="$$NAVIT_SHAREDIR/maps/osm_bbox_11.3,47.9,11.7,48.2.bin"/>' >$(SAMPLE_MAP).xml
+
+distclean-local:
+ rm -f $(SAMPLE_MAP).osm.bz2 $(SAMPLE_MAP).bin $(SAMPLE_MAP).xml
+
+all:
diff --git a/mapset.c b/mapset.c
new file mode 100644
index 00000000..e1a8f61e
--- /dev/null
+++ b/mapset.c
@@ -0,0 +1,275 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/** @file
+ *
+ * @brief Contains code used for loading more than one map
+ *
+ * The code in this file introduces "mapsets", which are collections of several maps.
+ * This enables navit to operate on more than one map at once. See map.c / map.h to learn
+ * how maps are handled.
+ */
+
+#include <string.h>
+#include <glib.h>
+#include <glib/gprintf.h>
+#include "debug.h"
+#include "item.h"
+#include "mapset.h"
+#include "projection.h"
+#include "map.h"
+
+/**
+ * @brief A mapset
+ *
+ * This structure holds a complete mapset
+ */
+struct mapset {
+ GList *maps; /**< Linked list of all the maps in the mapset */
+};
+
+/**
+ * @brief Creates a new, empty mapset
+ *
+ * @return The new mapset
+ */
+struct mapset *mapset_new(struct attr *parent, struct attr **attrs)
+{
+ struct mapset *ms;
+
+ ms=g_new0(struct mapset, 1);
+
+ return ms;
+}
+
+
+/**
+ * @brief Adds a map to a mapset
+ *
+ * @param ms The mapset to add the map to
+ * @param m The map to be added
+ */
+int
+mapset_add_attr(struct mapset *ms, struct attr *attr)
+{
+ switch (attr->type) {
+ case attr_map:
+ ms->maps=g_list_append(ms->maps, attr->u.map);
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+#if 0
+static void mapset_maps_free(struct mapset *ms)
+{
+ /* todo */
+}
+#endif
+
+/**
+ * @brief Destroys a mapset.
+ *
+ * This destroys a mapset. Please note that it does not touch the contained maps
+ * in any way.
+ *
+ * @param ms The mapset to be destroyed
+ */
+void mapset_destroy(struct mapset *ms)
+{
+ g_free(ms);
+}
+
+/**
+ * @brief Handle for a mapset in use
+ *
+ * This struct is used for a mapset that is in use. With this it is possible to iterate
+ * all maps in a mapset.
+ */
+struct mapset_handle {
+ GList *l; /**< Pointer to the current (next) map */
+};
+
+/**
+ * @brief Returns a new handle for a mapset
+ *
+ * This returns a new handle for an existing mapset. The new handle points to the first
+ * map in the set.
+ *
+ * @param ms The mapset to get a handle of
+ * @return The new mapset handle
+ */
+struct mapset_handle *
+mapset_open(struct mapset *ms)
+{
+ struct mapset_handle *ret=NULL;
+ if(ms)
+ {
+ ret=g_new(struct mapset_handle, 1);
+ ret->l=ms->maps;
+ }
+
+ return ret;
+}
+
+/**
+ * @brief Gets the next map from a mapset handle
+ *
+ * If you set active to true, this function will not return any maps that
+ * have the attr_active attribute associated with them and set to false.
+ *
+ * @param msh The mapset handle to get the next map of
+ * @param active Set to true to only get active maps (See description)
+ * @return The next map
+ */
+struct map * mapset_next(struct mapset_handle *msh, int active)
+{
+ struct map *ret;
+ struct attr active_attr;
+
+ for (;;) {
+ if (!msh || !msh->l)
+ return NULL;
+ ret=msh->l->data;
+ msh->l=g_list_next(msh->l);
+ if (!active)
+ return ret;
+ if (!map_get_attr(ret, attr_active, &active_attr, NULL))
+ return ret;
+ if (active_attr.u.num)
+ return ret;
+ }
+}
+
+/**
+ * @brief Closes a mapset handle after it is no longer used
+ *
+ * @param msh Mapset handle to be closed
+ */
+void
+mapset_close(struct mapset_handle *msh)
+{
+ g_free(msh);
+}
+
+/**
+ * @brief Holds information about a search in a mapset
+ *
+ * This struct holds information about a search (e.g. for a street) in a mapset.
+ *
+ * @sa For a more detailed description see the documentation of mapset_search_new().
+ */
+struct mapset_search {
+ GList *map; /**< The list of maps to be searched within */
+ struct map_search *ms; /**< A map search struct for the map currently active */
+ struct item *item; /**< "Superior" item. */
+ struct attr *search_attr; /**< Attribute to be searched for. */
+ int partial; /**< Indicates if one would like to have partial matches */
+};
+
+/**
+ * @brief Starts a search on a mapset
+ *
+ * This function starts a search on a mapset. What attributes one can search for depends on the
+ * map plugin. See the description of map_search_new() in map.c for details.
+ *
+ * If you enable partial matches bear in mind that the search matches only the begin of the
+ * strings - a search for a street named "street" would match to "streetfoo", but not to
+ * "somestreet". Search is case insensitive.
+ *
+ * The item passed to this function specifies a "superior item" to "search within" - e.g. a town
+ * in which we want to search for a street, or a country in which to search for a town.
+ *
+ * @param ms The mapset that should be searched
+ * @param item Specifies a superior item to "search within" (see description)
+ * @param search_attr Attribute specifying what to search for. See description.
+ * @param partial Set this to true to also have partial matches. See description.
+ * @return A new mapset search struct for this search
+ */
+struct mapset_search *
+mapset_search_new(struct mapset *ms, struct item *item, struct attr *search_attr, int partial)
+{
+ struct mapset_search *this;
+ dbg(1,"enter(%p,%p,%p,%d)\n", ms, item, search_attr, partial);
+ this=g_new0(struct mapset_search,1);
+ if(this != NULL && ms!=NULL )
+ {
+ this->map=ms->maps;
+ this->item=item;
+ this->search_attr=search_attr;
+ this->partial=partial;
+ this->ms=map_search_new(this->map->data, item, search_attr, partial);
+ return this;
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+/**
+ * @brief Returns the next found item from a mapset search
+ *
+ * This function returns the next item from a mapset search or NULL if there are no more items found.
+ * It automatically iterates through all the maps in the mapset. Please note that maps which have the
+ * attr_active attribute associated with them and set to false are not searched.
+ *
+ * @param this The mapset search to return an item from
+ * @return The next found item or NULL if there are no more items found
+ */
+struct item *
+mapset_search_get_item(struct mapset_search *this)
+{
+ struct item *ret=NULL;
+ struct attr active_attr;
+
+ while ((this) && (!this->ms || !(ret=map_search_get_item(this->ms)))) { /* The current map has no more items to be returned */
+ if (this->search_attr->type >= attr_country_all && this->search_attr->type <= attr_country_name)
+ break;
+ for (;;) {
+ this->map=g_list_next(this->map);
+ if (! this->map)
+ break;
+ if (!map_get_attr(this->map->data, attr_active, &active_attr, NULL))
+ break;
+ if (active_attr.u.num)
+ break;
+ }
+ if (! this->map)
+ break;
+ map_search_destroy(this->ms);
+ this->ms=map_search_new(this->map->data, this->item, this->search_attr, this->partial);
+ }
+ return ret;
+}
+
+/**
+ * @brief Destroys a mapset search
+ *
+ * @param this The mapset search to be destroyed
+ */
+void
+mapset_search_destroy(struct mapset_search *this)
+{
+ if (this) {
+ map_search_destroy(this->ms);
+ g_free(this);
+ }
+}
diff --git a/mapset.h b/mapset.h
new file mode 100644
index 00000000..0e19010b
--- /dev/null
+++ b/mapset.h
@@ -0,0 +1,41 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_MAPSET_H
+#define NAVIT_MAPSET_H
+
+/* prototypes */
+struct attr;
+struct item;
+struct map;
+struct mapset;
+struct mapset_handle;
+struct mapset_search;
+struct mapset *mapset_new(struct attr *parent, struct attr **attrs);
+int mapset_add_attr(struct mapset *ms, struct attr *attr);
+void mapset_destroy(struct mapset *ms);
+struct mapset_handle *mapset_open(struct mapset *ms);
+struct map *mapset_next(struct mapset_handle *msh, int active);
+void mapset_close(struct mapset_handle *msh);
+struct mapset_search *mapset_search_new(struct mapset *ms, struct item *item, struct attr *search_attr, int partial);
+struct item *mapset_search_get_item(struct mapset_search *this);
+void mapset_search_destroy(struct mapset_search *this);
+
+#endif
+
diff --git a/maptype.c b/maptype.c
new file mode 100644
index 00000000..cb77a1d5
--- /dev/null
+++ b/maptype.c
@@ -0,0 +1,51 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include "debug.h"
+#include "projection.h"
+#include "item.h"
+#include "map.h"
+#include "maptype.h"
+
+static struct maptype *maptype_root;
+
+void
+maptype_register(char *name, struct map_priv *(*map_new)(struct map_methods *meth, char *data, char **charset, enum projection *pro))
+{
+ struct maptype *mt;
+ mt=g_new(struct maptype, 1);
+ mt->name=g_strdup(name);
+ mt->map_new=map_new;
+ mt->next=maptype_root;
+ maptype_root=mt;
+}
+
+struct maptype *
+maptype_get(const char *name)
+{
+ struct maptype *mt=maptype_root;
+
+ while (mt) {
+ if (!g_ascii_strcasecmp(mt->name, name))
+ return mt;
+ mt=mt->next;
+ }
+ return NULL;
+}
diff --git a/maptype.h b/maptype.h
new file mode 100644
index 00000000..7ebf233b
--- /dev/null
+++ b/maptype.h
@@ -0,0 +1,40 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_MAPTYPE_H
+#define NAVIT_MAPTYPE_H
+
+struct map_methods;
+enum projection;
+
+struct maptype {
+ char *name;
+ struct map_priv *(*map_new)(struct map_methods *meth, char *data, char **charset, enum projection *pro);
+ struct maptype *next;
+};
+
+/* prototypes */
+struct map_methods;
+struct map_priv;
+struct maptype;
+void maptype_register(char *name, struct map_priv *(*map_new)(struct map_methods *meth, char *data, char **charset, enum projection *pro));
+struct maptype *maptype_get(const char *name);
+
+#endif
+
diff --git a/menu.c b/menu.c
new file mode 100644
index 00000000..92afa6c7
--- /dev/null
+++ b/menu.c
@@ -0,0 +1,47 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include "menu.h"
+#include "debug.h"
+
+struct menu *
+menu_add(struct menu *menu, char *name, enum menu_type type, struct callback *cb)
+{
+ struct menu *this;
+ if (! menu || ! menu->meth.add)
+ return NULL;
+ this=g_new0(struct menu, 1);
+ this->priv=(*menu->meth.add)(menu->priv, &this->meth, name, type, cb);
+ if (! this->priv) {
+ g_free(this);
+ return NULL;
+ }
+
+ return this;
+}
+
+void
+menu_popup(struct menu *menu)
+{
+ if (! menu || ! menu->meth.popup)
+ return;
+ (*menu->meth.popup)(menu->priv);
+
+}
diff --git a/menu.h b/menu.h
new file mode 100644
index 00000000..e2dd1c0e
--- /dev/null
+++ b/menu.h
@@ -0,0 +1,49 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_MENU_H
+#define NAVIT_MENU_H
+
+enum menu_type {
+ menu_type_submenu,
+ menu_type_menu,
+ menu_type_toggle,
+};
+
+struct container;
+struct menu;
+struct callback;
+
+struct menu_methods {
+ struct menu_priv *(*add)(struct menu_priv *menu, struct menu_methods *meth, char *name, enum menu_type type, struct callback *cb);
+ void (*set_toggle)(struct menu_priv *menu, int active);
+ int (*get_toggle)(struct menu_priv *menu);
+ void (*popup)(struct menu_priv *menu);
+};
+
+struct menu {
+ struct menu_priv *priv;
+ struct menu_methods meth;
+};
+
+/* prototypes */
+struct menu *menu_add(struct menu *menu, char *name, enum menu_type type, struct callback *cb);
+void menu_popup(struct menu *menu);
+/* end of prototypes */
+#endif
diff --git a/messages.c b/messages.c
new file mode 100644
index 00000000..14107097
--- /dev/null
+++ b/messages.c
@@ -0,0 +1,155 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include <time.h>
+#include "messages.h"
+#include "callback.h"
+#include "event.h"
+#include "attr.h"
+
+struct messagelist {
+ struct message *messages; /**< All the messages that can currently be shown */
+ int last_mid; /**< Last Message ID */
+ int maxage; /**< Maximum age of messages */
+ int maxnum; /**< Maximum number of messages */
+ struct callback *msg_cleanup_cb; /**< Callback to clean up the messages */
+ struct event_timeout *msg_cleanup_to; /**< Idle event to clean up the messages */
+};
+
+int
+message_new(struct messagelist *this_, char *message)
+{
+ struct message *msg;
+
+ msg = g_new0(struct message, 1);
+ msg->text = g_strdup(message);
+ msg->id = ++(this_->last_mid);
+ msg->time = time(NULL);
+
+ msg->next = this_->messages;
+ this_->messages = msg;
+
+ return msg->id;
+}
+
+int
+message_delete(struct messagelist *this_, int mid)
+{
+ struct message *msg,*last;;
+
+ msg = this_->messages;
+ last = NULL;
+
+ while (msg) {
+ if (msg->id == mid) {
+ break;
+ }
+
+ last = msg;
+ msg = msg->next;
+ }
+
+ if (msg) {
+ if (last) {
+ last->next = msg->next;
+ } else {
+ this_->messages = msg->next;
+ }
+
+ g_free(msg->text);
+ g_free(msg);
+
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+static void
+message_cleanup(struct messagelist *this_)
+{
+ struct message *msg,*next,*prev=NULL;
+ int i;
+ time_t now;
+
+ msg = this_->messages;
+
+ now = time(NULL);
+
+ i = 0;
+ while (msg && (i < this_->maxnum)) {
+ if ((this_->maxage > 0) && (now - msg->time) > this_->maxage) {
+ break;
+ }
+
+ i++;
+ prev = msg;
+ msg = msg->next;
+ }
+
+ if (prev) {
+ prev->next = NULL;
+ } else {
+ this_->messages = NULL;
+ }
+
+ while (msg) {
+ next = msg->next;
+
+ g_free(msg->text);
+ g_free(msg);
+
+ msg = next;
+ }
+}
+
+struct messagelist
+*messagelist_new(struct attr **attrs)
+{
+ struct messagelist *this = g_new0(struct messagelist, 1);
+ struct attr num_attr,age_attr;
+
+ if (attr_generic_get_attr(attrs, NULL, attr_message_maxage, &age_attr, NULL)) {
+ this->maxage = age_attr.u.num;
+ } else {
+ this->maxage = 10;
+ }
+
+ if (attr_generic_get_attr(attrs, NULL, attr_message_maxnum, &num_attr, NULL)) {
+ this->maxnum = num_attr.u.num;
+ } else {
+ this->maxnum = 3;
+ }
+
+ return this;
+}
+
+void
+messagelist_init(struct messagelist *this_)
+{
+ this_->msg_cleanup_cb = callback_new_1(callback_cast(message_cleanup), this_);
+ this_->msg_cleanup_to = event_add_timeout(1000, 1, this_->msg_cleanup_cb);
+}
+
+struct message
+*message_get(struct messagelist *this_)
+{
+ return this_->messages;
+}
diff --git a/messages.h b/messages.h
new file mode 100644
index 00000000..0b6c66c3
--- /dev/null
+++ b/messages.h
@@ -0,0 +1,41 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_MESSAGES_H
+#define NAVIT_MESSAGES_H
+
+struct messagelist;
+
+struct message {
+ struct message *next;
+ int id;
+ time_t time;
+ char *text;
+};
+
+/* Prototypes */
+struct attr;
+
+int message_new(struct messagelist *this_, char *message);
+int message_delete(struct messagelist *this_, int mid);
+struct messagelist *messagelist_new(struct attr **attrs);
+void messagelist_init(struct messagelist *this_);
+struct message *message_get(struct messagelist *this_);
+
+#endif
diff --git a/navigation.c b/navigation.c
new file mode 100644
index 00000000..827e09d4
--- /dev/null
+++ b/navigation.c
@@ -0,0 +1,2156 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <ctype.h>
+#include <glib.h>
+#include "debug.h"
+#include "profile.h"
+#include "navigation.h"
+#include "coord.h"
+#include "item.h"
+#include "route.h"
+#include "transform.h"
+#include "mapset.h"
+#include "projection.h"
+#include "map.h"
+#include "navit.h"
+#include "callback.h"
+#include "plugin.h"
+#include "navit_nls.h"
+
+#define DEBUG
+
+struct suffix {
+ char *fullname;
+ char *abbrev;
+ int sex;
+} suffixes[]= {
+ {"weg",NULL,1},
+ {"platz","pl.",1},
+ {"ring",NULL,1},
+ {"allee",NULL,2},
+ {"gasse",NULL,2},
+ {"straße","str.",2},
+ {"strasse",NULL,2},
+};
+
+struct navigation {
+ struct route *route;
+ struct map *map;
+ struct item_hash *hash;
+ struct navigation_itm *first;
+ struct navigation_itm *last;
+ struct navigation_command *cmd_first;
+ struct navigation_command *cmd_last;
+ struct callback_list *callback_speech;
+ struct callback_list *callback;
+ struct navit *navit;
+ int level_last;
+ struct item item_last;
+ int turn_around;
+ int turn_around_limit;
+ int distance_turn;
+ struct callback *route_cb;
+ int announce[route_item_last-route_item_first+1][3];
+};
+
+
+struct navigation_command {
+ struct navigation_itm *itm;
+ struct navigation_command *next;
+ struct navigation_command *prev;
+ int delta;
+ int roundabout_delta;
+ int length;
+};
+
+static void navigation_flush(struct navigation *this_);
+
+/**
+ * @brief Calculates the delta between two angles
+ * @param angle1 The first angle
+ * @param angle2 The second angle
+ * @return The difference between the angles: -179..-1=angle2 is left of angle1,0=same,1..179=angle2 is right of angle1,180=angle1 is opposite of angle2
+ */
+
+static int
+angle_delta(int angle1, int angle2)
+{
+ int delta=angle2-angle1;
+ if (delta <= -180)
+ delta+=360;
+ if (delta > 180)
+ delta-=360;
+ return delta;
+}
+
+static int
+angle_median(int angle1, int angle2)
+{
+ int delta=angle_delta(angle1, angle2);
+ int ret=angle1+delta/2;
+ if (ret < 0)
+ ret+=360;
+ if (ret > 360)
+ ret-=360;
+ return ret;
+}
+
+static int
+angle_opposite(int angle)
+{
+ return ((angle+180)%360);
+}
+
+int
+navigation_get_attr(struct navigation *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
+{
+ dbg(0,"enter %s\n", attr_to_name(type));
+ switch (type) {
+ case attr_map:
+ attr->u.map=this_->map;
+ break;
+ default:
+ return 0;
+ }
+ attr->type=type;
+ return 1;
+}
+
+
+struct navigation *
+navigation_new(struct attr *parent, struct attr **attrs)
+{
+ int i,j;
+ struct navigation *ret=g_new0(struct navigation, 1);
+ ret->hash=item_hash_new();
+ ret->callback=callback_list_new();
+ ret->callback_speech=callback_list_new();
+ ret->level_last=-2;
+ ret->distance_turn=50;
+ ret->turn_around_limit=3;
+ ret->navit=parent->u.navit;
+
+ for (j = 0 ; j <= route_item_last-route_item_first ; j++) {
+ for (i = 0 ; i < 3 ; i++) {
+ ret->announce[j][i]=-1;
+ }
+ }
+
+ return ret;
+}
+
+int
+navigation_set_announce(struct navigation *this_, enum item_type type, int *level)
+{
+ int i;
+ if (type < route_item_first || type > route_item_last) {
+ dbg(0,"street type %d out of range [%d,%d]", type, route_item_first, route_item_last);
+ return 0;
+ }
+ for (i = 0 ; i < 3 ; i++)
+ this_->announce[type-route_item_first][i]=level[i];
+ return 1;
+}
+
+static int
+navigation_get_announce_level(struct navigation *this_, enum item_type type, int dist)
+{
+ int i;
+
+ if (type < route_item_first || type > route_item_last)
+ return -1;
+ for (i = 0 ; i < 3 ; i++) {
+ if (dist <= this_->announce[type-route_item_first][i])
+ return i;
+ }
+ return i;
+}
+
+/**
+ * @brief Holds a way that one could possibly drive from a navigation item
+ */
+struct navigation_way {
+ struct navigation_way *next; /**< Pointer to a linked-list of all navigation_ways from this navigation item */
+ short dir; /**< The direction -1 or 1 of the way */
+ short angle2; /**< The angle one has to steer to drive from the old item to this street */
+ int flags; /**< The flags of the way */
+ struct item item; /**< The item of the way */
+ char *name1;
+ char *name2;
+};
+
+struct navigation_itm {
+ char *name1;
+ char *name2;
+ struct item item;
+ int direction;
+ int angle_start;
+ int angle_end;
+ struct coord start,end;
+ int time;
+ int length;
+ int dest_time;
+ int dest_length;
+ int told; /**< Indicates if this item's announcement has been told earlier and should not be told again*/
+ int streetname_told; /**< Indicates if this item's streetname has been told in speech navigation*/
+ int dest_count;
+ int flags;
+ struct navigation_itm *next;
+ struct navigation_itm *prev;
+ struct navigation_way *ways; /**< Pointer to all ways one could drive from here */
+};
+
+/* 0=N,90=E */
+static int
+road_angle(struct coord *c1, struct coord *c2, int dir)
+{
+ int ret=transform_get_angle_delta(c1, c2, dir);
+ dbg(1, "road_angle(0x%x,0x%x - 0x%x,0x%x)=%d\n", c1->x, c1->y, c2->x, c2->y, ret);
+ return ret;
+}
+
+static char
+*get_count_str(int n)
+{
+ switch (n) {
+ case 0:
+ return _("zeroth"); // Not shure if this exists, neither if it will ever be needed
+ case 1:
+ return _("first");
+ case 2:
+ return _("second");
+ case 3:
+ return _("third");
+ case 4:
+ return _("fourth");
+ case 5:
+ return _("fifth");
+ case 6:
+ return _("sixth");
+ default:
+ return NULL;
+ }
+}
+
+static char
+*get_exit_count_str(int n)
+{
+ switch (n) {
+ case 0:
+ return _("zeroth exit"); // Not shure if this exists, neither if it will ever be needed
+ case 1:
+ return _("first exit");
+ case 2:
+ return _("second exit");
+ case 3:
+ return _("third exit");
+ case 4:
+ return _("fourth exit");
+ case 5:
+ return _("fifth exit");
+ case 6:
+ return _("sixth exit");
+ default:
+ return NULL;
+ }
+}
+static int
+round_distance(int dist)
+{
+ if (dist < 100) {
+ dist=(dist+5)/10;
+ return dist*10;
+ }
+ if (dist < 250) {
+ dist=(dist+13)/25;
+ return dist*25;
+ }
+ if (dist < 500) {
+ dist=(dist+25)/50;
+ return dist*50;
+ }
+ if (dist < 1000) {
+ dist=(dist+50)/100;
+ return dist*100;
+ }
+ if (dist < 5000) {
+ dist=(dist+50)/100;
+ return dist*100;
+ }
+ if (dist < 100000) {
+ dist=(dist+500)/1000;
+ return dist*1000;
+ }
+ dist=(dist+5000)/10000;
+ return dist*10000;
+}
+
+static char *
+get_distance(int dist, enum attr_type type, int is_length)
+{
+ if (type == attr_navigation_long) {
+ if (is_length)
+ return g_strdup_printf(_("%d m"), dist);
+ else
+ return g_strdup_printf(_("in %d m"), dist);
+ }
+ if (dist < 1000) {
+ if (is_length)
+ return g_strdup_printf(_("%d meters"), dist);
+ else
+ return g_strdup_printf(_("in %d meters"), dist);
+ }
+ if (dist < 5000) {
+ int rem=(dist/100)%10;
+ if (rem) {
+ if (is_length)
+ return g_strdup_printf(_("%d.%d kilometer"), dist/1000, rem);
+ else
+ return g_strdup_printf(_("in %d.%d kilometers"), dist/1000, rem);
+ }
+ }
+ if (is_length)
+ return g_strdup_printf(ngettext("one kilometer","%d kilometers", dist/1000), dist/1000);
+ else
+ return g_strdup_printf(ngettext("in one kilometer","in %d kilometers", dist/1000), dist/1000);
+}
+
+
+/**
+ * @brief This calculates the angle with which an item starts or ends
+ *
+ * This function can be used to get the angle an item (from a route graph map)
+ * starts or ends with. Note that the angle will point towards the inner of
+ * the item.
+ *
+ * This is meant to be used with items from a route graph map
+ * With other items this will probably not be optimal...
+ *
+ * @param w The way which should be calculated
+ */
+static void
+calculate_angle(struct navigation_way *w)
+{
+ struct coord cbuf[2];
+ struct item *ritem; // the "real" item
+ struct coord c;
+ struct map_rect *mr;
+ struct attr attr;
+
+ w->angle2=361;
+ mr = map_rect_new(w->item.map, NULL);
+ if (!mr)
+ return;
+
+ ritem = map_rect_get_item_byid(mr, w->item.id_hi, w->item.id_lo);
+ if (!ritem) {
+ dbg(1,"Item from segment not found on map!\n");
+ map_rect_destroy(mr);
+ return;
+ }
+
+ if (ritem->type < type_line || ritem->type >= type_area) {
+ map_rect_destroy(mr);
+ return;
+ }
+ if (item_attr_get(ritem, attr_flags, &attr))
+ w->flags=attr.u.num;
+ else
+ w->flags=0;
+ if (item_attr_get(ritem, attr_street_name, &attr))
+ w->name1=map_convert_string(ritem->map,attr.u.str);
+ else
+ w->name1=NULL;
+ if (item_attr_get(ritem, attr_street_name_systematic, &attr))
+ w->name2=map_convert_string(ritem->map,attr.u.str);
+ else
+ w->name2=NULL;
+
+ if (w->dir < 0) {
+ if (item_coord_get(ritem, cbuf, 2) != 2) {
+ dbg(1,"Using calculate_angle() with a less-than-two-coords-item?\n");
+ map_rect_destroy(mr);
+ return;
+ }
+
+ while (item_coord_get(ritem, &c, 1)) {
+ cbuf[0] = cbuf[1];
+ cbuf[1] = c;
+ }
+
+ } else {
+ if (item_coord_get(ritem, cbuf, 2) != 2) {
+ dbg(1,"Using calculate_angle() with a less-than-two-coords-item?\n");
+ map_rect_destroy(mr);
+ return;
+ }
+ c = cbuf[0];
+ cbuf[0] = cbuf[1];
+ cbuf[1] = c;
+ }
+
+ map_rect_destroy(mr);
+
+ w->angle2=road_angle(&cbuf[1],&cbuf[0],0);
+}
+
+/**
+ * @brief Returns the time (in seconds) one will drive between two navigation items
+ *
+ * This function returns the time needed to drive between two items, including both of them,
+ * in seconds.
+ *
+ * @param from The first item
+ * @param to The last item
+ * @return The travel time in seconds, or -1 on error
+ */
+static int
+navigation_time(struct navigation_itm *from, struct navigation_itm *to)
+{
+ struct navigation_itm *cur;
+ int time;
+
+ time = 0;
+ cur = from;
+ while (cur) {
+ time += cur->time;
+
+ if (cur == to) {
+ break;
+ }
+ cur = cur->next;
+ }
+
+ if (!cur) {
+ return -1;
+ }
+
+ return time;
+}
+
+/**
+ * @brief Clears the ways one can drive from itm
+ *
+ * @param itm The item that should have its ways cleared
+ */
+static void
+navigation_itm_ways_clear(struct navigation_itm *itm)
+{
+ struct navigation_way *c,*n;
+
+ c = itm->ways;
+ while (c) {
+ n = c->next;
+ map_convert_free(c->name1);
+ map_convert_free(c->name2);
+ g_free(c);
+ c = n;
+ }
+
+ itm->ways = NULL;
+}
+
+/**
+ * @brief Updates the ways one can drive from itm
+ *
+ * This updates the list of possible ways to drive to from itm. The item "itm" is on
+ * and the next navigation item are excluded.
+ *
+ * @param itm The item that should be updated
+ * @param graph_map The route graph's map that these items are on
+ */
+static void
+navigation_itm_ways_update(struct navigation_itm *itm, struct map *graph_map)
+{
+ struct map_selection coord_sel;
+ struct map_rect *g_rect; // Contains a map rectangle from the route graph's map
+ struct item *i,*sitem;
+ struct attr sitem_attr,direction_attr;
+ struct navigation_way *w,*l;
+
+ navigation_itm_ways_clear(itm);
+
+ // These values cause the code in route.c to get us only the route graph point and connected segments
+ coord_sel.next = NULL;
+ coord_sel.u.c_rect.lu = itm->start;
+ coord_sel.u.c_rect.rl = itm->start;
+ // the selection's order is ignored
+
+ g_rect = map_rect_new(graph_map, &coord_sel);
+
+ i = map_rect_get_item(g_rect);
+ if (!i || i->type != type_rg_point) { // probably offroad?
+ return ;
+ }
+
+ w = NULL;
+
+ while (1) {
+ i = map_rect_get_item(g_rect);
+
+ if (!i) {
+ break;
+ }
+
+ if (i->type != type_rg_segment) {
+ continue;
+ }
+
+ if (!item_attr_get(i,attr_street_item,&sitem_attr)) {
+ dbg(1, "Got no street item for route graph item in entering_straight()\n");
+ continue;
+ }
+
+ if (!item_attr_get(i,attr_direction,&direction_attr)) {
+ continue;
+ }
+
+ sitem = sitem_attr.u.item;
+ if (item_is_equal(itm->item,*sitem) || ((itm->prev) && item_is_equal(itm->prev->item,*sitem))) {
+ continue;
+ }
+
+ l = w;
+ w = g_new(struct navigation_way, 1);
+ w->dir = direction_attr.u.num;
+ w->item = *sitem;
+ w->next = l;
+ calculate_angle(w);
+ }
+
+ map_rect_destroy(g_rect);
+
+ itm->ways = w;
+}
+
+static void
+navigation_destroy_itms_cmds(struct navigation *this_, struct navigation_itm *end)
+{
+ struct navigation_itm *itm;
+ struct navigation_command *cmd;
+ dbg(2,"enter this_=%p this_->first=%p this_->cmd_first=%p end=%p\n", this_, this_->first, this_->cmd_first, end);
+ if (this_->cmd_first)
+ dbg(2,"this_->cmd_first->itm=%p\n", this_->cmd_first->itm);
+ while (this_->first && this_->first != end) {
+ itm=this_->first;
+ dbg(3,"destroying %p\n", itm);
+ item_hash_remove(this_->hash, &itm->item);
+ this_->first=itm->next;
+ if (this_->first)
+ this_->first->prev=NULL;
+ if (this_->cmd_first && this_->cmd_first->itm == itm->next) {
+ cmd=this_->cmd_first;
+ this_->cmd_first=cmd->next;
+ if (cmd->next) {
+ cmd->next->prev = NULL;
+ }
+ g_free(cmd);
+ }
+ map_convert_free(itm->name1);
+ map_convert_free(itm->name2);
+ navigation_itm_ways_clear(itm);
+ g_free(itm);
+ }
+ if (! this_->first)
+ this_->last=NULL;
+ if (! this_->first && end)
+ dbg(0,"end wrong\n");
+ dbg(2,"ret this_->first=%p this_->cmd_first=%p\n",this_->first, this_->cmd_first);
+}
+
+static void
+navigation_itm_update(struct navigation_itm *itm, struct item *ritem)
+{
+ struct attr length, time;
+
+ if (! item_attr_get(ritem, attr_length, &length)) {
+ dbg(0,"no length\n");
+ return;
+ }
+ if (! item_attr_get(ritem, attr_time, &time)) {
+ dbg(0,"no time\n");
+ return;
+ }
+
+ dbg(1,"length=%d time=%d\n", length.u.num, time.u.num);
+ itm->length=length.u.num;
+ itm->time=time.u.num;
+}
+
+/**
+ * @brief This check if an item is part of a roundabout
+ *
+ * @param itm The item to be checked
+ * @return True if the item is part of a roundabout
+ */
+static int
+check_roundabout(struct navigation_itm *itm, struct map *graph_map)
+{
+ struct map_selection coord_sel;
+ struct map_rect *g_rect; // Contains a map rectangle from the route graph's map
+ struct item *i,*sitem;
+ struct attr sitem_attr,flags_attr;
+
+ // These values cause the code in route.c to get us only the route graph point and connected segments
+ coord_sel.next = NULL;
+ coord_sel.u.c_rect.lu = itm->start;
+ coord_sel.u.c_rect.rl = itm->start;
+ // the selection's order is ignored
+
+ g_rect = map_rect_new(graph_map, &coord_sel);
+
+ i = map_rect_get_item(g_rect);
+ if (!i || i->type != type_rg_point) { // probably offroad?
+ return 0;
+ }
+
+ while (1) {
+ i = map_rect_get_item(g_rect);
+
+ if (!i) {
+ break;
+ }
+
+ if (i->type != type_rg_segment) {
+ continue;
+ }
+
+ if (!item_attr_get(i,attr_street_item,&sitem_attr)) {
+ continue;
+ }
+
+ sitem = sitem_attr.u.item;
+ if (item_is_equal(itm->item,*sitem)) {
+ if (item_attr_get(i,attr_flags,&flags_attr) && (flags_attr.u.num & AF_ROUNDABOUT)) {
+ map_rect_destroy(g_rect);
+ return 1;
+ }
+ }
+ }
+
+ map_rect_destroy(g_rect);
+ return 0;
+}
+
+static struct navigation_itm *
+navigation_itm_new(struct navigation *this_, struct item *ritem)
+{
+ struct navigation_itm *ret=g_new0(struct navigation_itm, 1);
+ int i=0;
+ struct item *sitem;
+ struct map *graph_map = NULL;
+ struct attr street_item,direction,route_attr;
+ struct map_rect *mr;
+ struct attr attr;
+ struct coord c[5];
+
+ if (ritem) {
+ ret->streetname_told=0;
+ if (! item_attr_get(ritem, attr_street_item, &street_item)) {
+ dbg(1, "no street item\n");
+ return NULL;
+ }
+ if (item_attr_get(ritem, attr_direction, &direction))
+ ret->direction=direction.u.num;
+ else
+ ret->direction=0;
+
+ sitem=street_item.u.item;
+ ret->item=*sitem;
+ item_hash_insert(this_->hash, sitem, ret);
+ mr=map_rect_new(sitem->map, NULL);
+ sitem=map_rect_get_item_byid(mr, sitem->id_hi, sitem->id_lo);
+ if (item_attr_get(sitem, attr_street_name, &attr))
+ ret->name1=map_convert_string(sitem->map,attr.u.str);
+ if (item_attr_get(sitem, attr_street_name_systematic, &attr))
+ ret->name2=map_convert_string(sitem->map,attr.u.str);
+ navigation_itm_update(ret, ritem);
+
+ while (item_coord_get(ritem, &c[i], 1)) {
+ dbg(1, "coord %d 0x%x 0x%x\n", i, c[i].x ,c[i].y);
+
+ if (i < 4)
+ i++;
+ else {
+ c[2]=c[3];
+ c[3]=c[4];
+ }
+ }
+ dbg(1,"count=%d\n", i);
+ i--;
+
+ ret->angle_start=road_angle(&c[0], &c[1], 0);
+ ret->angle_end=road_angle(&c[i-1], &c[i], 0);
+
+ ret->start=c[0];
+ ret->end=c[i];
+
+ item_attr_get(ritem, attr_route, &route_attr);
+ graph_map = route_get_graph_map(route_attr.u.route);
+ if (check_roundabout(ret, graph_map)) {
+ ret->flags |= AF_ROUNDABOUT;
+ }
+
+ dbg(1,"i=%d start %d end %d '%s' '%s'\n", i, ret->angle_start, ret->angle_end, ret->name1, ret->name2);
+ map_rect_destroy(mr);
+ } else {
+ if (this_->last)
+ ret->start=ret->end=this_->last->end;
+ }
+ if (! this_->first)
+ this_->first=ret;
+ if (this_->last) {
+ this_->last->next=ret;
+ ret->prev=this_->last;
+ if (graph_map) {
+ navigation_itm_ways_update(ret,graph_map);
+ }
+ }
+ dbg(1,"ret=%p\n", ret);
+ this_->last=ret;
+ return ret;
+}
+
+/**
+ * @brief Counts how many times a driver could turn right/left
+ *
+ * This function counts how many times the driver theoretically could
+ * turn right/left between two navigation items, not counting the final
+ * turn itself.
+ *
+ * @param from The navigation item which should form the start
+ * @param to The navigation item which should form the end
+ * @param direction Set to < 0 to count turns to the left >= 0 for turns to the right
+ * @return The number of possibilities to turn or -1 on error
+ */
+static int
+count_possible_turns(struct navigation_itm *from, struct navigation_itm *to, int direction)
+{
+ int count;
+ struct navigation_itm *curr;
+ struct navigation_way *w;
+
+ count = 0;
+ curr = from->next;
+ while (curr && (curr != to)) {
+ w = curr->ways;
+
+ while (w) {
+ if (direction < 0) {
+ if (angle_delta(curr->prev->angle_end, w->angle2) < 0) {
+ count++;
+ break;
+ }
+ } else {
+ if (angle_delta(curr->prev->angle_end, w->angle2) > 0) {
+ count++;
+ break;
+ }
+ }
+ w = w->next;
+ }
+ curr = curr->next;
+ }
+
+ if (!curr) { // from does not lead to to?
+ return -1;
+ }
+
+ return count;
+}
+
+/**
+ * @brief Calculates distance and time to the destination
+ *
+ * This function calculates the distance and the time to the destination of a
+ * navigation. If incr is set, this is only calculated for the first navigation
+ * item, which is a lot faster than re-calculation the whole destination, but works
+ * only if the rest of the navigation already has been calculated.
+ *
+ * @param this_ The navigation whose destination / time should be calculated
+ * @param incr Set this to true to only calculate the first item. See description.
+ */
+static void
+calculate_dest_distance(struct navigation *this_, int incr)
+{
+ int len=0, time=0, count=0;
+ struct navigation_itm *next,*itm=this_->last;
+ dbg(1, "enter this_=%p, incr=%d\n", this_, incr);
+ if (incr) {
+ if (itm)
+ dbg(2, "old values: (%p) time=%d lenght=%d\n", itm, itm->dest_length, itm->dest_time);
+ else
+ dbg(2, "old values: itm is null\n");
+ itm=this_->first;
+ next=itm->next;
+ dbg(2, "itm values: time=%d lenght=%d\n", itm->length, itm->time);
+ dbg(2, "next values: (%p) time=%d lenght=%d\n", next, next->dest_length, next->dest_time);
+ itm->dest_length=next->dest_length+itm->length;
+ itm->dest_count=next->dest_count+1;
+ itm->dest_time=next->dest_time+itm->time;
+ dbg(2, "new values: time=%d lenght=%d\n", itm->dest_length, itm->dest_time);
+ return;
+ }
+ while (itm) {
+ len+=itm->length;
+ time+=itm->time;
+ itm->dest_length=len;
+ itm->dest_time=time;
+ itm->dest_count=count++;
+ itm=itm->prev;
+ }
+ dbg(1,"len %d time %d\n", len, time);
+}
+
+/**
+ * @brief Checks if two navigation items are on the same street
+ *
+ * This function checks if two navigation items are on the same street. It returns
+ * true if either their name or their "systematic name" (e.g. "A6" or "B256") are the
+ * same.
+ *
+ * @param old The first item to be checked
+ * @param new The second item to be checked
+ * @return True if both old and new are on the same street
+ */
+static int
+is_same_street2(char *old_name1, char *old_name2, char *new_name1, char *new_name2)
+{
+ if (old_name1 && new_name1 && !strcmp(old_name1, new_name1)) {
+ dbg(1,"is_same_street: '%s' '%s' vs '%s' '%s' yes (1.)\n", old_name2, new_name2, old_name1, new_name1);
+ return 1;
+ }
+ if (old_name2 && new_name2 && !strcmp(old_name2, new_name2)) {
+ dbg(1,"is_same_street: '%s' '%s' vs '%s' '%s' yes (2.)\n", old_name2, new_name2, old_name1, new_name1);
+ return 1;
+ }
+ dbg(1,"is_same_street: '%s' '%s' vs '%s' '%s' no\n", old_name2, new_name2, old_name1, new_name1);
+ return 0;
+}
+
+#if 0
+/**
+ * @brief Checks if two navigation items are on the same street
+ *
+ * This function checks if two navigation items are on the same street. It returns
+ * true if the first part of their "systematic name" is equal. If the "systematic name" is
+ * for example "A352/E3" (a german highway which at the same time is part of the international
+ * E-road network), it would only search for "A352" in the second item's systematic name.
+ *
+ * @param old The first item to be checked
+ * @param new The second item to be checked
+ * @return True if the "systematic name" of both items matches. See description.
+ */
+static int
+is_same_street_systematic(struct navigation_itm *old, struct navigation_itm *new)
+{
+ int slashold,slashnew;
+ if (!old->name2 || !new->name2)
+ return 1;
+ slashold=strcspn(old->name2, "/");
+ slashnew=strcspn(new->name2, "/");
+ if (slashold != slashnew || strncmp(old->name2, new->name2, slashold))
+ return 0;
+ return 1;
+}
+
+
+/**
+ * @brief Check if there are multiple possibilities to drive from old
+ *
+ * This function checks, if there are multiple streets connected to the exit of "old".
+ * Sometimes it happens that an item on a map is just segmented, without any other streets
+ * being connected there, and it is not useful if navit creates a maneuver there.
+ *
+ * @param new The navigation item we're driving to
+ * @return True if there are multiple streets
+ */
+static int
+maneuver_multiple_streets(struct navigation_itm *new)
+{
+ if (new->ways) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+
+/**
+ * @brief Check if the new item is entered "straight"
+ *
+ * This function checks if the new item is entered "straight" from the old item, i.e. if there
+ * is no other street one could take from the old item on with less steering.
+ *
+ * @param new The navigation item we're driving to
+ * @param diff The absolute angle one needs to steer to drive to this item
+ * @return True if the new item is entered "straight"
+ */
+static int
+maneuver_straight(struct navigation_itm *new, int diff)
+{
+ int curr_diff;
+ struct navigation_way *w;
+
+ w = new->ways;
+ dbg(1,"diff=%d\n", diff);
+ while (w) {
+ curr_diff=abs(angle_delta(new->prev->angle_end, w->angle2));
+ dbg(1,"curr_diff=%d\n", curr_diff);
+ if (curr_diff < diff) {
+ return 0;
+ }
+ w = w->next;
+ }
+ return 1;
+}
+#endif
+
+static int maneuver_category(enum item_type type)
+{
+ switch (type) {
+ case type_street_0:
+ return 1;
+ case type_street_1_city:
+ return 2;
+ case type_street_2_city:
+ return 3;
+ case type_street_3_city:
+ return 4;
+ case type_street_4_city:
+ return 5;
+ case type_highway_city:
+ return 7;
+ case type_street_1_land:
+ return 2;
+ case type_street_2_land:
+ return 3;
+ case type_street_3_land:
+ return 4;
+ case type_street_4_land:
+ return 5;
+ case type_street_n_lanes:
+ return 6;
+ case type_highway_land:
+ return 7;
+ case type_ramp:
+ return 0;
+ case type_roundabout:
+ return 0;
+ case type_ferry:
+ return 0;
+ default:
+ return 0;
+ }
+
+
+}
+
+static int
+is_way_allowed(struct navigation_way *way)
+{
+ if (way->dir > 0) {
+ if (way->flags & AF_ONEWAYREV)
+ return 0;
+ } else {
+ if (way->flags & AF_ONEWAY)
+ return 0;
+ }
+ return 1;
+}
+
+/**
+ * @brief Checks if navit has to create a maneuver to drive from old to new
+ *
+ * This function checks if it has to create a "maneuver" - i.e. guide the user - to drive
+ * from "old" to "new".
+ *
+ * @param old The old navigation item, where we're coming from
+ * @param new The new navigation item, where we're going to
+ * @param delta The angle the user has to steer to navigate from old to new
+ * @param reason A text string explaining how the return value resulted
+ * @return True if navit should guide the user, false otherwise
+ */
+static int
+maneuver_required2(struct navigation_itm *old, struct navigation_itm *new, int *delta, char **reason)
+{
+ int ret=0,d,dw,dlim;
+ char *r=NULL;
+ struct navigation_way *w;
+ int cat,ncat,wcat,maxcat,left=-180,right=180,is_unambigous=0,is_same_street;
+
+ dbg(1,"enter %p %p %p\n",old, new, delta);
+ d=angle_delta(old->angle_end, new->angle_start);
+ if (!new->ways) {
+ /* No announcement necessary */
+ r="no: Only one possibility";
+ } else if (!new->ways->next && new->ways->item.type == type_ramp && !is_way_allowed(new->ways)) {
+ /* If the other way is only a ramp and it is one-way in the wrong direction, no announcement necessary */
+ r="no: Only ramp";
+ }
+ if (! r) {
+ if ((old->flags & AF_ROUNDABOUT) && ! (new->flags & AF_ROUNDABOUT)) {
+ r="yes: leaving roundabout";
+ ret=1;
+ } else if (!(old->flags & AF_ROUNDABOUT) && (new->flags & AF_ROUNDABOUT))
+ r="no: entering roundabout";
+ else if ((old->flags & AF_ROUNDABOUT) && (new->flags & AF_ROUNDABOUT))
+ r="no: staying in roundabout";
+ }
+ if (!r && abs(d) > 75) {
+ /* always make an announcement if you have to make a sharp turn */
+ r="yes: delta over 75";
+ ret=1;
+ }
+ cat=maneuver_category(old->item.type);
+ ncat=maneuver_category(new->item.type);
+ if (!r) {
+ /* Check whether the street keeps its name */
+ is_same_street=is_same_street2(old->name1, old->name2, new->name1, new->name2);
+ w = new->ways;
+ maxcat=-1;
+ while (w) {
+ dw=angle_delta(old->angle_end, w->angle2);
+ if (dw < 0) {
+ if (dw > left)
+ left=dw;
+ } else {
+ if (dw < right)
+ right=dw;
+ }
+ wcat=maneuver_category(w->item.type);
+ /* If any other street has the same name but isn't a highway (a highway might split up temporarily), then
+ we can't use the same name criterium */
+ if (is_same_street && is_same_street2(old->name1, old->name2, w->name1, w->name2) && (cat != 7 || wcat != 7) && is_way_allowed(w))
+ is_same_street=0;
+ /* Mark if the street has a higher or the same category */
+ if (wcat > maxcat)
+ maxcat=wcat;
+ w = w->next;
+ }
+ /* get the delta limit for checking for other streets. It is lower if the street has no other
+ streets of the same or higher category */
+ if (ncat < cat)
+ dlim=80;
+ else
+ dlim=120;
+ /* if the street is really straight, the others might be closer to straight */
+ if (abs(d) < 20)
+ dlim/=2;
+ if ((maxcat == ncat && maxcat == cat) || (ncat == 0 && cat == 0))
+ dlim=abs(d)*620/256;
+ else if (maxcat < ncat && maxcat < cat)
+ dlim=abs(d)*128/256;
+ if (left < -dlim && right > dlim)
+ is_unambigous=1;
+ if (!is_same_street && is_unambigous < 1) {
+ ret=1;
+ r="yes: not same street or ambigous";
+ } else
+ r="no: same street and unambigous";
+#ifdef DEBUG
+ r=g_strdup_printf("yes: d %d left %d right %d dlim=%d cat old:%d new:%d max:%d unambigous=%d same_street=%d", d, left, right, dlim, cat, ncat, maxcat, is_unambigous, is_same_street);
+#endif
+ }
+ *delta=d;
+ if (reason)
+ *reason=r;
+ return ret;
+
+
+#if 0
+ if (new->item.type == old->item.type || (new->item.type != type_ramp && old->item.type != type_ramp)) {
+ if (is_same_street2(old, new)) {
+ if (! entering_straight(new, abs(*delta))) {
+ dbg(1, "maneuver_required: Not driving straight: yes\n");
+ if (reason)
+ *reason="yes: Not driving straight";
+ return 1;
+ }
+
+ if (check_multiple_streets(new)) {
+ if (entering_straight(new,abs(*delta)*2)) {
+ if (reason)
+ *reason="no: delta < ext_limit for same name";
+ return 0;
+ }
+ if (reason)
+ *reason="yes: delta > ext_limit for same name";
+ return 1;
+ } else {
+ dbg(1, "maneuver_required: Staying on the same street: no\n");
+ if (reason)
+ *reason="no: Staying on same street";
+ return 0;
+ }
+ }
+ } else
+ dbg(1, "maneuver_required: old or new is ramp\n");
+#if 0
+ if (old->item.type == type_ramp && (new->item.type == type_highway_city || new->item.type == type_highway_land)) {
+ dbg(1, "no_maneuver_required: old is ramp new is highway\n");
+ if (reason)
+ *reason="no: old is ramp new is highway";
+ return 0;
+ }
+#endif
+#if 0
+ if (old->crossings_end == 2) {
+ dbg(1, "maneuver_required: only 2 connections: no\n");
+ return 0;
+ }
+#endif
+ dbg(1,"delta=%d-%d=%d\n", new->angle_start, old->angle_end, *delta);
+ if ((new->item.type == type_highway_land || new->item.type == type_highway_city || old->item.type == type_highway_land || old->item.type == type_highway_city) && (!is_same_street_systematic(old, new) || (old->name2 != NULL && new->name2 == NULL))) {
+ dbg(1, "maneuver_required: highway changed name\n");
+ if (reason)
+ *reason="yes: highway changed name";
+ return 1;
+ }
+ if (abs(*delta) < straight_limit) {
+ if (! entering_straight(new,abs(*delta))) {
+ if (reason)
+ *reason="yes: not straight";
+ dbg(1, "maneuver_required: not driving straight: yes\n");
+ return 1;
+ }
+
+ dbg(1, "maneuver_required: delta(%d) < %d: no\n", *delta, straight_limit);
+ if (reason)
+ *reason="no: delta < limit";
+ return 0;
+ }
+ if (abs(*delta) < ext_straight_limit) {
+ if (entering_straight(new,abs(*delta)*2)) {
+ if (reason)
+ *reason="no: delta < ext_limit";
+ return 0;
+ }
+ }
+
+ if (! check_multiple_streets(new)) {
+ dbg(1, "maneuver_required: only one possibility: no\n");
+ if (reason)
+ *reason="no: only one possibility";
+ return 0;
+ }
+
+ dbg(1, "maneuver_required: delta=%d: yes\n", *delta);
+ if (reason)
+ *reason="yes: delta >= limit";
+ return 1;
+#endif
+}
+
+static struct navigation_command *
+command_new(struct navigation *this_, struct navigation_itm *itm, int delta)
+{
+ struct navigation_command *ret=g_new0(struct navigation_command, 1);
+ dbg(1,"enter this_=%p itm=%p delta=%d\n", this_, itm, delta);
+ ret->delta=delta;
+ ret->itm=itm;
+ if (itm && itm->prev && itm->ways && itm->prev->ways && !(itm->flags & AF_ROUNDABOUT) && (itm->prev->flags & AF_ROUNDABOUT)) {
+ int len=0;
+ int angle=0;
+ int entry_angle;
+ struct navigation_itm *itm2=itm->prev;
+ int exit_angle=angle_median(itm->prev->angle_end, itm->ways->angle2);
+ dbg(1,"exit %d median from %d,%d\n", exit_angle,itm->prev->angle_end, itm->ways->angle2);
+ while (itm2 && (itm2->flags & AF_ROUNDABOUT)) {
+ len+=itm2->length;
+ angle=itm2->angle_end;
+ itm2=itm2->prev;
+ }
+ if (itm2 && itm2->next && itm2->next->ways) {
+ itm2=itm2->next;
+ entry_angle=angle_median(angle_opposite(itm2->angle_start), itm2->ways->angle2);
+ dbg(1,"entry %d median from %d(%d),%d\n", entry_angle,angle_opposite(itm2->angle_start), itm2->angle_start, itm2->ways->angle2);
+ } else {
+ entry_angle=angle_opposite(angle);
+ }
+ dbg(0,"entry %d exit %d\n", entry_angle, exit_angle);
+ ret->roundabout_delta=angle_delta(entry_angle, exit_angle);
+ ret->length=len;
+
+ }
+ if (this_->cmd_last) {
+ this_->cmd_last->next=ret;
+ ret->prev = this_->cmd_last;
+ }
+ this_->cmd_last=ret;
+
+ if (!this_->cmd_first)
+ this_->cmd_first=ret;
+ return ret;
+}
+
+static void
+make_maneuvers(struct navigation *this_, struct route *route)
+{
+ struct navigation_itm *itm, *last=NULL, *last_itm=NULL;
+ int delta;
+ itm=this_->first;
+ this_->cmd_last=NULL;
+ this_->cmd_first=NULL;
+ while (itm) {
+ if (last) {
+ if (maneuver_required2(last_itm, itm,&delta,NULL)) {
+ command_new(this_, itm, delta);
+ }
+ } else
+ last=itm;
+ last_itm=itm;
+ itm=itm->next;
+ }
+ command_new(this_, last_itm, 0);
+}
+
+static int
+contains_suffix(char *name, char *suffix)
+{
+ if (!suffix)
+ return 0;
+ if (strlen(name) < strlen(suffix))
+ return 0;
+ return !strcasecmp(name+strlen(name)-strlen(suffix), suffix);
+}
+
+static char *
+replace_suffix(char *name, char *search, char *replace)
+{
+ int len=strlen(name)-strlen(search);
+ char *ret=g_malloc(len+strlen(replace)+1);
+ strncpy(ret, name, len);
+ strcpy(ret+len, replace);
+ if (isupper(name[len])) {
+ ret[len]=toupper(ret[len]);
+ }
+
+ return ret;
+}
+
+static char *
+navigation_item_destination(struct navigation_itm *itm, struct navigation_itm *next, char *prefix)
+{
+ char *ret=NULL,*name1,*sep,*name2;
+ int i,sex;
+ if (! prefix)
+ prefix="";
+ if(!itm->name1 && !itm->name2 && itm->item.type == type_ramp) {
+ dbg(1,">> Next is ramp %lx current is %lx \n", itm->item.type, next->item.type);
+
+ if(next->item.type == type_ramp)
+ return NULL;
+ if(itm->item.type == type_highway_city || itm->item.type == type_highway_land )
+ return g_strdup_printf("%s%s",prefix,_("exit")); /* %FIXME Can this even be reached? */
+ else
+ return g_strdup_printf("%s%s",prefix,_("into the ramp"));
+
+ }
+ if (!itm->name1 && !itm->name2)
+ return NULL;
+ if (itm->name1) {
+ sex=-1;
+ name1=NULL;
+ for (i = 0 ; i < sizeof(suffixes)/sizeof(suffixes[0]) ; i++) {
+ if (contains_suffix(itm->name1,suffixes[i].fullname)) {
+ sex=suffixes[i].sex;
+ name1=g_strdup(itm->name1);
+ break;
+ }
+ if (contains_suffix(itm->name1,suffixes[i].abbrev)) {
+ sex=suffixes[i].sex;
+ name1=replace_suffix(itm->name1, suffixes[i].abbrev, suffixes[i].fullname);
+ break;
+ }
+ }
+ if (itm->name2) {
+ name2=itm->name2;
+ sep=" ";
+ } else {
+ name2="";
+ sep="";
+ }
+ switch (sex) {
+ case -1:
+ /* TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name */
+ ret=g_strdup_printf(_("%sinto the street %s%s%s"),prefix,itm->name1, sep, name2);
+ break;
+ case 1:
+ /* TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Male form. The stuff after | doesn't have to be included */
+ ret=g_strdup_printf(_("%sinto the %s%s%s|male form"),prefix,name1, sep, name2);
+ break;
+ case 2:
+ /* TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Female form. The stuff after | doesn't have to be included */
+ ret=g_strdup_printf(_("%sinto the %s%s%s|female form"),prefix,name1, sep, name2);
+ break;
+ case 3:
+ /* TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Neutral form. The stuff after | doesn't have to be included */
+ ret=g_strdup_printf(_("%sinto the %s%s%s|neutral form"),prefix,name1, sep, name2);
+ break;
+ }
+ g_free(name1);
+
+ } else
+ /* TRANSLATORS: gives the name of the next road to turn into (into the E17) */
+ ret=g_strdup_printf(_("%sinto the %s"),prefix,itm->name2);
+ name1=ret;
+ while (name1 && *name1) {
+ switch (*name1) {
+ case '|':
+ *name1='\0';
+ break;
+ case '/':
+ *name1++=' ';
+ break;
+ default:
+ name1++;
+ }
+ }
+ return ret;
+}
+
+static char *
+show_maneuver(struct navigation *nav, struct navigation_itm *itm, struct navigation_command *cmd, enum attr_type type, int connect)
+{
+ /* TRANSLATORS: right, as in 'Turn right' */
+ char *dir=_("right"),*strength="";
+ int distance=itm->dest_length-cmd->itm->dest_length;
+ char *d,*ret=NULL;
+ int delta=cmd->delta;
+ int level;
+ int strength_needed;
+ int skip_roads;
+ int count_roundabout;
+ struct navigation_itm *cur;
+ struct navigation_way *w;
+
+ if (connect) {
+ level = -2; // level = -2 means "connect to another maneuver via 'then ...'"
+ } else {
+ level=1;
+ }
+
+ w = itm->next->ways;
+ strength_needed = 0;
+ if (angle_delta(itm->next->angle_start,itm->angle_end) < 0) {
+ while (w) {
+ if (angle_delta(w->angle2,itm->angle_end) < 0) {
+ strength_needed = 1;
+ break;
+ }
+ w = w->next;
+ }
+ } else {
+ while (w) {
+ if (angle_delta(w->angle2,itm->angle_end) > 0) {
+ strength_needed = 1;
+ break;
+ }
+ w = w->next;
+ }
+ }
+
+ if (delta < 0) {
+ /* TRANSLATORS: left, as in 'Turn left' */
+ dir=_("left");
+ delta=-delta;
+ }
+
+ if (strength_needed) {
+ if (delta < 45) {
+ /* TRANSLATORS: Don't forget the ending space */
+ strength=_("easily ");
+ } else if (delta < 105) {
+ strength="";
+ } else if (delta < 165) {
+ /* TRANSLATORS: Don't forget the ending space */
+ strength=_("strongly ");
+ } else if (delta < 180) {
+ /* TRANSLATORS: Don't forget the ending space */
+ strength=_("really strongly ");
+ } else {
+ dbg(1,"delta=%d\n", delta);
+ /* TRANSLATORS: Don't forget the ending space */
+ strength=_("unknown ");
+ }
+ }
+ if (type != attr_navigation_long_exact)
+ distance=round_distance(distance);
+ if (type == attr_navigation_speech) {
+ if (nav->turn_around && nav->turn_around == nav->turn_around_limit)
+ return g_strdup(_("When possible, please turn around"));
+ if (!connect) {
+ level=navigation_get_announce_level(nav, itm->item.type, distance-cmd->length);
+ }
+ dbg(1,"distance=%d level=%d type=0x%x\n", distance, level, itm->item.type);
+ }
+
+ if (cmd->itm->prev->flags & AF_ROUNDABOUT) {
+ switch (level) {
+ case 2:
+ return g_strdup(_("Enter the roundabout soon"));
+ case 1:
+ d = get_distance(distance, type, 1);
+ /* TRANSLATORS: %s is the distance to the roundabout */
+ ret = g_strdup_printf(_("In %s, enter the roundabout"), d);
+ g_free(d);
+ return ret;
+ case -2:
+ case 0:
+ cur = cmd->itm->prev;
+ count_roundabout = 0;
+ while (cur && (cur->flags & AF_ROUNDABOUT)) {
+ if (cur->next->ways && is_way_allowed(cur->next->ways)) { // If the next segment has no exit or the exit isn't allowed, don't count it
+ count_roundabout++;
+ }
+ cur = cur->prev;
+ }
+ switch (level) {
+ case 0:
+ ret = g_strdup_printf(_("Leave the roundabout at the %s"), get_exit_count_str(count_roundabout));
+ break;
+ case -2:
+ ret = g_strdup_printf(_("then leave the roundabout at the %s"), get_exit_count_str(count_roundabout));
+ break;
+ }
+ return ret;
+ }
+ }
+
+ switch(level) {
+ case 3:
+ d=get_distance(distance, type, 1);
+ ret=g_strdup_printf(_("Follow the road for the next %s"), d);
+ g_free(d);
+ return ret;
+ case 2:
+ d=g_strdup(_("soon"));
+ break;
+ case 1:
+ d=get_distance(distance, type, 0);
+ break;
+ case 0:
+ skip_roads = count_possible_turns(nav->first,cmd->itm,cmd->delta);
+ if (skip_roads > 0) {
+ if (get_count_str(skip_roads+1)) {
+ /* TRANSLATORS: First argument is the how manieth street to take, second the direction */
+ ret = g_strdup_printf(_("Take the %1$s road to the %2$s"), get_count_str(skip_roads+1), dir);
+ return ret;
+ } else {
+ d = g_strdup_printf(_("after %i roads"), skip_roads);
+ }
+ } else {
+ d=g_strdup(_("now"));
+ }
+ break;
+ case -2:
+ skip_roads = count_possible_turns(cmd->prev->itm,cmd->itm,cmd->delta);
+ if (skip_roads > 0) {
+ /* TRANSLATORS: First argument is the how manieth street to take, second the direction */
+ if (get_count_str(skip_roads+1)) {
+ ret = g_strdup_printf(_("then take the %1$s road to the %2$s"), get_count_str(skip_roads+1), dir);
+ return ret;
+ } else {
+ d = g_strdup_printf(_("after %i roads"), skip_roads);
+ }
+
+ } else {
+ d = g_strdup("");
+ }
+ break;
+ default:
+ d=g_strdup(_("error"));
+ }
+ if (cmd->itm->next) {
+ int tellstreetname = 0;
+ char *destination = NULL;
+
+ if(type == attr_navigation_speech) { // In voice mode
+ // In Voice Mode only tell the street name in level 1 or in level 0 if level 1
+ // was skipped
+
+ if (level == 1) { // we are close to the intersection
+ cmd->itm->streetname_told = 1; // remeber to be checked when we turn
+ tellstreetname = 1; // Ok so we tell the name of the street
+ }
+
+ if (level == 0) {
+ if(cmd->itm->streetname_told == 0) // we are right at the intersection
+ tellstreetname = 1;
+ else
+ cmd->itm->streetname_told = 0; // reset just in case we come to the same street again
+ }
+
+ }
+ else
+ tellstreetname = 1;
+
+ if(tellstreetname)
+ destination=navigation_item_destination(cmd->itm, itm, " ");
+ if (level != -2) {
+ /* TRANSLATORS: The first argument is strength, the second direction, the third distance and the fourth destination Example: 'Turn 'slightly' 'left' in '100 m' 'onto baker street' */
+ ret=g_strdup_printf(_("Turn %1$s%2$s %3$s%4$s"), strength, dir, d, destination ? destination:"");
+ } else {
+ /* TRANSLATORS: First argument is strength, second direction, third how many roads to skip, fourth destination */
+ ret=g_strdup_printf(_("then turn %1$s%2$s %3$s%4$s"), strength, dir, d, destination ? destination:"");
+ }
+ g_free(destination);
+ } else {
+ if (!connect) {
+ ret=g_strdup_printf(_("You have reached your destination %s"), d);
+ } else {
+ ret=g_strdup_printf(_("then you have reached your destination."));
+ }
+ }
+ g_free(d);
+ return ret;
+}
+
+/**
+ * @brief Creates announcements for maneuvers, plus maneuvers immediately following the next maneuver
+ *
+ * This function does create an announcement for the current maneuver and for maneuvers
+ * immediately following that maneuver, if these are too close and we're in speech navigation.
+ *
+ * @return An announcement that should be made
+ */
+static char *
+show_next_maneuvers(struct navigation *nav, struct navigation_itm *itm, struct navigation_command *cmd, enum attr_type type)
+{
+ struct navigation_command *cur,*prev;
+ int distance=itm->dest_length-cmd->itm->dest_length;
+ int level, dist, i, time;
+ int speech_time,time2nav;
+ char *ret,*old,*buf,*next;
+
+ if (type != attr_navigation_speech) {
+ return show_maneuver(nav, itm, cmd, type, 0); // We accumulate maneuvers only in speech navigation
+ }
+
+ level=navigation_get_announce_level(nav, itm->item.type, distance-cmd->length);
+
+ if (level > 1) {
+ return show_maneuver(nav, itm, cmd, type, 0); // We accumulate maneuvers only if they are close
+ }
+
+ if (cmd->itm->told) {
+ return g_strdup("");
+ }
+
+ ret = show_maneuver(nav, itm, cmd, type, 0);
+ time2nav = navigation_time(itm,cmd->itm->prev);
+ old = NULL;
+
+ cur = cmd->next;
+ prev = cmd;
+ i = 0;
+ while (cur && cur->itm) {
+ // We don't merge more than 3 announcements...
+ if (i > 1) { // if you change this, please also change the value below, that is used to terminate the loop
+ break;
+ }
+
+ next = show_maneuver(nav,prev->itm, cur, type, 0);
+ speech_time = navit_speech_estimate(nav->navit,next);
+ g_free(next);
+
+ if (speech_time == -1) { // user didn't set cps
+ speech_time = 30; // assume 3 seconds
+ }
+
+ dist = prev->itm->dest_length - cur->itm->dest_length;
+ time = navigation_time(prev->itm,cur->itm->prev);
+
+ if (time >= (speech_time + 30)) { // 3 seconds for understanding what has been said
+ break;
+ }
+
+ old = ret;
+ buf = show_maneuver(nav, prev->itm, cur, type, 1);
+ ret = g_strdup_printf("%s, %s", old, buf);
+ g_free(buf);
+ if (navit_speech_estimate(nav->navit,ret) > time2nav) {
+ g_free(ret);
+ ret = old;
+ i = 2; // This will terminate the loop
+ } else {
+ g_free(old);
+ }
+
+ // If the two maneuvers are *really* close, we shouldn't tell the second one again, because TTS won't be fast enough
+ if (time <= speech_time) {
+ cur->itm->told = 1;
+ }
+
+ prev = cur;
+ cur = cur->next;
+ i++;
+ }
+
+ return ret;
+}
+
+static void
+navigation_call_callbacks(struct navigation *this_, int force_speech)
+{
+ int distance, level = 0, level2;
+ void *p=this_;
+ if (!this_->cmd_first)
+ return;
+ callback_list_call(this_->callback, 1, &p);
+ dbg(1,"force_speech=%d turn_around=%d turn_around_limit=%d\n", force_speech, this_->turn_around, this_->turn_around_limit);
+ distance=round_distance(this_->first->dest_length-this_->cmd_first->itm->dest_length);
+ if (this_->turn_around_limit && this_->turn_around == this_->turn_around_limit) {
+ dbg(1,"distance=%d distance_turn=%d\n", distance, this_->distance_turn);
+ while (distance > this_->distance_turn) {
+ this_->level_last=4;
+ level=4;
+ force_speech=1;
+ if (this_->distance_turn >= 500)
+ this_->distance_turn*=2;
+ else
+ this_->distance_turn=500;
+ }
+ } else if (!this_->turn_around_limit || this_->turn_around == -this_->turn_around_limit+1) {
+ this_->distance_turn=50;
+ distance-=this_->cmd_first->length;
+ level=navigation_get_announce_level(this_, this_->first->item.type, distance);
+ if (this_->cmd_first->itm->prev) {
+ level2=navigation_get_announce_level(this_, this_->cmd_first->itm->prev->item.type, distance);
+ if (level2 > level)
+ level=level2;
+ }
+ if (level < this_->level_last) {
+ dbg(1,"level %d < %d\n", level, this_->level_last);
+ this_->level_last=level;
+ force_speech=1;
+ }
+ if (!item_is_equal(this_->cmd_first->itm->item, this_->item_last)) {
+ dbg(1,"item different\n");
+ this_->item_last=this_->cmd_first->itm->item;
+ force_speech=1;
+ }
+ }
+ if (force_speech) {
+ this_->level_last=level;
+ dbg(1,"distance=%d level=%d type=0x%x\n", distance, level, this_->first->item.type);
+ callback_list_call(this_->callback_speech, 1, &p);
+ }
+}
+
+static void
+navigation_update(struct navigation *this_, struct route *route, struct attr *attr)
+{
+ struct map *map;
+ struct map_rect *mr;
+ struct item *ritem; /* Holds an item from the route map */
+ struct item *sitem; /* Holds the corresponding item from the actual map */
+ struct attr street_item,street_direction;
+ struct navigation_itm *itm;
+ int mode=0, incr=0, first=1;
+ if (attr->type != attr_route_status)
+ return;
+
+ dbg(1,"enter %d\n", mode);
+ if (attr->u.num == route_status_no_destination || attr->u.num == route_status_not_found || attr->u.num == route_status_path_done_new)
+ navigation_flush(this_);
+ if (attr->u.num != route_status_path_done_new && attr->u.num != route_status_path_done_incremental)
+ return;
+
+ if (! this_->route)
+ return;
+ map=route_get_map(this_->route);
+ if (! map)
+ return;
+ mr=map_rect_new(map, NULL);
+ if (! mr)
+ return;
+ dbg(1,"enter\n");
+ while ((ritem=map_rect_get_item(mr))) {
+ if (ritem->type == type_route_start && this_->turn_around > -this_->turn_around_limit+1)
+ this_->turn_around--;
+ if (ritem->type == type_route_start_reverse && this_->turn_around < this_->turn_around_limit)
+ this_->turn_around++;
+ if (ritem->type != type_street_route)
+ continue;
+ if (first && item_attr_get(ritem, attr_street_item, &street_item)) {
+ first=0;
+ if (!item_attr_get(ritem, attr_direction, &street_direction))
+ street_direction.u.num=0;
+ sitem=street_item.u.item;
+ dbg(1,"sitem=%p\n", sitem);
+ itm=item_hash_lookup(this_->hash, sitem);
+ dbg(2,"itm for item with id (0x%x,0x%x) is %p\n", sitem->id_hi, sitem->id_lo, itm);
+ if (itm && itm->direction != street_direction.u.num) {
+ dbg(2,"wrong direction\n");
+ itm=NULL;
+ }
+ navigation_destroy_itms_cmds(this_, itm);
+ if (itm) {
+ navigation_itm_update(itm, ritem);
+ break;
+ }
+ dbg(1,"not on track\n");
+ }
+ navigation_itm_new(this_, ritem);
+ }
+ dbg(2,"turn_around=%d\n", this_->turn_around);
+ if (first)
+ navigation_destroy_itms_cmds(this_, NULL);
+ else {
+ if (! ritem) {
+ navigation_itm_new(this_, NULL);
+ make_maneuvers(this_,this_->route);
+ }
+ calculate_dest_distance(this_, incr);
+ profile(0,"end");
+ navigation_call_callbacks(this_, FALSE);
+ }
+ map_rect_destroy(mr);
+}
+
+static void
+navigation_flush(struct navigation *this_)
+{
+ navigation_destroy_itms_cmds(this_, NULL);
+}
+
+
+void
+navigation_destroy(struct navigation *this_)
+{
+ navigation_flush(this_);
+ item_hash_destroy(this_->hash);
+ callback_list_destroy(this_->callback);
+ callback_list_destroy(this_->callback_speech);
+ g_free(this_);
+}
+
+int
+navigation_register_callback(struct navigation *this_, enum attr_type type, struct callback *cb)
+{
+ if (type == attr_navigation_speech)
+ callback_list_add(this_->callback_speech, cb);
+ else
+ callback_list_add(this_->callback, cb);
+ return 1;
+}
+
+void
+navigation_unregister_callback(struct navigation *this_, enum attr_type type, struct callback *cb)
+{
+ if (type == attr_navigation_speech)
+ callback_list_remove_destroy(this_->callback_speech, cb);
+ else
+ callback_list_remove_destroy(this_->callback, cb);
+}
+
+struct map *
+navigation_get_map(struct navigation *this_)
+{
+ if (! this_->map)
+ this_->map=map_new(NULL, (struct attr*[]){
+ &(struct attr){attr_type,{"navigation"}},
+ &(struct attr){attr_navigation,.u.navigation=this_},
+ &(struct attr){attr_data,{""}},
+ &(struct attr){attr_description,{"Navigation"}},
+ NULL});
+ return this_->map;
+}
+
+struct map_priv {
+ struct navigation *navigation;
+};
+
+struct map_rect_priv {
+ struct navigation *nav;
+ struct navigation_command *cmd;
+ struct navigation_command *cmd_next;
+ struct navigation_itm *itm;
+ struct navigation_itm *itm_next;
+ struct navigation_itm *cmd_itm;
+ struct navigation_itm *cmd_itm_next;
+ struct item item;
+ enum attr_type attr_next;
+ int ccount;
+ int debug_idx;
+ struct navigation_way *ways;
+ int show_all;
+ char *str;
+};
+
+static int
+navigation_map_item_coord_get(void *priv_data, struct coord *c, int count)
+{
+ struct map_rect_priv *this=priv_data;
+ if (this->ccount || ! count)
+ return 0;
+ *c=this->itm->start;
+ this->ccount=1;
+ return 1;
+}
+
+static int
+navigation_map_item_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
+{
+ struct map_rect_priv *this_=priv_data;
+ attr->type=attr_type;
+ struct navigation_command *cmd=this_->cmd;
+ struct navigation_itm *itm=this_->itm;
+ struct navigation_itm *prev=itm->prev;
+
+ if (this_->str) {
+ g_free(this_->str);
+ this_->str=NULL;
+ }
+
+ if (cmd) {
+ if (cmd->itm != itm)
+ cmd=NULL;
+ }
+ switch(attr_type) {
+ case attr_navigation_short:
+ this_->attr_next=attr_navigation_long;
+ if (cmd) {
+ this_->str=attr->u.str=show_next_maneuvers(this_->nav, this_->cmd_itm, cmd, attr_type);
+ return 1;
+ }
+ return 0;
+ case attr_navigation_long:
+ this_->attr_next=attr_navigation_long_exact;
+ if (cmd) {
+ this_->str=attr->u.str=show_next_maneuvers(this_->nav, this_->cmd_itm, cmd, attr_type);
+ return 1;
+ }
+ return 0;
+ case attr_navigation_long_exact:
+ this_->attr_next=attr_navigation_speech;
+ if (cmd) {
+ this_->str=attr->u.str=show_next_maneuvers(this_->nav, this_->cmd_itm, cmd, attr_type);
+ return 1;
+ }
+ return 0;
+ case attr_navigation_speech:
+ this_->attr_next=attr_length;
+ if (cmd) {
+ this_->str=attr->u.str=show_next_maneuvers(this_->nav, this_->cmd_itm, this_->cmd, attr_type);
+ return 1;
+ }
+ return 0;
+ case attr_length:
+ this_->attr_next=attr_time;
+ if (cmd) {
+ attr->u.num=this_->cmd_itm->dest_length-cmd->itm->dest_length;
+ return 1;
+ }
+ return 0;
+ case attr_time:
+ this_->attr_next=attr_destination_length;
+ if (cmd) {
+ attr->u.num=this_->cmd_itm->dest_time-cmd->itm->dest_time;
+ return 1;
+ }
+ return 0;
+ case attr_destination_length:
+ attr->u.num=itm->dest_length;
+ this_->attr_next=attr_destination_time;
+ return 1;
+ case attr_destination_time:
+ attr->u.num=itm->dest_time;
+ this_->attr_next=attr_street_name;
+ return 1;
+ case attr_street_name:
+ attr->u.str=itm->name1;
+ this_->attr_next=attr_street_name_systematic;
+ if (attr->u.str)
+ return 1;
+ return 0;
+ case attr_street_name_systematic:
+ attr->u.str=itm->name2;
+ this_->attr_next=attr_debug;
+ if (attr->u.str)
+ return 1;
+ return 0;
+ case attr_debug:
+ switch(this_->debug_idx) {
+ case 0:
+ this_->debug_idx++;
+ this_->str=attr->u.str=g_strdup_printf("angle:%d (- %d)", itm->angle_start, itm->angle_end);
+ return 1;
+ case 1:
+ this_->debug_idx++;
+ this_->str=attr->u.str=g_strdup_printf("item type:%s", item_to_name(itm->item.type));
+ return 1;
+ case 2:
+ this_->debug_idx++;
+ if (cmd) {
+ this_->str=attr->u.str=g_strdup_printf("delta:%d", cmd->delta);
+ return 1;
+ }
+ case 3:
+ this_->debug_idx++;
+ if (prev) {
+ this_->str=attr->u.str=g_strdup_printf("prev street_name:%s", prev->name1);
+ return 1;
+ }
+ case 4:
+ this_->debug_idx++;
+ if (prev) {
+ this_->str=attr->u.str=g_strdup_printf("prev street_name_systematic:%s", prev->name2);
+ return 1;
+ }
+ case 5:
+ this_->debug_idx++;
+ if (prev) {
+ this_->str=attr->u.str=g_strdup_printf("prev angle:(%d -) %d", prev->angle_start, prev->angle_end);
+ return 1;
+ }
+ case 6:
+ this_->debug_idx++;
+ this_->ways=itm->ways;
+ if (prev) {
+ this_->str=attr->u.str=g_strdup_printf("prev item type:%s", item_to_name(prev->item.type));
+ return 1;
+ }
+ case 7:
+ if (this_->ways && prev) {
+ this_->str=attr->u.str=g_strdup_printf("other item angle:%d delta:%d flags:%d dir:%d type:%s id:(0x%x,0x%x)", this_->ways->angle2, angle_delta(prev->angle_end, this_->ways->angle2), this_->ways->flags, this_->ways->dir, item_to_name(this_->ways->item.type), this_->ways->item.id_hi, this_->ways->item.id_lo);
+ this_->ways=this_->ways->next;
+ return 1;
+ }
+ this_->debug_idx++;
+ case 8:
+ this_->debug_idx++;
+ if (prev) {
+ int delta=0;
+ char *reason=NULL;
+ maneuver_required2(prev, itm, &delta, &reason);
+ this_->str=attr->u.str=g_strdup_printf("reason:%s",reason);
+ return 1;
+ }
+
+ default:
+ this_->attr_next=attr_none;
+ return 0;
+ }
+ case attr_any:
+ while (this_->attr_next != attr_none) {
+ if (navigation_map_item_attr_get(priv_data, this_->attr_next, attr))
+ return 1;
+ }
+ return 0;
+ default:
+ attr->type=attr_none;
+ return 0;
+ }
+}
+
+static struct item_methods navigation_map_item_methods = {
+ NULL,
+ navigation_map_item_coord_get,
+ NULL,
+ navigation_map_item_attr_get,
+};
+
+
+static void
+navigation_map_destroy(struct map_priv *priv)
+{
+ g_free(priv);
+}
+
+static void
+navigation_map_rect_init(struct map_rect_priv *priv)
+{
+ priv->cmd_next=priv->nav->cmd_first;
+ priv->cmd_itm_next=priv->itm_next=priv->nav->first;
+}
+
+static struct map_rect_priv *
+navigation_map_rect_new(struct map_priv *priv, struct map_selection *sel)
+{
+ struct navigation *nav=priv->navigation;
+ struct map_rect_priv *ret=g_new0(struct map_rect_priv, 1);
+ ret->nav=nav;
+ navigation_map_rect_init(ret);
+ ret->item.meth=&navigation_map_item_methods;
+ ret->item.priv_data=ret;
+#ifdef DEBUG
+ ret->show_all=1;
+#endif
+ return ret;
+}
+
+static void
+navigation_map_rect_destroy(struct map_rect_priv *priv)
+{
+ g_free(priv);
+}
+
+static struct item *
+navigation_map_get_item(struct map_rect_priv *priv)
+{
+ struct item *ret=&priv->item;
+ int delta;
+ if (!priv->itm_next)
+ return NULL;
+ priv->itm=priv->itm_next;
+ priv->cmd=priv->cmd_next;
+ priv->cmd_itm=priv->cmd_itm_next;
+ if (!priv->cmd)
+ return NULL;
+ if (!priv->show_all && priv->itm->prev != NULL)
+ priv->itm=priv->cmd->itm;
+ priv->itm_next=priv->itm->next;
+ if (priv->itm->prev)
+ ret->type=type_nav_none;
+ else
+ ret->type=type_nav_position;
+ if (priv->cmd->itm == priv->itm) {
+ priv->cmd_itm_next=priv->cmd->itm;
+ priv->cmd_next=priv->cmd->next;
+ if (priv->cmd_itm_next && !priv->cmd_itm_next->next)
+ ret->type=type_nav_destination;
+ else {
+ if (priv->itm && priv->itm->prev && !(priv->itm->flags & AF_ROUNDABOUT) && (priv->itm->prev->flags & AF_ROUNDABOUT)) {
+
+ switch (((180+22)-priv->cmd->roundabout_delta)/45) {
+ case 0:
+ case 1:
+ ret->type=type_nav_roundabout_r1;
+ break;
+ case 2:
+ ret->type=type_nav_roundabout_r2;
+ break;
+ case 3:
+ ret->type=type_nav_roundabout_r3;
+ break;
+ case 4:
+ ret->type=type_nav_roundabout_r4;
+ break;
+ case 5:
+ ret->type=type_nav_roundabout_r5;
+ break;
+ case 6:
+ ret->type=type_nav_roundabout_r6;
+ break;
+ case 7:
+ ret->type=type_nav_roundabout_r7;
+ break;
+ case 8:
+ ret->type=type_nav_roundabout_r8;
+ break;
+ }
+ } else {
+ delta=priv->cmd->delta;
+ if (delta < 0) {
+ delta=-delta;
+ if (delta < 45)
+ ret->type=type_nav_left_1;
+ else if (delta < 105)
+ ret->type=type_nav_left_2;
+ else if (delta < 165)
+ ret->type=type_nav_left_3;
+ else
+ ret->type=type_none;
+ } else {
+ if (delta < 45)
+ ret->type=type_nav_right_1;
+ else if (delta < 105)
+ ret->type=type_nav_right_2;
+ else if (delta < 165)
+ ret->type=type_nav_right_3;
+ else
+ ret->type=type_none;
+ }
+ }
+ }
+ }
+ priv->ccount=0;
+ priv->debug_idx=0;
+ priv->attr_next=attr_navigation_short;
+
+ ret->id_lo=priv->itm->dest_count;
+ dbg(1,"type=%d\n", ret->type);
+ return ret;
+}
+
+static struct item *
+navigation_map_get_item_byid(struct map_rect_priv *priv, int id_hi, int id_lo)
+{
+ struct item *ret;
+ navigation_map_rect_init(priv);
+ while ((ret=navigation_map_get_item(priv))) {
+ if (ret->id_hi == id_hi && ret->id_lo == id_lo)
+ return ret;
+ }
+ return NULL;
+}
+
+static struct map_methods navigation_map_meth = {
+ projection_mg,
+ "utf-8",
+ navigation_map_destroy,
+ navigation_map_rect_new,
+ navigation_map_rect_destroy,
+ navigation_map_get_item,
+ navigation_map_get_item_byid,
+ NULL,
+ NULL,
+ NULL,
+};
+
+static struct map_priv *
+navigation_map_new(struct map_methods *meth, struct attr **attrs)
+{
+ struct map_priv *ret;
+ struct attr *navigation_attr;
+
+ navigation_attr=attr_search(attrs, NULL, attr_navigation);
+ if (! navigation_attr)
+ return NULL;
+ ret=g_new0(struct map_priv, 1);
+ *meth=navigation_map_meth;
+ ret->navigation=navigation_attr->u.navigation;
+
+ return ret;
+}
+
+void
+navigation_set_route(struct navigation *this_, struct route *route)
+{
+ struct attr callback;
+ this_->route=route;
+ this_->route_cb=callback_new_attr_1(callback_cast(navigation_update), attr_route_status, this_);
+ callback.type=attr_callback;
+ callback.u.callback=this_->route_cb;
+ route_add_attr(route, &callback);
+}
+
+void
+navigation_init(void)
+{
+ plugin_register_map_type("navigation", navigation_map_new);
+}
diff --git a/navigation.h b/navigation.h
new file mode 100644
index 00000000..820c87f5
--- /dev/null
+++ b/navigation.h
@@ -0,0 +1,49 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_NAVIGATION_H
+#define NAVIT_NAVIGATION_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/* prototypes */
+enum attr_type;
+enum item_type;
+struct attr;
+struct attr_iter;
+struct callback;
+struct map;
+struct navigation;
+struct route;
+int navigation_get_attr(struct navigation *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
+struct navigation *navigation_new(struct attr *parent, struct attr **attrs);
+int navigation_set_announce(struct navigation *this_, enum item_type type, int *level);
+void navigation_destroy(struct navigation *this_);
+int navigation_register_callback(struct navigation *this_, enum attr_type type, struct callback *cb);
+void navigation_unregister_callback(struct navigation *this_, enum attr_type type, struct callback *cb);
+struct map *navigation_get_map(struct navigation *this_);
+void navigation_set_route(struct navigation *this_, struct route *route);
+void navigation_init(void);
+/* end of prototypes */
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/navit.c b/navit.c
new file mode 100644
index 00000000..83a5b50f
--- /dev/null
+++ b/navit.c
@@ -0,0 +1,2252 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <glib.h>
+#include <math.h>
+#include <time.h>
+#include "config.h"
+#include "debug.h"
+#include "navit.h"
+#include "callback.h"
+#include "gui.h"
+#include "item.h"
+#include "projection.h"
+#include "map.h"
+#include "mapset.h"
+#include "main.h"
+#include "coord.h"
+#include "point.h"
+#include "transform.h"
+#include "param.h"
+#include "menu.h"
+#include "graphics.h"
+#include "cursor.h"
+#include "popup.h"
+#include "data_window.h"
+#include "route.h"
+#include "navigation.h"
+#include "speech.h"
+#include "track.h"
+#include "vehicle.h"
+#include "color.h"
+#include "layout.h"
+#include "log.h"
+#include "attr.h"
+#include "event.h"
+#include "file.h"
+#include "profile.h"
+#include "command.h"
+#include "navit_nls.h"
+#include "util.h"
+#include "messages.h"
+#include "vehicleprofile.h"
+
+/**
+ * @defgroup navit the navit core instance. navit is the object containing nearly everything: A set of maps, one or more vehicle, a graphics object for rendering the map, a gui object for displaying the user interface, a route object, a navigation object and so on. Be warned that it is theoretically possible to have more than one navit object
+ * @{
+ */
+
+//! The navit_vehicule
+struct navit_vehicle {
+ int follow;
+ /*! Limit of the follow counter. See navit_add_vehicle */
+ int follow_curr;
+ /*! Deprecated : follow counter itself. When it reaches 'update' counts, map is recentered*/
+ struct coord coord;
+ int dir;
+ int speed;
+ struct coord last; /*< Position of the last update of this vehicle */
+ struct color c;
+ struct color *c2;
+ struct cursor *cursor;
+ struct vehicle *vehicle;
+ struct attr callback;
+ int animate_cursor;
+};
+
+struct navit {
+ struct attr self;
+ GList *mapsets;
+ GList *layouts;
+ struct gui *gui;
+ struct layout *layout_current;
+ struct graphics *gra;
+ struct action *action;
+ struct transformation *trans;
+ struct compass *compass;
+ struct route *route;
+ struct navigation *navigation;
+ struct speech *speech;
+ struct tracking *tracking;
+ int ready;
+ struct window *win;
+ struct displaylist *displaylist;
+ int tracking_flag;
+ int orientation;
+ int recentdest_count;
+ int osd_configuration;
+ GList *vehicles;
+ GList *windows_items;
+ struct navit_vehicle *vehicle;
+ struct callback_list *attr_cbl;
+ struct callback *nav_speech_cb, *roadbook_callback, *popup_callback, *route_cb;
+ struct datawindow *roadbook_window;
+ struct map *bookmark;
+ struct map *former_destination;
+ GHashTable *bookmarks_hash;
+ struct point pressed, last, current;
+ int button_pressed,moved,popped,zoomed;
+ int center_timeout;
+ int autozoom_secs;
+ int autozoom_min;
+ int autozoom_active;
+ struct event_timeout *button_timeout, *motion_timeout;
+ struct callback *motion_timeout_callback;
+ int ignore_button;
+ int ignore_graphics_events;
+ struct log *textfile_debug_log;
+ struct pcoord destination;
+ int destination_valid;
+ int blocked;
+ int w,h;
+ int drag_bitmap;
+ int use_mousewheel;
+ struct messagelist *messages;
+ struct callback *resize_callback,*button_callback,*motion_callback;
+ struct vehicleprofile *vehicleprofile;
+ GList *vehicleprofiles;
+ int pitch;
+ int follow_cursor;
+};
+
+struct gui *main_loop_gui;
+
+struct attr_iter {
+ union {
+ GList *list;
+ struct mapset_handle *mapset_handle;
+ } u;
+};
+
+static void navit_vehicle_update(struct navit *this_, struct navit_vehicle *nv);
+static void navit_vehicle_draw(struct navit *this_, struct navit_vehicle *nv, struct point *pnt);
+static int navit_add_vehicle(struct navit *this_, struct vehicle *v);
+static int navit_set_attr_do(struct navit *this_, struct attr *attr, int init);
+static int navit_get_cursor_pnt(struct navit *this_, struct point *p, int *dir);
+static void navit_cmd_zoom_to_route(struct navit *this);
+static void navit_cmd_set_center_cursor(struct navit *this_);
+static void navit_set_vehicle(struct navit *this_, struct navit_vehicle *nv);
+
+void
+navit_add_mapset(struct navit *this_, struct mapset *ms)
+{
+ this_->mapsets = g_list_append(this_->mapsets, ms);
+}
+
+struct mapset *
+navit_get_mapset(struct navit *this_)
+{
+ if(this_->mapsets){
+ return this_->mapsets->data;
+ } else {
+ dbg(0,"No mapsets enabled! Is it on purpose? Navit can't draw a map. Please check your navit.xml\n");
+ }
+ return NULL;
+}
+
+struct tracking *
+navit_get_tracking(struct navit *this_)
+{
+ return this_->tracking;
+}
+
+static void
+navit_draw_async(struct navit *this_, int async)
+{
+ GList *l;
+ struct navit_vehicle *nv;
+
+ if (this_->blocked) {
+ this_->blocked |= 2;
+ return;
+ }
+ transform_setup_source_rect(this_->trans);
+ l=this_->vehicles;
+ while (l) {
+ nv=l->data;
+ navit_vehicle_draw(this_, nv, NULL);
+ l=g_list_next(l);
+ }
+ graphics_draw(this_->gra, this_->displaylist, this_->mapsets->data, this_->trans, this_->layout_current, async, NULL);
+}
+
+void
+navit_draw(struct navit *this_)
+{
+ navit_draw_async(this_, 0);
+}
+
+
+void
+navit_draw_displaylist(struct navit *this_)
+{
+ if (this_->ready == 3)
+ graphics_displaylist_draw(this_->gra, this_->displaylist, this_->trans, this_->layout_current, 1);
+}
+
+static void
+navit_redraw_route(struct navit *this_, struct route *route, struct attr *attr)
+{
+ int updated;
+ if (attr->type != attr_route_status)
+ return;
+ updated=attr->u.num;
+ if (this_->ready != 3)
+ return;
+ if (updated != route_status_path_done_new)
+ return;
+ if (this_->vehicle) {
+ if (this_->vehicle->follow_curr == 1)
+ return;
+ if (this_->vehicle->follow_curr <= this_->vehicle->follow)
+ this_->vehicle->follow_curr=this_->vehicle->follow;
+ }
+ navit_draw(this_);
+}
+
+void
+navit_handle_resize(struct navit *this_, int w, int h)
+{
+ struct map_selection sel;
+ memset(&sel, 0, sizeof(sel));
+ this_->w=w;
+ this_->h=h;
+ sel.u.p_rect.rl.x=w;
+ sel.u.p_rect.rl.y=h;
+ transform_set_screen_selection(this_->trans, &sel);
+ this_->ready |= 2;
+ graphics_set_rect(this_->gra, &sel.u.p_rect);
+ if (this_->ready == 3)
+ navit_draw(this_);
+}
+
+static void
+navit_resize(void *data, int w, int h)
+{
+ struct navit *this=data;
+ if (!this->ignore_graphics_events)
+ navit_handle_resize(this, w, h);
+}
+
+int
+navit_get_width(struct navit *this_)
+{
+ return this_->w;
+}
+
+
+int
+navit_get_height(struct navit *this_)
+{
+ return this_->h;
+}
+
+static void
+navit_popup(void *data)
+{
+ struct navit *this_=data;
+ popup(this_, 1, &this_->pressed);
+ this_->button_timeout=NULL;
+ this_->popped=1;
+}
+
+
+int
+navit_ignore_button(struct navit *this_)
+{
+ if (this_->ignore_button)
+ return 1;
+ this_->ignore_button=1;
+ return 0;
+}
+
+void
+navit_ignore_graphics_events(struct navit *this_, int ignore)
+{
+ this_->ignore_graphics_events=ignore;
+}
+
+static void
+update_transformation(struct transformation *tr, struct point *old, struct point *new, struct point *rot)
+{
+ struct coord co,cn;
+ struct coord c,*cp;
+ int yaw;
+ double angleo,anglen;
+
+ transform_reverse(tr, old, &co);
+ if (rot) {
+ angleo=atan2(old->y-rot->y, old->x-rot->x)*180/M_PI;
+ anglen=atan2(new->y-rot->y, new->x-rot->x)*180/M_PI;
+ yaw=transform_get_yaw(tr)+angleo-anglen;
+ transform_set_yaw(tr, yaw % 360);
+ }
+ transform_reverse(tr, new, &cn);
+ cp=transform_get_center(tr);
+ c.x=cp->x+co.x-cn.x;
+ c.y=cp->y+co.y-cn.y;
+ dbg(1,"from 0x%x,0x%x to 0x%x,0x%x\n", cp->x, cp->y, c.x, c.y);
+ transform_set_center(tr, &c);
+}
+
+static void
+navit_set_timeout(struct navit *this_)
+{
+ struct attr follow;
+ follow.type=attr_follow;
+ follow.u.num=this_->center_timeout;
+ navit_set_attr(this_, &follow);
+}
+
+int
+navit_handle_button(struct navit *this_, int pressed, int button, struct point *p, struct callback *popup_callback)
+{
+ int border=16;
+
+ callback_list_call_attr_4(this_->attr_cbl, attr_button, this_, (void *)pressed, (void *)button, p);
+ if (this_->ignore_button) {
+ this_->ignore_button=0;
+ return 0;
+ }
+ if (pressed) {
+ this_->pressed=*p;
+ this_->last=*p;
+ this_->zoomed=0;
+ if (button == 1) {
+ this_->button_pressed=1;
+ this_->moved=0;
+ this_->popped=0;
+ if (popup_callback)
+ this_->button_timeout=event_add_timeout(500, 0, popup_callback);
+ }
+ if (button == 2)
+ navit_set_center_screen(this_, p, 1);
+ if (button == 3)
+ popup(this_, button, p);
+ if (button == 4 && this_->use_mousewheel) {
+ this_->zoomed = 1;
+ navit_zoom_in(this_, 2, p);
+ }
+ if (button == 5 && this_->use_mousewheel) {
+ this_->zoomed = 1;
+ navit_zoom_out(this_, 2, p);
+ }
+ } else {
+
+ this_->button_pressed=0;
+ if (this_->button_timeout) {
+ event_remove_timeout(this_->button_timeout);
+ this_->button_timeout=NULL;
+ if (! this_->moved && ! transform_within_border(this_->trans, p, border)) {
+ navit_set_center_screen(this_, p, !this_->zoomed);
+ }
+ }
+ if (this_->motion_timeout) {
+ event_remove_timeout(this_->motion_timeout);
+ this_->motion_timeout=NULL;
+ }
+ if (this_->moved) {
+ struct point pr;
+ pr.x=this_->w/2;
+ pr.y=this_->h;
+#if 0
+ update_transformation(this_->trans, &this_->pressed, p, &pr);
+#else
+ update_transformation(this_->trans, &this_->pressed, p, NULL);
+#endif
+ graphics_draw_drag(this_->gra, NULL);
+ graphics_overlay_disable(this_->gra, 0);
+ if (!this_->zoomed)
+ navit_set_timeout(this_);
+ navit_draw(this_);
+ } else
+ return 1;
+ }
+ return 0;
+}
+
+static void
+navit_button(void *data, int pressed, int button, struct point *p)
+{
+ struct navit *this=data;
+ if (!this->ignore_graphics_events) {
+ if (! this->popup_callback)
+ this->popup_callback=callback_new_1(callback_cast(navit_popup), this);
+ navit_handle_button(this, pressed, button, p, this->popup_callback);
+ }
+}
+
+
+static void
+navit_motion_timeout(struct navit *this_)
+{
+ int dx, dy;
+
+ if (this_->drag_bitmap) {
+ struct point point;
+ point.x=(this_->current.x-this_->pressed.x);
+ point.y=(this_->current.y-this_->pressed.y);
+ if (graphics_draw_drag(this_->gra, &point)) {
+ graphics_overlay_disable(this_->gra, 1);
+ graphics_draw_mode(this_->gra, draw_mode_end);
+ this_->moved=1;
+ this_->motion_timeout=NULL;
+ return;
+ }
+ }
+ dx=(this_->current.x-this_->last.x);
+ dy=(this_->current.y-this_->last.y);
+ if (dx || dy) {
+ struct transformation *tr;
+ struct point pr;
+ this_->last=this_->current;
+ graphics_overlay_disable(this_->gra, 1);
+ tr=transform_dup(this_->trans);
+ pr.x=this_->w/2;
+ pr.y=this_->h;
+#if 0
+ update_transformation(tr, &this_->pressed, &this_->current, &pr);
+#else
+ update_transformation(tr, &this_->pressed, &this_->current, NULL);
+#endif
+#if 0
+ graphics_displaylist_move(this_->displaylist, dx, dy);
+#endif
+ graphics_draw_cancel(this_->gra, this_->displaylist);
+ graphics_displaylist_draw(this_->gra, this_->displaylist, tr, this_->layout_current, 0);
+ transform_destroy(tr);
+ this_->moved=1;
+ }
+ this_->motion_timeout=NULL;
+ return;
+}
+
+void
+navit_handle_motion(struct navit *this_, struct point *p)
+{
+ int dx, dy;
+
+ if (this_->button_pressed && !this_->popped) {
+ dx=(p->x-this_->pressed.x);
+ dy=(p->y-this_->pressed.y);
+ if (dx < -8 || dx > 8 || dy < -8 || dy > 8) {
+ if (this_->button_timeout) {
+ event_remove_timeout(this_->button_timeout);
+ this_->button_timeout=NULL;
+ }
+ this_->current=*p;
+ if (! this_->motion_timeout_callback)
+ this_->motion_timeout_callback=callback_new_1(callback_cast(navit_motion_timeout), this_);
+ if (! this_->motion_timeout)
+ this_->motion_timeout=event_add_timeout(100, 0, this_->motion_timeout_callback);
+ }
+ }
+}
+
+static void
+navit_motion(void *data, struct point *p)
+{
+ struct navit *this=data;
+ if (!this->ignore_graphics_events)
+ navit_handle_motion(this, p);
+}
+
+static void
+navit_scale(struct navit *this_, long scale, struct point *p, int draw)
+{
+ struct coord c1, c2, *center;
+ if (p)
+ transform_reverse(this_->trans, p, &c1);
+ transform_set_scale(this_->trans, scale);
+ if (p) {
+ transform_reverse(this_->trans, p, &c2);
+ center = transform_center(this_->trans);
+ center->x += c1.x - c2.x;
+ center->y += c1.y - c2.y;
+ }
+ if (draw)
+ navit_draw(this_);
+}
+
+/**
+ * @brief Automatically adjusts zoom level
+ *
+ * This function automatically adjusts the current
+ * zoom level according to the current speed.
+ *
+ * @param this_ The navit struct
+ * @param center The "immovable" point - i.e. the vehicles position if we're centering on the vehicle
+ * @param speed The vehicles speed in meters per second
+ * @param dir The direction into which the vehicle moves
+ */
+static void
+navit_autozoom(struct navit *this_, struct coord *center, int speed, int draw)
+{
+ struct point pc;
+ int distance,w,h;
+ double new_scale;
+ long scale;
+
+ if (! this_->autozoom_active) {
+ return;
+ }
+
+ distance = speed * this_->autozoom_secs;
+
+ transform_get_size(this_->trans, &w, &h);
+ transform(this_->trans, transform_get_projection(this_->trans), center, &pc, 1, 0, 0, NULL);
+ scale = transform_get_scale(this_->trans);
+
+ /* We make shure that the point we want to see is within a certain range
+ * around the vehicle. The radius of this circle is the size of the
+ * screen. This doesn't necessarily mean the point is visible because of
+ * perspective etc. Quite rough, but should be enough. */
+
+ if (w > h) {
+ new_scale = (double)distance / h * 16;
+ } else {
+ new_scale = (double)distance / w * 16;
+ }
+
+ if (abs(new_scale - scale) < 2) {
+ return; // Smoothing
+ }
+
+ if (new_scale >= this_->autozoom_min) {
+ navit_scale(this_, (long)new_scale, &pc, 0);
+ } else {
+ if (scale != this_->autozoom_min) {
+ navit_scale(this_, this_->autozoom_min, &pc, 0);
+ }
+ }
+}
+
+/**
+ * Change the current zoom level, zooming closer to the ground
+ *
+ * @param navit The navit instance
+ * @param factor The zoom factor, usually 2
+ * @param p The invariant point (if set to NULL, default to center)
+ * @returns nothing
+ */
+void
+navit_zoom_in(struct navit *this_, int factor, struct point *p)
+{
+ long scale=transform_get_scale(this_->trans)/factor;
+ if (scale < 1)
+ scale=1;
+ navit_scale(this_, scale, p, 1);
+}
+
+/**
+ * Change the current zoom level
+ *
+ * @param navit The navit instance
+ * @param factor The zoom factor, usually 2
+ * @param p The invariant point (if set to NULL, default to center)
+ * @returns nothing
+ */
+void
+navit_zoom_out(struct navit *this_, int factor, struct point *p)
+{
+ long scale=transform_get_scale(this_->trans)*factor;
+ navit_scale(this_, scale, p, 1);
+}
+
+static int
+navit_cmd_zoom_in(struct navit *this_)
+{
+ struct point p;
+ if (this_->vehicle && this_->vehicle->follow_curr == 1 && navit_get_cursor_pnt(this_, &p, NULL)) {
+ navit_zoom_in(this_, 2, &p);
+ this_->vehicle->follow_curr=this_->vehicle->follow;
+ } else
+ navit_zoom_in(this_, 2, NULL);
+ return 0;
+}
+
+static int
+navit_cmd_zoom_out(struct navit *this_)
+{
+ struct point p;
+ if (this_->vehicle && this_->vehicle->follow_curr == 1 && navit_get_cursor_pnt(this_, &p, NULL)) {
+ navit_zoom_out(this_, 2, &p);
+ this_->vehicle->follow_curr=this_->vehicle->follow;
+ } else
+ navit_zoom_out(this_, 2, NULL);
+ return 0;
+}
+
+static struct command_table commands[] = {
+ {"zoom_in",command_cast(navit_cmd_zoom_in)},
+ {"zoom_out",command_cast(navit_cmd_zoom_out)},
+ {"zoom_to_route",command_cast(navit_cmd_zoom_to_route)},
+ {"set_center_cursor",command_cast(navit_cmd_set_center_cursor)},
+};
+
+
+struct navit *
+navit_new(struct attr *parent, struct attr **attrs)
+{
+ struct navit *this_=g_new0(struct navit, 1);
+ struct pcoord center;
+ struct coord co;
+ struct coord_geo g;
+ enum projection pro=projection_mg;
+ int zoom = 256;
+ g.lat=53.13;
+ g.lng=11.70;
+
+ this_->self.type=attr_navit;
+ this_->self.u.navit=this_;
+ this_->attr_cbl=callback_list_new();
+ main_add_navit(this_);
+
+ this_->bookmarks_hash=g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
+
+ this_->orientation=-1;
+ this_->tracking_flag=1;
+ this_->recentdest_count=10;
+ this_->osd_configuration=-1;
+
+ this_->center_timeout = 10;
+ this_->use_mousewheel = 1;
+ this_->autozoom_secs = 10;
+ this_->autozoom_min = 7;
+ this_->autozoom_active = 0;
+ this_->follow_cursor = 1;
+
+ this_->trans = transform_new();
+ transform_from_geo(pro, &g, &co);
+ center.x=co.x;
+ center.y=co.y;
+ center.pro = pro;
+
+ transform_setup(this_->trans, &center, zoom, (this_->orientation != -1) ? this_->orientation : 0);
+ for (;*attrs; attrs++) {
+ navit_set_attr_do(this_, *attrs, 1);
+ }
+ this_->displaylist=graphics_displaylist_new();
+ command_add_table(this_->attr_cbl, commands, sizeof(commands)/sizeof(struct command_table), this_);
+
+ this_->messages = messagelist_new(attrs);
+
+ return this_;
+}
+
+static int
+navit_set_gui(struct navit *this_, struct gui *gui)
+{
+ if (this_->gui)
+ return 0;
+ this_->gui=gui;
+ if (gui_has_main_loop(this_->gui)) {
+ if (! main_loop_gui) {
+ main_loop_gui=this_->gui;
+ } else {
+ dbg(0,"gui with main loop already active, ignoring this instance");
+ return 0;
+ }
+ }
+ return 1;
+}
+
+void
+navit_add_message(struct navit *this_, char *message)
+{
+ message_new(this_->messages, message);
+}
+
+struct message
+*navit_get_messages(struct navit *this_)
+{
+ return message_get(this_->messages);
+}
+
+static int
+navit_set_graphics(struct navit *this_, struct graphics *gra)
+{
+ if (this_->gra)
+ return 0;
+ this_->gra=gra;
+ this_->resize_callback=callback_new_attr_1(callback_cast(navit_resize), attr_resize, this_);
+ graphics_add_callback(gra, this_->resize_callback);
+ this_->button_callback=callback_new_attr_1(callback_cast(navit_button), attr_button, this_);
+ graphics_add_callback(gra, this_->button_callback);
+ this_->motion_callback=callback_new_attr_1(callback_cast(navit_motion), attr_motion, this_);
+ graphics_add_callback(gra, this_->motion_callback);
+ return 1;
+}
+
+struct graphics *
+navit_get_graphics(struct navit *this_)
+{
+ return this_->gra;
+}
+
+struct vehicleprofile *
+navit_get_vehicleprofile(struct navit *this_)
+{
+ return this_->vehicleprofile;
+}
+
+GList *
+navit_get_vehicleprofiles(struct navit *this_)
+{
+ return this_->vehicleprofiles;
+}
+
+static void
+navit_projection_set(struct navit *this_, enum projection pro)
+{
+ struct coord_geo g;
+ struct coord *c;
+
+ c=transform_center(this_->trans);
+ transform_to_geo(transform_get_projection(this_->trans), c, &g);
+ transform_set_projection(this_->trans, pro);
+ transform_from_geo(pro, &g, c);
+ navit_draw(this_);
+}
+
+/**
+ * @param limit Limits the number of entries in the "backlog". Set to 0 for "infinite"
+ */
+static void
+navit_append_coord(struct navit *this_, char *file, struct pcoord *c, const char *type, const char *description, GHashTable *h, int limit)
+{
+ FILE *f;
+ int offset=0;
+ char *buffer;
+ int ch,prev,lines=0;
+ int numc,readc;
+ int fd;
+ const char *prostr;
+
+ f=fopen(file, "r");
+ if (!f)
+ goto new_file;
+ if (limit != 0) {
+ prev = '\n';
+ while ((ch = fgetc(f)) != EOF) {
+ if ((ch == '\n') && (prev != '\n')) {
+ lines++;
+ }
+ prev = ch;
+ }
+
+ if (prev != '\n') { // Last line did not end with a newline
+ lines++;
+ }
+
+ fclose(f);
+ f = fopen(file, "r+");
+ fd = fileno(f);
+ while (lines >= limit) { // We have to "scroll up"
+ rewind(f);
+ numc = 0; // Counts how many bytes we have in our line to scroll up
+ while ((ch = fgetc(f)) != EOF) {
+ numc++;
+ if (ch == '\n') {
+ break;
+ }
+ }
+
+ buffer=g_malloc(numc);
+ offset = numc; // Offset holds where we currently are
+
+ do {
+ fseek(f,offset,SEEK_SET);
+ readc = fread(buffer,1,numc,f);
+
+ fseek(f,-(numc+readc),SEEK_CUR);
+ fwrite(buffer,1,readc,f);
+
+ offset += readc;
+ } while (readc == numc);
+
+ g_free(buffer);
+ fflush(f);
+ ftruncate(fd,(offset-numc));
+#ifdef HAVE_FSYNC
+ fsync(fd);
+#endif
+
+ lines--;
+ }
+ fclose(f);
+ }
+
+new_file:
+ f=fopen(file, "a");
+ if (f) {
+ if (c) {
+ prostr = projection_to_name(c->pro,NULL);
+ fprintf(f,"%s%s%s0x%x %s0x%x type=%s label=\"%s\"\n",
+ prostr, *prostr ? ":" : "",
+ c->x >= 0 ? "":"-", c->x >= 0 ? c->x : -c->x,
+ c->y >= 0 ? "":"-", c->y >= 0 ? c->y : -c->y,
+ type, description);
+ } else
+ fprintf(f,"\n");
+ }
+ fclose(f);
+}
+
+/*
+ * navit_get_user_data_directory
+ *
+ * returns the directory used to store user data files (center.txt,
+ * destination.txt, bookmark.txt, ...)
+ *
+ * arg: gboolean create: create the directory if it does not exist
+ */
+static char*
+navit_get_user_data_directory(gboolean create) {
+ char *dir;
+ dir = getenv("NAVIT_USER_DATADIR");
+ if (create && !file_exists(dir)) {
+ dbg(0,"creating dir %s\n", dir);
+ if (file_mkdir(dir,0)) {
+ dbg(0,"failed creating dir %s\n", dir);
+ return NULL;
+ }
+ }
+
+ return dir;
+}
+
+/*
+ * navit_get_destination_file
+ *
+ * returns the name of the file used to store destinations with its
+ * full path
+ *
+ * arg: gboolean create: create the directory where the file is stored
+ * if it does not exist
+ */
+static char*
+navit_get_destination_file(gboolean create)
+{
+ return g_strjoin(NULL, navit_get_user_data_directory(create), "/destination.txt", NULL);
+}
+
+/*
+ * navit_get_bookmark_file
+ *
+ * returns the name of the file used to store bookmarks with its
+ * full path
+ *
+ * arg: gboolean create: create the directory where the file is stored
+ * if it does not exist
+ */
+static char*
+navit_get_bookmark_file(gboolean create)
+{
+ return g_strjoin(NULL, navit_get_user_data_directory(create), "/bookmark.txt", NULL);
+}
+
+
+/*
+ * navit_get_bookmark_file
+ *
+ * returns the name of the file used to store the center file with its
+ * full path
+ *
+ * arg: gboolean create: create the directory where the file is stored
+ * if it does not exist
+ */
+static char*
+navit_get_center_file(gboolean create)
+{
+ return g_strjoin(NULL, navit_get_user_data_directory(create), "/center.txt", NULL);
+}
+
+static void
+navit_set_center_from_file(struct navit *this_, char *file)
+{
+ FILE *f;
+ char *line = NULL;
+
+ size_t line_size = 0;
+ enum projection pro;
+ struct coord *center;
+
+ f = fopen(file, "r");
+ if (! f)
+ return;
+ getline(&line, &line_size, f);
+ fclose(f);
+ if (line) {
+ center = transform_center(this_->trans);
+ pro = transform_get_projection(this_->trans);
+ coord_parse(g_strchomp(line), pro, center);
+ free(line);
+ }
+ return;
+}
+
+static void
+navit_write_center_to_file(struct navit *this_, char *file)
+{
+ FILE *f;
+ enum projection pro;
+ struct coord *center;
+
+ f = fopen(file, "w+");
+ if (f) {
+ center = transform_center(this_->trans);
+ pro = transform_get_projection(this_->trans);
+ coord_print(pro, center, f);
+ fclose(f);
+ } else {
+ perror(file);
+ }
+ return;
+}
+
+
+/**
+ * Start the route computing to a given set of coordinates
+ *
+ * @param navit The navit instance
+ * @param c The coordinate to start routing to
+ * @param description A label which allows the user to later identify this destination in the former destinations selection
+ * @returns nothing
+ */
+void
+navit_set_destination(struct navit *this_, struct pcoord *c, const char *description, int async)
+{
+ if (c) {
+ this_->destination=*c;
+ this_->destination_valid=1;
+ } else
+ this_->destination_valid=0;
+ char *destination_file = navit_get_destination_file(TRUE);
+ navit_append_coord(this_, destination_file, c, "former_destination", description, NULL, this_->recentdest_count);
+ g_free(destination_file);
+ callback_list_call_attr_0(this_->attr_cbl, attr_destination);
+ if (this_->route) {
+ route_set_destination(this_->route, c, async);
+
+ if (this_->ready == 3)
+ navit_draw(this_);
+ }
+}
+
+/**
+ * @brief Checks if a route is calculated
+ *
+ * This function checks if a route is calculated.
+ *
+ * @param this_ The navit struct whose route should be checked.
+ * @return True if the route is set, false otherwise.
+ */
+int
+navit_check_route(struct navit *this_)
+{
+ if (this_->route) {
+ return route_get_path_set(this_->route);
+ }
+
+ return 0;
+}
+
+/**
+ * Record the given set of coordinates as a bookmark
+ *
+ * @param navit The navit instance
+ * @param c The coordinate to store
+ * @param description A label which allows the user to later identify this bookmark
+ * @returns nothing
+ */
+void
+navit_add_bookmark(struct navit *this_, struct pcoord *c, const char *description)
+{
+ char *bookmark_file = navit_get_bookmark_file(TRUE);
+ navit_append_coord(this_,bookmark_file, c, "bookmark", description, this_->bookmarks_hash,0);
+ g_free(bookmark_file);
+
+ callback_list_call_attr_0(this_->attr_cbl, attr_bookmark_map);
+}
+
+struct navit *global_navit;
+
+static void
+navit_add_bookmarks_from_file(struct navit *this_)
+{
+ char *bookmark_file = navit_get_bookmark_file(FALSE);
+ struct attr parent={attr_navit, .u.navit=this_};
+ struct attr type={attr_type, {"textfile"}}, data={attr_data, {bookmark_file}};
+ struct attr *attrs[]={&type, &data, NULL};
+
+ this_->bookmark=map_new(&parent, attrs);
+ g_free(bookmark_file);
+}
+
+static int
+navit_former_destinations_active(struct navit *this_)
+{
+ char *destination_file = navit_get_destination_file(FALSE);
+ FILE *f;
+ int active=0;
+ char buffer[3];
+ f=fopen(destination_file,"r");
+ if (f) {
+ if(!fseek(f, -2, SEEK_END) && fread(buffer, 2, 1, f) == 1 && (buffer[0]!='\n' || buffer[1]!='\n'))
+ active=1;
+ fclose(f);
+ }
+ g_free(destination_file);
+ return active;
+}
+
+static void
+navit_add_former_destinations_from_file(struct navit *this_)
+{
+ char *destination_file = navit_get_destination_file(FALSE);
+ struct attr parent={attr_navit, .u.navit=this_};
+ struct attr type={attr_type, {"textfile"}}, data={attr_data, {destination_file}};
+ struct attr *attrs[]={&type, &data, NULL};
+ struct map_rect *mr;
+ struct item *item;
+ int valid=0;
+ struct coord c;
+ struct pcoord pc;
+
+ this_->former_destination=map_new(&parent, attrs);
+ g_free(destination_file);
+ if (!this_->route || !navit_former_destinations_active(this_))
+ return;
+ mr=map_rect_new(this_->former_destination, NULL);
+ while ((item=map_rect_get_item(mr))) {
+ if (item->type == type_former_destination && item_coord_get(item, &c, 1))
+ valid=1;
+ }
+ map_rect_destroy(mr);
+ pc.pro=map_projection(this_->former_destination);
+ pc.x=c.x;
+ pc.y=c.y;
+ if (valid) {
+ route_set_destination(this_->route, &pc, 1);
+ this_->destination=pc;
+ this_->destination_valid=1;
+ }
+}
+
+
+void
+navit_textfile_debug_log(struct navit *this_, const char *fmt, ...)
+{
+ va_list ap;
+ char *str1,*str2;
+ va_start(ap, fmt);
+ if (this_->textfile_debug_log && this_->vehicle) {
+ str1=g_strdup_vprintf(fmt, ap);
+ str2=g_strdup_printf("0x%x 0x%x%s%s\n", this_->vehicle->coord.x, this_->vehicle->coord.y, strlen(str1) ? " " : "", str1);
+ log_write(this_->textfile_debug_log, str2, strlen(str2));
+ g_free(str2);
+ g_free(str1);
+ }
+ va_end(ap);
+}
+
+int
+navit_speech_estimate(struct navit *this_, char *str)
+{
+ return speech_estimate_duration(this_->speech, str);
+}
+
+void
+navit_say(struct navit *this_, char *text)
+{
+ speech_say(this_->speech, text);
+}
+
+/**
+ * @brief Toggles the navigation announcer for navit
+ * @param this_ The navit object
+ */
+void
+navit_announcer_toggle(struct navit *this_)
+{
+ struct attr attr, speechattr;
+
+ // search for the speech attribute
+ if(!navit_get_attr(this_, attr_speech, &speechattr, NULL))
+ return;
+ // find out if the corresponding attribute attr_active has been set
+ if(speech_get_attr(speechattr.u.speech, attr_active, &attr, NULL)) {
+ // flip it then...
+ attr.u.num = !attr.u.num;
+ } else {
+ // otherwise disable it because voice is enabled by default
+ attr.type = attr_active;
+ attr.u.num = 0;
+ }
+
+ // apply the new state
+ if(!speech_set_attr(speechattr.u.speech, &attr))
+ return;
+
+ // announce that the speech attribute has changed
+ callback_list_call_attr_0(this_->attr_cbl, attr_speech);
+}
+
+void
+navit_speak(struct navit *this_)
+{
+ struct navigation *nav=this_->navigation;
+ struct map *map=NULL;
+ struct map_rect *mr=NULL;
+ struct item *item;
+ struct attr attr;
+
+ if (!speech_get_attr(this_->speech, attr_active, &attr, NULL))
+ attr.u.num = 1;
+ dbg(1, "this_.speech->active %i\n", attr.u.num);
+ if(!attr.u.num)
+ return;
+
+ if (nav)
+ map=navigation_get_map(nav);
+ if (map)
+ mr=map_rect_new(map, NULL);
+ if (mr) {
+ while ((item=map_rect_get_item(mr)) && (item->type == type_nav_position || item->type == type_nav_none));
+ if (item && item_attr_get(item, attr_navigation_speech, &attr)) {
+ speech_say(this_->speech, attr.u.str);
+ navit_add_message(this_, attr.u.str);
+ navit_textfile_debug_log(this_, "type=announcement label=\"%s\"", attr.u.str);
+ }
+ map_rect_destroy(mr);
+ }
+}
+
+static void
+navit_window_roadbook_update(struct navit *this_)
+{
+ struct navigation *nav=this_->navigation;
+ struct map *map=NULL;
+ struct map_rect *mr=NULL;
+ struct item *item;
+ struct attr attr;
+ struct param_list param[5];
+ int secs;
+
+ dbg(1,"enter\n");
+ datawindow_mode(this_->roadbook_window, 1);
+ if (nav)
+ map=navigation_get_map(nav);
+ if (map)
+ mr=map_rect_new(map, NULL);
+ dbg(0,"nav=%p map=%p mr=%p\n", nav, map, mr);
+ if (mr) {
+ dbg(0,"while loop\n");
+ while ((item=map_rect_get_item(mr))) {
+ dbg(0,"item=%p\n", item);
+ attr.u.str=NULL;
+ if (item->type != type_nav_position) {
+ item_attr_get(item, attr_navigation_long, &attr);
+ if (attr.u.str == NULL) {
+ continue;
+ }
+ dbg(2, "Command='%s'\n", attr.u.str);
+ param[0].value=g_strdup(attr.u.str);
+ } else
+ param[0].value=_("Position");
+ param[0].name=_("Command");
+
+ item_attr_get(item, attr_length, &attr);
+ dbg(2, "Length=%d\n", attr.u.num);
+ param[1].name=_("Length");
+
+ if ( attr.u.num >= 2000 )
+ {
+ param[1].value=g_strdup_printf("%5.1f %s",(float)attr.u.num / 1000, _("km") );
+ }
+ else
+ {
+ param[1].value=g_strdup_printf("%7d %s",attr.u.num, _("m"));
+ }
+
+ item_attr_get(item, attr_time, &attr);
+ dbg(2, "Time=%d\n", attr.u.num);
+ secs=attr.u.num/10;
+ param[2].name=_("Time");
+ if ( secs >= 3600 )
+ {
+ param[2].value=g_strdup_printf("%d:%02d:%02d",secs / 60, ( secs / 60 ) % 60 , secs % 60);
+ }
+ else
+ {
+ param[2].value=g_strdup_printf("%d:%02d",secs / 60, secs % 60);
+ }
+
+ item_attr_get(item, attr_destination_length, &attr);
+ dbg(2, "Destlength=%d\n", attr.u.num);
+ param[3].name=_("Destination Length");
+ if ( attr.u.num >= 2000 )
+ {
+ param[3].value=g_strdup_printf("%5.1f %s",(float)attr.u.num / 1000, _("km") );
+ }
+ else
+ {
+ param[3].value=g_strdup_printf("%d %s",attr.u.num, _("m"));
+ }
+
+ item_attr_get(item, attr_destination_time, &attr);
+ dbg(2, "Desttime=%d\n", attr.u.num);
+ secs=attr.u.num/10;
+ param[4].name=_("Destination Time");
+ if ( secs >= 3600 )
+ {
+ param[4].value=g_strdup_printf("%d:%02d:%02d",secs / 3600, (secs / 60 ) % 60 , secs % 60);
+ }
+ else
+ {
+ param[4].value=g_strdup_printf("%d:%02d",secs / 60, secs % 60);
+ }
+ datawindow_add(this_->roadbook_window, param, 5);
+ }
+ map_rect_destroy(mr);
+ }
+ datawindow_mode(this_->roadbook_window, 0);
+}
+
+void
+navit_window_roadbook_destroy(struct navit *this_)
+{
+ dbg(0, "enter\n");
+ navigation_unregister_callback(this_->navigation, attr_navigation_long, this_->roadbook_callback);
+ this_->roadbook_window=NULL;
+ this_->roadbook_callback=NULL;
+}
+void
+navit_window_roadbook_new(struct navit *this_)
+{
+ if (!this_->gui || this_->roadbook_callback || this_->roadbook_window) {
+ return;
+ }
+
+ this_->roadbook_callback=callback_new_1(callback_cast(navit_window_roadbook_update), this_);
+ navigation_register_callback(this_->navigation, attr_navigation_long, this_->roadbook_callback);
+ this_->roadbook_window=gui_datawindow_new(this_->gui, _("Roadbook"), NULL, callback_new_1(callback_cast(navit_window_roadbook_destroy), this_));
+ navit_window_roadbook_update(this_);
+}
+
+void
+navit_init(struct navit *this_)
+{
+ struct mapset *ms;
+ struct map *map;
+
+ dbg(2,"enter gui %p graphics %p\n",this_->gui,this_->gra);
+ if (!this_->gui) {
+ dbg(0,"no gui\n");
+ navit_destroy(this_);
+ return;
+ }
+ if (!this_->gra) {
+ dbg(0,"no graphics\n");
+ navit_destroy(this_);
+ return;
+ }
+ dbg(2,"Connecting gui to graphics\n");
+ if (gui_set_graphics(this_->gui, this_->gra)) {
+ struct attr attr_type_gui, attr_type_graphics;
+ gui_get_attr(this_->gui, attr_type, &attr_type_gui, NULL);
+ graphics_get_attr(this_->gra, attr_type, &attr_type_graphics, NULL);
+ dbg(0,"failed to connect graphics '%s' to gui '%s'\n", attr_type_graphics.u.str, attr_type_gui.u.str);
+ dbg(0," Please see http://wiki.navit-project.org/index.php/Failed_to_connect_graphics_to_gui\n");
+ dbg(0," for explanations and solutions\n");
+
+ navit_destroy(this_);
+ return;
+ }
+ dbg(2,"Initializing graphics\n");
+ graphics_init(this_->gra);
+ dbg(2,"Setting Vehicle\n");
+ navit_set_vehicle(this_, this_->vehicle);
+ dbg(2,"Adding dynamic maps to mapset %p\n",this_->mapsets);
+ if (this_->mapsets) {
+ ms=this_->mapsets->data;
+ if (this_->route) {
+ if ((map=route_get_map(this_->route)))
+ mapset_add_attr(ms, &(struct attr){attr_map,.u.map=map});
+ if ((map=route_get_graph_map(this_->route))) {
+ mapset_add_attr(ms, &(struct attr){attr_map,.u.map=map});
+ map_set_attr(map, &(struct attr ){attr_active,.u.num=0});
+ }
+ route_set_mapset(this_->route, ms);
+ route_set_projection(this_->route, transform_get_projection(this_->trans));
+ }
+ if (this_->tracking) {
+ tracking_set_mapset(this_->tracking, ms);
+ if (this_->route)
+ tracking_set_route(this_->tracking, this_->route);
+ }
+ if (this_->navigation) {
+ if ((map=navigation_get_map(this_->navigation))) {
+ mapset_add_attr(ms, &(struct attr){attr_map,.u.map=map});
+ map_set_attr(map, &(struct attr ){attr_active,.u.num=0});
+ }
+ }
+ if (this_->tracking) {
+ if ((map=tracking_get_map(this_->tracking))) {
+ mapset_add_attr(ms, &(struct attr){attr_map,.u.map=map});
+ map_set_attr(map, &(struct attr ){attr_active,.u.num=0});
+ }
+ }
+ navit_add_bookmarks_from_file(this_);
+ navit_add_former_destinations_from_file(this_);
+ }
+ if (this_->route) {
+ struct attr callback;
+ this_->route_cb=callback_new_attr_1(callback_cast(navit_redraw_route), attr_route_status, this_);
+ callback.type=attr_callback;
+ callback.u.callback=this_->route_cb;
+ route_add_attr(this_->route, &callback);
+ }
+ if (this_->navigation) {
+ if (this_->speech) {
+ this_->nav_speech_cb=callback_new_1(callback_cast(navit_speak), this_);
+ navigation_register_callback(this_->navigation, attr_navigation_speech, this_->nav_speech_cb);
+ }
+ if (this_->route)
+ navigation_set_route(this_->navigation, this_->route);
+ }
+ dbg(2,"Setting Center\n");
+ char *center_file = navit_get_center_file(FALSE);
+ navit_set_center_from_file(this_, center_file);
+ g_free(center_file);
+#if 0
+ if (this_->menubar) {
+ men=menu_add(this_->menubar, "Data", menu_type_submenu, NULL);
+ if (men) {
+ navit_add_menu_windows_items(this_, men);
+ }
+ }
+#endif
+ global_navit=this_;
+#if 0
+ navit_window_roadbook_new(this_);
+ navit_window_items_new(this_);
+#endif
+ callback_list_call_attr_1(this_->attr_cbl, attr_navit, this_);
+ this_->ready|=1;
+
+ messagelist_init(this_->messages);
+
+ dbg(2,"ready=%d\n",this_->ready);
+ if (this_->ready == 3)
+ navit_draw(this_);
+}
+
+void
+navit_zoom_to_route(struct navit *this_, int orientation)
+{
+ struct map *map;
+ struct map_rect *mr=NULL;
+ struct item *item;
+ struct coord c;
+ struct coord_rect r;
+ int count=0,scale=16;
+ if (! this_->route)
+ return;
+ dbg(1,"enter\n");
+ map=route_get_map(this_->route);
+ dbg(1,"map=%p\n",map);
+ if (map)
+ mr=map_rect_new(map, NULL);
+ dbg(1,"mr=%p\n",mr);
+ if (mr) {
+ while ((item=map_rect_get_item(mr))) {
+ dbg(1,"item=%s\n", item_to_name(item->type));
+ while (item_coord_get(item, &c, 1)) {
+ dbg(1,"coord\n");
+ if (!count)
+ r.lu=r.rl=c;
+ else
+ coord_rect_extend(&r, &c);
+ count++;
+ }
+ }
+ }
+ if (! count)
+ return;
+ c.x=(r.rl.x+r.lu.x)/2;
+ c.y=(r.rl.y+r.lu.y)/2;
+ dbg(1,"count=%d\n",count);
+ if (orientation != -1)
+ transform_set_yaw(this_->trans, orientation);
+ transform_set_center(this_->trans, &c);
+ dbg(1,"%x,%x-%x,%x\n", r.rl.x,r.rl.y,r.lu.x,r.lu.y);
+ while (scale < 1<<20) {
+ struct point p1,p2;
+ transform_set_scale(this_->trans, scale);
+ transform_setup_source_rect(this_->trans);
+ transform(this_->trans, transform_get_projection(this_->trans), &r.lu, &p1, 1, 0, 0, NULL);
+ transform(this_->trans, transform_get_projection(this_->trans), &r.rl, &p2, 1, 0, 0, NULL);
+ dbg(1,"%d,%d-%d,%d\n",p1.x,p1.y,p2.x,p2.y);
+ if (p1.x < 0 || p2.x < 0 || p1.x > this_->w || p2.x > this_->w ||
+ p1.y < 0 || p2.y < 0 || p1.y > this_->h || p2.y > this_->h)
+ scale*=2;
+ else
+ break;
+
+ }
+ if (this_->ready == 3)
+ navit_draw_async(this_,0);
+}
+
+static void
+navit_cmd_zoom_to_route(struct navit *this)
+{
+ navit_zoom_to_route(this, 0);
+}
+
+
+/**
+ * Change the current zoom level
+ *
+ * @param navit The navit instance
+ * @param center The point where to center the map, including its projection
+ * @returns nothing
+ */
+void
+navit_set_center(struct navit *this_, struct pcoord *center, int set_timeout)
+{
+ struct coord *c=transform_center(this_->trans);
+ struct coord c1,c2;
+ enum projection pro = transform_get_projection(this_->trans);
+ if (pro != center->pro) {
+ c1.x = center->x;
+ c1.y = center->y;
+ transform_from_to(&c1, center->pro, &c2, pro);
+ } else {
+ c2.x = center->x;
+ c2.y = center->y;
+ }
+ *c=c2;
+ if (set_timeout)
+ navit_set_timeout(this_);
+ if (this_->ready == 3)
+ navit_draw(this_);
+}
+
+static void
+navit_set_center_coord_screen(struct navit *this_, struct coord *c, struct point *p, int set_timeout)
+{
+ int width, height;
+ struct point po;
+ transform_set_center(this_->trans, c);
+ transform_get_size(this_->trans, &width, &height);
+ po.x=width/2;
+ po.y=height/2;
+ update_transformation(this_->trans, &po, p, NULL);
+ if (set_timeout)
+ navit_set_timeout(this_);
+}
+
+static int
+navit_get_cursor_pnt(struct navit *this_, struct point *p, int *dir)
+{
+ int width, height;
+ struct navit_vehicle *nv=this_->vehicle;
+ transform_get_size(this_->trans, &width, &height);
+ if (this_->orientation == -1) {
+ p->x=50*width/100;
+ p->y=80*height/100;
+ if (dir)
+ *dir=nv->dir;
+ } else {
+ int mdir;
+ if (this_->tracking && this_->tracking_flag) {
+ mdir = tracking_get_angle(this_->tracking) - this_->orientation;
+ } else {
+ mdir=nv->dir-this_->orientation;
+ }
+
+ p->x=(50 - 30.*sin(M_PI*mdir/180.))*width/100;
+ p->y=(50 + 30.*cos(M_PI*mdir/180.))*height/100;
+ if (dir)
+ *dir=this_->orientation;
+ }
+ return 1;
+}
+
+static void
+navit_set_center_cursor(struct navit *this_)
+{
+ int dir;
+ struct point pn;
+ struct navit_vehicle *nv=this_->vehicle;
+ navit_get_cursor_pnt(this_, &pn, &dir);
+ transform_set_yaw(this_->trans, dir);
+ navit_set_center_coord_screen(this_, &nv->coord, &pn, 0);
+ navit_autozoom(this_, &nv->coord, nv->speed, 0);
+ if (this_->ready == 3)
+ navit_draw_async(this_, 1);
+}
+
+static void
+navit_cmd_set_center_cursor(struct navit *this_)
+{
+ navit_set_center_cursor(this_);
+}
+
+void
+navit_set_center_screen(struct navit *this_, struct point *p, int set_timeout)
+{
+ struct coord c;
+ struct pcoord pc;
+ transform_reverse(this_->trans, p, &c);
+ pc.x = c.x;
+ pc.y = c.y;
+ pc.pro = transform_get_projection(this_->trans);
+ navit_set_center(this_, &pc, set_timeout);
+}
+
+#if 0
+ switch((*attrs)->type) {
+ case attr_zoom:
+ zoom=(*attrs)->u.num;
+ break;
+ case attr_center:
+ g=*((*attrs)->u.coord_geo);
+ break;
+#endif
+
+static int
+navit_set_attr_do(struct navit *this_, struct attr *attr, int init)
+{
+ int dir=0, orient_old=0, attr_updated=0;
+ struct coord co;
+ long zoom;
+ GList *l;
+ struct navit_vehicle *nv;
+ struct attr active=(struct attr){attr_active,{(void *)0}};
+
+ switch (attr->type) {
+ case attr_autozoom:
+ attr_updated=(this_->autozoom_secs != attr->u.num);
+ this_->autozoom_secs = attr->u.num;
+ break;
+ case attr_autozoom_active:
+ attr_updated=(this_->autozoom_active != attr->u.num);
+ this_->autozoom_active = attr->u.num;
+ break;
+ case attr_center:
+ transform_from_geo(transform_get_projection(this_->trans), attr->u.coord_geo, &co);
+ dbg(1,"0x%x,0x%x\n",co.x,co.y);
+ transform_set_center(this_->trans, &co);
+ break;
+ case attr_drag_bitmap:
+ attr_updated=(this_->drag_bitmap != !!attr->u.num);
+ this_->drag_bitmap=!!attr->u.num;
+ break;
+ case attr_follow:
+ if (!this_->vehicle)
+ return 0;
+ attr_updated=(this_->vehicle->follow_curr != attr->u.num);
+ this_->vehicle->follow_curr = attr->u.num;
+ break;
+ case attr_layout:
+ if(this_->layout_current!=attr->u.layout) {
+ this_->layout_current=attr->u.layout;
+ graphics_font_destroy_all(this_->gra);
+ navit_draw(this_);
+ attr_updated=1;
+ }
+ break;
+ case attr_orientation:
+ orient_old=this_->orientation;
+ this_->orientation=attr->u.num;
+ if (!init) {
+ if (this_->orientation != -1) {
+ dir = this_->orientation;
+ } else {
+ if (this_->vehicle) {
+ dir = this_->vehicle->dir;
+ }
+ }
+ transform_set_yaw(this_->trans, dir);
+ if (orient_old != this_->orientation) {
+ if (this_->ready == 3)
+ navit_draw(this_);
+ attr_updated=1;
+ }
+ }
+ break;
+ case attr_osd_configuration:
+ dbg(0,"setting osd_configuration to %d (was %d)\n", attr->u.num, this_->osd_configuration);
+ attr_updated=(this_->osd_configuration != attr->u.num);
+ this_->osd_configuration=attr->u.num;
+ break;
+ case attr_pitch:
+ attr_updated=(this_->pitch != attr->u.num);
+ this_->pitch=attr->u.num;
+ transform_set_pitch(this_->trans, this_->pitch);
+ if (!init && attr_updated && this_->ready == 3)
+ navit_draw(this_);
+ break;
+ case attr_projection:
+ if(this_->trans && transform_get_projection(this_->trans) != attr->u.projection) {
+ navit_projection_set(this_, attr->u.projection);
+ attr_updated=1;
+ }
+ break;
+ case attr_recent_dest:
+ attr_updated=(this_->recentdest_count != attr->u.num);
+ this_->recentdest_count=attr->u.num;
+ break;
+ case attr_speech:
+ if(this_->speech && this_->speech != attr->u.speech) {
+ attr_updated=1;
+ this_->speech = attr->u.speech;
+ }
+ break;
+ case attr_timeout:
+ attr_updated=(this_->center_timeout != attr->u.num);
+ this_->center_timeout = attr->u.num;
+ break;
+ case attr_tracking:
+ attr_updated=(this_->tracking_flag != !!attr->u.num);
+ this_->tracking_flag=!!attr->u.num;
+ break;
+ case attr_use_mousewheel:
+ attr_updated=(this_->use_mousewheel != !!attr->u.num);
+ this_->use_mousewheel=!!attr->u.num;
+ break;
+ case attr_vehicle:
+ l=this_->vehicles;
+ while(l) {
+ nv=l->data;
+ if (nv->vehicle == attr->u.vehicle) {
+ if (!this_->vehicle || this_->vehicle->vehicle != attr->u.vehicle) {
+ if (this_->vehicle)
+ vehicle_set_attr(this_->vehicle->vehicle, &active, NULL);
+ active.u.num=1;
+ vehicle_set_attr(nv->vehicle, &active, NULL);
+ attr_updated=1;
+ }
+ navit_set_vehicle(this_, nv);
+ }
+ l=g_list_next(l);
+ }
+ break;
+ case attr_zoom:
+ zoom=transform_get_scale(this_->trans);
+ attr_updated=(zoom != attr->u.num);
+ transform_set_scale(this_->trans, attr->u.num);
+ if (attr_updated && !init)
+ navit_draw(this_);
+ break;
+ case attr_message:
+ navit_add_message(this_, attr->u.str);
+ break;
+ case attr_follow_cursor:
+ attr_updated=(this_->follow_cursor != !!attr->u.num);
+ this_->follow_cursor=!!attr->u.num;
+ break;
+ default:
+ return 0;
+ }
+ if (attr_updated && !init) {
+ callback_list_call_attr_2(this_->attr_cbl, attr->type, this_, attr);
+ if (attr->type == attr_osd_configuration)
+ graphics_draw_mode(this_->gra, draw_mode_end);
+ }
+ return 1;
+}
+
+int
+navit_set_attr(struct navit *this_, struct attr *attr)
+{
+ return navit_set_attr_do(this_, attr, 0);
+}
+
+int
+navit_get_attr(struct navit *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
+{
+ struct message *msg;
+ int len,offset;
+ int ret=1;
+
+ switch (type) {
+ case attr_message:
+ msg = navit_get_messages(this_);
+
+ if (!msg) {
+ return 0;
+ }
+
+ len = 0;
+ while (msg) {
+ len += strlen(msg->text) + 1;
+ msg = msg->next;
+ }
+ attr->u.str = g_malloc(len + 1);
+
+ msg = navit_get_messages(this_);
+ offset = 0;
+ while (msg) {
+ g_stpcpy((attr->u.str + offset), msg->text);
+ offset += strlen(msg->text);
+ attr->u.str[offset] = '\n';
+ offset++;
+
+ msg = msg->next;
+ }
+
+ attr->u.str[len] = '\0';
+ break;
+ case attr_bookmark_map:
+ attr->u.map=this_->bookmark;
+ break;
+ case attr_callback_list:
+ attr->u.callback_list=this_->attr_cbl;
+ break;
+ case attr_destination:
+ if (! this_->destination_valid)
+ return 0;
+ attr->u.pcoord=&this_->destination;
+ break;
+ case attr_displaylist:
+ attr->u.displaylist=this_->displaylist;
+ return (attr->u.displaylist != NULL);
+ case attr_former_destination_map:
+ attr->u.map=this_->former_destination;
+ break;
+ case attr_graphics:
+ attr->u.graphics=this_->gra;
+ ret=(attr->u.graphics != NULL);
+ break;
+ case attr_gui:
+ attr->u.gui=this_->gui;
+ ret=(attr->u.gui != NULL);
+ break;
+ case attr_layout:
+ if (iter) {
+ if (iter->u.list) {
+ iter->u.list=g_list_next(iter->u.list);
+ } else {
+ iter->u.list=this_->layouts;
+ }
+ if (!iter->u.list)
+ return 0;
+ attr->u.layout=(struct layout *)iter->u.list->data;
+ } else {
+ attr->u.layout=this_->layout_current;
+ }
+ break;
+ case attr_map:
+ if (iter && this_->mapsets) {
+ if (!iter->u.mapset_handle) {
+ iter->u.mapset_handle=mapset_open((struct mapset *)this_->mapsets->data);
+ }
+ attr->u.map=mapset_next(iter->u.mapset_handle, 0);
+ if(!attr->u.map) {
+ mapset_close(iter->u.mapset_handle);
+ return 0;
+ }
+ } else {
+ return 0;
+ }
+ break;
+ case attr_mapset:
+ attr->u.mapset=this_->mapsets->data;
+ return (attr->u.mapset != NULL);
+ case attr_navigation:
+ attr->u.navigation=this_->navigation;
+ break;
+ case attr_orientation:
+ attr->u.num=this_->orientation;
+ break;
+ case attr_osd_configuration:
+ attr->u.num=this_->osd_configuration;
+ break;
+ case attr_projection:
+ if(this_->trans) {
+ attr->u.num=transform_get_projection(this_->trans);
+ } else {
+ return 0;
+ }
+ break;
+ case attr_route:
+ attr->u.route=this_->route;
+ break;
+ case attr_speech:
+ attr->u.speech=this_->speech;
+ break;
+ case attr_tracking:
+ attr->u.num=this_->tracking_flag;
+ break;
+ case attr_transformation:
+ attr->u.transformation=this_->trans;
+ break;
+ case attr_vehicle:
+ if(iter) {
+ if(iter->u.list) {
+ iter->u.list=g_list_next(iter->u.list);
+ } else {
+ iter->u.list=this_->vehicles;
+ }
+ if(!iter->u.list)
+ return 0;
+ attr->u.vehicle=((struct navit_vehicle*)iter->u.list->data)->vehicle;
+ } else {
+ if(this_->vehicle) {
+ attr->u.vehicle=this_->vehicle->vehicle;
+ } else {
+ return 0;
+ }
+ }
+ break;
+ case attr_zoom:
+ attr->u.num=transform_get_scale(this_->trans);
+ break;
+ case attr_autozoom_active:
+ attr->u.num=this_->autozoom_active;
+ break;
+ case attr_follow_cursor:
+ attr->u.num=this_->follow_cursor;
+ break;
+ default:
+ return 0;
+ }
+ attr->type=type;
+ return ret;
+}
+
+static int
+navit_add_log(struct navit *this_, struct log *log)
+{
+ struct attr type_attr;
+ if (!log_get_attr(log, attr_type, &type_attr, NULL))
+ return 0;
+ if (!strcmp(type_attr.u.str, "textfile_debug")) {
+ char *header = "type=track_tracked\n";
+ if (this_->textfile_debug_log)
+ return 0;
+ log_set_header(log, header, strlen(header));
+ this_->textfile_debug_log=log;
+ return 1;
+ }
+ return 0;
+}
+
+int
+navit_add_attr(struct navit *this_, struct attr *attr)
+{
+ int ret=1;
+ switch (attr->type) {
+ case attr_callback:
+ navit_add_callback(this_, attr->u.callback);
+ break;
+ case attr_log:
+ ret=navit_add_log(this_, attr->u.log);
+ break;
+ case attr_gui:
+ ret=navit_set_gui(this_, attr->u.gui);
+ break;
+ case attr_graphics:
+ ret=navit_set_graphics(this_, attr->u.graphics);
+ break;
+ case attr_layout:
+ this_->layouts = g_list_append(this_->layouts, attr->u.layout);
+ if(!this_->layout_current)
+ this_->layout_current=attr->u.layout;
+ break;
+ case attr_route:
+ this_->route=attr->u.route;
+ break;
+ case attr_mapset:
+ this_->mapsets = g_list_append(this_->mapsets, attr->u.mapset);
+ break;
+ case attr_navigation:
+ this_->navigation=attr->u.navigation;
+ break;
+ case attr_recent_dest:
+ this_->recentdest_count = attr->u.num;
+ break;
+ case attr_speech:
+ this_->speech=attr->u.speech;
+ break;
+ case attr_tracking:
+ this_->tracking=attr->u.tracking;
+ break;
+ case attr_vehicle:
+ ret=navit_add_vehicle(this_, attr->u.vehicle);
+ break;
+ case attr_vehicleprofile:
+ this_->vehicleprofiles=g_list_prepend(this_->vehicleprofiles, attr->u.vehicleprofile);
+ break;
+ case attr_autozoom_min:
+ this_->autozoom_min = attr->u.num;
+ break;
+ default:
+ return 0;
+ }
+ callback_list_call_attr_2(this_->attr_cbl, attr->type, this_, attr);
+ return ret;
+}
+
+int
+navit_remove_attr(struct navit *this_, struct attr *attr)
+{
+ int ret=1;
+ switch (attr->type) {
+ case attr_callback:
+ navit_remove_callback(this_, attr->u.callback);
+ break;
+ default:
+ return 0;
+ }
+ return ret;
+}
+
+struct attr_iter *
+navit_attr_iter_new()
+{
+ return g_new0(struct attr_iter, 1);
+}
+
+void
+navit_attr_iter_destroy(struct attr_iter *iter)
+{
+ g_free(iter);
+}
+
+void
+navit_add_callback(struct navit *this_, struct callback *cb)
+{
+ callback_list_add(this_->attr_cbl, cb);
+}
+
+void
+navit_remove_callback(struct navit *this_, struct callback *cb)
+{
+ callback_list_remove(this_->attr_cbl, cb);
+}
+
+/**
+ * Toggle the cursor update : refresh the map each time the cursor has moved (instead of only when it reaches a border)
+ *
+ * @param navit The navit instance
+ * @returns nothing
+ */
+
+static void
+navit_vehicle_draw(struct navit *this_, struct navit_vehicle *nv, struct point *pnt)
+{
+ struct point cursor_pnt;
+ enum projection pro;
+ struct attr cursor;
+
+ if (this_->blocked)
+ return;
+ if (! vehicle_get_attr(nv->vehicle, attr_cursor, &cursor, NULL))
+ return;
+ if (! cursor.u.cursor)
+ return;
+ if (pnt)
+ cursor_pnt=*pnt;
+ else {
+ pro=transform_get_projection(this_->trans);
+ transform(this_->trans, pro, &nv->coord, &cursor_pnt, 1, 0, 0, NULL);
+ }
+ cursor_draw(cursor.u.cursor, this_->gra, &cursor_pnt, pnt ? 0:1, nv->dir-transform_get_yaw(this_->trans), nv->speed);
+#if 0
+ if (pnt)
+ pnt2=*pnt;
+ else {
+ pro=transform_get_projection(this_->trans);
+ transform(this_->trans, pro, &nv->coord, &pnt2, 1);
+ }
+#if 1
+ cursor_draw(nv->cursor, &pnt2, nv->dir-transform_get_angle(this_->trans, 0), nv->speed > 2, pnt == NULL);
+#else
+ cursor_draw(nv->cursor, &pnt2, nv->dir-transform_get_angle(this_->trans, 0), nv->speed > 2, 1);
+#endif
+#endif
+}
+
+static void
+navit_vehicle_update(struct navit *this_, struct navit_vehicle *nv)
+{
+ struct attr attr_valid, attr_dir, attr_speed, attr_pos;
+ struct pcoord cursor_pc;
+ struct point cursor_pnt, *pnt=&cursor_pnt;
+ struct tracking *tracking=NULL;
+ enum projection pro=transform_get_projection(this_->trans);
+ int border=16;
+ int (*get_attr)(void *, enum attr_type, struct attr *, struct attr_iter *);
+ void *attr_object;
+
+ profile(0,NULL);
+ if (this_->ready != 3) {
+ profile(0,"return 1\n");
+ return;
+ }
+ if (this_->vehicle == nv && this_->tracking_flag)
+ tracking=this_->tracking;
+ if (tracking) {
+ tracking_update(tracking, nv->vehicle, this_->vehicleprofile, pro);
+ attr_object=tracking;
+ get_attr=(int (*)(void *, enum attr_type, struct attr *, struct attr_iter *))tracking_get_attr;
+ } else {
+ attr_object=nv->vehicle;
+ get_attr=(int (*)(void *, enum attr_type, struct attr *, struct attr_iter *))vehicle_get_attr;
+ }
+ if (get_attr(attr_object, attr_position_valid, &attr_valid, NULL))
+ if (!attr_valid.u.num != attr_position_valid_invalid)
+ return;
+ if (! get_attr(attr_object, attr_position_direction, &attr_dir, NULL) ||
+ ! get_attr(attr_object, attr_position_speed, &attr_speed, NULL) ||
+ ! get_attr(attr_object, attr_position_coord_geo, &attr_pos, NULL)) {
+ profile(0,"return 2\n");
+ return;
+ }
+ nv->dir=*attr_dir.u.numd;
+ nv->speed=*attr_speed.u.numd;
+ transform_from_geo(pro, attr_pos.u.coord_geo, &nv->coord);
+ if (nv != this_->vehicle) {
+ navit_vehicle_draw(this_, nv, NULL);
+ profile(0,"return 3\n");
+ return;
+ }
+ cursor_pc.x = nv->coord.x;
+ cursor_pc.y = nv->coord.y;
+ cursor_pc.pro = pro;
+ if (this_->route) {
+ if (tracking)
+ route_set_position_from_tracking(this_->route, tracking, pro);
+ else
+ route_set_position(this_->route, &cursor_pc);
+ }
+ callback_list_call_attr_0(this_->attr_cbl, attr_position);
+ navit_textfile_debug_log(this_, "type=trackpoint_tracked");
+ if (this_->gui && nv->speed > 2)
+ gui_disable_suspend(this_->gui);
+
+ transform(this_->trans, pro, &nv->coord, &cursor_pnt, 1, 0, 0, NULL);
+ if (this_->button_pressed != 1 && this_->follow_cursor && nv->follow_curr <= nv->follow &&
+ (nv->follow_curr == 1 || !transform_within_border(this_->trans, &cursor_pnt, border)))
+ navit_set_center_cursor(this_);
+ else
+ navit_vehicle_draw(this_, nv, pnt);
+
+ if (nv->follow_curr > 1)
+ nv->follow_curr--;
+ else
+ nv->follow_curr=nv->follow;
+ callback_list_call_attr_2(this_->attr_cbl, attr_position_coord_geo, this_, nv->vehicle);
+
+ /* Finally, if we reached our destination, stop navigation. */
+ if (this_->route && route_destination_reached(this_->route)) {
+ navit_set_destination(this_, NULL, NULL, 0);
+ }
+ profile(0,"return 5\n");
+}
+
+/**
+ * Set the position of the vehicle
+ *
+ * @param navit The navit instance
+ * @param c The coordinate to set as position
+ * @returns nothing
+ */
+
+void
+navit_set_position(struct navit *this_, struct pcoord *c)
+{
+ if (this_->route) {
+ route_set_position(this_->route, c);
+ callback_list_call_attr_0(this_->attr_cbl, attr_position);
+ }
+ if (this_->ready == 3)
+ navit_draw(this_);
+}
+
+static int
+navit_set_vehicleprofile(struct navit *this_, char *name)
+{
+ struct attr attr;
+ GList *l;
+ l=this_->vehicleprofiles;
+ while (l) {
+ if (vehicleprofile_get_attr(l->data, attr_name, &attr, NULL)) {
+ if (!strcmp(attr.u.str, name)) {
+ this_->vehicleprofile=l->data;
+ if (this_->route)
+ route_set_profile(this_->route, this_->vehicleprofile);
+ return 1;
+ }
+ }
+ l=g_list_next(l);
+ }
+ return 0;
+}
+
+static void
+navit_set_vehicle(struct navit *this_, struct navit_vehicle *nv)
+{
+ struct attr attr;
+ this_->vehicle=nv;
+ if (nv && vehicle_get_attr(nv->vehicle, attr_profilename, &attr, NULL)) {
+ if (navit_set_vehicleprofile(this_, attr.u.str))
+ return;
+ }
+ navit_set_vehicleprofile(this_,"car");
+}
+
+/**
+ * Register a new vehicle
+ *
+ * @param navit The navit instance
+ * @param v The vehicle instance
+ * @returns 1 for success
+ */
+static int
+navit_add_vehicle(struct navit *this_, struct vehicle *v)
+{
+ struct navit_vehicle *nv=g_new0(struct navit_vehicle, 1);
+ struct attr follow,color,active, color2, animate;
+ nv->vehicle=v;
+ nv->follow=0;
+ nv->last.x = 0;
+ nv->last.y = 0;
+ nv->animate_cursor=0;
+ if ((vehicle_get_attr(v, attr_follow, &follow, NULL)))
+ nv->follow=nv->follow=follow.u.num;
+ if ((vehicle_get_attr(v, attr_color, &color, NULL)))
+ nv->c=*(color.u.color);
+ if ((vehicle_get_attr(v, attr_color2, &color2, NULL)))
+ nv->c2=color2.u.color;
+ else
+ nv->c2=NULL;
+ nv->follow_curr=nv->follow;
+ this_->vehicles=g_list_append(this_->vehicles, nv);
+ if ((vehicle_get_attr(v, attr_active, &active, NULL)) && active.u.num)
+ navit_set_vehicle(this_, nv);
+ if ((vehicle_get_attr(v, attr_animate, &animate, NULL)))
+ nv->animate_cursor=animate.u.num;
+ nv->callback.type=attr_callback;
+ nv->callback.u.callback=callback_new_2(callback_cast(navit_vehicle_update), this_, nv);
+ vehicle_add_attr(nv->vehicle, &nv->callback);
+ vehicle_set_attr(nv->vehicle, &this_->self, NULL);
+ return 1;
+}
+
+
+
+
+struct gui *
+navit_get_gui(struct navit *this_)
+{
+ return this_->gui;
+}
+
+struct transformation *
+navit_get_trans(struct navit *this_)
+{
+ return this_->trans;
+}
+
+struct route *
+navit_get_route(struct navit *this_)
+{
+ return this_->route;
+}
+
+struct navigation *
+navit_get_navigation(struct navit *this_)
+{
+ return this_->navigation;
+}
+
+struct displaylist *
+navit_get_displaylist(struct navit *this_)
+{
+ return this_->displaylist;
+}
+
+int
+navit_block(struct navit *this_, int block)
+{
+ if (block) {
+ this_->blocked |= 1;
+ if (graphics_draw_cancel(this_->gra, this_->displaylist))
+ this_->blocked |= 2;
+ return 0;
+ }
+ if (this_->blocked & 2) {
+ this_->blocked=0;
+ navit_draw(this_);
+ return 1;
+ }
+ this_->blocked=0;
+ return 0;
+}
+
+void
+navit_destroy(struct navit *this_)
+{
+ /* TODO: destroy objects contained in this_ */
+ if (this_->vehicle)
+ vehicle_destroy(this_->vehicle->vehicle);
+ main_remove_navit(this_);
+ char *center_file = navit_get_center_file(TRUE);
+ navit_write_center_to_file(this_, center_file);
+ g_free(center_file);
+ callback_destroy(this_->nav_speech_cb);
+ callback_destroy(this_->roadbook_callback);
+ callback_destroy(this_->popup_callback);
+ callback_destroy(this_->motion_timeout_callback);
+ if(this_->gra)
+ graphics_remove_callback(this_->gra, this_->resize_callback);
+ callback_destroy(this_->resize_callback);
+ if(this_->gra)
+ graphics_remove_callback(this_->gra, this_->button_callback);
+ callback_destroy(this_->button_callback);
+ if(this_->gra)
+ graphics_remove_callback(this_->gra, this_->motion_callback);
+ callback_destroy(this_->motion_callback);
+ g_free(this_);
+}
+
+/** @} */
diff --git a/navit.dtd b/navit.dtd
new file mode 100644
index 00000000..4abbabce
--- /dev/null
+++ b/navit.dtd
@@ -0,0 +1,93 @@
+<!ELEMENT config (plugins,debug*,navit)>
+<!ATTLIST config xmlns:xi CDATA #REQUIRED>
+<!ELEMENT plugins (plugin*)>
+<!ELEMENT plugin EMPTY>
+<!ATTLIST plugin path CDATA #REQUIRED>
+<!ATTLIST plugin active CDATA #IMPLIED>
+<!ELEMENT debug EMPTY>
+<!ATTLIST debug name CDATA #REQUIRED>
+<!ATTLIST debug level CDATA "0">
+<!ELEMENT navit (gui,graphics,vehicle*,tracking,route,navigation,speech,mapset+,layout+)>
+<!ATTLIST navit center CDATA #REQUIRED>
+<!ATTLIST navit zoom CDATA #REQUIRED>
+<!ATTLIST navit tracking CDATA #REQUIRED>
+<!ATTLIST navit cursor CDATA #REQUIRED>
+<!ATTLIST navit orientation CDATA #REQUIRED>
+<!ATTLIST navit recent_dest CDATA #IMPLIED>
+<!ELEMENT gui EMPTY>
+<!ATTLIST gui type CDATA #REQUIRED>
+<!ATTLIST gui menubar CDATA #IMPLIED>
+<!ATTLIST gui toolbar CDATA #IMPLIED>
+<!ATTLIST gui statusbar CDATA #IMPLIED>
+<!ATTLIST gui skin CDATA #IMPLIED>
+<!ATTLIST gui fullscreen CDATA #IMPLIED>
+<!ELEMENT graphics EMPTY>
+<!ATTLIST graphics type CDATA #REQUIRED>
+<!ELEMENT vehicle (cursor)>
+<!ATTLIST vehicle name CDATA #REQUIRED>
+<!ATTLIST vehicle source CDATA #REQUIRED>
+<!ATTLIST vehicle color CDATA #REQUIRED>
+<!ATTLIST vehicle enabled CDATA #IMPLIED>
+<!ATTLIST vehicle active CDATA #IMPLIED>
+<!ATTLIST vehicle follow CDATA #IMPLIED>
+<!ATTLIST vehicle update CDATA #IMPLIED>
+<!ATTLIST vehicle gpsd_query CDATA #IMPLIED>
+<!ELEMENT cursor EMPTY>
+<!ELEMENT tracking ANY>
+<!ELEMENT route (speed+)>
+<!ELEMENT speed EMPTY>
+<!ATTLIST speed type CDATA #REQUIRED>
+<!ATTLIST speed value CDATA #REQUIRED>
+<!ELEMENT navigation (announce+)>
+<!ELEMENT announce EMPTY>
+<!ATTLIST announce type CDATA #REQUIRED>
+<!ATTLIST announce level0 CDATA #IMPLIED>
+<!ATTLIST announce level1 CDATA #IMPLIED>
+<!ATTLIST announce level2 CDATA #IMPLIED>
+<!ATTLIST announce unit CDATA #REQUIRED>
+<!ELEMENT speech EMPTY>
+<!ATTLIST speech type CDATA #REQUIRED>
+<!ATTLIST speech data CDATA #REQUIRED>
+<!ELEMENT mapset (map+)>
+<!ATTLIST mapset enabled CDATA #IMPLIED>
+<!ELEMENT map EMPTY>
+<!ATTLIST map type CDATA #REQUIRED>
+<!ATTLIST map enabled CDATA #IMPLIED>
+<!ATTLIST map active CDATA #IMPLIED>
+<!ATTLIST map data CDATA #REQUIRED>
+<!ATTLIST map debug CDATA #IMPLIED>
+<!ELEMENT layout (layer*)>
+<!ATTLIST layout name CDATA #REQUIRED>
+<!ATTLIST layout color CDATA #IMPLIED>
+<!ATTLIST layout font CDATA #IMPLIED>
+<!ELEMENT layer (itemgra+)>
+<!ATTLIST layer name CDATA #IMPLIED>
+<!ATTLIST layer details CDATA #IMPLIED>
+<!ELEMENT itemgra (polygon|polyline|text|circle|icon|image|arrows)*>
+<!ATTLIST itemgra item_types CDATA #IMPLIED>
+<!ATTLIST itemgra order CDATA #IMPLIED>
+<!ATTLIST itemgra speed_range CDATA #IMPLIED>
+<!ELEMENT polygon EMPTY>
+<!ATTLIST polygon color CDATA #REQUIRED>
+<!ELEMENT polyline EMPTY>
+<!ATTLIST polyline color CDATA #REQUIRED>
+<!ATTLIST polyline width CDATA #IMPLIED>
+<!ATTLIST polyline dash CDATA #IMPLIED>
+<!ATTLIST polyline offset CDATA #IMPLIED>
+<!ELEMENT text EMPTY>
+<!ATTLIST text text_size CDATA #REQUIRED>
+<!ATTLIST text color CDATA #IMPLIED>
+<!ELEMENT circle EMPTY>
+<!ATTLIST circle color CDATA #REQUIRED>
+<!ATTLIST circle radius CDATA #REQUIRED>
+<!ATTLIST circle width CDATA #IMPLIED>
+<!ATTLIST circle text_size CDATA #IMPLIED>
+<!ELEMENT icon EMPTY>
+<!ATTLIST icon src CDATA #REQUIRED>
+<!ATTLIST icon w CDATA #IMPLIED>
+<!ATTLIST icon h CDATA #IMPLIED>
+<!ELEMENT arrows EMPTY>
+<!ATTLIST arrows color CDATA #REQUIRED>
+<!ATTLIST arrows width CDATA #IMPLIED>
+<!ELEMENT image EMPTY>
+
diff --git a/navit.h b/navit.h
new file mode 100644
index 00000000..665f4e48
--- /dev/null
+++ b/navit.h
@@ -0,0 +1,111 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_NAVIT_H
+#define NAVIT_NAVIT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern struct gui *main_loop_gui;
+/* prototypes */
+enum attr_type;
+struct attr;
+struct attr_iter;
+struct callback;
+struct displaylist;
+struct graphics;
+struct gui;
+struct mapset;
+struct message;
+struct navigation;
+struct navit;
+struct pcoord;
+struct point;
+struct route;
+struct tracking;
+struct transformation;
+struct vehicleprofile;
+
+// defined in glib.h.
+#ifndef __G_LIST_H__
+struct _GList;
+typedef struct _GList GList;
+#endif
+
+void navit_add_mapset(struct navit *this_, struct mapset *ms);
+struct mapset *navit_get_mapset(struct navit *this_);
+struct tracking *navit_get_tracking(struct navit *this_);
+void navit_draw(struct navit *this_);
+void navit_draw_displaylist(struct navit *this_);
+void navit_handle_resize(struct navit *this_, int w, int h);
+int navit_get_width(struct navit *this_);
+int navit_get_height(struct navit *this_);
+int navit_ignore_button(struct navit *this_);
+void navit_ignore_graphics_events(struct navit *this_, int ignore);
+int navit_handle_button(struct navit *this_, int pressed, int button, struct point *p, struct callback *popup_callback);
+void navit_handle_motion(struct navit *this_, struct point *p);
+void navit_zoom_in(struct navit *this_, int factor, struct point *p);
+void navit_zoom_out(struct navit *this_, int factor, struct point *p);
+struct navit *navit_new(struct attr *parent, struct attr **attrs);
+void navit_add_message(struct navit *this_, char *message);
+struct message *navit_get_messages(struct navit *this_);
+struct graphics *navit_get_graphics(struct navit *this_);
+struct vehicleprofile *navit_get_vehicleprofile(struct navit *this_);
+
+//! Returns a list of 'struct vehicleprofile *'
+GList *navit_get_vehicleprofiles(struct navit *this_);
+
+void navit_set_destination(struct navit *this_, struct pcoord *c, const char *description, int async);
+int navit_check_route(struct navit *this_);
+void navit_add_bookmark(struct navit *this_, struct pcoord *c, const char *description);
+void navit_textfile_debug_log(struct navit *this_, const char *fmt, ...);
+int navit_speech_estimate(struct navit *this_, char *str);
+void navit_say(struct navit *this_, char *text);
+void navit_announcer_toggle(struct navit *this_);
+void navit_speak(struct navit *this_);
+void navit_window_roadbook_destroy(struct navit *this_);
+void navit_window_roadbook_new(struct navit *this_);
+void navit_init(struct navit *this_);
+void navit_zoom_to_route(struct navit *this_, int orientation);
+void navit_set_center(struct navit *this_, struct pcoord *center, int set_timeout);
+void navit_set_center_screen(struct navit *this_, struct point *p, int set_timeout);
+int navit_set_attr(struct navit *this_, struct attr *attr);
+int navit_get_attr(struct navit *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
+int navit_add_attr(struct navit *this_, struct attr *attr);
+int navit_remove_attr(struct navit *this_, struct attr *attr);
+struct attr_iter *navit_attr_iter_new(void);
+void navit_attr_iter_destroy(struct attr_iter *iter);
+void navit_add_callback(struct navit *this_, struct callback *cb);
+void navit_remove_callback(struct navit *this_, struct callback *cb);
+void navit_set_position(struct navit *this_, struct pcoord *c);
+struct gui *navit_get_gui(struct navit *this_);
+struct transformation *navit_get_trans(struct navit *this_);
+struct route *navit_get_route(struct navit *this_);
+struct navigation *navit_get_navigation(struct navit *this_);
+struct displaylist *navit_get_displaylist(struct navit *this_);
+int navit_block(struct navit *this_, int block);
+void navit_destroy(struct navit *this_);
+/* end of prototypes */
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/navit.xml b/navit.xml
new file mode 100644
index 00000000..bbf9c1af
--- /dev/null
+++ b/navit.xml
@@ -0,0 +1,4490 @@
+<?xml version="1.0"?>
+<!DOCTYPE config SYSTEM "navit.dtd">
+<!-- For configuration options used in this file, please read
+ http://wiki.navit-project.org/index.php/Configuring_NavIt
+ Do not edit /usr/share/navit/navit.xml : changes would be lost
+ on upgrade. Rather copy it to ~/.navit/. Please read wiki -->
+<config xmlns:xi="http://www.w3.org/2001/XInclude">
+ <plugins>
+ <plugin path="$NAVIT_LIBDIR/*/${NAVIT_LIBPREFIX}lib*.so" ondemand="yes"/>
+ <plugin path="$NAVIT_LIBDIR/autoload/${NAVIT_LIBPREFIX}lib*.so"/>
+ <plugin path="$NAVIT_LIBDIR/*/${NAVIT_LIBPREFIX}libbinding_dbus.so" active="no"/>
+ <plugin path="$NAVIT_LIBDIR/*/${NAVIT_LIBPREFIX}libgraphics_null.so" active="no"/>
+ </plugins>
+
+ <debug name="navit:do_draw" level="0"/>
+ <!-- This is here so one can copy&paste the contents of popup menus -->
+ <debug name="navit:popup_printf_cb" level="0"/>
+ <!-- segv: 1 - show backtrace with gdb and exit, 2 - stay in gdb -->
+ <debug name="segv" level="1"/>
+ <!-- timestamps 0/1 - prefix log messages with a timestamp -->
+ <debug name="timestamps" level="0"/>
+ <!-- This line defines which location on the map navit will show after startup.
+ It makes sense to set it to your home coordinates.
+ Center coordinates format:
+ [D][D]DMM.ss[S][S]... N/S [D][D]DMM.ss[S][S]... E/W
+ [-][D]D.d[d]... [-][D][D]D.d[d]...
+ [-]0xX [-]0xX -->
+
+ <navit center="4808 N 1134 E" zoom="256" tracking="1" cursor="1" orientation="-1" recent_dest="10">
+ <!-- Use one of gtk_drawing_area, qt_qpainter or sdl. For cegui, use opengl -->
+ <graphics type="gtk_drawing_area"/>
+ <!-- The following line let you select which graphical user interface you'd like to use.
+ Options include internal (optimized for touch screen devices), gtk (useful for desktop computers) and cegui.
+ In case of the internal GUI, you can even influence the size of the text and of the icons in the toolbar and the viewport.
+ Here's an example for a freerunner: -->
+ <!-- <gui type="internal" font_size="350" icon_xs="32" icon_s="96" icon_l="96"/> -->
+ <!-- Normally it is sufficient to use -->
+ <!-- <gui type="internal" /> -->
+
+ <gui type="gtk" menubar="1" toolbar="1" statusbar="1"/>
+
+ <!-- for a debug log -->
+ <log enabled="no" type="textfile_debug" data="debug_%Y%m%d-%i.txt" flush_size="1000" flush_time="30"/>
+ <!-- osd items allow to position display and control items directly on top of the map: -->
+ <osd enabled="no" type="compass"/>
+ <osd enabled="no" type="eta"/>
+ <osd enabled="no" type="navigation_distance_to_target"/>
+ <osd enabled="no" type="navigation"/>
+ <osd enabled="no" type="navigation_distance_to_next"/>
+ <osd enabled="no" type="navigation_next_turn"/>
+
+ <!-- Commands include gui_internal_menu, gui_internal_fullscreen, zoom_in and zoom_out.
+ Usage of negative values change the button origins. x="0" y="0" specifies the top left, x="-0" y="-0" the bottom right corner.
+ It's always the top left corner of the icon, so you need to consider the icon's size when you enter the values. -->
+ <osd enabled="no" type="button" x="0" y="0" command="gui.fullscreen()" src="toggle_fullscreen.xpm"/>
+ <osd enabled="no" type="button" x="-96" y="0" command="gui.menu()" src="menu.xpm"/>
+ <osd enabled="no" type="button" x="-96" y="-96" command="zoom_in()" src="zoom_in.xpm"/>
+ <osd enabled="no" type="button" x="0" y="-96" command="zoom_out()" src="zoom_out.xpm"/>
+
+ <vehicle name="Local GPS" profilename="car" enabled="yes" active="1" source="gpsd://localhost" gpsd_query="w+xj" color="#0000ff">
+ <!-- Navit can write a tracklog in several formats (gpx, nmea or textfile): -->
+ <!-- <log type="gpx" data="track_%Y%m%d-%i.gpx" flush_size="1000" flush_time="30"/> -->
+ <cursor w="26" h="26">
+ <itemgra>
+ <circle color="#0000ff" radius="24" width="2">
+ <coord x="0" y="0"/>
+ </circle>
+ </itemgra>
+ <itemgra speed_range="-2">
+ <polyline color="#0000ff" width="2">
+ <coord x="0" y="0"/>
+ <coord x="0" y="0"/>
+ </polyline>
+ </itemgra>
+ <itemgra speed_range="3-">
+ <polyline color="#0000ff" width="2">
+ <coord x="-7" y="-10"/>
+ <coord x="0" y="12"/>
+ <coord x="7" y="-10"/>
+ </polyline>
+ </itemgra>
+ </cursor>
+ </vehicle>
+
+ <!-- For SDL, you should add follow="1" to have the view centered on your position -->
+ <!-- <vehicle name="Meins" enabled="yes" source="gpsd://localhost" color="#0000ff" follow="1"/> -->
+
+ <vehicle name="Demo" profilename="car" enabled="no" active="yes" source="demo://">
+ <cursor w="26" h="26">
+ <itemgra>
+ <circle color="#0000ff" radius="24" width="2">
+ <coord x="0" y="0"/>
+ </circle>
+ </itemgra>
+ <itemgra speed_range="-2">
+ <polyline color="#0000ff" width="2">
+ <coord x="0" y="0"/>
+ <coord x="0" y="0"/>
+ </polyline>
+ </itemgra>
+ <itemgra speed_range="3-">
+ <polyline color="#0000ff" width="2">
+ <coord x="-7" y="-10"/>
+ <coord x="0" y="12"/>
+ <coord x="7" y="-10"/>
+ </polyline>
+ </itemgra>
+ </cursor>
+ </vehicle>
+
+ <!-- For the cumulative displacement filter to be enabled, set cdf_histsize="x" here, with x being an integer somewhere around 4 -->
+ <tracking cdf_histsize="0"/>
+
+ <vehicleprofile name="car" flags="0x4000000" flags_forward_mask="0x4000002" flags_reverse_mask="0x4000001" maxspeed_handling="0" route_mode="0">
+ <roadprofile item_types="street_0,street_1_city,living_street,street_service,track_gravelled,track_unpaved" speed="10" route_weight="10">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <roadprofile item_types="street_2_city,track_paved" speed="30" route_weight="30">
+ <announcement level="0" distance_metric="50"/>
+ <announcement level="1" distance_metric="200"/>
+ <announcement level="2" distance_metric="500"/>
+ </roadprofile>
+ <roadprofile item_types="street_3_city" speed="40" route_weight="40">
+ <announcement level="0" distance_metric="50"/>
+ <announcement level="1" distance_metric="200"/>
+ <announcement level="2" distance_metric="500"/>
+ </roadprofile>
+ <roadprofile item_types="street_4_city" speed="50" route_weight="50">
+ <announcement level="0" distance_metric="50"/>
+ <announcement level="1" distance_metric="200"/>
+ <announcement level="2" distance_metric="500"/>
+ </roadprofile>
+ <roadprofile item_types="highway_city" speed="80" route_weight="80">
+ <announcement level="0" distance_metric="100"/>
+ <announcement level="1" distance_metric="400"/>
+ <announcement level="2" distance_metric="1000"/>
+ </roadprofile>
+ <roadprofile item_types="street_1_land" speed="60" route_weight="60">
+ <announcement level="0" distance_metric="100"/>
+ <announcement level="1" distance_metric="400"/>
+ <announcement level="2" distance_metric="1000"/>
+ </roadprofile>
+ <roadprofile item_types="street_2_land" speed="65" route_weight="65">
+ <announcement level="0" distance_metric="100"/>
+ <announcement level="1" distance_metric="400"/>
+ <announcement level="2" distance_metric="1000"/>
+ </roadprofile>
+ <roadprofile item_types="street_3_land" speed="70" route_weight="70">
+ <announcement level="0" distance_metric="100"/>
+ <announcement level="1" distance_metric="400"/>
+ <announcement level="2" distance_metric="1000"/>
+ </roadprofile>
+ <roadprofile item_types="street_4_land" speed="80" route_weight="80">
+ <announcement level="0" distance_metric="100"/>
+ <announcement level="1" distance_metric="400"/>
+ <announcement level="2" distance_metric="1000"/>
+ </roadprofile>
+ <roadprofile item_types="street_n_lanes" speed="120" route_weight="120">
+ <announcement level="0" distance_metric="300"/>
+ <announcement level="1" distance_metric="1000"/>
+ <announcement level="2" distance_metric="2000"/>
+ </roadprofile>
+ <roadprofile item_types="highway_land" speed="120" route_weight="120">
+ <announcement level="0" distance_metric="300"/>
+ <announcement level="1" distance_metric="1000"/>
+ <announcement level="2" distance_metric="2000"/>
+ </roadprofile>
+ <roadprofile item_types="ramp" speed="40" route_weight="40">
+ <announcement level="0" distance_metric="50"/>
+ <announcement level="1" distance_metric="200"/>
+ <announcement level="2" distance_metric="500"/>
+ </roadprofile>
+ <roadprofile item_types="roundabout" speed="10" route_weight="10"/>
+ <roadprofile item_types="ferry" speed="40" route_weight="40"/>
+ </vehicleprofile>
+
+ <vehicleprofile name="bike" flags="0x40000000" flags_forward_mask="0x40000000" flags_reverse_mask="0x40000000" maxspeed_handling="1" route_mode="0">
+ <roadprofile item_types="steps" speed="2" route_weight="5">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <roadprofile item_types="street_pedestrian,footway" speed="5" route_weight="10">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <roadprofile item_types="path,track_ground" speed="12" route_weight="12">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <roadprofile item_types="track_gravelled" speed="17" route_weight="15">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <!-- cycleways, paved tracks, serviceways etc. are the favourite ways -->
+ <roadprofile item_types="track_paved,cycleway,street_service,street_parking_lane" speed="22" route_weight="20">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <!-- residential, unclassified, living street etc. -->
+ <roadprofile item_types="street_0,street_1_city,living_street" speed="20" route_weight="15">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <!-- tertiary and minor roads are acceptable, but should be avoided in favour of tracks and cycleways -->
+ <roadprofile item_types="street_2_city,street_1_land,street_2_land" speed="22" route_weight="12">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <!-- secondary etc. are acceptable when necessary -->
+ <roadprofile item_types="street_3_city" speed="22" route_weight="10">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <!-- primary, trunk etc. should be avoided -->
+ <roadprofile item_types="street_4_city,ramp" speed="22" route_weight="7">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <!-- Those types do not appear in osm2navit.c and therefore are not used ATM -->
+ <roadprofile item_types="street_3_land,street_4_land" speed="20" route_weight="7">
+ <announcement level="0" distance_metric="100"/>
+ <announcement level="1" distance_metric="400"/>
+ <announcement level="2" distance_metric="1000"/>
+ </roadprofile>
+ <roadprofile item_types="roundabout" speed="20" route_weight="10"/>
+ <roadprofile item_types="ferry" speed="40" route_weight="40"/>
+ </vehicleprofile>
+
+ <vehicleprofile name="pedestrian" flags="0x20000000" flags_forward_mask="0x20000000" flags_reverse_mask="0x20000000" maxspeed_handling="1" route_mode="0">
+ <roadprofile item_types="footway,bridleway,path" speed="5" route_weight="5">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <roadprofile item_types="living_street,street_pedestrian" speed="5" route_weight="5">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <roadprofile item_types="track_gravelled" speed="5" route_weight="5">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <roadprofile item_types="track_paved" speed="5" route_weight="5">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <roadprofile item_types="cycleway" speed="5" route_weight="5">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <roadprofile item_types="street_0,street_1_city,street_2_city" speed="5" route_weight="5">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <roadprofile item_types="street_3_city,street_4_city,street_service" speed="5" route_weight="5">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <roadprofile item_types="street_1_land,street_2_land" speed="5" route_weight="5">
+ <announcement level="0" distance_metric="100"/>
+ <announcement level="1" distance_metric="400"/>
+ <announcement level="2" distance_metric="1000"/>
+ </roadprofile>
+ <roadprofile item_types="street_3_land,street_4_land" speed="5" route_weight="5">
+ <announcement level="0" distance_metric="100"/>
+ <announcement level="1" distance_metric="400"/>
+ <announcement level="2" distance_metric="1000"/>
+ </roadprofile>
+ <roadprofile item_types="roundabout" speed="5" route_weight="5"/>
+ <roadprofile item_types="ferry" speed="40" route_weight="40"/>
+ </vehicleprofile>
+ <vehicleprofile name="horse" flags="0x80000000" flags_forward_mask="0x80000000" flags_reverse_mask="0x80000000" maxspeed_handling="1" route_mode="0">
+ <roadprofile item_types="bridleway" speed="10" route_weight="10">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <roadprofile item_types="footway,path" speed="5" route_weight="5">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <roadprofile item_types="living_street,street_pedestrian" speed="5" route_weight="4">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <roadprofile item_types="track_gravelled" speed="5" route_weight="5">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <roadprofile item_types="track_paved" speed="5" route_weight="5">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <roadprofile item_types="cycleway" speed="5" route_weight="5">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <roadprofile item_types="street_0,street_1_city,street_2_city" speed="5" route_weight="2">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <roadprofile item_types="street_3_city,street_4_city,street_service" speed="5" route_weight="4">
+ <announcement level="0" distance_metric="25"/>
+ <announcement level="1" distance_metric="100"/>
+ <announcement level="2" distance_metric="200"/>
+ </roadprofile>
+ <roadprofile item_types="street_1_land,street_2_land" speed="5" route_weight="2">
+ <announcement level="0" distance_metric="100"/>
+ <announcement level="1" distance_metric="400"/>
+ <announcement level="2" distance_metric="1000"/>
+ </roadprofile>
+ <roadprofile item_types="street_3_land,street_4_land" speed="5" route_weight="4">
+ <announcement level="0" distance_metric="100"/>
+ <announcement level="1" distance_metric="400"/>
+ <announcement level="2" distance_metric="1000"/>
+ </roadprofile>
+ <roadprofile item_types="roundabout" speed="5" route_weight="2"/>
+ <roadprofile item_types="ferry" speed="40" route_weight="40"/>
+ </vehicleprofile>
+
+ <route destination_distance="50"/>
+
+ <navigation>
+ <announce type="street_0,street_1_city" level0="25" level1="100" level2="200" unit="m"/>
+ <announce type="street_2_city,street_3_city,street_4_city,ramp" level0="50" level1="200" level2="500" unit="m"/>
+ <announce type="highway_city,street_1_land,street_2_land,street_3_land,street_4_land" level0="100" level1="400" level2="1000" unit="m"/>
+ <announce type="street_n_lanes,highway_land" level0="300" level1="1000" level2="2000" unit="m"/>
+ </navigation>
+
+ <!-- Navit provides speech output in text format.
+ If you have a speech synthesizer like festival lite installed, you can get turn by turn directions out of navit. Please set the "cps"-value to how many characters your tts engine approximately speaks per second.
+ The default is text output to the shell -->
+ <speech type="cmdline" data="echo 'Fix the speech tag in navit.xml to let navit say:' '%s'" cps="15"/>
+ <!-- <speech type="cmdline" data="flite -t '%s'"/> -->
+
+ <!-- If you have the reiseplaner maps installed, set enabled="yes" in the next line and set the path correctly -->
+ <mapset enabled="no">
+ <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map"/>
+ <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp1.smp"/>
+ <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp2.smp"/>
+ <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp3.smp"/>
+ <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp4.smp"/>
+ <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp5.smp"/>
+ </mapset>
+
+ <!-- If you dont want to use the sample map, either set enabled="no" in the next line or remove the xml file from the maps directory -->
+ <mapset enabled="yes">
+ <xi:include href="$NAVIT_SHAREDIR/maps/*.xml"/>
+ </mapset>
+
+ <!-- Mapset template for openstreetmaps -->
+ <mapset enabled="no">
+ <map type="binfile" enabled="yes" data="/media/mmc2/MapsNavit/osm_europe.bin"/>
+ </mapset>
+
+ <!-- Mapset template for garmin maps -->
+ <mapset enabled="no">
+ <map type="garmin" enabled="yes" data="/path/to/img" debug="4"/>
+ </mapset>
+
+ <layout name="Car" color="#ffefb7" font="Liberation Sans">
+ <layer name="polygons">
+ <itemgra item_types="image" order="0-">
+ <image/>
+ </itemgra>
+ <itemgra item_types="poly_wood" order="0-">
+ <polygon color="#8ec78d"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_farm" order="0-">
+ <polygon color="#c7f1a3"/>
+ <polyline color="#79c691"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_town" order="0-">
+ <polygon color="#ffc895"/>
+ <polyline color="#ebb481"/>
+ </itemgra>
+ <itemgra item_types="poly_university" order="8-">
+ <polygon color="#d68fb8"/>
+ <polyline color="#881155"/>
+ </itemgra>
+ <itemgra item_types="poly_water" order="0-">
+ <polygon color="#82c8ea"/>
+ <polyline color="#5096b8"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_land" order="0-">
+ <polygon color="#ffefb7"/>
+ <polyline color="#ffefb7"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_flats,poly_scrub,poly_military_zone,poly_marine,plantation,tundra" order="9-">
+ <polygon color="#a0a0a0"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_park" order="0-">
+ <polygon color="#7cc334"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_pedestrian" order="10">
+ <polyline color="#d2d2d2" width="3"/>
+ <polyline color="#dddddd" width="1"/>
+ <polygon color="#dddddd"/>
+ </itemgra>
+ <itemgra item_types="poly_pedestrian" order="11">
+ <polyline color="#d2d2d2" width="5"/>
+ <polyline color="#dddddd" width="3"/>
+ <polygon color="#dddddd"/>
+ </itemgra>
+ <itemgra item_types="poly_pedestrian" order="12">
+ <polyline color="#d2d2d2" width="8"/>
+ <polyline color="#dddddd" width="6"/>
+ <polygon color="#dddddd"/>
+ </itemgra>
+ <itemgra item_types="poly_pedestrian" order="13">
+ <polyline color="#d2d2d2" width="9"/>
+ <polyline color="#dddddd" width="7"/>
+ <polygon color="#dddddd"/>
+ </itemgra>
+ <itemgra item_types="poly_pedestrian" order="14">
+ <polyline color="#d2d2d2" width="13"/>
+ <polyline color="#dddddd" width="9"/>
+ <polygon color="#dddddd"/>
+ </itemgra>
+ <itemgra item_types="poly_pedestrian" order="15">
+ <polyline color="#d2d2d2" width="18"/>
+ <polyline color="#dddddd" width="14"/>
+ <polygon color="#dddddd"/>
+ </itemgra>
+ <itemgra item_types="poly_pedestrian" order="16">
+ <polyline color="#d2d2d2" width="21"/>
+ <polyline color="#dddddd" width="17"/>
+ <polygon color="#dddddd"/>
+ </itemgra>
+ <itemgra item_types="poly_pedestrian" order="17">
+ <polyline color="#d2d2d2" width="25"/>
+ <polyline color="#dddddd" width="21"/>
+ <polygon color="#dddddd"/>
+ </itemgra>
+ <itemgra item_types="poly_pedestrian" order="18">
+ <polyline color="#d2d2d2" width="40"/>
+ <polyline color="#dddddd" width="34"/>
+ <polygon color="#dddddd"/>
+ </itemgra>
+ <itemgra item_types="poly_airport" order="0-">
+ <polygon color="#a0a0a0"/>
+ </itemgra>
+ <itemgra item_types="poly_sport,poly_sports_pitch" order="0-">
+ <polygon color="#4af04f"/>
+ </itemgra>
+ <itemgra item_types="poly_industry,poly_place" order="0-">
+ <polygon color="#e6e6e6"/>
+ </itemgra>
+ <itemgra item_types="poly_service" order="8-18">
+ <polygon color="#fefefe"/>
+ <polyline color="#d2d2d2" width="1"/>
+ </itemgra>
+ <itemgra item_types="poly_street_1" order="8-13">
+ <polygon color="#ffffff"/>
+ <polyline color="#d2d2d2" width="1"/>
+ </itemgra>
+ <itemgra item_types="poly_street_1" order="14-16">
+ <polygon color="#ffffff"/>
+ <polyline color="#d2d2d2" width="2"/>
+ </itemgra>
+ <itemgra item_types="poly_street_1" order="17-18">
+ <polygon color="#ffffff"/>
+ <polyline color="#d2d2d2" width="3"/>
+ </itemgra>
+ <itemgra item_types="poly_street_2" order="7-12">
+ <polygon color="#ffff00"/>
+ <polyline color="#c0c0c0" width="1"/>
+ </itemgra>
+ <itemgra item_types="poly_street_2" order="13-16">
+ <polygon color="#ffff00"/>
+ <polyline color="#c0c0c0" width="2"/>
+ </itemgra>
+ <itemgra item_types="poly_street_2" order="17-18">
+ <polygon color="#ffff00"/>
+ <polyline color="#c0c0c0" width="3"/>
+ </itemgra>
+ <itemgra item_types="poly_street_3" order="7-11">
+ <polygon color="#ffff00"/>
+ <polyline color="#a0a0a0" width="1"/>
+ </itemgra>
+ <itemgra item_types="poly_street_3" order="12-15">
+ <polygon color="#ffff00"/>
+ <polyline color="#a0a0a0" width="2"/>
+ </itemgra>
+ <itemgra item_types="poly_street_3" order="16-18">
+ <polygon color="#ffff00"/>
+ <polyline color="#a0a0a0" width="3"/>
+ </itemgra>
+ <itemgra item_types="water_line" order="0-">
+ <polyline color="#5096b8" width="1"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="water_river" order="4-5">
+ <polyline color="#82c8ea" width="1"/>
+ </itemgra>
+ <itemgra item_types="water_river" order="6">
+ <polyline color="#82c8ea" width="2"/>
+ </itemgra>
+ <itemgra item_types="water_river" order="7">
+ <polyline color="#82c8ea" width="3"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="water_river" order="8-9">
+ <polyline color="#82c8ea" width="4"/>
+ <text text_size="7"/>
+ </itemgra>
+ <itemgra item_types="water_river" order="10-">
+ <polyline color="#82c8ea" width="4"/>
+ <text text_size="10"/>
+ </itemgra>
+ <itemgra item_types="water_canal" order="6">
+ <polyline color="#82c8ea" width="1"/>
+ </itemgra>
+ <itemgra item_types="water_canal" order="7">
+ <polyline color="#82c8ea" width="2"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="water_canal" order="8-9">
+ <polyline color="#82c8ea" width="3"/>
+ <text text_size="7"/>
+ </itemgra>
+ <itemgra item_types="water_canal" order="10-">
+ <polyline color="#82c8ea" width="3"/>
+ <text text_size="10"/>
+ </itemgra>
+ <itemgra item_types="water_stream" order="8-9">
+ <polyline color="#82c8ea" width="1"/>
+ </itemgra>
+ <itemgra item_types="water_stream" order="10-">
+ <polyline color="#82c8ea" width="2"/>
+ <text text_size="7"/>
+ </itemgra>
+ <itemgra item_types="water_drain" order="10-">
+ <polyline color="#82c8ea" width="1"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_apron" order="0-">
+ <polygon color="#d0d0d0"/>
+ </itemgra>
+ <itemgra item_types="poly_terminal" order="7-">
+ <polygon color="#e3c6a6"/>
+ </itemgra>
+ <itemgra item_types="poly_cemetery" order="1-">
+ <polygon color="#bde3cb"/>
+ </itemgra>
+ <itemgra item_types="poly_car_parking" order="1-">
+ <polygon color="#e7cf87"/>
+ </itemgra>
+ <itemgra item_types="poly_building" order="0-">
+ <polygon color="#b6a6a6"/>
+ </itemgra>
+ <itemgra item_types="rail" order="6-">
+ <polyline color="#696969" width="3"/>
+ <polyline color="#ffffff" width="1" dash="5,5"/>
+ </itemgra>
+ <itemgra item_types="ferry" order="5-">
+ <polyline color="#000000" width="1" dash="10"/>
+ </itemgra>
+ <itemgra item_types="border_country" order="0-">
+ <polyline color="#b8434e" width="1" dash="10,5,2,5"/>
+ </itemgra>
+ <itemgra item_types="border_state" order="0-">
+ <polyline color="#808080" width="1"/>
+ </itemgra>
+ <itemgra item_types="height_line_1" order="0-">
+ <polyline color="#000000" width="4"/>
+ </itemgra>
+ <itemgra item_types="height_line_2" order="0-">
+ <polyline color="#000000" width="2"/>
+ </itemgra>
+ <itemgra item_types="height_line_3" order="0-">
+ <polyline color="#000000" width="1"/>
+ </itemgra>
+ </layer>
+ <layer name="streets">
+ <itemgra item_types="street_route" order="2">
+ <polyline color="#0000a0" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="3-5">
+ <polyline color="#0000a0" width="8"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="6">
+ <polyline color="#0000a0" width="10"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="7-8">
+ <polyline color="#0000a0" width="16"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="9-10">
+ <polyline color="#0000a0" width="20"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="11">
+ <polyline color="#0000a0" width="28"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="12">
+ <polyline color="#0000a0" width="32"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="13">
+ <polyline color="#0000a0" width="52"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="14">
+ <polyline color="#0000a0" width="64"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="15">
+ <polyline color="#0000a0" width="68"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="16">
+ <polyline color="#0000a0" width="132"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="17">
+ <polyline color="#0000a0" width="268"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="18">
+ <polyline color="#0000a0" width="530"/>
+ </itemgra>
+ <itemgra item_types="selected_line" order="2">
+ <polyline color="#ba00b8" width="4"/>
+ </itemgra>
+ <itemgra item_types="selected_line" order="3-5">
+ <polyline color="#ba00b8" width="8"/>
+ </itemgra>
+ <itemgra item_types="selected_line" order="6">
+ <polyline color="#ba00b8" width="10"/>
+ </itemgra>
+ <itemgra item_types="selected_line" order="7-8">
+ <polyline color="#ba00b8" width="16"/>
+ </itemgra>
+ <itemgra item_types="selected_line" order="9-10">
+ <polyline color="#ba00b8" width="20"/>
+ </itemgra>
+ <itemgra item_types="selected_line" order="11">
+ <polyline color="#ba00b8" width="28"/>
+ </itemgra>
+ <itemgra item_types="selected_line" order="12">
+ <polyline color="#ba00b8" width="32"/>
+ </itemgra>
+ <itemgra item_types="selected_line" order="13">
+ <polyline color="#ba00b8" width="52"/>
+ </itemgra>
+ <itemgra item_types="selected_line" order="14">
+ <polyline color="#ba00b8" width="64"/>
+ </itemgra>
+ <itemgra item_types="selected_line" order="15">
+ <polyline color="#ba00b8" width="68"/>
+ </itemgra>
+ <itemgra item_types="selected_line" order="16">
+ <polyline color="#ba00b8" width="132"/>
+ </itemgra>
+ <itemgra item_types="selected_line" order="17">
+ <polyline color="#ba00b8" width="268"/>
+ </itemgra>
+ <itemgra item_types="selected_line" order="18">
+ <polyline color="#ba00b8" width="530"/>
+ </itemgra>
+ <itemgra item_types="street_nopass" order="10-">
+ <polyline color="#000000" width="1"/>
+ </itemgra>
+ <itemgra item_types="track_paved" order="10-">
+ <polyline color="#000000" width="1"/>
+ </itemgra>
+ <itemgra item_types="track_gravelled" order="10-12">
+ <polyline color="#800000" width="1" dash="3,6"/>
+ </itemgra>
+ <itemgra item_types="track_gravelled" order="13-14">
+ <polyline color="#ffffff" width="4" dash="4,8"/>
+ <polyline color="#800000" width="2" dash="4,8"/>
+ </itemgra>
+ <itemgra item_types="track_gravelled" order="15-16">
+ <polyline color="#ffffff" width="5" dash="5,10"/>
+ <polyline color="#800000" width="3" dash="5,10"/>
+ </itemgra>
+ <itemgra item_types="track_gravelled" order="17-">
+ <polyline color="#ffffff" width="7" dash="7,15"/>
+ <polyline color="#800000" width="5" dash="7,15"/>
+ </itemgra>
+ <itemgra item_types="track_unpaved" order="10-">
+ <polyline color="#000000" width="1"/>
+ </itemgra>
+ <itemgra item_types="bridleway" order="10-">
+ <polyline color="#000000" width="1"/>
+ </itemgra>
+ <itemgra item_types="cycleway" order="10-">
+ <polyline color="#000000" width="1"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_novice" order="10-12">
+ <polyline color="#00A000" width="1"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_novice" order="13-14">
+ <polyline color="#00A000" width="2"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_novice" order="15-16">
+ <polyline color="#00A000" width="3"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_novice" order="17-">
+ <polyline color="#00A000" width="5"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_easy" order="10-12">
+ <polyline color="#0000ff" width="1"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_easy" order="13-14">
+ <polyline color="#0000ff" width="2"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_easy" order="15-16">
+ <polyline color="#0000ff" width="3"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_easy" order="17-">
+ <polyline color="#0000ff" width="5"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_intermediate" order="10-12">
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_intermediate" order="13-14">
+ <polyline color="#ff0000" width="2"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_intermediate" order="15-16">
+ <polyline color="#ff0000" width="3"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_intermediate" order="17-">
+ <polyline color="#ff0000" width="5"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_advanced" order="10-12">
+ <polyline color="#000000" width="1"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_advanced" order="13-14">
+ <polyline color="#000000" width="2"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_advanced" order="15-16">
+ <polyline color="#000000" width="3"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_advanced" order="17-">
+ <polyline color="#000000" width="5"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_expert" order="10-12">
+ <polyline color="#ffaa00" width="1"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_expert" order="13-14">
+ <polyline color="#ffaa00" width="2"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_expert" order="15-16">
+ <polyline color="#ffaa00" width="3"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_expert" order="17-">
+ <polyline color="#ffaa00" width="5"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_freeride" order="10-12">
+ <polyline color="#ffff00" width="1"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_freeride" order="13-14">
+ <polyline color="#ffff00" width="2"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_freeride" order="15-16">
+ <polyline color="#ffff00" width="3"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_freeride" order="17-">
+ <polyline color="#ffff00" width="5"/>
+ </itemgra>
+ <itemgra item_types="lift_cable_car" order="6-">
+ <polyline color="#696969" width="1" dash="5"/>
+ </itemgra>
+ <itemgra item_types="lift_chair" order="6-">
+ <polyline color="#696969" width="1" dash="5"/>
+ </itemgra>
+ <itemgra item_types="lift_drag" order="6-">
+ <polyline color="#696969" width="1" dash="5"/>
+ </itemgra>
+ <itemgra item_types="piste_nordic" order="10-12">
+ <polyline color="#0000ff" width="1" dash="3,6" offset="4"/>
+ </itemgra>
+ <itemgra item_types="piste_nordic" order="13-14">
+ <polyline color="#ffffff" width="4" dash="4,8" offset="6"/>
+ <polyline color="#0000ff" width="2" dash="4,8" offset="6"/>
+ </itemgra>
+ <itemgra item_types="piste_nordic" order="15-16">
+ <polyline color="#ffffff" width="5" dash="5,10" offset="7"/>
+ <polyline color="#0000ff" width="3" dash="5,10" offset="7"/>
+ </itemgra>
+ <itemgra item_types="piste_nordic" order="17-">
+ <polyline color="#ffffff" width="7" dash="7,15" offset="10"/>
+ <polyline color="#0000ff" width="5" dash="7,15" offset="10"/>
+ </itemgra>
+ <itemgra item_types="footway_and_piste_nordic" order="10-12">
+ <polyline color="#ff0000" width="1" dash="3,15"/>
+ <polyline color="#0000ff" width="1" dash="3,15" offset="9"/>
+ </itemgra>
+ <itemgra item_types="footway_and_piste_nordic" order="13-14">
+ <polyline color="#ffffff" width="4" dash="4,8"/>
+ <polyline color="#ff0000" width="2" dash="4,20"/>
+ <polyline color="#0000ff" width="2" dash="4,20" offset="12"/>
+ </itemgra>
+ <itemgra item_types="footway_and_piste_nordic" order="15-16">
+ <polyline color="#ffffff" width="5" dash="5,10"/>
+ <polyline color="#ff0000" width="3" dash="5,25"/>
+ <polyline color="#0000ff" width="3" dash="5,25" offset="15"/>
+ </itemgra>
+ <itemgra item_types="footway_and_piste_nordic" order="17-">
+ <polyline color="#ffffff" width="7" dash="7,15"/>
+ <polyline color="#ff0000" width="5" dash="7,37"/>
+ <polyline color="#0000ff" width="5" dash="7,37" offset="22"/>
+ </itemgra>
+ <itemgra item_types="footway" order="10-12">
+ <polyline color="#ff0000" width="1" dash="3,6"/>
+ </itemgra>
+ <itemgra item_types="footway" order="13-14">
+ <polyline color="#ffffff" width="4" dash="4,8"/>
+ <polyline color="#ff0000" width="2" dash="4,8"/>
+ </itemgra>
+ <itemgra item_types="footway" order="15-16">
+ <polyline color="#ffffff" width="5" dash="5,10"/>
+ <polyline color="#ff0000" width="3" dash="5,10"/>
+ </itemgra>
+ <itemgra item_types="footway" order="17-">
+ <polyline color="#ffffff" width="7" dash="7,15"/>
+ <polyline color="#ff0000" width="5" dash="7,15"/>
+ </itemgra>
+ <itemgra item_types="steps" order="10-">
+ <polyline color="#000000" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian" order="10">
+ <polyline color="#d2d2d2" width="3"/>
+ <polyline color="#dddddd" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian" order="11">
+ <polyline color="#d2d2d2" width="5"/>
+ <polyline color="#dddddd" width="3"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian" order="12">
+ <polyline color="#d2d2d2" width="8"/>
+ <polyline color="#dddddd" width="6"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian" order="13">
+ <polyline color="#d2d2d2" width="9"/>
+ <polyline color="#dddddd" width="7"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian" order="14">
+ <polyline color="#d2d2d2" width="13"/>
+ <polyline color="#dddddd" width="9"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian" order="15">
+ <polyline color="#d2d2d2" width="18"/>
+ <polyline color="#dddddd" width="14"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian" order="16">
+ <polyline color="#d2d2d2" width="21"/>
+ <polyline color="#dddddd" width="17"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian" order="17">
+ <polyline color="#d2d2d2" width="25"/>
+ <polyline color="#dddddd" width="21"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian" order="18">
+ <polyline color="#d2d2d2" width="40"/>
+ <polyline color="#dddddd" width="34"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="10">
+ <polyline color="#d2d2d2" width="4"/>
+ <polyline color="#fefefe" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="11">
+ <polyline color="#d2d2d2" width="4"/>
+ <polyline color="#fefefe" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="12">
+ <polyline color="#d2d2d2" width="5"/>
+ <polyline color="#fefefe" width="3"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="13">
+ <polyline color="#d2d2d2" width="6"/>
+ <polyline color="#fefefe" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="14">
+ <polyline color="#d2d2d2" width="7"/>
+ <polyline color="#fefefe" width="5"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="15">
+ <polyline color="#d2d2d2" width="8"/>
+ <polyline color="#fefefe" width="6"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="16">
+ <polyline color="#d2d2d2" width="9"/>
+ <polyline color="#fefefe" width="7"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="17">
+ <polyline color="#d2d2d2" width="10"/>
+ <polyline color="#fefefe" width="8"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="18">
+ <polyline color="#d2d2d2" width="11"/>
+ <polyline color="#fefefe" width="9"/>
+ </itemgra>
+ <itemgra item_types="street_parking_lane" order="12">
+ <polyline color="#d2d2d2" width="4"/>
+ <polyline color="#fefefe" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_parking_lane" order="13">
+ <polyline color="#d2d2d2" width="4"/>
+ <polyline color="#fefefe" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_parking_lane" order="14">
+ <polyline color="#d2d2d2" width="5"/>
+ <polyline color="#fefefe" width="3"/>
+ </itemgra>
+ <itemgra item_types="street_parking_lane" order="15">
+ <polyline color="#d2d2d2" width="6"/>
+ <polyline color="#fefefe" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_parking_lane" order="16">
+ <polyline color="#d2d2d2" width="7"/>
+ <polyline color="#fefefe" width="5"/>
+ </itemgra>
+ <itemgra item_types="street_parking_lane" order="17">
+ <polyline color="#d2d2d2" width="8"/>
+ <polyline color="#fefefe" width="6"/>
+ </itemgra>
+ <itemgra item_types="street_parking_lane" order="18">
+ <polyline color="#d2d2d2" width="9"/>
+ <polyline color="#fefefe" width="7"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="10">
+ <polyline color="#d2d2d2" width="4"/>
+ <polyline color="#ffffff" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="11">
+ <polyline color="#d2d2d2" width="6"/>
+ <polyline color="#ffffff" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="12">
+ <polyline color="#d2d2d2" width="10"/>
+ <polyline color="#ffffff" width="8"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="13">
+ <polyline color="#d2d2d2" width="11"/>
+ <polyline color="#ffffff" width="9"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="14">
+ <polyline color="#d2d2d2" width="17"/>
+ <polyline color="#ffffff" width="13"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="15">
+ <polyline color="#d2d2d2" width="18"/>
+ <polyline color="#ffffff" width="14"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="16">
+ <polyline color="#d2d2d2" width="30"/>
+ <polyline color="#ffffff" width="26"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="17">
+ <polyline color="#d2d2d2" width="67"/>
+ <polyline color="#ffffff" width="61"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="18">
+ <polyline color="#d2d2d2" width="132"/>
+ <polyline color="#ffffff" width="126"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="7-8">
+ <polyline color="#c0c0c0" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="9">
+ <polyline color="#c0c0c0" width="3"/>
+ <polyline color="#ffff00" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="10">
+ <polyline color="#c0c0c0" width="4"/>
+ <polyline color="#ffff00" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="11">
+ <polyline color="#c0c0c0" width="5"/>
+ <polyline color="#ffff00" width="3"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="12">
+ <polyline color="#c0c0c0" width="7"/>
+ <polyline color="#ffff00" width="5"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="13">
+ <polyline color="#c0c0c0" width="11"/>
+ <polyline color="#ffff00" width="8"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="14">
+ <polyline color="#c0c0c0" width="14"/>
+ <polyline color="#ffff00" width="11"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="15">
+ <polyline color="#c0c0c0" width="19"/>
+ <polyline color="#ffff00" width="15"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="16">
+ <polyline color="#c0c0c0" width="30"/>
+ <polyline color="#ffff00" width="26"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="17">
+ <polyline color="#c0c0c0" width="63"/>
+ <polyline color="#ffff00" width="57"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="18">
+ <polyline color="#c0c0c0" width="100"/>
+ <polyline color="#ffff00" width="90"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="7-8">
+ <polyline color="#a0a0a0" width="3"/>
+ <polyline color="#ffff00" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="9">
+ <polyline color="#a0a0a0" width="5"/>
+ <polyline color="#ffff00" width="3"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="10">
+ <polyline color="#a0a0a0" width="8"/>
+ <polyline color="#ffff00" width="6"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="11">
+ <polyline color="#a0a0a0" width="9"/>
+ <polyline color="#ffff00" width="7"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="12">
+ <polyline color="#a0a0a0" width="13"/>
+ <polyline color="#ffff00" width="9"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="13">
+ <polyline color="#a0a0a0" width="18"/>
+ <polyline color="#ffff00" width="14"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="14">
+ <polyline color="#a0a0a0" width="21"/>
+ <polyline color="#ffff00" width="17"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="15">
+ <polyline color="#a0a0a0" width="25"/>
+ <polyline color="#ffff00" width="21"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="16">
+ <polyline color="#a0a0a0" width="40"/>
+ <polyline color="#ffff00" width="34"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="17">
+ <polyline color="#a0a0a0" width="79"/>
+ <polyline color="#ffff00" width="73"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="18">
+ <polyline color="#a0a0a0" width="156"/>
+ <polyline color="#ffff00" width="150"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="2-6">
+ <polyline color="#404040" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="7-8">
+ <polyline color="#404040" width="3"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="9">
+ <polyline color="#000000" width="5"/>
+ <polyline color="#ff0000" width="3"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="10">
+ <polyline color="#000000" width="6"/>
+ <polyline color="#ff0000" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="11">
+ <polyline color="#000000" width="9"/>
+ <polyline color="#ff0000" width="7"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="12">
+ <polyline color="#000000" width="13"/>
+ <polyline color="#ff0000" width="9"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="13">
+ <polyline color="#000000" width="18"/>
+ <polyline color="#ff0000" width="14"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="14">
+ <polyline color="#000000" width="21"/>
+ <polyline color="#ff0000" width="17"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="15">
+ <polyline color="#000000" width="24"/>
+ <polyline color="#ff0000" width="20"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="16">
+ <polyline color="#000000" width="39"/>
+ <polyline color="#ff0000" width="33"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="17">
+ <polyline color="#000000" width="78"/>
+ <polyline color="#ff0000" width="72"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="18">
+ <polyline color="#000000" width="156"/>
+ <polyline color="#ff0000" width="150"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="2">
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="3-5">
+ <polyline color="#ff0000" width="3"/>
+ <polyline color="#ffff00" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="6">
+ <polyline color="#ff0000" width="4"/>
+ <polyline color="#ffff00" width="2"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="7-8">
+ <polyline color="#ff0000" width="7"/>
+ <polyline color="#ffff00" width="5"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="9-10">
+ <polyline color="#ff0000" width="9"/>
+ <polyline color="#ffff00" width="5"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="11">
+ <polyline color="#ff0000" width="13"/>
+ <polyline color="#ffff00" width="9"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="12">
+ <polyline color="#ff0000" width="15"/>
+ <polyline color="#ffff00" width="10"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="13">
+ <polyline color="#ff0000" width="25"/>
+ <polyline color="#ffff00" width="17"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="14">
+ <polyline color="#ff0000" width="31"/>
+ <polyline color="#ffff00" width="24"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="15">
+ <polyline color="#ff0000" width="33"/>
+ <polyline color="#ffff00" width="27"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="16">
+ <polyline color="#ff0000" width="65"/>
+ <polyline color="#ffff00" width="59"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="17">
+ <polyline color="#ff0000" width="133"/>
+ <polyline color="#ffff00" width="127"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="18">
+ <polyline color="#ff0000" width="264"/>
+ <polyline color="#ffff00" width="258"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="tracking_0" order="0-">
+ <polyline color="#000000" width="3"/>
+ </itemgra>
+ <itemgra item_types="tracking_10" order="0-">
+ <polyline color="#191919" width="3"/>
+ </itemgra>
+ <itemgra item_types="tracking_20" order="0-">
+ <polyline color="#333333" width="3"/>
+ </itemgra>
+ <itemgra item_types="tracking_30" order="0-">
+ <polyline color="#4c4c4c" width="3"/>
+ </itemgra>
+ <itemgra item_types="tracking_40" order="0-">
+ <polyline color="#666666" width="3"/>
+ </itemgra>
+ <itemgra item_types="tracking_50" order="0-">
+ <polyline color="#7f7f7f" width="3"/>
+ </itemgra>
+ <itemgra item_types="tracking_60" order="0-">
+ <polyline color="#999999" width="3"/>
+ </itemgra>
+ <itemgra item_types="tracking_70" order="0-">
+ <polyline color="#b2b2b2" width="3"/>
+ </itemgra>
+ <itemgra item_types="tracking_80" order="0-">
+ <polyline color="#cccccc" width="3"/>
+ </itemgra>
+ <itemgra item_types="tracking_90" order="0-">
+ <polyline color="#e5e5e5" width="3"/>
+ </itemgra>
+ <itemgra item_types="tracking_100" order="0-">
+ <polyline color="#ffffff" width="3"/>
+ </itemgra>
+ <itemgra item_types="highway_exit_label" order="10-">
+ <circle color="#000000" radius="3" text_size="7"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land,street_4_city,street_4_land,street_n_lanes" order="10-18">
+ <text text_size="8"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,street_3_city,street_3_land,ramp" order="11-18">
+ <text text_size="9"/>
+ </itemgra>
+ <itemgra item_types="street_nopass,street_0,street_1_city,street_1_land" order="12-18">
+ <text text_size="9"/>
+ </itemgra>
+ <itemgra item_types="traffic_distortion" order="2">
+ <polyline color="#ff9000" width="2"/>
+ </itemgra>
+ <itemgra item_types="traffic_distortion" order="3-5">
+ <polyline color="#ff9000" width="4"/>
+ </itemgra>
+ <itemgra item_types="traffic_distortion" order="6">
+ <polyline color="#ff9000" width="5"/>
+ </itemgra>
+ <itemgra item_types="traffic_distortion" order="7-8">
+ <polyline color="#ff9000" width="8"/>
+ </itemgra>
+ <itemgra item_types="traffic_distortion" order="9-10">
+ <polyline color="#ff9000" width="10"/>
+ </itemgra>
+ <itemgra item_types="traffic_distortion" order="11">
+ <polyline color="#ff9000" width="14"/>
+ </itemgra>
+ <itemgra item_types="traffic_distortion" order="12">
+ <polyline color="#ff9000" width="16"/>
+ </itemgra>
+ <itemgra item_types="traffic_distortion" order="13">
+ <polyline color="#ff9000" width="26"/>
+ </itemgra>
+ <itemgra item_types="traffic_distortion" order="14">
+ <polyline color="#ff9000" width="32"/>
+ </itemgra>
+ <itemgra item_types="traffic_distortion" order="15">
+ <polyline color="#ff9000" width="34"/>
+ </itemgra>
+ <itemgra item_types="traffic_distortion" order="16">
+ <polyline color="#ff9000" width="66"/>
+ </itemgra>
+ <itemgra item_types="traffic_distortion" order="17">
+ <polyline color="#ff9000" width="134"/>
+ </itemgra>
+ <itemgra item_types="traffic_distortion" order="18">
+ <polyline color="#ff9000" width="265"/>
+ </itemgra>
+ </layer>
+ <layer name="polylines">
+ <itemgra item_types="aeroway_taxiway" order="10">
+ <polyline color="#989994" width="4"/>
+ <polyline color="#d3dbbc" width="2"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="11">
+ <polyline color="#989994" width="6"/>
+ <polyline color="#d3dbbc" width="4"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="12">
+ <polyline color="#989994" width="10"/>
+ <polyline color="#d3dbbc" width="8"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="13">
+ <polyline color="#989994" width="12"/>
+ <polyline color="#d3dbbc" width="9"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="14">
+ <polyline color="#989994" width="15"/>
+ <polyline color="#d3dbbc" width="13"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="15">
+ <polyline color="#989994" width="17"/>
+ <polyline color="#d3dbbc" width="14"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="16">
+ <polyline color="#989994" width="33"/>
+ <polyline color="#d3dbbc" width="26"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="17">
+ <polyline color="#989994" width="69"/>
+ <polyline color="#d3dbbc" width="61"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="18">
+ <polyline color="#989994" width="132"/>
+ <polyline color="#d3dbbc" width="126"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="2-6">
+ <polyline color="#404040" width="1"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="7-8">
+ <polyline color="#404040" width="3"/>
+ <polyline color="#d3dbbc" width="1"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="9">
+ <polyline color="#6b6f5f" width="5"/>
+ <polyline color="#d3dbbc" width="3"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="10">
+ <polyline color="#6b6f5f" width="6"/>
+ <polyline color="#d3dbbc" width="4"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="11">
+ <polyline color="#6b6f5f" width="9"/>
+ <polyline color="#d3dbbc" width="7"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="12">
+ <polyline color="#6b6f5f" width="13"/>
+ <polyline color="#d3dbbc" width="9"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="13">
+ <polyline color="#6b6f5f" width="18"/>
+ <polyline color="#d3dbbc" width="14"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="14">
+ <polyline color="#6b6f5f" width="21"/>
+ <polyline color="#d3dbbc" width="17"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="15">
+ <polyline color="#6b6f5f" width="24"/>
+ <polyline color="#d3dbbc" width="20"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="16">
+ <polyline color="#6b6f5f" width="39"/>
+ <polyline color="#d3dbbc" width="33"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="17">
+ <polyline color="#6b6f5f" width="78"/>
+ <polyline color="#d3dbbc" width="72"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="18">
+ <polyline color="#6b6f5f" width="156"/>
+ <polyline color="#d3dbbc" width="150"/>
+ </itemgra>
+ <itemgra item_types="rail_tram" order="10-">
+ <polyline color="#606060" width="2"/>
+ </itemgra>
+ </layer>
+ <layer name="labels">
+ <itemgra item_types="house_number" order="15-">
+ <circle color="#000000" radius="3" text_size="7"/>
+ </itemgra>
+ <itemgra item_types="town_label,district_label,town_label_0e0,town_label_1e0,town_label_2e0,town_label_5e0,town_label_1e1,town_label_2e1,town_label_5e1,town_label_1e2,town_label_2e2,town_label_5e2,district_label_0e0,district_label_1e0,district_label_2e0,district_label_5e0,district_label_1e1,district_label_2e1,district_label_5e1,district_label_1e2,district_label_2e2,district_label_5e2" order="12-">
+ <circle color="#000000" radius="3" text_size="7"/>
+ </itemgra>
+ <itemgra item_types="district_label_1e3,district_label_2e3,district_label_5e3" order="11-">
+ <circle color="#000000" radius="3" text_size="7"/>
+ </itemgra>
+ <itemgra item_types="town_label_1e3,town_label_2e3,town_label_5e3" order="10-">
+ <circle color="#000000" radius="3" text_size="7"/>
+ </itemgra>
+ <itemgra item_types="district_label_1e4,district_label_2e4,district_label_5e4" order="9-">
+ <circle color="#000000" radius="3" text_size="7"/>
+ </itemgra>
+ <itemgra item_types="town_label_1e4,town_label_2e4,town_label_5e4" order="8-">
+ <circle color="#000000" radius="3" text_size="7"/>
+ </itemgra>
+ <itemgra item_types="district_label_1e5,district_label_2e5,district_label_5e5" order="6-">
+ <circle color="#000000" radius="3" text_size="10"/>
+ </itemgra>
+ <itemgra item_types="town_label_1e5,town_label_2e5,town_label_5e5" order="4-">
+ <circle color="#000000" radius="3" text_size="10"/>
+ </itemgra>
+ <itemgra item_types="district_label_1e6,district_label_2e6,district_label_5e6" order="3-">
+ <circle color="#000000" radius="3" text_size="15"/>
+ </itemgra>
+ <itemgra item_types="town_label_1e6,town_label_2e6,town_label_5e6" order="2-">
+ <circle color="#000000" radius="3" text_size="15"/>
+ </itemgra>
+ <itemgra item_types="town_label_1e7,district_label_1e7" order="1-">
+ <circle color="#000000" radius="3" text_size="15"/>
+ </itemgra>
+ </layer>
+ <layer name="Internal">
+ <itemgra item_types="track" order="7-">
+ <polyline color="#3f3f3f" width="1"/>
+ </itemgra>
+ <itemgra item_types="track_tracked" order="7-">
+ <polyline color="#3f3fff" width="3"/>
+ </itemgra>
+ <itemgra item_types="rg_segment" order="12-">
+ <polyline color="#FF089C" width="1"/>
+ <arrows color="#FF089C" width="1"/>
+ </itemgra>
+ <itemgra item_types="rg_point" order="12-">
+ <circle color="#FF089C" radius="10" text_size="7"/>
+ </itemgra>
+ <itemgra item_types="nav_left_1" order="0-">
+ <icon src="nav_left_1_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_left_2" order="0-">
+ <icon src="nav_left_2_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_left_3" order="0-">
+ <icon src="nav_left_3_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_right_1" order="0-">
+ <icon src="nav_right_1_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_right_2" order="0-">
+ <icon src="nav_right_2_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_right_3" order="0-">
+ <icon src="nav_right_3_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_straight" order="0-">
+ <icon src="nav_straight_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_turnaround_left" order="0-">
+ <icon src="nav_turnaround_left_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_turnaround_right" order="0-">
+ <icon src="nav_turnaround_right_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_roundabout_l1" order="0-">
+ <icon src="nav_roundabout_l1_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_roundabout_r1" order="0-">
+ <icon src="nav_roundabout_r1_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_roundabout_l2" order="0-">
+ <icon src="nav_roundabout_l2_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_roundabout_r2" order="0-">
+ <icon src="nav_roundabout_r2_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_roundabout_l3" order="0-">
+ <icon src="nav_roundabout_l3_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_roundabout_r3" order="0-">
+ <icon src="nav_roundabout_r3_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_roundabout_l4" order="0-">
+ <icon src="nav_roundabout_l4_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_roundabout_r4" order="0-">
+ <icon src="nav_roundabout_r4_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_roundabout_l5" order="0-">
+ <icon src="nav_roundabout_l5_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_roundabout_r5" order="0-">
+ <icon src="nav_roundabout_r5_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_roundabout_l6" order="0-">
+ <icon src="nav_roundabout_l6_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_roundabout_r6" order="0-">
+ <icon src="nav_roundabout_r6_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_roundabout_l7" order="0-">
+ <icon src="nav_roundabout_l7_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_roundabout_r7" order="0-">
+ <icon src="nav_roundabout_r7_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_roundabout_l8" order="0-">
+ <icon src="nav_roundabout_l8_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_roundabout_r8" order="0-">
+ <icon src="nav_roundabout_r8_bk.svg" w="32" h="32"/>
+ </itemgra>
+ <itemgra item_types="nav_none" order="0-">
+ <icon src="unknown.xpm"/>
+ </itemgra>
+ <itemgra item_types="announcement" order="7-">
+ <icon src="gui_sound_32_32.png"/>
+ <circle color="#FF089C" radius="10" text_size="7"/>
+ </itemgra>
+ </layer>
+ <layer name="Unknown" enabled="no">
+ <!-- This entry shows all unknow point elements as blue circles -->
+ <itemgra item_types="point_unkn" order="9-">
+ <circle color="#8080ff" radius="3"/>
+ </itemgra>
+ <!-- This entry shows all unknown linear elements as blue lines -->
+ <itemgra item_types="street_unkn" order="0-">
+ <polyline color="#8080ff" width="3"/>
+ </itemgra>
+ </layer>
+ <layer name="POI Symbols">
+ <itemgra item_types="mini_roundabout" order="12-">
+ <icon src="mini_roundabout.xpm"/>
+ </itemgra>
+ <itemgra item_types="turning_circle" order="12-">
+ <icon src="mini_roundabout.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_airport" order="5-">
+ <icon src="airport.png"/>
+ </itemgra>
+ <itemgra item_types="town_ghost" order="10-">
+ <icon src="ghost_town.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_hotel" order="12-">
+ <icon src="hotel.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_car_parking" order="11-">
+ <icon src="parking.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_car_dealer_parts" order="12-">
+ <icon src="car_dealer.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_fuel" order="12-">
+ <icon src="fuel.png"/>
+ </itemgra>
+ <itemgra item_types="poi_shopping" order="12-">
+ <icon src="shopping.png"/>
+ </itemgra>
+ <itemgra item_types="poi_attraction" order="11-">
+ <icon src="attraction.png"/>
+ </itemgra>
+ <itemgra item_types="poi_cafe" order="12-">
+ <icon src="cafe.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_bar" order="12-">
+ <icon src="bar.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_bridge" order="12-">
+ <icon src="bridge.xpm"/>
+ </itemgra>
+ <itemgra item_types="highway_exit" order="11-">
+ <icon src="exit.png"/>
+ </itemgra>
+ <itemgra item_types="poi_camp_rv" order="12-">
+ <icon src="camping.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_museum_history" order="12-">
+ <icon src="museum.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_hospital" order="12-">
+ <icon src="hospital.png"/>
+ </itemgra>
+ <itemgra item_types="poi_dining" order="12-">
+ <icon src="dining.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_fastfood" order="12-">
+ <icon src="fastfood.png"/>
+ </itemgra>
+ <itemgra item_types="poi_police" order="12-">
+ <icon src="police.png"/>
+ </itemgra>
+ <itemgra item_types="poi_auto_club" order="12-">
+ <icon src="auto_club.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_autoservice" order="12-">
+ <icon src="car_dealer.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_bank" order="12-">
+ <icon src="bank.png"/>
+ </itemgra>
+ <itemgra item_types="poi_bay" order="12-">
+ <icon src="bay.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_bend" order="12-">
+ <icon src="bend.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_boat_ramp" order="12-">
+ <icon src="boat_ramp.png"/>
+ </itemgra>
+ <itemgra item_types="poi_border_station" order="12-">
+ <icon src="border_station.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_bowling" order="12-">
+ <icon src="bowling.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_bus_station" order="11-">
+ <icon src="bus.png"/>
+ </itemgra>
+ <itemgra item_types="poi_bus_stop" order="12-">
+ <icon src="bus.png"/>
+ </itemgra>
+ <itemgra item_types="poi_bussines_service" order="12-">
+ <icon src="bussines_service.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_car_rent" order="12-">
+ <icon src="car_rent.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_car_wash" order="12-">
+ <icon src="car_wash.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_casino" order="12-">
+ <icon src="casino.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_cemetery" order="12-">
+ <icon src="cemetery.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_church" order="11-">
+ <icon src="church.png"/>
+ </itemgra>
+ <itemgra item_types="poi_cinema" order="12-">
+ <icon src="cinema.png"/>
+ </itemgra>
+ <itemgra item_types="poi_civil" order="12-">
+ <icon src="civil.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_communication" order="12-">
+ <icon src="communication.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_concert" order="12-">
+ <icon src="concert.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_cove" order="12-">
+ <icon src="cove.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_crossing" order="12-">
+ <icon src="crossing.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_dam" order="12-">
+ <icon src="dam.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_danger_area" order="12-">
+ <icon src="danger_area.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_dangerous" order="12-">
+ <icon src="dangerous.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_daymark" order="12-">
+ <icon src="daymark.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_diving" order="12-">
+ <icon src="diving.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_drinking_water" order="13-">
+ <icon src="drinking_water.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_emergency" order="12-">
+ <icon src="emergency.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_fair" order="12-">
+ <icon src="fair.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_firebrigade" order="12-">
+ <icon src="firebrigade.png"/>
+ </itemgra>
+ <itemgra item_types="poi_fish" order="9-">
+ <icon src="fish.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_forbiden_area" order="12-">
+ <icon src="forbiden_area.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_garmin" order="15-">
+ <icon src="garmin.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_golf" order="12-">
+ <icon src="golf.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_goverment_building" order="12-">
+ <icon src="goverment_building.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_height" order="12-">
+ <icon src="height.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_heliport" order="8-">
+ <icon src="heliport.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_hotspring" order="12-">
+ <icon src="hotspring.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_icesport" order="12-">
+ <icon src="icesport.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_information" order="12-">
+ <icon src="information.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_justice" order="12-">
+ <icon src="justice.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_landmark" order="11-">
+ <icon src="landmark.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_levee" order="12-">
+ <icon src="levee.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_level_crossing" order="11-">
+ <icon src="level_crossing.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_library" order="12-">
+ <icon src="library.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_locale" order="12-">
+ <icon src="locale.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_loudspeaker" order="12-">
+ <icon src="loudspeaker.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_mall" order="12-">
+ <icon src="mall.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_manmade_feature" order="12-">
+ <icon src="manmade_feature.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_marine" order="12-">
+ <icon src="marine.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_marine_type" order="12-">
+ <icon src="marine_type.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_mark" order="12-">
+ <icon src="mark.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_military" order="11-">
+ <icon src="military.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_mine" order="12-">
+ <icon src="mine.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_nondangerous" order="12-">
+ <icon src="nondangerous.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_oil_field" order="12-">
+ <icon src="oil_field.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_peak" order="7-">
+ <icon src="peak.png"/>
+ </itemgra>
+ <itemgra item_types="poi_personal_service" order="12-">
+ <icon src="personal_service.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_pharmacy" order="12-">
+ <icon src="pharmacy.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_post" order="13-">
+ <icon src="post.png"/>
+ </itemgra>
+ <itemgra item_types="poi_public_office" order="12-">
+ <icon src="public_office.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_rail_halt" order="11-">
+ <circle color="#ff0000" radius="3" width="3"/>
+ <circle color="#000000" radius="5" width="2" text_size="8"/>
+ </itemgra>
+ <itemgra item_types="poi_rail_station" order="9-">
+ <circle color="#ff0000" radius="3" width="3"/>
+ <circle color="#000000" radius="6" width="2" text_size="8"/>
+ </itemgra>
+ <itemgra item_types="poi_rail_tram_stop" order="10-11">
+ <circle color="#ff0000" radius="2" width="2"/>
+ </itemgra>
+ <itemgra item_types="poi_rail_tram_stop" order="12-">
+ <circle color="#ff0000" radius="3" width="3"/>
+ <circle color="#606060" radius="5" width="2" text_size="8"/>
+ </itemgra>
+ <itemgra item_types="poi_repair_service" order="12-">
+ <icon src="repair_service.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_resort" order="12-">
+ <icon src="resort.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_restaurant" order="12-">
+ <icon src="restaurant.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_restricted_area" order="12-">
+ <icon src="restricted_area.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_rest_room" order="13-">
+ <icon src="rest_room.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_restroom" order="13-">
+ <icon src="restroom.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_sailing" order="12-">
+ <icon src="sailing.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_scenic_area" order="12-">
+ <icon src="scenic_area.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_school" order="12-">
+ <icon src="school.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_service" order="12-">
+ <icon src="service.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_shop_apparel" order="12-">
+ <icon src="shop_apparel.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_shop_computer" order="12-">
+ <icon src="shop_computer.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_shop_department" order="12-">
+ <icon src="shop_department.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_shop_furnish" order="12-">
+ <icon src="shop_furnish.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_shop_grocery" order="12-">
+ <icon src="shop_grocery.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_shop_handg" order="12-">
+ <icon src="shop_handg.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_shop_merchandise" order="12-">
+ <icon src="shop_merchandise.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_shop_retail" order="12-">
+ <icon src="shop_retail.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_shower" order="13-">
+ <icon src="shower.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_skiing" order="11-">
+ <icon src="skiing.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_social_service" order="12-">
+ <icon src="social_service.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_sounding" order="12-">
+ <icon src="sounding.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_sport" order="12-">
+ <icon src="sport.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_stadium" order="11-">
+ <icon src="stadium.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_subdivision" order="12-">
+ <icon src="subdivision.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_swimming" order="12-">
+ <icon src="swimming.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_telephone" order="13-">
+ <icon src="telephone.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_theater" order="12-">
+ <icon src="theater.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_tide" order="12-">
+ <icon src="tide.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_tower" order="13-">
+ <icon src="tower.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_townhall" order="12-">
+ <icon src="townhall.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_trail" order="12-">
+ <icon src="trail.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_truck_stop" order="12-">
+ <icon src="truck_stop.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_tunnel" order="12-">
+ <icon src="tunnel.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_wine" order="12-">
+ <icon src="wine.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_worship" order="8-">
+ <icon src="worship.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_wrecker" order="12-">
+ <icon src="wrecker.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_zoo" order="9-">
+ <icon src="zoo.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_picnic" order="12-">
+ <icon src="picnic.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_gc_multi" order="12-">
+ <icon src="gc_multi.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_gc_tradi" order="12-">
+ <icon src="gc_tradi.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_gc_event" order="12-">
+ <icon src="gc_event.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_gc_mystery" order="12-">
+ <icon src="gc_mystery.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_gc_question" order="12-">
+ <icon src="gc_question.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_gc_stages" order="12-">
+ <icon src="gc_stages.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_gc_reference" order="12-">
+ <icon src="gc_reference.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_gc_webcam" order="12-">
+ <icon src="gc_webcam.xpm"/>
+ </itemgra>
+ <itemgra item_types="traffic_signals" order="13-">
+ <icon src="traffic_signals.png"/>
+ </itemgra>
+ <itemgra item_types="poi_wifi" order="13-">
+ <icon src="wifi.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_image" order="12-">
+ <image/>
+ </itemgra>
+ <!-- I'm not sure if the following stuff should appear in any layout. Maybe portions should only apply to the bicyle layout. -->
+ <itemgra item_types="poi_bench" order="13-">
+ <icon src="bench.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_biergarten" order="12-">
+ <icon src="biergarten.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_boundary_stone" order="13-">
+ <icon src="boundary_stone.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_castle" order="11-">
+ <icon src="castle.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_ruins" order="11-">
+ <icon src="ruins.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_hunting_stand" order="12-">
+ <icon src="hunting_stand.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_memorial" order="12-">
+ <icon src="memorial.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_monument" order="12-">
+ <icon src="memorial.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_shelter" order="11-">
+ <icon src="shelter.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_fountain" order="13-">
+ <icon src="fountain.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_potable_water" order="13-">
+ <icon src="potable_water.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_toilets" order="12-">
+ <icon src="toilets.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_viewpoint" order="10-">
+ <icon src="viewpoint.xpm"/>
+ </itemgra>
+ <itemgra item_types="tec_common" order="11-">
+ <icon src="tec_common.png" w="24" h="24"/>
+ </itemgra>
+ </layer>
+ <layer name="POI Labels">
+ <itemgra item_types="poi_airport,town_ghost,poi_hotel,poi_car_parking,poi_car_dealer_parts,poi_fuel,poi_shopping,poi_attraction,poi_cafe,poi_bar,highway_exit,poi_camp_rv,poi_museum_history,poi_hospital,poi_dining,poi_fastfood,poi_police,poi_autoservice,poi_bank,poi_bus_station,poi_bus_stop,poi_bussines_service,poi_car_rent,poi_church,poi_cinema,poi_concert,poi_drinkingwater,poi_emergency,poi_fair,poi_fish,poi_goverment_building,poi_hotspring,poi_information,poi_justice,poi_landmark,poi_library,poi_mall,poi_manmade_feature,poi_marine,poimarine_type,poi_mark,poi_oil_field,poi_peak,poi_personal_service,poi_pharmacy,poi_post,poi_public_office,poi_rail_halt,poi_rail_station,poi_rail_tram_stop,poi_repair_service,poi_resort,poi_restaurant,poi_restricted_area,poi_sailing,poi_scenic_area,poi_school,poi_service,poi_shop_retail,poi_skiing,poi_social_service,poi_sport,poi_stadium,poi_swimming,poi_theater,poi_townhall,poi_trail,poi_truck_stop,poi_tunnel,poi_worship,poi_wrecker,poi_zoo,poi_biergarten,poi_castle,poi_ruins,poi_memorial,poi_monument,poi_shelter,poi_fountain,poi_viewpoint" order="14-">
+ <circle color="#606060" radius="0" width="0" text_size="10"/>
+ </itemgra>
+ </layer>
+ </layout>
+
+ <layout name="Car-dark" color="#011001">
+ <layer name="polygons">
+ <itemgra item_types="image" order="0-">
+ <image/>
+ </itemgra>
+ <itemgra item_types="poly_wood" order="0-">
+ <polygon color="#041a06"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_farm" order="0-">
+ <polygon color="#041a06"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_town" order="0-">
+ <polygon color="#191711"/>
+ </itemgra>
+ <itemgra item_types="poly_university" order="8-">
+ <polygon color="#140f14"/>
+ </itemgra>
+ <itemgra item_types="poly_water" order="0-">
+ <polygon color="#010321"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_land" order="0-">
+ <polygon color="#011001"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_park" order="0-">
+ <polygon color="#041a06"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_pedestrian" order="10">
+ <polygon color="#202020"/>
+ </itemgra>
+ <itemgra item_types="poly_pedestrian" order="11">
+ <polyline color="#1e0728" width="3"/>
+ <polygon color="#202020"/>
+ </itemgra>
+ <itemgra item_types="poly_pedestrian" order="12">
+ <polyline color="#1e0728" width="5"/>
+ <polygon color="#202020"/>
+ </itemgra>
+ <itemgra item_types="poly_pedestrian" order="13">
+ <polyline color="#1e0728" width="6"/>
+ <polygon color="#202020"/>
+ </itemgra>
+ <itemgra item_types="poly_pedestrian" order="14">
+ <polyline color="#1e0728" width="7"/>
+ <polygon color="#202020"/>
+ </itemgra>
+ <itemgra item_types="poly_pedestrian" order="15">
+ <polyline color="#1e0728" width="9"/>
+ <polygon color="#202020"/>
+ </itemgra>
+ <itemgra item_types="poly_pedestrian" order="16">
+ <polyline color="#1e0728" width="10"/>
+ <polygon color="#202020"/>
+ </itemgra>
+ <itemgra item_types="poly_pedestrian" order="17">
+ <polyline color="#1e0728" width="12"/>
+ <polygon color="#202020"/>
+ </itemgra>
+ <itemgra item_types="poly_pedestrian" order="18">
+ <polyline color="#1e0728" width="20"/>
+ <polygon color="#202020"/>
+ </itemgra>
+ <itemgra item_types="poly_airport" order="0-">
+ <polygon color="#002e00"/>
+ </itemgra>
+ <itemgra item_types="poly_sport,poly_sports_pitch" order="0-">
+ <polygon color="#0c220c"/>
+ </itemgra>
+ <itemgra item_types="poly_industry,poly_place" order="0-">
+ <polygon color="#111111"/>
+ </itemgra>
+ <itemgra item_types="poly_service" order="8-18">
+ <polygon color="#1a1a1a"/>
+ <polyline color="#282828" width="1"/>
+ </itemgra>
+ <itemgra item_types="poly_street_1" order="8-13">
+ <polygon color="#24092f"/>
+ </itemgra>
+ <itemgra item_types="poly_street_1" order="14-16">
+ <polygon color="#24092f"/>
+ </itemgra>
+ <itemgra item_types="poly_street_1" order="17-18">
+ <polygon color="#24092f"/>
+ </itemgra>
+ <itemgra item_types="poly_street_2" order="7-12">
+ <polygon color="#c5c300"/>
+ <polyline color="#c0c0c0" width="1"/>
+ </itemgra>
+ <itemgra item_types="poly_street_2" order="13-16">
+ <polygon color="#c5c300"/>
+ <polyline color="#c0c0c0" width="2"/>
+ </itemgra>
+ <itemgra item_types="poly_street_2" order="17-18">
+ <polygon color="#c5c300"/>
+ <polyline color="#c0c0c0" width="3"/>
+ </itemgra>
+ <itemgra item_types="poly_street_3" order="7-11">
+ <polygon color="#c5c300"/>
+ <polyline color="#a0a0a0" width="1"/>
+ </itemgra>
+ <itemgra item_types="poly_street_3" order="12-15">
+ <polygon color="#c5c300"/>
+ <polyline color="#a0a0a0" width="2"/>
+ </itemgra>
+ <itemgra item_types="poly_street_3" order="16-18">
+ <polygon color="#c5c300"/>
+ <polyline color="#a0a0a0" width="3"/>
+ </itemgra>
+ <itemgra item_types="water_line" order="0-">
+ <polyline color="#010321" width="1"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="water_river" order="4-5">
+ <polyline color="#010321" width="1"/>
+ </itemgra>
+ <itemgra item_types="water_river" order="6">
+ <polyline color="#010321" width="2"/>
+ </itemgra>
+ <itemgra item_types="water_river" order="7">
+ <polyline color="#010321" width="3"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="water_river" order="8-9">
+ <polyline color="#010321" width="4"/>
+ <text text_size="7"/>
+ </itemgra>
+ <itemgra item_types="water_river" order="10-">
+ <polyline color="#010321" width="4"/>
+ <text text_size="10"/>
+ </itemgra>
+ <itemgra item_types="water_canal" order="6">
+ <polyline color="#010321" width="1"/>
+ </itemgra>
+ <itemgra item_types="water_canal" order="7">
+ <polyline color="#010321" width="2"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="water_canal" order="8-9">
+ <polyline color="#010321" width="3"/>
+ <text text_size="7"/>
+ </itemgra>
+ <itemgra item_types="water_canal" order="10-">
+ <polyline color="#010321" width="3"/>
+ <text text_size="10"/>
+ </itemgra>
+ <itemgra item_types="water_stream" order="8-9">
+ <polyline color="#010321" width="1"/>
+ </itemgra>
+ <itemgra item_types="water_stream" order="10-">
+ <polyline color="#010321" width="2"/>
+ <text text_size="7"/>
+ </itemgra>
+ <itemgra item_types="water_drain" order="10-">
+ <polyline color="#010321" width="1"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_apron" order="0-">
+ <polygon color="#041a06"/>
+ </itemgra>
+ <itemgra item_types="poly_terminal" order="7-">
+ <polygon color="#282424"/>
+ </itemgra>
+ <itemgra item_types="poly_cemetery" order="8-">
+ <polygon color="#041a06"/>
+ </itemgra>
+ <itemgra item_types="poly_car_parking" order="8-">
+ <polygon color="#1a170f"/>
+ </itemgra>
+ <itemgra item_types="poly_building" order="8-">
+ <polygon color="#282424"/>
+ </itemgra>
+ <itemgra item_types="rail" order="6-8">
+ <polyline color="#282828" width="2"/>
+ <polyline color="#3d3d3d" dash="1,5" width="2"/>
+ </itemgra>
+ <itemgra item_types="rail" order="9-">
+ <polyline color="#282828" width="3"/>
+ <polyline color="#3d3d3d" dash="1,5" width="2"/>
+ </itemgra>
+ <itemgra item_types="ferry" order="5-">
+ <polyline color="#113111" width="1" dash="10"/>
+ </itemgra>
+ <itemgra item_types="border_country" order="0-">
+ <polyline color="#0d0b41" width="1" dash="10,5,2,5"/>
+ </itemgra>
+ <itemgra item_types="border_state" order="0-">
+ <polyline color="#808080" width="1"/>
+ </itemgra>
+ <itemgra item_types="height_line_1" order="0-">
+ <polyline color="#000000" width="1"/>
+ </itemgra>
+ <itemgra item_types="height_line_2" order="0-">
+ <polyline color="#000000" width="2"/>
+ </itemgra>
+ </layer>
+ <layer name="streets">
+ <itemgra item_types="street_route" order="2">
+ <polyline color="#0000a0" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="3-5">
+ <polyline color="#0000a0" width="8"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="6">
+ <polyline color="#0000a0" width="10"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="7-8">
+ <polyline color="#0000a0" width="16"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="9-10">
+ <polyline color="#0000a0" width="20"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="11">
+ <polyline color="#0000a0" width="28"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="12">
+ <polyline color="#0000a0" width="32"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="13">
+ <polyline color="#0000a0" width="52"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="14">
+ <polyline color="#0000a0" width="64"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="15">
+ <polyline color="#0000a0" width="68"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="16">
+ <polyline color="#0000a0" width="132"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="17">
+ <polyline color="#0000a0" width="268"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="18">
+ <polyline color="#0000a0" width="530"/>
+ </itemgra>
+ <itemgra item_types="street_nopass" order="10-">
+ <polyline color="#000000" width="1"/>
+ </itemgra>
+ <itemgra item_types="track_paved" order="10-">
+ <polyline color="#000000" width="1"/>
+ </itemgra>
+ <itemgra item_types="track_gravelled" order="10-12">
+ <polyline color="#800000" width="1" dash="3,6"/>
+ </itemgra>
+ <itemgra item_types="track_gravelled" order="13-14">
+ <polyline color="#3d3d3d" width="4" dash="4,8"/>
+ <polyline color="#800000" width="2" dash="4,8"/>
+ </itemgra>
+ <itemgra item_types="track_gravelled" order="15-16">
+ <polyline color="#3d3d3d" width="5" dash="5,10"/>
+ <polyline color="#800000" width="3" dash="5,10"/>
+ </itemgra>
+ <itemgra item_types="track_gravelled" order="17-">
+ <polyline color="#3d3d3d" width="7" dash="7,15"/>
+ <polyline color="#800000" width="5" dash="7,15"/>
+ </itemgra>
+ <itemgra item_types="track_unpaved" order="10-">
+ <polyline color="#000000" width="1"/>
+ </itemgra>
+ <itemgra item_types="bridleway" order="10-">
+ <polyline color="#1e0728" width="1"/>
+ </itemgra>
+ <itemgra item_types="cycleway" order="10-">
+ <polyline color="#1e0728" width="1"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_novice" order="10-12">
+ <polyline color="#00A000" width="1"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_novice" order="13-14">
+ <polyline color="#00A000" width="2"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_novice" order="15-16">
+ <polyline color="#00A000" width="3"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_novice" order="17-">
+ <polyline color="#00A000" width="5"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_easy" order="10-12">
+ <polyline color="#0000ff" width="1"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_easy" order="13-14">
+ <polyline color="#0000ff" width="2"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_easy" order="15-16">
+ <polyline color="#0000ff" width="3"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_easy" order="17-">
+ <polyline color="#0000ff" width="5"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_intermediate" order="10-12">
+ <polyline color="#900000" width="1"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_intermediate" order="13-14">
+ <polyline color="#900000" width="2"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_intermediate" order="15-16">
+ <polyline color="#900000" width="3"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_intermediate" order="17-">
+ <polyline color="#900000" width="5"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_advanced" order="10-12">
+ <polyline color="#000000" width="1"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_advanced" order="13-14">
+ <polyline color="#000000" width="2"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_advanced" order="15-16">
+ <polyline color="#000000" width="3"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_advanced" order="17-">
+ <polyline color="#000000" width="5"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_expert" order="10-12">
+ <polyline color="#ffaa00" width="1"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_expert" order="13-14">
+ <polyline color="#ffaa00" width="2"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_expert" order="15-16">
+ <polyline color="#ffaa00" width="3"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_expert" order="17-">
+ <polyline color="#ffaa00" width="5"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_freeride" order="10-12">
+ <polyline color="#c5c300" width="1"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_freeride" order="13-14">
+ <polyline color="#c5c300" width="2"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_freeride" order="15-16">
+ <polyline color="#c5c300" width="3"/>
+ </itemgra>
+ <itemgra item_types="piste_downhill_freeride" order="17-">
+ <polyline color="#c5c300" width="5"/>
+ </itemgra>
+ <itemgra item_types="lift_cable_car" order="6-">
+ <polyline color="#3d3d3d" width="1" dash="5"/>
+ </itemgra>
+ <itemgra item_types="lift_chair" order="6-">
+ <polyline color="#3d3d3d" width="1" dash="5"/>
+ </itemgra>
+ <itemgra item_types="lift_drag" order="6-">
+ <polyline color="#3d3d3d" width="1" dash="5"/>
+ </itemgra>
+ <itemgra item_types="piste_nordic" order="10-12">
+ <polyline color="#0000ff" width="1" dash="3,6"/>
+ </itemgra>
+ <itemgra item_types="piste_nordic" order="13-14">
+ <polyline color="#0000ff" width="2" dash="4,8"/>
+ </itemgra>
+ <itemgra item_types="piste_nordic" order="15-16">
+ <polyline color="#0000ff" width="3" dash="5,10"/>
+ </itemgra>
+ <itemgra item_types="piste_nordic" order="17-">
+ <polyline color="#0000ff" width="5" dash="7,15"/>
+ </itemgra>
+ <itemgra item_types="footway" order="11-12">
+ <polyline color="#4e0000" width="1" dash="3,6"/>
+ </itemgra>
+ <itemgra item_types="footway" order="13-14">
+ <polyline color="#4e0000" width="2" dash="4,8"/>
+ </itemgra>
+ <itemgra item_types="footway" order="15-16">
+ <polyline color="#4e0000" width="3" dash="5,10"/>
+ </itemgra>
+ <itemgra item_types="footway" order="17-">
+ <polyline color="#4e0000" width="5" dash="7,15"/>
+ </itemgra>
+ <itemgra item_types="steps" order="14-15">
+ <polyline color="#4d4e11" width="1"/>
+ </itemgra>
+ <itemgra item_types="steps" order="16">
+ <polyline color="#4d4e11" width="2"/>
+ </itemgra>
+ <itemgra item_types="steps" order="17-18">
+ <polyline color="#4d4e11" width="3"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian" order="10">
+ <polyline color="#1e0728" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian" order="11">
+ <polyline color="#1e0728" width="5"/>
+ <polyline color="#202020" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian" order="12">
+ <polyline color="#1e0728" width="8"/>
+ <polyline color="#202020" width="3"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian" order="13">
+ <polyline color="#1e0728" width="9"/>
+ <polyline color="#202020" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian" order="14">
+ <polyline color="#1e0728" width="13"/>
+ <polyline color="#202020" width="7"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian" order="15">
+ <polyline color="#1e0728" width="18"/>
+ <polyline color="#202020" width="10"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian" order="16">
+ <polyline color="#1e0728" width="21"/>
+ <polyline color="#202020" width="13"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian" order="17">
+ <polyline color="#1e0728" width="25"/>
+ <polyline color="#202020" width="17"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian" order="18">
+ <polyline color="#1e0728" width="40"/>
+ <polyline color="#202020" width="30"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="10">
+ <polyline color="#2c2c2c" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="11">
+ <polyline color="#2c2c2c" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="12">
+ <polyline color="#2c2c2c" width="3"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="13">
+ <polyline color="#2c2c2c" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="14">
+ <polyline color="#2c2c2c" width="5"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="15">
+ <polyline color="#2c2c2c" width="6"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="16">
+ <polyline color="#2c2c2c" width="7"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="17">
+ <polyline color="#2c2c2c" width="8"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="18">
+ <polyline color="#2c2c2c" width="9"/>
+ </itemgra>
+ <itemgra item_types="street_parking_lane" order="12">
+ <polyline color="#2c2c2c" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_parking_lane" order="13">
+ <polyline color="#2c2c2c" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_parking_lane" order="14">
+ <polyline color="#2c2c2c" width="3"/>
+ </itemgra>
+ <itemgra item_types="street_parking_lane" order="15">
+ <polyline color="#2c2c2c" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_parking_lane" order="16">
+ <polyline color="#2c2c2c" width="5"/>
+ </itemgra>
+ <itemgra item_types="street_parking_lane" order="17">
+ <polyline color="#2c2c2c" width="6"/>
+ </itemgra>
+ <itemgra item_types="street_parking_lane" order="18">
+ <polyline color="#2c2c2c" width="7"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="10">
+ <polyline color="#24092f" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="11">
+ <polyline color="#24092f" width="3"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="12">
+ <polyline color="#24092f" width="5"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="13">
+ <polyline color="#24092f" width="9"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="14">
+ <polyline color="#24092f" width="13"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="15">
+ <polyline color="#24092f" width="14"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="16">
+ <polyline color="#24092f" width="26"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="17">
+ <polyline color="#24092f" width="61"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="18">
+ <polyline color="#24092f" width="126"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land" order="8">
+ <polyline color="#1d4c19" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land" order="9">
+ <polyline color="#1d4c19" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land" order="10">
+ <polyline color="#1d4c19" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land" order="11">
+ <polyline color="#1d4c19" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land" order="12">
+ <polyline color="#1d4c19" width="7"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land" order="13">
+ <polyline color="#1d4c19" width="11"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land" order="14">
+ <polyline color="#1d4c19" width="14"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land" order="15">
+ <polyline color="#1d4c19" width="17"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land" order="16">
+ <polyline color="#1d4c19" width="30"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land" order="17">
+ <polyline color="#1d4c19" width="67"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land" order="18">
+ <polyline color="#1d4c19" width="138"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp,roundabout" order="7-8">
+ <polyline color="#4d4e11" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp,roundabout" order="9">
+ <polyline color="#4d4e11" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp,roundabout" order="10">
+ <polyline color="#4d4e11" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp,roundabout" order="11">
+ <polyline color="#4d4e11" width="5"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp,roundabout" order="12">
+ <polyline color="#4d4e11" width="7"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp,roundabout" order="13">
+ <polyline color="#4d4e11" width="14"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp,roundabout" order="14">
+ <polyline color="#4d4e11" width="17"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp,roundabout" order="15">
+ <polyline color="#4d4e11" width="21"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp,roundabout" order="16">
+ <polyline color="#4d4e11" width="34"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp,roundabout" order="17">
+ <polyline color="#4d4e11" width="73"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp,roundabout" order="18">
+ <polyline color="#4d4e11" width="150"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="2-5">
+ <polyline color="#430000" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="6-8">
+ <polyline color="#430000" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="9">
+ <polyline color="#430000" width="3"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="10">
+ <polyline color="#430000" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="11">
+ <polyline color="#430000" width="7"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="12">
+ <polyline color="#430000" width="9"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="13">
+ <polyline color="#430000" width="14"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="14">
+ <polyline color="#430000" width="17"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="15">
+ <polyline color="#430000" width="20"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="16">
+ <polyline color="#430000" width="33"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="17">
+ <polyline color="#430000" width="72"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="18">
+ <polyline color="#430000" width="150"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="2">
+ <polyline color="#760000" width="1"/>
+ </itemgra>
+ <!--1d4c19/0d740d-->
+ <itemgra item_types="highway_city,highway_land" order="3-5">
+ <polyline color="#640000" width="3"/>
+ <polyline color="#0a5c0a" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="6">
+ <polyline color="#640000" width="4"/>
+ <polyline color="#0a5c0a" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="7-8">
+ <polyline color="#640000" width="6"/>
+ <polyline color="#005b00" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="9-10">
+ <polyline color="#640000" width="8"/>
+ <polyline color="#0a5c0a" width="2"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="11">
+ <polyline color="#640000" width="12"/>
+ <polyline color="#0a5c0a" width="3"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="12">
+ <polyline color="#640000" width="13"/>
+ <polyline color="#0a5c0a" width="3"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="13">
+ <polyline color="#640000" width="17"/>
+ <polyline color="#0a5c0a" width="4"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="14">
+ <polyline color="#640000" width="24"/>
+ <polyline color="#0a5c0a" width="4"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="15">
+ <polyline color="#640000" width="27"/>
+ <polyline color="#0a5c0a" width="5"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="16">
+ <polyline color="#640000" width="59"/>
+ <polyline color="#0a5c0a" width="6"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="17">
+ <polyline color="#640000" width="127"/>
+ <polyline color="#0a5c0a" width="7"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="18">
+ <polyline color="#640000" width="258"/>
+ <polyline color="#0a5c0a" width="8"/>
+ </itemgra>
+ <!-- This entry shows all unknown linear elements as blue lines -->
+ <!--
+ <itemgra item_types="street_unkn" order="0-">
+ <polyline color="#8080ff" width="3"/>
+ </itemgra>
+ -->
+ <itemgra item_types="highway_exit_label" order="10-">
+ <circle color="#000000" radius="3" text_size="7"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land,street_4_city,street_4_land,street_n_lanes" order="10-18">
+ <text text_size="8" color="#55c4bd"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,street_3_city,street_3_land,ramp" order="11-18">
+ <text text_size="9" color="#55c4bd"/>
+ </itemgra>
+ <itemgra item_types="street_nopass,street_0,street_1_city,street_1_land" order="12-18">
+ <text text_size="9" color="#55c4bd"/>
+ </itemgra>
+ </layer>
+ <layer name="polylines">
+ <itemgra item_types="aeroway_taxiway" order="10">
+ <polyline color="#404040" width="4"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="11">
+ <polyline color="#404040" width="6"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="12">
+ <polyline color="#404040" width="10"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="13">
+ <polyline color="#404040" width="12"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="14">
+ <polyline color="#404040" width="15"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="15">
+ <polyline color="#404040" width="17"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="16">
+ <polyline color="#404040" width="33"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="17">
+ <polyline color="#404040" width="69"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="18">
+ <polyline color="#404040" width="132"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="2-6">
+ <polyline color="#404040" width="1"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="7-8">
+ <polyline color="#404040" width="3"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="9">
+ <polyline color="#404040" width="5"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="10">
+ <polyline color="#404040" width="6"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="11">
+ <polyline color="#404040" width="9"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="12">
+ <polyline color="#404040" width="13"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="13">
+ <polyline color="#404040" width="18"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="14">
+ <polyline color="#404040" width="21"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="15">
+ <polyline color="#404040" width="24"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="16">
+ <polyline color="#404040" width="39"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="17">
+ <polyline color="#404040" width="78"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="18">
+ <polyline color="#404040" width="156"/>
+ </itemgra>
+ <itemgra item_types="rail_tram,bus_guideway" order="10-">
+ <polyline color="#3d3d3d" width="2"/>
+ </itemgra>
+ </layer>
+ <layer name="labels">
+ <itemgra item_types="town_label,district_label,town_label_0e0,town_label_1e0,town_label_2e0,town_label_5e0,town_label_1e1,town_label_2e1,town_label_5e1,town_label_1e2,town_label_2e2,town_label_5e2,district_label_0e0,district_label_1e0,district_label_2e0,district_label_5e0,district_label_1e1,district_label_2e1,district_label_5e1,district_label_1e2,district_label_2e2,district_label_5e2" order="12-">
+ <circle color="#55c4bd" radius="3" text_size="7"/>
+ </itemgra>
+ <itemgra item_types="district_label_1e3,district_label_2e3,district_label_5e3" order="11-">
+ <circle color="#55c4bd" radius="3" text_size="7"/>
+ </itemgra>
+ <itemgra item_types="town_label_1e3,town_label_2e3,town_label_5e3" order="10-">
+ <circle color="#55c4bd" radius="3" text_size="7"/>
+ </itemgra>
+ <itemgra item_types="district_label_1e4,district_label_2e4,district_label_5e4" order="9-">
+ <circle color="#55c4bd" radius="3" text_size="7"/>
+ </itemgra>
+ <itemgra item_types="town_label_1e4,town_label_2e4,town_label_5e4" order="8-">
+ <circle color="#55c4bd" radius="3" text_size="7"/>
+ </itemgra>
+ <itemgra item_types="district_label_1e5,district_label_2e5,district_label_5e5" order="6-">
+ <circle color="#55c4bd" radius="3" text_size="10"/>
+ </itemgra>
+ <itemgra item_types="town_label_1e5,town_label_2e5,town_label_5e5" order="4-">
+ <circle color="#55c4bd" radius="3" text_size="10"/>
+ </itemgra>
+ <itemgra item_types="district_label_1e6,district_label_2e6,district_label_5e6" order="3-">
+ <circle color="#55c4bd" radius="3" text_size="15"/>
+ </itemgra>
+ <itemgra item_types="town_label_1e6,town_label_2e6,town_label_5e6" order="2-">
+ <circle color="#55c4bd" radius="3" text_size="15"/>
+ </itemgra>
+ <itemgra item_types="town_label_1e7,district_label_1e7" order="1-">
+ <circle color="#55c4bd" radius="3" text_size="15"/>
+ </itemgra>
+ </layer>
+ <layer name="points">
+ <itemgra item_types="mini_roundabout" order="12-">
+ <icon src="mini_roundabout.xpm"/>
+ </itemgra>
+ <itemgra item_types="turning_circle" order="12-">
+ <icon src="mini_roundabout.xpm"/>
+ </itemgra>
+ <itemgra item_types="track" order="3-">
+ <polyline color="#3f3f3f" width="1"/>
+ </itemgra>
+ <itemgra item_types="poi_airport" order="5-">
+ <icon src="airport.png"/>
+ </itemgra>
+ <itemgra item_types="town_ghost" order="0-">
+ <icon src="ghost_town.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_hotel" order="12-">
+ <icon src="hotel.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_car_parking" order="11-">
+ <icon src="parking.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_car_dealer_parts" order="0-">
+ <icon src="car_dealer.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_fuel" order="10-">
+ <icon src="fuel.png"/>
+ </itemgra>
+ <itemgra item_types="poi_shopping" order="10-">
+ <icon src="shopping.png"/>
+ </itemgra>
+ <itemgra item_types="poi_attraction" order="8-">
+ <icon src="attraction.png"/>
+ </itemgra>
+ <itemgra item_types="poi_cafe" order="12-">
+ <icon src="cafe.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_bar" order="12-">
+ <icon src="bar.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_bridge" order="0-">
+ <icon src="bridge.xpm"/>
+ </itemgra>
+ <itemgra item_types="highway_exit" order="11-">
+ <icon src="exit.png"/>
+ </itemgra>
+ <itemgra item_types="poi_camp_rv" order="9-">
+ <icon src="camping.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_museum_history" order="12-">
+ <icon src="museum.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_hospital" order="12-">
+ <icon src="hospital.png"/>
+ </itemgra>
+ <!-- not really usefull -->
+ <!--
+ <itemgra item_types="point_unkn" order="0-">
+ <circle color="#8080ff" radius="3"/>
+ </itemgra>
+ -->
+ <itemgra item_types="poi_dining" order="12-">
+ <icon src="dining.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_fastfood" order="12-">
+ <icon src="fastfood.png"/>
+ </itemgra>
+ <itemgra item_types="poi_police" order="12-">
+ <icon src="police.png"/>
+ </itemgra>
+ <itemgra item_types="poi_auto_club" order="0-">
+ <icon src="auto_club.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_autoservice" order="0-">
+ <icon src="autoservice.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_bank" order="12-">
+ <icon src="bank.png"/>
+ </itemgra>
+ <itemgra item_types="poi_bay" order="0-">
+ <icon src="bay.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_bend" order="0-">
+ <icon src="bend.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_boat_ramp" order="12-">
+ <icon src="boat_ramp.png"/>
+ </itemgra>
+ <itemgra item_types="poi_border_station" order="0-">
+ <icon src="border_station.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_bowling" order="0-">
+ <icon src="bowling.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_bus_station" order="12-">
+ <icon src="bus.png"/>
+ </itemgra>
+ <itemgra item_types="poi_bus_stop" order="12-">
+ <icon src="bus.png"/>
+ </itemgra>
+ <itemgra item_types="poi_bussines_service" order="0-">
+ <icon src="bussines_service.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_car_rent" order="11-">
+ <icon src="car_rent.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_car_wash" order="12-">
+ <icon src="car_wash.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_casino" order="11-">
+ <icon src="casino.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_cemetery" order="11-">
+ <icon src="cemetery.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_church" order="11-">
+ <icon src="church.png"/>
+ </itemgra>
+ <itemgra item_types="poi_cinema" order="12-">
+ <icon src="cinema.png"/>
+ </itemgra>
+ <itemgra item_types="poi_civil" order="0-">
+ <icon src="civil.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_communication" order="0-">
+ <icon src="communication.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_concert" order="0-">
+ <icon src="concert.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_cove" order="0-">
+ <icon src="cove.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_crossing" order="0-">
+ <icon src="crossing.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_dam" order="0-">
+ <icon src="dam.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_danger_area" order="0-">
+ <icon src="danger_area.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_dangerous" order="0-">
+ <icon src="dangerous.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_daymark" order="0-">
+ <icon src="daymark.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_diving" order="0-">
+ <icon src="diving.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_drinking_water" order="0-">
+ <icon src="drinking_water.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_emergency" order="0-">
+ <icon src="emergency.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_fair" order="0-">
+ <icon src="fair.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_firebrigade" order="12-">
+ <icon src="firebrigade.png"/>
+ </itemgra>
+ <itemgra item_types="poi_fish" order="0-">
+ <icon src="fish.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_forbiden_area" order="0-">
+ <icon src="forbiden_area.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_garmin" order="0-">
+ <icon src="garmin.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_golf" order="12-">
+ <icon src="golf.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_goverment_building" order="0-">
+ <icon src="goverment_building.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_height" order="0-">
+ <icon src="height.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_heliport" order="7-">
+ <icon src="heliport.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_hotspring" order="0-">
+ <icon src="hotspring.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_icesport" order="0-">
+ <icon src="icesport.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_information" order="12-">
+ <icon src="information.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_justice" order="10-">
+ <icon src="justice.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_landmark" order="0-">
+ <icon src="landmark.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_levee" order="0-">
+ <icon src="levee.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_level_crossing" order="11-">
+ <icon src="level_crossing.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_library" order="12-">
+ <icon src="library.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_locale" order="0-">
+ <icon src="locale.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_loudspeaker" order="0-">
+ <icon src="loudspeaker.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_mall" order="0-">
+ <icon src="mall.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_manmade_feature" order="0-">
+ <icon src="manmade_feature.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_marine" order="0-">
+ <icon src="marine.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_marine_type" order="0-">
+ <icon src="marine_type.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_mark" order="0-">
+ <icon src="mark.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_military" order="0-">
+ <icon src="military.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_mine" order="0-">
+ <icon src="mine.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_nondangerous" order="0-">
+ <icon src="nondangerous.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_oil_field" order="0-">
+ <icon src="oil_field.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_peak" order="6-">
+ <icon src="peak.png"/>
+ </itemgra>
+ <itemgra item_types="poi_personal_service" order="0-">
+ <icon src="personal_service.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_pharmacy" order="12-">
+ <icon src="pharmacy.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_post" order="13-">
+ <icon src="post.png"/>
+ </itemgra>
+ <itemgra item_types="poi_public_office" order="0-">
+ <icon src="public_office.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_rail_halt" order="10-">
+ <circle color="#000000" radius="3" width="3"/>
+ <circle color="#3d3d3d" radius="6" width="2" text_size="8"/>
+ </itemgra>
+ <itemgra item_types="poi_rail_station" order="11-">
+ <circle color="#000000" radius="3" width="3"/>
+ <circle color="#3d3d3d" radius="6" width="2" text_size="8"/>
+ </itemgra>
+ <itemgra item_types="poi_rail_tram_stop" order="10-11">
+ <circle color="#3d3d3d" radius="2" width="2"/>
+ </itemgra>
+ <itemgra item_types="poi_rail_tram_stop" order="12-">
+ <circle color="#000000" radius="3" width="3"/>
+ <circle color="#3d3d3d" radius="6" width="2" text_size="8"/>
+ </itemgra>
+ <itemgra item_types="poi_repair_service" order="0-">
+ <icon src="repair_service.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_resort" order="0-">
+ <icon src="resort.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_rest_room" order="13-">
+ <icon src="rest_room.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_restaurant" order="12-">
+ <icon src="restaurant.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_restricted_area" order="0-">
+ <icon src="restricted_area.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_restroom" order="13-">
+ <icon src="restroom.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_sailing" order="0-">
+ <icon src="sailing.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_scenic_area" order="0-">
+ <icon src="scenic_area.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_school" order="12-">
+ <icon src="school.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_service" order="0-">
+ <icon src="service.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_shop_apparel" order="0-">
+ <icon src="shop_apparel.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_shop_computer" order="0-">
+ <icon src="shop_computer.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_shop_department" order="0-">
+ <icon src="shop_department.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_shop_furnish" order="0-">
+ <icon src="shop_furnish.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_shop_grocery" order="0-">
+ <icon src="shop_grocery.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_shop_handg" order="0-">
+ <icon src="shop_handg.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_shop_merchandise" order="0-">
+ <icon src="shop_merchandise.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_shop_retail" order="0-">
+ <icon src="shop_retail.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_shower" order="0-">
+ <icon src="shower.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_skiing" order="12-">
+ <icon src="skiing.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_social_service" order="0-">
+ <icon src="social_service.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_sounding" order="0-">
+ <icon src="sounding.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_sport" order="12-">
+ <icon src="sport.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_stadium" order="0-">
+ <icon src="stadium.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_subdivision" order="0-">
+ <icon src="subdivision.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_swimming" order="12-">
+ <icon src="swimming.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_telephone" order="13-">
+ <icon src="telephone.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_theater" order="12-">
+ <icon src="theater.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_tide" order="0-">
+ <icon src="tide.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_tower" order="13-">
+ <icon src="tower.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_townhall" order="12-">
+ <icon src="townhall.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_trail" order="0-">
+ <icon src="trail.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_truck_stop" order="0-">
+ <icon src="truck_stop.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_tunnel" order="0-">
+ <icon src="tunnel.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_wifi" order="11-">
+ <icon src="wifi.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_wine" order="0-">
+ <icon src="wine.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_worship" order="0-">
+ <icon src="worship.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_wrecker" order="0-">
+ <icon src="wrecker.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_zoo" order="10-">
+ <icon src="zoo.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_picnic" order="11-">
+ <icon src="picnic.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_gc_multi" order="0-">
+ <icon src="gc_multi.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_gc_tradi" order="0-">
+ <icon src="gc_tradi.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_gc_event" order="0-">
+ <icon src="gc_event.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_gc_mystery" order="0-">
+ <icon src="gc_mystery.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_gc_question" order="0-">
+ <icon src="gc_question.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_gc_stages" order="0-">
+ <icon src="gc_stages.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_gc_reference" order="0-">
+ <icon src="gc_reference.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_gc_webcam" order="0-">
+ <icon src="gc_webcam.xpm"/>
+ </itemgra>
+ <itemgra item_types="traffic_signals" order="13-">
+ <icon src="traffic_signals.png"/>
+ </itemgra>
+ <itemgra item_types="poly_flats,poly_scrub,poly_military_zone,poly_marine,plantation,tundra" order="0-">
+ <polygon color="#041a06"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poi_image" order="0-">
+ <image/>
+ </itemgra>
+ <itemgra item_types="rg_segment" order="0-">
+ <polyline color="#FF089C" width="1"/>
+ <arrows color="#FF089C" width="1"/>
+ </itemgra>
+ <itemgra item_types="rg_point" order="0-">
+ <circle color="#FF089C" radius="10" text_size="7"/>
+ </itemgra>
+ <!-- I'm not sure if the following stuff should appear in any layout. Maybe portions should only apply to the bike layout? -->
+ <itemgra item_types="poi_bench" order="13-">
+ <icon src="bench.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_biergarten" order="12-">
+ <icon src="biergarten.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_boundary_stone" order="13-">
+ <icon src="boundary_stone.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_castle" order="12-">
+ <icon src="castle.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_hunting_stand" order="13-">
+ <icon src="hunting_stand.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_memorial" order="12-">
+ <icon src="memorial.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_monument" order="12-">
+ <icon src="memorial.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_shelter" order="10-">
+ <icon src="shelter.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_fountain" order="12-">
+ <icon src="fountain.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_potable_water" order="12-">
+ <icon src="potable_water.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_toilets" order="12-">
+ <icon src="toilets.xpm"/>
+ </itemgra>
+ <itemgra item_types="poi_viewpoint" order="12-">
+ <icon src="viewpoint.xpm"/>
+ </itemgra>
+ <itemgra item_types="tec_common" order="11-">
+ <icon src="tec_common.png" w="24" h="24"/>
+ </itemgra>
+ </layer>
+ <layer name="POI Labels">
+ <itemgra item_types="poi_airport,town_ghost,poi_hotel,poi_car_parking,poi_car_dealer_parts,poi_fuel,poi_shopping,poi_attraction,poi_cafe,poi_bar,highway_exit,poi_camp_rv,poi_museum_history,poi_hospital,poi_dining,poi_fastfood,poi_police,poi_autoservice,poi_bank,poi_bus_station,poi_bus_stop,poi_bussines_service,poi_car_rent,poi_church,poi_cinema,poi_concert,poi_drinkingwater,poi_emergency,poi_fair,poi_fish,poi_goverment_building,poi_hotspring,poi_information,poi_justice,poi_landmark,poi_library,poi_mall,poi_manmade_feature,poi_marine,poimarine_type,poi_mark,poi_oil_field,poi_peak,poi_personal_service,poi_pharmacy,poi_post,poi_public_office,poi_rail_halt,poi_rail_station,poi_rail_tram_stop,poi_repair_service,poi_resort,poi_restaurant,poi_restricted_area,poi_sailing,poi_scenic_area,poi_school,poi_service,poi_shop_retail,poi_skiing,poi_social_service,poi_sport,poi_stadium,poi_swimming,poi_theater,poi_townhall,poi_trail,poi_truck_stop,poi_tunnel,poi_worship,poi_wrecker,poi_zoo,poi_biergarten,poi_castle,poi_ruins,poi_memorial,poi_monument,poi_shelter,poi_fountain,poi_viewpoint" order="14-">
+ <circle color="#606060" radius="0" width="0" text_size="10"/>
+ </itemgra>
+ </layer>
+ </layout>
+ <layout name="Bike" color="#ffefb7" font="Liberation Sans">
+ <layer name="Landuse">
+ <itemgra item_types="image" order="0-">
+ <image/>
+ </itemgra>
+ <itemgra item_types="poly_wood" order="0-">
+ <polygon color="#8ec78d"/>
+ </itemgra>
+ <itemgra item_types="poly_town" order="0-">
+ <polygon color="#ffc895"/>
+ <polyline color="#ebb481"/>
+ </itemgra>
+ <itemgra item_types="poly_park" order="0-">
+ <polygon color="#7cc334"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_water" order="0-">
+ <polygon color="#82c8ea"/>
+ <polyline color="#5096b8"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_land" order="0-">
+ <polygon color="#ffefb7"/>
+ <polyline color="#ffefb7"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_airport" order="0-">
+ <polygon color="#a0a0a0"/>
+ </itemgra>
+ <itemgra item_types="sport_poly,poly_sport" order="0-">
+ <polygon color="#ff8c00"/>
+ </itemgra>
+ <itemgra item_types="poly_industry,poly_place,poly_railway" order="0-">
+ <polygon color="#e6e6e6"/>
+ </itemgra>
+ <itemgra item_types="poly_commercial" order="0-">
+ <polygon color="#fff8dc"/>
+ </itemgra>
+ <itemgra item_types="industry_poly,building_poly,place_poly,poly_brownfield,poly_greenfield,poly_construction,poly_railway" order="0-">
+ <polygon color="#ecd8ff"/>
+ </itemgra>
+ <itemgra item_types="poly_farm" order="0-">
+ <polygon color="#c7f1a3"/>
+ <polyline color="#79c691"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_scree,poly_scrub,poly_fell,poly_heath" order="0-">
+ <polygon color="#c7f1a3"/>
+ <polyline color="#79c691"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_marsh,poly_mud,poly_quarry" order="0-">
+ <polygon color="#DEB887"/>
+ <polyline color="#DEB887"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_allotments,poly_playground,poly_village_green,poly_recreation_ground,poly_common,poly_garden" order="0-">
+ <polygon color="#c7f1a3"/>
+ <polyline color="#79c691"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="poly_ruins" order="0-">
+ <polygon color="#b6a6a6"/>
+ </itemgra>
+ <itemgra item_types="poly_apron" order="0-">
+ <polygon color="#d0d0d0"/>
+ </itemgra>
+ <itemgra item_types="poly_terminal" order="7-">
+ <polygon color="#e3c6a6"/>
+ </itemgra>
+ <itemgra item_types="poly_cemetery" order="1-">
+ <polygon color="#bde3cb"/>
+ </itemgra>
+ <itemgra item_types="poly_car_parking" order="1-">
+ <polygon color="#d2d2d2"/>
+ </itemgra>
+ <itemgra item_types="poly_building" order="0-">
+ <polygon color="#ff6347"/>
+ </itemgra>
+ </layer>
+ <layer name="Contour Lines">
+ <itemgra item_types="height_line_1" order="8">
+ <polyline color="#A9A9A9" width="1"/>
+ <text text_size="8"/>
+ </itemgra>
+ <itemgra item_types="height_line_1" order="9">
+ <polyline color="#A9A9A9" width="2"/>
+ <text text_size="8"/>
+ </itemgra>
+ <itemgra item_types="height_line_2" order="9">
+ <polyline color="#A9A9A9" width="1"/>
+ <text text_size="8"/>
+ </itemgra>
+ <itemgra item_types="height_line_1" order="10-">
+ <polyline color="#A9A9A9" width="3"/>
+ <text text_size="8"/>
+ </itemgra>
+ <itemgra item_types="height_line_2" order="10-">
+ <polyline color="#A9A9A9" width="2"/>
+ <text text_size="8"/>
+ </itemgra>
+ <itemgra item_types="height_line_3" order="10-">
+ <polyline color="#A9A9A9" width="1"/>
+ </itemgra>
+ </layer>
+ <!-- "Contour Lines" -->
+
+ <layer name="Barriers">
+ <itemgra item_types="ditch" order="8-">
+ <polyline color="#B8860B" width="1"/>
+ <text text_size="8"/>
+ </itemgra>
+ <itemgra item_types="hedge" order="8-">
+ <polyline color="#90EE90" width="1"/>
+ <text text_size="8"/>
+ </itemgra>
+ <itemgra item_types="fence" order="8-">
+ <polyline color="#808080" width="1"/>
+ <text text_size="8"/>
+ </itemgra>
+ <itemgra item_types="wall" order="8-">
+ <polyline color="#808080" width="1"/>
+ <text text_size="8"/>
+ </itemgra>
+ <itemgra item_types="retaining_wall" order="8-">
+ <polyline color="#808080" width="1"/>
+ <text text_size="8"/>
+ </itemgra>
+ <itemgra item_types="city_wall" order="8-">
+ <polyline color="#CD5C5C" width="1"/>
+ <text text_size="8"/>
+ </itemgra>
+ </layer>
+ <!-- "Barriers" -->
+
+ <layer name="Waterways">
+ <itemgra item_types="water_line" order="0-">
+ <polyline color="#82c8ea" width="2"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="water_river" order="0-">
+ <polyline color="#82c8ea" width="4"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="water_canal" order="0-">
+ <polyline color="#82c8ea" width="3"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="water_stream" order="0-">
+ <polyline color="#82c8ea" width="2"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="water_drain" order="0-">
+ <polyline color="#82c8ea" width="1"/>
+ <text text_size="5"/>
+ </itemgra>
+ </layer>
+ <layer name="Borders">
+ <itemgra item_types="border_state" order="0-5">
+ <polyline color="#778899" dash="3,2,1,3" width="3"/>
+ </itemgra>
+ <itemgra item_types="border_country" order="0-5">
+ <polyline color="#778899" dash="3,2,1,3" width="2"/>
+ </itemgra>
+ <itemgra item_types="border_state" order="6-11">
+ <polyline color="#778899" dash="6,6,1,6" width="3"/>
+ </itemgra>
+ <itemgra item_types="border_country" order="6-11">
+ <polyline color="#778899" dash="6,6,1,6" width="2"/>
+ </itemgra>
+ <itemgra item_types="border_state" order="12-20">
+ <polyline color="#778899" dash="10,10,2,10" width="3"/>
+ </itemgra>
+ <itemgra item_types="border_country" order="12-20">
+ <polyline color="#778899" dash="10,10,2,10" width="2"/>
+ </itemgra>
+ </layer>
+ <layer name="Current Route">
+ <itemgra item_types="street_route" order="2">
+ <polyline color="#FF00FF" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="3-5">
+ <polyline color="#FF00FF" width="8"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="6">
+ <polyline color="#FF00FF" width="10"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="7-8">
+ <polyline color="#FF00FF" width="16"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="9-10">
+ <polyline color="#FF00FF" width="20"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="11">
+ <polyline color="#FF00FF" width="28"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="12">
+ <polyline color="#FF00FF" width="32"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="13">
+ <polyline color="#FF00FF" width="52"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="14">
+ <polyline color="#FF00FF" width="64"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="15">
+ <polyline color="#FF00FF" width="68"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="16">
+ <polyline color="#FF00FF" width="132"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="17">
+ <polyline color="#FF00FF" width="268"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="18">
+ <polyline color="#FF00FF" width="530"/>
+ </itemgra>
+ </layer>
+ <layer name="Ways and Paths">
+ <itemgra item_types="powerline" order="12-">
+ <polyline color="#778899" width="1"/>
+ <polyline color="#778899" dash="1,80" width="5"/>
+ </itemgra>
+ <itemgra item_types="street_nopass" order="10-">
+ <polyline color="#000000" width="1"/>
+ </itemgra>
+ <itemgra item_types="track_paved" order="8-">
+ <polyline color="#d2d2d2" width="5"/>
+ <polyline color="#fefefe" width="3"/>
+ </itemgra>
+ <itemgra item_types="track_gravelled" order="9-">
+ <polyline color="#d2d2d2" width="4"/>
+ <polyline color="#fefefe" width="2"/>
+ </itemgra>
+ <itemgra item_types="track_unpaved" order="10-">
+ <polyline color="#d2d2d2" width="3"/>
+ <polyline color="#fefefe" width="1"/>
+ </itemgra>
+ <itemgra item_types="track_ground" order="11-">
+ <polyline color="#d2d2d2" width="3" dash="6,6"/>
+ <polyline color="#fefefe" width="1" dash="6,6"/>
+ </itemgra>
+ <itemgra item_types="track_grass" order="12-">
+ <polyline color="#fefefe" width="2" dash="6,6"/>
+ </itemgra>
+ <itemgra item_types="bridleway" order="10-">
+ <polyline color="#8b4513" width="3"/>
+ <polyline color="#f4a460" width="1"/>
+ </itemgra>
+ <itemgra item_types="cycleway" order="10-">
+ <polyline color="#006400" width="4"/>
+ <polyline color="#3cb371" width="2"/>
+ </itemgra>
+ <itemgra item_types="footway" order="12-">
+ <polyline color="#8b4513" width="3"/>
+ <polyline color="#CD853F" width="1"/>
+ </itemgra>
+ <itemgra item_types="steps" order="12-">
+ <polyline color="#8b4513" width="3"/>
+ <polyline color="#F4A460" width="1" dash="6,4"/>
+ </itemgra>
+ <itemgra item_types="path" order="11-">
+ <polyline color="#8b4513" width="3" dash="2,4"/>
+ </itemgra>
+ <itemgra item_types="hiking" order="11-">
+ <polyline color="#8b4513" width="2" dash="4,4"/>
+ </itemgra>
+ <itemgra item_types="hiking_mountain" order="11-">
+ <polyline color="#8b4513" width="2" dash="6,4"/>
+ </itemgra>
+ <itemgra item_types="hiking_mountain_demanding" order="13-">
+ <polyline color="#8b4513" width="2" dash="8,4"/>
+ </itemgra>
+ <itemgra item_types="hiking_alpine" order="13-">
+ <polyline color="#8b4513" width="1" dash="10,4"/>
+ </itemgra>
+ <itemgra item_types="hiking_alpine_demanding" order="14-">
+ <polyline color="#8b4513" width="1" dash="12,4"/>
+ </itemgra>
+ <itemgra item_types="hiking_alpine_difficult" order="14-">
+ <polyline color="#8b4513" width="1" dash="14,4"/>
+ </itemgra>
+ </layer>
+ <layer name="Streets">
+ <itemgra item_types="poly_pedestrian,poly_plaza" order="0-">
+ <polygon color="#d2d2d2"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian,living_street" order="10">
+ <polyline color="#d2d2d2" width="3"/>
+ <polyline color="#dddddd" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian,living_street" order="11">
+ <polyline color="#d2d2d2" width="5"/>
+ <polyline color="#dddddd" width="3"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian,living_street" order="12">
+ <polyline color="#d2d2d2" width="8"/>
+ <polyline color="#dddddd" width="6"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian,living_street" order="13">
+ <polyline color="#d2d2d2" width="9"/>
+ <polyline color="#dddddd" width="7"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian,living_street" order="14">
+ <polyline color="#d2d2d2" width="13"/>
+ <polyline color="#dddddd" width="9"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian,living_street" order="15">
+ <polyline color="#d2d2d2" width="18"/>
+ <polyline color="#dddddd" width="14"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian,living_street" order="16">
+ <polyline color="#d2d2d2" width="21"/>
+ <polyline color="#dddddd" width="17"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian,living_street" order="17">
+ <polyline color="#d2d2d2" width="25"/>
+ <polyline color="#dddddd" width="21"/>
+ </itemgra>
+ <itemgra item_types="street_pedestrian,living_street" order="18">
+ <polyline color="#d2d2d2" width="40"/>
+ <polyline color="#dddddd" width="34"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="9">
+ <polyline color="#d2d2d2" width="2"/>
+ <polyline color="#fefefe" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="10">
+ <polyline color="#d2d2d2" width="3"/>
+ <polyline color="#fefefe" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="11">
+ <polyline color="#d2d2d2" width="4"/>
+ <polyline color="#fefefe" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="12">
+ <polyline color="#d2d2d2" width="5"/>
+ <polyline color="#fefefe" width="3"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="13">
+ <polyline color="#d2d2d2" width="6"/>
+ <polyline color="#fefefe" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="14">
+ <polyline color="#d2d2d2" width="7"/>
+ <polyline color="#fefefe" width="5"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="15">
+ <polyline color="#d2d2d2" width="8"/>
+ <polyline color="#fefefe" width="6"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="16">
+ <polyline color="#d2d2d2" width="9"/>
+ <polyline color="#fefefe" width="7"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="17">
+ <polyline color="#d2d2d2" width="10"/>
+ <polyline color="#fefefe" width="8"/>
+ </itemgra>
+ <itemgra item_types="street_service" order="18">
+ <polyline color="#d2d2d2" width="11"/>
+ <polyline color="#fefefe" width="9"/>
+ </itemgra>
+ <itemgra item_types="street_parking_lane" order="12">
+ <polyline color="#d2d2d2" width="4"/>
+ <polyline color="#fefefe" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_parking_lane" order="13">
+ <polyline color="#d2d2d2" width="4"/>
+ <polyline color="#fefefe" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_parking_lane" order="14">
+ <polyline color="#d2d2d2" width="5"/>
+ <polyline color="#fefefe" width="3"/>
+ </itemgra>
+ <itemgra item_types="street_parking_lane" order="15">
+ <polyline color="#d2d2d2" width="6"/>
+ <polyline color="#fefefe" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_parking_lane" order="16">
+ <polyline color="#d2d2d2" width="7"/>
+ <polyline color="#fefefe" width="5"/>
+ </itemgra>
+ <itemgra item_types="street_parking_lane" order="17">
+ <polyline color="#d2d2d2" width="8"/>
+ <polyline color="#fefefe" width="6"/>
+ </itemgra>
+ <itemgra item_types="street_parking_lane" order="18">
+ <polyline color="#d2d2d2" width="9"/>
+ <polyline color="#fefefe" width="7"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="8-10">
+ <polyline color="#d2d2d2" width="4"/>
+ <polyline color="#ffffff" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="11">
+ <polyline color="#d2d2d2" width="6"/>
+ <polyline color="#ffffff" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="12">
+ <polyline color="#d2d2d2" width="10"/>
+ <polyline color="#ffffff" width="8"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="13">
+ <polyline color="#d2d2d2" width="12"/>
+ <polyline color="#ffffff" width="9"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="14">
+ <polyline color="#d2d2d2" width="15"/>
+ <polyline color="#ffffff" width="13"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="15">
+ <polyline color="#d2d2d2" width="17"/>
+ <polyline color="#ffffff" width="14"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="16">
+ <polyline color="#d2d2d2" width="33"/>
+ <polyline color="#ffffff" width="26"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="17">
+ <polyline color="#d2d2d2" width="69"/>
+ <polyline color="#ffffff" width="61"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="18">
+ <polyline color="#d2d2d2" width="132"/>
+ <polyline color="#ffffff" width="126"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="7-8">
+ <polyline color="#c0c0c0" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="9">
+ <polyline color="#c0c0c0" width="3"/>
+ <polyline color="#ffff00" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="10">
+ <polyline color="#c0c0c0" width="4"/>
+ <polyline color="#ffff00" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="11">
+ <polyline color="#c0c0c0" width="5"/>
+ <polyline color="#ffff00" width="3"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="12">
+ <polyline color="#c0c0c0" width="7"/>
+ <polyline color="#ffff00" width="5"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="13">
+ <polyline color="#c0c0c0" width="11"/>
+ <polyline color="#ffff00" width="8"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="14">
+ <polyline color="#c0c0c0" width="14"/>
+ <polyline color="#ffff00" width="11"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="15">
+ <polyline color="#c0c0c0" width="19"/>
+ <polyline color="#ffff00" width="15"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="16">
+ <polyline color="#c0c0c0" width="30"/>
+ <polyline color="#ffff00" width="26"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="17">
+ <polyline color="#c0c0c0" width="63"/>
+ <polyline color="#ffff00" width="57"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,ramp" order="18">
+ <polyline color="#c0c0c0" width="100"/>
+ <polyline color="#ffff00" width="90"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="7-8">
+ <polyline color="#a0a0a0" width="3"/>
+ <polyline color="#ffff00" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="9">
+ <polyline color="#a0a0a0" width="5"/>
+ <polyline color="#ffff00" width="3"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="10">
+ <polyline color="#a0a0a0" width="8"/>
+ <polyline color="#ffff00" width="6"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="11">
+ <polyline color="#a0a0a0" width="9"/>
+ <polyline color="#ffff00" width="7"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="12">
+ <polyline color="#a0a0a0" width="13"/>
+ <polyline color="#ffff00" width="9"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="13">
+ <polyline color="#a0a0a0" width="18"/>
+ <polyline color="#ffff00" width="14"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="14">
+ <polyline color="#a0a0a0" width="21"/>
+ <polyline color="#ffff00" width="17"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="15">
+ <polyline color="#a0a0a0" width="25"/>
+ <polyline color="#ffff00" width="21"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="16">
+ <polyline color="#a0a0a0" width="40"/>
+ <polyline color="#ffff00" width="34"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="17">
+ <polyline color="#a0a0a0" width="79"/>
+ <polyline color="#ffff00" width="73"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,roundabout" order="18">
+ <polyline color="#a0a0a0" width="156"/>
+ <polyline color="#ffff00" width="150"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="2-6">
+ <polyline color="#404040" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="7-8">
+ <polyline color="#404040" width="3"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="9">
+ <polyline color="#000000" width="5"/>
+ <polyline color="#ff0000" width="3"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="10">
+ <polyline color="#000000" width="6"/>
+ <polyline color="#ff0000" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="11">
+ <polyline color="#000000" width="9"/>
+ <polyline color="#ff0000" width="7"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="12">
+ <polyline color="#000000" width="13"/>
+ <polyline color="#ff0000" width="9"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="13">
+ <polyline color="#000000" width="18"/>
+ <polyline color="#ff0000" width="14"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="14">
+ <polyline color="#000000" width="21"/>
+ <polyline color="#ff0000" width="17"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="15">
+ <polyline color="#000000" width="24"/>
+ <polyline color="#ff0000" width="20"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="16">
+ <polyline color="#000000" width="39"/>
+ <polyline color="#ff0000" width="33"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="17">
+ <polyline color="#000000" width="78"/>
+ <polyline color="#ff0000" width="72"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="18">
+ <polyline color="#000000" width="156"/>
+ <polyline color="#ff0000" width="150"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="2">
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="3-5">
+ <polyline color="#ff0000" width="3"/>
+ <polyline color="#ffff00" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="6">
+ <polyline color="#ff0000" width="4"/>
+ <polyline color="#ffff00" width="2"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="7-8">
+ <polyline color="#ff0000" width="7"/>
+ <polyline color="#ffff00" width="5"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="9-10">
+ <polyline color="#ff0000" width="9"/>
+ <polyline color="#ffff00" width="5"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="11">
+ <polyline color="#ff0000" width="13"/>
+ <polyline color="#ffff00" width="9"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="12">
+ <polyline color="#ff0000" width="15"/>
+ <polyline color="#ffff00" width="10"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="13">
+ <polyline color="#ff0000" width="25"/>
+ <polyline color="#ffff00" width="17"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="14">
+ <polyline color="#ff0000" width="31"/>
+ <polyline color="#ffff00" width="24"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="15">
+ <polyline color="#ff0000" width="33"/>
+ <polyline color="#ffff00" width="27"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="16">
+ <polyline color="#ff0000" width="65"/>
+ <polyline color="#ffff00" width="59"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="17">
+ <polyline color="#ff0000" width="133"/>
+ <polyline color="#ffff00" width="127"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="18">
+ <polyline color="#ff0000" width="264"/>
+ <polyline color="#ffff00" width="258"/>
+ <polyline color="#ff0000" width="1"/>
+ </itemgra>
+ </layer>
+ <layer name="Aerialways">
+ <itemgra item_types="aeroway_taxiway" order="10">
+ <polyline color="#989994" width="4"/>
+ <polyline color="#d3dbbc" width="2"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="11">
+ <polyline color="#989994" width="6"/>
+ <polyline color="#d3dbbc" width="4"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="12">
+ <polyline color="#989994" width="10"/>
+ <polyline color="#d3dbbc" width="8"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="13">
+ <polyline color="#989994" width="12"/>
+ <polyline color="#d3dbbc" width="9"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="14">
+ <polyline color="#989994" width="15"/>
+ <polyline color="#d3dbbc" width="13"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="15">
+ <polyline color="#989994" width="17"/>
+ <polyline color="#d3dbbc" width="14"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="16">
+ <polyline color="#989994" width="33"/>
+ <polyline color="#d3dbbc" width="26"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="17">
+ <polyline color="#989994" width="69"/>
+ <polyline color="#d3dbbc" width="61"/>
+ </itemgra>
+ <itemgra item_types="aeroway_taxiway" order="18">
+ <polyline color="#989994" width="132"/>
+ <polyline color="#d3dbbc" width="126"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="2-6">
+ <polyline color="#404040" width="1"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="7-8">
+ <polyline color="#404040" width="3"/>
+ <polyline color="#d3dbbc" width="1"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="9">
+ <polyline color="#6b6f5f" width="5"/>
+ <polyline color="#d3dbbc" width="3"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="10">
+ <polyline color="#6b6f5f" width="6"/>
+ <polyline color="#d3dbbc" width="4"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="11">
+ <polyline color="#6b6f5f" width="9"/>
+ <polyline color="#d3dbbc" width="7"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="12">
+ <polyline color="#6b6f5f" width="13"/>
+ <polyline color="#d3dbbc" width="9"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="13">
+ <polyline color="#6b6f5f" width="18"/>
+ <polyline color="#d3dbbc" width="14"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="14">
+ <polyline color="#6b6f5f" width="21"/>
+ <polyline color="#d3dbbc" width="17"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="15">
+ <polyline color="#6b6f5f" width="24"/>
+ <polyline color="#d3dbbc" width="20"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="16">
+ <polyline color="#6b6f5f" width="39"/>
+ <polyline color="#d3dbbc" width="33"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="17">
+ <polyline color="#6b6f5f" width="78"/>
+ <polyline color="#d3dbbc" width="72"/>
+ </itemgra>
+ <itemgra item_types="aeroway_runway" order="18">
+ <polyline color="#6b6f5f" width="156"/>
+ <polyline color="#d3dbbc" width="150"/>
+ </itemgra>
+ </layer>
+ <layer name="Railways">
+ <itemgra item_types="rail" order="6-9">
+ <polyline color="#696969" width="4"/>
+ <polyline color="#FFFFFF" dash="2,5" width="2"/>
+ </itemgra>
+ <itemgra item_types="rail_narrow_gauge" order="6-9">
+ <polyline color="#696969" width="4"/>
+ <polyline color="#FFFFFF" dash="2,5" width="2"/>
+ </itemgra>
+ <itemgra item_types="rail" order="10-13">
+ <polyline color="#696969" width="6"/>
+ <polyline color="#FFFFFF" dash="3,8" width="3"/>
+ </itemgra>
+ <itemgra item_types="rail_narrow_gauge" order="10-13">
+ <polyline color="#696969" width="6"/>
+ <polyline color="#FFFFFF" dash="3,8" width="3"/>
+ </itemgra>
+ <itemgra item_types="rail" order="14-18">
+ <polyline color="#696969" width="8"/>
+ <polyline color="#FFFFFF" dash="4,12" width="5"/>
+ </itemgra>
+ <itemgra item_types="rail_narrow_gauge" order="14-18">
+ <polyline color="#696969" width="8"/>
+ <polyline color="#FFFFFF" dash="4,12" width="5"/>
+ </itemgra>
+ <itemgra item_types="rail_light" order="10-13">
+ <polyline color="#696969" width="4"/>
+ <polyline color="#FFFFFF" dash="2,5" width="2"/>
+ </itemgra>
+ <itemgra item_types="rail_light" order="14-18">
+ <polyline color="#696969" width="6"/>
+ <polyline color="#FFFFFF" dash="4,8" width="4"/>
+ </itemgra>
+ <itemgra item_types="rail_subway" order="8-">
+ <polyline color="#696969" width="2"/>
+ <polyline color="#FFFFFF" dash="5,5" width="2"/>
+ </itemgra>
+ <itemgra item_types="rail_mono" order="10-">
+ <polyline color="#696969" width="2"/>
+ </itemgra>
+ <itemgra item_types="rail_tram,bus_guideway" order="10-">
+ <polyline color="#696969" width="2"/>
+ </itemgra>
+ <itemgra item_types="rail_preserved" order="10-">
+ <polyline color="#696969" width="1" dash="7"/>
+ </itemgra>
+ <itemgra item_types="rail_disused" order="12-">
+ <polyline color="#d3d3d3" width="1" dash="10"/>
+ </itemgra>
+ <itemgra item_types="rail_abandoned" order="12-">
+ <polyline color="#f5f5f5" width="1" dash="10"/>
+ </itemgra>
+ <itemgra item_types="lift_cable_car" order="10-">
+ <polyline color="#778899" width="1"/>
+ <polyline color="#778899" dash="1,40" width="5"/>
+ </itemgra>
+ <itemgra item_types="lift_chair" order="10-">
+ <polyline color="#778899" width="1"/>
+ <polyline color="#778899" dash="1,40" width="5"/>
+ </itemgra>
+ <itemgra item_types="lift_drag" order="10-">
+ <polyline color="#778899" width="1"/>
+ <polyline color="#778899" dash="1,40" width="5"/>
+ </itemgra>
+ <itemgra item_types="ferry" order="5-">
+ <polyline color="#000000" width="3" dash="5"/>
+ </itemgra>
+ <itemgra item_types="track" order="3-">
+ <polyline color="#3f3f3f" width="1"/>
+ </itemgra>
+ </layer>
+ <layer name="Street Labels">
+ <itemgra item_types="highway_exit_label" order="10-">
+ <circle color="#000000" radius="3" text_size="12"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land,street_4_city,street_4_land,street_n_lanes" order="10-18">
+ <text text_size="8"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,street_3_city,street_3_land,ramp" order="11-18">
+ <text text_size="9"/>
+ </itemgra>
+ <itemgra item_types="street_nopass,street_0,street_1_city,street_1_land" order="12-18">
+ <text text_size="9"/>
+ </itemgra>
+ <itemgra item_types="track,track_paved,track_gravelled,track_unpaved,track_ground,track_grass" order="12-18">
+ <text text_size="9"/>
+ </itemgra>
+ <itemgra item_types="bridleway,cycleway,footway,steps,path" order="12-18">
+ <text text_size="9"/>
+ </itemgra>
+ <itemgra item_types="hiking,hiking_mountain,hiking_mountain_demanding,hiking_alpine,hiking_alpine_demanding,hiking_alpine_difficult" order="12-18">
+ <text text_size="9"/>
+ </itemgra>
+ </layer>
+ <xi:include xpointer="xpointer(/config/navit/layout[@name='Car']/layer[@name='POI Symbols'])"/>
+ <!-- <xi:include xpointer="xpointer(/config/navit/layout[@name='Car']/layer[@name='POI Labels'])"/> -->
+ <layer name="Unknown Elements">
+ <!-- This entry shows all unknown linear elements as blue lines -->
+ <!--
+ <itemgra item_types="street_unkn" order="0-">
+ <polyline color="#8080ff" width="3"/>
+ </itemgra>
+ -->
+ </layer>
+ <layer name="Place Labels">
+ <itemgra item_types="town_label,district_label,town_label_0e0,town_label_1e0,town_label_2e0,town_label_5e0,town_label_1e1,town_label_2e1,town_label_5e1,town_label_1e2,town_label_2e2,town_label_5e2,district_label_0e0,district_label_1e0,district_label_2e0,district_label_5e0,district_label_1e1,district_label_2e1,district_label_5e1,district_label_1e2,district_label_2e2,district_label_5e2" order="12-">
+ <circle color="#000000" radius="3" text_size="12"/>
+ </itemgra>
+ <itemgra item_types="district_label_1e3,district_label_2e3,district_label_5e3" order="9-">
+ <circle color="#000000" radius="3" text_size="12"/>
+ </itemgra>
+ <itemgra item_types="town_label_1e3,town_label_2e3,town_label_5e3" order="9-">
+ <circle color="#000000" radius="3" text_size="12"/>
+ </itemgra>
+ <itemgra item_types="district_label_1e4,district_label_2e4,district_label_5e4" order="7-">
+ <circle color="#000000" radius="3" text_size="12"/>
+ </itemgra>
+ <itemgra item_types="town_label_1e4,town_label_2e4,town_label_5e4" order="7-">
+ <circle color="#000000" radius="3" text_size="12"/>
+ </itemgra>
+ <itemgra item_types="district_label_1e5,district_label_2e5,district_label_5e5" order="5-">
+ <circle color="#000000" radius="3" text_size="10"/>
+ </itemgra>
+ <itemgra item_types="town_label_1e5,town_label_2e5,town_label_5e5" order="5-">
+ <circle color="#000000" radius="3" text_size="15"/>
+ </itemgra>
+ <itemgra item_types="district_label_1e6,district_label_2e6,district_label_5e6" order="3-">
+ <circle color="#000000" radius="3" text_size="15"/>
+ </itemgra>
+ <itemgra item_types="town_label_1e6,town_label_2e6,town_label_5e6" order="3-">
+ <circle color="#000000" radius="3" text_size="15"/>
+ </itemgra>
+ <itemgra item_types="town_label_1e7,district_label_1e7" order="1-">
+ <circle color="#000000" radius="3" text_size="15"/>
+ </itemgra>
+ </layer>
+ </layout>
+ <layout name="T@H" font="Liberation Sans">
+ <layer name="sea" details="0">
+ <!-- landuse=forest -->
+ <itemgra item_types="poly_wood" order="0-">
+ <polygon color="#72bf81"/>
+ </itemgra>
+ <!-- landuse=residential -->
+ <itemgra item_types="town_poly" order="0-">
+ <polygon color="#f2f2f2"/>
+ </itemgra>
+ <!-- natural=water -->
+ <itemgra item_types="water_poly" order="0-">
+ <polygon color="#b5d6f1"/>
+ <polyline color="#b5d6f1"/>
+ <text text_size="8"/>
+ </itemgra>
+ <!-- leisure=park -->
+ <itemgra item_types="park_poly" order="0-">
+ <polygon color="#c7f1a3"/>
+ <polyline color="#79c691"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="airport_poly" order="0-">
+ <polygon color="#a0a0a0"/>
+ </itemgra>
+ <itemgra item_types="sport_poly" order="0-">
+ <polygon color="#4af04f"/>
+ </itemgra>
+ <!-- landuse=industrial -->
+ <itemgra item_types="industry_poly,building_poly,place_poly" order="0-">
+ <polygon color="#ecd8ff"/>
+ </itemgra>
+ <!-- waterway=stream -->
+ <itemgra item_types="water_line" order="0-4">
+ <polyline color="#b5d6f1" width="1"/>
+ <text text_size="8"/>
+ </itemgra>
+ <!-- railway=subway -->
+ <itemgra item_types="rail" order="6">
+ <polyline color="#aaaaaa" width="1"/>
+ </itemgra>
+ <itemgra item_types="rail" order="7-8">
+ <polyline color="#aaaaaa" width="2"/>
+ </itemgra>
+ <itemgra item_types="rail" order="9-">
+ <polyline color="#aaaaaa" width="6"/>
+ </itemgra>
+ <itemgra item_types="ferry" order="5-">
+ <polyline color="#000000" width="1"/>
+ </itemgra>
+ <itemgra item_types="border_country" order="0-">
+ <polyline color="#b8434e" width="1"/>
+ </itemgra>
+ <itemgra item_types="border_state" order="0-">
+ <polyline color="#808080" width="1"/>
+ </itemgra>
+ <itemgra item_types="height_line_1" order="0-">
+ <polyline color="#000000" width="1"/>
+ </itemgra>
+ <itemgra item_types="height_line_2" order="0-">
+ <polyline color="#000000" width="2"/>
+ </itemgra>
+ <!-- routing -->
+ <itemgra item_types="street_route" order="2">
+ <polyline color="#0000a0" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="3-5">
+ <polyline color="#0000a0" width="8"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="6">
+ <polyline color="#0000a0" width="10"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="7-8">
+ <polyline color="#0000a0" width="16"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="9-10">
+ <polyline color="#0000a0" width="20"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="11">
+ <polyline color="#0000a0" width="28"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="12">
+ <polyline color="#0000a0" width="32"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="13">
+ <polyline color="#0000a0" width="52"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="14">
+ <polyline color="#0000a0" width="64"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="15">
+ <polyline color="#0000a0" width="68"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="16">
+ <polyline color="#0000a0" width="132"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="17">
+ <polyline color="#0000a0" width="268"/>
+ </itemgra>
+ <itemgra item_types="street_route" order="18">
+ <polyline color="#0000a0" width="530"/>
+ </itemgra>
+ <!-- highway=service,footway, ,... -->
+ <itemgra item_types="street_nopass" order="10">
+ <polyline color="#efeaa0" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_nopass" order="11-12">
+ <polyline color="#efeaa0" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_nopass" order="13-">
+ <polyline color="#efeaa0" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="10">
+ <polyline color="#d2d2d2" width="4"/>
+ <polyline color="#ffffff" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="11">
+ <polyline color="#d2d2d2" width="6"/>
+ <polyline color="#ffffff" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="12">
+ <polyline color="#d2d2d2" width="10"/>
+ <polyline color="#ffffff" width="8"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="13">
+ <polyline color="#d2d2d2" width="12"/>
+ <polyline color="#ffffff" width="9"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="14">
+ <polyline color="#d2d2d2" width="15"/>
+ <polyline color="#ffffff" width="13"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="15">
+ <polyline color="#d2d2d2" width="17"/>
+ <polyline color="#ffffff" width="14"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="16">
+ <polyline color="#d2d2d2" width="33"/>
+ <polyline color="#ffffff" width="26"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="17">
+ <polyline color="#d2d2d2" width="69"/>
+ <polyline color="#ffffff" width="61"/>
+ </itemgra>
+ <itemgra item_types="street_0,street_1_city,street_1_land" order="18">
+ <polyline color="#d2d2d2" width="132"/>
+ <polyline color="#ffffff" width="126"/>
+ </itemgra>
+ <!-- highway=tertiary -->
+ <itemgra item_types="street_2_city,street_2_land" order="7-8">
+ <polyline color="#c4c4c4" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land" order="9">
+ <polyline color="#c4c4c4" width="4"/>
+ <polyline color="#f7f496" width="2"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land" order="10">
+ <polyline color="#c4c4c4" width="6"/>
+ <polyline color="#f7f496" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land" order="11">
+ <polyline color="#c4c4c4" width="8"/>
+ <polyline color="#f7f496" width="6"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land" order="12">
+ <polyline color="#c4c4c4" width="12"/>
+ <polyline color="#f7f496" width="9"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land" order="13">
+ <polyline color="#c4c4c4" width="15"/>
+ <polyline color="#f7f496" width="11"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land" order="14">
+ <polyline color="#c4c4c4" width="18"/>
+ <polyline color="#f7f496" width="14"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land" order="15">
+ <polyline color="#c4c4c4" width="21"/>
+ <polyline color="#f7f496" width="17"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land" order="16">
+ <polyline color="#c4c4c4" width="35"/>
+ <polyline color="#f7f496" width="30"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land" order="17">
+ <polyline color="#c4c4c4" width="73"/>
+ <polyline color="#f7f496" width="67"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land" order="18">
+ <polyline color="#c4c4c4" width="144"/>
+ <polyline color="#f7f496" width="138"/>
+ </itemgra>
+ <!-- highway=secondary -->
+ <itemgra item_types="street_3_city,street_3_land,ramp" order="7">
+ <polyline color="#fdbf6f" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp" order="8">
+ <polyline color="#000000" width="2"/>
+ <polyline color="#fdbf6f" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp" order="9">
+ <polyline color="#000000" width="5"/>
+ <polyline color="#fdbf6f" width="3"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp" order="10">
+ <polyline color="#000000" width="8"/>
+ <polyline color="#fdbf6f" width="6"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp" order="11">
+ <polyline color="#000000" width="9"/>
+ <polyline color="#fdbf6f" width="7"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp" order="12">
+ <polyline color="#000000" width="11"/>
+ <polyline color="#fdbf6f" width="9"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp" order="13">
+ <polyline color="#000000" width="16"/>
+ <polyline color="#fdbf6f" width="14"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp" order="14">
+ <polyline color="#000000" width="19"/>
+ <polyline color="#fdbf6f" width="17"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp" order="15">
+ <polyline color="#000000" width="23"/>
+ <polyline color="#fdbf6f" width="21"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp" order="16">
+ <polyline color="#000000" width="36"/>
+ <polyline color="#fdbf6f" width="34"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp" order="17">
+ <polyline color="#000000" width="75"/>
+ <polyline color="#fdbf6f" width="73"/>
+ </itemgra>
+ <itemgra item_types="street_3_city,street_3_land,ramp" order="18">
+ <polyline color="#000000" width="152"/>
+ <polyline color="#fdbf6f" width="150"/>
+ </itemgra>
+ <!-- highway=primary -->
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="2-6">
+ <polyline color="#e46d71" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="7-8">
+ <polyline color="#e46d71" width="3"/>
+ <polyline color="#e46d71" width="1"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="9">
+ <polyline color="#e46d71" width="5"/>
+ <polyline color="#e46d71" width="3"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="10">
+ <polyline color="#e46d71" width="6"/>
+ <polyline color="#e46d71" width="4"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="11">
+ <polyline color="#e46d71" width="9"/>
+ <polyline color="#e46d71" width="7"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="12">
+ <polyline color="#e46d71" width="13"/>
+ <polyline color="#e46d71" width="9"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="13">
+ <polyline color="#e46d71" width="18"/>
+ <polyline color="#e46d71" width="14"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="14">
+ <polyline color="#e46d71" width="21"/>
+ <polyline color="#e46d71" width="17"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="15">
+ <polyline color="#e46d71" width="24"/>
+ <polyline color="#e46d71" width="20"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="16">
+ <polyline color="#e46d71" width="39"/>
+ <polyline color="#e46d71" width="33"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="17">
+ <polyline color="#e46d71" width="78"/>
+ <polyline color="#e46d71" width="72"/>
+ </itemgra>
+ <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="18">
+ <polyline color="#e46d71" width="156"/>
+ <polyline color="#e46d71" width="150"/>
+ </itemgra>
+ <!-- highway=motorway -->
+ <itemgra item_types="highway_city,highway_land" order="2">
+ <polyline color="#809bc0" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="3-5">
+ <polyline color="#87908a" width="3"/>
+ <polyline color="#809bc0" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="6">
+ <polyline color="#87908a" width="4"/>
+ <polyline color="#809bc0" width="2"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="7-8">
+ <polyline color="#87908a" width="7"/>
+ <polyline color="#809bc0" width="5"/>
+ <polyline color="#809bc0" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="9-10">
+ <polyline color="#87908a" width="9"/>
+ <polyline color="#809bc0" width="5"/>
+ <polyline color="#809bc0" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="11">
+ <polyline color="#87908a" width="13"/>
+ <polyline color="#809bc0" width="9"/>
+ <polyline color="#809bc0" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="12">
+ <polyline color="#87908a" width="15"/>
+ <polyline color="#809bc0" width="10"/>
+ <polyline color="#809bc0" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="13">
+ <polyline color="#87908a" width="25"/>
+ <polyline color="#809bc0" width="17"/>
+ <polyline color="#809bc0" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="14">
+ <polyline color="#87908a" width="31"/>
+ <polyline color="#809bc0" width="24"/>
+ <polyline color="#809bc0" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="15">
+ <polyline color="#87908a" width="33"/>
+ <polyline color="#809bc0" width="27"/>
+ <polyline color="#809bc0" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="16">
+ <polyline color="#87908a" width="65"/>
+ <polyline color="#809bc0" width="59"/>
+ <polyline color="#809bc0" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="17">
+ <polyline color="#87908a" width="133"/>
+ <polyline color="#809bc0" width="127"/>
+ <polyline color="#809bc0" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_city,highway_land" order="18">
+ <polyline color="#87908a" width="264"/>
+ <polyline color="#809bc0" width="258"/>
+ <polyline color="#809bc0" width="1"/>
+ </itemgra>
+ <itemgra item_types="highway_exit_label" order="10-">
+ <circle color="#000000" radius="3" text_size="7"/>
+ </itemgra>
+ <!-- highway=primary (font)-->
+ <itemgra item_types="highway_city,highway_land,street_4_city,street_4_land,street_n_lanes" order="10-18">
+ <text text_size="9"/>
+ </itemgra>
+ <itemgra item_types="street_2_city,street_2_land,street_3_city,street_3_land,ramp" order="11-18">
+ <text text_size="9"/>
+ </itemgra>
+ <itemgra item_types="street_nopass,street_0,street_1_city,street_1_land" order="12-18">
+ <text text_size="9"/>
+ </itemgra>
+ <!-- place=suburb -->
+ <itemgra item_types="town_label,district_label,town_label_0e0,town_label_1e0,town_label_2e0,town_label_5e0,town_label_1e1,town_label_2e1,town_label_5e1,town_label_1e2,town_label_2e2,town_label_5e2,district_label_0e0,district_label_1e0,district_label_2e0,district_label_5e0,district_label_1e1,district_label_2e1,district_label_5e1,district_label_1e2,district_label_2e2,district_label_5e2" order="9-">
+ <circle color="#000000" radius="3" text_size="9"/>
+ </itemgra>
+ <itemgra item_types="district_label_1e3,district_label_2e3,district_label_5e3" order="11-">
+ <circle color="#000000" radius="3" text_size="7"/>
+ </itemgra>
+ <itemgra item_types="town_label_1e3,town_label_2e3,town_label_5e3" order="10-">
+ <circle color="#000000" radius="3" text_size="7"/>
+ </itemgra>
+ <itemgra item_types="district_label_1e4,district_label_2e4,district_label_5e4" order="9-">
+ <circle color="#000000" radius="3" text_size="7"/>
+ </itemgra>
+ <itemgra item_types="town_label_1e4,town_label_2e4,town_label_5e4" order="8-">
+ <circle color="#000000" radius="3" text_size="7"/>
+ </itemgra>
+ <itemgra item_types="district_label_1e5,district_label_2e5,district_label_5e5" order="6-">
+ <circle color="#000000" radius="3" text_size="10"/>
+ </itemgra>
+ <!-- place=city -->
+ <itemgra item_types="town_label_1e5,town_label_2e5,town_label_5e5" order="4-">
+ <circle color="#000000" radius="3" text_size="15"/>
+ </itemgra>
+ <itemgra item_types="district_label_1e6,district_label_2e6,district_label_5e6" order="3-">
+ <circle color="#000000" radius="3" text_size="15"/>
+ </itemgra>
+ <itemgra item_types="town_label_1e6,town_label_2e6,town_label_5e6" order="2-">
+ <circle color="#000000" radius="3" text_size="15"/>
+ </itemgra>
+ <itemgra item_types="town_label_1e7,district_label_1e7" order="1-">
+ <circle color="#000000" radius="3" text_size="15"/>
+ </itemgra>
+ <itemgra item_types="flats,scrub,military_zone,marine_poly,plantation,tundra" order="0-">
+ <polygon color="#a0a0a0"/>
+ <text text_size="5"/>
+ </itemgra>
+ <itemgra item_types="rg_point" order="0-">
+ <circle color="#FF089C" radius="10"/>
+ </itemgra>
+ <!-- !!!!...POIs...!!!! -->
+ <!-- amenity=bank -->
+ <itemgra item_types="poi_bank" order="14-">
+ <icon src="bank.png"/>
+ <circle color="#000000" radius="3" text_size="7"/>
+ </itemgra>
+ <!-- amenity=fuel -->
+ <itemgra item_types="poi_fuel" order="14-">
+ <icon src="fuel.png"/>
+ <circle color="#000000" radius="3" text_size="7"/>
+ </itemgra>
+ <!-- amenity=hospitalg -->
+ <itemgra item_types="poi_hospital" order="14-">
+ <icon src="hospital.png"/>
+ <circle color="#000000" radius="3" text_size="7"/>
+ </itemgra>
+ <!-- amenity=parking -->
+ <itemgra item_types="poi_car_parking" order="14-">
+ <icon src="parking.xpm"/>
+ </itemgra>
+ <!-- amenity=police -->
+ <itemgra item_types="poi_police" order="14-">
+ <icon src="police.png"/>
+ <circle color="#000000" radius="3" text_size="7"/>
+ </itemgra>
+ <!-- amenity=restaurant -->
+ <itemgra item_types="poi_restaurant" order="14-">
+ <icon src="restaurant.xpm"/>
+ <circle color="#000000" radius="3" text_size="7"/>
+ </itemgra>
+ <!-- leisure=golf_curse -->
+ <itemgra item_types="poi_golf" order="14-">
+ <icon src="golf.xpm"/>
+ <circle color="#000000" radius="3" text_size="7"/>
+ </itemgra>
+ <!-- tourism=hotel -->
+ <itemgra item_types="poi_hotel" order="14-">
+ <icon src="hotel.xpm"/>
+ <circle color="#000000" radius="3" text_size="7"/>
+ </itemgra>
+ </layer>
+ </layout>
+ </navit>
+</config>
diff --git a/navit/Makefile.am b/navit/Makefile.am
deleted file mode 100644
index 56fff155..00000000
--- a/navit/Makefile.am
+++ /dev/null
@@ -1,43 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-DIST_SUBDIRS=binding data fib-1.1 gui graphics osd speech vehicle xpm maps
-SUBDIRS=binding data fib-1.1 gui graphics osd speech vehicle xpm
-if BUILD_SAMPLEMAP
- SUBDIRS += maps
-endif
-
-AM_CPPFLAGS = -I$(top_srcdir)/navit/fib-1.1 @NAVIT_CFLAGS@ -DPREFIX=\"@prefix@\" -DMODULE=navit
-BUILT_SOURCES=osm2navit
-bin_PROGRAMS = navit osm2navit
-
-pkgdata_DATA = navit.xml
-
-EXTRA_DIST = navit.xml
-
-navit_SOURCES = attr.c callback.c compass.c coord.c country.c cursor.c data_window.c debug.c \
- event.c file.c graphics.c gui.c item.c layout.c log.c main.c map.c \
- mapset.c maptype.c menu.c navit.c navigation.c osd.c param.c phrase.c plugin.c popup.c \
- profile.c projection.c route.c search.c speech.c transform.c track.c \
- util.c vehicle.c xmlconfig.c attr.h attr_def.h callback.h color.h compass.h coord.h country.h \
- cursor.h data.h data_window.h data_window_int.h debug.h destination.h draw_info.h endianess.h event.h \
- file.h graphics.h gtkext.h gui.h item.h item_def.h log.h layer.h layout.h main.h map-share.h map.h\
- map_data.h mapset.h maptype.h menu.h navigation.h navit.h osd.h \
- param.h phrase.h plugin.h point.h plugin_def.h projection.h popup.h route.h profile.h search.h speech.h \
- transform.h track.h util.h vehicle.h xmlconfig.h
-
-osm2navit_SOURCES = osm2navit.c item.c debug.c zipfile.h
-
-navit_LDADD = @NAVIT_LIBS@ @ZLIB_LIBS@ -Lfib-1.1 -lfib
-
-if !PLUGINS
- navit_SOURCES += builtin.c
- navit_LDADD += $(wildcard $(top_builddir)/navit/*/*/*.la)
-endif
-
-builtin.c:
- ls $(top_builddir)/navit/*/*/*.la | sed -e "s/.la/_init(void);/" -e "s/.*lib/extern void module_/" >builtin.c
- echo "extern void builtin_init(void);" >>builtin.c
- echo "void builtin_init(void) {" >>builtin.c
- ls $(top_builddir)/navit/*/*/*.la | sed -e "s/.la/_init();/" -e "s/.*lib/ module_/" >>builtin.c
- echo "}" >>builtin.c
-
-osm2navit_LDADD = @NAVIT_LIBS@ @ZLIB_LIBS@
diff --git a/navit/attr.c b/navit/attr.c
deleted file mode 100644
index be0c8f2f..00000000
--- a/navit/attr.c
+++ /dev/null
@@ -1,248 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <glib.h>
-#include "debug.h"
-#include "item.h"
-#include "coord.h"
-#include "transform.h"
-#include "color.h"
-#include "attr.h"
-#include "map.h"
-
-struct attr_name {
- enum attr_type attr;
- char *name;
-};
-
-
-static struct attr_name attr_names[]={
-#define ATTR2(x,y) ATTR(y)
-#define ATTR(x) { attr_##x, #x },
-#include "attr_def.h"
-#undef ATTR2
-#undef ATTR
-};
-
-enum attr_type
-attr_from_name(const char *name)
-{
- int i;
-
- for (i=0 ; i < sizeof(attr_names)/sizeof(struct attr_name) ; i++) {
- if (! strcmp(attr_names[i].name, name))
- return attr_names[i].attr;
- }
- return attr_none;
-}
-
-char *
-attr_to_name(enum attr_type attr)
-{
- int i;
-
- for (i=0 ; i < sizeof(attr_names)/sizeof(struct attr_name) ; i++) {
- if (attr_names[i].attr == attr)
- return attr_names[i].name;
- }
- return NULL;
-}
-
-struct attr *
-attr_new_from_text(const char *name, const char *value)
-{
- enum attr_type attr;
- struct attr *ret;
- struct coord_geo *g;
- struct coord c;
-
- ret=g_new0(struct attr, 1);
- dbg(1,"enter name='%s' value='%s'\n", name, value);
- attr=attr_from_name(name);
- ret->type=attr;
- switch (attr) {
- case attr_item_type:
- ret->u.item_type=item_from_name(value);
- break;
- default:
- if (attr >= attr_type_string_begin && attr <= attr_type_string_end) {
- ret->u.str=(char *)value;
- break;
- }
- if (attr >= attr_type_int_begin && attr <= attr_type_int_end) {
- ret->u.num=atoi(value);
- break;
- }
- if (attr >= attr_type_color_begin && attr <= attr_type_color_end) {
- struct color *color=g_new0(struct color, 1);
- int r,g,b,a;
- ret->u.color=color;
- if(strlen(value)==7){
- sscanf(value,"#%02x%02x%02x", &r, &g, &b);
- color->r = (r << 8) | r;
- color->g = (g << 8) | g;
- color->b = (b << 8) | b;
- color->a = (65535);
- } else if(strlen(value)==9){
- sscanf(value,"#%02x%02x%02x%02x", &r, &g, &b, &a);
- color->r = (r << 8) | r;
- color->g = (g << 8) | g;
- color->b = (b << 8) | b;
- color->a = (a << 8) | a;
- } else {
- dbg(0,"color %s has unknown format\n",value);
- }
- break;
- }
- if (attr >= attr_type_coord_geo_start && attr <= attr_type_coord_geo_end) {
- g=g_new(struct coord_geo, 1);
- ret->u.coord_geo=g;
- coord_parse(value, projection_mg, &c);
- transform_to_geo(projection_mg, &c, g);
- break;
- }
- dbg(1,"default\n");
- g_free(ret);
- ret=NULL;
- }
- return ret;
-}
-
-char *
-attr_to_text(struct attr *attr, struct map *map, int pretty)
-{
- char *ret;
- enum attr_type type=attr->type;
-
- if (type >= attr_type_item_begin && type <= attr_type_item_end) {
- struct item *item=attr->u.item;
- if (! item)
- return g_strdup("(nil)");
- return g_strdup_printf("type=0x%x id=0x%x,0x%x map=%p (%s:%s)", item->type, item->id_hi, item->id_lo, item->map, item->map ? map_get_type(item->map) : "", item->map ? map_get_filename(item->map) : "");
- }
- if (type >= attr_type_string_begin && type <= attr_type_string_end) {
- if (map) {
- char *mstr=map_convert_string(map, attr->u.str);
- ret=g_strdup(mstr);
- } else
- ret=g_strdup(attr->u.str);
- return ret;
- }
- if (type >= attr_type_int_begin && type <= attr_type_int_end)
- return g_strdup_printf("%d", attr->u.num);
- return g_strdup("(no text)");
-}
-
-struct attr *
-attr_search(struct attr **attrs, struct attr *last, enum attr_type attr)
-{
- dbg(1, "enter attrs=%p\n", attrs);
- while (*attrs) {
- dbg(1,"*attrs=%p\n", *attrs);
- if ((*attrs)->type == attr) {
- return *attrs;
- }
- attrs++;
- }
- return NULL;
-}
-
-int
-attr_generic_get_attr(struct attr **attrs, enum attr_type type, struct attr *attr, struct attr_iter *iter)
-{
- while (*attrs) {
- if ((*attrs)->type == type) {
- *attr=**attrs;
- return 1;
- }
- attrs++;
- }
- return 0;
-}
-
-int
-attr_data_size(struct attr *attr)
-{
- if (attr->type >= attr_type_string_begin && attr->type <= attr_type_string_end) {
- return strlen(attr->u.str)+1;
- }
- if (attr->type >= attr_type_int_begin && attr->type <= attr_type_int_end) {
- return sizeof(attr->u.num);
- }
- return 0;
-}
-
-void *
-attr_data_get(struct attr *attr)
-{
- if (attr->type >= attr_type_string_begin && attr->type <= attr_type_string_end) {
- return attr->u.str;
- }
- if (attr->type >= attr_type_int_begin && attr->type <= attr_type_int_end) {
- return &attr->u.num;
- }
- return NULL;
-}
-
-void
-attr_data_set(struct attr *attr, void *data)
-{
- if (attr->type >= attr_type_string_begin && attr->type <= attr_type_string_end) {
- attr->u.str=data;
- }
- if (attr->type >= attr_type_int_begin && attr->type <= attr_type_int_end) {
- attr->u.num=*((int *)data);
- }
-}
-
-void
-attr_free(struct attr *attr)
-{
- if (attr->type == attr_position_coord_geo)
- g_free(attr->u.coord_geo);
- if (attr->type >= attr_type_color_begin && attr->type <= attr_type_color_end)
- g_free(attr->u.color);
- g_free(attr);
-}
-
-struct attr *
-attr_dup(struct attr *attr)
-{
- int size;
- struct attr *ret=g_new0(struct attr, 1);
- ret->type=attr->type;
- if (attr->type >= attr_type_int_begin && attr->type <= attr_type_int_end) {
- ret->u.num=attr->u.num;
- } else {
- size=attr_data_size(attr);
- if (size) {
- ret->u.data=g_malloc(size);
- memcpy(ret->u.data, attr->u.data, size);
- }
- }
- return ret;
-}
-
-void
-attr_list_free(struct attr **attrs)
-{
- int count=0;
- while (attrs[count]) {
- attr_free(attrs[count++]);
- }
- g_free(attrs);
-}
-
-struct attr **
-attr_list_dup(struct attr **attrs)
-{
- struct attr **ret=attrs;
- int i,count=0;
-
- while (attrs[count])
- count++;
- ret=g_new0(struct attr *, count+1);
- for (i = 0 ; i < count ; i++)
- ret[i]=attr_dup(attrs[i]);
- return ret;
-}
diff --git a/navit/attr.h b/navit/attr.h
deleted file mode 100644
index dda3116d..00000000
--- a/navit/attr.h
+++ /dev/null
@@ -1,80 +0,0 @@
-#ifndef NAVIT_ATTR_H
-#define NAVIT_ATTR_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifndef ATTR_H
-#define ATTR_H
-
-#include "projection.h"
-
-enum item_type;
-
-enum attr_type {
-#define ATTR2(x,y) attr_##y=x,
-#define ATTR(x) attr_##x,
-#include "attr_def.h"
-#undef ATTR2
-#undef ATTR
-};
-
-#define AF_ONEWAY (1<<0)
-#define AF_ONEWAYREV (1<<1)
-#define AF_NOPASS (AF_ONEWAY|AF_ONEWAYREV)
-#define AF_ONEWAYMASK (AF_ONEWAY|AF_ONEWAYREV)
-#define AF_SEGMENTED (1<<2)
-
-
-struct attr {
- enum attr_type type;
- union {
- char *str;
- void *data;
- int num;
- struct item *item;
- enum item_type item_type;
- enum projection projection;
- double * numd;
- struct color *color;
- struct coord_geo *coord_geo;
- struct navit *navit;
- struct callback *callback;
- struct vehicle *vehicle;
- struct layout *layout;
- struct map *map;
- struct log *log;
- struct route *route;
- struct navigation *navigation;
- struct coord *coord;
- struct pcoord *pcoord;
- struct gui *gui;
- struct graphics *graphics;
- } u;
-};
-
-/* prototypes */
-enum attr_type;
-struct attr;
-struct attr_iter;
-struct map;
-enum attr_type attr_from_name(const char *name);
-char *attr_to_name(enum attr_type attr);
-struct attr *attr_new_from_text(const char *name, const char *value);
-char *attr_to_text(struct attr *attr, struct map *map, int pretty);
-struct attr *attr_search(struct attr **attrs, struct attr *last, enum attr_type attr);
-int attr_generic_get_attr(struct attr **attrs, enum attr_type type, struct attr *attr, struct attr_iter *iter);
-int attr_data_size(struct attr *attr);
-void *attr_data_get(struct attr *attr);
-void attr_data_set(struct attr *attr, void *data);
-void attr_free(struct attr *attr);
-struct attr *attr_dup(struct attr *attr);
-void attr_list_free(struct attr **attrs);
-struct attr **attr_list_dup(struct attr **attrs);
-/* end of prototypes */
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/navit/attr_def.h b/navit/attr_def.h
deleted file mode 100644
index 4d79c731..00000000
--- a/navit/attr_def.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/* prototypes */
-
-/* common */
-ATTR2(0x00000000,none)
-ATTR(any)
-
-ATTR2(0x00010000,type_item_begin)
-ATTR(town_streets_item)
-ATTR(street_name_item)
-ATTR(street_name_numbers_item)
-ATTR(street_item)
-ATTR(street_number_item)
-ATTR(item_type) /* fixme */
-ATTR2(0x0001ffff,type_item_end)
-
-ATTR2(0x00020000,type_int_begin)
-ATTR(h)
-ATTR(id)
-ATTR(flags)
-ATTR(w)
-ATTR(x)
-ATTR(y)
-ATTR(flush_size)
-ATTR(flush_time)
-ATTR(zipfile_ref)
-ATTR(country_id)
-ATTR(position_sats)
-ATTR(position_sats_used)
-ATTR(update)
-ATTR(follow)
-ATTR(length)
-ATTR(time)
-ATTR(destination_length)
-ATTR(destination_time)
-ATTR(speed)
-ATTR(interval)
-ATTR(position_qual)
-ATTR(zoom)
-ATTR(retry_interval)
-ATTR(projection)
-ATTR(offroad)
-ATTR(vocabulary_name)
-ATTR(vocabulary_name_systematic)
-ATTR(vocabulary_distances)
-ATTR(announce_name_systematic_first)
-ATTR2(0x00028000,type_boolean_begin)
-/* boolean */
-ATTR(overwrite)
-ATTR(active)
-ATTR(cursor)
-ATTR(orientation)
-ATTR(tracking)
-ATTR(menubar)
-ATTR(statusbar)
-ATTR(toolbar)
-ATTR(animate)
-ATTR(lazy)
-ATTR(mkdir)
-ATTR2(0x0002ffff,type_int_end)
-ATTR2(0x00030000,type_string_begin)
-ATTR(type)
-ATTR(label)
-ATTR(data)
-ATTR(charset)
-ATTR(country_all)
-ATTR(country_iso3)
-ATTR(country_iso2)
-ATTR(country_car)
-ATTR(country_name)
-ATTR(town_name)
-ATTR(town_postal)
-ATTR(district_name)
-ATTR(street_name)
-ATTR(street_name_systematic)
-ATTR(street_number)
-ATTR(debug)
-ATTR(address)
-ATTR(phone)
-ATTR(entry_fee)
-ATTR(open_hours)
-ATTR(skin)
-ATTR(fullscreen)
-ATTR(view_mode)
-ATTR(tilt)
-ATTR(media_window_title)
-ATTR(media_cmd)
-ATTR(image_codec)
-/* poi */
-ATTR(icon)
-ATTR(info_html)
-ATTR(price_html)
-/* navigation */
-ATTR(navigation_short)
-ATTR(navigation_long)
-ATTR(navigation_long_exact)
-ATTR(navigation_speech)
-ATTR(name)
-ATTR(source)
-ATTR(description)
-ATTR(gc_type)
-ATTR(layout)
-ATTR(position_nmea)
-ATTR(gpsd_query)
-ATTR(on_eof)
-ATTR2(0x0003ffff,type_string_end)
-ATTR(order_limit)
-ATTR2(0x00050000,type_double_start)
-ATTR(position_height)
-ATTR(position_speed)
-ATTR(position_direction)
-ATTR2(0x0005ffff,type_double_end)
-ATTR2(0x00060000,type_coord_geo_start)
-ATTR(position_coord_geo)
-ATTR(center)
-ATTR2(0x0006ffff,type_coord_geo_end)
-ATTR2(0x00070000,type_color_begin)
-ATTR(color)
-ATTR(color2)
-ATTR2(0x0007ffff,type_color_end)
-ATTR2(0x00080000,type_object_begin)
-ATTR(navit)
-ATTR(log)
-ATTR(callback)
-ATTR(route)
-ATTR(navigation)
-ATTR(vehicle)
-ATTR(map)
-ATTR(bookmark_map)
-ATTR(former_destination_map)
-ATTR(graphics)
-ATTR(gui)
-ATTR2(0x0008ffff,type_object_end)
-ATTR2(0x00090000,type_coord_begin)
-ATTR2(0x0009ffff,type_coord_end)
-ATTR2(0x000a0000,type_pcoord_begin)
-ATTR(destination)
-ATTR2(0x000affff,type_pcoord_end)
diff --git a/navit/binding/Makefile.am b/navit/binding/Makefile.am
deleted file mode 100644
index 540a233c..00000000
--- a/navit/binding/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-SUBDIRS=
-if USE_BINDING_PYTHON
- SUBDIRS+=python
-endif
-if USE_BINDING_DBUS
- SUBDIRS+=dbus
-endif
-
-DIST_SUBDIRS=python dbus
-
diff --git a/navit/binding/dbus/Makefile.am b/navit/binding/dbus/Makefile.am
deleted file mode 100644
index 72d8ef30..00000000
--- a/navit/binding/dbus/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ @DBUS_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=binding_dbus
-modulebinding_LTLIBRARIES = libbinding_dbus.la
-libbinding_dbus_la_SOURCES = binding_dbus.c
-libbinding_dbus_la_LIBADD = @DBUS_LIBS@
diff --git a/navit/binding/dbus/binding_dbus.c b/navit/binding/dbus/binding_dbus.c
deleted file mode 100644
index 5f682180..00000000
--- a/navit/binding/dbus/binding_dbus.c
+++ /dev/null
@@ -1,267 +0,0 @@
-#include <string.h>
-#define DBUS_API_SUBJECT_TO_CHANGE
-#include <dbus/dbus.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
-#include "config.h"
-#include "main.h"
-#include "navit.h"
-#include "coord.h"
-#include "plugin.h"
-#include "debug.h"
-
-
-static DBusConnection *connection;
-
-static char *service_name="org.navit-project.navit";
-static char *object_path="/org/navit_project/navit";
-
-GHashTable *object_hash;
-GHashTable *object_count;
-
-static char *
-object_new(char *type, void *object)
-{
- int id;
- char *ret;
- dbg(0,"enter %s\n", type);
- id=(int)g_hash_table_lookup(object_count, type);
- g_hash_table_insert(object_count, type, (void *)(id+1));
- ret=g_strdup_printf("%s/%s/%d", object_path, type, id);
- g_hash_table_insert(object_hash, ret, object);
- dbg(0,"return %s\n", ret);
- return (ret);
-}
-
-static void *
-object_get(const char *path)
-{
- return g_hash_table_lookup(object_hash, path);
-}
-
-static void *
-object_get_from_message_arg(DBusMessage *message, char *type)
-{
- char *opath;
- char *prefix;
- DBusError error;
- void *ret=NULL;
-
- dbus_error_init(&error);
- if (!dbus_message_get_args(message, &error, DBUS_TYPE_OBJECT_PATH, &opath, DBUS_TYPE_INVALID)) {
- dbus_error_free(&error);
- dbg(0,"wrong arg type\n");
- return NULL;
- }
- prefix=g_strdup_printf("%s/%s/", object_path, type);
- if (!strncmp(prefix, opath, strlen(prefix)))
- ret=object_get(opath);
- else
- dbg(0,"wrong object type\n");
- g_free(prefix);
- return ret;
-}
-
-static void *
-object_get_from_message(DBusMessage *message, char *type)
-{
- const char *opath=dbus_message_get_path(message);
- char *prefix;
- void *ret=NULL;
-
- prefix=g_strdup_printf("%s/%s/", object_path, type);
- if (!strncmp(prefix, opath, strlen(prefix)))
- ret=object_get(opath);
- else
- dbg(0,"wrong object type\n");
- g_free(prefix);
- return ret;
-}
-
-static DBusHandlerResult
-empty_reply(DBusConnection *connection, DBusMessage *message)
-{
- DBusMessage *reply;
-
- reply = dbus_message_new_method_return(message);
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-static DBusHandlerResult
-request_main_get_navit(DBusConnection *connection, DBusMessage *message)
-{
- DBusMessage *reply;
- DBusError error;
- struct iter *iter;
- struct navit *navit;
- char *opath;
-
- dbus_error_init(&error);
-
- if (!dbus_message_get_args(message, &error, DBUS_TYPE_OBJECT_PATH, &opath, DBUS_TYPE_INVALID)) {
- dbg(0,"Error parsing\n");
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- dbg(0,"opath=%s\n", opath);
- iter=object_get(opath);
- navit=main_get_navit(iter);
- if (navit) {
- reply = dbus_message_new_method_return(message);
- opath=object_new("navit",navit);
- dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, &opath, DBUS_TYPE_INVALID);
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- return DBUS_HANDLER_RESULT_HANDLED;
- }
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-static DBusHandlerResult
-request_main_iter(DBusConnection *connection, DBusMessage *message)
-{
- DBusMessage *reply;
- struct iter *iter=main_iter_new();
- dbg(0,"iter=%p\n", iter);
- char *opath=object_new("main_iter",iter);
- reply = dbus_message_new_method_return(message);
- dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, &opath, DBUS_TYPE_INVALID);
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-static DBusHandlerResult
-request_main_iter_destroy(DBusConnection *connection, DBusMessage *message)
-{
- struct iter *iter;
-
- iter=object_get_from_message_arg(message, "main_iter");
- if (! iter)
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- main_iter_destroy(iter);
-
- return empty_reply(connection, message);
-}
-static int
-pcoord_get_from_message(DBusMessage *message, struct pcoord *pc)
-{
- DBusMessageIter iter,iter2;
-
- dbus_message_iter_init(message, &iter);
- dbg(0,"%s\n", dbus_message_iter_get_signature(&iter));
- dbus_message_iter_recurse(&iter, &iter2);
-
- if (dbus_message_iter_get_arg_type(&iter2) != DBUS_TYPE_INT32)
- return 0;
- dbus_message_iter_get_basic(&iter2, &pc->pro);
- dbus_message_iter_next(&iter2);
- if (dbus_message_iter_get_arg_type(&iter2) != DBUS_TYPE_INT32)
- return 0;
- dbus_message_iter_get_basic(&iter2, &pc->x);
- dbus_message_iter_next(&iter2);
- if (dbus_message_iter_get_arg_type(&iter2) != DBUS_TYPE_INT32)
- return 0;
- dbus_message_iter_get_basic(&iter2, &pc->y);
- dbus_message_iter_next(&iter2);
- if (dbus_message_iter_get_arg_type(&iter2) != DBUS_TYPE_INVALID)
- return 0;
- return 1;
-}
-
-static DBusHandlerResult
-request_navit_set_center(DBusConnection *connection, DBusMessage *message)
-{
- struct pcoord pc;
- struct navit *navit;
- navit=object_get_from_message(message, "navit");
- if (! navit)
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- if (!pcoord_get_from_message(message, &pc))
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- navit_set_center(navit, &pc);
- return empty_reply(connection, message);
-}
-
-static DBusHandlerResult
-navit_handler_func(DBusConnection *connection, DBusMessage *message, void *user_data)
-{
- dbg(0,"type=%s interface=%s path=%s member=%s signature=%s\n", dbus_message_type_to_string(dbus_message_get_type(message)), dbus_message_get_interface(message), dbus_message_get_path(message), dbus_message_get_member(message), dbus_message_get_signature(message));
-#if 0
- if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Introspectable", "Introspect")) {
- DBusMessage *reply;
- gchar *idata;
- dbg(0,"Introspect\n");
- if (! strcmp(dbus_message_get_path(message), "/org/navit_project/navit")) {
- g_file_get_contents("binding/dbus/navit.introspect", &idata, NULL, NULL);
- reply = dbus_message_new_method_return(message);
- dbus_message_append_args(reply, DBUS_TYPE_STRING, &idata, DBUS_TYPE_INVALID);
- dbus_connection_send (connection, reply, NULL);
- dbus_message_unref (reply);
- g_free(idata);
- return DBUS_HANDLER_RESULT_HANDLED;
- }
- }
-#endif
- if (dbus_message_is_method_call (message, "org.navit_project.navit", "iter") &&
- dbus_message_has_signature(message, ""))
- return request_main_iter(connection, message);
- if (dbus_message_is_method_call (message, "org.navit_project.navit", "iter_destroy") &&
- dbus_message_has_signature(message, "o"))
- return request_main_iter_destroy(connection, message);
- if (dbus_message_is_method_call (message, "org.navit_project.navit", "get_navit") &&
- dbus_message_has_signature(message,"o"))
- return request_main_get_navit(connection, message);
- if (dbus_message_is_method_call (message, "org.navit_project.navit.navit", "set_center") &&
- dbus_message_has_signature(message,"(iii)"))
- return request_navit_set_center(connection, message);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-static DBusObjectPathVTable dbus_navit_vtable = {
- NULL,
- navit_handler_func,
- NULL
-};
-
-#if 0
-DBusHandlerResult
-filter(DBusConnection *connection, DBusMessage *message, void *user_data)
-{
- dbg(0,"type=%s interface=%s path=%s member=%s signature=%s\n", dbus_message_type_to_string(dbus_message_get_type(message)), dbus_message_get_interface(message), dbus_message_get_path(message), dbus_message_get_member(message), dbus_message_get_signature(message));
- if (dbus_message_is_signal(message, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) {
- }
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-#endif
-
-void plugin_init(void)
-{
- DBusError error;
-
- object_hash=g_hash_table_new(g_str_hash, g_str_equal);
- object_count=g_hash_table_new(g_str_hash, g_str_equal);
- dbg(0,"enter 1\n");
- dbus_error_init(&error);
- connection = dbus_bus_get(DBUS_BUS_SESSION, &error);
- if (!connection) {
- dbg(0,"Failed to open connection to session message bus: %s", error.message);
- dbus_error_free(&error);
- return;
- }
- dbus_connection_setup_with_g_main(connection, NULL);
-#if 0
- dbus_connection_add_filter(connection, filter, NULL, NULL);
- dbus_bus_add_match(connection, "type='signal',""interface='" DBUS_INTERFACE_DBUS "'", &error);
-#endif
- dbus_connection_register_fallback(connection, object_path, &dbus_navit_vtable, NULL);
- dbus_bus_request_name(connection, service_name, 0, &error);
- if (dbus_error_is_set(&error)) {
- dbg(0,"Failed to request name: %s", error.message);
- dbus_error_free (&error);
- }
-}
diff --git a/navit/binding/dbus/navit.introspect b/navit/binding/dbus/navit.introspect
deleted file mode 100644
index 8afea2d6..00000000
--- a/navit/binding/dbus/navit.introspect
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
-"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-<node>
- <interface name="org.navit_project.navit">
- <method name="iter_new">
- <arg name="iter" type="o" direction="out"/>
- </method>
- <method name="get_navit">
- <arg name="iter" type="o" direction="in"/>
- <arg name="navit" type="o" direction="out"/>
- </method>
- <method name="iter_destroy">
- <arg name="iter" type="o" direction="in"/>
- </method>
- </interface>
-</node>
diff --git a/navit/binding/dbus/test.py b/navit/binding/dbus/test.py
deleted file mode 100755
index 5f69fddb..00000000
--- a/navit/binding/dbus/test.py
+++ /dev/null
@@ -1,11 +0,0 @@
-#! /usr/bin/python
-import dbus
-bus = dbus.SessionBus()
-conn = bus.get_object('org.navit-project.navit',
- '/org/navit_project/navit')
-iface = dbus.Interface(conn, dbus_interface='org.navit_project.navit');
-iter=iface.iter();
-navit=bus.get_object('org.navit-project.navit', conn.get_navit(iter));
-iface.iter_destroy(iter);
-navit_iface = dbus.Interface(navit, dbus_interface='org.navit_project.navit.navit');
-navit_iface.set_center((1,0x138a4a,0x5d773f));
diff --git a/navit/binding/python/Makefile.am b/navit/binding/python/Makefile.am
deleted file mode 100644
index 1d791195..00000000
--- a/navit/binding/python/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ @PYTHON_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=binding_python
-modulebinding_LTLIBRARIES = libbinding_python.la
-libbinding_python_la_SOURCES = binding_python.c
-libbinding_python_la_LIBADD = @PYTHON_LIBS@
diff --git a/navit/binding/python/binding_python.c b/navit/binding/python/binding_python.c
deleted file mode 100644
index cb33f83b..00000000
--- a/navit/binding/python/binding_python.c
+++ /dev/null
@@ -1,283 +0,0 @@
-#include "config.h"
-#include <glib.h>
-#include <Python.h>
-#include <fcntl.h>
-#include "coord.h"
-#include "projection.h"
-#include "map.h"
-#include "mapset.h"
-#include "plugin.h"
-
-#if defined(MS_WINDOWS) || defined(__CYGWIN__)
-#define Obj_HEAD PyObject_HEAD_INIT(NULL);
-#else
-#define Obj_HEAD PyObject_HEAD_INIT(&PyType_Type)
-#endif
-
-/* *** coord *** */
-
-typedef struct {
- PyObject_HEAD
- struct coord *c;
-} coordObject;
-
-static void coord_destroy_py(coordObject *self);
-
-PyTypeObject coord_Type = {
- Obj_HEAD
- .tp_name="coord",
- .tp_basicsize=sizeof(coordObject),
- .tp_dealloc=(destructor)coord_destroy_py,
-};
-
-
-/* *** map *** */
-
-typedef struct {
- PyObject_HEAD
- struct map *m;
-} mapObject;
-
-static void map_destroy_py(mapObject *self);
-static PyObject *map_getattr_py(PyObject *self, char *name);
-
-PyTypeObject map_Type = {
- Obj_HEAD
- .tp_name="map",
- .tp_basicsize=sizeof(mapObject),
- .tp_dealloc=(destructor)map_destroy_py,
- .tp_getattr=map_getattr_py,
-};
-
-/* *** IMPLEMENTATIONS *** */
-
-/* *** coord *** */
-
-static PyObject *
-coord_new_py(PyObject *self, PyObject *args)
-{
- coordObject *ret;
- int x,y;
- if (!PyArg_ParseTuple(args, "ii:navit.coord",&x,&y))
- return NULL;
- ret=PyObject_NEW(coordObject, &coord_Type);
- ret->c=coord_new(x,y);
- return (PyObject *)ret;
-}
-
-static void
-coord_destroy_py(coordObject *self)
-{
- coord_destroy(self->c);
-}
-
-/* *** coord_rect *** */
-
-typedef struct {
- PyObject_HEAD
- struct coord_rect *r;
-} coord_rectObject;
-
-
-static void coord_rect_destroy_py(coord_rectObject *self);
-
-PyTypeObject coord_rect_Type = {
-#if defined(MS_WINDOWS) || defined(__CYGWIN__)
- PyObject_HEAD_INIT(NULL);
-#else
- PyObject_HEAD_INIT(&PyType_Type)
-#endif
- .tp_name="coord_rect",
- .tp_basicsize=sizeof(coord_rectObject),
- .tp_dealloc=(destructor)coord_rect_destroy_py,
-};
-
-static PyObject *
-coord_rect_new_py(PyObject *self, PyObject *args)
-{
- coord_rectObject *ret;
- coordObject *lu,*rd;
- if (!PyArg_ParseTuple(args, "O!O!:navit.coord_rect_rect",&coord_Type,&lu,&coord_Type,&rd))
- return NULL;
- ret=PyObject_NEW(coord_rectObject, &coord_rect_Type);
- ret->r=coord_rect_new(lu->c,rd->c);
- return (PyObject *)ret;
-}
-
-static void
-coord_rect_destroy_py(coord_rectObject *self)
-{
- coord_rect_destroy(self->r);
-}
-
-/* *** map_rect *** */
-
-typedef struct {
- PyObject_HEAD
- struct map_rect *mr;
-} map_rectObject;
-
-
-static void map_rect_destroy_py(map_rectObject *self);
-
-PyTypeObject map_rect_Type = {
-#if defined(MS_WINDOWS) || defined(__CYGWIN__)
- PyObject_HEAD_INIT(NULL);
-#else
- PyObject_HEAD_INIT(&PyType_Type)
-#endif
- .tp_name="map_rect",
- .tp_basicsize=sizeof(map_rectObject),
- .tp_dealloc=(destructor)map_rect_destroy_py,
-};
-
-static PyObject *
-map_rect_new_py(mapObject *self, PyObject *args)
-{
- map_rectObject *ret;
- coord_rectObject *r;
- if (!PyArg_ParseTuple(args, "O!:navit.map_rect_rect",&coord_rect_Type,&r))
- return NULL;
- ret=PyObject_NEW(map_rectObject, &map_rect_Type);
- ret->mr=map_rect_new(self->m, NULL);
- return (PyObject *)ret;
-}
-
-static void
-map_rect_destroy_py(map_rectObject *self)
-{
- map_rect_destroy(self->mr);
-}
-
-
-/* *** map *** */
-
-
-
-static PyMethodDef map_methods[] = {
- {"map_rect_new", (PyCFunction) map_rect_new_py, METH_VARARGS },
- {NULL, NULL },
-};
-
-static PyObject *
-map_getattr_py(PyObject *self, char *name)
-{
- return Py_FindMethod(map_methods, self, name);
-}
-
-
-static PyObject *
-map_new_py(PyObject *self, PyObject *args)
-{
- mapObject *ret;
- char *type, *filename;
-
- if (!PyArg_ParseTuple(args, "ss:navit.map", &type, &filename))
- return NULL;
- ret=PyObject_NEW(mapObject, &map_Type);
- ret->m=map_new(type,NULL);
- return (PyObject *)ret;
-}
-
-static void
-map_destroy_py(mapObject *self)
-{
- map_destroy(self->m);
-}
-
-/* *** mapset *** */
-
-
-typedef struct {
- PyObject_HEAD
- struct mapset *ms;
-} mapsetObject;
-
-
-static void mapset_destroy_py(mapsetObject *self);
-static PyObject *mapset_getattr_py(PyObject *self, char *name);
-
-PyTypeObject mapset_Type = {
-#if defined(MS_WINDOWS) || defined(__CYGWIN__)
- PyObject_HEAD_INIT(NULL);
-#else
- PyObject_HEAD_INIT(&PyType_Type)
-#endif
- .tp_name="mapset",
- .tp_basicsize=sizeof(mapsetObject),
- .tp_dealloc=(destructor)mapset_destroy_py,
- .tp_getattr=mapset_getattr_py,
-};
-
-static PyObject *
-mapset_add_py(mapsetObject *self, PyObject *args)
-{
- mapObject *map;
- if (!PyArg_ParseTuple(args, "O:navit.mapset", &map))
- return NULL;
- Py_INCREF(map);
- mapset_add(self->ms, map->m);
- return Py_BuildValue("");
-}
-
-static PyMethodDef mapset_methods[] = {
- {"add", (PyCFunction) mapset_add_py, METH_VARARGS },
- {NULL, NULL },
-};
-
-static PyObject *
-mapset_getattr_py(PyObject *self, char *name)
-{
- return Py_FindMethod(mapset_methods, self, name);
-}
-
-static PyObject *
-mapset_new_py(PyObject *self, PyObject *args)
-{
- mapsetObject *ret;
- if (!PyArg_ParseTuple(args, ":navit.mapset"))
- return NULL;
- ret=PyObject_NEW(mapsetObject, &mapset_Type);
- ret->ms=mapset_new();
- return (PyObject *)ret;
-}
-
-static void
-mapset_destroy_py(mapsetObject *self)
-{
- mapset_destroy(self->ms);
-}
-
-
-
-static PyMethodDef navitMethods[]={
- {"coord", coord_new_py, METH_VARARGS, "Create a new coordinate point."},
- {"coord_rect", coord_rect_new_py, METH_VARARGS, "Create a new coordinate rectangle."},
- {"map", map_new_py, METH_VARARGS, "Create a new map."},
- {"mapset", mapset_new_py, METH_VARARGS, "Create a new mapset."},
- {NULL, NULL, 0, NULL}
-};
-
-
-void
-plugin_init(void)
-{
- int fd,size;
- char buffer[65536];
-
- return;
-
- Py_Initialize();
- Py_InitModule("navit", navitMethods);
- fd=open("startup.py",O_RDONLY);
- if (fd >= 0) {
- size=read(fd, buffer, 65535);
- if (size > 0) {
- buffer[size]='\0';
- PyRun_SimpleString(buffer);
- }
- }
-
- Py_Finalize();
- exit(0);
-}
diff --git a/navit/callback.c b/navit/callback.c
deleted file mode 100644
index b8c386aa..00000000
--- a/navit/callback.c
+++ /dev/null
@@ -1,173 +0,0 @@
-#include <glib.h>
-#include <string.h>
-#include "item.h"
-#include "debug.h"
-#include "callback.h"
-
-struct callback {
- void (*func)();
- int pcount;
- enum attr_type type;
- void *p[0];
-
-};
-
-struct callback_list {
- GList *list;
-};
-
-struct callback_list *
-callback_list_new(void)
-{
- struct callback_list *ret=g_new0(struct callback_list, 1);
-
- return ret;
-}
-
-struct callback *
-callback_new_attr(void (*func)(void), enum attr_type type, int pcount, void **p)
-{
- struct callback *ret;
- int i;
-
- ret=g_malloc0(sizeof(struct callback)+pcount*sizeof(void *));
- ret->func=func;
- ret->pcount=pcount;
- ret->type=type;
- for (i = 0 ; i < pcount ; i++) {
- ret->p[i]=p[i];
- }
- return ret;
-}
-
-struct callback *
-callback_new(void (*func)(void), int pcount, void **p)
-{
- return callback_new_attr(func, attr_none, pcount, p);
-}
-
-void
-callback_set_arg(struct callback *cb, int arg, void *p)
-{
- if (arg < 0 || arg > cb->pcount)
- return;
- cb->p[arg]=p;
-}
-
-void
-callback_list_add(struct callback_list *l, struct callback *cb)
-{
- l->list=g_list_prepend(l->list, cb);
-}
-
-
-struct callback *
-callback_list_add_new(struct callback_list *l, void (*func)(void), int pcount, void **p)
-{
- struct callback *ret;
-
- ret=callback_new(func, pcount, p);
- callback_list_add(l, ret);
- return ret;
-}
-
-void
-callback_list_remove(struct callback_list *l, struct callback *cb)
-{
- l->list=g_list_remove(l->list, cb);
-}
-
-void
-callback_list_remove_destroy(struct callback_list *l, struct callback *cb)
-{
- callback_list_remove(l, cb);
- g_free(cb);
-}
-
-void
-callback_call(struct callback *cb, int pcount, void **p)
-{
- int i;
- void *pf[8];
- if (! cb)
- return;
- if (cb->pcount + pcount <= 8) {
- dbg(1,"cb->pcount=%d\n", cb->pcount);
- if (cb->pcount && cb->p)
- dbg(1,"cb->p[0]=%p\n", cb->p[0]);
- dbg(1,"pcount=%d\n", pcount);
- if (pcount && p)
- dbg(1,"p[0]=%p\n", p[0]);
- for (i = 0 ; i < cb->pcount ; i++)
- pf[i]=cb->p[i];
- for (i = 0 ; i < pcount ; i++)
- pf[i+cb->pcount]=p[i];
- switch (cb->pcount+pcount) {
- case 8:
- cb->func(pf[0],pf[1],pf[2],pf[3],pf[4],pf[5],pf[6],pf[7]);
- break;
- case 7:
- cb->func(pf[0],pf[1],pf[2],pf[3],pf[4],pf[5],pf[6]);
- break;
- case 6:
- cb->func(pf[0],pf[1],pf[2],pf[3],pf[4],pf[5]);
- break;
- case 5:
- cb->func(pf[0],pf[1],pf[2],pf[3],pf[4]);
- break;
- case 4:
- cb->func(pf[0],pf[1],pf[2],pf[3]);
- break;
- case 3:
- cb->func(pf[0],pf[1],pf[2]);
- break;
- case 2:
- cb->func(pf[0],pf[1]);
- break;
- case 1:
- cb->func(pf[0]);
- break;
- case 0:
- cb->func();
- break;
- }
- } else {
- g_warning("too many parameters for callback (%d+%d)\n", cb->pcount, pcount);
- }
-}
-
-void
-callback_list_call_attr(struct callback_list *l, enum attr_type type, int pcount, void **p)
-{
- GList *cbi;
- struct callback *cb;
-
- cbi=l->list;
- while (cbi) {
- cb=cbi->data;
- if (type == attr_any || cb->type == attr_any || cb->type == type)
- callback_call(cb, pcount, p);
- cbi=g_list_next(cbi);
- }
-
-}
-
-void
-callback_list_call(struct callback_list *l, int pcount, void **p)
-{
- callback_list_call_attr(l, attr_any, pcount, p);
-}
-
-
-void
-callback_list_destroy(struct callback_list *l)
-{
- GList *cbi;
- cbi=l->list;
- while (cbi) {
- g_free(cbi->data);
- cbi=g_list_next(cbi);
- }
- g_list_free(l->list);
- g_free(l);
-}
diff --git a/navit/callback.h b/navit/callback.h
deleted file mode 100644
index ebdaf047..00000000
--- a/navit/callback.h
+++ /dev/null
@@ -1,130 +0,0 @@
-#ifndef NAVIT_CALLBACK_H
-#define NAVIT_CALLBACK_H
-
-#include "item.h"
-#include "attr.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* prototypes */
-enum attr_type;
-struct callback;
-struct callback_list;
-struct callback_list *callback_list_new(void);
-struct callback * callback_new_attr(void (*func)(void), enum attr_type type, int pcount, void **p);
-struct callback *callback_new(void (*func)(void), int pcount, void **p);
-void callback_set_arg(struct callback *cb, int arg, void *p);
-void callback_list_add(struct callback_list *l, struct callback *cb);
-struct callback *callback_list_add_new(struct callback_list *l, void (*func)(void), int pcount, void **p);
-void callback_list_remove(struct callback_list *l, struct callback *cb);
-void callback_list_remove_destroy(struct callback_list *l, struct callback *cb);
-void callback_call(struct callback *cb, int pcount, void **p);
-void callback_list_call_attr(struct callback_list *l, enum attr_type type, int pcount, void **p);
-void callback_list_call(struct callback_list *l, int pcount, void **p);
-void callback_list_destroy(struct callback_list *l);
-/* end of prototypes */
-
-static inline struct callback *callback_new_attr_0(void (*func)(void), enum attr_type type)
-{
- return callback_new_attr(func, type, 0, NULL);
-}
-
-static inline struct callback *callback_new_0(void (*func)(void))
-{
- return callback_new(func, 0, NULL);
-}
-
-static inline struct callback *callback_new_attr_1(void (*func)(void), enum attr_type type, void *p1)
-{
- void *p[1];
- p[0]=p1;
- return callback_new_attr(func, type, 1, p);
-}
-
-static inline struct callback *callback_new_1(void (*func)(void), void *p1)
-{
- void *p[1];
- p[0]=p1;
- return callback_new(func, 1, p);
-}
-
-static inline struct callback *callback_new_attr_2(void (*func)(void), enum attr_type type, void *p1, void *p2)
-{
- void *p[2];
- p[0]=p1;
- p[1]=p2;
- return callback_new_attr(func, type, 2, p);
-}
-
-static inline struct callback *callback_new_2(void (*func)(void), void *p1, void *p2)
-{
- void *p[2];
- p[0]=p1;
- p[1]=p2;
- return callback_new(func, 2, p);
-}
-
-static inline struct callback *callback_new_3(void (*func)(void), void *p1, void *p2, void *p3)
-{
- void *p[3];
- p[0]=p1;
- p[1]=p2;
- p[2]=p3;
- return callback_new(func, 3, p);
-}
-
-static inline void callback_call_0(struct callback *cb)
-{
- callback_call(cb, 0, NULL);
-}
-
-static inline void callback_call_1(struct callback *cb, void *p1)
-{
- void *p[1];
- p[0]=p1;
- callback_call(cb, 1, p);
-}
-
-static inline void callback_list_call_0(struct callback_list *l)
-{
- callback_list_call(l, 0, NULL);
-}
-
-static inline void callback_list_call_attr_1(struct callback_list *l, enum attr_type type, void *p1)
-{
- void *p[1];
- p[0]=p1;
- callback_list_call_attr(l, type, 1, p);
-}
-
-static inline void callback_list_call_1(struct callback_list *l, void *p1)
-{
- void *p[1];
- p[0]=p1;
- callback_list_call(l, 1, p);
-}
-
-static inline void callback_list_call_attr_2(struct callback_list *l, enum attr_type type, void *p1, void *p2)
-{
- void *p[2];
- p[0]=p1;
- p[1]=p2;
- callback_list_call_attr(l, type, 2, p);
-}
-
-static inline void callback_list_call_2(struct callback_list *l, void *p1, void *p2)
-{
- void *p[2];
- p[0]=p1;
- p[1]=p2;
- callback_list_call(l, 2, p);
-}
-
-#define callback_cast(x) (void (*)(void))(x)
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/navit/color.h b/navit/color.h
deleted file mode 100644
index 17d3d9c8..00000000
--- a/navit/color.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef NAVIT_COLOR_H
-#define NAVIT_COLOR_H
-
-struct color {
- int r,g,b,a;
-};
-
-#endif
diff --git a/navit/compass.c b/navit/compass.c
deleted file mode 100644
index 7bb9ee81..00000000
--- a/navit/compass.c
+++ /dev/null
@@ -1,137 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <glib.h>
-#include "point.h"
-#include "coord.h"
-#include "graphics.h"
-#include "transform.h"
-#include "item.h"
-#include "route.h"
-#include "vehicle.h"
-#include "navit.h"
-#include "compass.h"
-
-#if 0
-struct compass {
- struct graphics *gr;
- struct graphics_gc *bg;
- struct graphics_gc *white;
- struct graphics_gc *green;
- struct graphics_font *font;
-};
-
-static void
-transform_rotate(struct point *center, int angle, struct point *p, int count)
-{
- int i,x,y;
- double dx,dy;
- for (i = 0 ; i < count ; i++)
- {
- dx=sin(M_PI*angle/180.0);
- dy=cos(M_PI*angle/180.0);
- x=dy*p->x-dx*p->y;
- y=dx*p->x+dy*p->y;
-
- p->x=center->x+x;
- p->y=center->y+y;
- p++;
- }
-}
-
-static void
-handle(struct graphics *gr, struct graphics_gc *gc, struct point *p, int r, int dir)
-{
- struct point ph[3];
- int l=r*0.4;
-
- ph[0].x=0;
- ph[0].y=r;
- ph[1].x=0;
- ph[1].y=-r;
- transform_rotate(p, dir, ph, 2);
- gr->draw_lines(gr, gc, ph, 2);
- ph[0].x=-l;
- ph[0].y=-r+l;
- ph[1].x=0;
- ph[1].y=-r;
- ph[2].x=l;
- ph[2].y=-r+l;
- transform_rotate(p, dir, ph, 3);
- gr->draw_lines(gr, gc, ph, 3);
-}
-
-void
-compass_draw(struct compass *comp, struct container *co)
-{
- struct point p;
- struct coord *pos, *dest;
- double *vehicle_dir,dir,distance;
- int dx,dy;
- char buffer[16];
-
- if (! co->vehicle)
- return;
-
- vehicle_dir=vehicle_dir_get(co->vehicle);
- comp->gr->draw_mode(comp->gr, draw_mode_begin);
- p.x=0;
- p.y=0;
- comp->gr->draw_rectangle(comp->gr, comp->bg, &p, 60, 80);
- p.x=30;
- p.y=30;
- comp->gr->draw_circle(comp->gr, comp->white, &p, 50);
- if (co->flags->orient_north)
- handle(comp->gr,comp->white, &p, 20,0);
- else
- handle(comp->gr, comp->white, &p, 20, -*vehicle_dir);
-#if 0 /* FIXME */
- dest=route_get_destination(co->route);
- if (dest) {
- pos=vehicle_pos_get(co->vehicle);
- dx=dest->x-pos->x;
- dy=dest->y-pos->y;
- dir=atan2(dx,dy)*180.0/M_PI;
-#if 0
- printf("dx %d dy %d dir=%f vehicle_dir=%f\n", dx, dy, dir, *vehicle_dir);
-#endif
- if (! co->flags->orient_north)
- dir-=*vehicle_dir;
- handle(comp->gr, comp->green, &p, 20, dir);
- p.x=8;
- p.y=72;
- distance=transform_distance(projection_mg, pos, dest)/1000.0;
- if (distance >= 100)
- sprintf(buffer,"%.0f km", distance);
- else if (distance >= 10)
- sprintf(buffer,"%.1f km", distance);
- else
- sprintf(buffer,"%.2f km", distance);
-
- comp->gr->draw_text(comp->gr, comp->green, NULL, comp->font, buffer, &p, 0x10000, 0);
- }
-#endif
- comp->gr->draw_mode(comp->gr, draw_mode_end);
-}
-
-struct compass *
-compass_new(struct container *co)
-{
- struct compass *this=g_new0(struct compass, 1);
- struct point p;
- p.x=10;
- p.y=10;
- this->gr=co->gra->overlay_new(co->gra, &p, 60, 80);
- this->bg=this->gr->gc_new(this->gr);
- this->gr->gc_set_foreground(this->bg, 0, 0, 0);
- this->white=this->gr->gc_new(this->gr);
- this->gr->gc_set_foreground(this->white, 0xffff, 0xffff, 0xffff);
- this->gr->gc_set_linewidth(this->white, 2);
- this->green=this->gr->gc_new(this->gr);
- this->gr->gc_set_foreground(this->green, 0x0, 0xffff, 0x0);
- this->gr->gc_set_linewidth(this->green, 2);
-
- this->font=this->gr->font_new(this->gr, 200);
- compass_draw(this, co);
- return this;
-}
-#endif
diff --git a/navit/compass.h b/navit/compass.h
deleted file mode 100644
index cb864170..00000000
--- a/navit/compass.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef NAVIT_COMPASS_H
-#define NAVIT_COMPASS_H
-
-struct compass * compass_new(struct container *co);
-void compass_draw(struct compass *comp, struct container *co);
-
-#endif
diff --git a/navit/coord.c b/navit/coord.c
deleted file mode 100644
index 9e554b27..00000000
--- a/navit/coord.c
+++ /dev/null
@@ -1,251 +0,0 @@
-#include <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "debug.h"
-#include "coord.h"
-#include "transform.h"
-#include "projection.h"
-/**
- * @defgroup coord Coordinate handling functions
- * @{
- */
-
-/**
- * Get a coordinate
- *
- * @param p Pointer to the coordinate
- * @returns the coordinate
- */
-
-struct coord *
-coord_get(unsigned char **p)
-{
- struct coord *ret=(struct coord *)(*p);
- *p += sizeof(*ret);
- return ret;
-}
-
-struct coord *
-coord_new(int x, int y)
-{
- struct coord *c=g_new(struct coord, 1);
-
- c->x=x;
- c->y=y;
-
- return c;
-}
-
-void
-coord_destroy(struct coord *c)
-{
- g_free(c);
-}
-
-struct coord_rect *
-coord_rect_new(struct coord *lu, struct coord *rl)
-{
- struct coord_rect *r=g_new(struct coord_rect, 1);
-
- g_assert(lu->x <= rl->x);
- g_assert(lu->y >= rl->y);
-
- r->lu=*lu;
- r->rl=*rl;
-
- return r;
-
-}
-
-void
-coord_rect_destroy(struct coord_rect *r)
-{
- g_free(r);
-}
-
-int
-coord_rect_overlap(struct coord_rect *r1, struct coord_rect *r2)
-{
- g_assert(r1->lu.x <= r1->rl.x);
- g_assert(r1->lu.y >= r1->rl.y);
- g_assert(r2->lu.x <= r2->rl.x);
- g_assert(r2->lu.y >= r2->rl.y);
- dbg(1,"0x%x,0x%x - 0x%x,0x%x vs 0x%x,0x%x - 0x%x,0x%x\n", r1->lu.x, r1->lu.y, r1->rl.x, r1->rl.y, r2->lu.x, r2->lu.y, r2->rl.x, r2->rl.y);
- if (r1->lu.x > r2->rl.x)
- return 0;
- if (r1->rl.x < r2->lu.x)
- return 0;
- if (r1->lu.y < r2->rl.y)
- return 0;
- if (r1->rl.y > r2->lu.y)
- return 0;
- return 1;
-}
-
-int
-coord_rect_contains(struct coord_rect *r, struct coord *c)
-{
- g_assert(r->lu.x <= r->rl.x);
- g_assert(r->lu.y >= r->rl.y);
- if (c->x < r->lu.x)
- return 0;
- if (c->x > r->rl.x)
- return 0;
- if (c->y < r->rl.y)
- return 0;
- if (c->y > r->lu.y)
- return 0;
- return 1;
-}
-
-void
-coord_rect_extend(struct coord_rect *r, struct coord *c)
-{
- if (c->x < r->lu.x)
- r->lu.x=c->x;
- if (c->x > r->rl.x)
- r->rl.x=c->x;
- if (c->y < r->rl.y)
- r->rl.y=c->y;
- if (c->y > r->lu.y)
- r->lu.y=c->y;
-}
-
- /* [Proj:][Ã]DMM.ss[S][S]... N/S [D][D]DMM.ss[S][S]... E/W */
- /* [Proj:][-][D]D.d[d]... [-][D][D]D.d[d]... */
- /* [Proj:][-]0xX [-]0xX */
-/*
- * Currently supported:
- * [Proj:]-0xX [-]0xX
- * - where Proj can be mg/garmin, defaults to mg
- * [Proj:][D][D]Dmm.ss[S][S] N/S [D][D]DMM.ss[S][S]... E/W
- * [Proj:][-][D]D.d[d]... [-][D][D]D.d[d]
- * - where Proj can be geo
- */
-
-int
-coord_parse(const char *c_str, enum projection pro, struct coord *c_ret)
-{
- int debug=0;
- char *proj=NULL,*s,*co;
- const char *str=c_str;
- int args,ret = 0;
- struct coord_geo g;
- struct coord c;
- enum projection str_pro=projection_none;
-
- dbg(1,"enter('%s',%d,%p)\n", c_str, pro, c_ret);
- s=strchr(str,' ');
- co=strchr(str,':');
- if (co && co < s) {
- proj=malloc(co-str+1);
- strncpy(proj, str, co-str);
- proj[co-str]='\0';
- dbg(1,"projection=%s\n", proj);
- str=co+1;
- s=strchr(str,' ');
- if (!strcmp(proj, "mg"))
- str_pro = projection_mg;
- else if (!strcmp(proj, "garmin"))
- str_pro = projection_garmin;
- else if (!strcmp(proj, "geo"))
- str_pro = projection_none;
- else {
- dbg(0, "Unknown projection: %s\n", proj);
- goto out;
- }
- }
- if (! s)
- return 0;
- while (*s == ' ') {
- s++;
- }
- if (!strncmp(s, "0x", 2) || !strncmp(s, "-0x", 3)) {
- args=sscanf(str, "%i %i%n",&c.x, &c.y, &ret);
- if (args < 2)
- goto out;
- dbg(1,"str='%s' x=0x%x y=0x%x c=%d\n", str, c.x, c.y, ret);
- dbg(1,"rest='%s'\n", str+ret);
-
- if (str_pro == projection_none)
- str_pro=projection_mg;
- if (str_pro != pro) {
- transform_to_geo(str_pro, &c, &g);
- transform_from_geo(pro, &g, &c);
- }
- *c_ret=c;
- } else if (*s == 'N' || *s == 'n' || *s == 'S' || *s == 's') {
- double lng, lat;
- char ns, ew;
- dbg(1,"str='%s'\n", str);
- args=sscanf(str, "%lf %c %lf %c%n", &lat, &ns, &lng, &ew, &ret);
- if (args < 4)
- goto out;
- if (str_pro == projection_none) {
- g.lat=floor(lat/100);
- lat-=g.lat*100;
- g.lat+=lat/60;
- g.lng=floor(lng/100);
- lng-=g.lng*100;
- g.lng+=lng/60;
- if (ns == 's' || ns == 'S')
- g.lat=-g.lat;
- if (ew == 'w' || ew == 'W')
- g.lng=-g.lng;
- transform_from_geo(pro, &g, c_ret);
- }
- dbg(3,"str='%s' x=%f ns=%c y=%f ew=%c c=%d\n", str, lng, ns, lat, ew, ret);
- dbg(3,"rest='%s'\n", str+ret);
- } else {
- double lng, lat;
- args=sscanf(str, "%lf %lf%n", &lng, &lat, &ret);
- if (args < 2)
- goto out;
- dbg(1,"str='%s' x=%f y=%f c=%d\n", str, lng, lat, ret);
- dbg(1,"rest='%s'\n", str+ret);
- g.lng=lng;
- g.lat=lat;
- transform_from_geo(pro, &g, c_ret);
- }
- if (debug)
- printf("rest='%s'\n", str+ret);
- ret+=str-c_str;
- if (debug) {
- printf("args=%d\n", args);
- printf("ret=%d delta=%d ret_str='%s'\n", ret, str-c_str, c_str+ret);
- }
-out:
- if (proj)
- free(proj);
- return ret;
-}
-
-void
-coord_print(enum projection pro, struct coord *c, FILE *out) {
- unsigned int x;
- unsigned int y;
- char *sign_x = "";
- char *sign_y = "";
-
- if ( c->x < 0 ) {
- x = -c->x;
- sign_x = "-";
- } else {
- x = c->x;
- }
- if ( c->y < 0 ) {
- y = -c->y;
- sign_y = "-";
- } else {
- y = c->y;
- }
- fprintf( out, "%s: %s0x%x %s0x%x\n",
- projection_to_name( pro ),
- sign_x, x,
- sign_y, y );
- return;
-}
-
-/** @} */
diff --git a/navit/coord.h b/navit/coord.h
deleted file mode 100644
index e92ae9a8..00000000
--- a/navit/coord.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef NAVIT_COORD_H
-#define NAVIT_COORD_H
-#include <stdio.h>
-#include "projection.h"
-
-/*! A integer mercator coordinate */
-struct coord {
- int x; /*!< X-Value */
- int y; /*!< Y-Value */
-};
-
-/*! A integer mercator coordinate carrying its projection */
-struct pcoord {
- enum projection pro;
- int x; /*!< X-Value */
- int y; /*!< Y-Value */
-};
-
-struct coord_rect {
- struct coord lu;
- struct coord rl;
-};
-
-//! A double mercator coordinate
-struct coord_d {
- double x; /*!< X-Value */
- double y; /*!< Y-Value */
-};
-
-//! A WGS84 coordinate
-struct coord_geo {
- double lng; /*!< Longitude */
- double lat; /*!< Latitude */
-};
-
-//! A cartesian coordinate
-struct coord_geo_cart {
- double x; /*!< X-Value */
- double y; /*!< Y-Value */
- double z; /*!< Z-Value */
-};
-
-enum projection;
-
-struct coord * coord_get(unsigned char **p);
-struct coord * coord_new(int x, int y);
-void coord_destroy(struct coord *c);
-int coord_parse(const char *c_str, enum projection pro, struct coord *c_ret);
-void coord_print(enum projection pro, struct coord *c, FILE *out);
-struct coord_rect * coord_rect_new(struct coord *lu, struct coord *rl);
-void coord_rect_destroy(struct coord_rect *r);
-int coord_rect_overlap(struct coord_rect *r1, struct coord_rect *r2);
-int coord_rect_contains(struct coord_rect *r, struct coord *c);
-void coord_rect_extend(struct coord_rect *r, struct coord *c);
-
-
-#endif
diff --git a/navit/country.c b/navit/country.c
deleted file mode 100644
index 0fa7a084..00000000
--- a/navit/country.c
+++ /dev/null
@@ -1,413 +0,0 @@
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <libintl.h>
-#include "debug.h"
-#include "item.h"
-#include "country.h"
-#include "search.h"
-
-struct country {
- int id;
- char *car;
- char *iso2;
- char *iso3;
- char *name;
-};
-
-#define gettext_noop(String) String
-#define _(STRING) gettext(STRING)
-#define _n(STRING) gettext_noop(STRING)
-
-static struct country country[]= {
- { 20, "AND", "AD", "AND", /* 020 */ _n("Andorra")},
- {784, "UAE", "AE", "ARE", /* 784 */ _n("United Arab Emirates")},
- { 4, "AFG", "AF", "AFG", /* 004 */ _n("Afghanistan")},
- { 28, "AG", "AG", "ATG", /* 028 */ _n("Antigua and Barbuda")},
- {660, NULL, "AI", "AIA", /* 660 */ _n("Anguilla")},
- { 8, "AL", "AL", "ALB", /* 008 */ _n("Albania")},
- { 51, "ARM", "AM", "ARM", /* 051 */ _n("Armenia")},
- {530, "NA", "AN", "ANT", /* 530 */ _n("Netherlands Antilles")},
- { 24, "ANG", "AO", "AGO", /* 024 */ _n("Angola")},
- { 10, NULL, "AQ", "ATA", /* 010 */ _n("Antarctica")},
- { 32, "RA", "AR", "ARG", /* 032 */ _n("Argentina")},
- { 16, NULL, "AS", "ASM", /* 016 */ _n("American Samoa")},
- { 40, "A", "AT", "AUT", /* 040 */ _n("Austria")},
- { 36, "AUS", "AU", "AUS", /* 036 */ _n("Australia")},
- {533, "ARU", "AW", "ABW", /* 533 */ _n("Aruba")},
- {248, "AX", "AX", "ALA", /* 248 */ _n("Aland Islands")},
- { 31, "AZ", "AZ", "AZE", /* 031 */ _n("Azerbaijan")},
- { 70, "BiH", "BA", "BIH", /* 070 */ _n("Bosnia and Herzegovina")},
- { 52, "BDS", "BB", "BRB", /* 052 */ _n("Barbados")},
- { 50, "BD", "BD", "BGD", /* 050 */ _n("Bangladesh")},
- { 56, "B", "BE", "BEL", /* 056 */ _n("Belgium")},
- {854, "BF", "BF", "BFA", /* 854 */ _n("Burkina Faso")},
- {100, "BG", "BG", "BGR", /* 100 */ _n("Bulgaria")},
- { 48, "BRN", "BH", "BHR", /* 048 */ _n("Bahrain")},
- {108, "RU", "BI", "BDI", /* 108 */ _n("Burundi")},
- {204, "BJ", "BJ", "BEN", /* 204 */ _n("Benin")},
- {652, NULL, "BL", "BLM", /* 652 */ _n("Saint Barthelemy")},
- { 60, NULL, "BM", "BMU", /* 060 */ _n("Bermuda")},
- { 96, "BRU", "BN", "BRN", /* 096 */ _n("Brunei Darussalam")},
- { 68, "BOL", "BO", "BOL", /* 068 */ _n("Bolivia")},
- { 76, "BR", "BR", "BRA", /* 076 */ _n("Brazil")},
- { 44, "BS", "BS", "BHS", /* 044 */ _n("Bahamas")},
- { 64, "BHT", "BT", "BTN", /* 064 */ _n("Bhutan")},
- { 74, NULL, "BV", "BVT", /* 074 */ _n("Bouvet Island")},
- { 72, "RB", "BW", "BWA", /* 072 */ _n("Botswana")},
- {112, "BY", "BY", "BLR", /* 112 */ _n("Belarus")},
- { 84, "BZ", "BZ", "BLZ", /* 084 */ _n("Belize")},
- {124, "CDN", "CA", "CAN", /* 124 */ _n("Canada")},
- {166, NULL, "CC", "CCK", /* 166 */ _n("Cocos (Keeling) Islands")},
- {180, "CGO", "CD", "COD", /* 180 */ _n("Congo, Democratic Republic of the")},
- {140, "RCA", "CF", "CAF", /* 140 */ _n("Central African Republic")},
- {178, NULL, "CG", "COG", /* 178 */ _n("Congo")},
- {756, "CH", "CH", "CHE", /* 756 */ _n("Switzerland")},
- {384, "CI", "CI", "CIV", /* 384 */ _n("Cote d'Ivoire")},
- {184, NULL, "CK", "COK", /* 184 */ _n("Cook Islands")},
- {152, "RCH", "CL", "CHL", /* 152 */ _n("Chile")},
- {120, "CAM", "CM", "CMR", /* 120 */ _n("Cameroon")},
- {156, "RC", "CN", "CHN", /* 156 */ _n("China")},
- {170, "CO", "CO", "COL", /* 170 */ _n("Colombia")},
- {188, "CR", "CR", "CRI", /* 188 */ _n("Costa Rica")},
- {192, "C", "CU", "CUB", /* 192 */ _n("Cuba")},
- {132, "CV", "CV", "CPV", /* 132 */ _n("Cape Verde")},
- {162, NULL, "CX", "CXR", /* 162 */ _n("Christmas Island")},
- {196, "CY", "CY", "CYP", /* 196 */ _n("Cyprus")},
- {203, "CZ", "CZ", "CZE", /* 203 */ _n("Czech Republic")},
- {276, "D", "DE", "DEU", /* 276 */ _n("Germany")},
- {262, "DJI", "DJ", "DJI", /* 262 */ _n("Djibouti")},
- {208, "DK", "DK", "DNK", /* 208 */ _n("Denmark")},
- {212, "WD", "DM", "DMA", /* 212 */ _n("Dominica")},
- {214, "DOM", "DO", "DOM", /* 214 */ _n("Dominican Republic")},
- { 12, "DZ", "DZ", "DZA", /* 012 */ _n("Algeria")},
- {218, "EC", "EC", "ECU", /* 218 */ _n("Ecuador")},
- {233, "EST", "EE", "EST", /* 233 */ _n("Estonia")},
- {818, "ET", "EG", "EGY", /* 818 */ _n("Egypt")},
- {732, "WSA", "EH", "ESH", /* 732 */ _n("Western Sahara")},
- {232, "ER", "ER", "ERI", /* 232 */ _n("Eritrea")},
- {724, "E", "ES", "ESP", /* 724 */ _n("Spain")},
- {231, "ETH", "ET", "ETH", /* 231 */ _n("Ethiopia")},
- {246, "FIN", "FI", "FIN", /* 246 */ _n("Finland")},
- {242, "FJI", "FJ", "FJI", /* 242 */ _n("Fiji")},
- {238, NULL, "FK", "FLK", /* 238 */ _n("Falkland Islands (Malvinas)")},
- {583, "FSM", "FM", "FSM", /* 583 */ _n("Micronesia, Federated States of")},
- {234, "FO", "FO", "FRO", /* 234 */ _n("Faroe Islands")},
- {250, "F", "FR", "FRA", /* 250 */ _n("France")},
- {266, "G", "GA", "GAB", /* 266 */ _n("Gabon")},
- {826, "GB", "GB", "GBR", /* 826 */ _n("United Kingdom")},
- {308, "WG", "GD", "GRD", /* 308 */ _n("Grenada")},
- {268, "GE", "GE", "GEO", /* 268 */ _n("Georgia")},
- {254, NULL, "GF", "GUF", /* 254 */ _n("French Guiana")},
- {831, NULL, "GG", "GGY", /* 831 */ _n("Guernsey")},
- {288, "GH", "GH", "GHA", /* 288 */ _n("Ghana")},
- {292, "GBZ", "GI", "GIB", /* 292 */ _n("Gibraltar")},
- {304, "KN", "GL", "GRL", /* 304 */ _n("Greenland")},
- {270, "WAG", "GM", "GMB", /* 270 */ _n("Gambia")},
- {324, "RG", "GN", "GIN", /* 324 */ _n("Guinea")},
- {312, NULL, "GP", "GLP", /* 312 */ _n("Guadeloupe")},
- {226, "GQ", "GQ", "GNQ", /* 226 */ _n("Equatorial Guinea")},
- {300, "GR", "GR", "GRC", /* 300 */ _n("Greece")},
- {239, NULL, "GS", "SGS", /* 239 */ _n("South Georgia and the South Sandwich Islands")},
- {320, "GCA", "GT", "GTM", /* 320 */ _n("Guatemala")},
- {316, NULL, "GU", "GUM", /* 316 */ _n("Guam")},
- {624, "GUB", "GW", "GNB", /* 624 */ _n("Guinea-Bissau")},
- {328, "GUY", "GY", "GUY", /* 328 */ _n("Guyana")},
- {344, "HK", "HK", "HKG", /* 344 */ _n("Hong Kong")},
- {334, NULL, "HM", "HMD", /* 334 */ _n("Heard Island and McDonald Islands")},
- {340, "HN", "HN", "HND", /* 340 */ _n("Honduras")},
- {191, "HR", "HR", "HRV", /* 191 */ _n("Croatia")},
- {332, "RH", "HT", "HTI", /* 332 */ _n("Haiti")},
- {348, "H", "HU", "HUN", /* 348 */ _n("Hungary")},
- {360, "RI", "ID", "IDN", /* 360 */ _n("Indonesia")},
- {372, "IRL", "IE", "IRL", /* 372 */ _n("Ireland")},
- {376, "IL", "IL", "ISR", /* 376 */ _n("Israel")},
- {833, NULL, "IM", "IMN", /* 833 */ _n("Isle of Man")},
- {356, "IND", "IN", "IND", /* 356 */ _n("India")},
- { 86, NULL, "IO", "IOT", /* 086 */ _n("British Indian Ocean Territory")},
- {368, "IRQ", "IQ", "IRQ", /* 368 */ _n("Iraq")},
- {364, "IR", "IR", "IRN", /* 364 */ _n("Iran, Islamic Republic of")},
- {352, "IS", "IS", "ISL", /* 352 */ _n("Iceland")},
- {380, "I", "IT", "ITA", /* 380 */ _n("Italy")},
- {832, NULL, "JE", "JEY", /* 832 */ _n("Jersey")},
- {388, "JA", "JM", "JAM", /* 388 */ _n("Jamaica")},
- {400, "JOR", "JO", "JOR", /* 400 */ _n("Jordan")},
- {392, "J", "JP", "JPN", /* 392 */ _n("Japan")},
- {404, "EAK", "KE", "KEN", /* 404 */ _n("Kenya")},
- {417, "KS", "KG", "KGZ", /* 417 */ _n("Kyrgyzstan")},
- {116, "K", "KH", "KHM", /* 116 */ _n("Cambodia")},
- {296, "KIR", "KI", "KIR", /* 296 */ _n("Kiribati")},
- {174, "COM", "KM", "COM", /* 174 */ _n("Comoros")},
- {659, "KAN", "KN", "KNA", /* 659 */ _n("Saint Kitts and Nevis")},
- {408, "KP", "KP", "PRK", /* 408 */ _n("Korea, Democratic People's Republic of")},
- {410, "ROK", "KR", "KOR", /* 410 */ _n("Korea, Republic of")},
- {414, "KWT", "KW", "KWT", /* 414 */ _n("Kuwait")},
- {136, NULL, "KY", "CYM", /* 136 */ _n("Cayman Islands")},
- {398, "KZ", "KZ", "KAZ", /* 398 */ _n("Kazakhstan")},
- {418, "LAO", "LA", "LAO", /* 418 */ _n("Lao People's Democratic Republic")},
- {422, "RL", "LB", "LBN", /* 422 */ _n("Lebanon")},
- {662, "WL", "LC", "LCA", /* 662 */ _n("Saint Lucia")},
- {438, "FL", "LI", "LIE", /* 438 */ _n("Liechtenstein")},
- {144, "CL", "LK", "LKA", /* 144 */ _n("Sri Lanka")},
- {430, "LB", "LR", "LBR", /* 430 */ _n("Liberia")},
- {426, "LS", "LS", "LSO", /* 426 */ _n("Lesotho")},
- {440, "LT", "LT", "LTU", /* 440 */ _n("Lithuania")},
- {442, "L", "LU", "LUX", /* 442 */ _n("Luxembourg")},
- {428, "LV", "LV", "LVA", /* 428 */ _n("Latvia")},
- {434, "LAR", "LY", "LBY", /* 434 */ _n("Libyan Arab Jamahiriya")},
- {504, "MA", "MA", "MAR", /* 504 */ _n("Morocco")},
- {492, "MC", "MC", "MCO", /* 492 */ _n("Monaco")},
- {498, "MD", "MD", "MDA", /* 498 */ _n("Moldova, Republic of")},
- {499, "MNE", "ME", "MNE", /* 499 */ _n("Montenegro")},
- {663, NULL, "MF", "MAF", /* 663 */ _n("Saint Martin (French part)")},
- {450, "RM", "MG", "MDG", /* 450 */ _n("Madagascar")},
- {584, "MH", "MH", "MHL", /* 584 */ _n("Marshall Islands")},
- {807, "MK", "MK", "MKD", /* 807 */ _n("Macedonia, the former Yugoslav Republic of")},
- {466, "RMM", "ML", "MLI", /* 466 */ _n("Mali")},
- {104, "MYA", "MM", "MMR", /* 104 */ _n("Myanmar")},
- {496, "MGL", "MN", "MNG", /* 496 */ _n("Mongolia")},
- {446, NULL, "MO", "MAC", /* 446 */ _n("Macao")},
- {580, NULL, "MP", "MNP", /* 580 */ _n("Northern Mariana Islands")},
- {474, NULL, "MQ", "MTQ", /* 474 */ _n("Martinique")},
- {478, "RIM", "MR", "MRT", /* 478 */ _n("Mauritania")},
- {500, NULL, "MS", "MSR", /* 500 */ _n("Montserrat")},
- {470, "M", "MT", "MLT", /* 470 */ _n("Malta")},
- {480, "MS", "MU", "MUS", /* 480 */ _n("Mauritius")},
- {462, "MV", "MV", "MDV", /* 462 */ _n("Maldives")},
- {454, "MW", "MW", "MWI", /* 454 */ _n("Malawi")},
- {484, "MEX", "MX", "MEX", /* 484 */ _n("Mexico")},
- {458, "MAL", "MY", "MYS", /* 458 */ _n("Malaysia")},
- {508, "MOC", "MZ", "MOZ", /* 508 */ _n("Mozambique")},
- {516, "NAM", "NA", "NAM", /* 516 */ _n("Namibia")},
- {540, "NCL", "NC", "NCL", /* 540 */ _n("New Caledonia")},
- {562, "RN", "NE", "NER", /* 562 */ _n("Niger")},
- {574, NULL, "NF", "NFK", /* 574 */ _n("Norfolk Island")},
- {566, "NGR", "NG", "NGA", /* 566 */ _n("Nigeria")},
- {558, "NIC", "NI", "NIC", /* 558 */ _n("Nicaragua")},
- {528, "NL", "NL", "NLD", /* 528 */ _n("Netherlands")},
- {578, "N", "NO", "NOR", /* 578 */ _n("Norway")},
- {524, "NEP", "NP", "NPL", /* 524 */ _n("Nepal")},
- {520, "NAU", "NR", "NRU", /* 520 */ _n("Nauru")},
- {570, NULL, "NU", "NIU", /* 570 */ _n("Niue")},
- {554, "NZ", "NZ", "NZL", /* 554 */ _n("New Zealand")},
- {512, "OM", "OM", "OMN", /* 512 */ _n("Oman")},
- {591, "PA", "PA", "PAN", /* 591 */ _n("Panama")},
- {604, "PE", "PE", "PER", /* 604 */ _n("Peru")},
- {258, NULL, "PF", "PYF", /* 258 */ _n("French Polynesia")},
- {598, "PNG", "PG", "PNG", /* 598 */ _n("Papua New Guinea")},
- {608, "RP", "PH", "PHL", /* 608 */ _n("Philippines")},
- {586, "PK", "PK", "PAK", /* 586 */ _n("Pakistan")},
- {616, "PL", "PL", "POL", /* 616 */ _n("Poland")},
- {666, NULL, "PM", "SPM", /* 666 */ _n("Saint Pierre and Miquelon")},
- {612, NULL, "PN", "PCN", /* 612 */ _n("Pitcairn")},
- {630, "PRI", "PR", "PRI", /* 630 */ _n("Puerto Rico")},
- {275, "AUT", "PS", "PSE", /* 275 */ _n("Palestinian Territory, Occupied")},
- {620, "P", "PT", "PRT", /* 620 */ _n("Portugal")},
- {585, "PAL", "PW", "PLW", /* 585 */ _n("Palau")},
- {600, "PY", "PY", "PRY", /* 600 */ _n("Paraguay")},
- {634, "Q", "QA", "QAT", /* 634 */ _n("Qatar")},
- {638, NULL, "RE", "REU", /* 638 */ _n("Reunion")},
- {642, "RO", "RO", "ROU", /* 642 */ _n("Romania")},
- {688, "SRB", "RS", "SRB", /* 688 */ _n("Serbia")},
- {643, "RUS", "RU", "RUS", /* 643 */ _n("Russian Federation")},
- {646, "RWA", "RW", "RWA", /* 646 */ _n("Rwanda")},
- {682, "KSA", "SA", "SAU", /* 682 */ _n("Saudi Arabia")},
- { 90, "SOL", "SB", "SLB", /* 090 */ _n("Solomon Islands")},
- {690, "SY", "SC", "SYC", /* 690 */ _n("Seychelles")},
- {736, "SUD", "SD", "SDN", /* 736 */ _n("Sudan")},
- {752, "S", "SE", "SWE", /* 752 */ _n("Sweden")},
- {702, "SGP", "SG", "SGP", /* 702 */ _n("Singapore")},
- {654, NULL, "SH", "SHN", /* 654 */ _n("Saint Helena")},
- {705, "SLO", "SI", "SVN", /* 705 */ _n("Slovenia")},
- {744, NULL, "SJ", "SJM", /* 744 */ _n("Svalbard and Jan Mayen")},
- {703, "SK", "SK", "SVK", /* 703 */ _n("Slovakia")},
- {694, "WAL", "SL", "SLE", /* 694 */ _n("Sierra Leone")},
- {674, "RSM", "SM", "SMR", /* 674 */ _n("San Marino")},
- {686, "SN", "SN", "SEN", /* 686 */ _n("Senegal")},
- {706, "SO", "SO", "SOM", /* 706 */ _n("Somalia")},
- {740, "SME", "SR", "SUR", /* 740 */ _n("Suriname")},
- {678, "STP", "ST", "STP", /* 678 */ _n("Sao Tome and Principe")},
- {222, "ES", "SV", "SLV", /* 222 */ _n("El Salvador")},
- {760, "SYR", "SY", "SYR", /* 760 */ _n("Syrian Arab Republic")},
- {748, "SD", "SZ", "SWZ", /* 748 */ _n("Swaziland")},
- {796, NULL, "TC", "TCA", /* 796 */ _n("Turks and Caicos Islands")},
- {148, "TD", "TD", "TCD", /* 148 */ _n("Chad")},
- {260, "ARK", "TF", "ATF", /* 260 */ _n("French Southern Territories")},
- {768, "RT", "TG", "TGO", /* 768 */ _n("Togo")},
- {764, "T", "TH", "THA", /* 764 */ _n("Thailand")},
- {762, "TJ", "TJ", "TJK", /* 762 */ _n("Tajikistan")},
- {772, NULL, "TK", "TKL", /* 772 */ _n("Tokelau")},
- {626, "TL", "TL", "TLS", /* 626 */ _n("Timor-Leste")},
- {795, "TM", "TM", "TKM", /* 795 */ _n("Turkmenistan")},
- {788, "TN", "TN", "TUN", /* 788 */ _n("Tunisia")},
- {776, "TON", "TO", "TON", /* 776 */ _n("Tonga")},
- {792, "TR", "TR", "TUR", /* 792 */ _n("Turkey")},
- {780, "TT", "TT", "TTO", /* 780 */ _n("Trinidad and Tobago")},
- {798, "TUV", "TV", "TUV", /* 798 */ _n("Tuvalu")},
- {158, NULL, "TW", "TWN", /* 158 */ _n("Taiwan, Province of China")},
- {834, "EAT", "TZ", "TZA", /* 834 */ _n("Tanzania, United Republic of")},
- {804, "UA", "UA", "UKR", /* 804 */ _n("Ukraine")},
- {800, "EAU", "UG", "UGA", /* 800 */ _n("Uganda")},
- {581, NULL, "UM", "UMI", /* 581 */ _n("United States Minor Outlying Islands")},
- {840, "USA", "US", "USA", /* 840 */ _n("United States")},
- {858, "ROU", "UY", "URY", /* 858 */ _n("Uruguay")},
- {860, "UZ", "UZ", "UZB", /* 860 */ _n("Uzbekistan")},
- {336, "SCV", "VA", "VAT", /* 336 */ _n("Holy See (Vatican City State)")},
- {670, "WV", "VC", "VCT", /* 670 */ _n("Saint Vincent and the Grenadines")},
- {862, "YV", "VE", "VEN", /* 862 */ _n("Venezuela")},
- { 92, NULL, "VG", "VGB", /* 092 */ _n("Virgin Islands, British")},
- {850, NULL, "VI", "VIR", /* 850 */ _n("Virgin Islands, U.S.")},
- {704, "VN", "VN", "VNM", /* 704 */ _n("Viet Nam")},
- {548, "VAN", "VU", "VUT", /* 548 */ _n("Vanuatu")},
- {876, NULL, "WF", "WLF", /* 876 */ _n("Wallis and Futuna")},
- {882, "WS", "WS", "WSM", /* 882 */ _n("Samoa")},
- {887, "YAR", "YE", "YEM", /* 887 */ _n("Yemen")},
- {175, NULL, "YT", "MYT", /* 175 */ _n("Mayotte")},
- {710, "ZA", "ZA", "ZAF", /* 710 */ _n("South Africa") },
- {894, "Z", "ZM", "ZMB", /* 894 */ _n("Zambia")},
- {716, "ZW", "ZW", "ZWE", /* 716 */ _n("Zimbabwe")},
-};
-
-
-struct country_search {
- struct attr search;
- int len;
- int partial;
- struct item item;
- int count;
- struct country *country;
- enum attr_type attr_next;
-};
-
-static int
-country_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
-{
- struct country_search *this_=priv_data;
- struct country *country=this_->country;
-
- attr->type=attr_type;
- switch (attr_type) {
- case attr_any:
- while (this_->attr_next != attr_none) {
- if (country_attr_get(this_, this_->attr_next, attr))
- return 1;
- }
- return 0;
- case attr_label:
- attr->u.str=gettext(country->name);
- this_->attr_next=attr_country_id;
- return 1;
- case attr_country_id:
- attr->u.num=country->id;
- this_->attr_next=country->car ? attr_country_car : attr_country_iso2;
- return 1;
- case attr_country_car:
- attr->u.str=country->car;
- this_->attr_next=attr_country_iso2;
- return attr->u.str ? 1 : 0;
- case attr_country_iso2:
- attr->u.str=country->iso2;
- this_->attr_next=attr_country_iso3;
- return 1;
- case attr_country_iso3:
- attr->u.str=country->iso3;
- this_->attr_next=attr_country_name;
- return 1;
- case attr_country_name:
- attr->u.str=gettext(country->name);
- this_->attr_next=attr_none;
- return 1;
- default:
- return 0;
- }
-}
-
-
-
-struct item_methods country_meth = {
- NULL, /* coord_rewind */
- NULL, /* coord_get */
- NULL, /* attr_rewind */
- country_attr_get, /* attr_get */
-};
-
-struct country_search *
-country_search_new(struct attr *search, int partial)
-{
- struct country_search *ret=g_new(struct country_search, 1);
- ret->search=*search;
- if (search->type != attr_country_id)
- ret->len=strlen(search->u.str);
- else
- ret->len=0;
- ret->partial=partial;
- ret->count=0;
-
- ret->item.type=type_country_label;
- ret->item.id_hi=0;
- ret->item.map=NULL;
- ret->item.meth=&country_meth;
- ret->item.priv_data=ret;
-
- return ret;
-}
-
-static int
-match(struct country_search *this_, enum attr_type type, const char *name)
-{
- int ret;
- if (!name)
- return 0;
- if (this_->search.type != type && this_->search.type != attr_country_all)
- return 0;
- if (this_->partial)
- ret=(strncasecmp(this_->search.u.str, name, this_->len) == 0);
- else
- ret=(strcasecmp(this_->search.u.str, name) == 0);
- return ret;
-
-}
-
-
-struct item *
-country_search_get_item(struct country_search *this_)
-{
- for (;;) {
- if (this_->count >= sizeof(country)/sizeof(struct country))
- return NULL;
- this_->country=&country[this_->count++];
- if ((this_->search.type == attr_country_id && this_->search.u.num == this_->country->id) ||
- match(this_, attr_country_iso3, this_->country->iso3) ||
- match(this_, attr_country_iso2, this_->country->iso2) ||
- match(this_, attr_country_car, this_->country->car) ||
- match(this_, attr_country_name, gettext(this_->country->name))) {
- this_->item.id_lo=this_->country->id;
- return &this_->item;
- }
- }
-}
-
-static struct attr country_default_attr;
-static char iso2[3];
-
-struct attr *
-country_default(void)
-{
- char *lang;
- if (country_default_attr.u.str)
- return &country_default_attr;
- lang=getenv("LANG");
- if (!lang || strlen(lang) < 5)
- return NULL;
- strncpy(iso2, lang+3, 2);
- country_default_attr.type=attr_country_iso2;
- country_default_attr.u.str=iso2;
- return &country_default_attr;
-}
-
-void
-country_search_destroy(struct country_search *this_)
-{
- g_free(this_);
-}
diff --git a/navit/country.h b/navit/country.h
deleted file mode 100644
index 8e435f3a..00000000
--- a/navit/country.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef NAVIT_COUNTRY_H
-#define NAVIT_COUNTRY_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* prototypes */
-struct attr;
-struct country_search;
-struct item;
-struct country_search *country_search_new(struct attr *search, int partial);
-struct item *country_search_get_item(struct country_search *this_);
-struct attr *country_default(void);
-void country_search_destroy(struct country_search *this_);
-/* end of prototypes */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/navit/cursor.c b/navit/cursor.c
deleted file mode 100644
index cf706c24..00000000
--- a/navit/cursor.c
+++ /dev/null
@@ -1,167 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <math.h>
-#include <glib.h>
-#include "debug.h"
-#include "coord.h"
-#include "transform.h"
-#include "projection.h"
-#include "point.h"
-#include "graphics.h"
-#include "vehicle.h"
-#include "navit.h"
-#include "callback.h"
-#include "color.h"
-#include "cursor.h"
-#include "compass.h"
-/* #include "track.h" */
-
-
-
-struct cursor {
- struct graphics *gra;
-#define NUM_GC 5
- struct graphics_gc *cursor_gc[NUM_GC];
- struct graphics_gc *cursor_gc2[NUM_GC];
- int current_gc;
- int last_dir;
- int last_draw_dir;
- guint animate_timer;
- struct point cursor_pnt;
-};
-
-
-void
-cursor_draw(struct cursor *this_, struct point *pnt, int dir, int draw_dir, int force)
-{
- int x=this_->cursor_pnt.x;
- int y=this_->cursor_pnt.y;
- int r=12,lw=2;
- double dx,dy;
- double fac1,fac2;
- struct point cpnt[3];
- struct graphics *gra=this_->gra;
-
- if (pnt && x == pnt->x && y == pnt->y && !force)
- return;
- if (!graphics_ready(gra))
- return;
- this_->last_dir = dir;
- this_->last_draw_dir = draw_dir;
- cpnt[0]=this_->cursor_pnt;
- cpnt[0].x-=r+lw;
- cpnt[0].y-=r+lw;
- graphics_draw_restore(gra, &cpnt[0], (r+lw)*2, (r+lw)*2);
- if (pnt) {
- graphics_draw_mode(gra, draw_mode_cursor);
- this_->cursor_pnt=*pnt;
- x=pnt->x;
- y=pnt->y;
- cpnt[0].x=x;
- cpnt[0].y=y;
- graphics_draw_circle(gra, this_->cursor_gc[this_->current_gc], &cpnt[0], r*2);
- if (this_->cursor_gc2[this_->current_gc])
- graphics_draw_circle(gra, this_->cursor_gc2[this_->current_gc], &cpnt[0], r*2-4);
- if (draw_dir) {
- dx=sin(M_PI*dir/180.0);
- dy=-cos(M_PI*dir/180.0);
-
- fac1=0.7*r;
- fac2=0.4*r;
- cpnt[0].x=x-dx*fac1+dy*fac2;
- cpnt[0].y=y-dy*fac1-dx*fac2;
- cpnt[1].x=x+dx*r;
- cpnt[1].y=y+dy*r;
- cpnt[2].x=x-dx*fac1-dy*fac2;
- cpnt[2].y=y-dy*fac1+dx*fac2;
- graphics_draw_lines(gra, this_->cursor_gc[this_->current_gc], cpnt, 3);
-
- if (this_->cursor_gc2[this_->current_gc]) {
- r-=4;
- fac1=0.7*r;
- fac2=0.4*r;
- cpnt[0].x=x-dx*fac1+dy*fac2;
- cpnt[0].y=y-dy*fac1-dx*fac2;
- cpnt[1].x=x+dx*r;
- cpnt[1].y=y+dy*r;
- cpnt[2].x=x-dx*fac1-dy*fac2;
- cpnt[2].y=y-dy*fac1+dx*fac2;
- graphics_draw_lines(gra, this_->cursor_gc2[this_->current_gc], cpnt, 3);
- }
- } else {
- cpnt[1]=cpnt[0];
- graphics_draw_lines(gra, this_->cursor_gc[this_->current_gc], cpnt, 2);
- if (this_->cursor_gc2[this_->current_gc])
- graphics_draw_circle(gra, this_->cursor_gc2[this_->current_gc], &cpnt[0], 4);
- }
- graphics_draw_mode(gra, draw_mode_end);
- }
-}
-
-static gboolean cursor_animate(struct cursor * this)
-{
- struct point p;
- this->current_gc++;
- if (this->current_gc >= NUM_GC)
- this->current_gc=0;
- p.x = this->cursor_pnt.x;
- p.y = this->cursor_pnt.y;
- cursor_draw(this, &p, this->last_dir, this->last_draw_dir, 1);
- return TRUE;
-}
-
-struct cursor *
-cursor_new(struct graphics *gra, struct color *c, struct color *c2, int animate)
-{
- unsigned char dash_list[] = { 4, 6 };
- int i;
- struct cursor *this=g_new(struct cursor,1);
- dbg(2,"enter gra=%p c=%p\n", gra, c);
- this->gra=gra;
- this->animate_timer=0;
- for (i=0;i<NUM_GC;i++) {
- this->cursor_gc[i]=NULL;
- this->cursor_gc2[i]=NULL;
- }
- this->current_gc=0;
- for (i=0;i<NUM_GC;i++) {
- this->cursor_gc[i]=graphics_gc_new(gra);
- graphics_gc_set_foreground(this->cursor_gc[i], c);
- graphics_gc_set_linewidth(this->cursor_gc[i], 2);
- if (c2) {
- this->cursor_gc2[i]=graphics_gc_new(gra);
- graphics_gc_set_foreground(this->cursor_gc2[i], c2);
- }
- if (animate) {
- graphics_gc_set_dashes(this->cursor_gc[i], 2, (NUM_GC-i)*2, dash_list, 2);
- if(this->cursor_gc2[i])
- graphics_gc_set_dashes(this->cursor_gc2[i], 2, i*2, dash_list, 2);
- } else {
- graphics_gc_set_linewidth(this->cursor_gc[i], 2);
- if(this->cursor_gc2[i])
- graphics_gc_set_linewidth(this->cursor_gc2[i], 2);
- break; // no need to create other GCs if we are not animating
- }
- }
- if (animate)
- this->animate_timer=g_timeout_add(250, (GSourceFunc)cursor_animate, (gpointer *)this);
- dbg(2,"ret=%p\n", this);
- return this;
-}
-
-void
-cursor_destroy(struct cursor *this_)
-{
- int i;
- if (this_->animate_timer)
- g_source_remove(this_->animate_timer);
- for (i=0;i<NUM_GC;i++)
- if(this_->cursor_gc[i])
- graphics_gc_destroy(this_->cursor_gc[i]);
- if(this_->cursor_gc2[i])
- graphics_gc_destroy(this_->cursor_gc2[i]);
- g_free(this_);
-}
diff --git a/navit/cursor.h b/navit/cursor.h
deleted file mode 100644
index 203ef080..00000000
--- a/navit/cursor.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef NAVIT_CURSOR_H
-#define NAVIT_CURSOR_H
-
-/* prototypes */
-struct color;
-struct cursor;
-struct graphics;
-struct point;
-void cursor_draw(struct cursor *this_, struct point *pnt, int dir, int draw_dir, int force);
-struct cursor *cursor_new(struct graphics *gra, struct color *c, struct color *c2, int animate);
-void cursor_destroy(struct cursor *this_);
-/* end of prototypes */
-
-#endif
diff --git a/navit/data.h b/navit/data.h
deleted file mode 100644
index 45174267..00000000
--- a/navit/data.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef NAVIT_DATA_H
-#define NAVIT_DATA_H
-
-static inline unsigned char
-get_u8(unsigned char **p)
-{
- return *((*p)++);
-}
-
-static inline unsigned short
-get_u16(unsigned char **p) {
- unsigned short ret;
- ret=*((unsigned short *)*p);
- *p+=sizeof(unsigned short);
- return ret;
-}
-
-static inline unsigned short
-get_u16_unal(unsigned char **p) {
- unsigned short ret;
- ret=*(*p)++;
- ret|=(*(*p)++) << 8;
- return ret;
-}
-
-
-static inline unsigned int
-get_u24(unsigned char **p) {
- unsigned long ret;
- ret=get_u16(p);
- ret|=*((*p)++) << 16;
- return ret;
-}
-
-
-static inline unsigned int
-get_u32(unsigned char **p) {
- unsigned long ret;
- ret=*((unsigned int *)*p);
- *p+=sizeof(unsigned int);
- return ret;
-}
-
-static inline unsigned int
-get_u32_unal(unsigned char **p) {
- unsigned long ret;
- ret=*(*p)++;
- ret|=(*(*p)++) << 8;
- ret|=(*(*p)++) << 16;
- ret|=(*(*p)++) << 24;
- return ret;
-}
-
-static inline char *
-get_string(unsigned char **p)
-{
- char *ret=(char *)(*p);
- while (**p) (*p)++;
- (*p)++;
- return ret;
-}
-
-#define L(x) ({ unsigned char *t=(unsigned char *)&(x); t[0] | (t[1] << 8) | (t[2] << 16) | (t[3] << 24); })
-
-#endif
-
diff --git a/navit/data/Makefile.am b/navit/data/Makefile.am
deleted file mode 100644
index e82f9dae..00000000
--- a/navit/data/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-SUBDIRS=mg textfile poi_geodownload binfile
-# garmin_img
-if HAVELIBGARMIN
-SUBDIRS+=garmin
-endif
-
-DIST_SUBDIRS=mg textfile poi_geodownload binfile garmin
-
diff --git a/navit/data/binfile/Makefile.am b/navit/data/binfile/Makefile.am
deleted file mode 100644
index e1457499..00000000
--- a/navit/data/binfile/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=data_binfile
-moduledata_LTLIBRARIES = libdata_binfile.la
-libdata_binfile_la_SOURCES = binfile.c
diff --git a/navit/data/binfile/binfile.c b/navit/data/binfile/binfile.c
deleted file mode 100644
index 55ea0084..00000000
--- a/navit/data/binfile/binfile.c
+++ /dev/null
@@ -1,645 +0,0 @@
-#include <windows.h>
-#include <glib.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include "config.h"
-#include "debug.h"
-#include "plugin.h"
-#include "projection.h"
-#include "map.h"
-#include "maptype.h"
-#include "item.h"
-#include "attr.h"
-#include "coord.h"
-#include "transform.h"
-#include "file.h"
-#include "zipfile.h"
-#include "endianess.h"
-
-static int map_id;
-
-
-struct minmax {
- short min;
- short max;
-};
-
-struct tile {
- int *start;
- int *end;
- int *pos;
- int *pos_coord_start;
- int *pos_coord;
- int *pos_attr_start;
- int *pos_attr;
- int *pos_next;
- int zipfile_num;
-};
-
-struct map_priv {
- int id;
- char *filename;
- struct file *fi;
- struct zip_cd *index_cd;
- int cde_size;
- struct zip_eoc *eoc;
- int zip_members;
-};
-
-struct map_rect_priv {
- int *start;
- int *end;
- enum attr_type attr_last;
- int label;
- int *label_attr[2];
- struct map_selection *sel;
- struct map_priv *m;
- struct item item;
- int tile_depth;
- struct tile tiles[8];
- struct tile *t;
- int country_id;
-};
-
-struct map_search_priv {
- struct map_rect_priv *mr;
- struct attr *search;
- struct map_selection *ms;
- int partial;
- GHashTable *search_results;
-};
-
-
-static void minmax_to_cpu(struct minmax * mima) {
- g_assert(mima != NULL);
- mima->min = le16_to_cpu(mima->min);
- mima->max = le16_to_cpu(mima->max);
-}
-
-static void lfh_to_cpu(struct zip_lfh *lfh) {
- g_assert(lfh != NULL);
- lfh->ziplocsig = le32_to_cpu(lfh->ziplocsig);
- lfh->zipver = le16_to_cpu(lfh->zipver);
- lfh->zipgenfld = le16_to_cpu(lfh->zipgenfld);
- lfh->zipmthd = le16_to_cpu(lfh->zipmthd);
- lfh->ziptime = le16_to_cpu(lfh->ziptime);
- lfh->zipdate = le16_to_cpu(lfh->zipdate);
- lfh->zipcrc = le32_to_cpu(lfh->zipcrc);
- lfh->zipsize = le32_to_cpu(lfh->zipsize);
- lfh->zipuncmp = le32_to_cpu(lfh->zipuncmp);
- lfh->zipfnln = le16_to_cpu(lfh->zipfnln);
- lfh->zipxtraln = le16_to_cpu(lfh->zipxtraln);
-}
-
-static void cd_to_cpu(struct zip_cd *zcd) {
- g_assert(zcd != NULL);
- zcd->zipccrc = le32_to_cpu(zcd->zipccrc);
- zcd->zipcsiz = le32_to_cpu(zcd->zipcsiz);
- zcd->zipcunc = le32_to_cpu(zcd->zipcunc);
- zcd->zipcfnl = le16_to_cpu(zcd->zipcfnl);
- zcd->zipcxtl = le16_to_cpu(zcd->zipcxtl);
- zcd->zipccml = le16_to_cpu(zcd->zipccml);
- zcd->zipdsk = le16_to_cpu(zcd->zipdsk);
- zcd->zipint = le16_to_cpu(zcd->zipint);
- zcd->zipext = le32_to_cpu(zcd->zipext);
- zcd->zipofst = le32_to_cpu(zcd->zipofst);
-}
-
-static void eoc_to_cpu(struct zip_eoc *eoc) {
- g_assert(eoc != NULL);
- eoc->zipesig = le32_to_cpu(eoc->zipesig);
- eoc->zipedsk = le16_to_cpu(eoc->zipedsk);
- eoc->zipecen = le16_to_cpu(eoc->zipecen);
- eoc->zipenum = le16_to_cpu(eoc->zipenum);
- eoc->zipecenn = le16_to_cpu(eoc->zipecenn);
- eoc->zipecsz = le32_to_cpu(eoc->zipecsz);
- eoc->zipeofst = le32_to_cpu(eoc->zipeofst);
- eoc->zipecoml = le16_to_cpu(eoc->zipecoml);
-}
-
-static void
-map_destroy_binfile(struct map_priv *m)
-{
- dbg(1,"map_destroy_binfile\n");
- g_free(m);
-}
-
-static void
-binfile_coord_rewind(void *priv_data)
-{
- struct map_rect_priv *mr=priv_data;
- struct tile *t=mr->t;
- t->pos_coord=t->pos_coord_start;
-}
-
-static int
-binfile_coord_get(void *priv_data, struct coord *c, int count)
-{
- struct map_rect_priv *mr=priv_data;
- struct tile *t=mr->t;
- int ret=0;
- dbg(2,"binfile_coord_get %d\n",count);
- while (count--) {
- dbg(2,"%p vs %p\n", t->pos_coord, t->pos_attr_start);
- if (t->pos_coord >= t->pos_attr_start)
- break;
- c->x=le32_to_cpu(*(t->pos_coord++));
- c->y=le32_to_cpu(*(t->pos_coord++));
- c++;
- ret++;
- }
- return ret;
-}
-
-static void
-binfile_attr_rewind(void *priv_data)
-{
- struct map_rect_priv *mr=priv_data;
- struct tile *t=mr->t;
- t->pos_attr=t->pos_attr_start;
-
-}
-
-static int
-binfile_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
-{
- struct map_rect_priv *mr=priv_data;
- struct tile *t=mr->t;
- enum attr_type type;
- int i,size;
-
- if (attr_type != mr->attr_last) {
- t->pos_attr=t->pos_attr_start;
- mr->attr_last=attr_type;
- }
- while (t->pos_attr < t->pos_next) {
- size=le32_to_cpu(*(t->pos_attr++));
- type=le32_to_cpu(t->pos_attr[0]);
- if (type == attr_label)
- mr->label=1;
- if (type == attr_town_name)
- mr->label_attr[0]=t->pos_attr;
- if (type == attr_street_name)
- mr->label_attr[0]=t->pos_attr;
- if (type == attr_street_name_systematic)
- mr->label_attr[1]=t->pos_attr;
- if (type == attr_type || attr_type == attr_any) {
- if (attr_type == attr_any) {
- dbg(1,"pos %p attr %s size %d\n", t->pos_attr-1, attr_to_name(type), size);
- }
- attr->type=type;
- attr_data_set(attr, t->pos_attr+1);
- t->pos_attr+=size;
- return 1;
- } else {
- t->pos_attr+=size;
- }
- }
- if (!mr->label && (attr_type == attr_any || attr_type == attr_label)) {
- for (i = 0 ; i < sizeof(mr->label_attr)/sizeof(int *) ; i++) {
- if (mr->label_attr[i]) {
- mr->label=1;
- attr->type=attr_label;
- attr_data_set(attr, mr->label_attr[i]+1);
- return 1;
- }
- }
- }
- return 0;
-}
-
-static struct item_methods methods_binfile = {
- binfile_coord_rewind,
- binfile_coord_get,
- binfile_attr_rewind,
- binfile_attr_get,
-};
-
-static void
-push_tile(struct map_rect_priv *mr, struct tile *t)
-{
- g_assert(mr->tile_depth < 8);
- mr->t=&mr->tiles[mr->tile_depth++];
- *(mr->t)=*t;
- mr->t->pos=mr->t->pos_next=mr->t->start;
-}
-
-static int
-pop_tile(struct map_rect_priv *mr)
-{
- if (mr->tile_depth <= 1)
- return 0;
- file_data_free(mr->m->fi, (unsigned char *)(mr->t->start));
- mr->t=&mr->tiles[--mr->tile_depth-1];
- return 1;
-}
-
-
-static int
-zipfile_to_tile(struct file *f, struct zip_cd *cd, struct tile *t)
-{
- char buffer[1024];
- struct zip_lfh *lfh;
- char *zipfn;
- dbg(1,"enter %p %p %p\n", f, cd, t);
- dbg(1,"cd->zipofst=0x%x\n", cd->zipofst);
- t->start=NULL;
- lfh=(struct zip_lfh *)(file_data_read(f,cd->zipofst,sizeof(struct zip_lfh)));
- lfh_to_cpu(lfh);
- zipfn=(char *)(file_data_read(f,cd->zipofst+sizeof(struct zip_lfh), lfh->zipfnln));
- strncpy(buffer, zipfn, lfh->zipfnln);
- buffer[lfh->zipfnln]='\0';
- dbg(1,"0x%x '%s' %d %d,%d\n", lfh->ziplocsig, buffer, sizeof(*cd)+cd->zipcfnl, lfh->zipsize, lfh->zipuncmp);
- switch (lfh->zipmthd) {
- case 0:
- t->start=(int *)(file_data_read(f,cd->zipofst+sizeof(struct zip_lfh)+lfh->zipfnln, lfh->zipuncmp));
- t->end=t->start+lfh->zipuncmp/4;
- break;
- case 8:
- t->start=(int *)(file_data_read_compressed(f,cd->zipofst+sizeof(struct zip_lfh)+lfh->zipfnln, lfh->zipsize, lfh->zipuncmp));
- t->end=t->start+lfh->zipuncmp/4;
- break;
- default:
- dbg(0,"Unknown compression method %d\n", lfh->zipmthd);
- }
- file_data_free(f, (unsigned char *)zipfn);
- file_data_free(f, (unsigned char *)lfh);
- return t->start != NULL;
-}
-
-static void
-push_zipfile_tile(struct map_rect_priv *mr, int zipfile)
-{
- struct map_priv *m=mr->m;
- struct file *f=m->fi;
- struct tile t;
- struct zip_cd *cd=(struct zip_cd *)(file_data_read(f, m->eoc->zipeofst + zipfile*m->cde_size, sizeof(struct zip_cd)));
- cd_to_cpu(cd);
- dbg(1,"enter %p %d\n", mr, zipfile);
- t.zipfile_num=zipfile;
- if (zipfile_to_tile(f, cd, &t))
- push_tile(mr, &t);
- file_data_free(f, (unsigned char *)cd);
-}
-
-static struct map_rect_priv *
-map_rect_new_binfile(struct map_priv *map, struct map_selection *sel)
-{
- struct map_rect_priv *mr;
- struct tile t;
-
- dbg(1,"map_rect_new_binfile\n");
- mr=g_new0(struct map_rect_priv, 1);
- mr->m=map;
- mr->sel=sel;
- mr->item.id_hi=0;
- mr->item.id_lo=0;
- dbg(1,"zip_members=%d\n", map->zip_members);
- if (map->eoc)
- push_zipfile_tile(mr, map->zip_members-1);
- else {
- unsigned char *d=file_data_read(map->fi, 0, map->fi->size);
- t.start=(int *)d;
- t.end=(int *)(d+map->fi->size);
- t.zipfile_num=0;
- push_tile(mr, &t);
- }
- mr->item.meth=&methods_binfile;
- mr->item.priv_data=mr;
- return mr;
-}
-
-
-static void
-map_rect_destroy_binfile(struct map_rect_priv *mr)
-{
- while (pop_tile(mr));
- file_data_free(mr->m->fi, (unsigned char *)(mr->tiles[0].start));
- g_free(mr);
-}
-
-static void
-setup_pos(struct map_rect_priv *mr)
-{
- int size,coord_size;
- struct tile *t=mr->t;
- size=le32_to_cpu(*(t->pos++));
- if (size > 1024*1024 || size < 0) {
- fprintf(stderr,"size=0x%x\n", size);
-#if 0
- fprintf(stderr,"offset=%d\n", (unsigned char *)(mr->pos)-mr->m->f->begin);
-#endif
- g_error("size error");
- }
- t->pos_next=t->pos+size;
- mr->item.type=le32_to_cpu(*(t->pos++));
- coord_size=le32_to_cpu(*(t->pos++));
- t->pos_coord_start=t->pos_coord=t->pos;
- t->pos_attr_start=t->pos_attr=t->pos_coord+coord_size;
-}
-
-static int
-selection_contains(struct map_selection *sel, struct coord_rect *r, struct minmax *mima)
-{
- int order;
- if (! sel)
- return 1;
- while (sel) {
- if (coord_rect_overlap(r, &sel->u.c_rect)) {
- order=sel->order[0];
- if (sel->order[1] > order)
- order=sel->order[1];
- if (sel->order[2] > order)
- order=sel->order[2];
- dbg(1,"min %d max %d order %d\n", mima->min, mima->max, order);
- if (!mima->min && !mima->max)
- return 1;
- if (order >= mima->min && order <= mima->max)
- return 1;
- }
- sel=sel->next;
- }
- return 0;
-}
-
-static void
-map_parse_country_binfile(struct map_rect_priv *mr)
-{
- struct attr at;
- if (binfile_attr_get(mr->item.priv_data, attr_country_id, &at)) {
- if (at.u.num == mr->country_id)
- {
- if (binfile_attr_get(mr->item.priv_data, attr_zipfile_ref, &at))
- {
- push_zipfile_tile(mr, at.u.num);
- }
- }
- }
-}
-
-static struct item *
-map_rect_get_item_binfile(struct map_rect_priv *mr)
-{
- struct tile *t;
- struct minmax *mima;
- for (;;) {
- t=mr->t;
- if (! t)
- return NULL;
- t->pos=t->pos_next;
- if (t->pos >= t->end) {
- if (pop_tile(mr))
- continue;
- return NULL;
- }
- mr->item.id_hi=t->zipfile_num;
- mr->item.id_lo=t->pos-t->start;
- mr->label=0;
- memset(mr->label_attr, 0, sizeof(mr->label_attr));
- setup_pos(mr);
- if ((mr->item.type == type_submap) && (!mr->country_id)) {
- struct coord_rect r;
- r.lu.x=le32_to_cpu(t->pos_coord[0]);
- r.lu.y=le32_to_cpu(t->pos_coord[3]);
- r.rl.x=le32_to_cpu(t->pos_coord[2]);
- r.rl.y=le32_to_cpu(t->pos_coord[1]);
- mima=(struct minmax *)(t->pos_attr+2);
- minmax_to_cpu(mima);
- if (!mr->m->eoc || !selection_contains(mr->sel, &r, mima)) {
- continue;
- }
- dbg(1,"pushing zipfile %d from %d\n", le32_to_cpu(t->pos_attr[5]), t->zipfile_num);
- push_zipfile_tile(mr, le32_to_cpu(t->pos_attr[5]));
- continue;
-
- }
- if (mr->country_id)
- {
- if (mr->item.type == type_countryindex) {
- map_parse_country_binfile(mr);
- }
- if (mr->item.type >= type_town_label && mr->item.type <= type_district_label_1e7)
- {
- return &mr->item;
- } else {
- continue;
- }
- }
- return &mr->item;
- }
-}
-
-static struct item *
-map_rect_get_item_byid_binfile(struct map_rect_priv *mr, int id_hi, int id_lo)
-{
- struct tile *t;
- if (mr->m->eoc)
- push_zipfile_tile(mr, id_hi);
- t=mr->t;
- t->pos=t->start+id_lo;
- mr->item.id_hi=id_hi;
- mr->item.id_lo=id_lo;
- mr->label=0;
- memset(mr->label_attr, 0, sizeof(mr->label_attr));
- setup_pos(mr);
- return &mr->item;
-}
-
-static struct map_search_priv *
-binmap_search_new(struct map_priv *map, struct item *item, struct attr *search, int partial)
-{
- struct map_rect_priv *map_rec;
- struct map_search_priv *msp;
- struct map_selection *ms;
- struct item *town;
- int i;
-
- switch (search->type) {
- case attr_country_name:
- break;
- case attr_town_name:
- msp = g_new(struct map_search_priv, 1);
- msp->search_results = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
- map_rec = map_rect_new_binfile(map, NULL);
- map_rec->country_id = item->id_lo;
- msp->mr = map_rec;
- msp->search = search;
- msp->partial = partial;
- return msp;
- break;
- case attr_town_postal:
- break;
- case attr_street_name:
- ms = g_new(struct map_selection, 1);
- ms->next = NULL;
- for (i = 0; i < layer_end; i++)
- {
- ms->order[i] = 18;
- }
- map_rec = map_rect_new_binfile(map, ms);
- town = map_rect_get_item_byid_binfile(map_rec, item->id_hi, item->id_lo);
- if (town) {
- struct map_search_priv *msp = g_new(struct map_search_priv, 1);
- struct coord *c = g_new(struct coord, 1);
- int size = 10000;
- switch (town->type) {
- case type_town_label_2e5:
- size = 10000;
- break;
- case type_town_label_2e4:
- size = 2500;
- break;
- case type_town_label_2e3:
- size = 1000;
- break;
- case type_town_label_2e2:
- size = 1000;
- break;
- default:
- break;
- }
- item_coord_get(town, c, 1);
- ms->u.c_rect.lu.x = c->x-size;
- ms->u.c_rect.lu.y = c->y+size;
- ms->u.c_rect.rl.x = c->x+size;
- ms->u.c_rect.rl.y = c->y-size;
-
- map_rect_destroy_binfile(map_rec);
- map_rec = map_rect_new_binfile(map, ms);
- msp->mr = map_rec;
- msp->search = search;
- msp->partial = partial;
- msp->search_results = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
- return msp;
- }
- map_rect_destroy_binfile(map_rec);
- g_free(ms);
- break;
- default:
- break;
- }
- return NULL;
-}
-static int
-ascii_cmp(char *name, char *match, int partial)
-{
- if (partial)
- return g_ascii_strncasecmp(name, match, strlen(match));
- else
- return g_ascii_strcasecmp(name, match);
-}
-
-static struct item *
-binmap_search_get_item(struct map_search_priv *map_search)
-{
- struct item* it;
- while ((it = map_rect_get_item_binfile(map_search->mr))) {
- if (map_search->search->type == attr_town_name) {
- if ((it->type >= type_town_label) && (it->type <= type_town_label_1e7)) {
- struct attr at;
- if (binfile_attr_get(it->priv_data, attr_label, &at)) {
- if (!ascii_cmp(at.u.str, map_search->search->u.str, map_search->partial)) {
- return it;
- }
- }
- }
- } else if (map_search->search->type == attr_street_name) {
- if ((it->type == type_street_3_city) || (it->type == type_street_2_city) || (it->type == type_street_1_city)) {
- struct attr at;
- if (binfile_attr_get(it->priv_data, attr_label, &at)) {
- if (!ascii_cmp(at.u.str, map_search->search->u.str, map_search->partial)) {
- if (!g_hash_table_lookup(map_search->search_results, at.u.str)) {
- g_hash_table_insert(map_search->search_results, g_strdup(at.u.str), "");
- return it;
- }
- }
- }
- }
- }
- }
- return NULL;
-}
-
-static void
-binmap_search_destroy(struct map_search_priv *ms)
-{
- g_hash_table_destroy(ms->search_results);
- g_free(ms->mr->sel);
- map_rect_destroy_binfile(ms->mr);
- g_free(ms);
-}
-
-static struct map_methods map_methods_binfile = {
- projection_mg,
- "utf-8",
- map_destroy_binfile,
- map_rect_new_binfile,
- map_rect_destroy_binfile,
- map_rect_get_item_binfile,
- map_rect_get_item_byid_binfile,
- binmap_search_new,
- binmap_search_destroy,
- binmap_search_get_item
-};
-
-static struct map_priv *
-map_new_binfile(struct map_methods *meth, struct attr **attrs)
-{
- struct map_priv *m;
- struct attr *data=attr_search(attrs, NULL, attr_data);
- struct file_wordexp *wexp;
- struct zip_cd *first_cd;
- char **wexp_data;
- int *magic,cde_index_size;
- if (! data)
- return NULL;
-
- wexp=file_wordexp_new(data->u.str);
- wexp_data=file_wordexp_get_array(wexp);
- dbg(1,"map_new_binfile %s\n", data->u.str);
- *meth=map_methods_binfile;
-
- m=g_new0(struct map_priv, 1);
- m->id=++map_id;
- m->filename=g_strdup(wexp_data[0]);
- dbg(0,"file_create %s\n", m->filename);
- m->fi=file_create(m->filename);
- if (! m->fi) {
- dbg(0,"Failed to load %s\n", m->filename);
- g_free(m);
- return NULL;
- }
- file_wordexp_destroy(wexp);
- magic=(int *)file_data_read(m->fi, 0, 4);
- *magic = le32_to_cpu(*magic);
- if (*magic == 0x04034b50) {
- cde_index_size=sizeof(struct zip_cd)+sizeof("index")-1;
- m->eoc=(struct zip_eoc *)file_data_read(m->fi,m->fi->size-sizeof(struct zip_eoc), sizeof(struct zip_eoc));
- eoc_to_cpu(m->eoc);
- dbg(1, "magic 0x%x\n", m->eoc->zipesig);
- m->index_cd=(struct zip_cd *)file_data_read(m->fi,m->fi->size-sizeof(struct zip_eoc)-cde_index_size, cde_index_size);
- cd_to_cpu(m->index_cd);
- first_cd=(struct zip_cd *)file_data_read(m->fi,m->eoc->zipeofst, sizeof(struct zip_cd));
- cd_to_cpu(first_cd);
- m->cde_size=sizeof(struct zip_cd)+first_cd->zipcfnl;
- m->zip_members=(m->eoc->zipecsz-cde_index_size)/m->cde_size+1;
- dbg(1, "cde_size %d\n", m->cde_size);
- dbg(1, "members %d\n",m->zip_members);
- dbg(1, "0x%x\n", m->eoc->zipesig);
- dbg(1, "0x%x\n", m->index_cd->zipcensig);
- file_data_free(m->fi, (unsigned char *)first_cd);
- } else
- file_mmap(m->fi);
- file_data_free(m->fi, (unsigned char *)magic);
- return m;
-}
-
-void
-plugin_init(void)
-{
- dbg(1,"binfile: plugin_init\n");
- plugin_register_map_type("binfile", map_new_binfile);
-}
-
diff --git a/navit/data/garmin/Makefile.am b/navit/data/garmin/Makefile.am
deleted file mode 100644
index 0a55ec6b..00000000
--- a/navit/data/garmin/Makefile.am
+++ /dev/null
@@ -1,25 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=data_garmin
-AM_CPPFLAGS+= @LIBGARMIN_CFLAGS@
-INCLUDES=-I$(top_srcdir)/navit/data/garmin/libgarmin
-AM_CPPFLAGS+=-I$(top_srcdir)/navit/data/garmin/libgarmin
-AM_CPPFLAGS+=-I$(srcdir)
-
-moduledata_LTLIBRARIES = libdata_garmin.la
-libdata_garmin_la_SOURCES = garmin.c garmin.h gar2navit.c gar2navit.h
-libdata_garmin_la_LIBADD = @LIBGARMIN_LIBS@
-nodist_libdata_garmin_la_SOURCES = g2nbuiltin.h
-builddir = @builddir@
-
-gar2navit.l$(OBJEXT): g2nbuiltin.h
-
-CLEANFILES = g2nbuiltin.h
-
-noinst_PROGRAMS=gentypes
-gentypes_SOURCES=gentypes.c
-
-g2nbuiltin.h: gentypes garmintypes.txt
- ./gentypes $(top_srcdir)/navit/data/garmin/garmintypes.txt $@
-
-EXTRA_DIST = garmintypes.txt
-
diff --git a/navit/data/garmin/gar2navit.c b/navit/data/garmin/gar2navit.c
deleted file mode 100644
index 687217d2..00000000
--- a/navit/data/garmin/gar2navit.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- Copyright (C) 2007 Alexander Atanasov <aatanasov@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; version 2 of the License.
-
- 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, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02110-1301 USA
-
- Garmin and MapSource are registered trademarks or trademarks
- of Garmin Ltd. or one of its subsidiaries.
-
-*/
-
-/*
- Street's are routable by:
- ALL - by all
- W pedestrian (1<<0)
- B bycycle (1<<1)
- M motorcycle (1<<2)
- C car (1<<3)
- T truck (1<<4)
- L largetruck (1<<5)
-File format is:
-
-POINT
-0x0100 = town_label_1e5, Megapolis (10M +)
-0x0200 = town_label_5e4, Megapolis (5-10M)
-...
-0x1e00-0x1e3f = district_label, District, Province, State Name
-...
-POLYLINE
-0x00 = ALL, street_1_land, Road
-0x01 = MCTL, highway_land, Major HWY thick
-0x02 = MCTL, street_4_land, Principal HWY-thick
-0x03 = MCTL, street_2_land, Principal HWY-medium
-....
-POLYGONE
-0x01 = town_poly, City (>200k)
-0x02 = town_poly, City (<200k)
-0x03 = town_poly, Village
-
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <malloc.h>
-#include "item.h"
-#include "attr.h"
-#include "garmin.h"
-#include "gar2navit.h"
-
-static int add_def(struct gar2nav_conv *conv, int type, unsigned short minid,
- unsigned short maxid, unsigned int routable, char *ntype,
- char *descr)
-{
- enum item_type it;
- struct gar2navit *g2n;
- dlog(11, "type=%d routable=%u min=%04X max=%04X ntype=%s descr=%s\n",
- type, routable, minid, maxid, ntype, descr);
- it = item_from_name(ntype);
- if (it==type_none) {
- dlog(1, "Please define: %s\n", ntype);
- }
- g2n = calloc(1, sizeof(*g2n));
- if (!g2n)
- return -1;
- g2n->id = minid;
- g2n->maxid = maxid;
- g2n->ntype = it;
- g2n->descr = strdup(descr);
- g2n->routable = routable;
- if (type == 1) {
- g2n->next = conv->points;
- conv->points = g2n;
- } else if (type == 2) {
- g2n->next = conv->polylines;
- conv->polylines = g2n;
- } else if (type == 3) {
- g2n->next = conv->polygons;
- conv->polygons = g2n;
- }
- return 0;
-}
-
-static unsigned int get_rtmask(char *p)
-{
- char *cp;
- unsigned int mask = 0;
- cp = p;
- while (*cp) {
- if (!strcasecmp(cp, "none"))
- return 0;
- if (!strcasecmp(cp, "all")) {
- mask = ~0;
- break;
- } if (*cp == 'W')
- mask |= RT_PEDESTRIAN;
- else if (*cp == 'B')
- mask |= RT_BYCYCLE;
- else if (*cp == 'M')
- mask |= RT_MOTORCYCLE;
- else if (*cp == 'C')
- mask |= RT_CAR;
- else if (*cp == 'T')
- mask |= RT_TRUCK;
- else if (*cp == 'L')
- mask |= RT_LONGTRUCK;
- cp++;
- }
- return mask;
-}
-
-static int load_types_file(char *file, struct gar2nav_conv *conv)
-{
- char buf[4096];
- char descr[4096];
- char ntype[4096];
- char rtby[4096];
- FILE *fp;
- unsigned int minid, maxid, routable;
- int rc;
- int type = -1;
-
- fp = fopen(file, "r");
- if (!fp)
- return -1;
- while (fgets(buf, sizeof(buf), fp)) {
- if (*buf == '#' || *buf == '\n')
- continue;
- routable = 0;
- if (!strncasecmp(buf, "POINT", 5)) {
- type = 1;
- continue;
- } else if (!strncasecmp(buf, "POI", 3)) {
- type = 1;
- continue;
- } else if (!strncasecmp(buf, "POLYLINE", 8)) {
- type = 2;
- continue;
- } else if (!strncasecmp(buf, "POLYGONE", 8)) {
- type = 3;
- continue;
- }
- // assume only lines are routable
- if (type == 2) {
- rc = sscanf(buf, "0x%04X = %[^\t, ] , %[^\t, ], %[^\n]",
- &minid, rtby, ntype, descr);
- if (rc != 4) {
- dlog(1, "Invalid line rc=%d:[%s]\n",rc, buf);
- dlog(1, "minid=%04X ntype=[%s] des=[%s]\n",
- minid, ntype, descr);
- continue;
- }
- routable = get_rtmask(rtby);
- } else {
- rc = sscanf(buf, "0x%04X - 0x%04X = %[^\t , ] , %[^\n]",
- &minid, &maxid, ntype, descr);
- if (rc != 4) {
- maxid = 0;
- rc = sscanf(buf, "0x%04X = %[^\t, ], %[^\n]",
- &minid, ntype, descr);
- if (rc != 3) {
- dlog(1, "Invalid line rc=%d:[%s]\n",rc, buf);
- dlog(1, "minid=%04X ntype=[%s] des=[%s]\n",
- minid, ntype, descr);
- continue;
- }
- }
- }
- add_def(conv, type, minid, maxid, routable, ntype, descr);
- }
- fclose(fp);
- return 1;
-}
-
-struct gar2nav_conv *g2n_conv_load(char *file)
-{
- struct gar2nav_conv *c;
- int rc;
-
- c = calloc(1, sizeof(*c));
- if (!c)
- return c;
- rc = load_types_file(file, c);
- if (rc < 0) {
- dlog(1, "Failed to load: [%s]\n", file);
- free(c);
- return NULL;
- }
- return c;
-}
-
-enum item_type g2n_get_type(struct gar2nav_conv *c, int type, unsigned short id)
-{
- struct gar2navit *def = NULL;
- if (type == G2N_POINT)
- def = c->points;
- else if (type == G2N_POLYLINE)
- def = c->polylines;
- else if (type == G2N_POLYGONE)
- def = c->polygons;
- else {
- dlog(1, "Unknown conversion type:%d\n", type);
- return type_none;
- }
-
- if (!def) {
- dlog(5, "No conversion data for %d\n", type);
- return type_none;
- }
-
- while (def) {
- if ((!def->maxid && def->id == id) ||
- (def->id <= id && id <= def->maxid))
- return def->ntype;
- def = def->next;
- }
- dlog(5, "Type[%d]:ID:[%04X] unknown\n", type, id);
- return type_none;
-}
-
-int g2n_get_routable(struct gar2nav_conv *c, int type, unsigned short id)
-{
- struct gar2navit *def = NULL;
- if (type == G2N_POINT)
- def = c->points;
- else if (type == G2N_POLYLINE)
- def = c->polylines;
- else if (type == G2N_POLYGONE)
- def = c->polygons;
- else {
- dlog(1, "Unknown conversion type:%d\n", type);
- return type_none;
- }
-
- if (!def) {
- dlog(5, "No conversion data for %d\n", type);
- return type_none;
- }
-
- while (def) {
- if ((!def->maxid && def->id == id) ||
- (def->id <= id && id <= def->maxid))
- return def->routable;
- def = def->next;
- }
- dlog(5, "Type[%d]:ID:[%04X] unknown\n", type, id);
- return 0;
-}
-
-char *g2n_get_descr(struct gar2nav_conv *c, int type, unsigned short id)
-{
- struct gar2navit *def = NULL;
- if (type == G2N_POINT)
- def = c->points;
- else if (type == G2N_POLYLINE)
- def = c->polylines;
- else if (type == G2N_POLYGONE)
- def = c->polygons;
- else {
- dlog(1, "Unknown conversion type:%d\n", type);
- return NULL;
- }
- while (def) {
- if ((!def->maxid && def->id == id) ||
- (def->id <= id && id <= def->maxid))
- return def->descr;
- def = def->next;
- }
- dlog(5, "Type[%d]:ID:[%04X] unknown\n", type, id);
- return NULL;
-}
-
-#if 0
-int main(int argc, char **argv)
-{
- load_types_file(argv[1], NULL);
- return 0;
-}
-#endif
-
-#include "g2nbuiltin.h"
diff --git a/navit/data/garmin/gar2navit.h b/navit/data/garmin/gar2navit.h
deleted file mode 100644
index de68298a..00000000
--- a/navit/data/garmin/gar2navit.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#define RT_PEDESTRIAN (1<<0)
-#define RT_BYCYCLE (1<<1)
-#define RT_MOTORCYCLE (1<<2)
-#define RT_CAR (1<<3)
-#define RT_TRUCK (1<<4)
-#define RT_LONGTRUCK (1<<5)
-
-struct gar2navit {
- unsigned short id;
- unsigned short maxid;
- enum item_type ntype;
- int routable;
- char *descr;
- struct gar2navit *next;
-};
-
-#define G2N_POINT 1
-#define G2N_POLYLINE 2
-#define G2N_POLYGONE 3
-
-struct gar2nav_conv {
- struct gar2navit *points;
- struct gar2navit *polylines;
- struct gar2navit *polygons;
-};
-
-struct gar2nav_conv *g2n_conv_load(char *file);
-enum item_type g2n_get_type(struct gar2nav_conv *c, int type, unsigned short id);
-char *g2n_get_descr(struct gar2nav_conv *c, int type, unsigned short id);
-int g2n_get_routable(struct gar2nav_conv *c, int type, unsigned short id);
-struct gar2nav_conv *g2n_default_conv(void);
diff --git a/navit/data/garmin/garmin.c b/navit/data/garmin/garmin.c
deleted file mode 100644
index d6d39d49..00000000
--- a/navit/data/garmin/garmin.c
+++ /dev/null
@@ -1,794 +0,0 @@
-/*
- Copyright (C) 2007 Alexander Atanasov <aatanasov@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; version 2 of the License.
-
- 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, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02110-1301 USA
-
- Garmin and MapSource are registered trademarks or trademarks
- of Garmin Ltd. or one of its subsidiaries.
-
-*/
-
-#include <glib.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include "config.h"
-#include "plugin.h"
-#include "data.h"
-#include "projection.h"
-#include "map.h"
-#include "maptype.h"
-#include "item.h"
-#include "attr.h"
-#include "coord.h"
-#include "transform.h"
-#include <stdio.h>
-#include "attr.h"
-#include "coord.h"
-#include <libgarmin.h>
-#include "garmin.h"
-#include "gar2navit.h"
-
-
-static int map_id;
-
-struct map_priv {
- int id;
- char *filename;
- struct gar2nav_conv *conv;
- struct gar *g;
-};
-
-struct map_rect_priv {
- int id;
- struct coord_rect r;
- char *label; // FIXME: Register all strings for searches
- int limit;
- struct map_priv *mpriv;
- struct gmap *gmap;
- struct gobject *cobj;
- struct gobject *objs;
- struct item item;
- unsigned int last_coord;
- void *last_itterated;
- struct coord last_c;
- void *last_oattr;
- unsigned int last_attr;
- struct gar_search *search;
-};
-
-int garmin_debug = 10;
-
-void
-logfn(char *file, int line, int level, char *fmt, ...)
-{
- va_list ap;
- if (level > garmin_debug)
- return;
- va_start(ap, fmt);
- fprintf(stdout, "%s:%d:%d|", file, line, level);
- vfprintf(stdout, fmt, ap);
- va_end(ap);
-}
-// need a base map and a map
-struct gscale {
- char *label;
- float scale;
- int bits;
-};
-
-static struct gscale mapscales[] = {
- {"7000 km", 70000.0, 8}
- ,{"5000 km", 50000.0, 8}
- ,{"3000 km", 30000.0, 9}
- ,{"2000 km", 20000.0, 9}
- ,{"1500 km", 15000.0, 10}
- ,{"1000 km", 10000.0, 10}
- ,{"700 km", 7000.0, 11}
- ,{"500 km", 5000.0, 11}
- ,{"300 km", 3000.0, 13}
- ,{"200 km", 2000.0, 13}
- ,{"150 km", 1500.0, 13}
- ,{"100 km", 1000.0, 14}
- ,{"70 km", 700.0, 15}
- ,{"50 km", 500.0, 16}
- ,{"30 km", 300.0, 16}
- ,{"20 km", 200.0, 17}
- ,{"15 km", 150.0, 17}
- ,{"10 km", 100.0, 18}
- ,{"7 km", 70.0, 18}
- ,{"5 km", 50.0, 19}
- ,{"3 km", 30.0, 19}
- ,{"2 km", 20.0, 20}
- ,{"1.5 km", 15.0, 22}
- ,{"1 km", 10.0, 24}
- ,{"700 m", 7.0, 24}
- ,{"500 m", 5.0, 24}
- ,{"300 m", 3.0, 24}
- ,{"200 m", 2.0, 24}
- ,{"150 m", 1.5, 24}
- ,{"100 m", 1.0, 24}
- ,{"70 m", 0.7, 24}
- ,{"50 m", 0.5, 24}
- ,{"30 m", 0.3, 24}
- ,{"20 m", 0.2, 24}
- ,{"15 m", 0.1, 24}
- ,{"10 m", 0.15, 24}
-};
-
-
-static int
-garmin_object_label(struct gobject *o, struct attr *attr)
-{
- struct map_rect_priv *mr = o->priv_data;
- if (!mr) {
- dlog(1, "Error object do not have priv_data!!\n");
- return 0;
- }
- if (mr->label)
- free(mr->label);
- mr->label = gar_get_object_lbl(o);
-#warning FIXME Process label and give only the visible part
- if (mr->label) {
- char *cp = mr->label;
- if (*mr->label == '@' || *mr->label == '^')
- cp++;
- /* FIXME: If zoomlevel is high convert ^ in the string to spaces */
- attr->u.str = cp;
- return 1;
- }
- return 0;
-}
-
-static int
-garmin_object_debug(struct gobject *o, struct attr *attr)
-{
- struct map_rect_priv *mr = o->priv_data;
- if (!mr) {
- dlog(1, "Error object do not have priv_data!!\n");
- return 0;
- }
- if (mr->label)
- free(mr->label);
- mr->label = gar_object_debug_str(o);
- if (mr->label) {
- attr->u.str = mr->label;
- return 1;
- }
- return 0;
-}
-
-
-static struct map_search_priv *
-gmap_search_new(struct map_priv *map, struct item *item, struct attr *search, int partial)
-{
- struct map_rect_priv *mr=g_new0(struct map_rect_priv, 1);
- struct gar_search *gs;
- int rc;
-
- dlog(1, "Called!\n");
- mr->mpriv=map;
- gs = g_new0(struct gar_search,1);
- if (!gs) {
- dlog(1, "Can not init search \n");
- free(mr);
- return NULL;
- }
- mr->search = gs;
- switch (search->type) {
- case attr_country_name:
- gs->type = GS_COUNTRY;
- break;
- case attr_town_name:
- gs->type = GS_CITY;
- break;
- case attr_town_postal:
- gs->type = GS_ZIP;
- break;
- case attr_street_name:
- gs->type = GS_ROAD;
- break;
-#if someday
- case attr_region_name:
- case attr_intersection:
- case attr_housenumber:
-#endif
- default:
- dlog(1, "Don't know how to search for %d\n", search->type);
- goto out_err;
- }
- gs->match = partial ? GM_START : GM_EXACT;
- gs->needle = strdup(search->u.str);
- dlog(5, "Needle: %s\n", gs->needle);
-
- mr->gmap = gar_find_subfiles(mr->mpriv->g, gs, GO_GET_SEARCH);
- if (!mr->gmap) {
- dlog(1, "Can not init search \n");
- goto out_err;
- }
- rc = gar_get_objects(mr->gmap, 0, gs, &mr->objs, GO_GET_SEARCH);
- if (rc < 0) {
- dlog(1, "Error loading objects\n");
- goto out_err;
- }
- mr->cobj = mr->objs;
- dlog(4, "Loaded %d objects\n", rc);
- return (struct map_search_priv *)mr;
-
-out_err:
- free(gs);
- free(mr);
- return NULL;
-}
-
-/* Assumes that only one item will be itterated at time! */
-static void
-coord_rewind(void *priv_data)
-{
- struct gobject *g = priv_data;
- struct map_rect_priv *mr = g->priv_data;
- mr->last_coord = 0;
-};
-
-static void
-attr_rewind(void *priv_data)
-{
- struct gobject *g = priv_data;
- struct map_rect_priv *mr = g->priv_data;
- mr->last_attr = 0;
-};
-
-static int
-point_coord_get(void *priv_data, struct coord *c, int count)
-{
- struct gobject *g = priv_data;
- struct map_rect_priv *mr = g->priv_data;
- struct gcoord gc;
- if (!count)
- return 0;
- if (g != mr->last_itterated) {
- mr->last_itterated = g;
- mr->last_coord = 0;
- }
-
- if (mr->last_coord > 0)
- return 0;
-
- gar_get_object_coord(mr->gmap, g, &gc);
- c->x = gc.x;
- c->y = gc.y;
- mr->last_coord++;
-// dlog(1,"point: x=%d y=%d\n", c->x, c->y);
- // dlog(1, "point: x=%f y=%f\n", GARDEG(c->x), GARDEG(c->y));
- return 1;
-}
-
-static int
-coord_is_segment(void *priv_data)
-{
- struct gobject *g = priv_data;
- struct map_rect_priv *mr = g->priv_data;
-
- if (mr->last_coord == 0)
- return 0;
- return gar_is_object_dcoord_node(mr->gmap, g, mr->last_coord - 1);
-}
-
-static int
-poly_coord_get(void *priv_data, struct coord *c, int count)
-{
- struct gobject *g = priv_data;
- struct map_rect_priv *mr = g->priv_data;
- int ndeltas = 0, total = 0;
- struct gcoord dc;
-
- if (!count)
- return 0;
-
- if (g != mr->last_itterated) {
- mr->last_itterated = g;
- mr->last_coord = 0;
- }
- ndeltas = gar_get_object_deltas(g);
- if (mr->last_coord > ndeltas + 1)
- return 0;
- while (count --) {
- if (mr->last_coord == 0) {
- gar_get_object_coord(mr->gmap, g, &dc);
- mr->last_c.x = dc.x;
- mr->last_c.y = dc.y;
- } else {
- if (!gar_get_object_dcoord(mr->gmap, g, mr->last_coord - 1, &dc)) {
- mr->last_coord = ndeltas + 2;
- return total;
- }
- mr->last_c.x += dc.x;
- mr->last_c.y += dc.y;
- }
- c->x = mr->last_c.x;
- c->y = mr->last_c.y;
- ddlog(1, "poly: x=%f y=%f\n", GARDEG(c->x), GARDEG(c->y));
-// dlog(1,"poly: x=%d y=%d\n", c->x, c->y);
- c++;
- total++;
- mr->last_coord ++;
- }
- return total;
-}
-
-// for _any we must return one by one
-static int
-point_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
-{
- struct gobject *g = priv_data;
- struct map_rect_priv *mr = g->priv_data;
- int rc;
- switch (attr_type) {
- case attr_any:
- if (g != mr->last_oattr) {
- mr->last_oattr = g;
- mr->last_attr = 0;
- }
- switch(mr->last_attr) {
- case 0:
- mr->last_attr++;
- attr->type = attr_label;
- rc = garmin_object_label(g, attr);
- if (rc)
- return rc;
- case 1:
- mr->last_attr++;
- attr->type = attr_debug;
- rc = garmin_object_debug(g, attr);
- if (rc)
- return rc;
- case 2:
- mr->last_attr++;
- if (g->type == GO_POLYLINE) {
- attr->type = attr_street_name;
- rc = garmin_object_label(g, attr);
- if (rc)
- return rc;
- }
- case 3:
- mr->last_attr++;
- attr->type = attr_flags;
- attr->u.num = 0;
- rc = gar_object_flags(g);
- if (rc & F_ONEWAY)
- attr->u.num |= AF_ONEWAY;
- if (rc & F_SEGMENTED)
- attr->u.num |= AF_SEGMENTED;
- return 1;
- default:
- return 0;
- }
- break;
- case attr_label:
- attr->type = attr_label;
- return garmin_object_label(g, attr);
- case attr_town_name:
- attr->type = attr_town_name;
- return garmin_object_label(g, attr);
- case attr_street_name:
- attr->type = attr_street_name;
- return garmin_object_label(g, attr);
- case attr_flags:
- attr->type = attr_flags;
- attr->u.num = 0;
- rc = gar_object_flags(g);
- if (rc & F_ONEWAY)
- attr->u.num |= AF_ONEWAY;
- if (rc & F_SEGMENTED)
- attr->u.num |= AF_SEGMENTED;
- return 1;
- default:
- dlog(1, "Dont know about attribute %d[%04X]=%s yet\n", attr_type,attr_type, attr_to_name(attr_type));
- }
-
- return 0;
-}
-
-static struct item_methods methods_garmin_point = {
- coord_rewind,
- point_coord_get,
- attr_rewind,
- point_attr_get,
-};
-
-static struct item_methods methods_garmin_poly = {
- coord_rewind,
- poly_coord_get,
- attr_rewind, // point_attr_rewind,
- point_attr_get, // poly_attr_get,
- coord_is_segment,
-};
-
-static struct item *
-garmin_poi2item(struct map_rect_priv *mr, struct gobject *o, unsigned short otype)
-{
- if (mr->mpriv->conv)
- mr->item.type = g2n_get_type(mr->mpriv->conv, G2N_POINT, otype);
- mr->item.meth = &methods_garmin_point;
- return &mr->item;
-}
-
-static struct item *
-garmin_pl2item(struct map_rect_priv *mr, struct gobject *o, unsigned short otype)
-{
- if (mr->mpriv->conv)
- mr->item.type = g2n_get_type(mr->mpriv->conv, G2N_POLYLINE, otype);
- mr->item.meth = &methods_garmin_poly;
- return &mr->item;
-}
-
-static struct item *
-garmin_pg2item(struct map_rect_priv *mr, struct gobject *o, unsigned short otype)
-{
- if (mr->mpriv->conv)
- mr->item.type = g2n_get_type(mr->mpriv->conv, G2N_POLYGONE, otype);
- mr->item.meth = &methods_garmin_poly;
- return &mr->item;
-}
-
-static struct item *
-garmin_obj2item(struct map_rect_priv *mr, struct gobject *o)
-{
- unsigned short otype;
- otype = gar_obj_type(o);
- mr->item.type = type_none;
- switch (o->type) {
- case GO_POINT:
- return garmin_poi2item(mr, o, otype);
- case GO_POLYLINE:
- return garmin_pl2item(mr, o, otype);
- case GO_POLYGON:
- return garmin_pg2item(mr, o, otype);
- case GO_ROAD:
- return garmin_pl2item(mr, o, otype);
- default:
- dlog(1, "Unknown garmin object type:%d\n",
- o->type);
- }
- return NULL;
-}
-
-static struct item *
-gmap_rect_get_item_byid(struct map_rect_priv *mr, int id_hi, int id_lo)
-{
- struct gobject *o;
- o = mr->objs = gar_get_object_by_id(mr->mpriv->g, id_hi, id_lo);
- if (!o) {
- dlog(1, "Can not find object\n");
- return NULL;
- }
-
- mr->item.id_hi = id_hi;
- mr->item.id_lo = id_lo;
- mr->item.priv_data = o;
- mr->item.type = type_none;
- o->priv_data = mr;
- if (!garmin_obj2item(mr, o))
- return NULL;
- return &mr->item;
-}
-
-static struct item *
-gmap_rect_get_item(struct map_rect_priv *mr)
-{
- struct gobject *o;
- if (!mr->objs)
- return NULL;
- if (!mr->cobj)
- return NULL;
- // mr->cobj = mr->objs;
- o = mr->cobj;
-// dlog(1, "gi:o=%p\n", o);
- mr->cobj = mr->cobj->next;
- if (o) {
- mr->item.id_hi = gar_object_mapid(o);
- mr->item.id_lo = gar_object_index(o);
- mr->item.priv_data = o;
- mr->item.type = type_none;
- o->priv_data = mr;
- if (!garmin_obj2item(mr, o))
- return NULL;
- return &mr->item;
- }
- return NULL;
-}
-
-#define max(a,b) ((a) > (b) ? (a) : (b))
-struct nl2gl_t {
- int g;
- int bits;
- char *descr;
-};
-
-struct nl2gl_t nl2gl_1[] = {
- { /* 0 */ .g = 12, .descr = "0-120m", },
- { /* 1 */ .g = 11, .descr = "0-120m", },
- { /* 2 */ .g = 10, .descr = "0-120m", },
- { /* 3 */ .g = 9, .descr = "0-120m", },
- { /* 4 */ .g = 8, .descr = "0-120m", },
- { /* 5 */ .g = 7, .descr = "0-120m", },
- { /* 6 */ .g = 6, .descr = "0-120m", },
- { /* 7 */ .g = 5, .descr = "0-120m", },
- { /* 8 */ .g = 4, .descr = "0-120m", },
- { /* 9 */ .g = 4, .descr = "0-120m", },
- { /* 10 */ .g = 3, .descr = "0-120m", },
- { /* 11 */ .g = 3, .descr = "0-120m", },
- { /* 12 */ .g = 2, .descr = "0-120m", },
- { /* 13 */ .g = 2, .descr = "0-120m", },
- { /* 14 */ .g = 2, .descr = "0-120m", },
- { /* 15 */ .g = 1, .descr = "0-120m", },
- { /* 16 */ .g = 1, .descr = "0-120m", },
- { /* 17 */ .g = 1, .descr = "0-120m", },
- { /* 18 */ .g = 0, .descr = "0-120m", },
-};
-
-struct nl2gl_t nl2gl[] = {
- { /* 0 */ .g = 9, .descr = "0-120m", },
- { /* 1 */ .g = 9, .descr = "0-120m", },
- { /* 2 */ .g = 8, .descr = "0-120m", },
- { /* 3 */ .g = 8, .descr = "0-120m", },
- { /* 4 */ .g = 7, .descr = "0-120m", },
- { /* 5 */ .g = 7, .descr = "0-120m", },
- { /* 6 */ .g = 6, .descr = "0-120m", },
- { /* 7 */ .g = 6, .descr = "0-120m", },
- { /* 8 */ .g = 5, .descr = "0-120m", },
- { /* 9 */ .g = 5, .descr = "0-120m", },
- { /* 10 */ .g = 4, .descr = "0-120m", },
- { /* 11 */ .g = 4, .descr = "0-120m", },
- { /* 12 */ .g = 3, .descr = "0-120m", },
- { /* 13 */ .g = 3, .descr = "0-120m", },
- { /* 14 */ .g = 2, .descr = "0-120m", },
- { /* 15 */ .g = 2, .descr = "0-120m", },
- { /* 16 */ .g = 1, .descr = "0-120m", },
- { /* 17 */ .g = 1, .descr = "0-120m", },
- { /* 18 */ .g = 0, .descr = "0-120m", },
-};
-
-static int
-get_level(struct map_selection *sel)
-{
- int l;
- l = max(sel->order[layer_town], sel->order[layer_street]);
- l = max(l, sel->order[layer_poly]);
- return l;
-}
-
-static int
-garmin_get_selection(struct map_rect_priv *map, struct map_selection *sel)
-{
- struct gar_rect r;
- struct gmap *gm;
- struct gobject **glast = NULL;
- int rc;
- int sl, el;
- int level = 0; // 18; /* max level for maps, overview maps can have bigger
- /* levels we do not deal w/ them
- */
- int flags = 0;
- if (sel && sel->order[layer_town] == 0 && sel->order[layer_poly] == 0
- && sel->order[layer_street]) {
- // Get all roads
- flags = GO_GET_ROUTABLE;
- sel = NULL;
- } else if (sel)
- flags = GO_GET_SORTED;
-
- if (sel) {
- r.lulat = sel->u.c_rect.lu.y;
- r.lulong = sel->u.c_rect.lu.x;
- r.rllat = sel->u.c_rect.rl.y;
- r.rllong = sel->u.c_rect.rl.x;
- level = get_level(sel);
-// level = nl2gl[level].g;
- dlog(2, "Looking level=%d for %f %f %f %f\n",
- level, r.lulat, r.lulong, r.rllat, r.rllong);
- }
- gm = gar_find_subfiles(map->mpriv->g, sel ? &r : NULL, flags);
- if (!gm) {
- if (sel) {
- dlog(1, "Can not find map data for the area: %f %f %f %f\n",
- r.lulat, r.lulong, r.rllat, r.rllong);
- } else {
- dlog(1, "Can not find map data\n");
- }
- return -1;
- }
-#if 0
- sl = (18-(gm->maxlevel - gm->minlevel))/2;
- el = sl + (gm->maxlevel - gm->minlevel);
- if (level < sl)
- level = sl;
- if (level > el)
- level = el;
- level = level - sl;
- level = (gm->maxlevel - gm->minlevel) - level;
- dlog(3, "sl=%d el=%d level=%d\n", sl, el, level);
-#endif
- sl = (18-gm->zoomlevels)/2;
- el = sl + gm->zoomlevels;
- if (level < sl)
- level = sl;
- if (level > el)
- level = el;
- level = level - sl;
- level = gm->basebits + level;
- dlog(3, "sl=%d el=%d level=%d\n", sl, el, level);
- map->gmap = gm;
- glast = &map->objs;
- while (*glast) {
- if ((*glast)->next) {
- *glast = (*glast)->next;
- } else
- break;
- }
- rc = gar_get_objects(gm, level, sel ? &r : NULL, glast, flags);
- if (rc < 0) {
- dlog(1, "Error loading objects\n");
- return -1;
- }
- map->cobj = map->objs;
- dlog(2, "Loaded %d objects\n", rc);
- return rc;
-}
-// Can not return NULL, navit segfaults
-static struct map_rect_priv *
-gmap_rect_new(struct map_priv *map, struct map_selection *sel)
-{
- struct map_selection *ms = sel;
- struct map_rect_priv *mr;
-
- if (!map)
- return NULL;
- mr = calloc(1, sizeof(*mr));
- if (!mr)
- return mr;
- mr->mpriv = map;
- if (!sel) {
- return mr;
- } else {
- while (ms) {
- dlog(2, "order town:%d street=%d poly=%d\n",
- ms->order[layer_town],
- ms->order[layer_street],
- ms->order[layer_poly]);
- if (garmin_get_selection(mr, ms) < 0) {
- // free(mr);
- // return NULL;
- }
- ms = ms->next;
- }
- }
- return mr;
-}
-
-static void
-gmap_rect_destroy(struct map_rect_priv *mr)
-{
- dlog(11,"destroy maprect\n");
- if (mr->gmap)
- gar_free_gmap(mr->gmap);
- if (mr->objs)
- gar_free_objects(mr->objs);
- if (mr->label)
- free(mr->label);
- free(mr);
-}
-
-static void
-gmap_search_destroy(struct map_search_priv *ms)
-{
- gmap_rect_destroy((struct map_rect_priv *)ms);
-}
-
-static void
-gmap_destroy(struct map_priv *m)
-{
- dlog(5, "garmin_map_destroy\n");
- if (m->g)
- gar_free(m->g);
- if (m->filename)
- free(m->filename);
- free(m);
-}
-
-static struct map_methods map_methods = {
- projection_garmin,
-// NULL, FIXME navit no longer displays labels without charset!
- "iso8859-1", // update from the map
- gmap_destroy, //
- gmap_rect_new,
- gmap_rect_destroy,
- gmap_rect_get_item,
- gmap_rect_get_item_byid,
- gmap_search_new,
- gmap_search_destroy,
- gmap_rect_get_item,
-};
-
-static struct map_priv *
-gmap_new(struct map_methods *meth, struct attr **attrs)
-{
- struct map_priv *m;
- struct attr *data;
- struct attr *debug;
- char buf[PATH_MAX];
- struct stat st;
- int dl = 1;
- struct gar_config cfg;
-
- data=attr_search(attrs, NULL, attr_data);
- if (! data)
- return NULL;
- debug=attr_search(attrs, NULL, attr_debug);
- if (debug) {
- dl = atoi(debug->u.str);
- if (!dl)
- dl = 1;
- }
- m=g_new(struct map_priv, 1);
- m->id=++map_id;
- m->filename = strdup(data->u.str);
- if (!m->filename) {
- g_free(m);
- return NULL;
- }
- memset(&cfg, 0, sizeof(struct gar_config));
- cfg.opm = OPM_GPS;
- cfg.debuglevel = dl;
- garmin_debug = dl;
- m->g = gar_init_cfg(NULL, logfn, &cfg);
- if (!m->g) {
- g_free(m->filename);
- g_free(m);
- return NULL;
- }
- // we want the data now, later we can load only what's necessery
- if (gar_img_load(m->g, m->filename, 1) < 0) {
- gar_free(m->g);
- g_free(m->filename);
- g_free(m);
- return NULL;
- }
- m->conv = NULL;
- snprintf(buf, sizeof(buf), "%s.types", m->filename);
- if (!stat(buf, &st)) {
- dlog(1, "Loading custom types from %s\n", buf);
- m->conv = g2n_conv_load(buf);
- }
- if (!m->conv) {
- dlog(1, "Using builtin types\n");
- m->conv = g2n_default_conv();
- }
- if (!m->conv) {
- dlog(1, "Failed to load map types\n");
- }
- *meth=map_methods;
- return m;
-}
-
-void
-plugin_init(void)
-{
- plugin_register_map_type("garmin", gmap_new);
-}
diff --git a/navit/data/garmin/garmin.h b/navit/data/garmin/garmin.h
deleted file mode 100644
index 50935b05..00000000
--- a/navit/data/garmin/garmin.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#define dlog(x,y ...) logfn(__FILE__,__LINE__,x, ##y)
-#ifdef HARDDEBUG
-#define ddlog(x,y ...) logfn(__FILE__,__LINE__,x, ##y)
-#else
-#define ddlog(x,y ...)
-#endif
-
-extern int garmin_debug;
-void logfn(char *file, int line, int level, char *fmt, ...);
-
diff --git a/navit/data/garmin/garmintypes.txt b/navit/data/garmin/garmintypes.txt
deleted file mode 100644
index fd73d372..00000000
--- a/navit/data/garmin/garmintypes.txt
+++ /dev/null
@@ -1,412 +0,0 @@
-#
-#
-#
-POINT
-0x0000 = label_unkn, Unknown label
-0x0100 = town_label_1e5, Megapolis (10M +)
-0x0200 = town_label_5e4, Megapolis (5-10M)
-0x0300 = town_label_2e4, Big City (2-5M)
-0x0400 = town_label_1e4, Big City (1-2M)
-0x0500 = town_label_5e3, Big City (0.5-1M)
-0x0600 = town_label_2e3, City (200-500k)
-0x0700 = town_label_1e3, City (100-200k)
-0x0800 = town_label_5e2, City (50-100k)
-0x0900 = town_label_2e2, City (20-50k)
-0x0a00 = town_label_1e2, City (10-20k)
-0x0b00 = town_label_5e1, Small City (5-10k)
-0x0c00 = town_label_2e1, Small City (2-5k)
-0x0d00 = town_label_1e1, Village (1-2k)
-0x0e00 = town_label_5e0, Village (500-1000)
-0x0f00 = town_label_2e0, Village (200-500)
-0x1000 = town_label_1e0, Village (100-200)
-0x1100 = town_label_0e0, Village (0-100)
-
-0x1200 = port_label, Port with services
-0x1300 = label_unkn, Unknown label2
-0x1400-0x14FF = country_label, Large Country Name
-0x1500-0x15FF = country_label, Country Name
-0x1c00 = poi_wreck, Unclassified Obstruction
-0x1c01 = poi_wreck, Wreck
-0x1c02 = poi_dangerous, submerged wreck, dangerous
-0x1c03 = poi_nondangerous, submerged wreck, non-dangerous
-0x1c04 = poi_wreck, Wreck, cleared by wire drag
-0x1c05 = poi_rock, Obstruction, visible at high water
-0x1c06 = poi_rock, Obstruction, awash
-0x1c07 = poi_rock, Obstruction, submerged
-0x1c08 = poi_rock, Obstruction, cleared by wire drag
-0x1c09 = poi_rock, Rock, awash
-0x1c0a = poi_rock, Rock, submerged at low Water
-0x1c0b = poi_sounding, Sounding
-0x1d00 = poi_tide, Tide Prediction
-
-0x1e00-0x1e3f = district_label, District, Province, State Name
-0x1f00 = district_label_0e0, Region, District Name
-
-# Fixme if it has label how to change to highway_exit_with_label ??
-0x2000-0x203F = highway_exit, Exit
-0x2100-0x213F = highway_exit, Exit with Services
-0x2200-0x223F = highway_exit, Exit with Restroom
-0x2300-0x233F = highway_exit, Exit with Convinience Store
-0x2400-0x243F = highway_exit, Exit with Weight Station
-0x2500-0x253F = highway_exit, Exit with Toolbooth Booth
-0x2600-0x263F = highway_exit, Exit with Information
-0x2700-0x273F = highway_exit, Exit
-
-0x2800-0x283F = district_label_1e0, Region Name
-
-0x2900 = poi_public_utilities, Services
-
-0x2A00 = poi_dining, Dining(Other)
-0x2A01 = poi_dining, Dining(American)
-0x2A02 = poi_dining, Dining(Asian)
-0x2A03 = poi_dining, Dining(Barbecue)
-0x2A04 = poi_dining, Dining(Chinese)
-0x2A05 = poi_dining, Dining(Deli/Bakery)
-0x2A06 = poi_dining, Dining(International)
-0x2A07 = poi_fastfood, Fast Food
-0x2A08 = poi_dining, Dining(Italian)
-0x2A09 = poi_dining, Dining(Mexican)
-0x2A0A = poi_dining, Dining(Pizza)
-0x2A0B = poi_dining, Dining(Sea Food)
-0x2A0C = poi_dining, Dining(Steak/Grill)
-0x2A0D = poi_dining, Dining(Bagel/Donut)
-0x2A0E = poi_dining, Dining(Cafe/Diner)
-0x2A0F = poi_dining, Dining(French)
-0x2A10 = poi_dining, Dining(German)
-0x2A11 = poi_dining, Dining(British Isles)
-0x2A12 = poi_dining, Dining(Special Foods)
-
-0x2B00 = poi_hotel, Hotel(Other)
-0x2B01 = poi_hotel, Hotel/Motel
-0x2B02 = poi_hotel, Bed & Breakfast inn
-0x2B03 = poi_camp_rv, Camping/RV-Park
-0x2B04 = poi_resort, Resort
-
-0x2C00 = poi_attraction, Amusement Park
-0x2C01 = poi_attraction, Amusement Park
-0x2C02 = poi_museum_history, Museum/History
-0x2C03 = poi_library, Libraries
-0x2C04 = poi_landmark, Land Mark
-0x2C05 = poi_school, School
-0x2C06 = poi_park, Park
-0x2C07 = poi_zoo, Zoo
-0x2C08 = poi_stadium, Sportpark, Stadium,(point)
-0x2C09 = poi_fair, Fair, Conference(point)
-0x2C0A = poi_wine, Wine restaurant(point)
-0x2C0B = poi_worship, Place of Worship
-0x2C0C = poi_hotspring, Hot Spring
-
-0x2D00 = poi_theater, Theater
-0x2D01 = poi_theater, Theater
-0x2D02 = poi_bar, Bar
-0x2D03 = poi_cinema, Cinema
-0x2D04 = poi_casino, Casino
-0x2D05 = poi_golf, Golf
-0x2D06 = poi_skiing, Skiing Center
-0x2D07 = poi_bowling, Bowling
-0x2D08 = poi_icesport, Ice/Sporting
-0x2D09 = poi_swimming, Swimming
-0x2D0A = poi_sport, Sports(point)
-0x2D0B = poi_sailing, Sailing Airport
-
-0x2E00 = poi_shopping, Shoping general
-0x2E01 = poi_shop_department, Department Store
-0x2E02 = poi_shop_grocery, Grocery
-0x2E03 = poi_shop_merchandise, General Merchandiser
-0x2E04 = poi_mall, Shopping Center
-0x2E05 = poi_pharmacy, Pharmacy
-0x2E06 = poi_shopping, Convenience
-0x2E07 = poi_shop_apparel, Apparel
-0x2E08 = poi_shop_handg, House and Garden
-0x2E09 = poi_shop_furnish, Home Furnishing
-0x2E0a = poi_shop_retail, Special Retail
-0x2E0b = poi_shop_computer, Computer/Software
-
-0x2F00 = poi_service, generic service
-0x2F01 = poi_fuel, Fuel/Gas
-0x2F02 = poi_car_rent, Car Rental
-0x2F03 = poi_autoservice, Car Repair
-0x2F04 = poi_airport, Airport
-0x2F05 = poi_post, Post Office
-0x2F06 = poi_bank, Bank
-0x2F07 = poi_car_dealer_parts, Car Dealer(point)
-0x2F08 = poi_bus_station, Bus Station
-0x2F09 = poi_marina, Marina
-0x2F0A = poi_wrecker, Wrecker Service
-0x2F0B = poi_car_parking, Parking
-0x2F0C = poi_rest_room, Restroom
-0x2F0D = poi_auto_club, Automobile Club
-0x2F0E = poi_car_wash, Car Wash
-0x2F0F = poi_garmin, Garmin Dealer
-0x2F10 = poi_personal_service, Personal Service
-0x2F11 = poi_bussines_service, Business Service
-0x2F12 = poi_communication, Communication
-0x2F13 = poi_repair_service, Repair Service
-0x2F14 = poi_social_service, Social Service
-0x2F15 = poi_public_utilities, Utility
-0x2F16 = poi_truck_stop, Truck Stop
-0x2F17 = poi_bus_stop, Bus Stop
-
-0x3000 = poi_emergency, generic emergency/government
-0x3001 = poi_police, Police Station
-0x3002 = poi_hospital, Hospital
-0x3003 = poi_public_office, Public Office
-0x3004 = poi_justice, Justice
-0x3005 = poi_concert, Concert hall(point)
-0x3006 = poi_border_station, Border Station(point)
-0x3007 = poi_goverment_building, Goverment Building
-0x3008 = poi_firebrigade, FireFighters Station
-
-0x4000-0x403F = poi_golf, Golf
-0x4100-0x413F = poi_fish, Fish
-0x4200-0x423F = poi_wreck, Wreck
-0x4300-0x433F = poi_marina, Marina
-0x4400-0x443F = poi_fuel, Gas
-0x4500-0x453F = poi_restaurant, Restaurant
-0x4600-0x463F = poi_bar, Bar
-0x4700-0x473F = poi_boat_ramp, Boat Ramp
-0x4800-0x483F = poi_camping, Camping
-0x4900-0x493F = poi_park, Park
-0x4A00-0x4A3F = poi_picnic, Picnic Area
-0x4B00-0x4B3F = poi_hospital, Hospital
-0x4C00-0x4C3F = poi_information, Information
-0x4D00-0x4D3F = poi_car_parking, Parking
-0x4E00-0x4E3F = poi_restroom, Restroom
-0x4F00-0x4F3F = poi_shower, Shower
-0x5000-0x503F = poi_drinking_water, Drinking Water
-0x5100-0x513F = poi_telephone, Telephone
-0x5200-0x523F = poi_scenic_area, Scenic Area
-0x5300-0x533F = poi_skiing, Skiing
-0x5400-0x543F = poi_swimming, Swimming
-0x5500-0x553F = poi_dam, Dam
-
-0x5600-0x563F = poi_forbiden_area, Forbiden Area
-0x5700-0x573F = poi_danger_area, Danger Area
-0x5800-0x583F = poi_restricted_area, Restricted Area
-
-0x5900 = poi_airport, Generic Airport
-0x5901 = poi_airport, Large Airport
-0x5902 = poi_airport, Medium Airport
-0x5903 = poi_airport, Small Airport
-0x5904 = poi_heliport, Heliport
-0x5905-0x593F = poi_airport, Airport
-
-0x5a00 = poi_mark, Kilometer Pole
-0x5b00 = poi_mark, Kolokol
-0x5c00 = poi_diving, Diving Place
-
-0x5D00-0x5D3F = poi_daymark, Daymark,Green Square
-0x5E00-0x5E3F = poi_daymark, Daymark,Red Triangle
-
-0x6000 = poi_loudspeaker, LoudSpeaker
-0x6100 = poi_building, House
-
-0x6200 = poi_height, Height with point in feet one decimal place
-0x6300 = poi_height, Height without point in feet no decimal place
-0x6400 = poi_manmade_feature, Manmade Feature
-0x6401 = poi_bridge, Bridge
-0x6402 = poi_building, Building
-0x6403 = poi_cemetery, Cemetery
-0x6404 = poi_church, Church
-0x6405 = poi_civil, Civil
-0x6406 = poi_crossing, Crossing
-0x6407 = poi_dam, Dam
-0x6408 = poi_hospital, Hospital
-0x6409 = poi_levee, Levee
-0x640A = poi_locale, Locale
-0x640B = poi_military, Military
-0x640C = poi_mine, Mine
-0x640D = poi_oil_field, Oil Field
-0x640E = poi_park, Park
-0x640F = poi_post, Post
-0x6410 = poi_school, School
-0x6411 = poi_tower, Tower
-0x6412 = poi_trail, Trail
-0x6413 = poi_tunnel, Tunnel
-0x6414 = poi_drinking_water, Drink water
-0x6415 = town_ghost, Ghost Town
-0x6416 = poi_subdivision, Subdivision
-
-0x6500 = poi_water_feature, Water Feature
-0x6501 = poi_water_feature, Arroyo
-0x6502 = poi_water_feature, Sand Bar
-0x6503 = poi_bay, Bay
-0x6504 = poi_bend, Bend
-0x6505 = poi_water_feature, Canal
-0x6506 = poi_water_feature, Channel
-0x6507 = poi_cove, Cove
-0x6508 = poi_water_feature, Falls
-0x6509 = poi_water_feature, Geyser
-0x650A = poi_water_feature, Glacier
-0x650B = poi_marine, Harbour
-0x650C = poi_island, Island
-0x650D = poi_water_feature, Lake
-0x650E = poi_water_feature, Rapids
-0x650F = poi_water_feature, Reservoir
-0x6510 = poi_water_feature, Sea
-0x6511 = poi_water_feature, Spring
-0x6512 = poi_water_feature, Stream
-0x6513 = poi_water_feature, Swamp
-
-0x6600 = poi_land_feature, Land Feature
-0x6601 = poi_land_feature, Arch
-0x6602 = poi_land_feature, Area
-0x6603 = poi_land_feature, Basin
-0x6604 = poi_land_feature, Beach
-0x6605 = poi_land_feature, Bench
-0x6606 = poi_land_feature, Cape
-0x6607 = poi_land_feature, Cliff
-0x6608 = poi_land_feature, Crater
-0x6609 = poi_land_feature, Flat
-0x660A = poi_land_feature, Forest
-0x660B = poi_land_feature, Gap
-0x660C = poi_land_feature, Gut
-0x660D = poi_land_feature, Isthmus
-0x660E = poi_land_feature, Lava
-0x660F = poi_land_feature, Pillar
-0x6610 = poi_land_feature, Plain
-0x6611 = poi_land_feature, Range
-0x6612 = poi_land_feature, Reserve
-0x6613 = poi_land_feature, Ridge
-0x6614 = poi_land_feature, Rock
-0x6615 = poi_land_feature, Slope
-0x6616 = poi_land_feature, Summit
-0x6617 = poi_land_feature, Valley
-0x6618 = poi_land_feature, Woods
-
-# This are dublicated to 0x1700, 0x1800, 0x1900, 0x1A00, 0x1B00
-# fix them if you need them
-0x1600 = poi_marine_type, Beakon
-0x1601 = poi_marine_type, Fog Horn
-0x1602 = poi_marine_type, Radio Beacon
-0x1603 = poi_marine_type, Racon
-0x1604 = poi_marine_type, Day Beacon, red triangle
-0x1605 = poi_marine_type, Day Beacon, green square
-0x1606 = poi_marine_type, Day Beacon, white diamond
-0x1607 = poi_marine_type, unlit Navaid, white
-0x1608 = poi_marine_type, unlit Navaid, red
-0x1609 = poi_marine_type, unlit Navaid, green
-0x160a = poi_marine_type, unlit Navaid, black
-0x160b = poi_marine_type, unlit Navaid, yellow or amber
-0x160c = poi_marine_type, unlit Navaid, orange
-0x160d = poi_marine_type, unlit Navaid, multi colored
-0x160e = poi_marine_type, Navaid, unknown
-0x160f = poi_marine_type, lighted Navaid, white
-0x1610 = poi_marine_type, lighted Navaid, red
-0x1611 = poi_marine_type, lighted Navaid, green
-0x1612 = poi_marine_type, lighted Navaid, yellow or amber
-0x1613 = poi_marine_type, lighted Navaid, orange
-0x1614 = poi_marine_type, lighted Navaid, violet
-0x1615 = poi_marine_type, lighted Navaid, blue
-0x1616 = poi_marine_type, lighted Navaid, multi colored
-
-#
-# Street's are routable by:
-# ALL - by all
-# W pedestrian
-# B bycycle
-# M motorcycle
-# C car
-# T truck
-# L largetruck
-# this is probably, encoded into the map
-
-POLYLINE
-0x00 = ALL, street_1_land, Road
-0x01 = MCTL, highway_land, Major HWY thick
-0x02 = MCTL, street_4_land, Principal HWY-thick
-0x03 = MCTL, street_2_land, Principal HWY-medium
-0x04 = MCTL, street_3_city, Arterial Road-medium
-0x05 = MCTL, street_4_city, Arterial Road-thick
-0x06 = MCTL, street_2_city, Road-thin
-0x07 = MCTL, street_1_city, Alley-thick
-0x08 = MCTL, ramp, Ramp
-0x09 = MCTL, ramp, Ramp highspeed
-0x0a = MCTL, street_0, Unpaved Road-thin
-0x0b = MCTL, ramp, Major HWY Connector-thick
-0x0c = MCTL, roundabout, Roundabout
-0x0d = MCTL, street_unkn, Reservation/Zapovednik?
-0x0e = MCTL, street_unkn, Unknown Element 0x0e
-0x0f = NONE, street_unkn, Unknown Element 0x0f
-0x10 = NONE, street_unkn, Unknown Element 0x10
-0x11 = NONE, street_unkn, Unknown Element 0x11
-0x12 = NONE, street_unkn, Unknown Element 0x12
-0x13 = NONE, street_unkn, Unknown Element 0x13
-0x14 = NONE, rail, Railroad
-0x15 = NONE, water_line, Shoreline
-0x16 = W, street_nopass, Trail
-0x18 = NONE, water_line, Stream-thin
-0x19 = NONE, time_zone, Time-Zone
-0x1a = ALL, ferry, Ferry
-0x1b = ALL, ferry, Ferry
-0x1c = NONE, border_country, Political Boundary
-0x1d = NONE, border_country, County Boundary
-0x1e = NONE, border_country, Intl. Boundary
-0x1f = NONE, water_line, River
-0x20 = NONE, height_line_1, Land Contour (thin) Height in feet
-0x21 = NONE, height_line_2, Land Contour (medium) Height in feet
-0x22 = NONE, height_line_3, Land Contour (thick) Height in feet
-0x23 = NONE, depth_line_1, Depth Contour (thin) Depth in feet
-0x24 = NONE, depth_line_2, Depth Contour (medium) Depth in feet
-0x25 = NONE, depth_line_3, Depth Contour (thick) Depth in feet
-0x26 = NONE, water_line, Intermittent River
-0x27 = NONE, street_nopass, Airport Runway
-0x28 = NONE, pipeline, Pipeline
-0x29 = NONE, powerline, Powerline
-0x2a = NONE, marine_boundary, Marine Boundary (no line)
-0x2b = NONE, marine_hazard, Marine Hazard (no line)
-
-POLYGONE
-0x01 = poly_town, City (>200k)
-0x02 = poly_town, City (<200k)
-0x03 = poly_town, Village
-0x04 = poly_military_zone, Military
-0x05 = poly_car_parking, Parking Lot
-0x06 = poly_car_parking, Parking Garage
-0x07 = poly_airport, Airport
-0x08 = poly_commercial_center, Shopping Center
-0x09 = poly_marine, Marina
-0x0a = poly_university, University/College
-0x0b = poly_hospital, Hospital
-0x0c = poly_industry, Industrial
-0x0d = area, Reservation
-0x0e = poly_airport, Airport Runway
-0x13 = area_unspecified, Man made area
-0x14 = poly_park, National park
-0x15 = poly_park, National park
-0x16 = poly_park, National park
-0x17 = poly_park, City Park
-0x18 = poly_golf_course, Golf
-0x19 = poly_sport, Sport
-0x1a = poly_cemetery, Cemetery
-0x1e = poly_park, State Park
-0x1f = poly_park, State Park
-0x20 = poly_park, State Park
-0x28 = poly_water, Ocean
-0x29 = poly_water, Water Reservour
-0x32 = poly_water, Sea
-0x3b = poly_water, Water Reservour
-0x3c = poly_water, Lake (250-600 km2)
-0x3d = poly_water, Lake (77-250 km2)
-0x3e = poly_water, Lake (25-77 km2)
-0x3f = poly_water, Lake (11-25 km2)
-0x40 = poly_water, Lake (0.25-11 km2)
-0x41 = poly_water, Lake (<0.25 km2)
-0x42 = poly_water, Lake (>3.3k km2)
-0x43 = poly_water, Lake (1.1-3.3k km2)
-0x44 = poly_water, Lake (0.6-1.1k km2)
-0x45 = poly_water, Water Reservour
-0x46 = poly_water, River (>1km)
-0x47 = poly_water, River (200m-1km)
-0x48 = poly_water, River (40-200m)
-0x49 = poly_water, River (<40m)
-0x4a = area, Definition Area
-0x4b = area, Background
-0x4c = poly_water, Intermittent River/Lake
-0x4d = poly_water, Glaciers
-0x4e = plantation, Orchard or plantation
-0x4f = poly_scrub, Scrub
-0x50 = poly_wood, Woods
-0x51 = poly_water, Wetland
-0x52 = tundra, Tundra
-0x53 = poly_flats, Flats
diff --git a/navit/data/garmin/gentypes.c b/navit/data/garmin/gentypes.c
deleted file mode 100644
index 0792bc05..00000000
--- a/navit/data/garmin/gentypes.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- Copyright (C) 2007 Alexander Atanasov <aatanasov@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; version 2 of the License.
-
- 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, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02110-1301 USA
-
- Garmin and MapSource are registered trademarks or trademarks
- of Garmin Ltd. or one of its subsidiaries.
-
-*/
-
-/*
- Street's are routable by:
- ALL - by all
- W pedestrian (1<<0)
- B bycycle (1<<1)
- M motorcycle (1<<2)
- C car (1<<3)
- T truck (1<<4)
- L largetruck (1<<5)
-File format is:
-
-POINT
-0x0100 = town_label_1e5, Megapolis (10M +)
-0x0200 = town_label_5e4, Megapolis (5-10M)
-...
-0x1e00-0x1e3f = district_label, District, Province, State Name
-...
-POLYLINE
-0x00 = ALL, street_1_land, Road
-0x01 = MCTL, highway_land, Major HWY thick
-0x02 = MCTL, street_4_land, Principal HWY-thick
-0x03 = MCTL, street_2_land, Principal HWY-medium
-....
-POLYGONE
-0x01 = town_poly, City (>200k)
-0x02 = town_poly, City (<200k)
-0x03 = town_poly, Village
-
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <malloc.h>
-#include <unistd.h>
-#include "item.h"
-#include "gar2navit.h"
-
-#define dlog(x, y...) fprintf(stderr, ## y)
-/*
-static int add_def(struct gar2nav_conv *conv, int type, unsigned short minid,
- unsigned short maxid, unsigned int routable, char *ntype,
- char *descr)
-*/
-
-static unsigned int get_rtmask(char *p)
-{
- char *cp;
- unsigned int mask = 0;
- cp = p;
- while (*cp) {
- if (!strcasecmp(cp, "none"))
- return 0;
- if (!strcasecmp(cp, "all")) {
- mask = ~0;
- break;
- } if (*cp == 'W')
- mask |= RT_PEDESTRIAN;
- else if (*cp == 'B')
- mask |= RT_BYCYCLE;
- else if (*cp == 'M')
- mask |= RT_MOTORCYCLE;
- else if (*cp == 'C')
- mask |= RT_CAR;
- else if (*cp == 'T')
- mask |= RT_TRUCK;
- else if (*cp == 'L')
- mask |= RT_LONGTRUCK;
- cp++;
- }
- return mask;
-}
-
-static void print_header(FILE *fp)
-{
- fprintf(fp, "// This is autogenerated file -- DO NOT EDIT\n");
- fprintf(fp, "struct gar2nav_conv *g2n_default_conv(void)\n"
- "{\n"
- "\tstruct gar2nav_conv *conv;\n"
- "\n"
- "\tconv = calloc(1, sizeof(*conv));\n"
- "\tif (!conv)\n"
- "\t\treturn conv;\n");
-}
-
-static int load_types_file(char *file, char *out)
-{
- char buf[4096];
- char descr[4096];
- char ntype[4096];
- char rtby[4096];
- FILE *fp;
- unsigned int minid, maxid, routable;
- int rc;
- int type = -1;
- FILE *fpout = stdout;
-
- fp = fopen(file, "r");
- if (!fp)
- return -1;
- if (out) {
- fpout = fopen(out, "w");
- if (!fpout)
- return -1;
- }
- print_header(fpout);
- while (fgets(buf, sizeof(buf), fp)) {
- if (*buf == '#' || *buf == '\n')
- continue;
- routable = 0;
- if (!strncasecmp(buf, "POINT", 5)) {
- type = 1;
- continue;
- } else if (!strncasecmp(buf, "POI", 3)) {
- type = 1;
- continue;
- } else if (!strncasecmp(buf, "POLYLINE", 8)) {
- type = 2;
- continue;
- } else if (!strncasecmp(buf, "POLYGONE", 8)) {
- type = 3;
- continue;
- }
- // assume only lines are routable
- if (type == 2) {
- rc = sscanf(buf, "0x%04X = %[^\t, ] , %[^\t, ], %[^\n]",
- &minid, rtby, ntype, descr);
- if (rc != 4) {
- dlog(1, "Invalid line rc=%d:[%s]\n",rc, buf);
- dlog(1, "minid=%04X ntype=[%s] des=[%s]\n",
- minid, ntype, descr);
- continue;
- }
- routable = get_rtmask(rtby);
- } else {
- rc = sscanf(buf, "0x%04X - 0x%04X = %[^\t , ] , %[^\n]",
- &minid, &maxid, ntype, descr);
- if (rc != 4) {
- maxid = 0;
- rc = sscanf(buf, "0x%04X = %[^\t, ], %[^\n]",
- &minid, ntype, descr);
- if (rc != 3) {
- dlog(1, "Invalid line rc=%d:[%s]\n",rc, buf);
- dlog(1, "minid=%04X ntype=[%s] des=[%s]\n",
- minid, ntype, descr);
- continue;
- }
- }
- }
- fprintf(fpout, "\tadd_def(conv, %d, %d, %d, %d, \"%s\", \"%s\");\n",
- type, minid, maxid, routable, ntype, descr);
-
- }
- fprintf(fpout, "\treturn conv;\n");
- fprintf(fpout, "}\n");
- fclose(fp);
- if (out)
- fclose(fpout);
- return 1;
-}
-
-int main(int argc, char **argv)
-{
- if (argc!=3) {
- fprintf(stderr, "Usage: %s garmintypes.txt outfile.c\n",
- argv[0]);
- return -1;
- }
- if (load_types_file(argv[1], argv[2]) < 0) {
- unlink(argv[2]);
- return -1;
- }
- return 0;
-}
diff --git a/navit/data/garmin_img/Makefile.am b/navit/data/garmin_img/Makefile.am
deleted file mode 100644
index 9e50c62b..00000000
--- a/navit/data/garmin_img/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=data_garmin_img
-moduledata_LTLIBRARIES = libdata_garmin_img.la
-libdata_garmin_img_la_SOURCES = garmin_img.c
diff --git a/navit/data/garmin_img/garmin_img.c b/navit/data/garmin_img/garmin_img.c
deleted file mode 100644
index d735b027..00000000
--- a/navit/data/garmin_img/garmin_img.c
+++ /dev/null
@@ -1,1493 +0,0 @@
-#include <glib.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include "config.h"
-#include "plugin.h"
-#include "data.h"
-#include "projection.h"
-#include "map.h"
-#include "maptype.h"
-#include "item.h"
-#include "attr.h"
-#include "coord.h"
-#include "transform.h"
-#include <stdio.h>
-#include "attr.h"
-#include "coord.h"
-
-struct file {
- FILE *f;
- int offset;
-};
-
-
-int shift=5;
-int subdiv_next=0x10;
-
-
-static void *
-file_read(struct file *f, int offset, int size)
-{
- void *ptr;
- int ret;
-
- ptr=calloc(size, 1);
- if (! ptr)
- return ptr;
- fseek(f->f, f->offset+offset, SEEK_SET);
- ret=fread(ptr, size, 1, f->f);
- if (ret != 1) {
- printf("fread %d vs %d offset %d+%d(0x%x)\n", ret, size, f->offset, offset,offset);
- g_assert(1==0);
- }
- return ptr;
-}
-
-static void
-file_free(void *ptr)
-{
- free(ptr);
-}
-
-struct offset_len {
- int offset;
- int length;
-} __attribute ((packed));
-
-static void
-dump_offset_len(struct offset_len *off_len)
-{
- printf("offset: 0x%x(%d) length 0x%x(%d)\n", off_len->offset, off_len->offset, off_len->length, off_len->length);
-}
-
-struct timestamp {
- short creation_year;
- char creation_month;
- char creation_day;
- char creation_hour;
- char creation_minute;
- char creation_second;
-} __attribute__((packed));
-
-struct img_header {
- char xor;
- char zero1[9];
- char update_month;
- char update_year;
- char zero2[3];
- char checksum[1];
- char signature[7];
- char unknown1[1];
- char unknown2[2];
- char unknown3[2];
- char unknown4[2];
- char unknown5[2];
- char zero3[25];
- struct timestamp ts;
- char unknown6;
- char map_file_identifier[7];
- char unknown12;
- char map_description1[20];
- short unknown13;
- short unknown14;
- char e1;
- char e2;
- char other[413];
- char zero4[512];
- char unknown7;
- char unknown8[11];
- int file_offset;
- char unknown9;
- char unknown10[15];
- char unknown11[480];
-} __attribute__((packed));
-
-static void
-dump_ts(struct timestamp *ts)
-{
- printf("%d-%02d-%02d %02d:%02d:%02d\n", ts->creation_year, ts->creation_month, ts->creation_day, ts->creation_hour, ts->creation_minute, ts->creation_second);
-}
-
-#if 0
-static void
-dump_img(struct img_header *img_hdr)
-{
- printf("signature: '%s'\n", img_hdr->signature);
- printf("creation: ");
- dump_ts(&img_hdr->ts);
- printf("map_file_identifier: '%s'\n", img_hdr->map_file_identifier);
- printf("file_offset: 0x%x\n", img_hdr->file_offset);
- printf("e1: 0x%x(%d)\n", img_hdr->e1, img_hdr->e1);
- printf("e2: 0x%x(%d)\n", img_hdr->e2, img_hdr->e2);
- printf("offset 0x%x\n", (int) &img_hdr->e1 - (int) img_hdr);
- printf("size %d\n", sizeof(*img_hdr));
-}
-#endif
-
-struct fat_block {
- char flag;
- char filename[8];
- char type[3];
- int size;
- char zero1;
- char part;
- char zero[14];
- unsigned short blocks[240];
-} __attribute__((packed));
-
-#if 0
-static void
-dump_fat_block(struct fat_block *fat_blk)
-{
- int i=0;
- char name[9];
- char type[4];
- printf("flag: 0x%x(%d)\n", fat_blk->flag, fat_blk->flag);
- strcpy(name, fat_blk->filename);
- name[8]='\0';
- strcpy(type, fat_blk->type);
- type[3]='\0';
- printf("name: '%s.%s'\n", name, type);
- printf("size: 0x%x(%d)\n", fat_blk->size, fat_blk->size);
- printf("part: 0x%x(%d)\n", fat_blk->part, fat_blk->part);
- printf("blocks: ");
- while (i < 240) {
- printf("0x%x(%d) ",fat_blk->blocks[i], fat_blk->blocks[i]);
- if (fat_blk->blocks[i] == 0xffff)
- break;
- i++;
- }
- printf("size: %d\n", sizeof(*fat_blk));
-
-}
-#endif
-
-struct file_header {
- short header_len;
- char type[10];
- char unknown1;
- char unknown2;
- struct timestamp ts;
-} __attribute__((packed));
-
-static void
-dump_file(struct file_header *fil_hdr)
-{
- printf("header_len: %d\n", fil_hdr->header_len);
- printf("type: '%s'\n", fil_hdr->type);
- printf("unknown1: 0x%x(%d)\n", fil_hdr->unknown1, fil_hdr->unknown1);
- printf("unknown2: 0x%x(%d)\n", fil_hdr->unknown2, fil_hdr->unknown2);
- printf("creation: ");
- dump_ts(&fil_hdr->ts);
- printf("size %d\n", sizeof(*fil_hdr));
-}
-
-struct region_header {
- struct file_header fil_hdr;
- struct offset_len offset_len;
-} __attribute__((packed));
-
-#if 0
-static void
-dump_region(struct region_header *rgn_hdr)
-{
- dump_offset_len(&rgn_hdr->offset_len);
-}
-#endif
-
-struct map_priv {
- int id;
- char *filename;
-};
-
-struct map_rect_priv {
- struct coord_rect r;
- int limit;
-
- struct file tre;
- struct tree_header *tre_hdr;
- struct file rgn;
- struct region_header *rgn_hdr;
- struct file lbl;
- struct label_header *lbl_hdr;
- char *label;
-
- int subdiv_level_count;
- int subdiv_pos;
- char *subdiv;
-
- int rgn_offset;
- int rgn_end;
- struct rgn_point *pnt;
- struct rgn_poly *ply;
- unsigned char *ply_data;
- int ply_bitpos;
- int ply_bitcount;
- int ply_lngbits;
- int ply_latbits;
- int ply_lng;
- int ply_lat;
- int ply_lnglimit;
- int ply_latlimit;
- int ply_lngsign;
- int ply_latsign;
- struct offset_len rgn_items[4];
- int rgn_type;
-
- int count;
-
- FILE *f;
- long pos;
- char line[256];
- int attr_pos;
- enum attr_type attr_last;
- char attrs[256];
- char attr[256];
- double lat,lng;
- char lat_c,lng_c;
- int eoc;
- struct map_priv *m;
- struct item item;
-};
-
-static int map_id;
-
-static int
-contains_coord(char *line)
-{
- return g_ascii_isdigit(line[0]);
-}
-
-static int debug=1;
-
-static int
-get_tag(char *line, char *name, int *pos, char *ret)
-{
- int len,quoted;
- char *p,*e,*n;
-
- if (debug)
- printf("get_tag %s from %s\n", name, line);
- if (! name)
- return 0;
- len=strlen(name);
- if (pos)
- p=line+*pos;
- else
- p=line;
- for(;;) {
- while (*p == ' ') {
- p++;
- }
- if (! *p)
- return 0;
- n=p;
- e=index(p,'=');
- if (! e)
- return 0;
- p=e+1;
- quoted=0;
- while (*p) {
- if (*p == ' ' && !quoted)
- break;
- if (*p == '"')
- quoted=1-quoted;
- p++;
- }
- if (e-n == len && !strncmp(n, name, len)) {
- e++;
- len=p-e;
- if (e[0] == '"') {
- e++;
- len-=2;
- }
- strncpy(ret, e, len);
- ret[len]='\0';
- if (pos)
- *pos=p-line;
- return 1;
- }
- }
- return 0;
-}
-
-static void
-get_line(struct map_rect_priv *mr)
-{
- mr->pos=ftell(mr->f);
- fgets(mr->line, 256, mr->f);
-}
-
-static void
-map_destroy_garmin_img(struct map_priv *m)
-{
- if (debug)
- printf("map_destroy_garmin_img\n");
- g_free(m);
-}
-
-static char *
-map_charset_garmin_img(struct map_priv *m)
-{
- return "iso8859-1";
-}
-
-static enum projection
-map_projection_garmin_img(struct map_priv *m)
-{
- return projection_garmin;
-}
-
-struct label_data_offset {
- struct offset_len offset_len;
- char multiplier;
- char data;
-} __attribute ((packed));
-
-#if 0
-static void
-dump_label_data_offset(struct label_data_offset *lbl_dat)
-{
- dump_offset_len(&lbl_dat->offset_len);
- printf("multiplier 0x%x(%d)\n", lbl_dat->multiplier, lbl_dat->multiplier);
- printf("data 0x%x(%d)\n", lbl_dat->data, lbl_dat->data);
-}
-#endif
-
-struct label_data {
- struct offset_len offset_len;
- short size;
- int zero;
-} __attribute ((packed));
-
-static void
-dump_label_data(struct label_data *lbl_dat)
-{
- dump_offset_len(&lbl_dat->offset_len);
- printf("size 0x%x(%d)\n", lbl_dat->size, lbl_dat->size);
-}
-
-struct tree_header {
- struct file_header fil_hdr;
- char boundary[12];
- struct offset_len level;
- struct offset_len subdivision;
- struct label_data copyright;
- struct offset_len tre7;
- short unknown1;
- char zero1;
- struct label_data polyline;
- struct label_data polygon;
- struct label_data point;
- int mapid;
-};
-
-static void
-dump_tree_header(struct tree_header *tre_hdr)
-{
- printf("tree_header:\n");
- dump_file(&tre_hdr->fil_hdr);
- printf("level: "); dump_offset_len(&tre_hdr->level);
- printf("subdivision: "); dump_offset_len(&tre_hdr->subdivision);
- printf("copyright: "); dump_label_data(&tre_hdr->copyright);
- printf("polyline: "); dump_label_data(&tre_hdr->polyline);
- printf("polygon: "); dump_label_data(&tre_hdr->polygon);
- printf("point: "); dump_label_data(&tre_hdr->point);
- printf("len: 0x%x(%d)\n", sizeof(*tre_hdr), sizeof(*tre_hdr));
-}
-
-struct label_header {
- struct file_header fil_hdr;
- struct label_data_offset label;
- struct label_data country;
- struct label_data region;
- struct label_data city;
- struct label_data poi_index;
- struct label_data_offset poi_properties;
- short zero1;
- char zero2;
- struct label_data poi_types;
- struct label_data zip;
- struct label_data hway;
- struct label_data exit;
- struct label_data hway_data;
- int unknown1;
- short unknown2;
- struct offset_len sort_descriptor;
- struct label_data lbl13;
- struct label_data lbl14;
-} __attribute((packed));
-
-#if 0
-static void
-dump_label(struct label_header *lbl_hdr)
-{
- dump_file(&lbl_hdr->fil_hdr);
- printf("label:\n");
- dump_label_data_offset(&lbl_hdr->label);
- printf("country:\n");
- dump_label_data(&lbl_hdr->country);
- printf("region:\n");
- dump_label_data(&lbl_hdr->region);
- printf("city:\n");
- dump_label_data(&lbl_hdr->city);
- printf("poi_index:\n");
- dump_label_data(&lbl_hdr->poi_index);
- printf("poi_properties:\n");
- dump_label_data_offset(&lbl_hdr->poi_properties);
- printf("poi_types:\n");
- dump_label_data(&lbl_hdr->poi_types);
- printf("zip:\n");
- dump_label_data(&lbl_hdr->zip);
- printf("hway:\n");
- dump_label_data(&lbl_hdr->hway);
- printf("exit:\n");
- dump_label_data(&lbl_hdr->exit);
- printf("hway_data:\n");
- dump_label_data(&lbl_hdr->hway_data);
- printf("lbl13:\n");
- dump_label_data(&lbl_hdr->lbl13);
- printf("lbl14:\n");
- dump_label_data(&lbl_hdr->lbl14);
- printf("len: 0x%x(%d)\n", sizeof(*lbl_hdr), sizeof(*lbl_hdr));
-}
-#endif
-
-struct triple {
- unsigned char data[3];
-} __attribute((packed));
-
-static unsigned int
-triple_u(struct triple *t)
-{
- return t->data[0] | (t->data[1] << 8) | (t->data[2] << 16);
-}
-
-static int
-triple(struct triple *t)
-{
- int ret=t->data[0] | (t->data[1] << 8) | (t->data[2] << 16);
- if (ret > 1<<23)
- ret=ret-(1<<24);
- return ret;
-}
-
-static void
-dump_triple_u(struct triple *t)
-{
- int val=triple_u(t);
- printf("0x%x(%d)\n", val, val);
-}
-
-struct tcoord {
- struct triple lng,lat;
-} __attribute((packed));
-
-static void
-dump_tcoord(struct tcoord *t)
-{
- printf ("0x%x(%d),0x%x(%d)\n", triple_u(&t->lng), triple_u(&t->lng), triple_u(&t->lat), triple_u(&t->lat));
-}
-
-struct level {
- unsigned char zoom;
- unsigned char bits_per_coord;
- unsigned short subdivisions;
-} __attribute((packed));
-
-static void
-dump_level(struct level *lvl)
-{
- printf("level:\n");
- printf("\tzoom 0x%x(%d)\n", lvl->zoom, lvl->zoom);
- printf("\tbits_per_coord 0x%x(%d)\n", lvl->bits_per_coord, lvl->bits_per_coord);
- printf("\tsubdivisions 0x%x(%d)\n", lvl->subdivisions, lvl->subdivisions);
-}
-
-struct subdivision {
- struct triple rgn_offset;
- unsigned char types;
- struct tcoord center;
- unsigned short width;
- unsigned short height;
- unsigned short next;
-} __attribute((packed));
-
-static void
-dump_subdivision(struct subdivision *sub)
-{
- printf("subdivision:\n");
- printf("\trgn_offset: "); dump_triple_u(&sub->rgn_offset);
- printf("\ttypes: 0x%x(%d)\n", sub->types, sub->types);
- printf("\tcenter: "); dump_tcoord(&sub->center);
- printf("\tsize: 0x%x(%d)x0x%x(%d) %s\n",sub->width & 0x7fff, sub->width & 0x7fff, sub->height, sub->height, sub->width & 0x8000 ? "Terminating" : "");
- printf("\tnext: 0x%x(%d)\n",sub->next, sub->next);
-
- printf("\tlen: 0x%x(%d)\n", sizeof(*sub), sizeof(*sub));
-}
-
-struct rgn_point {
- unsigned char info;
- struct triple lbl_offset;
- short lng_delta;
- short lat_delta;
- unsigned char subtype;
-} __attribute((packed));
-
-static void
-dump_point(struct rgn_point *pnt)
-{
- printf("point:\n");
- printf("\tinfo 0x%x(%d)\n", pnt->info, pnt->info);
- printf("\tlbl_offset 0x%x(%d)\n", triple_u(&pnt->lbl_offset), triple_u(&pnt->lbl_offset));
- printf("\tlng_delta 0x%x(%d)\n", pnt->lng_delta, pnt->lng_delta);
- printf("\tlat_delta 0x%x(%d)\n", pnt->lat_delta, pnt->lat_delta);
- printf("\tsubtype 0x%x(%d)\n", pnt->subtype, pnt->subtype);
- printf("\tlen: 0x%x(%d)\n", sizeof(*pnt), sizeof(*pnt));
-}
-
-struct rgn_poly {
- unsigned char info;
- struct triple lbl_offset;
- short lng_delta;
- short lat_delta;
- union {
- struct {
- unsigned char bitstream_len;
- unsigned char bitstream_info;
- } __attribute((packed)) p1;
- struct {
- unsigned short bitstream_len;
- unsigned char bitstream_info;
- } __attribute((packed)) p2;
- } __attribute((packed)) u;
-} __attribute((packed));
-
-static void
-dump_poly(struct rgn_poly *ply)
-{
- printf("poly:\n");
- printf("\tinfo 0x%x(%d)\n", ply->info, ply->info);
- printf("\tlbl_offset 0x%x(%d)\n", triple_u(&ply->lbl_offset), triple_u(&ply->lbl_offset));
- printf("\tlng_delta 0x%x(%d)\n", ply->lng_delta, ply->lng_delta);
- printf("\tlat_delta 0x%x(%d)\n", ply->lat_delta, ply->lat_delta);
- if (ply->info & 0x80) {
- printf("\tbitstream_len 0x%x(%d)\n", ply->u.p2.bitstream_len, ply->u.p2.bitstream_len);
- printf("\tbitstream_info 0x%x(%d)\n", ply->u.p2.bitstream_info, ply->u.p2.bitstream_info);
- } else {
- printf("\tbitstream_len 0x%x(%d)\n", ply->u.p1.bitstream_len, ply->u.p1.bitstream_len);
- printf("\tbitstream_info 0x%x(%d)\n", ply->u.p1.bitstream_info, ply->u.p1.bitstream_info);
- }
- printf("\tlen: 0x%x(%d)\n", sizeof(*ply), sizeof(*ply));
-}
-
-static void
-dump_hex(void *ptr, int len)
-{
- unsigned char *c=ptr;
- while (len--) {
- printf("%02x ", *c++);
- }
- printf("\n");
-}
-
-static void
-dump_hex_r(void *ptr, int len, int rec)
-{
- unsigned char *c=ptr;
- int l=rec;
- while (len--) {
- printf("%02x ", *c++);
- if (! --l) {
- printf("\n");
- l=rec;
- }
- }
- printf("\n");
-}
-
-#if 0
-static void
-dump_label_offset(struct map_rect_priv *mr, int offset)
-{
- void *p;
- p=file_read(&mr->lbl, mr->lbl_hdr->label.offset_len.offset+offset, 128);
- printf("%s\n", (char *)p);
-}
-#endif
-
-
-#if 0
-static void
-dump_region_item(struct subdivision *sub, struct file *rgn, struct map_rect_priv *mr)
-{
- int offset,item_offset,i,j;
- unsigned short count=0;
- unsigned short *offsets[4];
- unsigned short *file_offsets;
- struct rgn_point *pnt;
-
- offset=triple_u(&sub->rgn_offset)+mr->rgn_hdr->offset_len.offset;
- file_offsets=file_read(rgn, offset, 90*sizeof(unsigned short));
- printf("0x%x ", offset); dump_hex(file_offsets, 90);
- for (i=0 ; i < 4 ; i++) {
- printf("i=%d\n", i);
- if (sub->types & (0x10 << i)) {
- if (count) {
- offsets[i]=&file_offsets[count-1];
- } else
- offsets[i]=&count;
- count++;
- } else
- offsets[i]=NULL;
-
- }
- count--;
- count*=2;
- for (i=0 ; i < 4 ; i++) {
- printf("i=%d\n", i);
- if (offsets[i]) {
- printf("offset[%d]=0x%x(%d)\n", i, *offsets[i], *offsets[i]);
- switch (i) {
- case 0:
- printf("point\n");
- break;
- case 1:
- printf("indexed point\n");
- break;
- case 2:
- printf("polyline\n");
- break;
- case 3:
- printf("polygon\n");
- break;
- }
- item_offset=offset+*offsets[i];
- switch (i) {
- case 0:
- case 1:
- for (j = 0 ; j < 10 ; j++) {
- struct coord_geo g;
- char buffer[1024];
- double conv=180.0/(1UL<<23);
- pnt=file_read(rgn, item_offset, sizeof(*pnt)*20);
- // printf("0x%x ", item_offset); dump_hex(pnt, 32);
- dump_point(pnt);
- g.lng=(triple(&sub->center.lng)+(pnt->lng_delta << shift))*conv;
- g.lat=(triple(&sub->center.lat)+(pnt->lat_delta << shift))*conv;
- printf("%f %f\n", g.lng, g.lat);
- transform_geo_text(&g, buffer);
- printf("%s\n", buffer);
- dump_label_offset(mr, triple_u(&pnt->lbl_offset));
- if (pnt->info & 0x80)
- item_offset+=sizeof(*pnt);
- else
- item_offset+=sizeof(*pnt)-1;
- }
- }
- } else {
- printf("offset[%d] doesn't exist\n", i);
- }
- }
- file_free(file_offsets);
-}
-
-#endif
-
-static void
-dump_levels(struct map_rect_priv *mr)
-{
- int i,offset;
- struct level *lvl;
-
- offset=mr->tre_hdr->level.offset;
- for (i = 0 ; i < mr->tre_hdr->level.length/sizeof(*lvl) ; i++) {
- lvl=file_read(&mr->tre, offset, sizeof(*lvl));
- dump_level(lvl);
- offset+=sizeof(*lvl);
- }
-}
-
-#if 0
-static void
-dump_tree(struct file *f, struct file *rgn, struct map_rect_priv *mr)
-{
- struct tree_header *tre_hdr;
- struct subdivision *sub;
- int i,offset;
-
- tre_hdr=file_read(f, 0, sizeof(*tre_hdr));
- dump_tree_header(tre_hdr);
- offset=tre_hdr->subdivision.offset;
- sub=file_read(f, offset, sizeof(*sub));
- dump_subdivision(sub);
- offset+=sizeof(*sub);
- for (i = 1 ; i < tre_hdr->subdivision.length/sizeof(*sub) ; i++) {
- printf("i=%d\n", i);
- sub=file_read(f, offset, sizeof(*sub));
- dump_subdivision(sub);
- dump_region_item(sub, rgn, mr);
- if (sub->width & 0x8000)
- break;
- offset+=sizeof(*sub);
- }
- file_free(tre_hdr);
-}
-#endif
-
-#if 0
-static void
-dump_labels(struct file *f)
-{
- struct label_header *lbl_hdr;
-
- lbl_hdr=file_read(f, 0, sizeof(*lbl_hdr));
- printf("**labels**\n");
- dump_label(lbl_hdr);
- file_free(lbl_hdr);
-#if 0
- labels=alloca(lbl_hdr.label_length);
- file_read(f, lbl_hdr.label_offset, labels, lbl_hdr.label_length);
- l=labels;
- while (l < labels+lbl_hdr.label_length) {
- printf("'%s'(%d)\n", l, strlen(l));
- l+=strlen(l)+1;
- }
-#endif
-
-}
-#endif
-
-static void
-garmin_img_coord_rewind(void *priv_data)
-{
-}
-
-static void
-parse_line(struct map_rect_priv *mr)
-{
- int pos=0;
- sscanf(mr->line,"%lf %c %lf %c %n",&mr->lat,&mr->lat_c,&mr->lng,&mr->lng_c,&pos);
- if (pos < strlen(mr->line)) {
- strcpy(mr->attrs, mr->line+pos);
- }
-}
-
-static int
-get_bits(struct map_rect_priv *mr, int bits)
-{
- unsigned long ret;
- ret=L(*((unsigned long *)(mr->ply_data+mr->ply_bitpos/8)));
- ret >>= (mr->ply_bitpos & 7);
- ret &= (1 << bits)-1;
- mr->ply_bitpos+=bits;
- return ret;
-}
-
-static int
-garmin_img_coord_get(void *priv_data, struct coord *c, int count)
-{
- struct map_rect_priv *mr=priv_data;
- struct subdivision *sub=(struct subdivision *)(mr->subdiv+mr->subdiv_pos);
- int ret=0;
- int debug=0;
- if (debug)
- printf("garmin_img_coord_get %d\n",count);
- if (debug)
- dump_subdivision(sub);
- while (count--) {
- if (mr->rgn_type < 2) {
- c->x=triple(&sub->center.lng)+(mr->pnt->lng_delta << shift);
- c->y=triple(&sub->center.lat)+(mr->pnt->lat_delta << shift);
- } else {
- if (! mr->ply_bitpos) {
- if (mr->ply->info & 0x80) {
- mr->ply_bitcount=mr->ply->u.p2.bitstream_len*8;
- mr->ply_lngbits=mr->ply->u.p2.bitstream_info & 0xf;
- mr->ply_latbits=mr->ply->u.p2.bitstream_info >> 4;
- } else {
- mr->ply_bitcount=mr->ply->u.p1.bitstream_len*8;
- mr->ply_lngbits=mr->ply->u.p1.bitstream_info & 0xf;
- mr->ply_latbits=mr->ply->u.p1.bitstream_info >> 4;
- }
- if (mr->ply_lngbits <= 9)
- mr->ply_lngbits+=2;
- if (mr->ply_latbits <= 9)
- mr->ply_latbits+=2;
- if (! get_bits(mr,1)) {
- mr->ply_lngbits+=1;
- mr->ply_lngsign=0;
- } else
- if (get_bits(mr, 1))
- mr->ply_lngsign=-1;
- else
- mr->ply_lngsign=1;
- if (! get_bits(mr,1)) {
- mr->ply_latbits+=1;
- mr->ply_latsign=0;
- } else
- if (get_bits(mr, 1))
- mr->ply_latsign=-1;
- else
- mr->ply_latsign=1;
- mr->ply_lnglimit=1 << (mr->ply_lngbits-1);
- mr->ply_latlimit=1 << (mr->ply_latbits-1);
- mr->ply_lng=mr->ply->lng_delta;
- mr->ply_lat=mr->ply->lat_delta;
- if (debug)
- printf("lngbits %d latbits %d bitcount %d\n", mr->ply_lngbits, mr->ply_latbits, mr->ply_bitcount);
- c->x=0;
- c->y=0;
- } else {
- if (mr->ply_bitpos + mr->ply_lngbits + mr->ply_latbits > mr->ply_bitcount) {
- if (debug)
- printf("out of bits %d + %d + %d >= %d\n", mr->ply_bitpos, mr->ply_lngbits, mr->ply_latbits, mr->ply_bitcount);
- return ret;
- }
- c->x=0;
- c->y=0;
- int x,y;
- for (;;) {
- x=get_bits(mr,mr->ply_lngbits);
- if (debug)
- printf("x %d ", x);
- if (mr->ply_lngsign || x != mr->ply_lnglimit)
- break;
- c->x += x-1;
- }
- if (mr->ply_lngsign) {
- c->x=x*mr->ply_lngsign;
- } else {
- if (x >= mr->ply_lnglimit)
- c->x = x - (mr->ply_lnglimit << 1) - c->x;
- else
- c->x +=x;
- }
- for (;;) {
- y=get_bits(mr,mr->ply_latbits);
- if (debug)
- printf("y %d ", y);
- if (mr->ply_latsign || y != mr->ply_latlimit)
- break;
- c->y += y-1;
- }
- if (mr->ply_latsign) {
- c->y=y*mr->ply_latsign;
- } else {
- if (y >= mr->ply_latlimit)
- c->y = y - (mr->ply_latlimit << 1) - c->y;
- else
- c->y +=y;
- }
- mr->ply_lng += c->x;
- mr->ply_lat += c->y;
- }
- if (debug)
- printf(": x %d y %d\n", c->x, c->y);
-
- c->x=triple(&sub->center.lng)+(mr->ply_lng << shift);
- c->y=triple(&sub->center.lat)+(mr->ply_lat << shift);
- }
-#if 0
- c->x-=0x6f160;
- c->y-=0x181f59;
- c->x+=0x168ca1;
- c->y+=0x68d815;
-#endif
- c++;
- ret++;
- if (mr->rgn_type < 2)
- return ret;
- }
- return ret;
-}
-
-static char *
-get_label_offset(struct map_rect_priv *mr, int offset)
-{
- g_assert(offset < mr->lbl_hdr->label.offset_len.length);
- return file_read(&mr->lbl, mr->lbl_hdr->label.offset_len.offset+offset, 128);
-}
-
-static void
-garmin_img_attr_rewind(void *priv_data)
-{
-}
-
-static int
-garmin_img_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
-{
- struct map_rect_priv *mr=priv_data;
- int debug=0;
-
- if (debug)
- printf("garmin_img_attr_get\n");
- if (attr_type == attr_label) {
- if (debug)
- printf("garmin_img_attr_get label\n");
- attr->type=attr_type;
- if (mr->rgn_type < 2) {
- if (mr->label)
- file_free(mr->label);
- mr->label=get_label_offset(mr, triple_u(&mr->pnt->lbl_offset) & 0x3fffff);
- attr->u.str=mr->label;
- } else {
- attr->u.str="";
- }
- return 1;
- }
- return 0;
-}
-
-static struct item_methods methods_garmin_img = {
- garmin_img_coord_rewind,
- garmin_img_coord_get,
- garmin_img_attr_rewind,
- garmin_img_attr_get,
-};
-
-static int rgn_next_type(struct map_rect_priv *mr)
-{
- while (mr->rgn_type < 3) {
- mr->rgn_type++;
- if (mr->rgn_items[mr->rgn_type].offset && mr->rgn_items[mr->rgn_type].length != 0) {
- mr->rgn_offset=mr->rgn_items[mr->rgn_type].offset;
- mr->rgn_end=mr->rgn_offset+mr->rgn_items[mr->rgn_type].length;
- return 0;
- }
- }
- return 1;
-}
-
-static int
-sub_next(struct map_rect_priv *mr, int next)
-{
- int i,offset,first=-1,last=-1,count=-1;
- int end;
- unsigned short *offsets;
- int debug=0;
-
- if (mr->subdiv_level_count <= 0)
- return 1;
- if (debug)
- printf("%d left\n", mr->subdiv_level_count);
- mr->subdiv_level_count--;
-
-#if 0
- if (next && mr->subdiv[mr->subdiv_current].width & 0x8000)
- return 1;
-#endif
- if (debug)
- dump_hex_r(mr->subdiv+mr->subdiv_pos, 64, 14);
- mr->subdiv_pos+=next;
- if (debug)
- printf("subdiv_pos 0x%x\n", mr->subdiv_pos);
- if (mr->subdiv_pos > mr->tre_hdr->subdivision.length)
- return 1;
- struct subdivision *sub=(struct subdivision *)(mr->subdiv+mr->subdiv_pos);
- offset=triple_u(&sub->rgn_offset)+mr->rgn_hdr->offset_len.offset;
- if (debug) {
- printf("offset=0x%x\n", offset);
- dump_subdivision(sub);
- }
- offsets=file_read(&mr->rgn, offset, 3*sizeof(unsigned short));
-
- if (! next)
- next=subdiv_next;
- if (mr->subdiv_pos+next < mr->tre_hdr->subdivision.length)
- end=triple_u(&((struct subdivision *)(mr->subdiv+mr->subdiv_pos+next))->rgn_offset)+mr->rgn_hdr->offset_len.offset;
- else
- end=mr->rgn_hdr->offset_len.offset+mr->rgn_hdr->offset_len.length;
- if (debug) {
- dump_subdivision(sub);
- dump_hex(offsets, 6);
- }
- for (i=0 ; i < 4 ; i++) {
- if (debug)
- printf("i=%d ", i);
- if (sub->types & (0x10 << i)) {
- if (debug)
- printf("+ ");
- if (first == -1) {
- first=i;
- mr->rgn_items[i].offset=offset;
- if (debug)
- printf("\n");
- } else {
- mr->rgn_items[i].offset=offset+offsets[count];
- if (debug)
- printf("0x%x\n", offsets[count]);
- mr->rgn_items[last].length=mr->rgn_items[i].offset-mr->rgn_items[last].offset;
- }
- last=i;
- count++;
- } else {
- if (debug)
- printf("-\n");
- mr->rgn_items[i].offset=0;
- mr->rgn_items[i].length=0;
- }
-
- }
- if (first != -1) {
- mr->rgn_items[first].offset+=count*2;
- mr->rgn_items[first].length-=count*2;
- mr->rgn_items[last].length=end-mr->rgn_items[last].offset;
- }
- if (debug) {
- for (i=0 ; i < 4 ; i++) {
- printf("%d 0x%x 0x%x\n", i, mr->rgn_items[i].offset, mr->rgn_items[i].length);
- }
- }
- mr->rgn_type=-1;
- rgn_next_type(mr);
- if (debug)
- printf("*** offset 0x%x\n", mr->rgn_offset);
- file_free(offsets);
- return 0;
-}
-
-int item_count;
-
-static struct map_rect_priv *
-map_rect_new_garmin_img(struct map_priv *map, struct coord_rect *r, struct layer *layers, int limit)
-{
- struct map_rect_priv *mr;
- struct img_header img;
-
- if (debug)
- printf("map_rect_new_garmin_img\n");
- mr=g_new0(struct map_rect_priv, 1);
- mr->m=map;
- if (r)
- mr->r=*r;
- mr->limit=limit;
- mr->item.id_hi=0;
- mr->item.id_lo=0;
- mr->item.meth=&methods_garmin_img;
- mr->item.priv_data=mr;
- mr->f=fopen(map->filename, "r");
-
- fread(&img, sizeof(img), 1, mr->f);
-#if 0
- dump_img(&img);
- for (i = 0 ; i < (img.file_offset-sizeof(img))/sizeof(fat_blk) ; i++) {
- fread(&fat_blk, sizeof(fat_blk), 1, mr->f);
- if (!fat_blk.flag)
- break;
- dump_fat_block(&fat_blk);
- }
-#endif
- mr->rgn.offset=0xa*2048;
- mr->rgn.f=mr->f;
- mr->rgn_hdr=file_read(&mr->rgn, 0, sizeof(*mr->rgn_hdr));
-
- mr->tre.offset=0x62b*2048;
- mr->tre.f=mr->f;
- mr->tre_hdr=file_read(&mr->tre, 0, sizeof(*mr->tre_hdr));
-
- mr->lbl.offset=0x64a*2048;
- mr->lbl.f=mr->f;
- mr->lbl_hdr=file_read(&mr->lbl, 0, sizeof(*mr->lbl_hdr));
-
- mr->subdiv=file_read(&mr->tre, mr->tre_hdr->subdivision.offset, mr->tre_hdr->subdivision.length);
-#if 0
- dump_hex_r(mr->subdiv, mr->tre_hdr->subdivision.length, 16);
-#endif
- dump_tree_header(mr->tre_hdr);
-
- dump_levels(mr);
-
-
- printf("limit=%d\n", limit);
- if (limit < 3) {
- mr->subdiv_pos=0;
- mr->subdiv_level_count=1;
- shift=11;
- } else if (limit < 6) {
- mr->subdiv_pos=1*sizeof(struct subdivision);
- mr->subdiv_level_count=5;
- shift=9;
- } else if (limit < 8) {
- mr->subdiv_pos=6*sizeof(struct subdivision);
- mr->subdiv_level_count=9;
- shift=7;
- } else if (limit < 10) {
- mr->subdiv_pos=15*sizeof(struct subdivision);
- mr->subdiv_level_count=143;
- shift=5;
- } else {
- mr->subdiv_pos=158*sizeof(struct subdivision);
- mr->subdiv_level_count=4190;
- shift=2;
- subdiv_next=14;
- }
-
-#if 0
- mr->rgn_offset=triple_u(&mr->subdiv[mr->subdiv_current].rgn_offset)+mr->rgn_hdr->offset_len.offset+4;
- mr->rgn_type=1;
- mr->rgn_end=mr->rgn_offset+20*8;
-#endif
- mr->count=0;
- item_count=0;
-
-#if 0
- printf("*** offset 0x%x\n", 0x656c-mr->rgn.offset);
- printf("*** offset 0x%x\n", mr->rgn_offset);
-#endif
-#if 1
- sub_next(mr, 0);
-#endif
-#if 0
- {
- struct rgn_point *pnt;
- int i;
- int offset=0x65cc;
- for (i = 0 ; i < 26 ; i++) {
- pnt=file_read(&mr->rgn, 0x656c+8*i-mr->rgn.offset, sizeof(*pnt));
- // dump_hex(pnt, sizeof(*pnt));
- dump_point(pnt);
- dump_label_offset(mr, triple_u(&pnt->lbl_offset));
- }
- }
- exit(0);
-#endif
-#if 0
- dump_tree(&mr->tre,&mr->rgn,mr);
-#endif
-
-#if 0
- f.offset=0x64a*2048;
- f.f=mr->f;
- dump_labels(&f);
-#endif
-#if 0
- fseek(mr->f, img.file_offset, SEEK_SET);
- fread(&fil, sizeof(fil), 1, mr->f);
- dump_file(&fil);
- fread(&rgn, sizeof(rgn), 1, mr->f);
- dump_region(&rgn);
- fseek(mr->f, rgn.data_length, SEEK_CUR);
- fread(&fil, sizeof(fil), 1, mr->f);
- dump_file(&fil);
-#endif
- return mr;
-}
-
-
-static void
-map_rect_destroy_garmin_img(struct map_rect_priv *mr)
-{
- fclose(mr->f);
- g_free(mr);
-}
-
-
-static struct item *
-map_rect_get_item_garmin_img(struct map_rect_priv *mr)
-{
- char *p,type[256];
- int ptype;
- int debug=0;
-
- item_count++;
-
- if (debug)
- printf("map_rect_get_item_garmin_img\n");
- for (;;) {
- if (mr->rgn_offset < mr->rgn_end) {
- if (debug)
- printf("data available\n");
- if (mr->rgn_type >= 2) {
- int len;
- if (debug)
- printf("polyline %d\n", mr->count);
- if (mr->ply)
- file_free(mr->ply);
- mr->ply=file_read(&mr->rgn, mr->rgn_offset, sizeof(*mr->ply)*3);
- if(triple_u(&mr->ply->lbl_offset) >= mr->lbl_hdr->label.offset_len.length) {
- printf("item_count %d\n", item_count);
- dump_poly(mr->ply);
- dump_hex(mr->ply, 32);
- printf("%d vs %d\n", triple_u(&mr->ply->lbl_offset), mr->lbl_hdr->label.offset_len.length);
- }
- g_assert(triple_u(&mr->ply->lbl_offset) < mr->lbl_hdr->label.offset_len.length);
- if (debug) {
- dump_hex(mr->ply, 16);
- dump_poly(mr->ply);
- }
- if (mr->ply_data)
- file_free(mr->ply_data);
- mr->rgn_offset+=10;
- if (mr->ply->info & 0x80) {
- mr->rgn_offset++;
- len=mr->ply->u.p2.bitstream_len;
- } else
- len=mr->ply->u.p1.bitstream_len;
-
- mr->ply_data=file_read(&mr->rgn, mr->rgn_offset, len);
- mr->rgn_offset += len;
- mr->ply_bitpos=0;
- // dump_hex(mr->ply_data, 32);
- if (mr->rgn_type == 3) {
- switch(mr->ply->info & 0x7f) {
- case 0x1: /* large urban area (>200k) */
- mr->item.type=type_town_poly;
- break;
- case 0xd: /* reservation */
- mr->item.type=type_park_poly;
- break;
- case 0xe: /* airport runway */
- mr->item.type=type_airport_poly;
- break;
- case 0x14: /* national park */
- mr->item.type=type_park_poly;
- break;
- case 0x32: /* sea */
- case 0x3d: /* large lake (77-250km2) */
- case 0x4c: /* intermittend water */
- mr->item.type=type_water_poly;
- break;
- case 0x4b: /* background */
- continue;
- default:
- printf("unknown polygon: 0x%x\n", mr->ply->info);
- mr->item.type=type_street_3_city;
- }
- } else {
- switch(mr->ply->info & 0x3f) {
- case 0x1: /* major highway */
- mr->item.type=type_highway_land;
- break;
- case 0x2: /* principal highway */
- mr->item.type=type_street_3_land;
- break;
- case 0x6: /* residental street */
- mr->item.type=type_street_2_land;
- break;
- case 0x16: /* walkway/trail */
- mr->item.type=type_street_1_land;
- break;
- case 0x1e: /* international boundary */
- mr->item.type=type_border_country;
- break;
- case 0x20: /* minor land contour 1/10 */
- mr->item.type=type_height_line_1;
- break;
- case 0x21: /* major land contour 1/2 */
- mr->item.type=type_height_line_2;
- break;
- default:
- printf("unknown polyline: 0x%x\n", mr->ply->info);
- mr->item.type=type_street_3_city;
- }
- }
- return &mr->item;
- }
- if (mr->pnt)
- file_free(mr->pnt);
- mr->pnt=file_read(&mr->rgn, mr->rgn_offset, sizeof(*mr->pnt));
- mr->item.type=type_none;
- int subtype=mr->pnt->subtype;
- if (mr->pnt->lbl_offset.data[2] & 0x80)
- mr->rgn_offset+=9;
- else {
- mr->rgn_offset+=8;
- subtype=0;
- }
- switch(mr->pnt->info) {
- case 0x3: /* large city 2-5M */
- mr->item.type=type_town_label_2e6;
- break;
- case 0xa: /* small city/town 10-20k */
- mr->item.type=type_town_label_1e4;
- break;
- case 0xd: /* settlement 1-2K */
- mr->item.type=type_town_label_1e3;
- break;
- case 0x11: /* settlement less 100 */
- mr->item.type=type_town_label_5e1;
- break;
- case 0x1c:
- switch(subtype) {
- case 0x01:
- mr->item.type=type_poi_wreck;
- break;
- }
- break;
- case 0x20:
- mr->item.type=type_highway_exit;
- break;
- case 0x25:
- mr->item.type=type_poi_toll_booth;
- break;
- case 0x2b:
- switch(subtype) {
- case 0x01:
- mr->item.type=type_poi_hotel;
- break;
- case 0x03:
- mr->item.type=type_poi_camp_rv;
- break;
- }
- break;
- case 0x2c:
- switch(subtype) {
- case 0x00:
- mr->item.type=type_poi_attraction;
- break;
- case 0x02:
- mr->item.type=type_poi_museum_history;
- break;
- }
- break;
- case 0x2e:
- mr->item.type=type_poi_shopping;
- break;
- case 0x2f:
- switch(subtype) {
- case 0x01:
- mr->item.type=type_poi_fuel;
- break;
- case 0x07:
- mr->item.type=type_poi_car_dealer_parts;
- break;
- case 0x0b:
- mr->item.type=type_poi_car_parking;
- break;
- case 0x15:
- mr->item.type=type_poi_public_utilities;
- break;
- }
- break;
- case 0x30:
- switch(subtype) {
- case 0x02:
- mr->item.type=type_poi_hospital;
- break;
- }
- break;
- case 0x43:
- mr->item.type=type_poi_marina;
- break;
- case 0x46:
- mr->item.type=type_poi_bar;
- break;
- case 0x48:
- mr->item.type=type_poi_camping;
- break;
- case 0x49:
- mr->item.type=type_poi_park;
- break;
- case 0x4a:
- mr->item.type=type_poi_picnic;
- break;
- case 0x59: /* airport */
- mr->item.type=type_poi_airport;
- break;
- case 0x64:
- switch(subtype) {
- case 0x1:
- mr->item.type=type_poi_bridge;
- break;
- case 0x2:
- mr->item.type=type_poi_building;
- break;
- case 0x15:
- mr->item.type=type_town_ghost;
- break;
- }
- break;
- case 0x65:
- switch(subtype) {
- case 0x0:
- mr->item.type=type_poi_water_feature;
- break;
- case 0xc:
- mr->item.type=type_poi_island;
- break;
- case 0xd:
- mr->item.type=type_poi_lake;
- break;
- }
- break;
- case 0x66:
- switch(subtype) {
- case 0x0:
- mr->item.type=type_poi_land_feature;
- break;
- case 0x6:
- mr->item.type=type_poi_cape;
- break;
- case 0x14:
- mr->item.type=type_poi_rock;
- break;
- }
- break;
- }
- if (mr->item.type == type_none) {
- printf("unknown point: 0x%x 0x%x\n", mr->pnt->info, mr->pnt->subtype);
- dump_point(mr->pnt);
- printf("label: %s\n", get_label_offset(mr, triple_u(&mr->pnt->lbl_offset) & 0x3fffff));
- mr->item.type=type_town_label;
- }
- return &mr->item;
- }
- if (debug)
- printf("out of data for type\n");
- if (rgn_next_type(mr)) {
- if (debug)
- printf("out of data for region\n");
- if (sub_next(mr, subdiv_next)) {
- if (debug)
- printf("out of data for subdivision\n");
- return NULL;
- }
- }
- }
-}
-
-static struct item *
-map_rect_get_item_byid_garmin_img(struct map_rect_priv *mr, int id_hi, int id_lo)
-{
- fseek(mr->f, id_lo, SEEK_SET);
- get_line(mr);
- mr->item.id_hi=id_hi;
- return map_rect_get_item_garmin_img(mr);
-}
-
-static struct map_methods map_methods_garmin_img = {
- projection_garmin,
- "iso8859-1",
- map_destroy_garmin_img,
- map_charset_garmin_img,
- map_projection_garmin_img,
- map_rect_new_garmin_img,
- map_rect_destroy_garmin_img,
- map_rect_get_item_garmin_img,
- map_rect_get_item_byid_garmin_img,
-};
-
-static struct map_priv *
-map_new_garmin_img(struct map_methods *meth, struct attr **attrs)
-{
- struct map_priv *m;
- struct attr *data=attr_search(attrs, NULL, attr_data);
- if (! data)
- return NULL;
-
- *meth=map_methods_garmin_img;
- m=g_new(struct map_priv, 1);
- m->id=++map_id;
- m->filename=g_strdup(data->u.str);
- return m;
-}
-
-void
-plugin_init(void)
-{
- plugin_register_map_type("garmin_img", map_new_garmin_img);
-}
-
diff --git a/navit/data/mg/Makefile.am b/navit/data/mg/Makefile.am
deleted file mode 100644
index 1d59e3c6..00000000
--- a/navit/data/mg/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=data_mg
-moduledata_LTLIBRARIES = libdata_mg.la
-libdata_mg_la_SOURCES = map.c block.c town.c tree.c poly.c street.c mg.h
diff --git a/navit/data/mg/block.c b/navit/data/mg/block.c
deleted file mode 100644
index 08e9410e..00000000
--- a/navit/data/mg/block.c
+++ /dev/null
@@ -1,267 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include "debug.h"
-#include "mg.h"
-
-
-int block_lin_count,block_idx_count,block_active_count,block_mem,block_active_mem;
-
-struct block_index_item {
- unsigned int blocknum;
- unsigned int blocks;
-};
-
-struct block_index {
- unsigned int blocks;
- unsigned int size;
- unsigned int next;
- struct block_index_item list[0];
-};
-
-static struct block *
-block_get(unsigned char **p)
-{
- struct block *ret=(struct block *)(*p);
- *p += sizeof(*ret);
- return ret;
-}
-
-
-static struct block *
-block_get_byid(struct file *file, int id, unsigned char **p_ret)
-{
- struct block_index *blk_idx;
- int blk_num,max;
-
-
- blk_idx=(struct block_index *)(file->begin+0x1000);
- max=(blk_idx->size-sizeof(struct block_index))/sizeof(struct block_index_item);
- block_mem+=24;
- while (id >= max) {
- blk_idx=(struct block_index *)(file->begin+blk_idx->next*512);
- id-=max;
- }
- blk_num=blk_idx->list[id].blocknum;
-
- *p_ret=file->begin+blk_num*512;
- return block_get(p_ret);
-}
-
-int
-block_get_byindex(struct file *file, int idx, struct block_priv *blk)
-{
- dbg(1,"idx=%d\n", idx);
- blk->b=block_get_byid(file, idx, &blk->p);
- blk->block_start=(unsigned char *)(blk->b);
- blk->p_start=blk->p;
- blk->end=blk->block_start+blk->b->size;
-
- return 1;
-}
-
-static void
-block_setup_tags(struct map_rect_priv *mr)
-{
- int len;
- unsigned char *p,*t;
- char *str;
-
- mr->b.binarytree=0;
-
- p=mr->file->begin+0x0c;
- while (*p) {
- str=get_string(&p);
- len=get_u32_unal(&p);
- t=p;
- /* printf("String '%s' len %d\n", str, len); */
- if (! strcmp(str,"FirstBatBlock")) {
- /* printf("%ld\n", get_u32_unal(&t)); */
- } else if (! strcmp(str,"MaxBlockSize")) {
- /* printf("%ld\n", get_u32_unal(&t)); */
- } else if (! strcmp(str,"FREE_BLOCK_LIST")) {
- /* printf("%ld\n", get_u32_unal(&t)); */
- } else if (! strcmp(str,"TotalRect")) {
- mr->b.b_rect.lu.x=get_u32_unal(&t);
- mr->b.b_rect.lu.y=get_u32_unal(&t);
- mr->b.b_rect.rl.x=get_u32_unal(&t);
- mr->b.b_rect.rl.y=get_u32_unal(&t);
- /* printf("0x%x,0x%x-0x%x,0x%x\n", mr->b.b_rect.lu.x, mr->b.b_rect.lu.y, mr->b.b_rect.rl.x, mr->b.b_rect.rl.y); */
- } else if (! strcmp(str,"Version")) {
- /* printf("0x%lx\n", get_u32_unal(&t)); */
- } else if (! strcmp(str,"Categories")) {
- /* printf("0x%x\n", get_u16(&t)); */
- } else if (! strcmp(str,"binaryTree")) {
- mr->b.binarytree=get_u32_unal(&t);
- /* printf("%d\n", mr->b.binarytree); */
- } else if (! strcmp(str,"CategorySets")) {
- /* printf("0x%x\n", get_u16(&t)); */
- } else if (! strcmp(str,"Kommentar")) {
- /* printf("%s\n", get_string(&t)); */
- }
- p+=len;
- }
-}
-
-#if 0
-static void
-block_rect_print(struct coord_rect *r)
-{
- printf ("0x%x,0x%x-0x%x,0x%x (0x%x,0x%x)", r->lu.x, r->lu.y, r->rl.x, r->rl.y, r->lu.x/2+r->rl.x/2,r->lu.y/2+r->rl.y/2);
-}
-#endif
-
-static void
-block_rect_same(struct coord_rect *r1, struct coord_rect *r2)
-{
- g_assert(r1->lu.x==r2->lu.x);
- g_assert(r1->lu.y==r2->lu.y);
- g_assert(r1->rl.x==r2->rl.x);
- g_assert(r1->rl.y==r2->rl.y);
-}
-
-int
-block_init(struct map_rect_priv *mr)
-{
- mr->b.block_num=-1;
- mr->b.bt.b=NULL;
- mr->b.bt.next=0;
- block_setup_tags(mr);
- if (mr->b.binarytree) {
- mr->b.bt.next=mr->b.binarytree;
- mr->b.bt.p=NULL;
- mr->b.bt.block_count=0;
- }
- if (mr->cur_sel && !coord_rect_overlap(&mr->cur_sel->u.c_rect, &mr->b.b_rect))
- return 0;
- return block_next(mr);
-}
-
-
-int
-block_next_lin(struct map_rect_priv *mr)
-{
- for (;;) {
- block_lin_count++;
- block_mem+=sizeof(struct block *);
- mr->b.block_num++;
- if (! mr->b.block_num)
- mr->b.p=mr->file->begin+0x2000;
- else
- mr->b.p=mr->b.block_start+mr->b.b->blocks*512;
- if (mr->b.p >= mr->file->end) {
- dbg(1,"end of blocks %p vs %p\n", mr->b.p, mr->file->end);
- return 0;
- }
- mr->b.block_start=mr->b.p;
- mr->b.b=block_get(&mr->b.p);
- mr->b.p_start=mr->b.p;
- mr->b.end=mr->b.block_start+mr->b.b->size;
- if (mr->b.b->count == -1) {
- dbg(1,"empty blocks\n");
- return 0;
- }
- if (!mr->cur_sel || coord_rect_overlap(&mr->cur_sel->u.c_rect, &mr->b.b->r)) {
- block_active_count++;
- block_active_mem+=mr->b.b->blocks*512-sizeof(struct block *);
- dbg(1,"block ok\n");
- return 1;
- }
- dbg(2,"block not in cur_sel\n");
- }
-}
-
-int
-block_next(struct map_rect_priv *mr)
-{
- int blk_num,coord,r_h,r_w;
- struct block_bt_priv *bt=&mr->b.bt;
-
- if (!mr->b.binarytree || ! mr->cur_sel)
- return block_next_lin(mr);
- for (;;) {
- if (! bt->p) {
- dbg(1,"block 0x%x\n", bt->next);
- if (bt->next == -1)
- return 0;
- bt->b=block_get_byid(mr->file, bt->next, &bt->p);
- bt->end=(unsigned char *)mr->b.bt.b+mr->b.bt.b->size;
- bt->next=bt->b->next;
- bt->order=0;
- dbg(1,"size 0x%x next 0x%x\n", bt->b->size, bt->b->next);
- if (! mr->b.bt.block_count) {
-#if 0
- if (debug) {
- printf("idx rect ");
- block_rect_print(&mr->b.bt.b->r);
- }
-#endif
- bt->r=bt->b->r;
- bt->r_curr=bt->r;
- coord=get_u32(&mr->b.bt.p);
- } else {
- bt->p=(unsigned char *)bt->b+0xc;
- }
- bt->block_count++;
- }
- while (mr->b.bt.p < mr->b.bt.end) {
- block_idx_count++;
- blk_num=get_u32(&mr->b.bt.p);
- coord=get_u32(&mr->b.bt.p);
- block_mem+=8;
- dbg(1,"%p vs %p coord 0x%x ", mr->b.bt.end, mr->b.bt.p, coord);
- dbg(1,"block 0x%x", blk_num);
-
- r_w=bt->r_curr.rl.x-bt->r_curr.lu.x;
- r_h=bt->r_curr.lu.y-bt->r_curr.rl.y;
-#if 0
- if (debug) {
- printf(" rect1 ");
- block_rect_print(&bt->r_curr);
- printf(" %dx%d", r_w, r_h);
- }
-#endif
- mr->b.b=NULL;
- if (blk_num != -1) {
- block_mem+=8;
- if (coord_rect_overlap(&mr->cur_sel->u.c_rect, &bt->r_curr)) {
- mr->b.b=block_get_byid(mr->file, blk_num, &mr->b.p);
- mr->b.block_num=blk_num;
- g_assert(mr->b.b != NULL);
- mr->b.block_start=(unsigned char *)(mr->b.b);
- mr->b.p_start=mr->b.p;
- mr->b.end=mr->b.block_start+mr->b.b->size;
- block_rect_same(&mr->b.b->r, &bt->r_curr);
- }
- }
- if (coord != -1) {
- bt->stack[bt->stackp]=bt->r_curr;
- if (r_w > r_h) {
- bt->r_curr.rl.x=coord;
- bt->stack[bt->stackp].lu.x=coord+1;
- } else {
- bt->r_curr.lu.y=coord;
- bt->stack[bt->stackp].rl.y=coord+1;
- }
- bt->stackp++;
- g_assert(bt->stackp < BT_STACK_SIZE);
- } else {
- if (bt->stackp) {
- bt->stackp--;
- bt->r_curr=bt->stack[bt->stackp];
- } else {
- bt->r_curr=bt->r;
- bt->order++;
- if (bt->order > 100)
- return 0;
- }
- }
- if (mr->b.b) {
- block_active_count++;
- block_active_mem+=mr->b.b->blocks*512;
- return 1;
- }
- }
- bt->p=NULL;
- }
- return 0;
-}
diff --git a/navit/data/mg/map.c b/navit/data/mg/map.c
deleted file mode 100644
index 843516d8..00000000
--- a/navit/data/mg/map.c
+++ /dev/null
@@ -1,466 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include "config.h"
-#include "debug.h"
-#include "plugin.h"
-#include "maptype.h"
-#include "mg.h"
-
-
-static struct country_isonum {
- int country;
- int isonum;
- int postal_len;
- char *postal_prefix;
-} country_isonums[]={
- { 1,203},
- { 2,703},
- { 7,674},
- { 11,233},
- { 12,268},
- { 13,428},
- { 14,440},
- { 15,498},
- { 16,643},
- { 17,804},
- { 18,112},
- { 20,818},
- { 30,300},
- { 31,528},
- { 32, 56},
- { 33,250},
- { 34,724},
- { 36,348},
- { 39,380},
- { 40,642},
- { 41,756},
- { 43, 40},
- { 44,826},
- { 45,208},
- { 46,752},
- { 47,578},
- { 48,616},
- { 49,276,5,"D@@"},
- { 50,292},
- { 51,620},
- { 52,442},
- { 53,372},
- { 54,352},
- { 55, 8},
- { 56,470},
- { 57,196},
- { 58,246},
- { 59,100},
- { 61,422},
- { 62, 20},
- { 63,760},
- { 66,682},
- { 71,434},
- { 72,376},
- { 73,275},
- { 75,438},
- { 76,504},
- { 77, 12},
- { 78,788},
- { 81,688},
- { 83,400},
- { 85,191},
- { 86,705},
- { 87, 70},
- { 89,807},
- { 90,792},
- { 93,492},
- { 94, 31},
- { 95, 51},
- { 98,234},
- { 99,732},
- {336,774},
-};
-
-struct map_priv * map_new_mg(struct map_methods *meth, struct attr **attrs);
-
-static int map_id;
-
-static char *file[]={
- [file_border_ply]="border.ply",
- [file_bridge_ply]="bridge.ply",
- [file_build_ply]="build.ply",
- [file_golf_ply]="golf.ply",
- [file_height_ply]="height.ply",
- [file_natpark_ply]="natpark.ply",
- [file_nature_ply]="nature.ply",
- [file_other_ply]="other.ply",
- [file_rail_ply]="rail.ply",
- [file_sea_ply]="sea.ply",
- [file_street_bti]="street.bti",
- [file_street_str]="street.str",
- [file_strname_stn]="strname.stn",
- [file_town_twn]="town.twn",
- [file_tunnel_ply]="tunnel.ply",
- [file_water_ply]="water.ply",
- [file_woodland_ply]="woodland.ply",
-};
-
-int mg_country_from_isonum(int isonum)
-{
- int i;
- for (i = 0 ; i < sizeof(country_isonums)/sizeof(struct country_isonum) ; i++)
- if (country_isonums[i].isonum == isonum)
- return country_isonums[i].country;
- return 0;
-}
-
-int mg_country_to_isonum(int country)
-{
- int i;
- for (i = 0 ; i < sizeof(country_isonums)/sizeof(struct country_isonum) ; i++)
- if (country_isonums[i].country == country)
- return country_isonums[i].isonum;
- return 0;
-}
-
-int mg_country_postal_len(int country)
-{
- int i;
- for (i = 0 ; i < sizeof(country_isonums)/sizeof(struct country_isonum) ; i++)
- if (country_isonums[i].country == country)
- return country_isonums[i].postal_len;
- return 0;
-}
-
-static char *mg_country_postal_prefix(int isonum)
-{
- int i;
- for (i = 0 ; i < sizeof(country_isonums)/sizeof(struct country_isonum) ; i++)
- if (country_isonums[i].isonum == isonum)
- return country_isonums[i].postal_prefix;
- return NULL;
-}
-
-static int
-file_next(struct map_rect_priv *mr)
-{
- int debug=0;
- enum layer_type layer;
-
- for (;;) {
- mr->current_file++;
- if (mr->current_file >= file_end)
- return 0;
- mr->file=mr->m->file[mr->current_file];
- if (! mr->file)
- continue;
- switch (mr->current_file) {
- case file_strname_stn:
- continue;
- case file_town_twn:
- layer=layer_town;
- break;
- case file_street_str:
- layer=layer_street;
- break;
- default:
- layer=layer_poly;
- }
- if (mr->cur_sel && !mr->cur_sel->order[layer])
- continue;
- if (debug)
- printf("current file: '%s'\n", file[mr->current_file]);
- mr->cur_sel=mr->xsel;
- if (block_init(mr))
- return 1;
- }
-}
-
-static void
-map_destroy_mg(struct map_priv *m)
-{
- int i;
-
- printf("mg_map_destroy\n");
- for (i = 0 ; i < file_end ; i++) {
- if (m->file[i])
- file_destroy(m->file[i]);
- }
-}
-
-extern int block_lin_count,block_idx_count,block_active_count,block_mem,block_active_mem;
-
-static struct map_rect_priv *
-map_rect_new_mg(struct map_priv *map, struct map_selection *sel)
-{
- struct map_rect_priv *mr;
- int i;
-
- block_lin_count=0;
- block_idx_count=0;
- block_active_count=0;
- block_mem=0;
- block_active_mem=0;
- mr=g_new0(struct map_rect_priv, 1);
- mr->m=map;
- mr->xsel=sel;
- mr->current_file=-1;
- if (sel && sel->next)
- for (i=0 ; i < file_end ; i++)
- mr->block_hash[i]=g_hash_table_new(g_int_hash,g_int_equal);
-
- file_next(mr);
- return mr;
-}
-
-
-static struct item *
-map_rect_get_item_mg(struct map_rect_priv *mr)
-{
- for (;;) {
- switch (mr->current_file) {
- case file_town_twn:
- if (town_get(mr, &mr->town, &mr->item))
- return &mr->item;
- break;
- case file_border_ply:
- case file_bridge_ply:
- case file_build_ply:
- case file_golf_ply:
- /* case file_height_ply: */
- case file_natpark_ply:
- case file_nature_ply:
- case file_other_ply:
- case file_rail_ply:
- case file_sea_ply:
- /* case file_tunnel_ply: */
- case file_water_ply:
- case file_woodland_ply:
- if (poly_get(mr, &mr->poly, &mr->item))
- return &mr->item;
- break;
- case file_street_str:
- if (street_get(mr, &mr->street, &mr->item))
- return &mr->item;
- break;
- case file_end:
- return NULL;
- default:
- break;
- }
- if (block_next(mr))
- continue;
- if (mr->cur_sel->next) {
- mr->cur_sel=mr->cur_sel->next;
- if (block_init(mr))
- continue;
- }
- if (file_next(mr))
- continue;
- dbg(1,"lin_count %d idx_count %d active_count %d %d kB (%d kB)\n", block_lin_count, block_idx_count, block_active_count, (block_mem+block_active_mem)/1024, block_active_mem/1024);
- return NULL;
- }
-}
-
-static struct item *
-map_rect_get_item_byid_mg(struct map_rect_priv *mr, int id_hi, int id_lo)
-{
- mr->current_file = id_hi >> 16;
- switch (mr->current_file) {
- case file_town_twn:
- if (town_get_byid(mr, &mr->town, id_hi, id_lo, &mr->item))
- return &mr->item;
- break;
- case file_street_str:
- if (street_get_byid(mr, &mr->street, id_hi, id_lo, &mr->item))
- return &mr->item;
- break;
- default:
- if (poly_get_byid(mr, &mr->poly, id_hi, id_lo, &mr->item))
- return &mr->item;
- break;
- }
- return NULL;
-}
-
-
-static void
-map_rect_destroy_mg(struct map_rect_priv *mr)
-{
- int i;
- for (i=0 ; i < file_end ; i++)
- if (mr->block_hash[i])
- g_hash_table_destroy(mr->block_hash[i]);
- g_free(mr);
-}
-
-static char *
-map_search_mg_convert_special(char *str)
-{
- char *ret,*c=g_malloc(strlen(str)*2+1);
-
- ret=c;
- for (;;) {
- switch ((unsigned char)(*str)) {
- case 0xc4:
- *c++='A';
- break;
- case 0xd6:
- *c++='O';
- break;
- case 0xdc:
- *c++='U';
- break;
- case 0xdf:
- *c++='s';
- *c++='s';
- break;
- case 0xe4:
- *c++='a';
- break;
- case 0xf6:
- *c++='o';
- break;
- case 0xfc:
- *c++='u';
- break;
- default:
- dbg(1,"0x%x\n", *str);
- *c++=*str;
- break;
- }
- if (! *str)
- return ret;
- str++;
- }
-}
-
-
-static struct map_search_priv *
-map_search_new_mg(struct map_priv *map, struct item *item, struct attr *search, int partial)
-{
- struct map_rect_priv *mr=g_new0(struct map_rect_priv, 1);
- char *prefix;
- dbg(1,"id_lo=0x%x\n", item->id_lo);
- dbg(1,"search=%s\n", search->u.str);
- mr->m=map;
- mr->search_type=search->type;
- switch (search->type) {
- case attr_town_postal:
- if (item->type != type_country_label)
- return NULL;
- prefix=mg_country_postal_prefix(item->id_lo);
- if (! prefix)
- return NULL;
- tree_search_init(map->dirname, "town.b1", &mr->ts, 0);
- mr->current_file=file_town_twn;
- mr->search_str=g_strdup_printf("%s%s",prefix,search->u.str);
- dbg(0,"search_str='%s'\n",mr->search_str);
- mr->search_country=mg_country_from_isonum(item->id_lo);
- break;
- case attr_town_name:
- if (item->type != type_country_label)
- return NULL;
- tree_search_init(map->dirname, "town.b2", &mr->ts, 0x1000);
- mr->current_file=file_town_twn;
- mr->search_str=map_search_mg_convert_special(search->u.str);
- mr->search_country=mg_country_from_isonum(item->id_lo);
- break;
- case attr_street_name:
- if (item->type != type_town_streets)
- return NULL;
- dbg(1,"street_assoc=0x%x\n", item->id_lo);
- tree_search_init(map->dirname, "strname.b1", &mr->ts, 0);
- mr->current_file=file_strname_stn;
- mr->search_str=g_strdup(search->u.str);
- break;
- default:
- dbg(0,"unknown search\n");
- g_free(mr);
- return NULL;
- }
- mr->search_item=*item;
- mr->search_partial=partial;
- mr->file=mr->m->file[mr->current_file];
- block_init(mr);
- return (struct map_search_priv *)mr;
-}
-
-static void
-map_search_destroy_mg(struct map_search_priv *ms)
-{
- struct map_rect_priv *mr=(struct map_rect_priv *)ms;
-
- dbg(1,"mr=%p\n", mr);
- if (! mr)
- return;
- g_free(mr->search_str);
- tree_search_free(&mr->ts);
- g_free(mr);
-}
-
-static struct item *
-map_search_get_item_mg(struct map_search_priv *ms)
-{
- struct map_rect_priv *mr=(struct map_rect_priv *)ms;
-
- if (! mr)
- return NULL;
- switch (mr->search_type) {
- case attr_town_postal:
- case attr_town_name:
- return town_search_get_item(mr);
- case attr_street_name:
- return street_search_get_item(mr);
- default:
- return NULL;
- }
-}
-
-static struct map_methods map_methods_mg = {
- projection_mg,
- "iso8859-1",
- map_destroy_mg,
- map_rect_new_mg,
- map_rect_destroy_mg,
- map_rect_get_item_mg,
- map_rect_get_item_byid_mg,
- map_search_new_mg,
- map_search_destroy_mg,
- map_search_get_item_mg,
-};
-
-struct map_priv *
-map_new_mg(struct map_methods *meth, struct attr **attrs)
-{
- struct map_priv *m;
- int i,maybe_missing;
- struct attr *data;
- char *filename;
-
- *meth=map_methods_mg;
- data=attr_search(attrs, NULL, attr_data);
- if (! data)
- return NULL;
-
- m=g_new(struct map_priv, 1);
- m->id=++map_id;
- m->dirname=g_strdup(data->u.str);
- for (i = 0 ; i < file_end ; i++) {
- if (file[i]) {
- filename=g_strdup_printf("%s/%s", data->u.str, file[i]);
- m->file[i]=file_create_caseinsensitive(filename);
- if (! m->file[i]) {
- maybe_missing=(i == file_border_ply || i == file_height_ply || i == file_sea_ply);
- if (! maybe_missing)
- g_warning("Failed to load %s", filename);
- } else
- file_mmap(m->file[i]);
- g_free(filename);
- }
- }
-
- return m;
-}
-
-void
-plugin_init(void)
-{
- plugin_register_map_type("mg", map_new_mg);
-}
diff --git a/navit/data/mg/mg.h b/navit/data/mg/mg.h
deleted file mode 100644
index 2600e3ce..00000000
--- a/navit/data/mg/mg.h
+++ /dev/null
@@ -1,295 +0,0 @@
-#include <glib.h>
-#include "item.h"
-#include "attr.h"
-#include "coord.h"
-#include "data.h"
-#include "projection.h"
-#include "map.h"
-#include "file.h"
-
-struct block_data {
- struct file *file;
-};
-
-struct block {
- int blocks;
- int size;
- int next;
- struct coord_rect r;
- int count;
-};
-
-struct item_priv {
- int cidx;
- int aidx;
- unsigned char *cstart,*cp,*cend;
- unsigned char *astart,*ap,*aend;
- enum attr_type attr_last;
- enum attr_type attr_next;
- struct item item;
-};
-
-struct town_priv {
- unsigned int id; /*!< Identifier */
- struct coord c; /*!< Coordinates */
- char *name; /*!< Name */
- char *district; /*!< District */
- char *postal_code1; /*!< Postal code */
- unsigned char order; /*!< Order (Importance) */
- unsigned char type; /*!< Type */
- unsigned short country; /*!< Country */
- unsigned int unknown2; /*!< Unknown */
- unsigned char size; /*!< Size of town */
- unsigned int street_assoc; /*!< Association to streets */
- unsigned char unknown3; /*!< Unknown */
- char *postal_code2; /*!< 2nd postal code */
- unsigned int unknown4; /*!< Unknown */
-
- int cidx;
- int aidx;
- enum attr_type attr_next;
- char debug[256];
- char postal[32];
- struct item town_attr_item;
-};
-
-struct poly_priv {
- int poly_num;
- unsigned char *poly_next;
- int subpoly_num;
- int subpoly_num_all;
- unsigned char *subpoly_next;
- unsigned char *subpoly_start;
- unsigned char *p;
- struct coord c[2];
- char *name;
- unsigned char order;
- unsigned char type;
- unsigned int polys;
- unsigned int *count;
- unsigned int count_sum;
-
- int aidx;
- enum attr_type attr_next;
-};
-
-struct street_header {
- unsigned char order;
- int count;
-} __attribute__((packed));
-
-struct street_type {
- unsigned char order;
- unsigned short country;
-} __attribute__((packed));
-
-struct street_header_type {
- struct street_header *header;
- int type_count;
- struct street_type *type;
-};
-
-struct street_str {
- int segid;
- unsigned char limit; /* 0x03,0x30=One Way,0x33=No Passing */
- unsigned char unknown2;
- unsigned char unknown3;
- unsigned char type;
- unsigned int nameid;
-};
-
-struct street_name_segment {
- int segid;
- int country;
-};
-
-struct street_name {
- int len;
- int country;
- int townassoc;
- char *name1;
- char *name2;
- int segment_count;
- struct street_name_segment *segments;
- int aux_len;
- unsigned char *aux_data;
- int tmp_len;
- unsigned char *tmp_data;
-};
-
-struct street_name_numbers {
- int len;
- int tag;
- int dist;
- int country;
- struct coord *c;
- int first;
- int last;
- int segment_count;
- struct street_name_segment *segments;
- int aux_len;
- unsigned char *aux_data;
- int tmp_len;
- unsigned char *tmp_data;
-};
-
-struct street_name_number {
- int len;
- int tag;
- struct coord *c;
- int first;
- int last;
- struct street_name_segment *segment;
-};
-
-
-
-struct street_priv {
- struct file *name_file;
- struct street_header *header;
- int type_count;
- struct street_type *type;
- struct street_str *str;
- struct street_str *str_start;
- unsigned char *coord_begin;
- unsigned char *p;
- unsigned char *p_rewind;
- unsigned char *end;
- unsigned char *next;
- int status;
- int status_rewind;
- struct coord *ref;
- int bytes;
- int more;
- struct street_name name;
- enum attr_type attr_next;
- char debug[256];
-};
-
-enum file_index {
- file_border_ply=0,
- file_bridge_ply,
- file_build_ply,
- file_golf_ply,
- file_height_ply,
- file_natpark_ply,
- file_nature_ply,
- file_other_ply,
- file_rail_ply,
- file_sea_ply,
- file_street_bti,
- file_street_str,
- file_strname_stn,
- file_town_twn,
- file_tunnel_ply,
- file_water_ply,
- file_woodland_ply,
- file_end
-};
-
-struct map_priv {
- int id;
- struct file *file[file_end];
- char *dirname;
-};
-
-#define BT_STACK_SIZE 32
-
-struct block_bt_priv {
- struct block *b;
- struct coord_rect r, r_curr;
- int next;
- int block_count;
- struct coord_rect stack[BT_STACK_SIZE];
- int stackp;
- int order;
- unsigned char *p;
- unsigned char *end;
-};
-
-struct block_priv {
- int block_num;
- struct coord_rect b_rect;
- unsigned char *block_start;
- struct block *b;
- unsigned char *p;
- unsigned char *end;
- unsigned char *p_start;
- int binarytree;
- struct block_bt_priv bt;
-};
-
-struct block_offset {
- unsigned short offset;
- unsigned short block;
-};
-
-
-struct tree_search_node {
- struct tree_hdr *hdr;
- unsigned char *p;
- unsigned char *last;
- unsigned char *end;
- int low;
- int high;
- int last_low;
- int last_high;
- };
-
-struct tree_search {
- struct file *f;
- int last_node;
- int curr_node;
- struct tree_search_node nodes[5];
-};
-
-
-struct map_rect_priv {
- struct map_selection *xsel;
- struct map_selection *cur_sel;
-
- struct map_priv *m;
- enum file_index current_file;
- struct file *file;
- struct block_priv b;
- struct item item;
- struct town_priv town;
- struct poly_priv poly;
- struct street_priv street;
- struct tree_search ts;
- int search_country;
- struct item search_item;
- char *search_str;
- int search_partial;
- int search_linear;
- unsigned char *search_p;
- int search_blk_count;
- enum attr_type search_type;
- struct block_offset *search_blk_off;
- int search_block;
- GHashTable *block_hash[file_end];
- struct item_priv item3;
-};
-
-int mg_country_from_isonum(int isonum);
-int mg_country_to_isonum(int country);
-int mg_country_postal_len(int country);
-
-int block_init(struct map_rect_priv *mr);
-int block_next(struct map_rect_priv *mr);
-int block_get_byindex(struct file *file, int idx, struct block_priv *blk);
-int block_next_lin(struct map_rect_priv *mr);
-
-int tree_search_hv(char *dirname, char *filename, unsigned int search1, unsigned int search2, int *result);
-int town_get(struct map_rect_priv *mr, struct town_priv *poly, struct item *item);
-int town_get_byid(struct map_rect_priv *mr, struct town_priv *twn, int id_hi, int id_lo, struct item *item);
-struct item * town_search_get_item(struct map_rect_priv *mr);
-int poly_get(struct map_rect_priv *mr, struct poly_priv *poly, struct item *item);
-int poly_get_byid(struct map_rect_priv *mr, struct poly_priv *poly, int id_hi, int id_lo, struct item *item);
-int street_get(struct map_rect_priv *mr, struct street_priv *street, struct item *item);
-int street_get_byid(struct map_rect_priv *mr, struct street_priv *street, int id_hi, int id_lo, struct item *item);
-struct item * street_search_get_item(struct map_rect_priv *mr);
-void tree_search_init(char *dirname, char *filename, struct tree_search *ts, int offset);
-void tree_search_free(struct tree_search *ts);
-int tree_search_next(struct tree_search *ts, unsigned char **p, int dir);
-int tree_search_next_lin(struct tree_search *ts, unsigned char **p);
diff --git a/navit/data/mg/poly.c b/navit/data/mg/poly.c
deleted file mode 100644
index bc9af201..00000000
--- a/navit/data/mg/poly.c
+++ /dev/null
@@ -1,241 +0,0 @@
-#include <string.h>
-#include "debug.h"
-#include "mg.h"
-
-static void
-poly_coord_rewind(void *priv_data)
-{
- struct poly_priv *poly=priv_data;
-
- poly->p=poly->subpoly_start;
-
-}
-
-static int
-poly_coord_get(void *priv_data, struct coord *c, int count)
-{
- struct poly_priv *poly=priv_data;
- int ret=0;
-
- while (count--) {
- if (poly->p >= poly->subpoly_next)
- break;
- c->x=get_u32_unal(&poly->p);
- c->y=get_u32_unal(&poly->p);
- c++;
- ret++;
- }
- return ret;
-}
-
-static void
-poly_attr_rewind(void *priv_data)
-{
- struct poly_priv *poly=priv_data;
-
- poly->aidx=0;
-}
-
-static int
-poly_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
-{
- struct poly_priv *poly=priv_data;
-
- attr->type=attr_type;
- switch (attr_type) {
- case attr_any:
- while (poly->attr_next != attr_none) {
- if (poly_attr_get(poly, poly->attr_next, attr))
- return 1;
- }
- return 0;
- case attr_label:
- attr->u.str=poly->name;
- poly->attr_next=attr_none;
- if (attr->u.str[0])
- return 1;
- return 0;
- default:
- return 0;
- }
- return 1;
-}
-
-static struct item_methods poly_meth = {
- poly_coord_rewind,
- poly_coord_get,
- poly_attr_rewind,
- poly_attr_get,
-};
-
-static void
-poly_get_data(struct poly_priv *poly, unsigned char **p)
-{
- poly->c[0].x=get_u32_unal(p);
- poly->c[0].y=get_u32_unal(p);
- poly->c[1].x=get_u32_unal(p);
- poly->c[1].y=get_u32_unal(p);
- *p+=sizeof(struct coord);
- poly->name=(char *)(*p);
- while (**p) {
- (*p)++;
- }
- (*p)++;
- poly->order=*(*p)++;
- poly->type=*(*p)++;
- poly->polys=get_u32_unal(p);
- poly->count=(unsigned int *)(*p); (*p)+=poly->polys*sizeof(unsigned int);
- poly->count_sum=get_u32_unal(p);
-}
-
-int
-poly_get(struct map_rect_priv *mr, struct poly_priv *poly, struct item *item)
-{
- struct coord_rect r;
-
- for (;;) {
- if (mr->b.p >= mr->b.end)
- return 0;
- if (mr->b.p == mr->b.p_start) {
- poly->poly_num=0;
- poly->subpoly_num=0;
- poly->subpoly_num_all=0;
- poly->poly_next=mr->b.p;
- item->meth=&poly_meth;
- }
- if (poly->poly_num >= mr->b.b->count)
- return 0;
- if (!poly->subpoly_num) {
- mr->b.p=poly->poly_next;
- item->id_lo=mr->b.p-mr->file->begin;
- poly_get_data(poly, &mr->b.p);
- poly->poly_next=mr->b.p+poly->count_sum*sizeof(struct coord);
- poly->poly_num++;
- r.lu=poly->c[0];
- r.rl=poly->c[1];
- if (mr->cur_sel && (poly->order > mr->cur_sel->order[layer_poly]*3 || !coord_rect_overlap(&mr->cur_sel->u.c_rect, &r))) {
- poly->subpoly_num_all+=poly->polys;
- mr->b.p=poly->poly_next;
- continue;
- }
- switch(poly->type) {
- case 0x13:
- item->type=type_poly_wood;
- break;
- case 0x14:
- item->type=type_poly_town;
- break;
- case 0x15:
- item->type=type_poly_cemetery;
- break;
- case 0x16:
- item->type=type_poly_building;
- break;
- case 0x17:
- item->type=type_poly_museum;
- break;
- case 0x19:
- item->type=type_poly_place;
- break;
- case 0x1b:
- item->type=type_poly_commercial_center;
- break;
- case 0x1e:
- item->type=type_poly_industry;
- break;
- case 0x23:
- /* FIXME: what is this ?*/
- item->type=type_poly_place;
- break;
- case 0x24:
- item->type=type_poly_car_parking;
- break;
- case 0x28:
- item->type=type_poly_airport;
- break;
- case 0x29:
- item->type=type_poly_station;
- break;
- case 0x2d:
- item->type=type_poly_hospital;
- break;
- case 0x2e:
- item->type=type_poly_hospital;
- break;
- case 0x2f:
- item->type=type_poly_university;
- break;
- case 0x30:
- item->type=type_poly_university;
- break;
- case 0x32:
- item->type=type_poly_park;
- break;
- case 0x34:
- item->type=type_poly_sport;
- break;
- case 0x35:
- item->type=type_poly_sport;
- break;
- case 0x37:
- item->type=type_poly_golf_course;
- break;
- case 0x38:
- item->type=type_poly_national_park;
- break;
- case 0x39:
- item->type=type_poly_nature_park;
- break;
- case 0x3c:
- item->type=type_poly_water;
- break;
- case 0xbc:
- item->type=type_water_line;
- break;
- case 0xc3:
- /* FIXME: what is this ?*/
- item->type=type_border_state;
- break;
- case 0xc6:
- item->type=type_border_country;
- break;
- case 0xc7:
- item->type=type_border_state;
- break;
- case 0xd0:
- item->type=type_rail;
- break;
- default:
- dbg(0,"Unknown poly type 0x%x '%s' 0x%x,0x%x\n", poly->type,poly->name,r.lu.x,r.lu.y);
- item->type=type_street_unkn;
- }
- } else
- mr->b.p=poly->subpoly_next;
- dbg(1,"%d %d %s\n", poly->subpoly_num_all, mr->b.block_num, poly->name);
- item->id_lo=poly->subpoly_num_all | (mr->b.block_num << 16);
- item->id_hi=(mr->current_file << 16);
- dbg(1,"0x%x 0x%x\n", item->id_lo, item->id_hi);
- poly->subpoly_next=mr->b.p+L(poly->count[poly->subpoly_num])*sizeof(struct coord);
- poly->subpoly_num++;
- poly->subpoly_num_all++;
- if (poly->subpoly_num >= poly->polys)
- poly->subpoly_num=0;
- poly->subpoly_start=poly->p=mr->b.p;
- item->priv_data=poly;
- poly->attr_next=attr_label;
- return 1;
- }
-}
-
-int
-poly_get_byid(struct map_rect_priv *mr, struct poly_priv *poly, int id_hi, int id_lo, struct item *item)
-{
- int count=id_lo & 0xffff;
- int ret=0;
- block_get_byindex(mr->m->file[mr->current_file], id_lo >> 16, &mr->b);
- while (count-- >= 0) {
- ret=poly_get(mr, poly, item);
- }
- return ret;
-}
-
diff --git a/navit/data/mg/street.c b/navit/data/mg/street.c
deleted file mode 100644
index 019adb77..00000000
--- a/navit/data/mg/street.c
+++ /dev/null
@@ -1,728 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include "debug.h"
-#include "mg.h"
-
-int coord_debug;
-
-static void
-street_name_get(struct street_name *name, unsigned char **p)
-{
- unsigned char *start=*p;
- name->len=get_u16_unal(p);
- name->country=get_u16_unal(p);
- name->townassoc=get_u32_unal(p);
- name->name1=get_string(p);
- name->name2=get_string(p);
- name->segment_count=get_u32_unal(p);
- name->segments=(struct street_name_segment *)(*p);
- (*p)+=(sizeof (struct street_name_segment))*name->segment_count;
- name->aux_len=name->len-(*p-start);
- name->aux_data=*p;
- name->tmp_len=name->aux_len;
- name->tmp_data=name->aux_data;
- *p=start+name->len;
-}
-
-static void
-street_name_numbers_get(struct street_name_numbers *name_numbers, unsigned char **p)
-{
- unsigned char *start=*p;
- name_numbers->len=get_u16_unal(p);
- name_numbers->tag=get_u8(p);
- name_numbers->dist=get_u32_unal(p);
- name_numbers->country=get_u32_unal(p);
- name_numbers->c=coord_get(p);
- name_numbers->first=get_u24(p);
- name_numbers->last=get_u24(p);
- name_numbers->segment_count=get_u32_unal(p);
- name_numbers->segments=(struct street_name_segment *)(*p);
- (*p)+=sizeof(struct street_name_segment)*name_numbers->segment_count;
- name_numbers->aux_len=name_numbers->len-(*p-start);
- name_numbers->aux_data=*p;
- name_numbers->tmp_len=name_numbers->aux_len;
- name_numbers->tmp_data=name_numbers->aux_data;
- *p=start+name_numbers->len;
-}
-
-static void
-street_name_number_get(struct street_name_number *name_number, unsigned char **p)
-{
- unsigned char *start=*p;
- name_number->len=get_u16_unal(p);
- name_number->tag=get_u8(p);
- name_number->c=coord_get(p);
- name_number->first=get_u24(p);
- name_number->last=get_u24(p);
- name_number->segment=(struct street_name_segment *)p;
- *p=start+name_number->len;
-}
-
-static void
-street_name_get_by_id(struct street_name *name, struct file *file, unsigned long id)
-{
- unsigned char *p;
- if (id) {
- p=file->begin+id+0x2000;
- street_name_get(name, &p);
- }
-}
-
-static int street_get_bytes(struct coord_rect *r)
-{
- int bytes,dx,dy;
- bytes=2;
- dx=r->rl.x-r->lu.x;
- dy=r->lu.y-r->rl.y;
- g_assert(dx > 0);
- g_assert(dy > 0);
- if (dx > 32767 || dy > 32767)
- bytes=3;
- if (dx > 8388608 || dy > 8388608)
- bytes=4;
-
- return bytes;
-}
-
-static int street_get_coord(unsigned char **pos, int bytes, struct coord *ref, struct coord *f)
-{
- unsigned char *p;
- int x,y,flags=0;
-
- p=*pos;
- x=*p++;
- x|=(*p++) << 8;
- if (bytes == 2) {
- if ( x > 0x7fff) {
- x=0x10000-x;
- flags=1;
- }
- }
- else if (bytes == 3) {
- x|=(*p++) << 16;
- if ( x > 0x7fffff) {
- x=0x1000000-x;
- flags=1;
- }
- } else {
- x|=(*p++) << 16;
- x|=(*p++) << 24;
- if (x < 0) {
- x=-x;
- flags=1;
- }
- }
- y=*p++;
- y|=(*p++) << 8;
- if (bytes == 3) {
- y|=(*p++) << 16;
- } else if (bytes == 4) {
- y|=(*p++) << 16;
- y|=(*p++) << 24;
- }
- if (f) {
- f->x=ref[0].x+x;
- f->y=ref[1].y+y;
- }
- dbg(1,"0x%x,0x%x + 0x%x,0x%x = 0x%x,0x%x\n", x, y, ref[0].x, ref[1].y, f->x, f->y);
- *pos=p;
- return flags;
-}
-
-static void
-street_coord_get_begin(unsigned char **p)
-{
- struct street_str *str;
-
- str=(struct street_str *)(*p);
- while (L(str->segid)) {
- str++;
- }
- (*p)=(unsigned char *)str;
- (*p)+=4;
-}
-
-
-static void
-street_coord_rewind(void *priv_data)
-{
- /* struct street_priv *street=priv_data; */
-
-}
-
-static int
-street_coord_get_helper(struct street_priv *street, struct coord *c)
-{
- unsigned char *n;
- if (street->p+street->bytes*2 >= street->end)
- return 0;
- if (street->status >= 4)
- return 0;
- n=street->p;
- if (street_get_coord(&street->p, street->bytes, street->ref, c)) {
- if (street->status)
- street->next=n;
- street->status+=2;
- if (street->status == 5)
- return 0;
- }
- return 1;
-}
-
-static int
-street_coord_get(void *priv_data, struct coord *c, int count)
-{
- struct street_priv *street=priv_data;
- int ret=0,i,scount;
-
- if (! street->p && count) {
- street->p=street->coord_begin;
- scount=street->str-street->str_start;
- for (i = 0 ; i < scount ; i++) {
- street->status=L(street->str[i+1].segid) >= 0 ? 0:1;
- while (street_coord_get_helper(street, c));
- street->p=street->next;
- }
- street->status_rewind=street->status=L(street->str[1].segid) >= 0 ? 0:1;
- }
- while (count > 0) {
- if (street_coord_get_helper(street, c)) {
- c++;
- ret++;
- count--;
- } else {
- street->more=0;
- return ret;
- }
- }
- return ret;
-}
-
-static void
-street_attr_rewind(void *priv_data)
-{
- /* struct street_priv *street=priv_data; */
-
-}
-
-static int
-street_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
-{
- struct street_priv *street=priv_data;
- int nameid;
-
- dbg(1,"segid 0x%x\n", street->str->segid);
- attr->type=attr_type;
- switch (attr_type) {
- case attr_any:
- while (street->attr_next != attr_none) {
- if (street_attr_get(street, street->attr_next, attr))
- return 1;
- }
- return 0;
- case attr_label:
- street->attr_next=attr_street_name;
- nameid=L(street->str->nameid);
- if (! nameid)
- return 0;
- if (! street->name.len)
- street_name_get_by_id(&street->name,street->name_file,nameid);
- attr->u.str=street->name.name2;
- if (attr->u.str && attr->u.str[0])
- return 1;
- attr->u.str=street->name.name1;
- if (attr->u.str && attr->u.str[0])
- return 1;
- return 0;
- case attr_street_name:
- street->attr_next=attr_street_name_systematic;
- nameid=L(street->str->nameid);
- if (! nameid)
- return 0;
- if (! street->name.len)
- street_name_get_by_id(&street->name,street->name_file,nameid);
- attr->u.str=street->name.name2;
- return ((attr->u.str && attr->u.str[0]) ? 1:0);
- case attr_street_name_systematic:
- street->attr_next=attr_flags;
- nameid=L(street->str->nameid);
- if (! nameid)
- return 0;
- if (! street->name.len)
- street_name_get_by_id(&street->name,street->name_file,nameid);
- attr->u.str=street->name.name1;
- return ((attr->u.str && attr->u.str[0]) ? 1:0);
- case attr_flags:
- if (street->str->type & 0x40) {
- attr->u.num=(street->str->limit & 0x30) ? AF_ONEWAYREV:0;
- attr->u.num|=(street->str->limit & 0x03) ? AF_ONEWAY:0;
- } else {
- attr->u.num=(street->str->limit & 0x30) ? AF_ONEWAY:0;
- attr->u.num|=(street->str->limit & 0x03) ? AF_ONEWAYREV:0;
- }
- street->attr_next=attr_country_id;
- return 1;
- case attr_country_id:
- street->attr_next=attr_debug;
- nameid=L(street->str->nameid);
- if (! nameid)
- return 0;
- if (! street->name.len)
- street_name_get_by_id(&street->name,street->name_file,nameid);
- attr->u.num=mg_country_to_isonum(street->name.country);
- return 1;
- case attr_debug:
- street->attr_next=attr_none;
- {
- struct street_str *str=street->str;
- sprintf(street->debug,"order:0x%x\nsegid:0x%x\nlimit:0x%x\nunknown2:0x%x\nunknown3:0x%x\ntype:0x%x\nnameid:0x%x\ntownassoc:0x%x",street->header->order,str->segid,str->limit,str->unknown2,str->unknown3,str->type,str->nameid, street->name.len ? street->name.townassoc : 0);
- attr->u.str=street->debug;
- }
- return 1;
- default:
- return 0;
- }
- return 1;
-}
-
-static struct item_methods street_meth = {
- street_coord_rewind,
- street_coord_get,
- street_attr_rewind,
- street_attr_get,
-};
-
-static void
-street_get_data(struct street_priv *street, unsigned char **p)
-{
- street->header=(struct street_header *)(*p);
- (*p)+=sizeof(struct street_header);
- street->type_count=street->header->count;
- street->type=(struct street_type *)(*p);
- (*p)+=street->type_count*sizeof(struct street_type);
-}
-
-
- /*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 */
-static unsigned char limit[]={0,0,1,1,1,2,2,4,6,6,12,13,14,20,20,20,20,20,20};
-
-int
-street_get(struct map_rect_priv *mr, struct street_priv *street, struct item *item)
-{
- while (street->more) {
- struct coord c;
- street_coord_get(street, &c, 1);
- }
- if (mr->b.p == mr->b.p_start) {
- street_get_data(street, &mr->b.p);
- street->name_file=mr->m->file[file_strname_stn];
- if (mr->cur_sel && street->header->order > limit[mr->cur_sel->order[layer_street]])
- return 0;
- street->end=mr->b.end;
- street->ref=&mr->b.b->r.lu;
- street->bytes=street_get_bytes(&mr->b.b->r);
- street->str_start=street->str=(struct street_str *)mr->b.p;
- street->coord_begin=mr->b.p;
- street_coord_get_begin(&street->coord_begin);
- street->p=street->coord_begin;
- street->type--;
- item->meth=&street_meth;
- item->priv_data=street;
- } else {
- street->str++;
- street->p=street->next;
- }
- if (! L(street->str->segid))
- return 0;
- if (L(street->str->segid) < 0)
- street->type++;
-#if 0
- g_assert(street->p != NULL);
-#endif
- street->next=NULL;
- street->status_rewind=street->status=L(street->str[1].segid) >= 0 ? 0:1;
-#if 0
- if (street->type->country != 0x31) {
- printf("country=0x%x\n", street->type->country);
- }
-#endif
- item->id_hi=street->type->country | (mr->current_file << 16);
- item->id_lo=L(street->str->segid) > 0 ? L(street->str->segid) : -L(street->str->segid);
- switch(street->str->type & 0x1f) {
- case 0xf: /* very small street */
- if (street->str->limit == 0x33)
- item->type=type_street_nopass;
- else
- item->type=type_street_0;
- break;
- case 0xd:
- item->type=type_ferry;
- break;
- case 0xc: /* small street */
- item->type=type_street_1_city;
- break;
- case 0xb:
- item->type=type_street_2_city;
- break;
- case 0xa:
- if ((street->str->limit == 0x03 || street->str->limit == 0x30) && street->header->order < 4)
- item->type=type_street_4_city;
- else
- item->type=type_street_3_city;
- break;
- case 0x9:
- if (street->header->order < 5)
- item->type=type_street_4_city;
- else if (street->header->order < 7)
- item->type=type_street_2_city;
- else
- item->type=type_street_1_city;
- break;
- case 0x8:
- item->type=type_street_2_land;
- break;
- case 0x7:
- if ((street->str->limit == 0x03 || street->str->limit == 0x30) && street->header->order < 4)
- item->type=type_street_4_city;
- else
- item->type=type_street_3_land;
- break;
- case 0x6:
- item->type=type_ramp;
- break;
- case 0x5:
- item->type=type_street_4_land;
- break;
- case 0x4:
- item->type=type_street_4_land;
- break;
- case 0x3:
- item->type=type_street_n_lanes;
- break;
- case 0x2:
- item->type=type_highway_city;
- break;
- case 0x1:
- item->type=type_highway_land;
- break;
- default:
- item->type=type_street_unkn;
- dbg(0,"unknown type 0x%x\n",street->str->type);
- }
-#if 0
- coord_debug=(street->str->unknown2 != 0x40 || street->str->unknown3 != 0x40);
- if (coord_debug) {
- item->type=type_street_unkn;
- printf("%d %02x %02x %02x %02x\n", street->str->segid, street->str->type, street->str->limit, street->str->unknown2, street->str->unknown3);
- }
-#endif
- street->p_rewind=street->p;
- street->name.len=0;
- street->attr_next=attr_label;
- street->more=1;
- return 1;
-}
-
-int
-street_get_byid(struct map_rect_priv *mr, struct street_priv *street, int id_hi, int id_lo, struct item *item)
-{
- int country=id_hi & 0xffff;
- int res;
- dbg(1,"enter(%p,%p,0x%x,0x%x,%p)\n", mr, street, id_hi, id_lo, item);
- if (! country)
- return 0;
- tree_search_hv(mr->m->dirname, "street", (id_lo >> 8) | (country << 24), id_lo & 0xff, &res);
- dbg(1,"res=0x%x (blk=0x%x)\n", res, res >> 12);
- block_get_byindex(mr->m->file[mr->current_file], res >> 12, &mr->b);
- street_get_data(street, &mr->b.p);
- street->name_file=mr->m->file[file_strname_stn];
- street->end=mr->b.end;
- street->ref=&mr->b.b->r.lu;
- street->bytes=street_get_bytes(&mr->b.b->r);
- street->str_start=street->str=(struct street_str *)mr->b.p;
- street->coord_begin=mr->b.p;
- street_coord_get_begin(&street->coord_begin);
- street->p=street->coord_begin;
- street->type--;
- item->meth=&street_meth;
- item->priv_data=street;
- street->str+=(res & 0xfff)-1;
- dbg(1,"segid 0x%x\n", street->str[1].segid);
- return street_get(mr, street, item);
-#if 0
- mr->b.p=mr->b.block_start+(res & 0xffff);
- return town_get(mr, twn, item);
-#endif
-
- return 0;
-}
-
-
-struct street_name_index {
- int block;
- unsigned short country;
- int town_assoc;
- char name[0];
-} __attribute__((packed));
-
-
-static int
-street_search_compare_do(struct map_rect_priv *mr, int country, int town_assoc, char *name)
-{
- int d;
-
- dbg(1,"enter");
- dbg(1,"country 0x%x town_assoc 0x%x name '%s'\n", country, town_assoc, name);
- d=(mr->search_item.id_hi & 0xffff)-country;
- dbg(1,"country %d (%d vs %d)\n", d, mr->search_item.id_hi & 0xffff, country);
- if (!d) {
- if (mr->search_item.id_lo == town_assoc ) {
- dbg(1,"town_assoc match (0x%x)\n", town_assoc);
- if (mr->search_partial)
- d=strncasecmp(mr->search_str, name, strlen(mr->search_str));
- else
- d=strcasecmp(mr->search_str, name);
- dbg(1,"string %d\n", d);
- } else {
- if (town_assoc < mr->search_item.id_lo)
- d=1;
- else
- d=-1;
- dbg(1,"assoc %d 0x%x-0x%x\n",d, mr->search_item.id_lo, town_assoc);
- }
- }
- dbg(1,"d=%d\n", d);
- return d;
-}
-
-static int
-street_search_compare(unsigned char **p, struct map_rect_priv *mr)
-{
- struct street_name_index *i;
- int ret;
-
- dbg(1,"enter\n");
- i=(struct street_name_index *)(*p);
- *p+=sizeof(*i)+strlen(i->name)+1;
-
- dbg(1,"block 0x%x\n", i->block);
-
- ret=street_search_compare_do(mr, i->country, i->town_assoc, i->name);
- if (ret <= 0)
- mr->search_block=i->block;
- return ret;
-}
-
-static void
-street_name_numbers_coord_rewind(void *priv_data)
-{
- /* struct street_priv *street=priv_data; */
-
-}
-
-static void
-street_name_numbers_attr_rewind(void *priv_data)
-{
- /* struct street_priv *street=priv_data; */
-
-}
-
-static int
-street_name_numbers_coord_get(void *priv_data, struct coord *c, int count)
-{
- return 0;
-}
-
-static int
-street_name_numbers_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
-{
- attr->type=attr_type;
- switch (attr_type) {
- default:
- dbg(0,"unknown item\n");
- return 0;
- }
-}
-
-
-
-
-
-static struct item_methods street_name_numbers_meth = {
- street_name_numbers_coord_rewind,
- street_name_numbers_coord_get,
- street_name_numbers_attr_rewind,
- street_name_numbers_attr_get,
-};
-
-
-static void
-street_name_coord_rewind(void *priv_data)
-{
- /* struct street_priv *street=priv_data; */
-
-}
-
-static void
-street_name_attr_rewind(void *priv_data)
-{
- /* struct street_priv *street=priv_data; */
-
-}
-
-static int
-street_name_coord_get(void *priv_data, struct coord *c, int count)
-{
- struct map_rect_priv *mr=priv_data;
- struct street_name_numbers snns;
- unsigned char *p=mr->street.name.aux_data;
-
- dbg(1,"aux_data=%p\n", p);
- if (count) {
- street_name_numbers_get(&snns, &p);
- *c=*(snns.c);
- return 1;
- }
-
- return 0;
-}
-
-static int
-street_name_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
-{
- struct map_rect_priv *mr=priv_data;
- struct item *item;
-
- attr->type=attr_type;
- switch (attr_type) {
- case attr_street_name:
- attr->u.str=mr->street.name.name2;
- return ((attr->u.str && attr->u.str[0]) ? 1:0);
- case attr_street_name_systematic:
- attr->u.str=mr->street.name.name1;
- return ((attr->u.str && attr->u.str[0]) ? 1:0);
- case attr_street_name_numbers_item:
- item=&mr->item3.item;
- attr->u.item=item;
- item->type=type_street_name_numbers;
- item->id_hi=0;
- item->id_lo=1;
- item->meth=&street_name_numbers_meth;
- item->map=NULL;
- item->priv_data=mr;
- {
- int i;
- struct street_name_numbers nns;
- unsigned char *p=mr->street.name.aux_data;
- unsigned char *end=p+mr->street.name.aux_len;
- printf("len=0x%x\n", mr->street.name.aux_len);
- for (i = 0 ; i < mr->street.name.aux_len ; i++) {
- printf("%02x ",mr->street.name.aux_data[i]);
- }
- printf("\n");
- {
- while (p < end) {
- unsigned char *pn,*pn_end;
- struct street_name_number nn;
- street_name_numbers_get(&nns, &p);
- printf("name_numbers:\n");
- printf(" len 0x%x\n", nns.len);
- printf(" tag 0x%x\n", nns.tag);
- printf(" dist 0x%x\n", nns.dist);
- printf(" country 0x%x\n", nns.country);
- printf(" coord 0x%x,0x%x\n", nns.c->x, nns.c->y);
- printf(" first %d\n", nns.first);
- printf(" last %d\n", nns.last);
- printf(" segment count 0x%x\n", nns.segment_count);
- printf(" aux_len 0x%x\n", nns.aux_len);
- pn=nns.aux_data;
- pn_end=nns.aux_data+nns.aux_len;
- while (pn < pn_end) {
- printf(" number:\n");
- street_name_number_get(&nn, &pn);
- printf(" len 0x%x\n", nn.len);
- printf(" tag 0x%x\n", nn.tag);
- printf(" coord 0x%x,0x%x\n", nn.c->x, nn.c->y);
- printf(" first %d\n", nn.first);
- printf(" last %d\n", nn.last);
- }
- }
- }
- }
- return 1;
- default:
- dbg(0,"unknown item\n");
- return 0;
- }
-}
-
-
-
-
-
-static struct item_methods street_name_meth = {
- street_name_coord_rewind,
- street_name_coord_get,
- street_name_attr_rewind,
- street_name_attr_get,
-};
-
-
-struct item *
-street_search_get_item(struct map_rect_priv *mr)
-{
- int dir=1,leaf;
- unsigned char *last;
-
- dbg(1,"enter\n");
- if (! mr->search_blk_count) {
- dbg(1,"partial 0x%x '%s' ***\n", mr->town.street_assoc, mr->search_str);
- if (mr->search_linear)
- return NULL;
- dbg(1,"tree_search_next\n");
- mr->search_block=-1;
- while ((leaf=tree_search_next(&mr->ts, &mr->search_p, dir)) != -1) {
- dir=street_search_compare(&mr->search_p, mr);
- }
- dbg(1,"dir=%d mr->search_block=0x%x\n", dir, mr->search_block);
- if (mr->search_block == -1)
- return NULL;
- mr->search_blk_count=1;
- block_get_byindex(mr->m->file[file_strname_stn], mr->search_block, &mr->b);
- mr->b.p=mr->b.block_start+12;
- }
- dbg(1,"name id 0x%x\n", mr->b.p-mr->m->file[file_strname_stn]->begin);
- if (! mr->search_blk_count)
- return NULL;
- for (;;) {
- if (mr->b.p >= mr->b.end) {
- if (!block_next_lin(mr)) {
- dbg(1,"end of blocks in %p, %p\n", mr->m->file[file_strname_stn]->begin, mr->m->file[file_strname_stn]->end);
- return NULL;
- }
- mr->b.p=mr->b.block_start+12;
- }
- while (mr->b.p < mr->b.end) {
- last=mr->b.p;
- street_name_get(&mr->street.name, &mr->b.p);
- dir=street_search_compare_do(mr, mr->street.name.country, mr->street.name.townassoc, mr->street.name.name2);
- dbg(1,"country 0x%x assoc 0x%x name1 '%s' name2 '%s' dir=%d\n", mr->street.name.country, mr->street.name.townassoc, mr->street.name.name1, mr->street.name.name2, dir);
- if (dir < 0) {
- dbg(1,"end of data\n");
- mr->search_blk_count=0;
- return NULL;
- }
- if (!dir) {
- dbg(1,"result country 0x%x assoc 0x%x name1 '%s' name2 '%s' dir=%d aux_data=%p len=0x%x\n", mr->street.name.country, mr->street.name.townassoc, mr->street.name.name1, mr->street.name.name2, dir, mr->street.name.aux_data, mr->street.name.aux_len);
- mr->item.type = type_street_name;
- mr->item.id_hi=mr->street.name.country | (mr->current_file << 16) | 0x10000000;
- mr->item.id_lo=last-mr->m->file[mr->current_file]->begin;
- mr->item.meth=&street_name_meth;
- mr->item.map=NULL;
- mr->item.priv_data=mr;
- return &mr->item;
- }
- }
- }
-}
-
diff --git a/navit/data/mg/town.c b/navit/data/mg/town.c
deleted file mode 100644
index 92bd0e74..00000000
--- a/navit/data/mg/town.c
+++ /dev/null
@@ -1,264 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include "debug.h"
-#include "mg.h"
-
-
-
-static void
-town_coord_rewind(void *priv_data)
-{
- struct town_priv *twn=priv_data;
-
- twn->cidx=0;
-}
-
-static int
-town_coord_get(void *priv_data, struct coord *c, int count)
-{
- struct town_priv *twn=priv_data;
-
- if (twn->cidx || count <= 0)
- return 0;
- twn->cidx=1;
- *c=twn->c;
- return 1;
-}
-
-static void
-town_attr_rewind(void *priv_data)
-{
- struct town_priv *twn=priv_data;
-
- twn->aidx=0;
- twn->attr_next=attr_label;
-}
-
-static int
-town_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
-{
- struct town_priv *twn=priv_data;
- int len;
-
- attr->type=attr_type;
- switch (attr_type) {
- case attr_any:
- while (twn->attr_next != attr_none) {
- if (town_attr_get(twn, twn->attr_next, attr))
- return 1;
- }
- return 0;
- case attr_label:
- attr->u.str=twn->district;
- twn->attr_next=attr_town_name;
- if (attr->u.str[0])
- return 1;
- attr->u.str=twn->name;
- return ((attr->u.str && attr->u.str[0]) ? 1:0);
- case attr_town_name:
- attr->u.str=twn->name;
- twn->attr_next=attr_town_postal;
- return ((attr->u.str && attr->u.str[0]) ? 1:0);
- case attr_town_postal:
- strncpy(twn->postal, twn->postal_code1, 32);
- attr->u.str=twn->postal;
- len=mg_country_postal_len(twn->country);
- if (!len)
- len=31;
- twn->postal[len]='\0';
- twn->attr_next=attr_district_name;
- return ((attr->u.str && attr->u.str[0]) ? 1:0);
- case attr_district_name:
- attr->u.str=twn->district;
- twn->attr_next=attr_debug;
- return ((attr->u.str && attr->u.str[0]) ? 1:0);
- case attr_town_streets_item:
- twn->town_attr_item.type=type_town_streets;
- twn->town_attr_item.id_hi=twn->country | (file_town_twn << 16) | 0x10000000;
- twn->town_attr_item.id_lo=twn->street_assoc;
- attr->u.item=&twn->town_attr_item;
- twn->attr_next=attr_debug;
- return 1;
- case attr_debug:
- sprintf(twn->debug, "order %d\nsize %d\nstreet_assoc 0x%x", twn->order, twn->size, twn->street_assoc);
- attr->u.str=twn->debug;
- twn->attr_next=attr_none;
- return 1;
- default:
- g_assert(1==0);
- return 0;
- }
- return 1;
-}
-
-static struct item_methods town_meth = {
- town_coord_rewind,
- town_coord_get,
- town_attr_rewind,
- town_attr_get,
-};
-
-static void
-town_get_data(struct town_priv *twn, unsigned char **p)
-{
- twn->id=get_u32_unal(p);
- twn->c.x=get_u32_unal(p);
- twn->c.y=get_u32_unal(p);
- twn->name=get_string(p);
- twn->district=get_string(p);
- twn->postal_code1=get_string(p);
- twn->order=get_u8(p); /* 1-15 (19) */
- twn->country=get_u16_unal(p);
- twn->type=get_u8(p);
- twn->unknown2=get_u32_unal(p);
- twn->size=get_u8(p);
- twn->street_assoc=get_u32_unal(p);
- twn->unknown3=get_u8(p);
- twn->postal_code2=get_string(p);
- twn->unknown4=get_u32_unal(p);
-#if 0
- printf("%s\t%s\t%s\t%d\t%d\t%d\n",twn->name,twn->district,twn->postal_code1,twn->order, twn->country, twn->type);
-#endif
-}
- /*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 */
-static unsigned char limit[]={0,1,2,2,4,6,8,10,11,13,14,14,14,20,20,20,20,20,20};
-
-static enum item_type town_item[]={type_town_label_5e1, type_town_label_1e2, type_town_label_2e2, type_town_label_5e2, type_town_label_1e3, type_town_label_1e3, type_town_label_2e3, type_town_label_5e3, type_town_label_1e4, type_town_label_2e4, type_town_label_5e4, type_town_label_1e5, type_town_label_1e5, type_town_label_2e5, type_town_label_5e5, type_town_label_1e6, type_town_label_2e6};
-static enum item_type district_item[]={type_district_label_5e1, type_district_label_1e2, type_district_label_2e2, type_district_label_5e2, type_district_label_1e3, type_district_label_1e3, type_district_label_2e3, type_district_label_5e3, type_district_label_1e4, type_district_label_2e4, type_district_label_5e4, type_district_label_1e5, type_district_label_1e5, type_district_label_2e5, type_district_label_5e5, type_district_label_1e6, type_district_label_2e6};
-int
-town_get(struct map_rect_priv *mr, struct town_priv *twn, struct item *item)
-{
- int size;
- for (;;) {
- if (mr->b.p >= mr->b.end)
- return 0;
- town_get_data(twn, &mr->b.p);
- twn->cidx=0;
- twn->aidx=0;
- twn->attr_next=attr_label;
- if (! mr->cur_sel || (twn->order <= limit[mr->cur_sel->order[layer_town]] && coord_rect_contains(&mr->cur_sel->u.c_rect,&twn->c))) {
- switch(twn->type) {
- case 1:
- size=twn->size;
- if (size >= sizeof(town_item)/sizeof(enum item_type))
- size=sizeof(town_item)/sizeof(enum item_type)-1;
- item->type=town_item[size];
- break;
- case 3:
- size=twn->size;
- if (size == 6 && twn->order < 14)
- size++;
- if (size == 5 && twn->order < 14)
- size+=2;
- if (size >= sizeof(district_item)/sizeof(enum item_type))
- size=sizeof(district_item)/sizeof(enum item_type)-1;
- item->type=district_item[size];
- break;
- case 4:
- item->type=type_port_label;
- break;
- case 9:
- item->type=type_highway_exit_label;
- break;
- default:
- printf("unknown town type 0x%x '%s' '%s' 0x%x,0x%x\n", twn->type, twn->name, twn->district, twn->c.x, twn->c.y);
- item->type=type_town_label;
- }
- item->id_hi=twn->country | (mr->current_file << 16);
- item->id_lo=twn->id;
- item->priv_data=twn;
- item->meth=&town_meth;
- return 1;
- }
- }
-}
-
-int
-town_get_byid(struct map_rect_priv *mr, struct town_priv *twn, int id_hi, int id_lo, struct item *item)
-{
- int country=id_hi & 0xffff;
- int res;
- if (!tree_search_hv(mr->m->dirname, "town", (id_lo >> 8) | (country << 24), id_lo & 0xff, &res))
- return 0;
- block_get_byindex(mr->m->file[mr->current_file], res >> 16, &mr->b);
- mr->b.p=mr->b.block_start+(res & 0xffff);
- return town_get(mr, twn, item);
-}
-
-static int
-town_search_compare(unsigned char **p, struct map_rect_priv *mr)
-{
- int country, d;
- char *name;
-
- if (mr->search_type == attr_town_postal) {
- mr->search_blk_count=1;
- mr->search_blk_off=(struct block_offset *)(*p);
- *p+=4;
- name=get_string(p);
- d=0;
- } else {
- country=get_u16_unal(p);
- dbg(1,"country 0x%x ", country);
- name=get_string(p);
- dbg(1,"name '%s' ",name);
- mr->search_blk_count=get_u32_unal(p);
- mr->search_blk_off=(struct block_offset *)(*p);
- dbg(1,"len %d ", mr->search_blk_count);
- (*p)+=mr->search_blk_count*4;
- d=mr->search_country-country;
- }
- if (!d) {
- if (mr->search_partial)
- d=strncasecmp(mr->search_str, name, strlen(mr->search_str));
- else
- d=strcasecmp(mr->search_str, name);
- }
- dbg(1,"%d \n",d);
- return d;
-
-}
-
-
-
-struct item *
-town_search_get_item(struct map_rect_priv *mr)
-{
- int dir=1,leaf;
-
- if (! mr->search_blk_count) {
- dbg(1,"partial %d 0x%x '%s' ***\n", mr->search_partial, mr->search_country, mr->search_str);
- if (! mr->search_linear) {
- while ((leaf=tree_search_next(&mr->ts, &mr->search_p, dir)) != -1) {
- dir=town_search_compare(&mr->search_p, mr);
- if (! dir && leaf) {
- mr->search_linear=1;
- mr->search_p=NULL;
- break;
- }
- }
- if (! mr->search_linear) {
- dbg(1,"not found\n");
- return NULL;
- }
- }
- if (! tree_search_next_lin(&mr->ts, &mr->search_p)) {
- dbg(1,"linear not found\n");
- return NULL;
- }
- if (town_search_compare(&mr->search_p, mr)) {
- dbg(1,"no match\n");
- return NULL;
- }
- dbg(1,"found %d blocks\n",mr->search_blk_count);
- }
- if (! mr->search_blk_count)
- return NULL;
- dbg(1,"block 0x%x offset 0x%x\n", mr->search_blk_off->block, mr->search_blk_off->offset);
- block_get_byindex(mr->m->file[mr->current_file], mr->search_blk_off->block, &mr->b);
- mr->b.p=mr->b.block_start+mr->search_blk_off->offset;
- town_get(mr, &mr->town, &mr->item);
- mr->search_blk_off++;
- mr->search_blk_count--;
- return &mr->item;
-}
diff --git a/navit/data/mg/tree.c b/navit/data/mg/tree.c
deleted file mode 100644
index 077649e9..00000000
--- a/navit/data/mg/tree.c
+++ /dev/null
@@ -1,244 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include "debug.h"
-#include "mg.h"
-
-struct tree_hdr {
- unsigned int addr;
- unsigned int size;
- unsigned int low;
-};
-
-struct tree_hdr_h {
- unsigned int addr;
- unsigned int size;
-};
-
-struct tree_leaf_h {
- unsigned int lower;
- unsigned int higher;
- unsigned int match;
- unsigned int value;
-};
-
-
-struct tree_hdr_v {
- unsigned int count;
- unsigned int next;
- unsigned int unknown;
-};
-
-struct tree_leaf_v {
- unsigned char key;
- int value;
-} __attribute__((packed));
-
-static int
-tree_search_h(struct file *file, unsigned int search)
-{
- unsigned char *p=file->begin,*end;
- int last,i=0,value,lower;
- struct tree_hdr_h *thdr;
- struct tree_leaf_h *tleaf;
-
- dbg(1,"enter\n");
- while (i++ < 1000) {
- thdr=(struct tree_hdr_h *)p;
- p+=sizeof(*thdr);
- end=p+thdr->size;
- dbg(1,"@0x%x\n", p-file->begin);
- last=0;
- while (p < end) {
- tleaf=(struct tree_leaf_h *)p;
- p+=sizeof(*tleaf);
- dbg(1,"low:0x%x high:0x%x match:0x%x val:0x%x search:0x%x\n", tleaf->lower, tleaf->higher, tleaf->match, tleaf->value, search);
- value=tleaf->value;
- if (value == search)
- return tleaf->match;
- if (value > search) {
- dbg(1,"lower\n");
- lower=tleaf->lower;
- if (lower)
- last=lower;
- break;
- }
- last=tleaf->higher;
- }
- if (! last || last == -1)
- return 0;
- p=file->begin+last;
- }
- return 0;
-}
-
-static int
-tree_search_v(struct file *file, int offset, int search)
-{
- unsigned char *p=file->begin+offset;
- int i=0,count,next;
- struct tree_hdr_v *thdr;
- struct tree_leaf_v *tleaf;
- while (i++ < 1000) {
- thdr=(struct tree_hdr_v *)p;
- p+=sizeof(*thdr);
- count=L(thdr->count);
- dbg(1,"offset=0x%x count=0x%x\n", p-file->begin, count);
- while (count--) {
- tleaf=(struct tree_leaf_v *)p;
- p+=sizeof(*tleaf);
- dbg(1,"0x%x 0x%x\n", tleaf->key, search);
- if (tleaf->key == search)
- return L(tleaf->value);
- }
- next=L(thdr->next);
- if (! next)
- break;
- p=file->begin+next;
- }
- return 0;
-}
-
-int
-tree_search_hv(char *dirname, char *filename, unsigned int search_h, unsigned int search_v, int *result)
-{
- struct file *f_idx_h, *f_idx_v;
- char buffer[4096];
- int h,v;
-
- dbg(1,"enter(%s, %s, 0x%x, 0x%x, %p)\n",dirname, filename, search_h, search_v, result);
- sprintf(buffer, "%s/%s.h1", dirname, filename);
- f_idx_h=file_create_caseinsensitive(buffer);
- if (! f_idx_h)
- return 0;
- file_mmap(f_idx_h);
- sprintf(buffer, "%s/%s.v1", dirname, filename);
- f_idx_v=file_create_caseinsensitive(buffer);
- dbg(1,"%p %p\n", f_idx_h, f_idx_v);
- if (! f_idx_v) {
- file_destroy(f_idx_h);
- return 0;
- }
- file_mmap(f_idx_v);
- if ((h=tree_search_h(f_idx_h, search_h))) {
- dbg(1,"h=0x%x\n", h);
- if ((v=tree_search_v(f_idx_v, h, search_v))) {
- dbg(1,"v=0x%x\n", v);
- *result=v;
- file_destroy(f_idx_v);
- file_destroy(f_idx_h);
- dbg(1,"return 1\n");
- return 1;
- }
- }
- file_destroy(f_idx_v);
- file_destroy(f_idx_h);
- dbg(1,"return 0\n");
- return 0;
-}
-
-static struct tree_search_node *
-tree_search_enter(struct tree_search *ts, int offset)
-{
- struct tree_search_node *tsn=&ts->nodes[++ts->curr_node];
- unsigned char *p;
- p=ts->f->begin+offset;
- tsn->hdr=(struct tree_hdr *)p;
- tsn->p=p+sizeof(struct tree_hdr);
- tsn->last=tsn->p;
- tsn->end=p+tsn->hdr->size;
- tsn->low=tsn->hdr->low;
- tsn->high=tsn->hdr->low;
- dbg(1,"pos 0x%x addr 0x%x size 0x%x low 0x%x end 0x%x\n", p-ts->f->begin, tsn->hdr->addr, tsn->hdr->size, tsn->hdr->low, tsn->end-ts->f->begin);
- return tsn;
-}
-
-int tree_search_next(struct tree_search *ts, unsigned char **p, int dir)
-{
- struct tree_search_node *tsn=&ts->nodes[ts->curr_node];
-
- if (! *p)
- *p=tsn->p;
- dbg(1,"next *p=%p dir=%d\n", *p, dir);
- dbg(1,"low1=0x%x high1=0x%x\n", tsn->low, tsn->high);
- if (dir <= 0) {
- dbg(1,"down 0x%x\n", tsn->low);
- if (tsn->low != 0xffffffff) {
- tsn=tree_search_enter(ts, tsn->low);
- *p=tsn->p;
- tsn->high=get_u32(p);
- ts->last_node=ts->curr_node;
- dbg(1,"saving last2 %d 0x%x\n", ts->curr_node, tsn->last-ts->f->begin);
- dbg(1,"high2=0x%x\n", tsn->high);
- return 0;
- }
- return -1;
- }
- tsn->low=tsn->high;
- tsn->last=*p;
- tsn->high=get_u32_unal(p);
- dbg(1,"saving last3 %d %p\n", ts->curr_node, tsn->last);
- if (*p < tsn->end)
- return (tsn->low == 0xffffffff ? 1 : 0);
- dbg(1,"end reached high=0x%x\n",tsn->high);
- if (tsn->low != 0xffffffff) {
- dbg(1,"low 0x%x\n", tsn->low);
- tsn=tree_search_enter(ts, tsn->low);
- *p=tsn->p;
- tsn->high=get_u32_unal(p);
- ts->last_node=ts->curr_node;
- dbg(1,"saving last4 %d 0x%x\n", ts->curr_node, tsn->last-ts->f->begin);
- dbg(1,"high4=0x%x\n", tsn->high);
- return 0;
- }
- return -1;
-}
-
-int tree_search_next_lin(struct tree_search *ts, unsigned char **p)
-{
- struct tree_search_node *tsn=&ts->nodes[ts->curr_node];
- int high;
-
- dbg(1,"pos=%d 0x%x\n", ts->curr_node, *p-ts->f->begin);
- if (*p)
- ts->nodes[ts->last_node].last=*p;
- *p=tsn->last;
- for (;;) {
- high=get_u32_unal(p);
- if (*p < tsn->end) {
- ts->last_node=ts->curr_node;
- while (high != 0xffffffff) {
- tsn=tree_search_enter(ts, high);
- dbg(1,"reload %d\n",ts->curr_node);
- high=tsn->low;
- }
- return 1;
- }
- dbg(1,"eon %d 0x%x 0x%x\n", ts->curr_node, *p-ts->f->begin, tsn->end-ts->f->begin);
- if (! ts->curr_node)
- break;
- ts->curr_node--;
- tsn=&ts->nodes[ts->curr_node];
- *p=tsn->last;
- }
-
- return 0;
-}
-
-void
-tree_search_init(char *dirname, char *filename, struct tree_search *ts, int offset)
-{
- char buffer[4096];
- sprintf(buffer, "%s/%s", dirname, filename);
- ts->f=file_create_caseinsensitive(buffer);
- ts->curr_node=-1;
- if (ts->f) {
- file_mmap(ts->f);
- tree_search_enter(ts, offset);
- }
-}
-
-void
-tree_search_free(struct tree_search *ts)
-{
- file_destroy(ts->f);
-}
diff --git a/navit/data/poi_geodownload/Makefile.am b/navit/data/poi_geodownload/Makefile.am
deleted file mode 100644
index 41f25d59..00000000
--- a/navit/data/poi_geodownload/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-SUBDIRS=libmdb
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -I$(srcdir)/libmdb/include -DMODULE=data_poi_geodownload
-moduledata_LTLIBRARIES = libdata_poi_geodownload.la
-libdata_poi_geodownload_la_SOURCES = poi_geodownload.c
-libdata_poi_geodownload_la_LIBADD = -Llibmdb -lmdb
diff --git a/navit/data/poi_geodownload/libmdb/data.c b/navit/data/poi_geodownload/libmdb/data.c
deleted file mode 100644
index e50e57db..00000000
--- a/navit/data/poi_geodownload/libmdb/data.c
+++ /dev/null
@@ -1,856 +0,0 @@
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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.
- */
-
-#include "mdbtools.h"
-#include "time.h"
-#include "math.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-#define OFFSET_MASK 0x1fff
-
-char *mdb_money_to_string(MdbHandle *mdb, int start, char *s);
-static int _mdb_attempt_bind(MdbHandle *mdb,
- MdbColumn *col, unsigned char isnull, int offset, int len);
-static char *mdb_num_to_string(MdbHandle *mdb, int start, int datatype, int prec, int scale);
-int mdb_copy_ole(MdbHandle *mdb, char *dest, int start, int size);
-
-static char date_fmt[64] = "%x %X";
-
-void mdb_set_date_fmt(const char *fmt)
-{
- date_fmt[63] = 0;
- strncpy(date_fmt, fmt, 63);
-}
-
-void mdb_bind_column(MdbTableDef *table, int col_num, void *bind_ptr)
-{
-MdbColumn *col;
-
- /*
- ** the column arrary is 0 based, so decrement to get 1 based parameter
- */
- col=g_ptr_array_index(table->columns, col_num - 1);
- col->bind_ptr = bind_ptr;
-}
-int
-mdb_bind_column_by_name(MdbTableDef *table, gchar *col_name, void *bind_ptr)
-{
- unsigned int i;
- int col_num = -1;
- MdbColumn *col;
-
- for (i=0;i<table->num_cols;i++) {
- col=g_ptr_array_index(table->columns,i);
- if (!strcmp(col->name,col_name)) {
- col_num = col->col_num + 1;
- mdb_bind_column(table, col_num, bind_ptr);
- break;
- }
- }
-
- return col_num;
-}
-void mdb_bind_len(MdbTableDef *table, int col_num, int *len_ptr)
-{
-MdbColumn *col;
-
- col=g_ptr_array_index(table->columns, col_num - 1);
- col->len_ptr = len_ptr;
-}
-
-/**
- * mdb_find_pg_row
- * @mdb: Database file handle
- * @pg_row: Lower byte contains the row number, the upper three contain page
- * @buf: Pointer for returning a pointer to the page
- * @off: Pointer for returning an offset to the row
- * @len: Pointer for returning the length of the row
- *
- * Returns: 0 on success. 1 on failure.
- */
-int mdb_find_pg_row(MdbHandle *mdb, int pg_row, char **buf, int *off, int *len)
-{
- unsigned int pg = pg_row >> 8;
- unsigned int row = pg_row & 0xff;
-
- if (mdb_read_alt_pg(mdb, pg) != mdb->fmt->pg_size)
- return 1;
- mdb_swap_pgbuf(mdb);
- *off = mdb_pg_get_int16(mdb, mdb->fmt->row_count_offset + 2 + (row*2));
- *len = mdb_find_end_of_row(mdb, row) - *off + 1;
- mdb_swap_pgbuf(mdb);
- *buf = mdb->alt_pg_buf;
- return 0;
-}
-
-int
-mdb_find_end_of_row(MdbHandle *mdb, int row)
-{
- MdbFormatConstants *fmt = mdb->fmt;
- int row_end;
-
- /* Search the previous "row start" values for the first non-'lookupflag' one.
- * If we don't find one, then the end of the page is the correct value.
- */
-#if 1
- if (row==0) {
- row_end = fmt->pg_size - 1;
- } else {
- row_end = (mdb_pg_get_int16(mdb, ((fmt->row_count_offset + 2) + (row - 1) * 2)) & OFFSET_MASK) - 1;
- }
- return row_end;
-#else
- int i, row_start;
-
- /* if lookupflag is not set, it's good (deleteflag is ok) */
- for (i = row - 1; i >= 0; i--) {
- row_start = mdb_pg_get_int16(mdb, ((fmt->row_count_offset + 2) + i * 2));
- if (!(row_start & 0x8000)) {
- break;
- }
- }
-
- if (i == -1) {
- row_end = fmt->pg_size - 1;
- } else {
- row_end = (row_start & OFFSET_MASK) - 1;
- }
- return row_end;
-#endif
-}
-int mdb_is_null(unsigned char *null_mask, int col_num)
-{
-int byte_num = (col_num - 1) / 8;
-int bit_num = (col_num - 1) % 8;
-
- if ((1 << bit_num) & null_mask[byte_num]) {
- return 0;
- } else {
- return 1;
- }
-}
-/* bool has to be handled specially because it uses the null bit to store its
-** value*/
-static int
-mdb_xfer_bound_bool(MdbHandle *mdb, MdbColumn *col, int value)
-{
-
- col->cur_value_len = value;
- if (col->bind_ptr) {
- strcpy(col->bind_ptr, value ? "0" : "1");
- }
-
- return 0;
-}
-static int mdb_xfer_bound_ole(MdbHandle *mdb, int start, MdbColumn *col, int len)
-{
- int ret = 0;
- if (len) {
- col->cur_value_start = start;
- col->cur_value_len = len;
- } else {
- col->cur_value_start = 0;
- col->cur_value_len = 0;
- }
- if (col->bind_ptr || col->len_ptr) {
- //ret = mdb_copy_ole(mdb, col->bind_ptr, start, len);
- memcpy(col->bind_ptr, &mdb->pg_buf[start], MDB_MEMO_OVERHEAD);
- }
- if (col->len_ptr) {
- *col->len_ptr = MDB_MEMO_OVERHEAD;
- }
- return ret;
-}
-static int mdb_xfer_bound_data(MdbHandle *mdb, int start, MdbColumn *col, int len)
-{
-int ret;
- //if (!strcmp("Name",col->name)) {
- //printf("start %d %d\n",start, len);
- //}
- if (len) {
- col->cur_value_start = start;
- col->cur_value_len = len;
- } else {
- col->cur_value_start = 0;
- col->cur_value_len = 0;
- }
- if (col->bind_ptr) {
- if (!len) {
- strcpy(col->bind_ptr, "");
- } else if (col->col_type == MDB_NUMERIC) {
- //fprintf(stdout,"len %d size %d\n",len, col->col_size);
- char *str = mdb_num_to_string(mdb, start, col->col_type,
- col->col_prec, col->col_scale);
- strcpy(col->bind_ptr, str);
- g_free(str);
- } else {
- //fprintf(stdout,"len %d size %d\n",len, col->col_size);
- char *str = mdb_col_to_string(mdb, mdb->pg_buf, start,
- col->col_type, len);
- strcpy(col->bind_ptr, str);
-
- }
- ret = strlen(col->bind_ptr);
- if (col->len_ptr) {
- *col->len_ptr = ret;
- }
- return ret;
- }
- return 0;
-}
-int mdb_read_row(MdbTableDef *table, unsigned int row)
-{
- MdbHandle *mdb = table->entry->mdb;
- MdbFormatConstants *fmt = mdb->fmt;
- MdbColumn *col;
- unsigned int i;
- int rc;
- int row_start, row_end;
- int delflag, lookupflag;
- MdbField fields[256];
- int num_fields;
-
- if (table->num_rows <= row)
- return 0;
-
- row_start = mdb_pg_get_int16(mdb, (fmt->row_count_offset + 2) + (row*2));
- row_end = mdb_find_end_of_row(mdb, row);
-
- delflag = lookupflag = 0;
- if (row_start & 0x8000) lookupflag++;
- if (row_start & 0x4000) delflag++;
- row_start &= OFFSET_MASK; /* remove flags */
-#if MDB_DEBUG
- fprintf(stdout,"Row %d bytes %d to %d %s %s\n",
- row, row_start, row_end,
- lookupflag ? "[lookup]" : "",
- delflag ? "[delflag]" : "");
-#endif
-
- if (!table->noskip_del && delflag) {
- row_end = row_start-1;
- return 0;
- }
-
- num_fields = mdb_crack_row(table, row_start, row_end, fields);
- if (!mdb_test_sargs(table, fields, num_fields)) return 0;
-
-#if MDB_DEBUG
- fprintf(stdout,"sarg test passed row %d \n", row);
-#endif
-
-#if MDB_DEBUG
- buffer_dump(mdb->pg_buf, row_start, row_end);
-#endif
-
- /* take advantage of mdb_crack_row() to clean up binding */
- /* use num_cols instead of num_fields -- bsb 03/04/02 */
- for (i = 0; i < table->num_cols; i++) {
- col = g_ptr_array_index(table->columns,fields[i].colnum);
- rc = _mdb_attempt_bind(mdb, col, fields[i].is_null,
- fields[i].start, fields[i].siz);
- }
-
- return 1;
-}
-static int _mdb_attempt_bind(MdbHandle *mdb,
- MdbColumn *col,
- unsigned char isnull,
- int offset,
- int len)
-{
- if (col->col_type == MDB_BOOL) {
- mdb_xfer_bound_bool(mdb, col, isnull);
- } else if (isnull) {
- mdb_xfer_bound_data(mdb, 0, col, 0);
- } else if (col->col_type == MDB_OLE) {
- mdb_xfer_bound_ole(mdb, offset, col, len);
- } else {
- //if (!mdb_test_sargs(mdb, col, offset, len)) {
- //return 0;
- //}
- mdb_xfer_bound_data(mdb, offset, col, len);
- }
- return 1;
-}
-int mdb_read_next_dpg(MdbTableDef *table)
-{
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
- int next_pg;
-
-#ifndef SLOW_READ
- next_pg = mdb_map_find_next(mdb, table->usage_map,
- table->map_sz, table->cur_phys_pg);
-
- if (next_pg >= 0) {
- if (mdb_read_pg(mdb, next_pg)) {
- table->cur_phys_pg = next_pg;
- return table->cur_phys_pg;
- } else {
- return 0;
- }
- }
- fprintf(stderr, "Warning: defaulting to brute force read\n");
-#endif
- /* can't do a fast read, go back to the old way */
- do {
- if (!mdb_read_pg(mdb, table->cur_phys_pg++))
- return 0;
- } while (mdb->pg_buf[0]!=0x01 || mdb_pg_get_int32(mdb, 4)!=entry->table_pg);
- /* fprintf(stderr,"returning new page %ld\n", table->cur_phys_pg); */
- return table->cur_phys_pg;
-}
-int mdb_rewind_table(MdbTableDef *table)
-{
- table->cur_pg_num=0;
- table->cur_phys_pg=0;
- table->cur_row=0;
-
- return 0;
-}
-int
-mdb_fetch_row(MdbTableDef *table)
-{
- MdbHandle *mdb = table->entry->mdb;
- MdbFormatConstants *fmt = mdb->fmt;
- unsigned int rows;
- int rc;
- guint32 pg;
-
- if (table->num_rows==0)
- return 0;
-
- /* initialize */
- if (!table->cur_pg_num) {
- table->cur_pg_num=1;
- table->cur_row=0;
- if ((!table->is_temp_table)&&(table->strategy!=MDB_INDEX_SCAN))
- if (!mdb_read_next_dpg(table)) return 0;
- }
-
- do {
- if (table->is_temp_table) {
- GPtrArray *pages = table->temp_table_pages;
- rows = mdb_get_int16(
- g_ptr_array_index(pages, table->cur_pg_num-1),
- fmt->row_count_offset);
- if (table->cur_row >= rows) {
- table->cur_row = 0;
- table->cur_pg_num++;
- if (table->cur_pg_num > pages->len)
- return 0;
- }
- memcpy(mdb->pg_buf,
- g_ptr_array_index(pages, table->cur_pg_num-1),
- fmt->pg_size);
- } else if (table->strategy==MDB_INDEX_SCAN) {
-
- if (!mdb_index_find_next(table->mdbidx, table->scan_idx, table->chain, &pg, (guint16 *) &(table->cur_row))) {
- mdb_index_scan_free(table);
- return 0;
- }
- mdb_read_pg(mdb, pg);
- } else {
- rows = mdb_pg_get_int16(mdb,fmt->row_count_offset);
-
- /* if at end of page, find a new page */
- if (table->cur_row >= rows) {
- table->cur_row=0;
-
- if (!mdb_read_next_dpg(table)) {
- return 0;
- }
- }
- }
-
- /* printf("page %d row %d\n",table->cur_phys_pg, table->cur_row); */
- rc = mdb_read_row(table, table->cur_row);
- table->cur_row++;
- } while (!rc);
-
- return 1;
-}
-void mdb_data_dump(MdbTableDef *table)
-{
- unsigned int i;
- char *bound_values[MDB_MAX_COLS];
-
- for (i=0;i<table->num_cols;i++) {
- bound_values[i] = (char *) g_malloc(256);
- mdb_bind_column(table, i+1, bound_values[i]);
- }
- mdb_rewind_table(table);
- while (mdb_fetch_row(table)) {
- for (i=0;i<table->num_cols;i++) {
- fprintf(stdout, "column %d is %s\n", i+1, bound_values[i]);
- }
- }
- for (i=0;i<table->num_cols;i++) {
- g_free(bound_values[i]);
- }
-}
-
-int mdb_is_fixed_col(MdbColumn *col)
-{
- return col->is_fixed;
-}
-#if 0
-static char *mdb_data_to_hex(MdbHandle *mdb, char *text, int start, int size)
-{
-int i;
-
- for (i=start; i<start+size; i++) {
- sprintf(&text[(i-start)*2],"%02x", mdb->pg_buf[i]);
- }
- text[(i-start)*2]='\0';
-
- return text;
-}
-#endif
-int
-mdb_ole_read_next(MdbHandle *mdb, MdbColumn *col, void *ole_ptr)
-{
- guint16 ole_len;
- guint16 ole_flags;
- char *buf;
- int pg_row, row_start;
- int len;
-
- ole_len = mdb_get_int16(ole_ptr, 0);
- ole_flags = mdb_get_int16(ole_ptr, 2);
-
- if (ole_flags == 0x8000) {
- /* inline fields don't have a next */
- return 0;
- } else if (ole_flags == 0x4000) {
- /* 0x4000 flagged ole's are contained on one page and thus
- * should be handled entirely with mdb_ole_read() */
- return 0;
- } else if (ole_flags == 0x0000) {
- pg_row = (col->cur_blob_pg << 8) & col->cur_blob_row;
- if (mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &len)) {
- return 0;
- }
- if (col->bind_ptr)
- memcpy(col->bind_ptr, buf + row_start, len);
- pg_row = mdb_get_int32(buf, row_start);
- col->cur_blob_pg = pg_row >> 8;
- col->cur_blob_row = pg_row & 0xff;
-
- return len;
- }
- return 0;
-}
-int
-mdb_ole_read(MdbHandle *mdb, MdbColumn *col, void *ole_ptr, int chunk_size)
-{
- guint16 ole_len;
- guint16 ole_flags;
- char *buf;
- int pg_row, row_start;
- int len;
-
- ole_len = mdb_get_int16(ole_ptr, 0);
- ole_flags = mdb_get_int16(ole_ptr, 2);
- mdb_debug(MDB_DEBUG_OLE,"ole len = %d ole flags = %08x",
- ole_len, ole_flags);
-
- col->chunk_size = chunk_size;
-
- if (ole_flags == 0x8000) {
- /* inline ole field, if we can satisfy it, then do it */
- len = col->cur_value_len - MDB_MEMO_OVERHEAD;
- if (chunk_size >= len) {
- if (col->bind_ptr)
- memcpy(col->bind_ptr,
- &mdb->pg_buf[col->cur_value_start +
- MDB_MEMO_OVERHEAD],
- len);
- return len;
- } else {
- return 0;
- }
- } else if (ole_flags == 0x4000) {
- pg_row = mdb_get_int32(ole_ptr, 4);
- col->cur_blob_pg = pg_row >> 8;
- col->cur_blob_row = pg_row & 0xff;
- mdb_debug(MDB_DEBUG_OLE,"ole row = %d ole pg = %ld",
- col->cur_blob_row, col->cur_blob_pg);
-
- if (mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &len)) {
- return 0;
- }
- mdb_debug(MDB_DEBUG_OLE,"start %d len %d", row_start, len);
-
- if (col->bind_ptr) {
- memcpy(col->bind_ptr, buf + row_start, len);
- if (mdb_get_option(MDB_DEBUG_OLE))
- buffer_dump(col->bind_ptr, 0, 16);
- }
- return len;
- } else if (ole_flags == 0x0000) {
- pg_row = mdb_get_int32(ole_ptr, 4);
- col->cur_blob_pg = pg_row >> 8;
- col->cur_blob_row = pg_row & 0xff;
-
- if (mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &len)) {
- return 0;
- }
-
- if (col->bind_ptr)
- memcpy(col->bind_ptr, buf + row_start, len);
-
- pg_row = mdb_get_int32(buf, row_start);
- col->cur_blob_pg = pg_row >> 8;
- col->cur_blob_row = pg_row & 0xff;
-
- return len;
- } else {
- fprintf(stderr,"Unhandled ole field flags = %04x\n", ole_flags);
- return 0;
- }
-}
-int mdb_copy_ole(MdbHandle *mdb, char *dest, int start, int size)
-{
- guint16 ole_len;
- guint16 ole_flags;
- guint32 row_start, pg_row;
- guint32 len;
- char *buf;
-
- if (size<MDB_MEMO_OVERHEAD) {
- return 0;
- }
-
- /* The 16 bit integer at offset 0 is the length of the memo field.
- * The 32 bit integer at offset 4 contains page and row information.
- */
- ole_len = mdb_pg_get_int16(mdb, start);
- ole_flags = mdb_pg_get_int16(mdb, start+2);
-
- if (ole_flags == 0x8000) {
- len = size - MDB_MEMO_OVERHEAD;
- /* inline ole field */
- if (dest) memcpy(dest, &mdb->pg_buf[start + MDB_MEMO_OVERHEAD],
- size - MDB_MEMO_OVERHEAD);
- return len;
- } else if (ole_flags == 0x4000) {
- pg_row = mdb_get_int32(mdb->pg_buf, start+4);
- mdb_debug(MDB_DEBUG_OLE,"Reading LVAL page %06x", pg_row >> 8);
-
- if (mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &len)) {
- return 0;
- }
- mdb_debug(MDB_DEBUG_OLE,"row num %d start %d len %d",
- pg_row & 0xff, row_start, len);
-
- if (dest)
- memcpy(dest, buf + row_start, len);
- return len;
- } else if (ole_flags == 0x0000) {
- int cur = 0;
- pg_row = mdb_get_int32(mdb->pg_buf, start+4);
- mdb_debug(MDB_DEBUG_OLE,"Reading LVAL page %06x", pg_row >> 8);
- do {
- if (mdb_find_pg_row(mdb,pg_row,&buf,&row_start,&len)) {
- return 0;
- }
-
- mdb_debug(MDB_DEBUG_OLE,"row num %d start %d len %d",
- pg_row & 0xff, row_start, len);
-
- if (dest)
- memcpy(dest+cur, buf + row_start + 4, len - 4);
- cur += len - 4;
-
- /* find next lval page */
- pg_row = mdb_get_int32(buf, row_start);
- } while ((pg_row >> 8));
- return cur;
- } else {
- fprintf(stderr,"Unhandled ole field flags = %04x\n", ole_flags);
- return 0;
- }
-}
-static char *mdb_memo_to_string(MdbHandle *mdb, int start, int size)
-{
- guint16 memo_len;
- static char text[MDB_BIND_SIZE];
- guint16 memo_flags;
- guint32 row_start, pg_row;
- guint32 len;
- char *buf;
-
- if (size<MDB_MEMO_OVERHEAD) {
- return "";
- }
-
-#if MDB_DEBUG
- buffer_dump(mdb->pg_buf, start, start + 12);
-#endif
-
- /* The 16 bit integer at offset 0 is the length of the memo field.
- * The 32 bit integer at offset 4 contains page and row information.
- */
- memo_len = mdb_pg_get_int16(mdb, start);
- memo_flags = mdb_pg_get_int16(mdb, start+2);
-
- if (memo_flags & 0x8000) {
- /* inline memo field */
- strncpy(text, &mdb->pg_buf[start + MDB_MEMO_OVERHEAD],
- size - MDB_MEMO_OVERHEAD);
- text[size - MDB_MEMO_OVERHEAD]='\0';
- return text;
- } else if (memo_flags & 0x4000) {
- pg_row = mdb_get_int32(mdb->pg_buf, start+4);
-#if MDB_DEBUG
- printf("Reading LVAL page %06x\n", pg_row >> 8);
-#endif
- if (mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &len)) {
- return "";
- }
-#if MDB_DEBUG
- printf("row num %d start %d len %d\n",
- pg_row & 0xff, row_start, len);
- buffer_dump(mdb->pg_buf, row_start, row_start + len);
-#endif
- if (IS_JET3(mdb)) {
- strncpy(text, buf + row_start, len);
- text[len]='\0';
- } else {
- mdb_unicode2ascii(mdb, buf, row_start, len, text);
- }
- return text;
- } else { /* if (memo_flags == 0x0000) { */
- pg_row = mdb_get_int32(mdb->pg_buf, start+4);
-#if MDB_DEBUG
- printf("Reading LVAL page %06x\n", pg_row >> 8);
-#endif
- text[0]='\0';
- do {
- if (mdb_find_pg_row(mdb,pg_row,&buf,&row_start,&len)) {
- return "";
- }
-#if MDB_DEBUG
- printf("row num %d start %d len %d\n",
- pg_row & 0xff, row_start, len);
-#endif
- strncat(text, buf + row_start + 4,
- strlen(text) + len - 4 > MDB_BIND_SIZE ?
- MDB_BIND_SIZE - strlen(text) : len - 4);
-
- /* find next lval page */
- pg_row = mdb_get_int32(mdb->pg_buf, row_start);
- } while ((pg_row >> 8));
- return text;
-/*
- } else {
- fprintf(stderr,"Unhandled memo field flags = %04x\n", memo_flags);
- return "";
-*/
- }
-}
-static char *
-mdb_num_to_string(MdbHandle *mdb, int start, int datatype, int prec, int scale)
-{
- char *text;
- gint32 l;
-
- memcpy(&l, mdb->pg_buf+start+13, 4);
-
- text = (char *) g_malloc(prec+2);
- sprintf(text, "%0*" G_GINT32_FORMAT, prec, GINT32_FROM_LE(l));
- if (scale) {
- memmove(text+prec-scale, text+prec-scale+1, scale+1);
- text[prec-scale] = '.';
- }
- return text;
-}
-
-static int trim_trailing_zeros(char * buff, int n)
-{
- char * p = buff + n - 1;
-
- while (p >= buff && *p == '0')
- *p-- = '\0';
-
- if (*p == '.')
- *p = '\0';
-
- return 0;
-}
-
-char *mdb_col_to_string(MdbHandle *mdb, unsigned char *buf, int start, int datatype, int size)
-{
- /* FIX ME -- not thread safe */
- static char text[MDB_BIND_SIZE];
- time_t t;
- int n;
- float tf;
- double td;
-
- switch (datatype) {
- case MDB_BOOL:
- /* shouldn't happen. bools are handled specially
- ** by mdb_xfer_bound_bool() */
- break;
- case MDB_BYTE:
- sprintf(text,"%d",mdb_get_byte(buf, start));
- return text;
- break;
- case MDB_INT:
- sprintf(text,"%ld",(long)mdb_get_int16(buf, start));
- return text;
- break;
- case MDB_LONGINT:
- sprintf(text,"%ld",mdb_get_int32(buf, start));
- return text;
- break;
- case MDB_FLOAT:
- tf = mdb_get_single(mdb->pg_buf, start);
- n = sprintf(text,"%.*f",FLT_DIG - (int)ceil(log10(tf)), tf);
- trim_trailing_zeros(text, n);
- return text;
- break;
- case MDB_DOUBLE:
- td = mdb_get_double(mdb->pg_buf, start);
- n = sprintf(text,"%.*f",DBL_DIG - (int)ceil(log10(td)), td);
- trim_trailing_zeros(text, n);
- return text;
- break;
- case MDB_TEXT:
- if (size<0) {
- return "";
- }
- if (IS_JET4(mdb)) {
-/*
- int i;
- for (i=0;i<size;i++) {
- fprintf(stdout, "%c %02x ", mdb->pg_buf[start+i], mdb->pg_buf[start+i]);
- }
- fprintf(stdout, "\n");
-*/
- mdb_unicode2ascii(mdb, mdb->pg_buf, start, size, text);
- } else {
- strncpy(text, &buf[start], size);
- text[size]='\0';
- }
- return text;
- break;
- case MDB_SDATETIME:
- td = mdb_get_double(mdb->pg_buf, start);
- if (td > 1) {
- t = (long int)((td - 25569.0) * 86400.0);
- } else {
- t = (long int)(td * 86400.0);
- }
- strftime(text, MDB_BIND_SIZE, date_fmt, (struct tm*)gmtime(&t));
- return text;
-
- break;
- case MDB_MEMO:
- return mdb_memo_to_string(mdb, start, size);
- break;
- case MDB_MONEY:
- mdb_money_to_string(mdb, start, text);
- return text;
- case MDB_NUMERIC:
- break;
- default:
- return "";
- break;
- }
- return NULL;
-}
-int mdb_col_disp_size(MdbColumn *col)
-{
- switch (col->col_type) {
- case MDB_BOOL:
- return 1;
- break;
- case MDB_BYTE:
- return 4;
- break;
- case MDB_INT:
- return 6;
- break;
- case MDB_LONGINT:
- return 11;
- break;
- case MDB_FLOAT:
- return 10;
- break;
- case MDB_DOUBLE:
- return 10;
- break;
- case MDB_TEXT:
- return col->col_size;
- break;
- case MDB_SDATETIME:
- return 20;
- break;
- case MDB_MEMO:
- return 255;
- break;
- case MDB_MONEY:
- return 21;
- break;
- }
- return 0;
-}
-int mdb_col_fixed_size(MdbColumn *col)
-{
- switch (col->col_type) {
- case MDB_BOOL:
- return 1;
- break;
- case MDB_BYTE:
- return -1;
- break;
- case MDB_INT:
- return 2;
- break;
- case MDB_LONGINT:
- return 4;
- break;
- case MDB_FLOAT:
- return 4;
- break;
- case MDB_DOUBLE:
- return 8;
- break;
- case MDB_TEXT:
- return -1;
- break;
- case MDB_SDATETIME:
- return 4;
- break;
- case MDB_MEMO:
- return -1;
- break;
- case MDB_MONEY:
- return 8;
- break;
- }
- return 0;
-}
diff --git a/navit/data/poi_geodownload/libmdb/dump.c b/navit/data/poi_geodownload/libmdb/dump.c
deleted file mode 100644
index 7ee17f9a..00000000
--- a/navit/data/poi_geodownload/libmdb/dump.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <ctype.h>
-#include <string.h>
-#include <stdio.h>
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-void buffer_dump(const unsigned char* buf, int start, int end)
-{
- char asc[20];
- int j, k;
-
- memset(asc, 0, sizeof(asc));
- k = 0;
- for (j=start; j<=end; j++) {
- if (k == 0) {
- fprintf(stdout, "%04x ", j);
- }
- fprintf(stdout, "%02x ", buf[j]);
- asc[k] = isprint(buf[j]) ? buf[j] : '.';
- k++;
- if (k == 8) {
- fprintf(stdout, " ");
- }
- if (k == 16) {
- fprintf(stdout, " %s\n", asc);
- memset(asc, 0, sizeof(asc));
- k = 0;
- }
- }
- for (j=k; j<16; j++) {
- fprintf(stdout, " ");
- }
- if (k < 8) {
- fprintf(stdout, " ");
- }
- fprintf(stdout, " %s\n", asc);
-}
diff --git a/navit/data/poi_geodownload/libmdb/file.c b/navit/data/poi_geodownload/libmdb/file.c
deleted file mode 100644
index 941830c5..00000000
--- a/navit/data/poi_geodownload/libmdb/file.c
+++ /dev/null
@@ -1,376 +0,0 @@
-/* MDB Tools - A library for reading MS Access database files
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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.
- */
-
-#include "mdbtools.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-/*
-typedef struct {
- int pg_size;
- guint16 row_count_offset;
- guint16 tab_num_rows_offset;
- guint16 tab_num_cols_offset;
- guint16 tab_num_idxs_offset;
- guint16 tab_num_ridxs_offset;
- guint16 tab_usage_map_offset;
- guint16 tab_first_dpg_offset;
- guint16 tab_cols_start_offset;
- guint16 tab_ridx_entry_size;
- guint16 col_fixed_offset;
- guint16 col_size_offset;
- guint16 col_num_offset;
- guint16 tab_col_entry_size;
- guint16 tab_free_map_offset;
- guint16 tab_col_offset_var;
- guint16 tab_col_offset_fixed;
- guint16 tab_row_col_num_offset;
-} MdbFormatConstants;
-*/
-MdbFormatConstants MdbJet4Constants = {
- 4096, 0x0c, 16, 45, 47, 51, 55, 56, 63, 12, 15, 23, 5, 25, 59, 7, 21, 9
-};
-MdbFormatConstants MdbJet3Constants = {
- 2048, 0x08, 12, 25, 27, 31, 35, 36, 43, 8, 13, 16, 1, 18, 39, 3, 14, 5 /* not sure on 5, need to check */
-};
-
-static ssize_t _mdb_read_pg(MdbHandle *mdb, unsigned char *pg_buf, unsigned long pg);
-
-/**
- * mdb_find_file:
- * @filename: path to MDB (database) file
- *
- * Finds and returns the absolute path to an MDB file. Function will first try
- * to fstat file as passed, then search through the $MDBPATH if not found.
- *
- * Return value: gchar pointer to absolute path. Caller is responsible for
- * freeing.
- **/
-
-static gchar *mdb_find_file(char *file_name)
-{
- struct stat status;
- gchar *mdbpath, **dir, *tmpfname;
- unsigned int i = 0;
-
- /* try the provided file name first */
- if (!stat(file_name, &status)) {
- return g_strdup(file_name);
- }
-
- /* Now pull apart $MDBPATH and try those */
- mdbpath = (gchar *) getenv("MDBPATH");
- /* no path, can't find file */
- if (!mdbpath || !strlen(mdbpath)) return NULL;
-
- dir = g_strsplit(mdbpath, ":", 0);
- while (dir[i]) {
- if (!strlen(dir[i])) continue;
- tmpfname = g_strconcat(dir[i++], "/", file_name, NULL);
- if (!stat(tmpfname, &status)) {
- g_strfreev(dir);
- return tmpfname;
- }
- g_free(tmpfname);
- }
- g_strfreev(dir);
- return NULL;
-}
-/**
- * mdb_open:
- * @filename: path to MDB (database) file
- * @flags: MDB_NOFLAGS for read-only, MDB_WRITABLE for read/write
- *
- * Opens an MDB file and returns an MdbHandle to it. MDB File may be relative
- * to the current directory, a full path to the file, or relative to a
- * component of $MDBPATH.
- *
- * Return value: pointer to MdbHandle structure.
- **/
-MdbHandle *mdb_open(char *filename, MdbFileFlags flags)
-{
- MdbHandle *mdb;
-
- mdb = (MdbHandle *) g_malloc0(sizeof(MdbHandle));
- mdb_set_default_backend(mdb, "access");
- /* need something to bootstrap with, reassign after page 0 is read */
- mdb->fmt = &MdbJet3Constants;
- mdb->f = (MdbFile *) g_malloc0(sizeof(MdbFile));
- mdb->f->refs = 1;
- mdb->f->fd = -1;
- mdb->f->filename = (char *) mdb_find_file(filename);
- if (!mdb->f->filename) {
- fprintf(stderr, "Can't alloc filename\n");
- mdb_close(mdb);
- return NULL;
- }
- if (flags & MDB_WRITABLE) {
- mdb->f->writable = TRUE;
- mdb->f->fd = open(mdb->f->filename,O_RDWR);
- } else {
- mdb->f->fd = open(mdb->f->filename,O_RDONLY);
- }
-
- if (mdb->f->fd==-1) {
- fprintf(stderr,"Couldn't open file %s\n",mdb->f->filename);
- mdb_close(mdb);
- return NULL;
- }
- if (!mdb_read_pg(mdb, 0)) {
- fprintf(stderr,"Couldn't read first page.\n");
- mdb_close(mdb);
- return NULL;
- }
- if (mdb->pg_buf[0] != 0) {
- mdb_close(mdb);
- return NULL;
- }
- mdb->f->jet_version = mdb_pg_get_int32(mdb, 0x14);
- if (IS_JET4(mdb)) {
- mdb->fmt = &MdbJet4Constants;
- } else if (IS_JET3(mdb)) {
- mdb->fmt = &MdbJet3Constants;
- } else {
- fprintf(stderr,"Unknown Jet version.\n");
- mdb_close(mdb);
- return NULL;
- }
-
- return mdb;
-}
-
-/**
- * mdb_close:
- * @mdb: Handle to open MDB database file
- *
- * Dereferences MDB file, closes if reference count is 0, and destroys handle.
- *
- **/
-void
-mdb_close(MdbHandle *mdb)
-{
- if (!mdb) return;
- mdb_free_catalog(mdb);
- g_free(mdb->stats);
- g_free(mdb->backend_name);
-
- if (mdb->f) {
- if (mdb->f->refs > 1) {
- mdb->f->refs--;
- } else {
- if (mdb->f->fd != -1) close(mdb->f->fd);
- g_free(mdb->f->filename);
- g_free(mdb->f);
- }
- }
-
- g_free(mdb);
-}
-/**
- * mdb_clone_handle:
- * @mdb: Handle to open MDB database file
- *
- * Clones an existing database handle. Cloned handle shares the file descriptor
- * but has its own page buffer, page position, and similar internal variables.
- *
- * Return value: new handle to the database.
- */
-MdbHandle *mdb_clone_handle(MdbHandle *mdb)
-{
- MdbHandle *newmdb;
- MdbCatalogEntry *entry, *data;
- unsigned int i;
-
- newmdb = (MdbHandle *) g_memdup(mdb, sizeof(MdbHandle));
- newmdb->stats = NULL;
- newmdb->catalog = g_ptr_array_new();
- for (i=0;i<mdb->num_catalog;i++) {
- entry = g_ptr_array_index(mdb->catalog,i);
- data = g_memdup(entry,sizeof(MdbCatalogEntry));
- g_ptr_array_add(newmdb->catalog, data);
- }
- mdb->backend_name = NULL;
- if (mdb->f) {
- mdb->f->refs++;
- }
- return newmdb;
-}
-
-/*
-** mdb_read a wrapper for read that bails if anything is wrong
-*/
-ssize_t mdb_read_pg(MdbHandle *mdb, unsigned long pg)
-{
- ssize_t len;
-
- if (pg && mdb->cur_pg == pg) return mdb->fmt->pg_size;
-
- len = _mdb_read_pg(mdb, mdb->pg_buf, pg);
- //fprintf(stderr, "read page %d type %02x\n", pg, mdb->pg_buf[0]);
- mdb->cur_pg = pg;
- /* kan - reset the cur_pos on a new page read */
- mdb->cur_pos = 0; /* kan */
- return len;
-}
-ssize_t mdb_read_alt_pg(MdbHandle *mdb, unsigned long pg)
-{
- ssize_t len;
-
- len = _mdb_read_pg(mdb, mdb->alt_pg_buf, pg);
- return len;
-}
-static ssize_t _mdb_read_pg(MdbHandle *mdb, unsigned char *pg_buf, unsigned long pg)
-{
- ssize_t len;
- struct stat status;
- off_t offset = pg * mdb->fmt->pg_size;
-
- fstat(mdb->f->fd, &status);
- if (status.st_size < offset) {
- fprintf(stderr,"offset %lu is beyond EOF\n",offset);
- return 0;
- }
- if (mdb->stats && mdb->stats->collect)
- mdb->stats->pg_reads++;
-
- lseek(mdb->f->fd, offset, SEEK_SET);
- len = read(mdb->f->fd,pg_buf,mdb->fmt->pg_size);
- if (len==-1) {
- perror("read");
- return 0;
- }
- else if (len<mdb->fmt->pg_size) {
- /* fprintf(stderr,"EOF reached %d bytes returned.\n",len, mdb->fmt->pg_size); */
- return 0;
- }
- return len;
-}
-void mdb_swap_pgbuf(MdbHandle *mdb)
-{
-char tmpbuf[MDB_PGSIZE];
-
- memcpy(tmpbuf,mdb->pg_buf, MDB_PGSIZE);
- memcpy(mdb->pg_buf,mdb->alt_pg_buf, MDB_PGSIZE);
- memcpy(mdb->alt_pg_buf,tmpbuf,MDB_PGSIZE);
-}
-
-
-/* really stupid, just here for consistancy */
-unsigned char mdb_get_byte(unsigned char *buf, int offset)
-{
- return buf[offset];
-}
-unsigned char mdb_pg_get_byte(MdbHandle *mdb, int offset)
-{
- if (offset < 0 || offset+1 > mdb->fmt->pg_size) return -1;
- mdb->cur_pos++;
- return mdb->pg_buf[offset];
-}
-
-int mdb_get_int16(unsigned char *buf, int offset)
-{
- return buf[offset+1]*256+buf[offset];
-}
-int mdb_pg_get_int16(MdbHandle *mdb, int offset)
-{
- if (offset < 0 || offset+2 > mdb->fmt->pg_size) return -1;
- mdb->cur_pos+=2;
- return mdb_get_int16(mdb->pg_buf, offset);
-}
-
-gint32 mdb_pg_get_int24_msb(MdbHandle *mdb, int offset)
-{
- gint32 l = 0;
- if (offset <0 || offset+3 > mdb->fmt->pg_size) return -1;
- mdb->cur_pos+=3;
- memcpy((char *)&l+1, &(mdb->pg_buf[offset]), 3);
-#if 0
- printf("l=0x%08x 0x%08x\n",l,GINT32_FROM_BE(l));
-#endif
- return GINT32_FROM_BE(l);
-}
-gint32 mdb_get_int24(unsigned char *buf, int offset)
-{
- gint32 l = 0;
- memcpy(&l, &buf[offset], 3);
- return GINT32_FROM_LE(l);
-}
-gint32 mdb_pg_get_int24(MdbHandle *mdb, int offset)
-{
- if (offset <0 || offset+3 > mdb->fmt->pg_size) return -1;
- mdb->cur_pos+=3;
- return mdb_get_int24(mdb->pg_buf, offset);
-}
-
-long mdb_get_int32(unsigned char *buf, int offset)
-{
- guint32 l;
- memcpy(&l, &buf[offset], 4);
- return (long)GINT32_FROM_LE(l);
-}
-long mdb_pg_get_int32(MdbHandle *mdb, int offset)
-{
- if (offset <0 || offset+4 > mdb->fmt->pg_size) return -1;
- mdb->cur_pos+=4;
- return mdb_get_int32(mdb->pg_buf, offset);
-}
-
-float mdb_get_single(unsigned char *buf, int offset)
-{
- union {guint32 g; float f;} f;
- memcpy(&f, &buf[offset], 4);
- f.g = GUINT32_FROM_LE(f.g);
- return f.f;
-}
-float mdb_pg_get_single(MdbHandle *mdb, int offset)
-{
- if (offset <0 || offset+4 > mdb->fmt->pg_size) return -1;
- mdb->cur_pos+=4;
- return mdb_get_single(mdb->pg_buf, offset);
-}
-
-double mdb_get_double(unsigned char *buf, int offset)
-{
- union {guint64 g; double d;} d;
- memcpy(&d, &buf[offset], 8);
- d.g = GUINT64_FROM_LE(d.g);
- return d.d;
-}
-double mdb_pg_get_double(MdbHandle *mdb, int offset)
-{
- if (offset <0 || offset+8 > mdb->fmt->pg_size) return -1;
- mdb->cur_pos+=8;
- return mdb_get_double(mdb->pg_buf, offset);
-}
-
-
-int
-mdb_set_pos(MdbHandle *mdb, int pos)
-{
- if (pos<0 || pos >= mdb->fmt->pg_size) return 0;
-
- mdb->cur_pos=pos;
- return pos;
-}
-int mdb_get_pos(MdbHandle *mdb)
-{
- return mdb->cur_pos;
-}
diff --git a/navit/data/poi_geodownload/libmdb/iconv.c b/navit/data/poi_geodownload/libmdb/iconv.c
deleted file mode 100644
index 9f41afe3..00000000
--- a/navit/data/poi_geodownload/libmdb/iconv.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* MDB Tools - A library for reading MS Access database files
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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.
- */
-
-#include "mdbtools.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-int
-mdb_unicode2ascii(MdbHandle *mdb, unsigned char *buf, int offset, unsigned int len, char *dest)
-{
- unsigned int i;
-
- if (buf[offset]==0xff && buf[offset+1]==0xfe) {
- strncpy(dest, &buf[offset+2], len-2);
- dest[len-2]='\0';
- } else {
- /* convert unicode to ascii, rather sloppily */
- for (i=0;i<len;i+=2)
- dest[i/2] = buf[offset + i];
- dest[len/2]='\0';
- }
- return len;
-}
-
-int
-mdb_ascii2unicode(MdbHandle *mdb, unsigned char *buf, int offset, unsigned int len, char *dest)
-{
- unsigned int i = 0;
-
- if (!buf) return 0;
-
- if (IS_JET3(mdb)) {
- strncpy(dest, &buf[offset], len);
- dest[len]='\0';
- return strlen(dest);
- }
-
- while (i<strlen(&buf[offset]) && (i*2+2)<len) {
- dest[i*2] = buf[offset+i];
- dest[i*2+1] = 0;
- i++;
- }
-
- return (i*2);
-}
diff --git a/navit/data/poi_geodownload/libmdb/include/mdbtools.h b/navit/data/poi_geodownload/libmdb/include/mdbtools.h
deleted file mode 100644
index b17df280..00000000
--- a/navit/data/poi_geodownload/libmdb/include/mdbtools.h
+++ /dev/null
@@ -1,536 +0,0 @@
-/* MDB Tools - A library for reading MS Access database files
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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.
- */
-
-#ifndef _mdbtools_h_
-#define _mdbtools_h_
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <string.h>
-#include <glib.h>
-
-#ifdef HAVE_ICONV
-#include <iconv.h>
-#endif
-
-#define MDB_DEBUG 0
-
-#define MDB_PGSIZE 4096
-#define MDB_MAX_OBJ_NAME 256
-#define MDB_MAX_COLS 256
-#define MDB_MAX_IDX_COLS 10
-#define MDB_CATALOG_PG 18
-#define MDB_MEMO_OVERHEAD 12
-#define MDB_BIND_SIZE 16384
-
-enum {
- MDB_PAGE_DB = 0,
- MDB_PAGE_DATA,
- MDB_PAGE_TABLE,
- MDB_PAGE_INDEX,
- MDB_PAGE_LEAF,
- MDB_PAGE_MAP
-};
-enum {
- MDB_VER_JET3 = 0,
- MDB_VER_JET4 = 1
-};
-enum {
- MDB_FORM = 0,
- MDB_TABLE,
- MDB_MACRO,
- MDB_SYSTEM_TABLE,
- MDB_REPORT,
- MDB_QUERY,
- MDB_LINKED_TABLE,
- MDB_MODULE,
- MDB_RELATIONSHIP,
- MDB_UNKNOWN_09,
- MDB_UNKNOWN_0A,
- MDB_DATABASE_PROPERTY,
- MDB_ANY = -1
-};
-enum {
- MDB_BOOL = 0x01,
- MDB_BYTE = 0x02,
- MDB_INT = 0x03,
- MDB_LONGINT = 0x04,
- MDB_MONEY = 0x05,
- MDB_FLOAT = 0x06,
- MDB_DOUBLE = 0x07,
- MDB_SDATETIME = 0x08,
- MDB_TEXT = 0x0a,
- MDB_OLE = 0x0b,
- MDB_MEMO = 0x0c,
- MDB_REPID = 0x0f,
- MDB_NUMERIC = 0x10
-};
-
-/* SARG operators */
-enum {
- MDB_OR = 1,
- MDB_AND,
- MDB_NOT,
- MDB_EQUAL,
- MDB_GT,
- MDB_LT,
- MDB_GTEQ,
- MDB_LTEQ,
- MDB_LIKE,
- MDB_ISNULL,
- MDB_NOTNULL
-};
-
-typedef enum {
- MDB_TABLE_SCAN,
- MDB_LEAF_SCAN,
- MDB_INDEX_SCAN
-} MdbStrategy;
-
-typedef enum {
- MDB_NOFLAGS = 0x00,
- MDB_WRITABLE = 0x01
-} MdbFileFlags;
-
-enum {
- MDB_DEBUG_LIKE = 0x0001,
- MDB_DEBUG_WRITE = 0x0002,
- MDB_DEBUG_USAGE = 0x0004,
- MDB_DEBUG_OLE = 0x0008,
- MDB_DEBUG_ROW = 0x0010,
- MDB_USE_INDEX = 0x0020
-};
-
-#define mdb_is_logical_op(x) (x == MDB_OR || \
- x == MDB_AND || \
- x == MDB_NOT )
-
-#define mdb_is_relational_op(x) (x == MDB_EQUAL || \
- x == MDB_GT || \
- x == MDB_LT || \
- x == MDB_GTEQ || \
- x == MDB_LTEQ || \
- x == MDB_LIKE || \
- x == MDB_ISNULL || \
- x == MDB_NOTNULL )
-
-enum {
- MDB_ASC,
- MDB_DESC
-};
-
-enum {
- MDB_IDX_UNIQUE = 0x01,
- MDB_IDX_IGNORENULLS = 0x02,
- MDB_IDX_REQUIRED = 0x08
-};
-
-#define IS_JET4(mdb) (mdb->f->jet_version==MDB_VER_JET4)
-#define IS_JET3(mdb) (mdb->f->jet_version==MDB_VER_JET3)
-
-/* hash to store registered backends */
-/* extern GHashTable *mdb_backends; */
-
-/* forward declarations */
-typedef struct mdbindex MdbIndex;
-typedef struct mdbsargtree MdbSargNode;
-
-typedef struct {
- char *name;
- unsigned char needs_length; /* or precision */
- unsigned char needs_scale;
- unsigned char needs_quotes;
-} MdbBackendType;
-
-typedef struct {
- MdbBackendType *types_table;
-} MdbBackend;
-
-typedef struct {
- gboolean collect;
- unsigned long pg_reads;
-} MdbStatistics;
-
-typedef struct {
- int fd;
- gboolean writable;
- char *filename;
- guint32 jet_version;
- guint32 db_key;
- char db_passwd[14];
- MdbBackend *default_backend;
- char *backend_name;
- MdbStatistics *stats;
- /* free map */
- int map_sz;
- unsigned char *free_map;
- /* reference count */
- int refs;
-} MdbFile;
-
-/* offset to row count on data pages...version dependant */
-typedef struct {
- int pg_size;
- guint16 row_count_offset;
- guint16 tab_num_rows_offset;
- guint16 tab_num_cols_offset;
- guint16 tab_num_idxs_offset;
- guint16 tab_num_ridxs_offset;
- guint16 tab_usage_map_offset;
- guint16 tab_first_dpg_offset;
- guint16 tab_cols_start_offset;
- guint16 tab_ridx_entry_size;
- guint16 col_fixed_offset;
- guint16 col_size_offset;
- guint16 col_num_offset;
- guint16 tab_col_entry_size;
- guint16 tab_free_map_offset;
- guint16 tab_col_offset_var;
- guint16 tab_col_offset_fixed;
- guint16 tab_row_col_num_offset;
-} MdbFormatConstants;
-
-typedef struct {
- MdbFile *f;
- guint32 cur_pg;
- guint16 row_num;
- unsigned int cur_pos;
- unsigned char pg_buf[MDB_PGSIZE];
- unsigned char alt_pg_buf[MDB_PGSIZE];
- unsigned int num_catalog;
- GPtrArray *catalog;
- MdbBackend *default_backend;
- char *backend_name;
- MdbFormatConstants *fmt;
- MdbStatistics *stats;
-#ifdef HAVE_ICONV
- iconv_t iconv_out;
-#endif
-} MdbHandle;
-
-typedef struct {
- MdbHandle *mdb;
- char object_name[MDB_MAX_OBJ_NAME+1];
- int object_type;
- unsigned long table_pg; /* misnomer since object may not be a table */
- unsigned long kkd_pg;
- unsigned int kkd_rowid;
- int num_props;
- GArray *props;
- GArray *columns;
- int flags;
-} MdbCatalogEntry;
-
-typedef struct {
- gchar *name;
- GHashTable *hash;
-} MdbProperties;
-
-typedef union {
- int i;
- double d;
- char s[256];
-} MdbAny;
-
-typedef struct {
- char name[MDB_MAX_OBJ_NAME+1];
- int col_type;
- int col_size;
- void *bind_ptr;
- int *len_ptr;
- GHashTable *properties;
- unsigned int num_sargs;
- GPtrArray *sargs;
- GPtrArray *idx_sarg_cache;
- unsigned char is_fixed;
- int query_order;
- /* col_num is the current column order,
- * does not include deletes */
- int col_num;
- int cur_value_start;
- int cur_value_len;
- /* MEMO/OLE readers */
- guint32 cur_blob_pg;
- int cur_blob_row;
- int chunk_size;
- /* numerics only */
- int col_prec;
- int col_scale;
- MdbProperties *props;
- /* info needed for handling deleted/added columns */
- int fixed_offset;
- int var_col_num;
- /* row_col_num is the row column number order,
- * including deleted columns */
- int row_col_num;
-} MdbColumn;
-
-struct mdbsargtree {
- int op;
- MdbColumn *col;
- MdbAny value;
- void *parent;
- MdbSargNode *left;
- MdbSargNode *right;
-};
-
-typedef struct {
- guint32 pg;
- int start_pos;
- int offset;
- int len;
- guint16 idx_starts[2000];
- unsigned char cache_value[256];
-} MdbIndexPage;
-
-typedef int (*MdbSargTreeFunc)(MdbSargNode *, gpointer *data);
-
-#define MDB_MAX_INDEX_DEPTH 10
-
-typedef struct {
- int cur_depth;
- guint32 last_leaf_found;
- int clean_up_mode;
- MdbIndexPage pages[MDB_MAX_INDEX_DEPTH];
-} MdbIndexChain;
-
-typedef struct {
- MdbCatalogEntry *entry;
- char name[MDB_MAX_OBJ_NAME+1];
- unsigned int num_cols;
- GPtrArray *columns;
- unsigned int num_rows;
- int index_start;
- unsigned int num_real_idxs;
- unsigned int num_idxs;
- GPtrArray *indices;
- guint32 first_data_pg;
- guint32 cur_pg_num;
- guint32 cur_phys_pg;
- unsigned int cur_row;
- int noskip_del; /* don't skip deleted rows */
- /* object allocation map */
- guint32 map_base_pg;
- unsigned int map_sz;
- unsigned char *usage_map;
- /* pages with free space left */
- guint32 freemap_base_pg;
- unsigned int freemap_sz;
- unsigned char *free_usage_map;
- /* query planner */
- MdbSargNode *sarg_tree;
- MdbStrategy strategy;
- MdbIndex *scan_idx;
- MdbHandle *mdbidx;
- MdbIndexChain *chain;
- MdbProperties *props;
- unsigned int num_var_cols; /* to know if row has variable columns */
- /* temp table */
- unsigned int is_temp_table;
- GPtrArray *temp_table_pages;
-} MdbTableDef;
-
-struct mdbindex {
- int index_num;
- char name[MDB_MAX_OBJ_NAME+1];
- unsigned char index_type;
- guint32 first_pg;
- int num_rows; /* number rows in index */
- unsigned int num_keys;
- short key_col_num[MDB_MAX_IDX_COLS];
- unsigned char key_col_order[MDB_MAX_IDX_COLS];
- unsigned char flags;
- MdbTableDef *table;
-};
-
-typedef struct {
- char name[MDB_MAX_OBJ_NAME+1];
-} MdbColumnProp;
-
-typedef struct {
- void *value;
- int siz;
- int start;
- unsigned char is_null;
- unsigned char is_fixed;
- int colnum;
- int offset;
-} MdbField;
-
-typedef struct {
- int op;
- MdbAny value;
-} MdbSarg;
-
-/* mem.c */
-extern void mdb_init(void);
-extern void mdb_exit(void);
-
-/* file.c */
-extern ssize_t mdb_read_pg(MdbHandle *mdb, unsigned long pg);
-extern ssize_t mdb_read_alt_pg(MdbHandle *mdb, unsigned long pg);
-extern unsigned char mdb_get_byte(unsigned char *buf, int offset);
-extern int mdb_get_int16(unsigned char *buf, int offset);
-extern gint32 mdb_get_int24(unsigned char *buf, int offset);
-extern long mdb_get_int32(unsigned char *buf, int offset);
-extern float mdb_get_single(unsigned char *buf, int offset);
-extern double mdb_get_double(unsigned char *buf, int offset);
-extern unsigned char mdb_pg_get_byte(MdbHandle *mdb, int offset);
-extern int mdb_pg_get_int16(MdbHandle *mdb, int offset);
-extern gint32 mdb_pg_get_int24(MdbHandle *mdb, int offset);
-extern long mdb_pg_get_int32(MdbHandle *mdb, int offset);
-extern float mdb_pg_get_single(MdbHandle *mdb, int offset);
-extern double mdb_pg_get_double(MdbHandle *mdb, int offset);
-extern gint32 mdb_pg_get_int24_msb(MdbHandle *mdb, int offset);
-extern MdbHandle *mdb_open(char *filename, MdbFileFlags flags);
-extern void mdb_close(MdbHandle *mdb);
-extern MdbHandle *mdb_clone_handle(MdbHandle *mdb);
-extern void mdb_swap_pgbuf(MdbHandle *mdb);
-extern long _mdb_get_int32(unsigned char *buf, int offset);
-
-/* catalog.c */
-extern void mdb_free_catalog(MdbHandle *mdb);
-extern GPtrArray *mdb_read_catalog(MdbHandle *mdb, int obj_type);
-extern void mdb_dump_catalog(MdbHandle *mdb, int obj_type);
-extern char *mdb_get_objtype_string(int obj_type);
-
-/* table.c */
-extern MdbTableDef *mdb_alloc_tabledef(MdbCatalogEntry *entry);
-extern void mdb_free_tabledef(MdbTableDef *table);
-extern MdbTableDef *mdb_read_table(MdbCatalogEntry *entry);
-extern MdbTableDef *mdb_read_table_by_name(MdbHandle *mdb, gchar *table_name, int obj_type);
-extern void mdb_append_column(GPtrArray *columns, MdbColumn *in_col);
-extern void mdb_free_columns(GPtrArray *columns);
-extern GPtrArray *mdb_read_columns(MdbTableDef *table);
-extern void mdb_table_dump(MdbCatalogEntry *entry);
-extern guint16 read_pg_if_16(MdbHandle *mdb, int *cur_pos);
-extern guint32 read_pg_if_32(MdbHandle *mdb, int *cur_pos);
-extern int read_pg_if(MdbHandle *mdb, int *cur_pos, int offset);
-extern guint16 read_pg_if_n(MdbHandle *mdb, unsigned char *buf, int *cur_pos, int len);
-extern int mdb_is_user_table(MdbCatalogEntry *entry);
-extern int mdb_is_system_table(MdbCatalogEntry *entry);
-
-/* data.c */
-extern int mdb_bind_column_by_name(MdbTableDef *table, gchar *col_name, void *bind_ptr);
-extern void mdb_data_dump(MdbTableDef *table);
-extern void mdb_bind_column(MdbTableDef *table, int col_num, void *bind_ptr);
-extern int mdb_rewind_table(MdbTableDef *table);
-extern int mdb_fetch_row(MdbTableDef *table);
-extern int mdb_is_fixed_col(MdbColumn *col);
-extern char *mdb_col_to_string(MdbHandle *mdb, unsigned char *buf, int start, int datatype, int size);
-extern int mdb_find_pg_row(MdbHandle *mdb, int pg_row, char **buf, int *off, int *len);
-extern int mdb_find_end_of_row(MdbHandle *mdb, int row);
-extern int mdb_col_fixed_size(MdbColumn *col);
-extern int mdb_col_disp_size(MdbColumn *col);
-extern void mdb_bind_len(MdbTableDef *table, int col_num, int *len_ptr);
-extern int mdb_ole_read_next(MdbHandle *mdb, MdbColumn *col, void *ole_ptr);
-extern int mdb_ole_read(MdbHandle *mdb, MdbColumn *col, void *ole_ptr, int chunk_size);
-extern void mdb_set_date_fmt(const char *);
-extern int mdb_read_row(MdbTableDef *table, unsigned int row);
-
-/* dump.c */
-extern void buffer_dump(const unsigned char* buf, int start, int end);
-
-/* backend.c */
-extern char *mdb_get_coltype_string(MdbBackend *backend, int col_type);
-extern int mdb_coltype_takes_length(MdbBackend *backend, int col_type);
-extern void mdb_init_backends(void);
-extern void mdb_register_backend(MdbBackendType *backend, char *backend_name);
-extern void mdb_remove_backends(void);
-extern int mdb_set_default_backend(MdbHandle *mdb, char *backend_name);
-extern char *mdb_get_relationships(MdbHandle *mdb);
-
-/* sargs.c */
-extern int mdb_test_sargs(MdbTableDef *table, MdbField *fields, int num_fields);
-extern int mdb_test_sarg(MdbHandle *mdb, MdbColumn *col, MdbSargNode *node, MdbField *field);
-extern void mdb_sql_walk_tree(MdbSargNode *node, MdbSargTreeFunc func, gpointer data);
-extern int mdb_find_indexable_sargs(MdbSargNode *node, gpointer data);
-extern int mdb_add_sarg_by_name(MdbTableDef *table, char *colname, MdbSarg *in_sarg);
-extern int mdb_test_string(MdbSargNode *node, char *s);
-extern int mdb_test_int(MdbSargNode *node, gint32 i);
-extern int mdb_add_sarg(MdbColumn *col, MdbSarg *in_sarg);
-
-
-
-/* index.c */
-extern GPtrArray *mdb_read_indices(MdbTableDef *table);
-extern void mdb_index_dump(MdbTableDef *table, MdbIndex *idx);
-extern void mdb_index_scan_free(MdbTableDef *table);
-extern int mdb_index_find_next_on_page(MdbHandle *mdb, MdbIndexPage *ipg);
-extern int mdb_index_find_next(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain, guint32 *pg, guint16 *row);
-extern void mdb_index_hash_text(guchar *text, guchar *hash);
-extern void mdb_index_scan_init(MdbHandle *mdb, MdbTableDef *table);
-extern int mdb_index_find_row(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain, guint32 pg, guint16 row);
-extern void mdb_index_swap_n(unsigned char *src, int sz, unsigned char *dest);
-extern void mdb_free_indices(GPtrArray *indices);
-void mdb_index_page_reset(MdbIndexPage *ipg);
-extern MdbIndexPage *mdb_index_read_bottom_pg(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain);
-extern MdbIndexPage *mdb_index_unwind(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain);
-extern void mdb_index_page_init(MdbIndexPage *ipg);
-
-
-/* stats.c */
-extern void mdb_stats_on(MdbHandle *mdb);
-extern void mdb_stats_off(MdbHandle *mdb);
-extern void mdb_dump_stats(MdbHandle *mdb);
-
-/* like.c */
-extern int mdb_like_cmp(char *s, char *r);
-
-/* write.c */
-extern int mdb_crack_row(MdbTableDef *table, int row_start, int row_end, MdbField *fields);
-extern guint16 mdb_add_row_to_pg(MdbTableDef *table, unsigned char *row_buffer, int new_row_size);
-extern int mdb_update_index(MdbTableDef *table, MdbIndex *idx, unsigned int num_fields, MdbField *fields, guint32 pgnum, guint16 rownum);
-extern int mdb_pack_row(MdbTableDef *table, unsigned char *row_buffer, unsigned int num_fields, MdbField *fields);
-extern int mdb_replace_row(MdbTableDef *table, int row, unsigned char *new_row, int new_row_size);
-extern int mdb_pg_get_freespace(MdbHandle *mdb);
-extern int mdb_update_row(MdbTableDef *table);
-extern unsigned char *mdb_new_data_pg(MdbCatalogEntry *entry);
-
-/* map.c */
-extern guint32 mdb_map_find_next_freepage(MdbTableDef *table, int row_size);
-guint32 mdb_map_find_next(MdbHandle *mdb, unsigned char *map, unsigned int map_sz, guint32 start_pg);
-
-/* props.c */
-extern GPtrArray *mdb_read_props_list(gchar *kkd, int len);
-extern void mdb_free_props(MdbProperties *props);
-extern MdbProperties *mdb_read_props(MdbHandle *mdb, GPtrArray *names, gchar *kkd, int len);
-
-/* worktable.c */
-extern MdbTableDef *mdb_create_temp_table(MdbHandle *mdb, char *name);
-extern void mdb_temp_table_add_col(MdbTableDef *table, MdbColumn *col);
-extern void mdb_fill_temp_col(MdbColumn *tcol, char *col_name, int col_size, int col_type, int is_fixed);
-extern void mdb_fill_temp_field(MdbField *field, void *value, int siz, int is_fixed, int is_null, int start, int column);
-extern void mdb_temp_columns_end(MdbTableDef *table);
-
-/* options.c */
-extern int mdb_get_option(unsigned long optnum);
-extern void mdb_debug(int klass, char *fmt, ...);
-
-/* iconv.c */
-extern int mdb_unicode2ascii(MdbHandle *mdb, unsigned char *buf, int offset, unsigned int len, char *dest);
-extern int mdb_ascii2unicode(MdbHandle *mdb, unsigned char *buf, int offset, unsigned int len, char *dest);
-
-#endif /* _mdbtools_h_ */
diff --git a/navit/data/poi_geodownload/libmdb/index.c b/navit/data/poi_geodownload/libmdb/index.c
deleted file mode 100644
index e840536e..00000000
--- a/navit/data/poi_geodownload/libmdb/index.c
+++ /dev/null
@@ -1,905 +0,0 @@
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 2000-2004 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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.
- */
-
-#include "mdbtools.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-MdbIndexPage *mdb_index_read_bottom_pg(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain);
-MdbIndexPage *mdb_chain_add_page(MdbHandle *mdb, MdbIndexChain *chain, guint32 pg);
-
-char idx_to_text[] = {
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0-7 0x00-0x07 */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 8-15 0x09-0x0f */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 16-23 0x10-0x17 */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 24-31 0x19-0x1f */
-' ', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 32-39 0x20-0x27 */
-0x00, 0x00, 0x00, 0x00, 0x00, ' ', ' ', 0x00, /* 40-47 0x29-0x2f */
-'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', /* 48-55 0x30-0x37 */
-'^', '_', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 56-63 0x39-0x3f */
-0x00, '`', 'a', 'b', 'd', 'f', 'g', 'h', /* 64-71 0x40-0x47 */
-'i', 'j', 'k', 'l', 'm', 'o', 'p', 'r', /* 72-79 0x49-0x4f H */
-'s', 't', 'u', 'v', 'w', 'x', 'z', '{', /* 80-87 0x50-0x57 P */
-'|', '}', '~', '5', '6', '7', '8', '9', /* 88-95 0x59-0x5f */
-0x00, '`', 'a', 'b', 'd', 'f', 'g', 'h', /* 96-103 0x60-0x67 */
-'i', 'j', 'k', 'l', 'm', 'o', 'p', 'r', /* 014-111 0x69-0x6f h */
-'s', 't', 'u', 'v', 'w', 'x', 'z', '{', /* 112-119 0x70-0x77 p */
-'|', '}', '~', 0x00, 0x00, 0x00, 0x00, 0x00, /* 120-127 0x78-0x7f */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 128-135 0x80-0x87 */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */
-0x00, 0x00, 0x00, 0x00, 0x00, '`', 0x00, 0x00, /* 0xc0-0xc7 */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */
-0x00, '`', 0x00, '`', '`', '`', 0x00, 0x00, /* 0xe0-0xe7 */
-'f', 'f', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */
-0x00, 0x00, 0x00, 'r', 0x00, 0x00, 'r', 0x00, /* 0xf0-0xf7 */
-0x81, 0x00, 0x00, 0x00, 'x', 0x00, 0x00, 0x00, /* 0xf8-0xff */
-};
-
-
-GPtrArray *
-mdb_read_indices(MdbTableDef *table)
-{
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
- MdbFormatConstants *fmt = mdb->fmt;
- MdbIndex *pidx;
- unsigned int i, j;
- int idx_num, key_num, col_num;
- int cur_pos, name_sz, idx2_sz, type_offset;
- int index_start_pg = mdb->cur_pg;
- gchar *tmpbuf;
-
- table->indices = g_ptr_array_new();
-
- if (IS_JET4(mdb)) {
- cur_pos = table->index_start + 52 * table->num_real_idxs;
- idx2_sz = 28;
- type_offset = 23;
- } else {
- cur_pos = table->index_start + 39 * table->num_real_idxs;
- idx2_sz = 20;
- type_offset = 19;
- }
-
- tmpbuf = (gchar *) g_malloc(idx2_sz);
- for (i=0;i<table->num_idxs;i++) {
- read_pg_if_n(mdb, tmpbuf, &cur_pos, idx2_sz);
- cur_pos += idx2_sz;
- pidx = (MdbIndex *) g_malloc0(sizeof(MdbIndex));
- pidx->table = table;
- pidx->index_num = mdb_get_int16(tmpbuf, 4);
- pidx->index_type = tmpbuf[type_offset];
- g_ptr_array_add(table->indices, pidx);
- }
- g_free(tmpbuf);
-
- for (i=0;i<table->num_idxs;i++) {
- pidx = g_ptr_array_index (table->indices, i);
- if (IS_JET4(mdb)) {
- name_sz=read_pg_if_16(mdb, &cur_pos);
- cur_pos += 2;
- tmpbuf = g_malloc(name_sz);
- read_pg_if_n(mdb, tmpbuf, &cur_pos, name_sz);
- cur_pos += name_sz;
- mdb_unicode2ascii(mdb, tmpbuf, 0, name_sz, pidx->name);
- g_free(tmpbuf);
- } else {
- read_pg_if(mdb, &cur_pos, 0);
- name_sz=mdb->pg_buf[cur_pos++];
- read_pg_if_n(mdb, pidx->name, &cur_pos, name_sz);
- cur_pos += name_sz;
- pidx->name[name_sz]='\0';
- }
- //fprintf(stderr, "index name %s\n", pidx->name);
- }
-
- mdb_read_alt_pg(mdb, entry->table_pg);
- mdb_read_pg(mdb, index_start_pg);
- cur_pos = table->index_start;
- idx_num=0;
- for (i=0;i<table->num_real_idxs;i++) {
- if (IS_JET4(mdb)) cur_pos += 4;
- do {
- pidx = g_ptr_array_index (table->indices, idx_num++);
- } while (pidx && pidx->index_type==2);
-
- /* if there are more real indexes than index entries left after
- removing type 2's decrement real indexes and continue. Happens
- on Northwind Orders table.
- */
- if (!pidx) {
- table->num_real_idxs--;
- continue;
- }
-
- pidx->num_rows = mdb_get_int32(mdb->alt_pg_buf,
- fmt->tab_cols_start_offset +
- (i*fmt->tab_ridx_entry_size));
-
- key_num=0;
- for (j=0;j<MDB_MAX_IDX_COLS;j++) {
- col_num=read_pg_if_16(mdb,&cur_pos);
- cur_pos += 2;
- read_pg_if(mdb, &cur_pos, 0);
- cur_pos++;
- if (col_num == 0xFFFF)
- continue;
- /* set column number to a 1 based column number and store */
- pidx->key_col_num[key_num] = col_num + 1;
- pidx->key_col_order[key_num] =
- (mdb->pg_buf[cur_pos-1]) ? MDB_ASC : MDB_DESC;
- key_num++;
- }
- pidx->num_keys = key_num;
-
- cur_pos += 4;
- pidx->first_pg = read_pg_if_32(mdb, &cur_pos);
- cur_pos += 4;
- read_pg_if(mdb, &cur_pos, 0);
- pidx->flags = mdb->pg_buf[cur_pos++];
- if (IS_JET4(mdb)) cur_pos += 9;
- }
- return NULL;
-}
-void
-mdb_index_hash_text(guchar *text, guchar *hash)
-{
- unsigned int k;
-
- for (k=0;k<strlen(text);k++) {
- hash[k] = idx_to_text[text[k]];
- if (!(hash[k])) fprintf(stderr,
- "No translation available for %02x %d\n",
- text[k],text[k]);
- }
- hash[strlen(text)]=0;
-}
-void
-mdb_index_swap_n(unsigned char *src, int sz, unsigned char *dest)
-{
- int i, j = 0;
-
- for (i = sz; i > 0; i--) {
- dest[j++] = src[i];
- }
-}
-void
-mdb_index_cache_sarg(MdbColumn *col, MdbSarg *sarg, MdbSarg *idx_sarg)
-{
- //guint32 cache_int;
- unsigned char *c;
-
- switch (col->col_type) {
- case MDB_TEXT:
- mdb_index_hash_text(sarg->value.s, idx_sarg->value.s);
- break;
-
- case MDB_LONGINT:
- idx_sarg->value.i = GUINT32_SWAP_LE_BE(sarg->value.i);
- //cache_int = sarg->value.i * -1;
- c = (unsigned char *) &(idx_sarg->value.i);
- c[0] |= 0x80;
- //printf("int %08x %02x %02x %02x %02x\n", sarg->value.i, c[0], c[1], c[2], c[3]);
- break;
-
- case MDB_INT:
- break;
-
- default:
- break;
- }
-}
-#if 0
-int
-mdb_index_test_sarg(MdbHandle *mdb, MdbColumn *col, MdbSarg *sarg, int offset, int len)
-{
-char tmpbuf[256];
-int lastchar;
-
- switch (col->col_type) {
- case MDB_BYTE:
- return mdb_test_int(sarg, mdb_pg_get_byte(mdb, offset));
- break;
- case MDB_INT:
- return mdb_test_int(sarg, mdb_pg_get_int16(mdb, offset));
- break;
- case MDB_LONGINT:
- return mdb_test_int(sarg, mdb_pg_get_int32(mdb, offset));
- break;
- case MDB_TEXT:
- strncpy(tmpbuf, &mdb->pg_buf[offset],255);
- lastchar = len > 255 ? 255 : len;
- tmpbuf[lastchar]='\0';
- return mdb_test_string(sarg, tmpbuf);
- default:
- fprintf(stderr, "Calling mdb_test_sarg on unknown type. Add code to mdb_test_sarg() for type %d\n",col->col_type);
- break;
- }
- return 1;
-}
-#endif
-int
-mdb_index_test_sargs(MdbHandle *mdb, MdbIndex *idx, unsigned char *buf, int len)
-{
- unsigned int i, j;
- MdbColumn *col;
- MdbTableDef *table = idx->table;
- MdbSarg *idx_sarg;
- MdbSarg *sarg;
- MdbField field;
- MdbSargNode node;
- //int c_offset = 0,
- int c_len;
-
-#if 0
- fprintf(stderr,"mdb_index_test_sargs called on ");
- for (i=0;i<len;i++)
- fprintf(stderr,"%02x ",buf[i]); //mdb->pg_buf[offset+i]);
- fprintf(stderr,"\n");
-#endif
- for (i=0;i<idx->num_keys;i++) {
- //c_offset++; /* the per column null indicator/flags */
- col=g_ptr_array_index(table->columns,idx->key_col_num[i]-1);
- /*
- * This will go away eventually
- */
- if (col->col_type==MDB_TEXT) {
- //c_len = strlen(&mdb->pg_buf[offset + c_offset]);
- c_len = strlen(buf);
- } else {
- c_len = col->col_size;
- //fprintf(stderr,"Only text types currently supported. How did we get here?\n");
- }
- /*
- * If we have no cached index values for this column,
- * create them.
- */
- if (col->num_sargs && !col->idx_sarg_cache) {
- col->idx_sarg_cache = g_ptr_array_new();
- for (j=0;j<col->num_sargs;j++) {
- sarg = g_ptr_array_index (col->sargs, j);
- idx_sarg = g_memdup(sarg,sizeof(MdbSarg));
- //printf("calling mdb_index_cache_sarg\n");
- mdb_index_cache_sarg(col, sarg, idx_sarg);
- g_ptr_array_add(col->idx_sarg_cache, idx_sarg);
- }
- }
-
- for (j=0;j<col->num_sargs;j++) {
- sarg = g_ptr_array_index (col->idx_sarg_cache, j);
- /* XXX - kludge */
- node.op = sarg->op;
- node.value = sarg->value;
- //field.value = &mdb->pg_buf[offset + c_offset];
- field.value = buf;
- field.siz = c_len;
- field.is_null = FALSE;
- if (!mdb_test_sarg(mdb, col, &node, &field)) {
- /* sarg didn't match, no sense going on */
- return 0;
- }
- }
- }
- return 1;
-}
-/*
- * pack the pages bitmap
- */
-int
-mdb_index_pack_bitmap(MdbHandle *mdb, MdbIndexPage *ipg)
-{
- int mask_bit = 0;
- int mask_pos = 0x16;
- int mask_byte = 0;
- int elem = 0;
- int len, start, i;
-
- start = ipg->idx_starts[elem++];
-
- while (start) {
- len = ipg->idx_starts[elem] - start;
- fprintf(stdout, "len is %d\n", len);
- for (i=0; i < len; i++) {
- mask_bit++;
- if (mask_bit==8) {
- mask_bit=0;
- mdb->pg_buf[mask_pos++] = mask_byte;
- mask_byte = 0;
- }
- /* upon reaching the len, set the bit */
- }
- mask_byte = (1 << mask_bit) | mask_byte;
- fprintf(stdout, "mask byte is %02x at %d\n", mask_byte, mask_pos);
- start = ipg->idx_starts[elem++];
- }
- /* flush the last byte if any */
- mdb->pg_buf[mask_pos++] = mask_byte;
- /* remember to zero the rest of the bitmap */
- for (i = mask_pos; i < 0xf8; i++) {
- mdb->pg_buf[mask_pos++] = 0;
- }
- return 0;
-}
-/*
- * unpack the pages bitmap
- */
-int
-mdb_index_unpack_bitmap(MdbHandle *mdb, MdbIndexPage *ipg)
-{
- int mask_bit = 0;
- int mask_pos = 0x16;
- int mask_byte;
- int start = 0xf8;
- int elem = 0;
- int len = 0;
-
- ipg->idx_starts[elem++]=start;
-
-#if 0
- fprintf(stdout, "Unpacking index page %u\n", ipg->pg);
-#endif
- do {
- len = 0;
- do {
- mask_bit++;
- if (mask_bit==8) {
- mask_bit=0;
- mask_pos++;
- }
- mask_byte = mdb->pg_buf[mask_pos];
- len++;
- } while (mask_pos <= 0xf8 && !((1 << mask_bit) & mask_byte));
- //fprintf(stdout, "%d %d %d %d\n", mask_pos, mask_bit, mask_byte, len);
-
- start += len;
- if (mask_pos < 0xf8) ipg->idx_starts[elem++]=start;
-
- } while (mask_pos < 0xf8);
-
- /* if we zero the next element, so we don't pick up the last pages starts*/
- ipg->idx_starts[elem]=0;
-
- return elem;
-}
-/*
- * find the next entry on a page (either index or leaf). Uses state information
- * stored in the MdbIndexPage across calls.
- */
-int
-mdb_index_find_next_on_page(MdbHandle *mdb, MdbIndexPage *ipg)
-{
- if (!ipg->pg) return 0;
-
- /* if this page has not been unpacked to it */
- if (!ipg->idx_starts[0]){
- //fprintf(stdout, "Unpacking page %d\n", ipg->pg);
- mdb_index_unpack_bitmap(mdb, ipg);
- }
-
-
- if (ipg->idx_starts[ipg->start_pos + 1]==0) return 0;
- ipg->len = ipg->idx_starts[ipg->start_pos+1] - ipg->idx_starts[ipg->start_pos];
- ipg->start_pos++;
- //fprintf(stdout, "Start pos %d\n", ipg->start_pos);
-
- return ipg->len;
-}
-void mdb_index_page_reset(MdbIndexPage *ipg)
-{
- ipg->offset = 0xf8; /* start byte of the index entries */
- ipg->start_pos=0;
- ipg->len = 0;
- ipg->idx_starts[0]=0;
-}
-void mdb_index_page_init(MdbIndexPage *ipg)
-{
- memset(ipg, 0, sizeof(MdbIndexPage));
- mdb_index_page_reset(ipg);
-}
-/*
- * find the next leaf page if any given a chain. Assumes any exhausted leaf
- * pages at the end of the chain have been peeled off before the call.
- */
-MdbIndexPage *
-mdb_find_next_leaf(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain)
-{
- MdbIndexPage *ipg, *newipg;
- guint32 pg;
- guint passed = 0;
-
- ipg = mdb_index_read_bottom_pg(mdb, idx, chain);
-
- /*
- * If we are at the first page deep and it's not an index page then
- * we are simply done. (there is no page to find
- */
-
- if (mdb->pg_buf[0]==MDB_PAGE_LEAF) {
- /* Indexes can have leaves at the end that don't appear
- * in the upper tree, stash the last index found so
- * we can follow it at the end. */
- chain->last_leaf_found = ipg->pg;
- return ipg;
- }
-
- /*
- * apply sargs here, currently we don't
- */
- do {
- ipg->len = 0;
- //printf("finding next on pg %lu\n", ipg->pg);
- if (!mdb_index_find_next_on_page(mdb, ipg)) {
- //printf("find_next_on_page returned 0\n");
- return 0;
- }
- pg = mdb_pg_get_int24_msb(mdb, ipg->offset + ipg->len - 3);
- //printf("Looking at pg %lu at %lu %d\n", pg, ipg->offset, ipg->len);
- ipg->offset += ipg->len;
-
- /*
- * add to the chain and call this function
- * recursively.
- */
- newipg = mdb_chain_add_page(mdb, chain, pg);
- newipg = mdb_find_next_leaf(mdb, idx, chain);
- //printf("returning pg %lu\n",newipg->pg);
- return newipg;
- } while (!passed);
- /* no more pages */
- return NULL;
-
-}
-MdbIndexPage *
-mdb_chain_add_page(MdbHandle *mdb, MdbIndexChain *chain, guint32 pg)
-{
- MdbIndexPage *ipg;
-
- chain->cur_depth++;
- if (chain->cur_depth > MDB_MAX_INDEX_DEPTH) {
- fprintf(stderr,"Error! maximum index depth of %d exceeded. This is probably due to a programming bug, If you are confident that your indexes really are this deep, adjust MDB_MAX_INDEX_DEPTH in mdbtools.h and recompile.\n", MDB_MAX_INDEX_DEPTH);
- exit(1);
- }
- ipg = &(chain->pages[chain->cur_depth - 1]);
- mdb_index_page_init(ipg);
- ipg->pg = pg;
-
- return ipg;
-}
-/*
- * returns the bottom page of the IndexChain, if IndexChain is empty it
- * initializes it by reading idx->first_pg (the root page)
- */
-MdbIndexPage *
-mdb_index_read_bottom_pg(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain)
-{
- MdbIndexPage *ipg;
-
- /*
- * if it's new use the root index page (idx->first_pg)
- */
- if (!chain->cur_depth) {
- ipg = &(chain->pages[0]);
- mdb_index_page_init(ipg);
- chain->cur_depth = 1;
- ipg->pg = idx->first_pg;
- if (!(ipg = mdb_find_next_leaf(mdb, idx, chain)))
- return 0;
- } else {
- ipg = &(chain->pages[chain->cur_depth - 1]);
- ipg->len = 0;
- }
-
- mdb_read_pg(mdb, ipg->pg);
-
- return ipg;
-}
-/*
- * unwind the stack and search for new leaf node
- */
-MdbIndexPage *
-mdb_index_unwind(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain)
-{
- MdbIndexPage *ipg;
-
- //printf("page %lu finished\n",ipg->pg);
- if (chain->cur_depth==1) {
- //printf("cur_depth == 1 we're out\n");
- return NULL;
- }
- /*
- * unwind the stack until we find something or reach
- * the top.
- */
- ipg = NULL;
- while (chain->cur_depth>1 && ipg==NULL) {
- //printf("chain depth %d\n", chain->cur_depth);
- chain->cur_depth--;
- ipg = mdb_find_next_leaf(mdb, idx, chain);
- if (ipg) mdb_index_find_next_on_page(mdb, ipg);
- }
- if (chain->cur_depth==1) {
- //printf("last leaf %lu\n", chain->last_leaf_found);
- return NULL;
- }
- return ipg;
-}
-/*
- * the main index function.
- * caller provides an index chain which is the current traversal of index
- * pages from the root page to the leaf. Initially passed as blank,
- * mdb_index_find_next will store it's state information here. Each invocation
- * then picks up where the last one left off, allowing us to scroll through
- * the index one by one.
- *
- * Sargs are applied here but also need to be applied on the whole row b/c
- * text columns may return false positives due to hashing and non-index
- * columns with sarg values can't be tested here.
- */
-int
-mdb_index_find_next(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain, guint32 *pg, guint16 *row)
-{
- MdbIndexPage *ipg;
- int passed = 0;
- int idx_sz;
- int idx_start = 0;
- MdbColumn *col;
-
- ipg = mdb_index_read_bottom_pg(mdb, idx, chain);
-
- /*
- * loop while the sargs don't match
- */
- do {
- ipg->len = 0;
- /*
- * if no more rows on this leaf, try to find a new leaf
- */
- if (!mdb_index_find_next_on_page(mdb, ipg)) {
- if (!chain->clean_up_mode) {
- if (!(ipg = mdb_index_unwind(mdb, idx, chain)))
- chain->clean_up_mode = 1;
- }
- if (chain->clean_up_mode) {
- //fprintf(stdout,"in cleanup mode\n");
-
- if (!chain->last_leaf_found) return 0;
- mdb_read_pg(mdb, chain->last_leaf_found);
- chain->last_leaf_found = mdb_pg_get_int24(mdb, 0x0c);
- //printf("next leaf %lu\n", chain->last_leaf_found);
- mdb_read_pg(mdb, chain->last_leaf_found);
- /* reuse the chain for cleanup mode */
- chain->cur_depth = 1;
- ipg = &chain->pages[0];
- mdb_index_page_init(ipg);
- ipg->pg = chain->last_leaf_found;
- //printf("next on page %d\n",
- if (!mdb_index_find_next_on_page(mdb, ipg))
- return 0;
- }
- }
- *row = mdb->pg_buf[ipg->offset + ipg->len - 1];
-#if 0
- printf("page: ");
- buffer_dump(mdb->pg_buf, ipg->offset+ipg->len-4, ipg->offset+ipg->len-2);
-#endif
- *pg = mdb_pg_get_int24_msb(mdb, ipg->offset + ipg->len - 4);
-#if 0
- printf("row = %d pg = %lu ipg->pg = %lu offset = %lu len = %d\n", *row, *pg, ipg->pg, ipg->offset, ipg->len);
-#endif
- col=g_ptr_array_index(idx->table->columns,idx->key_col_num[0]-1);
- idx_sz = mdb_col_fixed_size(col);
- /* handle compressed indexes, single key indexes only? */
- if (idx->num_keys==1 && idx_sz>0 && ipg->len - 4 < idx_sz) {
-#if 0
- printf("short index found\n");
- buffer_dump(ipg->cache_value, 0, idx_sz);
-#endif
- memcpy(&ipg->cache_value[idx_sz - (ipg->len - 4)], &mdb->pg_buf[ipg->offset], ipg->len);
-#if 0
- buffer_dump(ipg->cache_value, 0, idx_sz);
-#endif
- } else {
- idx_start = ipg->offset + (ipg->len - 4 - idx_sz);
- memcpy(ipg->cache_value, &mdb->pg_buf[idx_start], idx_sz);
- }
-
- //idx_start = ipg->offset + (ipg->len - 4 - idx_sz);
- passed = mdb_index_test_sargs(mdb, idx, ipg->cache_value, idx_sz);
-
-// printf("passed=%d\n", passed);
-
- buffer_dump(mdb->pg_buf, ipg->offset, ipg->offset+ipg->len-1);
- ipg->offset += ipg->len;
-
- } while (!passed);
-
-#if 0
- fprintf(stdout,"len = %d pos %d\n", ipg->len, ipg->len);
- buffer_dump(mdb->pg_buf, ipg->offset, ipg->offset+ipg->len-1);
-#endif
-
- return ipg->len;
-}
-/*
- * XXX - FIX ME
- * This function is grossly inefficient. It scans the entire index building
- * an IndexChain to a specific row. We should be checking the index pages
- * for matches against the indexed fields to find the proper leaf page, but
- * getting it working first and then make it fast!
- */
-int
-mdb_index_find_row(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain, guint32 pg, guint16 row)
-{
- MdbIndexPage *ipg;
- int passed = 0;
- guint32 datapg;
- guint16 datarow;
-
- ipg = mdb_index_read_bottom_pg(mdb, idx, chain);
-
- do {
- ipg->len = 0;
- /*
- * if no more rows on this leaf, try to find a new leaf
- */
- if (!mdb_index_find_next_on_page(mdb, ipg)) {
- /* back to top? We're done */
- if (chain->cur_depth==1)
- return 0;
-
- /*
- * unwind the stack until we find something or reach
- * the top.
- */
- while (chain->cur_depth>1) {
- chain->cur_depth--;
- if (!(ipg = mdb_find_next_leaf(mdb, idx, chain)))
- return 0;
- mdb_index_find_next_on_page(mdb, ipg);
- }
- if (chain->cur_depth==1)
- return 0;
- }
- /* test row and pg */
- datarow = mdb->pg_buf[ipg->offset + ipg->len - 1];
- datapg = mdb_pg_get_int24_msb(mdb, ipg->offset + ipg->len - 4);
-
- if (datapg == pg && datarow == row) {
- passed = 1;
- }
- ipg->offset += ipg->len;
- } while (!passed);
-
- /* index chain from root to leaf should now be in "chain" */
- return 1;
-}
-
-void mdb_index_walk(MdbTableDef *table, MdbIndex *idx)
-{
-MdbHandle *mdb = table->entry->mdb;
-int cur_pos = 0;
-unsigned char marker;
-MdbColumn *col;
-unsigned int i;
-
- if (idx->num_keys!=1) return;
-
- mdb_read_pg(mdb, idx->first_pg);
- cur_pos = 0xf8;
-
- for (i=0;i<idx->num_keys;i++) {
- marker = mdb->pg_buf[cur_pos++];
- col=g_ptr_array_index(table->columns,idx->key_col_num[i]-1);
- //printf("column %d coltype %d col_size %d (%d)\n",i,col->col_type, mdb_col_fixed_size(col), col->col_size);
- }
-}
-void
-mdb_index_dump(MdbTableDef *table, MdbIndex *idx)
-{
- unsigned int i;
- MdbColumn *col;
-
- fprintf(stdout,"index number %d\n", idx->index_num);
- fprintf(stdout,"index name %s\n", idx->name);
- fprintf(stdout,"index first page %d\n", idx->first_pg);
- fprintf(stdout,"index rows %d\n", idx->num_rows);
- if (idx->index_type==1) fprintf(stdout,"index is a primary key\n");
- for (i=0;i<idx->num_keys;i++) {
- col=g_ptr_array_index(table->columns,idx->key_col_num[i]-1);
- fprintf(stdout,"Column %s(%d) Sorted %s Unique: %s\n",
- col->name,
- idx->key_col_num[i],
- idx->key_col_order[i]==MDB_ASC ? "ascending" : "descending",
- idx->flags & MDB_IDX_UNIQUE ? "Yes" : "No"
- );
- }
- mdb_index_walk(table, idx);
-}
-/*
- * compute_cost tries to assign a cost to a given index using the sargs
- * available in this query.
- *
- * Indexes with no matching sargs are assigned 0
- * Unique indexes are preferred over non-uniques
- * Operator preference is equal, like, isnull, others
- */
-int mdb_index_compute_cost(MdbTableDef *table, MdbIndex *idx)
-{
- unsigned int i;
- MdbColumn *col;
- MdbSarg *sarg = NULL;
- int not_all_equal = 0;
-
- if (!idx->num_keys) return 0;
- if (idx->num_keys > 1) {
- for (i=0;i<idx->num_keys;i++) {
- col=g_ptr_array_index(table->columns,idx->key_col_num[i]-1);
- if (col->sargs) sarg = g_ptr_array_index (col->sargs, 0);
- if (!sarg || sarg->op != MDB_EQUAL) not_all_equal++;
- }
- }
-
- col=g_ptr_array_index(table->columns,idx->key_col_num[0]-1);
- /*
- * if this is the first key column and there are no sargs,
- * then this index is useless.
- */
- if (!col->num_sargs) return 0;
-
- sarg = g_ptr_array_index (col->sargs, 0);
-
- /*
- * a like with a wild card first is useless as a sarg */
- if (sarg->op == MDB_LIKE && sarg->value.s[0]=='%')
- return 0;
-
- /*
- * this needs a lot of tweaking.
- */
- if (idx->flags & MDB_IDX_UNIQUE) {
- if (idx->num_keys == 1) {
- //printf("op is %d\n", sarg->op);
- switch (sarg->op) {
- case MDB_EQUAL:
- return 1; break;
- case MDB_LIKE:
- return 4; break;
- case MDB_ISNULL:
- return 12; break;
- default:
- return 8; break;
- }
- } else {
- switch (sarg->op) {
- case MDB_EQUAL:
- if (not_all_equal) return 2;
- else return 1;
- break;
- case MDB_LIKE:
- return 6; break;
- case MDB_ISNULL:
- return 12; break;
- default:
- return 9; break;
- }
- }
- } else {
- if (idx->num_keys == 1) {
- switch (sarg->op) {
- case MDB_EQUAL:
- return 2; break;
- case MDB_LIKE:
- return 5; break;
- case MDB_ISNULL:
- return 12; break;
- default:
- return 10; break;
- }
- } else {
- switch (sarg->op) {
- case MDB_EQUAL:
- if (not_all_equal) return 3;
- else return 2;
- break;
- case MDB_LIKE:
- return 7; break;
- case MDB_ISNULL:
- return 12; break;
- default:
- return 11; break;
- }
- }
- }
- return 0;
-}
-/*
- * choose_index runs mdb_index_compute_cost for each available index and picks
- * the best.
- *
- * Returns strategy to use (table scan, or index scan)
- */
-MdbStrategy
-mdb_choose_index(MdbTableDef *table, int *choice)
-{
- unsigned int i;
- MdbIndex *idx;
- int cost = 0;
- int least = 99;
-
- *choice = -1;
- for (i=0;i<table->num_idxs;i++) {
- idx = g_ptr_array_index (table->indices, i);
- cost = mdb_index_compute_cost(table, idx);
- //printf("cost for %s is %d\n", idx->name, cost);
- if (cost && cost < least) {
- least = cost;
- *choice = i;
- }
- }
- /* and the winner is: *choice */
- if (least==99) return MDB_TABLE_SCAN;
- return MDB_INDEX_SCAN;
-}
-void
-mdb_index_scan_init(MdbHandle *mdb, MdbTableDef *table)
-{
- int i;
-
- if (mdb_get_option(MDB_USE_INDEX) && mdb_choose_index(table, &i) == MDB_INDEX_SCAN) {
- table->strategy = MDB_INDEX_SCAN;
- table->scan_idx = g_ptr_array_index (table->indices, i);
- table->chain = g_malloc0(sizeof(MdbIndexChain));
- table->mdbidx = mdb_clone_handle(mdb);
- mdb_read_pg(table->mdbidx, table->scan_idx->first_pg);
- //printf("best index is %s\n",table->scan_idx->name);
- }
- //printf("TABLE SCAN? %d\n", table->strategy);
-}
-void
-mdb_index_scan_free(MdbTableDef *table)
-{
- if (table->chain) {
- g_free(table->chain);
- table->chain = NULL;
- }
- if (table->mdbidx) {
- mdb_close(table->mdbidx);
- table->mdbidx = NULL;
- }
-}
-
-void mdb_free_indices(GPtrArray *indices)
-{
- unsigned int i;
-
- if (!indices) return;
- for (i=0; i<indices->len; i++)
- g_free (g_ptr_array_index(indices, i));
- g_ptr_array_free(indices, TRUE);
-}
diff --git a/navit/data/poi_geodownload/libmdb/kkd.c b/navit/data/poi_geodownload/libmdb/kkd.c
deleted file mode 100644
index ea72887c..00000000
--- a/navit/data/poi_geodownload/libmdb/kkd.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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.
- */
-
-#include "mdbtools.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-
-/*
-** Note: This code is mostly garbage right now...just a test to parse out the
-** KKD structures.
-*/
-
-GArray *mdb_get_column_props(MdbCatalogEntry *entry, int start)
-{
-int pos, cnt=0;
-int len, tmp, cplen;
-MdbColumnProp prop;
-MdbHandle *mdb = entry->mdb;
-
- entry->props = g_array_new(FALSE,FALSE,sizeof(MdbColumnProp));
- len = mdb_pg_get_int16(mdb,start);
- pos = start + 6;
- while (pos < start+len) {
- tmp = mdb_pg_get_int16(mdb,pos); /* length of string */
- pos += 2;
- cplen = tmp > MDB_MAX_OBJ_NAME ? MDB_MAX_OBJ_NAME : tmp;
- g_memmove(prop.name,&mdb->pg_buf[pos],cplen);
- prop.name[cplen]='\0';
- pos += tmp;
- g_array_append_val(entry->props, prop.name);
- cnt++;
- }
- entry->num_props = cnt;
- return entry->props;
-}
-
-GHashTable *mdb_get_column_def(MdbCatalogEntry *entry, int start)
-{
-GHashTable *hash = NULL;
-MdbHandle *mdb = entry->mdb;
-MdbColumnProp prop;
-int tmp, pos, col_num, val_len, i;
-int len, col_type;
-unsigned char c;
-int end;
-
- fprintf(stdout,"\n data\n");
- fprintf(stdout,"-------\n");
- len = mdb_pg_get_int16(mdb,start);
- fprintf(stdout,"length = %3d\n",len);
- pos = start + 6;
- end = start + len;
- while (pos < end) {
- fprintf(stdout,"pos = %3d\n",pos);
- start = pos;
- tmp = mdb_pg_get_int16(mdb,pos); /* length of field */
- pos += 2;
- col_type = mdb_pg_get_int16(mdb,pos); /* ??? */
- pos += 2;
- col_num = 0;
- if (col_type) {
- col_num = mdb_pg_get_int16(mdb,pos);
- pos += 2;
- }
- val_len = mdb_pg_get_int16(mdb,pos);
- pos += 2;
- fprintf(stdout,"length = %3d %04x %2d %2d ",tmp, col_type, col_num, val_len);
- for (i=0;i<val_len;i++) {
- c = mdb->pg_buf[pos+i];
- if (isprint(c))
- fprintf(stdout," %c",c);
- else
- fprintf(stdout," %02x",c);
-
- }
- pos = start + tmp;
- prop = g_array_index(entry->props,MdbColumnProp,col_num);
- fprintf(stdout," Property %s",prop.name);
- fprintf(stdout,"\n");
- }
- return hash;
-}
-void mdb_kkd_dump(MdbCatalogEntry *entry)
-{
-int rows;
-int kkd_start, kkd_end;
-int i, tmp, pos, row_type, datapos=0;
-MdbColumnProp prop;
-MdbHandle *mdb = entry->mdb;
-int rowid = entry->kkd_rowid;
-
-
- mdb_read_pg(mdb, entry->kkd_pg);
- rows = mdb_pg_get_int16(mdb,8);
- fprintf(stdout,"number of rows = %d\n",rows);
- kkd_start = mdb_pg_get_int16(mdb,10+rowid*2);
- fprintf(stdout,"kkd start = %d %04x\n",kkd_start,kkd_start);
- kkd_end = mdb->fmt->pg_size;
- for (i=0;i<rows;i++) {
- tmp = mdb_pg_get_int16(mdb, 10+i*2);
- if (tmp < mdb->fmt->pg_size &&
- tmp > kkd_start &&
- tmp < kkd_end) {
- kkd_end = tmp;
- }
- }
- fprintf(stdout,"kkd end = %d %04x\n",kkd_end,kkd_end);
- pos = kkd_start + 4; /* 4 = K K D \0 */
- while (pos < kkd_end) {
- tmp = mdb_pg_get_int16(mdb,pos);
- row_type = mdb_pg_get_int16(mdb,pos+4);
- fprintf(stdout,"row size = %3d type = 0x%02x\n",tmp,row_type);
- if (row_type==0x80) {
- fprintf(stdout,"\nColumn Properties\n");
- fprintf(stdout,"-----------------\n");
- mdb_get_column_props(entry,pos);
- for (i=0;i<entry->num_props;i++) {
- prop = g_array_index(entry->props,MdbColumnProp,i);
- fprintf(stdout,"%3d %s\n",i,prop.name);
- }
- }
- if (row_type==0x01) datapos = pos;
- pos += tmp;
- }
-
- if (datapos) {
- mdb_get_column_def(entry, datapos);
- }
-}
-
diff --git a/navit/data/poi_geodownload/libmdb/map.c b/navit/data/poi_geodownload/libmdb/map.c
deleted file mode 100644
index 1164b7be..00000000
--- a/navit/data/poi_geodownload/libmdb/map.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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.
- */
-
-#include "mdbtools.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-static guint32
-mdb_map_find_next0(MdbHandle *mdb, unsigned char *map, unsigned int map_sz, guint32 start_pg)
-{
- guint32 pgnum, i, usage_bitlen;
- unsigned char *usage_bitmap;
-
- pgnum = mdb_get_int32(map, 1);
- usage_bitmap = map + 5;
- usage_bitlen = (map_sz - 5) * 8;
-
- i = (start_pg >= pgnum) ? start_pg-pgnum+1 : 0;
- for (; i<usage_bitlen; i++) {
- if (usage_bitmap[i/8] & (1 << (i%8))) {
- return pgnum + i;
- }
- }
- /* didn't find anything */
- return 0;
-}
-static int
-mdb_map_find_next1(MdbHandle *mdb, unsigned char *map, unsigned int map_sz, guint32 start_pg)
-{
- guint32 map_ind, max_map_pgs, offset, usage_bitlen;
-
- /*
- * start_pg will tell us where to (re)start the scan
- * for the next data page. each usage_map entry points to a
- * 0x05 page which bitmaps (mdb->fmt->pg_size - 4) * 8 pages.
- *
- * map_ind gives us the starting usage_map entry
- * offset gives us a page offset into the bitmap
- */
- usage_bitlen = (mdb->fmt->pg_size - 4) * 8;
- max_map_pgs = (map_sz - 1) / 4;
- map_ind = (start_pg + 1) / usage_bitlen;
- offset = (start_pg + 1) % usage_bitlen;
-
- for (; map_ind<max_map_pgs; map_ind++) {
- unsigned char *usage_bitmap;
- guint32 i, map_pg;
-
- if (!(map_pg = mdb_get_int32(map, (map_ind*4)+1))) {
- continue;
- }
- if(mdb_read_alt_pg(mdb, map_pg) != mdb->fmt->pg_size) {
- fprintf(stderr, "Oops! didn't get a full page at %d\n", map_pg);
- exit(1);
- }
-
- usage_bitmap = mdb->alt_pg_buf + 4;
- for (i=offset; i<usage_bitlen; i++) {
- if (usage_bitmap[i/8] & (1 << (i%8))) {
- return map_ind*usage_bitlen + i;
- }
- }
- offset = 0;
- }
- /* didn't find anything */
- return 0;
-}
-guint32
-mdb_map_find_next(MdbHandle *mdb, unsigned char *map, unsigned int map_sz, guint32 start_pg)
-{
- if (map[0] == 0) {
- return mdb_map_find_next0(mdb, map, map_sz, start_pg);
- } else if (map[0] == 1) {
- return mdb_map_find_next1(mdb, map, map_sz, start_pg);
- }
-
- fprintf(stderr, "Warning: unrecognized usage map type: %d\n", map[0]);
- return -1;
-}
-guint32
-mdb_alloc_page(MdbTableDef *table)
-{
- printf("Allocating new page\n");
- return 0;
-}
-guint32
-mdb_map_find_next_freepage(MdbTableDef *table, int row_size)
-{
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
- guint32 pgnum;
- guint32 cur_pg = 0;
- int free_space;
-
- do {
- pgnum = mdb_map_find_next(mdb,
- table->free_usage_map,
- table->freemap_sz, cur_pg);
- printf("looking at page %d\n", pgnum);
- if (!pgnum) {
- /* allocate new page */
- pgnum = mdb_alloc_page(table);
- return pgnum;
- }
- cur_pg = pgnum;
-
- mdb_read_pg(mdb, pgnum);
- free_space = mdb_pg_get_freespace(mdb);
-
- } while (free_space < row_size);
-
- printf("page %d has %d bytes left\n", pgnum, free_space);
-
- return pgnum;
-}
diff --git a/navit/data/poi_geodownload/libmdb/money.c b/navit/data/poi_geodownload/libmdb/money.c
deleted file mode 100644
index 7f2cf657..00000000
--- a/navit/data/poi_geodownload/libmdb/money.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 1998-1999 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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.
- */
-
-#include <stdio.h>
-#include "mdbtools.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-#define MAXPRECISION 20
-/*
-** these routines are copied from the freetds project which does something
-** very similiar
-*/
-
-static int multiply_byte(unsigned char *product, int num, unsigned char *multiplier);
-static int do_carry(unsigned char *product);
-static char *array_to_string(unsigned char *array, int unsigned scale, char *s);
-
-/**
- * mdb_money_to_string
- * @mdb: Handle to open MDB database file
- * @start: Offset of the field within the current page
- * @s: String that will receieve the value
- *
- * Returns: the string that has received the value.
- */
-char *mdb_money_to_string(MdbHandle *mdb, int start, char *s)
-{
- int num_bytes = 8;
- int i;
- int neg=0;
- unsigned char multiplier[MAXPRECISION], temp[MAXPRECISION];
- unsigned char product[MAXPRECISION];
- unsigned char money[num_bytes];
-
- memset(multiplier,0,MAXPRECISION);
- memset(product,0,MAXPRECISION);
- multiplier[0]=1;
- memcpy(money, mdb->pg_buf + start, num_bytes);
-
- /* Perform two's complement for negative numbers */
- if (money[7] & 0x80) {
- neg = 1;
- for (i=0;i<num_bytes;i++) {
- money[i] = ~money[i];
- }
- for (i=0; i<num_bytes; i++) {
- money[i] ++;
- if (money[i]!=0) break;
- }
- }
-
- for (i=0;i<num_bytes;i++) {
- /* product += multiplier * current byte */
- multiply_byte(product, money[i], multiplier);
-
- /* multiplier = multiplier * 256 */
- memcpy(temp, multiplier, MAXPRECISION);
- memset(multiplier,0,MAXPRECISION);
- multiply_byte(multiplier, 256, temp);
- }
- if (neg) {
- s[0]='-';
- array_to_string(product, 4, &s[1]);
- } else {
- array_to_string(product, 4, s);
- }
- return s;
-}
-static int multiply_byte(unsigned char *product, int num, unsigned char *multiplier)
-{
- unsigned char number[3];
- unsigned int i, j;
-
- number[0]=num%10;
- number[1]=(num/10)%10;
- number[2]=(num/100)%10;
-
- for (i=0;i<MAXPRECISION;i++) {
- if (multiplier[i] == 0) continue;
- for (j=0;j<3;j++) {
- if (number[j] == 0) continue;
- product[i+j] += multiplier[i]*number[j];
- }
- do_carry(product);
- }
- return 0;
-}
-static int do_carry(unsigned char *product)
-{
- unsigned int j;
-
- for (j=0;j<MAXPRECISION-1;j++) {
- if (product[j]>9) {
- product[j+1]+=product[j]/10;
- product[j]=product[j]%10;
- }
- }
- if (product[j]>9) {
- product[j]=product[j]%10;
- }
- return 0;
-}
-static char *array_to_string(unsigned char *array, unsigned int scale, char *s)
-{
- unsigned int top, i, j=0;
-
- for (top=MAXPRECISION;(top>0) && (top-1>scale) && !array[top-1];top--);
-
- if (top == 0) {
- s[j++] = '0';
- } else {
- for (i=top; i>0; i--) {
- if (j == top-scale) s[j++]='.';
- s[j++]=array[i-1]+'0';
- }
- }
- s[j]='\0';
-
- return s;
-}
diff --git a/navit/data/poi_geodownload/libmdb/options.c b/navit/data/poi_geodownload/libmdb/options.c
deleted file mode 100644
index cdbbc662..00000000
--- a/navit/data/poi_geodownload/libmdb/options.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 2004 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <stdlib.h>
-
-#include <mdbtools.h>
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-#define DEBUG 1
-
-static unsigned long opts;
-static int optset;
-
-static void load_options();
-
-void
-mdb_debug(int klass, char *fmt, ...)
-{
-#ifdef DEBUG
- va_list ap;
-
- if (!optset) load_options();
- if (klass & opts) {
- va_start(ap, fmt);
- vfprintf (stdout,fmt, ap);
- va_end(ap);
- fprintf(stdout,"\n");
- }
-#endif
-}
-
-static void
-load_options()
-{
- char *opt;
- char *s;
-
- if (!optset && (s=getenv("MDBOPTS"))) {
- opt = strtok(s, ":");
- do {
- if (!strcmp(opt, "use_index")) opts |= MDB_USE_INDEX;
- if (!strcmp(opt, "debug_like")) opts |= MDB_DEBUG_LIKE;
- if (!strcmp(opt, "debug_write")) opts |= MDB_DEBUG_WRITE;
- if (!strcmp(opt, "debug_usage")) opts |= MDB_DEBUG_USAGE;
- if (!strcmp(opt, "debug_ole")) opts |= MDB_DEBUG_OLE;
- if (!strcmp(opt, "debug_row")) opts |= MDB_DEBUG_ROW;
- if (!strcmp(opt, "debug_all")) {
- opts |= MDB_DEBUG_LIKE;
- opts |= MDB_DEBUG_WRITE;
- opts |= MDB_DEBUG_USAGE;
- opts |= MDB_DEBUG_OLE;
- opts |= MDB_DEBUG_ROW;
- }
- opt = strtok(NULL,":");
- } while (opt);
- }
- optset = 1;
-}
-int
-mdb_get_option(unsigned long optnum)
-{
- if (!optset) load_options();
- return ((opts & optnum) > 0);
-}
diff --git a/navit/data/poi_geodownload/libmdb/props.c b/navit/data/poi_geodownload/libmdb/props.c
deleted file mode 100644
index 61db9f54..00000000
--- a/navit/data/poi_geodownload/libmdb/props.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 2000 Brian Bruns
- *
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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.
- */
-
-#include "mdbtools.h"
-
-GPtrArray *
-mdb_read_props_list(gchar *kkd, int len)
-{
- guint32 record_len;
- int pos = 0;
- gchar *name;
- GPtrArray *names = NULL;
- int i = 0;
-
- names = g_ptr_array_new();
-#ifdef MDB_DEBUG
- buffer_dump(kkd, 0, len - 1);
-#endif
- pos = 0;
- while (pos < len) {
- record_len = mdb_get_int16(kkd, pos);
- pos += 2;
-#ifdef MDB_DEBUG
- printf("%02d ",i++);
- buffer_dump(kkd, pos - 2, pos + record_len - 1);
-#endif
- name = g_malloc(record_len + 1);
- strncpy(name, &kkd[pos], record_len);
- name[record_len] = '\0';
- pos += record_len;
- g_ptr_array_add(names, name);
-#ifdef MDB_DEBUG
- printf("new len = %d\n", names->len);
-#endif
- }
- return names;
-}
-void
-mdb_free_props(MdbProperties *props)
-{
- if (!props) return;
-
- if (props->name) g_free(props->name);
- g_free(props);
-}
-MdbProperties *
-mdb_alloc_props()
-{
- MdbProperties *props;
-
- props = g_malloc0(sizeof(MdbProperties));
-
- return props;
-}
-MdbProperties *
-mdb_read_props(MdbHandle *mdb, GPtrArray *names, gchar *kkd, int len)
-{
- guint32 record_len, name_len;
- int pos = 0;
- int elem, dtype, dsize;
- gchar *name, *value;
- MdbProperties *props;
- int i = 0;
-
-#ifdef MDB_DEBUG
- buffer_dump(kkd, 0, len - 1);
-#endif
- pos = 0;
-
- /* skip the name record */
- record_len = mdb_get_int16(kkd, pos);
- pos += 4;
- name_len = mdb_get_int16(kkd, pos);
- pos += 2;
- props = mdb_alloc_props();
- if (name_len) {
- props->name = g_malloc(name_len + 1);
- strncpy(props->name, &kkd[pos], name_len);
- props->name[name_len]='\0';
- }
- pos += name_len;
-
- props->hash = g_hash_table_new(g_str_hash, g_str_equal);
-
- while (pos < len) {
- record_len = mdb_get_int16(kkd, pos);
- elem = mdb_get_int16(kkd, pos + 4);
- dtype = kkd[pos + 3];
- dsize = mdb_get_int16(kkd, pos + 6);
- value = g_malloc(dsize + 1);
- strncpy(value, &kkd[pos + 8], dsize);
- value[dsize] = '\0';
- name = g_ptr_array_index(names,elem);
-#ifdef MDB_DEBUG
- printf("%02d ",i++);
- buffer_dump(kkd, pos, pos + record_len - 1);
- printf("elem %d dsize %d dtype %d\n", elem, dsize, dtype);
-#endif
- if (dtype == MDB_MEMO) dtype = MDB_TEXT;
- if (dtype == MDB_BOOL) {
- g_hash_table_insert(props->hash, g_strdup(name), g_strdup(kkd[pos + 8] ? "yes" : "no"));
- } else {
- g_hash_table_insert(props->hash, g_strdup(name), g_strdup(mdb_col_to_string(mdb, kkd, pos + 8, dtype, dsize)));
- }
- g_free(value);
- pos += record_len;
- }
- return props;
-
-}
diff --git a/navit/data/poi_geodownload/libmdb/sargs.c b/navit/data/poi_geodownload/libmdb/sargs.c
deleted file mode 100644
index b14aaa94..00000000
--- a/navit/data/poi_geodownload/libmdb/sargs.c
+++ /dev/null
@@ -1,273 +0,0 @@
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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.
- */
-
-/*
- * code for handling searchable arguments (sargs) used primary by the sql
- * engine to support where clause handling. The sargs are configured in
- * a tree with AND/OR operators connecting the child nodes. NOT operations
- * have only one child on the left side. Logical operators (=,<,>,etc..)
- * have no children.
- *
- * datatype support is a bit weak at this point. To add more types create
- * a mdb_test_[type]() function and invoke it from mdb_test_sarg()
- */
-#include "mdbtools.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-void
-mdb_sql_walk_tree(MdbSargNode *node, MdbSargTreeFunc func, gpointer data)
-{
- if (func(node, data))
- return;
- if (node->left) mdb_sql_walk_tree(node->left, func, data);
- if (node->right) mdb_sql_walk_tree(node->right, func, data);
-}
-int
-mdb_test_string(MdbSargNode *node, char *s)
-{
-int rc;
-
- if (node->op == MDB_LIKE) {
- return mdb_like_cmp(s,node->value.s);
- }
- rc = strncmp(node->value.s, s, 255);
- switch (node->op) {
- case MDB_EQUAL:
- if (rc==0) return 1;
- break;
- case MDB_GT:
- if (rc<0) return 1;
- break;
- case MDB_LT:
- if (rc>0) return 1;
- break;
- case MDB_GTEQ:
- if (rc<=0) return 1;
- break;
- case MDB_LTEQ:
- if (rc>=0) return 1;
- break;
- default:
- fprintf(stderr, "Calling mdb_test_sarg on unknown operator. Add code to mdb_test_string() for operator %d\n",node->op);
- break;
- }
- return 0;
-}
-int mdb_test_int(MdbSargNode *node, gint32 i)
-{
- switch (node->op) {
- case MDB_EQUAL:
- printf("comparing %x and %x %d\n", i, node->value.i, node->value.i == i);
- if (node->value.i == i) return 1;
- break;
- case MDB_GT:
- if (node->value.i < i) return 1;
- break;
- case MDB_LT:
- if (node->value.i > i) return 1;
- break;
- case MDB_GTEQ:
- if (node->value.i <= i) return 1;
- break;
- case MDB_LTEQ:
- if (node->value.i >= i) return 1;
- break;
- default:
- fprintf(stderr, "Calling mdb_test_sarg on unknown operator. Add code to mdb_test_int() for operator %d\n",node->op);
- break;
- }
- return 0;
-}
-#if 0
-#endif
-int
-mdb_find_indexable_sargs(MdbSargNode *node, gpointer data)
-{
- MdbSarg sarg;
-
- if (node->op == MDB_OR || node->op == MDB_NOT) return 1;
-
- /*
- * right now all we do is look for sargs that are anded together from
- * the root. Later we may put together OR ops into a range, and then
- * range scan the leaf pages. That is col1 = 2 or col1 = 4 becomes
- * col1 >= 2 and col1 <= 4 for the purpose of index scans, and then
- * extra rows are thrown out when the row is tested against the main
- * sarg tree. range scans are generally only a bit better than table
- * scanning anyway.
- *
- * also, later we should support the NOT operator, but it's generally
- * a pretty worthless test for indexes, ie NOT col1 = 3, we are
- * probably better off table scanning.
- */
- if (mdb_is_relational_op(node->op) && node->col) {
- //printf("op = %d value = %s\n", node->op, node->value.s);
- sarg.op = node->op;
- sarg.value = node->value;
- mdb_add_sarg(node->col, &sarg);
- }
- return 0;
-}
-int
-mdb_test_sarg(MdbHandle *mdb, MdbColumn *col, MdbSargNode *node, MdbField *field)
-{
-char tmpbuf[256];
-int lastchar;
-
- if (node->op == MDB_ISNULL) {
- if (field->is_null) return 0;
- else return 1;
- } else if (node->op == MDB_NOTNULL) {
- if (field->is_null) return 1;
- else return 0;
- }
- switch (col->col_type) {
- case MDB_BOOL:
- return mdb_test_int(node, !field->is_null);
- break;
- case MDB_BYTE:
- return mdb_test_int(node, (gint32)((char *)field->value)[0]);
- break;
- case MDB_INT:
- return mdb_test_int(node, (gint32)mdb_get_int16(field->value, 0));
- break;
- case MDB_LONGINT:
- return mdb_test_int(node, (gint32)mdb_get_int32(field->value, 0));
- break;
- case MDB_TEXT:
- if (IS_JET4(mdb)) {
- mdb_unicode2ascii(mdb, field->value, 0, field->siz, tmpbuf);
- } else {
- strncpy(tmpbuf, field->value, 255);
- lastchar = field->siz > 255 ? 255 : field->siz;
- tmpbuf[lastchar]='\0';
- }
- return mdb_test_string(node, tmpbuf);
- default:
- fprintf(stderr, "Calling mdb_test_sarg on unknown type. Add code to mdb_test_sarg() for type %d\n",col->col_type);
- break;
- }
- return 1;
-}
-int
-mdb_find_field(int col_num, MdbField *fields, int num_fields)
-{
- int i;
-
- for (i=0;i<num_fields;i++) {
- if (fields[i].colnum == col_num) return i;
- }
- return -1;
-}
-int
-mdb_test_sarg_node(MdbHandle *mdb, MdbSargNode *node, MdbField *fields, int num_fields)
-{
- int elem;
- MdbColumn *col;
- int rc;
-
- if (mdb_is_relational_op(node->op)) {
- col = node->col;
- /* for const = const expressions */
- if (!col) {
- return (node->value.i);
- }
- elem = mdb_find_field(col->col_num, fields, num_fields);
- if (!mdb_test_sarg(mdb, col, node, &fields[elem]))
- return 0;
- } else { /* logical op */
- switch (node->op) {
- case MDB_NOT:
- rc = mdb_test_sarg_node(mdb, node->left, fields, num_fields);
- return !rc;
- break;
- case MDB_AND:
- if (!mdb_test_sarg_node(mdb, node->left, fields, num_fields))
- return 0;
- return mdb_test_sarg_node(mdb, node->right, fields, num_fields);
- break;
- case MDB_OR:
- if (mdb_test_sarg_node(mdb, node->left, fields, num_fields))
- return 1;
- return mdb_test_sarg_node(mdb, node->right, fields, num_fields);
- break;
- }
- }
- return 1;
-}
-int
-mdb_test_sargs(MdbTableDef *table, MdbField *fields, int num_fields)
-{
- MdbSargNode *node;
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
-
- node = table->sarg_tree;
-
- /* there may not be a sarg tree */
- if (!node) return 1;
-
- return mdb_test_sarg_node(mdb, node, fields, num_fields);
-}
-#if 0
-int mdb_test_sargs(MdbHandle *mdb, MdbColumn *col, int offset, int len)
-{
-MdbSarg *sarg;
-int i;
-
- for (i=0;i<col->num_sargs;i++) {
- sarg = g_ptr_array_index (col->sargs, i);
- if (!mdb_test_sarg(mdb, col, sarg, offset, len)) {
- /* sarg didn't match, no sense going on */
- return 0;
- }
- }
-
- return 1;
-}
-#endif
-int mdb_add_sarg(MdbColumn *col, MdbSarg *in_sarg)
-{
-MdbSarg *sarg;
- if (!col->sargs) {
- col->sargs = g_ptr_array_new();
- }
- sarg = g_memdup(in_sarg,sizeof(MdbSarg));
- g_ptr_array_add(col->sargs, sarg);
- col->num_sargs++;
-
- return 1;
-}
-int mdb_add_sarg_by_name(MdbTableDef *table, char *colname, MdbSarg *in_sarg)
-{
- MdbColumn *col;
- unsigned int i;
-
- for (i=0;i<table->num_cols;i++) {
- col = g_ptr_array_index (table->columns, i);
- if (!strcasecmp(col->name,colname)) {
- return mdb_add_sarg(col, in_sarg);
- }
- }
- /* else didn't find the column return 0! */
- return 0;
-}
diff --git a/navit/data/poi_geodownload/libmdb/table.c b/navit/data/poi_geodownload/libmdb/table.c
deleted file mode 100644
index 52238ecd..00000000
--- a/navit/data/poi_geodownload/libmdb/table.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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.
- */
-
-#include "mdbtools.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-
-static gint mdb_col_comparer(MdbColumn **a, MdbColumn **b)
-{
- if ((*a)->col_num > (*b)->col_num)
- return 1;
- else if ((*a)->col_num < (*b)->col_num)
- return -1;
- else
- return 0;
-}
-
-static unsigned char mdb_col_needs_size(int col_type)
-{
- if (col_type == MDB_TEXT) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-MdbTableDef *mdb_alloc_tabledef(MdbCatalogEntry *entry)
-{
- MdbTableDef *table;
-
- table = (MdbTableDef *) g_malloc0(sizeof(MdbTableDef));
- table->entry=entry;
- strcpy(table->name, entry->object_name);
-
- return table;
-}
-void mdb_free_tabledef(MdbTableDef *table)
-{
- if (!table) return;
- if (table->is_temp_table) {
- unsigned int i;
- for (i=0; i<table->temp_table_pages->len; i++)
- g_free(g_ptr_array_index(table->temp_table_pages,i));
- g_ptr_array_free(table->temp_table_pages, TRUE);
- }
- mdb_free_columns(table->columns);
- mdb_free_indices(table->indices);
- g_free(table->usage_map);
- g_free(table->free_usage_map);
- g_free(table);
-}
-MdbTableDef *mdb_read_table(MdbCatalogEntry *entry)
-{
- MdbTableDef *table;
- MdbHandle *mdb = entry->mdb;
- MdbFormatConstants *fmt = mdb->fmt;
- int len, row_start, pg_row;
- char *buf;
-
- table = mdb_alloc_tabledef(entry);
-
- mdb_read_pg(mdb, entry->table_pg);
- if (mdb->pg_buf[0] != 0x02) return NULL; /* not a valid table def page */
-
- len = mdb_pg_get_int16(mdb,8);
-
- table->num_rows = mdb_pg_get_int32(mdb, fmt->tab_num_rows_offset);
- table->num_var_cols = mdb_pg_get_int16(mdb, fmt->tab_num_cols_offset-2);
- table->num_cols = mdb_pg_get_int16(mdb, fmt->tab_num_cols_offset);
- table->num_idxs = mdb_pg_get_int32(mdb, fmt->tab_num_idxs_offset);
- table->num_real_idxs = mdb_pg_get_int32(mdb, fmt->tab_num_ridxs_offset);
- /* grab a copy of the usage map */
- pg_row = mdb_pg_get_int32(mdb, fmt->tab_usage_map_offset);
- mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &(table->map_sz));
- table->usage_map = g_memdup(buf + row_start, table->map_sz);
- if (mdb_get_option(MDB_DEBUG_USAGE))
- buffer_dump(buf, row_start, row_start+table->map_sz-1);
- mdb_debug(MDB_DEBUG_USAGE,"usage map found on page %ld row %d start %d len %d",
- pg_row >> 8, pg_row & 0xff, row_start, table->map_sz);
-
- /* grab a copy of the free space page map */
- pg_row = mdb_pg_get_int32(mdb, fmt->tab_free_map_offset);
- mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &(table->freemap_sz));
- table->free_usage_map = g_memdup(buf + row_start, table->freemap_sz);
- mdb_debug(MDB_DEBUG_USAGE,"free map found on page %ld row %d start %d len %d\n",
- pg_row >> 8, pg_row & 0xff, row_start, table->freemap_sz);
-
- table->first_data_pg = mdb_pg_get_int16(mdb, fmt->tab_first_dpg_offset);
-
- return table;
-}
-MdbTableDef *mdb_read_table_by_name(MdbHandle *mdb, gchar *table_name, int obj_type)
-{
- unsigned int i;
- MdbCatalogEntry *entry;
-
- mdb_read_catalog(mdb, obj_type);
-
- for (i=0; i<mdb->num_catalog; i++) {
- entry = g_ptr_array_index(mdb->catalog, i);
- if (!strcasecmp(entry->object_name, table_name))
- return mdb_read_table(entry);
- }
-
- return NULL;
-}
-
-/*
-** read the next page if offset is > pg_size
-** return true if page was read
-*/
-int
-read_pg_if(MdbHandle *mdb, int *cur_pos, int offset)
-{
- if (*cur_pos + offset >= mdb->fmt->pg_size) {
- mdb_read_pg(mdb, mdb_pg_get_int32(mdb,4));
- *cur_pos = 8 - (mdb->fmt->pg_size - (*cur_pos));
- return 1;
- }
- return 0;
-}
-guint32
-read_pg_if_32(MdbHandle *mdb, int *cur_pos)
-{
- unsigned char c[4];
- int i, rc = 0;
-
- for (i=0;i<4;i++) {
- rc += read_pg_if(mdb, cur_pos, i);
- c[i] = mdb->pg_buf[(*cur_pos) + i];
- }
- return mdb_get_int32(c, 0);
-}
-guint16
-read_pg_if_16(MdbHandle *mdb, int *cur_pos)
-{
- unsigned char low_byte, high_byte;
- int rc = 0;
-
- rc += read_pg_if(mdb, cur_pos, 0);
- low_byte = mdb->pg_buf[*cur_pos];
- rc += read_pg_if(mdb, cur_pos, 1);
- high_byte = mdb->pg_buf[(*cur_pos) + 1];
-
- return (high_byte * 256 + low_byte);
-}
-guint16
-read_pg_if_n(MdbHandle *mdb, unsigned char *buf, int *cur_pos, int len)
-{
- if (*cur_pos + len < mdb->fmt->pg_size) {
- memcpy(buf, &mdb->pg_buf[*cur_pos], len);
- return 0;
- } else {
- int half = mdb->fmt->pg_size - *cur_pos;
- memcpy(buf, &mdb->pg_buf[*cur_pos], half);
- mdb_read_pg(mdb, mdb_pg_get_int32(mdb,4));
- memcpy(buf + half, &mdb->pg_buf[8], len - half);
- *cur_pos = 8 - half;
- return 1;
- }
-}
-
-void mdb_append_column(GPtrArray *columns, MdbColumn *in_col)
-{
- g_ptr_array_add(columns, g_memdup(in_col,sizeof(MdbColumn)));
-}
-void mdb_free_columns(GPtrArray *columns)
-{
- unsigned int i;
-
- if (!columns) return;
- for (i=0; i<columns->len; i++)
- g_free (g_ptr_array_index(columns, i));
- g_ptr_array_free(columns, TRUE);
-}
-GPtrArray *mdb_read_columns(MdbTableDef *table)
-{
- MdbHandle *mdb = table->entry->mdb;
- MdbFormatConstants *fmt = mdb->fmt;
- MdbColumn *pcol;
- unsigned char *col;
- unsigned int i;
- int cur_pos, name_sz;
-
- table->columns = g_ptr_array_new();
-
- col = (unsigned char *) g_malloc(fmt->tab_col_entry_size);
-
- cur_pos = fmt->tab_cols_start_offset +
- (table->num_real_idxs * fmt->tab_ridx_entry_size);
-
- /* new code based on patch submitted by Tim Nelson 2000.09.27 */
-
- /*
- ** column attributes
- */
- for (i=0;i<table->num_cols;i++) {
-#ifdef MDB_DEBUG
- /* printf("column %d\n", i);
- buffer_dump(mdb->pg_buf, cur_pos ,cur_pos + 18); */
-#endif
- read_pg_if_n(mdb, col, &cur_pos, fmt->tab_col_entry_size);
- cur_pos += fmt->tab_col_entry_size;
- pcol = (MdbColumn *) g_malloc0(sizeof(MdbColumn));
-
- pcol->col_type = col[0];
-
- // col_num_offset == 1 or 5
- pcol->col_num = col[fmt->col_num_offset];
-
- //fprintf(stdout,"----- column %d -----\n",pcol->col_num);
- // col_var == 3 or 7
- pcol->var_col_num = mdb_get_int16(col, fmt->tab_col_offset_var);
- //fprintf(stdout,"var column pos %d\n",pcol->var_col_num);
-
- // col_var == 5 or 9
- pcol->row_col_num = mdb_get_int16(col, fmt->tab_row_col_num_offset);
- //fprintf(stdout,"row column num %d\n",pcol->row_col_num);
-
- /* FIXME: can this be right in Jet3 and Jet4? */
- if (pcol->col_type == MDB_NUMERIC) {
- pcol->col_prec = col[11];
- pcol->col_scale = col[12];
- }
-
- // col_fixed_offset == 13 or 15
- pcol->is_fixed = col[fmt->col_fixed_offset] & 0x01 ? 1 : 0;
-
- // col_fixed_offset == 13 or 15
- pcol->fixed_offset = mdb_get_int16(col, fmt->tab_col_offset_fixed);
- //fprintf(stdout,"fixed column offset %d\n",pcol->fixed_offset);
- //fprintf(stdout,"col type %s\n",pcol->is_fixed ? "fixed" : "variable");
-
- if (pcol->col_type != MDB_BOOL) {
- // col_size_offset == 16 or 23
- pcol->col_size = mdb_get_int16(col, fmt->col_size_offset);
- } else {
- pcol->col_size=0;
- }
-
- g_ptr_array_add(table->columns, pcol);
- }
-
- g_free (col);
-
- /*
- ** column names - ordered the same as the column attributes table
- */
- for (i=0;i<table->num_cols;i++) {
- pcol = g_ptr_array_index(table->columns, i);
-
- if (IS_JET4(mdb)) {
- char *tmp_buf;
- name_sz = read_pg_if_16(mdb, &cur_pos);
- cur_pos += 2;
- tmp_buf = (char *) g_malloc(name_sz);
- read_pg_if_n(mdb, tmp_buf, &cur_pos, name_sz);
- mdb_unicode2ascii(mdb, tmp_buf, 0, name_sz, pcol->name);
- g_free(tmp_buf);
- cur_pos += name_sz;
- } else if (IS_JET3(mdb)) {
- read_pg_if(mdb, &cur_pos, 0);
- name_sz = mdb->pg_buf[cur_pos];
- cur_pos++;
- read_pg_if_n(mdb, pcol->name, &cur_pos, name_sz);
- pcol->name[name_sz]='\0';
- cur_pos += name_sz;
- } else {
- fprintf(stderr,"Unknown MDB version\n");
- }
- }
-
- /* Sort the columns by col_num */
- g_ptr_array_sort(table->columns, (GCompareFunc)mdb_col_comparer);
-
- table->index_start = cur_pos;
- return table->columns;
-}
-
-void mdb_table_dump(MdbCatalogEntry *entry)
-{
-MdbTableDef *table;
-MdbColumn *col;
-int coln;
-MdbIndex *idx;
-MdbHandle *mdb = entry->mdb;
-unsigned int i, bitn;
-guint32 pgnum;
-
- table = mdb_read_table(entry);
- fprintf(stdout,"definition page = %lu\n",entry->table_pg);
- fprintf(stdout,"number of datarows = %d\n",table->num_rows);
- fprintf(stdout,"number of columns = %d\n",table->num_cols);
- fprintf(stdout,"number of indices = %d\n",table->num_real_idxs);
-
- mdb_read_columns(table);
- mdb_read_indices(table);
-
- for (i=0;i<table->num_cols;i++) {
- col = g_ptr_array_index(table->columns,i);
-
- fprintf(stdout,"column %d Name: %-20s Type: %s(%d)\n",
- i, col->name,
- mdb_get_coltype_string(mdb->default_backend, col->col_type),
- col->col_size);
- }
-
- for (i=0;i<table->num_idxs;i++) {
- idx = g_ptr_array_index (table->indices, i);
- mdb_index_dump(table, idx);
- }
- if (table->usage_map) {
- printf("pages reserved by this object\n");
- printf("usage map pg %" G_GUINT32_FORMAT "\n",
- table->map_base_pg);
- printf("free map pg %" G_GUINT32_FORMAT "\n",
- table->freemap_base_pg);
- pgnum = mdb_get_int32(table->usage_map,1);
- /* the first 5 bytes of the usage map mean something */
- coln = 0;
- for (i=5;i<table->map_sz;i++) {
- for (bitn=0;bitn<8;bitn++) {
- if (table->usage_map[i] & 1 << bitn) {
- coln++;
- printf("%6" G_GUINT32_FORMAT, pgnum);
- if (coln==10) {
- printf("\n");
- coln = 0;
- } else {
- printf(" ");
- }
- }
- pgnum++;
- }
- }
- printf("\n");
- }
-}
-
-int mdb_is_user_table(MdbCatalogEntry *entry)
-{
- return ((entry->object_type == MDB_TABLE)
- && !(entry->flags & 0x80000002)) ? 1 : 0;
-}
-int mdb_is_system_table(MdbCatalogEntry *entry)
-{
- return ((entry->object_type == MDB_TABLE)
- && (entry->flags & 0x80000002)) ? 1 : 0;
-}
diff --git a/navit/data/poi_geodownload/libmdb/write.c b/navit/data/poi_geodownload/libmdb/write.c
deleted file mode 100644
index 1cff96a4..00000000
--- a/navit/data/poi_geodownload/libmdb/write.c
+++ /dev/null
@@ -1,878 +0,0 @@
-/* MDB Tools - A library for reading MS Access database file
- * Copyright (C) 2000 Brian Bruns
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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.
- */
-
-#include "mdbtools.h"
-#include "time.h"
-#include "math.h"
-
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
-
-//static int mdb_copy_index_pg(MdbTableDef *table, MdbIndex *idx, MdbIndexPage *ipg);
-static int mdb_add_row_to_leaf_pg(MdbTableDef *table, MdbIndex *idx, MdbIndexPage *ipg, MdbField *idx_fields);
-
-void
-_mdb_put_int16(unsigned char *buf, guint32 offset, guint32 value)
-{
- buf[offset] = value % 256;
- value /= 256;
- buf[offset+1] = value % 256;
-}
-void
-_mdb_put_int32(unsigned char *buf, guint32 offset, guint32 value)
-{
- buf[offset] = value % 256;
- value /= 256;
- buf[offset+1] = value % 256;
- value /= 256;
- buf[offset+2] = value % 256;
- value /= 256;
- buf[offset+3] = value % 256;
-}
-ssize_t
-mdb_write_pg(MdbHandle *mdb, unsigned long pg)
-{
- ssize_t len;
- struct stat status;
- off_t offset = pg * mdb->fmt->pg_size;
-
- fstat(mdb->f->fd, &status);
- /* is page beyond current size + 1 ? */
- if (status.st_size < offset + mdb->fmt->pg_size) {
- fprintf(stderr,"offset %lu is beyond EOF\n",offset);
- return 0;
- }
- lseek(mdb->f->fd, offset, SEEK_SET);
- len = write(mdb->f->fd,mdb->pg_buf,mdb->fmt->pg_size);
- if (len==-1) {
- perror("write");
- return 0;
- } else if (len<mdb->fmt->pg_size) {
- /* fprintf(stderr,"EOF reached %d bytes returned.\n",len, mdb->pg_size); */
- return 0;
- }
- mdb->cur_pos = 0;
- return len;
-}
-
-static int
-mdb_is_col_indexed(MdbTableDef *table, int colnum)
-{
- unsigned int i, j;
- MdbIndex *idx;
-
- for (i=0;i<table->num_idxs;i++) {
- idx = g_ptr_array_index (table->indices, i);
- for (j=0;j<idx->num_keys;j++) {
- if (idx->key_col_num[j]==colnum) return 1;
- }
- }
- return 0;
-}
-static int
-mdb_crack_row4(MdbTableDef *table, int row_start, int row_end, MdbField *fields)
-{
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
- MdbColumn *col;
- unsigned char *pg_buf = mdb->pg_buf;
- unsigned int i;
- unsigned int row_var_cols=0, row_fixed_cols, row_cols;
- unsigned int fixed_cols_found;
- unsigned int col_start;
- unsigned char *nullmask;
- unsigned int bitmask_sz;
- unsigned int byte_num, bit_num;
- unsigned int *var_col_offsets = NULL;
-
- if (mdb_get_option(MDB_DEBUG_ROW)) {
- buffer_dump(pg_buf, row_start, row_end);
- }
-
- row_cols = mdb_pg_get_int16(mdb, row_start);
-
- bitmask_sz = (row_cols + 7) / 8;
- nullmask = &pg_buf[row_end - bitmask_sz + 1];
-
- /* read table of variable column locations */
- if (table->num_var_cols > 0) {
- row_var_cols = mdb_pg_get_int16(mdb, row_end - bitmask_sz - 1);
- var_col_offsets = (int *)g_malloc((row_var_cols+1)*sizeof(int));
- for (i=0; i<row_var_cols+1; i++) {
- var_col_offsets[i] = mdb_pg_get_int16(mdb,
- row_end - bitmask_sz - 3 - (i*2));
- }
- }
- fixed_cols_found = 0;
- row_fixed_cols = row_cols - row_var_cols;
-
- /* read information into fields[] */
- for (i=0;i<table->num_cols;i++) {
- col = g_ptr_array_index(table->columns,i);
- fields[i].colnum = i;
- fields[i].is_fixed = (mdb_is_fixed_col(col)) ? 1 : 0;
- byte_num = col->col_num / 8;
- bit_num = col->col_num % 8;
- /* logic on nulls is reverse, 1 is not null, 0 is null */
- fields[i].is_null = nullmask[byte_num] & (1 << bit_num) ? 0 : 1;
-
- if ((fields[i].is_fixed)
- && (fixed_cols_found < row_fixed_cols)) {
- col_start = col->fixed_offset + 2;
- fields[i].start = row_start + col_start;
- fields[i].value = &pg_buf[row_start + col_start];
- fields[i].siz = col->col_size;
- fixed_cols_found++;
- /* Use col->var_col_num because a deleted column is still
- * present in the variable column offsets table for the row */
- } else if ((!fields[i].is_fixed)
- && (col->var_col_num < row_var_cols)) {
- col_start = var_col_offsets[col->var_col_num];
- fields[i].start = row_start + col_start;
- fields[i].value = &pg_buf[row_start + col_start];
- fields[i].siz = var_col_offsets[(col->var_col_num)+1] -
- col_start;
- } else {
- fields[i].start = 0;
- fields[i].value = NULL;
- fields[i].siz = 0;
- fields[i].is_null = 1;
- }
- }
- g_free(var_col_offsets);
-
- return row_cols;
-}
-static int
-mdb_crack_row3(MdbTableDef *table, int row_start, int row_end, MdbField *fields)
-{
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
- MdbColumn *col;
- unsigned char *pg_buf = mdb->pg_buf;
- unsigned int i;
- unsigned int row_var_cols = 0, row_fixed_cols, row_cols;
- unsigned int fixed_cols_found, var_cols_found;
- unsigned int col_start;
- unsigned char *nullmask;
- unsigned int bitmask_sz;
- unsigned int byte_num, bit_num;
- unsigned int *var_col_offsets = NULL;
- unsigned int num_jumps = 0, jumps_used = 0;
- unsigned int col_ptr, row_len;
-
- if (mdb_get_option(MDB_DEBUG_ROW)) {
- buffer_dump(pg_buf, row_start, row_end);
- }
-
- row_cols = pg_buf[row_start];
-
- bitmask_sz = (row_cols + 7) / 8;
- nullmask = &pg_buf[row_end - bitmask_sz + 1];
-
- /* read table of variable column locations */
- if (table->num_var_cols > 0) {
- row_var_cols = pg_buf[row_end - bitmask_sz];
- row_len = row_end - row_start + 1;
- num_jumps = (row_len - 1) / 256;
- col_ptr = row_end - bitmask_sz - num_jumps - 1;
- /* If last jump is a dummy value, ignore it */
- if ((col_ptr-row_start-row_var_cols)/256 < num_jumps)
- num_jumps--;
-
- var_col_offsets = (int *)g_malloc((row_var_cols+1)*sizeof(int));
- jumps_used = 0;
- for (i=0; i<row_var_cols+1; i++) {
- if ((jumps_used < num_jumps)
- && (i == pg_buf[row_end-bitmask_sz-jumps_used-1])) {
- jumps_used++;
- }
- var_col_offsets[i] = pg_buf[col_ptr-i]+(jumps_used*256);
- }
- }
- fixed_cols_found = 0;
- var_cols_found = 0;
- row_fixed_cols = row_cols - row_var_cols;
-
- if (mdb_get_option(MDB_DEBUG_ROW)) {
- fprintf(stdout,"bitmask_sz %d num_jumps %d\n",bitmask_sz, num_jumps);
- fprintf(stdout,"row_var_cols %d\n", row_var_cols);
- fprintf(stdout,"row_fixed_cols %d\n", row_fixed_cols);
- }
-
- /* read information into fields[] */
- for (i=0;i<table->num_cols;i++) {
- col = g_ptr_array_index (table->columns, i);
- fields[i].colnum = i;
- fields[i].is_fixed = (mdb_is_fixed_col(col)) ? 1 : 0;
- byte_num = col->col_num / 8;
- bit_num = col->col_num % 8;
- /* logic on nulls is reverse, 1 is not null, 0 is null */
- fields[i].is_null = nullmask[byte_num] & (1 << bit_num) ? 0 : 1;
-
- if ((fields[i].is_fixed)
- && (fixed_cols_found < row_fixed_cols)) {
- col_start = col->fixed_offset + 1;
- fields[i].start = row_start + col_start;
- fields[i].value = &pg_buf[row_start + col_start];
- fields[i].siz = col->col_size;
- fixed_cols_found++;
- } else if ((!fields[i].is_fixed)
- && (var_cols_found < row_var_cols)) {
- col_start = var_col_offsets[var_cols_found];
- fields[i].start = row_start + col_start;
- fields[i].value = &pg_buf[row_start + col_start];
- fields[i].siz = var_col_offsets[var_cols_found+1] -
- col_start;
- var_cols_found++;
- } else {
- fields[i].start = 0;
- fields[i].value = NULL;
- fields[i].siz = 0;
- fields[i].is_null = 1;
- }
- }
- g_free(var_col_offsets);
-
- return row_cols;
-}
-/**
- * mdb_crack_row:
- * @table: Table that the row belongs to
- * @row_start: offset to start of row on current page
- * @row_end: offset to end of row on current page
- * @fields: pointer to MdbField array to be popluated by mdb_crack_row
- *
- * Cracks a row buffer apart into its component fields.
- *
- * A row buffer is that portion of a data page which contains the values for
- * that row. Its beginning and end can be found in the row offset table.
- *
- * The resulting MdbField array contains pointers into the row for each field
- * present. Be aware that by modifying field[]->value, you would be modifying
- * the row buffer itself, not a copy.
- *
- * This routine is mostly used internally by mdb_fetch_row() but may have some
- * applicability for advanced application programs.
- *
- * Return value: number of fields present.
- */
-int
-mdb_crack_row(MdbTableDef *table, int row_start, int row_end, MdbField *fields)
-{
-MdbCatalogEntry *entry = table->entry;
-MdbHandle *mdb = entry->mdb;
-
- if (IS_JET4(mdb)) {
- return mdb_crack_row4(table, row_start, row_end, fields);
- } else {
- return mdb_crack_row3(table, row_start, row_end, fields);
- }
-}
-
-static int
-mdb_pack_null_mask(unsigned char *buffer, int num_fields, MdbField *fields)
-{
- int pos = 0, bit = 0, byte = 0;
- int i;
-
- /* 'Not null' bitmap */
- for (i=0; i<num_fields; i++) {
- /* column is null if bit is clear (0) */
- if (!fields[i].is_null) {
- byte |= 1 << bit;
- //printf("%d %d %d %d\n", i, bit, 1 << bit, byte);
- }
- bit++;
- if (bit==8) {
- buffer[pos++] = byte;
- bit = byte = 0;
- }
- }
- /* if we've written any bits to the current byte, flush it */
- if (bit)
- buffer[pos++] = byte;
-
- return pos;
-}
-/* fields must be ordered with fixed columns first, then vars, subsorted by
- * column number */
-static int
-mdb_pack_row4(MdbTableDef *table, unsigned char *row_buffer, unsigned int num_fields, MdbField *fields)
-{
- unsigned int pos = 0;
- unsigned int var_cols = 0;
- unsigned int i;
-
- row_buffer[pos++] = num_fields & 0xff;
- row_buffer[pos++] = (num_fields >> 8) & 0xff;
-
- /* Fixed length columns */
- for (i=0;i<num_fields;i++) {
- if (fields[i].is_fixed) {
- fields[i].offset = pos;
- if (!fields[i].is_null) {
- memcpy(&row_buffer[pos], fields[i].value, fields[i].siz);
- }
- pos += fields[i].siz;
- }
- }
- /* For tables without variable-length columns */
- if (table->num_var_cols == 0) {
- pos += mdb_pack_null_mask(&row_buffer[pos], num_fields, fields);
- return pos;
- }
- /* Variable length columns */
- for (i=0;i<num_fields;i++) {
- if (!fields[i].is_fixed) {
- var_cols++;
- fields[i].offset = pos;
- if (! fields[i].is_null) {
- memcpy(&row_buffer[pos], fields[i].value, fields[i].siz);
- pos += fields[i].siz;
- }
- }
- }
- /* EOD */
- row_buffer[pos] = pos & 0xff;
- row_buffer[pos+1] = (pos >> 8) & 0xff;
- pos += 2;
-
- /* Offsets of the variable-length columns */
- for (i=num_fields; i>0; i--) {
- if (!fields[i-1].is_fixed) {
- row_buffer[pos++] = fields[i-1].offset & 0xff;
- row_buffer[pos++] = (fields[i-1].offset >> 8) & 0xff;
- }
- }
- /* Number of variable-length columns */
- row_buffer[pos++] = var_cols & 0xff;
- row_buffer[pos++] = (var_cols >> 8) & 0xff;
-
- pos += mdb_pack_null_mask(&row_buffer[pos], num_fields, fields);
- return pos;
-}
-
-static int
-mdb_pack_row3(MdbTableDef *table, unsigned char *row_buffer, unsigned int num_fields, MdbField *fields)
-{
- unsigned int pos = 0;
- unsigned int var_cols = 0;
- unsigned int i, j;
- unsigned char *offset_high;
-
- row_buffer[pos++] = num_fields;
-
- /* Fixed length columns */
- for (i=0;i<num_fields;i++) {
- if (fields[i].is_fixed) {
- fields[i].offset = pos;
- if (!fields[i].is_null) {
- memcpy(&row_buffer[pos], fields[i].value, fields[i].siz);
- }
- pos += fields[i].siz;
- }
- }
- /* For tables without variable-length columns */
- if (table->num_var_cols == 0) {
- pos += mdb_pack_null_mask(&row_buffer[pos], num_fields, fields);
- return pos;
- }
- /* Variable length columns */
- for (i=0;i<num_fields;i++) {
- if (!fields[i].is_fixed) {
- var_cols++;
- fields[i].offset = pos;
- if (! fields[i].is_null) {
- memcpy(&row_buffer[pos], fields[i].value, fields[i].siz);
- pos += fields[i].siz;
- }
- }
- }
-
- offset_high = (unsigned char *) g_malloc(var_cols+1);
- offset_high[0] = (pos << 8) & 0xff;
- j = 1;
-
- /* EOD */
- row_buffer[pos] = pos & 0xff;
- pos++;
-
- /* Variable length column offsets */
- for (i=num_fields; i>0; i--) {
- if (!fields[i-1].is_fixed) {
- row_buffer[pos++] = fields[i-1].offset & 0xff;
- offset_high[j++] = (fields[i-1].offset << 8) & 0xff;
- }
- }
-
- /* Dummy jump table entry */
- if (offset_high[0] < (pos+(num_fields+7)/8-1)/255) {
- row_buffer[pos++] = 0xff;
- }
- /* Jump table */
- for (i=0; i<var_cols; i++) {
- if (offset_high[i] > offset_high[i+1]) {
- row_buffer[pos++] = var_cols-i;
- }
- }
- g_free(offset_high);
-
- row_buffer[pos++] = var_cols;
-
- pos += mdb_pack_null_mask(&row_buffer[pos], num_fields, fields);
- return pos;
-}
-int
-mdb_pack_row(MdbTableDef *table, unsigned char *row_buffer, int unsigned num_fields, MdbField *fields)
-{
- if (table->is_temp_table) {
- unsigned int i;
- for (i=0; i<num_fields; i++) {
- MdbColumn *c = g_ptr_array_index(table->columns, i);
- fields[i].is_null = (fields[i].value) ? 0 : 1;
- fields[i].colnum = i;
- fields[i].is_fixed = c->is_fixed;
- if ((c->col_type != MDB_TEXT)
- && (c->col_type != MDB_MEMO)) {
- fields[i].siz = c->col_size;
- }
- }
- }
- if (IS_JET4(table->entry->mdb)) {
- return mdb_pack_row4(table, row_buffer, num_fields, fields);
- } else {
- return mdb_pack_row3(table, row_buffer, num_fields, fields);
- }
-}
-int
-mdb_pg_get_freespace(MdbHandle *mdb)
-{
- int rows, free_start, free_end;
- int row_count_offset = mdb->fmt->row_count_offset;
-
- rows = mdb_pg_get_int16(mdb, row_count_offset);
- free_start = row_count_offset + 2 + (rows * 2);
- free_end = mdb_pg_get_int16(mdb, row_count_offset + (rows * 2));
- mdb_debug(MDB_DEBUG_WRITE,"free space left on page = %d", free_end - free_start);
- return (free_end - free_start);
-}
-unsigned char *
-mdb_new_leaf_pg(MdbCatalogEntry *entry)
-{
- MdbHandle *mdb = entry->mdb;
- unsigned char *new_pg;
-
- new_pg = (unsigned char *) g_malloc0(mdb->fmt->pg_size);
-
- new_pg[0]=0x04;
- new_pg[1]=0x01;
- _mdb_put_int32(new_pg, 4, entry->table_pg);
-
- return new_pg;
-}
-unsigned char *
-mdb_new_data_pg(MdbCatalogEntry *entry)
-{
- MdbFormatConstants *fmt = entry->mdb->fmt;
- unsigned char *new_pg;
-
- new_pg = (unsigned char *) g_malloc0(fmt->pg_size);
-
- new_pg[0]=0x01;
- new_pg[1]=0x01;
- _mdb_put_int16(new_pg, 2, fmt->pg_size - fmt->row_count_offset - 2);
- _mdb_put_int32(new_pg, 4, entry->table_pg);
-
- return new_pg;
-}
-
-int
-mdb_update_indexes(MdbTableDef *table, int num_fields, MdbField *fields, guint32 pgnum, guint16 rownum)
-{
- unsigned int i;
- MdbIndex *idx;
-
- for (i=0;i<table->num_idxs;i++) {
- idx = g_ptr_array_index (table->indices, i);
- mdb_debug(MDB_DEBUG_WRITE,"Updating %s (%d).", idx->name, idx->index_type);
- if (idx->index_type==1) {
- mdb_update_index(table, idx, num_fields, fields, pgnum, rownum);
- }
- }
- return 1;
-}
-
-int
-mdb_init_index_chain(MdbTableDef *table, MdbIndex *idx)
-{
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
-
- table->scan_idx = idx;
- table->chain = g_malloc0(sizeof(MdbIndexChain));
- table->mdbidx = mdb_clone_handle(mdb);
- mdb_read_pg(table->mdbidx, table->scan_idx->first_pg);
-
- return 1;
-}
-
-int
-mdb_update_index(MdbTableDef *table, MdbIndex *idx, unsigned int num_fields, MdbField *fields, guint32 pgnum, guint16 rownum)
-{
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
- int idx_xref[16];
- unsigned int i, j;
- MdbIndexChain *chain;
- MdbField idx_fields[10];
-
- for (i = 0; i < idx->num_keys; i++) {
- for (j = 0; j < num_fields; j++) {
- // key_col_num is 1 based, can't remember why though
- if (fields[j].colnum == idx->key_col_num[i]-1) {
- idx_xref[i] = j;
- idx_fields[i] = fields[j];
- }
- }
- }
- for (i = 0; i < idx->num_keys; i++) {
- fprintf(stdout, "key col %d (%d) is mapped to field %d (%d %d)\n",
- i, idx->key_col_num[i], idx_xref[i], fields[idx_xref[i]].colnum,
- fields[idx_xref[i]].siz);
- }
- for (i = 0; i < num_fields; i++) {
- fprintf(stdout, "%d (%d %d)\n",
- i, fields[i].colnum,
- fields[i].siz);
- }
-
- chain = g_malloc0(sizeof(MdbIndexChain));
-
- mdb_index_find_row(mdb, idx, chain, pgnum, rownum);
- printf("chain depth = %d\n", chain->cur_depth);
- printf("pg = %" G_GUINT32_FORMAT "\n",
- chain->pages[chain->cur_depth-1].pg);
- //mdb_copy_index_pg(table, idx, &chain->pages[chain->cur_depth-1]);
- mdb_add_row_to_leaf_pg(table, idx, &chain->pages[chain->cur_depth-1], idx_fields);
-
- return 1;
-}
-
-int
-mdb_insert_row(MdbTableDef *table, int num_fields, MdbField *fields)
-{
- int new_row_size;
- unsigned char row_buffer[4096];
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
- MdbFormatConstants *fmt = mdb->fmt;
- guint32 pgnum;
- guint16 rownum;
-
- if (!mdb->f->writable) {
- fprintf(stderr, "File is not open for writing\n");
- return 0;
- }
- new_row_size = mdb_pack_row(table, row_buffer, num_fields, fields);
- if (mdb_get_option(MDB_DEBUG_WRITE)) {
- buffer_dump(row_buffer, 0, new_row_size-1);
- }
- pgnum = mdb_map_find_next_freepage(table, new_row_size);
- if (!pgnum) {
- fprintf(stderr, "Unable to allocate new page.\n");
- return 0;
- }
-
- rownum = mdb_add_row_to_pg(table, row_buffer, new_row_size);
-
- if (mdb_get_option(MDB_DEBUG_WRITE)) {
- buffer_dump(mdb->pg_buf, 0, 39);
- buffer_dump(mdb->pg_buf, fmt->pg_size - 160, fmt->pg_size-1);
- }
- mdb_debug(MDB_DEBUG_WRITE, "writing page %d", pgnum);
- if (!mdb_write_pg(mdb, pgnum)) {
- fprintf(stderr, "write failed! exiting...\n");
- exit(1);
- }
-
- mdb_update_indexes(table, num_fields, fields, pgnum, rownum);
-
- return 1;
-}
-/*
- * Assumes caller has verfied space is available on page and adds the new
- * row to the current pg_buf.
- */
-guint16
-mdb_add_row_to_pg(MdbTableDef *table, unsigned char *row_buffer, int new_row_size)
-{
- unsigned char *new_pg;
- int num_rows, i, pos, row_start, row_end, row_size;
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
- MdbFormatConstants *fmt = mdb->fmt;
-
- if (table->is_temp_table) {
- GPtrArray *pages = table->temp_table_pages;
- if (pages->len == 0) {
- new_pg = mdb_new_data_pg(entry);
- g_ptr_array_add(pages, new_pg);
- } else {
- new_pg = g_ptr_array_index(pages, pages->len - 1);
- if (mdb_get_int16(new_pg, 2) < new_row_size + 2) {
- new_pg = mdb_new_data_pg(entry);
- g_ptr_array_add(pages, new_pg);
- }
- }
-
- num_rows = mdb_get_int16(new_pg, fmt->row_count_offset);
- pos = (num_rows == 0) ? fmt->pg_size :
- mdb_get_int16(new_pg, fmt->row_count_offset + (num_rows*2));
- } else { /* is not a temp table */
- new_pg = mdb_new_data_pg(entry);
-
- num_rows = mdb_pg_get_int16(mdb, fmt->row_count_offset);
- pos = fmt->pg_size;
-
- /* copy existing rows */
- for (i=0;i<num_rows;i++) {
- row_start = mdb_pg_get_int16(mdb, (fmt->row_count_offset + 2) + (i*2));
- row_end = mdb_find_end_of_row(mdb, i);
- row_size = row_end - row_start + 1;
- pos -= row_size;
- memcpy(&new_pg[pos], &mdb->pg_buf[row_start], row_size);
- _mdb_put_int16(new_pg, (fmt->row_count_offset + 2) + (i*2), pos);
- }
- }
-
- /* add our new row */
- pos -= new_row_size;
- memcpy(&new_pg[pos], row_buffer, new_row_size);
- /* add row to the row offset table */
- _mdb_put_int16(new_pg, (fmt->row_count_offset + 2) + (num_rows*2), pos);
-
- /* update number rows on this page */
- num_rows++;
- _mdb_put_int16(new_pg, fmt->row_count_offset, num_rows);
-
- /* update the freespace */
- _mdb_put_int16(new_pg,2,pos - fmt->row_count_offset - 2 - (num_rows*2));
-
- /* copy new page over old */
- if (!table->is_temp_table) {
- memcpy(mdb->pg_buf, new_pg, fmt->pg_size);
- g_free(new_pg);
- }
-
- return num_rows;
-}
-int
-mdb_update_row(MdbTableDef *table)
-{
-int row_start, row_end;
-unsigned int i;
-MdbColumn *col;
-MdbCatalogEntry *entry = table->entry;
-MdbHandle *mdb = entry->mdb;
-MdbFormatConstants *fmt = mdb->fmt;
-MdbField fields[256];
-unsigned char row_buffer[4096];
-int old_row_size, new_row_size, delta;
-unsigned int num_fields;
-
- if (!mdb->f->writable) {
- fprintf(stderr, "File is not open for writing\n");
- return 0;
- }
- row_start = mdb_pg_get_int16(mdb, (fmt->row_count_offset + 2) + ((table->cur_row-1)*2));
- row_end = mdb_find_end_of_row(mdb, table->cur_row-1);
- old_row_size = row_end - row_start;
-
- row_start &= 0x0FFF; /* remove flags */
-
- mdb_debug(MDB_DEBUG_WRITE,"page %lu row %d start %d end %d", (unsigned long) table->cur_phys_pg, table->cur_row-1, row_start, row_end);
- if (mdb_get_option(MDB_DEBUG_LIKE))
- buffer_dump(mdb->pg_buf, row_start, row_end);
-
- for (i=0;i<table->num_cols;i++) {
- col = g_ptr_array_index(table->columns,i);
- if (col->bind_ptr && mdb_is_col_indexed(table,i)) {
- fprintf(stderr, "Attempting to update column that is part of an index\n");
- return 0;
- }
- }
- num_fields = mdb_crack_row(table, row_start, row_end, fields);
-
- if (mdb_get_option(MDB_DEBUG_WRITE)) {
- for (i=0;i<num_fields;i++) {
- printf("col %d %d start %d siz %d\n", i, fields[i].colnum, fields[i].start, fields[i].siz);
- }
- }
- for (i=0;i<table->num_cols;i++) {
- col = g_ptr_array_index(table->columns,i);
- if (col->bind_ptr) {
- printf("yes\n");
- fields[i].value = col->bind_ptr;
- fields[i].siz = *(col->len_ptr);
- }
- }
-
- new_row_size = mdb_pack_row(table, row_buffer, num_fields, fields);
- if (mdb_get_option(MDB_DEBUG_WRITE))
- buffer_dump(row_buffer, 0, new_row_size-1);
- delta = new_row_size - old_row_size;
- if ((mdb_pg_get_freespace(mdb) - delta) < 0) {
- fprintf(stderr, "No space left on this page, update will not occur\n");
- return 0;
- }
- /* do it! */
- mdb_replace_row(table, table->cur_row-1, row_buffer, new_row_size);
- return 0;
-}
-int
-mdb_replace_row(MdbTableDef *table, int row, unsigned char *new_row, int new_row_size)
-{
-MdbCatalogEntry *entry = table->entry;
-MdbHandle *mdb = entry->mdb;
-MdbFormatConstants *fmt = mdb->fmt;
-unsigned char *new_pg;
-guint16 num_rows;
-int row_start, row_end, row_size;
-int i, pos;
-
- if (mdb_get_option(MDB_DEBUG_WRITE)) {
- buffer_dump(mdb->pg_buf, 0, 39);
- buffer_dump(mdb->pg_buf, fmt->pg_size - 160, fmt->pg_size-1);
- }
- mdb_debug(MDB_DEBUG_WRITE,"updating row %d on page %lu", row, (unsigned long) table->cur_phys_pg);
- new_pg = mdb_new_data_pg(entry);
-
- num_rows = mdb_pg_get_int16(mdb, fmt->row_count_offset);
- _mdb_put_int16(new_pg, fmt->row_count_offset, num_rows);
-
- pos = mdb->fmt->pg_size;
-
- /* rows before */
- for (i=0;i<row;i++) {
- row_start = mdb_pg_get_int16(mdb, (fmt->row_count_offset + 2) + (i*2));
- row_end = mdb_find_end_of_row(mdb, i);
- row_size = row_end - row_start + 1;
- pos -= row_size;
- memcpy(&new_pg[pos], &mdb->pg_buf[row_start], row_size);
- _mdb_put_int16(new_pg, (fmt->row_count_offset + 2) + (i*2), pos);
- }
-
- /* our row */
- pos -= new_row_size;
- memcpy(&new_pg[pos], new_row, new_row_size);
- _mdb_put_int16(new_pg, (fmt->row_count_offset + 2) + (row*2), pos);
-
- /* rows after */
- for (i=row+1;i<num_rows;i++) {
- row_start = mdb_pg_get_int16(mdb, (fmt->row_count_offset + 2) + (i*2));
- row_end = mdb_find_end_of_row(mdb, i);
- row_size = row_end - row_start + 1;
- pos -= row_size;
- memcpy(&new_pg[pos], &mdb->pg_buf[row_start], row_size);
- _mdb_put_int16(new_pg, (fmt->row_count_offset + 2) + (i*2), pos);
- }
-
- /* almost done, copy page over current */
- memcpy(mdb->pg_buf, new_pg, fmt->pg_size);
-
- g_free(new_pg);
-
- _mdb_put_int16(mdb->pg_buf, 2, mdb_pg_get_freespace(mdb));
- if (mdb_get_option(MDB_DEBUG_WRITE)) {
- buffer_dump(mdb->pg_buf, 0, 39);
- buffer_dump(mdb->pg_buf, fmt->pg_size - 160, fmt->pg_size-1);
- }
- /* drum roll, please */
- if (!mdb_write_pg(mdb, table->cur_phys_pg)) {
- fprintf(stderr, "write failed! exiting...\n");
- exit(1);
- }
- return 0;
-}
-static int
-mdb_add_row_to_leaf_pg(MdbTableDef *table, MdbIndex *idx, MdbIndexPage *ipg, MdbField *idx_fields)
-/*, guint32 pgnum, guint16 rownum)
-static int
-mdb_copy_index_pg(MdbTableDef *table, MdbIndex *idx, MdbIndexPage *ipg)
-*/
-{
- MdbCatalogEntry *entry = table->entry;
- MdbHandle *mdb = entry->mdb;
- MdbColumn *col;
- guint32 pg;
- guint16 row;
- unsigned char *new_pg;
- unsigned char key_hash[256];
- unsigned char iflag;
- int keycol;
-
- new_pg = mdb_new_leaf_pg(entry);
-
- mdb_index_page_reset(ipg);
- mdb_read_pg(mdb, ipg->pg);
-
- /* do we support this index type yet? */
- if (idx->num_keys > 1) {
- fprintf(stderr,"multikey indexes not yet supported, aborting\n");
- return 0;
- }
- keycol = idx->key_col_num[0];
- col = g_ptr_array_index (table->columns, keycol - 1);
- printf("keycol = %d (%s)\n", keycol, col->name);
- if (!mdb_is_fixed_col(col)) {
- fprintf(stderr,"variable length key columns not yet supported, aborting\n");
- return 0;
- }
- printf("col size = %d\n", col->col_size);
-
- while (mdb_index_find_next_on_page(mdb, ipg)) {
-
- /* check for compressed indexes. */
- if (ipg->len < col->col_size + 1) {
- fprintf(stderr,"compressed indexes not yet supported, aborting\n");
- return 0;
- }
-
- pg = mdb_pg_get_int24_msb(mdb, ipg->offset + ipg->len - 4);
- row = mdb->pg_buf[ipg->offset + ipg->len - 1];
- iflag = mdb->pg_buf[ipg->offset];
- mdb_index_swap_n(&mdb->pg_buf[ipg->offset + 1], col->col_size, key_hash);
- key_hash[col->col_size - 1] &= 0x7f;
- printf("length = %d\n", ipg->len);
- printf("iflag = %d pg = %" G_GUINT32_FORMAT
- " row = %" G_GUINT16_FORMAT "\n", iflag, pg, row);
- buffer_dump(mdb->pg_buf, ipg->offset, ipg->offset + ipg->len - 1);
- buffer_dump(mdb->pg_buf, ipg->offset + 1, ipg->offset + col->col_size);
- buffer_dump(key_hash, 0, col->col_size - 1);
- ipg->offset += ipg->len;
- ipg->len = 0;
- row++;
- }
- g_free(new_pg);
-
- return ipg->len;
-}
diff --git a/navit/data/poi_geodownload/poi_geodownload.c b/navit/data/poi_geodownload/poi_geodownload.c
deleted file mode 100644
index 229457b6..00000000
--- a/navit/data/poi_geodownload/poi_geodownload.c
+++ /dev/null
@@ -1,756 +0,0 @@
-#include <mdbtools.h>
-#include "config.h"
-#include "debug.h"
-#include "coord.h"
-#include "projection.h"
-#include "map.h"
-#include "item.h"
-#include "plugin.h"
-
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <dirent.h>
-
-struct map_priv
-{
- char *filename;
- MdbHandle *h;
- MdbHandle *h_idx;
- MdbTableDef *table;
- GPtrArray *table_col;
- MdbColumn **cols;
- MdbIndex *idx;
- int idx_size;
- enum item_type type;
- int name_col;
-};
-
-struct map_rect_priv
-{
- struct item item;
- struct map_priv *m;
- enum attr_type attr_next;
- int cidx;
- char buffer[4096];
-};
-
-#if 0
-struct index_data {
- unsigned char data[15];
-};
-struct poi {
- char filename[1024];
- char icon[1024];
- long pos;
- MdbHandle *h;
- MdbHandle *h_idx;
- MdbTableDef *table;
- GPtrArray *table_col;
- MdbColumn **cols;
- MdbIndex *idx;
- int idx_size;
- struct index_data index_data;
- MdbIndexChain chain;
- struct poi *next;
-} *poi_list;
-
-struct poi_data {
- struct poi *poi;
- int page;
- int row;
-};
-
- char poipath[256];
- char poibmp[256];
-
-
-#endif
-
-static void
-print_col(MdbHandle *h, MdbColumn *col, char *buffer, int hex)
-{
- char *s;
- dbg(1,"type=%d\n", col->col_type);
- switch (col->col_type) {
- case MDB_BOOL:
- strcpy(buffer, mdb_pg_get_byte(h, col->cur_value_start) ? "True" : "False");
- break;
- case MDB_BYTE:
- sprintf(buffer, "%d", mdb_pg_get_byte(h, col->cur_value_start));
- break;
- case MDB_LONGINT:
- if (hex)
- sprintf(buffer, "0x%lx", mdb_pg_get_int32(h, col->cur_value_start));
- else
- sprintf(buffer, "%ld", mdb_pg_get_int32(h, col->cur_value_start));
- break;
- case MDB_DOUBLE:
- sprintf(buffer, "%f", mdb_pg_get_double(h, col->cur_value_start));
- break;
- case MDB_TEXT:
- dbg(1,"pg_buf %p start %d len %d\n", h->pg_buf, col->cur_value_start, col->cur_value_len);
- if (col->cur_value_len) {
- s=mdb_col_to_string (h, h->pg_buf, col->cur_value_start, col->col_type, col->cur_value_len);
- dbg(1,"s=%p\n", s);
- sprintf(buffer, "%s", s);
- }
- break;
- default:
- sprintf(buffer, "unknown (%d)", col->col_type);
- }
-}
-
-#if 0
-
-static void
-setup_idx_data(struct index_data *idx, struct coord *c, unsigned int geoflags, int size)
-{
- /* 7f 80 1c 91 0a 7f 80 5c f5 41 7f 80 00 00 05 */
- idx->data[0]=0x7f;
- idx->data[1]=(c->x >> 24) ^ 0x80;
- idx->data[2]=c->x >> 16;
- idx->data[3]=c->x >> 8;
- idx->data[4]=c->x;
- idx->data[5]=0x7f;
- idx->data[6]=(c->y >> 24) ^ 0x80;
- idx->data[7]=c->y >> 16;
- idx->data[8]=c->y >> 8;
- idx->data[9]=c->y;
- idx->data[10]=0x7f;
- if (size > 12) {
- idx->data[11]=0x80 | (geoflags >> 24);
- idx->data[12]=geoflags >> 16;
- idx->data[13]=geoflags >> 8;
- idx->data[14]=geoflags;
- } else {
- idx->data[11]=geoflags;
- }
-}
-
-static void
-setup_idx_rect(struct coord *rect, struct index_data *idx, int size)
-{
- struct coord r[2];
- r[0].x=rect[0].x;
- r[0].y=rect[1].y;
- r[1].x=rect[1].x;
- r[1].y=rect[0].y;
-#if 0
- printf("low 0x%x 0%x\n", r[0].x, r[0].y);
- printf("high 0x%x 0%x\n", r[1].x, r[1].y);
-#endif
- setup_idx_data(idx, r, 0, size);
- setup_idx_data(idx+1, r+1, 0xffffffff, size);
-}
-
-#endif
-
-static int
-load_row(struct map_priv *poi, int pg, int row)
-{
- int row_start, row_end, offset;
- unsigned int num_fields, i;
- MdbField fields[256];
- MdbFormatConstants *fmt;
- int debug=0;
-
- fmt=poi->h->fmt;
- mdb_read_pg(poi->h, pg);
- dbg(1, "enter poi=%p pg=%d row=%d\n", poi, pg, row);
- dbg(1,"Page Type %d row_count_offset %d\n",poi->h->pg_buf[0], fmt->row_count_offset);
- for (i = 0; i <= row; i++) {
- offset=(fmt->row_count_offset + 2) + i * 2;
- dbg(1,"row %d %d 0x%x\n", i, offset, mdb_pg_get_int16(poi->h, offset));
- }
- row_start = mdb_pg_get_int16(poi->h, (fmt->row_count_offset + 2) + row * 2);
- if (row_start & 0x4000)
- return 1;
- row_end = mdb_find_end_of_row(poi->h, row);
- if (debug) {
- printf("start=0x%x end=0x%x\n", row_start, row_end);
- buffer_dump(poi->h->pg_buf, row_start, row_end);
- }
-
- poi->h->cur_pos=row_start & 0x1fff;
- poi->table->cur_row=row;
- num_fields = mdb_crack_row(poi->table, row_start & 0x1fff, row_end, fields);
- dbg(1,"num_fields=%d\n", num_fields);
- for (i = 0; i < num_fields; i++) {
- dbg(1,"i=%d/%d\n", i, num_fields);
- poi->cols[i]->cur_value_start=fields[i].start;
- poi->cols[i]->cur_value_len=fields[i].siz;
- }
- return 0;
-}
-
-#if 0
-
-static MdbIndexPage *
-index_next_row(MdbHandle *mdb, MdbIndex *idx, MdbIndexChain *chain)
-{
- MdbIndexPage *ipg;
-
- ipg = mdb_index_read_bottom_pg(mdb, idx, chain);
- if (!mdb_index_find_next_on_page(mdb, ipg)) {
-#if 0
- printf("no next\n");
-#endif
- if (!chain->clean_up_mode) {
-#if 0
- printf("no cleanup\n");
-#endif
- if (!(ipg = mdb_index_unwind(mdb, idx, chain)))
- chain->clean_up_mode = 1;
- }
- if (chain->clean_up_mode) {
-#if 0
- printf("cleanup\n");
-#endif
- //fprintf(stdout,"in cleanup mode\n");
-
- if (!chain->last_leaf_found) {
- printf("no last_leaf_found\n");
- return NULL;
- }
- mdb_read_pg(mdb, chain->last_leaf_found);
- chain->last_leaf_found =
- mdb_pg_get_int24(mdb, 0x0c);
- //printf("next leaf %lu\n", chain->last_leaf_found);
- mdb_read_pg(mdb, chain->last_leaf_found);
- /* reuse the chain for cleanup mode */
- chain->cur_depth = 1;
- ipg = &chain->pages[0];
- mdb_index_page_init(ipg);
- ipg->pg = chain->last_leaf_found;
- //printf("next on page %d\n",
- if (!mdb_index_find_next_on_page(mdb, ipg)) {
-#if 0
- printf("no find_next_on_page\n");
-#endif
- return NULL;
- }
- }
- }
- return ipg;
-}
-
-static int
-index_next(struct poi *poi, struct index_data *idx)
-{
- MdbIndexPage *ipg;
- MdbIndexChain *chain = &poi->chain;
- int row;
- int pg;
- int offset;
- char *cmp, *low, *high;
- int debug=0;
-
-
- for(;;) {
- for(;;) {
- ipg=index_next_row(poi->h_idx, poi->idx, chain);
- if (! ipg)
- return 0;
- row = poi->h_idx->pg_buf[ipg->offset + ipg->len - 1];
- pg = mdb_pg_get_int24_msb(poi->h_idx, ipg->offset + ipg->len - 4);
-
- offset=poi->idx_size+4-ipg->len;
- memcpy(poi->index_data.data+offset, poi->h_idx->pg_buf+ipg->offset, ipg->len - 4);
- cmp=poi->index_data.data;
- low=idx[0].data;
- high=idx[1].data;
- if (debug > 1) {
- buffer_dump(low, 0, poi->idx_size-1);
- buffer_dump(cmp, 0, poi->idx_size-1);
- buffer_dump(high, 0, poi->idx_size-1);
- printf("%d %d %d\n", memcmp(cmp, low, poi->idx_size), memcmp(cmp, high, poi->idx_size), offset);
- }
-#if 0
- buffer_dump(poi->h_idx->pg_buf, ipg->offset, ipg->offset+ipg->len-1);
-#endif
- ipg->offset += ipg->len;
- if (memcmp(cmp, low, poi->idx_size) >= 0) {
- if (memcmp(cmp, high, poi->idx_size) <=0 ) {
- if (debug) {
- printf("match\n");
- buffer_dump(low, 0, poi->idx_size-1);
- buffer_dump(cmp, 0, poi->idx_size-1);
- buffer_dump(high, 0, poi->idx_size-1);
- printf("%d %d %d\n", memcmp(cmp, low, poi->idx_size), memcmp(cmp, high, poi->idx_size), offset);
- }
- break;
- } else {
- return 0;
- }
- }
- if (debug > 1)
- printf("row=0x%x pg=0x%x len=%d\n", row, pg, ipg->len);
- }
- if (debug)
- printf("match: row=0x%x pg=0x%x len=%d\n", row, pg, ipg->len);
- if (!load_row(poi, pg, row))
- break;
- }
- return 1;
-}
-
-#endif
-
-static int
-load_poi_table(struct map_priv *m, MdbCatalogEntry *entry)
-{
- int j;
- MdbIndex *idx;
-
- m->h_idx=NULL;
- m->table = mdb_read_table(entry);
- m->table_col = mdb_read_columns(m->table);
- mdb_read_indices(m->table);
- m->cols = (MdbColumn **) (m->table_col->pdata);
- if (m->table_col->len < 4 || strcasecmp(m->cols[0]->name, "X") ||
- strcasecmp(m->cols[1]->name, "Y") || strcasecmp(m->cols[3]->name, "GEOFLAGS"))
- return 1;
- m->name_col=-1;
- for (j = 0; j < m->table_col->len ; j++) {
- if (!strcasecmp(m->cols[j]->name, "NAME"))
- m->name_col=j;
- }
- for (j = 0; j < m->table->num_idxs; j++) {
- idx = m->table->indices->pdata[j];
- if (idx->num_keys == 3 && idx->key_col_num[0] == 1 &&
- idx->key_col_num[1] == 2 && idx->key_col_num[2] == 4) {
- m->idx = idx;
- m->idx_size=3+m->cols[0]->col_size+m->cols[1]->col_size+m->cols[3]->col_size;
- m->h_idx=mdb_clone_handle(m->h);
- }
- }
- return 0;
-}
-
-#if 0
-
-static void
-load_poi(char *filename, char *icon, int type)
-{
- int i;
- MdbCatalogEntry *entry;
- GPtrArray *catalog;
- struct poi *new = g_new0(struct poi, 1);
-
- FILE *fp = fopen(filename,"r");
- if( fp ) {
- fclose(fp);
- } else {
- printf("ERR : POI file %s does not exists!\n",filename);
- exit(0);
- return -1;
- }
-
-
- fp = fopen(icon,"r");
- if( fp ) {
- fclose(fp);
- } else {
- printf("ERR : WARNING INCORRECT PICTURE! %s!\n",icon);
- exit(0);
- return -1;
- }
-
- strcpy(new->filename,filename);
- strcpy(new->icon,icon);
- new->type = type;
-
-
- if (type == 0) {
- new->h = mdb_open(filename, MDB_NOFLAGS);
- catalog = mdb_read_catalog(new->h, MDB_TABLE);
- for (i = 0; i < catalog->len; i++) {
- entry = catalog->pdata[i];
- if (!strcasecmp(entry->object_name, "_INDEXDATA")) {
- if (load_poi_table(new, entry)) {
- printf("%s invalid\n", filename);
- g_free(new);
- new=NULL;
- }
- }
- }
- g_ptr_array_free(catalog, 1);
- }
- if (new) {
- new->next = poi_list;
- poi_list = new;
- }
-}
-
-static void
-get_coord(struct poi *p, struct coord *c)
-{
- c->x=mdb_pg_get_int32(p->h, p->cols[0]->cur_value_start);
- c->y=mdb_pg_get_int32(p->h, p->cols[1]->cur_value_start);
-}
-
-static void
-poi_info(struct display_list *list, struct popup_item **popup)
-{
- struct poi_data *data=list->data;
- struct poi *poi=data->poi;
- struct popup_item *popup_last, *popup_val_last;
- char *text,buffer[4096];
- int j;
- MdbColumn *col;
- char *v;
-
- popup_last = *popup;
-
- popup_val_last = NULL;
- sprintf(buffer,"File:%s", poi->filename);
- popup_item_new_text(&popup_val_last, buffer, 1);
- sprintf(buffer,"Icon:%s", poi->icon);
- popup_item_new_text(&popup_val_last, buffer, 2);
- if (poi->type == 0) {
- printf("poi_info pg=%d row=%d\n", data->page, data->row);
- load_row(poi, data->page, data->row);
- sprintf(buffer,"Page:%d", data->page);
- popup_item_new_text(&popup_val_last, buffer, 3);
- sprintf(buffer,"Row:%d", data->row);
- popup_item_new_text(&popup_val_last, buffer, 4);
- for (j = 0; j < poi->table_col->len; j++) {
- col = poi->table_col->pdata[j];
- #if 0
- printf("start: %d type:%d\n", col->cur_value_start, col->col_type);
- #endif
- sprintf(buffer, "%s:", col->name);
- v = buffer + strlen(buffer);
- if (!strcasecmp(col->name,"X") || !strcasecmp(col->name,"Y"))
- print_col(poi->h, col, v, 1);
- else
- print_col(poi->h, col, v, 0);
- #if 0
- printf("%s\n", buffer);
- #endif
- text=g_convert(buffer,-1,"utf-8","iso8859-1",NULL,NULL,NULL);
- popup_item_new_text(&popup_val_last, buffer, j+10);
- g_free(text);
- }
- }
- popup_item_new_text(&popup_last, "POI", 20)->submenu = popup_val_last;
- *popup=popup_last;
-}
-
-static void
-draw_poi(struct poi *p, struct container *co, struct point *pnt)
-{
- struct poi_data data;
- data.poi=p;
- if (p->type == 0) {
- data.page=p->h->cur_pg;
- data.row=p->table->cur_row-1;
- }
- if (p->type == 1) {
- data.row=p->pos;
- }
- display_add(&co->disp[display_poi], 5, 0, p->icon, 1, pnt, poi_info, &data, sizeof(data));
-}
-
-static void
-plugin_draw(struct container *co)
-{
- struct coord c;
- struct point pnt;
- struct poi *p;
- struct index_data idx[2];
- int use_index=0;
- int debug=1;
-
- p = poi_list;
-
- if (co->trans->scale > 1024)
- return;
- if (debug) {
- printf("scale=%ld\n", co->trans->scale);
- printf("rect 0x%lx,0%lx-0x%lx,0x%lx\n", co->trans->rect[0].x, co->trans->rect[0].y, co->trans->rect[1].x, co->trans->rect[1].y);
- }
- while (p) {
- if (p->type == 0) {
- if (use_index)
- setup_idx_rect(co->trans->rect, idx, p->idx_size);
- if (! use_index) {
- printf("rewind %s %p\n", p->filename, p->table);
- mdb_rewind_table(p->table);
- while (mdb_fetch_row(p->table)) {
- get_coord(p, &c);
- if (transform(co->trans, &c, &pnt)) {
- if (debug)
- printf("coord 0x%lx,0x%lx pg %d row %d\n", c.x, c.y, p->h->cur_pg, p->table->cur_row);
- draw_poi(p, co, &pnt);
- }
- }
- } else {
- memset(&p->chain, 0, sizeof(p->chain));
- while (index_next(p, idx)) {
- get_coord(p, &c);
- if (transform(co->trans, &c, &pnt)) {
- if (debug)
- printf("coord 0x%lx,0x%lx pg %d row %d\n", c.x, c.y, p->h->cur_pg, p->table->cur_row);
- draw_poi(p, co, &pnt);
- }
- }
- }
- }
- if (p->type == 1) {
- FILE *f;
- char line[1024];
- struct text_poi tpoi;
- if(!(f=fopen(p->filename, "r"))){
- printf("can't open poi file for drawing!\n");
- exit(0);
- }
-#if 0
- printf("opened poi file %s for drawing!\n",p->filename);
-#endif
- p->pos=ftell(f);
- fgets(line, 1024, f);
- while (!feof(f)) {
- if (strlen(line)) {
- line[strlen(line)-1]='\0';
- }
- if (parse_text_poi(line, &tpoi)) {
- transform_mercator(&tpoi.lat,&tpoi.lng,&c);
-// printf("%ld %ld\n", c.x, c.y);
- if (transform(co->trans, &c, &pnt)) {
- draw_poi(p, co, &pnt);
- }
- }
- p->pos=ftell(f);
- fgets(line, 1024, f);
- }
- fclose(f);
- }
- p = p->next;
- }
-
-}
-
-#endif
-
-static void
-map_destroy_poi_geodownload(struct map_priv *m)
-{
- dbg(1,"enter\n");
- g_free(m);
-}
-
-static void
-poi_geodownload_coord_rewind(void *priv_data)
-{
- struct map_rect_priv *mr=priv_data;
- mr->cidx=0;
-}
-
-
-static int
-poi_geodownload_coord_get(void *priv_data, struct coord *c, int count)
-{
- struct map_rect_priv *mr=priv_data;
- dbg(1,"enter\n");
- if (mr->cidx || !count)
- return 0;
- c->x=mdb_pg_get_int32(mr->m->h, mr->m->cols[0]->cur_value_start);
- c->y=mdb_pg_get_int32(mr->m->h, mr->m->cols[1]->cur_value_start);
- dbg(1,"x=0x%x y=0x%x\n", c->x, c->y);
- return 1;
-}
-
-static void
-poi_geodownload_attr_rewind(void *priv_data)
-{
- struct map_rect_priv *mr=priv_data;
- mr->attr_next=attr_label;
-}
-
-static int
-poi_geodownload_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
-{
- struct map_rect_priv *mr=priv_data;
- struct map_priv *m=mr->m;
- MdbColumn *col;
- char *v;
- int j;
-
- dbg(1,"enter\n");
- attr->type=attr_type;
- switch (attr_type) {
- case attr_any:
- while (mr->attr_next != attr_none) {
- if (poi_geodownload_attr_get(mr, mr->attr_next, attr))
- return 1;
- }
- return 0;
- case attr_label:
- mr->attr_next=attr_debug;
- if (m->name_col == -1)
- return 0;
- col=m->cols[m->name_col];
- if (col->cur_value_len)
- attr->u.str=mdb_col_to_string (m->h, m->h->pg_buf, col->cur_value_start, col->col_type, col->cur_value_len);
- else
- attr->u.str="";
- return 1;
- case attr_debug:
- mr->attr_next=attr_none;
- v=mr->buffer;
- *v='\0';
- for (j = 0; j < mr->m->table_col->len; j++) {
- col = mr->m->table_col->pdata[j];
- printf("start: %d type:%d\n", col->cur_value_start, col->col_type);
- sprintf(v, "%s:", col->name);
- v += strlen(v);
- if (!strcasecmp(col->name,"X") || !strcasecmp(col->name,"Y"))
- print_col(mr->m->h, col, v, 1);
- else
- print_col(mr->m->h, col, v, 0);
- v += strlen(v);
- *v++='\n';
- *v='\0';
- }
- attr->u.str=mr->buffer;
- return 1;
- default:
- break;
- }
- return 0;
-}
-
-static struct item_methods methods_poi_geodownload = {
- poi_geodownload_coord_rewind,
- poi_geodownload_coord_get,
- poi_geodownload_attr_rewind,
- poi_geodownload_attr_get,
-};
-
-
-static struct map_rect_priv *
-map_rect_new_poi_geodownload(struct map_priv *map, struct map_selection *sel)
-{
- struct map_rect_priv *mr;
-
- dbg(1,"enter\n");
- mr=g_new0(struct map_rect_priv, 1);
- mr->item.meth=&methods_poi_geodownload;
- mr->item.id_hi=0;
- mr->item.id_lo=0;
- mr->item.priv_data=mr;
- mr->item.type=map->type;
- mr->m=map;
- mdb_rewind_table(map->table);
- return mr;
-}
-
-
-static void
-map_rect_destroy_poi_geodownload(struct map_rect_priv *mr)
-{
- g_free(mr);
-}
-
-static struct item *
-map_rect_get_item_poi_geodownload(struct map_rect_priv *mr)
-{
- dbg(1,"enter\n");
- if (mdb_fetch_row(mr->m->table)) {
- mr->item.id_hi=mr->m->table->cur_phys_pg;
- mr->item.id_lo=mr->m->table->cur_row-1;
- poi_geodownload_attr_rewind(mr);
- return &mr->item;
- }
- return NULL;
-}
-
-static struct item *
-map_rect_get_item_byid_poi_geodownload(struct map_rect_priv *mr, int id_hi, int id_lo)
-{
- char *v, buffer[4096];
- int j;
- MdbColumn *col;
-
- dbg(1,"enter\n");
- load_row(mr->m, id_hi, id_lo);
- for (j = 0; j < mr->m->table_col->len; j++) {
- col = mr->m->table_col->pdata[j];
- printf("start: %d type:%d\n", col->cur_value_start, col->col_type);
- sprintf(buffer, "%s:", col->name);
- v = buffer + strlen(buffer);
- if (!strcasecmp(col->name,"X") || !strcasecmp(col->name,"Y"))
- print_col(mr->m->h, col, v, 1);
- else
- print_col(mr->m->h, col, v, 0);
- printf("%s\n", buffer);
- }
- dbg(1,"ret=%p\n", &mr->item);
- poi_geodownload_attr_rewind(mr);
- return &mr->item;
-}
-
-
-static struct map_methods map_methods_poi_geodownload = {
- projection_mg,
- "iso8859-1",
- map_destroy_poi_geodownload,
- map_rect_new_poi_geodownload,
- map_rect_destroy_poi_geodownload,
- map_rect_get_item_poi_geodownload,
- map_rect_get_item_byid_poi_geodownload,
-};
-
-static struct map_priv *
-map_new_poi_geodownload(struct map_methods *meth, struct attr **attrs)
-{
- struct map_priv *m;
- MdbCatalogEntry *entry;
- GPtrArray *catalog;
- int i;
- struct attr *attr;
- struct attr *data=attr_search(attrs, NULL, attr_data);
- char *filename;
- if (! data)
- return NULL;
- filename=data->u.str;
- dbg(1,"filename %s\n",filename);
- *meth=map_methods_poi_geodownload;
-
- m=g_new(struct map_priv, 1);
- m->filename=g_strdup(filename);
- m->h = mdb_open(m->filename, MDB_NOFLAGS);
- m->type=type_none;
- dbg(1,"attr_search\n");
- attr=attr_search(attrs, NULL, attr_item_type);
- dbg(1,"attr_search result %p\n", attr);
- if (attr)
- m->type=attr->u.item_type;
-
-
- catalog = mdb_read_catalog(m->h, MDB_TABLE);
- for (i = 0; i < catalog->len; i++) {
- entry = catalog->pdata[i];
- dbg(1,"object name '%s'\n", entry->object_name);
- if (!strcasecmp(entry->object_name, "_INDEXDATA")) {
- if (load_poi_table(m, entry)) {
- printf("%s invalid\n", filename);
- g_free(m);
- m=NULL;
- }
- }
- }
- g_ptr_array_free(catalog, 1);
- return m;
-}
-
-void
-plugin_init(void)
-{
- dbg(1,"plugin_init\n");
- plugin_register_map_type("poi_geodownload", map_new_poi_geodownload);
- mdb_init();
-}
-
diff --git a/navit/data/textfile/Makefile.am b/navit/data/textfile/Makefile.am
deleted file mode 100644
index 495eb689..00000000
--- a/navit/data/textfile/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=data_textfile
-moduledata_LTLIBRARIES = libdata_textfile.la
-libdata_textfile_la_SOURCES = textfile.c textfile.h
diff --git a/navit/data/textfile/textfile.c b/navit/data/textfile/textfile.c
deleted file mode 100644
index 61191366..00000000
--- a/navit/data/textfile/textfile.c
+++ /dev/null
@@ -1,377 +0,0 @@
-#include <windows.h>
-#include <glib.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include "config.h"
-#include "debug.h"
-#include "plugin.h"
-#include "projection.h"
-#include "map.h"
-#include "maptype.h"
-#include "item.h"
-#include "attr.h"
-#include "transform.h"
-#include "file.h"
-
-#include "textfile.h"
-
-static int map_id;
-
-static int
-get_tag(char *line, char *name, int *pos, char *ret, char *name_ret)
-{
- int len=0,quoted;
- char *p,*e,*n;
-
- dbg(1,"get_tag %s from %s\n", name, line);
- if (name)
- len=strlen(name);
- if (pos)
- p=line+*pos;
- else
- p=line;
- for(;;) {
- while (*p == ' ') {
- p++;
- }
- if (! *p)
- return 0;
- n=p;
- e=index(p,'=');
- if (! e)
- return 0;
- p=e+1;
- quoted=0;
- while (*p) {
- if (*p == ' ' && !quoted)
- break;
- if (*p == '"')
- quoted=1-quoted;
- p++;
- }
- if (name == NULL || (e-n == len && !strncmp(n, name, len))) {
- if (name_ret) {
- len=e-n;
- strncpy(name_ret, n, len);
- name_ret[len]='\0';
- }
- e++;
- len=p-e;
- if (e[0] == '"') {
- e++;
- len-=2;
- }
- strncpy(ret, e, len);
- ret[len]='\0';
- if (pos)
- *pos=p-line;
- return 1;
- }
- }
- return 0;
-}
-
-static void
-get_line(struct map_rect_priv *mr)
-{
- if(mr->f) {
- mr->pos=ftell(mr->f);
- fgets(mr->line, SIZE, mr->f);
- if (strlen(mr->line) >= SIZE-1)
- printf("line too long\n");
- }
-}
-
-static void
-map_destroy_textfile(struct map_priv *m)
-{
- dbg(1,"map_destroy_textfile\n");
- g_free(m);
-}
-
-static void
-textfile_coord_rewind(void *priv_data)
-{
-}
-
-static int
-parse_line(struct map_rect_priv *mr, int attr)
-{
- int pos;
-
- pos=coord_parse(mr->line, projection_mg, &mr->c);
- if (pos < strlen(mr->line) && attr) {
- strcpy(mr->attrs, mr->line+pos);
- }
- return pos;
-}
-
-static int
-textfile_coord_get(void *priv_data, struct coord *c, int count)
-{
- struct map_rect_priv *mr=priv_data;
- int ret=0;
- dbg(1,"textfile_coord_get %d\n",count);
- while (count--) {
- if (mr->f && !feof(mr->f) && (!mr->item.id_hi || !mr->eoc) && parse_line(mr, mr->item.id_hi)) {
- *c=mr->c;
- dbg(1,"c=0x%x,0x%x\n", c->x, c->y);
- c++;
- ret++;
- get_line(mr);
- if (mr->item.id_hi)
- mr->eoc=1;
- } else {
- mr->more=0;
- break;
- }
- }
- return ret;
-}
-
-static void
-textfile_attr_rewind(void *priv_data)
-{
-}
-
-static void
-textfile_encode_attr(char *attr_val, enum attr_type attr_type, struct attr *attr)
-{
- if (attr_type >= attr_type_int_begin && attr_type <= attr_type_int_end)
- attr->u.num=atoi(attr_val);
- else
- attr->u.str=attr_val;
-}
-
-static int
-textfile_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
-{
- struct map_rect_priv *mr=priv_data;
- char *str=NULL;
- dbg(1,"textfile_attr_get mr=%p attrs='%s' ", mr, mr->attrs);
- if (attr_type != mr->attr_last) {
- dbg(1,"reset attr_pos\n");
- mr->attr_pos=0;
- mr->attr_last=attr_type;
- }
- if (attr_type == attr_any) {
- dbg(1,"attr_any");
- if (get_tag(mr->attrs,NULL,&mr->attr_pos,mr->attr, mr->attr_name)) {
- attr_type=attr_from_name(mr->attr_name);
- dbg(1,"found attr '%s' 0x%x\n", mr->attr_name, attr_type);
- attr->type=attr_type;
- textfile_encode_attr(mr->attr, attr_type, attr);
- return 1;
- }
- } else {
- str=attr_to_name(attr_type);
- dbg(1,"attr='%s' ",str);
- if (get_tag(mr->attrs,str,&mr->attr_pos,mr->attr, NULL)) {
- textfile_encode_attr(mr->attr, attr_type, attr);
- dbg(1,"found\n");
- return 1;
- }
- }
- dbg(1,"not found\n");
- return 0;
-}
-
-static struct item_methods methods_textfile = {
- textfile_coord_rewind,
- textfile_coord_get,
- textfile_attr_rewind,
- textfile_attr_get,
-};
-
-static struct map_rect_priv *
-map_rect_new_textfile(struct map_priv *map, struct map_selection *sel)
-{
- struct map_rect_priv *mr;
-
- dbg(1,"map_rect_new_textfile\n");
- mr=g_new0(struct map_rect_priv, 1);
- mr->m=map;
- mr->sel=sel;
- mr->item.id_hi=0;
- mr->item.id_lo=0;
- mr->item.meth=&methods_textfile;
- mr->item.priv_data=mr;
- if (map->is_pipe) {
- char *oargs,*args=g_strdup(map->filename),*sep=" ";
- enum layer_type lay;
- g_free(mr->args);
- while (sel) {
- oargs=args;
- args=g_strdup_printf("%s 0x%x 0x%x 0x%x 0x%x", oargs, sel->u.c_rect.lu.x, sel->u.c_rect.lu.y, sel->u.c_rect.rl.x, sel->u.c_rect.rl.y);
- g_free(oargs);
- for (lay=layer_town ; lay < layer_end ; lay++) {
- oargs=args;
- args=g_strdup_printf("%s%s%d", oargs, sep, sel->order[lay]);
- g_free(oargs);
- sep=",";
- }
- sel=sel->next;
- }
- dbg(1,"popen args %s\n", args);
- mr->args=args;
- mr->f=popen(mr->args, "r");
- } else {
- mr->f=fopen(map->filename, "r");
- }
- if(!mr->f) {
- printf("map_rect_new_textfile unable to open textfile %s\n",map->filename);
- }
- get_line(mr);
- return mr;
-}
-
-
-static void
-map_rect_destroy_textfile(struct map_rect_priv *mr)
-{
- if (mr->f) {
- if (mr->m->is_pipe)
- pclose(mr->f);
- else
- fclose(mr->f);
- }
- g_free(mr);
-}
-
-static struct item *
-map_rect_get_item_textfile(struct map_rect_priv *mr)
-{
- char *p,type[SIZE];
- dbg(1,"map_rect_get_item_textfile id_hi=%d line=%s", mr->item.id_hi, mr->line);
- if (!mr->f) {
- return NULL;
- }
- while (mr->more) {
- struct coord c;
- textfile_coord_get(mr, &c, 1);
- }
- for(;;) {
- if (feof(mr->f)) {
- dbg(1,"map_rect_get_item_textfile: eof\n");
- if (mr->item.id_hi) {
- return NULL;
- }
- mr->item.id_hi++;
- if (mr->m->is_pipe) {
- pclose(mr->f);
- mr->f=popen(mr->args, "r");
- } else
- fseek(mr->f, 0, SEEK_SET);
- get_line(mr);
- }
- if ((p=index(mr->line,'\n')))
- *p='\0';
- if (mr->item.id_hi) {
- mr->attrs[0]='\0';
- if (!parse_line(mr, 1)) {
- get_line(mr);
- continue;
- }
- dbg(1,"map_rect_get_item_textfile: point found\n");
- mr->eoc=0;
- mr->item.id_lo=mr->pos;
- } else {
- if (parse_line(mr, 1)) {
- get_line(mr);
- continue;
- }
- dbg(1,"map_rect_get_item_textfile: line found\n");
- if (! mr->line[0]) {
- get_line(mr);
- continue;
- }
- mr->item.id_lo=mr->pos;
- strcpy(mr->attrs, mr->line);
- get_line(mr);
- dbg(1,"mr=%p attrs=%s\n", mr, mr->attrs);
- }
- dbg(1,"get_attrs %s\n", mr->attrs);
- if (get_tag(mr->attrs,"type",NULL,type,NULL)) {
- dbg(1,"type='%s'\n", type);
- mr->item.type=item_from_name(type);
- if (mr->item.type == type_none)
- printf("Warning: type '%s' unknown\n", type);
- } else {
- get_line(mr);
- continue;
- }
- mr->attr_last=attr_none;
- mr->more=1;
- dbg(1,"return attr='%s'\n", mr->attrs);
- return &mr->item;
- }
-}
-
-static struct item *
-map_rect_get_item_byid_textfile(struct map_rect_priv *mr, int id_hi, int id_lo)
-{
- if (mr->m->is_pipe) {
- pclose(mr->f);
- mr->f=popen(mr->args, "r");
- } else
- fseek(mr->f, id_lo, SEEK_SET);
- get_line(mr);
- mr->item.id_hi=id_hi;
- return map_rect_get_item_textfile(mr);
-}
-
-static struct map_methods map_methods_textfile = {
- projection_mg,
- "iso8859-1",
- map_destroy_textfile,
- map_rect_new_textfile,
- map_rect_destroy_textfile,
- map_rect_get_item_textfile,
- map_rect_get_item_byid_textfile,
-};
-
-static struct map_priv *
-map_new_textfile(struct map_methods *meth, struct attr **attrs)
-{
- struct map_priv *m;
- struct attr *data=attr_search(attrs, NULL, attr_data);
- struct attr *charset=attr_search(attrs, NULL, attr_charset);
- struct file_wordexp *wexp;
- int len,is_pipe=0;
- char *wdata;
- char **wexp_data;
- if (! data)
- return NULL;
- dbg(0,"map_new_textfile %s\n", data->u.str);
- wdata=g_strdup_printf(data->u.str);
- len=strlen(wdata);
- if (len && wdata[len-1] == '|') {
- wdata[len-1]='\0';
- is_pipe=1;
- }
- wexp=file_wordexp_new(wdata);
- wexp_data=file_wordexp_get_array(wexp);
- *meth=map_methods_textfile;
-
- m=g_new0(struct map_priv, 1);
- m->id=++map_id;
- m->filename=g_strdup(wexp_data[0]);
- m->is_pipe=is_pipe;
- dbg(1,"map_new_textfile %s %s\n", m->filename, wdata);
- if (charset) {
- m->charset=g_strdup(charset->u.str);
- meth->charset=m->charset;
- }
- file_wordexp_destroy(wexp);
- return m;
-}
-
-void
-plugin_init(void)
-{
- dbg(1,"textfile: plugin_init\n");
- plugin_register_map_type("textfile", map_new_textfile);
-}
-
diff --git a/navit/data/textfile/textfile.h b/navit/data/textfile/textfile.h
deleted file mode 100644
index 3167e8bf..00000000
--- a/navit/data/textfile/textfile.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <stdio.h>
-#include "attr.h"
-#include "coord.h"
-struct map_priv {
- int id;
- char *filename;
- char *charset;
- int is_pipe;
-};
-
-#define SIZE 512
-
-struct map_rect_priv {
- struct map_selection *sel;
-
- FILE *f;
- long pos;
- char line[SIZE];
- int attr_pos;
- enum attr_type attr_last;
- char attrs[SIZE];
- char attr[SIZE];
- char attr_name[SIZE];
- struct coord c;
- int eoc;
- int more;
- struct map_priv *m;
- struct item item;
- char *args;
-};
-
diff --git a/navit/data_window.c b/navit/data_window.c
deleted file mode 100644
index fa67710f..00000000
--- a/navit/data_window.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <glib.h>
-#include "data_window.h"
-
-void
-datawindow_mode(struct datawindow *win, int start)
-{
- win->meth.mode(win->priv, start);
-}
-
-void
-datawindow_add(struct datawindow *win, struct param_list *param, int count)
-{
- win->meth.add(win->priv, param, count);
-}
-
-void
-datawindow_destroy(struct datawindow *win)
-{
- win->meth.destroy(win->priv);
- g_free(win);
-}
-
diff --git a/navit/data_window.h b/navit/data_window.h
deleted file mode 100644
index 103697db..00000000
--- a/navit/data_window.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef NAVIT_DATA_WINDOW_H
-#define NAVIT_DATA_WINDOW_H
-
-struct datawindow;
-struct param_list;
-struct datawindow_priv;
-
-struct datawindow_methods {
- void (*destroy)(struct datawindow_priv *win);
- void (*add)(struct datawindow_priv *win, struct param_list *param, int count);
- void (*mode)(struct datawindow_priv *win, int start);
-};
-
-struct datawindow {
- struct datawindow_priv *priv;
- struct datawindow_methods meth;
-};
-
-
-void datawindow_destroy(struct datawindow *win);
-void datawindow_add(struct datawindow *win, struct param_list *param, int count);
-void datawindow_mode(struct datawindow *win, int start);
-
-#endif
-
diff --git a/navit/data_window_int.h b/navit/data_window_int.h
deleted file mode 100644
index f455a3a3..00000000
--- a/navit/data_window_int.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef NAVIT_DATA_WINDOW_INT_H
-#define NAVIT_DATA_WINDOW_INT_H
-
-struct data_window {
- GtkWidget *window;
- GtkWidget *scrolled_window;
- GtkWidget *treeview;
- void(*callback)(struct data_window *, char **cols);
-};
-
-#endif
-
diff --git a/navit/debug.c b/navit/debug.c
deleted file mode 100644
index 19a0e98d..00000000
--- a/navit/debug.c
+++ /dev/null
@@ -1,100 +0,0 @@
-#include <windows.h>
-#include <signal.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <glib.h>
-#include "file.h"
-#include "debug.h"
-
-
-int debug_level=0,segv_level=0;
-static GHashTable *debug_hash;
-static char *gdb_program;
-static FILE *fLog;
-static void sigsegv(int sig)
-{
-//#if !defined(__CEGCC__)
-// char buffer[256];
-// if (segv_level > 1)
-// sprintf(buffer, "gdb -ex bt %s %d", gdb_program, getpid());
-// else
-// sprintf(buffer, "gdb -ex bt -ex detach -ex quit %s %d", gdb_program, getpid());
-// system(buffer);
-//#endif
-// exit(1);
-}
-
-void
-debug_init(const char *program_name)
-{
- gdb_program=program_name;
- signal(SIGSEGV, sigsegv);
- fLog = NULL; /* fopen("/Storage Card/navit.txt","a"); */
- debug_hash=g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
-}
-
-
-static void
-debug_update_level(gpointer key, gpointer value, gpointer user_data)
-{
- if (debug_level < (int) value)
- debug_level=(int) value;
-}
-
-void
-debug_level_set(const char *name, int level)
-{
- debug_level=0;
- if (strcmp(name,"segv")) {
- g_hash_table_insert(debug_hash, g_strdup(name), (gpointer) level);
- g_hash_table_foreach(debug_hash, debug_update_level, NULL);
- } else {
- segv_level=level;
- if (segv_level)
- signal(SIGSEGV, sigsegv);
- else
- signal(SIGSEGV, NULL);
- }
-}
-
-int
-debug_level_get(const char *name)
-{
- return (int)(g_hash_table_lookup(debug_hash, name));
-}
-
-void
-debug_vprintf(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, va_list ap)
-{
- char buffer[mlen+flen+3];
-
- sprintf(buffer, "%s:%s", module, function);
- if (debug_level_get(module) >= level || debug_level_get(buffer) >= level) {
- if (fLog)
- {
- if (prefix)
- fprintf(fLog,"%s:",buffer);
- vfprintf(fLog, fmt, ap);
- }
- else
- {
- if (prefix)
- fprintf(stderr,"%s:",buffer);
- vfprintf(stderr, fmt, ap);
- }
- }
-}
-
-void
-debug_printf(int level, const char *module, const int mlen,const char *function, const int flen, int prefix, const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- debug_vprintf(level, module, mlen, function, flen, prefix, fmt, ap);
- va_end(ap);
-}
-
-
diff --git a/navit/debug.h b/navit/debug.h
deleted file mode 100644
index 7e897129..00000000
--- a/navit/debug.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef NAVIT_DEBUG_H
-#define NAVIT_DEBUG_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdarg.h>
-extern int debug_level;
-#define dbg_str2(x) #x
-#define dbg_str1(x) dbg_str2(x)
-#define dbg_module dbg_str1(MODULE)
-#define dbg(level,fmt...) ({ if (debug_level >= level) debug_printf(level,dbg_module,strlen(dbg_module),__PRETTY_FUNCTION__, strlen(__PRETTY_FUNCTION__),1,fmt); })
-
-/* prototypes */
-void debug_init(const char *program_name);
-void debug_level_set(const char *name, int level);
-int debug_level_get(const char *name);
-void debug_vprintf(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, va_list ap);
-void debug_printf(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, ...);
-/* end of prototypes */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/navit/destination.h b/navit/destination.h
deleted file mode 100644
index b019fc06..00000000
--- a/navit/destination.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef NAVIT_DESTINATION_H
-#define NAVIT_DESTINATION_H
-
-/* prototypes */
-struct navit;
-int destination_address(struct navit *nav);
-/* end of prototypes */
-
-#endif
-
diff --git a/navit/draw_info.h b/navit/draw_info.h
deleted file mode 100644
index 863b0017..00000000
--- a/navit/draw_info.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef NAVIT_DRAW_INFO_H
-#define NAVIT_DRAW_INFO_H
-
-struct draw_info {
- struct container *co;
- int display;
- int limit;
-};
-
-#endif
-
diff --git a/navit/endianess.h b/navit/endianess.h
deleted file mode 100644
index 8d8cf8b5..00000000
--- a/navit/endianess.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef __ENDIANESS_HANDLER__
-
- /* The following is based on xorg/xserver/GL/glx/glxbyteorder.h
- * which is (c) IBM Corp. 2006,2007 and originally licensed under the following
- * BSD-license. All modifications in navit are licensed under the GNU GPL as
- * described in file "COPYRIGHT".
- * --------------------------
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sub license,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, THE AUTHORS, AND/OR THEIR SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
- * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
- #define le16_to_cpu(x) (x)
- #define le32_to_cpu(x) (x)
- #define cpu_to_le16(x) (x)
- #define cpu_to_le16(x) (x)
-
-#define __ENDIANESS_HANDLER__
-#endif
-
diff --git a/navit/event.c b/navit/event.c
deleted file mode 100644
index 8fe59490..00000000
--- a/navit/event.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <glib.h>
-#include "event.h"
-
-static GMainLoop *loop;
-
-void event_main_loop_run(void)
-{
- loop = g_main_loop_new (NULL, TRUE);
- if (g_main_loop_is_running (loop))
- {
- g_main_loop_run (loop);
- }
-}
-
-void event_main_loop_quit(void)
-{
- if (loop)
- g_main_loop_quit(loop);
-}
diff --git a/navit/event.h b/navit/event.h
deleted file mode 100644
index 23c07ebf..00000000
--- a/navit/event.h
+++ /dev/null
@@ -1,2 +0,0 @@
-void event_main_loop_run(void);
-void event_main_loop_quit(void);
diff --git a/navit/file.c b/navit/file.c
deleted file mode 100644
index 71b797b8..00000000
--- a/navit/file.c
+++ /dev/null
@@ -1,469 +0,0 @@
-#define _FILE_OFFSET_BITS 64
-#define _LARGEFILE_SOURCE
-#define _LARGEFILE64_SOURCE
-#include <windows.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#if 0
-#include <sys/mman.h>
-#endif
-#include <dirent.h>
-#include <stdio.h>
-#if 0
-#include <wordexp.h>
-#endif
-#include <glib.h>
-#include <zlib.h>
-#include "debug.h"
-#include "file.h"
-#include "config.h"
-
-#ifndef O_LARGEFILE
-#define O_LARGEFILE 0
-#endif
-
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-static struct file *file_list;
-
-struct file *
-file_create(char *name)
-{
- struct stat stat;
- struct file *file= g_new0(struct file,1);
-
- if (! file)
- return file;
- file->fd=open(name, O_RDONLY|O_LARGEFILE | O_BINARY);
- if (file->fd < 0) {
- g_free(file);
- return NULL;
- }
- fstat(file->fd, &stat);
- file->size=stat.st_size;
- file->name = g_strdup(name);
- g_assert(file != NULL);
- file->next=file_list;
- file_list=file;
- return file;
-}
-
-int file_is_dir(char *name)
-{
- struct stat buf;
- if (! stat(name, &buf)) {
- return S_ISDIR(buf.st_mode);
- }
- return 0;
-
-}
-
-int file_mkdir(char *name, int pflag)
-{
- char buffer[strlen(name)+1];
- int ret;
- char *curr, *next;
- dbg(1,"enter %s %d\n",name,pflag);
- if (!pflag) {
- if (file_is_dir(name))
- return 0;
-#if !defined(__CEGCC__) && defined(_WIN32)
- return mkdir(name);
-#else
- return mkdir(name, 0777);
-#endif
- }
- strcpy(buffer, name);
- next=buffer;
- while (next=strchr(next, '/')) {
- *next='\0';
- ret=file_mkdir(buffer, 0);
- if (ret)
- return ret;
- *next++='/';
- }
- if (pflag == 1)
-#if !defined(__CEGCC__) && defined(_WIN32)
- return mkdir(name);
-#else
- return mkdir(name, 0777);
-#endif
- return 0;
-}
-
-int
-file_mmap(struct file *file)
-{
-#if 0
-#if defined(_WIN32) || defined(__CEGCC__)
- file->begin = (unsigned char*)mmap_readonly_win32( file->name, &file->map_handle, &file->map_file );
-#else
- file->begin=mmap(NULL, file->size, PROT_READ|PROT_WRITE, MAP_PRIVATE, file->fd, 0);
- g_assert(file->begin != NULL);
- if (file->begin == (void *)0xffffffff) {
- perror("mmap");
- return 0;
- }
-#endif
- g_assert(file->begin != (void *)0xffffffff);
- file->end=file->begin+file->size;
-
- return 1;
-#endif
- return 0;
-}
-
-unsigned char *
-file_data_read(struct file *file, long long offset, int size)
-{
- void *ret;
- if (file->begin)
- return file->begin+offset;
- ret=g_malloc(size);
- lseek(file->fd, offset, SEEK_SET);
- if (read(file->fd, ret, size) != size) {
- g_free(ret);
- ret=NULL;
- }
- return ret;
-
-}
-
-static int
-uncompress_int(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
-{
- z_stream stream;
- int err;
-
- stream.next_in = (Bytef*)source;
- stream.avail_in = (uInt)sourceLen;
- stream.next_out = dest;
- stream.avail_out = (uInt)*destLen;
-
- stream.zalloc = (alloc_func)0;
- stream.zfree = (free_func)0;
-
- err = inflateInit2(&stream, -MAX_WBITS);
- if (err != Z_OK) return err;
-
- err = inflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- inflateEnd(&stream);
- if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
- return Z_DATA_ERROR;
- return err;
- }
- *destLen = stream.total_out;
-
- err = inflateEnd(&stream);
- return err;
-}
-
-unsigned char *
-file_data_read_compressed(struct file *file, long long offset, int size, int size_uncomp)
-{
- void *ret;
- char buffer[size];
- uLongf destLen=size_uncomp;
-
- ret=g_malloc(size_uncomp);
- lseek(file->fd, offset, SEEK_SET);
- if (read(file->fd, buffer, size) != size) {
- g_free(ret);
- ret=NULL;
- } else {
- if (uncompress_int(ret, &destLen, (Bytef *)buffer, size) != Z_OK) {
- dbg(0,"uncompress failed\n");
- g_free(ret);
- ret=NULL;
- }
- }
- return ret;
-}
-
-void
-file_data_free(struct file *file, unsigned char *data)
-{
- if (file->begin && data >= file->begin && data < file->end)
- return;
- g_free(data);
-}
-
-int
-file_exists(char *name)
-{
- struct stat buf;
- if (! stat(name, &buf))
- return 1;
- return 0;
-}
-
-void
-file_remap_readonly(struct file *f)
-{
-#if defined(_WIN32) || defined(__CEGCC__)
-#else
- void *begin;
- munmap(f->begin, f->size);
- begin=mmap(f->begin, f->size, PROT_READ, MAP_PRIVATE, f->fd, 0);
- if (f->begin != begin)
- printf("remap failed\n");
-#endif
-}
-
-void
-file_remap_readonly_all(void)
-{
- struct file *f=file_list;
- int limit=1000;
-
- while (f && limit-- > 0) {
- file_remap_readonly(f);
- f=f->next;
- }
-}
-
-void
-file_unmap(struct file *f)
-{
-#if 0
-#if defined(_WIN32) || defined(__CEGCC__)
- mmap_unmap_win32( f->begin, f->map_handle , f->map_file );
-#else
- munmap(f->begin, f->size);
-#endif
-#endif
-}
-
-void
-file_unmap_all(void)
-{
- struct file *f=file_list;
- int limit=1000;
-
- while (f && limit-- > 0) {
- file_unmap(f);
- f=f->next;
- }
-}
-
-
-
-void *
-file_opendir(char *dir)
-{
- return opendir(dir);
-}
-
-char *
-file_readdir(void *hnd)
-{
- struct dirent *ent;
-
- ent=readdir(hnd);
- if (! ent)
- return NULL;
- return ent->d_name;
-}
-
-void
-file_closedir(void *hnd)
-{
- closedir(hnd);
-}
-
-struct file *
-file_create_caseinsensitive(char *name)
-{
- char dirname[strlen(name)+1];
- char *filename;
- char *p;
- void *d;
- struct file *ret;
-
- ret=file_create(name);
- if (ret)
- return ret;
-
- strcpy(dirname, name);
- p=dirname+strlen(name);
- while (p > dirname) {
- if (*p == '/')
- break;
- p--;
- }
- *p=0;
- d=file_opendir(dirname);
- if (d) {
- *p++='/';
- while ((filename=file_readdir(d))) {
- if (!strcasecmp(filename, p)) {
- strcpy(p, filename);
- ret=file_create(dirname);
- if (ret)
- break;
- }
- }
- file_closedir(d);
- }
- return ret;
-}
-
-void
-file_destroy(struct file *f)
-{
- close(f->fd);
-
- if ( f->begin != NULL )
- {
- file_unmap( f );
- }
-
- g_free(f->name);
- g_free(f);
-}
-
-#ifndef _WORDEXP_H_
-#define _WORDEXP_H_
-
-
-typedef struct {
- size_t we_wordc; /* count of words matched */
- char **we_wordv; /* pointer to list of words */
- size_t we_offs; /* slots to reserve in we_wordv */
- /* following are internals */
- char *we_strings; /* storage for wordv strings */
- size_t we_nbytes; /* size of we_strings */
-} wordexp_t;
-
-/*
- * Flags for wordexp().
- */
-#define WRDE_APPEND 0x1 /* append to previously generated */
-#define WRDE_DOOFFS 0x2 /* we_offs member is valid */
-#define WRDE_NOCMD 0x4 /* disallow command substitution */
-#define WRDE_REUSE 0x8 /* reuse wordexp_t */
-#define WRDE_SHOWERR 0x10 /* don't redirect stderr to /dev/null */
-#define WRDE_UNDEF 0x20 /* disallow undefined shell vars */
-
-/*
- * Return values from wordexp().
- */
-#define WRDE_BADCHAR 1 /* unquoted special character */
-#define WRDE_BADVAL 2 /* undefined variable */
-#define WRDE_CMDSUB 3 /* command substitution not allowed */
-#define WRDE_NOSPACE 4 /* no memory for result */
-#if (_XOPEN_SOURCE - 0) >= 4 || defined(_NETBSD_SOURCE)
-#define WRDE_NOSYS 5 /* obsolete, reserved */
-#endif
-#define WRDE_SYNTAX 6 /* shell syntax error */
-#define WRDE_ERRNO 7 /* other errors see errno */
-
-void wordfree(wordexp_t *);
-int wordexp(const char * words, wordexp_t * we, int flags);
-
-
-#endif /* !_WORDEXP_H_ */
-
-#include <sys/types.h>
-#include <assert.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-int wordexp(const char * words, wordexp_t * we, int flags)
-{
- int error=0;
-
- assert(we != NULL);
- assert(words != NULL);
-
- we->we_wordc = 1;
- we->we_wordv = NULL;
- we->we_strings = NULL;
- we->we_nbytes = 0;
-
- we->we_wordv = malloc( we->we_wordc * sizeof( char* ) );
-
- we->we_nbytes = strlen( words ) + 1;
- we->we_strings = malloc( we->we_nbytes );
-
- we->we_wordv[0] = &we->we_strings[0];
-
- // copy string & terminate
- memcpy( we->we_strings, words, we->we_nbytes -1 );
- we->we_strings[ we->we_nbytes -1 ] = '\0';
-
- return error;
-}
-
-void wordfree(wordexp_t *we)
-{
- assert(we != NULL);
-
- if ( we->we_wordv )
- {
- free(we->we_wordv);
- }
- if ( we->we_strings )
- {
- free(we->we_strings);
- }
-
- we->we_wordv = NULL;
- we->we_strings = NULL;
- we->we_nbytes = 0;
- we->we_wordc = 0;
-}
-struct file_wordexp {
- int err;
- wordexp_t we;
-};
-
-struct file_wordexp *
-file_wordexp_new(const char *pattern)
-{
- struct file_wordexp *ret=g_new0(struct file_wordexp, 1);
-
- ret->err=wordexp(pattern, &ret->we, 0);
- if (ret->err)
- dbg(0,"wordexp('%s') returned %d\n", pattern, ret->err);
- return ret;
- return NULL;
-}
-
-int
-file_wordexp_get_count(struct file_wordexp *wexp)
-{
- return wexp->we.we_wordc;
-}
-
-char **
-file_wordexp_get_array(struct file_wordexp *wexp)
-{
- return wexp->we.we_wordv;
-}
-
-void
-file_wordexp_destroy(struct file_wordexp *wexp)
-{
- if (! wexp->err)
- wordfree(&wexp->we);
- g_free(wexp);
-}
-
-
-int
-file_get_param(struct file *file, struct param_list *param, int count)
-{
- int i=count;
- param_add_string("Filename", file->name, &param, &count);
- param_add_hex("Size", file->size, &param, &count);
- return i-count;
-}
diff --git a/navit/file.h b/navit/file.h
deleted file mode 100644
index 63712ca1..00000000
--- a/navit/file.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef NAVIT_FILE_H
-#define NAVIT_FILE_H
-
-#include <windows.h>
-#include "param.h"
-
-struct file {
- unsigned char *begin;
- unsigned char *end;
- long long size;
- char *name;
- int fd;
-#if defined(_WIN32) || defined(__CEGCC__)
- long map_handle;
- long map_file;
-#endif
- struct file *next;
-};
-
-/* prototypes */
-struct file;
-struct file_wordexp;
-struct param_list;
-struct file *file_create(char *name);
-int file_is_dir(char *name);
-int file_mkdir(char *name, int pflag);
-int file_mmap(struct file *file);
-unsigned char *file_data_read(struct file *file, long long offset, int size);
-unsigned char *file_data_read_compressed(struct file *file, long long offset, int size, int size_uncomp);
-void file_data_free(struct file *file, unsigned char *data);
-int file_exists(char *name);
-void file_remap_readonly(struct file *f);
-void file_remap_readonly_all(void);
-void file_unmap(struct file *f);
-void file_unmap_all(void);
-void *file_opendir(char *dir);
-char *file_readdir(void *hnd);
-void file_closedir(void *hnd);
-struct file *file_create_caseinsensitive(char *name);
-void file_destroy(struct file *f);
-struct file_wordexp *file_wordexp_new(const char *pattern);
-int file_wordexp_get_count(struct file_wordexp *wexp);
-char **file_wordexp_get_array(struct file_wordexp *wexp);
-void file_wordexp_destroy(struct file_wordexp *wexp);
-int file_get_param(struct file *file, struct param_list *param, int count);
-/* end of prototypes */
-
-#endif
-
diff --git a/navit/graphics.c b/navit/graphics.c
deleted file mode 100644
index 75a1f946..00000000
--- a/navit/graphics.c
+++ /dev/null
@@ -1,1021 +0,0 @@
-//##############################################################################################################
-//#
-//# File: graphics.c
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//#
-//##############################################################################################################
-
-#include <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include "debug.h"
-#include "string.h"
-#include "draw_info.h"
-#include "point.h"
-#include "graphics.h"
-#include "projection.h"
-#include "map.h"
-#include "coord.h"
-#include "transform.h"
-#include "plugin.h"
-#include "profile.h"
-#include "mapset.h"
-#include "layout.h"
-#include "route.h"
-#include "util.h"
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-struct graphics
-{
- struct graphics_priv *priv;
- struct graphics_methods meth;
- struct graphics_font *font[16];
- struct graphics_gc *gc[3];
- struct attr **attrs;
- int ready;
-};
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-struct displaylist {
- GHashTable *dl;
-};
-//##############################################################################################################
-//# Description: Creates a new graphics object
-//# Comment: attr type required
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-struct graphics * graphics_new(struct attr *parent, struct attr **attrs)
-{
- struct graphics *this_;
- struct attr *type_attr;
- struct graphics_priv * (*graphicstype_new)(struct graphics_methods *meth, struct attr **attrs);
-
- if (! (type_attr=attr_search(attrs, NULL, attr_type))) {
- return NULL;
- }
-
- graphicstype_new=plugin_get_graphics_type(type_attr->u.str);
- if (! graphicstype_new)
- return NULL;
- this_=g_new0(struct graphics, 1);
- this_->priv=(*graphicstype_new)(&this_->meth, attrs);
- this_->attrs=attr_list_dup(attrs);
- return this_;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-int graphics_get_attr(struct graphics *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
-{
- return attr_generic_get_attr(this_->attrs, type, attr, iter);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-struct graphics * graphics_overlay_new(struct graphics *parent, struct point *p, int w, int h)
-{
- struct graphics *this_;
- this_=g_new0(struct graphics, 1);
- this_->priv=parent->meth.overlay_new(parent->priv, &this_->meth, p, w, h);
- return this_;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void graphics_init(struct graphics *this_)
-{
- this_->gc[0]=graphics_gc_new(this_);
- graphics_gc_set_background(this_->gc[0], &(struct color) { 0xffff, 0xefef, 0xb7b7 });
- graphics_gc_set_foreground(this_->gc[0], &(struct color) { 0xffff, 0xefef, 0xb7b7 });
- this_->gc[1]=graphics_gc_new(this_);
- graphics_gc_set_background(this_->gc[1], &(struct color) { 0x0000, 0x0000, 0x0000 });
- graphics_gc_set_foreground(this_->gc[1], &(struct color) { 0xffff, 0xffff, 0xffff });
- this_->gc[2]=graphics_gc_new(this_);
- graphics_gc_set_background(this_->gc[2], &(struct color) { 0xffff, 0xffff, 0xffff });
- graphics_gc_set_foreground(this_->gc[2], &(struct color) { 0xffff, 0xffff, 0xffff });
- this_->meth.background_gc(this_->priv, this_->gc[0]->priv);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void * graphics_get_data(struct graphics *this_, char *type)
-{
- return (this_->meth.get_data(this_->priv, type));
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void graphics_register_resize_callback(struct graphics *this_, void (*callback)(void *data, int w, int h), void *data)
-{
- this_->meth.register_resize_callback(this_->priv, callback, data);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment: Called in navit.c
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void graphics_register_button_callback(struct graphics *this_, void (*callback)(void *data, int pressed, int button, struct point *p), void *data)
-{
- this_->meth.register_button_callback(this_->priv, callback, data);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void graphics_register_motion_callback(struct graphics *this_, void (*callback)(void *data, struct point *p), void *data)
-{
- this_->meth.register_motion_callback(this_->priv, callback, data);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-struct graphics_font * graphics_font_new(struct graphics *gra, int size, int flags)
-{
- struct graphics_font *this_;
-
- this_=g_new0(struct graphics_font,1);
- this_->priv=gra->meth.font_new(gra->priv, &this_->meth, size, flags);
- return this_;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-struct graphics_gc * graphics_gc_new(struct graphics *gra)
-{
- struct graphics_gc *this_;
-
- this_=g_new0(struct graphics_gc,1);
- this_->priv=gra->meth.gc_new(gra->priv, &this_->meth);
- return this_;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void graphics_gc_destroy(struct graphics_gc *gc)
-{
- gc->meth.gc_destroy(gc->priv);
- g_free(gc);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void graphics_gc_set_foreground(struct graphics_gc *gc, struct color *c)
-{
- gc->meth.gc_set_foreground(gc->priv, c);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void graphics_gc_set_background(struct graphics_gc *gc, struct color *c)
-{
- gc->meth.gc_set_background(gc->priv, c);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void graphics_gc_set_linewidth(struct graphics_gc *gc, int width)
-{
- gc->meth.gc_set_linewidth(gc->priv, width);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void graphics_gc_set_dashes(struct graphics_gc *gc, int width, int offset, unsigned char dash_list[], int n)
-{
- if (gc->meth.gc_set_dashes)
- gc->meth.gc_set_dashes(gc->priv, width, offset, dash_list, n);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-struct graphics_image * graphics_image_new(struct graphics *gra, char *path)
-{
- struct graphics_image *this_;
-
- this_=g_new0(struct graphics_image,1);
- this_->priv=gra->meth.image_new(gra->priv, &this_->meth, path, &this_->width, &this_->height, &this_->hot);
- if (! this_->priv) {
- g_free(this_);
- this_=NULL;
- }
- return this_;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void graphics_image_free(struct graphics *gra, struct graphics_image *img)
-{
- if (gra->meth.image_free)
- gra->meth.image_free(gra->priv, img->priv);
- g_free(img);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void graphics_draw_restore(struct graphics *this_, struct point *p, int w, int h)
-{
- this_->meth.draw_restore(this_->priv, p, w, h);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void graphics_draw_mode(struct graphics *this_, enum draw_mode_num mode)
-{
- this_->meth.draw_mode(this_->priv, mode);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void graphics_draw_lines(struct graphics *this_, struct graphics_gc *gc, struct point *p, int count)
-{
- this_->meth.draw_lines(this_->priv, gc->priv, p, count);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void graphics_draw_circle(struct graphics *this_, struct graphics_gc *gc, struct point *p, int r)
-{
- this_->meth.draw_circle(this_->priv, gc->priv, p, r);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void graphics_draw_rectangle(struct graphics *this_, struct graphics_gc *gc, struct point *p, int w, int h)
-{
- this_->meth.draw_rectangle(this_->priv, gc->priv, p, w, h);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void graphics_draw_text(struct graphics *this_, struct graphics_gc *gc1, struct graphics_gc *gc2, struct graphics_font *font, char *text, struct point *p, int dx, int dy)
-{
- this_->meth.draw_text(this_->priv, gc1->priv, gc2 ? gc2->priv : NULL, font->priv, text, p, dx, dy);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void graphics_draw_image(struct graphics *this_, struct graphics_gc *gc, struct point *p, struct graphics_image *img)
-{
- this_->meth.draw_image(this_->priv, gc->priv, p, img->priv);
-}
-
-#include "attr.h"
-#include "popup.h"
-#include <stdio.h>
-
-
-#if 0
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void popup_view_html(struct popup_item *item, char *file)
-{
- char command[1024];
- sprintf(command,"firefox %s", file);
- system(command);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void graphics_popup(struct display_list *list, struct popup_item **popup)
-{
- struct item *item;
- struct attr attr;
- struct map_rect *mr;
- struct coord c;
- struct popup_item *curr_item,*last=NULL;
- item=list->data;
- mr=map_rect_new(item->map, NULL, NULL, 0);
- printf("id hi=0x%x lo=0x%x\n", item->id_hi, item->id_lo);
- item=map_rect_get_item_byid(mr, item->id_hi, item->id_lo);
- if (item) {
- if (item_attr_get(item, attr_name, &attr)) {
- curr_item=popup_item_new_text(popup,attr.u.str,1);
- if (item_attr_get(item, attr_info_html, &attr)) {
- popup_item_new_func(&last,"HTML Info",1, popup_view_html, g_strdup(attr.u.str));
- }
- if (item_attr_get(item, attr_price_html, &attr)) {
- popup_item_new_func(&last,"HTML Preis",2, popup_view_html, g_strdup(attr.u.str));
- }
- curr_item->submenu=last;
- }
- }
- map_rect_destroy(mr);
-}
-#endif
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-struct displayitem {
- struct item item;
- char *label;
- int displayed;
- int count;
- struct point pnt[0];
-};
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static int xdisplay_free_list(gpointer key, gpointer value, gpointer user_data)
-{
- GList *h, *l;
- h=value;
- l=h;
- while (l) {
- struct displayitem *di=l->data;
- if (! di->displayed && di->item.type < type_line)
- dbg(1,"warning: item '%s' not displayed\n", item_to_name(di->item.type));
- g_free(l->data);
- l=g_list_next(l);
- }
- g_list_free(h);
- return TRUE;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void xdisplay_free(GHashTable *display_list)
-{
- g_hash_table_foreach_remove(display_list, xdisplay_free_list, NULL);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void display_add(struct displaylist *displaylist, struct item *item, int count, struct point *pnt, char *label)
-{
- struct displayitem *di;
- int len;
- GList *l;
- char *p;
-
- len=sizeof(*di)+count*sizeof(*pnt);
- if (label)
- len+=strlen(label)+1;
-
- p=g_malloc(len);
-
- di=(struct displayitem *)p;
- di->displayed=0;
- p+=sizeof(*di)+count*sizeof(*pnt);
- di->item=*item;
- if (label) {
- di->label=p;
- strcpy(di->label, label);
- } else
- di->label=NULL;
- di->count=count;
- memcpy(di->pnt, pnt, count*sizeof(*pnt));
-
- l=g_hash_table_lookup(displaylist->dl, GINT_TO_POINTER(item->type));
- l=g_list_prepend(l, di);
- g_hash_table_insert(displaylist->dl, GINT_TO_POINTER(item->type), l);
-}
-
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void label_line(struct graphics *gra, struct graphics_gc *fg, struct graphics_gc *bg, struct graphics_font *font, struct point *p, int count, char *label)
-{
- int i,x,y,tl;
- double dx,dy,l;
- struct point p_t;
-
- tl=strlen(label)*400;
- for (i = 0 ; i < count-1 ; i++) {
- dx=p[i+1].x-p[i].x;
- dx*=100;
- dy=p[i+1].y-p[i].y;
- dy*=100;
- l=(int)sqrt((float)(dx*dx+dy*dy));
- if (l > tl) {
- x=p[i].x;
- y=p[i].y;
- if (dx < 0) {
- dx=-dx;
- dy=-dy;
- x=p[i+1].x;
- y=p[i+1].y;
- }
- x+=(l-tl)*dx/l/200;
- y+=(l-tl)*dy/l/200;
- x-=dy*45/l/10;
- y+=dx*45/l/10;
- p_t.x=x;
- p_t.y=y;
- #if 0
- printf("display_text: '%s', %d, %d, %d, %d %d\n", label, x, y, dx*0x10000/l, dy*0x10000/l, l);
- #endif
- gra->meth.draw_text(gra->priv, fg->priv, bg->priv, font->priv, label, &p_t, dx*0x10000/l, dy*0x10000/l);
- }
- }
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void xdisplay_draw_elements(struct graphics *gra, GHashTable *display_list, struct itemtype *itm)
-{
- struct element *e;
- GList *l,*ls,*es,*types;
- enum item_type type;
- struct graphics_gc *gc = NULL;
- struct graphics_image *img;
- struct point p;
-
- es=itm->elements;
- while (es) {
- e=es->data;
- types=itm->type;
- while (types) {
- type=GPOINTER_TO_INT(types->data);
- ls=g_hash_table_lookup(display_list, GINT_TO_POINTER(type));
- l=ls;
- if (gc)
- graphics_gc_destroy(gc);
- gc=NULL;
- img=NULL;
- while (l) {
- struct displayitem *di;
- di=l->data;
- di->displayed=1;
- if (! gc) {
- gc=graphics_gc_new(gra);
- gc->meth.gc_set_foreground(gc->priv, &e->color);
- }
- switch (e->type) {
- case element_polygon:
- gra->meth.draw_polygon(gra->priv, gc->priv, di->pnt, di->count);
- break;
- case element_polyline:
- if (e->u.polyline.width > 1)
- gc->meth.gc_set_linewidth(gc->priv, e->u.polyline.width);
- if (e->u.polyline.width > 0 && e->u.polyline.dash_num > 0)
- graphics_gc_set_dashes(gc, e->u.polyline.width, 0,
- e->u.polyline.dash_table,
- e->u.polyline.dash_num);
- gra->meth.draw_lines(gra->priv, gc->priv, di->pnt, di->count);
- break;
- case element_circle:
- if (e->u.circle.width > 1)
- gc->meth.gc_set_linewidth(gc->priv, e->u.polyline.width);
- gra->meth.draw_circle(gra->priv, gc->priv, &di->pnt[0], e->u.circle.radius);
- if (di->label && e->label_size) {
- p.x=di->pnt[0].x+3;
- p.y=di->pnt[0].y+10;
- if (! gra->font[e->label_size])
- gra->font[e->label_size]=graphics_font_new(gra, e->label_size*20, 0);
- gra->meth.draw_text(gra->priv, gra->gc[2]->priv, gra->gc[1]->priv, gra->font[e->label_size]->priv, di->label, &p, 0x10000, 0);
- }
- break;
- case element_label:
- if (di->label) {
- if (! gra->font[e->label_size])
- gra->font[e->label_size]=graphics_font_new(gra, e->label_size*20, 0);
- label_line(gra, gra->gc[2], gra->gc[1], gra->font[e->label_size], di->pnt, di->count, di->label);
- }
- break;
- case element_icon:
- if (!img) {
- char *icon=g_strjoin(NULL,getenv("NAVIT_SHAREDIR"), "/xpm/", e->u.icon.src, NULL);
- img=graphics_image_new(gra, icon);
- g_free(icon);
- if (! img)
- g_warning("failed to load icon '%s'\n", e->u.icon.src);
- }
- if (img) {
- p.x=di->pnt[0].x - img->hot.x;
- p.y=di->pnt[0].y - img->hot.y;
- gra->meth.draw_image(gra->priv, gra->gc[0]->priv, &p, img->priv);
- graphics_image_free(gra, img);
- img = NULL;
- }
- break;
- case element_image:
- dbg(1,"image: '%s'\n", di->label);
- if (gra->meth.draw_image_warp)
- gra->meth.draw_image_warp(gra->priv, gra->gc[0]->priv, di->pnt, di->count, di->label);
- else
- dbg(0,"draw_image_warp not supported by graphics driver drawing '%s'\n", di->label);
- break;
- default:
- printf("Unhandled element type %d\n", e->type);
-
- }
- l=g_list_next(l);
- }
- types=g_list_next(types);
- }
- es=g_list_next(es);
- }
- if (gc)
- graphics_gc_destroy(gc);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void xdisplay_draw_layer(GHashTable *display_list, struct graphics *gra, struct layer *lay, int order)
-{
- GList *itms;
- struct itemtype *itm;
-
- itms=lay->itemtypes;
- while (itms) {
- itm=itms->data;
- if (order >= itm->order_min && order <= itm->order_max)
- xdisplay_draw_elements(gra, display_list, itm);
- itms=g_list_next(itms);
- }
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void xdisplay_draw(GHashTable *display_list, struct graphics *gra, struct layout *l, int order)
-{
- GList *lays;
- struct layer *lay;
-
- lays=l->layers;
- while (lays) {
- lay=lays->data;
- xdisplay_draw_layer(display_list, gra, lay, order);
- lays=g_list_next(lays);
- }
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-extern void *route_selection;
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void do_draw_map(struct displaylist *displaylist, struct transformation *t, struct map *m, int order)
-{
- enum projection pro;
- struct map_rect *mr;
- struct item *item;
- int conv,count,max=16384;
- struct point pnt[max];
- struct coord ca[max];
- struct attr attr;
- struct map_selection *sel;
-
- pro=map_projection(m);
- conv=map_requires_conversion(m);
- sel=transform_get_selection(t, pro, order);
- if (route_selection)
- mr=map_rect_new(m, route_selection);
- else
- mr=map_rect_new(m, sel);
- if (! mr) {
- map_selection_destroy(sel);
- return;
- }
- while ((item=map_rect_get_item(mr))) {
- count=item_coord_get(item, ca, item->type < type_line ? 1: max);
- if (item->type >= type_line && count < 2) {
- dbg(1,"poly from map has only %d points\n", count);
- continue;
- }
- if (item->type < type_line) {
- if (! map_selection_contains_point(sel, &ca[0])) {
- dbg(1,"point not visible\n");
- continue;
- }
- } else if (item->type < type_area) {
- if (! map_selection_contains_polyline(sel, ca, count)) {
- dbg(1,"polyline not visible\n");
- continue;
- }
- } else {
- if (! map_selection_contains_polygon(sel, ca, count)) {
- dbg(1,"polygon not visible\n");
- continue;
- }
- }
- if (count == max)
- dbg(0,"point count overflow\n", count);
- count=transform(t, pro, ca, pnt, count, 1);
- if (item->type >= type_line && count < 2) {
- dbg(1,"poly from transform has only %d points\n", count);
- continue;
- }
- if (!item_attr_get(item, attr_label, &attr))
- attr.u.str=NULL;
- if (conv && attr.u.str && attr.u.str[0]) {
- char *str=map_convert_string(m, attr.u.str);
- display_add(displaylist, item, count, pnt, str);
- map_convert_free(str);
- } else
- display_add(displaylist, item, count, pnt, attr.u.str);
- }
- map_rect_destroy(mr);
- map_selection_destroy(sel);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void do_draw(struct displaylist *displaylist, struct transformation *t, GList *mapsets, int order)
-{
- struct mapset *ms;
- struct map *m;
- struct mapset_handle *h;
-
- if (! mapsets)
- return;
- ms=mapsets->data;
- h=mapset_open(ms);
- while ((m=mapset_next(h, 1))) {
- do_draw_map(displaylist, t, m, order);
- }
- mapset_close(h);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-int graphics_ready(struct graphics *this_)
-{
- return this_->ready;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void graphics_displaylist_draw(struct graphics *gra, struct displaylist *displaylist, struct transformation *trans, struct layout *l)
-{
- int order=transform_get_order(trans);
- struct point p;
- p.x=0;
- p.y=0;
- // FIXME find a better place to set the background color
- graphics_gc_set_background(gra->gc[0], l->color);
- graphics_gc_set_foreground(gra->gc[0], l->color);
- gra->meth.background_gc(gra->priv, gra->gc[0]->priv);
- gra->meth.draw_mode(gra->priv, draw_mode_begin);
- gra->meth.draw_rectangle(gra->priv, gra->gc[0]->priv, &p, 32767, 32767);
- xdisplay_draw(displaylist->dl, gra, l, order);
- gra->meth.draw_mode(gra->priv, draw_mode_end);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void graphics_displaylist_move(struct displaylist *displaylist, int dx, int dy)
-{
- struct displaylist_handle *dlh;
- struct displayitem *di;
- int i;
-
- dlh=graphics_displaylist_open(displaylist);
- while ((di=graphics_displaylist_next(dlh))) {
- for (i = 0 ; i < di->count ; i++) {
- di->pnt[i].x+=dx;
- di->pnt[i].y+=dy;
- }
- }
- graphics_displaylist_close(dlh);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void graphics_draw(struct graphics *gra, struct displaylist *displaylist, GList *mapsets, struct transformation *trans, struct layout *l)
-{
- int order=transform_get_order(trans);
-
- dbg(1,"enter");
-
-#if 0
- printf("scale=%d center=0x%x,0x%x mercator scale=%f\n", scale, co->trans->center.x, co->trans->center.y, transform_scale(co->trans->center.y));
-#endif
-
- xdisplay_free(displaylist->dl);
- dbg(1,"order=%d\n", order);
-
-
-#if 0
- for (i = 0 ; i < data_window_type_end; i++) {
- data_window_begin(co->data_window[i]);
- }
-#endif
- profile(0,NULL);
- do_draw(displaylist, trans, mapsets, order);
-// profile(1,"do_draw");
- graphics_displaylist_draw(gra, displaylist, trans, l);
- profile(1,"xdisplay_draw");
- profile(0,"end");
-
-#if 0
- for (i = 0 ; i < data_window_type_end; i++) {
- data_window_end(co->data_window[i]);
- }
-#endif
- gra->ready=1;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-struct displaylist_handle {
- GList *hl_head,*hl,*l;
-};
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-struct displaylist_handle * graphics_displaylist_open(struct displaylist *displaylist)
-{
- struct displaylist_handle *ret;
-
- ret=g_new0(struct displaylist_handle, 1);
- ret->hl_head=ret->hl=g_hash_to_list(displaylist->dl);
-
- return ret;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-struct displayitem * graphics_displaylist_next(struct displaylist_handle *dlh)
-{
- struct displayitem *ret;
- if (! dlh->l) {
- if (!dlh->hl)
- return NULL;
- dlh->l=dlh->hl->data;
- dlh->hl=g_list_next(dlh->hl);
- }
- ret=dlh->l->data;
- dlh->l=g_list_next(dlh->l);
- return ret;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void graphics_displaylist_close(struct displaylist_handle *dlh)
-{
- g_list_free(dlh->hl_head);
- g_free(dlh);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-struct displaylist * graphics_displaylist_new(void)
-{
- struct displaylist *ret=g_new(struct displaylist, 1);
-
- ret->dl=g_hash_table_new(NULL,NULL);
-
- return ret;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-struct item * graphics_displayitem_get_item(struct displayitem *di)
-{
- return &di->item;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-char * graphics_displayitem_get_label(struct displayitem *di)
-{
- return di->label;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static int within_dist_point(struct point *p0, struct point *p1, int dist)
-{
- if (p0->x == 32767 || p0->y == 32767 || p1->x == 32767 || p1->y == 32767)
- return 0;
- if (p0->x == -32768 || p0->y == -32768 || p1->x == -32768 || p1->y == -32768)
- return 0;
- if ((p0->x-p1->x)*(p0->x-p1->x) + (p0->y-p1->y)*(p0->y-p1->y) <= dist*dist) {
- return 1;
- }
- return 0;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static int within_dist_line(struct point *p, struct point *line_p0, struct point *line_p1, int dist)
-{
- int vx,vy,wx,wy;
- int c1,c2;
- struct point line_p;
-
- vx=line_p1->x-line_p0->x;
- vy=line_p1->y-line_p0->y;
- wx=p->x-line_p0->x;
- wy=p->y-line_p0->y;
-
- c1=vx*wx+vy*wy;
- if ( c1 <= 0 )
- return within_dist_point(p, line_p0, dist);
- c2=vx*vx+vy*vy;
- if ( c2 <= c1 )
- return within_dist_point(p, line_p1, dist);
-
- line_p.x=line_p0->x+vx*c1/c2;
- line_p.y=line_p0->y+vy*c1/c2;
- return within_dist_point(p, &line_p, dist);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static int within_dist_polyline(struct point *p, struct point *line_pnt, int count, int dist, int close)
-{
- int i;
- for (i = 0 ; i < count-1 ; i++) {
- if (within_dist_line(p,line_pnt+i,line_pnt+i+1,dist)) {
- return 1;
- }
- }
- if (close)
- return (within_dist_line(p,line_pnt,line_pnt+count-1,dist));
- return 0;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static int within_dist_polygon(struct point *p, struct point *poly_pnt, int count, int dist)
-{
- int i, j, c = 0;
- for (i = 0, j = count-1; i < count; j = i++) {
- if ((((poly_pnt[i].y <= p->y) && ( p->y < poly_pnt[j].y )) ||
- ((poly_pnt[j].y <= p->y) && ( p->y < poly_pnt[i].y))) &&
- (p->x < (poly_pnt[j].x - poly_pnt[i].x) * (p->y - poly_pnt[i].y) / (poly_pnt[j].y - poly_pnt[i].y) + poly_pnt[i].x))
- c = !c;
- }
- if (! c)
- return within_dist_polyline(p, poly_pnt, count, dist, 1);
- return c;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-int graphics_displayitem_within_dist(struct displayitem *di, struct point *p, int dist)
-{
- if (di->item.type < type_line) {
- return within_dist_point(p, &di->pnt[0], dist);
- }
- if (di->item.type < type_area) {
- return within_dist_polyline(p, di->pnt, di->count, dist, 0);
- }
- return within_dist_polygon(p, di->pnt, di->count, dist);
-}
diff --git a/navit/graphics.h b/navit/graphics.h
deleted file mode 100644
index 7983c4b8..00000000
--- a/navit/graphics.h
+++ /dev/null
@@ -1,146 +0,0 @@
-#ifndef NAVIT_GRAPHICS_H
-#define NAVIT_GRAPHICS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-struct point;
-struct container;
-struct color;
-struct graphics;
-struct graphics_gc;
-struct graphics_font;
-struct graphics_image;
-struct transformation;
-struct display_list;
-
-enum draw_mode_num {
- draw_mode_begin, draw_mode_end, draw_mode_cursor
-};
-
-struct graphics_priv;
-struct graphics_font_priv;
-struct graphics_image_priv;
-struct graphics_gc_priv;
-struct graphics_font_methods;
-struct graphics_gc_methods;
-struct graphics_image_methods;
-
-struct graphics_methods {
- void (*graphics_destroy)(struct graphics_priv *gr);
- void (*draw_mode)(struct graphics_priv *gr, enum draw_mode_num mode);
- void (*draw_lines)(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count);
- void (*draw_polygon)(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count);
- void (*draw_rectangle)(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h);
- void (*draw_circle)(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r);
- void (*draw_text)(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy);
- void (*draw_image)(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img);
- void (*draw_image_warp)(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, int count, char *data);
- void (*draw_restore)(struct graphics_priv *gr, struct point *p, int w, int h);
- struct graphics_font_priv *(*font_new)(struct graphics_priv *gr, struct graphics_font_methods *meth, int size, int flags);
- struct graphics_gc_priv *(*gc_new)(struct graphics_priv *gr, struct graphics_gc_methods *meth);
- void (*background_gc)(struct graphics_priv *gr, struct graphics_gc_priv *gc);
- struct graphics_priv *(*overlay_new)(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h);
- struct graphics_image_priv *(*image_new)(struct graphics_priv *gr, struct graphics_image_methods *meth, char *path, int *w, int *h, struct point *hot);
- void *(*get_data)(struct graphics_priv *gr, char *type);
- void (*register_resize_callback)(struct graphics_priv *gr, void (*callback)(void *data, int w, int h), void *data);
- void (*register_button_callback)(struct graphics_priv *gr, void (*callback)(void *data, int pressed, int button, struct point *p), void *data);
- void (*register_motion_callback)(struct graphics_priv *gr, void (*callback)(void *data, struct point *p), void *data);
- void (*image_free)(struct graphics_priv *gr, struct graphics_image_priv *priv);
-};
-
-
-struct graphics_font_methods {
- void (*font_destroy)(struct graphics_font_priv *font);
-};
-
-struct graphics_font {
- struct graphics_font_priv *priv;
- struct graphics_font_methods meth;
-};
-
-struct graphics_gc_methods {
- void (*gc_destroy)(struct graphics_gc_priv *gc);
- void (*gc_set_linewidth)(struct graphics_gc_priv *gc, int width);
- void (*gc_set_dashes)(struct graphics_gc_priv *gc, int width, int offset, unsigned char dash_list[], int n);
- void (*gc_set_foreground)(struct graphics_gc_priv *gc, struct color *c);
- void (*gc_set_background)(struct graphics_gc_priv *gc, struct color *c);
-};
-
-struct graphics_gc {
- struct graphics_gc_priv *priv;
- struct graphics_gc_methods meth;
-};
-
-struct graphics_image_methods {
- void (*image_destroy)(struct graphics_image_priv *img);
-};
-
-struct graphics_image {
- struct graphics_image_priv *priv;
- struct graphics_image_methods meth;
- int width;
- int height;
- struct point hot;
-};
-
-/* prototypes */
-enum attr_type;
-enum draw_mode_num;
-struct attr;
-struct attr_iter;
-struct color;
-struct displayitem;
-struct displaylist;
-struct displaylist_handle;
-struct graphics;
-struct graphics_font;
-struct graphics_gc;
-struct graphics_image;
-struct item;
-struct layout;
-struct point;
-struct transformation;
-struct graphics *graphics_new(struct attr *parent, struct attr **attrs);
-int graphics_get_attr(struct graphics *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
-struct graphics *graphics_overlay_new(struct graphics *parent, struct point *p, int w, int h);
-void graphics_init(struct graphics *this_);
-void *graphics_get_data(struct graphics *this_, char *type);
-void graphics_register_resize_callback(struct graphics *this_, void (*callback)(void *data, int w, int h), void *data);
-void graphics_register_button_callback(struct graphics *this_, void (*callback)(void *data, int pressed, int button, struct point *p), void *data);
-void graphics_register_motion_callback(struct graphics *this_, void (*callback)(void *data, struct point *p), void *data);
-struct graphics_font *graphics_font_new(struct graphics *gra, int size, int flags);
-struct graphics_gc *graphics_gc_new(struct graphics *gra);
-void graphics_gc_destroy(struct graphics_gc *gc);
-void graphics_gc_set_foreground(struct graphics_gc *gc, struct color *c);
-void graphics_gc_set_background(struct graphics_gc *gc, struct color *c);
-void graphics_gc_set_linewidth(struct graphics_gc *gc, int width);
-void graphics_gc_set_dashes(struct graphics_gc *gc, int width, int offset, unsigned char dash_list[], int n);
-struct graphics_image *graphics_image_new(struct graphics *gra, char *path);
-void graphics_image_free(struct graphics *gra, struct graphics_image *img);
-void graphics_draw_restore(struct graphics *this_, struct point *p, int w, int h);
-void graphics_draw_mode(struct graphics *this_, enum draw_mode_num mode);
-void graphics_draw_lines(struct graphics *this_, struct graphics_gc *gc, struct point *p, int count);
-void graphics_draw_circle(struct graphics *this_, struct graphics_gc *gc, struct point *p, int r);
-void graphics_draw_rectangle(struct graphics *this_, struct graphics_gc *gc, struct point *p, int w, int h);
-void graphics_draw_text(struct graphics *this_, struct graphics_gc *gc1, struct graphics_gc *gc2, struct graphics_font *font, char *text, struct point *p, int dx, int dy);
-void graphics_draw_image(struct graphics *this_, struct graphics_gc *gc, struct point *p, struct graphics_image *img);
-void display_add(struct displaylist *displaylist, struct item *item, int count, struct point *pnt, char *label);
-int graphics_ready(struct graphics *this_);
-void graphics_displaylist_draw(struct graphics *gra, struct displaylist *displaylist, struct transformation *trans, struct layout *l);
-void graphics_displaylist_move(struct displaylist *displaylist, int dx, int dy);
-void graphics_draw(struct graphics *gra, struct displaylist *displaylist, GList *mapsets, struct transformation *trans, struct layout *l);
-struct displaylist_handle *graphics_displaylist_open(struct displaylist *displaylist);
-struct displayitem *graphics_displaylist_next(struct displaylist_handle *dlh);
-void graphics_displaylist_close(struct displaylist_handle *dlh);
-struct displaylist *graphics_displaylist_new(void);
-struct item *graphics_displayitem_get_item(struct displayitem *di);
-char *graphics_displayitem_get_label(struct displayitem *di);
-int graphics_displayitem_within_dist(struct displayitem *di, struct point *p, int dist);
-/* end of prototypes */
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/navit/graphics/Makefile.am b/navit/graphics/Makefile.am
deleted file mode 100644
index 450fb182..00000000
--- a/navit/graphics/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-SUBDIRS=null
-if GRAPHICS_GTK_DRAWING_AREA
- SUBDIRS+=gtk_drawing_area
-endif
-if GRAPHICS_OPENGL
- SUBDIRS+=opengl
-endif
-if USE_GRAPHICS_QT_QPAINTER
- SUBDIRS+=qt_qpainter
-endif
-SUBDIRS+=win32
diff --git a/navit/graphics/gtk_drawing_area/Makefile.am b/navit/graphics/gtk_drawing_area/Makefile.am
deleted file mode 100644
index ec6f642c..00000000
--- a/navit/graphics/gtk_drawing_area/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @GTK2_CFLAGS@ @FREETYPE2_CFLAGS@ @FONTCONFIG_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=graphics_gtk_drawing_area
-modulegraphics_LTLIBRARIES = libgraphics_gtk_drawing_area.la
-libgraphics_gtk_drawing_area_la_SOURCES = graphics_gtk_drawing_area.c
-libgraphics_gtk_drawing_area_la_LDFLAGS = @GTK2_LIBS@ @FREETYPE2_LIBS@ @FONTCONFIG_LIBS@ @IMLIB2_LIBS@
diff --git a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c
deleted file mode 100644
index 90d7ddd6..00000000
--- a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c
+++ /dev/null
@@ -1,916 +0,0 @@
-#define GDK_ENABLE_BROKEN
-#include "config.h"
-#include <gtk/gtk.h>
-#include <fontconfig/fontconfig.h>
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#ifdef HAVE_IMLIB2
-#include <Imlib2.h>
-#endif
-
-#ifndef _WIN32
-#include <gdk/gdkx.h>
-#endif
-#include "debug.h"
-#include "point.h"
-#include "graphics.h"
-#include "color.h"
-#include "plugin.h"
-
-struct graphics_priv {
- GdkEventButton button_event;
- int button_timeout;
- GtkWidget *widget;
- GtkWidget *win;
- GdkDrawable *drawable;
- GdkDrawable *background;
- int background_ready;
- GdkColormap *colormap;
- FT_Library library;
- struct point p;
- int width;
- int height;
- int library_init;
- int visible;
- struct graphics_priv *parent;
- struct graphics_priv *overlays;
- struct graphics_priv *next;
- struct graphics_gc_priv *background_gc;
- enum draw_mode_num mode;
- void (*resize_callback)(void *data, int w, int h);
- void *resize_callback_data;
- void (*motion_callback)(void *data, struct point *p);
- void *motion_callback_data;
- void (*button_callback)(void *data, int press, int button, struct point *p);
- void *button_callback_data;
-};
-
-struct graphics_font_priv {
- FT_Face face;
-};
-
-struct graphics_gc_priv {
- GdkGC *gc;
- struct graphics_priv *gr;
-};
-
-struct graphics_image_priv {
- GdkPixbuf *pixbuf;
- int w;
- int h;
-};
-
-static void
-graphics_destroy(struct graphics_priv *gr)
-{
- FcFini();
-}
-
-/**
- * List of font families to use, in order of preference
- */
-static char *fontfamilies[]={
- "Liberation Mono",
- "Arial",
- "DejaVu Sans",
- "NcrBI4nh",
- "luximbi",
- "FreeSans",
- NULL,
-};
-
-static void font_destroy(struct graphics_font_priv *font)
-{
- g_free(font);
- /* TODO: free font->face */
-}
-
-static struct graphics_font_methods font_methods = {
- font_destroy
-};
-
-/**
- * Load a new font using the fontconfig library.
- * First search for each of the font families and require and exact match on family
- * If no font found, let fontconfig pick the best match
- */
-static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, int size, int flags)
-{
- struct graphics_font_priv *font=g_new(struct graphics_font_priv, 1);
-
- *meth=font_methods;
- int exact, found;
- char **family;
-
- if (!gr->library_init) {
- FT_Init_FreeType( &gr->library );
- gr->library_init=1;
- }
- found=0;
- for (exact=1;!found && exact>=0;exact--) {
- family=fontfamilies;
- while (*family && !found) {
- dbg(1, "Looking for font family %s. exact=%d\n", *family, exact);
- FcPattern *required = FcPatternBuild(NULL, FC_FAMILY, FcTypeString, *family, NULL);
- if (flags)
- FcPatternAddInteger(required,FC_WEIGHT,FC_WEIGHT_BOLD);
- FcConfigSubstitute(FcConfigGetCurrent(), required, FcMatchFont);
- FcDefaultSubstitute(required);
- FcResult result;
- FcPattern *matched = FcFontMatch(FcConfigGetCurrent(), required, &result);
- if (matched) {
- FcValue v1, v2;
- FcChar8 *fontfile;
- int fontindex;
- FcPatternGet(required, FC_FAMILY, 0, &v1);
- FcPatternGet(matched, FC_FAMILY, 0, &v2);
- FcResult r1 = FcPatternGetString(matched, FC_FILE, 0, &fontfile);
- FcResult r2 = FcPatternGetInteger(matched, FC_INDEX, 0, &fontindex);
- if ((r1 == FcResultMatch) && (r2 == FcResultMatch) && (FcValueEqual(v1,v2) || !exact)) {
- dbg(2, "About to load font from file %s index %d\n", fontfile, fontindex);
- FT_New_Face( gr->library, (char *)fontfile, fontindex, &font->face );
- found=1;
- }
- FcPatternDestroy(matched);
- }
- FcPatternDestroy(required);
- family++;
- }
- }
- if (!found) {
- g_warning("Failed to load font, no labelling");
- g_free(font);
- return NULL;
- }
- FT_Set_Char_Size(font->face, 0, size, 300, 300);
- FT_Select_Charmap(font->face, FT_ENCODING_UNICODE);
- return font;
-}
-
-static void
-gc_destroy(struct graphics_gc_priv *gc)
-{
- g_object_unref(gc->gc);
- g_free(gc);
-}
-
-static void
-gc_set_linewidth(struct graphics_gc_priv *gc, int w)
-{
- gdk_gc_set_line_attributes(gc->gc, w, GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_ROUND);
-}
-
-static void
-gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n)
-{
- gdk_gc_set_dashes(gc->gc, offset, (gint8 *)dash_list, n);
- gdk_gc_set_line_attributes(gc->gc, w, GDK_LINE_ON_OFF_DASH, GDK_CAP_ROUND, GDK_JOIN_ROUND);
-}
-
-static void
-gc_set_color(struct graphics_gc_priv *gc, struct color *c, int fg)
-{
- GdkColor gdkc;
- gdkc.pixel=0;
- gdkc.red=c->r;
- gdkc.green=c->g;
- gdkc.blue=c->b;
- gdk_colormap_alloc_color(gc->gr->colormap, &gdkc, FALSE, TRUE);
- if (fg)
- gdk_gc_set_foreground(gc->gc, &gdkc);
- else
- gdk_gc_set_background(gc->gc, &gdkc);
-}
-
-static void
-gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
-{
- gc_set_color(gc, c, 1);
-}
-
-static void
-gc_set_background(struct graphics_gc_priv *gc, struct color *c)
-{
- gc_set_color(gc, c, 0);
-}
-
-static struct graphics_gc_methods gc_methods = {
- gc_destroy,
- gc_set_linewidth,
- gc_set_dashes,
- gc_set_foreground,
- gc_set_background
-};
-
-static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth)
-{
- struct graphics_gc_priv *gc=g_new(struct graphics_gc_priv, 1);
-
- *meth=gc_methods;
- gc->gc=gdk_gc_new(gr->widget->window);
- gc->gr=gr;
- return gc;
-}
-
-
-static struct graphics_image_priv *
-image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h, struct point *hot)
-{
- GdkPixbuf *pixbuf;
- struct graphics_image_priv *ret;
- const char *option;
-
- pixbuf=gdk_pixbuf_new_from_file(name, NULL);
- if (! pixbuf)
- return NULL;
- ret=g_new0(struct graphics_image_priv, 1);
- ret->pixbuf=pixbuf;
- ret->w=gdk_pixbuf_get_width(pixbuf);
- ret->h=gdk_pixbuf_get_height(pixbuf);
- *w=ret->w;
- *h=ret->h;
- if (hot) {
- option=gdk_pixbuf_get_option(pixbuf, "x_hot");
- if (option)
- hot->x=atoi(option);
- else
- hot->x=ret->w/2-1;
- option=gdk_pixbuf_get_option(pixbuf, "y_hot");
- if (option)
- hot->y=atoi(option);
- else
- hot->y=ret->h/2-1;
- }
- return ret;
-}
-
-static void
-image_free(struct graphics_priv *gr, struct graphics_image_priv *priv)
-{
- if (priv->pixbuf)
- g_object_unref(priv->pixbuf);
- g_free(priv);
-}
-
-static void
-draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
-{
- if (gr->mode == draw_mode_begin || gr->mode == draw_mode_end)
- gdk_draw_lines(gr->drawable, gc->gc, (GdkPoint *)p, count);
- if (gr->mode == draw_mode_end || gr->mode == draw_mode_cursor)
- gdk_draw_lines(gr->widget->window, gc->gc, (GdkPoint *)p, count);
-}
-
-static void
-draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
-{
- if (gr->mode == draw_mode_begin || gr->mode == draw_mode_end)
- gdk_draw_polygon(gr->drawable, gc->gc, TRUE, (GdkPoint *)p, count);
- if (gr->mode == draw_mode_end || gr->mode == draw_mode_cursor)
- gdk_draw_polygon(gr->widget->window, gc->gc, TRUE, (GdkPoint *)p, count);
-}
-
-static void
-draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
-{
- gdk_draw_rectangle(gr->drawable, gc->gc, TRUE, p->x, p->y, w, h);
-}
-
-static void
-draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r)
-{
- if (gr->mode == draw_mode_begin || gr->mode == draw_mode_end)
- gdk_draw_arc(gr->drawable, gc->gc, FALSE, p->x-r/2, p->y-r/2, r, r, 0, 64*360);
- if (gr->mode == draw_mode_end || gr->mode == draw_mode_cursor)
- gdk_draw_arc(gr->widget->window, gc->gc, FALSE, p->x-r/2, p->y-r/2, r, r, 0, 64*360);
-}
-
-
-struct text_glyph {
- int x,y,w,h;
- GdkImage *shadow;
- unsigned char pixmap[0];
-};
-
-struct text_render {
- int x1,y1;
- int x2,y2;
- int x3,y3;
- int x4,y4;
- int glyph_count;
- struct text_glyph *glyph[0];
-};
-
-#ifndef _WIN32
-static GdkImage *
-display_text_render_shadow(struct text_glyph *g)
-{
- int mask0, mask1, mask2, x, y, w=g->w, h=g->h;
- int str=(g->w+9)/8;
- unsigned char *shadow;
- unsigned char *p, *pm=g->pixmap;
- GdkImage *ret;
-
- shadow=malloc(str*(g->h+2)); /* do not use g_malloc() here */
- memset(shadow, 0, str*(g->h+2));
- for (y = 0 ; y < h ; y++) {
- p=shadow+str*y;
- mask0=0x4000;
- mask1=0xe000;
- mask2=0x4000;
- for (x = 0 ; x < w ; x++) {
- if (pm[x+y*w]) {
- p[0]|=(mask0 >> 8);
- if (mask0 & 0xff)
- p[1]|=mask0;
-
- p[str]|=(mask1 >> 8);
- if (mask1 & 0xff)
- p[str+1]|=mask1;
- p[str*2]|=(mask2 >> 8);
- if (mask2 & 0xff)
- p[str*2+1]|=mask2;
- }
- mask0 >>= 1;
- mask1 >>= 1;
- mask2 >>= 1;
- if (!((mask0 >> 8) | (mask1 >> 8) | (mask2 >> 8))) {
- mask0<<=8;
- mask1<<=8;
- mask2<<=8;
- p++;
- }
- }
- }
- ret=gdk_image_new_bitmap(gdk_visual_get_system(), shadow, g->w+2, g->h+2);
- return ret;
-}
-#else
-static GdkImage *
-display_text_render_shadow(struct text_glyph *g)
-{
- int mask0, mask1, mask2, x, y, w=g->w, h=g->h;
- int str=(g->w+9)/8;
- unsigned char *p, *pm=g->pixmap;
- GdkImage *ret;
-
- ret=gdk_image_new( GDK_IMAGE_NORMAL , gdk_visual_get_system(), w+2, h+2);
-
- for (y = 0 ; y < h ; y++) {
- p=ret->mem+str*y;
-
- mask0=0x4000;
- mask1=0xe000;
- mask2=0x4000;
- for (x = 0 ; x < w ; x++) {
- if (pm[x+y*w]) {
- p[0]|=(mask0 >> 8);
- if (mask0 & 0xff)
- p[1]|=mask0;
-
- p[str]|=(mask1 >> 8);
- if (mask1 & 0xff)
- p[str+1]|=mask1;
- p[str*2]|=(mask2 >> 8);
- if (mask2 & 0xff)
- p[str*2+1]|=mask2;
- }
- mask0 >>= 1;
- mask1 >>= 1;
- mask2 >>= 1;
- if (!((mask0 >> 8) | (mask1 >> 8) | (mask2 >> 8))) {
- mask0<<=8;
- mask1<<=8;
- mask2<<=8;
- }
- }
- }
- return ret;
-}
-#endif
-
-static struct text_render *
-display_text_render(char *text, struct graphics_font_priv *font, int dx, int dy, int x, int y)
-{
- FT_GlyphSlot slot = font->face->glyph; // a small shortcut
- FT_Matrix matrix;
- FT_Vector pen;
- FT_UInt glyph_index;
- int n,len;
- struct text_render *ret;
- struct text_glyph *curr;
- char *p=text;
-
- len=g_utf8_strlen(text, -1);
- ret=g_malloc(sizeof(*ret)+len*sizeof(struct text_glyph *));
- ret->glyph_count=len;
-
- matrix.xx = dx;
- matrix.xy = dy;
- matrix.yx = -dy;
- matrix.yy = dx;
-
- pen.x = 0 * 64;
- pen.y = 0 * 64;
- x <<= 6;
- y <<= 6;
- FT_Set_Transform( font->face, &matrix, &pen );
-
- for ( n = 0; n < len; n++ )
- {
-
- glyph_index = FT_Get_Char_Index(font->face, g_utf8_get_char(p));
- FT_Load_Glyph(font->face, glyph_index, FT_LOAD_DEFAULT );
- FT_Render_Glyph(font->face->glyph, ft_render_mode_normal );
-
- curr=g_malloc(sizeof(*curr)+slot->bitmap.rows*slot->bitmap.pitch);
- ret->glyph[n]=curr;
-
- curr->x=(x>>6)+slot->bitmap_left;
- curr->y=(y>>6)-slot->bitmap_top;
- curr->w=slot->bitmap.width;
- curr->h=slot->bitmap.rows;
- if (slot->bitmap.width && slot->bitmap.rows) {
- memcpy(curr->pixmap, slot->bitmap.buffer, slot->bitmap.rows*slot->bitmap.pitch);
- curr->shadow=display_text_render_shadow(curr);
- }
- else
- curr->shadow=NULL;
-#if 0
- printf("height=%d\n", slot->metrics.height);
- printf("height2=%d\n", face->height);
- printf("bbox %d %d %d %d\n", face->bbox.xMin, face->bbox.yMin, face->bbox.xMax, face->bbox.yMax);
-#endif
- x += slot->advance.x;
- y -= slot->advance.y;
- p=g_utf8_next_char(p);
- }
- return ret;
-}
-
-static void
-display_text_draw(struct text_render *text, struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg)
-{
- int i;
- struct text_glyph *g, **gp;
-
- gp=text->glyph;
- i=text->glyph_count;
- while (i-- > 0)
- {
- g=*gp++;
- if (g->shadow && bg)
- gdk_draw_image(gr->drawable, bg->gc, g->shadow, 0, 0, g->x-1, g->y-1, g->w+2, g->h+2);
- }
- gp=text->glyph;
- i=text->glyph_count;
- while (i-- > 0)
- {
- g=*gp++;
- if (g->w && g->h)
- gdk_draw_gray_image(gr->drawable, fg->gc, g->x, g->y, g->w, g->h, GDK_RGB_DITHER_NONE, g->pixmap, g->w);
- }
-}
-
-static void
-display_text_free(struct text_render *text)
-{
- int i;
- struct text_glyph **gp;
-
- gp=text->glyph;
- i=text->glyph_count;
- while (i-- > 0) {
- if ((*gp)->shadow) {
- g_object_unref((*gp)->shadow);
- }
- g_free(*gp++);
- }
- g_free(text);
-}
-
-static void
-draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
-{
- struct text_render *t;
-
- if (! font)
- return;
- if (bg) {
- gdk_gc_set_function(fg->gc, GDK_AND_INVERT);
- gdk_gc_set_function(bg->gc, GDK_OR);
- }
-
- t=display_text_render(text, font, dx, dy, p->x, p->y);
- display_text_draw(t, gr, fg, bg);
- display_text_free(t);
- if (bg) {
- gdk_gc_set_function(fg->gc, GDK_COPY);
- gdk_gc_set_function(bg->gc, GDK_COPY);
- }
-}
-
-static void
-draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
-{
- gdk_draw_pixbuf(gr->drawable, fg->gc, img->pixbuf, 0, 0, p->x, p->y,
- img->w, img->h, GDK_RGB_DITHER_NONE, 0, 0);
-}
-
-#ifdef HAVE_IMLIB2
-static void
-draw_image_warp(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, int count, char *data)
-{
- void *image;
- int w,h;
- dbg(1,"draw_image_warp data=%s\n", data);
- image = imlib_load_image(data);
- imlib_context_set_display(gdk_x11_drawable_get_xdisplay(gr->widget->window));
- imlib_context_set_colormap(gdk_x11_colormap_get_xcolormap(gtk_widget_get_colormap(gr->widget)));
- imlib_context_set_visual(gdk_x11_visual_get_xvisual(gtk_widget_get_visual(gr->widget)));
- imlib_context_set_drawable(gdk_x11_drawable_get_xid(gr->drawable));
- imlib_context_set_image(image);
- w = imlib_image_get_width();
- h = imlib_image_get_height();
- if (count == 3) {
- /* 0 1
- 2 */
- imlib_render_image_on_drawable_skewed(0, 0, w, h, p[0].x, p[0].y, p[1].x-p[0].x, p[1].y-p[0].y, p[2].x-p[0].x, p[2].y-p[0].y);
- }
- if (count == 2) {
- /* 0
- 1 */
- imlib_render_image_on_drawable_skewed(0, 0, w, h, p[0].x, p[0].y, p[1].x-p[0].x, 0, 0, p[1].y-p[0].y);
- }
- if (count == 1) {
- /*
- 0
- */
- imlib_render_image_on_drawable_skewed(0, 0, w, h, p[0].x-w/2, p[0].y-h/2, w, 0, 0, h);
- }
-}
-#endif
-
-static void
-overlay_draw(struct graphics_priv *parent, struct graphics_priv *overlay, int window)
-{
- GdkPixbuf *pixbuf,*pixbuf2;
- GtkWidget *widget=parent->widget;
- guchar *pixels1, *pixels2, *p1, *p2;
- int x,y,w,h;
- int rowstride1,rowstride2;
- int n_channels1,n_channels2;
-
- if (! parent->drawable)
- return;
-
- w=overlay->width;
- if (w < 0)
- w+=parent->width;
- h=overlay->height;
- if (h < 0)
- h+=parent->height;
- pixbuf=gdk_pixbuf_get_from_drawable(NULL, overlay->drawable, NULL, 0, 0, 0, 0, w, h);
- pixbuf2=gdk_pixbuf_new(gdk_pixbuf_get_colorspace(pixbuf), TRUE, gdk_pixbuf_get_bits_per_sample(pixbuf),
- gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf));
-
- rowstride1 = gdk_pixbuf_get_rowstride (pixbuf);
- rowstride2 = gdk_pixbuf_get_rowstride (pixbuf2);
- pixels1=gdk_pixbuf_get_pixels (pixbuf);
- pixels2=gdk_pixbuf_get_pixels (pixbuf2);
- n_channels1 = gdk_pixbuf_get_n_channels (pixbuf);
- n_channels2 = gdk_pixbuf_get_n_channels (pixbuf2);
- for (y = 0 ; y < h ; y++) {
- for (x = 0 ; x < w ; x++) {
- p1 = pixels1 + y * rowstride1 + x * n_channels1;
- p2 = pixels2 + y * rowstride2 + x * n_channels2;
- p2[0]=p1[0];
- p2[1]=p1[1];
- p2[2]=p1[2];
- p2[3]=127;
- }
- }
- x=overlay->p.x;
- if (x < 0)
- x+=parent->width;
- y=overlay->p.y;
- if (y < 0)
- y+=parent->height;
- if (window) {
- if (overlay->background_ready)
- gdk_draw_drawable(parent->drawable, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], overlay->background, 0, 0, x, y, w, h);
- }
- else {
- gdk_draw_drawable(overlay->background, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], parent->drawable, x, y, 0, 0, w, h);
- overlay->background_ready=1;
- }
- gdk_draw_pixbuf(parent->drawable, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], pixbuf2, 0, 0, x, y, w, h, GDK_RGB_DITHER_NONE, 0, 0);
- if (window)
- gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], parent->drawable, x, y, x, y, w, h);
- g_object_unref(pixbuf);
- g_object_unref(pixbuf2);
-#if 0
- gdk_draw_drawable(gr->gra->drawable,
- gr->gra->widget->style->fg_gc[GTK_WIDGET_STATE(gr->gra->widget)],
- img->gra->drawable,
- 0, 0, p->x, p->y, img->gra->width, img->gra->height);
-#endif
-}
-
-static void
-draw_restore(struct graphics_priv *gr, struct point *p, int w, int h)
-{
- GtkWidget *widget=gr->widget;
- gdk_draw_drawable(widget->window,
- widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
- gr->drawable,
- p->x, p->y, p->x, p->y, w, h);
-
-}
-
-static void
-background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
-{
- gr->background_gc=gc;
-}
-
-static void
-draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
-{
- struct graphics_priv *overlay;
- GtkWidget *widget=gr->widget;
-
-#if 0
- if (mode == draw_mode_begin) {
- if (! gr->parent && gr->background_gc)
- gdk_draw_rectangle(gr->drawable, gr->background_gc->gc, TRUE, 0, 0, gr->width, gr->height);
- }
-#endif
- if (mode == draw_mode_end && gr->mode == draw_mode_begin) {
- if (gr->parent) {
- overlay_draw(gr->parent, gr, 1);
- } else {
- overlay=gr->overlays;
- while (overlay) {
- overlay_draw(gr, overlay, 0);
- overlay=overlay->next;
- }
- gdk_draw_drawable(widget->window,
- widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
- gr->drawable,
- 0, 0, 0, 0, gr->width, gr->height);
- }
- }
- gr->mode=mode;
-}
-
-/* Events */
-
-static gint
-configure(GtkWidget * widget, GdkEventConfigure * event, gpointer user_data)
-{
- struct graphics_priv *gra=user_data;
- if (! gra->visible)
- return TRUE;
- if (gra->drawable != NULL) {
- g_object_unref(gra->drawable);
- }
- gra->width=widget->allocation.width;
- gra->height=widget->allocation.height;
- gra->drawable = gdk_pixmap_new(widget->window, gra->width, gra->height, -1);
- if (gra->resize_callback)
- (*gra->resize_callback)(gra->resize_callback_data, gra->width, gra->height);
- return TRUE;
-}
-
-static gint
-expose(GtkWidget * widget, GdkEventExpose * event, gpointer user_data)
-{
- struct graphics_priv *gra=user_data;
-
- gra->visible=1;
- if (! gra->drawable)
- configure(widget, NULL, user_data);
- gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
- gra->drawable, event->area.x, event->area.y,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
-
- return FALSE;
-}
-
-#if 0
-static gint
-button_timeout(gpointer user_data)
-{
-#if 0
- struct container *co=user_data;
- int x=co->gra->gra->button_event.x;
- int y=co->gra->gra->button_event.y;
- int button=co->gra->gra->button_event.button;
-
- co->gra->gra->button_timeout=0;
- popup(co, x, y, button);
-
- return FALSE;
-#endif
-}
-#endif
-
-static gint
-button_press(GtkWidget * widget, GdkEventButton * event, gpointer user_data)
-{
- struct graphics_priv *this=user_data;
- struct point p;
-
- p.x=event->x;
- p.y=event->y;
- if (this->button_callback)
- (*this->button_callback)(this->button_callback_data, 1, event->button, &p);
- return FALSE;
-}
-
-static gint
-button_release(GtkWidget * widget, GdkEventButton * event, gpointer user_data)
-{
- struct graphics_priv *this=user_data;
- struct point p;
-
- p.x=event->x;
- p.y=event->y;
- if (this->button_callback)
- (*this->button_callback)(this->button_callback_data, 0, event->button, &p);
- return FALSE;
-}
-
-static gint
-scroll(GtkWidget * widget, GdkEventScroll * event, gpointer user_data)
-{
- struct graphics_priv *this=user_data;
- struct point p;
- int button;
-
- p.x=event->x;
- p.y=event->y;
- if (this->button_callback) {
- switch (event->direction) {
- case GDK_SCROLL_UP:
- button=4;
- break;
- case GDK_SCROLL_DOWN:
- button=5;
- break;
- default:
- button=-1;
- break;
- }
- if (button != -1) {
- (*this->button_callback)(this->button_callback_data, 1, button, &p);
- (*this->button_callback)(this->button_callback_data, 0, button, &p);
- }
- }
- return FALSE;
-}
-
-static gint
-motion_notify(GtkWidget * widget, GdkEventMotion * event, gpointer user_data)
-{
- struct graphics_priv *this=user_data;
- struct point p;
-
- p.x=event->x;
- p.y=event->y;
- if (this->motion_callback)
- (*this->motion_callback)(this->motion_callback_data, &p);
- return FALSE;
-}
-
-static struct graphics_priv *graphics_gtk_drawing_area_new_helper(struct graphics_methods *meth);
-
-static struct graphics_priv *
-overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h)
-{
- struct graphics_priv *this=graphics_gtk_drawing_area_new_helper(meth);
- this->drawable=gdk_pixmap_new(gr->widget->window, w, h, -1);
- this->colormap=gr->colormap;
- this->widget=gr->widget;
- this->p=*p;
- this->width=w;
- this->height=h;
- this->parent=gr;
- this->background=gdk_pixmap_new(gr->widget->window, w, h, -1);
- this->next=gr->overlays;
- gr->overlays=this;
- return this;
-}
-
-static int gtk_argc;
-static char **gtk_argv={NULL};
-
-
-static void *
-get_data(struct graphics_priv *this, char *type)
-{
- if (!strcmp(type,"gtk_widget"))
- return this->widget;
- if (!strcmp(type,"window")) {
- gtk_init(&gtk_argc, &gtk_argv);
- gtk_set_locale();
- this->win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_default_size(GTK_WINDOW(this->win), 792, 547);
- gtk_window_set_title(GTK_WINDOW(this->win), "Navit");
- gtk_widget_realize(this->win);
- gtk_container_add(GTK_CONTAINER(this->win), this->widget);
- gtk_widget_show_all(this->win);
- return this->win;
- }
- return NULL;
-}
-
-static void
-register_resize_callback(struct graphics_priv *this, void (*callback)(void *data, int w, int h), void *data)
-{
- this->resize_callback=callback;
- this->resize_callback_data=data;
-}
-
-static void
-register_motion_callback(struct graphics_priv *this, void (*callback)(void *data, struct point *p), void *data)
-{
- this->motion_callback=callback;
- this->motion_callback_data=data;
-}
-
-static void
-register_button_callback(struct graphics_priv *this, void (*callback)(void *data, int press, int button, struct point *p), void *data)
-{
- this->button_callback=callback;
- this->button_callback_data=data;
-}
-
-static struct graphics_methods graphics_methods = {
- graphics_destroy,
- draw_mode,
- draw_lines,
- draw_polygon,
- draw_rectangle,
- draw_circle,
- draw_text,
- draw_image,
-#ifdef HAVE_IMLIB2
- draw_image_warp,
-#else
- NULL,
-#endif
- draw_restore,
- font_new,
- gc_new,
- background_gc,
- overlay_new,
- image_new,
- get_data,
- register_resize_callback,
- register_button_callback,
- register_motion_callback,
- image_free,
-};
-
-static struct graphics_priv *
-graphics_gtk_drawing_area_new_helper(struct graphics_methods *meth)
-{
- struct graphics_priv *this=g_new0(struct graphics_priv,1);
- *meth=graphics_methods;
-
- return this;
-}
-
-static struct graphics_priv *
-graphics_gtk_drawing_area_new(struct graphics_methods *meth, struct attr **attrs)
-{
- GtkWidget *draw;
-
- draw=gtk_drawing_area_new();
- struct graphics_priv *this=graphics_gtk_drawing_area_new_helper(meth);
- this->widget=draw;
-
- this->colormap=gdk_colormap_new(gdk_visual_get_system(),FALSE);
- gtk_widget_set_events(draw, GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK|GDK_POINTER_MOTION_MASK|GDK_KEY_PRESS_MASK);
- g_signal_connect(G_OBJECT(draw), "expose_event", G_CALLBACK(expose), this);
- g_signal_connect(G_OBJECT(draw), "configure_event", G_CALLBACK(configure), this);
-#if 0
- g_signal_connect(G_OBJECT(draw), "realize_event", G_CALLBACK(realize), co);
-#endif
- g_signal_connect(G_OBJECT(draw), "button_press_event", G_CALLBACK(button_press), this);
- g_signal_connect(G_OBJECT(draw), "button_release_event", G_CALLBACK(button_release), this);
- g_signal_connect(G_OBJECT(draw), "scroll_event", G_CALLBACK(scroll), this);
- g_signal_connect(G_OBJECT(draw), "motion_notify_event", G_CALLBACK(motion_notify), this);
- if (FcInit() != FcTrue)
- dbg(0, "Failed to init fontconfig");
- return this;
-}
-
-void
-plugin_init(void)
-{
- plugin_register_graphics_type("gtk_drawing_area", graphics_gtk_drawing_area_new);
-}
diff --git a/navit/graphics/gtk_gl_ext/graphics_gtk_gl_ext.c b/navit/graphics/gtk_gl_ext/graphics_gtk_gl_ext.c
deleted file mode 100644
index c91e94c6..00000000
--- a/navit/graphics/gtk_gl_ext/graphics_gtk_gl_ext.c
+++ /dev/null
@@ -1,333 +0,0 @@
-#include <stdlib.h>
-#include <gtk/gtk.h>
-#include <gtk/gtkgl.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-#include "point.h"
-#include "graphics.h"
-#include "container.h"
-
-
-struct graphics_gra {
- GtkWidget *widget;
- int width;
- int height;
- int library_init;
- int visible;
- int buffer;
-};
-
-struct graphics_font {
-};
-
-struct graphics_gc {
- double fr,fg,fb;
- double br,bg,bb;
- double width;
- struct graphics_gra *gra;
-};
-
-static struct graphics_font *font_new(struct graphics *gr, int size)
-{
- struct graphics_font *font=g_new(struct graphics_font, 1);
- return font;
-}
-
-static struct graphics_gc *gc_new(struct graphics *gr)
-{
- struct graphics_gc *gc=g_new(struct graphics_gc, 1);
-
- gc->fr=1;
- gc->fg=1;
- gc->fb=1;
- gc->br=0;
- gc->bg=0;
- gc->bb=0;
- gc->width=1;
- gc->gra=gr->gra;
- return gc;
-}
-
-static void
-gc_set_linewidth(struct graphics_gc *gc, int w)
-{
- gc->width=w;
-}
-
-static void
-gc_set_foreground(struct graphics_gc *gc, int r, int g, int b)
-{
- gc->fr=r/65535.0;
- gc->fg=g/65535.0;
- gc->fb=b/65535.0;
-}
-
-static void
-gc_set_background(struct graphics_gc *gc, int r, int g, int b)
-{
- gc->br=r/65535.0;
- gc->bg=g/65535.0;
- gc->bb=b/65535.0;
-}
-
-static void
-vertex(struct point *p)
-{
- double x,y;
- x=p->x;
- y=p->y;
- x/=792;
- y/=469;
- x-=0.5;
- y=0.5-y;
- glVertex3f(x,y,0);
-}
-
-static void
-draw_lines(struct graphics *gr, struct graphics_gc *gc, struct point *p, int count)
-{
- int i;
-
- glLineWidth(gc->width);
- glColor3f(gc->fr, gc->fg, gc->fb);
- glBegin(GL_LINE_STRIP);
- for (i=0 ; i < count ; i++)
- vertex(p++);
- glEnd();
-}
-
-static void
-draw_polygon(struct graphics *gr, struct graphics_gc *gc, struct point *p, int count)
-{
- int i;
- double x,y;
- glColor3f(gc->fr, gc->fg, gc->fb);
- glBegin(GL_POLYGON);
- for (i=0 ; i < count ; i++)
- vertex(p++);
- glEnd();
-}
-
-
-static void
-draw_circle(struct graphics *gr, struct graphics_gc *gc, struct point *p, int r)
-{
-
-}
-
-static void
-draw_text(struct graphics *gr, struct graphics_gc *fg, struct graphics_gc *bg, struct graphics_font *font, unsigned char *text, int x, int y, int dx, int dy)
-{
-}
-
-static void
-draw_begin(struct graphics *gr)
-{
- printf("draw_begin\n");
- glClearColor(gr->gc[0]->br, gr->gc[0]->bg, gr->gc[0]->bb, 0);
- glNewList(1, GL_COMPILE);
- gr->gra->buffer=1;
-}
-
-static void
-draw_end(struct graphics *gr)
-{
- printf("draw_end\n");
- glEndList();
- gr->gra->buffer=0;
-}
-
-static void realize(GtkWidget * widget, gpointer data)
-{
- GdkGLContext *glcontext = gtk_widget_get_gl_context(widget);
- GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable(widget);
-
- GLUquadricObj *qobj;
- static GLfloat light_diffuse[] = { 1.0, 0.0, 0.0, 1.0 };
- static GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 };
-
- /*** OpenGL BEGIN ***/
- if (!gdk_gl_drawable_gl_begin(gldrawable, glcontext))
- return;
-
- qobj = gluNewQuadric();
- gluQuadricDrawStyle(qobj, GLU_FILL);
-#if 0
- glNewList(1, GL_COMPILE);
- gluSphere(qobj, 1.0, 20, 20);
- glBegin(GL_LINE_STRIP);
- glVertex3f(0.0,0.1,0.0);
- glVertex3f(0.1,0.1,0.0);
- glVertex3f(0.1,0.2,0.0);
- glVertex3f(0.2,0.2,0.0);
- glEnd();
- glEndList();
-#endif
-
-#if 0
- glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
- glLightfv(GL_LIGHT0, GL_POSITION, light_position);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_DEPTH_TEST);
-#endif
-
- glClearColor(1.0, 1.0, 1.0, 1.0);
- glClearDepth(1.0);
-
- glViewport(0, 0,
- widget->allocation.width, widget->allocation.height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(19.0, 1.0, 1.0, 10.0);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- gluLookAt(0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
- glTranslatef(0.0, 0.0, 0.0);
-
- gdk_gl_drawable_gl_end(gldrawable);
- /*** OpenGL END ***/
-}
-
-static gboolean
-configure(GtkWidget * widget, GdkEventConfigure * event, gpointer user_data)
-{
- GdkGLContext *glcontext = gtk_widget_get_gl_context(widget);
- GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable(widget);
- struct container *co=user_data;
- struct graphics_gra *gra=co->gra->gra;
-
-
- printf("configure %d %d\n",gra->width, gra->height);
- gra->width=widget->allocation.width;
- gra->height=widget->allocation.height;
-
- /*** OpenGL BEGIN ***/
- if (!gdk_gl_drawable_gl_begin(gldrawable, glcontext))
- return FALSE;
-
- glViewport(0, 0,
- widget->allocation.width, widget->allocation.height);
-
- gdk_gl_drawable_gl_end(gldrawable);
- /*** OpenGL END ***/
- if (gra->visible)
- graphics_resize(co, gra->width, gra->height);
-
- return TRUE;
-}
-
-static gboolean
-expose(GtkWidget * widget, GdkEventExpose * event, gpointer user_data)
-{
- GdkGLContext *glcontext = gtk_widget_get_gl_context(widget);
- GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable(widget);
- struct container *co=user_data;
- struct graphics_gra *gra=co->gra->gra;
-
- printf("expose\n");
- if (! gra->visible) {
- gra->visible=1;
- configure(widget, NULL, user_data);
- }
- /*** OpenGL BEGIN ***/
- if (!gdk_gl_drawable_gl_begin(gldrawable, glcontext))
- return FALSE;
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glCallList(1);
-
- if (gdk_gl_drawable_is_double_buffered(gldrawable))
- gdk_gl_drawable_swap_buffers(gldrawable);
- else
- glFlush();
-
- gdk_gl_drawable_gl_end(gldrawable);
- /*** OpenGL END ***/
-
- return TRUE;
-}
-
-
-struct graphics *
-graphics_gtk_gl_area_new(struct container *co, GtkWidget **widget)
-{
- GdkGLConfig *glconfig;
- gint major, minor;
- GtkWidget *drawing_area;
-
- struct graphics *this=g_new0(struct graphics,1);
- this->draw_lines=draw_lines;
- this->draw_polygon=draw_polygon;
- this->draw_circle=draw_circle;
- this->draw_text=draw_text;
-#if 0
- this->draw_begin=draw_begin;
- this->draw_end=draw_end;
-#endif
- this->gc_new=gc_new;
- this->gc_set_linewidth=gc_set_linewidth;
- this->gc_set_foreground=gc_set_foreground;
- this->gc_set_background=gc_set_background;
- this->font_new=font_new;
- this->gra=g_new0(struct graphics_gra, 1);
-
- /*
- * Init GtkGLExt.
- */
-
- gtk_gl_init(NULL, NULL);
-
- /*
- * Query OpenGL extension version.
- */
-
- gdk_gl_query_version(&major, &minor);
- g_print("OpenGL extension version - %d.%d\n", major, minor);
-
- /*
- * Configure OpenGL-capable visual.
- */
-
- /* Try double-buffered visual */
- glconfig = gdk_gl_config_new_by_mode(GDK_GL_MODE_RGB |
- GDK_GL_MODE_DEPTH |
- GDK_GL_MODE_DOUBLE);
- if (glconfig == NULL) {
- g_print("*** Cannot find the double-buffered visual.\n");
- g_print("*** Trying single-buffered visual.\n");
-
- /* Try single-buffered visual */
- glconfig = gdk_gl_config_new_by_mode(GDK_GL_MODE_RGB |
- GDK_GL_MODE_DEPTH);
- if (glconfig == NULL) {
- g_print
- ("*** No appropriate OpenGL-capable visual found.\n");
- exit(1);
- }
- }
-
-
- drawing_area = gtk_drawing_area_new();
-
- /* Set OpenGL-capability to the widget. */
- gtk_widget_set_gl_capability(drawing_area,
- glconfig,
- NULL, TRUE, GDK_GL_RGBA_TYPE);
-
- g_signal_connect_after(G_OBJECT(drawing_area), "realize",
- G_CALLBACK(realize), NULL);
- g_signal_connect(G_OBJECT(drawing_area), "configure_event",
- G_CALLBACK(configure), co);
- g_signal_connect(G_OBJECT(drawing_area), "expose_event",
- G_CALLBACK(expose), co);
-
- *widget=drawing_area;
- this->gra->widget=drawing_area;
- return this;
-}
-
-
diff --git a/navit/graphics/null/Makefile.am b/navit/graphics/null/Makefile.am
deleted file mode 100644
index 88c0e69a..00000000
--- a/navit/graphics/null/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=graphics_null
-modulegraphics_LTLIBRARIES = libgraphics_null.la
-libgraphics_null_la_SOURCES = graphics_null.c
diff --git a/navit/graphics/null/graphics_null.c b/navit/graphics/null/graphics_null.c
deleted file mode 100644
index 8b87e22c..00000000
--- a/navit/graphics/null/graphics_null.c
+++ /dev/null
@@ -1,208 +0,0 @@
-#include <glib.h>
-#include "config.h"
-#include "point.h"
-#include "graphics.h"
-#include "color.h"
-#include "plugin.h"
-
-static int dummy;
-static struct graphics_priv {
- int dummy;
-} graphics_priv;
-
-static struct graphics_font_priv {
- int dummy;
-} graphics_font_priv;
-
-static struct graphics_gc_priv {
- int dummy;
-} graphics_gc_priv;
-
-static struct graphics_image_priv {
- int dummy;
-} graphics_image_priv;
-
-static void
-graphics_destroy(struct graphics_priv *gr)
-{
-}
-
-static void font_destroy(struct graphics_font_priv *font)
-{
-
-}
-
-static struct graphics_font_methods font_methods = {
- font_destroy
-};
-
-static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, int size)
-{
- *meth=font_methods;
- return &graphics_font_priv;
-}
-
-static void
-gc_destroy(struct graphics_gc_priv *gc)
-{
-}
-
-static void
-gc_set_linewidth(struct graphics_gc_priv *gc, int w)
-{
-}
-
-static void
-gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n)
-{
-}
-
-static void
-gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
-{
-}
-
-static void
-gc_set_background(struct graphics_gc_priv *gc, struct color *c)
-{
-}
-
-static struct graphics_gc_methods gc_methods = {
- gc_destroy,
- gc_set_linewidth,
- gc_set_dashes,
- gc_set_foreground,
- gc_set_background
-};
-
-static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth)
-{
- *meth=gc_methods;
- return &graphics_gc_priv;
-}
-
-
-static struct graphics_image_priv *
-image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h)
-{
- return &graphics_image_priv;
-}
-
-static void
-draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
-{
-}
-
-static void
-draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
-{
-}
-
-static void
-draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
-{
-}
-
-static void
-draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r)
-{
-}
-
-
-static void
-draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
-{
-}
-
-static void
-draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
-{
-}
-
-static void
-draw_image_warp(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, int count, char *data)
-{
-}
-
-static void
-draw_restore(struct graphics_priv *gr, struct point *p, int w, int h)
-{
-}
-
-static void
-background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
-{
-}
-
-static void
-draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
-{
-}
-
-static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h);
-
-static void *
-get_data(struct graphics_priv *this, char *type)
-{
- return &dummy;
-}
-
-
-
-static void
-register_resize_callback(struct graphics_priv *this, void (*callback)(void *data, int w, int h), void *data)
-{
-}
-
-static void
-register_motion_callback(struct graphics_priv *this, void (*callback)(void *data, struct point *p), void *data)
-{
-}
-
-static void
-register_button_callback(struct graphics_priv *this, void (*callback)(void *data, int press, int button, struct point *p), void *data)
-{
-}
-
-static struct graphics_methods graphics_methods = {
- graphics_destroy,
- draw_mode,
- draw_lines,
- draw_polygon,
- draw_rectangle,
- draw_circle,
- draw_text,
- draw_image,
- draw_image_warp,
- draw_restore,
- font_new,
- gc_new,
- background_gc,
- overlay_new,
- image_new,
- get_data,
- register_resize_callback,
- register_button_callback,
- register_motion_callback,
-};
-
-static struct graphics_priv *
-overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h)
-{
- *meth=graphics_methods;
- return &graphics_priv;
-}
-
-
-static struct graphics_priv *
-graphics_null_new(struct graphics_methods *meth, struct attr **attrs)
-{
- *meth=graphics_methods;
- return &graphics_priv;
-}
-
-void
-plugin_init(void)
-{
- plugin_register_graphics_type("null", graphics_null_new);
-}
diff --git a/navit/graphics/opengl/Makefile.am b/navit/graphics/opengl/Makefile.am
deleted file mode 100644
index b0a25f38..00000000
--- a/navit/graphics/opengl/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ @OPENGL_CFLAGS@ @GLC_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=graphics_opengl
-modulegraphics_LTLIBRARIES = libgraphics_opengl.la
-libgraphics_opengl_la_SOURCES = graphics_opengl.c
-libgraphics_opengl_la_LIBADD = @OPENGL_LIBS@ @GLC_LIBS@
diff --git a/navit/graphics/opengl/graphics_opengl.c b/navit/graphics/opengl/graphics_opengl.c
deleted file mode 100644
index fce72f49..00000000
--- a/navit/graphics/opengl/graphics_opengl.c
+++ /dev/null
@@ -1,826 +0,0 @@
-#include <math.h>
-#include <glib.h>
-#include "config.h"
-#include <GL/glc.h>
-#include "point.h"
-#include "graphics.h"
-#include "color.h"
-#include "plugin.h"
-
-#include "debug.h"
-
-#include <GL/glut.h>
-
-
-void CALLBACK tessBeginCB(GLenum which);
-void CALLBACK tessEndCB();
-void CALLBACK tessErrorCB(GLenum errorCode);
-void CALLBACK tessVertexCB(const GLvoid *data);
-void CALLBACK tessVertexCB2(const GLvoid *data);
-void CALLBACK tessCombineCB(const GLdouble newVertex[3], const GLdouble *neighborVertex[4],
- const GLfloat neighborWeight[4], GLdouble **outData);
-
-
-struct graphics_priv {
- int button_timeout;
- struct point p;
- int width;
- int height;
- int library_init;
- int visible;
- struct graphics_priv *parent;
- struct graphics_priv *overlays;
- struct graphics_priv *next;
- struct graphics_gc_priv *background_gc;
- enum draw_mode_num mode;
- void (*resize_callback)(void *data, int w, int h);
- void *resize_callback_data;
- void (*motion_callback)(void *data, struct point *p);
- void *motion_callback_data;
- void (*button_callback)(void *data, int press, int button, struct point *p);
- void *button_callback_data;
- GLuint DLid;
-};
-
-struct graphics_font_priv {
-#if 0
- FT_Face face;
-#endif
-};
-
-struct graphics_gc_priv {
- struct graphics_priv *gr;
- float fr,fg,fb,fa;
- float br,bg,bb,ba;
- int linewidth;
-};
-
-struct graphics_image_priv {
- int w;
- int h;
-};
-
-static void
-graphics_destroy(struct graphics_priv *gr)
-{
-}
-
-int frame=0;
-
-// http://quesoglc.sourceforge.net/tutorial.php
-
-
-static void font_destroy(struct graphics_font_priv *font)
-{
- g_free(font);
- /* TODO: free font->face */
-}
-
-static struct graphics_font_methods font_methods = {
- font_destroy
-};
-
-static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, int size)
-{
-#if 0
- char **filename=fontlist;
- struct graphics_font_priv *font=g_new(struct graphics_font_priv, 1);
-
- *meth=font_methods;
-
- if (!gr->library_init) {
- FT_Init_FreeType( &gr->library );
- gr->library_init=1;
- }
-
- while (*filename) {
- if (!FT_New_Face( gr->library, *filename, 0, &font->face ))
- break;
- filename++;
- }
- if (! *filename) {
- g_warning("Failed to load font, no labelling");
- g_free(font);
- return NULL;
- }
- FT_Set_Char_Size(font->face, 0, size, 300, 300);
- FT_Select_Charmap(font->face, FT_ENCODING_UNICODE);
- return font;
-#endif
- return NULL;
-}
-
-static void
-gc_destroy(struct graphics_gc_priv *gc)
-{
- g_free(gc);
-}
-
-static void
-gc_set_linewidth(struct graphics_gc_priv *gc, int w)
-{
- gc->linewidth=w;
-}
-
-static void
-gc_set_dashes(struct graphics_gc_priv *gc, int width, int offset, unsigned char *dash_list, int n)
-{
-#if 0
- gdk_gc_set_dashes(gc->gc, offset, (gint8 *)dash_list, n);
- gdk_gc_set_line_attributes(gc->gc, width, GDK_LINE_ON_OFF_DASH, GDK_CAP_ROUND, GDK_JOIN_ROUND);
-#endif
-}
-
-
-static void
-gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
-{
- gc->fr=c->r/65535.0;
- gc->fg=c->g/65535.0;
- gc->fb=c->b/65535.0;
- gc->fa=c->a/65535.0;
-// printf("new alpha : %i\n",c->a);
-}
-
-static void
-gc_set_background(struct graphics_gc_priv *gc, struct color *c)
-{
- gc->br=c->r/65535.0;
- gc->bg=c->g/65535.0;
- gc->bb=c->b/65535.0;
- gc->ba=c->a/65535.0;
-}
-
-static struct graphics_gc_methods gc_methods = {
- gc_destroy,
- gc_set_linewidth,
- gc_set_dashes,
- gc_set_foreground,
- gc_set_background
-};
-
-static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth)
-{
- struct graphics_gc_priv *gc=g_new(struct graphics_gc_priv, 1);
-
- *meth=gc_methods;
- gc->gr=gr;
- gc->linewidth=1;
- return gc;
-}
-
-
-static struct graphics_image_priv *
-image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h)
-{
-#if 0
- GdkPixbuf *pixbuf;
- struct graphics_image_priv *ret;
-
- pixbuf=gdk_pixbuf_new_from_file(name, NULL);
- if (! pixbuf)
- return NULL;
- ret=g_new0(struct graphics_image_priv, 1);
- ret->pixbuf=pixbuf;
- ret->w=gdk_pixbuf_get_width(pixbuf);
- ret->h=gdk_pixbuf_get_height(pixbuf);
- *w=ret->w;
- *h=ret->h;
- return ret;
-#endif
- return NULL;
-}
-
-static void
-draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
-{
- int i;
-/*
- if (gr->mode == draw_mode_begin || gr->mode == draw_mode_end)
- gdk_draw_lines(gr->drawable, gc->gc, (GdkPoint *)p, count);
- if (gr->mode == draw_mode_end || gr->mode == draw_mode_cursor)
- gdk_draw_lines(gr->widget->window, gc->gc, (GdkPoint *)p, count);
-*/
- /*
- if(gr->mode == draw_mode_begin){
- printf("B");
- } else if (gr->mode == draw_mode_end){
- printf("E");
- } else {
- printf("x");
- }
-*/
-
- for (i = 0 ; i < count-1 ; i++) {
-
-// glEnable( GL_POLYGON_SMOOTH );
-// glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
-// glEnable( GL_BLEND );
-
- float dx=p[i+1].x-p[i].x;
- float dy=p[i+1].y-p[i].y;
-
- float cx=(p[i+1].x+p[i].x)/2;
- float cy=(p[i+1].y+p[i].y)/2;
-// printf("(%lx,%lx) -> (%lx,%lx) : (%lx,%lx)\n",p[i].x,p[i].y,p[i+1].x,p[i+1].y,dx,dy);
-
- int w=round(sqrt(pow((dx),2)+pow((dy),2)));
-
- float angle=atan (dy/dx) * 180 / M_PI;
-
- glPushMatrix();
- glTranslatef(cx,cy,1);
- // glColor4f( 0,0,0,1);
- // glRasterPos2f( 1,1 );
- glRotatef(angle,0.0,0.0,1.0);
-
- glColor4f( gc->fr, gc->fg, gc->fb, gc->fa);
-
- int linewidth=gc->linewidth;
-
- glBegin( GL_POLYGON );
- glVertex2f( -w/2,-linewidth/2 );
- glVertex2f( -w/2-4,0 );
- glVertex2f( -w/2,+linewidth/2 );
- glVertex2f( +w/2,+linewidth/2 );
- glVertex2f( +w/2+4,0 );
- glVertex2f( +w/2,-linewidth/2 );
- glVertex2f( -w/2,+linewidth/2 );
- glEnd();
-
-
- // FIXME Roads label can maybe be drawn here, avoid the display_label loop, when playing with Z axis position.
- /*
- if(attr==1){
- glcRenderStyle(GLC_TEXTURE);
- glColor3f(0., 0., 0.);
- glScalef(12, 12, 0.);
- glcRenderString(">>");
- } else if(attr==-1){
- glcRenderStyle(GLC_TEXTURE);
- glColor3f(0., 0., 0.);
- glScalef(12, 12, 0.);
- glcRenderString("<<");
- }
-
- */
- glPopMatrix();
- }
-// glDisable( GL_BLEND );
-// glDisable( GL_POLYGON_SMOOTH );
-
-/*
- if(label){
- if((strlen(label)*6)<w){
- SDL_print(label,cx, cy,-angle);
- }
- }
-*/
-}
-
-
-const char* getPrimitiveType(GLenum type)
-{
- switch(type)
- {
- case 0x0000:
- return "GL_POINTS";
- break;
- case 0x0001:
- return "GL_LINES";
- break;
- case 0x0002:
- return "GL_LINE_LOOP";
- break;
- case 0x0003:
- return "GL_LINE_STRIP";
- break;
- case 0x0004:
- return "GL_TRIANGLES";
- break;
- case 0x0005:
- return "GL_TRIANGLE_STRIP";
- break;
- case 0x0006:
- return "GL_TRIANGLE_FAN";
- break;
- case 0x0007:
- return "GL_QUADS";
- break;
- case 0x0008:
- return "GL_QUAD_STRIP";
- break;
- case 0x0009:
- return "GL_POLYGON";
- break;
- }
-}
-
-void CALLBACK tessBeginCB(GLenum which)
-{
- glBegin(which);
-
- dbg(1,"glBegin( %s );\n",getPrimitiveType(which));
-}
-
-
-
-void CALLBACK tessEndCB()
-{
- glEnd();
-
- dbg(1,"glEnd();\n");
-}
-
-
-
-void CALLBACK tessVertexCB(const GLvoid *data)
-{
- // cast back to double type
- const GLdouble *ptr = (const GLdouble*)data;
-
- glVertex3dv(ptr);
-
- dbg(1," glVertex3d();\n");
-}
-
-
-static void
-draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
-{
- int i;
-
- GLUtesselator *tess = gluNewTess(); // create a tessellator
- if(!tess) return 0; // failed to create tessellation object, return 0
-
- GLdouble quad1[count][3];
- for (i = 0 ; i < count ; i++) {
- quad1[i][0]=(GLdouble)(p[i].x);
- quad1[i][1]=(GLdouble)(p[i].y);
- quad1[i][2]=0;
- }
-
-
- // register callback functions
- gluTessCallback(tess, GLU_TESS_BEGIN, (void (*)(void))tessBeginCB);
- gluTessCallback(tess, GLU_TESS_END, (void (*)(void))tessEndCB);
- // gluTessCallback(tess, GLU_TESS_ERROR, (void (*)(void))tessErrorCB);
- gluTessCallback(tess, GLU_TESS_VERTEX, (void (*)(void))tessVertexCB);
-
- // tessellate and compile a concave quad into display list
- // gluTessVertex() takes 3 params: tess object, pointer to vertex coords,
- // and pointer to vertex data to be passed to vertex callback.
- // The second param is used only to perform tessellation, and the third
- // param is the actual vertex data to draw. It is usually same as the second
- // param, but It can be more than vertex coord, for example, color, normal
- // and UV coords which are needed for actual drawing.
- // Here, we are looking at only vertex coods, so the 2nd and 3rd params are
- // pointing same address.
- glColor4f( gc->fr, gc->fg, gc->fb, gc->fa);
- gluTessBeginPolygon(tess, 0); // with NULL data
- gluTessBeginContour(tess);
- for (i = 0 ; i < count ; i++) {
- gluTessVertex(tess, quad1[i], quad1[i]);
- }
- gluTessEndContour(tess);
- gluTessEndPolygon(tess);
-
- gluDeleteTess(tess); // delete after tessellation
-
-}
-
-static void
-draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
-{
-#if 0
- gdk_draw_rectangle(gr->drawable, gc->gc, TRUE, p->x, p->y, w, h);
-#endif
-}
-
-static void
-draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r)
-{
-#if 0
- if (gr->mode == draw_mode_begin || gr->mode == draw_mode_end)
- gdk_draw_arc(gr->drawable, gc->gc, FALSE, p->x-r/2, p->y-r/2, r, r, 0, 64*360);
- if (gr->mode == draw_mode_end || gr->mode == draw_mode_cursor)
- gdk_draw_arc(gr->widget->window, gc->gc, FALSE, p->x-r/2, p->y-r/2, r, r, 0, 64*360);
-#endif
-}
-
-
-
-void SDL_print(char * label,int x, int y, double angle)
-{
- glPushMatrix();
- glcRenderStyle(GLC_TEXTURE);
- glColor4f(0,0,0,1);
- glTranslatef(x, y, 1);
- glRotatef(180,1,0,0);
- glRotatef(angle,0,0,1);
-
- glScalef(14, 14, 14);
- // FIXME : add some error checking : glcGetError()
- glcRenderString(label);
- glPopMatrix();
-
-}
-
-static void
-draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
-{
-// dbg(0,"%s : %i,%i, %f\n",text,dx,dy,(180*atan2(dx,dy)/3.14));
- SDL_print(text,p->x,p->y,(180*atan2(dx,dy)/3.14)-90);
-}
-
-static void
-draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
-{
-#if 0
- gdk_draw_pixbuf(gr->drawable, fg->gc, img->pixbuf, 0, 0, p->x, p->y,
- img->w, img->h, GDK_RGB_DITHER_NONE, 0, 0);
-#endif
-}
-
-#ifdef HAVE_IMLIB2
-static void
-draw_image_warp(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, int count, char *data)
-{
-#if 0
- void *image;
- int w,h;
- printf("draw_image_warp data=%s\n", data);
- image = imlib_load_image(data);
- imlib_context_set_display(gdk_x11_drawable_get_xdisplay(gr->widget->window));
- imlib_context_set_colormap(gdk_x11_colormap_get_xcolormap(gtk_widget_get_colormap(gr->widget)));
- imlib_context_set_visual(gdk_x11_visual_get_xvisual(gtk_widget_get_visual(gr->widget)));
- imlib_context_set_drawable(gdk_x11_drawable_get_xid(gr->drawable));
- imlib_context_set_image(image);
- w = imlib_image_get_width();
- h = imlib_image_get_height();
- if (count == 3) {
- imlib_render_image_on_drawable_skewed(0, 0, w, h, p[0].x, p[0].y, p[1].x-p[0].x, p[1].y-p[0].y, p[2].x-p[0].x, p[2].y-p[0].y);
- }
- if (count == 2) {
- imlib_render_image_on_drawable_skewed(0, 0, w, h, p[0].x, p[0].y, p[1].x-p[0].x, 0, 0, p[1].y-p[0].y);
- }
-#endif
-}
-#endif
-
-static void
-overlay_draw(struct graphics_priv *parent, struct graphics_priv *overlay, int window)
-{
-#if 0
- GdkPixbuf *pixbuf,*pixbuf2;
- GtkWidget *widget=parent->widget;
- guchar *pixels1, *pixels2, *p1, *p2;
- int x,y;
- int rowstride1,rowstride2;
- int n_channels1,n_channels2;
-
- if (! parent->drawable)
- return;
-
- pixbuf=gdk_pixbuf_get_from_drawable(NULL, overlay->drawable, NULL, 0, 0, 0, 0, overlay->width, overlay->height);
- pixbuf2=gdk_pixbuf_new(gdk_pixbuf_get_colorspace(pixbuf), TRUE, gdk_pixbuf_get_bits_per_sample(pixbuf),
- gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf));
-
- rowstride1 = gdk_pixbuf_get_rowstride (pixbuf);
- rowstride2 = gdk_pixbuf_get_rowstride (pixbuf2);
- pixels1=gdk_pixbuf_get_pixels (pixbuf);
- pixels2=gdk_pixbuf_get_pixels (pixbuf2);
- n_channels1 = gdk_pixbuf_get_n_channels (pixbuf);
- n_channels2 = gdk_pixbuf_get_n_channels (pixbuf2);
- for (y = 0 ; y < overlay->height ; y++) {
- for (x = 0 ; x < overlay->width ; x++) {
- p1 = pixels1 + y * rowstride1 + x * n_channels1;
- p2 = pixels2 + y * rowstride2 + x * n_channels2;
- p2[0]=p1[0];
- p2[1]=p1[1];
- p2[2]=p1[2];
- p2[3]=127;
- }
- }
- if (window)
- gdk_draw_pixmap(parent->drawable, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], overlay->background, 0, 0, overlay->p.x, overlay->p.y, overlay->width, overlay->height);
- else
- gdk_draw_pixmap(overlay->background, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], parent->drawable, overlay->p.x, overlay->p.y, 0, 0, overlay->width, overlay->height);
- gdk_draw_pixbuf(parent->drawable, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], pixbuf2, 0, 0, overlay->p.x, overlay->p.y, overlay->width, overlay->height, GDK_RGB_DITHER_NONE, 0, 0);
- if (window)
- gdk_draw_pixmap(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], parent->drawable, overlay->p.x, overlay->p.y, overlay->p.x, overlay->p.y, overlay->width, overlay->height);
-#if 0
- gdk_draw_pixmap(gr->gra->drawable,
- gr->gra->widget->style->fg_gc[GTK_WIDGET_STATE(gr->gra->widget)],
- img->gra->drawable,
- 0, 0, p->x, p->y, img->gra->width, img->gra->height);
-#endif
-#endif
-}
-
-static void
-draw_restore(struct graphics_priv *gr, struct point *p, int w, int h)
-{
-#if 0
- GtkWidget *widget=gr->widget;
- gdk_draw_pixmap(widget->window,
- widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
- gr->drawable,
- p->x, p->y, p->x, p->y, w, h);
-#endif
-
-}
-
-static void
-background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
-{
- gr->background_gc=gc;
-}
-
-static void
-draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
-{
- if (gr->DLid) {
- if (mode == draw_mode_begin)
- glNewList(gr->DLid,GL_COMPILE);
- if (mode == draw_mode_end)
- glEndList();
- }
-
-#if 0
- struct graphics_priv *overlay;
- GtkWidget *widget=gr->widget;
-
- if (mode == draw_mode_begin) {
- if (! gr->parent && gr->background_gc)
- gdk_draw_rectangle(gr->drawable, gr->background_gc->gc, TRUE, 0, 0, gr->width, gr->height);
- }
- if (mode == draw_mode_end && gr->mode == draw_mode_begin) {
- if (gr->parent) {
- overlay_draw(gr->parent, gr, 1);
- } else {
- overlay=gr->overlays;
- while (overlay) {
- overlay_draw(gr, overlay, 0);
- overlay=overlay->next;
- }
- gdk_draw_pixmap(widget->window,
- widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
- gr->drawable,
- 0, 0, 0, 0, gr->width, gr->height);
- }
- }
- gr->mode=mode;
-#endif
-}
-
-#if 0
-/* Events */
-
-static gint
-configure(GtkWidget * widget, GdkEventConfigure * event, gpointer user_data)
-{
- struct graphics_priv *gra=user_data;
- if (! gra->visible)
- return TRUE;
- if (gra->drawable != NULL) {
- gdk_pixmap_unref(gra->drawable);
- }
- gra->width=widget->allocation.width;
- gra->height=widget->allocation.height;
- gra->drawable = gdk_pixmap_new(widget->window, gra->width, gra->height, -1);
- if (gra->resize_callback)
- (*gra->resize_callback)(gra->resize_callback_data, gra->width, gra->height);
- return TRUE;
-}
-
-static gint
-expose(GtkWidget * widget, GdkEventExpose * event, gpointer user_data)
-{
- struct graphics_priv *gra=user_data;
-
- gra->visible=1;
- if (! gra->drawable)
- configure(widget, NULL, user_data);
- gdk_draw_pixmap(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
- gra->drawable, event->area.x, event->area.y,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
-
- return FALSE;
-}
-
-#if 0
-static gint
-button_timeout(gpointer user_data)
-{
-#if 0
- struct container *co=user_data;
- int x=co->gra->gra->button_event.x;
- int y=co->gra->gra->button_event.y;
- int button=co->gra->gra->button_event.button;
-
- co->gra->gra->button_timeout=0;
- popup(co, x, y, button);
-
- return FALSE;
-#endif
-}
-#endif
-
-static gint
-button_press(GtkWidget * widget, GdkEventButton * event, gpointer user_data)
-{
- struct graphics_priv *this=user_data;
- struct point p;
-
- p.x=event->x;
- p.y=event->y;
- if (this->button_callback)
- (*this->button_callback)(this->button_callback_data, 1, event->button, &p);
- return FALSE;
-}
-
-static gint
-button_release(GtkWidget * widget, GdkEventButton * event, gpointer user_data)
-{
- struct graphics_priv *this=user_data;
- struct point p;
-
- p.x=event->x;
- p.y=event->y;
- if (this->button_callback)
- (*this->button_callback)(this->button_callback_data, 0, event->button, &p);
- return FALSE;
-}
-
-static gint
-scroll(GtkWidget * widget, GdkEventScroll * event, gpointer user_data)
-{
- struct graphics_priv *this=user_data;
- struct point p;
- int button;
-
- p.x=event->x;
- p.y=event->y;
- if (this->button_callback) {
- switch (event->direction) {
- case GDK_SCROLL_UP:
- button=4;
- break;
- case GDK_SCROLL_DOWN:
- button=5;
- break;
- default:
- button=-1;
- break;
- }
- if (button != -1) {
- (*this->button_callback)(this->button_callback_data, 1, button, &p);
- (*this->button_callback)(this->button_callback_data, 0, button, &p);
- }
- }
- return FALSE;
-}
-
-static gint
-motion_notify(GtkWidget * widget, GdkEventMotion * event, gpointer user_data)
-{
- struct graphics_priv *this=user_data;
- struct point p;
-
- p.x=event->x;
- p.y=event->y;
- if (this->motion_callback)
- (*this->motion_callback)(this->motion_callback_data, &p);
- return FALSE;
-}
-
-#endif
-
-
-static struct graphics_priv *
-overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h)
-{
-#if 0
- struct graphics_priv *this=graphics_gtk_drawing_area_new_helper(meth);
- this->drawable=gdk_pixmap_new(gr->widget->window, w, h, -1);
- this->colormap=gr->colormap;
- this->widget=gr->widget;
- this->p=*p;
- this->width=w;
- this->height=h;
- this->parent=gr;
- this->background=gdk_pixmap_new(gr->widget->window, w, h, -1);
- this->next=gr->overlays;
- gr->overlays=this;
- return this;
-#endif
- return NULL;
-}
-
-static void *
-get_data(struct graphics_priv *this, char *type)
-{
- if (strcmp(type,"opengl_displaylist"))
- return NULL;
-#if 0
- dbg(1,"Creating the DL from driver\n");
- this->DLid = glGenLists(1);
-#endif
- return &this->DLid;
-}
-
-static void
-register_resize_callback(struct graphics_priv *this, void (*callback)(void *data, int w, int h), void *data)
-{
- this->resize_callback=callback;
- this->resize_callback_data=data;
-}
-
-static void
-register_motion_callback(struct graphics_priv *this, void (*callback)(void *data, struct point *p), void *data)
-{
- this->motion_callback=callback;
- this->motion_callback_data=data;
-}
-
-static void
-register_button_callback(struct graphics_priv *this, void (*callback)(void *data, int press, int button, struct point *p), void *data)
-{
- this->button_callback=callback;
- this->button_callback_data=data;
-}
-
-static struct graphics_methods graphics_methods = {
- graphics_destroy,
- draw_mode,
- draw_lines,
- draw_polygon,
- draw_rectangle,
- draw_circle,
- draw_text,
- draw_image,
-#ifdef HAVE_IMLIB2
- draw_image_warp,
-#else
- NULL,
-#endif
- draw_restore,
- font_new,
- gc_new,
- background_gc,
- overlay_new,
- image_new,
- get_data,
- register_resize_callback,
- register_button_callback,
- register_motion_callback,
- NULL, // image_free
-};
-
-static struct graphics_priv *
-graphics_opengl_new(struct graphics_methods *meth, struct attr **attrs)
-{
- struct graphics_priv *this=g_new0(struct graphics_priv,1);
- *meth=graphics_methods;
-
-// GtkWidget *draw;
-
-// draw=gtk_drawnig_area_new();
-
-
- // Initialize the fonts
- int ctx = 0;
- int font = 0;
- ctx = glcGenContext();
- glcContext(ctx);
- font = glcNewFontFromFamily(glcGenFontID(), "Verdana");
- glcFont(font);
- glcStringType(GLC_UTF8_QSO);
-// glcFontFace(font, "Italic");
-
-
-/*
- this->widget=draw;
-
- this->colormap=gdk_colormap_new(gdk_visual_get_system(),FALSE);
- gtk_widget_set_events(draw, GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK|GDK_POINTER_MOTION_MASK|GDK_KEY_PRESS_MASK);
- g_signal_connect(G_OBJECT(draw), "expose_event", G_CALLBACK(expose), this);
- g_signal_connect(G_OBJECT(draw), "configure_event", G_CALLBACK(configure), this);
-#if 0
- g_signal_connect(G_OBJECT(draw), "realize_event", G_CALLBACK(realize), co);
-#endif
- g_signal_connect(G_OBJECT(draw), "button_press_event", G_CALLBACK(button_press), this);
- g_signal_connect(G_OBJECT(draw), "button_release_event", G_CALLBACK(button_release), this);
- g_signal_connect(G_OBJECT(draw), "scroll_event", G_CALLBACK(scroll), this);
- g_signal_connect(G_OBJECT(draw), "motion_notify_event", G_CALLBACK(motion_notify), this);
- */
- return this;
-}
-
-void
-plugin_init(void)
-{
- plugin_register_graphics_type("opengl", graphics_opengl_new);
-}
diff --git a/navit/graphics/qt_qpainter/Makefile.am b/navit/graphics/qt_qpainter/Makefile.am
deleted file mode 100644
index 4f353541..00000000
--- a/navit/graphics/qt_qpainter/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @QT_GUI_CFLAGS@ @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=graphics_qt_qpainter
-modulegraphics_LTLIBRARIES = libgraphics_qt_qpainter.la
-libgraphics_qt_qpainter_la_SOURCES = graphics_qt_qpainter.cpp
-libgraphics_qt_qpainter_la_LDFLAGS = @QT_GUI_LIBS@
diff --git a/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp b/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp
deleted file mode 100644
index c0f59bc2..00000000
--- a/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp
+++ /dev/null
@@ -1,682 +0,0 @@
-//##############################################################################################################
-//#
-//# File: graphics_qt_qpainter.cpp
-//# Description: Graphics interface for internal GUI using Qt (Trolltech.com)
-//# Comment:
-//# Authors: Martin Schaller (04/2008), Stefan Klumpp (04/2008)
-//#
-//##############################################################################################################
-
-
-#include <glib.h>
-#include "config.h"
-#include "point.h"
-#include "item.h"
-#include "graphics.h"
-#include "color.h"
-#include "debug.h"
-#include "plugin.h"
-
-#if 0
-#define QWS
-#define NO_DEBUG
-#endif
-
-#include <qglobal.h>
-
-#if QT_VERSION < 0x040000
-#include <qwidget.h>
-#include <qapplication.h>
-#include <qpainter.h>
-#include <qpen.h>
-#include <qbrush.h>
-#include <qimage.h>
-#include <qpixmap.h>
-#include <qlistview.h>
-#else
-#include <QApplication>
-#include <QGraphicsScene>
-#include <QGraphicsView>
-#include <QPainter>
-#include <QPen>
-#include <QBrush>
-#include <QPixmap>
-#include <QWidget>
-#include <QPolygonF>
-#include <QtGui>
-#endif
-
-//##############################################################################################################
-//# Description: RenderArea (QWidget) class for the main window (map, menu, ...)
-//# Comment:
-//# Authors: Martin Schaller (04/2008), Stefan Klumpp (04/2008)
-//##############################################################################################################
-class RenderArea : public QWidget
- {
- public:
- RenderArea(QWidget *parent = 0);
- QPixmap *pixmap;
- void (*resize_callback)(void *data, int w, int h);
- void *resize_callback_data;
- void (*motion_callback)(void *data, struct point *p);
- void *motion_callback_data;
- void (*button_callback)(void *data, int press, int button, struct point *p);
- void *button_callback_data; // struct navit *
-
-
- protected:
- QSize sizeHint() const;
- void paintEvent(QPaintEvent *event);
- void resizeEvent(QResizeEvent *event);
- void mouseEvent(int pressed, QMouseEvent *event);
- void mousePressEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void wheelEvent(QWheelEvent *event);
-
- };
-
-//##############################################################################################################
-//# Description: Constructor
-//# Comment: Using a QPixmap for rendering the graphics
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-RenderArea::RenderArea(QWidget *parent)
- : QWidget(parent)
-{
- pixmap = new QPixmap(800, 600);
-}
-
-//##############################################################################################################
-//# Description: QWidget:sizeHint
-//# Comment: This property holds the recommended size for the widget
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-QSize RenderArea::sizeHint() const
-{
- return QSize(800, 600);
-}
-
-//##############################################################################################################
-//# Description: QWidget:paintEvent
-//# Comment: A paint event is a request to repaint all or part of the widget.
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void RenderArea::paintEvent(QPaintEvent * event)
-{
- QPainter painter(this);
- painter.drawPixmap(0, 0, *pixmap);
-}
-
-
-//##############################################################################################################
-//# Description: QWidget::resizeEvent()
-//# Comment: When resizeEvent() is called, the widget already has its new geometry.
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void RenderArea::resizeEvent(QResizeEvent * event)
-{
- QSize size=event->size();
- delete pixmap;
- pixmap = new QPixmap(size);
- if (this->resize_callback)
- (this->resize_callback)(this->resize_callback_data, size.width(), size.height());
-}
-
-//##############################################################################################################
-//# Description: Method to handle mouse clicks
-//# Comment: Delegate of QWidget::mousePressEvent and QWidget::mouseReleaseEvent (see below)
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void RenderArea::mouseEvent(int pressed, QMouseEvent *event)
-{
- struct point p;
- if (!this->button_callback)
- return;
- p.x=event->x();
- p.y=event->y();
- switch (event->button()) {
- case Qt::LeftButton:
- (this->button_callback)(this->button_callback_data, pressed, 1, &p); // calls navit_button() in navit.c
- break;
- case Qt::MidButton:
- (this->button_callback)(this->button_callback_data, pressed, 2, &p);
- break;
- case Qt::RightButton:
- (this->button_callback)(this->button_callback_data, pressed, 3, &p);
- break;
- default:
- break;
- }
-}
-
-void RenderArea::mousePressEvent(QMouseEvent *event)
-{
- mouseEvent(1, event);
-}
-
-void RenderArea::mouseReleaseEvent(QMouseEvent *event)
-{
- mouseEvent(0, event);
-}
-
-//##############################################################################################################
-//# Description: QWidget::mouseMoveEvent
-//# Comment: If mouse tracking is switched on, mouse move events occur even if no mouse button is pressed.
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void RenderArea::mouseMoveEvent(QMouseEvent *event)
-{
- struct point p;
- if (!this->motion_callback)
- return;
- p.x=event->x();
- p.y=event->y();
- (this->motion_callback)(this->motion_callback_data, &p);
-}
-
-
-//##############################################################################################################
-//# Description: Qt Event :: Zoom in/out with the mouse's scrollwheel
-//# Comment:
-//# Authors: Stefan Klumpp (04/2008)
-//##############################################################################################################
-void RenderArea::wheelEvent(QWheelEvent *event)
-{
- struct point p;
- int button;
-
- if (!this->button_callback)
- return;
- p.x=event->x(); // xy-coordinates of the mouse pointer
- p.y=event->y();
-
- if (event->delta() > 0) // wheel movement away from the person
- button=4;
- else if (event->delta() < 0) // wheel movement towards the person
- button=5;
- else
- button=-1;
-
- if (button != -1) {
- (*this->button_callback)(this->button_callback_data, 1, button, &p);
- (*this->button_callback)(this->button_callback_data, 0, button, &p);
- }
-
- event->accept();
-}
-
-//##############################################################################################################
-// General comments:
-// -----------------
-// gr = graphics = draw area
-// gc = graphics context = pen to paint on the draw area
-//##############################################################################################################
-
-static int dummy;
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-struct graphics_priv {
- QApplication *app;
- RenderArea *widget;
- QPainter *painter;
- struct graphics_gc_priv *background_gc;
- enum draw_mode_num mode;
-};
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static struct graphics_font_priv {
- int dummy;
-} graphics_font_priv;
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static struct graphics_gc_priv {
- QPen *pen;
- QBrush *brush;
-} graphics_gc_priv;
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static struct graphics_image_priv {
- QImage *image;
-} graphics_image_priv;
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void graphics_destroy(struct graphics_priv *gr)
-{
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void font_destroy(struct graphics_font_priv *font)
-{
-
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static struct graphics_font_methods font_methods = {
- font_destroy
-};
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, int size, int flags)
-{
- *meth=font_methods;
- return &graphics_font_priv;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void gc_destroy(struct graphics_gc_priv *gc)
-{
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void gc_set_linewidth(struct graphics_gc_priv *gc, int w)
-{
- gc->pen->setWidth(w);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n)
-{
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
-{
-#if QT_VERSION >= 0x040000
- QColor col(c->r >> 8, c->g >> 8, c->b >> 8, c->a >> 8);
-#else
- QColor col(c->r >> 8, c->g >> 8, c->b >> 8);
-#endif
- gc->pen->setColor(col);
- gc->brush->setColor(col);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void gc_set_background(struct graphics_gc_priv *gc, struct color *c)
-{
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static struct graphics_gc_methods gc_methods = {
- gc_destroy,
- gc_set_linewidth,
- gc_set_dashes,
- gc_set_foreground,
- gc_set_background
-};
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth)
-{
- *meth=gc_methods;
- struct graphics_gc_priv *ret=g_new0(struct graphics_gc_priv, 1);
- ret->pen=new QPen();
- ret->brush=new QBrush(Qt::SolidPattern);
- return ret;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static struct graphics_image_priv * image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *path, int *w, int *h, struct point *hot)
-{
- struct graphics_image_priv *ret=g_new0(struct graphics_image_priv, 1);
-
- ret->image=new QImage(path);
- *w=ret->image->width();
- *h=ret->image->height();
- if (hot) {
- hot->x=*w/2;
- hot->y=*h/2;
- }
- return ret;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
-{
- int i;
-#if QT_VERSION >= 0x040000
- QPolygon polygon;
-#else
- QPointArray polygon;
-#endif
-
- for (i = 0 ; i < count ; i++)
- polygon.putPoints(i, 1, p[i].x, p[i].y);
- gr->painter->setPen(*gc->pen);
- gr->painter->drawPolyline(polygon);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
-{
- int i;
-#if QT_VERSION >= 0x040000
- QPolygon polygon;
-#else
- QPointArray polygon;
-#endif
-
- for (i = 0 ; i < count ; i++)
- polygon.putPoints(i, 1, p[i].x, p[i].y);
- gr->painter->setPen(*gc->pen);
- gr->painter->setBrush(*gc->brush);
- gr->painter->drawPolygon(polygon);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
-{
- gr->painter->fillRect(p->x,p->y, w, h, *gc->brush);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r)
-{
- gr->painter->setPen(*gc->pen);
- gr->painter->drawArc(p->x-r, p->y-r, r*2, r*2, 0, 360*16);
-
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
-{
- QString tmp = text;
- gr->painter->drawText(p->x, p->y, tmp);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
-{
- gr->painter->drawImage(p->x, p->y, *img->image);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void draw_image_warp(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, int count, char *data)
-{
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void draw_restore(struct graphics_priv *gr, struct point *p, int w, int h)
-{
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
-{
- gr->background_gc=gc;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
-{
- dbg(0,"mode=%d\n", mode);
- if (mode == draw_mode_begin) {
- gr->painter->begin(gr->widget->pixmap);
-#if 0
- gr->painter->fillRect(QRect(QPoint(0,0), gr->widget->size()), *gr->background_gc->brush);
-#endif
- }
-#if QT_VERSION < 0x040000
- if (mode == draw_mode_cursor) {
- gr->painter->begin(gr->widget);
- }
-#endif
- if (mode == draw_mode_end) {
- if (gr->mode == draw_mode_begin) {
- gr->painter->end();
- gr->widget->update();
- } else {
-#if QT_VERSION < 0x040000
- gr->painter->end();
-#endif
- }
- }
- gr->mode=mode;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h);
-
-static int argc=1;
-static char *argv[]={"navit",NULL};
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void * get_data(struct graphics_priv *this_, char *type)
-{
- if (strcmp(type, "window"))
- return NULL;
- this_->painter=new QPainter;
- this_->widget->show();
- return &dummy;
-}
-
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void register_resize_callback(struct graphics_priv *this_, void (*callback)(void *data, int w, int h), void *data)
-{
- this_->widget->resize_callback=callback;
- this_->widget->resize_callback_data=data;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void register_motion_callback(struct graphics_priv *this_, void (*callback)(void *data, struct point *p), void *data)
-{
- this_->widget->motion_callback=callback;
- this_->widget->motion_callback_data=data;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void register_button_callback(struct graphics_priv *this_, void (*callback)(void *data, int press, int button, struct point *p), void *data)
-{
- this_->widget->button_callback=callback;
- this_->widget->button_callback_data=data;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static struct graphics_methods graphics_methods = {
- graphics_destroy,
- draw_mode,
- draw_lines,
- draw_polygon,
- draw_rectangle,
- draw_circle,
- draw_text,
- draw_image,
- draw_image_warp,
- draw_restore,
- font_new,
- gc_new,
- background_gc,
- overlay_new,
- image_new,
- get_data,
- register_resize_callback,
- register_button_callback,
- register_motion_callback,
-};
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h)
-{
- *meth=graphics_methods;
- return NULL;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-#if QT_VERSION < 0x040000
-static gboolean graphics_qt_qpainter_idle(void *data)
-{
- struct graphics_priv *gr=(struct graphics_priv *)data;
- gr->app->processOneEvent();
- return TRUE;
-}
-#endif
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static struct graphics_priv * graphics_qt_qpainter_new(struct graphics_methods *meth, struct attr **attrs)
-{
- struct graphics_priv *ret=g_new0(struct graphics_priv, 1);
- *meth=graphics_methods;
- ret->app = new QApplication(argc, argv);
- ret->widget= new RenderArea();
-#if QT_VERSION < 0x040000
- g_idle_add(graphics_qt_qpainter_idle, ret);
-#endif
-
- return ret;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void plugin_init(void)
-{
- plugin_register_graphics_type("qt_qpainter", graphics_qt_qpainter_new);
-}
-
-
-
-
-// *** EOF ***
diff --git a/navit/graphics/win32/Makefile.am b/navit/graphics/win32/Makefile.am
deleted file mode 100644
index 56390a4e..00000000
--- a/navit/graphics/win32/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=graphics_win32
-modulegraphics_LTLIBRARIES = libgraphics_win32.la
-libgraphics_win32_la_SOURCES = graphics_win32.c xpm2bmp.c
diff --git a/navit/graphics/win32/graphics_win32.c b/navit/graphics/win32/graphics_win32.c
deleted file mode 100644
index dc878f13..00000000
--- a/navit/graphics/win32/graphics_win32.c
+++ /dev/null
@@ -1,794 +0,0 @@
-#include <windows.h>
-#include <wchar.h>
-#include <wingdi.h>
-#include <glib.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#if defined(__CEGCC__)
-#include <libintl.h>
-#endif
-#include "config.h"
-#include "debug.h"
-#include "point.h"
-#include "graphics.h"
-#include "color.h"
-#include "plugin.h"
-#include "win32_gui.h"
-#include "xpm2bmp.h"
-#include "util.h"
-
-#ifndef GET_WHEEL_DELTA_WPARAM
- #define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam))
-#endif
-
-
-static GHashTable *image_cache_hash = NULL;
-
-
-HFONT EzCreateFont (HDC hdc, TCHAR * szFaceName, int iDeciPtHeight,
- int iDeciPtWidth, int iAttributes, BOOL fLogRes) ;
-
-#define EZ_ATTR_BOLD 1
-#define EZ_ATTR_ITALIC 2
-#define EZ_ATTR_UNDERLINE 4
-#define EZ_ATTR_STRIKEOUT 8
-
-HFONT EzCreateFont (HDC hdc, TCHAR * szFaceName, int iDeciPtHeight,
- int iDeciPtWidth, int iAttributes, BOOL fLogRes)
-{
- FLOAT cxDpi, cyDpi ;
- HFONT hFont ;
- LOGFONT lf ;
- POINT pt ;
- TEXTMETRIC tm ;
-
- SaveDC (hdc) ;
-
-#if !defined(__CEGCC__)
- SetGraphicsMode (hdc, GM_ADVANCED) ;
- ModifyWorldTransform (hdc, NULL, MWT_IDENTITY) ;
-#endif
- SetViewportOrgEx (hdc, 0, 0, NULL) ;
-#if !defined(__CEGCC__)
- SetWindowOrgEx (hdc, 0, 0, NULL) ;
-#endif
- if (fLogRes)
- {
- cxDpi = (FLOAT) GetDeviceCaps (hdc, LOGPIXELSX) ;
- cyDpi = (FLOAT) GetDeviceCaps (hdc, LOGPIXELSY) ;
- }
- else
- {
- cxDpi = (FLOAT) (25.4 * GetDeviceCaps (hdc, HORZRES) /
- GetDeviceCaps (hdc, HORZSIZE)) ;
-
- cyDpi = (FLOAT) (25.4 * GetDeviceCaps (hdc, VERTRES) /
- GetDeviceCaps (hdc, VERTSIZE)) ;
- }
-
- pt.x = (int) (iDeciPtWidth * cxDpi / 72) ;
- pt.y = (int) (iDeciPtHeight * cyDpi / 72) ;
-
-#if !defined(__CEGCC__)
- DPtoLP (hdc, &pt, 1) ;
-#endif
- lf.lfHeight = - (int) (fabs (pt.y) / 10.0 + 0.5) ;
- lf.lfWidth = 0 ;
- lf.lfEscapement = 0 ;
- lf.lfOrientation = 0 ;
- lf.lfWeight = iAttributes & EZ_ATTR_BOLD ? 700 : 0 ;
- lf.lfItalic = iAttributes & EZ_ATTR_ITALIC ? 1 : 0 ;
- lf.lfUnderline = iAttributes & EZ_ATTR_UNDERLINE ? 1 : 0 ;
- lf.lfStrikeOut = iAttributes & EZ_ATTR_STRIKEOUT ? 1 : 0 ;
- lf.lfCharSet = DEFAULT_CHARSET ;
- lf.lfOutPrecision = 0 ;
- lf.lfClipPrecision = 0 ;
- lf.lfQuality = 0 ;
- lf.lfPitchAndFamily = 0 ;
-
- lstrcpy (lf.lfFaceName, szFaceName) ;
-
- hFont = CreateFontIndirect (&lf) ;
-
- if (iDeciPtWidth != 0)
- {
- hFont = (HFONT) SelectObject (hdc, hFont) ;
-
- GetTextMetrics (hdc, &tm) ;
-
- DeleteObject (SelectObject (hdc, hFont)) ;
-
- lf.lfWidth = (int) (tm.tmAveCharWidth *
- fabs (pt.x) / fabs (pt.y) + 0.5) ;
-
- hFont = CreateFontIndirect (&lf) ;
- }
-
- RestoreDC (hdc, -1) ;
- return hFont ;
-}
-
-struct graphics_image_priv {
- PXPM2BMP pxpm;
-};
-
-
-void ErrorExit(LPTSTR lpszFunction)
-{
- // Retrieve the system error message for the last-error code
-
- LPVOID lpMsgBuf;
- LPVOID lpDisplayBuf;
- DWORD dw = GetLastError();
-
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- dw,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &lpMsgBuf,
- 0, NULL );
-
- lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT,
- (lstrlen((LPCTSTR)lpMsgBuf)+lstrlen((LPCTSTR)lpszFunction)+40)*sizeof(TCHAR));
- stprintf ((LPTSTR)lpDisplayBuf, TEXT("%s failed with error %d: %s"), lpszFunction, (int)dw, (char *)lpMsgBuf);
-
- dbg( 0, "%s\n", (char *)lpDisplayBuf );
- MessageBox(NULL, (LPCTSTR)lpDisplayBuf, TEXT("Error"), MB_OK);
-
- LocalFree(lpMsgBuf);
- LocalFree(lpDisplayBuf);
- ExitProcess(dw);
-}
-
-
-
-struct graphics_gc_priv {
- HWND hwnd;
- int line_width;
- COLORREF fg_color;
- COLORREF bg_color;
- struct graphics_priv *gr;
-};
-
-
-//struct graphics_priv *g_gra;
-
-static HDC hMemDC;
-static HBITMAP hBitmap;
-static HBITMAP hOldBitmap;
-
-// Fills the region 'rgn' in graded colours
-static void MakeMemoryDC(HANDLE hWnd, HDC hdc )
-{
- if ( hMemDC )
- {
- if ( hOldBitmap )
- {
- SelectObject( hMemDC, hOldBitmap );
- DeleteObject( hBitmap );
- hBitmap = NULL;
- hOldBitmap = NULL;
- }
- }
-
- // Creates memory DC
- hMemDC = CreateCompatibleDC(hdc);
- if ( hMemDC )
- {
- RECT rectRgn;
- GetClientRect( hWnd, &rectRgn );
-
- int Width = rectRgn.right - rectRgn.left;
- int Height = rectRgn.bottom - rectRgn.top;
- dbg( 1, "resize memDC to: %d %d \n", Width, Height );
-
- hBitmap = CreateCompatibleBitmap(hdc, Width, Height );
-
- if ( hBitmap )
- {
- hOldBitmap = (HBITMAP) SelectObject( hMemDC, hBitmap);
- }
- }
-}
-
-static void HandleButtonClick( struct graphics_priv *gra_priv, int updown, int button, long lParam )
-{
- int xPos = LOWORD(lParam);
- int yPos = HIWORD(lParam);
-
- if (gra_priv->button_callback )
- {
- struct point pt = {xPos, yPos};
- (*gra_priv->button_callback)(gra_priv->button_callback_data, updown, button, &pt);
- }
-}
-
-static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
-{
-
-//if ( Message != 15 )
-//printf( "CHILD %d %d %d \n", Message, wParam, lParam );
-
- struct graphics_priv* gra_priv = (struct graphics_priv*)GetWindowLongPtr( hwnd , DWLP_USER );
-
- switch(Message)
- {
- case WM_CREATE:
- {
- HDC hdc;
- hdc = GetDC( hwnd );
- MakeMemoryDC(hwnd, hdc );
- ReleaseDC( hwnd, hdc );
- }
- break;
- case WM_COMMAND:
- switch(LOWORD(wParam))
- {
- case WM_USER + 1:
- break;
- }
- break;
- case WM_CLOSE:
- DestroyWindow(hwnd);
- break;
- case WM_USER+1:
- if ( gra_priv )
- {
- RECT rc ;
- HDC hdc;
-
- GetClientRect( hwnd, &rc );
- gra_priv->width = rc.right;
- gra_priv->height = rc.bottom;
-
- hdc = GetDC( hwnd );
- MakeMemoryDC(hwnd, hdc );
- ReleaseDC( hwnd, hdc );
- }
- break;
-
- case WM_SIZE:
- /*
- if ( gra_priv )
- {
- //graphics = GetWindowLong( hwnd, DWL_USER, 0 );
-
-
- {
- HDC hdc;
- hdc = GetDC( hwnd );
- MakeMemoryDC(hwnd, hdc );
- ReleaseDC( hwnd, hdc );
- }
- (*gra_priv->resize_callback)(gra_priv->resize_callback_data, gra_priv->width, gra_priv->height);
-
-
- }
- */
- if ( gra_priv )
- {
- gra_priv->width = LOWORD( lParam );
- gra_priv->height = HIWORD( lParam );
- (*gra_priv->resize_callback)(gra_priv->resize_callback_data, gra_priv->width, gra_priv->height);
- dbg( 1, "resize gfx to: %d %d \n", gra_priv->width, gra_priv->height );
- }
- break;
- case WM_DESTROY:
- PostQuitMessage(0);
- exit( 0 );
- break;
- case WM_PAINT:
- if ( gra_priv )
- {
- HDC hdc = GetDC(hwnd );
- if ( hMemDC )
- {
- BitBlt( hdc, 0, 0, gra_priv->width , gra_priv->height, hMemDC, 0, 0, SRCCOPY );
- }
- ReleaseDC( hwnd, hdc );
- }
- break;
- case WM_MOUSEMOVE:
- {
- int xPos = LOWORD(lParam);
- int yPos = HIWORD(lParam);
- struct point pt = {xPos, yPos};
-
- dbg( 2, "WM_MOUSEMOVE: %d %d \n", xPos, yPos );
- (*gra_priv->motion_callback)(gra_priv->motion_callback_data, &pt);
- }
-
- break;
-
- case WM_LBUTTONDOWN:
- HandleButtonClick( gra_priv,1, 1,lParam );
- break;
- case WM_LBUTTONUP:
- HandleButtonClick( gra_priv, 0, 1,lParam );
- break;
- case WM_RBUTTONDOWN:
- HandleButtonClick( gra_priv, 1, 3,lParam );
- break;
- case WM_RBUTTONUP:
- HandleButtonClick( gra_priv, 0, 3,lParam );
- break;
-
- default:
- return DefWindowProc(hwnd, Message, wParam, lParam);
- }
- return 0;
-}
-
-
-static const TCHAR g_szClassName[] = TEXT("NAVGRA");
-
-HANDLE CreateGraphicsWindows( struct graphics_priv* gr )
-{
- WNDCLASS wc;
- HWND hwnd;
- RECT rcParent;
-
-// wc.cbSize = sizeof(WNDCLASSEX);
- wc.style = 0;
- wc.lpfnWndProc = WndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 64;
- wc.hInstance = NULL;
- wc.hIcon = NULL;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = g_szClassName;
-// wc.hIconSm = NULL;
-
-
- GetClientRect( gr->wnd_parent_handle,&rcParent);
-
- if(!RegisterClass(&wc))
- {
- ErrorExit( TEXT("Window Registration Failed!") );
- return NULL;
- }
-
- gr->width = rcParent.right - rcParent.left;
- gr->height = rcParent.bottom - rcParent.top;
-#if defined(__CEGCC__)
- (*gr->resize_callback)(gr->resize_callback_data, gr->width, gr->height);
-#endif
- hwnd = CreateWindow( g_szClassName,
- TEXT(""),
- WS_CHILD ,
- 0,
- 0,
- gr->width,
- gr->height,
- gr->wnd_parent_handle,
- (HMENU)ID_CHILD_GFX,
- NULL,
- NULL);
-
- if(hwnd == NULL)
- {
- ErrorExit( TEXT("Window Creation Failed!") );
- return NULL;
- }
-
- SetWindowLongPtr( hwnd , DWLP_USER, (LONG_PTR)gr );
-
- ShowWindow( hwnd, TRUE );
- UpdateWindow( hwnd );
-
- gr->wnd_handle = hwnd;
-
- PostMessage( gr->wnd_parent_handle, WM_USER + 1, 0, 0 );
-
- return hwnd;
-}
-
-
-
-static void graphics_destroy(struct graphics_priv *gr)
-{
- g_free( gr );
-}
-
-
-static void gc_destroy(struct graphics_gc_priv *gc)
-{
- g_free( gc );
-}
-
-static void gc_set_linewidth(struct graphics_gc_priv *gc, int w)
-{
- gc->line_width = w;
-}
-
-static void gc_set_dashes(struct graphics_gc_priv *gc, int width, int offset, unsigned char dash_list[], int n)
-{
-// gdk_gc_set_dashes(gc->gc, 0, (gint8 *)dash_list, n);
-// gdk_gc_set_line_attributes(gc->gc, 1, GDK_LINE_ON_OFF_DASH, GDK_CAP_ROUND, GDK_JOIN_ROUND);
-}
-
-
-
-//static void gc_set_color(struct graphics_gc_priv *gc, struct color *c, int fg)
-//{
-//
-// gc->fg_color = RGB( c->r, c->g, c->b );
-//}
-
-static void gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
-{
- gc->fg_color = RGB( c->r, c->g, c->b );
-}
-
-static void gc_set_background(struct graphics_gc_priv *gc, struct color *c)
-{
- gc->bg_color = RGB( c->r, c->g, c->b );
- if ( hMemDC )
- SetBkColor( hMemDC, gc->bg_color );
-
-}
-
-static struct graphics_gc_methods gc_methods = {
- gc_destroy,
- gc_set_linewidth,
- gc_set_dashes,
- gc_set_foreground,
- gc_set_background
-};
-
-static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth)
-{
- struct graphics_gc_priv *gc=g_new(struct graphics_gc_priv, 1);
- *meth=gc_methods;
- gc->hwnd = gr->wnd_handle;
- gc->line_width = 1;
- gc->fg_color = RGB( 0,0,0 );
- gc->bg_color = RGB( 255,255,255 );
- return gc;
-}
-
-
-static void draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
-{
- int i;
- HPEN holdpen;
- HPEN hpen;
-
- hpen = CreatePen( PS_SOLID, gc->line_width, gc->fg_color );
- holdpen = SelectObject( hMemDC, hpen );
-
- SetBkColor( hMemDC, gc->bg_color );
-
- int first = 1;
- for ( i = 0; i< count; i++ )
- {
- if ( first )
- {
- first = 0;
- MoveToEx( hMemDC, p[0].x, p[0].y, NULL );
- }
- else
- {
- LineTo( hMemDC, p[i].x, p[i].y );
- }
- }
-
- SelectObject( hMemDC, holdpen );
- DeleteObject( hpen );
-}
-
-static void draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
-{
-
- //if (gr->mode == draw_mode_begin || gr->mode == draw_mode_end)
- {
- int i;
- POINT points[ count ];
- for ( i=0;i< count; i++ )
- {
- points[i].x = p[i].x;
- points[i].y = p[i].y;
- }
- HBRUSH holdbrush;
- HBRUSH hbrush;
-
- SetBkColor( hMemDC, gc->bg_color );
-
- hbrush = CreateSolidBrush( gc->fg_color );
- holdbrush = SelectObject( hMemDC, hbrush );
- Polygon( hMemDC, points,count );
- SelectObject( hMemDC, holdbrush );
- DeleteObject( hbrush );
- }
-}
-
-
-static void draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
-{
-// gdk_draw_rectangle(gr->drawable, gc->gc, TRUE, p->x, p->y, w, h);
-}
-
-static void draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r)
-{
- HDC dc = hMemDC;
-
- HPEN holdpen;
- HPEN hpen;
-
- hpen = CreatePen( PS_SOLID, gc->line_width, gc->fg_color );
- holdpen = SelectObject( dc, hpen );
-
- SetBkColor( hMemDC, gc->bg_color );
-
- Ellipse( dc, p->x - r, p->y -r, p->x + r, p->y + r );
-
- SelectObject( dc, holdpen );
- DeleteObject( hpen );
-
-// if (gr->mode == draw_mode_begin || gr->mode == draw_mode_end)
-// gdk_draw_arc(gr->drawable, gc->gc, FALSE, p->x-r/2, p->y-r/2, r, r, 0, 64*360);
-// if (gr->mode == draw_mode_end || gr->mode == draw_mode_cursor)
-// gdk_draw_arc(gr->widget->window, gc->gc, FALSE, p->x-r/2, p->y-r/2, r, r, 0, 64*360);
-}
-
-
-
-static void draw_restore(struct graphics_priv *gr, struct point *p, int w, int h)
-{
- InvalidateRect( gr->wnd_handle, NULL, FALSE );
-}
-
-static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
-{
- dbg( 1, "set draw_mode to %d\n", (int)mode );
-
- if ( mode == draw_mode_begin )
- {
- if ( gr->wnd_handle == NULL )
- {
- CreateGraphicsWindows( gr );
- }
- if ( gr->mode != draw_mode_begin )
- {
- if ( hMemDC )
- {
- RECT rcClient;
- HBRUSH bgBrush = CreateSolidBrush( gr->bg_color );
- GetClientRect( gr->wnd_handle, &rcClient );
- FillRect( hMemDC, &rcClient, bgBrush );
- DeleteObject( bgBrush );
- }
- }
- }
-
- // force paint
- if (mode == draw_mode_end && gr->mode == draw_mode_begin)
- {
- InvalidateRect( gr->wnd_handle, NULL, FALSE );
- }
-
- gr->mode=mode;
-
-}
-
-
-static void * get_data(struct graphics_priv *this_, char *type)
-{
- if ( strcmp( "wnd_parent_handle_ptr", type ) == 0 )
- {
- return &( this_->wnd_parent_handle );
- }
- if ( strcmp( "START_CLIENT", type ) == 0 )
- {
- CreateGraphicsWindows( this_ );
- return NULL;
- }
- return NULL;
-}
-
-
-static void register_resize_callback(struct graphics_priv *this_, void (*callback)(void *data, int w, int h), void *data)
-{
- this_->resize_callback=callback;
- this_->resize_callback_data=data;
-}
-
-static void register_motion_callback(struct graphics_priv *this_, void (*callback)(void *data, struct point *p), void *data)
-{
- this_->motion_callback=callback;
- this_->motion_callback_data=data;
-}
-
-static void register_button_callback(struct graphics_priv *this_, void (*callback)(void *data, int press, int button, struct point *p), void *data)
-{
- this_->button_callback=callback;
- this_->button_callback_data=data;
-}
-
-static void background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
-{
- RECT rcClient;
- HBRUSH bgBrush = CreateSolidBrush( gc->bg_color );
- GetClientRect( gr->wnd_handle, &rcClient );
- FillRect( hMemDC, &rcClient, bgBrush );
- DeleteObject( bgBrush );
- gr->bg_color = gc->bg_color;
-}
-
-struct graphics_font_priv {
- LOGFONT lf;
- HFONT hfont;
- int size;
-};
-
-static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
-{
- RECT rcClient;
- GetClientRect( gr->wnd_handle, &rcClient );
-
- int prevBkMode = SetBkMode( hMemDC, TRANSPARENT );
-
- if ( NULL == font->hfont )
- {
- font->hfont = EzCreateFont (hMemDC, TEXT ("Arial"), font->size/2, 0, 0, TRUE) ;
- GetObject ( font->hfont, sizeof (LOGFONT), &font->lf) ;
- }
-
-
- double angle = -atan2( dy, dx ) * 180 / 3.14159 ;
-
- SetTextAlign (hMemDC, TA_BASELINE) ;
- SetViewportOrgEx (hMemDC, p->x, p->y, NULL) ;
- font->lf.lfEscapement = font->lf.lfOrientation = ( angle * 10 ) ;
- DeleteObject (font->hfont) ;
-
- font->hfont = CreateFontIndirect (&font->lf);
- HFONT hOldFont = SelectObject(hMemDC, font->hfont );
-
- gunichar2* utf16 = NULL;
- glong utf16_len = 0;
-
- utf16 = g_utf8_to_utf16( text, -1, NULL, &utf16_len, NULL );
-#if defined(__CEGCC__)
- ExtTextOut(hMemDC, 0,0, ETO_OPAQUE, 0, utf16, (size_t)utf16_len,0 );
-#else
- TextOutW(hMemDC, 0,0, utf16, (size_t)utf16_len );
-#endif
- g_free( utf16 );
-
-
- SelectObject(hMemDC, hOldFont);
- DeleteObject (font->hfont) ;
-
- SetBkMode( hMemDC, prevBkMode );
-
- SetViewportOrgEx (hMemDC, 0, 0, NULL) ;
-
-}
-
-
-
-static void font_destroy(struct graphics_font_priv *font)
-{
- if ( font->hfont )
- {
- DeleteObject(font->hfont);
- }
- g_free(font);
-}
-
-static struct graphics_font_methods font_methods = {
- font_destroy
-};
-
-static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, int size, int flags)
-{
- struct graphics_font_priv *font=g_new(struct graphics_font_priv, 1);
- *meth = font_methods;
-
- font->hfont = NULL;
- font->size = size;
- // FontFamily fontFamily( "Liberation Mono");
-//font( &fontFamily, size, FontStyleRegular, UnitPoint );
- return font;
-}
-
-
-void image_cache_hash_add( const char* key, struct graphics_image_priv* val_ptr)
-{
- if ( image_cache_hash == NULL ) {
- image_cache_hash = g_hash_table_new(g_str_hash, g_str_equal);
- }
-
- if ( g_hash_table_lookup(image_cache_hash, key ) == NULL )
- {
- g_hash_table_insert(image_cache_hash, g_strdup( key ), (gpointer)val_ptr );
- }
-
-}
-
-struct graphics_image_priv* image_cache_hash_lookup( const char* key )
-{
- struct graphics_image_priv* val_ptr = NULL;
-
- if ( image_cache_hash != NULL )
- {
- val_ptr = g_hash_table_lookup(image_cache_hash, key );
- }
- return val_ptr;
-}
-
-
-
-static struct graphics_image_priv *image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h, struct point *hot)
-{
- struct graphics_image_priv* ret;
-
- if ( NULL == ( ret = image_cache_hash_lookup( name ) ) )
- {
- ret = g_new( struct graphics_image_priv, 1 );
- dbg( 1, "loading image '%s'\n", name );
- ret->pxpm = Xpm2bmp_new();
- Xpm2bmp_load( ret->pxpm, name );
- image_cache_hash_add( name, ret );
- }
-
- return ret;
-}
-
-static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
-{
- Xpm2bmp_paint( img->pxpm , hMemDC, p->x, p->y );
-}
-
-static struct graphics_methods graphics_methods = {
- graphics_destroy,
- draw_mode,
- draw_lines,
- draw_polygon,
- draw_rectangle,
- draw_circle,
- draw_text,
- draw_image,
-#ifdef HAVE_IMLIB2
- NULL, // draw_image_warp,
-#else
- NULL,
-#endif
- draw_restore,
- font_new,
- gc_new,
- background_gc,
- NULL, // overlay_new,
- image_new,
- get_data,
- register_resize_callback,
- register_button_callback,
- register_motion_callback,
-};
-
-static struct graphics_priv * graphics_win32_drawing_area_new_helper(struct graphics_methods *meth)
-{
- struct graphics_priv *this_=g_new0(struct graphics_priv,1);
- *meth=graphics_methods;
- this_->mode = -1;
- return this_;
-}
-
-struct graphics_priv* win32_graphics_new( struct graphics_methods *meth, struct attr **attrs)
-{
- struct graphics_priv* this_=graphics_win32_drawing_area_new_helper(meth);
- return this_;
-}
-
-void
-plugin_init(void)
-{
- plugin_register_graphics_type("win32", win32_graphics_new);
-}
diff --git a/navit/graphics/win32/win32_gui.h b/navit/graphics/win32/win32_gui.h
deleted file mode 100644
index 32095a0c..00000000
--- a/navit/graphics/win32/win32_gui.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef WIN32_GUI_INCLUDED
-#define WIN32_GUI_INCLUDED
-
-#include "resources/resource.h"
-#include "coord.h"
-#include "point.h"
-#include "graphics.h"
-
-#define ID_CHILD_GFX 100
-#define ID_CHILD_TOOLBAR (ID_CHILD_GFX + 1)
-#define ID_CHILD_1 (ID_CHILD_TOOLBAR + 1)
-#define ID_CHILD_2 (ID_CHILD_1 + 1)
-#define ID_CHILD_3 (ID_CHILD_2 + 1)
-#define ID_CHILD_4 (ID_CHILD_4 + 1)
-
-#define ID_DISPLAY_ZOOMIN 200
-#define ID_DISPLAY_ZOOMOUT 201
-#define ID_DISPLAY_REFRESH 202
-#define ID_DISPLAY_CURSOR 203
-#define ID_DISPLAY_ORIENT 204
-#define ID_DISPLAY_DESTINATION 205
-
-#define ID_FILE_EXIT 9001
-#define ID_STUFF_GO 9002
-
-#define _(text) gettext(text)
-
-#define POPUP_MENU_OFFSET 4000
-
-struct statusbar_methods;
-struct menu_methods;
-struct datawindow_methods;
-struct navit;
-struct callback;
-
-
-struct menu_priv {
- HWND wnd_handle;
- HMENU hMenu;
- struct callback* cb;
-};
-
-struct gui_priv {
- struct navit *nav;
- HANDLE hwnd;
-};
-
-
-struct graphics_priv {
- struct point p;
- int width;
- int height;
- int library_init;
- int visible;
- HANDLE wnd_parent_handle;
- HANDLE wnd_handle;
- COLORREF bg_color;
-
-
- void (*resize_callback)(void *data, int w, int h);
- void *resize_callback_data;
- void (*motion_callback)(void *data, struct point *p);
- void *motion_callback_data;
- void (*button_callback)(void *data, int press, int button, struct point *p);
- void *button_callback_data;
- enum draw_mode_num mode;
-};
-
-
-struct graphics_priv* win32_graphics_new( struct graphics_methods *meth, struct attr **attrs);
-HANDLE create_destination_window( struct navit *nav );
-BOOL register_destination_window();
-
-
-#endif
diff --git a/navit/graphics/win32/xpm2bmp.c b/navit/graphics/win32/xpm2bmp.c
deleted file mode 100644
index 4c02448d..00000000
--- a/navit/graphics/win32/xpm2bmp.c
+++ /dev/null
@@ -1,589 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <windows.h>
-#include <wingdi.h>
-#include "xpm2bmp.h"
-
-#define _DBG
-
-// function prototypes
-static int CreateBitmapFromXpm( const char* filename, PXPM2BMP pXpm2bmp );
-
-// typedefs
-static XPMCOLORENTRY theRGBRecords[] =
-{
- {"ALICEBLUE", 240, 248, 255},
- {"ANTIQUEWHITE", 250, 235, 215},
- {"AQUAMARINE", 50, 191, 193},
- {"AZURE", 240, 255, 255},
- {"BEIGE", 245, 245, 220},
- {"BISQUE", 255, 228, 196},
- {"BLACK", 0, 0, 0},
- {"BLANCHEDALMOND", 255, 235, 205},
- {"BLUE", 0, 0, 255},
- {"BLUEVIOLET", 138, 43, 226},
- {"BROWN", 165, 42, 42},
- {"BURLYWOOD", 222, 184, 135},
- {"CADETBLUE", 95, 146, 158},
- {"CHARTREUSE", 127, 255, 0},
- {"CHOCOLATE", 210, 105, 30},
- {"CORAL", 255, 114, 86},
- {"CORNFLOWERBLUE", 34, 34, 152},
- {"CORNSILK", 255, 248, 220},
- {"CYAN", 0, 255, 255},
- {"DARKGOLDENROD", 184, 134, 11},
- {"DARKGREEN", 0, 86, 45},
- {"DARKKHAKI", 189, 183, 107},
- {"DARKOLIVEGREEN", 85, 86, 47},
- {"DARKORANGE", 255, 140, 0},
- {"DARKORCHID", 139, 32, 139},
- {"DARKSALMON", 233, 150, 122},
- {"DARKSEAGREEN", 143, 188, 143},
- {"DARKSLATEBLUE", 56, 75, 102},
- {"DARKSLATEGRAY", 47, 79, 79},
- {"DARKTURQUOISE", 0, 166, 166},
- {"DARKVIOLET", 148, 0, 211},
- {"DEEPPINK", 255, 20, 147},
- {"DEEPSKYBLUE", 0, 191, 255},
- {"DIMGRAY", 84, 84, 84},
- {"DODGERBLUE", 30, 144, 255},
- {"FIREBRICK", 142, 35, 35},
- {"FLORALWHITE", 255, 250, 240},
- {"FORESTGREEN", 80, 159, 105},
- {"GAINSBORO", 220, 220, 220},
- {"GHOSTWHITE", 248, 248, 255},
- {"GOLD", 218, 170, 0},
- {"GOLDENROD", 239, 223, 132},
- {"GRAY", 126, 126, 126},
- {"GRAY0", 0, 0, 0},
- {"GRAY1", 3, 3, 3},
- {"GRAY10", 26, 26, 26},
- {"GRAY100", 255, 255, 255},
- {"GRAY11", 28, 28, 28},
- {"GRAY12", 31, 31, 31},
- {"GRAY13", 33, 33, 33},
- {"GRAY14", 36, 36, 36},
- {"GRAY15", 38, 38, 38},
- {"GRAY16", 41, 41, 41},
- {"GRAY17", 43, 43, 43},
- {"GRAY18", 46, 46, 46},
- {"GRAY19", 48, 48, 48},
- {"GRAY2", 5, 5, 5},
- {"GRAY20", 51, 51, 51},
- {"GRAY21", 54, 54, 54},
- {"GRAY22", 56, 56, 56},
- {"GRAY23", 59, 59, 59},
- {"GRAY24", 61, 61, 61},
- {"GRAY25", 64, 64, 64},
- {"GRAY26", 66, 66, 66},
- {"GRAY27", 69, 69, 69},
- {"GRAY28", 71, 71, 71},
- {"GRAY29", 74, 74, 74},
- {"GRAY3", 8, 8, 8},
- {"GRAY30", 77, 77, 77},
- {"GRAY31", 79, 79, 79},
- {"GRAY32", 82, 82, 82},
- {"GRAY33", 84, 84, 84},
- {"GRAY34", 87, 87, 87},
- {"GRAY35", 89, 89, 89},
- {"GRAY36", 92, 92, 92},
- {"GRAY37", 94, 94, 94},
- {"GRAY38", 97, 97, 97},
- {"GRAY39", 99, 99, 99},
- {"GRAY4", 10, 10, 10},
- {"GRAY40", 102, 102, 102},
- {"GRAY41", 105, 105, 105},
- {"GRAY42", 107, 107, 107},
- {"GRAY43", 110, 110, 110},
- {"GRAY44", 112, 112, 112},
- {"GRAY45", 115, 115, 115},
- {"GRAY46", 117, 117, 117},
- {"GRAY47", 120, 120, 120},
- {"GRAY48", 122, 122, 122},
- {"GRAY49", 125, 125, 125},
- {"GRAY5", 13, 13, 13},
- {"GRAY50", 127, 127, 127},
- {"GRAY51", 130, 130, 130},
- {"GRAY52", 133, 133, 133},
- {"GRAY53", 135, 135, 135},
- {"GRAY54", 138, 138, 138},
- {"GRAY55", 140, 140, 140},
- {"GRAY56", 143, 143, 143},
- {"GRAY57", 145, 145, 145},
- {"GRAY58", 148, 148, 148},
- {"GRAY59", 150, 150, 150},
- {"GRAY6", 15, 15, 15},
- {"GRAY60", 153, 153, 153},
- {"GRAY61", 156, 156, 156},
- {"GRAY62", 158, 158, 158},
- {"GRAY63", 161, 161, 161},
- {"GRAY64", 163, 163, 163},
- {"GRAY65", 166, 166, 166},
- {"GRAY66", 168, 168, 168},
- {"GRAY67", 171, 171, 171},
- {"GRAY68", 173, 173, 173},
- {"GRAY69", 176, 176, 176},
- {"GRAY7", 18, 18, 18},
- {"GRAY70", 179, 179, 179},
- {"GRAY71", 181, 181, 181},
- {"GRAY72", 184, 184, 184},
- {"GRAY73", 186, 186, 186},
- {"GRAY74", 189, 189, 189},
- {"GRAY75", 191, 191, 191},
- {"GRAY76", 194, 194, 194},
- {"GRAY77", 196, 196, 196},
- {"GRAY78", 199, 199, 199},
- {"GRAY79", 201, 201, 201},
- {"GRAY8", 20, 20, 20},
- {"GRAY80", 204, 204, 204},
- {"GRAY81", 207, 207, 207},
- {"GRAY82", 209, 209, 209},
- {"GRAY83", 212, 212, 212},
- {"GRAY84", 214, 214, 214},
- {"GRAY85", 217, 217, 217},
- {"GRAY86", 219, 219, 219},
- {"GRAY87", 222, 222, 222},
- {"GRAY88", 224, 224, 224},
- {"GRAY89", 227, 227, 227},
- {"GRAY9", 23, 23, 23},
- {"GRAY90", 229, 229, 229},
- {"GRAY91", 232, 232, 232},
- {"GRAY92", 235, 235, 235},
- {"GRAY93", 237, 237, 237},
- {"GRAY94", 240, 240, 240},
- {"GRAY95", 242, 242, 242},
- {"GRAY96", 245, 245, 245},
- {"GRAY97", 247, 247, 247},
- {"GRAY98", 250, 250, 250},
- {"GRAY99", 252, 252, 252},
- {"GREEN", 0, 255, 0},
- {"GREENYELLOW", 173, 255, 47},
- {"HONEYDEW", 240, 255, 240},
- {"HOTPINK", 255, 105, 180},
- {"INDIANRED", 107, 57, 57},
- {"IVORY", 255, 255, 240},
- {"KHAKI", 179, 179, 126},
- {"LAVENDER", 230, 230, 250},
- {"LAVENDERBLUSH", 255, 240, 245},
- {"LAWNGREEN", 124, 252, 0},
- {"LEMONCHIFFON", 255, 250, 205},
- {"LIGHTBLUE", 176, 226, 255},
- {"LIGHTCORAL", 240, 128, 128},
- {"LIGHTCYAN", 224, 255, 255},
- {"LIGHTGOLDENROD", 238, 221, 130},
- {"LIGHTGOLDENRODYELLOW", 250, 250, 210},
- {"LIGHTGRAY", 168, 168, 168},
- {"LIGHTPINK", 255, 182, 193},
- {"LIGHTSALMON", 255, 160, 122},
- {"LIGHTSEAGREEN", 32, 178, 170},
- {"LIGHTSKYBLUE", 135, 206, 250},
- {"LIGHTSLATEBLUE", 132, 112, 255},
- {"LIGHTSLATEGRAY", 119, 136, 153},
- {"LIGHTSTEELBLUE", 124, 152, 211},
- {"LIGHTYELLOW", 255, 255, 224},
- {"LIMEGREEN", 0, 175, 20},
- {"LINEN", 250, 240, 230},
- {"MAGENTA", 255, 0, 255},
- {"MAROON", 143, 0, 82},
- {"MEDIUMAQUAMARINE", 0, 147, 143},
- {"MEDIUMBLUE", 50, 50, 204},
- {"MEDIUMFORESTGREEN", 50, 129, 75},
- {"MEDIUMGOLDENROD", 209, 193, 102},
- {"MEDIUMORCHID", 189, 82, 189},
- {"MEDIUMPURPLE", 147, 112, 219},
- {"MEDIUMSEAGREEN", 52, 119, 102},
- {"MEDIUMSLATEBLUE", 106, 106, 141},
- {"MEDIUMSPRINGGREEN", 35, 142, 35},
- {"MEDIUMTURQUOISE", 0, 210, 210},
- {"MEDIUMVIOLETRED", 213, 32, 121},
- {"MIDNIGHTBLUE", 47, 47, 100},
- {"MINTCREAM", 245, 255, 250},
- {"MISTYROSE", 255, 228, 225},
- {"MOCCASIN", 255, 228, 181},
- {"NAVAJOWHITE", 255, 222, 173},
- {"NAVY", 35, 35, 117},
- {"NAVYBLUE", 35, 35, 117},
- {"OLDLACE", 253, 245, 230},
- {"OLIVEDRAB", 107, 142, 35},
- {"ORANGE", 255, 135, 0},
- {"ORANGERED", 255, 69, 0},
- {"ORCHID", 239, 132, 239},
- {"PALEGOLDENROD", 238, 232, 170},
- {"PALEGREEN", 115, 222, 120},
- {"PALETURQUOISE", 175, 238, 238},
- {"PALEVIOLETRED", 219, 112, 147},
- {"PAPAYAWHIP", 255, 239, 213},
- {"PEACHPUFF", 255, 218, 185},
- {"PERU", 205, 133, 63},
- {"PINK", 255, 181, 197},
- {"PLUM", 197, 72, 155},
- {"POWDERBLUE", 176, 224, 230},
- {"PURPLE", 160, 32, 240},
- {"RED", 255, 0, 0},
- {"ROSYBROWN", 188, 143, 143},
- {"ROYALBLUE", 65, 105, 225},
- {"SADDLEBROWN", 139, 69, 19},
- {"SALMON", 233, 150, 122},
- {"SANDYBROWN", 244, 164, 96},
- {"SEAGREEN", 82, 149, 132},
- {"SEASHELL", 255, 245, 238},
- {"SIENNA", 150, 82, 45},
- {"SKYBLUE", 114, 159, 255},
- {"SLATEBLUE", 126, 136, 171},
- {"SLATEGRAY", 112, 128, 144},
- {"SNOW", 255, 250, 250},
- {"SPRINGGREEN", 65, 172, 65},
- {"STEELBLUE", 84, 112, 170},
- {"TAN", 222, 184, 135},
- {"THISTLE", 216, 191, 216},
- {"TOMATO", 255, 99, 71},
- {"TRANSPARENT", 0, 0, 1},
- {"TURQUOISE", 25, 204, 223},
- {"VIOLET", 156, 62, 206},
- {"VIOLETRED", 243, 62, 150},
- {"WHEAT", 245, 222, 179},
- {"WHITE", 255, 255, 255},
- {"WHITESMOKE", 245, 245, 245},
- {"YELLOW", 255, 255, 0},
- {"YELLOWGREEN", 50, 216, 56}
-};
-
-
-PXPM2BMP Xpm2bmp_new()
-{
- PXPM2BMP preturn = (PXPM2BMP)calloc( sizeof( XPM2BMP ) , 1 );
- return preturn;
-}
-
-
-int Xpm2bmp_load( PXPM2BMP pXpm2bmp, const char* filename )
-{
- return CreateBitmapFromXpm( filename, pXpm2bmp );
-}
-
-int Xpm2bmp_paint( PXPM2BMP pXpm2bmp, HDC hdc, int x1,int y1 )
-{
- StretchDIBits(hdc,
- x1, y1, pXpm2bmp->size_x, pXpm2bmp->size_y,
- 0, 0, pXpm2bmp->size_x, pXpm2bmp->size_y,
- pXpm2bmp->wimage_data_trans,
- (BITMAPINFO *)pXpm2bmp->bmih_trans,
- DIB_RGB_COLORS,
- SRCAND );
-
- StretchDIBits(hdc,
- x1, y1, pXpm2bmp->size_x, pXpm2bmp->size_y,
- 0, 0, pXpm2bmp->size_x, pXpm2bmp->size_y,
- pXpm2bmp->wimage_data,
- (BITMAPINFO *)pXpm2bmp->bmih,
- DIB_RGB_COLORS,
- SRCPAINT );
-
- return 0;
-}
-
-static int parse_line_values( const char* line, PXPM2BMP pXpm2bmp )
-{
- int return_value = 0;
- char* parse_line = (char*)line;
- char* tok;
- int value_pos = 0;
-
- parse_line = strchr( parse_line, '"' );
- parse_line++;
-
- tok = strtok( parse_line, " \t\n" );
-
- while ( tok != 0 )
- {
- int val = atoi( tok );
- switch ( value_pos )
- {
- case 0: pXpm2bmp->size_x = val; break;
- case 1: pXpm2bmp->size_y = val; break;
- case 2: pXpm2bmp->colors = val; break;
- case 3: pXpm2bmp->chars_per_pixel = val; break;
- case 4: pXpm2bmp->hotspot_x = val; break;
- case 5: pXpm2bmp->hotspot_y = val; break;
- }
- tok = strtok( NULL, " \t" );
- value_pos ++;
-
- }
-
- return return_value;
-}
-
-static int hex2int( char c )
-{
- if ((c >= '0') && (c <='9' )) return c - '0';
- if ((c >= 'A') && (c <= 'F')) return c - 'A' + 10;
- if ((c >= 'a') && (c <= 'f')) return c - 'a' + 10;
- return -1;
-}
-
-static DWORD string2hex16( const char* str )
-{
- int i1 = hex2int( str[0] );
- int i2 = hex2int( str[1] );
- if ( ( i1 >= 0 ) && ( i2 >= 0 ) )
- return i1*16+i2;
- return -1;
-}
-
-static int parse_color_values( const char* line, PXPM2BMP pXpm2bmp )
-{
- int return_value = 0;
- char* cq = strchr( line, '"' );
- char* cchar = strchr( cq+pXpm2bmp->chars_per_pixel+1, 'c' );
- char* chash = strchr( cq+pXpm2bmp->chars_per_pixel+1, '#' );
- char* qe = strchr( cq+pXpm2bmp->chars_per_pixel+1, '"' );
-
- cq++;
-
- if ( cq )
- {
- memcpy( pXpm2bmp->color_entires[ pXpm2bmp-> color_entires_size].color_str, cq, pXpm2bmp->chars_per_pixel + 1 );
- pXpm2bmp->color_entires[ pXpm2bmp-> color_entires_size].color_str[ pXpm2bmp->chars_per_pixel ] = '\0';
-
-
- if ( cchar && chash && qe)
- {
- chash++;
- *qe = 0;
- int len = strlen( chash );
-
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].r = string2hex16( &chash[0] );
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].g = string2hex16( &chash[len / 3] );
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].b = string2hex16( &chash[len * 2 / 3] );
-#ifdef _DBG
-printf( "adding color %s => %d RGB %lx %lx %lx to index %d\n",
- line,
- pXpm2bmp->color_entires_size,
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].r,
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].g,
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].b,
- pXpm2bmp->color_entires_size );
-#endif
- }
- else
- {
- int q;
- char *start = cchar + 1;
- char *end = start;
-
- while ( *start != 0 )
- {
- if ( ( *start != '\t' ) && ( *start != ' ' ) )
- {
- break;
- }
- start++;
- }
-
- end = start;
- while ( *end != 0 )
- {
- if ( ( *end == '\t' ) || ( *end == ' ' ) || ( *end == '"' ))
- {
- *end = 0;
- }
- end++;
- }
-
- start = strupr( start );
-
- for ( q=0; q < sizeof( theRGBRecords ) / sizeof( theRGBRecords[0] ); q++ )
- {
-
- if ( 0 == strcmp( start, theRGBRecords[q].color_str ) )
- {
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].r = theRGBRecords[q].r;
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].g = theRGBRecords[q].g;
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].b = theRGBRecords[q].b;
- }
- }
- if ( 0 == strcmp( start, "NONE" ) )
- {
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].r = 255;
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].g = 0;
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].b = 255;
- }
- }
- }
- pXpm2bmp->color_entires_size++;
-
- return return_value;
-}
-
-static int vv = 0;
-
-static int parse_pixel_line_values( const char* line, PXPM2BMP pXpm2bmp, unsigned char* pixel_data, unsigned char* pixel_data_trans )
-{
- int return_value = 0;
- int i,j;
-
-
- char* cq = strchr( line, '"' );
- int pix_idx = 0;
- int size_x = pXpm2bmp->size_x;
- int len = strlen( cq );
-
- cq++;
-
- if ( len > pXpm2bmp->chars_per_pixel * size_x )
- {
- for ( i=0; i< size_x; i++ )
- {
- int found = 0;
- char* cmp = &cq[ i * pXpm2bmp->chars_per_pixel];
-
- for ( j=0; j< pXpm2bmp-> color_entires_size; j++ )
- {
- if ( strncmp( cmp, pXpm2bmp->color_entires[ j ].color_str, pXpm2bmp->chars_per_pixel ) == 0 )
- {
- int r = pXpm2bmp->color_entires[ j ].r;
- int g = pXpm2bmp->color_entires[ j ].g;
- int b = pXpm2bmp->color_entires[ j ].b;
-
- if ( ( r == 255 ) && ( g == 0 ) && ( r == 255 ) )
- {
- r=g=b=0;
- pixel_data_trans[ pix_idx ] = 255;
- pixel_data_trans[ pix_idx+1 ] = 255;
- pixel_data_trans[ pix_idx+2 ] = 255;
- }
- else
- {
- pixel_data_trans[ pix_idx ] = 0;
- pixel_data_trans[ pix_idx+1 ] = 0;
- pixel_data_trans[ pix_idx+2 ] = 0;
- }
-
- // pixel_data[ pix_idx++ ] = pXpm2bmp->color_entires[ j ].r;
- // pixel_data[ pix_idx++ ] = pXpm2bmp->color_entires[ j ].g;
- // pixel_data[ pix_idx++ ] = pXpm2bmp->color_entires[ j ].b;
- pixel_data[ pix_idx++ ] = b;
- pixel_data[ pix_idx++ ] = g;
- pixel_data[ pix_idx++ ] = r;
- found = 1;
- vv++;
- break;
- }
- }
- if ( !found )
- {
- fprintf( stderr, "XPMLIB: error color not found\n" );
- }
-
- }
- }
- else
- {
- return_value = -1;
- fprintf( stderr, "XPMLIB: invalid line length\n" );
- }
- return return_value;
-}
-
-
-static int CreateBitmapFromXpm( const char* filename, PXPM2BMP pXpm2bmp )
-{
- int return_val = 0;
- unsigned char i, row;
- char line[ 1024 ];
- int nbytes ;
- FILE* file_xpm = fopen( filename, "r" );
-
- int phase = 0;
- row = 0;
-
- if ( file_xpm )
- {
- while ( fgets(line, sizeof( line ), file_xpm ) )
- {
-#ifdef _DBG
- printf( "PARSING: %s\n", line );
-#endif
- if ( line[ 0 ] != '"' )
- continue;
-
- switch ( phase )
- {
- case 0:
- parse_line_values( line, pXpm2bmp );
-#ifdef _DBG
- printf( "size_x %d\n", pXpm2bmp->size_x );
- printf( "size_y %d\n", pXpm2bmp->size_y );
-#endif
- phase = 1;
-
- pXpm2bmp->color_entires_size = 0;
- nbytes = ( pXpm2bmp->chars_per_pixel + 1 ) * pXpm2bmp->colors;
-
- pXpm2bmp->color_entires = calloc( sizeof( XPMCOLORENTRY ), pXpm2bmp->colors + 100 );
- pXpm2bmp->color_entires[0].color_str = calloc( nbytes, pXpm2bmp->colors );
- for ( i = 1; i< pXpm2bmp->colors; i++ )
- {
- pXpm2bmp->color_entires[i].color_str = pXpm2bmp->color_entires[0].color_str + ( pXpm2bmp->chars_per_pixel + 1 ) * i;
- }
-
- if (!(pXpm2bmp->dib = (unsigned char *)malloc(sizeof(BITMAPINFOHEADER) + pXpm2bmp->size_x * pXpm2bmp->size_y * 3)))
- {
- return 4;
- }
- if (!(pXpm2bmp->dib_trans = (unsigned char *)calloc(sizeof(BITMAPINFOHEADER) + pXpm2bmp->size_x * pXpm2bmp->size_y * 3,1)))
- {
- return 4;
- }
-
- memset(pXpm2bmp->dib, 0, sizeof(BITMAPINFOHEADER));
- pXpm2bmp->bmih = (BITMAPINFOHEADER *)pXpm2bmp->dib;
- pXpm2bmp->bmih->biSize = sizeof(BITMAPINFOHEADER);
- pXpm2bmp->bmih->biWidth = pXpm2bmp->size_x;
- pXpm2bmp->bmih->biHeight = -((long)pXpm2bmp->size_y);
- pXpm2bmp->bmih->biPlanes = 1;
- pXpm2bmp->bmih->biBitCount = 24;
- pXpm2bmp->bmih->biCompression = 0;
- pXpm2bmp->wimage_data = pXpm2bmp->dib + sizeof(BITMAPINFOHEADER);
-
-
- pXpm2bmp->bmih_trans = (BITMAPINFOHEADER *)pXpm2bmp->dib_trans;
- pXpm2bmp->bmih_trans->biSize = sizeof(BITMAPINFOHEADER);
- pXpm2bmp->bmih_trans->biWidth = pXpm2bmp->size_x;
- pXpm2bmp->bmih_trans->biHeight = -((long)pXpm2bmp->size_y);
- pXpm2bmp->bmih_trans->biPlanes = 1;
- pXpm2bmp->bmih_trans->biBitCount = 24;
- pXpm2bmp->bmih_trans->biCompression = 0;
- pXpm2bmp->wimage_data_trans = pXpm2bmp->dib_trans + sizeof(BITMAPINFOHEADER);
-// memset( pXpm2bmp->wimage_data_trans, 255, 5* 22 * 3 );
-
- break;
- case 1:
- parse_color_values( line, pXpm2bmp );
- if ( pXpm2bmp->color_entires_size >= pXpm2bmp->colors )
- {
- phase = 2;
- }
-
- break;
- case 2:
- parse_pixel_line_values( line, pXpm2bmp,
- pXpm2bmp->wimage_data + row * pXpm2bmp->size_x * 3,
- pXpm2bmp->wimage_data_trans + row * pXpm2bmp->size_x * 3 );
-
- row++;
- if ( row >= pXpm2bmp->size_y )
- {
- phase = 3;
- }
- break;
- }
-
- }
-
- fclose( file_xpm );
- }
- return return_val;
-}
diff --git a/navit/gtkext.h b/navit/gtkext.h
deleted file mode 100644
index 572057ba..00000000
--- a/navit/gtkext.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef NAVIT_GTKEXT_H
-#define NAVIT_GTKEXT_H
-
-void gdk_gc_set_fill_rule(GdkGC *gc, GdkFillRule fill_rule);
-
-#endif
diff --git a/navit/gui.c b/navit/gui.c
deleted file mode 100644
index 2d59da1f..00000000
--- a/navit/gui.c
+++ /dev/null
@@ -1,127 +0,0 @@
-#include <windows.h>
-#include <glib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include "menu.h"
-#include "debug.h"
-#include "gui.h"
-#include "menu.h"
-#include "data_window.h"
-#include "item.h"
-#include "plugin.h"
-
-struct gui {
- struct gui_methods meth;
- struct gui_priv *priv;
- struct attr **attrs;
-};
-
-struct gui *
-gui_new(struct attr *parent, struct attr **attrs)
-{
- struct gui *this_;
- struct attr *type_attr;
- struct gui_priv *(*guitype_new)(struct navit *nav, struct gui_methods *meth, struct attr **attrs);
- if (! (type_attr=attr_search(attrs, NULL, attr_type))) {
- return NULL;
- }
-
- guitype_new=plugin_get_gui_type(type_attr->u.str);
- if (! guitype_new)
- return NULL;
-
- this_=g_new0(struct gui, 1);
- this_->priv=guitype_new(parent->u.navit, &this_->meth, attrs);
- this_->attrs=attr_list_dup(attrs);
- return this_;
-}
-
-int
-gui_get_attr(struct gui *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
-{
- return attr_generic_get_attr(this_->attrs, type, attr, iter);
-}
-
-struct menu *
-gui_menubar_new(struct gui *gui)
-{
- struct menu *this_;
- if (! gui->meth.menubar_new)
- return NULL;
- this_=g_new0(struct menu, 1);
- this_->priv=gui->meth.menubar_new(gui->priv, &this_->meth);
- if (! this_->priv) {
- g_free(this_);
- return NULL;
- }
- return this_;
-}
-
-struct menu *
-gui_popup_new(struct gui *gui)
-{
- struct menu *this_;
- if (! gui->meth.popup_new)
- return NULL;
- this_=g_new0(struct menu, 1);
- this_->priv=gui->meth.popup_new(gui->priv, &this_->meth);
- if (! this_->priv) {
- g_free(this_);
- return NULL;
- }
- return this_;
-}
-
-struct datawindow *
-gui_datawindow_new(struct gui *gui, char *name, struct callback *click, struct callback *close)
-{
- struct datawindow *this_;
- if (! gui->meth.datawindow_new)
- return NULL;
- this_=g_new0(struct datawindow, 1);
- this_->priv=gui->meth.datawindow_new(gui->priv, name, click, close, &this_->meth);
- if (! this_->priv) {
- g_free(this_);
- return NULL;
- }
- return this_;
-}
-
-int
-gui_add_bookmark(struct gui *gui, struct pcoord *c, char *description)
-{
- int ret;
- dbg(2,"enter\n");
- if (! gui->meth.add_bookmark)
- return 0;
- ret=gui->meth.add_bookmark(gui->priv, c, description);
-
- dbg(2,"ret=%d\n", ret);
- return ret;
-}
-
-int
-gui_set_graphics(struct gui *this_, struct graphics *gra)
-{
- if (! this_->meth.set_graphics)
- return 1;
- return this_->meth.set_graphics(this_->priv, gra);
-}
-
-int
-gui_has_main_loop(struct gui *this_)
-{
- if (! this_->meth.run_main_loop)
- return 0;
- return 1;
-}
-
-int
-gui_run_main_loop(struct gui *this_)
-{
- if (! gui_has_main_loop(this_))
- return 1;
- return this_->meth.run_main_loop(this_->priv);
-}
-
diff --git a/navit/gui.h b/navit/gui.h
deleted file mode 100644
index 9f170f76..00000000
--- a/navit/gui.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef NAVIT_GUI_H
-#define NAVIT_GUI_H
-
-struct navit;
-struct gui_priv;
-struct menu_methods;
-struct datawindow_methods;
-struct callback;
-struct graphics;
-struct coord;
-struct pcoord;
-
-struct gui_methods {
- struct menu_priv *(*menubar_new)(struct gui_priv *priv, struct menu_methods *meth);
- struct menu_priv *(*popup_new)(struct gui_priv *priv, struct menu_methods *meth);
- int (*set_graphics)(struct gui_priv *priv, struct graphics *gra);
- int (*run_main_loop)(struct gui_priv *priv);
- struct datawindow_priv *(*datawindow_new)(struct gui_priv *priv, char *name, struct callback *click, struct callback *close, struct datawindow_methods *meth);
- int (*add_bookmark)(struct gui_priv *priv, struct pcoord *c, char *description);
-};
-
-
-/* prototypes */
-enum attr_type;
-struct attr;
-struct attr_iter;
-struct callback;
-struct datawindow;
-struct graphics;
-struct gui;
-struct menu;
-struct navit;
-struct pcoord;
-struct gui *gui_new(struct attr *parent, struct attr **attrs);
-int gui_get_attr(struct gui *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
-struct menu *gui_menubar_new(struct gui *gui);
-struct menu *gui_popup_new(struct gui *gui);
-struct datawindow *gui_datawindow_new(struct gui *gui, char *name, struct callback *click, struct callback *close);
-int gui_add_bookmark(struct gui *gui, struct pcoord *c, char *description);
-int gui_set_graphics(struct gui *this_, struct graphics *gra);
-int gui_has_main_loop(struct gui *this_);
-int gui_run_main_loop(struct gui *this_);
-/* end of prototypes */
-
-#endif
-
diff --git a/navit/gui/Makefile.am b/navit/gui/Makefile.am
deleted file mode 100644
index 1f368df6..00000000
--- a/navit/gui/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-SUBDIRS=internal
-if GUI_GTK
- SUBDIRS += gtk
-endif
-if GUI_SDL
- SUBDIRS += sdl
-endif
-
diff --git a/navit/gui/gtk/Makefile.am b/navit/gui/gtk/Makefile.am
deleted file mode 100644
index 5d34b152..00000000
--- a/navit/gui/gtk/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = -I$(top_srcdir)/navit @NAVIT_CFLAGS@ @GTK2_CFLAGS@ -DMODULE=gui_gtk
-modulegui_LTLIBRARIES = libgui_gtk.la
-libgui_gtk_la_SOURCES = datawindow.c destination.c gui_gtk_statusbar.c gui_gtk_action.c gui_gtk_window.c gui_gtk.h
-libgui_gtk_la_LIBADD = @GTK2_LIBS@
diff --git a/navit/gui/gtk/datawindow.c b/navit/gui/gtk/datawindow.c
deleted file mode 100644
index 6660ed85..00000000
--- a/navit/gui/gtk/datawindow.c
+++ /dev/null
@@ -1,171 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
-#include "debug.h"
-#include "callback.h"
-#include "param.h"
-#include "data_window.h"
-#include "gui_gtk.h"
-
-struct datawindow_priv {
- GtkWidget *window;
- GtkWidget *scrolled_window;
- GtkWidget *treeview;
- GtkListStore *liststore;
- GtkTreeModel *sortmodel;
- struct callback *click, *close;
-};
-
-static void
-gui_gtk_datawindow_destroy(struct datawindow_priv *win)
-{
- return;
-}
-
-static GValue value;
-static void
-select_row(GtkTreeView *tree, GtkTreePath *path, GtkTreeViewColumn *column, struct datawindow_priv *win)
-{
- char *cols[20];
- GtkTreeIter iter;
- GtkTreeModel *model;
- int i;
-
- dbg(0,"win=%p\n", win);
-
- model=gtk_tree_view_get_model(tree);
- gtk_tree_model_get_iter(model, &iter, path);
-
- for (i=0;i<gtk_tree_model_get_n_columns(model);i++) {
- gtk_tree_model_get_value(model, &iter, i, &value);
- cols[i]=g_strdup_value_contents(&value)+1;
- cols[i][strlen(cols[i])-1]='\0';
- g_value_unset(&value);
- }
- callback_call_1(win->click, cols);
-}
-
-static void
-gui_gtk_datawindow_add(struct datawindow_priv *win, struct param_list *param, int count)
-{
- int i;
- GtkCellRenderer *cell;
- GtkTreeIter iter;
- GType types[count];
-
- if (! win->treeview) {
- win->treeview=gtk_tree_view_new();
- gtk_tree_view_set_model (GTK_TREE_VIEW (win->treeview), NULL);
- gtk_container_add(GTK_CONTAINER(win->scrolled_window), win->treeview);
- gtk_widget_show_all(GTK_WIDGET(win->window));
- gtk_widget_grab_focus(GTK_WIDGET(win->treeview));
-
- /* add column names to treeview */
- for(i=0;i<count;i++) {
- if (param[i].name) {
- cell=gtk_cell_renderer_text_new();
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (win->treeview),-1,param[i].name,
- cell,"text",i, NULL);
- }
- }
-#if 0
- g_signal_connect(G_OBJECT(win->treeview), "click-column", G_CALLBACK(click_column), NULL);
-#endif
- g_signal_connect(G_OBJECT(win->treeview), "row-activated", G_CALLBACK(select_row), win);
- }
-
- /* find data storage and create a new one if none is there */
- if (gtk_tree_view_get_model(GTK_TREE_VIEW (win->treeview)) == NULL) {
- for(i=0;i<count;i++) {
- if (param[i].name && !strcmp(param[i].name, "Distance"))
- types[i]=G_TYPE_INT;
- else
- types[i]=G_TYPE_STRING;
- }
- win->liststore=gtk_list_store_newv(count,types);
- if (! strcmp(param[0].name, "Distance")) {
- win->sortmodel=gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(win->liststore));
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (win->sortmodel), 0, GTK_SORT_ASCENDING);
- gtk_tree_view_set_model (GTK_TREE_VIEW (win->treeview), GTK_TREE_MODEL(win->sortmodel));
- } else
- gtk_tree_view_set_model (GTK_TREE_VIEW (win->treeview), GTK_TREE_MODEL(win->liststore));
- }
-
- gtk_list_store_append(win->liststore,&iter);
-
- /* add data to data storage */
- for(i=0;i<count;i++) {
- if (param[i].name && !strcmp(param[i].name, "Distance")) {
- gtk_list_store_set(win->liststore,&iter,i,atoi(param[i].value),-1);
- } else {
- gtk_list_store_set(win->liststore,&iter,i,param[i].value,-1);
- }
- }
-}
-
-static void
-gui_gtk_datawindow_mode(struct datawindow_priv *win, int start)
-{
- if (start) {
- if (win && win->treeview) {
- gtk_tree_view_set_model (GTK_TREE_VIEW (win->treeview), NULL);
- }
- }
-}
-
-static gboolean
-gui_gtk_datawindow_delete(GtkWidget *widget, GdkEvent *event, struct datawindow_priv *win)
-{
- callback_call_0(win->close);
-
- return FALSE;
-}
-
-static gboolean
-keypress(GtkWidget *widget, GdkEventKey *event, struct datawindow_priv *win)
-{
- if (event->type != GDK_KEY_PRESS)
- return FALSE;
- if (event->keyval == GDK_Cancel) {
- gui_gtk_datawindow_delete(widget, event, win);
- gtk_widget_destroy(win->window);
- }
- return FALSE;
-}
-
-
-static struct datawindow_methods gui_gtk_datawindow_meth = {
- gui_gtk_datawindow_destroy,
- gui_gtk_datawindow_add,
- gui_gtk_datawindow_mode,
-};
-
-struct datawindow_priv *
-gui_gtk_datawindow_new(struct gui_priv *gui, char *name, struct callback *click, struct callback *close, struct datawindow_methods *meth)
-{
- struct datawindow_priv *win;
-
- *meth=gui_gtk_datawindow_meth;
- win=g_new0(struct datawindow_priv, 1);
- win->window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_default_size(GTK_WINDOW(win->window), 320, 200);
- gtk_window_set_title(GTK_WINDOW(win->window), name);
-
- win->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (win->scrolled_window),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_container_add(GTK_CONTAINER(win->window), win->scrolled_window);
- g_signal_connect(G_OBJECT(win->window), "key-press-event", G_CALLBACK(keypress), win);
- win->treeview=NULL;
- win->click=click;
- win->close=close;
- if (gui)
- gtk_window_set_transient_for(GTK_WINDOW((GtkWidget *)(win->window)), GTK_WINDOW(gui->win));
-
- g_signal_connect(G_OBJECT(win->window), "delete-event", G_CALLBACK(gui_gtk_datawindow_delete), win);
- gtk_widget_show_all(win->window);
- return win;
-}
-
diff --git a/navit/gui/gtk/destination.c b/navit/gui/gtk/destination.c
deleted file mode 100644
index 2753a562..00000000
--- a/navit/gui/gtk/destination.c
+++ /dev/null
@@ -1,505 +0,0 @@
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <libintl.h>
-#include <gtk/gtk.h>
-#include "debug.h"
-#include "destination.h"
-#include "navit.h"
-#include "item.h"
-#include "coord.h"
-#include "track.h"
-#include "country.h"
-#include "search.h"
-#include "projection.h"
-
-#define COL_COUNT 8
-
-#define gettext_noop(String) String
-#define _(STRING) gettext(STRING)
-#define _n(STRING) gettext_noop(STRING)
-
-static struct search_param {
- struct navit *nav;
- struct mapset *ms;
- struct search_list *sl;
- struct attr attr;
- int partial;
- GtkWidget *entry_country, *entry_postal, *entry_city, *entry_district;
- GtkWidget *entry_street, *entry_number;
- GtkWidget *listbox;
- GtkWidget *treeview;
- GtkListStore *liststore;
- GtkTreeModel *liststore2;
-} search_param;
-
-static void button_map(GtkWidget *widget, struct search_param *search)
-{
- struct pcoord *c=NULL;
- GtkTreeIter iter;
- if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (search->liststore2), &iter))
- return;
- gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), &iter, COL_COUNT, &c, -1);
- if (c) {
- navit_set_center(search->nav, c);
- }
-}
-
-static char *description(struct search_param *search, GtkTreeIter *iter)
-{
- char *desc,*car,*postal,*town,*street;
- gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), iter, 0, &car, -1);
- gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), iter, 1, &postal, -1);
- gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), iter, 2, &town, -1);
- gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), iter, 4, &street, -1);
- if (search->attr.type == attr_town_name)
- desc=g_strdup_printf("%s-%s %s", car, postal, town);
- else
- desc=g_strdup_printf("%s-%s %s, %s", car, postal, town, street);
- return desc;
-}
-
-static void button_destination(GtkWidget *widget, struct search_param *search)
-{
- struct pcoord *c=NULL;
- GtkTreeIter iter;
- char *desc;
-
- if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (search->liststore2), &iter))
- return;
- gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), &iter, COL_COUNT, &c, -1);
- if (c) {
- desc=description(search, &iter);
- navit_set_destination(search->nav, c, desc);
- g_free(desc);
- }
-}
-
-static void button_bookmark(GtkWidget *widget, struct search_param *search)
-{
- struct pcoord *c=NULL;
- GtkTreeIter iter;
- char *desc;
-
- if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (search->liststore2), &iter))
- return;
- gtk_tree_model_get (GTK_TREE_MODEL (search->liststore2), &iter, COL_COUNT, &c, -1);
- if (c) {
- desc=description(search, &iter);
- navit_add_bookmark(search->nav, c, desc);
- g_free(desc);
- }
-}
-
-
-char **columns_text[] = {
- (char *[]){_n("Car"),_n("Iso2"),_n("Iso3"),_n("Country"),NULL},
- (char *[]){_n("Car"),_n("Postal"),_n("Town"),_n("District"),NULL},
- (char *[]){_n("Car"),_n("Postal"),_n("Town"),_n("District"),_n("Street"),NULL},
- (char *[]){_n("Car"),_n("Postal"),_n("Town"),_n("District"),_n("Street"),_n("Number"),NULL},
-};
-
-static void set_columns(struct search_param *param, int mode)
-{
- GList *columns_list,*columns;
- char **column_text=columns_text[mode];
- int i=0;
-
- columns_list=gtk_tree_view_get_columns(GTK_TREE_VIEW(param->treeview));
- columns=columns_list;
- while (columns) {
- gtk_tree_view_remove_column(GTK_TREE_VIEW(param->treeview), columns->data);
- columns=g_list_next(columns);
- }
- g_list_free(columns_list);
- while (*column_text) {
- printf("column_text=%p\n", column_text);
- printf("*column_text=%s\n", *column_text);
- GtkCellRenderer *cell=gtk_cell_renderer_text_new();
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (param->treeview),-1, gettext(*column_text), cell, "text", i, NULL);
- i++;
- column_text++;
- }
-
-}
-
-static void row_activated(GtkWidget *widget, GtkTreePath *p1, GtkTreeViewColumn *c, struct search_param *search)
-{
- GtkTreePath *path;
- GtkTreeViewColumn *focus_column;
- GtkTreeIter iter;
- GtkWidget *entry_widget;
- char *str;
- int column;
-
- dbg(0,"enter\n");
- gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview), &path, &focus_column);
- gtk_tree_model_get_iter(search->liststore2, &iter, path);
- switch(search->attr.type) {
- case attr_country_all:
- entry_widget=search->entry_country;
- column=3;
- break;
- case attr_town_name:
- entry_widget=search->entry_city;
- column=2;
- break;
- case attr_street_name:
- entry_widget=search->entry_street;
- column=4;
- break;
- default:
- dbg(0,"Unknown mode\n");
- return;
- }
- gtk_tree_model_get(search->liststore2, &iter, column, &str, -1);
- dbg(0,"str=%s\n", str);
- search->partial=0;
- gtk_entry_set_text(GTK_ENTRY(entry_widget), str);
-}
-
-static void tree_view_button_release(GtkWidget *widget, GdkEventButton *event, struct search_param *search)
-{
- GtkTreePath *path;
- GtkTreeViewColumn *column;
- gtk_tree_view_get_cursor(GTK_TREE_VIEW(search->treeview), &path, &column);
- gtk_tree_view_row_activated(GTK_TREE_VIEW(search->treeview), path, column);
-
-}
-static void
-next_focus(struct search_param *search, GtkWidget *widget)
-{
- if (widget == search->entry_country)
- gtk_widget_grab_focus(search->entry_city);
- if (widget == search->entry_city)
- gtk_widget_grab_focus(search->entry_street);
- if (widget == search->entry_street)
- gtk_widget_grab_focus(search->entry_number);
-
-}
-
-static void changed(GtkWidget *widget, struct search_param *search)
-{
- struct search_list_result *res;
- GtkTreeIter iter;
-
- search->attr.u.str=(char *)gtk_entry_get_text(GTK_ENTRY(widget));
- printf("changed %s partial %d\n", search->attr.u.str, search->partial);
- if (widget == search->entry_country) {
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (search->liststore2), 3, GTK_SORT_ASCENDING);
- dbg(0,"country\n");
- search->attr.type=attr_country_all;
- set_columns(search, 0);
- }
- if (widget == search->entry_postal) {
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (search->liststore2), 1, GTK_SORT_ASCENDING);
- dbg(0,"postal\n");
- search->attr.type=attr_town_postal;
- if (strlen(search->attr.u.str) < 2)
- return;
- set_columns(search, 1);
- }
- if (widget == search->entry_city) {
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (search->liststore2), 2, GTK_SORT_ASCENDING);
- dbg(0,"town\n");
- search->attr.type=attr_town_name;
- if (strlen(search->attr.u.str) < 3)
- return;
- set_columns(search, 1);
- }
- if (widget == search->entry_street) {
- dbg(0,"street\n");
- search->attr.type=attr_street_name;
- set_columns(search, 2);
- }
-
-
- search_list_search(search->sl, &search->attr, search->partial);
- gtk_list_store_clear(search->liststore);
- while((res=search_list_get_result(search->sl))) {
- gtk_list_store_append(search->liststore,&iter);
- gtk_list_store_set(search->liststore,&iter,COL_COUNT,res->c,-1);
- if (widget == search->entry_country) {
- if (res->country) {
- gtk_list_store_set(search->liststore,&iter,0,res->country->car,-1);
- gtk_list_store_set(search->liststore,&iter,1,res->country->iso3,-1);
- gtk_list_store_set(search->liststore,&iter,2,res->country->iso2,-1);
- gtk_list_store_set(search->liststore,&iter,3,res->country->name,-1);
- }
- } else {
- if (res->country)
- gtk_list_store_set(search->liststore,&iter,0,res->country->car,-1);
- else
- gtk_list_store_set(search->liststore,&iter,0,"",-1);
- if (res->town) {
- gtk_list_store_set(search->liststore,&iter,1,res->town->postal,-1);
- gtk_list_store_set(search->liststore,&iter,2,res->town->name,-1);
- gtk_list_store_set(search->liststore,&iter,3,res->town->district,-1);
- } else {
- gtk_list_store_set(search->liststore,&iter,1,"",-1);
- gtk_list_store_set(search->liststore,&iter,2,"",-1);
- gtk_list_store_set(search->liststore,&iter,3,"",-1);
- }
- if (res->street)
- gtk_list_store_set(search->liststore,&iter,4,res->street->name,-1);
- else
- gtk_list_store_set(search->liststore,&iter,4,"",-1);
-
- }
- }
- if (! search->partial)
- next_focus(search, widget);
- search->partial=1;
-}
-
-/* borrowed from gpe-login */
-
-
-#define MAX_ARGS 8
-
-static void
-parse_xkbd_args (const char *cmd, char **argv)
-{
- const char *p = cmd;
- char buf[strlen (cmd) + 1], *bufp = buf;
- int nargs = 0;
- int escape = 0, squote = 0, dquote = 0;
-
- while (*p)
- {
- if (escape)
- {
- *bufp++ = *p;
- escape = 0;
- }
- else
- {
- switch (*p)
- {
- case '\\':
- escape = 1;
- break;
- case '"':
- if (squote)
- *bufp++ = *p;
- else
- dquote = !dquote;
- break;
- case '\'':
- if (dquote)
- *bufp++ = *p;
- else
- squote = !squote;
- break;
- case ' ':
- if (!squote && !dquote)
- {
- *bufp = 0;
- if (nargs < MAX_ARGS)
- argv[nargs++] = strdup (buf);
- bufp = buf;
- break;
- }
- default:
- *bufp++ = *p;
- break;
- }
- }
- p++;
- }
-
- if (bufp != buf)
- {
- *bufp = 0;
- if (nargs < MAX_ARGS)
- argv[nargs++] = strdup (buf);
- }
- argv[nargs] = NULL;
-}
-
-int kbd_pid;
-
-static int
-spawn_xkbd (char *xkbd_path, char *xkbd_str)
-{
-#ifdef _WIN32 // AF FIXME for WIN32
- #ifndef F_SETFD
- #define F_SETFD 2
- #endif
-#else
- char *xkbd_args[MAX_ARGS + 1];
- int fd[2];
- char buf[256];
- char c;
- int a = 0;
- size_t n;
-
- pipe (fd);
- kbd_pid = fork ();
- if (kbd_pid == 0)
- {
- close (fd[0]);
- if (dup2 (fd[1], 1) < 0)
- perror ("dup2");
- close (fd[1]);
- if (fcntl (1, F_SETFD, 0))
- perror ("fcntl");
- xkbd_args[0] = (char *)xkbd_path;
- xkbd_args[1] = "-xid";
- if (xkbd_str)
- parse_xkbd_args (xkbd_str, xkbd_args + 2);
- else
- xkbd_args[2] = NULL;
- execvp (xkbd_path, xkbd_args);
- perror (xkbd_path);
- _exit (1);
- }
- close (fd[1]);
- do {
- n = read (fd[0], &c, 1);
- if (n)
- {
- buf[a++] = c;
- }
- } while (n && (c != 10) && (a < (sizeof (buf) - 1)));
-
- if (a)
- {
- buf[a] = 0;
- return atoi (buf);
- }
-#endif
- return 0;
-}
-
-int destination_address(struct navit *nav)
-{
-
- GtkWidget *window2, *keyboard, *vbox, *table;
- GtkWidget *label_country;
- GtkWidget *label_postal, *label_city, *label_district;
- GtkWidget *label_street, *label_number;
- GtkWidget *hseparator1,*hseparator2;
- GtkWidget *button1,*button2,*button3;
- int i;
- struct search_param *search=&search_param;
- struct attr search_attr, country_name, *country_attr;
- struct tracking *tracking;
- struct country_search *cs;
- struct item *item;
-
-
- search->nav=nav;
- search->ms=navit_get_mapset(nav);
- search->sl=search_list_new(search->ms);
-
- window2 = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title(GTK_WINDOW(window2),_("Enter Destination"));
- vbox = gtk_vbox_new(FALSE, 0);
- table = gtk_table_new(3, 8, FALSE);
-
- search->entry_country = gtk_entry_new();
- label_country = gtk_label_new(_("Country"));
- search->entry_postal = gtk_entry_new();
- label_postal = gtk_label_new(_("Zip Code"));
- search->entry_city = gtk_entry_new();
- label_city = gtk_label_new(_("City"));
- search->entry_district = gtk_entry_new();
- label_district = gtk_label_new(_("District/Township"));
- hseparator1 = gtk_vseparator_new();
- search->entry_street = gtk_entry_new();
- label_street = gtk_label_new(_("Street"));
- search->entry_number = gtk_entry_new();
- label_number = gtk_label_new(_("Number"));
- search->treeview=gtk_tree_view_new();
- search->listbox = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (search->listbox),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-
- gtk_tree_view_set_model (GTK_TREE_VIEW (search->treeview), NULL);
- gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(search->listbox),search->treeview);
- {
- GType types[COL_COUNT+1];
- for(i=0;i<COL_COUNT;i++)
- types[i]=G_TYPE_STRING;
- types[i]=G_TYPE_POINTER;
- search->liststore=gtk_list_store_newv(COL_COUNT+1,types);
- search->liststore2=gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(search->liststore));
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (search->liststore2), 3, GTK_SORT_ASCENDING);
- gtk_tree_view_set_model (GTK_TREE_VIEW (search->treeview), GTK_TREE_MODEL(search->liststore2));
- }
-
-
-
-
- hseparator2 = gtk_vseparator_new();
- button1 = gtk_button_new_with_label(_("Map"));
- button2 = gtk_button_new_with_label(_("Bookmark"));
- button3 = gtk_button_new_with_label(_("Destination"));
-
- gtk_table_attach(GTK_TABLE(table), label_country, 0, 1, 0, 1, 0, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), label_postal, 1, 2, 0, 1, 0, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), label_city, 2, 3, 0, 1, 0, GTK_FILL, 0, 0);
-
- gtk_table_attach(GTK_TABLE(table), search->entry_country, 0, 1, 1, 2, 0, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), search->entry_postal, 1, 2, 1, 2, 0, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), search->entry_city, 2, 3, 1, 2, 0, GTK_FILL, 0, 0);
-
- gtk_table_attach(GTK_TABLE(table), label_district, 0, 1, 2, 3, 0, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), label_street, 1, 2, 2, 3, 0, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), label_number, 2, 3, 2, 3, 0, GTK_FILL, 0, 0);
-
- gtk_table_attach(GTK_TABLE(table), search->entry_district, 0, 1, 3, 4, 0, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), search->entry_street, 1, 2, 3, 4, 0, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), search->entry_number, 2, 3, 3, 4, 0, GTK_FILL, 0, 0);
-
- gtk_table_attach(GTK_TABLE(table), search->listbox, 0, 3, 4, 5, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0);
-
- gtk_table_attach(GTK_TABLE(table), button1, 0, 1, 5, 6, GTK_FILL, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), button2, 1, 2, 5, 6, GTK_FILL, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(table), button3, 2, 3, 5, 6, GTK_FILL, GTK_FILL, 0, 0);
-
- g_signal_connect(G_OBJECT(search->entry_country), "changed", G_CALLBACK(changed), search);
- g_signal_connect(G_OBJECT(search->entry_postal), "changed", G_CALLBACK(changed), search);
- g_signal_connect(G_OBJECT(search->entry_city), "changed", G_CALLBACK(changed), search);
- g_signal_connect(G_OBJECT(search->entry_district), "changed", G_CALLBACK(changed), search);
- g_signal_connect(G_OBJECT(search->entry_street), "changed", G_CALLBACK(changed), search);
- g_signal_connect(G_OBJECT(search->entry_number), "changed", G_CALLBACK(changed), search);
- g_signal_connect(G_OBJECT(button1), "clicked", G_CALLBACK(button_map), search);
- g_signal_connect(G_OBJECT(button2), "clicked", G_CALLBACK(button_bookmark), search);
- g_signal_connect(G_OBJECT(button3), "clicked", G_CALLBACK(button_destination), search);
- g_signal_connect(G_OBJECT(search->treeview), "button-release-event", G_CALLBACK(tree_view_button_release), search);
- g_signal_connect(G_OBJECT(search->treeview), "row_activated", G_CALLBACK(row_activated), search);
-
- gtk_widget_grab_focus(search->entry_city);
-
- gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0);
- keyboard=gtk_socket_new();
- gtk_box_pack_end(GTK_BOX(vbox), keyboard, FALSE, FALSE, 0);
- gtk_container_add(GTK_CONTAINER(window2), vbox);
-#if 0
- g_signal_connect(G_OBJECT(listbox), "select-row", G_CALLBACK(select_row), NULL);
-#endif
- gtk_widget_show_all(window2);
-
-#ifndef _WIN32
- gtk_socket_steal(GTK_SOCKET(keyboard), spawn_xkbd("xkbd","-geometry 200x100"));
-#endif
-
- country_attr=country_default();
- tracking=navit_get_tracking(nav);
- if (tracking && tracking_get_current_attr(tracking, attr_country_id, &search_attr))
- country_attr=&search_attr;
- if (country_attr) {
- cs=country_search_new(country_attr, 0);
- item=country_search_get_item(cs);
- if (item && item_attr_get(item, attr_country_name, &country_name))
- gtk_entry_set_text(GTK_ENTRY(search->entry_country), country_name.u.str);
- country_search_destroy(cs);
- } else {
- dbg(0,"warning: no default country found\n");
- }
- search->partial=1;
- return 0;
-}
diff --git a/navit/gui/gtk/gui_gtk.h b/navit/gui/gtk/gui_gtk.h
deleted file mode 100644
index ddf8e7f2..00000000
--- a/navit/gui/gtk/gui_gtk.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#include "coord.h"
-
-struct menu_methods;
-struct datawindow_methods;
-struct navit;
-struct callback;
-struct statusbar_priv;
-
-struct gui_priv {
- struct navit *nav;
- GtkWidget *win;
- GtkWidget *dialog_win;
- GtkWidget *dialog_entry;
- struct pcoord dialog_coord;
- GtkWidget *vbox;
- GtkWidget *menubar;
- GtkActionGroup *base_group;
- GtkActionGroup *debug_group;
- GtkActionGroup *dyn_group;
- GtkUIManager *ui_manager;
- GSList *layout_group;
- GSList *projection_group;
- GSList *vehicle_group;
- GtkUIManager *menu_manager; // old
- struct statusbar_priv *statusbar;
- int menubar_enable;
- int toolbar_enable;
- int statusbar_enable;
- int dyn_counter;
-};
-
-void gui_gtk_ui_init(struct gui_priv *this);
-struct menu_priv *gui_gtk_menubar_new(struct gui_priv *gui, struct menu_methods *meth);
-struct statusbar_priv *gui_gtk_statusbar_new(struct gui_priv *gui);
-struct menu_priv *gui_gtk_popup_new(struct gui_priv *gui, struct menu_methods *meth);
-struct datawindow_priv *gui_gtk_datawindow_new(struct gui_priv *gui, char *name, struct callback *click, struct callback *close, struct datawindow_methods *meth);
diff --git a/navit/gui/gtk/gui_gtk_action.c b/navit/gui/gtk/gui_gtk_action.c
deleted file mode 100644
index 3feb08ca..00000000
--- a/navit/gui/gtk/gui_gtk_action.c
+++ /dev/null
@@ -1,569 +0,0 @@
-#include <string.h>
-#include <gtk/gtk.h>
-#include "navit.h"
-#include "gui_gtk.h"
-#include "menu.h"
-#include "coord.h"
-#include "item.h"
-#include "attr.h"
-#include "callback.h"
-#include "debug.h"
-#include "destination.h"
-
-#define gettext_noop(String) String
-#define _(STRING) gettext(STRING)
-#define _n(STRING) gettext_noop(STRING)
-
-struct menu_priv {
- char *path;
- GtkAction *action;
- struct gui_priv *gui;
- enum menu_type type;
- struct callback *cb;
- struct menu_priv *child;
- struct menu_priv *sibling;
- gulong handler_id;
- guint merge_id;
- GtkWidget *widget;
-};
-
-/* Create callbacks that implement our Actions */
-
-static void
-zoom_in_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- navit_zoom_in(gui->nav, 2, NULL);
-}
-
-static void
-zoom_out_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- navit_zoom_out(gui->nav, 2, NULL);
-}
-
-static void
-refresh_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- navit_draw(gui->nav);
-}
-
-static void
-roadbook_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- navit_window_roadbook_new(gui->nav);
-}
-
-static void
-cursor_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- struct attr attr;
-
- attr.type=attr_cursor;
- attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
- if(!navit_set_attr(gui->nav, &attr)) {
- dbg(0, "Failed to set attr_cursor\n");
- }
-}
-
-static void
-tracking_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- struct attr attr;
-
- attr.type=attr_tracking;
- attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
- if(!navit_set_attr(gui->nav, &attr)) {
- dbg(0, "Failed to set attr_tracking\n");
- }
-}
-
-static void
-orient_north_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- struct attr attr;
-
- attr.type=attr_orientation;
- attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
- if(!navit_set_attr(gui->nav, &attr)) {
- dbg(0, "Failed to set attr_orientation\n");
- }
-}
-
-static void
-window_fullscreen_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- if(gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w)))
- gtk_window_fullscreen(GTK_WINDOW(gui->win));
- else
- gtk_window_unfullscreen(GTK_WINDOW(gui->win));
-}
-
-#include <stdlib.h>
-#include "point.h"
-#include "transform.h"
-
-static void
-info_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- char buffer[512];
- int mw,mh;
- struct coord lt, rb;
- struct point p;
- struct transformation *t;
-
- t=navit_get_trans(gui->nav);
- transform_get_size(t, &mw, &mh);
- p.x=0;
- p.y=0;
- transform_reverse(t, &p, &lt);
- p.x=mw;
- p.y=mh;
- transform_reverse(t, &p, &rb);
-
- sprintf(buffer,"./info.sh %d,%d 0x%x,0x%x 0x%x,0x%x", mw, mh, lt.x, lt.y, rb.x, rb.y);
- system(buffer);
-
-}
-
-
-static void
-route_clear_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- navit_set_destination(gui->nav, NULL, NULL);
-}
-
-static void
-destination_action(GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- destination_address(gui->nav);
-}
-
-static void
-quit_action (GtkWidget *w, struct gui_priv *gui, void *dummy)
-{
- navit_destroy(gui->nav);
-}
-
-static GtkActionEntry entries[] =
-{
- { "DisplayMenuAction", NULL, _n("Display") },
- { "RouteMenuAction", NULL, _n("Route") },
- { "FormerDestinationMenuAction", NULL, _n("Former Destinations") },
- { "BookmarkMenuAction", NULL, _n("Bookmarks") },
- { "MapMenuAction", NULL, _n("Map") },
- { "LayoutMenuAction", NULL, _n("Layout") },
- { "ProjectionMenuAction", NULL, _n("Projection") },
- { "VehicleMenuAction", NULL, _n("Vehicle") },
- { "ZoomOutAction", GTK_STOCK_ZOOM_OUT, _n("ZoomOut"), NULL, NULL, G_CALLBACK(zoom_out_action) },
- { "ZoomInAction", GTK_STOCK_ZOOM_IN, _n("ZoomIn"), NULL, NULL, G_CALLBACK(zoom_in_action) },
- { "RefreshAction", GTK_STOCK_REFRESH, _n("Refresh"), NULL, NULL, G_CALLBACK(refresh_action) },
- { "RoadbookAction", GTK_STOCK_JUSTIFY_FILL, _n("Roadbook"), NULL, NULL, G_CALLBACK(roadbook_action) },
-#ifdef GTK_STOCK_INFO
- { "InfoAction", GTK_STOCK_INFO, _n("Info"), NULL, NULL, G_CALLBACK(info_action) },
-#else
- { "InfoAction", NULL, _n("Info"), NULL, NULL, G_CALLBACK(info_action) },
-#endif /*GTK_STOCK_INFO*/
- { "DestinationAction", "flag_icon", _n("Destination"), NULL, NULL, G_CALLBACK(destination_action) },
- { "RouteClearAction", NULL, _n("Clear"), NULL, NULL, G_CALLBACK(route_clear_action) },
- { "Test", NULL, _n("Test"), NULL, NULL, G_CALLBACK(destination_action) },
- { "QuitAction", GTK_STOCK_QUIT, _n("_Quit"), "<control>Q",NULL, G_CALLBACK (quit_action) }
-};
-
-static guint n_entries = G_N_ELEMENTS (entries);
-
-static GtkToggleActionEntry toggleentries[] =
-{
- { "CursorAction", "cursor_icon",_n("Cursor"), NULL, NULL, G_CALLBACK(cursor_action),TRUE },
- { "TrackingAction", NULL ,_n("Tracking"), NULL, NULL, G_CALLBACK(tracking_action),TRUE },
- { "OrientationAction", "orientation_icon", _n("Orientation"), NULL, NULL, G_CALLBACK(orient_north_action),FALSE },
-#ifdef GTK_STOCK_FULLSCREEN
- { "FullscreenAction",GTK_STOCK_FULLSCREEN, _n("Fullscreen"), NULL, NULL, G_CALLBACK(window_fullscreen_action), FALSE }
-#else
- { "FullscreenAction", NULL, _n("Fullscreen"), NULL, NULL, G_CALLBACK(window_fullscreen_action), FALSE }
-#endif /*GTK_STOCK_FULLSCREEN*/
-};
-
-static guint n_toggleentries = G_N_ELEMENTS (toggleentries);
-
-static GtkActionEntry debug_entries[] =
-{
- { "DataMenuAction", NULL, _n("Data") },
-};
-
-static guint n_debug_entries = G_N_ELEMENTS (debug_entries);
-
-
-static const char * cursor_xpm[] = {
-"22 22 2 1",
-" c None",
-". c #0000FF",
-" ",
-" ",
-" ",
-" .. ",
-" .. .. ",
-" .. .. ",
-" . . ",
-" . . ",
-" . ... . ",
-" . ... . . ",
-" . ... . . ",
-" . .. . . ",
-" . . . ",
-" . . . ",
-" . . . ",
-" . . . ",
-" .. .. ",
-" .. .. ",
-" .. ",
-" ",
-" ",
-" "};
-
-
-static const char * north_xpm[] = {
-"22 22 2 1",
-" c None",
-". c #000000",
-" ",
-" ",
-" . ",
-" ... ",
-" . . . ",
-" . . . ",
-" . ",
-" .... . .... ",
-" .... . .... ",
-" .... . .. ",
-" .. .. .. ",
-" .. .. .. ",
-" .. .. .. ",
-" .. .. .. ",
-" .. . .... ",
-" .... . .... ",
-" .... . .... ",
-" . ",
-" . ",
-" . ",
-" ",
-" "};
-
-
-static const char * flag_xpm[] = {
-"22 22 2 1",
-" c None",
-"+ c #000000",
-"+++++++ ",
-"+ +++++++++ ",
-"+ +++ +++++++++ ",
-"+ +++ +++ +++ ",
-"++++ +++ +++ ",
-"++++ +++ +++ ",
-"++++ +++ +++ + ",
-"+ ++++++ +++ + ",
-"+ +++ ++++++ + ",
-"+ +++ +++ +++ ",
-"++++ +++ +++ ",
-"++++ +++ +++ ",
-"++++++++++ +++ + ",
-"+ +++++++++ + ",
-"+ ++++++ ",
-"+ ",
-"+ ",
-"+ ",
-"+ ",
-"+ ",
-"+ ",
-"+ "};
-
-
-
-static struct {
- gchar *stockid;
- const char **icon_xpm;
-} stock_icons[] = {
- {"cursor_icon", cursor_xpm },
- {"orientation_icon", north_xpm },
- {"flag_icon", flag_xpm }
-};
-
-
-static gint n_stock_icons = G_N_ELEMENTS (stock_icons);
-
-
-static void
-register_my_stock_icons (void)
-{
- GtkIconFactory *icon_factory;
- GtkIconSet *icon_set;
- GdkPixbuf *pixbuf;
- gint i;
-
- icon_factory = gtk_icon_factory_new ();
-
- for (i = 0; i < n_stock_icons; i++)
- {
- pixbuf = gdk_pixbuf_new_from_xpm_data(stock_icons[i].icon_xpm);
- icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
- g_object_unref(pixbuf);
- gtk_icon_factory_add (icon_factory, stock_icons[i].stockid, icon_set);
- gtk_icon_set_unref (icon_set);
- }
-
- gtk_icon_factory_add_default(icon_factory);
-
- g_object_unref(icon_factory);
-}
-
-
-static char layout[] =
- "<ui>\
- <menubar name=\"MenuBar\">\
- <menu name=\"Display\" action=\"DisplayMenuAction\">\
- <menuitem name=\"Zoom in\" action=\"ZoomInAction\" />\
- <menuitem name=\"Zoom out\" action=\"ZoomOutAction\" />\
- <menuitem name=\"Cursor\" action=\"CursorAction\"/>\
- <menuitem name=\"Tracking\" action=\"TrackingAction\"/>\
- <menuitem name=\"Orientation\" action=\"OrientationAction\"/>\
- <menuitem name=\"Roadbook\" action=\"RoadbookAction\"/>\
- <menuitem name=\"Fullscreen\" action=\"FullscreenAction\"/>\
- <menuitem name=\"Quit\" action=\"QuitAction\" />\
- <placeholder name=\"RouteMenuAdditions\" />\
- </menu>\
- <menu name=\"Data\" action=\"DataMenuAction\">\
- <placeholder name=\"DataMenuAdditions\" />\
- </menu>\
- <menu name=\"Route\" action=\"RouteMenuAction\">\
- <menuitem name=\"Refresh\" action=\"RefreshAction\" />\
- <menuitem name=\"Destination\" action=\"DestinationAction\" />\
- <menuitem name=\"Clear\" action=\"RouteClearAction\" />\
- <menu name=\"FormerDestinations\" action=\"FormerDestinationMenuAction\">\
- <placeholder name=\"FormerDestinationMenuAdditions\" />\
- </menu>\
- <menu name=\"Bookmarks\" action=\"BookmarkMenuAction\">\
- <placeholder name=\"BookmarkMenuAdditions\" />\
- </menu>\
- <placeholder name=\"RouteMenuAdditions\" />\
- </menu>\
- <menu name=\"Map\" action=\"MapMenuAction\">\
- <menu name=\"Layout\" action=\"LayoutMenuAction\">\
- <placeholder name=\"LayoutMenuAdditions\" />\
- </menu>\
- <menu name=\"Projection\" action=\"ProjectionMenuAction\">\
- <placeholder name=\"ProjectionMenuAdditions\" />\
- </menu>\
- <menu name=\"Vehicle\" action=\"VehicleMenuAction\">\
- <placeholder name=\"VehicleMenuAdditions\" />\
- </menu>\
- <placeholder name=\"MapMenuAdditions\" />\
- </menu>\
- </menubar>\
- <toolbar name=\"ToolBar\" action=\"BaseToolbar\" action=\"BaseToolbarAction\">\
- <placeholder name=\"ToolItems\">\
- <separator/>\
- <toolitem name=\"Zoom in\" action=\"ZoomInAction\"/>\
- <toolitem name=\"Zoom out\" action=\"ZoomOutAction\"/>\
- <toolitem name=\"Refresh\" action=\"RefreshAction\"/>\
- <toolitem name=\"Cursor\" action=\"CursorAction\"/>\
- <toolitem name=\"Orientation\" action=\"OrientationAction\"/>\
- <toolitem name=\"Destination\" action=\"DestinationAction\"/>\
- <!-- <toolitem name=\"Info\" action=\"InfoAction\"/> -->\
- <toolitem name=\"Roadbook\" action=\"RoadbookAction\"/>\
- <toolitem name=\"Quit\" action=\"QuitAction\"/>\
- <separator/>\
- </placeholder>\
- </toolbar>\
- <popup name=\"PopUp\">\
- </popup>\
- </ui>";
-
-
-static void
-activate(void *dummy, struct menu_priv *menu)
-{
- if (menu->cb)
- callback_call_0(menu->cb);
-}
-
-static struct menu_methods menu_methods;
-
-static struct menu_priv *
-add_menu(struct menu_priv *menu, struct menu_methods *meth, char *name, enum menu_type type, struct callback *cb)
-{
- struct menu_priv *ret;
- char *dynname;
-
- ret=g_new0(struct menu_priv, 1);
- *meth=menu_methods;
- if (! strcmp(menu->path, "/ui/MenuBar") && !strcmp(name,"Route")) {
- dynname=g_strdup("Route");
- } else if (! strcmp(menu->path, "/ui/MenuBar") && !strcmp(name,"Data")) {
- dynname=g_strdup("Data");
- } else {
- dynname=g_strdup_printf("%d", menu->gui->dyn_counter++);
- if (type == menu_type_toggle)
- ret->action=GTK_ACTION(gtk_toggle_action_new(dynname, name, NULL, NULL));
- else
- ret->action=gtk_action_new(dynname, name, NULL, NULL);
- if (cb)
- ret->handler_id=g_signal_connect(ret->action, "activate", G_CALLBACK(activate), ret);
- gtk_action_group_add_action(menu->gui->dyn_group, ret->action);
- ret->merge_id=gtk_ui_manager_new_merge_id(menu->gui->ui_manager);
- gtk_ui_manager_add_ui( menu->gui->ui_manager, ret->merge_id, menu->path, dynname, dynname, type == menu_type_submenu ? GTK_UI_MANAGER_MENU : GTK_UI_MANAGER_MENUITEM, FALSE);
- }
- ret->gui=menu->gui;
- ret->path=g_strdup_printf("%s/%s", menu->path, dynname);
- ret->type=type;
- ret->cb=cb;
- ret->sibling=menu->child;
- menu->child=ret;
- g_free(dynname);
- return ret;
-
-}
-
-static void
-remove_menu(struct menu_priv *item, int recursive)
-{
-
- if (recursive) {
- struct menu_priv *next,*child=item->child;
- while (child) {
- next=child->sibling;
- remove_menu(child, recursive);
- child=next;
- }
- }
- if (item->action) {
- gtk_ui_manager_remove_ui(item->gui->ui_manager, item->merge_id);
- gtk_action_group_remove_action(item->gui->dyn_group, item->action);
-#if 0
- if (item->callback)
- g_signal_handler_disconnect(item->action, item->handler_id);
-#endif
- g_object_unref(item->action);
- }
- g_free(item->path);
- g_free(item);
-}
-
-static void
-set_toggle(struct menu_priv *menu, int active)
-{
- gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(menu->action), active);
-}
-
-static int
-get_toggle(struct menu_priv *menu)
-{
- return gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(menu->action));
-}
-
-static struct menu_methods menu_methods = {
-#if 1
- add_menu,
- set_toggle,
- get_toggle,
-#else
- NULL,
- NULL,
- NULL
-#endif
-};
-
-
-static void
-popup_deactivate(GtkWidget *widget, struct menu_priv *menu)
-{
- g_signal_handler_disconnect(widget, menu->handler_id);
- remove_menu(menu, 1);
-}
-
-static void
-popup_activate(struct menu_priv *menu)
-{
-#ifdef _WIN32
- menu->widget=gtk_ui_manager_get_widget(menu->gui->ui_manager, menu->path );
-#endif
- gtk_menu_popup(GTK_MENU(menu->widget), NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time ());
- menu->handler_id=g_signal_connect(menu->widget, "selection-done", G_CALLBACK(popup_deactivate), menu);
-}
-
-void
-gui_gtk_ui_init(struct gui_priv *this)
-{
- GError *error = NULL;
- struct attr attr;
- GtkToggleAction *toggle_action;
-
- this->base_group = gtk_action_group_new ("BaseActions");
- this->debug_group = gtk_action_group_new ("DebugActions");
- this->dyn_group = gtk_action_group_new ("DynamicActions");
- register_my_stock_icons();
- this->ui_manager = gtk_ui_manager_new ();
- gtk_action_group_set_translation_domain(this->base_group,"navit");
- gtk_action_group_set_translation_domain(this->debug_group,"navit");
- gtk_action_group_set_translation_domain(this->dyn_group,"navit");
- gtk_action_group_add_actions (this->base_group, entries, n_entries, this);
- gtk_action_group_add_toggle_actions (this->base_group, toggleentries, n_toggleentries, this);
- gtk_ui_manager_insert_action_group (this->ui_manager, this->base_group, 0);
- gtk_action_group_add_actions (this->debug_group, debug_entries, n_debug_entries, this);
- gtk_ui_manager_insert_action_group (this->ui_manager, this->debug_group, 0);
- gtk_ui_manager_add_ui_from_string (this->ui_manager, layout, strlen(layout), &error);
- gtk_ui_manager_insert_action_group (this->ui_manager, this->dyn_group, 0);
- if (error) {
- g_message ("building menus failed: %s", error->message);
- g_error_free (error);
- }
- if (navit_get_attr(this->nav, attr_cursor, &attr, NULL)) {
- toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "CursorAction"));
- gtk_toggle_action_set_active(toggle_action, attr.u.num);
- }
- if (navit_get_attr(this->nav, attr_orientation, &attr, NULL)) {
- toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "OrientationAction"));
- gtk_toggle_action_set_active(toggle_action, attr.u.num);
- }
- if (navit_get_attr(this->nav, attr_tracking, &attr, NULL)) {
- toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "TrackingAction"));
- gtk_toggle_action_set_active(toggle_action, attr.u.num);
- }
-}
-
-static struct menu_priv *
-gui_gtk_ui_new (struct gui_priv *this, struct menu_methods *meth, char *path, int popup, GtkWidget **widget_ret)
-{
- struct menu_priv *ret;
- GtkWidget *widget;
-
- *meth=menu_methods;
- ret=g_new0(struct menu_priv, 1);
- ret->path=g_strdup(path);
- ret->gui=this;
-
- widget=gtk_ui_manager_get_widget(this->ui_manager, path);
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS);
- if (widget_ret)
- *widget_ret=widget;
- if (! popup) {
- gtk_box_pack_start (GTK_BOX(this->vbox), widget, FALSE, FALSE, 0);
- gtk_widget_show (widget);
- } else {
- ret->widget=widget;
- meth->popup=popup_activate;
- }
- return ret;
-}
-
-#if 0
-struct menu_priv *
-gui_gtk_menubar_new(struct gui_priv *this, struct menu_methods *meth)
-{
- return gui_gtk_ui_new(this, meth, "/ui/MenuBar", 0, &this->menubar);
-}
-#endif
-
-struct menu_priv *
-gui_gtk_popup_new(struct gui_priv *this, struct menu_methods *meth)
-{
- return gui_gtk_ui_new(this, meth, "/ui/PopUp", 1, NULL);
-}
diff --git a/navit/gui/gtk/gui_gtk_statusbar.c b/navit/gui/gtk/gui_gtk_statusbar.c
deleted file mode 100644
index f029e084..00000000
--- a/navit/gui/gtk/gui_gtk_statusbar.c
+++ /dev/null
@@ -1,162 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <math.h>
-#include <gtk/gtk.h>
-#include <libintl.h>
-#include "item.h"
-#include "coord.h"
-#include "debug.h"
-#include "vehicle.h"
-#include "callback.h"
-#include "route.h"
-#include "transform.h"
-#include "navit.h"
-#include "map.h"
-#include "navigation.h"
-#include "gui_gtk.h"
-
-
-#define _(STRING) gettext(STRING)
-
-struct statusbar_priv {
- struct gui_priv *gui;
- GtkWidget *hbox;
- char gps_text[128];
- GtkWidget *gps;
- char route_text[128];
- GtkWidget *route;
- struct callback *vehicle_cb;
-};
-
-
-
-
-static void
-statusbar_destroy(struct statusbar_priv *this)
-{
- g_free(this);
-}
-
-static void
-statusbar_gps_update(struct statusbar_priv *this, int sats, int qual, double lng, double lat, double height, double direction, double speed)
-{
- char lat_c='N';
- char lng_c='E';
- char *dirs[]={_("N"),_("NE"),_("E"),_("SE"),_("S"),_("SW"),_("W"),_("NW"),_("N")};
- char *dir;
- int dir_idx;
-
- if (lng < 0) {
- lng=-lng;
- lng_c='W';
- }
- if (lat < 0) {
- lat=-lat;
- lat_c='S';
- }
- dir_idx=(direction+22.5)/45;
- dir=dirs[dir_idx];
- sprintf(this->gps_text, "GPS %2d/%1d %02.0f%07.4f%c %03.0f%07.4f%c %4.0fm %3.0f°%-2s %3.0fkm/h", sats, qual, floor(lat), fmod(lat*60,60), lat_c, floor(lng), fmod(lng*60,60), lng_c, height, direction, dir, speed);
- gtk_label_set_text(GTK_LABEL(this->gps), this->gps_text);
-
-}
-
-static void
-statusbar_route_update(struct statusbar_priv *this, struct navit *navit, struct vehicle *v)
-{
- struct navigation *nav=NULL;
- struct map *map=NULL;
- struct map_rect *mr=NULL;
- struct item *item=NULL;
- struct attr attr;
- double route_len=0;
- time_t eta;
- struct tm *eta_tm=NULL;
- char buffer[128];
- double lng, lat, direction=0, height=0, speed=0;
- int sats=0, qual=0;
- char lat_c='N';
- char lng_c='E';
- char *dirs[]={_("N"),_("NE"),_("E"),_("SE"),_("S"),_("SW"),_("W"),_("NW"),_("N")};
- char *dir;
- int dir_idx;
-
- if (navit)
- nav=navit_get_navigation(navit);
- if (nav)
- map=navigation_get_map(nav);
- if (map)
- mr=map_rect_new(map, NULL);
- if (mr)
- item=map_rect_get_item(mr);
- if (item) {
- if (item_attr_get(item, attr_destination_length, &attr))
- route_len=attr.u.num;
- if (item_attr_get(item, attr_destination_time, &attr)) {
- eta=time(NULL)+attr.u.num/10;
- eta_tm=localtime(&eta);
- }
- }
- if (mr)
- map_rect_destroy(mr);
- sprintf(buffer,_("Route %4.0fkm %02d:%02d ETA" ),route_len/1000, eta_tm ? eta_tm->tm_hour : 0 , eta_tm ? eta_tm->tm_min : 0);
- if (strcmp(buffer, this->route_text)) {
- strcpy(this->route_text, buffer);
- gtk_label_set_text(GTK_LABEL(this->route), this->route_text);
- }
- if (!vehicle_get_attr(v, attr_position_coord_geo, &attr))
- return;
- lng=attr.u.coord_geo->lng;
- lat=attr.u.coord_geo->lat;
- if (lng < 0) {
- lng=-lng;
- lng_c='W';
- }
- if (lat < 0) {
- lat=-lat;
- lat_c='S';
- }
- if (vehicle_get_attr(v, attr_position_direction, &attr))
- direction=*(attr.u.numd);
- direction=fmod(direction,360);
- if (direction < 0)
- direction+=360;
- dir_idx=(direction+22.5)/45;
- dir=dirs[dir_idx];
- if (vehicle_get_attr(v, attr_position_height, &attr))
- height=*(attr.u.numd);
- if (vehicle_get_attr(v, attr_position_speed, &attr))
- speed=*(attr.u.numd);
- if (vehicle_get_attr(v, attr_position_sats_used, &attr))
- sats=attr.u.num;
- if (vehicle_get_attr(v, attr_position_qual, &attr))
- qual=attr.u.num;
- sprintf(this->gps_text,"GPS %2d/%1d %02.0f%07.4f%c %03.0f%07.4f%c %4.0fm %3.0f°%-2s %3.0fkm/h", sats, qual, floor(lat), fmod(lat*60,60), lat_c, floor(lng), fmod(lng*60,60), lng_c, height, direction, dir, speed);
- gtk_label_set_text(GTK_LABEL(this->gps), this->gps_text);
-}
-
-struct statusbar_priv *
-gui_gtk_statusbar_new(struct gui_priv *gui)
-{
- struct statusbar_priv *this=g_new0(struct statusbar_priv, 1);
-
- this->gui=gui;
- this->hbox=gtk_hbox_new(FALSE, 1);
- this->gps=gtk_label_new( "GPS 00/0 0000.0000N 00000.0000E 0000m 000°NO 000km/h" );
- gtk_label_set_justify(GTK_LABEL(this->gps), GTK_JUSTIFY_LEFT);
- this->route=gtk_label_new( _( "Route 0000km 0+00:00 ETA" ) );
- gtk_label_set_justify(GTK_LABEL(this->route), GTK_JUSTIFY_LEFT);
- gtk_box_pack_start(GTK_BOX(this->hbox), this->gps, TRUE, TRUE, 2);
- gtk_box_pack_start(GTK_BOX(this->hbox), gtk_vseparator_new(), TRUE, TRUE, 2);
- gtk_box_pack_start(GTK_BOX(this->hbox), this->route, TRUE, TRUE, 2);
- GTK_WIDGET_UNSET_FLAGS (this->hbox, GTK_CAN_FOCUS);
-
- gtk_box_pack_end(GTK_BOX(gui->vbox), this->hbox, FALSE, FALSE, 0);
- gtk_widget_show_all(this->hbox);
- /* add a callback for position updates */
- this->vehicle_cb=callback_new_attr_1(callback_cast(statusbar_route_update), attr_position_coord_geo, this);
- navit_add_callback(gui->nav, this->vehicle_cb);
- return this;
-}
-
diff --git a/navit/gui/gtk/gui_gtk_window.c b/navit/gui/gtk/gui_gtk_window.c
deleted file mode 100644
index 2cda180f..00000000
--- a/navit/gui/gtk/gui_gtk_window.c
+++ /dev/null
@@ -1,564 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <gdk/gdkkeysyms.h>
-#if !defined(GDK_Book) || !defined(GDK_Calendar)
-#include <X11/XF86keysym.h>
-#endif
-#include <libintl.h>
-#include <gtk/gtk.h>
-#include "config.h"
-#include "item.h"
-#include "navit.h"
-#include "debug.h"
-#include "gui.h"
-#include "coord.h"
-#include "point.h"
-#include "plugin.h"
-#include "graphics.h"
-#include "gui_gtk.h"
-#include "transform.h"
-#include "config.h"
-#include "callback.h"
-#include "layout.h"
-#include "vehicle.h"
-#include "map.h"
-#include "coord.h"
-
-#ifdef USE_HILDON
-#include "hildon-widgets/hildon-defines.h"
-#define KEY_ZOOM_IN HILDON_HARDKEY_INCREASE
-#define KEY_ZOOM_OUT HILDON_HARDKEY_DECREASE
-#define KEY_UP HILDON_HARDKEY_UP
-#define KEY_DOWN HILDON_HARDKEY_DOWN
-#define KEY_LEFT HILDON_HARDKEY_LEFT
-#define KEY_RIGHT HILDON_HARDKEY_RIGHT
-#else
-#ifndef GDK_Book
-#define GDK_Book XF86XK_Book
-#endif
-#ifndef GDK_Calendar
-#define GDK_Calendar XF86XK_Calendar
-#endif
-#define KEY_ZOOM_IN GDK_Book
-#define KEY_ZOOM_OUT GDK_Calendar
-#define KEY_UP GDK_Up
-#define KEY_DOWN GDK_Down
-#define KEY_LEFT GDK_Left
-#define KEY_RIGHT GDK_Right
-#endif
-
-#define _(text) gettext(text)
-
-static gboolean
-keypress(GtkWidget *widget, GdkEventKey *event, struct gui_priv *this)
-{
- int w,h;
- #ifdef USE_HILDON
- GtkToggleAction *action;
- gboolean *fullscreen;
- #endif /*HILDON*/
- struct point p;
- if (event->type != GDK_KEY_PRESS)
- return FALSE;
- dbg(1,"keypress 0x%x\n", event->keyval);
- transform_get_size(navit_get_trans(this->nav), &w, &h);
- switch (event->keyval) {
- case GDK_KP_Enter:
- gtk_menu_shell_select_first(GTK_MENU_SHELL(this->menubar), TRUE);
- break;
- case KEY_UP:
- p.x=w/2;
- p.y=0;
- navit_set_center_screen(this->nav, &p);
- break;
- case KEY_DOWN:
- p.x=w/2;
- p.y=h;
- navit_set_center_screen(this->nav, &p);
- break;
- case KEY_LEFT:
- p.x=0;
- p.y=h/2;
- navit_set_center_screen(this->nav, &p);
- break;
- case KEY_RIGHT:
- p.x=w;
- p.y=h/2;
- navit_set_center_screen(this->nav, &p);
- break;
- case KEY_ZOOM_IN:
- navit_zoom_in(this->nav, 2, NULL);
- break;
- case KEY_ZOOM_OUT:
- navit_zoom_out(this->nav, 2, NULL);
- break;
- #ifdef USE_HILDON
- case HILDON_HARDKEY_FULLSCREEN:
- action = GTK_TOGGLE_ACTION (gtk_action_group_get_action (this->base_group, "FullscreenAction"));
-
- if ( gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)))
- {
- fullscreen = 0;
- } else {
- fullscreen = 1;
- }
- gtk_toggle_action_set_active (action, fullscreen);
- break;
- #endif /*HILDON*/
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-static int
-gui_gtk_set_graphics(struct gui_priv *this, struct graphics *gra)
-{
- GtkWidget *graphics;
-
- graphics=graphics_get_data(gra, "gtk_widget");
- if (! graphics)
- return 1;
- GTK_WIDGET_SET_FLAGS (graphics, GTK_CAN_FOCUS);
- gtk_widget_set_sensitive(graphics, TRUE);
- g_signal_connect(G_OBJECT(graphics), "key-press-event", G_CALLBACK(keypress), this);
- gtk_box_pack_end(GTK_BOX(this->vbox), graphics, TRUE, TRUE, 0);
- gtk_widget_show_all(graphics);
- gtk_widget_grab_focus(graphics);
-
- return 0;
-}
-
-static void
-gui_gtk_add_bookmark_do(struct gui_priv *gui)
-{
- navit_add_bookmark(gui->nav, &gui->dialog_coord, gtk_entry_get_text(GTK_ENTRY(gui->dialog_entry)));
- gtk_widget_destroy(gui->dialog_win);
-}
-
-static int
-gui_gtk_add_bookmark(struct gui_priv *gui, struct pcoord *c, char *description)
-{
- GtkWidget *button_ok,*button_cancel,*label,*vbox,*hbox;
-
- gui->dialog_coord=*c;
- gui->dialog_win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
- vbox=gtk_vbox_new(FALSE, 0);
- gtk_container_add (GTK_CONTAINER (gui->dialog_win), vbox);
- gtk_window_set_title(GTK_WINDOW(gui->dialog_win),_("Add Bookmark"));
- gtk_window_set_transient_for(GTK_WINDOW(gui->dialog_win), GTK_WINDOW(gui->win));
- gtk_window_set_modal(GTK_WINDOW(gui->dialog_win), TRUE);
- label=gtk_label_new(_("Name"));
- gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
- gui->dialog_entry=gtk_entry_new();
- gtk_entry_set_text(GTK_ENTRY(gui->dialog_entry), description);
- gtk_box_pack_start(GTK_BOX(vbox), gui->dialog_entry, TRUE, TRUE, 0);
- hbox=gtk_hbox_new(FALSE, 0);
- button_ok = gtk_button_new_from_stock (GTK_STOCK_OK);
- gtk_box_pack_start(GTK_BOX(hbox), button_ok, TRUE, TRUE, 10);
- button_cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
- gtk_box_pack_start(GTK_BOX(hbox), button_cancel, TRUE, TRUE, 10);
- gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 10);
- gtk_widget_show_all(gui->dialog_win);
- GTK_WIDGET_SET_FLAGS (button_ok, GTK_CAN_DEFAULT);
- gtk_widget_grab_default(button_ok);
- g_signal_connect_swapped (G_OBJECT (button_cancel), "clicked", G_CALLBACK (gtk_widget_destroy), G_OBJECT (gui->dialog_win));
- g_signal_connect_swapped (G_OBJECT (gui->dialog_entry), "activate", G_CALLBACK (gui_gtk_add_bookmark_do), gui);
-
- g_signal_connect_swapped(G_OBJECT (button_ok), "clicked", G_CALLBACK (gui_gtk_add_bookmark_do), gui);
-
- return 1;
-}
-
-struct gui_methods gui_gtk_methods = {
- NULL,
- gui_gtk_popup_new,
- gui_gtk_set_graphics,
- NULL,
- gui_gtk_datawindow_new,
- gui_gtk_add_bookmark,
-};
-
-static gboolean
-gui_gtk_delete(GtkWidget *widget, GdkEvent *event, struct navit *nav)
-{
- /* FIXME remove attr_navit callback */
- navit_destroy(nav);
-
- return TRUE;
-}
-
-static void
-gui_gtk_toggle_init(struct gui_priv *this)
-{
- struct attr attr;
- GtkToggleAction *toggle_action;
-
- if (navit_get_attr(this->nav, attr_cursor, &attr, NULL)) {
- toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "CursorAction"));
- gtk_toggle_action_set_active(toggle_action, attr.u.num);
- } else {
- dbg(0, "Unable to locate CursorAction\n");
- }
- if (navit_get_attr(this->nav, attr_orientation, &attr, NULL)) {
- toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "OrientationAction"));
- gtk_toggle_action_set_active(toggle_action, attr.u.num);
- } else {
- dbg(0, "Unable to locate OrientationAction\n");
- }
- if (navit_get_attr(this->nav, attr_tracking, &attr, NULL)) {
- toggle_action = GTK_TOGGLE_ACTION(gtk_action_group_get_action(this->base_group, "TrackingAction"));
- gtk_toggle_action_set_active(toggle_action, attr.u.num);
- } else {
- dbg(0, "Unable to locate TrackingAction\n");
- }
-}
-
-struct action_cb_data {
- struct gui_priv *gui;
- struct attr attr;
-};
-
-static void
-gui_gtk_action_activate(GtkAction *action, struct action_cb_data *data)
-{
- if(data->attr.type == attr_destination) {
- char * label;
- g_object_get(G_OBJECT(action), "label", &label,NULL);
- navit_set_destination(data->gui->nav, data->attr.u.pcoord, label);
- g_free(label);
- }
-}
-static void
-gui_gtk_add_menu(struct gui_priv *this, char *name, char *label, char *path, int submenu, struct action_cb_data *data)
-{
- GtkAction *action;
- guint merge_id;
-
- action=gtk_action_new(name, label, NULL, NULL);
- if (data)
- g_signal_connect(action, "activate", G_CALLBACK(gui_gtk_action_activate), data);
- gtk_action_group_add_action(this->dyn_group, action);
- merge_id=gtk_ui_manager_new_merge_id(this->ui_manager);
- gtk_ui_manager_add_ui(this->ui_manager, merge_id, path, name, name, submenu ? GTK_UI_MANAGER_MENU : GTK_UI_MANAGER_MENUITEM, FALSE);
-}
-
-static void
-gui_gtk_action_toggled(GtkToggleAction *action, struct action_cb_data *data)
-{
- map_set_active(data->attr.u.map, gtk_toggle_action_get_active(action));
- navit_draw(data->gui->nav);
-}
-
-static void
-gui_gtk_add_toggle_menu(struct gui_priv *this, char *name, char *label, char *path, struct action_cb_data *data, gboolean active)
-{
- GtkToggleAction *toggle_action;
- guint merge_id;
-
- toggle_action=gtk_toggle_action_new(name, label, NULL, NULL);
- gtk_toggle_action_set_active(toggle_action, active);
- g_signal_connect(GTK_ACTION(toggle_action), "toggled", G_CALLBACK(gui_gtk_action_toggled), data);
- gtk_action_group_add_action(this->dyn_group, GTK_ACTION(toggle_action));
- merge_id=gtk_ui_manager_new_merge_id(this->ui_manager);
- gtk_ui_manager_add_ui(this->ui_manager, merge_id, path, name, name, GTK_UI_MANAGER_MENUITEM, FALSE);
-}
-
-static void
-gui_gtk_action_changed(GtkRadioAction *action, GtkRadioAction *current, struct action_cb_data *data)
-{
- if (action == current) {
- navit_set_attr(data->gui->nav, &data->attr);
- }
-}
-
-static void
-gui_gtk_add_radio_menu(struct gui_priv *this, char *name, char *label, char *path, struct action_cb_data *data, GSList **g)
-{
- GtkRadioAction *radio_action;
- guint merge_id;
-
- radio_action=gtk_radio_action_new(name, label, NULL, NULL, 0);
- gtk_radio_action_set_group(radio_action, *g);
- *g=gtk_radio_action_get_group(radio_action);
- g_signal_connect(GTK_ACTION(radio_action), "changed", G_CALLBACK(gui_gtk_action_changed), data);
- gtk_action_group_add_action(this->dyn_group, GTK_ACTION(radio_action));
- merge_id=gtk_ui_manager_new_merge_id(this->ui_manager);
- gtk_ui_manager_add_ui(this->ui_manager, merge_id, path, name, name, GTK_UI_MANAGER_MENUITEM, FALSE);
-}
-
-static void
-gui_gtk_layouts_init(struct gui_priv *this)
-{
- struct attr_iter *iter;
- struct attr attr;
- struct action_cb_data *data;
- int count=0;
- char *name;
-
- iter=navit_attr_iter_new();
- while(navit_get_attr(this->nav, attr_layout, &attr, iter)) {
- name=g_strdup_printf("Layout %d", count++);
- data=g_new(struct action_cb_data, 1);
- data->gui=this;
- data->attr.type=attr_layout;
- data->attr.u.layout=attr.u.layout;
- gui_gtk_add_radio_menu(this, name, attr.u.layout->name, "/ui/MenuBar/Map/Layout/LayoutMenuAdditions", data, &this->layout_group);
- g_free(name);
- }
- navit_attr_iter_destroy(iter);
-}
-
-static void
-gui_gtk_projections_init(struct gui_priv *this)
-{
- struct action_cb_data *data;
-
- data=g_new(struct action_cb_data, 1);
- data->gui=this;
- data->attr.type=attr_projection;
- data->attr.u.projection=projection_mg;
- gui_gtk_add_radio_menu(this, "Projection mg", "Map & Guide", "/ui/MenuBar/Map/Projection/ProjectionMenuAdditions", data, &this->projection_group);
-
- data=g_new(struct action_cb_data, 1);
- data->gui=this;
- data->attr.type=attr_projection;
- data->attr.u.projection=projection_garmin;
- gui_gtk_add_radio_menu(this, "Projection garmin", "Garmin", "/ui/MenuBar/Map/Projection/ProjectionMenuAdditions", data, &this->projection_group);
-}
-
-static void
-gui_gtk_vehicles_init(struct gui_priv *this)
-{
- struct attr_iter *iter;
- struct attr attr,vattr;
- struct action_cb_data *data;
- int count=0;
- char *name;
-
- iter=navit_attr_iter_new();
- while(navit_get_attr(this->nav, attr_vehicle, &attr, iter)) {
- vehicle_get_attr(attr.u.vehicle, attr_name, &vattr);
- name=g_strdup_printf("Vehicle %d", count++);
- data=g_new(struct action_cb_data, 1);
- data->gui=this;
- data->attr.type=attr_vehicle;
- data->attr.u.vehicle=attr.u.vehicle;
- gui_gtk_add_radio_menu(this, name, vattr.u.str, "/ui/MenuBar/Map/Vehicle/VehicleMenuAdditions", data, &this->vehicle_group);
- g_free(name);
- }
- navit_attr_iter_destroy(iter);
-}
-
-static void
-gui_gtk_maps_init(struct gui_priv *this)
-{
- struct attr_iter *iter;
- struct attr attr;
- struct action_cb_data *data;
- int count=0;
- char *name, *label;
-
- iter=navit_attr_iter_new();
- while(navit_get_attr(this->nav, attr_map, &attr, iter)) {
- name=g_strdup_printf("Map %d", count++);
- label=g_strdup_printf("%s:%s", map_get_type(attr.u.map), map_get_filename(attr.u.map));
- data=g_new(struct action_cb_data, 1);
- data->gui=this;
- data->attr.type=attr_map;
- data->attr.u.map=attr.u.map;
- gui_gtk_add_toggle_menu(this, name, label, "/ui/MenuBar/Map/MapMenuAdditions", data, map_get_active(attr.u.map));
- g_free(name);
- g_free(label);
- }
- navit_attr_iter_destroy(iter);
-
-}
-
-static void
-gui_gtk_destinations_init(struct gui_priv *this)
-{
- struct attr attr;
- struct action_cb_data *data;
- struct map_rect *mr=NULL;
- struct item *item;
- struct coord c;
- int count=0;
- char *name, *label;
-
- if(navit_get_attr(this->nav, attr_former_destination_map, &attr, NULL) && attr.u.map && (mr=map_rect_new(attr.u.map, NULL))) {
- while ((item=map_rect_get_item(mr))) {
- if (item->type != type_former_destination) continue;
- name=g_strdup_printf("Destination %d", count++);
- item_attr_get(item, attr_label, &attr);
- label=attr.u.str;
- item_coord_get(item, &c, 1);
- data=g_new(struct action_cb_data, 1);
- data->gui=this;
- data->attr.type=attr_destination;
- data->attr.u.pcoord=g_new(struct pcoord, 1);
- data->attr.u.pcoord->pro=projection_mg;
- data->attr.u.pcoord->x=c.x;
- data->attr.u.pcoord->y=c.y;
- gui_gtk_add_menu(this, name, label, "/ui/MenuBar/Route/FormerDestinations/FormerDestinationMenuAdditions",0,data);
- g_free(name);
- }
- map_rect_destroy(mr);
- }
-}
-
-static void
-gui_gtk_bookmarks_init(struct gui_priv *this)
-{
- struct attr attr;
- struct action_cb_data *data;
- struct map_rect *mr=NULL;
- struct item *item;
- struct coord c;
- int count=0;
- char *parent, *name, *label, *label_full, *menu_label, *tmp_parent, *s;
- GHashTable *hash;
-
- if(navit_get_attr(this->nav, attr_bookmark_map, &attr, NULL) && attr.u.map && (mr=map_rect_new(attr.u.map, NULL))) {
- hash=g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
- while ((item=map_rect_get_item(mr))) {
- if (item->type != type_bookmark) continue;
- item_attr_get(item, attr_label, &attr);
- label_full=attr.u.str;
- item_coord_get(item, &c, 1);
- menu_label=g_malloc(strlen(label_full)+1);
- label=label_full;
- parent=g_strdup("/ui/MenuBar/Route/Bookmarks/BookmarkMenuAdditions");
- while ((s=strchr(label, '/'))) {
- strcpy(menu_label, label_full);
- menu_label[s-label_full]='\0';
- if ((tmp_parent=g_hash_table_lookup(hash, menu_label))) {
- tmp_parent=g_strdup(tmp_parent);
- } else {
- name=g_strdup_printf("Bookmark %d", count++);
- gui_gtk_add_menu(this, name, menu_label+(label-label_full),parent,1,NULL);
- tmp_parent=g_strdup_printf("%s/%s", parent, name);
- g_hash_table_insert(hash, g_strdup(menu_label), g_strdup(tmp_parent));
- g_free(name);
- }
- g_free(parent);
- parent=tmp_parent;
- label=s+1;
- }
- g_free(menu_label);
- data=g_new(struct action_cb_data, 1);
- data->gui=this;
- data->attr.type=attr_destination;
- data->attr.u.pcoord=g_new(struct pcoord, 1);
- data->attr.u.pcoord->pro=projection_mg;
- data->attr.u.pcoord->x=c.x;
- data->attr.u.pcoord->y=c.y;
- name=g_strdup_printf("Bookmark %d", count++);
- gui_gtk_add_menu(this, name, label, parent,0,data);
- g_free(name);
- g_free(parent);
- }
- g_hash_table_destroy(hash);
- }
-}
-
-static void
-gui_gtk_init(struct gui_priv *this, struct navit *nav)
-{
-
-
- gui_gtk_toggle_init(this);
- gui_gtk_layouts_init(this);
- gui_gtk_projections_init(this);
- gui_gtk_vehicles_init(this);
- gui_gtk_maps_init(this);
- gui_gtk_destinations_init(this);
- gui_gtk_bookmarks_init(this);
-}
-
-static struct gui_priv *
-gui_gtk_new(struct navit *nav, struct gui_methods *meth, struct attr **attrs)
-{
- struct gui_priv *this;
- int w=792, h=547;
- char *cp = getenv("NAVIT_XID");
- unsigned xid = 0;
- struct attr *attr;
- GtkWidget *widget;
-
- if (cp) {
- xid = strtol(cp, NULL, 0);
- }
-
- this=g_new0(struct gui_priv, 1);
- this->nav=nav;
-
- attr = attr_search(attrs, NULL, attr_menubar);
- if (attr) {
- this->menubar_enable=attr->u.num;
- } else {
- this->menubar_enable=1;
- }
- attr=attr_search(attrs, NULL, attr_toolbar);
- if (attr) {
- this->toolbar_enable=attr->u.num;
- } else {
- this->toolbar_enable=1;
- }
- attr=attr_search(attrs, NULL, attr_statusbar);
- if (attr) {
- this->statusbar_enable=attr->u.num;
- } else {
- this->statusbar_enable=1;
- }
-
- *meth=gui_gtk_methods;
-
- if (!xid)
- this->win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- else
- this->win = gtk_plug_new(xid);
-
- g_signal_connect(G_OBJECT(this->win), "delete-event", G_CALLBACK(gui_gtk_delete), nav);
- this->vbox = gtk_vbox_new(FALSE, 0);
- gtk_window_set_default_size(GTK_WINDOW(this->win), w, h);
- gtk_window_set_title(GTK_WINDOW(this->win), "Navit");
- gtk_widget_realize(this->win);
- gui_gtk_ui_init(this);
- if (this->menubar_enable) {
- widget=gtk_ui_manager_get_widget(this->ui_manager, "/ui/MenuBar");
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS);
- gtk_box_pack_start (GTK_BOX(this->vbox), widget, FALSE, FALSE, 0);
- gtk_widget_show (widget);
- this->menubar=widget;
- }
- if (this->toolbar_enable) {
- widget=gtk_ui_manager_get_widget(this->ui_manager, "/ui/ToolBar");
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS);
- gtk_box_pack_start (GTK_BOX(this->vbox), widget, FALSE, FALSE, 0);
- gtk_widget_show (widget);
- }
- if (this->statusbar_enable) {
- this->statusbar=gui_gtk_statusbar_new(this);
- }
- gtk_container_add(GTK_CONTAINER(this->win), this->vbox);
- gtk_widget_show_all(this->win);
-
-
- navit_add_callback(nav, callback_new_attr_1(callback_cast(gui_gtk_init), attr_navit, this));
- return this;
-}
-
-static int gtk_argc;
-static char **gtk_argv={NULL};
-
-void
-plugin_init(void)
-{
- gtk_init(&gtk_argc, &gtk_argv);
- gtk_set_locale();
-
-
- plugin_register_gui_type("gtk", gui_gtk_new);
-}
diff --git a/navit/gui/internal/Makefile.am b/navit/gui/internal/Makefile.am
deleted file mode 100644
index 86bafad4..00000000
--- a/navit/gui/internal/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = -I$(top_srcdir)/navit @NAVIT_CFLAGS@ -DMODULE=gui_internal
-modulegui_LTLIBRARIES = libgui_internal.la
-libgui_internal_la_SOURCES = gui_internal.c
-libgui_internal_la_LIBADD =
diff --git a/navit/gui/internal/gui_internal.c b/navit/gui/internal/gui_internal.c
deleted file mode 100644
index c08a5ebd..00000000
--- a/navit/gui/internal/gui_internal.c
+++ /dev/null
@@ -1,407 +0,0 @@
-//##############################################################################################################
-//#
-//# File: gui_internal.c
-//# Description: New "internal" GUI for use with any graphics library
-//# Comment: Trying to make a touchscreen friendly GUI
-//# Authors: Martin Schaller (04/2008), Stefan Klumpp (04/2008)
-//#
-//##############################################################################################################
-
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <libintl.h>
-#include <glib.h>
-#include "config.h"
-#include "item.h"
-#include "navit.h"
-#include "debug.h"
-#include "gui.h"
-#include "coord.h"
-#include "point.h"
-#include "plugin.h"
-#include "graphics.h"
-#include "transform.h"
-#include "color.h"
-#include "config.h"
-
-#define STATE_VISIBLE 1
-#define STATE_SELECTED 2
-#define STATE_HIGHLIGHTED 4
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-struct gui_priv {
- struct navit *nav;
- struct graphics *gra;
- struct graphics_gc *background;
- struct graphics_gc *highlight_background;
- struct graphics_gc *foreground;
- struct graphics_font *font;
- int w,h;
- int menu;
- struct widget *widgets;
- int widgets_count;
-};
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-struct widget {
- int type;
- char *text;
- char *icon;
- void (*func)(struct gui_priv *priv, struct widget *widget);
- void *data;
- int state;
- struct point p;
- int w,h;
-};
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void action_return(struct gui_priv *this, struct widget *wi)
-{
- this->menu=0;
- wi->state &= ~STATE_HIGHLIGHTED;
- navit_draw_displaylist(this->nav);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void action_zoom_in(struct gui_priv *this, struct widget *wi)
-{
- this->menu=0;
- wi->state &= ~STATE_HIGHLIGHTED;
- navit_zoom_in(this->nav,2,NULL);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void action_zoom_out(struct gui_priv *this, struct widget *wi)
-{
- this->menu=0;
- wi->state &= ~STATE_HIGHLIGHTED;
- navit_zoom_out(this->nav,2,NULL);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-struct widget main_menu[] = {
- {0, "Return", "xpm/unknown.xpm",action_return},
- {0, "Destination", "xpm/flag_bk_wh.xpm"},
- {0, "Tour", "xpm/unknown.xpm" },
- {0, "Vehicle", "xpm/cursor.xpm"},
- {0, "Map point?", "xpm/unknown.xpm" }, // cp15: What do you mean with "Kartenpunkt"?
- {0, "Map", "xpm/unknown.xpm",NULL,NULL,STATE_SELECTED},
- {0, "Road map", "xpm/unknown.xpm" },
- {0, "Zoom in", "xpm/unknown.xpm",action_zoom_in},
- {0, "Zoom out", "xpm/unknown.xpm",action_zoom_out},
-};
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void gui_internal_draw_button(struct gui_priv *this, struct widget *wi)
-{
- struct point pnt[5];
- struct graphics_image *img;
- int th=10,tw=40,b=5;
- pnt[0]=wi->p;
- pnt[0].x+=1;
- pnt[0].y+=1;
- if (wi->state & STATE_HIGHLIGHTED)
- graphics_draw_rectangle(this->gra, this->highlight_background, &pnt, wi->w-1, wi->h-1);
- else
- graphics_draw_rectangle(this->gra, this->background, &pnt, wi->w-1, wi->h-1);
- pnt[0]=wi->p;
- pnt[0].x+=(wi->w-tw)/2;
- pnt[0].y+=wi->h-th-b;
- graphics_draw_text(this->gra, this->foreground, NULL, this->font, wi->text, &pnt[0], 0x10000, 0);
-
- img=graphics_image_new(this->gra, wi->icon);
- if (img) {
- pnt[0]=wi->p;
- pnt[0].x+=wi->w/2-img->hot.x;
- pnt[0].y+=(wi->h-th-b)/2-img->hot.y;
- graphics_draw_image(this->gra, this->foreground, &pnt[0], img);
- graphics_image_free(this->gra, img);
- }
-
- pnt[0]=wi->p;
- pnt[1].x=pnt[0].x+wi->w;
- pnt[1].y=pnt[0].y;
- pnt[2].x=pnt[0].x+wi->w;
- pnt[2].y=pnt[0].y+wi->h;
- pnt[3].x=pnt[0].x;
- pnt[3].y=pnt[0].y+wi->h;
- pnt[4]=pnt[0];
- if (wi->state & STATE_SELECTED) {
- graphics_gc_set_linewidth(this->foreground, 4);
- b=2;
- pnt[0].x+=b;
- pnt[0].y+=b;
- pnt[1].x-=b-1;
- pnt[1].y+=b;
- pnt[2].x-=b-1;
- pnt[2].y-=b-1;
- pnt[3].x+=b;
- pnt[3].y-=b-1;
- pnt[4].x+=b;
- pnt[4].y+=b;
- }
- graphics_draw_lines(this->gra, this->foreground, pnt, 5);
- if (wi->state & STATE_SELECTED)
- graphics_gc_set_linewidth(this->foreground, 1);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void gui_internal_clear(struct gui_priv *this)
-{
- struct graphics *gra=this->gra;
- struct point pnt;
- pnt.x=0;
- pnt.y=0;
- dbg(0,"w=%d h=%d\n", this->w, this->h);
- graphics_draw_rectangle(gra, this->background, &pnt, this->w, this->h);
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void gui_internal_render_menu(struct gui_priv *this, int offset, struct widget *wi, int count)
-{
- struct graphics *gra=this->gra;
- struct point pnt;
- int w,h,x,y,i;
-
- dbg(0,"menu\n");
- w=this->w/4;
- h=this->h/4;
- for (i = 0 ; i < count ; i++)
- wi[i].state&=~STATE_VISIBLE;
- i=offset;
- for (y = 0 ; y < this->h ; y+=h) {
- for (x = 0 ; x < this->w ; x+=w) {
- if (i < count) {
- wi[i].p.x=x;
- wi[i].p.y=y;
- wi[i].w=w;
- wi[i].h=h;
- wi[i].state|=STATE_VISIBLE;
- gui_internal_draw_button(this, &wi[i]);
- }
- i++;
- }
- }
- this->widgets=wi;
- this->widgets_count=count;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void gui_internal_highlight(struct gui_priv *this, struct point *p)
-{
- struct widget *wi,*found=NULL;
- int i;
-
- for (i = 0 ; i < this->widgets_count ; i++) {
- wi=&this->widgets[i];
- if (p && wi->state & STATE_VISIBLE && wi->p.x < p->x && wi->p.y < p->y && wi->p.x + wi->w > p->x && wi->p.y + wi->h > p->y)
- found=wi;
- else
- if (wi->state & STATE_HIGHLIGHTED) {
- wi->state &= ~STATE_HIGHLIGHTED;
- gui_internal_draw_button(this, wi);
- }
- }
- if (! found)
- return;
- if (! (found->state & STATE_HIGHLIGHTED)) {
- found->state |= STATE_HIGHLIGHTED;
- gui_internal_draw_button(this, found);
- }
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void gui_internal_call_highlighted(struct gui_priv *this)
-{
- struct widget *wi;
- int i;
-
- for (i = 0 ; i < this->widgets_count ; i++) {
- wi=&this->widgets[i];
- if (wi->state & STATE_HIGHLIGHTED) {
- if (wi->func)
- wi->func(this, wi);
- }
- }
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void gui_internal_motion(struct gui_priv *this, struct point *p)
-{
- if (!this->menu)
- navit_handle_motion(this->nav, p);
-}
-
-//##############################################################################################################
-//# Description: Function to handle mouse clicks and scroll wheel movement
-//# Comment:
-//# Authors: Martin Schaller (04/2008), Stefan Klumpp (04/2008)
-//##############################################################################################################
-static void gui_internal_button(struct gui_priv *this, int pressed, int button, struct point *p)
-{
- struct graphics *gra=this->gra;
- struct point pnt;
-
- // if still on the map (not in the menu, yet):
- if (!this->menu) {
- // check whether the position of the mouse changed during press/release OR if it is the scrollwheel
- if (!navit_handle_button(this->nav, pressed, button, p, NULL) || button >=4) // Maybe there's a better way to do this
- return;
- // draw menu
- this->menu++;
- graphics_draw_mode(gra, draw_mode_begin);
- gui_internal_clear(this);
- gui_internal_render_menu(this, 0, main_menu, sizeof(main_menu)/sizeof(struct widget));
- graphics_draw_mode(gra, draw_mode_end);
- return;
- }
-
- // if already in the menu:
- if (pressed) {
- graphics_draw_mode(gra, draw_mode_begin);
- gui_internal_highlight(this, p);
- graphics_draw_mode(gra, draw_mode_end);
- } else {
- graphics_draw_mode(gra, draw_mode_begin);
- gui_internal_highlight(this, p);
- graphics_draw_mode(gra, draw_mode_end);
- gui_internal_call_highlighted(this);
- if (this->menu) {
- graphics_draw_mode(gra, draw_mode_begin);
- gui_internal_highlight(this, NULL);
- graphics_draw_mode(gra, draw_mode_end);
- }
- }
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static void gui_internal_resize(struct gui_priv *this, int w, int h)
-{
- this->w=w;
- this->h=h;
- dbg(0,"w=%d h=%d\n", w, h);
- if (!this->menu)
- navit_resize(this->nav, w, h);
-}
-
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static int gui_internal_set_graphics(struct gui_priv *this, struct graphics *gra)
-{
- void *graphics;
- struct color cb={0x7fff,0x7fff,0x7fff,0xffff};
- struct color cbh={0x9fff,0x9fff,0x9fff,0xffff};
- struct color cf={0xbfff,0xbfff,0xbfff,0xffff};
- struct transformation *trans=navit_get_trans(this->nav);
-
- dbg(0,"enter\n");
- graphics=graphics_get_data(gra, "window");
- if (! graphics)
- return 1;
- this->gra=gra;
- transform_get_size(trans, &this->w, &this->h);
- graphics_register_resize_callback(gra, gui_internal_resize, this);
- graphics_register_button_callback(gra, gui_internal_button, this);
- graphics_register_motion_callback(gra, gui_internal_motion, this);
- this->background=graphics_gc_new(gra);
- graphics_gc_set_foreground(this->background, &cb);
- this->highlight_background=graphics_gc_new(gra);
- graphics_gc_set_foreground(this->highlight_background, &cbh);
- this->foreground=graphics_gc_new(gra);
- graphics_gc_set_foreground(this->foreground, &cf);
- this->font=graphics_font_new(gra, 200, 1);
- return 0;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-struct gui_methods gui_internal_methods = {
- NULL,
- NULL,
- gui_internal_set_graphics,
-};
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-static struct gui_priv * gui_internal_new(struct navit *nav, struct gui_methods *meth, struct attr **attrs)
-{
- struct gui_priv *this;
- *meth=gui_internal_methods;
- this=g_new0(struct gui_priv, 1);
- this->nav=nav;
-
- return this;
-}
-
-//##############################################################################################################
-//# Description:
-//# Comment:
-//# Authors: Martin Schaller (04/2008)
-//##############################################################################################################
-void plugin_init(void)
-{
- plugin_register_gui_type("internal", gui_internal_new);
-}
diff --git a/navit/gui/sdl/Makefile.am b/navit/gui/sdl/Makefile.am
deleted file mode 100644
index f5777f24..00000000
--- a/navit/gui/sdl/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-SUBDIRS=datafiles
-AM_CPPFLAGS = @NAVIT_CFLAGS@ @CEGUI_CFLAGS@ @GLC_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=gui_sdl
-modulegui_LTLIBRARIES = libgui_sdl.la
-libgui_sdl_la_SOURCES = gui_sdl_window.cpp sdl_events.cpp gui_sdl.h sdl_events.h wmcontrol.c wmcontrol.h cegui_keyboard.cpp cegui_keyboard.h
-libgui_sdl_la_LIBADD = @SDL_LIBS@ @CEGUI_LIBS@ @OPENGL_LIBS@ @GLC_LIBS@
diff --git a/navit/gui/sdl/cegui_keyboard.cpp b/navit/gui/sdl/cegui_keyboard.cpp
deleted file mode 100644
index 3bf0888f..00000000
--- a/navit/gui/sdl/cegui_keyboard.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-#include "CEGUI.h"
-#include "sdl_events.h"
-
-
-bool ShowKeyboard(const CEGUI::EventArgs& event){
- CEGUI::WindowManager::getSingleton().getWindow("Navit/Keyboard/Input")->setText("");
- CEGUI::WindowManager::getSingleton().getWindow("Navit/Keyboard")->show();
-}
-
-
-
-void Add_KeyBoard_key(CEGUI::String key,int x,int y,int w){
-
- using namespace CEGUI;
-// char button_name [5];
-// sprintf(button_name,"%s",key);
- FrameWindow* wnd = (FrameWindow*)WindowManager::getSingleton().createWindow("TaharezLook/Button", key);
- CEGUI::WindowManager::getSingleton().getWindow("Navit/Keyboard")->addChildWindow(wnd);
- wnd->setPosition(UVector2(cegui_absdim(x), cegui_absdim( y)));
- wnd->setSize(UVector2(cegui_absdim(w), cegui_absdim( 40)));
- wnd->setText(key);
- wnd->subscribeEvent(PushButton::EventClicked, Event::Subscriber(Handle_Virtual_Key_Down));
-
-}
-
-
-void BuildKeyboard(){
- int w=55;
- int offset_x=10;
- int count_x=0;
-
- int y=25;
- Add_KeyBoard_key("A",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("Z",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("E",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("R",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("T",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("Y",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("U",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("I",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("O",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("P",offset_x+(count_x++)*w,y,w);
- count_x++;
- Add_KeyBoard_key("7",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("8",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("9",offset_x+(count_x++)*w,y,w);
-
- y=70;
- count_x=0;
- Add_KeyBoard_key("Q",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("S",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("D",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("F",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("G",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("H",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("J",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("K",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("L",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("M",offset_x+(count_x++)*w,y,w);
- count_x++;
- Add_KeyBoard_key("4",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("5",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("6",offset_x+(count_x++)*w,y,w);
-
- y=115;
- count_x=0;
-
- Add_KeyBoard_key("W",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("X",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("C",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("V",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("B",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("N",offset_x+(count_x++)*w,y,w);
-
- Add_KeyBoard_key(" ",offset_x+(count_x++)*w,y,w*2);
- count_x++;
-
- Add_KeyBoard_key("BACK",offset_x+(count_x++)*w,y,w*2);
- count_x+=2;
-
- Add_KeyBoard_key("1",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("2",offset_x+(count_x++)*w,y,w);
- Add_KeyBoard_key("3",offset_x+(count_x++)*w,y,w);
-
- y=160;
- count_x=11;
- Add_KeyBoard_key("0",offset_x+(count_x++)*w,y,w);
-
- Add_KeyBoard_key("OK",offset_x+(count_x++)*w,y,w*2);
-
-
-}
-
-
diff --git a/navit/gui/sdl/cegui_keyboard.h b/navit/gui/sdl/cegui_keyboard.h
deleted file mode 100644
index bb329499..00000000
--- a/navit/gui/sdl/cegui_keyboard.h
+++ /dev/null
@@ -1,5 +0,0 @@
-bool ShowKeyboard(const CEGUI::EventArgs& event);
-void Add_KeyBoard_key(CEGUI::String key,int x,int y,int w);
-void BuildKeyboard();
-bool Handle_Virtual_Key_Down(const CEGUI::EventArgs& event);
-
diff --git a/navit/gui/sdl/datafiles/Makefile.am b/navit/gui/sdl/datafiles/Makefile.am
deleted file mode 100644
index 0a1e19bf..00000000
--- a/navit/gui/sdl/datafiles/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-# include $(top_srcdir)/Makefile.inc
-
-CEGUIFONTSdir=$(pkgdatadir)/datafiles/fonts
-# CEGUIFONTS_DATA = fonts/DejaVuSans-10.font fonts/DejaVuSans-14.font fonts/DejaVuSans-18.font fonts/DejaVuSans.ttf fonts/Font.xsd
-CEGUIFONTS_DATA = fonts/DejaVuSans-10.font fonts/DejaVuSans-12.font fonts/DejaVuSans-14.font fonts/DejaVuSans.ttf fonts/Font.xsd
-
-CEGUILAYOUTdir=$(pkgdatadir)/datafiles/layouts
-CEGUILAYOUT_DATA = layouts/GUILayout.xsd layouts/Mineque.layout layouts/TaharezLook.layout
-
-CEGUIIMAGESETSdir=$(pkgdatadir)/datafiles/imagesets
-CEGUIIMAGESETS_DATA = imagesets/Imageset.xsd imagesets/Mineque-Black.imageset imagesets/navit-skin-black-imageset.tga \
- imagesets/TaharezLook.imageset imagesets/TaharezLook.tga
-
-CEGUILOOKNFEELdir=$(pkgdatadir)/datafiles/looknfeel
-CEGUILOOKNFEEL_DATA = looknfeel/Falagard.xsd looknfeel/Mineque.looknfeel looknfeel/TaharezLook.looknfeel
-
-CEGUISCHEMESdir=$(pkgdatadir)/datafiles/schemes
-CEGUISCHEMES_DATA = schemes/GUIScheme.xsd schemes/Mineque.scheme schemes/TaharezLook.scheme
-
-EXTRA_DIST = $(CEGUIFONTS_DATA) $(CEGUILAYOUT_DATA) $(CEGUIIMAGESETS_DATA) $(CEGUILOOKNFEEL_DATA) $(CEGUISCHEMES_DATA)
diff --git a/navit/gui/sdl/datafiles/fonts/DejaVuSans-10.font b/navit/gui/sdl/datafiles/fonts/DejaVuSans-10.font
deleted file mode 100755
index 25e51b2c..00000000
--- a/navit/gui/sdl/datafiles/fonts/DejaVuSans-10.font
+++ /dev/null
@@ -1,2 +0,0 @@
-<?xml version="1.0" ?>
-<Font Name="DejaVuSans-10" Filename="DejaVuSans.ttf" Type="FreeType" Size="10" NativeHorzRes="800" NativeVertRes="600" AutoScaled="true"/>
diff --git a/navit/gui/sdl/datafiles/fonts/DejaVuSans-12.font b/navit/gui/sdl/datafiles/fonts/DejaVuSans-12.font
deleted file mode 100755
index 56f65a24..00000000
--- a/navit/gui/sdl/datafiles/fonts/DejaVuSans-12.font
+++ /dev/null
@@ -1,2 +0,0 @@
-<?xml version="1.0" ?>
-<Font Name="DejaVuSans-12" Filename="DejaVuSans.ttf" Type="FreeType" Size="12" NativeHorzRes="800" NativeVertRes="600" AutoScaled="true"/>
diff --git a/navit/gui/sdl/datafiles/fonts/DejaVuSans-14.font b/navit/gui/sdl/datafiles/fonts/DejaVuSans-14.font
deleted file mode 100755
index ddddd46d..00000000
--- a/navit/gui/sdl/datafiles/fonts/DejaVuSans-14.font
+++ /dev/null
@@ -1,2 +0,0 @@
-<?xml version="1.0" ?>
-<Font Name="DejaVuSans-14" Filename="DejaVuSans.ttf" Type="FreeType" Size="14" NativeHorzRes="800" NativeVertRes="600" AutoScaled="true"/>
diff --git a/navit/gui/sdl/datafiles/fonts/DejaVuSans.ttf b/navit/gui/sdl/datafiles/fonts/DejaVuSans.ttf
deleted file mode 100755
index 7e96e8ec..00000000
--- a/navit/gui/sdl/datafiles/fonts/DejaVuSans.ttf
+++ /dev/null
Binary files differ
diff --git a/navit/gui/sdl/datafiles/fonts/Font.xsd b/navit/gui/sdl/datafiles/fonts/Font.xsd
deleted file mode 100644
index 5ab529cd..00000000
--- a/navit/gui/sdl/datafiles/fonts/Font.xsd
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" ?>
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
- <xsd:element name="Font" type="FontType" />
-
- <xsd:complexType name="FontType">
- <xsd:sequence>
- <xsd:element name="Mapping" type="MapType" maxOccurs="unbounded" minOccurs="0" />
- </xsd:sequence>
- <xsd:attributeGroup ref="FontAttrs" />
- </xsd:complexType>
- <xsd:complexType name="MapType">
- <xsd:attribute name="Codepoint" type="xsd:nonNegativeInteger" use="required" />
- <xsd:attribute name="Image" type="xsd:string" use="required" />
- <xsd:attribute name="HorzAdvance" type="xsd:integer" use="optional" default="-1" />
- </xsd:complexType>
- <xsd:attributeGroup name="FontAttrs">
- <xsd:attribute name="Name" type="xsd:string" use="required" />
- <xsd:attribute name="Filename" type="xsd:string" use="required" />
- <xsd:attribute name="ResourceGroup" type="xsd:string" use="optional" default="" />
- <xsd:attribute name="Type" use="required">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="FreeType" />
- <xsd:enumeration value="Pixmap" />
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="Size" type="xsd:nonNegativeInteger" use="optional" default="12" />
- <xsd:attribute name="NativeHorzRes" type="xsd:nonNegativeInteger" use="optional" default="640" />
- <xsd:attribute name="NativeVertRes" type="xsd:nonNegativeInteger" use="optional" default="480" />
- <xsd:attribute name="AutoScaled" type="xsd:boolean" use="optional" default="false" />
- <xsd:attribute name="AntiAlias" type="xsd:boolean" use="optional" default="true" />
- </xsd:attributeGroup>
-</xsd:schema>
diff --git a/navit/gui/sdl/datafiles/imagesets/Imageset.xsd b/navit/gui/sdl/datafiles/imagesets/Imageset.xsd
deleted file mode 100644
index 49ced132..00000000
--- a/navit/gui/sdl/datafiles/imagesets/Imageset.xsd
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
-
- <xsd:element name="Imageset" type="ImagesetType"/>
-
- <xsd:complexType name="ImagesetType">
- <xsd:sequence>
- <xsd:element name="Image" type="ImageType" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="Imagefile" type="xsd:string" use="required"/>
- <xsd:attribute name="ResourceGroup" type="xsd:string" use="optional" default="" />
- <xsd:attribute name="Name" type="xsd:string" use="required"/>
- <xsd:attribute name="NativeHorzRes" type="xsd:nonNegativeInteger" use="optional" default="640" />
- <xsd:attribute name="NativeVertRes" type="xsd:nonNegativeInteger" use="optional" default="480" />
- <xsd:attribute name="AutoScaled" type="xsd:boolean" use="optional" default="false" />
- </xsd:complexType>
-
- <xsd:complexType name="ImageType">
- <xsd:attribute name="Name" type="xsd:string" use="required"/>
- <xsd:attribute name="XPos" type="xsd:nonNegativeInteger" use="required"/>
- <xsd:attribute name="YPos" type="xsd:nonNegativeInteger" use="required"/>
- <xsd:attribute name="Width" type="xsd:nonNegativeInteger" use="required"/>
- <xsd:attribute name="Height" type="xsd:nonNegativeInteger" use="required"/>
- <xsd:attribute name="XOffset" type="xsd:integer" use="optional" default="0"/>
- <xsd:attribute name="YOffset" type="xsd:integer" use="optional" default="0"/>
- </xsd:complexType>
-
-</xsd:schema>
diff --git a/navit/gui/sdl/datafiles/imagesets/Mineque-Black.imageset b/navit/gui/sdl/datafiles/imagesets/Mineque-Black.imageset
deleted file mode 100644
index ef19947e..00000000
--- a/navit/gui/sdl/datafiles/imagesets/Mineque-Black.imageset
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" ?>
-<Imageset Name="Mineque-Black" Imagefile="navit-skin-black-imageset.tga" NativeHorzRes="800" NativeVertRes="730" AutoScaled="true">
-<!--
-Imagefile - file with all textures inside
-NativeHorzRes, NativeVertRes - image size in pixels
-Image Name - name of texture we will further use in layout and looknfeel files
-XPos, YPos - position (X,Y) of texture parts in image file it's count for "d" corner as below
- d____e
- | |
- |____|
- f g
--->
-<!-- Round panel parts -->
- <Image Name="ZoomOutButton" XPos="0" YPos="260" Width="62" Height="93" />
- <Image Name="ZoomInButton" XPos="0" YPos="360" Width="92" Height="62" />
- <Image Name="ViewModeSwitchButton" XPos="0" YPos="153" Width="98" Height="98" />
-<!-- Top panel parts -->
- <Image Name="QuitButton" XPos="0" YPos="450" Width="29" Height="30" />
- <Image Name="RouteButton" XPos="35" YPos="450" Width="36" Height="36" />
- <Image Name="OptionsButton" XPos="75" YPos="450" Width="37" Height="25" />
- <Image Name="SpeakerOffButton" XPos="115" YPos="450" Width="28" Height="36" />
- <Image Name="SpeakerOnButton" XPos="145" YPos="450" Width="28" Height="36" />
- <Image Name="SateliteImage" XPos="230" YPos="450" Width="30" Height="38" />
- <Image Name="SateliteStrenghBarOn" XPos="180" YPos="450" Width="17" Height="32" />
- <Image Name="SateliteStrenghBarOff" XPos="200" YPos="450" Width="17" Height="32" />
- <Image Name="TopPanel" XPos="0" YPos="53" Width="800" Height="64" />
- <Image Name="NavitAboutButton" XPos="0" YPos="500" Width="82" Height="25" />
-<!-- Right panel parts -->
- <Image Name="RightPanel" XPos="635" YPos="127" Width="165" Height="600" />
-<!-- Navigation area -->
- <Image Name="ArrowLeft" XPos="258" YPos="450" Width="39" Height="34" />
- <Image Name="ArrowTop" XPos="316" YPos="450" Width="34" Height="39" />
- <Image Name="ArrowRight" XPos="435" YPos="450" Width="39" Height="34" />
- <Image Name="ArrowDown" XPos="275" YPos="450" Width="34" Height="39" />
-<!-- Bottom street panel part -->
- <Image Name="BottomStreetPanel" XPos="0" YPos="0" Width="800" Height="50" />
-</Imageset>
diff --git a/navit/gui/sdl/datafiles/imagesets/TaharezLook.imageset b/navit/gui/sdl/datafiles/imagesets/TaharezLook.imageset
deleted file mode 100755
index e5aef981..00000000
--- a/navit/gui/sdl/datafiles/imagesets/TaharezLook.imageset
+++ /dev/null
@@ -1,242 +0,0 @@
-<?xml version="1.0" ?>
-<Imageset Name="TaharezLook" Imagefile="TaharezLook.tga" NativeHorzRes="800" NativeVertRes="600" AutoScaled="true">
- <Image Name="ClientBrush" XPos="2" YPos="2" Width="64" Height="64" />
- <Image Name="WindowLeftEdge" XPos="6" YPos="95" Width="1" Height="22" XOffset="4" />
- <Image Name="WindowRightEdge" XPos="34" YPos="95" Width="1" Height="22" XOffset="-5" />
- <Image Name="WindowTopEdge" XPos="9" YPos="68" Width="23" Height="1" />
- <Image Name="WindowBottomEdge" XPos="9" YPos="143" Width="23" Height="1" />
- <Image Name="WindowTopLeft" XPos="2" YPos="68" Width="5" Height="24" />
- <Image Name="WindowTopRight" XPos="34" YPos="68" Width="5" Height="24" />
- <Image Name="WindowBottomLeft" XPos="2" YPos="120" Width="5" Height="24" />
- <Image Name="WindowBottomRight" XPos="34" YPos="120" Width="5" Height="24" />
- <Image Name="ButtonLeftNormal" XPos="68" YPos="20" Width="12" Height="16" />
- <Image Name="ButtonMiddleNormal" XPos="82" YPos="20" Width="12" Height="16" />
- <Image Name="ButtonRightNormal" XPos="96" YPos="20" Width="12" Height="16" />
- <Image Name="ButtonLeftPushed" XPos="68" YPos="38" Width="12" Height="16" />
- <Image Name="ButtonMiddlePushed" XPos="82" YPos="38" Width="12" Height="16" />
- <Image Name="ButtonRightPushed" XPos="96" YPos="38" Width="12" Height="16" />
- <Image Name="ButtonLeftHighlight" XPos="68" YPos="56" Width="12" Height="16" />
- <Image Name="ButtonMiddleHighlight" XPos="82" YPos="56" Width="12" Height="16" />
- <Image Name="ButtonRightHighlight" XPos="96" YPos="56" Width="12" Height="16" />
- <Image Name="CheckboxNormal" XPos="110" YPos="2" Width="12" Height="12" />
- <Image Name="CheckboxHover" XPos="110" YPos="30" Width="12" Height="12" />
- <Image Name="CheckboxMark" XPos="110" YPos="16" Width="12" Height="12" />
- <Image Name="RadioButtonNormal" XPos="124" YPos="2" Width="12" Height="12" />
- <Image Name="RadioButtonHover" XPos="124" YPos="30" Width="12" Height="12" />
- <Image Name="RadioButtonMark" XPos="124" YPos="16" Width="12" Height="12" />
- <Image Name="TitlebarLeft" XPos="68" YPos="2" Width="8" Height="16" />
- <Image Name="TitlebarMiddle" XPos="78" YPos="2" Width="8" Height="16" />
- <Image Name="TitlebarRight" XPos="88" YPos="2" Width="8" Height="16" />
- <Image Name="NewTitlebarLeft" XPos="61" YPos="127" Width="13" Height="16" />
- <Image Name="NewTitlebarMiddle" XPos="77" YPos="127" Width="12" Height="16" />
- <Image Name="NewTitlebarRight" XPos="92" YPos="127" Width="12" Height="16" />
- <Image Name="SysAreaMiddle" XPos="107" YPos="127" Width="12" Height="16" />
- <Image Name="SysAreaRight" XPos="122" YPos="127" Width="13" Height="16" />
- <Image Name="StaticLeft" XPos="41" YPos="89" Width="6" Height="6" />
- <Image Name="StaticRight" XPos="63" YPos="89" Width="6" Height="6" />
- <Image Name="StaticTop" XPos="52" YPos="78" Width="6" Height="6" />
- <Image Name="StaticBottom" XPos="52" YPos="100" Width="6" Height="6" />
- <Image Name="StaticTopLeft" XPos="41" YPos="78" Width="6" Height="6" />
- <Image Name="StaticTopRight" XPos="63" YPos="78" Width="6" Height="6" />
- <Image Name="StaticBottomLeft" XPos="41" YPos="100" Width="6" Height="6" />
- <Image Name="StaticBottomRight" XPos="63" YPos="100" Width="6" Height="6" />
- <Image Name="StaticBackdrop" XPos="52" YPos="89" Width="6" Height="6" />
- <Image Name="ProgressBarLeft" XPos="71" YPos="74" Width="7" Height="12" />
- <Image Name="ProgressBarMiddle" XPos="80" YPos="74" Width="6" Height="12" />
- <Image Name="ProgressBarRight" XPos="88" YPos="74" Width="6" Height="12" />
- <Image Name="ProgressBarDimSegment" XPos="96" YPos="74" Width="8" Height="12" />
- <Image Name="ProgressBarLitSegment" XPos="106" YPos="74" Width="8" Height="12" />
- <Image Name="EditBoxLeft" XPos="41" YPos="108" Width="4" Height="18" />
- <Image Name="EditBoxMiddle" XPos="47" YPos="108" Width="4" Height="18" />
- <Image Name="EditBoxRight" XPos="53" YPos="108" Width="4" Height="18" />
- <Image Name="EditBoxCarat" XPos="60" YPos="108" Width="4" Height="18" />
- <Image Name="SpinnerUpNormal" XPos="68" YPos="110" Width="10" Height="6" />
- <Image Name="SpinnerDownNormal" XPos="68" YPos="118" Width="10" Height="6" />
- <Image Name="SpinnerUpHover" XPos="82" YPos="110" Width="10" Height="6" />
- <Image Name="SpinnerDownHover" XPos="82" YPos="118" Width="10" Height="6" />
- <Image Name="TextSelectionBrush" XPos="8" YPos="70" Width="16" Height="16" />
- <Image Name="VertScrollTop" XPos="182" YPos="2" Width="20" Height="8" />
- <Image Name="VertScrollMiddle" XPos="182" YPos="12" Width="20" Height="8" />
- <Image Name="VertScrollBottom" XPos="182" YPos="22" Width="20" Height="8" />
- <Image Name="VertScrollBarSegment" XPos="206" YPos="2" Width="4" Height="10" />
- <Image Name="VertScrollThumbNormal" XPos="214" YPos="2" Width="8" Height="24" />
- <Image Name="VertScrollThumbHover" XPos="224" YPos="2" Width="8" Height="24" />
- <Image Name="VertScrollUpNormal" XPos="196" YPos="32" Width="12" Height="12" />
- <Image Name="VertScrollDownNormal" XPos="182" YPos="32" Width="12" Height="12" />
- <Image Name="VertScrollUpHover" XPos="196" YPos="46" Width="12" Height="12" />
- <Image Name="VertScrollDownHover" XPos="182" YPos="46" Width="12" Height="12" />
- <Image Name="MiniVertScrollBarSegment" XPos="207" YPos="60" Width="4" Height="10" />
- <Image Name="MiniVertScrollThumbNormal" XPos="214" YPos="59" Width="7" Height="22" />
- <Image Name="MiniVertScrollThumbTopNormal" XPos="214" YPos="59" Width="7" Height="5" />
- <Image Name="MiniVertScrollThumbMiddleNormal" XPos="214" YPos="65" Width="7" Height="5" />
- <Image Name="MiniVertScrollThumbBottomNormal" XPos="214" YPos="76" Width="7" Height="5" />
- <Image Name="MiniVertScrollThumbTopHover" XPos="223" YPos="59" Width="7" Height="5" />
- <Image Name="MiniVertScrollThumbMiddleHover" XPos="223" YPos="65" Width="7" Height="5" />
- <Image Name="MiniVertScrollThumbBottomHover" XPos="223" YPos="76" Width="7" Height="5" />
- <Image Name="MiniVertScrollThumbHover" XPos="223" YPos="59" Width="7" Height="22" />
- <Image Name="MiniVertScrollUpNormal" XPos="194" YPos="60" Width="10" Height="9" />
- <Image Name="MiniVertScrollDownNormal" XPos="182" YPos="59" Width="10" Height="9" />
- <Image Name="MiniVertScrollUpHover" XPos="194" YPos="70" Width="10" Height="9" />
- <Image Name="MiniVertScrollDownHover" XPos="182" YPos="69" Width="10" Height="9" />
- <Image Name="VertSliderBody" XPos="234" YPos="2" Width="9" Height="48" />
- <Image Name="VertSliderThumbNormal" XPos="217" YPos="28" Width="15" Height="6" />
- <Image Name="VertSliderThumbHover" XPos="217" YPos="36" Width="15" Height="6" />
- <Image Name="MiniHorzScrollBarSegment" XPos="244" YPos="80" Width="10" Height="4" />
- <Image Name="MiniHorzScrollThumbNormal" XPos="233" YPos="87" Width="22" Height="7" />
- <Image Name="MiniHorzScrollThumbLeftNormal" XPos="233" YPos="87" Width="5" Height="7" />
- <Image Name="MiniHorzScrollThumbMiddleNormal" XPos="239" YPos="87" Width="5" Height="7" />
- <Image Name="MiniHorzScrollThumbRightNormal" XPos="250" YPos="87" Width="5" Height="7" />
- <Image Name="MiniHorzScrollThumbHover" XPos="233" YPos="96" Width="22" Height="7" />
- <Image Name="MiniHorzScrollThumbLeftHover" XPos="233" YPos="96" Width="5" Height="7" />
- <Image Name="MiniHorzScrollThumbMiddleHover" XPos="239" YPos="96" Width="5" Height="7" />
- <Image Name="MiniHorzScrollThumbRightHover" XPos="250" YPos="96" Width="5" Height="7" />
- <Image Name="MiniHorzScrollLeftNormal" XPos="246" YPos="55" Width="9" Height="10" />
- <Image Name="MiniHorzScrollRightNormal" XPos="245" YPos="67" Width="9" Height="10" />
- <Image Name="MiniHorzScrollLeftHover" XPos="236" YPos="55" Width="9" Height="10" />
- <Image Name="MiniHorzScrollRightHover" XPos="235" YPos="67" Width="9" Height="10" />
- <Image Name="ListboxLeft" XPos="41" YPos="89" Width="7" Height="6" />
- <Image Name="ListboxRight" XPos="62" YPos="89" Width="7" Height="6" />
- <Image Name="ListboxTop" XPos="52" YPos="78" Width="6" Height="7" />
- <Image Name="ListboxBottom" XPos="52" YPos="99" Width="6" Height="7" />
- <Image Name="ListboxTopLeft" XPos="41" YPos="78" Width="7" Height="7" />
- <Image Name="ListboxTopRight" XPos="62" YPos="78" Width="7" Height="7" />
- <Image Name="ListboxBottomLeft" XPos="41" YPos="99" Width="7" Height="7" />
- <Image Name="ListboxBottomRight" XPos="62" YPos="99" Width="7" Height="7" />
- <Image Name="ListboxBackdrop" XPos="52" YPos="89" Width="6" Height="6" />
- <Image Name="ListboxSelectionBrush" XPos="8" YPos="70" Width="16" Height="16" />
- <Image Name="ComboboxEditLeft" XPos="138" YPos="2" Width="8" Height="16" />
- <Image Name="ComboboxEditMiddle" XPos="148" YPos="2" Width="8" Height="16" />
- <Image Name="ComboboxListButtonNormal" XPos="158" YPos="2" Width="16" Height="16" />
- <Image Name="ComboboxListButtonHover" XPos="158" YPos="20" Width="16" Height="16" />
- <Image Name="ComboboxListLeft" XPos="138" YPos="48" Width="8" Height="8" />
- <Image Name="ComboboxListRight" XPos="158" YPos="48" Width="8" Height="8" />
- <Image Name="ComboboxListTop" XPos="148" YPos="48" Width="8" Height="8" />
- <Image Name="ComboboxListBottom" XPos="148" YPos="58" Width="8" Height="8" />
- <Image Name="ComboboxListTopLeft" XPos="138" YPos="38" Width="8" Height="8" />
- <Image Name="ComboboxListTopRight" XPos="158" YPos="38" Width="8" Height="8" />
- <Image Name="ComboboxListBottomLeft" XPos="138" YPos="58" Width="8" Height="8" />
- <Image Name="ComboboxListBottomRight" XPos="158" YPos="58" Width="8" Height="8" />
- <Image Name="ComboboxListBackdrop" XPos="148" YPos="48" Width="8" Height="8" />
- <Image Name="ComboboxSelectionBrush" XPos="8" YPos="70" Width="16" Height="16" />
- <Image Name="ComboboxDividerLeft" XPos="138" YPos="68" Width="14" Height="1" />
- <Image Name="ComboboxDividerMiddle" XPos="154" YPos="68" Width="8" Height="1" />
- <Image Name="ComboboxDividerRight" XPos="164" YPos="68" Width="14" Height="1" />
- <Image Name="HeaderBarBackdropNormal" XPos="230" YPos="163" Width="10" Height="12" />
- <Image Name="HeaderBarBackdropHover" XPos="230" YPos="163" Width="10" Height="12" />
- <Image Name="HeaderBarSplitterNormal" XPos="225" YPos="92" Width="3" Height="16" />
- <Image Name="HeaderBarSplitterHover" XPos="200" YPos="92" Width="3" Height="16" />
- <Image Name="HeaderBarSortUp" XPos="233" YPos="178" Width="8" Height="8" />
- <Image Name="HeaderBarSortDown" XPos="244" YPos="178" Width="8" Height="8" />
- <Image Name="MultiListLeft" XPos="170" YPos="92" Width="7" Height="6" />
- <Image Name="MultiListRight" XPos="191" YPos="92" Width="7" Height="6" />
- <Image Name="MultiListTop" XPos="181" YPos="81" Width="6" Height="7" />
- <Image Name="MultiListBottom" XPos="181" YPos="102" Width="6" Height="7" />
- <Image Name="MultiListTopLeft" XPos="170" YPos="81" Width="7" Height="7" />
- <Image Name="MultiListTopRight" XPos="191" YPos="81" Width="7" Height="7" />
- <Image Name="MultiListBottomLeft" XPos="170" YPos="102" Width="7" Height="7" />
- <Image Name="MultiListBottomRight" XPos="191" YPos="102" Width="7" Height="7" />
- <Image Name="MultiListBackdrop" XPos="181" YPos="92" Width="6" Height="6" />
- <Image Name="MultiListSelectionBrush" XPos="9" YPos="71" Width="14" Height="14" />
- <Image Name="AltProgressLeft" XPos="71" YPos="88" Width="8" Height="12" />
- <Image Name="AltProgressMiddle" XPos="81" YPos="88" Width="8" Height="12" />
- <Image Name="AltProgressRight" XPos="91" YPos="88" Width="8" Height="12" />
- <Image Name="AltProgressQuarter" XPos="102" YPos="89" Width="3" Height="4" />
- <Image Name="AltProgressHalf" XPos="109" YPos="89" Width="4" Height="5" />
- <Image Name="AltProgressLight1" XPos="100" YPos="97" Width="4" Height="8" />
- <Image Name="AltProgressLight2" XPos="106" YPos="97" Width="4" Height="8" />
- <Image Name="AltProgressLight3" XPos="112" YPos="97" Width="4" Height="8" />
- <Image Name="AltProgressLight4" XPos="118" YPos="97" Width="4" Height="8" />
- <Image Name="AltProgressLight5" XPos="124" YPos="97" Width="4" Height="8" />
- <Image Name="AltProgressLight6" XPos="130" YPos="97" Width="4" Height="8" />
- <Image Name="AltProgressLight7" XPos="136" YPos="97" Width="4" Height="8" />
- <Image Name="AltProgressLight8" XPos="142" YPos="97" Width="4" Height="8" />
- <Image Name="AltProgressLight9" XPos="148" YPos="97" Width="4" Height="8" />
- <Image Name="AltProgressLight10" XPos="154" YPos="97" Width="4" Height="8" />
- <Image Name="CloseButtonNormal" XPos="41" YPos="128" Width="16" Height="16" />
- <Image Name="CloseButtonHover" XPos="41" YPos="146" Width="16" Height="16" />
- <Image Name="CloseButtonPressed" XPos="41" YPos="164" Width="16" Height="16" />
- <Image Name="NewCloseButtonNormal" XPos="90" YPos="146" Width="10" Height="10" />
- <Image Name="NewCloseButtonHover" XPos="90" YPos="146" Width="10" Height="10" />
- <Image Name="NewCloseButtonPressed" XPos="90" YPos="146" Width="10" Height="10" />
- <Image Name="MultiLineEditboxLeft" XPos="41" YPos="89" Width="6" Height="6" />
- <Image Name="MultiLineEditboxRight" XPos="63" YPos="89" Width="6" Height="6" />
- <Image Name="MultiLineEditboxTop" XPos="52" YPos="78" Width="6" Height="6" />
- <Image Name="MultiLineEditboxBottom" XPos="52" YPos="100" Width="6" Height="6" />
- <Image Name="MultiLineEditboxTopLeft" XPos="41" YPos="78" Width="6" Height="6" />
- <Image Name="MultiLineEditboxTopRight" XPos="63" YPos="78" Width="6" Height="6" />
- <Image Name="MultiLineEditboxBottomLeft" XPos="41" YPos="100" Width="6" Height="6" />
- <Image Name="MultiLineEditboxBottomRight" XPos="63" YPos="100" Width="6" Height="6" />
- <Image Name="MultiLineEditboxBackdrop" XPos="52" YPos="89" Width="6" Height="6" />
- <Image Name="MultiLineEditboxSelectionBrush" XPos="9" YPos="71" Width="14" Height="14" />
- <Image Name="MouseTarget" XPos="182" YPos="127" Width="17" Height="17" XOffset="-8" YOffset="-8" />
- <Image Name="MouseArrow" XPos="138" YPos="127" Width="31" Height="25" XOffset="0" YOffset="0" />
- <Image Name="MouseMoveCursor" XPos="201" YPos="127" Width="18" Height="18" XOffset="-8" YOffset="-8" />
- <Image Name="MouseNoSoCursor" XPos="221" YPos="127" Width="8" Height="18" XOffset="-3" YOffset="-8" />
- <Image Name="MouseEsWeCursor" XPos="182" YPos="150" Width="18" Height="8" XOffset="-8" YOffset="-3" />
- <Image Name="MouseNeSwCursor" XPos="201" YPos="147" Width="14" Height="14" XOffset="-7" YOffset="-7" />
- <Image Name="MouseNwSeCursor" XPos="230" YPos="126" Width="14" Height="14" XOffset="-7" YOffset="-7" />
- <Image Name="MouseTextBar" XPos="173" YPos="127" Width="7" Height="18" XOffset="-2" YOffset="-9" />
- <Image Name="TabHorizontalFiller" XPos="197" YPos="201" Width="7" Height="1" />
- <Image Name="TabContentPaneUpperLeft" XPos="41" YPos="78" Width="7" Height="7" />
- <Image Name="TabContentPaneUpper" XPos="52" YPos="78" Width="6" Height="7" />
- <Image Name="TabContentPaneUpperRight" XPos="62" YPos="78" Width="7" Height="7" />
- <Image Name="TabContentPaneLeft" XPos="41" YPos="89" Width="7" Height="6" />
- <Image Name="TabContentPaneRight" XPos="62" YPos="89" Width="7" Height="6" />
- <Image Name="TabContentPaneLower" XPos="52" YPos="99" Width="6" Height="7" />
- <Image Name="TabContentPaneLowerLeft" XPos="41" YPos="99" Width="7" Height="7" />
- <Image Name="TabContentPaneLowerRight" XPos="62" YPos="99" Width="7" Height="7" />
- <Image Name="TabContentPaneMiddle" XPos="52" YPos="89" Width="6" Height="6" />
- <Image Name="TabButtonScrollLeftNormal" XPos="97" YPos="108" Width="16" Height="17" />
- <Image Name="TabButtonScrollRightNormal" XPos="112" YPos="108" Width="16" Height="17" />
- <Image Name="TabButtonScrollLeftHover" XPos="127" YPos="108" Width="16" Height="17" />
- <Image Name="TabButtonScrollRightHover" XPos="142" YPos="108" Width="16" Height="17" />
- <Image Name="TabButtonLeftNormal" XPos="41" YPos="89" Width="7" Height="6" />
- <Image Name="TabButtonRightNormal" XPos="62" YPos="89" Width="7" Height="6" />
- <Image Name="TabButtonUpperNormal" XPos="52" YPos="78" Width="6" Height="7" />
- <Image Name="TabButtonLowerNormal" XPos="52" YPos="99" Width="6" Height="7" />
- <Image Name="TabButtonUpperLeftNormal" XPos="41" YPos="78" Width="7" Height="7" />
- <Image Name="TabButtonUpperLeft2Normal" XPos="186" YPos="164" Width="7" Height="7" />
- <Image Name="TabButtonUpperRightNormal" XPos="62" YPos="78" Width="7" Height="7" />
- <Image Name="TabButtonLowerLeftNormal" XPos="41" YPos="99" Width="7" Height="7" />
- <Image Name="TabButtonLowerRightNormal" XPos="62" YPos="99" Width="7" Height="7" />
- <Image Name="TabButtonLowerRight2Normal" XPos="187" YPos="195" Width="7" Height="7" />
- <Image Name="TabButtonMiddleNormal" XPos="52" YPos="89" Width="6" Height="6" />
- <Image Name="TabButtonLeftSelected" XPos="41" YPos="89" Width="7" Height="6" />
- <Image Name="TabButtonRightSelected" XPos="62" YPos="89" Width="7" Height="6" />
- <Image Name="TabButtonUpperSelected" XPos="52" YPos="78" Width="6" Height="7" />
- <Image Name="TabButtonLowerSelected" XPos="52" YPos="89" Width="6" Height="6" />
- <Image Name="TabButtonUpperLeftSelected" XPos="41" YPos="78" Width="7" Height="7" />
- <Image Name="TabButtonUpperRightSelected" XPos="62" YPos="78" Width="7" Height="7" />
- <Image Name="TabButtonLowerLeftSelected" XPos="41" YPos="99" Width="7" Height="7" />
- <Image Name="TabButtonLowerRightSelected" XPos="62" YPos="99" Width="7" Height="7" />
- <Image Name="TabButtonMiddleSelected" XPos="52" YPos="89" Width="6" Height="6" />
- <Image Name="TooltipTopLeft" XPos="61" YPos="160" Width="4" Height="4" />
- <Image Name="TooltipTopRight" XPos="85" YPos="160" Width="5" Height="4" />
- <Image Name="TooltipBottomLeft" XPos="61" YPos="184" Width="4" Height="5" />
- <Image Name="TooltipBottomRight" XPos="85" YPos="184" Width="5" Height="5" />
- <Image Name="TooltipLeftEdge" XPos="61" YPos="171" Width="4" Height="6" />
- <Image Name="TooltipRightEdge" XPos="85" YPos="171" Width="5" Height="6" />
- <Image Name="TooltipTopEdge" XPos="72" YPos="160" Width="6" Height="4" />
- <Image Name="TooltipBottomEdge" XPos="72" YPos="184" Width="6" Height="5" />
- <Image Name="TooltipMiddle" XPos="72" YPos="171" Width="6" Height="6" />
- <Image Name="MenuTopLeft" XPos="166" YPos="204" Width="2" Height="2" />
- <Image Name="MenuTopRight" XPos="175" YPos="204" Width="3" Height="2" />
- <Image Name="MenuBottomLeft" XPos="166" YPos="213" Width="2" Height="3" />
- <Image Name="MenuBottomRight" XPos="175" YPos="213" Width="3" Height="3" />
- <Image Name="MenuLeft" XPos="166" YPos="209" Width="2" Height="1" />
- <Image Name="MenuRight" XPos="175" YPos="209" Width="3" Height="1" />
- <Image Name="MenuTop" XPos="171" YPos="204" Width="1" Height="2" />
- <Image Name="MenuBottom" XPos="171" YPos="213" Width="1" Height="3" />
- <Image Name="MenuMiddle" XPos="171" YPos="209" Width="1" Height="1" />
- <Image Name="PopupMenuFrameTopLeft" XPos="186" YPos="204" Width="2" Height="2" />
- <Image Name="PopupMenuFrameTopRight" XPos="195" YPos="204" Width="4" Height="2" />
- <Image Name="PopupMenuFrameBottomLeft" XPos="186" YPos="213" Width="2" Height="4" />
- <Image Name="PopupMenuFrameBottomRight" XPos="195" YPos="213" Width="4" Height="4" />
- <Image Name="PopupMenuFrameLeft" XPos="186" YPos="209" Width="2" Height="1" />
- <Image Name="PopupMenuFrameRight" XPos="195" YPos="209" Width="4" Height="1" />
- <Image Name="PopupMenuFrameTop" XPos="191" YPos="204" Width="1" Height="2" />
- <Image Name="PopupMenuFrameBottom" XPos="191" YPos="213" Width="1" Height="4" />
- <Image Name="PopupMenuMiddle" XPos="191" YPos="209" Width="1" Height="1" />
- <Image Name="PopupMenuArrowRight" XPos="179" YPos="204" Width="5" Height="5" />
- <Image Name="PopupMenuArrowLeft" XPos="179" YPos="210" Width="5" Height="5" />
-</Imageset>
diff --git a/navit/gui/sdl/datafiles/imagesets/TaharezLook.tga b/navit/gui/sdl/datafiles/imagesets/TaharezLook.tga
deleted file mode 100755
index 9659b7fb..00000000
--- a/navit/gui/sdl/datafiles/imagesets/TaharezLook.tga
+++ /dev/null
Binary files differ
diff --git a/navit/gui/sdl/datafiles/imagesets/navit-skin-black-imageset.tga b/navit/gui/sdl/datafiles/imagesets/navit-skin-black-imageset.tga
deleted file mode 100644
index f617b78d..00000000
--- a/navit/gui/sdl/datafiles/imagesets/navit-skin-black-imageset.tga
+++ /dev/null
Binary files differ
diff --git a/navit/gui/sdl/datafiles/layouts/GUILayout.xsd b/navit/gui/sdl/datafiles/layouts/GUILayout.xsd
deleted file mode 100644
index 0a3a5b9c..00000000
--- a/navit/gui/sdl/datafiles/layouts/GUILayout.xsd
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0"?>
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
-
- <xsd:element name="GUILayout" type="GUILayoutType"/>
-
- <xsd:complexType name="GUILayoutType">
- <xsd:sequence>
- <xsd:element name="Window" type="WindowType" />
- </xsd:sequence>
- <xsd:attribute name="Parent" type="xsd:string" use="optional" default=""/>
- </xsd:complexType>
-
- <xsd:complexType name="WindowType">
- <xsd:sequence>
- <xsd:element name="LayoutImport" type="LayoutImportType" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element name="Event" type="EventType" minOccurs="0" maxOccurs="unbounded" />
- <xsd:choice minOccurs="0" maxOccurs="unbounded">
- <xsd:element name="Window" type="WindowType" />
- <xsd:element name="AutoWindow" type="AutoWindowType" />
- </xsd:choice>
- <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="Type" type="xsd:string" use="required"/>
- <xsd:attribute name="Name" type="xsd:string" use="optional" default="" />
- </xsd:complexType>
-
- <xsd:complexType name="AutoWindowType">
- <xsd:sequence>
- <xsd:element name="LayoutImport" type="LayoutImportType" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element name="Event" type="EventType" minOccurs="0" maxOccurs="unbounded" />
- <xsd:choice minOccurs="0" maxOccurs="unbounded">
- <xsd:element name="Window" type="WindowType" />
- <xsd:element name="AutoWindow" type="AutoWindowType" />
- </xsd:choice>
- <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="NameSuffix" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <xsd:complexType name="PropertyType">
- <xsd:simpleContent>
- <xsd:extension base="xsd:string">
- <xsd:attribute name="Name" type="xsd:string" use="required"/>
- <xsd:attribute name="Value" type="xsd:string" use="optional"/>
- </xsd:extension>
- </xsd:simpleContent>
- </xsd:complexType>
-
- <xsd:complexType name="LayoutImportType">
- <xsd:attribute name="Filename" type="xsd:string" use="required"/>
- <xsd:attribute name="Prefix" type="xsd:string" use="optional" default="" />
- <xsd:attribute name="ResourceGroup" type="xsd:string" use="optional" default="" />
- </xsd:complexType>
-
- <xsd:complexType name="EventType">
- <xsd:attribute name="Name" type="xsd:string" use="required"/>
- <xsd:attribute name="Function" type="xsd:string" use="required"/>
- </xsd:complexType>
-
-</xsd:schema>
-
diff --git a/navit/gui/sdl/datafiles/layouts/Mineque.layout b/navit/gui/sdl/datafiles/layouts/Mineque.layout
deleted file mode 100644
index 58f6e073..00000000
--- a/navit/gui/sdl/datafiles/layouts/Mineque.layout
+++ /dev/null
@@ -1,258 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<GUILayout >
- <!-- The main window. Everything has to be a child of it. -->
- <Window Type="DefaultWindow" Name="Navit" >
- <Property Name="InheritsAlpha" Value="False" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
-
- <!-- Items for the Bottom Panel -->
- <Window Type="NavitGrey/StaticImage" Name="BottomPanel" >
- <Property Name="Image" Value="set:Mineque-Black image:BottomStreetPanel" />
- <Property Name="UnifiedAreaRect" Value="{{0,1},{0,550},{0,660},{0,600}}" />
- <Property Name="ZOrderChangeEnabled" value="False" />
- </Window>
- <Window Type="NavitGrey/StaticText" Name="Navit/Routing/Tips" >
- <Property Name="Font" Value="DejaVuSans-14" />
- <Property Name="Visible" Value="True" />
- <Property Name="HorzFormatting" Value="WordWrapCentred" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0,60},{0,565},{0,600},{0,598}}" />
- </Window>
-
- <!-- Items for the Right Panel -->
- <Window Type="NavitGrey/StaticImage" Name="RightPanel" >
- <Property Name="Image" Value="set:Mineque-Black image:RightPanel" />
- <Property Name="UnifiedAreaRect" Value="{{0,635},{0,0},{0,800},{0,600}}" />
- <Property Name="ZOrderChangeEnabled" value="False" />
- </Window>
-
- <Window Type="NavitGrey/ViewModeSwitchButton" Name="OSD/ViewMode" >
- <Property Name="UnifiedAreaRect" Value="{{0,702},{0,502},{0,800},{0,600}}" />
- <Property Name="ZOrderChangeEnabled" value="False" />
- </Window>
- <Window Type="NavitGrey/ZoomInButton" Name="ZoomInButton" >
- <Property Name="UnifiedAreaRect" Value="{{0,707},{0,469},{0,800},{0,532}}" />
- <Property Name="ZOrderChangeEnabled" value="False" />
- </Window>
- <Window Type="NavitGrey/ZoomOutButton" Name="ZoomOutButton" >
- <Property Name="UnifiedAreaRect" Value="{{0,669},{0,507},{0,731},{0,600}}" />
- <Property Name="ZOrderChangeEnabled" value="False" />
- </Window>
-
- <Window Type="NavitGrey/StaticText" Name="OSD/SpeedoMeterLabel" >
- <Property Name="Font" Value="DejaVuSans-12" />
- <Property Name="Text" Value="Speed" />
- <Property Name="HorzFormatting" Value="WordWrapCentred" />
- <Property Name="UnifiedAreaRect" Value="{{0,670},{0,100},{0,800},{0,128}}" />
- </Window>
- <Window Type="NavitGrey/StaticText" Name="OSD/SpeedoMeter" >
- <Property Name="Font" Value="DejaVuSans-14" />
- <Property Name="HorzFormatting" Value="WordWrapCentred" />
- <Property Name="UnifiedAreaRect" Value="{{0,670},{0,120},{0,800},{0,150}}" />
- </Window>
- <Window Type="NavitGrey/StaticText" Name="OSD/AltimeterLabel" >
- <Property Name="Font" Value="DejaVuSans-12" />
- <Property Name="Text" Value="Alt." />
- <Property Name="HorzFormatting" Value="WordWrapCentred" />
- <Property Name="UnifiedAreaRect" Value="{{0,670},{0,148},{0,800},{0,176}}" />
- </Window>
- <Window Type="NavitGrey/StaticText" Name="OSD/Altimeter" >
- <Property Name="Font" Value="DejaVuSans-14" />
- <Property Name="HorzFormatting" Value="WordWrapCentred" />
- <Property Name="UnifiedAreaRect" Value="{{0,670},{0,164},{0,800},{0,194}}" />
- </Window>
- <Window Type="NavitGrey/StaticText" Name="OSD/Satellites" >
- <Property Name="Font" Value="DejaVuSans-12" />
- <Property Name="HorzFormatting" Value="WordWrapCentred" />
- <Property Name="UnifiedAreaRect" Value="{{0,670},{0,196},{0,800},{0,226}}" />
- </Window>
-
-
-
- <Window Type="TaharezLook/LargeVerticalScrollbar" Name="OSD/Scrollbar1" >
- <Property Name="PageSize" Value="0" />
- <Property Name="OverlapSize" Value="0" />
- <Property Name="StepSize" Value="200" />
- <Property Name="DocumentSize" Value="2000" />
- <Property Name="ScrollPosition" Value="400" />
- <Property Name="UnifiedMaxSize" Value="{{0.03,0},{1,0}}" />
- <Property Name="UnifiedMinSize" Value="{{0.01,0},{0.1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0,770},{0,300},{0,790},{0,450}}" />
- </Window>
-
-
- <!-- Items for the Top Panel -->
- <Window Type="NavitGrey/StaticImage" Name="TopPanel" >
- <Property Name="Image" Value="set:Mineque-Black image:TopPanel" />
- <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{0,800},{0,64}}" />
- <Property Name="ZOrderChangeEnabled" value="False" />
- </Window>
- <Window Type="NavitGrey/QuitButton" Name="OSD/Quit" >
- <Property Name="UnifiedAreaRect" Value="{{0,8},{0,4},{0,37},{0,34}}" />
- <Property Name="ZOrderChangeEnabled" value="False" />
- </Window>
- <Window Type="NavitGrey/RouteButton" Name="DestinationButton" >
- <Property Name="UnifiedAreaRect" Value="{{0,152},{0,1},{0,188},{0,36}}" />
- <Property Name="ZOrderChangeEnabled" value="False" />
- </Window>
- <Window Type="NavitGrey/StaticImage" Name="SateliteImage" >
- <Property Name="Image" Value="set:Mineque-Black image:SateliteImage" />
- <Property Name="UnifiedAreaRect" Value="{{0,672},{0,7},{0,702},{0,45}}" />
- <Property Name="ZOrderChangeEnabled" value="False" />
- </Window>
-
- <Window Type="NavitGrey/OptionsButton" Name="OptionsButton" >
- <Property Name="ZOrderChangeEnabled" value="False" />
- <Property Name="UnifiedAreaRect" Value="{{0,79},{0,5},{0,116},{0,30}}" />
- </Window>
-
-
- <Window Type="NavitGrey/SpeakerButton" Name="OSD/nGhostButton" >
- <Property Name="ZOrderChangeEnabled" value="False" />
- <Property Name="UnifiedAreaRect" Value="{{0,632},{0,9},{0,660},{0,45}}" />
- </Window>
- <Window Type="NavitGrey/StaticImage" Name="SateliteStrenghBar1" >
- <Property Name="Image" Value="set:Mineque-Black image:SateliteStrenghBarOff" />
- <Property Name="UnifiedAreaRect" Value="{{0,707},{0,12},{0,724},{0,44}}" />
- </Window>
- <Window Type="NavitGrey/StaticImage" Name="SateliteStrenghBar2" >
- <Property Name="Image" Value="set:Mineque-Black image:SateliteStrenghBarOff" />
- <Property Name="UnifiedAreaRect" Value="{{0,722},{0,12},{0,739},{0,44}}" />
- </Window>
- <Window Type="NavitGrey/StaticImage" Name="SateliteStrenghBar3" >
- <Property Name="Image" Value="set:Mineque-Black image:SateliteStrenghBarOff" />
- <Property Name="UnifiedAreaRect" Value="{{0,737},{0,12},{0,754},{0,44}}" />
- </Window>
- <Window Type="NavitGrey/StaticImage" Name="SateliteStrenghBar4" >
- <Property Name="Image" Value="set:Mineque-Black image:SateliteStrenghBarOff" />
- <Property Name="UnifiedAreaRect" Value="{{0,752},{0,12},{0,769},{0,44}}" />
- </Window>
- <Window Type="NavitGrey/StaticImage" Name="SateliteStrenghBar5" >
- <Property Name="Image" Value="set:Mineque-Black image:SateliteStrenghBarOff" />
- <Property Name="UnifiedAreaRect" Value="{{0,767},{0,12},{0,784},{0,44}}" />
- </Window>
-<!-- <Window Type="NavitGrey/NavitAboutButton" Name="NavitAboutButton"> -->
- <Window Type="NavitGrey/NavitAboutButton" Name="OSD/RoadbookButton">
- <Property Name="ZOrderChangeEnabled" value="False" />
- <Property Name="UnifiedAreaRect" Value="{{0,361},{0,13},{0,443},{0,38}}" />
- </Window>
-
-
- <!-- The Destination window and its controls -->
- <Window Type="TaharezLook/FrameWindow" Name="DestinationWindow" >
- <Property Name="Text" Value="Choose your destination" />
- <Property Name="Visible" Value="False" />
- <Property Name="Alpha" Value="0.7" />
- <Property Name="TitlebarEnabled" Value="True" />
- <Property Name="UnifiedAreaRect" Value="{{0.001,0},{0.07,0},{0.8,0},{0.9,0}}" />
- <Window Type="TaharezLook/StaticText" Name="DestinationWindow/Country" >
- <Property Name="Text" Value="Country :" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.05,0},{0.271871,0},{0.1,0}}" />
- </Window>
- <Window Type="TaharezLook/Editbox" Name="DestinationWindow/CountryEditbox" >
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.3,0},{0.05,0},{0.9,0},{0.1,0}}" />
- </Window>
- <Window Type="TaharezLook/StaticText" Name="DestinationWindow/Town" >
- <Property Name="Text" Value="Town : " />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.11,0},{0.275,0},{0.16,0}}" />
- </Window>
- <Window Type="TaharezLook/Editbox" Name="DestinationWindow/TownEditbox" >
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.3,0},{0.11,0},{0.9,0},{0.16,0}}" />
- </Window>
- <Window Type="TaharezLook/StaticText" Name="DestinationWindow/Street" >
- <Property Name="Text" Value="Street : " />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.17,0},{0.275,0},{0.22,0}}" />
- </Window>
- <Window Type="TaharezLook/Editbox" Name="DestinationWindow/StreetEditbox" >
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.3,0},{0.17,0},{0.9,0},{0.22,0}}" />
- </Window>
- <Window Type="TaharezLook/StaticText" Name="DestinationWindow/Label1" >
- <Property Name="Text" Value="Pick your choice :" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.23,0},{0.9,0},{0.28,0}}" />
- </Window>
- <Window Type="TaharezLook/MultiColumnList" Name="DestinationWindow/Listbox" >
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.29,0},{0.945,0},{0.905842,0}}" />
- </Window>
- <Window Type="TaharezLook/Button" Name="DestinationWindow/KB" >
- <Property Name="Text" Value="Keyboard" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.54,0},{0.92,0},{0.70,0},{0.98,0}}" />
- </Window>
- <Window Type="TaharezLook/Button" Name="DestinationWindow/GO" >
- <Property Name="Text" Value="Go!" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.72,0},{0.92,0},{0.97,0},{0.98,0}}" />
- </Window>
- <Window Type="TaharezLook/StaticText" Name="DestinationWindow/Dest_x" >
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.92,0},{0.12,0},{0.98,0}}" />
- </Window>
- <Window Type="TaharezLook/StaticText" Name="DestinationWindow/Dest_y" >
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.12,0},{0.92,0},{0.23,0},{0.98,0}}" />
- </Window>
-
- </Window>
-
- <!-- The RoadBook window, which use the old skin -->
- <Window Type="TaharezLook/FrameWindow" Name="Navit/RoadBook" >
- <Property Name="Alpha" Value="0.85" />
- <Property Name="Visible" Value="False" />
- <Property Name="AlwaysOnTop" Value="True" />
- <Property Name="Text" Value="Road Book" />
- <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.02,0},{0.99,0},{0.87,0}}" />
- <Window Type="TaharezLook/MultiColumnList" Name="Roadbook" >
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.05,0},{0.99,0},{0.93,0}}" />
- </Window>
- <Window Type="TaharezLook/StaticText" Name="RoadBook/ETA" >
- <Property Name="Font" Value="DejaVuSans-12" />
- <Property Name="HorzFormatting" Value="WordWrapCentred" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.94,0},{0.7,0},{0.99,0}}" />
- </Window>
- <Window Type="TaharezLook/Button" Name="OSD/RoadbookButton2" >
- <Property Name="Text" Value="Close" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.8,0},{0.94,0},{0.99,0},{0.99,0}}" />
- </Window>
- </Window>
- <Window Type="TaharezLook/FrameWindow" Name="Navit/Keyboard" >
- <Property Name="Alpha" Value="0.85" />
- <Property Name="Visible" Value="False" />
- <Property Name="AlwaysOnTop" Value="True" />
- <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.5,0},{0.99,0},{0.87,0}}" />
- <Window Type="TaharezLook/StaticText" Name="Navit/Keyboard/Input" >
- <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.80,0},{0.7,0},{0.95,0}}" />
- </Window>
- </Window>
-
- <!-- These arrows will be used later, to move the map
- <Window Type="NavitGrey/ArrowLeft" Name="ArrowLeft" >
- <Property Name="UnifiedAreaRect" Value="{{0,},{0,0},{0,39},{0,34}}" />
- </Window>
- <Window Type="NavitGrey/ArrowTop" Name="ArrowTop" >
- <Property Name="UnifiedAreaRect" Value="{{0,},{0,0},{0,34},{0,39}}" />
- </Window>
- <Window Type="NavitGrey/ArrowRight" Name="ArrowRight" >
- <Property Name="UnifiedAreaRect" Value="{{0,},{0,0},{0,39},{0,34}}" />
- </Window>
- <Window Type="NavitGrey/ArrowDown" Name="ArrowDown" >
- <Property Name="TitlebarEnabled" Value="False" />
- <Property Name="UnifiedAreaRect" Value="{{0,},{0,0},{0,34},{0,39}}" />
- </Window>
- -->
-
-
- </Window> <!-- Navit window -->
-</GUILayout>
diff --git a/navit/gui/sdl/datafiles/layouts/TaharezLook.layout b/navit/gui/sdl/datafiles/layouts/TaharezLook.layout
deleted file mode 100755
index 351dfbed..00000000
--- a/navit/gui/sdl/datafiles/layouts/TaharezLook.layout
+++ /dev/null
@@ -1,260 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<GUILayout >
- <Window Type="DefaultWindow" Name="Navit" >
- <Property Name="InheritsAlpha" Value="False" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
-
- <Window Type="TaharezLook/FrameWindow" Name="DestinationChoose" >
- <Property Name="Text" Value="Choose your destination" />
- <Property Name="Visible" Value="False" />
- <Property Name="Alpha" Value="0.7" />
- <Property Name="TitlebarEnabled" Value="True" />
- <Property Name="UnifiedAreaRect" Value="{{0.001,0},{0.1,0},{0.8,0},{0.4,0}}" />
- <Window Type="TaharezLook/Button" Name="DestinationWindow/Address" >
- <Property Name="Text" Value="Search Address" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.02,0},{0.2,0},{0.26,0},{0.8,0}}" />
- </Window>
- <Window Type="TaharezLook/Button" Name="DestinationWindow/Bookmark" >
- <Property Name="Text" Value="Bookmark" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.32,0},{0.2,0},{0.57,0},{0.8,0}}" />
- </Window>
- <Window Type="TaharezLook/Button" Name="DestinationWindow/FormerDest" >
- <Property Name="Text" Value="FormerDest" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.62,0},{0.2,0},{0.87,0},{0.8,0}}" />
- </Window>
-
- </Window>
-
-
- <Window Type="TaharezLook/FrameWindow" Name="BookmarkSelection" >
- <Property Name="Text" Value="Choose your destination" />
- <Property Name="Visible" Value="False" />
- <Property Name="Alpha" Value="0.7" />
- <Property Name="TitlebarEnabled" Value="True" />
- <Property Name="UnifiedAreaRect" Value="{{0.001,0},{0.07,0},{0.8,0},{0.9,0}}" />
- <Window Type="TaharezLook/MultiColumnList" Name="Bookmarks/Listbox" >
- <Property Name="Font" Value="DejaVuSans-14" />
- <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.9,0}}" />
- </Window>
- </Window>
-
- <Window Type="TaharezLook/FrameWindow" Name="FormerDestSelection" >
- <Property Name="Text" Value="Choose your destination" />
- <Property Name="Visible" Value="False" />
- <Property Name="Alpha" Value="0.7" />
- <Property Name="TitlebarEnabled" Value="True" />
- <Property Name="UnifiedAreaRect" Value="{{0.001,0},{0.07,0},{0.8,0},{0.9,0}}" />
- <Window Type="TaharezLook/MultiColumnList" Name="FormerDests/Listbox" >
- <Property Name="Font" Value="DejaVuSans-14" />
- <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.9,0}}" />
- </Window>
- </Window>
-
- <Window Type="TaharezLook/FrameWindow" Name="AdressSearchWindow" >
- <Property Name="Text" Value="Choose your destination" />
- <Property Name="Visible" Value="False" />
- <Property Name="Alpha" Value="0.7" />
- <Property Name="TitlebarEnabled" Value="True" />
- <Property Name="UnifiedAreaRect" Value="{{0.001,0},{0.07,0},{0.8,0},{0.9,0}}" />
- <Window Type="TaharezLook/StaticText" Name="AdressSearch/Country" >
- <Property Name="Text" Value="Country :" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.05,0},{0.271871,0},{0.1,0}}" />
- </Window>
- <Window Type="TaharezLook/Editbox" Name="AdressSearch/CountryEditbox" >
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.3,0},{0.05,0},{0.9,0},{0.1,0}}" />
- </Window>
- <Window Type="TaharezLook/StaticText" Name="AdressSearch/Town" >
- <Property Name="Text" Value="Town : " />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.11,0},{0.275,0},{0.16,0}}" />
- </Window>
- <Window Type="TaharezLook/Editbox" Name="AdressSearch/TownEditbox" >
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.3,0},{0.11,0},{0.9,0},{0.16,0}}" />
- </Window>
- <Window Type="TaharezLook/StaticText" Name="AdressSearch/Street" >
- <Property Name="Text" Value="Street : " />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.17,0},{0.275,0},{0.22,0}}" />
- </Window>
- <Window Type="TaharezLook/Editbox" Name="AdressSearch/StreetEditbox" >
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.3,0},{0.17,0},{0.9,0},{0.22,0}}" />
- </Window>
- <Window Type="TaharezLook/StaticText" Name="AdressSearch/Label1" >
- <Property Name="Text" Value="Pick your choice :" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.23,0},{0.9,0},{0.28,0}}" />
- </Window>
- <Window Type="TaharezLook/MultiColumnList" Name="AdressSearch/Listbox" >
- <Property Name="Font" Value="DejaVuSans-14" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.29,0},{0.945,0},{0.905842,0}}" />
- </Window>
- <Window Type="TaharezLook/Button" Name="AdressSearch/KB" >
- <Property Name="Text" Value="Keyboard" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.54,0},{0.92,0},{0.70,0},{0.98,0}}" />
- </Window>
- <Window Type="TaharezLook/Button" Name="AdressSearch/GO" >
- <Property Name="Text" Value="Go!" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.72,0},{0.92,0},{0.97,0},{0.98,0}}" />
- </Window>
- <Window Type="TaharezLook/StaticText" Name="AdressSearch/Dest_x" >
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.92,0},{0.12,0},{0.98,0}}" />
- </Window>
- <Window Type="TaharezLook/StaticText" Name="AdressSearch/Dest_y" >
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.12,0},{0.92,0},{0.23,0},{0.98,0}}" />
- </Window>
- </Window>
-
- <Window Type="TaharezLook/StaticText" Name="Navit/Routing/Tips" >
- <Property Name="Font" Value="DejaVuSans-14" />
- <Property Name="Text" Value="No destination set." />
- <Property Name="Alpha" Value="0.7" />
- <Property Name="Visible" Value="False" />
- <Property Name="HorzFormatting" Value="WordWrapCentred" />
- <Property Name="UnifiedAreaRect" Value="{{0.02,0},{0.88,0},{0.77,0},{0.98,0}}" />
- </Window>
- <Window Type="TaharezLook/StaticText" Name="Navit/Routing/CurrentRoadName" >
- <Property Name="Font" Value="DejaVuSans-14" />
- <Property Name="Alpha" Value="0.7" />
- <Property Name="HorzFormatting" Value="WordWrapCentred" />
- <Property Name="UnifiedAreaRect" Value="{{0.02,0},{0.001,0},{0.77,0},{0.07,0}}" />
- </Window>
- <Window Type="TaharezLook/Button" Name="DestinationButton" >
- <Property Name="Text" Value="Destination" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.8,0},{0.01,0},{0.99,0},{0.06,0}}" />
- </Window>
- <Window Type="TaharezLook/StaticText" Name="OSD/SpeedoMeter" >
- <Property Name="Font" Value="DejaVuSans-14" />
- <Property Name="HorzFormatting" Value="WordWrapCentred" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.8,0},{0.06,0},{0.99,0},{0.11,0}}" />
- </Window>
- <Window Type="TaharezLook/StaticText" Name="OSD/Altimeter" >
- <Property Name="Font" Value="DejaVuSans-14" />
- <Property Name="HorzFormatting" Value="WordWrapCentred" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.8,0},{0.11,0},{0.99,0},{0.16,0}}" />
- </Window>
- <Window Type="TaharezLook/StaticText" Name="OSD/Satellites" >
- <Property Name="Font" Value="DejaVuSans-12" />
- <Property Name="HorzFormatting" Value="WordWrapCentred" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.8,0},{0.16,0},{0.99,0},{0.21,0}}" />
- </Window>
- <Window Type="TaharezLook/StaticText" Name="OSD/Coords" >
- <Property Name="Font" Value="DejaVuSans-12" />
- <Property Name="HorzFormatting" Value="WordWrapCentred" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.8,0},{0.21,0},{0.99,0},{0.26,0}}" />
- </Window>
- <Window Type="TaharezLook/Button" Name="ZoomInButton" >
- <Property Name="Text" Value="ZoomIn" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.8,0},{0.26,0},{0.99,0},{0.31,0}}" />
- </Window>
- <Window Type="TaharezLook/Button" Name="ZoomOutButton" >
- <Property Name="Text" Value="ZoomOut" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.8,0},{0.31,0},{0.99,0},{0.36,0}}" />
- </Window>
- <Window Type="TaharezLook/Button" Name="OSD/RoadbookButton" >
- <Property Name="Text" Value="RoadBook" />
- <Property Name="Visible" Value="False" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.8,0},{0.36,0},{0.99,0},{0.41,0}}" />
- </Window>
- <Window Type="TaharezLook/StaticText" Name="OSD/ETA" >
- <Property Name="Font" Value="DejaVuSans-12" />
- <Property Name="Visible" Value="False" />
- <Property Name="HorzFormatting" Value="WordWrapCentred" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.8,0},{0.41,0},{0.99,0},{0.51,0}}" />
- </Window>
- <Window Type="TaharezLook/Button" Name="OSD/nGhostButton" >
- <Property Name="Text" Value="Media" />
- <Property Name="Visible" Value="True" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.8,0},{0.51,0},{0.99,0},{0.56,0}}" />
- </Window>
-
- <Window Type="TaharezLook/LargeVerticalScrollbar" Name="OSD/Scrollbar1" >
- <Property Name="PageSize" Value="0" />
- <Property Name="OverlapSize" Value="0" />
- <Property Name="DocumentSize" Value="2000" />
- <Property Name="ScrollPosition" Value="400" />
- <Property Name="UnifiedMaxSize" Value="{{0.03,0},{1,0}}" />
- <Property Name="UnifiedMinSize" Value="{{0.01,0},{0.1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.94,0},{0.58,0},{0.99,0},{0.85,0}}" />
- </Window>
-
-
- <Window Type="TaharezLook/Button" Name="OSD/ViewMode" >
- <Property Name="Text" Value="3D" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.8,0},{0.87,0},{0.99,0},{0.93,0}}" />
- </Window>
- <Window Type="TaharezLook/Button" Name="OSD/Quit" >
- <Property Name="Text" Value="Quit" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.8,0},{0.93,0},{0.99,0},{0.99,0}}" />
- </Window>
- <Window Type="TaharezLook/FrameWindow" Name="Navit/ProgressWindow" >
- <Property Name="Text" Value="Calculating the route" />
- <Property Name="Visible" Value="False" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="TitlebarEnabled" Value="True" />
- <Property Name="UnifiedAreaRect" Value="{{0.137865,0},{0.775,0},{0.729668,0},{0.888333,0}}" />
- <Window Type="TaharezLook/ProgressBar" Name="Navit/ProgressWindow/Bar" >
- <Property Name="StepSize" Value="0.01" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="CurrentProgress" Value="0" />
- <Property Name="UnifiedAreaRect" Value="{{0.0920548,0},{0.513128,0},{0.872384,0},{0.921541,0}}" />
- </Window>
- </Window>
- <Window Type="TaharezLook/FrameWindow" Name="Navit/RoadBook" >
- <Property Name="Alpha" Value="0.85" />
- <Property Name="Visible" Value="False" />
- <Property Name="AlwaysOnTop" Value="True" />
- <Property Name="Text" Value="Road Book" />
- <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.02,0},{0.99,0},{0.87,0}}" />
- <Window Type="TaharezLook/MultiColumnList" Name="Roadbook" >
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.05,0},{0.99,0},{0.93,0}}" />
- </Window>
- <Window Type="TaharezLook/StaticText" Name="RoadBook/ETA" >
- <Property Name="Font" Value="DejaVuSans-12" />
- <Property Name="HorzFormatting" Value="WordWrapCentred" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.94,0},{0.7,0},{0.99,0}}" />
- </Window>
- <Window Type="TaharezLook/Button" Name="OSD/RoadbookButton2" >
- <Property Name="Text" Value="Close" />
- <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.8,0},{0.94,0},{0.99,0},{0.99,0}}" />
- </Window>
- </Window>
- <Window Type="TaharezLook/FrameWindow" Name="Navit/Keyboard" >
- <Property Name="Alpha" Value="0.85" />
- <Property Name="Visible" Value="False" />
- <Property Name="AlwaysOnTop" Value="True" />
- <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.5,0},{0.99,0},{0.87,0}}" />
- <Window Type="TaharezLook/StaticText" Name="Navit/Keyboard/Input" >
- <Property Name="UnifiedAreaRect" Value="{{0.01,0},{0.80,0},{0.7,0},{0.95,0}}" />
- </Window>
- </Window>
- </Window>
-</GUILayout>
diff --git a/navit/gui/sdl/datafiles/looknfeel/Falagard.xsd b/navit/gui/sdl/datafiles/looknfeel/Falagard.xsd
deleted file mode 100644
index 590de6bc..00000000
--- a/navit/gui/sdl/datafiles/looknfeel/Falagard.xsd
+++ /dev/null
@@ -1,399 +0,0 @@
-<?xml version="1.0" ?>
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
- <xsd:element name="Falagard" type="falagardSpecificationType" />
- <xsd:complexType name="falagardSpecificationType">
- <xsd:sequence>
- <xsd:element name="WidgetLook" type="widgetLookType" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="widgetLookType">
- <xsd:sequence>
- <xsd:element name="PropertyDefinition" type="propertyDefinitionType" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element name="PropertyLinkDefinition" type="propertyLinkDefinitionType" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element name="Property" type="propertyType" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element name="NamedArea" type="namedAreaType" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element name="Child" type="widgetComponentType" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element name="ImagerySection" type="imagerySectionType" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element name="StateImagery" type="stateType" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- <xsd:complexType name="propertyDefinitionType">
- <xsd:attribute name="type" type="propertyTypeEnum" use="optional" default="Generic" />
- <xsd:attribute name="name" type="xsd:string" use="required" />
- <xsd:attribute name="initialValue" type="xsd:string" use="optional" default="" />
- <xsd:attribute name="layoutOnWrite" type="xsd:boolean" use="optional" default="false" />
- <xsd:attribute name="redrawOnWrite" type="xsd:boolean" use="optional" default="false" />
- </xsd:complexType>
- <xsd:complexType name="propertyLinkDefinitionType">
- <xsd:attribute name="type" type="propertyTypeEnum" use="optional" default="Generic" />
- <xsd:attribute name="name" type="xsd:string" use="required" />
- <xsd:attribute name="widget" type="xsd:string" use="required" />
- <xsd:attribute name="targetProperty" type="xsd:string" use="optional" default="" />
- <xsd:attribute name="initialValue" type="xsd:string" use="optional" default="" />
- <xsd:attribute name="layoutOnWrite" type="xsd:boolean" use="optional" default="false" />
- <xsd:attribute name="redrawOnWrite" type="xsd:boolean" use="optional" default="false" />
- </xsd:complexType>
- <xsd:complexType name="namedAreaType">
- <xsd:sequence>
- <xsd:element name="Area" type="componentAreaType" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- <xsd:complexType name="stateType">
- <xsd:sequence>
- <xsd:element name="Layer" type="layerType" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- <xsd:attribute name="clipped" type="xsd:boolean" use="optional" default="true" />
- </xsd:complexType>
- <xsd:complexType name="layerType">
- <xsd:sequence>
- <xsd:element name="Section" type="sectionSpecType" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="priority" type="xsd:integer" use="optional" default="0" />
- </xsd:complexType>
- <xsd:complexType name="sectionSpecType">
- <xsd:choice minOccurs="0" maxOccurs="1">
- <xsd:element name="Colour" type="colourType" />
- <xsd:element name="Colours" type="colourRectType" />
- <xsd:element name="ColourProperty" type="settingByPropertyType" />
- <xsd:element name="ColourRectProperty" type="settingByPropertyType" />
- </xsd:choice>
- <xsd:attribute name="look" type="xsd:string" use="optional" default="" />
- <xsd:attribute name="section" type="xsd:string" use="required" />
- <xsd:attribute name="controlProperty" type="xsd:string" use="optional" default="" />
- </xsd:complexType>
- <xsd:complexType name="imagerySectionType">
- <xsd:sequence>
- <xsd:choice minOccurs="0" maxOccurs="1">
- <xsd:element name="Colour" type="colourType" />
- <xsd:element name="Colours" type="colourRectType" />
- <xsd:element name="ColourProperty" type="settingByPropertyType" />
- <xsd:element name="ColourRectProperty" type="settingByPropertyType" />
- </xsd:choice>
- <xsd:element name="FrameComponent" type="frameComponentType" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element name="ImageryComponent" type="imageryComponentType" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element name="TextComponent" type="textComponentType" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- <xsd:complexType name="frameComponentType">
- <xsd:sequence>
- <xsd:element name="Area" type="componentAreaType" />
- <xsd:element name="Image" type="frameImageType" minOccurs="0" maxOccurs="9" />
- <xsd:choice minOccurs="0" maxOccurs="1">
- <xsd:element name="Colour" type="colourType" />
- <xsd:element name="Colours" type="colourRectType" />
- <xsd:element name="ColourProperty" type="settingByPropertyType" />
- <xsd:element name="ColourRectProperty" type="settingByPropertyType" />
- </xsd:choice>
- <xsd:choice minOccurs="0" maxOccurs="1">
- <xsd:element name="VertFormat" type="vertFormatType" />
- <xsd:element name="VertFormatProperty" type="settingByPropertyType" />
- </xsd:choice>
- <xsd:choice minOccurs="0" maxOccurs="1">
- <xsd:element name="HorzFormat" type="horzFormatType" />
- <xsd:element name="HorzFormatProperty" type="settingByPropertyType" />
- </xsd:choice>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="textComponentType">
- <xsd:sequence>
- <xsd:element name="Area" type="componentAreaType" />
- <xsd:element name="Text" type="textStringType" minOccurs="0" maxOccurs="1" />
- <xsd:element name="TextProperty" type="textPropertyType" minOccurs="0" maxOccurs="1" />
- <xsd:element name="FontProperty" type="fontPropertyType" minOccurs="0" maxOccurs="1" />
- <xsd:choice minOccurs="0" maxOccurs="1">
- <xsd:element name="Colour" type="colourType" />
- <xsd:element name="Colours" type="colourRectType" />
- <xsd:element name="ColourProperty" type="settingByPropertyType" />
- <xsd:element name="ColourRectProperty" type="settingByPropertyType" />
- </xsd:choice>
- <xsd:choice minOccurs="0" maxOccurs="1">
- <xsd:element name="VertFormat" type="vertTextFormatType" />
- <xsd:element name="VertFormatProperty" type="settingByPropertyType" />
- </xsd:choice>
- <xsd:choice minOccurs="0" maxOccurs="1">
- <xsd:element name="HorzFormat" type="horzTextFormatType" />
- <xsd:element name="HorzFormatProperty" type="settingByPropertyType" />
- </xsd:choice>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="imageryComponentType">
- <xsd:sequence>
- <xsd:element name="Area" type="componentAreaType" />
- <xsd:choice>
- <xsd:element name="Image" type="imageType" />
- <xsd:element name="ImageProperty" type="settingByPropertyType" />
- </xsd:choice>
- <xsd:choice minOccurs="0" maxOccurs="1">
- <xsd:element name="Colour" type="colourType" />
- <xsd:element name="Colours" type="colourRectType" />
- <xsd:element name="ColourProperty" type="settingByPropertyType" />
- <xsd:element name="ColourRectProperty" type="settingByPropertyType" />
- </xsd:choice>
- <xsd:choice minOccurs="0" maxOccurs="1">
- <xsd:element name="VertFormat" type="vertFormatType" />
- <xsd:element name="VertFormatProperty" type="settingByPropertyType" />
- </xsd:choice>
- <xsd:choice minOccurs="0" maxOccurs="1">
- <xsd:element name="HorzFormat" type="horzFormatType" />
- <xsd:element name="HorzFormatProperty" type="settingByPropertyType" />
- </xsd:choice>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="widgetComponentType">
- <xsd:sequence>
- <xsd:element name="Area" type="componentAreaType" />
- <xsd:element name="VertAlignment" type="vertAlignmentType" minOccurs="0" maxOccurs="1" />
- <xsd:element name="HorzAlignment" type="horzAlignmentType" minOccurs="0" maxOccurs="1" />
- <xsd:element name="Property" type="propertyType" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="type" type="xsd:string" use="required" />
- <xsd:attribute name="nameSuffix" type="xsd:string" use="required" />
- <xsd:attribute name="renderer" type="xsd:string" use="optional" default="" />
- <xsd:attribute name="look" type="xsd:string" use="optional" default="" />
- </xsd:complexType>
- <xsd:complexType name="horzFormatType">
- <xsd:attribute name="type" type="horzFormatEnum" use="required" />
- </xsd:complexType>
- <xsd:complexType name="vertFormatType">
- <xsd:attribute name="type" type="vertFormatEnum" use="required" />
- </xsd:complexType>
- <xsd:complexType name="horzTextFormatType">
- <xsd:attribute name="type" type="horzTextFormatEnum" use="required" />
- </xsd:complexType>
- <xsd:complexType name="vertTextFormatType">
- <xsd:attribute name="type" type="vertTextFormatEnum" use="required" />
- </xsd:complexType>
- <xsd:complexType name="horzAlignmentType">
- <xsd:attribute name="type" type="horzAlignmentEnum" use="required" />
- </xsd:complexType>
- <xsd:complexType name="vertAlignmentType">
- <xsd:attribute name="type" type="vertAlignmentEnum" use="required" />
- </xsd:complexType>
- <xsd:complexType name="propertyType">
- <xsd:attribute name="name" type="xsd:string" use="required" />
- <xsd:attribute name="value" type="xsd:string" use="required" />
- </xsd:complexType>
- <xsd:complexType name="imageType">
- <xsd:attribute name="imageset" type="xsd:string" use="required" />
- <xsd:attribute name="image" type="xsd:string" use="required" />
- </xsd:complexType>
- <xsd:complexType name="frameImageType">
- <xsd:attribute name="type" type="frameImageComponentEnum" use="required" />
- <xsd:attribute name="imageset" type="xsd:string" use="required" />
- <xsd:attribute name="image" type="xsd:string" use="required" />
- </xsd:complexType>
- <xsd:complexType name="componentAreaType">
- <xsd:choice>
- <xsd:sequence>
- <xsd:element name="Dim" type="dimensionType" minOccurs="4" maxOccurs="4" />
- </xsd:sequence>
- <xsd:element name="AreaProperty" type="settingByPropertyType" />
- </xsd:choice>
- </xsd:complexType>
- <xsd:complexType name="dimensionType">
- <xsd:choice>
- <xsd:element name="UnifiedDim" type="unifiedDimType" />
- <xsd:element name="AbsoluteDim" type="absoluteDimType" />
- <xsd:element name="ImageDim" type="imageDimType" />
- <xsd:element name="WidgetDim" type="widgetDimType" />
- <xsd:element name="FontDim" type="fontDimType" />
- <xsd:element name="PropertyDim" type="propertyDimType" />
- </xsd:choice>
- <xsd:attribute name="type" type="dimensionTypeEnum" use="required" />
- </xsd:complexType>
- <xsd:complexType name="fontDimType">
- <xsd:sequence>
- <xsd:element name="DimOperator" type="dimensionOperatorType" minOccurs="0" maxOccurs="1" />
- </xsd:sequence>
- <xsd:attribute name="widget" type="xsd:string" use="optional" default="" />
- <xsd:attribute name="font" type="xsd:string" use="optional" default="" />
- <xsd:attribute name="string" type="xsd:string" use="optional" default="" />
- <xsd:attribute name="type" type="fontMetricTypeEnum" use="required" />
- <xsd:attribute name="padding" type="xsd:decimal" use="optional" default="0" />
- </xsd:complexType>
- <xsd:complexType name="propertyDimType">
- <xsd:sequence>
- <xsd:element name="DimOperator" type="dimensionOperatorType" minOccurs="0" maxOccurs="1" />
- </xsd:sequence>
- <xsd:attribute name="widget" type="xsd:string" use="optional" default="" />
- <xsd:attribute name="name" type="xsd:string" use="required" />
- <xsd:attribute name="type" type="propertyDimensionTypeEnum" use="optional" default="" />
- </xsd:complexType>
- <xsd:complexType name="unifiedDimType">
- <xsd:sequence>
- <xsd:element name="DimOperator" type="dimensionOperatorType" minOccurs="0" maxOccurs="1" />
- </xsd:sequence>
- <xsd:attribute name="scale" type="xsd:decimal" use="optional" default="0" />
- <xsd:attribute name="offset" type="xsd:integer" use="optional" default="0" />
- <xsd:attribute name="type" type="dimensionTypeEnum" use="required" />
- </xsd:complexType>
- <xsd:complexType name="absoluteDimType">
- <xsd:sequence>
- <xsd:element name="DimOperator" type="dimensionOperatorType" minOccurs="0" maxOccurs="1" />
- </xsd:sequence>
- <xsd:attribute name="value" type="xsd:decimal" use="optional" default="0" />
- </xsd:complexType>
- <xsd:complexType name="imageDimType">
- <xsd:sequence>
- <xsd:element name="DimOperator" type="dimensionOperatorType" minOccurs="0" maxOccurs="1" />
- </xsd:sequence>
- <xsd:attribute name="imageset" type="xsd:string" use="required" />
- <xsd:attribute name="image" type="xsd:string" use="required" />
- <xsd:attribute name="dimension" type="dimensionTypeEnum" use="required" />
- </xsd:complexType>
- <xsd:complexType name="widgetDimType">
- <xsd:sequence>
- <xsd:element name="DimOperator" type="dimensionOperatorType" minOccurs="0" maxOccurs="1" />
- </xsd:sequence>
- <xsd:attribute name="widget" type="xsd:string" use="optional" default="" />
- <xsd:attribute name="dimension" type="dimensionTypeEnum" use="required" />
- </xsd:complexType>
- <xsd:complexType name="settingByPropertyType">
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- <xsd:complexType name="colourRectType">
- <xsd:attribute name="topLeft" type="colourValType" use="required" />
- <xsd:attribute name="topRight" type="colourValType" use="required" />
- <xsd:attribute name="bottomLeft" type="colourValType" use="required" />
- <xsd:attribute name="bottomRight" type="colourValType" use="required" />
- </xsd:complexType>
- <xsd:complexType name="colourType">
- <xsd:attribute name="colour" type="colourValType" use="required" />
- </xsd:complexType>
- <xsd:simpleType name="colourValType">
- <xsd:restriction base="xsd:string">
- <xsd:pattern value="[a-fA-F0-9]{8}" />
- </xsd:restriction>
- </xsd:simpleType>
- <xsd:complexType name="textStringType">
- <xsd:attribute name="string" type="xsd:string" use="optional" default="" />
- <xsd:attribute name="font" type="xsd:string" use="optional" default="" />
- </xsd:complexType>
- <xsd:complexType name="textPropertyType">
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- <xsd:complexType name="fontPropertyType">
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- <xsd:complexType name="dimensionOperatorType">
- <xsd:choice>
- <xsd:element name="UnifiedDim" type="unifiedDimType" />
- <xsd:element name="AbsoluteDim" type="absoluteDimType" />
- <xsd:element name="ImageDim" type="imageDimType" />
- <xsd:element name="WidgetDim" type="widgetDimType" />
- <xsd:element name="FontDim" type="fontDimType" />
- <xsd:element name="PropertyDim" type="propertyDimType" />
- </xsd:choice>
- <xsd:attribute name="op" type="dimensionOperatorEnum" use="required" />
- </xsd:complexType>
- <xsd:simpleType name="propertyDimensionTypeEnum">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="" />
- <xsd:enumeration value="Width" />
- <xsd:enumeration value="Height" />
- </xsd:restriction>
- </xsd:simpleType>
- <xsd:simpleType name="dimensionTypeEnum">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="LeftEdge" />
- <xsd:enumeration value="TopEdge" />
- <xsd:enumeration value="RightEdge" />
- <xsd:enumeration value="BottomEdge" />
- <xsd:enumeration value="XPosition" />
- <xsd:enumeration value="YPosition" />
- <xsd:enumeration value="Width" />
- <xsd:enumeration value="Height" />
- <xsd:enumeration value="XOffset" />
- <xsd:enumeration value="YOffset" />
- </xsd:restriction>
- </xsd:simpleType>
- <xsd:simpleType name="vertFormatEnum">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="TopAligned" />
- <xsd:enumeration value="CentreAligned" />
- <xsd:enumeration value="BottomAligned" />
- <xsd:enumeration value="Stretched" />
- <xsd:enumeration value="Tiled" />
- </xsd:restriction>
- </xsd:simpleType>
- <xsd:simpleType name="horzFormatEnum">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="LeftAligned" />
- <xsd:enumeration value="CentreAligned" />
- <xsd:enumeration value="RightAligned" />
- <xsd:enumeration value="Stretched" />
- <xsd:enumeration value="Tiled" />
- </xsd:restriction>
- </xsd:simpleType>
- <xsd:simpleType name="vertAlignmentEnum">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="TopAligned" />
- <xsd:enumeration value="CentreAligned" />
- <xsd:enumeration value="BottomAligned" />
- </xsd:restriction>
- </xsd:simpleType>
- <xsd:simpleType name="horzAlignmentEnum">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="LeftAligned" />
- <xsd:enumeration value="CentreAligned" />
- <xsd:enumeration value="RightAligned" />
- </xsd:restriction>
- </xsd:simpleType>
- <xsd:simpleType name="horzTextFormatEnum">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="LeftAligned" />
- <xsd:enumeration value="RightAligned" />
- <xsd:enumeration value="CentreAligned" />
- <xsd:enumeration value="Justified" />
- <xsd:enumeration value="WordWrapLeftAligned" />
- <xsd:enumeration value="WordWrapRightAligned" />
- <xsd:enumeration value="WordWrapCentreAligned" />
- <xsd:enumeration value="WordWrapJustified" />
- </xsd:restriction>
- </xsd:simpleType>
- <xsd:simpleType name="vertTextFormatEnum">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="TopAligned" />
- <xsd:enumeration value="BottomAligned" />
- <xsd:enumeration value="CentreAligned" />
- </xsd:restriction>
- </xsd:simpleType>
- <xsd:simpleType name="propertyTypeEnum">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="Generic" />
- </xsd:restriction>
- </xsd:simpleType>
- <xsd:simpleType name="fontMetricTypeEnum">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="LineSpacing" />
- <xsd:enumeration value="Baseline" />
- <xsd:enumeration value="HorzExtent" />
- </xsd:restriction>
- </xsd:simpleType>
- <xsd:simpleType name="dimensionOperatorEnum">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="Noop" />
- <xsd:enumeration value="Add" />
- <xsd:enumeration value="Subtract" />
- <xsd:enumeration value="Multiply" />
- <xsd:enumeration value="Divide" />
- </xsd:restriction>
- </xsd:simpleType>
- <xsd:simpleType name="frameImageComponentEnum">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="Background" />
- <xsd:enumeration value="TopLeftCorner" />
- <xsd:enumeration value="TopRightCorner" />
- <xsd:enumeration value="BottomLeftCorner" />
- <xsd:enumeration value="BottomRightCorner" />
- <xsd:enumeration value="LeftEdge" />
- <xsd:enumeration value="RightEdge" />
- <xsd:enumeration value="TopEdge" />
- <xsd:enumeration value="BottomEdge" />
- </xsd:restriction>
- </xsd:simpleType>
-</xsd:schema>
diff --git a/navit/gui/sdl/datafiles/looknfeel/Mineque.looknfeel b/navit/gui/sdl/datafiles/looknfeel/Mineque.looknfeel
deleted file mode 100755
index dc649600..00000000
--- a/navit/gui/sdl/datafiles/looknfeel/Mineque.looknfeel
+++ /dev/null
@@ -1,1476 +0,0 @@
-<?xml version="1.0" ?>
-<Falagard>
-
- <WidgetLook name="NavitGrey/StaticShared">
- <ImagerySection name="frame">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
-<!-- <Image type="TopLeftCorner" imageset="TaharezLook" image="StaticTopLeft" />
- <Image type="TopRightCorner" imageset="TaharezLook" image="StaticTopRight" />
- <Image type="BottomLeftCorner" imageset="TaharezLook" image="StaticBottomLeft" />
- <Image type="BottomRightCorner" imageset="TaharezLook" image="StaticBottomRight" />
- <Image type="LeftEdge" imageset="TaharezLook" image="StaticLeft" />
- <Image type="RightEdge" imageset="TaharezLook" image="StaticRight" />
- <Image type="TopEdge" imageset="TaharezLook" image="StaticTop" />
- <Image type="BottomEdge" imageset="TaharezLook" image="StaticBottom" />-->
- <ColourRectProperty name="FrameColours" />
- </FrameComponent>
- </ImagerySection>
-
- <ImagerySection name="background">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
-<!-- <Image imageset="TaharezLook" image="StaticBackdrop" /> -->
- <!--<ColourRectProperty name="BackgroundColours" />-->
-<!-- <Colours topLeft="FFFFFFFF" topRight="FFFFFFFF" bottomLeft="FFFFFFFF" bottomRight="FFFFFFFF" /> -->
- <VertFormat type="Stretched" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- </ImagerySection>
-
-
- <ImagerySection name="background_noframe">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
-<!-- <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim> -->
-<!-- <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim> -->
- <Dim type="RightEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="BottomEdge"><AbsoluteDim value="0" /></Dim>
- </Area>
-<!-- <Image imageset="TaharezLook" image="StaticBackdrop" />
- <ColourRectProperty name="BackgroundColours" /> -->
- <Colours topLeft="FFFFFFFF" topRight="FFFFFFFF" bottomLeft="FFFFFFFF" bottomRight="FFFFFFFF" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- </ImagerySection>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/StaticImage
- ***************************************************
- -->
- <WidgetLook name="NavitGrey/StaticImage">
- <PropertyDefinition name="ImageColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="FrameColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="BackgroundColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="VertFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <PropertyDefinition name="HorzFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <Property name="BackgroundEnabled" value="True" />
- <Property name="FrameEnabled" value="False" />
- <ImagerySection name="image_withframe">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="StaticLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="StaticTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="StaticRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="StaticBottom" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- <ImageProperty name="Image" />
- <ColourRectProperty name="ImageColours" />
- <VertFormatProperty name="VertFormatting" />
- <HorzFormatProperty name="HorzFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="image_noframe">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="Image" />
- <ColourRectProperty name="ImageColours" />
- <VertFormatProperty name="VertFormatting" />
- <HorzFormatProperty name="HorzFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Enabled" />
- <StateImagery name="Disabled" />
- <StateImagery name="EnabledFrame">
- <Layer>
- <Section look="NavitGrey/StaticShared" section="frame" />
- </Layer>
- </StateImagery>
- <StateImagery name="DisabledFrame">
- <Layer>
- <Section look="NavitGrey/StaticShared" section="frame" />
- </Layer>
- </StateImagery>
- <StateImagery name="WithFrameEnabledBackground">
- <Layer>
- <Section look="NavitGrey/StaticShared" section="background" />
- </Layer>
- </StateImagery>
- <StateImagery name="WithFrameDisabledBackground">
- <Layer>
- <Section look="NavitGrey/StaticShared" section="background" />
- </Layer>
- </StateImagery>
- <StateImagery name="NoFrameEnabledBackground">
- <Layer>
- <Section look="NavitGrey/StaticShared" section="background_noframe" />
- </Layer>
- </StateImagery>
- <StateImagery name="NoFrameDisabledBackground">
- <Layer>
- <Section look="NavitGrey/StaticShared" section="background_noframe" />
- </Layer>
- </StateImagery>
- <StateImagery name="WithFrameImage">
- <Layer>
- <Section section="image_withframe" />
- </Layer>
- </StateImagery>
- <StateImagery name="NoFrameImage">
- <Layer>
- <Section section="image_noframe" />
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <WidgetLook name="NavitGrey/ViewModeSwitchButton">
- <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="DisabledImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <ImagerySection name="normal">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="Width"><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height"><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="ViewModeSwitchButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightNormal" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddleNormal" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="NormalImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="hover">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="ViewModeSwitchButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightHighlight" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddleHighlight" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="HoverImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="pushed">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="ViewModeSwitchButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightPushed" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddlePushed" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="PushedImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Normal">
- <Layer>
- <Section section="normal" />
- <Section section="label">
- <ColourProperty name="NormalTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Hover">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Pushed">
- <Layer>
- <Section section="pushed" />
- <Section section="label">
- <ColourProperty name="PushedTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="PushedOff">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="label">
- <ColourProperty name="DisabledTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <WidgetLook name="NavitGrey/ZoomInButton">
- <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="DisabledImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <ImagerySection name="normal">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="Width"><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height"><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="ZoomInButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightNormal" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddleNormal" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="NormalImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="hover">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="ZoomInButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightHighlight" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddleHighlight" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="HoverImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="pushed">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="ZoomInButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightPushed" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddlePushed" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="PushedImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Normal">
- <Layer>
- <Section section="normal" />
- <Section section="label">
- <ColourProperty name="NormalTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Hover">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Pushed">
- <Layer>
- <Section section="pushed" />
- <Section section="label">
- <ColourProperty name="PushedTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="PushedOff">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="label">
- <ColourProperty name="DisabledTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <WidgetLook name="NavitGrey/ZoomOutButton">
- <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="DisabledImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <ImagerySection name="normal">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="Width"><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height"><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="ZoomOutButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightNormal" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddleNormal" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="NormalImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="hover">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="ZoomOutButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightHighlight" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddleHighlight" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="HoverImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="pushed">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="ZoomOutButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightPushed" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddlePushed" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="PushedImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Normal">
- <Layer>
- <Section section="normal" />
- <Section section="label">
- <ColourProperty name="NormalTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Hover">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Pushed">
- <Layer>
- <Section section="pushed" />
- <Section section="label">
- <ColourProperty name="PushedTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="PushedOff">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="label">
- <ColourProperty name="DisabledTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <WidgetLook name="NavitGrey/SpeakerOffButton">
- <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="DisabledImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <ImagerySection name="normal">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="Width"><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height"><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="TaharezLook" image="SpeakerOffButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightNormal" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddleNormal" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="NormalImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="hover">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="SpeakerOffButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightHighlight" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddleHighlight" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="HoverImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="pushed">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="LeftEdge" imageset="Mineque-Black" image="ViewModeSwitchButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightPushed" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddlePushed" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="PushedImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Normal">
- <Layer>
- <Section section="normal" />
- <Section section="label">
- <ColourProperty name="NormalTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Hover">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Pushed">
- <Layer>
- <Section section="pushed" />
- <Section section="label">
- <ColourProperty name="PushedTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="PushedOff">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="label">
- <ColourProperty name="DisabledTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <WidgetLook name="NavitGrey/QuitButton">
- <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="HoverTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="PushedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="DisabledTextColour" initialValue="FF7F7F7F" redrawOnWrite="true" />
- <PropertyDefinition name="VertLabelFormatting" initialValue="CentreAligned" />
- <PropertyDefinition name="HorzLabelFormatting" initialValue="CentreAligned" />
- <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="DisabledImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <ImagerySection name="label">
- <TextComponent>
- <Area>
- <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="Width"><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height"><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <VertFormatProperty name="VertLabelFormatting" />
- <HorzFormatProperty name="HorzLabelFormatting" />
- </TextComponent>
- </ImagerySection>
- <ImagerySection name="normal">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="Width"><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height"><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="QuitButton" />
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="NormalImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="hover">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="QuitButton" />
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="HoverImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="pushed">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
-<!-- <Image type="LeftEdge" imageset="TaharezLook" image="ButtonLeftPushed" /> -->
-<!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightPushed" /> -->
- <Image type="Background" imageset="Mineque-Black" image="QuitButton" />
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="PushedImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Normal">
- <Layer>
- <Section section="normal" />
- <Section section="label">
- <ColourProperty name="NormalTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Hover">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Pushed">
- <Layer>
- <Section section="pushed" />
- <Section section="label">
- <ColourProperty name="PushedTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="PushedOff">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="label">
- <ColourProperty name="DisabledTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
-
- <WidgetLook name="NavitGrey/RouteButton">
- <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="DisabledImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <ImagerySection name="normal">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="Width"><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height"><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="RouteButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightNormal" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddleNormal" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="NormalImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="hover">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="RouteButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightHighlight" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddleHighlight" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="HoverImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="pushed">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="RouteButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightPushed" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddlePushed" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="PushedImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Normal">
- <Layer>
- <Section section="normal" />
- <Section section="label">
- <ColourProperty name="NormalTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Hover">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Pushed">
- <Layer>
- <Section section="pushed" />
- <Section section="label">
- <ColourProperty name="PushedTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="PushedOff">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="label">
- <ColourProperty name="DisabledTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
-
- <WidgetLook name="NavitGrey/OptionsButton">
- <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="DisabledImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <ImagerySection name="normal">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="Width"><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height"><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="OptionsButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightNormal" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddleNormal" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="NormalImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="hover">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="OptionsButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightHighlight" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddleHighlight" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="HoverImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="pushed">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="OptionsButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightPushed" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddlePushed" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="PushedImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Normal">
- <Layer>
- <Section section="normal" />
- <Section section="label">
- <ColourProperty name="NormalTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Hover">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Pushed">
- <Layer>
- <Section section="pushed" />
- <Section section="label">
- <ColourProperty name="PushedTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="PushedOff">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="label">
- <ColourProperty name="DisabledTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <WidgetLook name="NavitGrey/NavitAboutButton">
- <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="DisabledImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <ImagerySection name="normal">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="Width"><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height"><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="NavitAboutButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightNormal" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddleNormal" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="NormalImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="hover">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="NavitAboutButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightHighlight" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddleHighlight" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="HoverImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="pushed">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="NavitAboutButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightPushed" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddlePushed" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="PushedImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Normal">
- <Layer>
- <Section section="normal" />
- <Section section="label">
- <ColourProperty name="NormalTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Hover">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Pushed">
- <Layer>
- <Section section="pushed" />
- <Section section="label">
- <ColourProperty name="PushedTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="PushedOff">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="label">
- <ColourProperty name="DisabledTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <WidgetLook name="NavitGrey/SpeakerButton">
- <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="DisabledImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <ImagerySection name="normal">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="Width"><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height"><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="SpeakerOnButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightNormal" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddleNormal" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="NormalImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="hover">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="SpeakerOnButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightHighlight" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddleHighlight" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="HoverImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="pushed">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="Background" imageset="Mineque-Black" image="SpeakerOnButton" />
- <!-- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightPushed" /> -->
- <!-- <Image type="Background" imageset="TaharezLook" image="ButtonMiddlePushed" /> -->
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="PushedImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Normal">
- <Layer>
- <Section section="normal" />
- <Section section="label">
- <ColourProperty name="NormalTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Hover">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Pushed">
- <Layer>
- <Section section="pushed" />
- <Section section="label">
- <ColourProperty name="PushedTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="PushedOff">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="label">
- <ColourProperty name="DisabledTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!-- this widget needs cleanup -->
- <WidgetLook name="NavitGrey/StaticText">
- <PropertyDefinition name="FrameColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="BackgroundColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
- <Property name="FrameEnabled" value="True" />
- <Property name="BackgroundEnabled" value="True" />
- <NamedArea name="WithFrameTextRenderArea">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="StaticLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="StaticTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="StaticRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="StaticBottom" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="WithFrameTextRenderAreaHScroll">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="StaticLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="StaticTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="StaticRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="WithFrameTextRenderAreaVScroll">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="StaticLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="StaticTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="StaticBottom" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="WithFrameTextRenderAreaHVScroll">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="StaticLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="StaticTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="NoFrameTextRenderArea">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" ><UnifiedDim scale="1" type="RightEdge" /></Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1" type="BottomEdge" /></Dim>
- </Area>
- </NamedArea>
- <NamedArea name="NoFrameTextRenderAreaHScroll">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" ><UnifiedDim scale="1" type="RightEdge" /></Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="NoFrameTextRenderAreaVScroll">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1" type="BottomEdge" /></Dim>
- </Area>
- </NamedArea>
- <NamedArea name="NoFrameTextRenderAreaHVScroll">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <Child type="TaharezLook/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" offset="-12" type="Width" /></Dim>
- <Dim type="Height" ><AbsoluteDim value="12" /></Dim>
- </Area>
- <VertAlignment type="BottomAligned" />
- </Child>
- <Child type="TaharezLook/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><AbsoluteDim value="12" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" offset="-12" type="Height" /></Dim>
- </Area>
- <HorzAlignment type="RightAligned" />
- </Child>
- <StateImagery name="Enabled" />
- <StateImagery name="Disabled" />
- <StateImagery name="EnabledFrame">
- <Layer>
- <Section look="NavitGrey/StaticShared" section="frame" />
- </Layer>
- </StateImagery>
- <StateImagery name="DisabledFrame">
- <Layer>
- <Section look="NavitGrey/StaticShared" section="frame" />
- </Layer>
- </StateImagery>
- <StateImagery name="WithFrameEnabledBackground">
- <Layer>
- <Section look="NavitGrey/StaticShared" section="background" />
- </Layer>
- </StateImagery>
- <StateImagery name="WithFrameDisabledBackground">
- <Layer>
- <Section look="TaharezLook/StaticShared" section="background" />
- </Layer>
- </StateImagery>
- <StateImagery name="NoFrameEnabledBackground">
- <Layer>
- <Section look="TaharezLook/StaticShared" section="background_noframe" />
- </Layer>
- </StateImagery>
- <StateImagery name="NoFrameDisabledBackground">
- <Layer>
- <Section look="TaharezLook/StaticShared" section="background_noframe" />
- </Layer>
- </StateImagery>
- </WidgetLook>
-
-</Falagard>
-
diff --git a/navit/gui/sdl/datafiles/looknfeel/TaharezLook.looknfeel b/navit/gui/sdl/datafiles/looknfeel/TaharezLook.looknfeel
deleted file mode 100755
index 795aed43..00000000
--- a/navit/gui/sdl/datafiles/looknfeel/TaharezLook.looknfeel
+++ /dev/null
@@ -1,4534 +0,0 @@
-<?xml version="1.0" ?>
-<Falagard>
- <!--
- ***************************************************
- TaharezLook/Button
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/Button">
- <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="HoverTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="PushedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="DisabledTextColour" initialValue="FF7F7F7F" redrawOnWrite="true" />
- <PropertyDefinition name="VertLabelFormatting" initialValue="CentreAligned" />
- <PropertyDefinition name="HorzLabelFormatting" initialValue="CentreAligned" />
- <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="DisabledImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <ImagerySection name="label">
- <TextComponent>
- <Area>
- <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="Width"><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height"><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <VertFormatProperty name="VertLabelFormatting" />
- <HorzFormatProperty name="HorzLabelFormatting" />
- </TextComponent>
- </ImagerySection>
- <ImagerySection name="normal">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="Width"><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height"><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="LeftEdge" imageset="TaharezLook" image="ButtonLeftNormal" />
- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightNormal" />
- <Image type="Background" imageset="TaharezLook" image="ButtonMiddleNormal" />
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="NormalImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="hover">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="LeftEdge" imageset="TaharezLook" image="ButtonLeftHighlight" />
- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightHighlight" />
- <Image type="Background" imageset="TaharezLook" image="ButtonMiddleHighlight" />
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="HoverImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="pushed">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="LeftEdge" imageset="TaharezLook" image="ButtonLeftPushed" />
- <Image type="RightEdge" imageset="TaharezLook" image="ButtonRightPushed" />
- <Image type="Background" imageset="TaharezLook" image="ButtonMiddlePushed" />
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="PushedImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Normal">
- <Layer>
- <Section section="normal" />
- <Section section="label">
- <ColourProperty name="NormalTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Hover">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Pushed">
- <Layer>
- <Section section="pushed" />
- <Section section="label">
- <ColourProperty name="PushedTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="PushedOff">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="label">
- <ColourProperty name="DisabledTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/RadioButton
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/RadioButton">
- <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="HoverTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="PushedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="DisabledTextColour" initialValue="FF7F7F7F" redrawOnWrite="true" />
- <ImagerySection name="label">
- <TextComponent>
- <Area>
- <Dim type="LeftEdge" >
- <ImageDim imageset="TaharezLook" image="RadioButtonNormal" dimension="Width">
- <DimOperator op="Add">
- <AbsoluteDim value="3" />
- </DimOperator>
- </ImageDim>
- </Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <VertFormat type="CentreAligned" />
- <HorzFormat type="LeftAligned" />
- </TextComponent>
- </ImagerySection>
- <ImagerySection name="normal">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="RadioButtonNormal" />
- <VertFormat type="CentreAligned" />
- <HorzFormat type="LeftAligned" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="hover">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="RadioButtonHover" />
- <VertFormat type="CentreAligned" />
- <HorzFormat type="LeftAligned" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="select_mark">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="RadioButtonMark" />
- <VertFormat type="CentreAligned" />
- <HorzFormat type="LeftAligned" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Normal">
- <Layer>
- <Section section="normal" />
- <Section section="label">
- <ColourProperty name="NormalTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Hover">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="label">
- <ColourProperty name="DisabledTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="SelectedNormal">
- <Layer>
- <Section section="normal" />
- <Section section="select_mark" />
- <Section section="label">
- <ColourProperty name="NormalTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="SelectedHover">
- <Layer>
- <Section section="hover" />
- <Section section="select_mark" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="SelectedDisabled">
- <Layer>
- <Section section="normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="select_mark">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="label">
- <ColourProperty name="DisabledTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/Checkbox
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/Checkbox">
- <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="HoverTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="PushedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="DisabledTextColour" initialValue="FF7F7F7F" redrawOnWrite="true" />
- <ImagerySection name="label">
- <TextComponent>
- <Area>
- <Dim type="LeftEdge" >
- <ImageDim imageset="TaharezLook" image="CheckboxNormal" dimension="Width">
- <DimOperator op="Add">
- <AbsoluteDim value="3" />
- </DimOperator>
- </ImageDim>
- </Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <VertFormat type="CentreAligned" />
- <HorzFormat type="LeftAligned" />
- </TextComponent>
- </ImagerySection>
- <ImagerySection name="normal">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="CheckboxNormal" />
- <VertFormat type="CentreAligned" />
- <HorzFormat type="LeftAligned" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="hover">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="CheckboxHover" />
- <VertFormat type="CentreAligned" />
- <HorzFormat type="LeftAligned" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="select_mark">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="CheckboxMark" />
- <VertFormat type="CentreAligned" />
- <HorzFormat type="LeftAligned" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Normal">
- <Layer>
- <Section section="normal" />
- <Section section="label">
- <ColourProperty name="NormalTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Hover">
- <Layer>
- <Section section="hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="label">
- <ColourProperty name="DisabledTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="SelectedNormal">
- <Layer>
- <Section section="normal" />
- <Section section="select_mark" />
- <Section section="label">
- <ColourProperty name="NormalTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="SelectedHover">
- <Layer>
- <Section section="hover" />
- <Section section="select_mark" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="SelectedDisabled">
- <Layer>
- <Section section="normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="select_mark">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="label">
- <ColourProperty name="DisabledTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/Editbox
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/Editbox">
- <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="SelectedTextColour" initialValue="FF000000" redrawOnWrite="true" />
- <PropertyDefinition name="ActiveSelectionColour" initialValue="FF607FFF" redrawOnWrite="true" />
- <PropertyDefinition name="InactiveSelectionColour" initialValue="FF808080" redrawOnWrite="true" />
- <Property name="MouseCursorImage" value="set:TaharezLook image:MouseTextBar" />
- <NamedArea name="TextArea">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="5" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="5" /></Dim>
- <Dim type="RightEdge" ><UnifiedDim scale="1.0" offset="-5" type="RightEdge" /></Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1.0" offset="-5" type="BottomEdge" /></Dim>
- </Area>
- </NamedArea>
- <ImagerySection name="container_normal">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="LeftEdge" imageset="TaharezLook" image="EditBoxLeft" />
- <Image type="RightEdge" imageset="TaharezLook" image="EditBoxRight" />
- <Image type="Background" imageset="TaharezLook" image="EditBoxMiddle" />
- </FrameComponent>
- </ImagerySection>
- <ImagerySection name="selection">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="TextSelectionBrush" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="Carat">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><ImageDim imageset="TaharezLook" image="EditBoxCarat" dimension="Width" /></Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="EditBoxCarat" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Enabled">
- <Layer>
- <Section section="container_normal" />
- </Layer>
- </StateImagery>
- <StateImagery name="ReadOnly">
- <Layer>
- <Section section="container_normal" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="container_normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="ActiveSelection">
- <Layer>
- <Section section="selection">
- <ColourProperty name="ActiveSelectionColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="InactiveSelection">
- <Layer>
- <Section section="selection">
- <ColourProperty name="InactiveSelectionColour" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/Titlebar
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/Titlebar">
- <PropertyDefinition name="CaptionColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <ImagerySection name="main">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="NewTitlebarLeft" />
- <VertFormat type="Stretched" />
- </ImageryComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="SysAreaRight" dimension="Width">
- <DimOperator op="Add">
- <ImageDim imageset="TaharezLook" image="SysAreaMiddle" dimension="Width" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="NewTitlebarRight" />
- <VertFormat type="Stretched" />
- <HorzFormat type="RightAligned" />
- </ImageryComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="SysAreaRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="SysAreaMiddle" />
- <VertFormat type="Stretched" />
- <HorzFormat type="RightAligned" />
- </ImageryComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="SysAreaRight" />
- <VertFormat type="Stretched" />
- <HorzFormat type="RightAligned" />
- </ImageryComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="NewTitlebarLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="SysAreaRight" dimension="Width">
- <DimOperator op="Add">
- <ImageDim imageset="TaharezLook" image="SysAreaMiddle" dimension="Width">
- <DimOperator op="Add">
- <ImageDim imageset="TaharezLook" image="NewTitlebarRight" dimension="Width" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="NewTitlebarMiddle" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="caption">
- <TextComponent>
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="NewTitlebarLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" offset="-75" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ColourProperty name="CaptionColour" />
- <VertFormat type="CentreAligned" />
- </TextComponent>
- </ImagerySection>
- <StateImagery name="Active">
- <Layer>
- <Section section="main" />
- <Section section="caption" />
- </Layer>
- </StateImagery>
- <StateImagery name="Inactive">
- <Layer>
- <Section section="main" />
- <Section section="caption" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="main">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="caption">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/FrameWindow
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/FrameWindow">
- <PropertyLinkDefinition name="CaptionColour" widget="__auto_titlebar__" targetProperty="CaptionColour" initialValue="FFFFFFFF" />
- <PropertyLinkDefinition name="TitlebarFont" widget="__auto_titlebar__" targetProperty="Font" />
- <Property name="NSSizingCursorImage" value="set:TaharezLook image:MouseNoSoCursor" />
- <Property name="EWSizingCursorImage" value="set:TaharezLook image:MouseEsWeCursor" />
- <Property name="NWSESizingCursorImage" value="set:TaharezLook image:MouseNwSeCursor" />
- <Property name="NESWSizingCursorImage" value="set:TaharezLook image:MouseNeSwCursor" />
- <NamedArea name="ClientWithTitleWithFrame">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="WindowTopLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><WidgetDim widget="__auto_titlebar__" dimension="BottomEdge" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="WindowTopRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="WindowBottomEdge" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="ClientWithTitleNoFrame">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><WidgetDim widget="__auto_titlebar__" dimension="BottomEdge" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="BottomEdge" ><WidgetDim dimension="BottomEdge" /></Dim>
- </Area>
- </NamedArea>
- <NamedArea name="ClientNoTitleWithFrame">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="WindowTopLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="WindowTopEdge" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="WindowTopRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="WindowBottomEdge" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="ClientNoTitleNoFrame">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- </NamedArea>
- <Child type="TaharezLook/Titlebar" nameSuffix="__auto_titlebar__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><FontDim type="LineSpacing" padding="8" /></Dim>
- </Area>
- <Property name="AlwaysOnTop" value="False" />
- </Child>
- <Child type="TaharezLook/SystemButton" nameSuffix="__auto_closebutton__">
- <Area>
- <Dim type="LeftEdge" >
- <UnifiedDim scale="1" type="LeftEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="SysAreaRight" dimension="Width">
- <DimOperator op="Add">
- <ImageDim imageset="TaharezLook" image="SysAreaMiddle" dimension="Width" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="TopEdge" >
- <AbsoluteDim value="0.5">
- <DimOperator op="Multiply">
- <WidgetDim widget="__auto_titlebar__" dimension="Height">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="NewCloseButtonNormal" dimension="Width" />
- </DimOperator>
- </WidgetDim>
- </DimOperator>
- </AbsoluteDim>
- </Dim>
- <Dim type="Width" ><ImageDim imageset="TaharezLook" image="NewCloseButtonNormal" dimension="Width" /></Dim>
- <Dim type="Height" ><ImageDim imageset="TaharezLook" image="NewCloseButtonNormal" dimension="Width" /></Dim>
- </Area>
- <Property name="AlwaysOnTop" value="True" />
- <Property name="NormalImage" value="set:TaharezLook image:NewCloseButtonNormal" />
- <Property name="HoverImage" value="set:TaharezLook image:NewCloseButtonHover" />
- <Property name="PushedImage" value="set:TaharezLook image:NewCloseButtonPressed" />
- </Child>
- <ImagerySection name="withtitle_frame">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><WidgetDim widget="__auto_titlebar__" dimension="BottomEdge" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1" type="BottomEdge" /></Dim>
- </Area>
- <Image type="BottomLeftCorner" imageset="TaharezLook" image="WindowBottomLeft" />
- <Image type="BottomRightCorner" imageset="TaharezLook" image="WindowBottomRight" />
- <Image type="LeftEdge" imageset="TaharezLook" image="WindowLeftEdge" />
- <Image type="RightEdge" imageset="TaharezLook" image="WindowRightEdge" />
- <Image type="BottomEdge" imageset="TaharezLook" image="WindowBottomEdge" />
- <Image type="Background" imageset="TaharezLook" image="ClientBrush" />
- <VertFormat type="Tiled" />
- <HorzFormat type="Tiled" />
- </FrameComponent>
- </ImagerySection>
- <ImagerySection name="notitle_frame">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="TopLeftCorner" imageset="TaharezLook" image="WindowTopLeft" />
- <Image type="TopRightCorner" imageset="TaharezLook" image="WindowTopRight" />
- <Image type="BottomLeftCorner" imageset="TaharezLook" image="WindowBottomLeft" />
- <Image type="BottomRightCorner" imageset="TaharezLook" image="WindowBottomRight" />
- <Image type="LeftEdge" imageset="TaharezLook" image="WindowLeftEdge" />
- <Image type="RightEdge" imageset="TaharezLook" image="WindowRightEdge" />
- <Image type="BottomEdge" imageset="TaharezLook" image="WindowBottomEdge" />
- <Image type="Background" imageset="TaharezLook" image="ClientBrush" />
- <VertFormat type="Tiled" />
- <HorzFormat type="Tiled" />
- </FrameComponent>
- </ImagerySection>
- <ImagerySection name="withtitle_noframe_client_area">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><WidgetDim widget="__auto_titlebar__" dimension="Height" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1" type="BottomEdge" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="ClientBrush" />
- <VertFormat type="Tiled" />
- <HorzFormat type="Tiled" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="notitle_noframe_client_area">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="ClientBrush" />
- <VertFormat type="Tiled" />
- <HorzFormat type="Tiled" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="ActiveWithTitleWithFrame">
- <Layer>
- <Section section="withtitle_frame" />
- </Layer>
- </StateImagery>
- <StateImagery name="InactiveWithTitleWithFrame">
- <Layer>
- <Section section="withtitle_frame" />
- </Layer>
- </StateImagery>
- <StateImagery name="DisabledWithTitleWithFrame">
- <Layer>
- <Section section="withtitle_frame">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="ActiveWithTitleNoFrame">
- <Layer>
- <Section section="withtitle_noframe_client_area" />
- </Layer>
- </StateImagery>
- <StateImagery name="InactiveWithTitleNoFrame">
- <Layer>
- <Section section="withtitle_noframe_client_area" />
- </Layer>
- </StateImagery>
- <StateImagery name="DisabledWithTitleNoFrame">
- <Layer>
- <Section section="withtitle_noframe_client_area">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="ActiveNoTitleWithFrame">
- <Layer>
- <Section section="notitle_frame" />
- </Layer>
- </StateImagery>
- <StateImagery name="InactiveNoTitleWithFrame">
- <Layer>
- <Section section="notitle_frame" />
- </Layer>
- </StateImagery>
- <StateImagery name="DisabledNoTitleWithFrame">
- <Layer>
- <Section section="notitle_frame">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="ActiveNoTitleNoFrame">
- <Layer>
- <Section section="notitle_noframe_client_area" />
- </Layer>
- </StateImagery>
- <StateImagery name="InactiveNoTitleNoFrame">
- <Layer>
- <Section section="notitle_noframe_client_area" />
- </Layer>
- </StateImagery>
- <StateImagery name="DisabledNoTitleNoFrame">
- <Layer>
- <Section section="notitle_noframe_client_area">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/ProgressBar
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/ProgressBar">
- <NamedArea name="ProgressArea">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="ProgressBarLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="ProgressBarRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- </NamedArea>
- <ImagerySection name="frame">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="LeftEdge" imageset="TaharezLook" image="ProgressBarLeft" />
- <Image type="RightEdge" imageset="TaharezLook" image="ProgressBarRight" />
- <Image type="Background" imageset="TaharezLook" image="ProgressBarMiddle" />
- </FrameComponent>
- </ImagerySection>
- <ImagerySection name="progress_lights" >
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="ProgressBarLitSegment" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Tiled" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Enabled">
- <Layer>
- <Section section="frame" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="frame">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="EnabledProgress">
- <Layer>
- <Section section="progress_lights" />
- </Layer>
- </StateImagery>
- <StateImagery name="DisabledProgress">
- <Layer>
- <Section section="progress_lights">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/AlternateProgressBar
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/AltProgressBar">
- <NamedArea name="ProgressArea">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="AltProgressLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="2" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="AltProgressRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="Height" ><UnifiedDim scale="1" offset="-4" type="Height" /></Dim>
- </Area>
- </NamedArea>
- <ImagerySection name="frame">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="LeftEdge" imageset="TaharezLook" image="AltProgressLeft" />
- <Image type="RightEdge" imageset="TaharezLook" image="AltProgressRight" />
- <Image type="Background" imageset="TaharezLook" image="AltProgressMiddle" />
- </FrameComponent>
- </ImagerySection>
- <ImagerySection name="progress_lights" >
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><UnifiedDim scale="0" type="LeftEdge" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="AltProgressLight1" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Tiled" />
- </ImageryComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><UnifiedDim scale="0.1" type="LeftEdge" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="AltProgressLight2" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Tiled" />
- </ImageryComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><UnifiedDim scale="0.2" type="LeftEdge" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="AltProgressLight3" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Tiled" />
- </ImageryComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><UnifiedDim scale="0.3" type="LeftEdge" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="AltProgressLight4" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Tiled" />
- </ImageryComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><UnifiedDim scale="0.4" type="LeftEdge" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="AltProgressLight5" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Tiled" />
- </ImageryComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><UnifiedDim scale="0.5" type="LeftEdge" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="AltProgressLight6" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Tiled" />
- </ImageryComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><UnifiedDim scale="0.6" type="LeftEdge" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="AltProgressLight7" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Tiled" />
- </ImageryComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><UnifiedDim scale="0.7" type="LeftEdge" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="AltProgressLight8" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Tiled" />
- </ImageryComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><UnifiedDim scale="0.8" type="LeftEdge" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="AltProgressLight9" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Tiled" />
- </ImageryComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><UnifiedDim scale="0.9" type="LeftEdge" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="AltProgressLight10" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Tiled" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Enabled">
- <Layer>
- <Section section="frame" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="frame">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="EnabledProgress">
- <Layer>
- <Section section="progress_lights" />
- </Layer>
- </StateImagery>
- <StateImagery name="DisabledProgress">
- <Layer>
- <Section section="progress_lights">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/VUMeter (progress bar)
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/VUMeter">
- <Property name="VerticalProgress" value="True" />
- <NamedArea name="ProgressArea">
- <Area>
- <Dim type="LeftEdge" ><UnifiedDim scale="0" type="LeftEdge" /></Dim>
- <Dim type="TopEdge" ><UnifiedDim scale="0" type="TopEdge" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- </NamedArea>
- <ImagerySection name="progress_lights" >
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><UnifiedDim scale="0" type="LeftEdge" /></Dim>
- <Dim type="TopEdge" ><UnifiedDim scale="0.5" type="TopEdge" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="0.5" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="TextSelectionBrush" />
- <Colours topLeft="FF00FF00" topRight="FF00FF00" bottomLeft="FF00FF00" bottomRight="FF00FF00" />
- <VertFormat type="Tiled" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><UnifiedDim scale="0" type="LeftEdge" /></Dim>
- <Dim type="TopEdge" ><UnifiedDim scale="0.2" type="TopEdge" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="0.3" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="TextSelectionBrush" />
- <Colours topLeft="FFFFFF00" topRight="FFFFFF00" bottomLeft="FFFFFF00" bottomRight="FFFFFF00" />
- <VertFormat type="Tiled" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><UnifiedDim scale="0" type="LeftEdge" /></Dim>
- <Dim type="TopEdge" ><UnifiedDim scale="0" type="TopEdge" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="0.2" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="TextSelectionBrush" />
- <Colours topLeft="FFFF0000" topRight="FFFF0000" bottomLeft="FFFF0000" bottomRight="FFFF0000" />
- <VertFormat type="Tiled" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Enabled">
- </StateImagery>
- <StateImagery name="Disabled">
- </StateImagery>
- <StateImagery name="EnabledProgress">
- <Layer>
- <Section section="progress_lights" />
- </Layer>
- </StateImagery>
- <StateImagery name="DisabledProgress">
- <Layer>
- <Section section="progress_lights">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/SliderThumb
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/SliderThumb">
- <Property name="VertFree" value="True" />
- <ImagerySection name="normal">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="VertSliderThumbNormal" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="hover">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="VertSliderThumbHover" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Normal">
- <Layer>
- <Section section="normal" />
- </Layer>
- </StateImagery>
- <StateImagery name="Hover">
- <Layer>
- <Section section="hover" />
- </Layer>
- </StateImagery>
- <StateImagery name="Pushed">
- <Layer>
- <Section section="hover" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/Slider
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/Slider">
- <Property name="VerticalSlider" value="True" />
- <Property name="MouseButtonDownAutoRepeat" value="True" />
- <Property name="WantsMultiClickEvents" value="False" />
- <NamedArea name="ThumbTrackArea">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
- </Area>
- </NamedArea>
- <Child type="TaharezLook/SliderThumb" nameSuffix="__auto_thumb__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
- <Dim type="Height" ><ImageDim imageset="TaharezLook" image="VertSliderThumbNormal" dimension="Height" /></Dim>
- </Area>
- </Child>
- <ImagerySection name="main">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="3" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1.0" offset="-6" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="VertSliderBody" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Enabled">
- <Layer>
- <Section section="main" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="main">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/HorizontalScrollbarThumb
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/HorizontalScrollbarThumb">
- <Property name="HorzFree" value="True" />
- <ImagerySection name="normal">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
- </Area>
- <Image type="LeftEdge" imageset="TaharezLook" image="MiniHorzScrollThumbLeftNormal" />
- <Image type="RightEdge" imageset="TaharezLook" image="MiniHorzScrollThumbRightNormal" />
- <Image type="Background" imageset="TaharezLook" image="MiniHorzScrollThumbMiddleNormal" />
- </FrameComponent>
- </ImagerySection>
- <ImagerySection name="hover">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
- </Area>
- <Image type="LeftEdge" imageset="TaharezLook" image="MiniHorzScrollThumbLeftHover" />
- <Image type="RightEdge" imageset="TaharezLook" image="MiniHorzScrollThumbRightHover" />
- <Image type="Background" imageset="TaharezLook" image="MiniHorzScrollThumbMiddleHover" />
- </FrameComponent>
- </ImagerySection>
- <StateImagery name="Normal">
- <Layer>
- <Section section="normal" />
- </Layer>
- </StateImagery>
- <StateImagery name="Hover">
- <Layer>
- <Section section="hover" />
- </Layer>
- </StateImagery>
- <StateImagery name="Pushed">
- <Layer>
- <Section section="normal" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/HorizontalScrollbar
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/HorizontalScrollbar">
- <NamedArea name="ThumbTrackArea">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="MiniHorzScrollLeftNormal" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1.0" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="MiniHorzScrollRightNormal" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
- </Area>
- </NamedArea>
- <Child type="TaharezLook/ImageButton" nameSuffix="__auto_incbtn__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><ImageDim imageset="TaharezLook" image="MiniHorzScrollRightNormal" dimension="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <HorzAlignment type="RightAligned" />
- <Property name="NormalImage" value="set:TaharezLook image:MiniHorzScrollRightNormal" />
- <Property name="HoverImage" value="set:TaharezLook image:MiniHorzScrollRightHover" />
- <Property name="PushedImage" value="set:TaharezLook image:MiniHorzScrollRightNormal" />
- </Child>
- <Child type="TaharezLook/ImageButton" nameSuffix="__auto_decbtn__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><ImageDim imageset="TaharezLook" image="MiniHorzScrollLeftNormal" dimension="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Property name="NormalImage" value="set:TaharezLook image:MiniHorzScrollLeftNormal" />
- <Property name="HoverImage" value="set:TaharezLook image:MiniHorzScrollLeftHover" />
- <Property name="PushedImage" value="set:TaharezLook image:MiniHorzScrollLeftNormal" />
- </Child>
- <Child type="TaharezLook/HorizontalScrollbarThumb" nameSuffix="__auto_thumb__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="0.1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Property name="UnifiedMinSize" value="{{0,25},{0,0}}" />
- </Child>
- <ImagerySection name="main">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="MiniHorzScrollLeftNormal" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1.0" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="MiniHorzScrollRightNormal" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="MiniHorzScrollBarSegment" />
- <VertFormat type="CentreAligned" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Enabled">
- <Layer>
- <Section section="main" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="main">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/VerticalScrollbarThumb
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/VerticalScrollbarThumb">
- <Property name="VertFree" value="True" />
- <ImagerySection name="normal">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
- </Area>
- <Image type="TopEdge" imageset="TaharezLook" image="MiniVertScrollThumbTopNormal" />
- <Image type="BottomEdge" imageset="TaharezLook" image="MiniVertScrollThumbBottomNormal" />
- <Image type="Background" imageset="TaharezLook" image="MiniVertScrollThumbMiddleNormal" />
- </FrameComponent>
- </ImagerySection>
- <ImagerySection name="hover">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
- </Area>
- <Image type="TopEdge" imageset="TaharezLook" image="MiniVertScrollThumbTopHover" />
- <Image type="BottomEdge" imageset="TaharezLook" image="MiniVertScrollThumbBottomHover" />
- <Image type="Background" imageset="TaharezLook" image="MiniVertScrollThumbMiddleHover" />
- </FrameComponent>
- </ImagerySection>
- <StateImagery name="Normal">
- <Layer>
- <Section section="normal" />
- </Layer>
- </StateImagery>
- <StateImagery name="Hover">
- <Layer>
- <Section section="hover" />
- </Layer>
- </StateImagery>
- <StateImagery name="Pushed">
- <Layer>
- <Section section="normal" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/VerticalScrollbar
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/VerticalScrollbar">
- <Property name="VerticalScrollbar" value="True" />
- <NamedArea name="ThumbTrackArea">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="MiniVertScrollUpNormal" dimension="Height" /></Dim>
- <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1.0" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="MiniVertScrollDownNormal" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <Child type="TaharezLook/ImageButton" nameSuffix="__auto_incbtn__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><ImageDim imageset="TaharezLook" image="MiniVertScrollDownNormal" dimension="Height" /></Dim>
- </Area>
- <VertAlignment type="BottomAligned" />
- <Property name="NormalImage" value="set:TaharezLook image:MiniVertScrollDownNormal" />
- <Property name="HoverImage" value="set:TaharezLook image:MiniVertScrollDownHover" />
- <Property name="PushedImage" value="set:TaharezLook image:MiniVertScrollDownNormal" />
- </Child>
- <Child type="TaharezLook/ImageButton" nameSuffix="__auto_decbtn__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><ImageDim imageset="TaharezLook" image="MiniVertScrollUpNormal" dimension="Height" /></Dim>
- </Area>
- <Property name="NormalImage" value="set:TaharezLook image:MiniVertScrollUpNormal" />
- <Property name="HoverImage" value="set:TaharezLook image:MiniVertScrollUpHover" />
- <Property name="PushedImage" value="set:TaharezLook image:MiniVertScrollUpNormal" />
- </Child>
- <Child type="TaharezLook/VerticalScrollbarThumb" nameSuffix="__auto_thumb__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="0.1" type="Height" /></Dim>
- </Area>
- <Property name="UnifiedMinSize" value="{{0,0},{0,25}}" />
- </Child>
- <ImagerySection name="main">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="MiniVertScrollUpNormal" dimension="Height" /></Dim>
- <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1.0" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="MiniVertScrollDownNormal" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- <Image imageset="TaharezLook" image="MiniVertScrollBarSegment" />
- <VertFormat type="Stretched" />
- <HorzFormat type="CentreAligned" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Enabled">
- <Layer>
- <Section section="main" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="main">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/Listbox
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/Listbox">
- <NamedArea name="ItemRenderingArea">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="ListboxLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="ListboxTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="ListboxRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="ListboxBottom" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="ItemRenderingAreaHScroll">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="ListboxLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="ListboxTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="ListboxRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="ItemRenderingAreaVScroll">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="ListboxLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="ListboxTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="ListboxBottom" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="ItemRenderingAreaHVScroll">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="ListboxLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="ListboxTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <Child type="TaharezLook/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" offset="-12" type="Width" /></Dim>
- <Dim type="Height" ><AbsoluteDim value="12" /></Dim>
- </Area>
- <VertAlignment type="BottomAligned" />
- </Child>
- <Child type="TaharezLook/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><AbsoluteDim value="12" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" offset="-12" type="Height" /></Dim>
- </Area>
- <HorzAlignment type="RightAligned" />
- </Child>
- <ImagerySection name="main">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="TopLeftCorner" imageset="TaharezLook" image="ListboxTopLeft" />
- <Image type="TopRightCorner" imageset="TaharezLook" image="ListboxTopRight" />
- <Image type="BottomLeftCorner" imageset="TaharezLook" image="ListboxBottomLeft" />
- <Image type="BottomRightCorner" imageset="TaharezLook" image="ListboxBottomRight" />
- <Image type="LeftEdge" imageset="TaharezLook" image="ListboxLeft" />
- <Image type="RightEdge" imageset="TaharezLook" image="ListboxRight" />
- <Image type="TopEdge" imageset="TaharezLook" image="ListboxTop" />
- <Image type="BottomEdge" imageset="TaharezLook" image="ListboxBottom" />
- <Image type="Background" imageset="TaharezLook" image="ListboxBackdrop" />
- </FrameComponent>
- </ImagerySection>
- <StateImagery name="Enabled">
- <Layer>
- <Section section="main" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="main">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/ComboDropList
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/ComboDropList">
- <NamedArea name="ItemRenderingArea">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="ComboboxListLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="ComboboxListTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="ComboboxListRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="ComboboxListBottom" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="ItemRenderingAreaHScroll">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="ComboboxListLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="ComboboxListTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="ComboboxListRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="ItemRenderingAreaVScroll">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="ComboboxListLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="ComboboxListTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="ComboboxListBottom" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="ItemRenderingAreaHVScroll">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="ComboboxListLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="ComboboxListTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <Child type="TaharezLook/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" offset="-12" type="Width" /></Dim>
- <Dim type="Height" ><AbsoluteDim value="12" /></Dim>
- </Area>
- <VertAlignment type="BottomAligned" />
- </Child>
- <Child type="TaharezLook/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><AbsoluteDim value="12" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" offset="-12" type="Height" /></Dim>
- </Area>
- <HorzAlignment type="RightAligned" />
- </Child>
- <ImagerySection name="main">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="TopLeftCorner" imageset="TaharezLook" image="ComboboxListTopLeft" />
- <Image type="TopRightCorner" imageset="TaharezLook" image="ComboboxListTopRight" />
- <Image type="BottomLeftCorner" imageset="TaharezLook" image="ComboboxListBottomLeft" />
- <Image type="BottomRightCorner" imageset="TaharezLook" image="ComboboxListBottomRight" />
- <Image type="LeftEdge" imageset="TaharezLook" image="ComboboxListLeft" />
- <Image type="RightEdge" imageset="TaharezLook" image="ComboboxListRight" />
- <Image type="TopEdge" imageset="TaharezLook" image="ComboboxListTop" />
- <Image type="BottomEdge" imageset="TaharezLook" image="ComboboxListBottom" />
- <Image type="Background" imageset="TaharezLook" image="ComboboxListBackdrop" />
- </FrameComponent>
- </ImagerySection>
- <StateImagery name="Enabled">
- <Layer>
- <Section section="main" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="main">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/ComboEditbox
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/ComboEditbox">
- <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="SelectedTextColour" initialValue="FF000000" redrawOnWrite="true" />
- <PropertyDefinition name="ActiveSelectionColour" initialValue="FF607FFF" redrawOnWrite="true" />
- <PropertyDefinition name="InactiveSelectionColour" initialValue="FF808080" redrawOnWrite="true" />
- <Property name="MouseCursorImage" value="set:TaharezLook image:MouseTextBar" />
- <NamedArea name="TextArea">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="5" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="5" /></Dim>
- <Dim type="RightEdge" ><UnifiedDim scale="1.0" offset="-5" type="RightEdge" /></Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1.0" offset="-5" type="BottomEdge" /></Dim>
- </Area>
- </NamedArea>
- <ImagerySection name="container_normal">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
- </Area>
- <Image type="LeftEdge" imageset="TaharezLook" image="ComboboxEditLeft" />
- <Image type="Background" imageset="TaharezLook" image="ComboboxEditMiddle" />
- </FrameComponent>
- </ImagerySection>
- <ImagerySection name="selection">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="TextSelectionBrush" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="Carat">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><ImageDim imageset="TaharezLook" image="EditBoxCarat" dimension="Width" /></Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="EditBoxCarat" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Enabled">
- <Layer>
- <Section section="container_normal" />
- </Layer>
- </StateImagery>
- <StateImagery name="ReadOnly">
- <Layer>
- <Section section="container_normal" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="container_normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="ActiveSelection">
- <Layer>
- <Section section="selection">
- <ColourProperty name="ActiveSelectionColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="InactiveSelection">
- <Layer>
- <Section section="selection">
- <ColourProperty name="InactiveSelectionColour" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/Combobox
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/Combobox">
- <PropertyLinkDefinition name="NormalEditTextColour" widget="__auto_editbox__" targetProperty="NormalTextColour" initialValue="FFFFFFFF" />
- <PropertyLinkDefinition name="SelectedEditTextColour" widget="__auto_editbox__" targetProperty="SelectedTextColour" initialValue="FF000000" />
- <PropertyLinkDefinition name="ActiveEditSelectionColour" widget="__auto_editbox__" targetProperty="ActiveSelectionColour" initialValue="FF6060FF" />
- <PropertyLinkDefinition name="InactiveEditSelectionColour" widget="__auto_editbox__" targetProperty="InactiveSelectionColour" initialValue="FF808080" />
- <Child type="TaharezLook/ComboEditbox" nameSuffix="__auto_editbox__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <FontDim type="LineSpacing">
- <DimOperator op="Multiply">
- <AbsoluteDim value="1.5" />
- </DimOperator>
- </FontDim>
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="Height" >
- <FontDim type="LineSpacing">
- <DimOperator op="Multiply">
- <AbsoluteDim value="1.5" />
- </DimOperator>
- </FontDim>
- </Dim>
- </Area>
- </Child>
- <Child type="TaharezLook/ComboDropList" nameSuffix="__auto_droplist__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><WidgetDim widget="__auto_editbox__" dimension="BottomEdge" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1" type="BottomEdge" /></Dim>
- </Area>
- </Child>
- <Child type="TaharezLook/ImageButton" nameSuffix="__auto_button__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><WidgetDim widget="__auto_editbox__" dimension="Height" /></Dim>
- <Dim type="Height" ><WidgetDim widget="__auto_editbox__" dimension="Height" /></Dim>
- </Area>
- <HorzAlignment type="RightAligned" />
- <Property name="NormalImage" value="set:TaharezLook image:ComboboxListButtonNormal" />
- <Property name="HoverImage" value="set:TaharezLook image:ComboboxListButtonHover" />
- <Property name="PushedImage" value="set:TaharezLook image:ComboboxListButtonNormal" />
- </Child>
- <StateImagery name="Enabled" />
- <StateImagery name="Disabled" />
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/Spinner
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/Spinner">
- <Child type="TaharezLook/Editbox" nameSuffix="__auto_editbox__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="VertScrollUpNormal" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- </Child>
- <Child type="TaharezLook/ImageButton" nameSuffix="__auto_incbtn__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><ImageDim imageset="TaharezLook" image="VertScrollUpNormal" dimension="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="0.5" type="Height" /></Dim>
- </Area>
- <HorzAlignment type="RightAligned" />
- <Property name="NormalImage" value="set:TaharezLook image:VertScrollUpNormal" />
- <Property name="HoverImage" value="set:TaharezLook image:VertScrollUpHover" />
- <Property name="PushedImage" value="set:TaharezLook image:VertScrollUpNormal" />
- </Child>
- <Child type="TaharezLook/ImageButton" nameSuffix="__auto_decbtn__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><UnifiedDim scale="0.5" type="TopEdge" /></Dim>
- <Dim type="Width" ><ImageDim imageset="TaharezLook" image="VertScrollUpNormal" dimension="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="0.5" type="Height" /></Dim>
- </Area>
- <HorzAlignment type="RightAligned" />
- <Property name="NormalImage" value="set:TaharezLook image:VertScrollDownNormal" />
- <Property name="HoverImage" value="set:TaharezLook image:VertScrollDownHover" />
- <Property name="PushedImage" value="set:TaharezLook image:VertScrollDownNormal" />
- </Child>
- <StateImagery name="Enabled" />
- <StateImagery name="Disabled" />
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/StaticShared
- (Shared imagery components for static widgets)
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/StaticShared">
- <ImagerySection name="frame">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="TopLeftCorner" imageset="TaharezLook" image="StaticTopLeft" />
- <Image type="TopRightCorner" imageset="TaharezLook" image="StaticTopRight" />
- <Image type="BottomLeftCorner" imageset="TaharezLook" image="StaticBottomLeft" />
- <Image type="BottomRightCorner" imageset="TaharezLook" image="StaticBottomRight" />
- <Image type="LeftEdge" imageset="TaharezLook" image="StaticLeft" />
- <Image type="RightEdge" imageset="TaharezLook" image="StaticRight" />
- <Image type="TopEdge" imageset="TaharezLook" image="StaticTop" />
- <Image type="BottomEdge" imageset="TaharezLook" image="StaticBottom" />
- <ColourRectProperty name="FrameColours" />
- </FrameComponent>
- </ImagerySection>
- <ImagerySection name="background">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="StaticLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="StaticTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="StaticRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="StaticBottom" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- <Image imageset="TaharezLook" image="StaticBackdrop" />
- <!--<ColourRectProperty name="BackgroundColours" />-->
- <Colours topLeft="FFFFFFFF" topRight="FFFFFFFF" bottomLeft="FFFFFFFF" bottomRight="FFFFFFFF" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="background_noframe">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge"><UnifiedDim scale="1" type="RightEdge" /></Dim>
- <Dim type="BottomEdge"><UnifiedDim scale="1" type="BottomEdge" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="StaticBackdrop" />
- <!--<ColourRectProperty name="BackgroundColours" />-->
- <Colours topLeft="FFFFFFFF" topRight="FFFFFFFF" bottomLeft="FFFFFFFF" bottomRight="FFFFFFFF" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- </ImagerySection>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/StaticImage
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/StaticImage">
- <PropertyDefinition name="ImageColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="FrameColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="BackgroundColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="VertFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <PropertyDefinition name="HorzFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <Property name="BackgroundEnabled" value="True" />
- <Property name="FrameEnabled" value="True" />
- <ImagerySection name="image_withframe">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="StaticLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="StaticTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="StaticRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="StaticBottom" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- <ImageProperty name="Image" />
- <ColourRectProperty name="ImageColours" />
- <VertFormatProperty name="VertFormatting" />
- <HorzFormatProperty name="HorzFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="image_noframe">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="Image" />
- <ColourRectProperty name="ImageColours" />
- <VertFormatProperty name="VertFormatting" />
- <HorzFormatProperty name="HorzFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Enabled" />
- <StateImagery name="Disabled" />
- <StateImagery name="EnabledFrame">
- <Layer>
- <Section look="TaharezLook/StaticShared" section="frame" />
- </Layer>
- </StateImagery>
- <StateImagery name="DisabledFrame">
- <Layer>
- <Section look="TaharezLook/StaticShared" section="frame" />
- </Layer>
- </StateImagery>
- <StateImagery name="WithFrameEnabledBackground">
- <Layer>
- <Section look="TaharezLook/StaticShared" section="background" />
- </Layer>
- </StateImagery>
- <StateImagery name="WithFrameDisabledBackground">
- <Layer>
- <Section look="TaharezLook/StaticShared" section="background" />
- </Layer>
- </StateImagery>
- <StateImagery name="NoFrameEnabledBackground">
- <Layer>
- <Section look="TaharezLook/StaticShared" section="background_noframe" />
- </Layer>
- </StateImagery>
- <StateImagery name="NoFrameDisabledBackground">
- <Layer>
- <Section look="TaharezLook/StaticShared" section="background_noframe" />
- </Layer>
- </StateImagery>
- <StateImagery name="WithFrameImage">
- <Layer>
- <Section section="image_withframe" />
- </Layer>
- </StateImagery>
- <StateImagery name="NoFrameImage">
- <Layer>
- <Section section="image_noframe" />
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/StaticText
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/StaticText">
- <PropertyDefinition name="FrameColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="BackgroundColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
- <Property name="FrameEnabled" value="True" />
- <Property name="BackgroundEnabled" value="True" />
- <NamedArea name="WithFrameTextRenderArea">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="StaticLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="StaticTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="StaticRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="StaticBottom" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="WithFrameTextRenderAreaHScroll">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="StaticLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="StaticTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="StaticRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="WithFrameTextRenderAreaVScroll">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="StaticLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="StaticTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="StaticBottom" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="WithFrameTextRenderAreaHVScroll">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="StaticLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="StaticTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="NoFrameTextRenderArea">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" ><UnifiedDim scale="1" type="RightEdge" /></Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1" type="BottomEdge" /></Dim>
- </Area>
- </NamedArea>
- <NamedArea name="NoFrameTextRenderAreaHScroll">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" ><UnifiedDim scale="1" type="RightEdge" /></Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="NoFrameTextRenderAreaVScroll">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1" type="BottomEdge" /></Dim>
- </Area>
- </NamedArea>
- <NamedArea name="NoFrameTextRenderAreaHVScroll">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <Child type="TaharezLook/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" offset="-12" type="Width" /></Dim>
- <Dim type="Height" ><AbsoluteDim value="12" /></Dim>
- </Area>
- <VertAlignment type="BottomAligned" />
- </Child>
- <Child type="TaharezLook/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><AbsoluteDim value="12" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" offset="-12" type="Height" /></Dim>
- </Area>
- <HorzAlignment type="RightAligned" />
- </Child>
- <StateImagery name="Enabled" />
- <StateImagery name="Disabled" />
- <StateImagery name="EnabledFrame">
- <Layer>
- <Section look="TaharezLook/StaticShared" section="frame" />
- </Layer>
- </StateImagery>
- <StateImagery name="DisabledFrame">
- <Layer>
- <Section look="TaharezLook/StaticShared" section="frame" />
- </Layer>
- </StateImagery>
- <StateImagery name="WithFrameEnabledBackground">
- <Layer>
- <Section look="TaharezLook/StaticShared" section="background" />
- </Layer>
- </StateImagery>
- <StateImagery name="WithFrameDisabledBackground">
- <Layer>
- <Section look="TaharezLook/StaticShared" section="background" />
- </Layer>
- </StateImagery>
- <StateImagery name="NoFrameEnabledBackground">
- <Layer>
- <Section look="TaharezLook/StaticShared" section="background_noframe" />
- </Layer>
- </StateImagery>
- <StateImagery name="NoFrameDisabledBackground">
- <Layer>
- <Section look="TaharezLook/StaticShared" section="background_noframe" />
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/ListHeaderSegment
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/ListHeaderSegment">
- <Property name="SizingCursorImage" value="set:TaharezLook image:MouseEsWeCursor" />
- <Property name="MovingCursorImage" value="set:TaharezLook image:MouseMoveCursor" />
- <ImagerySection name="segment_normal">
- <Colours topLeft="FFDDDDDD" topRight="FFDDDDDD" bottomLeft="FFDDDDDD" bottomRight="FFDDDDDD" />
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="HeaderBarSplitterNormal" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="HeaderBarBackdropNormal" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="segment_hover">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="HeaderBarSplitterNormal" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="HeaderBarBackdropHover" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="splitter_normal">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="HeaderBarSplitterNormal" />
- <VertFormat type="Stretched" />
- <HorzFormat type="RightAligned" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="splitter_hover">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="HeaderBarSplitterHover" />
- <VertFormat type="Stretched" />
- <HorzFormat type="RightAligned" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="ascend_icon">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="3" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="3" /></Dim>
- <Dim type="Width" ><ImageDim imageset="TaharezLook" image="HeaderBarSortUp" dimension="Width" /></Dim>
- <Dim type="Height" ><ImageDim imageset="TaharezLook" image="HeaderBarSortUp" dimension="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="HeaderBarSortUp" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="descend_icon">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="3" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="3" /></Dim>
- <Dim type="Width" ><ImageDim imageset="TaharezLook" image="HeaderBarSortDown" dimension="Width" /></Dim>
- <Dim type="Height" ><ImageDim imageset="TaharezLook" image="HeaderBarSortDown" dimension="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="HeaderBarSortDown" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="label">
- <TextComponent>
- <Area>
- <Dim type="LeftEdge" >
- <ImageDim imageset="TaharezLook" image="HeaderBarSortUp" dimension="Width">
- <DimOperator op="Add">
- <AbsoluteDim value="5" />
- </DimOperator>
- </ImageDim>
- </Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" ><UnifiedDim scale="1" type="RightEdge" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <VertFormat type="CentreAligned" />
- </TextComponent>
- </ImagerySection>
- <StateImagery name="Normal">
- <Layer>
- <Section section="segment_normal" />
- <Section section="splitter_normal" />
- <Section section="label" />
- </Layer>
- </StateImagery>
- <StateImagery name="Hover">
- <Layer>
- <Section section="segment_hover" />
- <Section section="splitter_normal" />
- <Section section="label" />
- </Layer>
- </StateImagery>
- <StateImagery name="SplitterHover">
- <Layer>
- <Section section="segment_normal" />
- <Section section="splitter_hover" />
- <Section section="label" />
- </Layer>
- </StateImagery>
- <StateImagery name="DragGhost" clipped="false" >
- <Layer priority="1" >
- <Section section="segment_normal">
- <Colours topLeft="90FFFFFF" topRight="90FFFFFF" bottomLeft="90FFFFFF" bottomRight="90FFFFFF" />
- </Section>
- <Section section="splitter_normal">
- <Colours topLeft="90FFFFFF" topRight="90FFFFFF" bottomLeft="90FFFFFF" bottomRight="90FFFFFF" />
- </Section>
- <Section section="label">
- <Colours topLeft="90FFFFFF" topRight="90FFFFFF" bottomLeft="90FFFFFF" bottomRight="90FFFFFF" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="AscendingSortIcon">
- <Layer>
- <Section section="ascend_icon" />
- </Layer>
- </StateImagery>
- <StateImagery name="DescendingSortIcon">
- <Layer>
- <Section section="descend_icon" />
- </Layer>
- </StateImagery>
- <StateImagery name="GhostAscendingSortIcon" clipped="false">
- <Layer priority="1" >
- <Section section="ascend_icon">
- <Colours topLeft="90FFFFFF" topRight="90FFFFFF" bottomLeft="90FFFFFF" bottomRight="90FFFFFF" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="GhostDescendingSortIcon" clipped="false">
- <Layer priority="1" >
- <Section section="descend_icon">
- <Colours topLeft="90FFFFFF" topRight="90FFFFFF" bottomLeft="90FFFFFF" bottomRight="90FFFFFF" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="segment_normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="splitter_normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="label">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/ListHeader
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/ListHeader">
- <Property name="SegmentWidgetType" value="TaharezLook/ListHeaderSegment" />
- <StateImagery name="Enabled" />
- <StateImagery name="Disabled" />
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/MultiColumnList
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/MultiColumnList">
- <NamedArea name="ItemRenderingArea">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="MultiListLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><WidgetDim widget="__auto_listheader__" dimension="BottomEdge" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="MultiListRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="MultiListBottom" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="ItemRenderingAreaHScroll">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="MultiListLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><WidgetDim widget="__auto_listheader__" dimension="BottomEdge" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="MultiListRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="ItemRenderingAreaVScroll">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="MultiListLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><WidgetDim widget="__auto_listheader__" dimension="BottomEdge" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="MultiListBottom" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="ItemRenderingAreaHVScroll">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="MultiListLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><WidgetDim widget="__auto_listheader__" dimension="BottomEdge" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <Child type="TaharezLook/ListHeader" nameSuffix="__auto_listheader__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="2" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="2" /></Dim>
- <Dim type="RightEdge" ><UnifiedDim scale="1" offset="-2" type="RightEdge" /></Dim>
- <Dim type="Height" >
- <FontDim type="LineSpacing">
- <DimOperator op="Multiply">
- <AbsoluteDim value="1.5" />
- </DimOperator>
- </FontDim>
- </Dim>
- </Area>
- </Child>
- <Child type="TaharezLook/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" offset="-12" type="Width" /></Dim>
- <Dim type="Height" ><AbsoluteDim value="12" /></Dim>
- </Area>
- <VertAlignment type="BottomAligned" />
- </Child>
- <Child type="TaharezLook/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><WidgetDim widget="__auto_listheader__" dimension="BottomEdge" /></Dim>
- <Dim type="Width" ><AbsoluteDim value="12" /></Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1" offset="-12" type="BottomEdge" /></Dim>
- </Area>
- <HorzAlignment type="RightAligned" />
- </Child>
- <ImagerySection name="main">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="TopLeftCorner" imageset="TaharezLook" image="MultiListTopLeft" />
- <Image type="TopRightCorner" imageset="TaharezLook" image="MultiListTopRight" />
- <Image type="BottomLeftCorner" imageset="TaharezLook" image="MultiListBottomLeft" />
- <Image type="BottomRightCorner" imageset="TaharezLook" image="MultiListBottomRight" />
- <Image type="LeftEdge" imageset="TaharezLook" image="MultiListLeft" />
- <Image type="RightEdge" imageset="TaharezLook" image="MultiListRight" />
- <Image type="TopEdge" imageset="TaharezLook" image="MultiListTop" />
- <Image type="BottomEdge" imageset="TaharezLook" image="MultiListBottom" />
- <Image type="Background" imageset="TaharezLook" image="MultiListBackdrop" />
- </FrameComponent>
- </ImagerySection>
- <StateImagery name="Enabled">
- <Layer>
- <Section section="main" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="main">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/MultiLineEditbox
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/MultiLineEditbox">
- <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="SelectedTextColour" initialValue="FF000000" redrawOnWrite="true" />
- <PropertyDefinition name="ActiveSelectionColour" initialValue="FF607FFF" redrawOnWrite="true" />
- <PropertyDefinition name="InactiveSelectionColour" initialValue="FF808080" redrawOnWrite="true" />
- <Property name="MouseCursorImage" value="set:TaharezLook image:MouseTextBar" />
- <Property name="SelectionBrushImage" value="set:TaharezLook image:MultiLineEditboxSelectionBrush" />
- <NamedArea name="TextArea">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="MultiLineEditboxLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="MultiLineEditboxTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="MultiLineEditboxRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="MultiLineEditboxBottom" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="TextAreaHScroll">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="MultiLineEditboxLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="MultiLineEditboxTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="MultiLineEditboxRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="TextAreaVScroll">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="MultiLineEditboxLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="MultiLineEditboxTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="MultiLineEditboxBottom" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="TextAreaHVScroll">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="MultiLineEditboxLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="MultiLineEditboxTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <Child type="TaharezLook/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" offset="-12" type="Width" /></Dim>
- <Dim type="Height" ><AbsoluteDim value="12" /></Dim>
- </Area>
- <VertAlignment type="BottomAligned" />
- </Child>
- <Child type="TaharezLook/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><AbsoluteDim value="12" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" offset="-12" type="Height" /></Dim>
- </Area>
- <HorzAlignment type="RightAligned" />
- </Child>
- <ImagerySection name="main">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="TopLeftCorner" imageset="TaharezLook" image="MultiLineEditboxTopLeft" />
- <Image type="TopRightCorner" imageset="TaharezLook" image="MultiLineEditboxTopRight" />
- <Image type="BottomLeftCorner" imageset="TaharezLook" image="MultiLineEditboxBottomLeft" />
- <Image type="BottomRightCorner" imageset="TaharezLook" image="MultiLineEditboxBottomRight" />
- <Image type="LeftEdge" imageset="TaharezLook" image="MultiLineEditboxLeft" />
- <Image type="RightEdge" imageset="TaharezLook" image="MultiLineEditboxRight" />
- <Image type="TopEdge" imageset="TaharezLook" image="MultiLineEditboxTop" />
- <Image type="BottomEdge" imageset="TaharezLook" image="MultiLineEditboxBottom" />
- <Image type="Background" imageset="TaharezLook" image="MultiLineEditboxBackdrop" />
- </FrameComponent>
- </ImagerySection>
- <ImagerySection name="Carat">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><ImageDim imageset="TaharezLook" image="EditBoxCarat" dimension="Width" /></Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="EditBoxCarat" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Enabled">
- <Layer>
- <Section section="main" />
- </Layer>
- </StateImagery>
- <StateImagery name="ReadOnly">
- <Layer>
- <Section section="main" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="main">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/Tooltip
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/Tooltip">
- <NamedArea name="TextArea">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="TooltipLeftEdge" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="TooltipTopEdge" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="TooltipRightEdge" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="TooltipBottomEdge" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <ImagerySection name="main">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="TopLeftCorner" imageset="TaharezLook" image="TooltipTopLeft" />
- <Image type="TopRightCorner" imageset="TaharezLook" image="TooltipTopRight" />
- <Image type="BottomLeftCorner" imageset="TaharezLook" image="TooltipBottomLeft" />
- <Image type="BottomRightCorner" imageset="TaharezLook" image="TooltipBottomRight" />
- <Image type="LeftEdge" imageset="TaharezLook" image="TooltipLeftEdge" />
- <Image type="RightEdge" imageset="TaharezLook" image="TooltipRightEdge" />
- <Image type="TopEdge" imageset="TaharezLook" image="TooltipTopEdge" />
- <Image type="BottomEdge" imageset="TaharezLook" image="TooltipBottomEdge" />
- <Image type="Background" imageset="TaharezLook" image="TooltipMiddle" />
- </FrameComponent>
- </ImagerySection>
- <ImagerySection name="label">
- <TextComponent>
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="TooltipLeftEdge" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="TooltipTopEdge" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="TooltipRightEdge" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="TooltipBottomEdge" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- <Colours topLeft="FF000000" topRight="FF000000" bottomLeft="FF000000" bottomRight="FF000000" />
- <VertFormat type="CentreAligned" />
- <HorzFormat type="CentreAligned" />
- </TextComponent>
- </ImagerySection>
- <StateImagery name="Enabled">
- <Layer>
- <Section section="main" />
- <Section section="label" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="main" />
- <Section section="label" />
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/ScrollablePane
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/ScrollablePane">
- <NamedArea name="ViewableArea">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
- </Area>
- </NamedArea>
- <NamedArea name="ViewableAreaHScroll">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="ViewableAreaVScroll">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
- </Area>
- </NamedArea>
- <NamedArea name="ViewableAreaHVScroll">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <Child type="TaharezLook/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" offset="-12" type="Width" /></Dim>
- <Dim type="Height" ><AbsoluteDim value="12" /></Dim>
- </Area>
- <VertAlignment type="BottomAligned" />
- </Child>
- <Child type="TaharezLook/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><AbsoluteDim value="12" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" offset="-12" type="Height" /></Dim>
- </Area>
- <HorzAlignment type="RightAligned" />
- </Child>
- <StateImagery name="Enabled" />
- <StateImagery name="Disabled" />
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/TabButton
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/TabButton">
- <PropertyDefinition name="NormalTextColour" initialValue="FFC0C0C0" redrawOnWrite="true" />
- <PropertyDefinition name="HoverTextColour" initialValue="FFE0E0E0" redrawOnWrite="true" />
- <PropertyDefinition name="PushedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="SelectedTextColour" initialValue="FFE0E0E0" redrawOnWrite="true" />
- <PropertyDefinition name="DisabledTextColour" initialValue="FF7F7F7F" redrawOnWrite="true" />
- <ImagerySection name="label">
- <TextComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <VertFormat type="CentreAligned" />
- <HorzFormat type="CentreAligned" />
- </TextComponent>
- </ImagerySection>
- <ImagerySection name="top_normal">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="TopLeftCorner" imageset="TaharezLook" image="TabButtonUpperLeftNormal" />
- <Image type="TopRightCorner" imageset="TaharezLook" image="TabButtonUpperRightNormal" />
- <Image type="BottomLeftCorner" imageset="TaharezLook" image="TabButtonLowerLeftNormal" />
- <Image type="BottomRightCorner" imageset="TaharezLook" image="TabButtonLowerRight2Normal" />
- <Image type="LeftEdge" imageset="TaharezLook" image="TabButtonLeftNormal" />
- <Image type="RightEdge" imageset="TaharezLook" image="TabButtonRightNormal" />
- <Image type="TopEdge" imageset="TaharezLook" image="TabButtonUpperNormal" />
- <Image type="BottomEdge" imageset="TaharezLook" image="TabButtonLowerNormal" />
- <Image type="Background" imageset="TaharezLook" image="TabButtonMiddleNormal" />
- </FrameComponent>
- </ImagerySection>
- <ImagerySection name="bot_normal">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="TopLeftCorner" imageset="TaharezLook" image="TabButtonUpperLeft2Normal" />
- <Image type="TopRightCorner" imageset="TaharezLook" image="TabButtonUpperRightNormal" />
- <Image type="BottomLeftCorner" imageset="TaharezLook" image="TabButtonLowerLeftNormal" />
- <Image type="BottomRightCorner" imageset="TaharezLook" image="TabButtonLowerRightNormal" />
- <Image type="LeftEdge" imageset="TaharezLook" image="TabButtonLeftNormal" />
- <Image type="RightEdge" imageset="TaharezLook" image="TabButtonRightNormal" />
- <Image type="TopEdge" imageset="TaharezLook" image="TabButtonUpperNormal" />
- <Image type="BottomEdge" imageset="TaharezLook" image="TabButtonLowerNormal" />
- <Image type="Background" imageset="TaharezLook" image="TabButtonMiddleNormal" />
- </FrameComponent>
- </ImagerySection>
- <ImagerySection name="top_hover">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="TopLeftCorner" imageset="TaharezLook" image="TabButtonUpperLeftNormal" />
- <Image type="TopRightCorner" imageset="TaharezLook" image="TabButtonUpperRightNormal" />
- <Image type="BottomLeftCorner" imageset="TaharezLook" image="TabButtonLowerLeftNormal" />
- <Image type="BottomRightCorner" imageset="TaharezLook" image="TabButtonLowerRight2Normal" />
- <Image type="LeftEdge" imageset="TaharezLook" image="TabButtonLeftNormal" />
- <Image type="RightEdge" imageset="TaharezLook" image="TabButtonRightNormal" />
- <Image type="TopEdge" imageset="TaharezLook" image="TabButtonUpperNormal" />
- <Image type="BottomEdge" imageset="TaharezLook" image="TabButtonLowerNormal" />
- <Image type="Background" imageset="TaharezLook" image="TabButtonMiddleNormal" />
- </FrameComponent>
- </ImagerySection>
- <ImagerySection name="bot_hover">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="TopLeftCorner" imageset="TaharezLook" image="TabButtonUpperLeft2Normal" />
- <Image type="TopRightCorner" imageset="TaharezLook" image="TabButtonUpperRightNormal" />
- <Image type="BottomLeftCorner" imageset="TaharezLook" image="TabButtonLowerLeftNormal" />
- <Image type="BottomRightCorner" imageset="TaharezLook" image="TabButtonLowerRightNormal" />
- <Image type="LeftEdge" imageset="TaharezLook" image="TabButtonLeftNormal" />
- <Image type="RightEdge" imageset="TaharezLook" image="TabButtonRightNormal" />
- <Image type="TopEdge" imageset="TaharezLook" image="TabButtonUpperNormal" />
- <Image type="BottomEdge" imageset="TaharezLook" image="TabButtonLowerNormal" />
- <Image type="Background" imageset="TaharezLook" image="TabButtonMiddleNormal" />
- </FrameComponent>
- </ImagerySection>
- <ImagerySection name="top_selected">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="TopLeftCorner" imageset="TaharezLook" image="TabButtonUpperLeftSelected" />
- <Image type="TopEdge" imageset="TaharezLook" image="TabButtonUpperSelected" />
- <Image type="TopRightCorner" imageset="TaharezLook" image="TabButtonUpperRightSelected" />
- <Image type="LeftEdge" imageset="TaharezLook" image="TabButtonLeftSelected" />
- <Image type="Background" imageset="TaharezLook" image="TabButtonMiddleSelected" />
- <Image type="RightEdge" imageset="TaharezLook" image="TabButtonRightSelected" />
- </FrameComponent>
- </ImagerySection>
- <ImagerySection name="bot_selected">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="LeftEdge" imageset="TaharezLook" image="TabButtonLeftSelected" />
- <Image type="Background" imageset="TaharezLook" image="TabButtonMiddleSelected" />
- <Image type="RightEdge" imageset="TaharezLook" image="TabButtonRightSelected" />
- <Image type="BottomLeftCorner" imageset="TaharezLook" image="TabButtonLowerLeftNormal" />
- <Image type="BottomEdge" imageset="TaharezLook" image="TabButtonLowerNormal" />
- <Image type="BottomRightCorner" imageset="TaharezLook" image="TabButtonLowerRightNormal" />
- </FrameComponent>
- </ImagerySection>
- <StateImagery name="TopNormal">
- <Layer>
- <Section section="top_normal" />
- <Section section="label">
- <ColourProperty name="NormalTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="BottomNormal">
- <Layer>
- <Section section="bot_normal" />
- <Section section="label">
- <ColourProperty name="NormalTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="TopHover">
- <Layer>
- <Section section="top_hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="BottomHover">
- <Layer>
- <Section section="bot_hover" />
- <Section section="label">
- <ColourProperty name="HoverTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="TopSelected">
- <Layer>
- <Section section="top_selected" />
- <Section section="label">
- <ColourProperty name="SelectedTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="BottomSelected">
- <Layer>
- <Section section="bot_selected" />
- <Section section="label">
- <ColourProperty name="SelectedTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="TopPushed">
- <Layer>
- <Section section="top_normal" />
- <Section section="label">
- <ColourProperty name="PushedTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="BottomPushed">
- <Layer>
- <Section section="bot_normal" />
- <Section section="label">
- <ColourProperty name="PushedTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="TopDisabled">
- <Layer>
- <Section section="top_normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="label">
- <ColourProperty name="DisabledTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="BottomDisabled">
- <Layer>
- <Section section="bot_normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="label">
- <ColourProperty name="DisabledTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/TabContentPane
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/TabContentPane">
- <PropertyDefinition name="EnableTop" initialValue="0" redrawOnWrite="true" layoutOnWrite="true" />
- <PropertyDefinition name="EnableBottom" initialValue="0" redrawOnWrite="true" layoutOnWrite="true" />
- <ImagerySection name="normal">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="BottomEdge" >
- <ImageDim imageset="TaharezLook" image="TabContentPaneUpperLeft" dimension="Height">
- <DimOperator op="Multiply">
- <PropertyDim name="EnableTop" />
- </DimOperator>
- </ImageDim>
- </Dim>
- </Area>
- <Image type="TopLeftCorner" imageset="TaharezLook" image="TabContentPaneUpperLeft" />
- <Image type="TopEdge" imageset="TaharezLook" image="TabContentPaneUpper" />
- <Image type="TopRightCorner" imageset="TaharezLook" image="TabContentPaneUpperRight" />
- </FrameComponent>
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" >
- <ImageDim imageset="TaharezLook" image="TabContentPaneUpperLeft" dimension="Height">
- <DimOperator op="Multiply">
- <PropertyDim name="EnableTop" />
- </DimOperator>
- </ImageDim>
- </Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="Height">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="TabContentPaneLowerLeft" dimension="Height">
- <DimOperator op="Multiply">
- <PropertyDim name="EnableBottom" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- <Image type="LeftEdge" imageset="TaharezLook" image="TabContentPaneLeft" />
- <Image type="Background" imageset="TaharezLook" image="TabContentPaneMiddle" />
- <Image type="RightEdge" imageset="TaharezLook" image="TabContentPaneRight" />
- </FrameComponent>
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" >
- <UnifiedDim scale="1" type="Height">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="TabContentPaneLowerLeft" dimension="Height">
- <DimOperator op="Multiply">
- <PropertyDim name="EnableBottom" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="BottomLeftCorner" imageset="TaharezLook" image="TabContentPaneLowerLeft" />
- <Image type="BottomEdge" imageset="TaharezLook" image="TabContentPaneLower" />
- <Image type="BottomRightCorner" imageset="TaharezLook" image="TabContentPaneLowerRight" />
- </FrameComponent>
- </ImagerySection>
- <StateImagery name="Enabled">
- <Layer>
- <Section section="normal" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/TabButtonPane
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/TabButtonPane">
- <PropertyDefinition name="EnableTop" initialValue="1" redrawOnWrite="true" layoutOnWrite="true" />
- <PropertyDefinition name="EnableBottom" initialValue="1" redrawOnWrite="true" layoutOnWrite="true" />
- <ImagerySection name="normal">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="BottomEdge" >
- <ImageDim imageset="TaharezLook" image="TabHorizontalFiller" dimension="Height">
- <DimOperator op="Multiply">
- <PropertyDim name="EnableTop" />
- </DimOperator>
- </ImageDim>
- </Dim>
- </Area>
- <Image type="TopEdge" imageset="TaharezLook" image="TabHorizontalFiller" />
- </FrameComponent>
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" >
- <ImageDim imageset="TaharezLook" image="TabHorizontalFiller" dimension="Height">
- <DimOperator op="Multiply">
- <PropertyDim name="EnableTop" />
- </DimOperator>
- </ImageDim>
- </Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="Height">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="TabHorizontalFiller" dimension="Height">
- <DimOperator op="Multiply">
- <PropertyDim name="EnableBottom" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </FrameComponent>
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" >
- <UnifiedDim scale="1" type="Height">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="TabHorizontalFiller" dimension="Height">
- <DimOperator op="Multiply">
- <PropertyDim name="EnableBottom" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="BottomEdge" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="BottomEdge" imageset="TaharezLook" image="TabHorizontalFiller" />
- </FrameComponent>
- </ImagerySection>
- <StateImagery name="Enabled">
- <Layer>
- <Section section="normal" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/TabControl
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/TabControl">
- <Property name="TabButtonType" value="TaharezLook/TabButton" />
- <Property name="TabTextPadding" value="{0,6}" />
- <Child type="TaharezLook/TabContentPane" nameSuffix="__auto_TabPane__">
- <Area>
- <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge"><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="TopEdge">
- <PropertyDim widget="__auto_TabPane__" name="EnableBottom">
- <DimOperator op="Multiply">
- <PropertyDim name="TabHeight" type="Height" />
- </DimOperator>
- </PropertyDim>
- </Dim>
- <Dim type="Height">
- <UnifiedDim scale="1" type="Height">
- <DimOperator op="Subtract">
- <PropertyDim name="TabHeight" type="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </Child>
- <Child type="TaharezLook/TabButtonPane" nameSuffix="__auto_TabPane__Buttons">
- <Area>
- <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="RightEdge"><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="TopEdge">
- <PropertyDim widget="__auto_TabPane__Buttons" name="EnableTop">
- <DimOperator op="Multiply">
- <UnifiedDim scale="1" type="Height">
- <DimOperator op="Subtract">
- <PropertyDim name="TabHeight" type="Height" />
- </DimOperator>
- </UnifiedDim>
- </DimOperator>
- </PropertyDim>
- </Dim>
- <Dim type="Height"><PropertyDim name="TabHeight" type="Height" /></Dim>
- </Area>
- </Child>
- <Child type="TaharezLook/SystemButton" nameSuffix="__auto_TabPane__ScrollLeft">
- <Area>
- <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge">
- <WidgetDim widget="__auto_TabPane__Buttons" dimension="TopEdge" />
- </Dim>
- <Dim type="Width">
- <WidgetDim widget="__auto_TabPane__Buttons" dimension="Height">
- <DimOperator op="Multiply">
- <ImageDim imageset="TaharezLook" image="TabButtonScrollLeftNormal" dimension="Width">
- <DimOperator op="Divide">
- <ImageDim imageset="TaharezLook" image="TabButtonScrollLeftNormal" dimension="Height" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </WidgetDim>
- </Dim>
- <Dim type="BottomEdge">
- <WidgetDim widget="__auto_TabPane__Buttons" dimension="BottomEdge" />
- </Dim>
- </Area>
- <Property name="AlwaysOnTop" value="True" />
- <Property name="NormalImage" value="set:TaharezLook image:TabButtonScrollLeftNormal" />
- <Property name="HoverImage" value="set:TaharezLook image:TabButtonScrollLeftHover" />
- <Property name="PushedImage" value="set:TaharezLook image:TabButtonScrollLeftHover" />
- </Child>
- <Child type="TaharezLook/SystemButton" nameSuffix="__auto_TabPane__ScrollRight">
- <Area>
- <Dim type="Width">
- <WidgetDim widget="__auto_TabPane__Buttons" dimension="Height">
- <DimOperator op="Multiply">
- <ImageDim imageset="TaharezLook" image="TabButtonScrollRightNormal" dimension="Width">
- <DimOperator op="Divide">
- <ImageDim imageset="TaharezLook" image="TabButtonScrollRightNormal" dimension="Height" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </WidgetDim>
- </Dim>
- <Dim type="LeftEdge">
- <UnifiedDim scale="1" type="Width">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_TabPane__ScrollRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="TopEdge">
- <WidgetDim widget="__auto_TabPane__Buttons" dimension="TopEdge" />
- </Dim>
- <Dim type="Height">
- <WidgetDim widget="__auto_TabPane__Buttons" dimension="Height" />
- </Dim>
- </Area>
- <Property name="AlwaysOnTop" value="True" />
- <Property name="NormalImage" value="set:TaharezLook image:TabButtonScrollRightNormal" />
- <Property name="HoverImage" value="set:TaharezLook image:TabButtonScrollRightHover" />
- <Property name="PushedImage" value="set:TaharezLook image:TabButtonScrollRightHover" />
- </Child>
- <StateImagery name="Enabled" />
- <StateImagery name="Disabled" />
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/MenuItem
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/MenuItem">
- <PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="DisabledTextColour" initialValue="FF7F7F7F" redrawOnWrite="true" />
- <PropertyDefinition name="HoverColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="PushedColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="OpenedColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <Property name="WantsMultiClickEvents" value="False" />
- <NamedArea name="ContentSize">
- <Area>
- <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="Width">
- <FontDim type="HorzExtent">
- <DimOperator op="Add">
- <ImageDim imageset="TaharezLook" image="MenuLeft" dimension="Width">
- <DimOperator op="Add">
- <ImageDim imageset="TaharezLook" image="MenuRight" dimension="Width" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </FontDim>
- </Dim>
- <Dim type="Height">
- <FontDim type="LineSpacing">
- <DimOperator op="Add">
- <ImageDim imageset="TaharezLook" image="MenuTop" dimension="Height">
- <DimOperator op="Add">
- <ImageDim imageset="TaharezLook" image="MenuBottom" dimension="Height" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </FontDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="HasPopupContentSize">
- <Area>
- <Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
- <Dim type="Width">
- <FontDim type="HorzExtent">
- <DimOperator op="Add">
- <ImageDim imageset="TaharezLook" image="MenuLeft" dimension="Width">
- <DimOperator op="Add">
- <ImageDim imageset="TaharezLook" image="MenuRight" dimension="Width">
- <DimOperator op="Add">
- <ImageDim imageset="TaharezLook" image="PopupMenuArrowLeft" dimension="Width">
- <DimOperator op="Multiply">
- <AbsoluteDim value="3" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </FontDim>
- </Dim>
- <Dim type="Height">
- <FontDim type="LineSpacing">
- <DimOperator op="Add">
- <ImageDim imageset="TaharezLook" image="MenuTop" dimension="Height">
- <DimOperator op="Add">
- <ImageDim imageset="TaharezLook" image="MenuBottom" dimension="Height" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </FontDim>
- </Dim>
- </Area>
- </NamedArea>
- <ImagerySection name="label">
- <TextComponent>
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="MenuLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="MenuTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="MenuRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="MenuBottom" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- <VertFormat type="CentreAligned" />
- <HorzFormat type="LeftAligned" />
- </TextComponent>
- </ImagerySection>
- <ImagerySection name="frame">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="TopLeftCorner" imageset="TaharezLook" image="MenuTopLeft" />
- <Image type="TopRightCorner" imageset="TaharezLook" image="MenuTopRight" />
- <Image type="BottomLeftCorner" imageset="TaharezLook" image="MenuBottomLeft" />
- <Image type="BottomRightCorner" imageset="TaharezLook" image="MenuBottomRight" />
- <Image type="LeftEdge" imageset="TaharezLook" image="MenuLeft" />
- <Image type="RightEdge" imageset="TaharezLook" image="MenuRight" />
- <Image type="TopEdge" imageset="TaharezLook" image="MenuTop" />
- <Image type="BottomEdge" imageset="TaharezLook" image="MenuBottom" />
- <Image type="Background" imageset="TaharezLook" image="MenuMiddle" />
- </FrameComponent>
- </ImagerySection>
- <ImagerySection name="popup_arrow_right">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" >
- <UnifiedDim scale="1" type="Width">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="PopupMenuArrowRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="PopupMenuArrowRight" />
- <VertFormat type="CentreAligned" />
- <HorzFormat type="RightAligned" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="popup_arrow_left">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" >
- <UnifiedDim scale="1" type="Width">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="PopupMenuArrowLeft" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="PopupMenuArrowLeft" />
- <VertFormat type="CentreAligned" />
- <HorzFormat type="RightAligned" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="EnabledNormal">
- <Layer>
- <Section section="label">
- <ColourProperty name="NormalTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="EnabledHover">
- <Layer>
- <Section section="frame">
- <ColourProperty name="HoverColour" />
- </Section>
- <Section section="label">
- <ColourProperty name="NormalTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="EnabledPushed">
- <Layer>
- <Section section="frame">
- <ColourProperty name="PushedColour" />
- </Section>
- <Section section="label">
- <ColourProperty name="NormalTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="EnabledPopupOpen">
- <Layer>
- <Section section="frame">
- <ColourProperty name="OpenedColour" />
- </Section>
- <Section section="label">
- <ColourProperty name="NormalTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="DisabledNormal">
- <Layer>
- <Section section="label">
- <ColourProperty name="DisabledTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="DisabledHover">
- <Layer>
- <Section section="frame">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="label">
- <ColourProperty name="DisabledTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="DisabledPushed">
- <Layer>
- <Section section="frame">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="label">
- <ColourProperty name="DisabledTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="DisabledPopupOpen">
- <Layer>
- <Section section="frame">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- <Section section="label">
- <ColourProperty name="DisabledTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="PopupClosedIcon">
- <Layer>
- <Section section="popup_arrow_right" />
- </Layer>
- </StateImagery>
- <StateImagery name="PopupOpenIcon">
- <Layer>
- <Section section="popup_arrow_left" />
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/PopupMenu
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/PopupMenu">
- <PropertyDefinition name="BackgroundColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="BorderWidth" initialValue="0" layoutOnWrite="true" />
- <NamedArea name="ItemRenderArea">
- <Area>
- <Dim type="LeftEdge" >
- <ImageDim imageset="TaharezLook" image="PopupMenuFrameLeft" dimension="Width">
- <DimOperator op="Add">
- <PropertyDim name="BorderWidth" />
- </DimOperator>
- </ImageDim>
- </Dim>
- <Dim type="TopEdge" >
- <ImageDim imageset="TaharezLook" image="PopupMenuFrameTop" dimension="Height">
- <DimOperator op="Add">
- <PropertyDim name="BorderWidth" />
- </DimOperator>
- </ImageDim>
- </Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="PopupMenuFrameRight" dimension="Width">
- <DimOperator op="Add">
- <PropertyDim name="BorderWidth" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="PopupMenuFrameBottom" dimension="Height">
- <DimOperator op="Add">
- <PropertyDim name="BorderWidth" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <ImagerySection name="frame">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="TopLeftCorner" imageset="TaharezLook" image="PopupMenuFrameTopLeft" />
- <Image type="TopRightCorner" imageset="TaharezLook" image="PopupMenuFrameTopRight" />
- <Image type="BottomLeftCorner" imageset="TaharezLook" image="PopupMenuFrameBottomLeft" />
- <Image type="BottomRightCorner" imageset="TaharezLook" image="PopupMenuFrameBottomRight" />
- <Image type="LeftEdge" imageset="TaharezLook" image="PopupMenuFrameLeft" />
- <Image type="RightEdge" imageset="TaharezLook" image="PopupMenuFrameRight" />
- <Image type="TopEdge" imageset="TaharezLook" image="PopupMenuFrameTop" />
- <Image type="BottomEdge" imageset="TaharezLook" image="PopupMenuFrameBottom" />
- <Image type="Background" imageset="TaharezLook" image="PopupMenuMiddle" />
- </FrameComponent>
- </ImagerySection>
- <StateImagery name="Enabled">
- <Layer>
- <Section section="frame">
- <ColourRectProperty name="BackgroundColours" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="frame">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
-
- <!--
- ***************************************************
- TaharezLook/Menubar
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/Menubar">
- <PropertyDefinition name="BackgroundColours" initialValue="tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="BorderWidth" initialValue="5" layoutOnWrite="true" />
- <NamedArea name="ItemRenderArea">
- <Area>
- <Dim type="LeftEdge" >
- <ImageDim imageset="TaharezLook" image="PopupMenuFrameLeft" dimension="Width">
- <DimOperator op="Add">
- <PropertyDim name="BorderWidth" />
- </DimOperator>
- </ImageDim>
- </Dim>
- <Dim type="TopEdge" >
- <ImageDim imageset="TaharezLook" image="PopupMenuFrameTop" dimension="Height">
- <DimOperator op="Add">
- <PropertyDim name="BorderWidth" />
- </DimOperator>
- </ImageDim>
- </Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="PopupMenuFrameRight" dimension="Width">
- <DimOperator op="Add">
- <PropertyDim name="BorderWidth" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="PopupMenuFrameBottom" dimension="Height">
- <DimOperator op="Add">
- <PropertyDim name="BorderWidth" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <ImagerySection name="frame">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="TopLeftCorner" imageset="TaharezLook" image="PopupMenuFrameTopLeft" />
- <Image type="TopRightCorner" imageset="TaharezLook" image="PopupMenuFrameTopRight" />
- <Image type="BottomLeftCorner" imageset="TaharezLook" image="PopupMenuFrameBottomLeft" />
- <Image type="BottomRightCorner" imageset="TaharezLook" image="PopupMenuFrameBottomRight" />
- <Image type="LeftEdge" imageset="TaharezLook" image="PopupMenuFrameLeft" />
- <Image type="RightEdge" imageset="TaharezLook" image="PopupMenuFrameRight" />
- <Image type="TopEdge" imageset="TaharezLook" image="PopupMenuFrameTop" />
- <Image type="BottomEdge" imageset="TaharezLook" image="PopupMenuFrameBottom" />
- <Image type="Background" imageset="TaharezLook" image="PopupMenuMiddle" />
- </FrameComponent>
- </ImagerySection>
- <StateImagery name="Enabled">
- <Layer>
- <Section section="frame">
- <ColourRectProperty name="BackgroundColours" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="frame">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/LargeVerticalScrollbarThumb
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/LargeVerticalScrollbarThumb">
- <Property name="VertFree" value="True" />
- <ImagerySection name="normal">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="VertScrollThumbNormal" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="hover">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1.0" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1.0" type="Height" /></Dim>
- </Area>
- <Image imageset="TaharezLook" image="VertScrollThumbHover" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Normal">
- <Layer>
- <Section section="normal" />
- </Layer>
- </StateImagery>
- <StateImagery name="Hover">
- <Layer>
- <Section section="hover" />
- </Layer>
- </StateImagery>
- <StateImagery name="Pushed">
- <Layer>
- <Section section="normal" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="normal">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/LargeVerticalScrollbar
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/LargeVerticalScrollbar">
- <Property name="VerticalScrollbar" value="True" />
- <NamedArea name="ThumbTrackArea">
- <Area>
- <Dim type="LeftEdge" ><UnifiedDim scale="0.325" type="LeftEdge" /></Dim>
- <Dim type="TopEdge" >
- <WidgetDim widget="__auto_decbtn__" dimension="Height">
- <DimOperator op="Add">
- <ImageDim imageset="TaharezLook" image="VertScrollTop" dimension="Height">
- <DimOperator op="Multiply">
- <AbsoluteDim value="0.5" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </WidgetDim>
- </Dim>
- <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1.0" type="BottomEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_decbtn__" dimension="Height">
- <DimOperator op="Add">
- <ImageDim imageset="TaharezLook" image="VertScrollTop" dimension="Height">
- <DimOperator op="Multiply">
- <AbsoluteDim value="0.5" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </WidgetDim>
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <Child type="TaharezLook/ImageButton" nameSuffix="__auto_incbtn__">
- <Area>
- <Dim type="LeftEdge" ><UnifiedDim scale="0.25" type="LeftEdge" /></Dim>
- <Dim type="TopEdge" >
- <AbsoluteDim value="-1">
- <DimOperator op="Multiply">
- <ImageDim imageset="TaharezLook" image="VertScrollTop" dimension="Height">
- <DimOperator op="Multiply">
- <AbsoluteDim value="0.5" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </AbsoluteDim>
- </Dim>
- <Dim type="Width" ><UnifiedDim scale="0.6" type="Width" /></Dim>
- <Dim type="Height" >
- <UnifiedDim scale="0.6" type="Width">
- <DimOperator op="Multiply">
- <ImageDim imageset="TaharezLook" image="VertScrollUpNormal" dimension="Width">
- <DimOperator op="Divide">
- <ImageDim imageset="TaharezLook" image="VertScrollUpNormal" dimension="Height"/>
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- <VertAlignment type="BottomAligned" />
- <Property name="NormalImage" value="set:TaharezLook image:VertScrollDownNormal" />
- <Property name="HoverImage" value="set:TaharezLook image:VertScrollDownHover" />
- <Property name="PushedImage" value="set:TaharezLook image:VertScrollDownNormal" />
- </Child>
- <Child type="TaharezLook/ImageButton" nameSuffix="__auto_decbtn__">
- <Area>
- <Dim type="LeftEdge" ><UnifiedDim scale="0.25" type="LeftEdge" /></Dim>
- <Dim type="TopEdge">
- <ImageDim imageset="TaharezLook" image="VertScrollTop" dimension="Height">
- <DimOperator op="Multiply">
- <AbsoluteDim value="0.5" />
- </DimOperator>
- </ImageDim>
- </Dim>
- <Dim type="Width" ><UnifiedDim scale="0.6" type="Width" /></Dim>
- <Dim type="Height" >
- <UnifiedDim scale="0.6" type="Width">
- <DimOperator op="Multiply">
- <ImageDim imageset="TaharezLook" image="VertScrollUpNormal" dimension="Width">
- <DimOperator op="Divide">
- <ImageDim imageset="TaharezLook" image="VertScrollUpNormal" dimension="Height"/>
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- <Property name="NormalImage" value="set:TaharezLook image:VertScrollUpNormal" />
- <Property name="HoverImage" value="set:TaharezLook image:VertScrollUpHover" />
- <Property name="PushedImage" value="set:TaharezLook image:VertScrollUpNormal" />
- </Child>
- <Child type="TaharezLook/LargeVerticalScrollbarThumb" nameSuffix="__auto_thumb__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="0.4" type="Width" /></Dim>
- <Dim type="Height" >
- <UnifiedDim scale="0.4" type="Width">
- <DimOperator op="Multiply">
- <ImageDim imageset="TaharezLook" image="VertScrollThumbNormal" dimension="Height">
- <DimOperator op="Divide">
- <ImageDim imageset="TaharezLook" image="VertScrollThumbNormal" dimension="Width"/>
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </Child>
- <ImagerySection name="main">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="TopEdge" imageset="TaharezLook" image="VertScrollTop" />
- <Image type="BottomEdge" imageset="TaharezLook" image="VertScrollBottom" />
- <Image type="Background" imageset="TaharezLook" image="VertScrollMiddle" />
- </FrameComponent>
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><UnifiedDim scale="0.45" type="LeftEdge" /></Dim>
- <Dim type="TopEdge" >
- <WidgetDim widget="__auto_decbtn__" dimension="Height">
- <DimOperator op="Add">
- <ImageDim imageset="TaharezLook" image="VertScrollTop" dimension="Height">
- <DimOperator op="Multiply">
- <AbsoluteDim value="0.5" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </WidgetDim>
- </Dim>
- <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1.0" type="BottomEdge">
- <DimOperator op="Subtract">
- <WidgetDim widget="__auto_decbtn__" dimension="Height">
- <DimOperator op="Add">
- <ImageDim imageset="TaharezLook" image="VertScrollTop" dimension="Height">
- <DimOperator op="Multiply">
- <AbsoluteDim value="0.5" />
- </DimOperator>
- </ImageDim>
- </DimOperator>
- </WidgetDim>
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- <Image imageset="TaharezLook" image="VertScrollBarSegment" />
- <VertFormat type="Tiled" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Enabled">
- <Layer>
- <Section section="main" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="main">
- <Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/ImageButton
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/ImageButton">
- <PropertyDefinition name="NormalImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="HoverImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="PushedImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="DisabledImage" initialValue="" redrawOnWrite="true" />
- <PropertyDefinition name="VertImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <PropertyDefinition name="HorzImageFormatting" initialValue="Stretched" redrawOnWrite="true" />
- <ImagerySection name="normal">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="NormalImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="hover">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="HoverImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="pushed">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="PushedImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <ImagerySection name="disabled">
- <ImageryComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <ImageProperty name="DisabledImage" />
- <VertFormatProperty name="VertImageFormatting" />
- <HorzFormatProperty name="HorzImageFormatting" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Normal">
- <Layer>
- <Section section="normal" />
- </Layer>
- </StateImagery>
- <StateImagery name="Hover">
- <Layer>
- <Section section="hover" />
- </Layer>
- </StateImagery>
- <StateImagery name="Pushed">
- <Layer>
- <Section section="pushed" />
- </Layer>
- </StateImagery>
- <StateImagery name="PushedOff">
- <Layer>
- <Section section="hover" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="disabled" />
- </Layer>
- </StateImagery>
- </WidgetLook>
-
- <!--
- ***************************************************
- TaharezLook/ItemListbox
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/ItemListbox">
- <NamedArea name="ItemRenderArea">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="ListboxLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="ListboxTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="ListboxRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="ListboxBottom" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="ItemRenderAreaHScroll">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="ListboxLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="ListboxTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" type="RightEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="ListboxRight" dimension="Width" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" offset="-12" type="BottomEdge" />
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="ItemRenderAreaVScroll">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="ListboxLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="ListboxTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" offset="-12" type="RightEdge" />
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" type="BottomEdge">
- <DimOperator op="Subtract">
- <ImageDim imageset="TaharezLook" image="ListboxBottom" dimension="Height" />
- </DimOperator>
- </UnifiedDim>
- </Dim>
- </Area>
- </NamedArea>
- <NamedArea name="ItemRenderAreaHVScroll">
- <Area>
- <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="ListboxLeft" dimension="Width" /></Dim>
- <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="ListboxTop" dimension="Height" /></Dim>
- <Dim type="RightEdge" >
- <UnifiedDim scale="1" offset="-12" type="RightEdge" />
- </Dim>
- <Dim type="BottomEdge" >
- <UnifiedDim scale="1" offset="-12" type="BottomEdge" />
- </Dim>
- </Area>
- </NamedArea>
- <Child type="TaharezLook/HorizontalScrollbar" nameSuffix="__auto_hscrollbar__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" offset="-12" type="Width" /></Dim>
- <Dim type="Height" ><AbsoluteDim value="12" /></Dim>
- </Area>
- <VertAlignment type="BottomAligned" />
- </Child>
- <Child type="TaharezLook/VerticalScrollbar" nameSuffix="__auto_vscrollbar__">
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><AbsoluteDim value="12" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <HorzAlignment type="RightAligned" />
- </Child>
- <ImagerySection name="main">
- <FrameComponent>
- <Area>
- <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
- <Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
- <Dim type="Height" ><UnifiedDim scale="1" type="Height" /></Dim>
- </Area>
- <Image type="TopLeftCorner" imageset="TaharezLook" image="ListboxTopLeft" />
- <Image type="TopRightCorner" imageset="TaharezLook" image="ListboxTopRight" />
- <Image type="BottomLeftCorner" imageset="TaharezLook" image="ListboxBottomLeft" />
- <Image type="BottomRightCorner" imageset="TaharezLook" image="ListboxBottomRight" />
- <Image type="LeftEdge" imageset="TaharezLook" image="ListboxLeft" />
- <Image type="RightEdge" imageset="TaharezLook" image="ListboxRight" />
- <Image type="TopEdge" imageset="TaharezLook" image="ListboxTop" />
- <Image type="BottomEdge" imageset="TaharezLook" image="ListboxBottom" />
- <Image type="Background" imageset="TaharezLook" image="ListboxBackdrop" />
- </FrameComponent>
- </ImagerySection>
- <StateImagery name="Enabled">
- <Layer>
- <Section section="main" />
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="main" />
- </Layer>
- </StateImagery>
- </WidgetLook>
-
-
- <!--
- ***************************************************
- TaharezLook/ListboxItem
- ***************************************************
- -->
- <WidgetLook name="TaharezLook/ListboxItem">
- <PropertyDefinition name="TextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="SelectedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
- <PropertyDefinition name="SelectionBrush" initialValue="set:TaharezLook image:ListboxSelectionBrush" redrawOnWrite="true" />
- <PropertyDefinition name="SelectionColour" initialValue="FF4444AA" redrawOnWrite="true" />
- <Property name="Selectable" value="True" />
- <NamedArea name="ContentSize">
- <Area>
- <Dim type="LeftEdge" >
- <AbsoluteDim value="0" />
- </Dim>
- <Dim type="TopEdge" >
- <AbsoluteDim value="0" />
- </Dim>
- <Dim type="Width" >
- <FontDim type="HorzExtent" padding="6" />
- </Dim>
- <Dim type="Height" >
- <FontDim type="LineSpacing" />
- </Dim>
- </Area>
- </NamedArea>
- <ImagerySection name="label">
- <TextComponent>
- <Area>
- <Dim type="TopEdge">
- <AbsoluteDim value="0" />
- </Dim>
- <Dim type="LeftEdge">
- <AbsoluteDim value="3" />
- </Dim>
- <Dim type="RightEdge">
- <UnifiedDim scale="1" offset="-3" type="RightEdge" />
- </Dim>
- <Dim type="BottomEdge">
- <UnifiedDim scale="1" type="BottomEdge" />
- </Dim>
- </Area>
- </TextComponent>
- </ImagerySection>
- <ImagerySection name="selection">
- <ImageryComponent>
- <Area>
- <Dim type="TopEdge">
- <AbsoluteDim value="0" />
- </Dim>
- <Dim type="LeftEdge">
- <AbsoluteDim value="0" />
- </Dim>
- <Dim type="RightEdge">
- <UnifiedDim scale="1" type="RightEdge" />
- </Dim>
- <Dim type="BottomEdge">
- <UnifiedDim scale="1" type="BottomEdge" />
- </Dim>
- </Area>
- <ImageProperty name="SelectionBrush" />
- <ColourProperty name="SelectionColour" />
- <VertFormat type="Stretched" />
- <HorzFormat type="Stretched" />
- </ImageryComponent>
- </ImagerySection>
- <StateImagery name="Enabled">
- <Layer>
- <Section section="label">
- <ColourProperty name="TextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="Disabled">
- <Layer>
- <Section section="label">
- <ColourProperty name="TextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="SelectedEnabled">
- <Layer>
- <Section section="selection" />
- <Section section="label">
- <ColourProperty name="SelectedTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- <StateImagery name="SelectedDisabled">
- <Layer>
- <Section section="selection" />
- <Section section="label">
- <ColourProperty name="SelectedTextColour" />
- </Section>
- </Layer>
- </StateImagery>
- </WidgetLook>
-
-</Falagard>
-
diff --git a/navit/gui/sdl/datafiles/schemes/GUIScheme.xsd b/navit/gui/sdl/datafiles/schemes/GUIScheme.xsd
deleted file mode 100644
index 24dba207..00000000
--- a/navit/gui/sdl/datafiles/schemes/GUIScheme.xsd
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" ?>
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
- <xsd:element name="GUIScheme" type="SchemeType" />
- <xsd:complexType name="SchemeType">
- <xsd:choice minOccurs="0" maxOccurs="unbounded">
- <xsd:element name="Imageset" type="NamedDataType" />
- <xsd:element name="ImagesetFromImage" type="NamedDataType" />
- <xsd:element name="Font" type="NamedDataType" />
- <xsd:element name="LookNFeel" type="FileDataType" />
- <xsd:element name="WindowSet" type="WindowSetType" />
- <xsd:element name="WindowRendererSet" type="WindowRendererSetType" />
- <xsd:element name="WindowAlias" type="WindowAliasType" />
- <xsd:element name="FalagardMapping" type="FalagardMapType" />
- </xsd:choice>
- <xsd:attribute name="Name" type="xsd:string" use="required" />
- </xsd:complexType>
- <xsd:complexType name="WindowSetType">
- <xsd:sequence>
- <xsd:element name="WindowFactory" type="WindowFactoryType" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="Filename" type="xsd:string" use="required" />
- </xsd:complexType>
- <xsd:complexType name="WindowRendererSetType">
- <xsd:sequence>
- <xsd:element name="WindowRendererFactory" type="WindowRendererFactoryType" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="Filename" type="xsd:string" use="required" />
- </xsd:complexType>
- <xsd:complexType name="FileDataType">
- <xsd:attribute name="Filename" type="xsd:string" use="required" />
- <xsd:attribute name="ResourceGroup" type="xsd:string" use="optional" default="" />
- </xsd:complexType>
- <xsd:complexType name="NamedDataType">
- <xsd:attribute name="Name" type="xsd:string" use="required" />
- <xsd:attribute name="Filename" type="xsd:string" use="required" />
- <xsd:attribute name="ResourceGroup" type="xsd:string" use="optional" default="" />
- </xsd:complexType>
- <xsd:complexType name="WindowFactoryType">
- <xsd:attribute name="Name" type="xsd:string" use="required" />
- </xsd:complexType>
- <xsd:complexType name="WindowRendererFactoryType">
- <xsd:attribute name="Name" type="xsd:string" use="required" />
- </xsd:complexType>
- <xsd:complexType name="WindowAliasType">
- <xsd:attribute name="Alias" type="xsd:string" use="required" />
- <xsd:attribute name="Target" type="xsd:string" use="required" />
- </xsd:complexType>
- <xsd:complexType name="FalagardMapType">
- <xsd:attribute name="WindowType" type="xsd:string" use="required" />
- <xsd:attribute name="TargetType" type="xsd:string" use="required" />
- <xsd:attribute name="Renderer" type="xsd:string" use="required" />
- <xsd:attribute name="LookNFeel" type="xsd:string" use="required" />
- </xsd:complexType>
-</xsd:schema> \ No newline at end of file
diff --git a/navit/gui/sdl/datafiles/schemes/Mineque.scheme b/navit/gui/sdl/datafiles/schemes/Mineque.scheme
deleted file mode 100755
index 34101892..00000000
--- a/navit/gui/sdl/datafiles/schemes/Mineque.scheme
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" ?>
-<GUIScheme Name="TaharezLook">
- <Imageset Name="TaharezLook" Filename="TaharezLook.imageset" />
- <Imageset Name="Mineque-Black" Filename="Mineque-Black.imageset" />
- <LookNFeel Filename="Mineque.looknfeel" />
- <LookNFeel Filename="TaharezLook.looknfeel" />
- <WindowRendererSet Filename="CEGUIFalagardWRBase" />
-
- <FalagardMapping WindowType="NavitGrey/StaticImage" TargetType="DefaultWindow" Renderer="Falagard/StaticImage" LookNFeel="NavitGrey/StaticImage" />
- <FalagardMapping WindowType="NavitGrey/StaticText" TargetType="DefaultWindow" Renderer="Falagard/StaticText" LookNFeel="NavitGrey/StaticText" />
-
- <FalagardMapping WindowType="NavitGrey/ZoomInButton" TargetType="CEGUI/PushButton" Renderer="Falagard/Button" LookNFeel="NavitGrey/ZoomInButton" />
- <FalagardMapping WindowType="NavitGrey/ZoomOutButton" TargetType="CEGUI/PushButton" Renderer="Falagard/Button" LookNFeel="NavitGrey/ZoomOutButton" />
- <FalagardMapping WindowType="NavitGrey/SpeakerOffButton" TargetType="CEGUI/PushButton" Renderer="Falagard/Button" LookNFeel="NavitGrey/SpeakerOffButton" />
- <FalagardMapping WindowType="NavitGrey/RouteButton" TargetType="CEGUI/PushButton" Renderer="Falagard/Button" LookNFeel="NavitGrey/RouteButton" />
- <FalagardMapping WindowType="NavitGrey/OptionsButton" TargetType="CEGUI/PushButton" Renderer="Falagard/Button" LookNFeel="NavitGrey/OptionsButton" />
- <FalagardMapping WindowType="NavitGrey/QuitButton" TargetType="CEGUI/PushButton" Renderer="Falagard/Button" LookNFeel="NavitGrey/QuitButton" />
- <FalagardMapping WindowType="NavitGrey/NavitAboutButton" TargetType="CEGUI/PushButton" Renderer="Falagard/Button" LookNFeel="NavitGrey/NavitAboutButton" />
- <FalagardMapping WindowType="NavitGrey/SpeakerButton" TargetType="CEGUI/PushButton" Renderer="Falagard/Button" LookNFeel="NavitGrey/SpeakerButton" />
-
-
- <FalagardMapping WindowType="NavitGrey/ModeSwitchButton" TargetType="CEGUI/PushButton" Renderer="Falagard/Button" LookNFeel="NavitGrey/ModeSwitchButton" />
-
- <FalagardMapping WindowType="NavitGrey/ViewModeSwitchButton" TargetType="CEGUI/PushButton" Renderer="Falagard/Button" LookNFeel="NavitGrey/ViewModeSwitchButton" />
-
- <FalagardMapping WindowType="TaharezLook/Button" TargetType="CEGUI/PushButton" Renderer="Falagard/Button" LookNFeel="TaharezLook/Button" />
- <FalagardMapping WindowType="TaharezLook/Checkbox" TargetType="CEGUI/Checkbox" Renderer="Falagard/ToggleButton" LookNFeel="TaharezLook/Checkbox" />
- <FalagardMapping WindowType="TaharezLook/ImageButton" TargetType="CEGUI/PushButton" Renderer="Falagard/Button" LookNFeel="TaharezLook/ImageButton" />
- <FalagardMapping WindowType="TaharezLook/RadioButton" TargetType="CEGUI/RadioButton" Renderer="Falagard/ToggleButton" LookNFeel="TaharezLook/RadioButton" />
- <FalagardMapping WindowType="TaharezLook/FrameWindow" TargetType="CEGUI/FrameWindow" Renderer="Falagard/FrameWindow" LookNFeel="TaharezLook/FrameWindow" />
- <FalagardMapping WindowType="TaharezLook/Titlebar" TargetType="CEGUI/Titlebar" Renderer="Falagard/Titlebar" LookNFeel="TaharezLook/Titlebar" />
- <FalagardMapping WindowType="TaharezLook/SystemButton" TargetType="CEGUI/PushButton" Renderer="Falagard/SystemButton" LookNFeel="TaharezLook/Button" />
- <FalagardMapping WindowType="TaharezLook/Editbox" TargetType="CEGUI/Editbox" Renderer="Falagard/Editbox" LookNFeel="TaharezLook/Editbox" />
- <FalagardMapping WindowType="TaharezLook/MultiLineEditbox" TargetType="CEGUI/MultiLineEditbox" Renderer="Falagard/MultiLineEditbox" LookNFeel="TaharezLook/MultiLineEditbox" />
- <FalagardMapping WindowType="TaharezLook/Menubar" TargetType="CEGUI/Menubar" Renderer="Falagard/Menubar" LookNFeel="TaharezLook/Menubar" />
- <FalagardMapping WindowType="TaharezLook/PopupMenu" TargetType="CEGUI/PopupMenu" Renderer="Falagard/PopupMenu" LookNFeel="TaharezLook/PopupMenu" />
- <FalagardMapping WindowType="TaharezLook/MenuItem" TargetType="CEGUI/MenuItem" Renderer="Falagard/MenuItem" LookNFeel="TaharezLook/MenuItem" />
- <FalagardMapping WindowType="TaharezLook/AlternateProgressBar" TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="TaharezLook/AltProgressBar" />
- <FalagardMapping WindowType="TaharezLook/ProgressBar" TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="TaharezLook/ProgressBar" />
- <FalagardMapping WindowType="TaharezLook/VUMeter" TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="TaharezLook/VUMeter" />
- <FalagardMapping WindowType="TaharezLook/VerticalScrollbar" TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="TaharezLook/VerticalScrollbar" />
- <FalagardMapping WindowType="TaharezLook/HorizontalScrollbar" TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="TaharezLook/HorizontalScrollbar" />
- <FalagardMapping WindowType="TaharezLook/VerticalScrollbarThumb" TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="TaharezLook/VerticalScrollbarThumb" />
- <FalagardMapping WindowType="TaharezLook/HorizontalScrollbarThumb" TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="TaharezLook/HorizontalScrollbarThumb" />
- <FalagardMapping WindowType="TaharezLook/LargeVerticalScrollbar" TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="TaharezLook/LargeVerticalScrollbar" />
- <FalagardMapping WindowType="TaharezLook/LargeVerticalScrollbarThumb" TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="TaharezLook/LargeVerticalScrollbarThumb" />
- <FalagardMapping WindowType="TaharezLook/TabButton" TargetType="CEGUI/TabButton" Renderer="Falagard/TabButton" LookNFeel="TaharezLook/TabButton" />
- <FalagardMapping WindowType="TaharezLook/TabControl" TargetType="CEGUI/TabControl" Renderer="Falagard/TabControl" LookNFeel="TaharezLook/TabControl" />
- <FalagardMapping WindowType="TaharezLook/TabContentPane" TargetType="DefaultWindow" Renderer="Falagard/Default" LookNFeel="TaharezLook/TabContentPane" />
- <FalagardMapping WindowType="TaharezLook/TabButtonPane" TargetType="DefaultWindow" Renderer="Falagard/Default" LookNFeel="TaharezLook/TabButtonPane" />
- <FalagardMapping WindowType="TaharezLook/ComboDropList" TargetType="CEGUI/ComboDropList" Renderer="Falagard/Listbox" LookNFeel="TaharezLook/ComboDropList" />
- <FalagardMapping WindowType="TaharezLook/ComboEditbox" TargetType="CEGUI/Editbox" Renderer="Falagard/Editbox" LookNFeel="TaharezLook/ComboEditbox" />
- <FalagardMapping WindowType="TaharezLook/Combobox" TargetType="CEGUI/Combobox" Renderer="Falagard/Default" LookNFeel="TaharezLook/Combobox" />
- <FalagardMapping WindowType="TaharezLook/Listbox" TargetType="CEGUI/Listbox" Renderer="Falagard/Listbox" LookNFeel="TaharezLook/Listbox" />
- <FalagardMapping WindowType="TaharezLook/ListHeader" TargetType="CEGUI/ListHeader" Renderer="Falagard/ListHeader" LookNFeel="TaharezLook/ListHeader" />
- <FalagardMapping WindowType="TaharezLook/ListHeaderSegment" TargetType="CEGUI/ListHeaderSegment" Renderer="Falagard/ListHeaderSegment" LookNFeel="TaharezLook/ListHeaderSegment" />
- <FalagardMapping WindowType="TaharezLook/MultiColumnList" TargetType="CEGUI/MultiColumnList" Renderer="Falagard/MultiColumnList" LookNFeel="TaharezLook/MultiColumnList" />
- <FalagardMapping WindowType="TaharezLook/Slider" TargetType="CEGUI/Slider" Renderer="Falagard/Slider" LookNFeel="TaharezLook/Slider" />
- <FalagardMapping WindowType="TaharezLook/SliderThumb" TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="TaharezLook/SliderThumb" />
- <FalagardMapping WindowType="TaharezLook/ScrollablePane" TargetType="CEGUI/ScrollablePane" Renderer="Falagard/ScrollablePane" LookNFeel="TaharezLook/ScrollablePane" />
- <FalagardMapping WindowType="TaharezLook/Spinner" TargetType="CEGUI/Spinner" Renderer="Falagard/Default" LookNFeel="TaharezLook/Spinner" />
- <FalagardMapping WindowType="TaharezLook/Tooltip" TargetType="CEGUI/Tooltip" Renderer="Falagard/Tooltip" LookNFeel="TaharezLook/Tooltip" />
- <FalagardMapping WindowType="TaharezLook/StaticImage" TargetType="DefaultWindow" Renderer="Falagard/StaticImage" LookNFeel="TaharezLook/StaticImage" />
- <FalagardMapping WindowType="TaharezLook/StaticText" TargetType="DefaultWindow" Renderer="Falagard/StaticText" LookNFeel="TaharezLook/StaticText" />
- <FalagardMapping WindowType="TaharezLook/ItemListbox" TargetType="CEGUI/ItemListbox" Renderer="Falagard/ItemListbox" LookNFeel="TaharezLook/ItemListbox" />
- <FalagardMapping WindowType="TaharezLook/ListboxItem" TargetType="CEGUI/ItemEntry" Renderer="Falagard/ItemEntry" LookNFeel="TaharezLook/ListboxItem" />
-</GUIScheme>
diff --git a/navit/gui/sdl/datafiles/schemes/TaharezLook.scheme b/navit/gui/sdl/datafiles/schemes/TaharezLook.scheme
deleted file mode 100755
index e48ad4cc..00000000
--- a/navit/gui/sdl/datafiles/schemes/TaharezLook.scheme
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" ?>
-<GUIScheme Name="TaharezLook">
- <Imageset Name="TaharezLook" Filename="TaharezLook.imageset" />
- <LookNFeel Filename="TaharezLook.looknfeel" />
- <WindowRendererSet Filename="CEGUIFalagardWRBase" />
- <FalagardMapping WindowType="TaharezLook/Button" TargetType="CEGUI/PushButton" Renderer="Falagard/Button" LookNFeel="TaharezLook/Button" />
- <FalagardMapping WindowType="TaharezLook/Checkbox" TargetType="CEGUI/Checkbox" Renderer="Falagard/ToggleButton" LookNFeel="TaharezLook/Checkbox" />
- <FalagardMapping WindowType="TaharezLook/ImageButton" TargetType="CEGUI/PushButton" Renderer="Falagard/Button" LookNFeel="TaharezLook/ImageButton" />
- <FalagardMapping WindowType="TaharezLook/RadioButton" TargetType="CEGUI/RadioButton" Renderer="Falagard/ToggleButton" LookNFeel="TaharezLook/RadioButton" />
- <FalagardMapping WindowType="TaharezLook/FrameWindow" TargetType="CEGUI/FrameWindow" Renderer="Falagard/FrameWindow" LookNFeel="TaharezLook/FrameWindow" />
- <FalagardMapping WindowType="TaharezLook/Titlebar" TargetType="CEGUI/Titlebar" Renderer="Falagard/Titlebar" LookNFeel="TaharezLook/Titlebar" />
- <FalagardMapping WindowType="TaharezLook/SystemButton" TargetType="CEGUI/PushButton" Renderer="Falagard/SystemButton" LookNFeel="TaharezLook/Button" />
- <FalagardMapping WindowType="TaharezLook/Editbox" TargetType="CEGUI/Editbox" Renderer="Falagard/Editbox" LookNFeel="TaharezLook/Editbox" />
- <FalagardMapping WindowType="TaharezLook/MultiLineEditbox" TargetType="CEGUI/MultiLineEditbox" Renderer="Falagard/MultiLineEditbox" LookNFeel="TaharezLook/MultiLineEditbox" />
- <FalagardMapping WindowType="TaharezLook/Menubar" TargetType="CEGUI/Menubar" Renderer="Falagard/Menubar" LookNFeel="TaharezLook/Menubar" />
- <FalagardMapping WindowType="TaharezLook/PopupMenu" TargetType="CEGUI/PopupMenu" Renderer="Falagard/PopupMenu" LookNFeel="TaharezLook/PopupMenu" />
- <FalagardMapping WindowType="TaharezLook/MenuItem" TargetType="CEGUI/MenuItem" Renderer="Falagard/MenuItem" LookNFeel="TaharezLook/MenuItem" />
- <FalagardMapping WindowType="TaharezLook/AlternateProgressBar" TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="TaharezLook/AltProgressBar" />
- <FalagardMapping WindowType="TaharezLook/ProgressBar" TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="TaharezLook/ProgressBar" />
- <FalagardMapping WindowType="TaharezLook/VUMeter" TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="TaharezLook/VUMeter" />
- <FalagardMapping WindowType="TaharezLook/VerticalScrollbar" TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="TaharezLook/VerticalScrollbar" />
- <FalagardMapping WindowType="TaharezLook/HorizontalScrollbar" TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="TaharezLook/HorizontalScrollbar" />
- <FalagardMapping WindowType="TaharezLook/VerticalScrollbarThumb" TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="TaharezLook/VerticalScrollbarThumb" />
- <FalagardMapping WindowType="TaharezLook/HorizontalScrollbarThumb" TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="TaharezLook/HorizontalScrollbarThumb" />
- <FalagardMapping WindowType="TaharezLook/LargeVerticalScrollbar" TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="TaharezLook/LargeVerticalScrollbar" />
- <FalagardMapping WindowType="TaharezLook/LargeVerticalScrollbarThumb" TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="TaharezLook/LargeVerticalScrollbarThumb" />
- <FalagardMapping WindowType="TaharezLook/TabButton" TargetType="CEGUI/TabButton" Renderer="Falagard/TabButton" LookNFeel="TaharezLook/TabButton" />
- <FalagardMapping WindowType="TaharezLook/TabControl" TargetType="CEGUI/TabControl" Renderer="Falagard/TabControl" LookNFeel="TaharezLook/TabControl" />
- <FalagardMapping WindowType="TaharezLook/TabContentPane" TargetType="DefaultWindow" Renderer="Falagard/Default" LookNFeel="TaharezLook/TabContentPane" />
- <FalagardMapping WindowType="TaharezLook/TabButtonPane" TargetType="DefaultWindow" Renderer="Falagard/Default" LookNFeel="TaharezLook/TabButtonPane" />
- <FalagardMapping WindowType="TaharezLook/ComboDropList" TargetType="CEGUI/ComboDropList" Renderer="Falagard/Listbox" LookNFeel="TaharezLook/ComboDropList" />
- <FalagardMapping WindowType="TaharezLook/ComboEditbox" TargetType="CEGUI/Editbox" Renderer="Falagard/Editbox" LookNFeel="TaharezLook/ComboEditbox" />
- <FalagardMapping WindowType="TaharezLook/Combobox" TargetType="CEGUI/Combobox" Renderer="Falagard/Default" LookNFeel="TaharezLook/Combobox" />
- <FalagardMapping WindowType="TaharezLook/Listbox" TargetType="CEGUI/Listbox" Renderer="Falagard/Listbox" LookNFeel="TaharezLook/Listbox" />
- <FalagardMapping WindowType="TaharezLook/ListHeader" TargetType="CEGUI/ListHeader" Renderer="Falagard/ListHeader" LookNFeel="TaharezLook/ListHeader" />
- <FalagardMapping WindowType="TaharezLook/ListHeaderSegment" TargetType="CEGUI/ListHeaderSegment" Renderer="Falagard/ListHeaderSegment" LookNFeel="TaharezLook/ListHeaderSegment" />
- <FalagardMapping WindowType="TaharezLook/MultiColumnList" TargetType="CEGUI/MultiColumnList" Renderer="Falagard/MultiColumnList" LookNFeel="TaharezLook/MultiColumnList" />
- <FalagardMapping WindowType="TaharezLook/Slider" TargetType="CEGUI/Slider" Renderer="Falagard/Slider" LookNFeel="TaharezLook/Slider" />
- <FalagardMapping WindowType="TaharezLook/SliderThumb" TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="TaharezLook/SliderThumb" />
- <FalagardMapping WindowType="TaharezLook/ScrollablePane" TargetType="CEGUI/ScrollablePane" Renderer="Falagard/ScrollablePane" LookNFeel="TaharezLook/ScrollablePane" />
- <FalagardMapping WindowType="TaharezLook/Spinner" TargetType="CEGUI/Spinner" Renderer="Falagard/Default" LookNFeel="TaharezLook/Spinner" />
- <FalagardMapping WindowType="TaharezLook/Tooltip" TargetType="CEGUI/Tooltip" Renderer="Falagard/Tooltip" LookNFeel="TaharezLook/Tooltip" />
- <FalagardMapping WindowType="TaharezLook/StaticImage" TargetType="DefaultWindow" Renderer="Falagard/StaticImage" LookNFeel="TaharezLook/StaticImage" />
- <FalagardMapping WindowType="TaharezLook/StaticText" TargetType="DefaultWindow" Renderer="Falagard/StaticText" LookNFeel="TaharezLook/StaticText" />
- <FalagardMapping WindowType="TaharezLook/ItemListbox" TargetType="CEGUI/ItemListbox" Renderer="Falagard/ItemListbox" LookNFeel="TaharezLook/ItemListbox" />
- <FalagardMapping WindowType="TaharezLook/ListboxItem" TargetType="CEGUI/ItemEntry" Renderer="Falagard/ItemEntry" LookNFeel="TaharezLook/ListboxItem" />
-</GUIScheme>
diff --git a/navit/gui/sdl/gui_sdl.h b/navit/gui/sdl/gui_sdl.h
deleted file mode 100644
index 877d69e1..00000000
--- a/navit/gui/sdl/gui_sdl.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#include "SDL/SDL.h"
-
-#define XRES 800
-#define YRES 600
-
-
-struct menu_methods;
-struct navit;
-
-extern struct navit *sdl_gui_navit;
-
-
-bool BookmarkGo(const char * name);
-bool FormerDestGo(const char * name);
-
-struct gui_priv {
- struct navit *nav;
- int dyn_counter;
-};
-
diff --git a/navit/gui/sdl/gui_sdl_window.cpp b/navit/gui/sdl/gui_sdl_window.cpp
deleted file mode 100644
index 4afac7a3..00000000
--- a/navit/gui/sdl/gui_sdl_window.cpp
+++ /dev/null
@@ -1,903 +0,0 @@
-#include "glib.h"
-#include <stdio.h>
-#include <libintl.h>
-
-// FIXME temporary fix for enum
-#include "projection.h"
-
-#include "item.h"
-#include "navit.h"
-#include "vehicle.h"
-#include "profile.h"
-#include "transform.h"
-#include "gui.h"
-#include "coord.h"
-#include "config.h"
-#include "plugin.h"
-#include "callback.h"
-#include "point.h"
-#include "graphics.h"
-#include "gui_sdl.h"
-#include "navigation.h"
-#include "debug.h"
-#include "attr.h"
-#include "track.h"
-#include "menu.h"
-#include "map.h"
-
-
-#include "CEGUI.h"
-
-// FIXME This is for 3d fonts. Needs QuesoGLC. Could probably (and should) be moved to graphics instead
-// since fonts here are handled by CEGUI
-#include "GL/glc.h"
-
-#include "sdl_events.h"
-#include "cegui_keyboard.h"
-#include "wmcontrol.h"
-
-#define VM_2D 0
-#define VM_3D 1
-
-bool VIEW_MODE=VM_3D;
-
-GLdouble eyeX=400;
-GLdouble eyeY=900;
-GLdouble eyeZ=-800;
-GLdouble centerX=400;
-GLdouble centerY=300;
-GLdouble centerZ=0;
-GLdouble upX=0;
-GLdouble upY=-1;
-GLdouble upZ=0;
-
-struct navit *sdl_gui_navit;
-
-#include <CEGUI/RendererModules/OpenGLGUIRenderer/openglrenderer.h>
-#include "CEGUIDefaultResourceProvider.h"
-CEGUI::OpenGLRenderer* renderer;
-
-#undef profile
-#define profile(x,y)
-
-CEGUI::Window* myRoot;
-
-// Temp fix for pluginless mode
-// #define MODULE "gui_sdl"
-GLuint * DLid;
-
-#define _(STRING) gettext(STRING)
-
-char media_window_title[255], media_cmd[255];
-
-struct bookmark{
- char * name;
- struct callback *cb;
- struct bookmark *next;
-} *bookmarks;
-
-struct former_dest{
- char * name;
- struct callback *cb;
- struct former_dest *next;
-} *former_dests;
-
-static int
-gui_sdl_set_graphics(struct gui_priv *this_, struct graphics *gra)
-{
- dbg(1,"setting up the graphics\n");
-
- DLid=(GLuint *)graphics_get_data(gra, "opengl_displaylist");
- if (!DLid)
- return 1;
- return 0;
-}
-
-static void
-sdl_update_roadbook(struct navigation *nav)
-{
-
- using namespace CEGUI;
-
- struct map *map;
- struct map_rect *mr;
-
- if (! nav)
- return;
- map=navigation_get_map(nav);
- if (! map)
- return;
- mr=map_rect_new(map, NULL);
- if (! mr)
- return;
-
- // First, ensure the navigation tip is visible. quick workaround for when resuming a destination
- WindowManager::getSingleton().getWindow("Navit/Routing/Tips")->show();
-
- // update the 'Navigation Tip' on the main window
- try {
- struct attr attr;
- item_attr_get(map_rect_get_item(mr), attr_navigation_speech, &attr);
- map_rect_destroy(mr);
- mr=map_rect_new(map, NULL);
- WindowManager::getSingleton().getWindow("Navit/Routing/Tips")->setText((CEGUI::utf8*)(attr.u.str));
- }
- catch (CEGUI::Exception& e)
- {
- fprintf(stderr,"CEGUI Exception occured: \n%s\n", e.getMessage().c_str());
- printf("Missing control!...\n");
- }
-
- // Then, update the whole roadbook
- try {
-
- /* Currently we use the 'Navit' text to display the roadbook, until Mineque design a button for that
- if(! WindowManager::getSingleton().getWindow("OSD/RoadbookButton")->isVisible()){
- WindowManager::getSingleton().getWindow("OSD/RoadbookButton")->show();
- }
- */
-
- MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("Roadbook"));
- mcl->resetList();
-
- item *item;
- struct attr attr;
-
- while ((item=map_rect_get_item(mr))) {
- mcl->addRow();
- item_attr_get(item, attr_navigation_short, &attr);
- ListboxTextItem* itemListbox = new ListboxTextItem(attr.u.str);
- itemListbox->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
- mcl->setItem(itemListbox, 0, mcl->getRowCount()-1);
- }
- map_rect_destroy(mr);
- }
- catch (CEGUI::Exception& e)
- {
- dbg(0,"CEGUI Exception occured: \n%s\n", e.getMessage().c_str());
- dbg(0,"Missing control!\n");
- }
-
-}
-
-static void show_road_name(){
- struct tracking *tracking;
- struct attr road_name_attr;
- tracking=navit_get_tracking(sdl_gui_navit);
-
- using namespace CEGUI;
-
-
- if (tracking && tracking_get_current_attr(tracking, attr_label, &road_name_attr) ) {
- WindowManager::getSingleton().getWindow("Navit/Routing/CurrentRoadName")->setText((CEGUI::utf8*)(road_name_attr.u.str));
- }
-
-}
-
-static gboolean gui_timeout_cb(gpointer data)
-{
- return TRUE;
-}
-
-static int gui_run_main_loop(struct gui_priv *this_)
-{
- GSource *timeout;
- using namespace CEGUI;
- dbg(0,"Entering main loop\n");
-
- bool must_quit = false;
-
- // get "run-time" in seconds
- double last_time_pulse = static_cast<double>(SDL_GetTicks());
-
- int frames=0;
- char fps [12];
-
- struct map_selection sel,sel2;
-
- memset(&sel, 0, sizeof(sel));
- memset(&sel2, 0, sizeof(sel2));
- sel.u.c_rect.rl.x=800;
- sel.u.c_rect.rl.y=600;
-#if 0
- sel.next=&sel2;
- sel2.u.c_rect.rl.x=-200;
- sel2.u.c_rect.rl.y=0;
- sel2.u.c_rect.lu.x=1000;
- sel2.u.c_rect.lu.y=-800;
- for (int i=0 ; i < layer_end ; i++)
- sel2.order[i]=-4;
-#endif
-
- transform_set_screen_selection(navit_get_trans(this_->nav), &sel);
- navit_draw(this_->nav);
-
- bool enable_timer=0;
-
- struct navigation *navig;
- navig=navit_get_navigation(sdl_gui_navit);
-
- navigation_register_callback(navig,
- attr_navigation_long,
- callback_new_0((void (*)())sdl_update_roadbook)
- );
-
- timeout = g_timeout_source_new(100);
- g_source_set_callback(timeout, gui_timeout_cb, NULL, NULL);
- g_source_attach(timeout, NULL);
- while (!must_quit)
- {
- if(enable_timer)
- profile(0,NULL);
- glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- if(VIEW_MODE==VM_3D){
- gluLookAt(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ);
- }
-
- // FIXME This is to draw a ground. This is ugly and need to be fixed.
- // Without it, we see the color of sky under the roads.
- glColor4f(0.0f,0.7f,0.35f,1.0f);
- glBegin(GL_POLYGON);
- glVertex3f( -800,-600*3, 0.0f);
- glVertex3f( -800,600*2, 0.0f);
- glVertex3f( 1600,600*2, 0.0f);
- glVertex3f( 1600,-600*3, 0.0f);
- glEnd();
-
-
- if(enable_timer)
- profile(0,"graphics_redraw");
-// if (!g_main_context_iteration (NULL, FALSE))
- // sleep(1);
- g_main_context_iteration (NULL, TRUE);
- // sleep(1);
- if(enable_timer)
- profile(0,"main context");
-
- show_road_name();
-
- if (DLid && *DLid)
- glCallList(*DLid);
- else
- navit_draw_displaylist(sdl_gui_navit);
-
- inject_input(must_quit);
- if(enable_timer)
- profile(0,"inputs");
-
- // Render the cursor.
- int x=400;
- int y=480;
- float cursor_size=15.0f;
- glColor4f(0.0f,1.0f,0.0f,0.75f);
- glEnable(GL_BLEND);
- glBegin(GL_TRIANGLES);
- glVertex3f( x, y-cursor_size, 0.0f);
- glVertex3f(x-cursor_size,y+cursor_size, 0.0f);
- glVertex3f( x+cursor_size,y+cursor_size, 0.0f);
- glEnd();
- glDisable(GL_BLEND);
- if(enable_timer)
- profile(0,"cursor");
-
- frames++;
- if(SDL_GetTicks()-last_time_pulse>1000){
- sprintf(fps,"%i fps",frames); // /(SDL_GetTicks()/1000));
- frames=0;
- last_time_pulse = SDL_GetTicks();
- }
- WindowManager::getSingleton().getWindow("OSD/Satellites")->setText(fps);
-
- if(enable_timer)
- profile(0,"fps");
-
- CEGUI::System::getSingleton().renderGUI();
- if(enable_timer)
- profile(0,"GUI");
-
- SDL_GL_SwapBuffers();
- }
- g_source_destroy(timeout);
-
-}
-
-static struct menu_priv *
-add_menu(struct menu_priv *menu, struct menu_methods *meth, char *name, enum menu_type type, struct callback *cb);
-
-static struct menu_methods menu_methods = {
- add_menu,
-};
-
-struct menu_priv {
- char *path;
-// GtkAction *action;
- struct gui_priv *gui;
- enum menu_type type;
- struct callback *cb;
- struct menu_priv *child;
- struct menu_priv *sibling;
- gulong handler_id;
- guint merge_id;
-};
-
-#define MENU_BOOKMARK 2
-#define MENU_FORMER_DEST 3
-
-static struct menu_priv *
-add_menu(struct menu_priv *menu, struct menu_methods *meth, char *name, enum menu_type type, struct callback *cb)
-{
- using namespace CEGUI;
- *meth=menu_methods;
- dbg(0,"callback : %s\n",name);
-
- if(menu==(struct menu_priv *)(MENU_BOOKMARK)){
- dbg(0,"Item is a bookmark\n");
- MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("Bookmarks/Listbox"));
-
- ListboxTextItem* itemListbox = new ListboxTextItem((CEGUI::utf8*)(name));
- itemListbox->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
- mcl->addRow(itemListbox,0);
-
- struct bookmark *newB = g_new0(struct bookmark, 1);
- newB->name=g_strdup(name);
- newB->cb=cb;
- if (newB) {
- newB->next = bookmarks;
- bookmarks = newB;
- }
-
- }
-
- if(menu==(struct menu_priv *)(MENU_FORMER_DEST)){
- dbg(0,"Item is a former destination\n");
- MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("FormerDests/Listbox"));
-
- ListboxTextItem* itemListbox = new ListboxTextItem((CEGUI::utf8*)(name));
- itemListbox->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
- mcl->addRow(itemListbox,0);
-
- struct former_dest *newB = g_new0(struct former_dest, 1);
- newB->name=g_strdup(name);
- newB->cb=cb;
- if (newB) {
- newB->next = former_dests;
- former_dests = newB;
- }
-
- }
-
- if(!strcmp(name,"Bookmarks")){
- dbg(0,"Menu is the bookmark menu!\n");
- return (struct menu_priv *)MENU_BOOKMARK;
- } else if(!strcmp(name,"Former Destinations")){
- dbg(0,"Menu is the Former Destinations menu!\n");
- return (struct menu_priv *)MENU_FORMER_DEST;
- } else {
- return (struct menu_priv *)1;
- }
-}
-
-bool BookmarkGo(const char * name)
-{
- dbg(0,"searching for bookmark %s\n",name);
- bookmark * bookmark_search=bookmarks;
- while ( bookmark_search ){
- dbg(0,"-> %s\n",bookmark_search->name);
- if(!strcmp(bookmark_search->name,name)){
- dbg(0,"Got it :)\n");
- callback_call_0(bookmark_search->cb);
- }
- bookmark_search=bookmark_search->next;
- }
-
-}
-
-bool FormerDestGo(const char * name)
-{
- dbg(0,"searching for former_dest %s\n",name);
- former_dest * former_dest_search=former_dests;
- while ( former_dest_search ){
- dbg(0,"-> %s\n",former_dest_search->name);
- if(!strcmp(former_dest_search->name,name)){
- dbg(0,"Got it :)\n");
- callback_call_0(former_dest_search->cb);
- }
- former_dest_search=former_dest_search->next;
- }
-
-}
-
-static struct menu_priv *
-gui_sdl_menubar_new(struct gui_priv *this_, struct menu_methods *meth)
-{
- *meth=menu_methods;
- return (struct menu_priv *) 1; //gui_gtk_ui_new(this_, meth, "/ui/MenuBar", nav, 0);
-}
-
-static struct menu_priv *
-gui_sdl_popup_new(struct gui_priv *this_, struct menu_methods *meth)
-{
- return NULL; //gui_gtk_ui_new(this_, meth, "/ui/PopUp", nav, 1);
-}
-
-struct gui_methods gui_sdl_methods = {
- gui_sdl_menubar_new,
- gui_sdl_popup_new,
- gui_sdl_set_graphics,
- gui_run_main_loop,
-};
-
-
-int init_GL() {
-
- // Blue sky
- glClearColor(0.3,0.7,1.0,0);
-
- if(VIEW_MODE==VM_2D){
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
-
- glOrtho( 0, XRES, YRES, 0, -1, 1 );
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- CEGUI::WindowManager::getSingleton().getWindow("OSD/ViewMode")->setText("2D");
- } else {
-
- // Dimensions de la fenetre de rendu
- glViewport(0, 0, XRES, YRES);
- // Initialisation de la matrice de projection
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(45, 1.0, 0.1, 2800.0);
- // Rendu avec lissage de Gouraud
-// glShadeModel(GL_SMOOTH);
- // glEnable(GL_DEPTH_TEST);
-
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-// gluLookAt(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ);
- CEGUI::WindowManager::getSingleton().getWindow("OSD/ViewMode")->setText("3D");
- }
-
- //Display list code
- // GLuint glGenLists(GLsizei numberOfIDsRequired);
- // linesDL = glGenLists(1);
-
- if( glGetError() != GL_NO_ERROR ) {
- return 0;
- }
- return 1;
-}
-
-bool ToggleView(const CEGUI::EventArgs& event)
-{
- VIEW_MODE=!VIEW_MODE;
- init_GL();
-}
-
-bool MoveCamera(const CEGUI::EventArgs& event){
-
- CEGUI::Scrollbar * sb = static_cast<const CEGUI::Scrollbar *>(CEGUI::WindowManager::getSingleton().getWindow("OSD/Scrollbar1"));
- eyeZ=-sb->getScrollPosition();
- if (eyeZ>-100){
- eyeZ=-100;
- }
-}
-
-
-
-static void init_sdlgui(char * skin_layout,int fullscreen,int tilt, char *image_codec_name)
-{
- SDL_Surface * screen;
-// atexit (SDL_Quit);
- SDL_Init (SDL_INIT_VIDEO);
- int videoFlags;
- const SDL_VideoInfo *videoInfo;
- videoInfo = SDL_GetVideoInfo( );
-
- if ( !videoInfo )
- {
- fprintf( stderr, "Video query failed: %s\n",
- SDL_GetError( ) );
- }
-
- /* the flags to pass to SDL_SetVideoMode */
- videoFlags = SDL_OPENGL; /* Enable OpenGL in SDL */
- videoFlags |= SDL_GL_DOUBLEBUFFER; /* Enable double buffering */
- videoFlags |= SDL_HWPALETTE; /* Store the palette in hardware */
- videoFlags |= SDL_RESIZABLE; /* Enable window resizing */
-
- /* This checks to see if surfaces can be stored in memory */
- if ( videoInfo->hw_available )
- videoFlags |= SDL_HWSURFACE;
- else
- videoFlags |= SDL_SWSURFACE;
-
- /* This checks if hardware blits can be done */
- if ( videoInfo->blit_hw )
- videoFlags |= SDL_HWACCEL;
-
- /* Sets up OpenGL double buffering */
- SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
-
- SDL_WM_SetCaption("NavIt - The OpenSource vector based navigation engine", NULL);
-
- /* get a SDL surface */
- screen = SDL_SetVideoMode( XRES, YRES, 32,
- videoFlags );
-
- if (screen == NULL) {
- fprintf (stderr, "Can't set SDL: %s\n", SDL_GetError ());
- exit (1);
- }
- if(fullscreen){
- SDL_WM_ToggleFullScreen(screen);
- }
- SDL_ShowCursor (SDL_ENABLE);
- SDL_EnableUNICODE (1);
- SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
-
-// init_GL();
-
- try
- {
- using namespace CEGUI;
- if (image_codec_name) {
- dbg(0, "Using image codec: %s from config\n", image_codec_name);
- } else {
-#if defined (HAVE_LIBCEGUISILLYIMAGECODEC)
- image_codec_name = "SILLYImageCodec";
-#elif defined(HAVE_LIBCEGUIDEVILIMAGECODEC)
- image_codec_name = "DevILImageCodec";
-#elif defined (HAVE_LIBCEGUITGAIMAGECODEC)
- image_codec_name = "TGAImageCodec";
-#else
- fprintf (stderr, "No default image codec available. Try setting image_codec in your config\n");
- exit (1);
-#endif
- dbg(0, "Using default image codec: %s\n", image_codec_name);
- }
- CEGUI::OpenGLRenderer::setDefaultImageCodecName(image_codec_name);
-
- CEGUI::System::setDefaultXMLParserName(CEGUI::String("TinyXMLParser"));
- dbg(0, "Using %s as the default CEGUI XML Parser\n", CEGUI::System::getDefaultXMLParserName().c_str());
- renderer = new CEGUI::OpenGLRenderer(0,XRES,YRES);
- new CEGUI::System(renderer);
-
- SDL_ShowCursor(SDL_ENABLE);
- SDL_EnableUNICODE(1);
- SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
-
- CEGUI::DefaultResourceProvider* rp = static_cast<CEGUI::DefaultResourceProvider*>
- (System::getSingleton().getResourceProvider());
-
-
- char *filename;
-
- filename=g_strdup_printf("%s/share/navit/datafiles", getenv("NAVIT_PREFIX"));
-
- if (FILE * file = fopen(filename, "r")){
- fclose(file);
- dbg(0,"Ressources can be loaded from %s\n",filename);
- } else {
- filename=g_strdup_printf("./gui/sdl/datafiles");
- dbg(0,"Failling back to %s",filename);
- }
-
- dbg(0,"Loading SDL datafiles from %s\n",filename);
-
- rp->setResourceGroupDirectory("schemes", g_strdup_printf("%s/schemes/",filename));
- rp->setResourceGroupDirectory("imagesets", g_strdup_printf("%s/imagesets/",filename));
- rp->setResourceGroupDirectory("fonts", g_strdup_printf("%s/fonts/",filename));
- rp->setResourceGroupDirectory("layouts", g_strdup_printf("%s/layouts/",filename));
- rp->setResourceGroupDirectory("looknfeels", g_strdup_printf("%s/looknfeel/",filename));
- rp->setResourceGroupDirectory("lua_scripts", g_strdup_printf("%s/lua_scripts/",filename));
- g_free(filename);
-
-
- CEGUI::Imageset::setDefaultResourceGroup("imagesets");
- CEGUI::Font::setDefaultResourceGroup("fonts");
- CEGUI::Scheme::setDefaultResourceGroup("schemes");
- CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels");
- CEGUI::WindowManager::setDefaultResourceGroup("layouts");
- CEGUI::ScriptModule::setDefaultResourceGroup("lua_scripts");
-
- char buffer [50];
- sprintf (buffer, "%s.scheme", skin_layout);
- dbg(1,"Loading scheme : %s\n",buffer);
-
- CEGUI::SchemeManager::getSingleton().loadScheme(buffer);
-
- CEGUI::FontManager::getSingleton().createFont("DejaVuSans-10.font");
- CEGUI::FontManager::getSingleton().createFont("DejaVuSans-12.font");
- CEGUI::FontManager::getSingleton().createFont("DejaVuSans-14.font");
-
- CEGUI::System::getSingleton().setDefaultFont("DejaVuSans-10");
-
- CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
-
- dbg(1,"Loading layout : %s\n",buffer);
-
- sprintf (buffer, "%s.layout", skin_layout);
-
- myRoot = CEGUI::WindowManager::getSingleton().loadWindowLayout(buffer);
-
- CEGUI::System::getSingleton().setGUISheet(myRoot);
-
- try {
-
- CEGUI::WindowManager::getSingleton().getWindow("OSD/Quit")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(ButtonQuit));
-// CEGUI::WindowManager::getSingleton().getWindow("OSD/Quit")->setText(_("Quit"));
-
- CEGUI::WindowManager::getSingleton().getWindow("ZoomInButton")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(ZoomIn));
-// CEGUI::WindowManager::getSingleton().getWindow("ZoomInButton")->setText(_("ZoomIn"));
-
- CEGUI::WindowManager::getSingleton().getWindow("ZoomOutButton")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(ZoomOut));
-// CEGUI::WindowManager::getSingleton().getWindow("ZoomOutButton")->setText(_("ZoomOut"));
-
- CEGUI::WindowManager::getSingleton().getWindow("AdressSearch/CountryEditbox")->subscribeEvent(Window::EventKeyUp, Event::Subscriber(DestinationEntryChange));
- CEGUI::WindowManager::getSingleton().getWindow("AdressSearch/CountryEditbox")->subscribeEvent(Window::EventMouseButtonDown, Event::Subscriber(handleMouseEnters));
- CEGUI::WindowManager::getSingleton().getWindow("AdressSearch/TownEditbox")->subscribeEvent(Window::EventKeyUp, Event::Subscriber(DestinationEntryChange));
- CEGUI::WindowManager::getSingleton().getWindow("AdressSearch/TownEditbox")->subscribeEvent(Window::EventMouseButtonDown, Event::Subscriber(handleMouseEnters));
- CEGUI::WindowManager::getSingleton().getWindow("AdressSearch/StreetEditbox")->subscribeEvent(Window::EventKeyUp, Event::Subscriber(DestinationEntryChange));
- CEGUI::WindowManager::getSingleton().getWindow("AdressSearch/StreetEditbox")->subscribeEvent(Window::EventMouseButtonDown, Event::Subscriber(handleMouseEnters));
-
- CEGUI::WindowManager::getSingleton().getWindow("DestinationButton")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(DestinationWindowSwitch));
- CEGUI::WindowManager::getSingleton().getWindow("DestinationWindow/Address")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(AddressSearchSwitch));
- CEGUI::WindowManager::getSingleton().getWindow("DestinationWindow/Bookmark")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(BookmarkSelectionSwitch));
- CEGUI::WindowManager::getSingleton().getWindow("DestinationWindow/FormerDest")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(FormerDestSelectionSwitch));
-
-
- CEGUI::WindowManager::getSingleton().getWindow("OSD/ViewMode")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(ToggleView));
-
- CEGUI::WindowManager::getSingleton().getWindow("AdressSearch/GO")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(ButtonGo));
- CEGUI::WindowManager::getSingleton().getWindow("AdressSearch/KB")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(ShowKeyboard));
-
- CEGUI::WindowManager::getSingleton().getWindow("AdressSearch/Listbox")->subscribeEvent(MultiColumnList::EventSelectionChanged, Event::Subscriber(ItemSelect));
- CEGUI::WindowManager::getSingleton().getWindow("Bookmarks/Listbox")->subscribeEvent(MultiColumnList::EventSelectionChanged, Event::Subscriber(BookmarkSelect));
- CEGUI::WindowManager::getSingleton().getWindow("FormerDests/Listbox")->subscribeEvent(MultiColumnList::EventSelectionChanged, Event::Subscriber(FormerDestSelect));
-
-
- // Translation for StaticTexts (labels)
- CEGUI::WindowManager::getSingleton().getWindow("AdressSearch/Country")->setText(_("Country"));
- CEGUI::WindowManager::getSingleton().getWindow("AdressSearch/Town")->setText(_("City"));
- CEGUI::WindowManager::getSingleton().getWindow("AdressSearch/Street")->setText(_("Street"));
-
-
- MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("AdressSearch/Listbox"));
-
- mcl->setSelectionMode(MultiColumnList::RowSingle) ;
- mcl->addColumn("Value", 0, cegui_absdim(200.0));
- mcl->addColumn("ID", 1, cegui_absdim(70.0));
- mcl->addColumn("Assoc", 2, cegui_absdim(70.0));
- mcl->addColumn("x", 3, cegui_absdim(70.0));
- mcl->addColumn("y", 4, cegui_absdim(70.0));
-
- MultiColumnList* mcl2 = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("Roadbook"));
-
- mcl2->setSelectionMode(MultiColumnList::RowSingle) ;
- mcl2->addColumn("Instructions", 0, cegui_absdim(700.0));
-
- MultiColumnList* mcl3 = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("Bookmarks/Listbox"));
-
- mcl3->setSelectionMode(MultiColumnList::RowSingle) ;
- mcl3->addColumn("Name", 0, cegui_absdim(700.0));
-
- MultiColumnList* mcl4 = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("FormerDests/Listbox"));
-
- mcl4->setSelectionMode(MultiColumnList::RowSingle) ;
- mcl4->addColumn("Name", 0, cegui_absdim(700.0));
-
- BuildKeyboard();
-
- CEGUI::WindowManager::getSingleton().getWindow("OSD/Scrollbar1")->subscribeEvent(Scrollbar::EventScrollPositionChanged, Event::Subscriber(MoveCamera));
-
- // FIXME : char (conf) -> int (init) -> char (property) = bad
- char buffer[4];
- sprintf (buffer,"%i",tilt);
- CEGUI::WindowManager::getSingleton().getWindow("OSD/Scrollbar1")->setProperty("ScrollPosition",buffer);
- eyeZ=-tilt;
-
- CEGUI::WindowManager::getSingleton().getWindow("OSD/RoadbookButton")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(RoadBookSwitch));
- CEGUI::WindowManager::getSingleton().getWindow("OSD/RoadbookButton")->setText(_("RoadBook"));
-
- CEGUI::WindowManager::getSingleton().getWindow("OSD/nGhostButton")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(Switch_to_nGhost));
- // this one is maybe not needed anymore
- CEGUI::WindowManager::getSingleton().getWindow("OSD/RoadbookButton2")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(RoadBookSwitch));
-
- }
- catch (CEGUI::Exception& e)
- {
- fprintf(stderr,"CEGUI Exception occured: \n%s\n", e.getMessage().c_str());
- printf("Missing control!...\n");
- }
-
- }
- catch (CEGUI::Exception& e)
- {
- fprintf(stderr,"CEGUI Exception occured: \n%s\n", e.getMessage().c_str());
- printf("quiting...\n");
- exit(1);
- }
- init_GL();
- // Force centering view on cursor
-// navit_toggle_cursor(gui->nav);
- // Force refresh on gps update
-// navit_toggle_tracking(gui->nav);
-
-}
-
-static void vehicle_callback_handler( struct navit *nav, struct vehicle *v){
- char buffer [50];
- struct attr attr;
- int sats=0, sats_used=0;
-
- if (vehicle_get_attr(v, attr_position_speed, &attr))
- sprintf (buffer, "%02.02f km/h", *attr.u.numd);
- else
- strcpy (buffer, "N/A");
- CEGUI::WindowManager::getSingleton().getWindow("OSD/SpeedoMeter")->setText(buffer);
-
- if (vehicle_get_attr(v, attr_position_height, &attr))
- sprintf (buffer, "%.f m", *attr.u.numd);
- else
- strcpy (buffer, "N/A");
- CEGUI::WindowManager::getSingleton().getWindow("OSD/Altimeter")->setText(buffer);
-
- if (vehicle_get_attr(v, attr_position_sats, &attr))
- sats=attr.u.num;
- if (vehicle_get_attr(v, attr_position_sats_used, &attr))
- sats_used=attr.u.num;
-// printf(" sats : %i, used %i: \n",sats,sats_used);
- // Sat image hardcoded for now. may break the TaharezSkin
- // setProperty("Image", CEGUI::PropertyHelper::imageToString( yourImageSet->getImage( "yourImageName" ) ) );
-
- try {
- if(sats_used>1){
- CEGUI::WindowManager::getSingleton().getWindow("SateliteStrenghBar1")->setProperty("Image","set:Mineque-Black image:SateliteStrenghBarOn");
- } else {
- CEGUI::WindowManager::getSingleton().getWindow("SateliteStrenghBar1")->setProperty("Image","set:Mineque-Black image:SateliteStrenghBarOff");
- }
-
- if(sats_used>3){
- CEGUI::WindowManager::getSingleton().getWindow("SateliteStrenghBar2")->setProperty("Image","set:Mineque-Black image:SateliteStrenghBarOn");
- } else {
- CEGUI::WindowManager::getSingleton().getWindow("SateliteStrenghBar2")->setProperty("Image","set:Mineque-Black image:SateliteStrenghBarOff");
- }
-
- if(sats_used>5){
- CEGUI::WindowManager::getSingleton().getWindow("SateliteStrenghBar3")->setProperty("Image","set:Mineque-Black image:SateliteStrenghBarOn");
- } else {
- CEGUI::WindowManager::getSingleton().getWindow("SateliteStrenghBar3")->setProperty("Image","set:Mineque-Black image:SateliteStrenghBarOff");
- }
-
- if(sats_used>7){
- CEGUI::WindowManager::getSingleton().getWindow("SateliteStrenghBar4")->setProperty("Image","set:Mineque-Black image:SateliteStrenghBarOn");
- } else {
- CEGUI::WindowManager::getSingleton().getWindow("SateliteStrenghBar4")->setProperty("Image","set:Mineque-Black image:SateliteStrenghBarOff");
- }
-
- if(sats_used>8){
- CEGUI::WindowManager::getSingleton().getWindow("SateliteStrenghBar5")->setProperty("Image","set:Mineque-Black image:SateliteStrenghBarOn");
- } else {
- CEGUI::WindowManager::getSingleton().getWindow("SateliteStrenghBar5")->setProperty("Image","set:Mineque-Black image:SateliteStrenghBarOff");
- }
- }
- catch (CEGUI::Exception& e)
- {
- dbg(1,"Warning : you skin doesn't have the satellitebars. You should use Mineque's skin.\n");
- }
-
-}
-
-static struct gui_priv *
-gui_sdl_new(struct navit *nav, struct gui_methods *meth, struct attr **attrs)
-{
- dbg(1,"Begin SDL init\n");
- struct gui_priv *this_;
- sdl_gui_navit=nav;
-
- if(sdl_gui_navit){
- dbg(1,"VALID navit instance in gui\n");
- } else {
- dbg(1,"Invalid navit instance in gui\n");
- }
- if(nav){
- dbg(1,"VALID source navit instance in gui\n");
- } else {
- dbg(1,"Invalid source navit instance in gui\n");
- }
-
- *meth=gui_sdl_methods;
-
- this_=g_new0(struct gui_priv, 1);
- int fullscreen=0;
-
- struct attr *fullscreen_setting=attr_search(attrs, NULL, attr_fullscreen);
- //FIXME currently, we only check if fullscreen is declared, but not its value
- if(fullscreen_setting){
- fullscreen=1;
- printf("fullscreen\n");
- } else {
- fullscreen=0;
- printf("Normal screen\n");
- }
-
- int tilt=400;
- struct attr *tilt_setting=attr_search(attrs, NULL, attr_tilt);
- if(tilt_setting){
- if(sscanf(tilt_setting->u.str,"%i",&tilt)){
- dbg(0,"tilt set to %i\n",tilt);
- } else {
- dbg(0,"title was not recognized : %s\n",tilt_setting->u.str);
- }
- } else {
- dbg(0,"tilt is not set\n");
- }
-
- struct attr *view_mode_setting=attr_search(attrs, NULL, attr_view_mode);
- if(view_mode_setting){
- if(!strcmp(view_mode_setting->u.str,"2D")){
- dbg(0,"View mode is 2D\n");
- VIEW_MODE=VM_2D;
- } else {
- dbg(0,"view mode is something else : %s\n",view_mode_setting->u.str);
- }
-
- } else {
- dbg(0,"view_mode is not set\n");
- }
-
- struct attr *media_cmd_setting=attr_search(attrs, NULL, attr_media_cmd);
- if(media_cmd_setting){
- dbg(0,"setting media_cmd to %s\n",media_cmd_setting->u.str);
- strcpy(media_cmd,media_cmd_setting->u.str);
- } else {
-// strcpy(media_cmd_setting->u.str,media_window_title);
- }
-
- struct attr *media_window_title_setting=attr_search(attrs, NULL, attr_media_window_title);
- if(media_window_title_setting){
- strcpy(media_window_title,media_window_title_setting->u.str);
- } else {
-// strcpy(media_cmd_setting->u.str,media_window_title);
- }
-
- struct attr *image_codec_setting=attr_search(attrs, NULL, attr_image_codec);
- char *image_codec_name=NULL;
- if (image_codec_setting)
- image_codec_name=image_codec_setting->u.str;
- struct attr *skin_setting=attr_search(attrs, NULL, attr_skin);
- if(skin_setting){
- init_sdlgui(skin_setting->u.str,fullscreen,tilt, image_codec_name);
- } else {
- g_warning("Warning, no skin set for <sdl> in navit.xml. Using default one");
- init_sdlgui("TaharezLook",fullscreen,tilt, image_codec_name);
- }
-
-
- dbg(1,"End SDL init\n");
-
- //gui_sdl_window.cpp:710: error: invalid conversion from 'void (*)(vehicle*)' to 'void (*)()'
-
- /* add callback for position updates */
- struct callback *cb=callback_new_attr_0(callback_cast(vehicle_callback_handler), attr_position_coord_geo);
-
- navit_add_callback(nav,cb);
- this_->nav=nav;
-
- return this_;
-}
-
-void
-plugin_init(void)
-{
- dbg(1,"registering sdl plugin\n");
- plugin_register_gui_type("sdl", gui_sdl_new);
-}
diff --git a/navit/gui/sdl/sdl_events.cpp b/navit/gui/sdl/sdl_events.cpp
deleted file mode 100644
index 7a121753..00000000
--- a/navit/gui/sdl/sdl_events.cpp
+++ /dev/null
@@ -1,810 +0,0 @@
-#include "CEGUI.h"
-#include "sdl_events.h"
-#include "gui_sdl.h"
-
-#include <CEGUI/RendererModules/OpenGLGUIRenderer/openglrenderer.h>
-
-// FIXME temporary fix for enum
-#include "projection.h"
-#include "item.h"
-#include "navit.h"
-#include "debug.h"
-#include "track.h"
-#include "search.h"
-#include "coord.h"
-#include "country.h"
-#include "string.h"
-
-// Library for window switching (-> nGhost)
-#include "wmcontrol.h"
-
-
-struct sdl_destination{
- int country;
- int town;
- int town_street_assoc;
- int current_search;
-} SDL_dest;
-
-
-static struct search_param {
- struct navit *nav;
- struct mapset *ms;
- struct search_list *sl;
- struct attr attr;
- } search_param;
-
-
-void route_to(int x,int y){
- struct pcoord pos;
- pos.x=x;
- pos.y=y;
- /* FIXME: Get projection from list like x,y or use pcoord from search directly */
- pos.pro = projection_mg;
- using namespace CEGUI;
- extern struct navit *sdl_gui_navit;
-
- try {
- WindowManager::getSingleton().getWindow("AdressSearchWindow")->hide();
- WindowManager::getSingleton().getWindow("Navit/Routing/Tips")->show();
-
-// WindowManager::getSingleton().getWindow("Navit/ProgressWindow")->show();
- // route_set_destination(co->route, &pos);
- // I could have been using search->nav instead of sdl_gui_navit. is it better this way?
-
-// WindowManager::getSingleton().getWindow("Navit/ProgressWindow")->hide();
-// WindowManager::getSingleton().getWindow("OSD/RoadbookButton")->show();
-// WindowManager::getSingleton().getWindow("OSD/ETA")->show();
- }
- catch (CEGUI::Exception& e)
- {
- fprintf(stderr,"CEGUI Exception occured: \n%s\n", e.getMessage().c_str());
- printf("Missing control!...\n");
- }
- navit_set_destination(sdl_gui_navit, &pos, "FIXME");
-
-}
-
-bool Handle_Virtual_Key_Down(const CEGUI::EventArgs& event){
-
- using namespace CEGUI;
-
- const WindowEventArgs& we = static_cast<const CEGUI::WindowEventArgs&>(event);
- String senderID = we.window->getName();
-
- Window* editbox = WindowManager::getSingleton().getWindow("Navit/Keyboard/Input");
- String content=editbox->getText();
-
-
- if(senderID=="OK"){
- WindowManager::getSingleton().getWindow("Navit/Keyboard")->hide();
- return 0;
- } else if(senderID=="BACK"){
- content=content.substr(0, content.length()-1);
- editbox->setText(content);
- } else {
- content+=senderID;
- editbox->setText(content);
- }
-
- Window* country_edit = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/CountryEditbox"));
- Window* town_edit = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/TownEditbox"));
- Window* street_edit = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/StreetEditbox"));
-
- switch (SDL_dest.current_search) {
- case SRCH_COUNTRY:
- country_edit->setText(content);
- break;
- case SRCH_TOWN :
- town_edit->setText(content);
- break;
- case SRCH_STREET :
- street_edit->setText(content);
- break;
- }
- handle_destination_change();
-}
-
-bool handleItemSelect(int r)
-{
- using namespace CEGUI;
-
- MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("AdressSearch/Listbox"));
-
- ListboxItem * item = mcl->getItemAtGridReference(MCLGridRef(r,0));
- ListboxItem * itemid = mcl->getItemAtGridReference(MCLGridRef(r,1));
- ListboxItem * item_assoc = mcl->getItemAtGridReference(MCLGridRef(r,2));
-
-
- Window* country_edit = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/CountryEditbox"));
- Window* twn_edit = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/TownEditbox"));
- Window* street_edit = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/StreetEditbox"));
-
- if(SDL_dest.current_search==SRCH_COUNTRY){
- country_edit->setText(item->getText());
- twn_edit->activate();
- SDL_dest.current_search=SRCH_TOWN;
- WindowManager::getSingleton().getWindow("Navit/Keyboard/Input")->setText("");
-
- } else if(SDL_dest.current_search==SRCH_TOWN){
- twn_edit->setText(item->getText());
-
- ListboxItem * itemx = mcl->getItemAtGridReference(MCLGridRef(r,3));
- ListboxItem * itemy = mcl->getItemAtGridReference(MCLGridRef(r,4));
-
- Window* Dest_x = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/Dest_x"));
- Dest_x->setText(itemx->getText().c_str());
-
- Window* Dest_y = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/Dest_y"));
- Dest_y->setText(itemy->getText().c_str());
-
- mcl->resetList();
-
- SDL_dest.current_search=SRCH_STREET;
- street_edit->activate();
- WindowManager::getSingleton().getWindow("Navit/Keyboard/Input")->setText("");
-
- } else if(SDL_dest.current_search==SRCH_STREET){
- street_edit->setText(item->getText());
-
- WindowManager::getSingleton().getWindow("Navit/Keyboard")->hide();
-
- ListboxItem * itemx = mcl->getItemAtGridReference(MCLGridRef(r,3));
- ListboxItem * itemy = mcl->getItemAtGridReference(MCLGridRef(r,4));
-
- Window* Dest_x = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/Dest_x"));
- Dest_x->setText(itemx->getText().c_str());
-
- Window* Dest_y = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/Dest_y"));
- Dest_y->setText(itemy->getText().c_str());
-
- mcl->resetList();
-
- SDL_dest.current_search=SRCH_STREET;
-
- WindowManager::getSingleton().getWindow("Navit/Keyboard/Input")->setText("");
-
-
- } else if (SDL_dest.current_search==SRCH_NUMBER){
-
- struct coord pos;
- ListboxItem * itemx = mcl->getItemAtGridReference(MCLGridRef(r,3));
- ListboxItem * itemy = mcl->getItemAtGridReference(MCLGridRef(r,4));
-
- pos.x=atoi(itemx->getText().c_str());
- pos.y=atoi(itemy->getText().c_str());
-
- route_to(pos.x,pos.y);
- }
-
- return true;
-}
-
-bool route_clear(const CEGUI::EventArgs& event)
-{
-// navit_set_destination(gui->nav, NULL, NULL);
-}
-
-bool ItemSelect(const CEGUI::EventArgs& event)
-{
- //FIXME maybe merge with handleItemSelect
- using namespace CEGUI;
-
- MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("AdressSearch/Listbox"));
- ListboxItem * item = mcl->getFirstSelectedItem();
- handleItemSelect(mcl->getItemRowIndex(item));
-}
-
-bool BookmarkSelect(const CEGUI::EventArgs& event)
-{
- using namespace CEGUI;
- dbg(0,"1\n");
- MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("Bookmarks/Listbox"));
- dbg(0,"2\n");
- ListboxItem * item = mcl->getFirstSelectedItem();
- if(item){
- dbg(0,"item %s is at row %i\n",item->getText().c_str(),mcl->getItemRowIndex(item));
- BookmarkGo(item->getText().c_str());
- }
- WindowManager::getSingleton().getWindow("BookmarkSelection")->hide();
-}
-
-bool FormerDestSelect(const CEGUI::EventArgs& event)
-{
- using namespace CEGUI;
- dbg(0,"1\n");
- MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("FormerDests/Listbox"));
- dbg(0,"2\n");
- ListboxItem * item = mcl->getFirstSelectedItem();
- if(item){
- dbg(0,"item %s is at row %i\n",item->getText().c_str(),mcl->getItemRowIndex(item));
- FormerDestGo(item->getText().c_str());
- }
- WindowManager::getSingleton().getWindow("FormerDestSelection")->hide();
- dbg(0,"hided\n");
-}
-
-bool handleMouseEnters(const CEGUI::EventArgs& event)
-{
- // FIXME this whole function could maybe be removed
- const CEGUI::WindowEventArgs& we = static_cast<const CEGUI::WindowEventArgs&>(event);
-
- // FIXME theses variables should be shared
- extern CEGUI::OpenGLRenderer* renderer;
-
- using namespace CEGUI;
- WindowManager::getSingleton().getWindow("Navit/Keyboard/Input")->setText("");
- MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("AdressSearch/Listbox"));
-
- String senderID = we.window->getName();
-
- if (senderID == "AdressSearch/CountryEditbox"){
- // First, clean off the Street and Town Editbox
- Window* town_edit = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/TownEditbox"));
- town_edit->setText("");
- Window* street_edit = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/StreetEditbox"));
- street_edit->setText("");
- SDL_dest.current_search=SRCH_COUNTRY;
-
- } else if (senderID == "AdressSearch/TownEditbox"){
- // First, clean off the Street Editbox
- Window* street_edit = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/StreetEditbox"));
- street_edit->setText("");
- SDL_dest.current_search=SRCH_TOWN;
-
- } else if (senderID == "AdressSearch/StreetEditbox"){
- // First, make sure the user selected an entry in the town choice. If he hadn't, select the first for him.
- if(SDL_dest.current_search==SRCH_TOWN){
- if (mcl->getRowCount()>0)
- {
- handleItemSelect(0);
- }
- }
- SDL_dest.current_search=SRCH_STREET;
-
- }
-}
-
-
-void handle_destination_change(){
-
- using namespace CEGUI;
-
- struct search_param *search=&search_param;
- struct search_list_result *res;
-
- MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("AdressSearch/Listbox"));
-
-
- if (SDL_dest.current_search==SRCH_COUNTRY)
- {
- Editbox* country_edit = static_cast<Editbox*>(WindowManager::getSingleton().getWindow("AdressSearch/CountryEditbox"));
- String content=country_edit->getText();
-
- mcl->resetList();
- dbg(0,"Starting a country search : %s\n",content.c_str());
-
- search->attr.type=attr_country_all;
-
- // FIXME the following codeblock could be shared between country, town and street search
- search->attr.u.str=(char *)content.c_str();
-
- search_list_search(search->sl, &search->attr, 1);
- while((res=search_list_get_result(search->sl))) {
- ListboxTextItem* itemListbox = new ListboxTextItem((CEGUI::utf8*)(res->country->name));
- itemListbox->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
-
- mcl->addRow(itemListbox,0);
- }
-
- } else if (SDL_dest.current_search==SRCH_TOWN)
- {
-
- Editbox* town_edit = static_cast<Editbox*>(WindowManager::getSingleton().getWindow("AdressSearch/TownEditbox"));
- String content=town_edit->getText();
-
-
- mcl->resetList();
-
- if(strlen(content.c_str())<4){
-
- } else {
- dbg(0,"town searching for %s\n",content.c_str());
- search->attr.type=attr_town_name;
- search->attr.u.str=(char *)content.c_str();
-
- search_list_search(search->sl, &search->attr, 1);
- while((res=search_list_get_result(search->sl))) {
- ListboxTextItem* itemListbox = new ListboxTextItem((CEGUI::utf8*)(res->town->name));
- itemListbox->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
-
- mcl->addRow(itemListbox,0);
-
- char x [256];
- sprintf(x,"%li",res->c->x);
- ListboxTextItem* xitem = new ListboxTextItem(x);
-
- char y [256];
- sprintf(y,"%li",res->c->y);
-
- ListboxTextItem* yitem = new ListboxTextItem(y);
-
- try
- {
- mcl->setItem(xitem, 3, mcl->getRowCount()-1);
- mcl->setItem(yitem, 4, mcl->getRowCount()-1);
- }
- // something went wrong, so cleanup the ListboxTextItem.
- catch (InvalidRequestException)
- {
-// delete item;
- }
-
- }
-
- }
-
-
- } else if (SDL_dest.current_search==SRCH_STREET)
- {
- Editbox* street_edit = static_cast<Editbox*>(WindowManager::getSingleton().getWindow("AdressSearch/StreetEditbox"));
-
- String content=street_edit->getText();
- if(strlen(content.c_str())<1){
-
- } else {
- // dbg(1,"street searching for %s\n",content.c_str());
- search->attr.type=attr_street_name;
- search->attr.u.str=(char *)content.c_str();
-
- mcl->resetList();
-
- search_list_search(search->sl, &search->attr, 1);
- while((res=search_list_get_result(search->sl))) {
- ListboxTextItem* itemListbox = new ListboxTextItem((CEGUI::utf8*)(res->street->name));
- itemListbox->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
-
- mcl->addRow(itemListbox,0);
-
- char x [256];
- sprintf(x,"%li",res->c->x);
- ListboxTextItem* xitem = new ListboxTextItem(x);
-
- char y [256];
- sprintf(y,"%li",res->c->y);
-
- ListboxTextItem* yitem = new ListboxTextItem(y);
-
- try
- {
- mcl->setItem(xitem, 3, mcl->getRowCount()-1);
- mcl->setItem(yitem, 4, mcl->getRowCount()-1);
- }
- // something went wrong, so cleanup the ListboxTextItem.
- catch (InvalidRequestException)
- {
-// delete item;
- }
-
-
- }
- }
- }
-
-}
-
-
-bool DestinationEntryChange(const CEGUI::EventArgs& event)
-{
- handleMouseEnters(event);
- handle_destination_change();
-
- return true;
-}
-
-bool DestinationWindowSwitch(const CEGUI::EventArgs& event)
-{
- using namespace CEGUI;
-
- WindowManager::getSingleton().getWindow("AdressSearchWindow")->hide();
- WindowManager::getSingleton().getWindow("BookmarkSelection")->hide();
- WindowManager::getSingleton().getWindow("FormerDestSelection")->hide();
-
- if(WindowManager::getSingleton().getWindow("DestinationChoose")->isVisible()){
- WindowManager::getSingleton().getWindow("DestinationChoose")->hide();
- } else {
- WindowManager::getSingleton().getWindow("DestinationChoose")->show();
- }
-}
-
-bool BookmarkSelectionSwitch(const CEGUI::EventArgs& event)
-{
- using namespace CEGUI;
- if(WindowManager::getSingleton().getWindow("BookmarkSelection")->isVisible()){
- WindowManager::getSingleton().getWindow("BookmarkSelection")->hide();
- } else {
- WindowManager::getSingleton().getWindow("DestinationChoose")->hide();
- WindowManager::getSingleton().getWindow("BookmarkSelection")->show();
- }
-}
-
-bool FormerDestSelectionSwitch(const CEGUI::EventArgs& event)
-{
- using namespace CEGUI;
- if(WindowManager::getSingleton().getWindow("FormerDestSelection")->isVisible()){
- WindowManager::getSingleton().getWindow("FormerDestSelection")->hide();
- } else {
- WindowManager::getSingleton().getWindow("DestinationChoose")->hide();
- WindowManager::getSingleton().getWindow("FormerDestSelection")->show();
- }
-}
-
-bool AddressSearchSwitch(const CEGUI::EventArgs& event)
-{
- using namespace CEGUI;
- WindowManager::getSingleton().getWindow("DestinationChoose")->hide();
- WindowManager::getSingleton().getWindow("AdressSearchWindow")->show();
-
-
- if(sdl_gui_navit){
- } else {
- dbg(0,"*** Invalid navit instance in sdl_events\n");
- }
- struct search_param *search=&search_param;
- struct search_list_result *res;
-
- // dbg(1,"search->nav=sdl_gui_navit;\n");
- search->nav=sdl_gui_navit;
- // dbg(1,"search->ms=navit_get_mapset(sdl_gui_navit);\n");
- search->ms=navit_get_mapset(sdl_gui_navit);
- // dbg(1,"search->sl=search_list_new(search->ms);\n");
- search->sl=search_list_new(search->ms);
-
-
- const CEGUI::WindowEventArgs& we = static_cast<const CEGUI::WindowEventArgs&>(event);
-
- Window* town_edit = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/TownEditbox"));
- town_edit->setText("");
- Window* street_edit = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/StreetEditbox"));
- street_edit->setText("");
- town_edit->activate();
-
- SDL_dest.current_search=SRCH_COUNTRY;
- MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("AdressSearch/Listbox"));
- mcl->resetList();
-
-
- // Code to get the current country and set it by default for the search
- struct attr search_attr, country_name, *country_attr;
- struct tracking *tracking;
- struct country_search *cs;
- struct item *item;
-
-
- Editbox* country_edit = static_cast<Editbox*>(WindowManager::getSingleton().getWindow("AdressSearch/CountryEditbox"));
-
- country_attr=country_default();
- tracking=navit_get_tracking(sdl_gui_navit);
- if (tracking && tracking_get_current_attr(tracking, attr_country_id, &search_attr))
- country_attr=&search_attr;
- cs=country_search_new(country_attr, 0);
- item=country_search_get_item(cs);
- if (item && item_attr_get(item, attr_country_name, &country_name)){
- country_edit->setText(country_name.u.str);
- handle_destination_change();
- }
- country_search_destroy(cs);
-
- SDL_dest.current_search=SRCH_TOWN;
-
- return true;
-}
-
-bool Switch_to_nGhost(const CEGUI::EventArgs& event)
-{
- extern char media_window_title[255], media_cmd[255];
- dbg(0,"trying to switch to %s (%s)\n",media_window_title,media_cmd);
- if (window_switch(media_window_title)==EXIT_FAILURE)
- {
- popen(media_cmd,"r");
- }
-
-}
-
-
-bool RoadBookSwitch(const CEGUI::EventArgs& event)
-{
- using namespace CEGUI;
-
-// const CEGUI::WindowEventArgs& we = static_cast<const CEGUI::WindowEventArgs&>(event);
- if(WindowManager::getSingleton().getWindow("Navit/RoadBook")->isVisible()){
- WindowManager::getSingleton().getWindow("Navit/RoadBook")->hide();
- WindowManager::getSingleton().getWindow("OSD/RoadbookButton")->show();
- } else {
- WindowManager::getSingleton().getWindow("Navit/RoadBook")->show();
- WindowManager::getSingleton().getWindow("OSD/RoadbookButton")->hide();
- }
- return true;
-}
-
-bool ButtonGo(const CEGUI::EventArgs& event)
-{
- using namespace CEGUI;
-
- MultiColumnList* mcl = static_cast<MultiColumnList*>(WindowManager::getSingleton().getWindow("AdressSearch/Listbox"));
- // First, make sure the user selected an entry in the town choice. If he hadn't, select the first for him.
- if(SDL_dest.current_search==SRCH_TOWN){
- if (mcl->getRowCount()>0)
- {
- handleItemSelect(0);
- }
- }
-
-
- Window* Dest_x = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/Dest_x"));
- Window* Dest_y = static_cast<Window*>(WindowManager::getSingleton().getWindow("AdressSearch/Dest_y"));
-
- extern struct navit *sdl_gui_navit;
- route_to(atoi(Dest_x->getText().c_str()),atoi(Dest_y->getText().c_str()));
-
- return true;
-}
-
-
-bool ZoomIn(const CEGUI::EventArgs& event)
-{
- extern struct navit *sdl_gui_navit;
- navit_zoom_in(sdl_gui_navit, 2, NULL);
-
-}
-
-bool ZoomOut(const CEGUI::EventArgs& event)
-{
- extern struct navit *sdl_gui_navit;
- navit_zoom_out(sdl_gui_navit, 2, NULL);
-}
-
-bool ButtonQuit(const CEGUI::EventArgs& event)
-{
- exit(0);
-}
-
-
-
-
-// Nothing really interesting below.
-
-void handle_mouse_down(Uint8 button)
-{
- switch ( button )
- {
- // handle real mouse buttons
- case SDL_BUTTON_LEFT:
- CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::LeftButton);
- break;
- case SDL_BUTTON_MIDDLE:
- CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::MiddleButton);
- break;
- case SDL_BUTTON_RIGHT:
- CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::RightButton);
- break;
-
- // handle the mouse wheel
- case SDL_BUTTON_WHEELDOWN:
- CEGUI::System::getSingleton().injectMouseWheelChange( -1 );
- break;
- case SDL_BUTTON_WHEELUP:
- CEGUI::System::getSingleton().injectMouseWheelChange( +1 );
- break;
- }
-}
-
-
-void handle_mouse_up(Uint8 button)
-{
- switch ( button )
- {
- case SDL_BUTTON_LEFT:
- CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::LeftButton);
- break;
- case SDL_BUTTON_MIDDLE:
- CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::MiddleButton);
- break;
- case SDL_BUTTON_RIGHT:
- CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::RightButton);
- break;
- }
-}
-
-void inject_time_pulse(double& last_time_pulse)
-{
- // get current "run-time" in seconds
- double t = 0.001*SDL_GetTicks();
-
- // inject the time that passed since the last call
- CEGUI::System::getSingleton().injectTimePulse( float(t-last_time_pulse) );
-
- // store the new time as the last time
- last_time_pulse = t;
-}
-
- CEGUI::uint SDLKeyToCEGUIKey(SDLKey key)
- {
- using namespace CEGUI;
- switch (key)
- {
- case SDLK_BACKSPACE: return Key::Backspace;
- case SDLK_TAB: return Key::Tab;
- case SDLK_RETURN: return Key::Return;
- case SDLK_PAUSE: return Key::Pause;
- case SDLK_ESCAPE: return Key::Escape;
- case SDLK_SPACE: return Key::Space;
- case SDLK_COMMA: return Key::Comma;
- case SDLK_MINUS: return Key::Minus;
- case SDLK_PERIOD: return Key::Period;
- case SDLK_SLASH: return Key::Slash;
- case SDLK_0: return Key::Zero;
- case SDLK_1: return Key::One;
- case SDLK_2: return Key::Two;
- case SDLK_3: return Key::Three;
- case SDLK_4: return Key::Four;
- case SDLK_5: return Key::Five;
- case SDLK_6: return Key::Six;
- case SDLK_7: return Key::Seven;
- case SDLK_8: return Key::Eight;
- case SDLK_9: return Key::Nine;
- case SDLK_COLON: return Key::Colon;
- case SDLK_SEMICOLON: return Key::Semicolon;
- case SDLK_EQUALS: return Key::Equals;
- case SDLK_LEFTBRACKET: return Key::LeftBracket;
- case SDLK_BACKSLASH: return Key::Backslash;
- case SDLK_RIGHTBRACKET: return Key::RightBracket;
- case SDLK_a: return Key::A;
- case SDLK_b: return Key::B;
- case SDLK_c: return Key::C;
- case SDLK_d: return Key::D;
- case SDLK_e: return Key::E;
- case SDLK_f: return Key::F;
- case SDLK_g: return Key::G;
- case SDLK_h: return Key::H;
- case SDLK_i: return Key::I;
- case SDLK_j: return Key::J;
- case SDLK_k: return Key::K;
- case SDLK_l: return Key::L;
- case SDLK_m: return Key::M;
- case SDLK_n: return Key::N;
- case SDLK_o: return Key::O;
- case SDLK_p: return Key::P;
- case SDLK_q: return Key::Q;
- case SDLK_r: return Key::R;
- case SDLK_s: return Key::S;
- case SDLK_t: return Key::T;
- case SDLK_u: return Key::U;
- case SDLK_v: return Key::V;
- case SDLK_w: return Key::W;
- case SDLK_x: return Key::X;
- case SDLK_y: return Key::Y;
- case SDLK_z: return Key::Z;
- case SDLK_DELETE: return Key::Delete;
- case SDLK_KP0: return Key::Numpad0;
- case SDLK_KP1: return Key::Numpad1;
- case SDLK_KP2: return Key::Numpad2;
- case SDLK_KP3: return Key::Numpad3;
- case SDLK_KP4: return Key::Numpad4;
- case SDLK_KP5: return Key::Numpad5;
- case SDLK_KP6: return Key::Numpad6;
- case SDLK_KP7: return Key::Numpad7;
- case SDLK_KP8: return Key::Numpad8;
- case SDLK_KP9: return Key::Numpad9;
- case SDLK_KP_PERIOD: return Key::Decimal;
- case SDLK_KP_DIVIDE: return Key::Divide;
- case SDLK_KP_MULTIPLY: return Key::Multiply;
- case SDLK_KP_MINUS: return Key::Subtract;
- case SDLK_KP_PLUS: return Key::Add;
- case SDLK_KP_ENTER: return Key::NumpadEnter;
- case SDLK_KP_EQUALS: return Key::NumpadEquals;
- case SDLK_UP: return Key::ArrowUp;
- case SDLK_DOWN: return Key::ArrowDown;
- case SDLK_RIGHT: return Key::ArrowRight;
- case SDLK_LEFT: return Key::ArrowLeft;
- case SDLK_INSERT: return Key::Insert;
- case SDLK_HOME: return Key::Home;
- case SDLK_END: return Key::End;
- case SDLK_PAGEUP: return Key::PageUp;
- case SDLK_PAGEDOWN: return Key::PageDown;
- case SDLK_F1: return Key::F1;
- case SDLK_F2: return Key::F2;
- case SDLK_F3: return Key::F3;
- case SDLK_F4: return Key::F4;
- case SDLK_F5: return Key::F5;
- case SDLK_F6: return Key::F6;
- case SDLK_F7: return Key::F7;
- case SDLK_F8: return Key::F8;
- case SDLK_F9: return Key::F9;
- case SDLK_F10: return Key::F10;
- case SDLK_F11: return Key::F11;
- case SDLK_F12: return Key::F12;
- case SDLK_F13: return Key::F13;
- case SDLK_F14: return Key::F14;
- case SDLK_F15: return Key::F15;
- case SDLK_NUMLOCK: return Key::NumLock;
- case SDLK_SCROLLOCK: return Key::ScrollLock;
- case SDLK_RSHIFT: return Key::RightShift;
- case SDLK_LSHIFT: return Key::LeftShift;
- case SDLK_RCTRL: return Key::RightControl;
- case SDLK_LCTRL: return Key::LeftControl;
- case SDLK_RALT: return Key::RightAlt;
- case SDLK_LALT: return Key::LeftAlt;
- case SDLK_LSUPER: return Key::LeftWindows;
- case SDLK_RSUPER: return Key::RightWindows;
- case SDLK_SYSREQ: return Key::SysRq;
- case SDLK_MENU: return Key::AppMenu;
- case SDLK_POWER: return Key::Power;
- default: return 0;
- }
- return 0;
- }
-
-
-void inject_input(bool& must_quit)
-{
- SDL_Event e;
-
- // go through all available events
- while (SDL_PollEvent(&e))
- {
- // we use a switch to determine the event type
- switch (e.type)
- {
- // mouse motion handler
- case SDL_MOUSEMOTION:
- // we inject the mouse position directly.
- CEGUI::System::getSingleton().injectMousePosition(
- static_cast<float>(e.motion.x),
- static_cast<float>(e.motion.y)
- );
- break;
-
- // mouse down handler
- case SDL_MOUSEBUTTONDOWN:
- // let a special function handle the mouse button down event
- handle_mouse_down(e.button.button);
- break;
-
- // mouse up handler
- case SDL_MOUSEBUTTONUP:
- // let a special function handle the mouse button up event
- handle_mouse_up(e.button.button);
- break;
-
-
- // key down
- case SDL_KEYDOWN:
- // to tell CEGUI that a key was pressed, we inject the scancode, translated from SDL
- CEGUI::System::getSingleton().injectKeyDown(SDLKeyToCEGUIKey(e.key.keysym.sym));
-
- // as for the character it's a litte more complicated. we'll use for translated unicode value.
- // this is described in more detail below.
- if ((e.key.keysym.unicode & 0xFF80) == 0)
- {
- CEGUI::System::getSingleton().injectChar(e.key.keysym.unicode & 0x7F);
- }
- break;
-
- // key up
- case SDL_KEYUP:
- // like before we inject the scancode translated from SDL.
- CEGUI::System::getSingleton().injectKeyUp(SDLKeyToCEGUIKey(e.key.keysym.sym));
- break;
-
-
- // WM quit event occured
- case SDL_QUIT:
- must_quit = true;
- break;
-
- }
-
- }
-
-}
diff --git a/navit/gui/sdl/sdl_events.h b/navit/gui/sdl/sdl_events.h
deleted file mode 100644
index b4d6e60a..00000000
--- a/navit/gui/sdl/sdl_events.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#include "SDL/SDL.h"
-#include "CEGUI.h"
-
-
-
-#define SRCH_COUNTRY 1
-#define SRCH_TOWN 2
-#define SRCH_STREET 3
-#define SRCH_NUMBER 4
-
-
-
-bool handleItemSelect(int r);
-bool ItemSelect(const CEGUI::EventArgs& event);
-bool handleMouseEnters(const CEGUI::EventArgs& event);
-void handle_destination_change();
-
-bool DestinationEntryChange(const CEGUI::EventArgs& event);
-bool DestinationWindowSwitch(const CEGUI::EventArgs& event);
-bool BookmarkSelectionSwitch(const CEGUI::EventArgs& event);
-bool BookmarkSelect(const CEGUI::EventArgs& event);
-bool FormerDestSelectionSwitch(const CEGUI::EventArgs& event);
-bool FormerDestSelect(const CEGUI::EventArgs& event);
-bool AddressSearchSwitch(const CEGUI::EventArgs& event);
-bool Switch_to_nGhost(const CEGUI::EventArgs& event);
-bool RoadBookSwitch(const CEGUI::EventArgs& event);
-bool ButtonGo(const CEGUI::EventArgs& event);
-bool ZoomIn(const CEGUI::EventArgs& event);
-bool ZoomOut(const CEGUI::EventArgs& event);
-bool ButtonQuit(const CEGUI::EventArgs& event);
-
-void inject_time_pulse(double& last_time_pulse);
-
-bool Handle_Virtual_Key_Down(const CEGUI::EventArgs& event);
-
-CEGUI::uint SDLKeyToCEGUIKey(SDLKey key);
-
-void inject_input(bool& must_quit);
-
-
diff --git a/navit/gui/sdl/wmcontrol.c b/navit/gui/sdl/wmcontrol.c
deleted file mode 100644
index 0337ce2d..00000000
--- a/navit/gui/sdl/wmcontrol.c
+++ /dev/null
@@ -1,1252 +0,0 @@
-
-// This is loosely based upon wmctrl 1.07.
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-#include <locale.h>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <X11/cursorfont.h>
-#include <X11/Xmu/WinUtil.h>
-#include <glib.h>
-
-
-#include "wmcontrol.h"
-
-#define _NET_WM_STATE_REMOVE 0 /* remove/unset property */
-#define _NET_WM_STATE_ADD 1 /* add/set property */
-#define _NET_WM_STATE_TOGGLE 2 /* toggle property */
-
-#define MAX_PROPERTY_VALUE_LEN 4096
-#define SELECT_WINDOW_MAGIC ":SELECT:"
-#define ACTIVE_WINDOW_MAGIC ":ACTIVE:"
-
-#define p_verbose(...) if (options.verbose) { \
- fprintf(stderr, __VA_ARGS__); \
-}
-
-/* declarations of static functions *//*{{{*/
-static gboolean wm_supports (Display *disp, const gchar *prop);
-static Window *get_client_list (Display *disp, unsigned long *size);
-static int client_msg(Display *disp, Window win, char *msg,
- unsigned long data0, unsigned long data1,
- unsigned long data2, unsigned long data3,
- unsigned long data4);
-static int list_windows (Display *disp);
-static int list_desktops (Display *disp);
-static int showing_desktop (Display *disp);
-static int change_viewport (Display *disp);
-static int change_geometry (Display *disp);
-static int change_number_of_desktops (Display *disp);
-static int switch_desktop (Display *disp);
-static int wm_info (Display *disp);
-static gchar *get_output_str (gchar *str, gboolean is_utf8);
-static int action_window (Display *disp, Window win, char mode);
-static int action_window_pid (Display *disp, char mode);
-static int action_window_str (Display *disp, char mode);
-static int activate_window (Display *disp, Window win,
- gboolean switch_desktop);
-static int close_window (Display *disp, Window win);
-static int longest_str (gchar **strv);
-static int window_to_desktop (Display *disp, Window win, int desktop);
-static void window_set_title (Display *disp, Window win, char *str, char mode);
-static gchar *get_window_title (Display *disp, Window win);
-static gchar *get_window_class (Display *disp, Window win);
-static gchar *get_property (Display *disp, Window win,
- Atom xa_prop_type, gchar *prop_name, unsigned long *size);
-static void init_charset(void);
-static int window_move_resize (Display *disp, Window win, char *arg);
-static int window_state (Display *disp, Window win, char *arg);
-static Window Select_Window(Display *dpy);
-static Window get_active_window(Display *dpy);
-
-/*}}}*/
-
-static struct {
- int verbose;
- int force_utf8;
- int show_class;
- int show_pid;
- int show_geometry;
- int match_by_id;
- int match_by_cls;
- int full_window_title_match;
- int wa_desktop_titles_invalid_utf8;
- char *param_window;
- char *param;
-} options;
-
-static gboolean envir_utf8;
-
-int window_switch(const char *windowName) { /* {{{ */
- int opt;
- int ret = EXIT_SUCCESS;
- int missing_option = 1;
- Display *disp;
-
- memset(&options, 0, sizeof(options)); /* just for sure */
-
- /* necessary to make g_get_charset() and g_locale_*() work */
- setlocale(LC_ALL, "");
-
- options.param_window=malloc(strlen(windowName));
- strncpy(options.param_window,windowName,strlen(windowName));
-
- init_charset();
-
- if (! (disp = XOpenDisplay(NULL))) {
- fputs("Cannot open display.\n", stderr);
- return EXIT_FAILURE;
- }
- if (! options.param_window) {
- fputs("No window was specified.\n", stderr);
- return EXIT_FAILURE;
- }
- ret = action_window_str(disp, 'a');
- XCloseDisplay(disp);
- return ret;
-}
-/* }}} */
-
-static void init_charset (void) {/*{{{*/
- const gchar *charset; /* unused */
- gchar *lang = getenv("LANG") ? g_ascii_strup(getenv("LANG"), -1) : NULL;
- gchar *lc_ctype = getenv("LC_CTYPE") ? g_ascii_strup(getenv("LC_CTYPE"), -1) : NULL;
-
- /* this glib function doesn't work on my system ... */
- envir_utf8 = g_get_charset(&charset);
-
- /* ... therefore we will examine the environment variables */
- if (lc_ctype && (strstr(lc_ctype, "UTF8") || strstr(lc_ctype, "UTF-8"))) {
- envir_utf8 = TRUE;
- }
- else if (lang && (strstr(lang, "UTF8") || strstr(lang, "UTF-8"))) {
- envir_utf8 = TRUE;
- }
-
- g_free(lang);
- g_free(lc_ctype);
-
- if (options.force_utf8) {
- envir_utf8 = TRUE;
- }
- p_verbose("envir_utf8: %d\n", envir_utf8);
-}/*}}}*/
-
-static int client_msg(Display *disp, Window win, char *msg, /* {{{ */
- unsigned long data0, unsigned long data1,
- unsigned long data2, unsigned long data3,
- unsigned long data4) {
- XEvent event;
- long mask = SubstructureRedirectMask | SubstructureNotifyMask;
-
- event.xclient.type = ClientMessage;
- event.xclient.serial = 0;
- event.xclient.send_event = True;
- event.xclient.message_type = XInternAtom(disp, msg, False);
- event.xclient.window = win;
- event.xclient.format = 32;
- event.xclient.data.l[0] = data0;
- event.xclient.data.l[1] = data1;
- event.xclient.data.l[2] = data2;
- event.xclient.data.l[3] = data3;
- event.xclient.data.l[4] = data4;
-
- if (XSendEvent(disp, DefaultRootWindow(disp), False, mask, &event)) {
- return EXIT_SUCCESS;
- }
- else {
- fprintf(stderr, "Cannot send %s event.\n", msg);
- return EXIT_FAILURE;
- }
-}/*}}}*/
-
-static gchar *get_output_str (gchar *str, gboolean is_utf8) {/*{{{*/
- gchar *out;
-
- if (str == NULL) {
- return NULL;
- }
-
- if (envir_utf8) {
- if (is_utf8) {
- out = g_strdup(str);
- }
- else {
- if (! (out = g_locale_to_utf8(str, -1, NULL, NULL, NULL))) {
- p_verbose("Cannot convert string from locale charset to UTF-8.\n");
- out = g_strdup(str);
- }
- }
- }
- else {
- if (is_utf8) {
- if (! (out = g_locale_from_utf8(str, -1, NULL, NULL, NULL))) {
- p_verbose("Cannot convert string from UTF-8 to locale charset.\n");
- out = g_strdup(str);
- }
- }
- else {
- out = g_strdup(str);
- }
- }
-
- return out;
-}/*}}}*/
-
-static int wm_info (Display *disp) {/*{{{*/
- Window *sup_window = NULL;
- gchar *wm_name = NULL;
- gchar *wm_class = NULL;
- unsigned long *wm_pid = NULL;
- unsigned long *showing_desktop = NULL;
- gboolean name_is_utf8 = TRUE;
- gchar *name_out;
- gchar *class_out;
-
- if (! (sup_window = (Window *)get_property(disp, DefaultRootWindow(disp),
- XA_WINDOW, "_NET_SUPPORTING_WM_CHECK", NULL))) {
- if (! (sup_window = (Window *)get_property(disp, DefaultRootWindow(disp),
- XA_CARDINAL, "_WIN_SUPPORTING_WM_CHECK", NULL))) {
- fputs("Cannot get window manager info properties.\n"
- "(_NET_SUPPORTING_WM_CHECK or _WIN_SUPPORTING_WM_CHECK)\n", stderr);
- return EXIT_FAILURE;
- }
- }
-
- /* WM_NAME */
- if (! (wm_name = get_property(disp, *sup_window,
- XInternAtom(disp, "UTF8_STRING", False), "_NET_WM_NAME", NULL))) {
- name_is_utf8 = FALSE;
- if (! (wm_name = get_property(disp, *sup_window,
- XA_STRING, "_NET_WM_NAME", NULL))) {
- p_verbose("Cannot get name of the window manager (_NET_WM_NAME).\n");
- }
- }
- name_out = get_output_str(wm_name, name_is_utf8);
-
- /* WM_CLASS */
- if (! (wm_class = get_property(disp, *sup_window,
- XInternAtom(disp, "UTF8_STRING", False), "WM_CLASS", NULL))) {
- name_is_utf8 = FALSE;
- if (! (wm_class = get_property(disp, *sup_window,
- XA_STRING, "WM_CLASS", NULL))) {
- p_verbose("Cannot get class of the window manager (WM_CLASS).\n");
- }
- }
- class_out = get_output_str(wm_class, name_is_utf8);
-
-
- /* WM_PID */
- if (! (wm_pid = (unsigned long *)get_property(disp, *sup_window,
- XA_CARDINAL, "_NET_WM_PID", NULL))) {
- p_verbose("Cannot get pid of the window manager (_NET_WM_PID).\n");
- }
-
- /* _NET_SHOWING_DESKTOP */
- if (! (showing_desktop = (unsigned long *)get_property(disp, DefaultRootWindow(disp),
- XA_CARDINAL, "_NET_SHOWING_DESKTOP", NULL))) {
- p_verbose("Cannot get the _NET_SHOWING_DESKTOP property.\n");
- }
-
- /* print out the info */
- printf("Name: %s\n", name_out ? name_out : "N/A");
- printf("Class: %s\n", class_out ? class_out : "N/A");
-
- if (wm_pid) {
- printf("PID: %lu\n", *wm_pid);
- }
- else {
- printf("PID: N/A\n");
- }
-
- if (showing_desktop) {
- printf("Window manager's \"showing the desktop\" mode: %s\n",
- *showing_desktop == 1 ? "ON" : "OFF");
- }
- else {
- printf("Window manager's \"showing the desktop\" mode: N/A\n");
- }
-
- g_free(name_out);
- g_free(sup_window);
- g_free(wm_name);
- g_free(wm_class);
- g_free(wm_pid);
- g_free(showing_desktop);
-
- return EXIT_SUCCESS;
-}/*}}}*/
-
-static int showing_desktop (Display *disp) {/*{{{*/
- unsigned long state;
-
- if (strcmp(options.param, "on") == 0) {
- state = 1;
- }
- else if (strcmp(options.param, "off") == 0) {
- state = 0;
- }
- else {
- fputs("The argument to the -k option must be either \"on\" or \"off\"\n", stderr);
- return EXIT_FAILURE;
- }
-
- return client_msg(disp, DefaultRootWindow(disp), "_NET_SHOWING_DESKTOP",
- state, 0, 0, 0, 0);
-}/*}}}*/
-
-static int change_viewport (Display *disp) {/*{{{*/
- unsigned long x, y;
- const char *argerr = "The -o option expects two integers separated with a comma.\n";
-
- if (sscanf(options.param, "%lu,%lu", &x, &y) == 2) {
- return client_msg(disp, DefaultRootWindow(disp), "_NET_DESKTOP_VIEWPORT",
- x, y, 0, 0, 0);
- }
- else {
- fputs(argerr, stderr);
- return EXIT_FAILURE;
- }
-}/*}}}*/
-
-static int change_geometry (Display *disp) {/*{{{*/
- unsigned long x, y;
- const char *argerr = "The -g option expects two integers separated with a comma.\n";
-
- if (sscanf(options.param, "%lu,%lu", &x, &y) == 2) {
- return client_msg(disp, DefaultRootWindow(disp), "_NET_DESKTOP_GEOMETRY",
- x, y, 0, 0, 0);
- }
- else {
- fputs(argerr, stderr);
- return EXIT_FAILURE;
- }
-}/*}}}*/
-
-static int change_number_of_desktops (Display *disp) {/*{{{*/
- unsigned long n;
-
- if (sscanf(options.param, "%lu", &n) != 1) {
- fputs("The -n option expects an integer.\n", stderr);
- return EXIT_FAILURE;
- }
-
- return client_msg(disp, DefaultRootWindow(disp), "_NET_NUMBER_OF_DESKTOPS",
- n, 0, 0, 0, 0);
-}/*}}}*/
-
-static int switch_desktop (Display *disp) {/*{{{*/
- int target = -1;
-
- target = atoi(options.param);
- if (target == -1) {
- fputs("Invalid desktop ID.\n", stderr);
- return EXIT_FAILURE;
- }
-
- return client_msg(disp, DefaultRootWindow(disp), "_NET_CURRENT_DESKTOP",
- (unsigned long)target, 0, 0, 0, 0);
-}/*}}}*/
-
-static void window_set_title (Display *disp, Window win, /* {{{ */
- char *title, char mode) {
- gchar *title_utf8;
- gchar *title_local;
-
- if (envir_utf8) {
- title_utf8 = g_strdup(title);
- title_local = NULL;
- }
- else {
- if (! (title_utf8 = g_locale_to_utf8(title, -1, NULL, NULL, NULL))) {
- title_utf8 = g_strdup(title);
- }
- title_local = g_strdup(title);
- }
-
- if (mode == 'T' || mode == 'N') {
- /* set name */
- if (title_local) {
- XChangeProperty(disp, win, XA_WM_NAME, XA_STRING, 8, PropModeReplace,
- title_local, strlen(title_local));
- }
- else {
- XDeleteProperty(disp, win, XA_WM_NAME);
- }
- XChangeProperty(disp, win, XInternAtom(disp, "_NET_WM_NAME", False),
- XInternAtom(disp, "UTF8_STRING", False), 8, PropModeReplace,
- title_utf8, strlen(title_utf8));
- }
-
- if (mode == 'T' || mode == 'I') {
- /* set icon name */
- if (title_local) {
- XChangeProperty(disp, win, XA_WM_ICON_NAME, XA_STRING, 8, PropModeReplace,
- title_local, strlen(title_local));
- }
- else {
- XDeleteProperty(disp, win, XA_WM_ICON_NAME);
- }
- XChangeProperty(disp, win, XInternAtom(disp, "_NET_WM_ICON_NAME", False),
- XInternAtom(disp, "UTF8_STRING", False), 8, PropModeReplace,
- title_utf8, strlen(title_utf8));
- }
-
- g_free(title_utf8);
- g_free(title_local);
-
-}/*}}}*/
-
-static int window_to_desktop (Display *disp, Window win, int desktop) {/*{{{*/
- unsigned long *cur_desktop = NULL;
- Window root = DefaultRootWindow(disp);
-
- if (desktop == -1) {
- if (! (cur_desktop = (unsigned long *)get_property(disp, root,
- XA_CARDINAL, "_NET_CURRENT_DESKTOP", NULL))) {
- if (! (cur_desktop = (unsigned long *)get_property(disp, root,
- XA_CARDINAL, "_WIN_WORKSPACE", NULL))) {
- fputs("Cannot get current desktop properties. "
- "(_NET_CURRENT_DESKTOP or _WIN_WORKSPACE property)"
- "\n", stderr);
- return EXIT_FAILURE;
- }
- }
- desktop = *cur_desktop;
- }
- g_free(cur_desktop);
-
- return client_msg(disp, win, "_NET_WM_DESKTOP", (unsigned long)desktop,
- 0, 0, 0, 0);
-}/*}}}*/
-
-static int activate_window (Display *disp, Window win, /* {{{ */
- gboolean switch_desktop) {
- unsigned long *desktop;
-
-
- printf("sounds good\n");
- /* desktop ID */
- if ((desktop = (unsigned long *)get_property(disp, win,
- XA_CARDINAL, "_NET_WM_DESKTOP", NULL)) == NULL) {
- if ((desktop = (unsigned long *)get_property(disp, win,
- XA_CARDINAL, "_WIN_WORKSPACE", NULL)) == NULL) {
- p_verbose("Cannot find desktop ID of the window.\n");
- }
- }
-
- if (switch_desktop && desktop) {
- if (client_msg(disp, DefaultRootWindow(disp),
- "_NET_CURRENT_DESKTOP",
- *desktop, 0, 0, 0, 0) != EXIT_SUCCESS) {
- p_verbose("Cannot switch desktop.\n");
- }
- g_free(desktop);
- }
-
- client_msg(disp, win, "_NET_ACTIVE_WINDOW",
- 0, 0, 0, 0, 0);
- XMapRaised(disp, win);
-
- return EXIT_SUCCESS;
-}/*}}}*/
-
-static int close_window (Display *disp, Window win) {/*{{{*/
- return client_msg(disp, win, "_NET_CLOSE_WINDOW",
- 0, 0, 0, 0, 0);
-}/*}}}*/
-
-static int window_state (Display *disp, Window win, char *arg) {/*{{{*/
- unsigned long action;
- Atom prop1 = 0;
- Atom prop2 = 0;
- char *p1, *p2;
- const char *argerr = "The -b option expects a list of comma separated parameters: \"(remove|add|toggle),<PROP1>[,<PROP2>]\"\n";
-
- if (!arg || strlen(arg) == 0) {
- fputs(argerr, stderr);
- return EXIT_FAILURE;
- }
-
- if ((p1 = strchr(arg, ','))) {
- gchar *tmp_prop1, *tmp1;
-
- *p1 = '\0';
-
- /* action */
- if (strcmp(arg, "remove") == 0) {
- action = _NET_WM_STATE_REMOVE;
- }
- else if (strcmp(arg, "add") == 0) {
- action = _NET_WM_STATE_ADD;
- }
- else if (strcmp(arg, "toggle") == 0) {
- action = _NET_WM_STATE_TOGGLE;
- }
- else {
- fputs("Invalid action. Use either remove, add or toggle.\n", stderr);
- return EXIT_FAILURE;
- }
- p1++;
-
- /* the second property */
- if ((p2 = strchr(p1, ','))) {
- gchar *tmp_prop2, *tmp2;
- *p2 = '\0';
- p2++;
- if (strlen(p2) == 0) {
- fputs("Invalid zero length property.\n", stderr);
- return EXIT_FAILURE;
- }
- tmp_prop2 = g_strdup_printf("_NET_WM_STATE_%s", tmp2 = g_ascii_strup(p2, -1));
- p_verbose("State 2: %s\n", tmp_prop2);
- prop2 = XInternAtom(disp, tmp_prop2, False);
- g_free(tmp2);
- g_free(tmp_prop2);
- }
-
- /* the first property */
- if (strlen(p1) == 0) {
- fputs("Invalid zero length property.\n", stderr);
- return EXIT_FAILURE;
- }
- tmp_prop1 = g_strdup_printf("_NET_WM_STATE_%s", tmp1 = g_ascii_strup(p1, -1));
- p_verbose("State 1: %s\n", tmp_prop1);
- prop1 = XInternAtom(disp, tmp_prop1, False);
- g_free(tmp1);
- g_free(tmp_prop1);
-
-
- return client_msg(disp, win, "_NET_WM_STATE",
- action, (unsigned long)prop1, (unsigned long)prop2, 0, 0);
- }
- else {
- fputs(argerr, stderr);
- return EXIT_FAILURE;
- }
-}/*}}}*/
-
-static gboolean wm_supports (Display *disp, const gchar *prop) {/*{{{*/
- Atom xa_prop = XInternAtom(disp, prop, False);
- Atom *list;
- unsigned long size;
- int i;
-
- if (! (list = (Atom *)get_property(disp, DefaultRootWindow(disp),
- XA_ATOM, "_NET_SUPPORTED", &size))) {
- p_verbose("Cannot get _NET_SUPPORTED property.\n");
- return FALSE;
- }
-
- for (i = 0; i < size / sizeof(Atom); i++) {
- if (list[i] == xa_prop) {
- g_free(list);
- return TRUE;
- }
- }
-
- g_free(list);
- return FALSE;
-}/*}}}*/
-
-static int window_move_resize (Display *disp, Window win, char *arg) {/*{{{*/
- signed long grav, x, y, w, h;
- unsigned long grflags;
- const char *argerr = "The -e option expects a list of comma separated integers: \"gravity,X,Y,width,height\"\n";
-
- if (!arg || strlen(arg) == 0) {
- fputs(argerr, stderr);
- return EXIT_FAILURE;
- }
-
- if (sscanf(arg, "%ld,%ld,%ld,%ld,%ld", &grav, &x, &y, &w, &h) != 5) {
- fputs(argerr, stderr);
- return EXIT_FAILURE;
- }
-
- if (grav < 0) {
- fputs("Value of gravity mustn't be negative. Use zero to use the default gravity of the window.\n", stderr);
- return EXIT_FAILURE;
- }
-
- grflags = grav;
- if (x != -1) grflags |= (1 << 8);
- if (y != -1) grflags |= (1 << 9);
- if (w != -1) grflags |= (1 << 10);
- if (h != -1) grflags |= (1 << 11);
-
- p_verbose("grflags: %lu\n", grflags);
-
- if (wm_supports(disp, "_NET_MOVERESIZE_WINDOW")){
- return client_msg(disp, win, "_NET_MOVERESIZE_WINDOW",
- grflags, (unsigned long)x, (unsigned long)y, (unsigned long)w, (unsigned long)h);
- }
- else {
- p_verbose("WM doesn't support _NET_MOVERESIZE_WINDOW. Gravity will be ignored.\n");
- if ((w < 1 || h < 1) && (x >= 0 && y >= 0)) {
- XMoveWindow(disp, win, x, y);
- }
- else if ((x < 0 || y < 0) && (w >= 1 && h >= -1)) {
- XResizeWindow(disp, win, w, h);
- }
- else if (x >= 0 && y >= 0 && w >= 1 && h >= 1) {
- XMoveResizeWindow(disp, win, x, y, w, h);
- }
- return EXIT_SUCCESS;
- }
-}/*}}}*/
-
-static int action_window (Display *disp, Window win, char mode) {/*{{{*/
- p_verbose("Using window: 0x%.8lx\n", win);
- switch (mode) {
- case 'a':
- return activate_window(disp, win, TRUE);
-
- case 'c':
- return close_window(disp, win);
-
- case 'e':
- /* resize/move the window around the desktop => -r -e */
- return window_move_resize(disp, win, options.param);
-
- case 'b':
- /* change state of a window => -r -b */
- return window_state(disp, win, options.param);
-
- case 't':
- /* move the window to the specified desktop => -r -t */
- return window_to_desktop(disp, win, atoi(options.param));
-
- case 'R':
- /* move the window to the current desktop and activate it => -r */
- if (window_to_desktop(disp, win, -1) == EXIT_SUCCESS) {
- usleep(100000); /* 100 ms - make sure the WM has enough
- time to move the window, before we activate it */
- return activate_window(disp, win, FALSE);
- }
- else {
- return EXIT_FAILURE;
- }
-
- case 'N': case 'I': case 'T':
- window_set_title(disp, win, options.param, mode);
- return EXIT_SUCCESS;
-
- default:
- fprintf(stderr, "Unknown action: '%c'\n", mode);
- return EXIT_FAILURE;
- }
-}/*}}}*/
-
-static int action_window_pid (Display *disp, char mode) {/*{{{*/
- unsigned long wid;
-
- if (sscanf(options.param_window, "0x%lx", &wid) != 1 &&
- sscanf(options.param_window, "0X%lx", &wid) != 1 &&
- sscanf(options.param_window, "%lu", &wid) != 1) {
- fputs("Cannot convert argument to number.\n", stderr);
- return EXIT_FAILURE;
- }
-
- return action_window(disp, (Window)wid, mode);
-}/*}}}*/
-
-static int action_window_str (Display *disp, char mode) {/*{{{*/
- Window activate = 0;
- Window *client_list;
- unsigned long client_list_size;
- int i;
-
- if (strcmp(SELECT_WINDOW_MAGIC, options.param_window) == 0) {
- activate = Select_Window(disp);
- if (activate) {
- return action_window(disp, activate, mode);
- }
- else {
- return EXIT_FAILURE;
- }
- }
- if (strcmp(ACTIVE_WINDOW_MAGIC, options.param_window) == 0) {
- activate = get_active_window(disp);
- if (activate)
- {
- return action_window(disp, activate, mode);
- }
- else
- {
- return EXIT_FAILURE;
- }
- }
- else {
- if ((client_list = get_client_list(disp, &client_list_size)) == NULL) {
- return EXIT_FAILURE;
- }
-
- for (i = 0; i < client_list_size / sizeof(Window); i++) {
- gchar *match_utf8;
- if (options.show_class) {
- match_utf8 = get_window_class(disp, client_list[i]); /* UTF8 */
- }
- else {
- match_utf8 = get_window_title(disp, client_list[i]); /* UTF8 */
- }
- if (match_utf8) {
- gchar *match;
- gchar *match_cf;
- gchar *match_utf8_cf = NULL;
- if (envir_utf8) {
- match = g_strdup(options.param_window);
- match_cf = g_utf8_casefold(options.param_window, -1);
- }
- else {
- if (! (match = g_locale_to_utf8(options.param_window, -1, NULL, NULL, NULL))) {
- match = g_strdup(options.param_window);
- }
- match_cf = g_utf8_casefold(match, -1);
- }
-
- if (!match || !match_cf) {
- continue;
- }
-
- match_utf8_cf = g_utf8_casefold(match_utf8, -1);
-
- if ((options.full_window_title_match && strcmp(match_utf8, match) == 0) ||
- (!options.full_window_title_match && strstr(match_utf8_cf, match_cf))) {
- activate = client_list[i];
- g_free(match);
- g_free(match_cf);
- g_free(match_utf8);
- g_free(match_utf8_cf);
- break;
- }
- g_free(match);
- g_free(match_cf);
- g_free(match_utf8);
- g_free(match_utf8_cf);
- }
- }
- g_free(client_list);
-
- if (activate) {
- return action_window(disp, activate, mode);
- }
- else {
- return EXIT_FAILURE;
- }
- }
-}/*}}}*/
-
-static int list_desktops (Display *disp) {/*{{{*/
- unsigned long *num_desktops = NULL;
- unsigned long *cur_desktop = NULL;
- unsigned long desktop_list_size = 0;
- unsigned long *desktop_geometry = NULL;
- unsigned long desktop_geometry_size = 0;
- gchar **desktop_geometry_str = NULL;
- unsigned long *desktop_viewport = NULL;
- unsigned long desktop_viewport_size = 0;
- gchar **desktop_viewport_str = NULL;
- unsigned long *desktop_workarea = NULL;
- unsigned long desktop_workarea_size = 0;
- gchar **desktop_workarea_str = NULL;
- gchar *list = NULL;
- int i;
- int id;
- Window root = DefaultRootWindow(disp);
- int ret = EXIT_FAILURE;
- gchar **names = NULL;
- gboolean names_are_utf8 = TRUE;
-
- if (! (num_desktops = (unsigned long *)get_property(disp, root,
- XA_CARDINAL, "_NET_NUMBER_OF_DESKTOPS", NULL))) {
- if (! (num_desktops = (unsigned long *)get_property(disp, root,
- XA_CARDINAL, "_WIN_WORKSPACE_COUNT", NULL))) {
- fputs("Cannot get number of desktops properties. "
- "(_NET_NUMBER_OF_DESKTOPS or _WIN_WORKSPACE_COUNT)"
- "\n", stderr);
- goto cleanup;
- }
- }
-
- if (! (cur_desktop = (unsigned long *)get_property(disp, root,
- XA_CARDINAL, "_NET_CURRENT_DESKTOP", NULL))) {
- if (! (cur_desktop = (unsigned long *)get_property(disp, root,
- XA_CARDINAL, "_WIN_WORKSPACE", NULL))) {
- fputs("Cannot get current desktop properties. "
- "(_NET_CURRENT_DESKTOP or _WIN_WORKSPACE property)"
- "\n", stderr);
- goto cleanup;
- }
- }
-
- if (options.wa_desktop_titles_invalid_utf8 ||
- (list = get_property(disp, root,
- XInternAtom(disp, "UTF8_STRING", False),
- "_NET_DESKTOP_NAMES", &desktop_list_size)) == NULL) {
- names_are_utf8 = FALSE;
- if ((list = get_property(disp, root,
- XA_STRING,
- "_WIN_WORKSPACE_NAMES", &desktop_list_size)) == NULL) {
- p_verbose("Cannot get desktop names properties. "
- "(_NET_DESKTOP_NAMES or _WIN_WORKSPACE_NAMES)"
- "\n");
- /* ignore the error - list the desktops without names */
- }
- }
-
- /* common size of all desktops */
- if (! (desktop_geometry = (unsigned long *)get_property(disp, DefaultRootWindow(disp),
- XA_CARDINAL, "_NET_DESKTOP_GEOMETRY", &desktop_geometry_size))) {
- p_verbose("Cannot get common size of all desktops (_NET_DESKTOP_GEOMETRY).\n");
- }
-
- /* desktop viewport */
- if (! (desktop_viewport = (unsigned long *)get_property(disp, DefaultRootWindow(disp),
- XA_CARDINAL, "_NET_DESKTOP_VIEWPORT", &desktop_viewport_size))) {
- p_verbose("Cannot get common size of all desktops (_NET_DESKTOP_VIEWPORT).\n");
- }
-
- /* desktop workarea */
- if (! (desktop_workarea = (unsigned long *)get_property(disp, DefaultRootWindow(disp),
- XA_CARDINAL, "_NET_WORKAREA", &desktop_workarea_size))) {
- if (! (desktop_workarea = (unsigned long *)get_property(disp, DefaultRootWindow(disp),
- XA_CARDINAL, "_WIN_WORKAREA", &desktop_workarea_size))) {
- p_verbose("Cannot get _NET_WORKAREA property.\n");
- }
- }
-
- /* prepare the array of desktop names */
- names = g_malloc0(*num_desktops * sizeof(char *));
- if (list) {
- id = 0;
- names[id++] = list;
- for (i = 0; i < desktop_list_size; i++) {
- if (list[i] == '\0') {
- if (id >= *num_desktops) {
- break;
- }
- names[id++] = list + i + 1;
- }
- }
- }
-
- /* prepare desktop geometry strings */
- desktop_geometry_str = g_malloc0((*num_desktops + 1) * sizeof(char *));
- if (desktop_geometry && desktop_geometry_size > 0) {
- if (desktop_geometry_size == 2 * sizeof(*desktop_geometry)) {
- /* only one value - use it for all desktops */
- p_verbose("WM provides _NET_DESKTOP_GEOMETRY value common for all desktops.\n");
- for (i = 0; i < *num_desktops; i++) {
- desktop_geometry_str[i] = g_strdup_printf("%lux%lu",
- desktop_geometry[0], desktop_geometry[1]);
- }
- }
- else {
- /* seperate values for desktops of different size */
- p_verbose("WM provides separate _NET_DESKTOP_GEOMETRY value for each desktop.\n");
- for (i = 0; i < *num_desktops; i++) {
- if (i < desktop_geometry_size / sizeof(*desktop_geometry) / 2) {
- desktop_geometry_str[i] = g_strdup_printf("%lux%lu",
- desktop_geometry[i*2], desktop_geometry[i*2+1]);
- }
- else {
- desktop_geometry_str[i] = g_strdup("N/A");
- }
- }
- }
- }
- else {
- for (i = 0; i < *num_desktops; i++) {
- desktop_geometry_str[i] = g_strdup("N/A");
- }
- }
-
- /* prepare desktop viewport strings */
- desktop_viewport_str = g_malloc0((*num_desktops + 1) * sizeof(char *));
- if (desktop_viewport && desktop_viewport_size > 0) {
- if (desktop_viewport_size == 2 * sizeof(*desktop_viewport)) {
- /* only one value - use it for current desktop */
- p_verbose("WM provides _NET_DESKTOP_VIEWPORT value only for the current desktop.\n");
- for (i = 0; i < *num_desktops; i++) {
- if (i == *cur_desktop) {
- desktop_viewport_str[i] = g_strdup_printf("%lu,%lu",
- desktop_viewport[0], desktop_viewport[1]);
- }
- else {
- desktop_viewport_str[i] = g_strdup("N/A");
- }
- }
- }
- else {
- /* seperate values for each of desktops */
- for (i = 0; i < *num_desktops; i++) {
- if (i < desktop_viewport_size / sizeof(*desktop_viewport) / 2) {
- desktop_viewport_str[i] = g_strdup_printf("%lu,%lu",
- desktop_viewport[i*2], desktop_viewport[i*2+1]);
- }
- else {
- desktop_viewport_str[i] = g_strdup("N/A");
- }
- }
- }
- }
- else {
- for (i = 0; i < *num_desktops; i++) {
- desktop_viewport_str[i] = g_strdup("N/A");
- }
- }
-
- /* prepare desktop workarea strings */
- desktop_workarea_str = g_malloc0((*num_desktops + 1) * sizeof(char *));
- if (desktop_workarea && desktop_workarea_size > 0) {
- if (desktop_workarea_size == 4 * sizeof(*desktop_workarea)) {
- /* only one value - use it for current desktop */
- p_verbose("WM provides _NET_WORKAREA value only for the current desktop.\n");
- for (i = 0; i < *num_desktops; i++) {
- if (i == *cur_desktop) {
- desktop_workarea_str[i] = g_strdup_printf("%lu,%lu %lux%lu",
- desktop_workarea[0], desktop_workarea[1],
- desktop_workarea[2], desktop_workarea[3]);
- }
- else {
- desktop_workarea_str[i] = g_strdup("N/A");
- }
- }
- }
- else {
- /* seperate values for each of desktops */
- for (i = 0; i < *num_desktops; i++) {
- if (i < desktop_workarea_size / sizeof(*desktop_workarea) / 4) {
- desktop_workarea_str[i] = g_strdup_printf("%lu,%lu %lux%lu",
- desktop_workarea[i*4], desktop_workarea[i*4+1],
- desktop_workarea[i*4+2], desktop_workarea[i*4+3]);
- }
- else {
- desktop_workarea_str[i] = g_strdup("N/A");
- }
- }
- }
- }
- else {
- for (i = 0; i < *num_desktops; i++) {
- desktop_workarea_str[i] = g_strdup("N/A");
- }
- }
-
- /* print the list */
- for (i = 0; i < *num_desktops; i++) {
- gchar *out = get_output_str(names[i], names_are_utf8);
- printf("%-2d %c DG: %-*s VP: %-*s WA: %-*s %s\n", i, i == *cur_desktop ? '*' : '-',
- longest_str(desktop_geometry_str), desktop_geometry_str[i],
- longest_str(desktop_viewport_str), desktop_viewport_str[i],
- longest_str(desktop_workarea_str), desktop_workarea_str[i],
- out ? out : "N/A");
- g_free(out);
- }
-
- p_verbose("Total number of desktops: %lu\n", *num_desktops);
- p_verbose("Current desktop ID (counted from zero): %lu\n", *cur_desktop);
-
- ret = EXIT_SUCCESS;
- goto cleanup;
-
-cleanup:
- g_free(names);
- g_free(num_desktops);
- g_free(cur_desktop);
- g_free(desktop_geometry);
- g_strfreev(desktop_geometry_str);
- g_free(desktop_viewport);
- g_strfreev(desktop_viewport_str);
- g_free(desktop_workarea);
- g_strfreev(desktop_workarea_str);
- g_free(list);
-
- return ret;
-}/*}}}*/
-
-static int longest_str (gchar **strv) {/*{{{*/
- int max = 0;
- int i = 0;
-
- while (strv && strv[i]) {
- if (strlen(strv[i]) > max) {
- max = strlen(strv[i]);
- }
- i++;
- }
-
- return max;
-}/*}}}*/
-
-static Window *get_client_list (Display *disp, unsigned long *size) {/*{{{*/
- Window *client_list;
-
- if ((client_list = (Window *)get_property(disp, DefaultRootWindow(disp),
- XA_WINDOW, "_NET_CLIENT_LIST", size)) == NULL) {
- if ((client_list = (Window *)get_property(disp, DefaultRootWindow(disp),
- XA_CARDINAL, "_WIN_CLIENT_LIST", size)) == NULL) {
- fputs("Cannot get client list properties. \n"
- "(_NET_CLIENT_LIST or _WIN_CLIENT_LIST)"
- "\n", stderr);
- return NULL;
- }
- }
-
- return client_list;
-}/*}}}*/
-
-static int list_windows (Display *disp) {/*{{{*/
- Window *client_list;
- unsigned long client_list_size;
- int i;
- int max_client_machine_len = 0;
-
- if ((client_list = get_client_list(disp, &client_list_size)) == NULL) {
- return EXIT_FAILURE;
- }
-
- /* find the longest client_machine name */
- for (i = 0; i < client_list_size / sizeof(Window); i++) {
- gchar *client_machine;
- if ((client_machine = get_property(disp, client_list[i],
- XA_STRING, "WM_CLIENT_MACHINE", NULL))) {
- max_client_machine_len = strlen(client_machine);
- }
- g_free(client_machine);
- }
-
- /* print the list */
- for (i = 0; i < client_list_size / sizeof(Window); i++) {
- gchar *title_utf8 = get_window_title(disp, client_list[i]); /* UTF8 */
- gchar *title_out = get_output_str(title_utf8, TRUE);
- gchar *client_machine;
- gchar *class_out = get_window_class(disp, client_list[i]); /* UTF8 */
- unsigned long *pid;
- unsigned long *desktop;
- int x, y, junkx, junky;
- unsigned int wwidth, wheight, bw, depth;
- Window junkroot;
-
- /* desktop ID */
- if ((desktop = (unsigned long *)get_property(disp, client_list[i],
- XA_CARDINAL, "_NET_WM_DESKTOP", NULL)) == NULL) {
- desktop = (unsigned long *)get_property(disp, client_list[i],
- XA_CARDINAL, "_WIN_WORKSPACE", NULL);
- }
-
- /* client machine */
- client_machine = get_property(disp, client_list[i],
- XA_STRING, "WM_CLIENT_MACHINE", NULL);
-
- /* pid */
- pid = (unsigned long *)get_property(disp, client_list[i],
- XA_CARDINAL, "_NET_WM_PID", NULL);
-
- /* geometry */
- XGetGeometry (disp, client_list[i], &junkroot, &junkx, &junky,
- &wwidth, &wheight, &bw, &depth);
- XTranslateCoordinates (disp, client_list[i], junkroot, junkx, junky,
- &x, &y, &junkroot);
-
- /* special desktop ID -1 means "all desktops", so we
- have to convert the desktop value to signed long */
- printf("0x%.8lx %2ld", client_list[i],
- desktop ? (signed long)*desktop : 0);
- if (options.show_pid) {
- printf(" %-6lu", pid ? *pid : 0);
- }
- if (options.show_geometry) {
- printf(" %-4d %-4d %-4d %-4d", x, y, wwidth, wheight);
- }
- if (options.show_class) {
- printf(" %-20s ", class_out ? class_out : "N/A");
- }
-
- printf(" %*s %s\n",
- max_client_machine_len,
- client_machine ? client_machine : "N/A",
- title_out ? title_out : "N/A"
- );
- g_free(title_utf8);
- g_free(title_out);
- g_free(desktop);
- g_free(client_machine);
- g_free(class_out);
- g_free(pid);
- }
- g_free(client_list);
-
- return EXIT_SUCCESS;
-}/*}}}*/
-
-static gchar *get_window_class (Display *disp, Window win) {/*{{{*/
- gchar *class_utf8;
- gchar *wm_class;
- unsigned long size;
-
- wm_class = get_property(disp, win, XA_STRING, "WM_CLASS", &size);
- if (wm_class) {
- gchar *p_0 = strchr(wm_class, '\0');
- if (wm_class + size - 1 > p_0) {
- *(p_0) = '.';
- }
- class_utf8 = g_locale_to_utf8(wm_class, -1, NULL, NULL, NULL);
- }
- else {
- class_utf8 = NULL;
- }
-
- g_free(wm_class);
-
- return class_utf8;
-}/*}}}*/
-
-static gchar *get_window_title (Display *disp, Window win) {/*{{{*/
- gchar *title_utf8;
- gchar *wm_name;
- gchar *net_wm_name;
-
- wm_name = get_property(disp, win, XA_STRING, "WM_NAME", NULL);
- net_wm_name = get_property(disp, win,
- XInternAtom(disp, "UTF8_STRING", False), "_NET_WM_NAME", NULL);
-
- if (net_wm_name) {
- title_utf8 = g_strdup(net_wm_name);
- }
- else {
- if (wm_name) {
- title_utf8 = g_locale_to_utf8(wm_name, -1, NULL, NULL, NULL);
- }
- else {
- title_utf8 = NULL;
- }
- }
-
- g_free(wm_name);
- g_free(net_wm_name);
-
- return title_utf8;
-}/*}}}*/
-
-static gchar *get_property (Display *disp, Window win, /*{{{*/
- Atom xa_prop_type, gchar *prop_name, unsigned long *size) {
- Atom xa_prop_name;
- Atom xa_ret_type;
- int ret_format;
- unsigned long ret_nitems;
- unsigned long ret_bytes_after;
- unsigned long tmp_size;
- unsigned char *ret_prop;
- gchar *ret;
-
- xa_prop_name = XInternAtom(disp, prop_name, False);
-
- /* MAX_PROPERTY_VALUE_LEN / 4 explanation (XGetWindowProperty manpage):
- *
- * long_length = Specifies the length in 32-bit multiples of the
- * data to be retrieved.
- */
- if (XGetWindowProperty(disp, win, xa_prop_name, 0, MAX_PROPERTY_VALUE_LEN / 4, False,
- xa_prop_type, &xa_ret_type, &ret_format,
- &ret_nitems, &ret_bytes_after, &ret_prop) != Success) {
- p_verbose("Cannot get %s property.\n", prop_name);
- return NULL;
- }
-
- if (xa_ret_type != xa_prop_type) {
- p_verbose("Invalid type of %s property.\n", prop_name);
- XFree(ret_prop);
- return NULL;
- }
-
- /* null terminate the result to make string handling easier */
- tmp_size = (ret_format / 8) * ret_nitems;
- ret = g_malloc(tmp_size + 1);
- memcpy(ret, ret_prop, tmp_size);
- ret[tmp_size] = '\0';
-
- if (size) {
- *size = tmp_size;
- }
-
- XFree(ret_prop);
- return ret;
-}/*}}}*/
-
-static Window Select_Window(Display *dpy) {/*{{{*/
- /*
- * Routine to let user select a window using the mouse
- * Taken from xfree86.
- */
-
- int status;
- Cursor cursor;
- XEvent event;
- Window target_win = None, root = DefaultRootWindow(dpy);
- int buttons = 0;
- int dummyi;
- unsigned int dummy;
-
- /* Make the target cursor */
- cursor = XCreateFontCursor(dpy, XC_crosshair);
-
- /* Grab the pointer using target cursor, letting it room all over */
- status = XGrabPointer(dpy, root, False,
- ButtonPressMask|ButtonReleaseMask, GrabModeSync,
- GrabModeAsync, root, cursor, CurrentTime);
- if (status != GrabSuccess) {
- fputs("ERROR: Cannot grab mouse.\n", stderr);
- return 0;
- }
-
- /* Let the user select a window... */
- while ((target_win == None) || (buttons != 0)) {
- /* allow one more event */
- XAllowEvents(dpy, SyncPointer, CurrentTime);
- XWindowEvent(dpy, root, ButtonPressMask|ButtonReleaseMask, &event);
- switch (event.type) {
- case ButtonPress:
- if (target_win == None) {
- target_win = event.xbutton.subwindow; /* window selected */
- if (target_win == None) target_win = root;
- }
- buttons++;
- break;
- case ButtonRelease:
- if (buttons > 0) /* there may have been some down before we started */
- buttons--;
- break;
- }
- }
-
- XUngrabPointer(dpy, CurrentTime); /* Done with pointer */
-
- if (XGetGeometry (dpy, target_win, &root, &dummyi, &dummyi,
- &dummy, &dummy, &dummy, &dummy) && target_win != root) {
- target_win = XmuClientWindow (dpy, target_win);
- }
-
- return(target_win);
-}/*}}}*/
-
-static Window get_active_window(Display *disp) {/*{{{*/
- char *prop;
- unsigned long size;
- Window ret = (Window)0;
-
- prop = get_property(disp, DefaultRootWindow(disp), XA_WINDOW,
- "_NET_ACTIVE_WINDOW", &size);
- if (prop) {
- ret = *((Window*)prop);
- g_free(prop);
- }
-
- return(ret);
-}/*}}}*/
-
-
diff --git a/navit/gui/sdl/wmcontrol.h b/navit/gui/sdl/wmcontrol.h
deleted file mode 100644
index 224dae56..00000000
--- a/navit/gui/sdl/wmcontrol.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifdef __cplusplus
-extern "C" {
-#endif
-int window_switch(const char *windowName);
-#ifdef __cplusplus
-}
-#endif
diff --git a/navit/gui/win32/Makefile.am b/navit/gui/win32/Makefile.am
deleted file mode 100644
index 6ca8b730..00000000
--- a/navit/gui/win32/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = -I$(top_srcdir)/navit @NAVIT_CFLAGS@ -DMODULE=gui_win32
-modulegui_LTLIBRARIES = libgui_win32.la
-libgui_win32_la_SOURCES = gui_win32.c win32_gui_destination.c win32_gui_notify.c
-libgui_win32_la_LIBADD =
diff --git a/navit/gui/win32/gui_win32.c b/navit/gui/win32/gui_win32.c
deleted file mode 100644
index 7ede0dfc..00000000
--- a/navit/gui/win32/gui_win32.c
+++ /dev/null
@@ -1,549 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <process.h>
-#include <windows.h>
-#include <wchar.h>
-#include <glib.h>
-#if defined(__CEGCC__)
-#include <libintl.h>
-#endif
-#include <commctrl.h>
-#include "config.h"
-#include "plugin.h"
-#include "gui.h"
-#include "win32_gui.h"
-#include "point.h"
-#include "navit.h"
-#include "menu.h"
-#include "item.h"
-#include "attr.h"
-#include "callback.h"
-#include <commctrl.h>
-#include "debug.h"
-#include "util.h"
-
-
-//static GHashTable *popup_callback_hash = NULL;
-static GArray *popup_menu_array;
-
-const TCHAR g_szClassName[] = TEXT("navit_gui_class");
-
-static int menu_id = 0;
-
-gboolean message_pump( gpointer data )
-{
- MSG messages;
-
- Sleep( 1 );
-
- if (GetMessage (&messages, NULL, 0, 0))
- {
- TranslateMessage(&messages);
- DispatchMessage(&messages);
- }
- else{
- exit( 0 );
- }
- return TRUE;
-}
-
-
-
-//extern struct graphics_priv *g_gra;
-
-BOOL CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam)
-{
- LPRECT rcParent;
- int idChild;
-
- idChild = GetWindowLong(hwndChild, GWL_ID);
-
- if ( idChild == ID_CHILD_GFX )
- {
- rcParent = (LPRECT) lParam;
-
- MoveWindow( hwndChild, 0, 0, rcParent->right, rcParent->bottom, TRUE );
- PostMessage( hwndChild, WM_USER+1, 0, 0 );
- }
-
- return TRUE;
-}
-
-#ifndef GET_WHEEL_DELTA_WPARAM
- #define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam))
-#endif
-
-static void CreateToolBar(HWND hwnd)
-{
- // Create Toolbar
- HWND hTool;
- TBBUTTON tbb[8];
- TBADDBITMAP tbab;
-#if 0
- struct tagINITCOMMONCONTROLSEX initComm;
-
- initComm.dwSize = sizeof(struct tagINITCOMMONCONTROLSEX);
- initComm.dwICC = ICC_BAR_CLASSES | ICC_LISTVIEW_CLASSES;
- InitCommonControlsEx(&initComm);
-#endif
-
- hTool = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0,
- hwnd, (HMENU)ID_CHILD_TOOLBAR, GetModuleHandle(NULL), NULL);
-
- if(hTool == NULL)
- MessageBox(hwnd, TEXT("Could not create tool bar."), TEXT("Error"), MB_OK | MB_ICONERROR);
-
- SendMessage(hTool, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
-
- tbab.hInst = GetModuleHandle(NULL);
- tbab.nID = IDB_NAVITTOOLBAR;
- int iImageOffset = SendMessage(hTool, TB_ADDBITMAP, 10, (LPARAM) &tbab);
-
- int iStr;
-
- ZeroMemory(tbb, sizeof(tbb));
-
- tbb[0].iBitmap = iImageOffset;
- tbb[0].fsState = TBSTATE_ENABLED;
- tbb[0].fsStyle = TBSTYLE_BUTTON;
- tbb[0].idCommand = ID_DISPLAY_ZOOMIN;
- iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"ZoomIn" );
- tbb[0].iString = iStr;
-
- tbb[1].iBitmap = iImageOffset+1;
- tbb[1].fsState = TBSTATE_ENABLED;
- tbb[1].fsStyle = TBSTYLE_BUTTON;
- tbb[1].idCommand = ID_DISPLAY_ZOOMOUT;
- iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"ZoomOut" );
- tbb[1].iString = iStr;
-
- tbb[2].iBitmap = iImageOffset+4;
- tbb[2].fsState = TBSTATE_ENABLED;
- tbb[2].fsStyle = TBSTYLE_BUTTON;
- tbb[2].idCommand = ID_DISPLAY_REFRESH;
- iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"Refresh" );
- tbb[2].iString = iStr;
-
- tbb[3].iBitmap = iImageOffset+2;
- tbb[3].fsState = TBSTATE_ENABLED;
- tbb[3].fsStyle = TBSTYLE_BUTTON;
- tbb[3].idCommand = ID_DISPLAY_CURSOR;
- iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"Cursor" );
- tbb[3].iString = iStr;
-
- tbb[4].iBitmap = iImageOffset+5;
- tbb[4].fsState = TBSTATE_ENABLED;
- tbb[4].fsStyle = TBSTYLE_BUTTON;
- tbb[4].idCommand = ID_DISPLAY_ORIENT;
- iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"Orientation" );
- tbb[4].iString = iStr;
-
- tbb[5].iBitmap = iImageOffset+8;
- tbb[5].fsState = TBSTATE_ENABLED;
- tbb[5].fsStyle = TBSTYLE_BUTTON;
- tbb[5].idCommand = ID_DISPLAY_DESTINATION;
- iStr= SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"Destination" );
- tbb[5].iString = iStr;
-
- tbb[6].iBitmap = iImageOffset+3;
- tbb[6].fsState = TBSTATE_ENABLED;
- tbb[6].fsStyle = TBSTYLE_BUTTON;
- tbb[6].idCommand = ID_DISPLAY_ZOOMIN;
- iStr= SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"Roadbook" );
- tbb[6].iString = iStr;
-
- tbb[7].iBitmap = iImageOffset+9;
- tbb[7].fsState = TBSTATE_ENABLED;
- tbb[7].fsStyle = TBSTYLE_BUTTON;
- tbb[7].idCommand = ID_FILE_EXIT;
- iStr= SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"_Quit" );
- tbb[7].iString = iStr;
-
- SendMessage(hTool, TB_ADDBUTTONS, sizeof(tbb)/sizeof(TBBUTTON), (LPARAM)&tbb);
-}
-
-static void window_layout( HWND hwnd )
-{
-#if !defined(__CEGCC__)
- RECT rcClient;
- RECT rcTool;
- int iToolHeight;
-
- HWND hChild = GetDlgItem(hwnd, ID_CHILD_TOOLBAR);
- SendMessage(hChild, TB_AUTOSIZE, 0, 0);
-
-
- GetWindowRect(hChild, &rcTool);
- iToolHeight = rcTool.bottom - rcTool.top;
-
- GetClientRect(hwnd, &rcClient);
- dbg( 2, "BEFORE resize gui to: %d %d %d %d \n", rcClient.left, rcClient.right, rcClient.top, rcClient.bottom );
-
- rcClient.top += iToolHeight;
-
- dbg( 1, "resize gui to: %ld %ld %ld %ld \n", rcClient.left, rcClient.right, rcClient.top, rcClient.bottom );
-
-
- hChild = GetDlgItem(hwnd, ID_CHILD_GFX);
- if ( hChild )
- {
- MoveWindow( hChild, rcClient.left, rcClient.top, rcClient.right- rcClient.left, rcClient.bottom - rcClient.top, TRUE );
-// PostMessage( hChild, WM_USER+1, 0, 0 );
- }
-#endif
-}
-
-static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
-{
- dbg( 2, "PARENT %d %d %d \n", Message, wParam, lParam );
-
- switch(Message)
- {
- case WM_CREATE:
- {
- HMENU hMenu, hSubMenu;
-
- CreateToolBar( hwnd );
-
- hMenu = CreateMenu();
- // g_this_->hwnd = hwnd;
-
- hSubMenu = CreatePopupMenu();
-
- AppendMenuW(hSubMenu, MF_STRING, ID_DISPLAY_ZOOMIN, L"ZoomIn" );
- AppendMenuW(hSubMenu, MF_STRING, ID_DISPLAY_ZOOMOUT, L"ZoomOut" );
- AppendMenuW(hSubMenu, MF_STRING, ID_DISPLAY_REFRESH, L"Refresh" );
- AppendMenuW(hSubMenu, MF_STRING, ID_DISPLAY_DESTINATION, L"Destination" );
- AppendMenuW(hSubMenu, MF_STRING, ID_DISPLAY_REFRESH, L"Refresh");
- AppendMenuW(hSubMenu, MF_SEPARATOR, 0, NULL );
- AppendMenuW(hSubMenu, MF_STRING, ID_FILE_EXIT, L"_Quit" );
-
- AppendMenuW(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, L"Display" );
- hSubMenu = CreatePopupMenu();
- AppendMenu(hSubMenu, MF_STRING, ID_STUFF_GO, TEXT("&Go"));
- AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, TEXT("&Stuff"));
-
-#if !defined(__CEGCC__)
- SetMenu(hwnd, hMenu);
-#endif
-
- window_layout( hwnd );
-
- }
- break;
- case WM_COMMAND:
- {
- dbg( 1, "WM_COMMAND %d\n", LOWORD(wParam) );
- struct gui_priv* gui = (struct gui_priv*)GetWindowLongPtr( hwnd , DWLP_USER );
-
-
- switch(LOWORD(wParam))
- {
- case ID_DISPLAY_ZOOMIN:
- navit_zoom_in(gui->nav, 2, NULL);
- return 0;
- break;
- case ID_DISPLAY_ZOOMOUT:
- navit_zoom_out(gui->nav, 2, NULL);
- return 0;
- break;
- case ID_DISPLAY_REFRESH:
- navit_draw(gui->nav);
- return 0;
- break;
- case ID_DISPLAY_CURSOR:
- {
- struct attr attr;
- attr.type=attr_cursor;
- // TODO attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
- if(!navit_set_attr(gui->nav, &attr)) {
- dbg(0, "Failed to set attr_cursor\n");
- }
- return 0;
- }
- break;
- case ID_DISPLAY_ORIENT:
- {
- struct attr attr;
-
- attr.type=attr_orientation;
- attr.u.num = 0; // TODO
- if(!navit_set_attr(gui->nav, &attr)) {
- dbg(0, "Failed to set attr_orientation\n");
- }
- return 0;
- }
- case ID_DISPLAY_DESTINATION:
- {
- create_destination_window(gui->nav);
- return 0;
- }
-
- case ID_FILE_EXIT:
- PostMessage(hwnd, WM_CLOSE, 0, 0);
- return 0;
- break;
- }
- if ( popup_menu_array )
- {
- struct menu_priv* priv = (struct menu_priv*)g_array_index( popup_menu_array, gint, LOWORD(wParam) - POPUP_MENU_OFFSET );
-
- if ( priv )
- {
- if ( priv->cb )
- {
- callback_call_0( priv->cb );
- return 0;
- }
- }
- }
- }
- break;
- case WM_USER + 1:
- window_layout( hwnd );
- return 0;
- break;
- case WM_CLOSE:
- DestroyWindow(hwnd);
- break;
- case WM_SIZE:
- window_layout( hwnd );
- return 0;
- break;
- case WM_DESTROY:
- PostQuitMessage(0);
- break;
-
-
- case WM_MOUSEWHEEL:
- {
- struct gui_priv* gui = (struct gui_priv*)GetWindowLongPtr( hwnd , DWLP_USER );
-
- short delta = GET_WHEEL_DELTA_WPARAM( wParam );
- if ( delta > 0 )
- {
- navit_zoom_in(gui->nav, 2, NULL);
- }
- else{
- navit_zoom_out(gui->nav, 2, NULL);
- }
- }
- break;
-
- default:
- return DefWindowProc(hwnd, Message, wParam, lParam);
- }
- return 0;
-}
-
-HANDLE CreateWin32Window( void )
-{
- WNDCLASS wc;
- HWND hwnd;
-
-// wc.cbSize = sizeof(WNDCLASSEX);
- wc.style = 0;
- wc.lpfnWndProc = WndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 32;
- wc.hInstance = NULL;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = g_szClassName;
-// wc.hIconSm = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_NAVIT));
- wc.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_NAVIT));
-
- if(!RegisterClass(&wc))
- {
- MessageBox(NULL, TEXT("Window Registration Failed!"), TEXT("Error!"), MB_ICONEXCLAMATION | MB_OK);
- return 0;
- }
-
- hwnd = CreateWindowEx(
- WS_EX_CLIENTEDGE,
- g_szClassName,
- TEXT("Navit"),
-#if defined(__CEGCC__)
- WS_SYSMENU | WS_CLIPCHILDREN,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
-#else
- WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
- CW_USEDEFAULT, CW_USEDEFAULT, 800, 600,
-#endif
- NULL, NULL, NULL, NULL);
-
- if(hwnd == NULL)
- {
- MessageBox(NULL, TEXT("Window Creation Failed!"), TEXT("Error!"), MB_ICONEXCLAMATION | MB_OK);
- return 0;
- }
-
- ShowWindow(hwnd, TRUE);
- UpdateWindow(hwnd);
-
- g_idle_add (message_pump, NULL);
-
- register_destination_window();
- return hwnd;
-}
-
-
-static int win32_gui_set_graphics(struct gui_priv *this_, struct graphics *gra)
-{
- HANDLE* wndHandle_ptr = graphics_get_data(gra, "wnd_parent_handle_ptr");
- *wndHandle_ptr = this_->hwnd;
- graphics_get_data(gra, "START_CLIENT");
- return 0;
-}
-
-
-//static void win32_gui_add_bookmark_do(struct gui_priv *gui)
-//{
-//// navit_add_bookmark(gui->nav, &gui->dialog_coord, gtk_entry_get_text(GTK_ENTRY(gui->dialog_entry)));
-//// gtk_widget_destroy(gui->dialog_win);
-//}
-
-static int win32_gui_add_bookmark(struct gui_priv *gui, struct pcoord *c, char *description)
-{
- return 1;
-}
-
-
-static struct menu_methods menu_methods;
-
-
-static struct menu_priv *add_menu( struct menu_priv *menu,
- struct menu_methods *meth,
- char *name,
- enum menu_type type,
- struct callback *cb)
-{
- struct menu_priv* ret = NULL;
-
- ret = g_new0(struct menu_priv, 1);
-
- *ret = *menu;
- *meth = menu_methods;
-
- TCHAR *menuname = newSysString(name);
-
- if ( type == menu_type_submenu )
- {
- HMENU hSubMenu = NULL;
- hSubMenu = CreatePopupMenu();
-
- AppendMenu(menu->hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, menuname );
-
- ret->hMenu = hSubMenu;
- }
- else
- {
- AppendMenu( menu->hMenu, MF_STRING, menu_id, menuname );
- }
-
- g_free(menuname);
- // g_hash_table_insert( popup_callback_hash, GINT_TO_POINTER( menu_id ), (gpointer)cb );
- g_array_append_val( popup_menu_array, ret );
-
- ret->cb = cb;
-
- menu_id++;
-
- return ret;
-
-}
-
-static void set_toggle(struct menu_priv *menu, int active)
-{
- // gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(menu->action), active);
-}
-
-static int get_toggle(struct menu_priv *menu)
-{
- // return gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(menu->action));
- return 0;
-}
-
-static struct menu_methods menu_methods = {
- add_menu,
- set_toggle,
- get_toggle,
-};
-
-static void popup_activate(struct menu_priv *menu)
-{
- POINT pnt;
- GetCursorPos( &pnt );
-
- if (menu->hMenu)
- {
- TrackPopupMenu( menu->hMenu, 0, pnt.x, pnt.y, 0, menu->wnd_handle, NULL );
- DestroyMenu( menu->hMenu );
- }
-}
-
-
-//static void popup_deactivate( struct menu_priv *menu )
-//{
-// DestroyMenu( menu->hMenu );
-//}
-
-struct menu_priv* win32_gui_popup_new(struct gui_priv *this_, struct menu_methods *meth)
-{
- struct menu_priv* ret = NULL;
-
- ret = g_new0(struct menu_priv, 1);
- *meth = menu_methods;
-
- menu_id = POPUP_MENU_OFFSET;
-
- if ( popup_menu_array )
- {
- g_array_free (popup_menu_array, TRUE);
- popup_menu_array = NULL;
- }
-
- popup_menu_array = g_array_new (FALSE, FALSE, sizeof (gint));
-
- ret->cb = NULL;
- ret->hMenu = CreatePopupMenu();
- ret->wnd_handle = this_->hwnd;
- meth->popup=popup_activate;
-
- dbg( 1, "create popup menu %d \n", (int)ret->hMenu );
-
- return ret;
-}
-
-struct gui_methods win32_gui_methods = {
- NULL, // win32_gui_menubar_new,
- win32_gui_popup_new,
- win32_gui_set_graphics,
- NULL,
- NULL,
- win32_gui_add_bookmark,
-};
-
-
-
-static struct gui_priv *win32_gui_new( struct navit *nav, struct gui_methods *meth, struct attr **attrs)
-{
- struct gui_priv *this_;
-
- *meth=win32_gui_methods;
-
- this_=g_new0(struct gui_priv, 1);
- this_->nav=nav;
-
- this_->hwnd = CreateWin32Window();
- SetWindowLongPtr( this_->hwnd , DWLP_USER, (LONG_PTR) this_ );
-
- return this_;
-}
-
-void plugin_init(void)
-{
- plugin_register_gui_type("win32", win32_gui_new);
- plugin_register_graphics_type("win32_graphics", win32_graphics_new);
-}
diff --git a/navit/gui/win32/gui_win32.h b/navit/gui/win32/gui_win32.h
deleted file mode 100644
index cdb6d302..00000000
--- a/navit/gui/win32/gui_win32.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef WIN32_GUI_INCLUDED
-#define WIN32_GUI_INCLUDED
-
-#include "resources\resource.h"
-#include "coord.h"
-#include "point.h"
-#include "graphics.h"
-
-#define ID_CHILD_GFX 100
-#define ID_CHILD_TOOLBAR (ID_CHILD_GFX + 1)
-#define ID_CHILD_1 (ID_CHILD_TOOLBAR + 1)
-#define ID_CHILD_2 (ID_CHILD_1 + 1)
-#define ID_CHILD_3 (ID_CHILD_2 + 1)
-#define ID_CHILD_4 (ID_CHILD_4 + 1)
-
-#define ID_DISPLAY_ZOOMIN 200
-#define ID_DISPLAY_ZOOMOUT 201
-#define ID_DISPLAY_REFRESH 202
-#define ID_DISPLAY_CURSOR 203
-#define ID_DISPLAY_ORIENT 204
-#define ID_DISPLAY_DESTINATION 205
-
-#define ID_FILE_EXIT 9001
-#define ID_STUFF_GO 9002
-
-#define _(text) gettext(text)
-
-#define POPUP_MENU_OFFSET 4000
-
-struct statusbar_methods;
-struct menu_methods;
-struct datawindow_methods;
-struct navit;
-struct callback;
-
-
-struct menu_priv {
- HWND wnd_handle;
- HMENU hMenu;
- struct callback* cb;
-};
-
-struct gui_priv {
- struct navit *nav;
- HANDLE hwnd;
-};
-
-
-struct graphics_priv {
- struct point p;
- int width;
- int height;
- int library_init;
- int visible;
- HANDLE wnd_parent_handle;
- HANDLE wnd_handle;
- COLORREF bg_color;
-
-
- void (*resize_callback)(void *data, int w, int h);
- void *resize_callback_data;
- void (*motion_callback)(void *data, struct point *p);
- void *motion_callback_data;
- void (*button_callback)(void *data, int press, int button, struct point *p);
- void *button_callback_data;
- enum draw_mode_num mode;
-};
-
-
-struct graphics_priv* win32_graphics_new( struct graphics_methods *meth, struct attr **attrs);
-HANDLE create_destination_window( struct navit *nav );
-BOOL register_destination_window();
-
-
-#endif
diff --git a/navit/gui/win32/win32_gui.h b/navit/gui/win32/win32_gui.h
deleted file mode 100644
index d5b457b7..00000000
--- a/navit/gui/win32/win32_gui.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef WIN32_GUI_INCLUDED
-#define WIN32_GUI_INCLUDED
-
-#include "resources/resource.h"
-#include "coord.h"
-#include "point.h"
-#include "graphics.h"
-
-#define ID_CHILD_GFX 100
-#define ID_CHILD_TOOLBAR (ID_CHILD_GFX + 1)
-#define ID_CHILD_1 (ID_CHILD_TOOLBAR + 1)
-#define ID_CHILD_2 (ID_CHILD_1 + 1)
-#define ID_CHILD_3 (ID_CHILD_2 + 1)
-#define ID_CHILD_4 (ID_CHILD_4 + 1)
-
-#define ID_DISPLAY_ZOOMIN 200
-#define ID_DISPLAY_ZOOMOUT 201
-#define ID_DISPLAY_REFRESH 202
-#define ID_DISPLAY_CURSOR 203
-#define ID_DISPLAY_ORIENT 204
-#define ID_DISPLAY_DESTINATION 205
-
-#define ID_FILE_EXIT 9001
-#define ID_STUFF_GO 9002
-
-#define _(text) gettext(text)
-
-#define POPUP_MENU_OFFSET 4000
-
-struct statusbar_methods;
-struct menu_methods;
-struct datawindow_methods;
-struct navit;
-struct callback;
-
-
-struct menu_priv {
- HWND wnd_handle;
- HMENU hMenu;
- struct callback* cb;
-};
-
-struct gui_priv {
- struct navit *nav;
- HANDLE hwnd;
-};
-
-
-struct graphics_priv {
- struct point p;
- int width;
- int height;
- int library_init;
- int visible;
- HANDLE wnd_parent_handle;
- HANDLE wnd_handle;
- COLORREF bg_color;
-
-
- void (*resize_callback)(void *data, int w, int h);
- void *resize_callback_data;
- void (*motion_callback)(void *data, struct point *p);
- void *motion_callback_data;
- void (*button_callback)(void *data, int press, int button, struct point *p);
- void *button_callback_data;
- enum draw_mode_num mode;
-};
-
-
-struct graphics_priv* win32_graphics_new( struct graphics_methods *meth, struct attr **attrs);
-HANDLE create_destination_window( struct navit *nav );
-BOOL register_destination_window(void);
-
-
-#endif
diff --git a/navit/gui/win32/win32_gui_destination.c b/navit/gui/win32/win32_gui_destination.c
deleted file mode 100644
index 624383b8..00000000
--- a/navit/gui/win32/win32_gui_destination.c
+++ /dev/null
@@ -1,407 +0,0 @@
-#include <windows.h>
-#include <windowsx.h>
-#include <commctrl.h>
-#include <glib.h>
-#include "item.h"
-#include "attr.h"
-#include "navit.h"
-#include "search.h"
-#include "debug.h"
-#include "util.h"
-#include "win32_gui_notify.h"
-#include "resources/resource.h"
-
-static const TCHAR g_szDestinationClassName[] = TEXT("navit_gui_destinationwindow_class");
-
-struct datawindow_priv
-{
- HWND hwnd;
- HWND hwndLabel;
- HWND hwndEdit;
- HWND hwndList;
- HWND hwndButtonPrev;
- HWND hwndButtonNext;
- enum attr_type currentSearchState;
- struct search_list *sl;
- struct navit *nav;
- struct notify_priv *notifications;
-};
-
-static void setlayout(struct datawindow_priv *datawindow)
-{
- LVCOLUMN lvc;
- lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
-
- RECT winrect;
- GetWindowRect (datawindow->hwndList, &winrect);
-
- lvc.iSubItem = 1;
- lvc.cx = (winrect.right - winrect.left) - 52 ;
- lvc.fmt = LVCFMT_LEFT; // left-aligned column
-
- switch (datawindow->currentSearchState)
- {
- case attr_country_name:
- {
- Edit_SetText(datawindow->hwndLabel, TEXT("Country"));
- lvc.pszText = TEXT("Country");
- }
- break;
- case attr_town_name:
- {
- Edit_SetText(datawindow->hwndLabel, TEXT("Postal or Town"));
- lvc.pszText = TEXT("Town");
- }
- break;
- case attr_street_name:
- {
- Edit_SetText(datawindow->hwndLabel, TEXT("Street"));
- lvc.pszText = TEXT("Street");
- }
- break;
- default:
- break;
-
- }
-
- (void)ListView_SetColumn(datawindow->hwndList, 1, &lvc);
-
- Edit_SetText(datawindow->hwndEdit, TEXT(""));
- SetFocus(datawindow->hwndEdit);
-}
-
-static void notify_apply(struct datawindow_priv *datawindow, int index, int param2)
-{
- TCHAR txtBuffer[1024];
- struct attr search_attr;
- struct search_list_result *res;
-
- if ( index >= 0 )
- {
- ListView_GetItemText(datawindow->hwndList, index, 1, txtBuffer, 1024);
-
- TCHAR_TO_UTF8(txtBuffer, search_string);
-
- search_attr.type = datawindow->currentSearchState;
- search_attr.u.str = search_string;
-
- search_list_search(datawindow->sl, &search_attr, 0);
- res=search_list_get_result(datawindow->sl);
- }
-
- switch (datawindow->currentSearchState)
- {
- case attr_country_name:
- {
- datawindow->currentSearchState = attr_town_name;
- }
- break;
- case attr_town_name:
- {
- datawindow->currentSearchState = attr_street_name;
- }
- break;
- case attr_street_name:
- {
- navit_set_destination(datawindow->nav, res->c, "Mein Test");
- DestroyWindow(datawindow->hwnd);
- }
- break;
- default:
- break;
-
- }
-
- setlayout(datawindow);
-
-}
-
-static void notify_back(struct datawindow_priv *datawindow, int param1, int param2)
-{
- switch (datawindow->currentSearchState)
- {
- case attr_country_name:
- break;
- case attr_town_name:
- {
- datawindow->currentSearchState = attr_country_name;
- }
- break;
- case attr_street_name:
- {
- datawindow->currentSearchState = attr_town_name;
- }
- break;
- default:
- break;
-
- }
-
- setlayout(datawindow);
-}
-
-static void notify_textchange(struct datawindow_priv *datawindow, int param1, int param2)
-{
-
- struct attr search_attr;
- struct search_list_result *res;
-
- int lineLength = Edit_LineLength(datawindow->hwndEdit, 0);
- TCHAR line[lineLength + 1];
- (void)Edit_GetLine(datawindow->hwndEdit, 0, line, lineLength + 1);
- line[lineLength] = 0;
-
-
- (void)ListView_DeleteAllItems( datawindow->hwndList);
-
- TCHAR_TO_UTF8(line, search_string);
-
- search_attr.type = datawindow->currentSearchState;
- search_attr.u.str = search_string;
-
- if (lineLength<1)
- return;
-
- search_list_search(datawindow->sl, &search_attr, 1);
-
-
- TCHAR *tcharBuffer = NULL;
- int listIndex = 0;
- LVITEM lvI;
-
- lvI.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE;
- lvI.state = 0;
- lvI.stateMask = 0;
-
- while ((res=search_list_get_result(datawindow->sl)) && listIndex < 50)
- {
-
- switch (search_attr.type)
- {
- case attr_country_name:
- tcharBuffer = newSysString(res->country->name);
- break;
- case attr_town_name:
- tcharBuffer = newSysString(res->town->name);
- break;
- case attr_street_name:
- if (res->street->name)
- {
- tcharBuffer = newSysString(res->street->name);
- }
- else
- {
- continue;
- }
- break;
- default:
- dbg(0, "Unhandled search type");
- }
-
- lvI.iItem = listIndex;
- lvI.iImage = listIndex;
- lvI.iSubItem = 0;
- lvI.lParam = (LPARAM) res->country->iso2;
- UTF8_TO_TCHAR(res->country->iso2, converted_iso2);
- lvI.pszText = converted_iso2;//LPSTR_TEXTCALLBACK; // sends an LVN_GETDISP message.
- (void)ListView_InsertItem(datawindow->hwndList, &lvI);
- ListView_SetItemText(datawindow->hwndList, listIndex, 1, tcharBuffer);
- g_free(tcharBuffer);
- dbg(0,"%s\n", res->country->name);
- listIndex++;
- }
-}
-
-static void notify_destroy(struct datawindow_priv *datawindow, int param1, int param2)
-{
- if ( datawindow )
- {
- search_list_destroy(datawindow->sl);
- g_free(datawindow);
- }
-}
-
-static void notify_size(struct datawindow_priv *datawindow, int width, int height)
-{
- if (datawindow)
- {
- MoveWindow(datawindow->hwndLabel,
- 0, 0, // starting x- and y-coordinates
- width, // width of client area
- 20, // height of client area
- TRUE); // repaint window
- MoveWindow(datawindow->hwndEdit,
- 0, 20, // starting x- and y-coordinates
- width, // width of client area
- 20, // height of client area
- TRUE); // repaint window
- MoveWindow(datawindow->hwndList,
- 0, 40, // starting x- and y-coordinates
- width, // width of client area
- height - 60, // height of client area
- TRUE); // repaint window
- MoveWindow(datawindow->hwndButtonPrev,
- 0, height - 20, // starting x- and y-coordinates
- width/2, // width of client area
- 20, // height of client area
- TRUE); // repaint window
- MoveWindow(datawindow->hwndButtonNext,
- width/2, height - 20, // starting x- and y-coordinates
- width/2, // width of client area
- 20, // height of client area
- TRUE); // repaint window
-
- setlayout(datawindow);
-
- }
-}
-
-static BOOL init_lv_columns(HWND hWndListView)
-{
-
-// struct LVCOLUMN lvc = {LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM,
-// LVCFMT_LEFT, 100, szText[iCol], 0, iCol, 0, 0 };
-
- TCHAR szText[][8] = {TEXT("Iso"),TEXT("Country")}; // temporary buffer
- LVCOLUMN lvc;
- int iCol;
-
- lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
-
- for (iCol = 0; iCol < 2; iCol++)
- {
- lvc.iSubItem = iCol;
- lvc.pszText = szText[iCol];
- lvc.cx = 50; // width of column in pixels
-
- if ( iCol < 2 )
- lvc.fmt = LVCFMT_LEFT; // left-aligned column
- else
- lvc.fmt = LVCFMT_RIGHT; // right-aligned column
-
- if (ListView_InsertColumn(hWndListView, iCol, &lvc) == -1)
- return FALSE;
- }
- return TRUE;
-}
-
-BOOL register_destination_window()
-{
- WNDCLASS wc;
-
- wc.style = 0;
- wc.lpfnWndProc = message_handler;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 32;
- wc.hInstance = NULL;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = g_szDestinationClassName;
- wc.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_NAVIT));
-
- if (!RegisterClass(&wc))
- {
- dbg(0, "Window Registration Failed!\n");
- return FALSE;
- }
- return TRUE;
-}
-
-HANDLE create_destination_window( struct navit *nav )
-{
-
-
- struct datawindow_priv *this_;
-
- this_=g_new0(struct datawindow_priv, 1);
- this_->nav = nav;
- this_->currentSearchState = attr_country_name;
- this_->sl=search_list_new(navit_get_mapset(this_->nav));
-
- this_->hwnd = CreateWindowEx(
- WS_EX_CLIENTEDGE,
- g_szDestinationClassName,
- TEXT("Destination Input"),
-#if defined(__CEGCC__)
- WS_SYSMENU | WS_CLIPCHILDREN,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
-#else
- WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
- CW_USEDEFAULT, CW_USEDEFAULT, 640, 480,
-#endif
- NULL, NULL, NULL, NULL);
-
- if (this_->hwnd == NULL)
- {
- dbg(0, "Window Creation Failed!\n");
- return 0;
- }
-
- this_->notifications = win32_gui_notify_new(this_);
- SetWindowLongPtr( this_->hwnd , DWLP_USER, (LONG_PTR) this_->notifications );
-
- this_->hwndLabel = CreateWindow(WC_STATIC, // predefined class
- TEXT("Country"), // no window title
- WS_CHILD | WS_VISIBLE | ES_LEFT , //| WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL
- 0, 0, 0, 0, // set size in WM_SIZE message
- this_->hwnd, // parent window
- NULL,//(HMENU) ID_EDITCHILD, // edit control ID
- (HINSTANCE) GetWindowLong(this_->hwnd, GWL_HINSTANCE),
- NULL); // pointer not needed
-
- this_->hwndEdit = CreateWindow(WC_EDIT, // predefined class
- NULL, // no window title
- WS_CHILD | WS_VISIBLE | ES_LEFT | WS_BORDER , //| WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL
- 0, 0, 0, 0, // set size in WM_SIZE message
- this_->hwnd, // parent window
- NULL,//(HMENU) ID_EDITCHILD, // edit control ID
- (HINSTANCE) GetWindowLong(this_->hwnd, GWL_HINSTANCE),
- NULL); // pointer not needed
-
- this_->hwndList = CreateWindow(WC_LISTVIEW, // predefined class
- NULL, // no window title
- WS_CHILD | WS_VISIBLE | ES_LEFT | WS_BORDER | LVS_REPORT , //| WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL
- 0, 0, 0, 0, // set size in WM_SIZE message
- this_->hwnd, // parent window
- NULL,//(HMENU) ID_EDITCHILD, // edit control ID
- (HINSTANCE) GetWindowLong(this_->hwnd, GWL_HINSTANCE),
- NULL); // pointer not needed
-
- this_->hwndButtonPrev = CreateWindow(WC_BUTTON, // predefined class
- TEXT("<<"), // no window title
- WS_CHILD | WS_VISIBLE | ES_LEFT | WS_BORDER | LVS_REPORT , //| WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL
- 0, 0, 0, 0, // set size in WM_SIZE message
- this_->hwnd, // parent window
- NULL,//(HMENU) ID_EDITCHILD, // edit control ID
- (HINSTANCE) GetWindowLong(this_->hwnd, GWL_HINSTANCE),
- NULL); // pointer not needed
- this_->hwndButtonNext = CreateWindow(WC_BUTTON, // predefined class
- TEXT(">>"), // no window title
- WS_CHILD | WS_VISIBLE | ES_LEFT | WS_BORDER | LVS_REPORT , //| WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL
- 0, 0, 0, 0, // set size in WM_SIZE message
- this_->hwnd, // parent window
- NULL,//(HMENU) ID_EDITCHILD, // edit control ID
- (HINSTANCE) GetWindowLong(this_->hwnd, GWL_HINSTANCE),
- NULL); // pointer not needed
-#if 0
- (void)ListView_SetExtendedListViewStyle(this_->hwndList,LVS_EX_FULLROWSELECT);
-#endif
-
-
- win32_gui_notify( this_->notifications, this_->hwndEdit, CHANGE, notify_textchange);
- win32_gui_notify( this_->notifications, NULL, WINDOW_SIZE, notify_size);
- win32_gui_notify( this_->notifications, this_->hwndList, DBLCLICK, notify_apply);
- win32_gui_notify( this_->notifications, this_->hwnd, WINDOW_DESTROY, notify_destroy);
-
- win32_gui_notify( this_->notifications, this_->hwndButtonNext, BUTTON_CLICK, notify_apply);
- win32_gui_notify( this_->notifications, this_->hwndButtonPrev, BUTTON_CLICK, notify_back);
-
- init_lv_columns(this_->hwndList);
- SetFocus(this_->hwndEdit);
- ShowWindow(this_->hwnd, TRUE);
- UpdateWindow(this_->hwnd);
-
- return this_->hwnd;
-}
-
diff --git a/navit/gui/win32/win32_gui_notify.c b/navit/gui/win32/win32_gui_notify.c
deleted file mode 100644
index bd50f140..00000000
--- a/navit/gui/win32/win32_gui_notify.c
+++ /dev/null
@@ -1,132 +0,0 @@
-#include <windows.h>
-#include <windowsx.h>
-#include <commctrl.h>
-#include <glib.h>
-#include "win32_gui_notify.h"
-
-struct window_data
-{
- HWND hwnd;
- UINT message;
- void(*func)(struct datawindow_priv *parent, int param1, int param2);
-};
-
-struct notify_priv
-{
- GList *window_list;
- struct datawindow_priv *parent;
-
-};
-
-
-void win32_gui_notify(struct notify_priv* notify, HWND hwnd, int message_id, void(*func)(struct datawindow_priv *parent, int param1, int param2))
-{
- struct window_data *wnd_data = g_new( struct window_data,1);
-
- wnd_data->hwnd = hwnd;
- wnd_data->message = message_id;
- wnd_data->func = func;
-
- notify->window_list = g_list_append( notify->window_list, (gpointer) wnd_data );
-
-}
-
-struct notify_priv* win32_gui_notify_new(struct datawindow_priv *parent)
-{
- struct notify_priv* notify = g_new0(struct notify_priv,1);
- notify->parent = parent;
- return notify;
-}
-
-LRESULT CALLBACK message_handler(HWND hwnd, UINT win_message, WPARAM wParam, LPARAM lParam)
-{
- enum message_id message = INVALID;
- int param1 = -1;
- int param2 = -1;
- HWND hwndDlg = hwnd;
-
- switch (win_message)
- {
- case WM_CREATE:
- {
- message = WINDOW_CREATE;
- }
- break;
- case WM_SIZE:
- {
- message = WINDOW_SIZE;
- param1 = LOWORD(lParam);
- param2 = HIWORD(lParam);
- }
- break;
- case WM_DESTROY:
- {
- message = WINDOW_DESTROY;
- }
- break;
- case WM_NOTIFY:
- {
- hwndDlg = (((LPNMHDR)lParam)->hwndFrom);
- switch (((LPNMHDR)lParam)->code)
- {
- case NM_DBLCLK:
- {
- message = DBLCLICK;
-#if 0
- param1 = ((LPNMITEMACTIVATE)lParam)->iItem;
-#endif
- }
- break;
- case NM_CLICK:
- message = CLICK;
- break;
- }
- }
- break;
- case WM_COMMAND:
- {
- hwndDlg = (HWND)lParam;
-
- switch (HIWORD(wParam))
- {
- case EN_CHANGE:
- {
- message = CHANGE;
- }
- break;
- case BN_CLICKED:
- {
- message = BUTTON_CLICK;
- }
- break;
- }
- }
- break;
-
- default:
- return DefWindowProc(hwnd, win_message, wParam, lParam);
- }
-
- struct notify_priv* notify_data = (struct notify_priv*)GetWindowLongPtr( hwnd , DWLP_USER );
-
- if ( message != INVALID && notify_data && notify_data->window_list )
- {
-
- GList* current_element = g_list_first(notify_data->window_list);
-
-
- struct window_data* wnd_data = NULL;
- while (current_element != NULL)
- {
- wnd_data = current_element->data;
-
- if ( (wnd_data->hwnd == hwndDlg || wnd_data->hwnd == NULL) && message == wnd_data->message)
- {
- wnd_data->func(notify_data->parent, param1, param2);
- }
-
- current_element = g_list_next(current_element);
- }
- }
- return FALSE;
-}
diff --git a/navit/item.c b/navit/item.c
deleted file mode 100644
index 52b6a238..00000000
--- a/navit/item.c
+++ /dev/null
@@ -1,153 +0,0 @@
-#include <string.h>
-#include <glib.h>
-#include "coord.h"
-#include "debug.h"
-#include "item.h"
-
-struct item_name {
- enum item_type item;
- char *name;
-};
-
-
-struct item_name item_names[]={
-#define ITEM2(x,y) ITEM(y)
-#define ITEM(x) { type_##x, #x },
-#include "item_def.h"
-#undef ITEM2
-#undef ITEM
-};
-
-void
-item_coord_rewind(struct item *it)
-{
- it->meth->item_coord_rewind(it->priv_data);
-}
-
-int
-item_coord_get(struct item *it, struct coord *c, int count)
-{
- return it->meth->item_coord_get(it->priv_data, c, count);
-}
-
-int
-item_coord_is_segment(struct item *it)
-{
- if (it->meth->item_coord_is_segment)
- return it->meth->item_coord_is_segment(it->priv_data);
- return 0;
-}
-
-void
-item_attr_rewind(struct item *it)
-{
- it->meth->item_attr_rewind(it->priv_data);
-}
-int
-item_attr_get(struct item *it, enum attr_type attr_type, struct attr *attr)
-{
- return it->meth->item_attr_get(it->priv_data, attr_type, attr);
-}
-
-struct item * item_new(char *type, int zoom)
-{
- struct item * it;
-
- it = g_new0(struct item, 1);
-
- /* FIXME evaluate arguments */
-
- return it;
-}
-
-enum item_type
-item_from_name(const char *name)
-{
- int i;
-
- for (i=0 ; i < sizeof(item_names)/sizeof(struct item_name) ; i++) {
- if (! strcmp(item_names[i].name, name))
- return item_names[i].item;
- }
- return type_none;
-}
-
-char *
-item_to_name(enum item_type item)
-{
- int i;
-
- for (i=0 ; i < sizeof(item_names)/sizeof(struct item_name) ; i++) {
- if (item_names[i].item == item)
- return item_names[i].name;
- }
- return NULL;
-}
-
-struct item_hash {
- GHashTable *h;
-};
-
-static guint
-item_hash_hash(gconstpointer key)
-{
- const struct item *itm=key;
- gconstpointer hashkey=(gconstpointer)(itm->id_hi^itm->id_lo^((int) itm->map));
- return g_direct_hash(hashkey);
-}
-
-static gboolean
-item_hash_equal(gconstpointer a, gconstpointer b)
-{
- const struct item *itm_a=a;
- const struct item *itm_b=b;
- if (item_is_equal(*itm_a, *itm_b))
- return TRUE;
- return FALSE;
-}
-
-
-
-struct item_hash *
-item_hash_new(void)
-{
- struct item_hash *ret=g_new(struct item_hash, 1);
-
- ret->h=g_hash_table_new_full(item_hash_hash, item_hash_equal, g_free, NULL);
- return ret;
-}
-
-void
-item_hash_insert(struct item_hash *h, struct item *item, void *val)
-{
- struct item *hitem=g_new(struct item, 1);
- *hitem=*item;
- dbg(2,"inserting (0x%x,0x%x) into %p\n", item->id_hi, item->id_lo, h->h);
- g_hash_table_insert(h->h, hitem, val);
-}
-
-int
-item_hash_remove(struct item_hash *h, struct item *item)
-{
- int ret;
-
- dbg(2,"removing (0x%x,0x%x) from %p\n", item->id_hi, item->id_lo, h->h);
- ret=g_hash_table_remove(h->h, item);
- dbg(2,"ret=%d\n", ret);
-
- return ret;
-}
-
-void *
-item_hash_lookup(struct item_hash *h, struct item *item)
-{
- return g_hash_table_lookup(h->h, item);
-}
-
-
-void
-item_hash_destroy(struct item_hash *h)
-{
- g_hash_table_destroy(h->h);
- g_free(h);
-}
diff --git a/navit/item.h b/navit/item.h
deleted file mode 100644
index 448df2ec..00000000
--- a/navit/item.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef NAVIT_ITEM_H
-#define NAVIT_ITEM_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum item_type {
-#define ITEM2(x,y) type_##y=x,
-#define ITEM(x) type_##x,
-#include "item_def.h"
-#undef ITEM2
-#undef ITEM
-};
-
-#include "attr.h"
-
-#define item_is_equal_id(a,b) ((a).id_hi == (b).id_hi && (a).id_lo == (b).id_lo)
-#define item_is_equal(a,b) (item_is_equal_id(a,b) && (a).map == (b).map)
-
-struct coord;
-
-struct item_methods {
- void (*item_coord_rewind)(void *priv_data);
- int (*item_coord_get)(void *priv_data, struct coord *c, int count);
- void (*item_attr_rewind)(void *priv_data);
- int (*item_attr_get)(void *priv_data, enum attr_type attr_type, struct attr *attr);
- int (*item_coord_is_segment)(void *priv_data);
-};
-
-struct item {
- enum item_type type;
- int id_hi;
- int id_lo;
- struct map *map;
- struct item_methods *meth;
- void *priv_data;
-};
-
-/* prototypes */
-enum attr_type;
-enum item_type;
-struct attr;
-struct coord;
-struct item;
-struct item_hash;
-void item_coord_rewind(struct item *it);
-int item_coord_get(struct item *it, struct coord *c, int count);
-/* does the next returned coordinate mark a segment */
-int item_coord_is_segment(struct item *it);
-void item_attr_rewind(struct item *it);
-int item_attr_get(struct item *it, enum attr_type attr_type, struct attr *attr);
-struct item *item_new(char *type, int zoom);
-enum item_type item_from_name(const char *name);
-char *item_to_name(enum item_type item);
-struct item_hash *item_hash_new(void);
-void item_hash_insert(struct item_hash *h, struct item *item, void *val);
-int item_hash_remove(struct item_hash *h, struct item *item);
-void *item_hash_lookup(struct item_hash *h, struct item *item);
-void item_hash_destroy(struct item_hash *h);
-/* end of prototypes */
-
-
-#ifdef __cplusplus
-}
-/* __cplusplus */
-#endif
-
-/* NAVIT_ITEM_H */
-#endif
diff --git a/navit/item_def.h b/navit/item_def.h
deleted file mode 100644
index add50340..00000000
--- a/navit/item_def.h
+++ /dev/null
@@ -1,406 +0,0 @@
-/* This file is generated from http://wiki.navit-project.org/index.php/Item_def.h, do not edit it, edit the wiki page instead */
-ITEM2(0x00000000,none)
-ITEM2(0x00000001,point_unspecified)
-ITEM(town_streets)
-ITEM(street_name)
-ITEM(street_name_numbers)
-ITEM(street_number)
-/* Point */
-ITEM2(0x00010000,town_label)
-ITEM2(0x00010001,town_label_0e0)
-ITEM2(0x00010002,town_label_1e0)
-ITEM2(0x00010003,town_label_2e0)
-ITEM2(0x00010004,town_label_5e0)
-ITEM2(0x00010005,town_label_1e1)
-ITEM2(0x00010006,town_label_2e1)
-ITEM2(0x00010007,town_label_5e1)
-ITEM2(0x00010008,town_label_1e2)
-ITEM2(0x00010009,town_label_2e2)
-ITEM2(0x0001000a,town_label_5e2)
-ITEM2(0x0001000b,town_label_1e3)
-ITEM2(0x0001000c,town_label_2e3)
-ITEM2(0x0001000d,town_label_5e3)
-ITEM2(0x0001000e,town_label_1e4)
-ITEM2(0x0001000f,town_label_2e4)
-ITEM2(0x00010010,town_label_5e4)
-ITEM2(0x00010011,town_label_1e5)
-ITEM2(0x00010012,town_label_2e5)
-ITEM2(0x00010013,town_label_5e5)
-ITEM2(0x00010014,town_label_1e6)
-ITEM2(0x00010015,town_label_2e6)
-ITEM2(0x00010016,town_label_5e6)
-ITEM2(0x00010017,town_label_1e7)
-ITEM2(0x00010100,district_label)
-ITEM2(0x00010101,district_label_0e0)
-ITEM2(0x00010102,district_label_1e0)
-ITEM2(0x00010103,district_label_2e0)
-ITEM2(0x00010104,district_label_5e0)
-ITEM2(0x00010105,district_label_1e1)
-ITEM2(0x00010106,district_label_2e1)
-ITEM2(0x00010107,district_label_5e1)
-ITEM2(0x00010108,district_label_1e2)
-ITEM2(0x00010109,district_label_2e2)
-ITEM2(0x0001010a,district_label_5e2)
-ITEM2(0x0001010b,district_label_1e3)
-ITEM2(0x0001010c,district_label_2e3)
-ITEM2(0x0001010d,district_label_5e3)
-ITEM2(0x0001010e,district_label_1e4)
-ITEM2(0x0001010f,district_label_2e4)
-ITEM2(0x00010110,district_label_5e4)
-ITEM2(0x00010111,district_label_1e5)
-ITEM2(0x00010112,district_label_2e5)
-ITEM2(0x00010113,district_label_5e5)
-ITEM2(0x00010114,district_label_1e6)
-ITEM2(0x00010115,district_label_2e6)
-ITEM2(0x00010116,district_label_5e6)
-ITEM2(0x00010117,district_label_1e7)
-ITEM(country_label)
-ITEM(town_ghost)
-ITEM(highway_exit_label)
-ITEM(port_label)
-ITEM(label_unkn)
-ITEM(highway_exit)
-ITEM(poi_lake)
-ITEM(poi_island)
-ITEM(poi)
-ITEM(waypoint)
-ITEM(trackpoint)
-ITEM(bookmark)
-ITEM(former_destination)
-ITEM(poi_land_feature)
-ITEM(poi_cape)
-ITEM(poi_rock)
-ITEM(poi_airport)
-ITEM(poi_toll_booth)
-ITEM(poi_fuel)
-ITEM(poi_hotel)
-ITEM(poi_camp_rv)
-ITEM(poi_marina)
-ITEM(poi_attraction)
-ITEM(poi_museum_history)
-ITEM(poi_shopping)
-ITEM(poi_car_dealer_parts)
-ITEM(poi_car_parking)
-ITEM(poi_wreck)
-ITEM(poi_building)
-ITEM(poi_bridge)
-ITEM(poi_park)
-ITEM(poi_water_feature)
-ITEM(poi_bar)
-ITEM(poi_picnic)
-ITEM(poi_hospital)
-ITEM(poi_camping)
-ITEM(poi_public_utilities)
-ITEM(poi_burgerking)
-ITEM(poi_kfc)
-ITEM(poi_mcdonalds)
-ITEM(poi_wienerwald)
-ITEM(poi_dining)
-ITEM(poi_fastfood)
-ITEM(poi_police)
-ITEM(poi_auto_club)
-ITEM(poi_autoservice)
-ITEM(poi_bank)
-ITEM(poi_bay)
-ITEM(poi_bend)
-ITEM(poi_boat_ramp)
-ITEM(poi_border_station)
-ITEM(poi_bowling)
-ITEM(poi_bus_station)
-ITEM(poi_bus_stop)
-ITEM(poi_bussines_service)
-ITEM(poi_car_rent)
-ITEM(poi_car_wash)
-ITEM(poi_casino)
-ITEM(poi_cemetery)
-ITEM(poi_church)
-ITEM(poi_cinema)
-ITEM(poi_civil)
-ITEM(poi_communication)
-ITEM(poi_concert)
-ITEM(poi_cove)
-ITEM(poi_crossing)
-ITEM(poi_dam)
-ITEM(poi_danger_area)
-ITEM(poi_dangerous)
-ITEM(poi_daymark)
-ITEM(poi_diving)
-ITEM(poi_drinking_water)
-ITEM(poi_emergency)
-ITEM(poi_fair)
-ITEM(poi_firebrigade)
-ITEM(poi_fish)
-ITEM(poi_forbiden_area)
-ITEM(poi_garmin)
-ITEM(poi_golf)
-ITEM(poi_goverment_building)
-ITEM(poi_height)
-ITEM(poi_heliport)
-ITEM(poi_hotspring)
-ITEM(poi_icesport)
-ITEM(poi_information)
-ITEM(poi_justice)
-ITEM(poi_landmark)
-ITEM(poi_levee)
-ITEM(poi_library)
-ITEM(poi_locale)
-ITEM(poi_loudspeaker)
-ITEM(poi_mall)
-ITEM(poi_manmade_feature)
-ITEM(poi_marine)
-ITEM(poi_marine_type)
-ITEM(poi_mark)
-ITEM(poi_military)
-ITEM(poi_mine)
-ITEM(poi_nondangerous)
-ITEM(poi_oil_field)
-ITEM(poi_personal_service)
-ITEM(poi_pharmacy)
-ITEM(poi_post)
-ITEM(poi_public_office)
-ITEM(poi_repair_service)
-ITEM(poi_resort)
-ITEM(poi_rest_room)
-ITEM(poi_restaurant)
-ITEM(poi_restricted_area)
-ITEM(poi_restroom)
-ITEM(poi_sailing)
-ITEM(poi_scenic_area)
-ITEM(poi_school)
-ITEM(poi_service)
-ITEM(poi_shop_apparel)
-ITEM(poi_shop_computer)
-ITEM(poi_shop_department)
-ITEM(poi_shop_furnish)
-ITEM(poi_shop_grocery)
-ITEM(poi_shop_handg)
-ITEM(poi_shop_merchandise)
-ITEM(poi_shop_retail)
-ITEM(poi_shower)
-ITEM(poi_skiing)
-ITEM(poi_social_service)
-ITEM(poi_sounding)
-ITEM(poi_sport)
-ITEM(poi_stadium)
-ITEM(poi_subdivision)
-ITEM(poi_swimming)
-ITEM(poi_telephone)
-ITEM(poi_theater)
-ITEM(poi_tide)
-ITEM(poi_tower)
-ITEM(poi_trail)
-ITEM(poi_truck_stop)
-ITEM(poi_tunnel)
-ITEM(poi_wine)
-ITEM(poi_worship)
-ITEM(poi_wrecker)
-ITEM(poi_zoo)
-ITEM(rg_point)
-ITEM(point_unkn)
-ITEM(traffic_signals)
-ITEM(poi_gc_multi)
-ITEM(poi_gc_tradi)
-ITEM(poi_gc_event)
-ITEM(poi_gc_mystery)
-ITEM(poi_gc_question)
-ITEM(poi_gc_stages)
-ITEM(poi_gc_reference)
-ITEM(poi_gc_webcam)
-ITEM(poi_cafe)
-ITEM(nav_straight)
-ITEM(nav_turnaround)
-ITEM(nav_right_1)
-ITEM(nav_right_2)
-ITEM(nav_right_3)
-ITEM(nav_left_1)
-ITEM(nav_left_2)
-ITEM(nav_left_3)
-ITEM(nav_roundabout_r1)
-ITEM(nav_roundabout_r2)
-ITEM(nav_roundabout_r3)
-ITEM(nav_roundabout_r4)
-ITEM(nav_roundabout_r5)
-ITEM(nav_roundabout_r6)
-ITEM(nav_roundabout_r7)
-ITEM(nav_roundabout_r8)
-ITEM(nav_roundabout_l1)
-ITEM(nav_roundabout_l2)
-ITEM(nav_roundabout_l3)
-ITEM(nav_roundabout_l4)
-ITEM(nav_roundabout_l5)
-ITEM(nav_roundabout_l6)
-ITEM(nav_roundabout_l7)
-ITEM(nav_roundabout_l8)
-ITEM(poi_peak)
-ITEM(poi_rail_station)
-ITEM(poi_image)
-ITEM(mini_roundabout)
-ITEM(turning_circle)
-ITEM(poi_townhall)
-ITEM(poi_level_crossing)
-ITEM(poi_rail_halt)
-ITEM(poi_rail_tram_stop)
-/* Line */
-ITEM2(0x80000000,line)
-ITEM2(0x80000001,line_unspecified)
-ITEM(border_country)
-ITEM(border_state)
-ITEM(rail)
-ITEM(water_line)
-ITEM(street_nopass)
-ITEM(street_0)
-ITEM(street_1_city)
-ITEM(street_2_city)
-ITEM(street_3_city)
-ITEM(street_4_city)
-ITEM(highway_city)
-ITEM(street_1_land)
-ITEM(street_2_land)
-ITEM(street_3_land)
-ITEM(street_4_land)
-ITEM(street_n_lanes)
-ITEM(highway_land)
-ITEM(ramp)
-ITEM(ferry)
-ITEM(roadbook)
-ITEM(street_unkn)
-ITEM(street_route)
-ITEM(height_line_1)
-ITEM(height_line_2)
-ITEM(track)
-ITEM(height_line_3)
-ITEM(depth_line_1)
-ITEM(depth_line_2)
-ITEM(depth_line_3)
-ITEM(powerline)
-ITEM(pipeline)
-ITEM(time_zone)
-ITEM(marine_boundary)
-ITEM(marine_hazard)
-ITEM(roundabout)
-ITEM(rg_segment)
-ITEM(aeroway_runway)
-ITEM(aeroway_taxiway)
-ITEM(street_service)
-ITEM(coverage)
-ITEM(street_pedestrian)
-ITEM(bridge)
-ITEM(tunnel)
-ITEM(bridleway)
-ITEM(cycleway)
-ITEM(footway)
-ITEM(steps)
-ITEM(track_paved)
-ITEM(track_gravelled)
-ITEM(track_unpaved)
-ITEM(track_ground)
-ITEM(track_grass)
-ITEM(rail_narrow_gauge)
-ITEM(rail_light)
-ITEM(rail_subway)
-ITEM(rail_mono)
-ITEM(rail_tram)
-ITEM(rail_preserved)
-ITEM(rail_disused)
-ITEM(rail_abandoned)
-ITEM(lift_cable_car)
-ITEM(lift_chair)
-ITEM(lift_drag)
-ITEM(living_street)
-ITEM(bus_guideway)
-ITEM(street_construction)
-ITEM(border_civil)
-ITEM(border_political)
-ITEM(border_national_park)
-ITEM(water_river)
-ITEM(water_canal)
-ITEM(water_stream)
-ITEM(water_drain)
-/* Area */
-ITEM2(0xc0000000,area)
-ITEM2(0xc0000001,area_unspecified)
-ITEM(poly_wood)
-ITEM(poly_water)
-ITEM(poly_town)
-ITEM(poly_cemetery)
-ITEM(poly_car_parking)
-ITEM(poly_industry)
-ITEM(poly_airport)
-ITEM(poly_hospital)
-ITEM(poly_park)
-ITEM(poly_sport)
-ITEM(poly_museum)
-ITEM(image)
-ITEM(image_path)
-ITEM(poly_commercial_center)
-ITEM(poly_golf_course)
-ITEM(poly_university)
-ITEM(poly_national_park)
-ITEM(poly_nature_park)
-ITEM(poly_flats)
-ITEM(poly_scrub)
-ITEM(poly_military_zone)
-ITEM(poly_marine)
-ITEM(plantation)
-ITEM(tundra)
-ITEM(tile)
-ITEM(submap)
-ITEM(poly_building)
-ITEM(poly_place)
-ITEM(poly_station)
-ITEM(poly_farm)
-ITEM(poly_sport_tennis)
-ITEM(poly_apron)
-ITEM(poly_terminal)
-ITEM(countryindex)
-ITEM(poly_sports_centre)
-ITEM(poly_sports_stadium)
-ITEM(poly_sports_track)
-ITEM(poly_sports_pitch)
-ITEM(poly_water_park)
-ITEM(poly_marina)
-ITEM(poly_fishing)
-ITEM(poly_theme_park)
-ITEM(poly_attraction)
-ITEM(poly_ruins)
-ITEM(poly_archaeological_site)
-ITEM(poly_artwork)
-ITEM(poly_zoo)
-ITEM(poly_camp_site)
-ITEM(poly_caravan_site)
-ITEM(poly_picnic_site)
-ITEM(poly_playground)
-ITEM(poly_allotments)
-ITEM(poly_village_green)
-ITEM(poly_recreation_ground)
-ITEM(poly_common)
-ITEM(poly_garden)
-ITEM(poly_nature_reserve)
-ITEM(poly_glacier)
-ITEM(poly_scree)
-ITEM(poly_fell)
-ITEM(poly_heath)
-ITEM(poly_marsh)
-ITEM(poly_mud)
-ITEM(poly_land)
-ITEM(poly_beach)
-ITEM(poly_quarry)
-ITEM(poly_landfill)
-ITEM(poly_retail)
-ITEM(poly_commercial)
-ITEM(poly_brownfield)
-ITEM(poly_greenfield)
-ITEM(poly_construction)
-ITEM(poly_railway)
-ITEM(poly_military)
-ITEM(poly_airfield)
-ITEM(poly_barracks)
-ITEM(poly_danger_area)
-ITEM(poly_range)
-ITEM(poly_naval_base)
-ITEM(poly_basin)
-ITEM(poly_reservoir)
-ITEM(poly_college)
-ITEM(poly_battlefield)
-ITEM(poly_pedestrian)
-ITEM(poly_plaza)
diff --git a/navit/layer.h b/navit/layer.h
deleted file mode 100644
index 4d602126..00000000
--- a/navit/layer.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef NAVIT_LAYER_H
-#define NAVIT_LAYER_H
-
-enum layer_type {
- layer_town=0,
- layer_street,
- layer_poly,
- layer_end,
-};
-
-#endif
-
diff --git a/navit/layout.c b/navit/layout.c
deleted file mode 100644
index 4b3d85cd..00000000
--- a/navit/layout.c
+++ /dev/null
@@ -1,139 +0,0 @@
-#include <glib.h>
-#include <string.h>
-#include "layout.h"
-
-struct layout * layout_new(const char *name, struct color *color)
-{
- struct layout *l;
-
- l = g_new0(struct layout, 1);
- l->name = g_strdup(name);
- l->color = g_new0(struct color,1);
- *(l->color) = *color;
- return l;
-}
-
-
-struct layer * layer_new(const char *name, int details)
-{
- struct layer *l;
-
- l = g_new0(struct layer, 1);
- l->name = g_strdup(name);
- l->details = details;
- return l;
-}
-
-void layout_add_layer(struct layout *layout, struct layer *layer)
-{
- layout->layers = g_list_append(layout->layers, layer);
-}
-
-struct itemtype * itemtype_new(int order_min, int order_max)
-{
- struct itemtype *itm;
-
- itm = g_new0(struct itemtype, 1);
- itm->order_min=order_min;
- itm->order_max=order_max;
- return itm;
-}
-
-void itemtype_add_type(struct itemtype *this, enum item_type type)
-{
- this->type = g_list_append(this->type, GINT_TO_POINTER(type));
-}
-
-
-void layer_add_itemtype(struct layer *layer, struct itemtype * itemtype)
-{
- layer->itemtypes = g_list_append(layer->itemtypes, itemtype);
-
-}
-
-void itemtype_add_element(struct itemtype *itemtype, struct element *element)
-{
- itemtype->elements = g_list_append(itemtype->elements, element);
-}
-
-struct element *
-polygon_new(struct color *color)
-{
- struct element *e;
- e = g_new0(struct element, 1);
- e->type=element_polygon;
- e->color=*color;
-
- return e;
-}
-
-struct element *
-polyline_new(struct color *color, int width, int directed,
- int *dash_table, int dash_num)
-{
- struct element *e;
- int i;
-
- e = g_new0(struct element, 1);
- e->type=element_polyline;
- e->color=*color;
- e->u.polyline.width=width;
- e->u.polyline.directed=directed;
- e->u.polyline.dash_num=dash_num;
- for (i=0; i<dash_num; i++)
- e->u.polyline.dash_table[i] = dash_table[i];
-
- return e;
-}
-
-struct element *
-circle_new(struct color *color, int radius, int width, int label_size)
-{
- struct element *e;
-
- e = g_new0(struct element, 1);
- e->type=element_circle;
- e->color=*color;
- e->label_size=label_size;
- e->u.circle.width=width;
- e->u.circle.radius=radius;
-
- return e;
-}
-
-struct element *
-label_new(int label_size)
-{
- struct element *e;
-
- e = g_new0(struct element, 1);
- e->type=element_label;
- e->label_size=label_size;
-
- return e;
-}
-
-struct element *
-icon_new(const char *src)
-{
- struct element *e;
-
- e = g_malloc0(sizeof(*e)+strlen(src)+1);
- e->type=element_icon;
- e->u.icon.src=(char *)(e+1);
- strcpy(e->u.icon.src,src);
-
- return e;
-}
-
-struct element *
-image_new(void)
-{
- struct element *e;
-
- e = g_malloc0(sizeof(*e));
- e->type=element_image;
-
- return e;
-}
-
diff --git a/navit/layout.h b/navit/layout.h
deleted file mode 100644
index 87831004..00000000
--- a/navit/layout.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef NAVIT_LAYOUT_H
-#define NAVIT_LAYOUT_H
-
-#include "item.h"
-#include "color.h"
-
-struct element_line;
-struct element_text;
-
-struct element {
- enum { element_point, element_polyline, element_polygon, element_circle, element_label, element_icon, element_image } type;
- struct color color;
- int label_size;
- union {
- struct element_point {
- } point;
- struct element_polyline {
- int width;
- int directed;
- int dash_num;
- unsigned char dash_table[4];
- } polyline;
- struct element_polygon {
- } polygon;
- struct element_circle {
- int width;
- int radius;
- } circle;
- struct element_icon {
- char *src;
- } icon;
- } u;
-};
-
-
-struct itemtype {
- int order_min, order_max;
- GList *type;
- GList *elements;
-};
-
-struct color;
-
-struct layer { char *name; int details; GList *itemtypes; };
-
-struct layout { char *name; struct color *color; GList *layers; };
-
-/* prototypes */
-enum item_type;
-struct element;
-struct itemtype;
-struct layer;
-struct layout;
-struct layout *layout_new(const char *name, struct color *color);
-struct layer *layer_new(const char *name, int details);
-void layout_add_layer(struct layout *layout, struct layer *layer);
-struct itemtype *itemtype_new(int order_min, int order_max);
-void itemtype_add_type(struct itemtype *this, enum item_type type);
-void layer_add_itemtype(struct layer *layer, struct itemtype *itemtype);
-void itemtype_add_element(struct itemtype *itemtype, struct element *element);
-struct element *polygon_new(struct color *color);
-struct element *polyline_new(struct color *color, int width, int directed,
- int *dash_table, int dash_num);
-struct element *circle_new(struct color *color, int radius, int width, int label_size);
-struct element *label_new(int label_size);
-struct element *icon_new(const char *src);
-struct element *image_new(void);
-
-#endif
-
diff --git a/navit/log.c b/navit/log.c
deleted file mode 100644
index 378b446b..00000000
--- a/navit/log.c
+++ /dev/null
@@ -1,272 +0,0 @@
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <time.h>
-#include <sys/time.h>
-#include <glib.h>
-#include "file.h"
-#include "item.h"
-#include "debug.h"
-#include "log.h"
-
-struct log_data {
- int len;
- int max_len;
- char *data;
-};
-
-struct log {
- FILE *f;
- int overwrite;
- int empty;
- int lazy;
- int mkdir;
- int flush_size;
- int flush_time;
- guint timer;
- struct timeval last_flush;
- char *filename;
- char *filename_ex1;
- char *filename_ex2;
- struct log_data header;
- struct log_data data;
- struct log_data trailer;
- struct attr **attrs;
-};
-
-static void
-strftime_localtime(char *buffer, int size, char *fmt)
-{
- time_t t;
- struct tm *tm;
-
- t=time(NULL);
- tm=localtime(&t);
- strftime(buffer, 4096, fmt, tm);
-}
-
-static void
-expand_filenames(struct log *this_)
-{
- char buffer[4096];
- int i;
-
- strftime_localtime(buffer, 4096, this_->filename);
- this_->filename_ex1=g_strdup(buffer);
- if (strstr(this_->filename_ex1,"%i")) {
- i=0;
- do {
- g_free(this_->filename_ex2);
- this_->filename_ex2=g_strdup_printf(this_->filename_ex1,i++);
- } while (file_exists(this_->filename_ex2));
- } else
- this_->filename_ex2=g_strdup(this_->filename_ex1);
-}
-
-static void
-log_open(struct log *this_)
-{
- char *mode;
- if (this_->overwrite)
- mode="w";
- else
- mode="r+";
- if (this_->mkdir)
- file_mkdir(this_->filename_ex2, 2);
- this_->f=fopen(this_->filename_ex2, mode);
- if (! this_->f)
- this_->f=fopen(this_->filename_ex2, "w");
- if (! this_->f)
- return;
- if (!this_->overwrite)
- fseek(this_->f, 0, SEEK_END);
- this_->empty = !ftell(this_->f);
- gettimeofday(&this_->last_flush, NULL);
-}
-
-static void
-log_close(struct log *this_)
-{
- if (! this_->f)
- return;
- if (this_->trailer.len)
- fwrite(this_->trailer.data, 1, this_->trailer.len, this_->f);
- fflush(this_->f);
- fclose(this_->f);
- this_->f=NULL;
-}
-
-static void
-log_flush(struct log *this_)
-{
- long pos;
- if (this_->lazy && !this_->f) {
- if (!this_->data.len)
- return;
- log_open(this_);
- }
- if (! this_->f)
- return;
- if (this_->empty) {
- if (this_->header.len)
- fwrite(this_->header.data, 1, this_->header.len, this_->f);
- if (this_->header.len || this_->data.len)
- this_->empty=0;
- }
- fwrite(this_->data.data, 1, this_->data.len, this_->f);
- if (this_->trailer.len) {
- pos=ftell(this_->f);
- if (pos > 0) {
- fwrite(this_->trailer.data, 1, this_->trailer.len, this_->f);
- fseek(this_->f, pos, SEEK_SET);
- }
- }
-
- fflush(this_->f);
- g_free(this_->data.data);
- this_->data.data=NULL;
- this_->data.max_len=this_->data.len=0;
- gettimeofday(&this_->last_flush, NULL);
-}
-
-static int
-log_flush_required(struct log *this_)
-{
- return this_->data.len > this_->flush_size;
-}
-
-
-static void
-log_change(struct log *this_)
-{
- log_flush(this_);
- log_close(this_);
- expand_filenames(this_);
- if (! this_->lazy)
- log_open(this_);
-}
-
-static int
-log_change_required(struct log *this_)
-{
- char buffer[4096];
-
- strftime_localtime(buffer, 4096, this_->filename);
- return (strcmp(this_->filename_ex1, buffer) != 0);
-}
-
-static gboolean
-log_timer(gpointer data)
-{
- struct log *this_=data;
- struct timeval tv;
- int delta;
- gettimeofday(&tv, NULL);
- delta=(tv.tv_sec-this_->last_flush.tv_sec)*1000+(tv.tv_usec-this_->last_flush.tv_usec)/1000;
- dbg(1,"delta=%d flush_time=%d\n", delta, this_->flush_time);
- if (this_->flush_time && delta > this_->flush_time*1000)
- log_flush(this_);
- return TRUE;
-}
-
-int
-log_get_attr(struct log *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
-{
- return attr_generic_get_attr(this_->attrs, type, attr, iter);
-}
-
-
-struct log *
-log_new(struct attr **attrs)
-{
- struct log *ret=g_new0(struct log, 1);
- struct attr *data,*overwrite,*lazy,*mkdir,*flush_size,*flush_time;
- struct file_wordexp *wexp;
- char *filename, **wexp_data;
-
- dbg(1,"enter\n");
- data=attr_search(attrs, NULL, attr_data);
- if (! data)
- return NULL;
- filename=data->u.str;
- wexp=file_wordexp_new(filename);
- if (wexp && file_wordexp_get_count(wexp) > 0) {
- wexp_data=file_wordexp_get_array(wexp);
- filename=wexp_data[0];
- }
- if (filename)
- ret->filename=g_strdup(filename);
- if (wexp)
- file_wordexp_destroy(wexp);
- overwrite=attr_search(attrs, NULL, attr_overwrite);
- if (overwrite)
- ret->overwrite=overwrite->u.num;
- lazy=attr_search(attrs, NULL, attr_lazy);
- if (lazy)
- ret->lazy=lazy->u.num;
- mkdir=attr_search(attrs, NULL, attr_mkdir);
- if (mkdir)
- ret->mkdir=mkdir->u.num;
- flush_size=attr_search(attrs, NULL, attr_flush_size);
- if (flush_size)
- ret->flush_size=flush_size->u.num;
- flush_time=attr_search(attrs, NULL, attr_flush_time);
- if (flush_time)
- ret->flush_time=flush_time->u.num;
- if (ret->flush_time) {
- dbg(1,"interval %d\n", ret->flush_time*1000);
- ret->timer=g_timeout_add(ret->flush_time*1000, log_timer, ret);
- }
- expand_filenames(ret);
- if (! ret->lazy)
- log_open(ret);
- ret->attrs=attr_list_dup(attrs);
- return ret;
-}
-
-void
-log_set_header(struct log *this_, char *data, int len)
-{
- this_->header.data=g_malloc(len);
- this_->header.max_len=this_->header.len=len;
- memcpy(this_->header.data, data, len);
-}
-
-void
-log_set_trailer(struct log *this_, char *data, int len)
-{
- this_->trailer.data=g_malloc(len);
- this_->trailer.max_len=this_->trailer.len=len;
- memcpy(this_->trailer.data, data, len);
-}
-
-void
-log_write(struct log *this_, char *data, int len)
-{
- dbg(1,"enter\n");
- if (log_change_required(this_)) {
- dbg(1,"log_change");
- log_change(this_);
- }
- if (this_->data.len + len > this_->data.max_len) {
- dbg(2,"overflow\n");
- this_->data.max_len+=16384;
- this_->data.data=g_realloc(this_->data.data,this_->data.max_len);
- }
- memcpy(this_->data.data+this_->data.len, data, len);
- this_->data.len+=len;
- if (log_flush_required(this_))
- log_flush(this_);
-}
-
-void
-log_destroy(struct log *this_)
-{
- if (this_->timer)
- g_source_remove(this_->timer);
- log_flush(this_);
- log_close(this_);
- g_free(this_);
-}
diff --git a/navit/log.h b/navit/log.h
deleted file mode 100644
index e9dabf30..00000000
--- a/navit/log.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef NAVIT_LOG_H
-#define NAVIT_LOG_H
-/* prototypes */
-enum attr_type;
-struct attr;
-struct attr_iter;
-struct log;
-int log_get_attr(struct log *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
-struct log *log_new(struct attr **attrs);
-void log_set_header(struct log *this_, char *data, int len);
-void log_set_trailer(struct log *this_, char *data, int len);
-void log_write(struct log *this_, char *data, int len);
-void log_destroy(struct log *this_);
-/* end of prototypes */
-#endif
diff --git a/navit/main.c b/navit/main.c
deleted file mode 100644
index bd0dcf58..00000000
--- a/navit/main.c
+++ /dev/null
@@ -1,281 +0,0 @@
-#include <windows.h>
-#include <locale.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <getopt.h>
-#include <string.h>
-#include <signal.h>
-#include <glib.h>
-#include <sys/types.h>
-
-#ifndef _WIN32
-#include <sys/wait.h>
-#include <signal.h>
-#endif
-
-#include <unistd.h>
-#include <libintl.h>
-#include "config.h"
-#include "file.h"
-#include "debug.h"
-#include "main.h"
-#include "navit.h"
-#include "gui.h"
-#include "xmlconfig.h"
-#include "item.h"
-#include "coord.h"
-#include "route.h"
-#include "navigation.h"
-#include "event.h"
-
-#define _(STRING) gettext(STRING)
-
-#if !defined(PREFIX)
-#define PREFIX "/usr/bin"
-#endif
-#if !defined(PATH_MAX)
-#define PATH_MAX 259
-#endif
-struct map_data *map_data_default;
-
-#ifndef _WIN32
-static void sigchld(int sig)
-{
- int status;
- while (waitpid(-1, &status, WNOHANG) > 0);
-}
-#endif
-
-
-gchar *get_home_directory(void)
-{
- static gchar *homedir = NULL;
-
- if (homedir) return homedir;
- homedir = getenv("HOME");
- if (!homedir)
- {
- g_warning("Could not find home directory. Using current directory as home directory.");
- homedir = ".";
- } else {
- homedir=g_strdup(homedir);
- }
- return homedir;
-}
-
-static GList *navit;
-
-struct iter {
- GList *list;
-};
-
-struct iter *
-main_iter_new(void)
-{
- struct iter *ret=g_new0(struct iter, 1);
- ret->list=navit;
- return ret;
-}
-
-void
-main_iter_destroy(struct iter *iter)
-{
- g_free(iter);
-}
-
-struct navit *
-main_get_navit(struct iter *iter)
-{
- GList *list;
- struct navit *ret=NULL;
- if (iter)
- list=iter->list;
- else
- list=navit;
- if (list) {
- ret=(struct navit *)(list->data);
- if (iter)
- iter->list=g_list_next(iter->list);
- }
- return ret;
-
-}
-void
-main_add_navit(struct navit *nav)
-{
- navit=g_list_prepend(navit, nav);
-}
-
-void
-main_remove_navit(struct navit *nav)
-{
- navit=g_list_remove(navit, nav);
- if (! navit)
- event_main_loop_quit();
-}
-
-void
-print_usage(void)
-{
- printf(_("navit usage:\nnavit [options] [configfile]\n\t-c <file>: use <file> as config file\n\t-d <n>: set the debug output level to <n>. (TODO)\n\t-h: print this usage info and exit.\n\t-v: Print the version and exit.\n"));
-}
-
-int main(int argc, char **argv)
-{
- GError *error = NULL;
- char *config_file = NULL;
- char *s;
- int l;
-
-
-#ifndef _WIN32
- signal(SIGCHLD, sigchld);
-#endif
-
- setenv("LC_NUMERIC","C",1);
- setlocale(LC_ALL,"");
- setlocale(LC_NUMERIC,"C");
- if (file_exists("navit.c") || file_exists("navit.o")) {
- char buffer[PATH_MAX];
- printf(_("Running from source directory\n"));
- getcwd(buffer, PATH_MAX);
- setenv("NAVIT_PREFIX", buffer, 0);
- setenv("NAVIT_LIBDIR", buffer, 0);
- setenv("NAVIT_SHAREDIR", buffer, 0);
- setenv("NAVIT_LIBPREFIX", "*/.libs/", 0);
- s=g_strdup_printf("%s/../locale", buffer);
- setenv("NAVIT_LOCALEDIR", s, 0);
- g_free(s);
- } else {
- if (!getenv("NAVIT_PREFIX")) {
- l=strlen(argv[0]);
- if (l > 10 && !strcmp(argv[0]+l-10,"/bin/navit")) {
- s=g_strdup(argv[0]);
- s[l-10]='\0';
- if (strcmp(s, PREFIX))
- printf(_("setting '%s' to '%s'\n"), "NAVIT_PREFIX", s);
- setenv("NAVIT_PREFIX", s, 0);
- g_free(s);
- } else
- setenv("NAVIT_PREFIX", PREFIX, 0);
- }
-#ifdef _WIN32
- s=g_strdup_printf("locale");
-#else
- s=g_strdup_printf("%s/share/locale", getenv("NAVIT_PREFIX"));
-#endif
- setenv("NAVIT_LOCALEDIR", s, 0);
- g_free(s);
-#ifdef _WIN32
- s=g_strdup_printf(".");
-#else
- s=g_strdup_printf("%s/share/navit", getenv("NAVIT_PREFIX"));
-#endif
- setenv("NAVIT_SHAREDIR", s, 0);
- g_free(s);
- s=g_strdup_printf("%s/lib/navit", getenv("NAVIT_PREFIX"));
- setenv("NAVIT_LIBDIR", s, 0);
- g_free(s);
- }
- bindtextdomain(PACKAGE, getenv("NAVIT_LOCALEDIR"));
- bind_textdomain_codeset (PACKAGE, "UTF-8");
- textdomain(PACKAGE);
-
- debug_init(argv[0]);
- if (getenv("LC_ALL"))
- dbg(0,"Warning: LC_ALL is set, this might lead to problems\n");
-#ifndef USE_PLUGINS
- extern void builtin_init(void);
- builtin_init();
-#endif
-#if 0
- /* handled in gui/gtk */
- gtk_set_locale();
- gtk_init(&argc, &argv);
- gdk_rgb_init();
-#endif
- s = getenv("NAVIT_WID");
- if (s) {
- setenv("SDL_WINDOWID", s, 0);
- }
- route_init();
- navigation_init();
- config_file=NULL;
- int opt;
- opterr=0; //don't bomb out on errors.
- if (argc > 1) {
- while((opt = getopt(argc, argv, ":hvc:d:")) != -1) {
- switch(opt) {
- case 'h':
- print_usage();
- exit(0);
- break;
- case 'v':
- printf("%s %s\n", "navit", "0.0.4+svn");
- exit(0);
- break;
- case 'c':
- printf("config file n is set to `%s'\n", optarg);
- config_file = optarg;
- break;
- case 'd':
- printf("TODO Verbose option is set to `%s'\n", optarg);
- break;
- case ':':
- fprintf(stderr, "navit: Error - Option `%c' needs a value\n", optopt);
- print_usage();
- exit(1);
- break;
- case '?':
- fprintf(stderr, "navit: Error - No such option: `%c'\n", optopt);
- print_usage();
- exit(1);
- }
- }
- }
- // use 1st cmd line option that is left for the config file
- if (optind < argc) config_file = argv[optind];
-
- GList *list = NULL, *li;
- // if config file is explicitely given only look for it, otherwise try std paths
- if (config_file) list = g_list_append(list,g_strdup(config_file));
- else {
- list = g_list_append(list,g_strjoin(NULL,get_home_directory(), "/.navit/navit.xml" , NULL));
- list = g_list_append(list,g_strjoin(NULL,get_home_directory(), "/navit.xml" , NULL));
- list = g_list_append(list,g_strdup("navit.xml.local"));
- list = g_list_append(list,g_strdup("navit.xml"));
- list = g_list_append(list,g_strjoin(NULL,getenv("NAVIT_SHAREDIR"), "/navit.xml.local" , NULL));
- list = g_list_append(list,g_strjoin(NULL,getenv("NAVIT_SHAREDIR"), "/navit.xml" , NULL));
- }
- li = list;
- do {
- if (li == NULL) {
- // We have not found an existing config file from all possibilities
- printf(_("No config file navit.xml, navit.xml.local found\n"));
- exit(1);
- }
- // Try the next config file possibility from the list
- config_file = li->data;
- li = g_list_next(li);
- } while (!file_exists(config_file));
-
- if (!config_load(config_file, &error)) {
- printf(_("Error parsing '%s': %s\n"), config_file, error->message);
- } else {
- printf(_("Using '%s'\n"), config_file);
- }
-
- g_list_foreach(list, g_free, NULL);
- g_list_free(list);
-
- if (! navit) {
- printf(_("No instance has been created, exiting\n"));
- exit(1);
- }
- if (main_loop_gui) {
- gui_run_main_loop(main_loop_gui);
- } else
- event_main_loop_run();
-
- return 0;
-}
diff --git a/navit/main.h b/navit/main.h
deleted file mode 100644
index ba62fe7f..00000000
--- a/navit/main.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef NAVIT_MAIN_H
-#define NAVIT_MAIN_H
-
-/* prototypes */
-struct navit;
-struct iter;
-struct iter * main_iter_new(void);
-void main_iter_destroy(struct iter *iter);
-struct navit * main_get_navit(struct iter *iter);
-void main_add_navit(struct navit *nav);
-void main_remove_navit(struct navit *nav);
-void print_usage(void);
-int main(int argc, char **argv);
-/* end of prototypes */
-
-#endif
-
diff --git a/navit/map-share.h b/navit/map-share.h
deleted file mode 100644
index 2b534a63..00000000
--- a/navit/map-share.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef NAVIT_MAP_SHARE_H
-#define NAVIT_MAP_SHARE_H
-
-void map_srv_start_poa(CORBA_ORB orb, CORBA_Environment * ev);
-CORBA_Object map_srv_start_object(CORBA_Environment * ev, struct container *co);
-
-#endif
-
diff --git a/navit/map.c b/navit/map.c
deleted file mode 100644
index a5198df3..00000000
--- a/navit/map.c
+++ /dev/null
@@ -1,250 +0,0 @@
-#include <glib.h>
-#include <string.h>
-#include "debug.h"
-#include "coord.h"
-#include "projection.h"
-#include "map.h"
-#include "maptype.h"
-#include "transform.h"
-#include "item.h"
-#include "plugin.h"
-#include "country.h"
-
-
-struct map {
- struct map_methods meth;
- struct map_priv *priv;
- char *type;
- char *filename;
- int active;
-};
-
-struct map_rect {
- struct map *m;
- struct map_rect_priv *priv;
-};
-
-struct map *
-map_new(const char *type, struct attr **attrs)
-{
- struct map *m;
- struct map_priv *(*maptype_new)(struct map_methods *meth, struct attr **attrs);
- struct attr *data=attr_search(attrs, NULL, attr_data);
-
-
- maptype_new=plugin_get_map_type(type);
- if (! maptype_new)
- return NULL;
-
- m=g_new0(struct map, 1);
- m->active=1;
- m->type=g_strdup(type);
- if (data)
- m->filename=g_strdup(data->u.str);
- m->priv=maptype_new(&m->meth, attrs);
- if (! m->priv) {
- g_free(m);
- m=NULL;
- }
- return m;
-}
-
-char *
-map_get_filename(struct map *this_)
-{
- return this_->filename;
-}
-
-char *
-map_get_type(struct map *this_)
-{
- return this_->type;
-}
-
-int
-map_get_active(struct map *this_)
-{
- return this_->active;
-}
-
-void
-map_set_active(struct map *this_, int active)
-{
- this_->active=active;
-}
-
-int
-map_requires_conversion(struct map *this_)
-{
- return (this_->meth.charset != NULL && strcmp(this_->meth.charset, "utf-8"));
-}
-
-char *
-map_convert_string(struct map *this_, char *str)
-{
- return g_convert(str, -1,"utf-8",this_->meth.charset,NULL,NULL,NULL);
-}
-
-void
-map_convert_free(char *str)
-{
- g_free(str);
-}
-
-enum projection
-map_projection(struct map *this_)
-{
- return this_->meth.pro;
-}
-
-void
-map_set_projection(struct map *this_, enum projection pro)
-{
- this_->meth.pro=pro;
-}
-
-void
-map_destroy(struct map *m)
-{
- m->meth.map_destroy(m->priv);
- g_free(m);
-}
-
-struct map_rect *
-map_rect_new(struct map *m, struct map_selection *sel)
-{
- struct map_rect *mr;
-
-#if 0
- printf("map_rect_new 0x%x,0x%x-0x%x,0x%x\n", r->lu.x, r->lu.y, r->rl.x, r->rl.y);
-#endif
- mr=g_new0(struct map_rect, 1);
- mr->m=m;
- mr->priv=m->meth.map_rect_new(m->priv, sel);
- if (! mr->priv) {
- g_free(mr);
- mr=NULL;
- }
-
- return mr;
-}
-
-struct item *
-map_rect_get_item(struct map_rect *mr)
-{
- struct item *ret;
- g_assert(mr != NULL);
- g_assert(mr->m != NULL);
- g_assert(mr->m->meth.map_rect_get_item != NULL);
- ret=mr->m->meth.map_rect_get_item(mr->priv);
- if (ret)
- ret->map=mr->m;
- return ret;
-}
-
-struct item *
-map_rect_get_item_byid(struct map_rect *mr, int id_hi, int id_lo)
-{
- struct item *ret=NULL;
- g_assert(mr != NULL);
- g_assert(mr->m != NULL);
- if (mr->m->meth.map_rect_get_item_byid)
- ret=mr->m->meth.map_rect_get_item_byid(mr->priv, id_hi, id_lo);
- if (ret)
- ret->map=mr->m;
- return ret;
-}
-
-void
-map_rect_destroy(struct map_rect *mr)
-{
- mr->m->meth.map_rect_destroy(mr->priv);
- g_free(mr);
-}
-
-struct map_search {
- struct map *m;
- struct attr search_attr;
- void *priv;
-};
-
-struct map_search *
-map_search_new(struct map *m, struct item *item, struct attr *search_attr, int partial)
-{
- struct map_search *this_;
- dbg(1,"enter(%p,%p,%p,%d)\n", m, item, search_attr, partial);
- dbg(1,"0x%x 0x%x 0x%x\n", attr_country_all, search_attr->type, attr_country_name);
- this_=g_new0(struct map_search,1);
- this_->m=m;
- this_->search_attr=*search_attr;
- if (search_attr->type >= attr_country_all && search_attr->type <= attr_country_name)
- this_->priv=country_search_new(&this_->search_attr, partial);
- else {
- if (m->meth.map_search_new) {
- if (m->meth.charset)
- this_->search_attr.u.str=g_convert(this_->search_attr.u.str, -1,m->meth.charset,"utf-8",NULL,NULL,NULL);
- this_->priv=m->meth.map_search_new(m->priv, item, &this_->search_attr, partial);
- } else {
- g_free(this_);
- this_=NULL;
- }
- }
- return this_;
-}
-
-struct item *
-map_search_get_item(struct map_search *this_)
-{
- struct item *ret;
-
- if (! this_)
- return NULL;
- if (this_->search_attr.type >= attr_country_all && this_->search_attr.type <= attr_country_name)
- return country_search_get_item(this_->priv);
- ret=this_->m->meth.map_search_get_item(this_->priv);
- if (ret)
- ret->map=this_->m;
- return ret;
-}
-
-void
-map_search_destroy(struct map_search *this_)
-{
- if (! this_)
- return;
- if (this_->search_attr.type >= attr_country_all && this_->search_attr.type <= attr_country_name)
- country_search_destroy(this_->priv);
- else {
- if (this_->m->meth.charset)
- g_free(this_->search_attr.u.str);
- this_->m->meth.map_search_destroy(this_->priv);
- }
- g_free(this_);
-}
-
-struct map_selection *
-map_selection_dup(struct map_selection *sel)
-{
- struct map_selection *next,**last;
- struct map_selection *ret=NULL;
- last=&ret;
- while (sel) {
- next = g_new(struct map_selection, 1);
- *next=*sel;
- *last=next;
- last=&next->next;
- sel = sel->next;
- }
- return ret;
-}
-
-void
-map_selection_destroy(struct map_selection *sel)
-{
- struct map_selection *next;
- while (sel) {
- next = sel->next;
- g_free(sel);
- sel = next;
- }
-}
diff --git a/navit/map.h b/navit/map.h
deleted file mode 100644
index 1dcc28b1..00000000
--- a/navit/map.h
+++ /dev/null
@@ -1,157 +0,0 @@
-#ifndef NAVIT_MAP_H
-#define NAVIT_MAP_H
-
-struct map_priv;
-struct attr;
-#include "coord.h"
-#include "point.h"
-#include "layer.h"
-
-struct map_selection {
- struct map_selection *next;
- union {
- struct coord_rect c_rect;
- struct point_rect p_rect;
- } u;
- int order[layer_end];
-};
-
-struct map_methods {
- enum projection pro;
- char *charset;
- void (*map_destroy)(struct map_priv *priv);
- struct map_rect_priv * (*map_rect_new)(struct map_priv *map, struct map_selection *sel);
- void (*map_rect_destroy)(struct map_rect_priv *mr);
- struct item * (*map_rect_get_item)(struct map_rect_priv *mr);
- struct item * (*map_rect_get_item_byid)(struct map_rect_priv *mr, int id_hi, int id_lo);
- struct map_search_priv *(*map_search_new)(struct map_priv *map, struct item *item, struct attr *search, int partial);
- void (*map_search_destroy)(struct map_search_priv *ms);
- struct item * (*map_search_get_item)(struct map_search_priv *ms);
-};
-
-static inline int
-map_selection_contains_point(struct map_selection *sel, struct coord *c)
-{
- struct map_selection *curr=sel;
- while (curr) {
- struct coord_rect *r=&curr->u.c_rect;
- if (c->x >= r->lu.x && c->x <= r->rl.x &&
- c->y <= r->lu.y && c->y >= r->rl.y)
- return 1;
- curr=curr->next;
- }
- return sel ? 0:1;
-}
-
-static inline int
-map_selection_contains_polyline(struct map_selection *sel, struct coord *c, int count)
-{
- int i,x_mi,x_ma,y_mi,y_ma;
- struct map_selection *curr;
-
- if (! sel)
- return 1;
- for (i = 0 ; i < count-1 ; i++) {
- x_mi=c[i].x;
- if (c[i+1].x < x_mi)
- x_mi=c[i+1].x;
- x_ma=c[i].x;
- if (c[i+1].x > x_ma)
- x_ma=c[i+1].x;
- y_mi=c[i].y;
- if (c[i+1].y < y_mi)
- y_mi=c[i+1].y;
- y_ma=c[i].y;
- if (c[i+1].y > y_ma)
- y_ma=c[i+1].y;
- curr=sel;
- while (curr) {
- struct coord_rect *sr=&curr->u.c_rect;
- if (x_mi <= sr->rl.x && x_ma >= sr->lu.x &&
- y_ma >= sr->rl.y && y_mi <= sr->lu.y)
- return 1;
- curr=curr->next;
- }
- }
- return 0;
-}
-
-static inline int
-map_selection_contains_rect(struct map_selection *sel, struct coord_rect *r)
-{
- struct map_selection *curr;
-
- g_assert(r->lu.x <= r->rl.x);
- g_assert(r->lu.y >= r->rl.y);
-
- if (! sel)
- return 1;
- curr=sel;
- while (curr) {
- struct coord_rect *sr=&curr->u.c_rect;
- g_assert(sr->lu.x <= sr->rl.x);
- g_assert(sr->lu.y >= sr->rl.y);
- if (r->lu.x <= sr->rl.x && r->rl.x >= sr->lu.x &&
- r->lu.y >= sr->rl.y && r->rl.y <= sr->lu.y)
- return 1;
- curr=curr->next;
- }
- return 0;
-}
-
-static inline int
-map_selection_contains_polygon(struct map_selection *sel, struct coord *c, int count)
-{
- struct coord_rect r;
- int i;
-
- if (! sel)
- return 1;
- if (! count)
- return 0;
- r.lu=c[0];
- r.rl=c[0];
- for (i = 1 ; i < count ; i++) {
- if (c[i].x < r.lu.x)
- r.lu.x=c[i].x;
- if (c[i].x > r.rl.x)
- r.rl.x=c[i].x;
- if (c[i].y < r.rl.y)
- r.rl.y=c[i].y;
- if (c[i].y > r.lu.y)
- r.lu.y=c[i].y;
- }
- return map_selection_contains_rect(sel, &r);
-}
-
-/* prototypes */
-enum projection;
-struct attr;
-struct item;
-struct map;
-struct map_rect;
-struct map_search;
-struct map_selection;
-struct map *map_new(const char *type, struct attr **attrs);
-char *map_get_filename(struct map *this_);
-char *map_get_type(struct map *this_);
-int map_get_active(struct map *this_);
-void map_set_active(struct map *this_, int active);
-int map_requires_conversion(struct map *this_);
-char *map_convert_string(struct map *this_, char *str);
-void map_convert_free(char *str);
-enum projection map_projection(struct map *this_);
-void map_set_projection(struct map *this_, enum projection pro);
-void map_destroy(struct map *m);
-struct map_rect *map_rect_new(struct map *m, struct map_selection *sel);
-struct item *map_rect_get_item(struct map_rect *mr);
-struct item *map_rect_get_item_byid(struct map_rect *mr, int id_hi, int id_lo);
-void map_rect_destroy(struct map_rect *mr);
-struct map_search *map_search_new(struct map *m, struct item *item, struct attr *search_attr, int partial);
-struct item *map_search_get_item(struct map_search *this_);
-void map_search_destroy(struct map_search *this_);
-struct map_selection *map_selection_dup(struct map_selection *sel);
-void map_selection_destroy(struct map_selection *sel);
-/* end of prototypes */
-
-#endif
diff --git a/navit/map_data.h b/navit/map_data.h
deleted file mode 100644
index bb2aab9c..00000000
--- a/navit/map_data.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef NAVIT_MAP_DATA_H
-#define NAVIT_MAP_DATA_H
-
-enum file_index {
- file_border_ply=0,
- file_bridge_ply,
- file_height_ply,
- file_other_ply,
- file_rail_ply,
- file_sea_ply,
- file_street_bti,
- file_street_str,
- file_strname_stn,
- file_town_twn,
- file_tunnel_ply,
- file_water_ply,
- file_woodland_ply,
- file_end
-};
-
-struct map_data {
- struct file *file[file_end];
- struct map_data *next;
-};
-
-struct map_data *load_maps(char *map);
-
-struct transformation;
-struct block_info;
-
-void map_data_foreach(struct map_data *mdata, int file, struct transformation *t, int limit,
- void(*func)(struct block_info *, unsigned char *, unsigned char *, void *), void *data);
-
-#endif
-
diff --git a/navit/maps/Makefile.am b/navit/maps/Makefile.am
deleted file mode 100644
index 6480eddf..00000000
--- a/navit/maps/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-
-SAMPLE_MAP=osm_bbox_11.3,47.9,11.7,48.2
-
-maps_DATA = $(SAMPLE_MAP).bin $(SAMPLE_MAP).xml
-
-samplemap: $(SAMPLE_MAP).bin
-
-$(SAMPLE_MAP).osm.bz2:
- echo "Downloading osm sample map"
- wget -O $(SAMPLE_MAP).osm.bz2.tmp http://navit.sourceforge.net/maps/$(SAMPLE_MAP).osm.bz2
- mv $(SAMPLE_MAP).osm.bz2.tmp $(SAMPLE_MAP).osm.bz2
-
-$(SAMPLE_MAP).bin $(SAMPLE_MAP).xml: $(SAMPLE_MAP).osm.bz2 $(top_builddir)/navit/osm2navit
- echo "Converting osm sample map"
- bzcat $(SAMPLE_MAP).osm.bz2 | $(top_builddir)/navit/osm2navit --attr-debug-level=5 $(SAMPLE_MAP).bin.tmp
- mv $(SAMPLE_MAP).bin.tmp $(SAMPLE_MAP).bin
- echo '<map type="binfile" enabled="yes" data="$$NAVIT_SHAREDIR/maps/osm_bbox_11.3,47.9,11.7,48.2.bin"/>' >$(SAMPLE_MAP).xml
-
-distclean-local:
- rm -f $(SAMPLE_MAP).osm.bz2 $(SAMPLE_MAP).bin $(SAMPLE_MAP).xml
-
-all:
diff --git a/navit/mapset.c b/navit/mapset.c
deleted file mode 100644
index 5c805cbb..00000000
--- a/navit/mapset.c
+++ /dev/null
@@ -1,120 +0,0 @@
-#include <string.h>
-#include <glib.h>
-#include <glib/gprintf.h>
-#include "debug.h"
-#include "item.h"
-#include "mapset.h"
-#include "projection.h"
-#include "map.h"
-
-struct mapset {
- GList *maps;
-};
-
-struct mapset *mapset_new(void)
-{
- struct mapset *ms;
-
- ms=g_new0(struct mapset, 1);
-
- return ms;
-}
-
-void mapset_add(struct mapset *ms, struct map *m)
-{
- ms->maps=g_list_append(ms->maps, m);
-}
-
-#if 0
-static void mapset_maps_free(struct mapset *ms)
-{
- /* todo */
-}
-#endif
-
-void mapset_destroy(struct mapset *ms)
-{
- g_free(ms);
-}
-
-struct mapset_handle {
- GList *l;
-};
-
-struct mapset_handle *
-mapset_open(struct mapset *ms)
-{
- struct mapset_handle *ret;
-
- ret=g_new(struct mapset_handle, 1);
- ret->l=ms->maps;
-
- return ret;
-}
-
-struct map * mapset_next(struct mapset_handle *msh, int active)
-{
- struct map *ret;
-
- for (;;) {
- if (!msh->l)
- return NULL;
- ret=msh->l->data;
- msh->l=g_list_next(msh->l);
- if (!active || map_get_active(ret))
- return ret;
- }
-}
-
-void
-mapset_close(struct mapset_handle *msh)
-{
- g_free(msh);
-}
-
-struct mapset_search {
- GList *map;
- struct map_search *ms;
- struct item *item;
- struct attr *search_attr;
- int partial;
-};
-
-struct mapset_search *
-mapset_search_new(struct mapset *ms, struct item *item, struct attr *search_attr, int partial)
-{
- struct mapset_search *this;
- dbg(1,"enter(%p,%p,%p,%d)\n", ms, item, search_attr, partial);
- this=g_new0(struct mapset_search,1);
- this->map=ms->maps;
- this->item=item;
- this->search_attr=search_attr;
- this->partial=partial;
- this->ms=map_search_new(this->map->data, item, search_attr, partial);
- return this;
-}
-
-struct item *
-mapset_search_get_item(struct mapset_search *this)
-{
- struct item *ret;
- while (!(ret=map_search_get_item(this->ms))) {
- if (this->search_attr->type >= attr_country_all && this->search_attr->type <= attr_country_name)
- break;
- do {
- this->map=g_list_next(this->map);
- } while (this->map && ! map_get_active(this->map->data));
- if (! this->map)
- break;
- map_search_destroy(this->ms);
- this->ms=map_search_new(this->map->data, this->item, this->search_attr, this->partial);
- }
- return ret;
-}
-
-void
-mapset_search_destroy(struct mapset_search *this)
-{
- map_search_destroy(this->ms);
- g_free(this);
-}
diff --git a/navit/mapset.h b/navit/mapset.h
deleted file mode 100644
index 894dee12..00000000
--- a/navit/mapset.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef NAVIT_MAPSET_H
-#define NAVIT_MAPSET_H
-
-/* prototypes */
-struct attr;
-struct item;
-struct map;
-struct mapset;
-struct mapset_handle;
-struct mapset_search;
-struct mapset *mapset_new(void);
-void mapset_add(struct mapset *ms, struct map *m);
-void mapset_destroy(struct mapset *ms);
-struct mapset_handle *mapset_open(struct mapset *ms);
-struct map *mapset_next(struct mapset_handle *msh, int active);
-void mapset_close(struct mapset_handle *msh);
-struct mapset_search *mapset_search_new(struct mapset *ms, struct item *item, struct attr *search_attr, int partial);
-struct item *mapset_search_get_item(struct mapset_search *this);
-void mapset_search_destroy(struct mapset_search *this);
-
-#endif
-
diff --git a/navit/maptype.c b/navit/maptype.c
deleted file mode 100644
index 0c0a26bc..00000000
--- a/navit/maptype.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <glib.h>
-#include "projection.h"
-#include "map.h"
-#include "maptype.h"
-
-static struct maptype *maptype_root;
-
-void
-maptype_register(char *name, struct map_priv *(*map_new)(struct map_methods *meth, char *data, char **charset, enum projection *pro))
-{
- struct maptype *mt;
- mt=g_new(struct maptype, 1);
- mt->name=g_strdup(name);
- mt->map_new=map_new;
- mt->next=maptype_root;
- maptype_root=mt;
-}
-
-struct maptype *
-maptype_get(const char *name)
-{
- struct maptype *mt=maptype_root;
-
- while (mt) {
- if (!g_ascii_strcasecmp(mt->name, name))
- return mt;
- mt=mt->next;
- }
- return NULL;
-}
diff --git a/navit/maptype.h b/navit/maptype.h
deleted file mode 100644
index bfaf4e29..00000000
--- a/navit/maptype.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef NAVIT_MAPTYPE_H
-#define NAVIT_MAPTYPE_H
-
-struct map_methods;
-
-struct maptype {
- char *name;
- struct map_priv *(*map_new)(struct map_methods *meth, char *data, char **charset, enum projection *pro);
- struct maptype *next;
-};
-
-/* prototypes */
-enum projection;
-struct map_methods;
-struct map_priv;
-struct maptype;
-void maptype_register(char *name, struct map_priv *(*map_new)(struct map_methods *meth, char *data, char **charset, enum projection *pro));
-struct maptype *maptype_get(const char *name);
-
-#endif
-
diff --git a/navit/menu.c b/navit/menu.c
deleted file mode 100644
index d19565bb..00000000
--- a/navit/menu.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <windows.h>
-#include <glib.h>
-#include <string.h>
-#include "menu.h"
-#include "debug.h"
-
-struct menu *
-menu_add(struct menu *menu, char *name, enum menu_type type, struct callback *cb)
-{
- struct menu *this;
- this=g_new0(struct menu, 1);
- this->priv=(*menu->meth.add_menu)(menu->priv, &this->meth, name, type, cb);
- if (! this->priv) {
- g_free(this);
- return NULL;
- }
-
- return this;
-}
-
-void
-menu_popup(struct menu *menu)
-{
- if (! menu || ! menu->meth.popup)
- return;
- (*menu->meth.popup)(menu->priv);
-
-}
diff --git a/navit/menu.h b/navit/menu.h
deleted file mode 100644
index 1aeb3211..00000000
--- a/navit/menu.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef NAVIT_MENU_H
-#define NAVIT_MENU_H
-
-enum menu_type {
- menu_type_submenu,
- menu_type_menu,
- menu_type_toggle,
-};
-
-struct container;
-struct menu;
-struct callback;
-
-struct menu_methods {
- struct menu_priv *(*add_menu)(struct menu_priv *menu, struct menu_methods *meth, char *name, enum menu_type type, struct callback *cb);
- void (*set_toggle)(struct menu_priv *menu, int active);
- int (*get_toggle)(struct menu_priv *menu);
- void (*popup)(struct menu_priv *menu);
-};
-
-struct menu {
- struct menu_priv *priv;
- struct menu_methods meth;
-};
-
-/* prototypes */
-struct menu *menu_add(struct menu *menu, char *name, enum menu_type type, struct callback *cb);
-void menu_popup(struct menu *menu);
-/* end of prototypes */
-#endif
diff --git a/navit/navigation.c b/navit/navigation.c
deleted file mode 100644
index 57b13683..00000000
--- a/navit/navigation.c
+++ /dev/null
@@ -1,986 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <glib.h>
-#include <libintl.h>
-#include "debug.h"
-#include "profile.h"
-#include "navigation.h"
-#include "coord.h"
-#include "item.h"
-#include "route.h"
-#include "transform.h"
-#include "mapset.h"
-#include "projection.h"
-#include "map.h"
-#include "navit.h"
-#include "callback.h"
-#include "plugin.h"
-
-#define _(STRING) gettext(STRING)
-
-struct suffix {
- char *fullname;
- char *abbrev;
- int sex;
-} suffixes[]= {
- {"weg",NULL,1},
- {"platz","pl.",1},
- {"ring",NULL,1},
- {"allee",NULL,2},
- {"gasse",NULL,2},
- {"straße","str.",2},
- {"strasse",NULL,2},
-};
-
-struct navigation {
- struct map *map;
- struct item_hash *hash;
- struct navigation_itm *first;
- struct navigation_itm *last;
- struct navigation_command *cmd_first;
- struct navigation_command *cmd_last;
- struct callback_list *callback_speech;
- struct callback_list *callback;
- int level_last;
- struct item item_last;
- int turn_around;
- int turn_around_limit;
- int distance_turn;
- int distance_last;
- int announce[route_item_last-route_item_first+1][3];
-};
-
-
-struct navigation_command {
- struct navigation_itm *itm;
- struct navigation_command *next;
- int delta;
-};
-
-struct navigation *
-navigation_new(struct attr **attrs)
-{
- int i,j;
- struct navigation *ret=g_new0(struct navigation, 1);
- ret->hash=item_hash_new();
- ret->callback=callback_list_new();
- ret->callback_speech=callback_list_new();
- ret->level_last=-2;
- ret->distance_last=-2;
- ret->distance_turn=50;
- ret->turn_around_limit=3;
-
- for (j = 0 ; j <= route_item_last-route_item_first ; j++) {
- for (i = 0 ; i < 3 ; i++) {
- ret->announce[j][i]=-1;
- }
- }
-
- return ret;
-}
-
-int
-navigation_set_announce(struct navigation *this_, enum item_type type, int *level)
-{
- int i;
- if (type < route_item_first || type > route_item_last) {
- dbg(0,"street type %d out of range [%d,%d]", type, route_item_first, route_item_last);
- return 0;
- }
- for (i = 0 ; i < 3 ; i++)
- this_->announce[type-route_item_first][i]=level[i];
- return 1;
-}
-
-static int
-navigation_get_announce_level(struct navigation *this_, enum item_type type, int dist)
-{
- int i;
-
- if (type < route_item_first || type > route_item_last)
- return -1;
- for (i = 0 ; i < 3 ; i++) {
- if (dist <= this_->announce[type-route_item_first][i])
- return i;
- }
- return i;
-}
-
-struct navigation_itm {
- char *name1;
- char *name2;
- struct item item;
- int angle_start;
- int angle_end;
- int time;
- int length;
- int dest_time;
- int dest_length;
- int told;
- struct navigation_itm *next;
- struct navigation_itm *prev;
-};
-
-/* 0=N,90=E */
-static int
-road_angle(struct coord *c1, struct coord *c2, int dir)
-{
- int ret=transform_get_angle_delta(c1, c2, dir);
- dbg(1, "road_angle(0x%x,0x%x - 0x%x,0x%x)=%d\n", c1->x, c1->y, c2->x, c2->y, ret);
- return ret;
-}
-
-static int
-round_distance(int dist)
-{
- if (dist < 100) {
- dist=(dist+5)/10;
- return dist*10;
- }
- if (dist < 250) {
- dist=(dist+13)/25;
- return dist*25;
- }
- if (dist < 500) {
- dist=(dist+25)/50;
- return dist*50;
- }
- if (dist < 1000) {
- dist=(dist+50)/100;
- return dist*100;
- }
- if (dist < 5000) {
- dist=(dist+50)/100;
- return dist*100;
- }
- if (dist < 100000) {
- dist=(dist+500)/1000;
- return dist*1000;
- }
- dist=(dist+5000)/10000;
- return dist*10000;
-}
-
-static char *
-get_distance(int dist, enum attr_type type, int is_length)
-{
- if (type == attr_navigation_long) {
- if (is_length)
- return g_strdup_printf(_("%d m"), dist);
- else
- return g_strdup_printf(_("in %d m"), dist);
- }
- if (dist < 1000) {
- if (is_length)
- return g_strdup_printf(_("%d meters"), dist);
- else
- return g_strdup_printf(_("in %d meters"), dist);
- }
- if (dist < 5000) {
- int rem=(dist/100)%10;
- if (rem) {
- if (is_length)
- return g_strdup_printf(_("%d.%d kilometer"), dist/1000, rem);
- else
- return g_strdup_printf(_("in %d.%d kilometers"), dist/1000, rem);
- }
- }
- if (is_length)
- return g_strdup_printf(ngettext("one kilometer","%d kilometers", dist/1000), dist/1000);
- else
- return g_strdup_printf(ngettext("in one kilometer","in %d kilometers", dist/1000), dist/1000);
-}
-
-static void
-navigation_destroy_itms_cmds(struct navigation *this_, struct navigation_itm *end)
-{
- struct navigation_itm *itm;
- struct navigation_command *cmd;
- dbg(2,"enter this_=%p this_->first=%p this_->cmd_first=%p end=%p\n", this_, this_->first, this_->cmd_first, end);
- if (this_->cmd_first)
- dbg(2,"this_->cmd_first->itm=%p\n", this_->cmd_first->itm);
- while (this_->first && this_->first != end) {
- itm=this_->first;
- dbg(3,"destroying %p\n", itm);
- item_hash_remove(this_->hash, &itm->item);
- this_->first=itm->next;
- if (this_->first)
- this_->first->prev=NULL;
- if (this_->cmd_first && this_->cmd_first->itm == itm->next) {
- cmd=this_->cmd_first;
- this_->cmd_first=cmd->next;
- g_free(cmd);
- }
- map_convert_free(itm->name1);
- map_convert_free(itm->name2);
- g_free(itm);
- }
- if (! this_->first)
- this_->last=NULL;
- if (! this_->first && end)
- dbg(0,"end wrong\n");
- dbg(2,"ret this_->first=%p this_->cmd_first=%p\n",this_->first, this_->cmd_first);
-}
-
-static void
-navigation_itm_update(struct navigation_itm *itm, struct item *ritem)
-{
- struct attr length, time;
- if (! item_attr_get(ritem, attr_length, &length)) {
- dbg(0,"no length\n");
- return;
- }
- if (! item_attr_get(ritem, attr_time, &time)) {
- dbg(0,"no time\n");
- return;
- }
- dbg(1,"length=%d time=%d\n", length.u.num, time.u.num);
- itm->length=length.u.num;
- itm->time=time.u.num;
-}
-
-static struct navigation_itm *
-navigation_itm_new(struct navigation *this_, struct item *ritem)
-{
- struct navigation_itm *ret=g_new0(struct navigation_itm, 1);
- int l,i=0;
- struct item *sitem;
- struct attr street_item;
- struct map_rect *mr;
- struct attr attr;
- struct coord c[5];
-
- if (ritem) {
- ret->told=0;
- if (! item_attr_get(ritem, attr_street_item, &street_item)) {
- dbg(0,"no street item\n");
- return NULL;
- }
- sitem=street_item.u.item;
- ret->item=*sitem;
- item_hash_insert(this_->hash, sitem, ret);
- mr=map_rect_new(sitem->map, NULL);
- sitem=map_rect_get_item_byid(mr, sitem->id_hi, sitem->id_lo);
- if (item_attr_get(sitem, attr_street_name, &attr))
- ret->name1=map_convert_string(sitem->map,attr.u.str);
- if (item_attr_get(sitem, attr_street_name_systematic, &attr))
- ret->name2=map_convert_string(sitem->map,attr.u.str);
- navigation_itm_update(ret, ritem);
- l=-1;
- while (item_coord_get(ritem, &c[i], 1)) {
- dbg(1, "coord %d 0x%x 0x%x\n", i, c[i].x ,c[i].y);
- l=i;
- if (i < 4)
- i++;
- else {
- c[2]=c[3];
- c[3]=c[4];
- }
- }
- dbg(1,"count=%d\n", l);
- if (l == 4)
- l=3;
- ret->angle_start=road_angle(&c[0], &c[1], 0);
- ret->angle_end=road_angle(&c[l-1], &c[l], 0);
- dbg(1,"i=%d start %d end %d '%s' '%s'\n", i, ret->angle_start, ret->angle_end, ret->name1, ret->name2);
- map_rect_destroy(mr);
- }
- if (! this_->first)
- this_->first=ret;
- if (this_->last) {
- this_->last->next=ret;
- ret->prev=this_->last;
- }
- dbg(1,"ret=%p\n", ret);
- this_->last=ret;
- return ret;
-}
-
-static void
-calculate_dest_distance(struct navigation *this_, int incr)
-{
- int len=0, time=0;
- struct navigation_itm *next,*itm=this_->last;
- dbg(1, "enter this_=%p, incr=%d\n", this_, incr);
- if (incr) {
- if (itm)
- dbg(2, "old values: (%p) time=%d lenght=%d\n", itm, itm->dest_length, itm->dest_time);
- else
- dbg(2, "old values: itm is null\n");
- itm=this_->first;
- next=itm->next;
- dbg(2, "itm values: time=%d lenght=%d\n", itm->length, itm->time);
- dbg(2, "next values: (%p) time=%d lenght=%d\n", next, next->dest_length, next->dest_time);
- itm->dest_length=next->dest_length+itm->length;
- itm->dest_time=next->dest_time+itm->time;
- dbg(2, "new values: time=%d lenght=%d\n", itm->dest_length, itm->dest_time);
- return;
- }
- while (itm) {
- len+=itm->length;
- time+=itm->time;
- itm->dest_length=len;
- itm->dest_time=time;
- itm=itm->prev;
- }
- dbg(1,"len %d time %d\n", len, time);
-}
-
-static int
-is_same_street2(struct navigation_itm *old, struct navigation_itm *new)
-{
- if (old->name1 && new->name1 && !strcmp(old->name1, new->name1)) {
- dbg(1,"is_same_street: '%s' '%s' vs '%s' '%s' yes (1.)\n", old->name2, new->name2, old->name1, new->name1);
- return 1;
- }
- if (old->name2 && new->name2 && !strcmp(old->name2, new->name2)) {
- dbg(1,"is_same_street: '%s' '%s' vs '%s' '%s' yes (2.)\n", old->name2, new->name2, old->name1, new->name1);
- return 1;
- }
- dbg(1,"is_same_street: '%s' '%s' vs '%s' '%s' no\n", old->name2, new->name2, old->name1, new->name1);
- return 0;
-}
-
-static int
-maneuver_required2(struct navigation_itm *old, struct navigation_itm *new, int *delta)
-{
- dbg(1,"enter %p %p %p\n",old, new, delta);
- if (new->item.type == old->item.type || (new->item.type != type_ramp && old->item.type != type_ramp)) {
- if (is_same_street2(old, new)) {
- dbg(1, "maneuver_required: is_same_street: no\n");
- return 0;
- }
- } else
- dbg(1, "maneuver_required: old or new is ramp\n");
-#if 0
- if (old->crossings_end == 2) {
- dbg(1, "maneuver_required: only 2 connections: no\n");
- return 0;
- }
-#endif
- *delta=new->angle_start-old->angle_end;
- if (*delta < -180)
- *delta+=360;
- if (*delta > 180)
- *delta-=360;
- dbg(1,"delta=%d-%d=%d\n", new->angle_start, old->angle_end, *delta);
- if (*delta < 20 && *delta >-20) {
- dbg(1, "maneuver_required: delta(%d) < 20: no\n", *delta);
- return 0;
- }
- dbg(1, "maneuver_required: delta=%d: yes\n", *delta);
- return 1;
-}
-
-static struct navigation_command *
-command_new(struct navigation *this_, struct navigation_itm *itm, int delta)
-{
- struct navigation_command *ret=g_new0(struct navigation_command, 1);
- dbg(1,"enter this_=%p itm=%p delta=%d\n", this_, itm, delta);
- ret->delta=delta;
- ret->itm=itm;
- if (this_->cmd_last)
- this_->cmd_last->next=ret;
- this_->cmd_last=ret;
-
- if (!this_->cmd_first)
- this_->cmd_first=ret;
- return ret;
-}
-
-static void
-make_maneuvers(struct navigation *this_)
-{
- struct navigation_itm *itm, *last=NULL, *last_itm=NULL;
- int delta;
- itm=this_->first;
- this_->cmd_last=NULL;
- this_->cmd_first=NULL;
- while (itm) {
- if (last) {
- if (maneuver_required2(last_itm, itm, &delta)) {
- command_new(this_, itm, delta);
- }
- } else
- last=itm;
- last_itm=itm;
- itm=itm->next;
- }
-}
-
-static int
-contains_suffix(char *name, char *suffix)
-{
- if (!suffix)
- return 0;
- if (strlen(name) < strlen(suffix))
- return 0;
- return !strcasecmp(name+strlen(name)-strlen(suffix), suffix);
-}
-
-static char *
-replace_suffix(char *name, char *search, char *replace)
-{
- int len=strlen(name)-strlen(search);
- char *ret=g_malloc(len+strlen(replace)+1);
- strncpy(ret, name, len);
- strcpy(ret+len, replace);
-
- return ret;
-}
-
-static char *
-navigation_item_destination(struct navigation_itm *itm, struct navigation_itm *next, char *prefix)
-{
- char *ret=NULL,*name1,*sep,*name2;
- int i,sex;
- if (! prefix)
- prefix="";
- if(!itm->name1 && !itm->name2 && itm->item.type == type_ramp) {
- dbg(1,">> Next is ramp %lx current is %lx \n", itm->item.type, next->item.type);
-
- if(next->item.type == type_ramp)
- return NULL;
- if(itm->item.type == type_highway_city || itm->item.type == type_highway_land )
- return g_strdup_printf("%s%s",prefix,_("exit"));
- else
- return g_strdup_printf("%s%s",prefix,_("ramp"));
-
- }
- if (!itm->name1 && !itm->name2)
- return NULL;
- if (itm->name1) {
- sex=-1;
- name1=NULL;
- for (i = 0 ; i < sizeof(suffixes)/sizeof(suffixes[0]) ; i++) {
- if (contains_suffix(itm->name1,suffixes[i].fullname)) {
- sex=suffixes[i].sex;
- name1=g_strdup(itm->name1);
- break;
- }
- if (contains_suffix(itm->name1,suffixes[i].abbrev)) {
- sex=suffixes[i].sex;
- name1=replace_suffix(itm->name1, suffixes[i].abbrev, suffixes[i].fullname);
- break;
- }
- }
- if (itm->name2) {
- name2=itm->name2;
- sep=" ";
- } else {
- name2="";
- sep="";
- }
- switch (sex) {
- case -1:
- /* TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name */
- ret=g_strdup_printf(_("%sinto the street %s%s%s"),prefix,itm->name1, sep, name2);
- break;
- case 1:
- /* TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Male form. The stuff after | doesn't have to be included */
- ret=g_strdup_printf(_("%sinto the %s%s%s|male form"),prefix,name1, sep, name2);
- break;
- case 2:
- /* TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Female form. The stuff after | doesn't have to be included */
- ret=g_strdup_printf(_("%sinto the %s%s%s|female form"),prefix,name1, sep, name2);
- break;
- case 3:
- /* TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Neutral form. The stuff after | doesn't have to be included */
- ret=g_strdup_printf(_("%sinto the %s%s%s|neutral form"),prefix,name1, sep, name2);
- break;
- }
- g_free(name1);
-
- } else
- ret=g_strdup_printf(_("into the %s"),itm->name2);
- name1=ret;
- while (*name1) {
- switch (*name1) {
- case '|':
- *name1='\0';
- break;
- case '/':
- *name1++=' ';
- break;
- default:
- name1++;
- }
- }
- return ret;
-}
-
-
-static char *
-show_maneuver(struct navigation *nav, struct navigation_itm *itm, struct navigation_command *cmd, enum attr_type type)
-{
- char *dir=_("right"),*strength="";
- int distance=itm->dest_length-cmd->itm->dest_length;
- char *d,*ret;
- int delta=cmd->delta;
- int level;
- level=1;
- if (delta < 0) {
- dir=_("left");
- delta=-delta;
- }
- if (delta < 45) {
- strength=_("easily ");
- } else if (delta < 105) {
- strength="";
- } else if (delta < 165) {
- strength=_("strongly ");
- } else {
- dbg(1,"delta=%d\n", delta);
- strength=_("unknown ");
- }
- if (type != attr_navigation_long_exact)
- distance=round_distance(distance);
- if (type == attr_navigation_speech) {
- if (nav->turn_around && nav->turn_around == nav->turn_around_limit)
- return g_strdup(_("When possible, please turn around"));
- level=navigation_get_announce_level(nav, itm->item.type, distance);
- dbg(1,"distance=%d level=%d type=0x%x\n", distance, level, itm->item.type);
- }
- switch(level) {
- case 3:
- d=get_distance(distance, type, 1);
- ret=g_strdup_printf(_("Follow the road for the next %s"), d);
- g_free(d);
- return ret;
- case 2:
- d=g_strdup(_("soon"));
- break;
- case 1:
- d=get_distance(distance, type, 0);
- break;
- case 0:
- d=g_strdup(_("now"));
- break;
- default:
- d=g_strdup(_("error"));
- }
- if (cmd->itm->next) {
- int tellstreetname = 0;
- char *destination = NULL;
-
- if(type == attr_navigation_speech) { // In voice mode
- // In Voice Mode only tell the street name in level 1 or in level 0 if level 1
- // was skipped
-
- if (level == 1) { // we are close to the intersection
- cmd->itm->told = 1; // remeber to be checked when we turn
- tellstreetname = 1; // Ok so we tell the name of the street
- }
-
- if (level == 0) {
- if(cmd->itm->told == 0) // we are write at the intersection
- tellstreetname = 1;
- else
- cmd->itm->told = 0; // reset just in case we come to the same street again
- }
-
- }
- else
- tellstreetname = 1;
-
- if(tellstreetname)
- destination=navigation_item_destination(cmd->itm, itm, " ");
- /* TRANSLATORS: The first argument is strength, the second direction, the third distance and the fourth destination Example: 'Turn 'slightly' 'left' in '100 m' 'onto baker street' */
- ret=g_strdup_printf(_("Turn %1$s%2$s %3$s%4$s"), strength, dir, d, destination ? destination:"");
- g_free(destination);
- } else
- ret=g_strdup_printf(_("You have reached your destination %s"), d);
- g_free(d);
- return ret;
-}
-
-static void
-navigation_call_callbacks(struct navigation *this_, int force_speech)
-{
- int distance, level = 0;
- void *p=this_;
- if (!this_->cmd_first)
- return;
- callback_list_call(this_->callback, 1, &p);
- dbg(1,"force_speech=%d turn_around=%d turn_around_limit=%d\n", force_speech, this_->turn_around, this_->turn_around_limit);
- distance=round_distance(this_->first->dest_length-this_->cmd_first->itm->dest_length);
- if (this_->turn_around_limit && this_->turn_around == this_->turn_around_limit) {
- dbg(1,"distance=%d distance_turn=%d\n", distance, this_->distance_turn);
- while (distance > this_->distance_turn) {
- this_->level_last=4;
- level=4;
- force_speech=1;
- if (this_->distance_turn >= 500)
- this_->distance_turn*=2;
- else
- this_->distance_turn=500;
- }
- } else if (!this_->turn_around_limit || this_->turn_around == -this_->turn_around_limit+1) {
- this_->distance_turn=50;
- level=navigation_get_announce_level(this_, this_->first->item.type, distance);
- if (level < this_->level_last) {
- dbg(1,"level %d < %d\n", level, this_->level_last);
- this_->level_last=level;
- force_speech=1;
- }
- if (!item_is_equal(this_->cmd_first->itm->item, this_->item_last)) {
- dbg(1,"item different\n");
- this_->item_last=this_->cmd_first->itm->item;
- force_speech=1;
- }
- }
- if (force_speech) {
- this_->level_last=level;
- dbg(1,"distance=%d level=%d type=0x%x\n", distance, level, this_->first->item.type);
- callback_list_call(this_->callback_speech, 1, &p);
- }
-}
-
-void
-navigation_update(struct navigation *this_, struct route *route)
-{
- struct map *map;
- struct map_rect *mr;
- struct item *ritem,*sitem;
- struct attr street_item;
- struct navigation_itm *itm;
- int incr=0;
-
- if (! route)
- return;
- map=route_get_map(route);
- if (! map)
- return;
- mr=map_rect_new(map, NULL);
- if (! mr)
- return;
- dbg(1,"enter\n");
- ritem=map_rect_get_item(mr);
- if (ritem) {
- if (item_attr_get(ritem, attr_street_item, &street_item)) {
- sitem=street_item.u.item;
- dbg(1,"sitem=%p\n", sitem);
- itm=item_hash_lookup(this_->hash, sitem);
- dbg(2,"itm for item with id (0x%x,0x%x) is %p\n", sitem->id_hi, sitem->id_lo, itm);
- navigation_destroy_itms_cmds(this_, itm);
- if (itm) {
- incr=1;
- navigation_itm_update(itm, ritem);
- } else {
- dbg(1,"not on track\n");
- do {
- dbg(1,"item\n");
- navigation_itm_new(this_, ritem);
- ritem=map_rect_get_item(mr);
- } while (ritem);
- itm=navigation_itm_new(this_, NULL);
- make_maneuvers(this_);
- }
- } else
- dbg(0,"no street_item\n");
- calculate_dest_distance(this_, incr);
- dbg(2,"destination distance old=%d new=%d\n", this_->distance_last, this_->first->dest_length);
- if (this_->first->dest_length > this_->distance_last && this_->distance_last >= 0)
- this_->turn_around++;
- else
- this_->turn_around--;
- if (this_->turn_around > this_->turn_around_limit)
- this_->turn_around=this_->turn_around_limit;
- else if (this_->turn_around < -this_->turn_around_limit+1)
- this_->turn_around=-this_->turn_around_limit+1;
- dbg(2,"turn_around=%d\n", this_->turn_around);
- this_->distance_last=this_->first->dest_length;
- profile(0,"end");
- navigation_call_callbacks(this_, FALSE);
- } else
- navigation_destroy_itms_cmds(this_, NULL);
- map_rect_destroy(mr);
-
-#if 0
- struct route_path_handle *rph;
- struct route_path_segment *s;
- struct navigation_itm *itm;
- struct route_info *pos,*dst;
- struct street_data *sd;
- int *speedlist;
- int len,end_flag=0;
- int incr;
-
- profile(0,NULL);
- pos=route_get_pos(route);
- dst=route_get_dst(route);
- if (! pos || ! dst)
- return;
- speedlist=route_get_speedlist(route);
- len=route_info_length(pos, dst, 0);
- dbg(2,"len pos,dst = %d\n", len);
- if (len == -1) {
- len=route_info_length(pos, NULL, 0);
- dbg(2,"len pos = %d\n", len);
- end_flag=1;
- }
- sd=route_info_street(pos);
- itm=item_hash_lookup(this_->hash, &sd->item);
- dbg(2,"itm for item with id (0x%x,0x%x) is %p\n", sd->item.id_hi, sd->item.id_lo, itm);
- navigation_destroy_itms_cmds(this_, itm);
- if (itm)
- incr=1;
- else {
- itm=navigation_itm_new(this_, &sd->item, route_info_point(pos, -1));
- incr=0;
- }
- itm->length=len;
- itm->time=route_time(speedlist, &sd->item, len);
- dbg(2,"%p time = %d\n", itm, itm->time);
- if (!incr) {
- printf("not on track\n");
- rph=route_path_open(route);
- if (rph) {
- while((s=route_path_get_segment(rph))) {
- itm=navigation_itm_new(this_, route_path_segment_get_item(s),route_path_segment_get_start(s));
- itm->time=route_path_segment_get_time(s);
- itm->length=route_path_segment_get_length(s);
- }
- route_path_close(rph);
- }
- if (end_flag) {
- len=route_info_length(NULL, dst, 0);
- dbg(1, "end %d\n", len);
- sd=route_info_street(dst);
- itm=navigation_itm_new(this_, &sd->item, route_info_point(pos, 2));
- itm->length=len;
- itm->time=route_time(speedlist, &sd->item, len);
- }
- itm=navigation_itm_new(this_, NULL, NULL);
- make_maneuvers(this_);
- }
- calculate_dest_distance(this_, incr);
- dbg(2,"destination distance old=%d new=%d\n", this_->distance_last, this_->first->dest_length);
- if (this_->first->dest_length > this_->distance_last && this_->distance_last >= 0)
- this_->turn_around=1;
- else
- this_->turn_around=0;
- dbg(2,"turn_around=%d\n", this_->turn_around);
- this_->distance_last=this_->first->dest_length;
- profile(0,"end");
- navigation_call_callbacks(this_, FALSE);
-#endif
-}
-
-void
-navigation_flush(struct navigation *this_)
-{
- navigation_destroy_itms_cmds(this_, NULL);
-}
-
-
-void
-navigation_destroy(struct navigation *this_)
-{
- navigation_flush(this_);
- item_hash_destroy(this_->hash);
- callback_list_destroy(this_->callback);
- callback_list_destroy(this_->callback_speech);
- g_free(this_);
-}
-
-int
-navigation_register_callback(struct navigation *this_, enum attr_type type, struct callback *cb)
-{
- if (type == attr_navigation_speech)
- callback_list_add(this_->callback_speech, cb);
- else
- callback_list_add(this_->callback, cb);
- return 1;
-}
-
-void
-navigation_unregister_callback(struct navigation *this_, enum attr_type type, struct callback *cb)
-{
- if (type == attr_navigation_speech)
- callback_list_remove_destroy(this_->callback_speech, cb);
- else
- callback_list_remove_destroy(this_->callback, cb);
-}
-
-struct map *
-navigation_get_map(struct navigation *this_)
-{
- struct attr navigation_attr;
- struct attr data_attr;
- struct attr *attrs_navigation[]={&navigation_attr, &data_attr, NULL};
- navigation_attr.type=attr_navigation;
- navigation_attr.u.navigation=this_;
- data_attr.type=attr_data;
- data_attr.u.str="";
-
- if (! this_->map)
- this_->map=map_new("navigation",attrs_navigation);
- return this_->map;
-}
-
-struct map_priv {
- struct navigation *navigation;
-};
-
-struct map_rect_priv {
- struct navigation *nav;
- struct navigation_command *cmd;
- struct navigation_command *cmd_next;
- struct navigation_itm *itm;
- struct navigation_itm *itm_next;
- struct item item;
-};
-
-static int
-navigation_map_item_coord_get(void *priv_data, struct coord *c, int count)
-{
- return 0;
-}
-
-static int
-navigation_map_item_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
-{
- struct map_rect_priv *this_=priv_data;
- attr->type=attr_type;
- switch(attr_type) {
- case attr_navigation_short:
- case attr_navigation_long:
- case attr_navigation_long_exact:
- case attr_navigation_speech:
- attr->u.str=show_maneuver(this_->nav, this_->itm, this_->cmd, attr_type);
- return 1;
- case attr_length:
- attr->u.num=this_->itm->dest_length-this_->cmd->itm->dest_length;
- return 1;
- case attr_time:
- attr->u.num=this_->itm->dest_time-this_->cmd->itm->dest_time;
- return 1;
- case attr_destination_length:
- attr->u.num=this_->itm->dest_length;
- return 1;
- case attr_destination_time:
- attr->u.num=this_->itm->dest_time;
- return 1;
- default:
- attr->type=attr_none;
- return 0;
- }
-}
-
-static struct item_methods navigation_map_item_methods = {
- NULL,
- navigation_map_item_coord_get,
- NULL,
- navigation_map_item_attr_get,
-};
-
-
-static void
-navigation_map_destroy(struct map_priv *priv)
-{
- g_free(priv);
-}
-
-static struct map_rect_priv *
-navigation_map_rect_new(struct map_priv *priv, struct map_selection *sel)
-{
- struct navigation *nav=priv->navigation;
- struct map_rect_priv *ret=g_new0(struct map_rect_priv, 1);
- ret->nav=nav;
- ret->cmd_next=nav->cmd_first;
- ret->itm_next=nav->first;
- ret->item.meth=&navigation_map_item_methods;
- ret->item.priv_data=ret;
- return ret;
-}
-
-static void
-navigation_map_rect_destroy(struct map_rect_priv *priv)
-{
- g_free(priv);
-}
-
-static struct item *
-navigation_map_get_item(struct map_rect_priv *priv)
-{
- struct item *ret;
- int delta;
- if (!priv->cmd_next)
- return NULL;
- ret=&priv->item;
- priv->cmd=priv->cmd_next;
- priv->itm=priv->itm_next;
- priv->itm_next=priv->cmd->itm;
- priv->cmd_next=priv->cmd->next;
-
- delta=priv->cmd->delta;
- dbg(1,"delta=%d\n", delta);
- if (delta < 0) {
- delta=-delta;
- if (delta < 45)
- ret->type=type_nav_left_1;
- else if (delta < 105)
- ret->type=type_nav_left_2;
- else if (delta < 165)
- ret->type=type_nav_left_3;
- else
- ret->type=type_none;
- } else {
- if (delta < 45)
- ret->type=type_nav_right_1;
- else if (delta < 105)
- ret->type=type_nav_right_2;
- else if (delta < 165)
- ret->type=type_nav_right_3;
- else
- ret->type=type_none;
- }
- dbg(1,"type=%d\n", ret->type);
- return ret;
-}
-
-static struct item *
-navigation_map_get_item_byid(struct map_rect_priv *priv, int id_hi, int id_lo)
-{
- dbg(0,"stub");
- return NULL;
-}
-
-static struct map_methods navigation_map_meth = {
- projection_mg,
- NULL,
- navigation_map_destroy,
- navigation_map_rect_new,
- navigation_map_rect_destroy,
- navigation_map_get_item,
- navigation_map_get_item_byid,
- NULL,
- NULL,
- NULL,
-};
-
-static struct map_priv *
-navigation_map_new(struct map_methods *meth, struct attr **attrs)
-{
- struct map_priv *ret;
- struct attr *navigation_attr;
-
- navigation_attr=attr_search(attrs, NULL, attr_navigation);
- if (! navigation_attr)
- return NULL;
- ret=g_new0(struct map_priv, 1);
- *meth=navigation_map_meth;
- ret->navigation=navigation_attr->u.navigation;
-
- return ret;
-}
-
-
-void
-navigation_init(void)
-{
- plugin_register_map_type("navigation", navigation_map_new);
-}
diff --git a/navit/navigation.h b/navit/navigation.h
deleted file mode 100644
index fb873ebf..00000000
--- a/navit/navigation.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef NAVIT_NAVIGATION_H
-#define NAVIT_NAVIGATION_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* prototypes */
-enum attr_type;
-enum item_type;
-struct attr;
-struct callback;
-struct map;
-struct navigation;
-struct route;
-struct navigation *navigation_new(struct attr **attrs);
-int navigation_set_announce(struct navigation *this_, enum item_type type, int *level);
-void navigation_update(struct navigation *this_, struct route *route);
-void navigation_flush(struct navigation *this_);
-void navigation_destroy(struct navigation *this_);
-int navigation_register_callback(struct navigation *this_, enum attr_type type, struct callback *cb);
-void navigation_unregister_callback(struct navigation *this_, enum attr_type type, struct callback *cb);
-struct map *navigation_get_map(struct navigation *this_);
-void navigation_init(void);
-/* end of prototypes */
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/navit/navit.c b/navit/navit.c
deleted file mode 100644
index 8ee06531..00000000
--- a/navit/navit.c
+++ /dev/null
@@ -1,1655 +0,0 @@
-#include <windows.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <signal.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <glib.h>
-#include <libintl.h>
-#include <math.h>
-#include "debug.h"
-#include "navit.h"
-#include "callback.h"
-#include "gui.h"
-#include "item.h"
-#include "projection.h"
-#include "map.h"
-#include "mapset.h"
-#include "main.h"
-#include "coord.h"
-#include "point.h"
-#include "transform.h"
-#include "param.h"
-#include "menu.h"
-#include "graphics.h"
-#include "cursor.h"
-#include "popup.h"
-#include "data_window.h"
-#include "route.h"
-#include "navigation.h"
-#include "speech.h"
-#include "track.h"
-#include "vehicle.h"
-#include "color.h"
-#include "layout.h"
-#include "log.h"
-#include "attr.h"
-
-#define _(STRING) gettext(STRING)
-/**
- * @defgroup navit the navit core instance
- * @{
- */
-
-struct navit_vehicle {
- int update;
- int update_curr;
- int follow;
- int follow_curr;
- struct coord coord;
- int dir;
- int speed;
- struct color c;
- struct color *c2;
- struct cursor *cursor;
- struct vehicle *vehicle;
- struct attr callback;
- int animate_cursor;
-};
-
-struct navit {
- struct attr self;
- GList *mapsets;
- GList *layouts;
- struct gui *gui;
- struct layout *layout_current;
- struct graphics *gra;
- struct action *action;
- struct transformation *trans;
- struct compass *compass;
- struct route *route;
- struct navigation *navigation;
- struct speech *speech;
- struct tracking *tracking;
- int ready;
- struct window *win;
- struct displaylist *displaylist;
- int cursor_flag;
- int tracking_flag;
- int orient_north_flag;
- GList *vehicles;
- GList *windows_items;
- struct navit_vehicle *vehicle;
- struct callback_list *attr_cbl;
- int pid;
- struct callback *nav_speech_cb;
- struct callback *roadbook_callback;
- struct callback *popup_callback;
- struct datawindow *roadbook_window;
- struct map *bookmark;
- struct map *former_destination;
- struct menu *bookmarks;
- GHashTable *bookmarks_hash;
- struct menu *destinations;
- struct point pressed, last, current;
- int button_pressed,moved,popped;
- guint button_timeout, motion_timeout;
- struct log *textfile_debug_log;
- struct pcoord destination;
- int destination_valid;
-};
-
-struct gui *main_loop_gui;
-
-struct attr_iter {
- union {
- GList *list;
- struct mapset_handle *mapset_handle;
- } u;
-};
-
-static void navit_vehicle_update(struct navit *this_, struct navit_vehicle *nv);
-static void navit_vehicle_draw(struct navit *this_, struct navit_vehicle *nv, struct point *pnt);
-
-void
-navit_add_mapset(struct navit *this_, struct mapset *ms)
-{
- this_->mapsets = g_list_append(this_->mapsets, ms);
-}
-
-struct mapset *
-navit_get_mapset(struct navit *this_)
-{
- if(this_->mapsets){
- return this_->mapsets->data;
- } else {
- g_warning("No mapsets enabled! Is it on purpose? Navit can't draw a map. Please check your navit.xml\n");
- }
- exit(-1);
-}
-
-struct tracking *
-navit_get_tracking(struct navit *this_)
-{
- return this_->tracking;
-}
-
-void
-navit_add_layout(struct navit *this_, struct layout *lay)
-{
- this_->layouts = g_list_append(this_->layouts, lay);
- if(!this_->layout_current) {
- this_->layout_current=lay;
- }
-}
-
-void
-navit_draw(struct navit *this_)
-{
- GList *l;
- struct navit_vehicle *nv;
-
- transform_setup_source_rect(this_->trans);
- graphics_draw(this_->gra, this_->displaylist, this_->mapsets, this_->trans, this_->layout_current);
- l=this_->vehicles;
- while (l) {
- nv=l->data;
- navit_vehicle_draw(this_, nv, NULL);
- l=g_list_next(l);
- }
-}
-
-void
-navit_draw_displaylist(struct navit *this_)
-{
- if (this_->ready == 3)
- graphics_displaylist_draw(this_->gra, this_->displaylist, this_->trans, this_->layout_current);
-}
-
-void
-navit_resize(void *data, int w, int h)
-{
- struct navit *this_=data;
- struct map_selection sel;
- memset(&sel, 0, sizeof(sel));
- sel.u.p_rect.rl.x=w;
- sel.u.p_rect.rl.y=h;
- transform_set_screen_selection(this_->trans, &sel);
- this_->ready |= 2;
- if (this_->ready == 3)
- navit_draw(this_);
-}
-
-static void
-navit_popup(void *data)
-{
- struct navit *this_=data;
- popup(this_, 1, &this_->pressed);
- this_->button_timeout=0;
- this_->popped=1;
-}
-
-
-static gboolean
-navit_handle_button_timeout(void *data)
-{
- callback_call_0((struct callback *)data);
- return FALSE;
-}
-
-
-int
-navit_handle_button(struct navit *this_, int pressed, int button, struct point *p, struct callback *popup_callback)
-{
- int border=16;
-
- if (pressed) {
- this_->pressed=*p;
- this_->last=*p;
- if (button == 1) {
- this_->button_pressed=1;
- this_->moved=0;
- this_->popped=0;
- if (popup_callback)
- this_->button_timeout=g_timeout_add(500, navit_handle_button_timeout, popup_callback);
- }
- if (button == 2)
- navit_set_center_screen(this_, p);
- if (button == 3)
- popup(this_, button, p);
- if (button == 4)
- navit_zoom_in(this_, 2, p);
- if (button == 5)
- navit_zoom_out(this_, 2, p);
- } else {
- this_->button_pressed=0;
- if (this_->button_timeout) {
- g_source_remove(this_->button_timeout);
- this_->button_timeout=0;
- if (! this_->moved && ! transform_within_border(this_->trans, p, border))
- navit_set_center_screen(this_, p);
-
- }
- if (this_->motion_timeout) {
- g_source_remove(this_->motion_timeout);
- this_->motion_timeout=0;
- }
- if (this_->moved) {
- struct point p;
- transform_get_size(this_->trans, &p.x, &p.y);
- p.x/=2;
- p.y/=2;
- p.x-=this_->last.x-this_->pressed.x;
- p.y-=this_->last.y-this_->pressed.y;
- navit_set_center_screen(this_, &p);
- } else
- return 1;
- }
- return 0;
-}
-
-static void
-navit_button(void *data, int pressed, int button, struct point *p)
-{
- struct navit *this=data;
- if (! this->popup_callback)
- this->popup_callback=callback_new_1(navit_popup, this);
- navit_handle_button(this, pressed, button, p, this->popup_callback);
-}
-
-
-static gboolean
-navit_motion_timeout(void *data)
-{
- struct navit *this_=data;
- int dx, dy;
-
- dx=(this_->current.x-this_->last.x);
- dy=(this_->current.y-this_->last.y);
- if (dx || dy) {
- this_->last=this_->current;
- graphics_displaylist_move(this_->displaylist, dx, dy);
- graphics_displaylist_draw(this_->gra, this_->displaylist, this_->trans, this_->layout_current);
- this_->moved=1;
- }
- this_->motion_timeout=0;
- return FALSE;
-}
-
-void
-navit_handle_motion(struct navit *this_, struct point *p)
-{
- int dx, dy;
-
- if (this_->button_pressed && !this_->popped) {
- dx=(p->x-this_->pressed.x);
- dy=(p->y-this_->pressed.y);
- if (dx < -8 || dx > 8 || dy < -8 || dy > 8) {
- if (this_->button_timeout) {
- g_source_remove(this_->button_timeout);
- this_->button_timeout=0;
- }
- this_->current=*p;
- if (! this_->motion_timeout)
- this_->motion_timeout=g_timeout_add(100, navit_motion_timeout, this_);
- }
- }
-}
-
-static void
-navit_motion(void *data, struct point *p)
-{
- navit_handle_motion((struct navit *)data, p);
-}
-
-static void
-navit_scale(struct navit *this_, long scale, struct point *p)
-{
- struct coord c1, c2, *center;
- if (p)
- transform_reverse(this_->trans, p, &c1);
- transform_set_scale(this_->trans, scale);
- if (p) {
- transform_reverse(this_->trans, p, &c2);
- center = transform_center(this_->trans);
- center->x += c1.x - c2.x;
- center->y += c1.y - c2.y;
- }
- navit_draw(this_);
-}
-
-/**
- * Change the current zoom level, zooming closer to the ground
- *
- * @param navit The navit instance
- * @param factor The zoom factor, usually 2
- * @param p The invariant point (if set to NULL, default to center)
- * @returns nothing
- */
-void
-navit_zoom_in(struct navit *this_, int factor, struct point *p)
-{
- long scale=transform_get_scale(this_->trans)/factor;
- if (scale < 1)
- scale=1;
- navit_scale(this_, scale, p);
-}
-
-/**
- * Change the current zoom level
- *
- * @param navit The navit instance
- * @param factor The zoom factor, usually 2
- * @param p The invariant point (if set to NULL, default to center)
- * @returns nothing
- */
-void
-navit_zoom_out(struct navit *this_, int factor, struct point *p)
-{
- long scale=transform_get_scale(this_->trans)*factor;
- navit_scale(this_, scale, p);
-}
-
-struct navit *
-navit_new(struct attr *parent, struct attr **attrs)
-{
- struct navit *this_=g_new0(struct navit, 1);
- struct pcoord center;
- struct coord co;
- struct coord_geo g;
- enum projection pro=projection_mg;
- int zoom = 256;
- g.lat=53.13;
- g.lng=11.70;
-
- main_add_navit(this_);
- this_->self.type=attr_navit;
- this_->self.u.navit=this_;
- this_->attr_cbl=callback_list_new();
-
-#if !defined(__CEGCC__) && !defined(_WIN32)
- FILE *f;
- f=popen("pidof /usr/bin/ipaq-sleep","r");
- if (f) {
- fscanf(f,"%d",&this_->pid);
- dbg(1,"ipaq_sleep pid=%d\n", this_->pid);
- pclose(f);
- }
-#endif
- this_->bookmarks_hash=g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
-
- this_->cursor_flag=1;
- this_->orient_north_flag=0;
- this_->tracking_flag=1;
-
- for (;*attrs; attrs++) {
- switch((*attrs)->type) {
- case attr_zoom:
- zoom=(*attrs)->u.num;
- break;
- case attr_center:
- g=*((*attrs)->u.coord_geo);
- break;
- case attr_cursor:
- this_->cursor_flag=!!(*attrs)->u.num;
- break;
- case attr_orientation:
- this_->orient_north_flag=!!(*attrs)->u.num;
- break;
- case attr_tracking:
- this_->tracking_flag=!!(*attrs)->u.num;
- break;
- default:
- dbg(0, "Unexpected attribute %x\n",(*attrs)->type);
- break;
- }
- }
- transform_from_geo(pro, &g, &co);
- center.x=co.x;
- center.y=co.y;
- center.pro = pro;
-
- this_->trans=transform_new();
- transform_setup(this_->trans, &center, zoom, 0);
- this_->displaylist=graphics_displaylist_new();
- return this_;
-}
-
-static int
-navit_set_gui(struct navit *this_, struct gui *gui)
-{
- if (this_->gui)
- return 0;
- this_->gui=gui;
- if (gui_has_main_loop(this_->gui)) {
- if (! main_loop_gui) {
- main_loop_gui=this_->gui;
- } else {
- g_warning("gui with main loop already active, ignoring this instance");
- return 0;
- }
- }
- return 1;
-}
-
-static int
-navit_set_graphics(struct navit *this_, struct graphics *gra)
-{
- if (this_->gra)
- return 0;
- this_->gra=gra;
- graphics_register_resize_callback(this_->gra, navit_resize, this_);
- graphics_register_button_callback(this_->gra, navit_button, this_);
- graphics_register_motion_callback(this_->gra, navit_motion, this_);
- return 1;
-}
-
-struct graphics *
-navit_get_graphics(struct navit *this_)
-{
- return this_->gra;
-}
-
-static void
-navit_projection_set(struct navit *this_, enum projection pro)
-{
- struct coord_geo g;
- struct coord *c;
-
- c=transform_center(this_->trans);
- transform_to_geo(transform_get_projection(this_->trans), c, &g);
- transform_set_projection(this_->trans, pro);
- transform_from_geo(pro, &g, c);
- navit_draw(this_);
-}
-
-static void
-navit_add_menu_destinations(struct navit *this_, char *name, struct menu *rmen, GHashTable *h, struct callback *cb)
-{
- char buffer2[2048];
- char *i,*n;
- struct menu *men,*nmen;
-
- if (rmen) {
- i=name;
- n=name;
- men=rmen;
- while (h && (i=strchr(n, '/'))) {
- strcpy(buffer2, name);
- buffer2[i-name]='\0';
- if (!(nmen=g_hash_table_lookup(h, buffer2))) {
- nmen=menu_add(men, buffer2+(n-name), menu_type_submenu, NULL);
- g_hash_table_insert(h, g_strdup(buffer2), nmen);
- }
- n=i+1;
- men=nmen;
- }
- menu_add(men, n, menu_type_menu, cb);
- }
-}
-
-static void
-navit_append_coord(struct navit *this_, char *file, struct pcoord *c, char *type, const char *description, struct menu *rmen, GHashTable *h, void (*cb_func)(void))
-{
- FILE *f;
- int offset=0;
- char *buffer;
- const char *prostr;
- struct callback *cb;
-
- f=fopen(file, "a");
- if (f) {
- offset=ftell(f);
- if (c) {
- prostr = projection_to_name(c->pro);
- fprintf(f,"%s%s0x%x 0x%x type=%s label=\"%s\"\n",
- prostr, *prostr ? ":" : "", c->x, c->y, type, description);
- } else
- fprintf(f,"\n");
- fclose(f);
- }
- if (c) {
- buffer=g_strdup(description);
- cb=callback_new_2(cb_func, this_, (void *)offset);
- navit_add_menu_destinations(this_, buffer, rmen, h, cb);
- g_free(buffer);
- }
-}
-
-static int
-parse_line(FILE *f, char *buffer, char **name, struct pcoord *c)
-{
- int pos;
- char *s,*i;
- struct coord co;
- char *cp;
- enum projection pro = projection_mg;
- *name=NULL;
- if (! fgets(buffer, 2048, f))
- return -3;
- cp = buffer;
- pos=coord_parse(cp, pro, &co);
- if (!pos)
- return -2;
- if (!cp[pos] || cp[pos] == '\n')
- return -1;
- cp[strlen(cp)-1]='\0';
- s=cp+pos+1;
- if (!strncmp(s,"type=", 5)) {
- i=strchr(s, '"');
- if (i) {
- s=i+1;
- i=strchr(s, '"');
- if (i)
- *i='\0';
- }
- }
- *name=s;
- c->x = co.x;
- c->y = co.y;
- c->pro = pro;
- return pos;
-}
-
-
-static void
-navit_set_destination_from_file(struct navit *this_, char *file, int bookmark, int offset)
-{
- FILE *f;
- char *name, *description, buffer[2048];
- struct pcoord c;
-
- f=fopen(file, "r");
- if (! f)
- return;
- fseek(f, offset, SEEK_SET);
- if (parse_line(f, buffer, &name, &c) <= 0)
- return;
- if (bookmark) {
- description=g_strdup_printf("Bookmark %s", name);
- navit_set_destination(this_, &c, description);
- g_free(description);
- } else
- navit_set_destination(this_, &c, name);
-}
-
-static void
-navit_set_destination_from_destination(struct navit *this_, void *offset_p)
-{
- navit_set_destination_from_file(this_, "destination.txt", 0, (int)offset_p);
-}
-
-static void
-navit_set_destination_from_bookmark(struct navit *this_, void *offset_p)
-{
- navit_set_destination_from_file(this_, "bookmark.txt", 1, (int)offset_p);
-}
-
-static void
-navit_set_center_from_file(struct navit *this_, char *file)
-{
- FILE *f;
- char *line = NULL;
-
- size_t line_size = 0;
- enum projection pro;
- struct coord *center;
-
- file = g_strjoin(NULL, get_home_directory(), "/.navit/", file, NULL);
- if (!file_exists(file)) {
- g_free(file);
- return;
- }
- f = fopen(file, "r");
- getline(&line, &line_size, f);
- fclose(f);
- g_free(file);
- if (line) {
- center = transform_center(this_->trans);
- pro = transform_get_projection(this_->trans);
- coord_parse(g_strchomp(line), pro, center);
- free(line);
- }
- return;
-}
-
-static void
-navit_write_center_to_file(struct navit *this_, char *file)
-{
- FILE *f;
- enum projection pro;
- struct coord *center;
- char *directory;
-
- directory = g_strjoin(NULL, get_home_directory(), "/.navit/", NULL);
- if (!file_exists(directory)) {
- if (mkdir(directory
-#if !defined(_WIN32) || defined(__CEGCC__)
- ,S_IRUSR|S_IWUSR|S_IXUSR
- |S_IRGRP|S_IXGRP|
- S_IROTH|S_IXOTH
-#endif
- ) == -1) {
- perror(directory);
- g_free(directory);
- return;
- }
- }
-
- file = g_strjoin(NULL, directory, file, NULL);
- g_free(directory);
- f = fopen(file, "w+");
- if (f) {
- center = transform_center(this_->trans);
- pro = transform_get_projection(this_->trans);
- coord_print(pro, center, f);
- fclose(f);
- } else {
- perror(file);
- }
- g_free(file);
- return;
-}
-
-
-/**
- * Start the route computing to a given set of coordinates
- *
- * @param navit The navit instance
- * @param c The coordinate to start routing to
- * @param description A label which allows the user to later identify this destination in the former destinations selection
- * @returns nothing
- */
-void
-navit_set_destination(struct navit *this_, struct pcoord *c, char *description)
-{
- if (c) {
- this_->destination=*c;
- this_->destination_valid=1;
- } else
- this_->destination_valid=0;
- navit_append_coord(this_, "destination.txt", c, "former_destination", description, this_->destinations, NULL, callback_cast(navit_set_destination_from_destination));
- callback_list_call_attr_1(this_->attr_cbl, attr_destination, this_);
- if (this_->route) {
- route_set_destination(this_->route, c);
- if (this_->navigation)
- navigation_flush(this_->navigation);
- navit_draw(this_);
- }
-}
-
-/**
- * Record the given set of coordinates as a bookmark
- *
- * @param navit The navit instance
- * @param c The coordinate to store
- * @param description A label which allows the user to later identify this bookmark
- * @returns nothing
- */
-void
-navit_add_bookmark(struct navit *this_, struct pcoord *c, const char *description)
-{
- navit_append_coord(this_,"bookmark.txt", c, "bookmark", description, this_->bookmarks, this_->bookmarks_hash, callback_cast(navit_set_destination_from_bookmark));
-}
-
-struct navit *global_navit;
-
-static void
-navit_add_menu_destinations_from_file(struct navit *this_, char *file, struct menu *rmen, GHashTable *h, struct route *route, void (*cb_func)(void))
-{
- int pos,flag=0;
- FILE *f;
- char buffer[2048];
- struct pcoord c;
- char *name;
- int offset=0;
- struct callback *cb;
-
- f=fopen(file, "r");
- if (f) {
- while (! feof(f) && (pos=parse_line(f, buffer, &name, &c)) > -3) {
- if (pos > 0) {
- cb=callback_new_2(cb_func, this_, (void *)offset);
- navit_add_menu_destinations(this_, name, rmen, h, cb);
- flag=1;
- } else
- flag=0;
- offset=ftell(f);
- }
- fclose(f);
- if (route && flag) {
- this_->destination=c;
- this_->destination_valid=1;
- route_set_destination(route, &c);
- }
- }
-}
-
-static void
-navit_add_menu_former_destinations(struct navit *this_, struct menu *men, struct route *route)
-{
- if (men)
- this_->destinations=menu_add(men, _("Former Destinations"), menu_type_submenu, NULL);
- else
- this_->destinations=NULL;
- navit_add_menu_destinations_from_file(this_, "destination.txt", this_->destinations, NULL, route, callback_cast(navit_set_destination_from_destination));
-}
-
-//static void
-//navit_add_menu_bookmarks(struct navit *this_, struct menu *men)
-//{
-// if (men)
-// this_->bookmarks=menu_add(men, _("Bookmarks"), menu_type_submenu, NULL);
-// else
-// this_->bookmarks=NULL;
-// navit_add_menu_destinations_from_file(this_, "bookmark.txt", this_->bookmarks, this_->bookmarks_hash, NULL, callback_cast(navit_set_destination_from_bookmark));
-//}
-
-static void
-navit_add_bookmarks_from_file(struct navit *this_)
-{
- struct attr type={attr_type, {"textfile"}}, data={attr_data, {"bookmark.txt"}};
- struct attr *attrs[]={&type, &data, NULL};
-
- this_->bookmark=map_new("textfile", attrs);
-}
-
-static void
-navit_add_former_destinations_from_file(struct navit *this_)
-{
- struct attr type={attr_type, {"textfile"}}, data={attr_data, {"destination.txt"}};
- struct attr *attrs[]={&type, &data, NULL};
-
- this_->former_destination=map_new("textfile", attrs);
-}
-
-
-static void
-navit_textfile_debug_log(struct navit *this_, const char *fmt, ...)
-{
- va_list ap;
- char *str1,*str2;
- va_start(ap, fmt);
- if (this_->textfile_debug_log && this_->vehicle) {
- str1=g_strdup_vprintf(fmt, ap);
- str2=g_strdup_printf("0x%x 0x%x%s%s\n", this_->vehicle->coord.x, this_->vehicle->coord.y, strlen(str1) ? " " : "", str1);
- log_write(this_->textfile_debug_log, str2, strlen(str2));
- g_free(str2);
- g_free(str1);
- }
- va_end(ap);
-}
-
-
-void
-navit_speak(struct navit *this_)
-{
- struct navigation *nav=this_->navigation;
- struct map *map=NULL;
- struct map_rect *mr=NULL;
- struct item *item;
- struct attr attr;
-
- if (nav)
- map=navigation_get_map(nav);
- if (map)
- mr=map_rect_new(map, NULL);
- if (mr) {
- item=map_rect_get_item(mr);
- if (item && item_attr_get(item, attr_navigation_speech, &attr)) {
- speech_say(this_->speech, attr.u.str);
- navit_textfile_debug_log(this_, "item=point_debug debug=\"speech_say('%s')\"", attr.u.str);
- }
- map_rect_destroy(mr);
- }
-}
-
-static void
-navit_window_roadbook_update(struct navit *this_)
-{
- struct navigation *nav=this_->navigation;
- struct map *map=NULL;
- struct map_rect *mr=NULL;
- struct item *item;
- struct attr attr;
- struct param_list param[5];
- int secs;
-
- dbg(1,"enter\n");
- datawindow_mode(this_->roadbook_window, 1);
- if (nav)
- map=navigation_get_map(nav);
- if (map)
- mr=map_rect_new(map, NULL);
- dbg(0,"nav=%p map=%p mr=%p\n", nav, map, mr);
- if (mr) {
- dbg(0,"while loop\n");
- while ((item=map_rect_get_item(mr))) {
- dbg(0,"item=%p\n", item);
- attr.u.str=NULL;
- item_attr_get(item, attr_navigation_long, &attr);
- dbg(2, "Command='%s'\n", attr.u.str);
- param[0].name=_("Command");
- param[0].value=g_strdup(attr.u.str);
-
- item_attr_get(item, attr_length, &attr);
- dbg(2, "Length=%d\n", attr.u.num);
- param[1].name=_("Length");
-
- if ( attr.u.num >= 2000 )
- {
- param[1].value=g_strdup_printf("%5.1f %s",(float)attr.u.num / 1000, _("km") );
- }
- else
- {
- param[1].value=g_strdup_printf("%7d %s",attr.u.num, _("m"));
- }
-
- item_attr_get(item, attr_time, &attr);
- dbg(2, "Time=%d\n", attr.u.num);
- secs=attr.u.num/10;
- param[2].name=_("Time");
- if ( secs >= 3600 )
- {
- param[2].value=g_strdup_printf("%d:%02d:%02d",secs / 60, ( secs / 60 ) % 60 , secs % 60);
- }
- else
- {
- param[2].value=g_strdup_printf("%d:%02d",secs / 60, secs % 60);
- }
-
- item_attr_get(item, attr_destination_length, &attr);
- dbg(2, "Destlength=%d\n", attr.u.num);
- param[3].name=_("Destination Length");
- if ( attr.u.num >= 2000 )
- {
- param[3].value=g_strdup_printf("%5.1f %s",(float)attr.u.num / 1000, _("km") );
- }
- else
- {
- param[3].value=g_strdup_printf("%d %s",attr.u.num, _("m"));
- }
-
- item_attr_get(item, attr_destination_time, &attr);
- dbg(2, "Desttime=%d\n", attr.u.num);
- secs=attr.u.num/10;
- param[4].name=_("Destination Time");
- if ( secs >= 3600 )
- {
- param[4].value=g_strdup_printf("%d:%02d:%02d",secs / 3600, (secs / 60 ) % 60 , secs % 60);
- }
- else
- {
- param[4].value=g_strdup_printf("%d:%02d",secs / 60, secs % 60);
- }
- datawindow_add(this_->roadbook_window, param, 5);
- }
- map_rect_destroy(mr);
- }
- datawindow_mode(this_->roadbook_window, 0);
-}
-
-void
-navit_window_roadbook_destroy(struct navit *this_)
-{
- dbg(0, "enter\n");
- navigation_unregister_callback(this_->navigation, attr_navigation_long, this_->roadbook_callback);
- this_->roadbook_window=NULL;
- this_->roadbook_callback=NULL;
-}
-void
-navit_window_roadbook_new(struct navit *this_)
-{
- this_->roadbook_callback=callback_new_1(callback_cast(navit_window_roadbook_update), this_);
- navigation_register_callback(this_->navigation, attr_navigation_long, this_->roadbook_callback);
- this_->roadbook_window=gui_datawindow_new(this_->gui, _("Roadbook"), NULL, callback_new_1(callback_cast(navit_window_roadbook_destroy), this_));
- navit_window_roadbook_update(this_);
-}
-
-static void
-get_direction(char *buffer, int angle, int mode)
-{
- angle=angle%360;
- switch (mode) {
- case 0:
- sprintf(buffer,"%d",angle);
- break;
- case 1:
- if (angle < 69 || angle > 291)
- *buffer++='N';
- if (angle > 111 && angle < 249)
- *buffer++='S';
- if (angle > 22 && angle < 158)
- *buffer++='E';
- if (angle > 202 && angle < 338)
- *buffer++='W';
- *buffer++='\0';
- break;
- case 2:
- angle=(angle+15)/30;
- if (! angle)
- angle=12;
- sprintf(buffer,"%d H", angle);
- break;
- }
-}
-
-struct navit_window_items {
- struct datawindow *win;
- struct callback *click;
- char *name;
- int distance;
- GHashTable *hash;
- GList *list;
-};
-
-static void
-navit_window_items_click(struct navit *this_, struct navit_window_items *nwi, char **col)
-{
- struct pcoord c;
- char *description;
-
- // FIXME
- dbg(0,"enter col=%s,%s,%s,%s,%s\n", col[0], col[1], col[2], col[3], col[4]);
- sscanf(col[4], "0x%x,0x%x", &c.x, &c.y);
- c.pro = projection_mg;
- dbg(0,"0x%x,0x%x\n", c.x, c.y);
- description=g_strdup_printf("%s %s", nwi->name, col[3]);
- navit_set_destination(this_, &c, description);
- g_free(description);
-}
-
-static void
-navit_window_items_open(struct navit *this_, struct navit_window_items *nwi)
-{
- struct map_selection sel;
- struct coord c,*center;
- struct mapset_handle *h;
- struct map *m;
- struct map_rect *mr;
- struct item *item;
- struct attr attr;
- int idist,dist;
- struct param_list param[5];
- char distbuf[32];
- char dirbuf[32];
- char coordbuf[64];
-
- dbg(0, "distance=%d\n", nwi->distance);
- if (nwi->distance == -1)
- dist=40000000;
- else
- dist=nwi->distance*1000;
- param[0].name="Distance";
- param[1].name="Direction";
- param[2].name="Type";
- param[3].name="Name";
- param[4].name=NULL;
- sel.next=NULL;
-#if 0
- sel.order[layer_town]=18;
- sel.order[layer_street]=18;
- sel.order[layer_poly]=18;
-#else
- sel.order[layer_town]=0;
- sel.order[layer_street]=0;
- sel.order[layer_poly]=0;
-#endif
- center=transform_center(this_->trans);
- sel.u.c_rect.lu.x=center->x-dist;
- sel.u.c_rect.lu.y=center->y+dist;
- sel.u.c_rect.rl.x=center->x+dist;
- sel.u.c_rect.rl.y=center->y-dist;
- dbg(2,"0x%x,0x%x - 0x%x,0x%x\n", sel.u.c_rect.lu.x, sel.u.c_rect.lu.y, sel.u.c_rect.rl.x, sel.u.c_rect.rl.y);
- nwi->click=callback_new_2(callback_cast(navit_window_items_click), this_, nwi);
- nwi->win=gui_datawindow_new(this_->gui, nwi->name, nwi->click, NULL);
- h=mapset_open(navit_get_mapset(this_));
- while ((m=mapset_next(h, 1))) {
- dbg(2,"m=%p %s\n", m, map_get_filename(m));
- mr=map_rect_new(m, &sel);
- dbg(2,"mr=%p\n", mr);
- while ((item=map_rect_get_item(mr))) {
- if (item_coord_get(item, &c, 1)) {
- if (coord_rect_contains(&sel.u.c_rect, &c) && g_hash_table_lookup(nwi->hash, &item->type)) {
- if (! item_attr_get(item, attr_label, &attr))
- attr.u.str="";
- idist=transform_distance(map_projection(item->map), center, &c);
- if (idist < dist) {
- get_direction(dirbuf, transform_get_angle_delta(center, &c, 0), 1);
- param[0].value=distbuf;
- param[1].value=dirbuf;
- param[2].value=item_to_name(item->type);
- sprintf(distbuf,"%d", idist/1000);
- param[3].value=attr.u.str;
- sprintf(coordbuf, "0x%x,0x%x", c.x, c.y);
- param[4].value=coordbuf;
- datawindow_add(nwi->win, param, 5);
- }
- /* printf("gefunden %s %s %d\n",item_to_name(item->type), attr.u.str, idist/1000); */
- }
- if (item->type >= type_line)
- while (item_coord_get(item, &c, 1));
- }
- }
- map_rect_destroy(mr);
- }
- mapset_close(h);
-}
-
-struct navit_window_items *
-navit_window_items_new(const char *name, int distance)
-{
- struct navit_window_items *nwi=g_new0(struct navit_window_items, 1);
- nwi->name=g_strdup(name);
- nwi->distance=distance;
- nwi->hash=g_hash_table_new(g_int_hash, g_int_equal);
-
- return nwi;
-}
-
-void
-navit_window_items_add_item(struct navit_window_items *nwi, enum item_type type)
-{
- nwi->list=g_list_prepend(nwi->list, (void *)type);
- g_hash_table_insert(nwi->hash, &nwi->list->data, (void *)1);
-}
-
-void
-navit_add_window_items(struct navit *this_, struct navit_window_items *nwi)
-{
- this_->windows_items=g_list_append(this_->windows_items, nwi);
-}
-
-//static void
-//navit_add_menu_windows_items(struct navit *this_, struct menu *men)
-//{
-// struct navit_window_items *nwi;
-// struct callback *cb;
-// GList *l;
-// l=this_->windows_items;
-// while (l) {
-// nwi=l->data;
-// cb=callback_new_2(callback_cast(navit_window_items_open), this_, nwi);
-// menu_add(men, nwi->name, menu_type_menu, cb);
-// l=g_list_next(l);
-// }
-//}
-
-void
-navit_init(struct navit *this_)
-{
- struct mapset *ms;
- struct map *map;
- GList *l;
- struct navit_vehicle *nv;
-
- if (!this_->gui) {
- g_warning("no gui\n");
- navit_destroy(this_);
- return;
- }
- if (!this_->gra) {
- g_warning("no graphics\n");
- navit_destroy(this_);
- return;
- }
- if (gui_set_graphics(this_->gui, this_->gra)) {
- struct attr attr_type_gui, attr_type_graphics;
- gui_get_attr(this_->gui, attr_type, &attr_type_gui, NULL);
- graphics_get_attr(this_->gra, attr_type, &attr_type_graphics, NULL);
- g_warning("failed to connect graphics '%s' to gui '%s'\n", attr_type_graphics.u.str, attr_type_gui.u.str);
- g_warning(" Please see http://wiki.navit-project.org/index.php/Failed_to_connect_graphics_to_gui\n");
- g_warning(" for explanations and solutions\n");
-
- navit_destroy(this_);
- return;
- }
- graphics_init(this_->gra);
- l=this_->vehicles;
- while (l) {
- dbg(1,"parsed one vehicle\n");
- nv=l->data;
- nv->cursor=cursor_new(this_->gra, &nv->c, nv->c2, nv->animate_cursor);
- nv->callback.type=attr_callback;
- nv->callback.u.callback=callback_new_2(callback_cast(navit_vehicle_update), this_, nv);
- vehicle_add_attr(nv->vehicle, &nv->callback);
- vehicle_set_attr(nv->vehicle, &this_->self, NULL);
- l=g_list_next(l);
- }
- if (this_->mapsets) {
- ms=this_->mapsets->data;
- if (this_->route) {
- if ((map=route_get_map(this_->route)))
- mapset_add(ms, map);
- if ((map=route_get_graph_map(this_->route))) {
- mapset_add(ms, map);
- map_set_active(map, 0);
- }
- route_set_mapset(this_->route, ms);
- }
- if (this_->tracking)
- tracking_set_mapset(this_->tracking, ms);
- if (this_->navigation) {
- if ((map=navigation_get_map(this_->navigation))) {
- mapset_add(ms, map);
- map_set_active(map, 0);
- }
- }
- navit_add_bookmarks_from_file(this_);
- navit_add_former_destinations_from_file(this_);
- navit_add_menu_former_destinations(this_, NULL, this_->route);
- }
- if (this_->navigation && this_->speech) {
- this_->nav_speech_cb=callback_new_1(callback_cast(navit_speak), this_);
- navigation_register_callback(this_->navigation, attr_navigation_speech, this_->nav_speech_cb);
- }
- navit_set_center_from_file(this_, "center.txt");
-#if 0
- if (this_->menubar) {
- men=menu_add(this_->menubar, "Data", menu_type_submenu, NULL);
- if (men) {
- navit_add_menu_windows_items(this_, men);
- }
- }
-#endif
- global_navit=this_;
-#if 0
- navit_window_roadbook_new(this_);
- navit_window_items_new(this_);
-#endif
- callback_list_call_attr_1(this_->attr_cbl, attr_navit, this_);
- this_->ready|=1;
- if (this_->ready == 3)
- navit_draw(this_);
-}
-
-void
-navit_set_center(struct navit *this_, struct pcoord *center)
-{
- struct coord *c=transform_center(this_->trans);
- struct coord c1,c2;
- enum projection pro = transform_get_projection(this_->trans);
- if (pro != center->pro) {
- c1.x = center->x;
- c1.y = center->y;
- transform_from_to(&c1, center->pro, &c2, pro);
- } else {
- c2.x = center->x;
- c2.y = center->y;
- }
- *c=c2;
- if (this_->ready == 3)
- navit_draw(this_);
-}
-
-static void
-navit_set_center_cursor(struct navit *this_, struct coord *cursor, int dir, int xpercent, int ypercent)
-{
- struct coord *c=transform_center(this_->trans);
- int width, height;
- struct point p;
- struct coord cnew;
-
- transform_get_size(this_->trans, &width, &height);
- *c=*cursor;
- transform_set_angle(this_->trans, dir);
- p.x=(100-xpercent)*width/100;
- p.y=(100-ypercent)*height/100;
- transform_reverse(this_->trans, &p, &cnew);
- *c=cnew;
- if (this_->ready == 3)
- navit_draw(this_);
-}
-
-
-void
-navit_set_center_screen(struct navit *this_, struct point *p)
-{
- struct coord c;
- struct pcoord pc;
- transform_reverse(this_->trans, p, &c);
- pc.x = c.x;
- pc.y = c.y;
- pc.pro = transform_get_projection(this_->trans);
- navit_set_center(this_, &pc);
-}
-
-int
-navit_set_attr(struct navit *this_, struct attr *attr)
-{
- int dir=0, orient_old=0, attr_updated=0;
-
- switch (attr->type) {
- case attr_cursor:
- if (this_->cursor_flag != !!attr->u.num) {
- this_->cursor_flag=!!attr->u.num;
- attr_updated=1;
- }
- break;
- case attr_layout:
- if(this_->layout_current!=attr->u.layout) {
- this_->layout_current=attr->u.layout;
- navit_draw(this_);
- attr_updated=1;
- }
- break;
- case attr_orientation:
- orient_old=this_->orient_north_flag;
- this_->orient_north_flag=!!attr->u.num;
- if (this_->orient_north_flag) {
- dir = 0;
- } else {
- if (this_->vehicle) {
- dir = this_->vehicle->dir;
- }
- }
- transform_set_angle(this_->trans, dir);
- if (orient_old != this_->orient_north_flag) {
- navit_draw(this_);
- attr_updated=1;
- }
- break;
- case attr_projection:
- if(this_->trans && transform_get_projection(this_->trans) != attr->u.projection) {
- navit_projection_set(this_, attr->u.projection);
- attr_updated=1;
- }
- break;
- case attr_tracking:
- if (this_->tracking_flag != !!attr->u.num) {
- this_->tracking_flag=!!attr->u.num;
- attr_updated=1;
- }
- break;
- case attr_vehicle:
- if (!this_->vehicle || this_->vehicle->vehicle != attr->u.vehicle) {
- GList *l;
- l=this_->vehicles;
- while(l) {
- if (((struct navit_vehicle *)l->data)->vehicle == attr->u.vehicle) {
- this_->vehicle=(struct navit_vehicle *)l->data;
- attr_updated=1;
- }
- l=g_list_next(l);
- }
- }
- break;
- default:
- return 0;
- }
- if (attr_updated) {
- callback_list_call_attr_2(this_->attr_cbl, attr->type, this_, attr);
- }
- return 1;
-}
-
-int
-navit_get_attr(struct navit *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
-{
- switch (type) {
- case attr_bookmark_map:
- attr->u.map=this_->bookmark;
- break;
- case attr_cursor:
- attr->u.num=this_->cursor_flag;
- break;
- case attr_destination:
- if (! this_->destination_valid)
- return 0;
- attr->u.pcoord=&this_->destination;
- break;
- case attr_former_destination_map:
- attr->u.map=this_->former_destination;
- break;
- case attr_layout:
- if (iter) {
- if (iter->u.list) {
- iter->u.list=g_list_next(iter->u.list);
- } else {
- iter->u.list=this_->layouts;
- }
- if (!iter->u.list)
- return 0;
- attr->u.layout=(struct layout *)iter->u.list->data;
- } else {
- attr->u.layout=this_->layout_current;
- }
- break;
- case attr_map:
- if (iter && this_->mapsets) {
- if (!iter->u.mapset_handle) {
- iter->u.mapset_handle=mapset_open((struct mapset *)this_->mapsets->data);
- }
- attr->u.map=mapset_next(iter->u.mapset_handle, 0);
- if(!attr->u.map) {
- mapset_close(iter->u.mapset_handle);
- return 0;
- }
- } else {
- return 0;
- }
- break;
- case attr_orientation:
- attr->u.num=this_->orient_north_flag;
- break;
- case attr_projection:
- if(this_->trans) {
- attr->u.num=transform_get_projection(this_->trans);
- } else {
- return 0;
- }
- break;
- case attr_tracking:
- attr->u.num=this_->tracking_flag;
- break;
- case attr_vehicle:
- if(iter) {
- if(iter->u.list) {
- iter->u.list=g_list_next(iter->u.list);
- } else {
- iter->u.list=this_->vehicles;
- }
- if(!iter->u.list)
- return 0;
- attr->u.vehicle=((struct navit_vehicle*)iter->u.list->data)->vehicle;
- } else {
- if(this_->vehicle) {
- attr->u.vehicle=this_->vehicle->vehicle;
- } else {
- return 0;
- }
- }
- break;
- default:
- return 0;
- }
- attr->type=type;
- return 1;
-}
-
-static int
-navit_add_log(struct navit *this_, struct log *log)
-{
- struct attr type_attr;
- if (!log_get_attr(log, attr_type, &type_attr, NULL))
- return 0;
- if (!strcmp(type_attr.u.str, "textfile_debug")) {
- if (this_->textfile_debug_log)
- return 0;
- this_->textfile_debug_log=log;
- return 1;
- }
- return 0;
-}
-
-int
-navit_add_attr(struct navit *this_, struct attr *attr)
-{
- switch (attr->type) {
- case attr_log:
- return navit_add_log(this_, attr->u.log);
- case attr_gui:
- return navit_set_gui(this_, attr->u.gui);
- case attr_graphics:
- return navit_set_graphics(this_, attr->u.graphics);
- case attr_route:
- this_->route=attr->u.route;
- route_set_projection(this_->route, transform_get_projection(this_->trans));
- break;
- case attr_navigation:
- this_->navigation=attr->u.navigation;
- break;
- default:
- return 0;
- }
- return 1;
-}
-
-struct attr_iter *
-navit_attr_iter_new()
-{
- return g_new0(struct attr_iter, 1);
-}
-
-void
-navit_attr_iter_destroy(struct attr_iter *iter)
-{
- g_free(iter);
-}
-
-void
-navit_add_callback(struct navit *this_, struct callback *cb)
-{
- callback_list_add(this_->attr_cbl, cb);
-}
-
-void
-navit_remove_callback(struct navit *this_, struct callback *cb)
-{
- callback_list_remove(this_->attr_cbl, cb);
-}
-
-/**
- * Toggle the cursor update : refresh the map each time the cursor has moved (instead of only when it reaches a border)
- *
- * @param navit The navit instance
- * @returns nothing
- */
-
-static void
-navit_vehicle_draw(struct navit *this_, struct navit_vehicle *nv, struct point *pnt)
-{
- struct point pnt2;
- enum projection pro;
- if (pnt)
- pnt2=*pnt;
- else {
- pro=transform_get_projection(this_->trans);
- transform(this_->trans, pro, &nv->coord, &pnt2, 1, 0);
- }
-#if 1
- cursor_draw(nv->cursor, &pnt2, nv->dir-transform_get_angle(this_->trans, 0), nv->speed > 2, pnt == NULL);
-#else
- cursor_draw(nv->cursor, &pnt2, nv->dir-transform_get_angle(this_->trans, 0), nv->speed > 2, 1);
-#endif
-}
-
-static void
-navit_vehicle_update(struct navit *this_, struct navit_vehicle *nv)
-{
- struct attr attr_dir, attr_speed, attr_pos;
- struct pcoord cursor_pc;
- struct point cursor_pnt, *pnt=&cursor_pnt;
- enum projection pro;
- int border=16;
- int route_path_set=0;
-
- if (this_->ready != 3)
- return;
-
- if (! vehicle_get_attr(nv->vehicle, attr_position_direction, &attr_dir) ||
- ! vehicle_get_attr(nv->vehicle, attr_position_speed, &attr_speed) ||
- ! vehicle_get_attr(nv->vehicle, attr_position_coord_geo, &attr_pos))
- return;
- nv->dir=*attr_dir.u.numd;
- nv->speed=*attr_speed.u.numd;
- pro=transform_get_projection(this_->trans);
- transform_from_geo(pro, attr_pos.u.coord_geo, &nv->coord);
- if (nv != this_->vehicle) {
- navit_vehicle_draw(this_, nv, NULL);
- return;
- }
- if (this_->route)
- route_path_set=route_get_path_set(this_->route);
- if (this_->tracking && this_->tracking_flag) {
- if (tracking_update(this_->tracking, &nv->coord, nv->dir)) {
- if (this_->route && nv->update_curr == 1)
- route_set_position_from_tracking(this_->route, this_->tracking);
- }
- } else {
- if (this_->route && nv->update_curr == 1) {
- cursor_pc.pro = pro;
- cursor_pc.x = nv->coord.x;
- cursor_pc.y = nv->coord.y;
- route_set_position(this_->route, &cursor_pc);
- }
- }
- transform(this_->trans, pro, &nv->coord, &cursor_pnt, 1, 0);
- if (!transform_within_border(this_->trans, &cursor_pnt, border)) {
- if (!this_->cursor_flag)
- return;
- if (nv->follow_curr != 1) {
- if (this_->orient_north_flag)
- navit_set_center_cursor(this_, &nv->coord, 0, 50 - 30.*sin(M_PI*nv->dir/180.), 50 + 30.*cos(M_PI*nv->dir/180.));
- else
- navit_set_center_cursor(this_, &nv->coord, nv->dir, 50, 80);
- pnt=NULL;
- }
- }
-
-#ifndef _WIN32
- if (this_->pid && nv->speed > 2)
- kill(this_->pid, SIGWINCH);
-#endif
- if (this_->route && nv->update_curr == 1)
- navigation_update(this_->navigation, this_->route);
- if (this_->cursor_flag && nv->follow_curr == 1) {
- navit_set_center_cursor(this_, &nv->coord, nv->dir, 50, 80);
- pnt=NULL;
- }
- if (pnt && this_->route && !route_path_set && route_get_path_set(this_->route))
- navit_draw(this_);
- if (nv->follow_curr > 1)
- nv->follow_curr--;
- else
- nv->follow_curr=nv->follow;
- if (nv->update_curr > 1)
- nv->update_curr--;
- else
- nv->update_curr=nv->update;
- callback_list_call_attr_2(this_->attr_cbl, attr_position_coord_geo, this_, nv->vehicle);
- if (pnt)
- navit_vehicle_draw(this_, nv, pnt);
-}
-
-/**
- * Set the position of the vehicle
- *
- * @param navit The navit instance
- * @param c The coordinate to set as position
- * @returns nothing
- */
-
-void
-navit_set_position(struct navit *this_, struct pcoord *c)
-{
- if (this_->route) {
- route_set_position(this_->route, c);
- if (this_->navigation) {
- navigation_update(this_->navigation, this_->route);
- }
- }
- navit_draw(this_);
-}
-
-/**
- * Register a new vehicle
- *
- * @param navit The navit instance
- * @param v The vehicle instance
- * @param name Guess? :)
- * @param c The color to use for the cursor, currently only used in GTK
- * @param update Wether to refresh the map each time this vehicle position changes (instead of only when it reaches a border)
- * @param follow Wether to center the map on this vehicle position
- * @returns a vehicle instance
- */
-struct navit_vehicle *
-navit_add_vehicle(struct navit *this_, struct vehicle *v, struct attr **attrs)
-{
- struct navit_vehicle *nv=g_new0(struct navit_vehicle, 1);
- struct attr *update,*follow,*color,*active, *color2, *animate;
- nv->vehicle=v;
- nv->update=1;
- nv->follow=0;
- nv->animate_cursor=0;
- if ((update=attr_search(attrs, NULL, attr_update)))
- nv->update=nv->update=update->u.num;
- if ((follow=attr_search(attrs, NULL, attr_follow)))
- nv->follow=nv->follow=follow->u.num;
- if ((color=attr_search(attrs, NULL, attr_color)))
- nv->c=*(color->u.color);
- if ((color2=attr_search(attrs, NULL, attr_color2)))
- nv->c2=color2->u.color;
- else
- nv->c2=NULL;
- nv->update_curr=nv->update;
- nv->follow_curr=nv->follow;
- this_->vehicles=g_list_append(this_->vehicles, nv);
- if ((active=attr_search(attrs, NULL, attr_active)) && active->u.num)
- navit_set_vehicle(this_, nv);
- if ((animate=attr_search(attrs, NULL, attr_animate)))
- nv->animate_cursor=animate->u.num;
- return nv;
-}
-
-void
-navit_set_vehicle(struct navit *this_, struct navit_vehicle *nv)
-{
- this_->vehicle=nv;
-}
-
-void
-navit_tracking_add(struct navit *this_, struct tracking *tracking)
-{
- this_->tracking=tracking;
-}
-
-void
-navit_set_speech(struct navit *this_, struct speech *speech)
-{
- this_->speech=speech;
-}
-
-
-struct gui *
-navit_get_gui(struct navit *this_)
-{
- return this_->gui;
-}
-
-struct transformation *
-navit_get_trans(struct navit *this_)
-{
- return this_->trans;
-}
-
-struct route *
-navit_get_route(struct navit *this_)
-{
- return this_->route;
-}
-
-struct navigation *
-navit_get_navigation(struct navit *this_)
-{
- return this_->navigation;
-}
-
-struct displaylist *
-navit_get_displaylist(struct navit *this_)
-{
- return this_->displaylist;
-}
-
-void
-navit_destroy(struct navit *this_)
-{
- /* TODO: destroy objects contained in this_ */
- main_remove_navit(this_);
- navit_write_center_to_file(this_, "center.txt");
- g_free(this_);
-}
-
-/** @} */
diff --git a/navit/navit.dtd b/navit/navit.dtd
deleted file mode 100644
index 3102dcf5..00000000
--- a/navit/navit.dtd
+++ /dev/null
@@ -1,77 +0,0 @@
-<!ELEMENT config (plugins,debug*,navit)>
-<!ELEMENT plugins (plugin*)>
-<!ELEMENT plugin EMPTY>
-<!ATTLIST plugin path CDATA #REQUIRED>
-<!ATTLIST plugin active CDATA #IMPLIED>
-<!ELEMENT debug EMPTY>
-<!ATTLIST debug name CDATA #REQUIRED>
-<!ATTLIST debug level CDATA "0">
-<!ELEMENT navit (gui,graphics,vehicle*,tracking,route,navigation,speech,mapset+,layout+)>
-<!ATTLIST navit center CDATA #REQUIRED>
-<!ATTLIST navit zoom CDATA #REQUIRED>
-<!ATTLIST navit tracking CDATA #REQUIRED>
-<!ATTLIST navit cursor CDATA #REQUIRED>
-<!ATTLIST navit orientation CDATA #REQUIRED>
-<!ELEMENT gui EMPTY>
-<!ATTLIST gui type CDATA #REQUIRED>
-<!ATTLIST gui menubar CDATA #IMPLIED>
-<!ATTLIST gui toolbar CDATA #IMPLIED>
-<!ATTLIST gui statusbar CDATA #IMPLIED>
-<!ATTLIST gui skin CDATA #IMPLIED>
-<!ATTLIST gui fullscreen CDATA #IMPLIED>
-<!ELEMENT graphics EMPTY>
-<!ATTLIST graphics type CDATA #REQUIRED>
-<!ELEMENT vehicle EMPTY>
-<!ATTLIST vehicle name CDATA #REQUIRED>
-<!ATTLIST vehicle source CDATA #REQUIRED>
-<!ATTLIST vehicle color CDATA #REQUIRED>
-<!ATTLIST vehicle enabled CDATA #IMPLIED>
-<!ATTLIST vehicle active CDATA #IMPLIED>
-<!ATTLIST vehicle follow CDATA #IMPLIED>
-<!ATTLIST vehicle refresh CDATA #IMPLIED>
-<!ELEMENT tracking ANY>
-<!ELEMENT route (speed+)>
-<!ELEMENT speed EMPTY>
-<!ATTLIST speed type CDATA #REQUIRED>
-<!ATTLIST speed value CDATA #REQUIRED>
-<!ELEMENT navigation (announce+)>
-<!ELEMENT announce EMPTY>
-<!ATTLIST announce type CDATA #REQUIRED>
-<!ATTLIST announce level0 CDATA #IMPLIED>
-<!ATTLIST announce level1 CDATA #IMPLIED>
-<!ATTLIST announce level2 CDATA #IMPLIED>
-<!ATTLIST announce unit CDATA #REQUIRED>
-<!ELEMENT speech EMPTY>
-<!ATTLIST speech type CDATA #REQUIRED>
-<!ATTLIST speech data CDATA #REQUIRED>
-<!ELEMENT mapset (map+)>
-<!ATTLIST mapset enabled CDATA #IMPLIED>
-<!ELEMENT map EMPTY>
-<!ATTLIST map type CDATA #REQUIRED>
-<!ATTLIST map enabled CDATA #IMPLIED>
-<!ATTLIST map active CDATA #IMPLIED>
-<!ATTLIST map data CDATA #REQUIRED>
-<!ATTLIST map debug CDATA #IMPLIED>
-<!ELEMENT layout (layer*)>
-<!ATTLIST layout name CDATA #REQUIRED>
-<!ATTLIST layout color CDATA #IMPLIED>
-<!ELEMENT layer (item+)>
-<!ATTLIST layer name CDATA #REQUIRED>
-<!ATTLIST layer details CDATA #REQUIRED>
-<!ELEMENT item (polygon|polyline|label|circle|icon)*>
-<!ATTLIST item type CDATA #REQUIRED>
-<!ATTLIST item order CDATA #REQUIRED>
-<!ELEMENT polygon EMPTY>
-<!ATTLIST polygon color CDATA #REQUIRED>
-<!ELEMENT polyline EMPTY>
-<!ATTLIST polyline color CDATA #REQUIRED>
-<!ATTLIST polyline width CDATA #IMPLIED>
-<!ELEMENT label EMPTY>
-<!ATTLIST label label_size CDATA #REQUIRED>
-<!ELEMENT circle EMPTY>
-<!ATTLIST circle color CDATA #REQUIRED>
-<!ATTLIST circle radius CDATA #REQUIRED>
-<!ATTLIST circle label_size CDATA #IMPLIED>
-<!ELEMENT icon EMPTY>
-<!ATTLIST icon src CDATA #REQUIRED>
-
diff --git a/navit/navit.h b/navit/navit.h
deleted file mode 100644
index ec76eeee..00000000
--- a/navit/navit.h
+++ /dev/null
@@ -1,80 +0,0 @@
-#ifndef NAVIT_NAVIT_H
-#define NAVIT_NAVIT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-extern struct gui *main_loop_gui;
-/* prototypes */
-enum attr_type;
-enum item_type;
-struct attr;
-struct attr_iter;
-struct callback;
-struct displaylist;
-struct graphics;
-struct gui;
-struct layout;
-struct mapset;
-struct navigation;
-struct navit;
-struct navit_vehicle;
-struct navit_window_items;
-struct pcoord;
-struct point;
-struct route;
-struct speech;
-struct tracking;
-struct transformation;
-struct vehicle;
-void navit_add_mapset(struct navit *this_, struct mapset *ms);
-struct mapset *navit_get_mapset(struct navit *this_);
-struct tracking *navit_get_tracking(struct navit *this_);
-void navit_add_layout(struct navit *this_, struct layout *lay);
-void navit_draw(struct navit *this_);
-void navit_draw_displaylist(struct navit *this_);
-void navit_resize(void *data, int w, int h);
-int navit_handle_button(struct navit *this_, int pressed, int button, struct point *p, struct callback *popup_callback);
-void navit_handle_motion(struct navit *this_, struct point *p);
-void navit_zoom_in(struct navit *this_, int factor, struct point *p);
-void navit_zoom_out(struct navit *this_, int factor, struct point *p);
-struct navit *navit_new(struct attr *parent, struct attr **attrs);
-struct graphics *navit_get_graphics(struct navit *this_);
-void navit_set_destination(struct navit *this_, struct pcoord *c, char *description);
-void navit_add_bookmark(struct navit *this_, struct pcoord *c, const char *description);
-void navit_speak(struct navit *this_);
-void navit_window_roadbook_destroy(struct navit *this_);
-void navit_window_roadbook_new(struct navit *this_);
-struct navit_window_items *navit_window_items_new(const char *name, int distance);
-void navit_window_items_add_item(struct navit_window_items *nwi, enum item_type type);
-void navit_add_window_items(struct navit *this_, struct navit_window_items *nwi);
-void navit_init(struct navit *this_);
-void navit_set_center(struct navit *this_, struct pcoord *center);
-void navit_set_center_screen(struct navit *this_, struct point *p);
-int navit_set_attr(struct navit *this_, struct attr *attr);
-int navit_get_attr(struct navit *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
-int navit_add_attr(struct navit *this_, struct attr *attr);
-struct attr_iter *navit_attr_iter_new(void);
-void navit_attr_iter_destroy(struct attr_iter *iter);
-void navit_add_callback(struct navit *this_, struct callback *cb);
-void navit_remove_callback(struct navit *this_, struct callback *cb);
-void navit_set_position(struct navit *this_, struct pcoord *c);
-struct navit_vehicle *navit_add_vehicle(struct navit *this_, struct vehicle *v, struct attr **attrs);
-void navit_set_vehicle(struct navit *this_, struct navit_vehicle *nv);
-void navit_tracking_add(struct navit *this_, struct tracking *tracking);
-void navit_route_add(struct navit *this_, struct route *route);
-void navit_navigation_add(struct navit *this_, struct navigation *navigation);
-void navit_set_speech(struct navit *this_, struct speech *speech);
-struct gui *navit_get_gui(struct navit *this_);
-struct transformation *navit_get_trans(struct navit *this_);
-struct route *navit_get_route(struct navit *this_);
-struct navigation *navit_get_navigation(struct navit *this_);
-struct displaylist *navit_get_displaylist(struct navit *this_);
-void navit_destroy(struct navit *this_);
-/* end of prototypes */
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/navit/navit.xml b/navit/navit.xml
deleted file mode 100644
index 460b7ae5..00000000
--- a/navit/navit.xml
+++ /dev/null
@@ -1,2416 +0,0 @@
-<!--
-For configuration options used in this file, please read
-http://wiki.navit-project.org/index.php/Configuring_NavIt
--->
-
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE navit SYSTEM "navit.dtd">
-<config xmlns:xi="http://www.w3.org/2001/XInclude">
-<plugins>
- <plugin path="$NAVIT_LIBDIR/*/${NAVIT_LIBPREFIX}lib*.so"/>
- <plugin path="$NAVIT_LIBDIR/*/${NAVIT_LIBPREFIX}libgraphics_null.so" active="no" />
-</plugins>
-<debug name="navit:do_draw" level="0" />
-
-<!--
-Center coordinates format:
-[D][D]DMM.ss[S][S]... N/S [D][D]DMM.ss[S][S]... E/W
-[-][D]D.d[d]... [-][D][D]D.d[d]...
-[-]0xX [-]0xX
-Change to your home coordinates.
--->
-
-
-<!--
- This line defines which location on the map navit will show after startup.
- It makes sense to set it to your home coordinates.
--->
-<navit center="4808 N 1134 E" zoom="256" tracking="1" cursor="1" orientation="0">
-
-
-<!--
- <osd type="compass" />
- <osd type="eta" />
- <osd type="navigation" />
--->
-
-
-<!--
- The following line let you select which graphical user interface you'd like to use.
- The default is GTK:
--->
- <gui type="gtk" menubar="1" toolbar="1" statusbar="1" />
- <graphics type="gtk_drawing_area" />
-
-<!-- For SDL, use rather the following lines
- <gui type="sdl" />
- <graphics type="opengl" />
--->
-
- <vehicle name="Mine" enabled="yes" active="1" source="gpsd://localhost" gpsd_query="w+xj" color="#0000ff"/>
- <!-- To improve visibility of the cursor in gtk, you may optionally add:
- color2="#rrggbb" - draws a second cursor inside the original, in the specified colour
- animate="1" - animates the cursor, as series of moving dots
- -->
- <!-- For SDL, you should add follow="1" refresh="1" to have the view centered on your position
- <vehicle name="Meins" enabled="yes" source="gpsd://localhost" color="#0000ff" follow="1" refresh="1"/>
- -->
-
- <vehicle name="Demo" enabled="no" source="demo://" color="#0000aa"/>
-
- <tracking>
- </tracking>
-
- <route>
- <speed type="street_0,street_1_city" value="10" />
- <speed type="street_2_city" value="30" />
- <speed type="street_3_city" value="40" />
- <speed type="street_4_city" value="50" />
- <speed type="highway_city" value="80" />
- <speed type="street_1_land" value="60" />
- <speed type="street_2_land" value="65" />
- <speed type="street_3_land" value="70" />
- <speed type="street_4_land" value="80" />
- <speed type="street_n_lanes" value="120" />
- <speed type="highway_land" value="120" />
- <speed type="ramp" value="40" />
- <speed type="ferry" value="40" />
- </route>
-
- <navigation>
- <announce type="street_0,street_1_city" level0="10" level1="100" level2="200" unit="m" />
- <announce type="street_2_city,street_3_city,street_4_city,ramp" level0="20" level1="200" level2="500" unit="m" />
- <announce type="highway_city,street_1_land,street_2_land,street_3_land,street_4_land" level0="40" level1="400" level2="1000" unit="m" />
- <announce type="street_n_lanes,highway_land" level0="100" level1="1000" level2="2000" unit="m" />
- </navigation>
-
-
- <!-- Navit provides speech output in text format.
- If you have a speech synthesizer like festival lite installed, you can get turn by turn directions out of navit.
- The default is text output to the shell
- -->
- <speech type="cmdline" data="echo 'Fix the speech tag in navit.xml to let navit say:' '%s'" />
- <!--<speech type="cmdline" data="flite -t '%s'" />-->
-
-<!-- If you have the reiseplaner maps installed, set enabled="yes" in the next line -->
- <mapset enabled="no">
- <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map" />
- <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp1.smp" />
- <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp2.smp" />
- <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp3.smp" />
- <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp4.smp" />
- <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp5.smp" />
- </mapset>
-
-<!-- If you dont want to use the sample map, either set enabled="no" in the next line or remove the xml file from the maps directory -->
- <mapset enabled="yes">
- <xi:include href="$NAVIT_SHAREDIR/maps/*.xml" />
- </mapset>
-
-<!-- Sample mapset for garmin maps -->
- <mapset enabled="no">
- <map type="garmin" enabled="yes" data="/path/to/img" debug="4"/>
- </mapset>
-
- <layout name="Car" color= "#ffefb7">
- <layer name="polygons">
- <item type="image" order="0-">
- <image />
- </item>
- <item type="poly_wood" order="0-">
- <polygon color="#8ec78d" />
- </item>
- <item type="poly_town" order="0-">
- <polygon color="#ffc895" />
- <polyline color="#ebb481" />
- </item>
- <item type="poly_water" order="0-">
- <polygon color="#82c8ea" />
- <polyline color="#5096b8" />
- <label label_size="5" />
- </item>
- <item type="poly_park" order="0-">
- <polygon color="#7cc334" />
- <label label_size="5" />
- </item>
- <item type="poly_pedestrian" order="10">
- <polyline color="#d2d2d2" width="3" />
- <polyline color="#dddddd" width="1" />
- <polygon color="#dddddd" />
- </item>
- <item type="poly_pedestrian" order="11">
- <polyline color="#d2d2d2" width="5" />
- <polyline color="#dddddd" width="3" />
- <polygon color="#dddddd" />
- </item>
- <item type="poly_pedestrian" order="12">
- <polyline color="#d2d2d2" width="8" />
- <polyline color="#dddddd" width="6" />
- <polygon color="#dddddd" />
- </item>
- <item type="poly_pedestrian" order="13">
- <polyline color="#d2d2d2" width="9" />
- <polyline color="#dddddd" width="7" />
- <polygon color="#dddddd" />
- </item>
- <item type="poly_pedestrian" order="14">
- <polyline color="#d2d2d2" width="13" />
- <polyline color="#dddddd" width="9" />
- <polygon color="#dddddd" />
- </item>
- <item type="poly_pedestrian" order="15">
- <polyline color="#d2d2d2" width="18" />
- <polyline color="#dddddd" width="14" />
- <polygon color="#dddddd" />
- </item>
- <item type="poly_pedestrian" order="16">
- <polyline color="#d2d2d2" width="21" />
- <polyline color="#dddddd" width="17" />
- <polygon color="#dddddd" />
- </item>
- <item type="poly_pedestrian" order="17">
- <polyline color="#d2d2d2" width="25" />
- <polyline color="#dddddd" width="21" />
- <polygon color="#dddddd" />
- </item>
- <item type="poly_pedestrian" order="18">
- <polyline color="#d2d2d2" width="40" />
- <polyline color="#dddddd" width="34" />
- <polygon color="#dddddd" />
- </item>
- <item type="poly_airport" order="0-">
- <polygon color="#a0a0a0" />
- </item>
- <item type="poly_sport" order="0-">
- <polygon color="#4af04f" />
- </item>
- <item type="poly_industry,poly_place" order="0-">
- <polygon color="#e6e6e6" />
- </item>
- <item type="poly_building" order="0-">
- <polygon color="#b6a6a6" />
- </item>
- <item type="water_line" order="0-">
- <polyline color="#5096b8" width="1" />
- <label label_size="5" />
- </item>
- <item type="water_river" order="4-5">
- <polyline color="#82c8ea" width="1" />
- </item>
- <item type="water_river" order="6">
- <polyline color="#82c8ea" width="2" />
- </item>
- <item type="water_river" order="7">
- <polyline color="#82c8ea" width="3" />
- <label label_size="5" />
- </item>
- <item type="water_river" order="8-9">
- <polyline color="#82c8ea" width="4" />
- <label label_size="7" />
- </item>
- <item type="water_river" order="10-">
- <polyline color="#82c8ea" width="4" />
- <label label_size="10" />
- </item>
- <item type="water_canal" order="6">
- <polyline color="#82c8ea" width="1" />
- </item>
- <item type="water_canal" order="7">
- <polyline color="#82c8ea" width="2" />
- <label label_size="5" />
- </item>
- <item type="water_canal" order="8-9">
- <polyline color="#82c8ea" width="3" />
- <label label_size="7" />
- </item>
- <item type="water_canal" order="10-">
- <polyline color="#82c8ea" width="3" />
- <label label_size="10" />
- </item>
- <item type="water_stream" order="8-9">
- <polyline color="#82c8ea" width="1" />
- </item>
- <item type="water_stream" order="10-">
- <polyline color="#82c8ea" width="2" />
- <label label_size="7" />
- </item>
- <item type="water_drain" order="10-">
- <polyline color="#82c8ea" width="1" />
- <label label_size="5" />
- </item>
- <item type="poly_apron" order="0-">
- <polygon color="#d0d0d0" />
- </item>
- <item type="poly_terminal" order="7-">
- <polygon color="#e3c6a6" />
- </item>
- <item type="poly_cemetery" order="1-">
- <polygon color="#bde3cb" />
- </item>
- <item type="poly_car_parking" order="1-">
- <polygon color="#e7cf87" />
- </item>
- <item type="rail" order="6-">
- <polyline color="#696969" width="3" />
- <polyline color="#ffffff" width="1" dash="5,5" />
- </item>
- <item type="ferry" order="5-">
- <polyline color="#000000" width="1" dash="10" />
- </item>
- <item type="border_country" order="0-">
- <polyline color="#b8434e" width="1" dash="10,5,2,5" />
- </item>
- <item type="border_state" order="0-">
- <polyline color="#808080" width="1" />
- </item>
- <item type="height_line_1" order="0-">
- <polyline color="#000000" width="1" />
- </item>
- <item type="height_line_2" order="0-">
- <polyline color="#000000" width="2" />
- </item>
- </layer>
- <layer name="streets">
- <item type="street_route" order="2">
- <polyline color="#0000a0" width="4" />
- </item>
- <item type="street_route" order="3-5">
- <polyline color="#0000a0" width="8" />
- </item>
- <item type="street_route" order="6">
- <polyline color="#0000a0" width="10" />
- </item>
- <item type="street_route" order="7-8">
- <polyline color="#0000a0" width="16" />
- </item>
- <item type="street_route" order="9-10">
- <polyline color="#0000a0" width="20" />
- </item>
- <item type="street_route" order="11">
- <polyline color="#0000a0" width="28" />
- </item>
- <item type="street_route" order="12">
- <polyline color="#0000a0" width="32" />
- </item>
- <item type="street_route" order="13">
- <polyline color="#0000a0" width="52" />
- </item>
- <item type="street_route" order="14">
- <polyline color="#0000a0" width="64" />
- </item>
- <item type="street_route" order="15">
- <polyline color="#0000a0" width="68" />
- </item>
- <item type="street_route" order="16">
- <polyline color="#0000a0" width="132" />
- </item>
- <item type="street_route" order="17">
- <polyline color="#0000a0" width="268" />
- </item>
- <item type="street_route" order="18">
- <polyline color="#0000a0" width="530" />
- </item>
- <item type="street_nopass" order="10-">
- <polyline color="#000000" width="1" />
- </item>
- <item type="track_paved" order="10-">
- <polyline color="#000000" width="1" />
- </item>
- <item type="track_gravelled" order="10-12">
- <polyline color="#800000" width="1" dash="3,6" />
- </item>
- <item type="track_gravelled" order="13-14">
- <polyline color="#ffffff" width="4" dash="4,8" />
- <polyline color="#800000" width="2" dash="4,8" />
- </item>
- <item type="track_gravelled" order="15-16">
- <polyline color="#ffffff" width="5" dash="5,10" />
- <polyline color="#800000" width="3" dash="5,10" />
- </item>
- <item type="track_gravelled" order="17-">
- <polyline color="#ffffff" width="7" dash="7,15" />
- <polyline color="#800000" width="5" dash="7,15" />
- </item>
- <item type="track_unpaved" order="10-">
- <polyline color="#000000" width="1" />
- </item>
- <item type="bridleway" order="10-">
- <polyline color="#000000" width="1" />
- </item>
- <item type="cycleway" order="10-">
- <polyline color="#000000" width="1" />
- </item>
- <item type="footway" order="10-12">
- <polyline color="#ff0000" width="1" dash="3,6" />
- </item>
- <item type="footway" order="13-14">
- <polyline color="#ffffff" width="4" dash="4,8" />
- <polyline color="#ff0000" width="2" dash="4,8" />
- </item>
- <item type="footway" order="15-16">
- <polyline color="#ffffff" width="5" dash="5,10" />
- <polyline color="#ff0000" width="3" dash="5,10" />
- </item>
- <item type="footway" order="17-">
- <polyline color="#ffffff" width="7" dash="7,15" />
- <polyline color="#ff0000" width="5" dash="7,15" />
- </item>
- <item type="steps" order="10-">
- <polyline color="#000000" width="1" />
- </item>
- <item type="street_pedestrian" order="10">
- <polyline color="#d2d2d2" width="3" />
- <polyline color="#dddddd" width="1" />
- </item>
- <item type="street_pedestrian" order="11">
- <polyline color="#d2d2d2" width="5" />
- <polyline color="#dddddd" width="3" />
- </item>
- <item type="street_pedestrian" order="12">
- <polyline color="#d2d2d2" width="8" />
- <polyline color="#dddddd" width="6" />
- </item>
- <item type="street_pedestrian" order="13">
- <polyline color="#d2d2d2" width="9" />
- <polyline color="#dddddd" width="7" />
- </item>
- <item type="street_pedestrian" order="14">
- <polyline color="#d2d2d2" width="13" />
- <polyline color="#dddddd" width="9" />
- </item>
- <item type="street_pedestrian" order="15">
- <polyline color="#d2d2d2" width="18" />
- <polyline color="#dddddd" width="14" />
- </item>
- <item type="street_pedestrian" order="16">
- <polyline color="#d2d2d2" width="21" />
- <polyline color="#dddddd" width="17" />
- </item>
- <item type="street_pedestrian" order="17">
- <polyline color="#d2d2d2" width="25" />
- <polyline color="#dddddd" width="21" />
- </item>
- <item type="street_pedestrian" order="18">
- <polyline color="#d2d2d2" width="40" />
- <polyline color="#dddddd" width="34" />
- </item>
- <item type="street_service" order="10">
- <polyline color="#d2d2d2" width="4" />
- <polyline color="#fefefe" width="2" />
- </item>
- <item type="street_service" order="11">
- <polyline color="#d2d2d2" width="4" />
- <polyline color="#fefefe" width="2" />
- </item>
- <item type="street_service" order="12">
- <polyline color="#d2d2d2" width="5" />
- <polyline color="#fefefe" width="3" />
- </item>
- <item type="street_service" order="13">
- <polyline color="#d2d2d2" width="6" />
- <polyline color="#fefefe" width="4" />
- </item>
- <item type="street_service" order="14">
- <polyline color="#d2d2d2" width="7" />
- <polyline color="#fefefe" width="5" />
- </item>
- <item type="street_service" order="15">
- <polyline color="#d2d2d2" width="8" />
- <polyline color="#fefefe" width="6" />
- </item>
- <item type="street_service" order="16">
- <polyline color="#d2d2d2" width="9" />
- <polyline color="#fefefe" width="7" />
- </item>
- <item type="street_service" order="17">
- <polyline color="#d2d2d2" width="10" />
- <polyline color="#fefefe" width="8" />
- </item>
- <item type="street_service" order="18">
- <polyline color="#d2d2d2" width="11" />
- <polyline color="#fefefe" width="9" />
- </item>
-
- <item type="street_0,street_1_city,street_1_land" order="10">
- <polyline color="#d2d2d2" width="4" />
- <polyline color="#ffffff" width="2" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="11">
- <polyline color="#d2d2d2" width="6" />
- <polyline color="#ffffff" width="4" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="12">
- <polyline color="#d2d2d2" width="10" />
- <polyline color="#ffffff" width="8" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="13">
- <polyline color="#d2d2d2" width="12" />
- <polyline color="#ffffff" width="9" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="14">
- <polyline color="#d2d2d2" width="15" />
- <polyline color="#ffffff" width="13" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="15">
- <polyline color="#d2d2d2" width="17" />
- <polyline color="#ffffff" width="14" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="16">
- <polyline color="#d2d2d2" width="33" />
- <polyline color="#ffffff" width="26" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="17">
- <polyline color="#d2d2d2" width="69" />
- <polyline color="#ffffff" width="61" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="18">
- <polyline color="#d2d2d2" width="132" />
- <polyline color="#ffffff" width="126" />
- </item>
- <item type="street_2_city,street_2_land" order="7-8">
- <polyline color="#c0c0c0" width="2" />
- </item>
- <item type="street_2_city,street_2_land" order="9">
- <polyline color="#c0c0c0" width="4" />
- <polyline color="#ffff00" width="2" />
- </item>
- <item type="street_2_city,street_2_land" order="10">
- <polyline color="#c0c0c0" width="6" />
- <polyline color="#ffff00" width="4" />
- </item>
- <item type="street_2_city,street_2_land" order="11">
- <polyline color="#c0c0c0" width="8" />
- <polyline color="#ffff00" width="6" />
- </item>
- <item type="street_2_city,street_2_land" order="12">
- <polyline color="#c0c0c0" width="12" />
- <polyline color="#ffff00" width="9" />
- </item>
- <item type="street_2_city,street_2_land" order="13">
- <polyline color="#c0c0c0" width="15" />
- <polyline color="#ffff00" width="11" />
- </item>
- <item type="street_2_city,street_2_land" order="14">
- <polyline color="#c0c0c0" width="18" />
- <polyline color="#ffff00" width="14" />
- </item>
- <item type="street_2_city,street_2_land" order="15">
- <polyline color="#c0c0c0" width="21" />
- <polyline color="#ffff00" width="17" />
- </item>
- <item type="street_2_city,street_2_land" order="16">
- <polyline color="#c0c0c0" width="35" />
- <polyline color="#ffff00" width="30" />
- </item>
- <item type="street_2_city,street_2_land" order="17">
- <polyline color="#c0c0c0" width="73" />
- <polyline color="#ffff00" width="67" />
- </item>
- <item type="street_2_city,street_2_land" order="18">
- <polyline color="#c0c0c0" width="144" />
- <polyline color="#ffff00" width="138" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="7-8">
- <polyline color="#a0a0a0" width="3" />
- <polyline color="#ffff00" width="1" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="9">
- <polyline color="#a0a0a0" width="5" />
- <polyline color="#ffff00" width="3" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="10">
- <polyline color="#a0a0a0" width="8" />
- <polyline color="#ffff00" width="6" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="11">
- <polyline color="#a0a0a0" width="9" />
- <polyline color="#ffff00" width="7" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="12">
- <polyline color="#a0a0a0" width="13" />
- <polyline color="#ffff00" width="9" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="13">
- <polyline color="#a0a0a0" width="18" />
- <polyline color="#ffff00" width="14" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="14">
- <polyline color="#a0a0a0" width="21" />
- <polyline color="#ffff00" width="17" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="15">
- <polyline color="#a0a0a0" width="25" />
- <polyline color="#ffff00" width="21" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="16">
- <polyline color="#a0a0a0" width="40" />
- <polyline color="#ffff00" width="34" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="17">
- <polyline color="#a0a0a0" width="79" />
- <polyline color="#ffff00" width="73" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="18">
- <polyline color="#a0a0a0" width="156" />
- <polyline color="#ffff00" width="150" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="2-6">
- <polyline color="#404040" width="1" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="7-8">
- <polyline color="#404040" width="3" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="9">
- <polyline color="#000000" width="5" />
- <polyline color="#ff0000" width="3" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="10">
- <polyline color="#000000" width="6" />
- <polyline color="#ff0000" width="4" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="11">
- <polyline color="#000000" width="9" />
- <polyline color="#ff0000" width="7" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="12">
- <polyline color="#000000" width="13" />
- <polyline color="#ff0000" width="9" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="13">
- <polyline color="#000000" width="18" />
- <polyline color="#ff0000" width="14" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="14">
- <polyline color="#000000" width="21" />
- <polyline color="#ff0000" width="17" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="15">
- <polyline color="#000000" width="24" />
- <polyline color="#ff0000" width="20" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="16">
- <polyline color="#000000" width="39" />
- <polyline color="#ff0000" width="33" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="17">
- <polyline color="#000000" width="78" />
- <polyline color="#ff0000" width="72" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="18">
- <polyline color="#000000" width="156" />
- <polyline color="#ff0000" width="150" />
- </item>
- <item type="highway_city,highway_land" order="2">
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="3-5">
- <polyline color="#ff0000" width="3" />
- <polyline color="#ffff00" width="1" />
- </item>
- <item type="highway_city,highway_land" order="6">
- <polyline color="#ff0000" width="4" />
- <polyline color="#ffff00" width="2" />
- </item>
- <item type="highway_city,highway_land" order="7-8">
- <polyline color="#ff0000" width="7" />
- <polyline color="#ffff00" width="5" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="9-10">
- <polyline color="#ff0000" width="9" />
- <polyline color="#ffff00" width="5" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="11">
- <polyline color="#ff0000" width="13" />
- <polyline color="#ffff00" width="9" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="12">
- <polyline color="#ff0000" width="15" />
- <polyline color="#ffff00" width="10" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="13">
- <polyline color="#ff0000" width="25" />
- <polyline color="#ffff00" width="17" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="14">
- <polyline color="#ff0000" width="31" />
- <polyline color="#ffff00" width="24" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="15">
- <polyline color="#ff0000" width="33" />
- <polyline color="#ffff00" width="27" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="16">
- <polyline color="#ff0000" width="65" />
- <polyline color="#ffff00" width="59" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="17">
- <polyline color="#ff0000" width="133" />
- <polyline color="#ffff00" width="127" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="18">
- <polyline color="#ff0000" width="264" />
- <polyline color="#ffff00" width="258" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="street_unkn" order="0-">
- <polyline color="#8080ff" width="3" />
- </item>
- <item type="highway_exit_label" order="10-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="highway_city,highway_land,street_4_city,street_4_land,street_n_lanes" order="10-18">
- <label label_size="8" />
- </item>
- <item type="street_2_city,street_2_land,street_3_city,street_3_land,ramp" order="11-18">
- <label label_size="9" />
- </item>
- <item type="street_nopass,street_0,street_1_city,street_1_land" order="12-18">
- <label label_size="9" />
- </item>
- </layer>
- <layer name="polylines">
- <item type="aeroway_taxiway" order="10">
- <polyline color="#989994" width="4" />
- <polyline color="#d3dbbc" width="2" />
- </item>
- <item type="aeroway_taxiway" order="11">
- <polyline color="#989994" width="6" />
- <polyline color="#d3dbbc" width="4" />
- </item>
- <item type="aeroway_taxiway" order="12">
- <polyline color="#989994" width="10" />
- <polyline color="#d3dbbc" width="8" />
- </item>
- <item type="aeroway_taxiway" order="13">
- <polyline color="#989994" width="12" />
- <polyline color="#d3dbbc" width="9" />
- </item>
- <item type="aeroway_taxiway" order="14">
- <polyline color="#989994" width="15" />
- <polyline color="#d3dbbc" width="13" />
- </item>
- <item type="aeroway_taxiway" order="15">
- <polyline color="#989994" width="17" />
- <polyline color="#d3dbbc" width="14" />
- </item>
- <item type="aeroway_taxiway" order="16">
- <polyline color="#989994" width="33" />
- <polyline color="#d3dbbc" width="26" />
- </item>
- <item type="aeroway_taxiway" order="17">
- <polyline color="#989994" width="69" />
- <polyline color="#d3dbbc" width="61" />
- </item>
- <item type="aeroway_taxiway" order="18">
- <polyline color="#989994" width="132" />
- <polyline color="#d3dbbc" width="126" />
- </item>
- <item type="aeroway_runway" order="2-6">
- <polyline color="#404040" width="1" />
- </item>
- <item type="aeroway_runway" order="7-8">
- <polyline color="#404040" width="3" />
- <polyline color="#d3dbbc" width="1" />
- </item>
- <item type="aeroway_runway" order="9">
- <polyline color="#6b6f5f" width="5" />
- <polyline color="#d3dbbc" width="3" />
- </item>
- <item type="aeroway_runway" order="10">
- <polyline color="#6b6f5f" width="6" />
- <polyline color="#d3dbbc" width="4" />
- </item>
- <item type="aeroway_runway" order="11">
- <polyline color="#6b6f5f" width="9" />
- <polyline color="#d3dbbc" width="7" />
- </item>
- <item type="aeroway_runway" order="12">
- <polyline color="#6b6f5f" width="13" />
- <polyline color="#d3dbbc" width="9" />
- </item>
- <item type="aeroway_runway" order="13">
- <polyline color="#6b6f5f" width="18" />
- <polyline color="#d3dbbc" width="14" />
- </item>
- <item type="aeroway_runway" order="14">
- <polyline color="#6b6f5f" width="21" />
- <polyline color="#d3dbbc" width="17" />
- </item>
- <item type="aeroway_runway" order="15">
- <polyline color="#6b6f5f" width="24" />
- <polyline color="#d3dbbc" width="20" />
- </item>
- <item type="aeroway_runway" order="16">
- <polyline color="#6b6f5f" width="39" />
- <polyline color="#d3dbbc" width="33" />
- </item>
- <item type="aeroway_runway" order="17">
- <polyline color="#6b6f5f" width="78" />
- <polyline color="#d3dbbc" width="72" />
- </item>
- <item type="aeroway_runway" order="18">
- <polyline color="#6b6f5f" width="156" />
- <polyline color="#d3dbbc" width="150" />
- </item>
- <item type="rail_tram" order="10-">
- <polyline color="#606060" width="2" />
- </item>
- </layer>
- <layer name="labels">
- <item type="town_label,district_label,town_label_0e0,town_label_1e0,town_label_2e0,town_label_5e0,town_label_1e1,town_label_2e1,town_label_5e1,town_label_1e2,town_label_2e2,town_label_5e2,district_label_0e0,district_label_1e0,district_label_2e0,district_label_5e0,district_label_1e1,district_label_2e1,district_label_5e1,district_label_1e2,district_label_2e2,district_label_5e2" order="12-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="district_label_1e3,district_label_2e3,district_label_5e3" order="11-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="town_label_1e3,town_label_2e3,town_label_5e3" order="10-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="district_label_1e4,district_label_2e4,district_label_5e4" order="9-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="town_label_1e4,town_label_2e4,town_label_5e4" order="8-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="district_label_1e5,district_label_2e5,district_label_5e5" order="6-">
- <circle color="#000000" radius="3" label_size="10" />
- </item>
- <item type="town_label_1e5,town_label_2e5,town_label_5e5" order="4-">
- <circle color="#000000" radius="3" label_size="10" />
- </item>
- <item type="district_label_1e6,district_label_2e6,district_label_5e6" order="3-">
- <circle color="#000000" radius="3" label_size="15" />
- </item>
- <item type="town_label_1e6,town_label_2e6,town_label_5e6" order="2-">
- <circle color="#000000" radius="3" label_size="15" />
- </item>
- <item type="town_label_1e7,district_label_1e7" order="1-">
- <circle color="#000000" radius="3" label_size="15" />
- </item>
- </layer>
- <layer name="points">
- <item type="mini_roundabout" order="12-">
- <icon src="mini_roundabout.xpm" />
- </item>
- <item type="turning_circle" order="12-">
- <icon src="mini_roundabout.xpm" />
- </item>
- <item type="track" order="3-">
- <polyline color="#3f3f3f" width="1" />
- </item>
-
- <item type="poi_airport" order="5-">
- <icon src="airport.xpm" />
- </item>
- <item type="town_ghost" order="0-">
- <icon src="ghost_town.xpm" />
- </item>
- <item type="poi_hotel" order="12-">
- <icon src="hotel.xpm" />
- </item>
- <item type="poi_car_parking" order="11-">
- <icon src="parking.xpm" />
- </item>
- <item type="poi_car_dealer_parts" order="0-">
- <icon src="car_dealer.xpm" />
- </item>
- <item type="poi_fuel" order="10-">
- <icon src="fuel.xpm" />
- </item>
- <item type="poi_shopping" order="10-">
- <icon src="shopping.xpm" />
- </item>
- <item type="poi_attraction" order="5-">
- <icon src="attraction.xpm" />
- </item>
- <item type="poi_cafe" order="12-">
- <icon src="cafe.xpm" />
- </item>
- <item type="poi_bar" order="12-">
- <icon src="bar.xpm" />
- </item>
- <item type="poi_bridge" order="0-">
- <icon src="bridge.xpm" />
- </item>
- <item type="highway_exit" order="11-">
- <icon src="exit.xpm" />
- </item>
- <item type="poi_camp_rv" order="9-">
- <icon src="camping.xpm" />
- </item>
- <item type="poi_museum_history" order="12-">
- <icon src="museum.xpm" />
- </item>
- <item type="poi_hospital" order="12-">
- <icon src="hospital.xpm" />
- </item>
- <item type="point_unkn" order="0-">
- <circle color="#8080ff" radius="3" />
- </item>
- <item type="poi_dining" order="12-">
- <icon src="dining.xpm" />
- </item>
- <item type="poi_fastfood" order="12-">
- <icon src="fastfood.xpm" />
- </item>
- <item type="poi_police" order="12-">
- <icon src="police.xpm" />
- </item>
- <item type="poi_auto_club" order="0-">
- <icon src="auto_club.xpm" />
- </item>
- <item type="poi_autoservice" order="0-">
- <icon src="autoservice.xpm" />
- </item>
- <item type="poi_bank" order="12-">
- <icon src="bank.xpm" />
- </item>
- <item type="poi_bay" order="0-">
- <icon src="bay.xpm" />
- </item>
- <item type="poi_bend" order="0-">
- <icon src="bend.xpm" />
- </item>
- <item type="poi_boat_ramp" order="0-">
- <icon src="boat_ramp.xpm" />
- </item>
- <item type="poi_border_station" order="0-">
- <icon src="border_station.xpm" />
- </item>
- <item type="poi_bowling" order="0-">
- <icon src="bowling.xpm" />
- </item>
- <item type="poi_bus_station" order="12-">
- <icon src="bus.xpm" />
- </item>
- <item type="poi_bus_stop" order="12-">
- <icon src="bus.xpm" />
- </item>
- <item type="poi_bussines_service" order="0-">
- <icon src="bussines_service.xpm" />
- </item>
- <item type="poi_car_rent" order="0-">
- <icon src="car_rent.xpm" />
- </item>
- <item type="poi_car_wash" order="0-">
- <icon src="car_wash.xpm" />
- </item>
- <item type="poi_casino" order="0-">
- <icon src="casino.xpm" />
- </item>
- <item type="poi_cemetery" order="0-">
- <icon src="cemetery.xpm" />
- </item>
- <item type="poi_church" order="11-">
- <icon src="church.xpm" />
- </item>
- <item type="poi_cinema" order="12-">
- <icon src="cinema.xpm" />
- </item>
- <item type="poi_civil" order="0-">
- <icon src="civil.xpm" />
- </item>
- <item type="poi_communication" order="0-">
- <icon src="communication.xpm" />
- </item>
- <item type="poi_concert" order="0-">
- <icon src="concert.xpm" />
- </item>
- <item type="poi_cove" order="0-">
- <icon src="cove.xpm" />
- </item>
- <item type="poi_crossing" order="0-">
- <icon src="crossing.xpm" />
- </item>
- <item type="poi_dam" order="0-">
- <icon src="dam.xpm" />
- </item>
- <item type="poi_danger_area" order="0-">
- <icon src="danger_area.xpm" />
- </item>
- <item type="poi_dangerous" order="0-">
- <icon src="dangerous.xpm" />
- </item>
- <item type="poi_daymark" order="0-">
- <icon src="daymark.xpm" />
- </item>
- <item type="poi_diving" order="0-">
- <icon src="diving.xpm" />
- </item>
- <item type="poi_drinking_water" order="0-">
- <icon src="drinking_water.xpm" />
- </item>
- <item type="poi_emergency" order="0-">
- <icon src="emergency.xpm" />
- </item>
- <item type="poi_fair" order="0-">
- <icon src="fair.xpm" />
- </item>
- <item type="poi_firebrigade" order="12-">
- <icon src="firebrigade.xpm" />
- </item>
- <item type="poi_fish" order="0-">
- <icon src="fish.xpm" />
- </item>
- <item type="poi_forbiden_area" order="0-">
- <icon src="forbiden_area.xpm" />
- </item>
- <item type="poi_garmin" order="0-">
- <icon src="garmin.xpm" />
- </item>
- <item type="poi_golf" order="12-">
- <icon src="golf.xpm" />
- </item>
- <item type="poi_goverment_building" order="0-">
- <icon src="goverment_building.xpm" />
- </item>
- <item type="poi_height" order="0-">
- <icon src="height.xpm" />
- </item>
- <item type="poi_heliport" order="7-">
- <icon src="heliport.xpm" />
- </item>
- <item type="poi_hotspring" order="0-">
- <icon src="hotspring.xpm" />
- </item>
- <item type="poi_icesport" order="0-">
- <icon src="icesport.xpm" />
- </item>
- <item type="poi_information" order="12-">
- <icon src="information.xpm" />
- </item>
- <item type="poi_justice" order="0-">
- <icon src="justice.xpm" />
- </item>
- <item type="poi_landmark" order="0-">
- <icon src="landmark.xpm" />
- </item>
- <item type="poi_levee" order="0-">
- <icon src="levee.xpm" />
- </item>
- <item type="poi_level_crossing" order="11-">
- <icon src="level_crossing.xpm" />
- </item>
- <item type="poi_library" order="12-">
- <icon src="library.xpm" />
- </item>
- <item type="poi_locale" order="0-">
- <icon src="locale.xpm" />
- </item>
- <item type="poi_loudspeaker" order="0-">
- <icon src="loudspeaker.xpm" />
- </item>
- <item type="poi_mall" order="0-">
- <icon src="mall.xpm" />
- </item>
- <item type="poi_manmade_feature" order="0-">
- <icon src="manmade_feature.xpm" />
- </item>
- <item type="poi_marine" order="0-">
- <icon src="marine.xpm" />
- </item>
- <item type="poi_marine_type" order="0-">
- <icon src="marine_type.xpm" />
- </item>
- <item type="poi_mark" order="0-">
- <icon src="mark.xpm" />
- </item>
- <item type="poi_military" order="0-">
- <icon src="military.xpm" />
- </item>
- <item type="poi_mine" order="0-">
- <icon src="mine.xpm" />
- </item>
- <item type="poi_nondangerous" order="0-">
- <icon src="nondangerous.xpm" />
- </item>
- <item type="poi_oil_field" order="0-">
- <icon src="oil_field.xpm" />
- </item>
- <item type="poi_peak" order="6-">
- <icon src="peak.xpm" />
- </item>
- <item type="poi_personal_service" order="0-">
- <icon src="personal_service.xpm" />
- </item>
- <item type="poi_pharmacy" order="12-">
- <icon src="pharmacy.xpm" />
- </item>
- <item type="poi_post" order="13-">
- <icon src="post.xpm" />
- </item>
- <item type="poi_public_office" order="0-">
- <icon src="public_office.xpm" />
- </item>
- <item type="poi_rail_halt" order="10-">
- <circle color="#ff0000" radius="3" width="3" />
- <circle color="#000000" radius="5" width="2" label_size="8" />
- </item>
- <item type="poi_rail_station" order="9-">
- <circle color="#ff0000" radius="3" width="3" />
- <circle color="#000000" radius="6" width="2" label_size="8" />
- </item>
- <item type="poi_rail_tram_stop" order="10-11">
- <circle color="#ff0000" radius="2" width="2"/>
- </item>
- <item type="poi_rail_tram_stop" order="12-">
- <circle color="#ff0000" radius="3" width="3" />
- <circle color="#606060" radius="5" width="2" label_size="8" />
- </item>
- <item type="poi_repair_service" order="0-">
- <icon src="repair_service.xpm" />
- </item>
- <item type="poi_resort" order="0-">
- <icon src="resort.xpm" />
- </item>
- <item type="poi_rest_room" order="13-">
- <icon src="rest_room.xpm" />
- </item>
- <item type="poi_restaurant" order="12-">
- <icon src="restaurant.xpm" />
- </item>
- <item type="poi_restricted_area" order="0-">
- <icon src="restricted_area.xpm" />
- </item>
- <item type="poi_restroom" order="13-">
- <icon src="restroom.xpm" />
- </item>
- <item type="poi_sailing" order="0-">
- <icon src="sailing.xpm" />
- </item>
- <item type="poi_scenic_area" order="0-">
- <icon src="scenic_area.xpm" />
- </item>
- <item type="poi_school" order="12-">
- <icon src="school.xpm" />
- </item>
- <item type="poi_service" order="0-">
- <icon src="service.xpm" />
- </item>
- <item type="poi_shop_apparel" order="0-">
- <icon src="shop_apparel.xpm" />
- </item>
- <item type="poi_shop_computer" order="0-">
- <icon src="shop_computer.xpm" />
- </item>
- <item type="poi_shop_department" order="0-">
- <icon src="shop_department.xpm" />
- </item>
- <item type="poi_shop_furnish" order="0-">
- <icon src="shop_furnish.xpm" />
- </item>
- <item type="poi_shop_grocery" order="0-">
- <icon src="shop_grocery.xpm" />
- </item>
- <item type="poi_shop_handg" order="0-">
- <icon src="shop_handg.xpm" />
- </item>
- <item type="poi_shop_merchandise" order="0-">
- <icon src="shop_merchandise.xpm" />
- </item>
- <item type="poi_shop_retail" order="0-">
- <icon src="shop_retail.xpm" />
- </item>
- <item type="poi_shower" order="0-">
- <icon src="shower.xpm" />
- </item>
- <item type="poi_skiing" order="12-">
- <icon src="skiing.xpm" />
- </item>
- <item type="poi_social_service" order="0-">
- <icon src="social_service.xpm" />
- </item>
- <item type="poi_sounding" order="0-">
- <icon src="sounding.xpm" />
- </item>
- <item type="poi_sport" order="0-">
- <icon src="sport.xpm" />
- </item>
- <item type="poi_stadium" order="0-">
- <icon src="stadium.xpm" />
- </item>
- <item type="poi_subdivision" order="0-">
- <icon src="subdivision.xpm" />
- </item>
- <item type="poi_swimming" order="12-">
- <icon src="swimming.xpm" />
- </item>
- <item type="poi_telephone" order="13-">
- <icon src="telephone.xpm" />
- </item>
- <item type="poi_theater" order="12-">
- <icon src="theater.xpm" />
- </item>
- <item type="poi_tide" order="0-">
- <icon src="tide.xpm" />
- </item>
- <item type="poi_tower" order="13-">
- <icon src="tower.xpm" />
- </item>
- <item type="poi_townhall" order="12-">
- <icon src="townhall.xpm" />
- </item>
- <item type="poi_trail" order="0-">
- <icon src="trail.xpm" />
- </item>
- <item type="poi_truck_stop" order="0-">
- <icon src="truck_stop.xpm" />
- </item>
- <item type="poi_tunnel" order="0-">
- <icon src="tunnel.xpm" />
- </item>
- <item type="poi_wine" order="0-">
- <icon src="wine.xpm" />
- </item>
- <item type="poi_worship" order="0-">
- <icon src="worship.xpm" />
- </item>
- <item type="poi_wrecker" order="0-">
- <icon src="wrecker.xpm" />
- </item>
- <item type="poi_zoo" order="0-">
- <icon src="zoo.xpm" />
- </item>
- <item type="poi_picnic" order="11-">
- <icon src="picnic.xpm" />
- </item>
- <item type="poi_gc_multi" order="0-">
- <icon src="gc_multi.xpm" />
- </item>
- <item type="poi_gc_tradi" order="0-">
- <icon src="gc_tradi.xpm" />
- </item>
- <item type="poi_gc_event" order="0-">
- <icon src="gc_event.xpm" />
- </item>
- <item type="poi_gc_mystery" order="0-">
- <icon src="gc_mystery.xpm" />
- </item>
- <item type="poi_gc_question" order="0-">
- <icon src="gc_question.xpm" />
- </item>
- <item type="poi_gc_stages" order="0-">
- <icon src="gc_stages.xpm" />
- </item>
- <item type="poi_gc_reference" order="0-">
- <icon src="gc_reference.xpm" />
- </item>
- <item type="poi_gc_webcam" order="0-">
- <icon src="gc_webcam.xpm" />
- </item>
- <item type="traffic_signals" order="13-">
- <icon src="traffic_signals.xpm" />
- </item>
- <item type="poly_flats,poly_scrub,poly_military_zone,poly_marine,plantation,tundra" order="0-">
- <polygon color="#a0a0a0" />
- <label label_size="5" />
- </item>
- <item type="poi_image" order="0-">
- <image />
- </item>
- <item type="rg_segment" order="0-">
- <polyline color="#FF089C" width="1" />
- </item>
- <item type="rg_point" order="0-">
- <circle color="#FF089C" radius="10" label_size="7" />
- </item>
- </layer>
- </layout>
- <layout name="Bike" color= "#ffefb7">
- <layer name="polygons">
- <item type="image" order="0-">
- <image />
- </item>
- <item type="poly_wood" order="0-">
- <polygon color="#8ec78d" />
- </item>
- <item type="poly_town" order="0-">
- <polygon color="#ffc895" />
- <polyline color="#ebb481" />
- </item>
- <item type="poly_park" order="0-">
- <polygon color="#7cc334" />
- <label label_size="5" />
- </item>
- <item type="poly_water" order="0-">
- <polygon color="#82c8ea" />
- <polyline color="#5096b8" />
- <label label_size="5" />
- </item>
- <item type="poly_land" order="0-">
- <polygon color="#ffefb7" />
- <polyline color="#ffefb7" />
- <label label_size="5" />
- </item>
- <item type="poly_airport" order="0-">
- <polygon color="#a0a0a0" />
- </item>
- <item type="sport_poly,poly_sport" order="0-">
- <polygon color="#ff8c00" />
- </item>
- <item type="poly_industry,poly_place,poly_railway" order="0-">
- <polygon color="#e6e6e6" />
- </item>
- <item type="poly_commercial" order="0-">
- <polygon color="#fff8dc" />
- </item>
-
- <!-- landuse=industrial -->
- <item type="industry_poly,building_poly,place_poly,poly_brownfield,poly_greenfield,poly_construction,poly_railway" order="0-">
- <polygon color="#ecd8ff" />
- </item>
- <!-- landuse=farm -->
- <item type="poly_farm" order="0-">
- <polygon color="#c7f1a3" />
- <polyline color="#79c691" />
- <label label_size="5" />
- </item>
- <item type="poly_scree,poly_scrub,poly_fell,poly_heath" order="0-">
- <polygon color="#c7f1a3" />
- <polyline color="#79c691" />
- <label label_size="5" />
- </item>
- <item type="poly_marsh,poly_mud,poly_quarry" order="0-">
- <polygon color="#DEB887" />
- <polyline color="#DEB887" />
- <label label_size="5" />
- </item>
-
- <item type="poly_allotments,poly_playground,poly_village_green,poly_recreation_ground,poly_common,poly_garden" order="0-">
- <polygon color="#c7f1a3" />
- <polyline color="#79c691" />
- <label label_size="5" />
- </item>
-
- <item type="poly_building" order="0-">
- <polygon color="#ff6347" />
- </item>
- <item type="poly_ruins" order="0-">
- <polygon color="#b6a6a6" />
- </item>
- <item type="water_line" order="0-">
- <polyline color="#82c8ea" width="2" />
- <label label_size="5" />
- </item>
- <item type="water_river" order="0-">
- <polyline color="#82c8ea" width="4" />
- <label label_size="5" />
- </item>
- <item type="water_canal" order="0-">
- <polyline color="#82c8ea" width="3" />
- <label label_size="5" />
- </item>
- <item type="water_stream" order="0-">
- <polyline color="#82c8ea" width="2" />
- <label label_size="5" />
- </item>
- <item type="water_drain" order="0-">
- <polyline color="#82c8ea" width="1" />
- <label label_size="5" />
- </item>
- <item type="poly_apron" order="0-">
- <polygon color="#d0d0d0" />
- </item>
- <item type="poly_terminal" order="7-">
- <polygon color="#e3c6a6" />
- </item>
- <item type="poly_cemetery" order="1-">
- <polygon color="#bde3cb" />
- </item>
- <item type="poly_car_parking" order="1-">
- <polygon color="#d2d2d2" />
- </item>
-
- <!-- borders -->
- <item type="border_state" order="0-5">
- <polyline color="#778899" dash="3,2,1,3" width="3" />
- </item>
- <item type="border_country" order="0-5">
- <polyline color="#778899" dash="3,2,1,3" width="2" />
- </item>
-
- <item type="border_state" order="6-11">
- <polyline color="#778899" dash="6,6,1,6" width="3" />
- </item>
- <item type="border_country" order="6-11">
- <polyline color="#778899" dash="6,6,1,6" width="2" />
- </item>
-
- <item type="border_state" order="12-20">
- <polyline color="#778899" dash="10,10,2,10" width="3" />
- </item>
- <item type="border_country" order="12-20">
- <polyline color="#778899" dash="10,10,2,10" width="2" />
- </item>
-
- <item type="height_line_1" order="0-">
- <polyline color="#000000" width="1" />
- </item>
- <item type="height_line_2" order="0-">
- <polyline color="#000000" width="2" />
- </item>
- <item type="street_route" order="2">
- <polyline color="#0000a0" width="4" />
- </item>
- <item type="street_route" order="3-5">
- <polyline color="#0000a0" width="8" />
- </item>
- <item type="street_route" order="6">
- <polyline color="#0000a0" width="10" />
- </item>
- <item type="street_route" order="7-8">
- <polyline color="#0000a0" width="16" />
- </item>
- <item type="street_route" order="9-10">
- <polyline color="#0000a0" width="20" />
- </item>
- <item type="street_route" order="11">
- <polyline color="#0000a0" width="28" />
- </item>
- <item type="street_route" order="12">
- <polyline color="#0000a0" width="32" />
- </item>
- <item type="street_route" order="13">
- <polyline color="#0000a0" width="52" />
- </item>
- <item type="street_route" order="14">
- <polyline color="#0000a0" width="64" />
- </item>
- <item type="street_route" order="15">
- <polyline color="#0000a0" width="68" />
- </item>
- <item type="street_route" order="16">
- <polyline color="#0000a0" width="132" />
- </item>
- <item type="street_route" order="17">
- <polyline color="#0000a0" width="268" />
- </item>
- <item type="street_route" order="18">
- <polyline color="#0000a0" width="530" />
- </item>
- <item type="street_nopass" order="10-">
- <polyline color="#000000" width="1" />
- </item>
- <item type="track_paved" order="9-">
- <polyline color="#d2d2d2" width="4" />
- <polyline color="#fefefe" width="2" />
- </item>
- <item type="track_gravelled" order="10-">
- <polyline color="#d2d2d2" width="3" />
- <polyline color="#fefefe" width="1" />
- </item>
- <item type="track_unpaved" order="11-">
- <polyline color="#fff0f5" width="2" />
- <polyline color="#fff0f5" width="1" />
- </item>
- <item type="track_ground" order="12-">
- <polyline color="#fff0f5" width="2" />
- <polyline color="#fff0f5" width="1" />
- </item>
- <item type="track_grass" order="13-">
- <polyline color="#ffffe0" width="2" />
- <polyline color="#ffffe0" width="1" />
- </item>
- <item type="bridleway" order="10-">
- <polyline color="#8b4513" width="3" />
- <polyline color="#f4a460" width="1" />
- </item>
- <item type="cycleway" order="10-">
- <polyline color="#006400" width="4" />
- <polyline color="#3cb371" width="2" />
- </item>
- <item type="footway" order="12-">
- <polyline color="#8b4513" width="3" />
- <polyline color="#CD853F" width="1" />
- </item>
- <item type="steps" order="12-">
- <polyline color="#8b4513" width="3" />
- <polyline color="#F4A460" width="1" dash="6,4" />
- </item>
- <item type="poly_pedestrian,poly_plaza" order="0-">
- <polygon color="#d2d2d2" />
- </item>
- <item type="street_pedestrian,living_street" order="10">
- <polyline color="#d2d2d2" width="3" />
- <polyline color="#dddddd" width="1" />
- </item>
- <item type="street_pedestrian,living_street" order="11">
- <polyline color="#d2d2d2" width="5" />
- <polyline color="#dddddd" width="3" />
- </item>
- <item type="street_pedestrian,living_street" order="12">
- <polyline color="#d2d2d2" width="8" />
- <polyline color="#dddddd" width="6" />
- </item>
- <item type="street_pedestrian,living_street" order="13">
- <polyline color="#d2d2d2" width="9" />
- <polyline color="#dddddd" width="7" />
- </item>
- <item type="street_pedestrian,living_street" order="14">
- <polyline color="#d2d2d2" width="13" />
- <polyline color="#dddddd" width="9" />
- </item>
- <item type="street_pedestrian,living_street" order="15">
- <polyline color="#d2d2d2" width="18" />
- <polyline color="#dddddd" width="14" />
- </item>
- <item type="street_pedestrian,living_street" order="16">
- <polyline color="#d2d2d2" width="21" />
- <polyline color="#dddddd" width="17" />
- </item>
- <item type="street_pedestrian,living_street" order="17">
- <polyline color="#d2d2d2" width="25" />
- <polyline color="#dddddd" width="21" />
- </item>
- <item type="street_pedestrian,living_street" order="18">
- <polyline color="#d2d2d2" width="40" />
- <polyline color="#dddddd" width="34" />
- </item>
- <item type="street_service" order="9">
- <polyline color="#d2d2d2" width="2" />
- <polyline color="#fefefe" width="1" />
- </item>
- <item type="street_service" order="10">
- <polyline color="#d2d2d2" width="3" />
- <polyline color="#fefefe" width="2" />
- </item>
- <item type="street_service" order="11">
- <polyline color="#d2d2d2" width="4" />
- <polyline color="#fefefe" width="2" />
- </item>
- <item type="street_service" order="12">
- <polyline color="#d2d2d2" width="5" />
- <polyline color="#fefefe" width="3" />
- </item>
- <item type="street_service" order="13">
- <polyline color="#d2d2d2" width="6" />
- <polyline color="#fefefe" width="4" />
- </item>
- <item type="street_service" order="14">
- <polyline color="#d2d2d2" width="7" />
- <polyline color="#fefefe" width="5" />
- </item>
- <item type="street_service" order="15">
- <polyline color="#d2d2d2" width="8" />
- <polyline color="#fefefe" width="6" />
- </item>
- <item type="street_service" order="16">
- <polyline color="#d2d2d2" width="9" />
- <polyline color="#fefefe" width="7" />
- </item>
- <item type="street_service" order="17">
- <polyline color="#d2d2d2" width="10" />
- <polyline color="#fefefe" width="8" />
- </item>
- <item type="street_service" order="18">
- <polyline color="#d2d2d2" width="11" />
- <polyline color="#fefefe" width="9" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="8-10">
- <polyline color="#d2d2d2" width="4" />
- <polyline color="#ffffff" width="2" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="11">
- <polyline color="#d2d2d2" width="6" />
- <polyline color="#ffffff" width="4" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="12">
- <polyline color="#d2d2d2" width="10" />
- <polyline color="#ffffff" width="8" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="13">
- <polyline color="#d2d2d2" width="12" />
- <polyline color="#ffffff" width="9" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="14">
- <polyline color="#d2d2d2" width="15" />
- <polyline color="#ffffff" width="13" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="15">
- <polyline color="#d2d2d2" width="17" />
- <polyline color="#ffffff" width="14" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="16">
- <polyline color="#d2d2d2" width="33" />
- <polyline color="#ffffff" width="26" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="17">
- <polyline color="#d2d2d2" width="69" />
- <polyline color="#ffffff" width="61" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="18">
- <polyline color="#d2d2d2" width="132" />
- <polyline color="#ffffff" width="126" />
- </item>
- <item type="street_2_city,street_2_land" order="7-8">
- <polyline color="#c0c0c0" width="3" />
- <polyline color="#ffff00" width="1" />
- </item>
- <item type="street_2_city,street_2_land" order="9">
- <polyline color="#c0c0c0" width="4" />
- <polyline color="#ffff00" width="2" />
- </item>
- <item type="street_2_city,street_2_land" order="10">
- <polyline color="#c0c0c0" width="6" />
- <polyline color="#ffff00" width="4" />
- </item>
- <item type="street_2_city,street_2_land" order="11">
- <polyline color="#c0c0c0" width="8" />
- <polyline color="#ffff00" width="6" />
- </item>
- <item type="street_2_city,street_2_land" order="12">
- <polyline color="#c0c0c0" width="12" />
- <polyline color="#ffff00" width="9" />
- </item>
- <item type="street_2_city,street_2_land" order="13">
- <polyline color="#c0c0c0" width="15" />
- <polyline color="#ffff00" width="11" />
- </item>
- <item type="street_2_city,street_2_land" order="14">
- <polyline color="#c0c0c0" width="18" />
- <polyline color="#ffff00" width="14" />
- </item>
- <item type="street_2_city,street_2_land" order="15">
- <polyline color="#c0c0c0" width="21" />
- <polyline color="#ffff00" width="17" />
- </item>
- <item type="street_2_city,street_2_land" order="16">
- <polyline color="#c0c0c0" width="35" />
- <polyline color="#ffff00" width="30" />
- </item>
- <item type="street_2_city,street_2_land" order="17">
- <polyline color="#c0c0c0" width="73" />
- <polyline color="#ffff00" width="67" />
- </item>
- <item type="street_2_city,street_2_land" order="18">
- <polyline color="#c0c0c0" width="144" />
- <polyline color="#ffff00" width="138" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="7-8">
- <polyline color="#a0a0a0" width="3" />
- <polyline color="#ffff00" width="1" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="9">
- <polyline color="#a0a0a0" width="5" />
- <polyline color="#ffff00" width="3" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="10">
- <polyline color="#a0a0a0" width="8" />
- <polyline color="#ffff00" width="6" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="11">
- <polyline color="#a0a0a0" width="9" />
- <polyline color="#ffff00" width="7" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="12">
- <polyline color="#a0a0a0" width="13" />
- <polyline color="#ffff00" width="9" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="13">
- <polyline color="#a0a0a0" width="18" />
- <polyline color="#ffff00" width="14" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="14">
- <polyline color="#a0a0a0" width="21" />
- <polyline color="#ffff00" width="17" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="15">
- <polyline color="#a0a0a0" width="25" />
- <polyline color="#ffff00" width="21" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="16">
- <polyline color="#a0a0a0" width="40" />
- <polyline color="#ffff00" width="34" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="17">
- <polyline color="#a0a0a0" width="79" />
- <polyline color="#ffff00" width="73" />
- </item>
- <item type="street_3_city,street_3_land,ramp,roundabout" order="18">
- <polyline color="#a0a0a0" width="156" />
- <polyline color="#ffff00" width="150" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="2-6">
- <polyline color="#404040" width="1" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="7-8">
- <polyline color="#404040" width="3" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="9">
- <polyline color="#000000" width="5" />
- <polyline color="#ff0000" width="3" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="10">
- <polyline color="#000000" width="6" />
- <polyline color="#ff0000" width="4" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="11">
- <polyline color="#000000" width="9" />
- <polyline color="#ff0000" width="7" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="12">
- <polyline color="#000000" width="13" />
- <polyline color="#ff0000" width="9" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="13">
- <polyline color="#000000" width="18" />
- <polyline color="#ff0000" width="14" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="14">
- <polyline color="#000000" width="21" />
- <polyline color="#ff0000" width="17" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="15">
- <polyline color="#000000" width="24" />
- <polyline color="#ff0000" width="20" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="16">
- <polyline color="#000000" width="39" />
- <polyline color="#ff0000" width="33" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="17">
- <polyline color="#000000" width="78" />
- <polyline color="#ff0000" width="72" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="18">
- <polyline color="#000000" width="156" />
- <polyline color="#ff0000" width="150" />
- </item>
- <item type="highway_city,highway_land" order="2">
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="3-5">
- <polyline color="#ff0000" width="3" />
- <polyline color="#ffff00" width="1" />
- </item>
- <item type="highway_city,highway_land" order="6">
- <polyline color="#ff0000" width="4" />
- <polyline color="#ffff00" width="2" />
- </item>
- <item type="highway_city,highway_land" order="7-8">
- <polyline color="#ff0000" width="7" />
- <polyline color="#ffff00" width="5" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="9-10">
- <polyline color="#ff0000" width="9" />
- <polyline color="#ffff00" width="5" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="11">
- <polyline color="#ff0000" width="13" />
- <polyline color="#ffff00" width="9" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="12">
- <polyline color="#ff0000" width="15" />
- <polyline color="#ffff00" width="10" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="13">
- <polyline color="#ff0000" width="25" />
- <polyline color="#ffff00" width="17" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="14">
- <polyline color="#ff0000" width="31" />
- <polyline color="#ffff00" width="24" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="15">
- <polyline color="#ff0000" width="33" />
- <polyline color="#ffff00" width="27" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="16">
- <polyline color="#ff0000" width="65" />
- <polyline color="#ffff00" width="59" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="17">
- <polyline color="#ff0000" width="133" />
- <polyline color="#ffff00" width="127" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="18">
- <polyline color="#ff0000" width="264" />
- <polyline color="#ffff00" width="258" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="street_unkn" order="0-">
- <polyline color="#8080ff" width="3" />
- </item>
- <item type="highway_exit_label" order="10-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="highway_city,highway_land,street_4_city,street_4_land,street_n_lanes" order="10-18">
- <label label_size="8" />
- </item>
- <item type="street_2_city,street_2_land,street_3_city,street_3_land,ramp" order="11-18">
- <label label_size="9" />
- </item>
- <item type="street_nopass,street_0,street_1_city,street_1_land" order="12-18">
- <label label_size="9" />
- </item>
- <item type="aeroway_taxiway" order="10">
- <polyline color="#989994" width="4" />
- <polyline color="#d3dbbc" width="2" />
- </item>
- <item type="aeroway_taxiway" order="11">
- <polyline color="#989994" width="6" />
- <polyline color="#d3dbbc" width="4" />
- </item>
- <item type="aeroway_taxiway" order="12">
- <polyline color="#989994" width="10" />
- <polyline color="#d3dbbc" width="8" />
- </item>
- <item type="aeroway_taxiway" order="13">
- <polyline color="#989994" width="12" />
- <polyline color="#d3dbbc" width="9" />
- </item>
- <item type="aeroway_taxiway" order="14">
- <polyline color="#989994" width="15" />
- <polyline color="#d3dbbc" width="13" />
- </item>
- <item type="aeroway_taxiway" order="15">
- <polyline color="#989994" width="17" />
- <polyline color="#d3dbbc" width="14" />
- </item>
- <item type="aeroway_taxiway" order="16">
- <polyline color="#989994" width="33" />
- <polyline color="#d3dbbc" width="26" />
- </item>
- <item type="aeroway_taxiway" order="17">
- <polyline color="#989994" width="69" />
- <polyline color="#d3dbbc" width="61" />
- </item>
- <item type="aeroway_taxiway" order="18">
- <polyline color="#989994" width="132" />
- <polyline color="#d3dbbc" width="126" />
- </item>
- <item type="aeroway_runway" order="2-6">
- <polyline color="#404040" width="1" />
- </item>
- <item type="aeroway_runway" order="7-8">
- <polyline color="#404040" width="3" />
- <polyline color="#d3dbbc" width="1" />
- </item>
- <item type="aeroway_runway" order="9">
- <polyline color="#6b6f5f" width="5" />
- <polyline color="#d3dbbc" width="3" />
- </item>
- <item type="aeroway_runway" order="10">
- <polyline color="#6b6f5f" width="6" />
- <polyline color="#d3dbbc" width="4" />
- </item>
- <item type="aeroway_runway" order="11">
- <polyline color="#6b6f5f" width="9" />
- <polyline color="#d3dbbc" width="7" />
- </item>
- <item type="aeroway_runway" order="12">
- <polyline color="#6b6f5f" width="13" />
- <polyline color="#d3dbbc" width="9" />
- </item>
- <item type="aeroway_runway" order="13">
- <polyline color="#6b6f5f" width="18" />
- <polyline color="#d3dbbc" width="14" />
- </item>
- <item type="aeroway_runway" order="14">
- <polyline color="#6b6f5f" width="21" />
- <polyline color="#d3dbbc" width="17" />
- </item>
- <item type="aeroway_runway" order="15">
- <polyline color="#6b6f5f" width="24" />
- <polyline color="#d3dbbc" width="20" />
- </item>
- <item type="aeroway_runway" order="16">
- <polyline color="#6b6f5f" width="39" />
- <polyline color="#d3dbbc" width="33" />
- </item>
- <item type="aeroway_runway" order="17">
- <polyline color="#6b6f5f" width="78" />
- <polyline color="#d3dbbc" width="72" />
- </item>
- <item type="aeroway_runway" order="18">
- <polyline color="#6b6f5f" width="156" />
- <polyline color="#d3dbbc" width="150" />
- </item>
-
-
- <item type="rail" order="6-9">
- <polyline color="#696969" width="4" />
- <polyline color="#FFFFFF" dash="2,5" width="2" />
- </item>
- <item type="rail_narrow_gauge" order="6-9">
- <polyline color="#696969" width="4" />
- <polyline color="#FFFFFF" dash="2,5" width="2" />
- </item>
-
- <item type="rail" order="10-13">
- <polyline color="#696969" width="6" />
- <polyline color="#FFFFFF" dash="3,8" width="3" />
- </item>
- <item type="rail_narrow_gauge" order="10-13">
- <polyline color="#696969" width="6" />
- <polyline color="#FFFFFF" dash="3,8" width="3" />
- </item>
-
- <item type="rail" order="14-18">
- <polyline color="#696969" width="8" />
- <polyline color="#FFFFFF" dash="4,12" width="5" />
- </item>
- <item type="rail_narrow_gauge" order="14-18">
- <polyline color="#696969" width="8" />
- <polyline color="#FFFFFF" dash="4,12" width="5" />
- </item>
-
- <item type="rail_light" order="10-13">
- <polyline color="#696969" width="4" />
- <polyline color="#FFFFFF" dash="2,5" width="2" />
- </item>
-
- <item type="rail_light" order="14-18">
- <polyline color="#696969" width="6" />
- <polyline color="#FFFFFF" dash="4,8" width="4" />
- </item>
-
- <item type="rail_subway" order="8-">
- <polyline color="#696969" width="2" />
- <polyline color="#FFFFFF" dash="5,5" width="2" />
- </item>
- <item type="rail_mono" order="10-">
- <polyline color="#696969" width="2" />
- </item>
- <item type="rail_tram,bus_guideway" order="10-">
- <polyline color="#696969" width="2" />
- </item>
- <item type="rail_preserved" order="10-">
- <polyline color="#696969" width="1" dash="7" />
- </item>
- <item type="rail_disused" order="12-">
- <polyline color="#d3d3d3" width="1" dash="10" />
- </item>
- <item type="rail_abandoned" order="12-">
- <polyline color="#f5f5f5" width="1" dash="10" />
- </item>
- <item type="lift_cable_car" order="6-">
- <polyline color="#696969" width="1" dash="5" />
- </item>
- <item type="lift_chair" order="6-">
- <polyline color="#696969" width="1" dash="5" />
- </item>
- <item type="lift_drag" order="6-">
- <polyline color="#696969" width="1" dash="5" />
- </item>
- <item type="ferry" order="5-">
- <polyline color="#000000" width="3" dash="5" />
- </item>
- <item type="track" order="3-">
- <polyline color="#3f3f3f" width="1" />
- </item>
-
-
-
- <item type="town_label,district_label,town_label_0e0,town_label_1e0,town_label_2e0,town_label_5e0,town_label_1e1,town_label_2e1,town_label_5e1,town_label_1e2,town_label_2e2,town_label_5e2,district_label_0e0,district_label_1e0,district_label_2e0,district_label_5e0,district_label_1e1,district_label_2e1,district_label_5e1,district_label_1e2,district_label_2e2,district_label_5e2" order="12-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="district_label_1e3,district_label_2e3,district_label_5e3" order="9-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="town_label_1e3,town_label_2e3,town_label_5e3" order="9-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="district_label_1e4,district_label_2e4,district_label_5e4" order="7-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="town_label_1e4,town_label_2e4,town_label_5e4" order="7-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="district_label_1e5,district_label_2e5,district_label_5e5" order="5-">
- <circle color="#000000" radius="3" label_size="10" />
- </item>
- <item type="town_label_1e5,town_label_2e5,town_label_5e5" order="5-">
- <circle color="#000000" radius="3" label_size="10" />
- </item>
- <item type="district_label_1e6,district_label_2e6,district_label_5e6" order="3-">
- <circle color="#000000" radius="3" label_size="15" />
- </item>
- <item type="town_label_1e6,town_label_2e6,town_label_5e6" order="3-">
- <circle color="#000000" radius="3" label_size="15" />
- </item>
- <item type="town_label_1e7,district_label_1e7" order="1-">
- <circle color="#000000" radius="3" label_size="15" />
- </item>
- </layer>
- <xi:include xpointer="xpointer(/config/navit/layout[@name='Car']/layer[@name='points'])" />
- </layout>
-
-
-
- <layout name="T@H">
- <layer name="sea" details="0">
-
-<!-- landuse=forest -->
- <item type="wood" order="0-">
- <polygon color="#72bf81" />
- </item>
-<!-- landuse=residential -->
- <item type="town_poly" order="0-">
- <polygon color="#f2f2f2" />
- </item>
-<!-- natural=water -->
- <item type="water_poly" order="0-">
- <polygon color="#b5d6f1" />
- <polyline color="#b5d6f1" />
- <label label_size="8" />
- </item>
-<!-- leisure=park -->
- <item type="park_poly" order="0-">
- <polygon color="#c7f1a3" />
- <polyline color="#79c691" />
- <label label_size="5" />
- </item>
- <item type="airport_poly" order="0-">
- <polygon color="#a0a0a0" />
- </item>
- <item type="sport_poly" order="0-">
- <polygon color="#4af04f" />
- </item>
-
-<!-- landuse=industrial -->
- <item type="industry_poly,building_poly,place_poly" order="0-">
- <polygon color="#ecd8ff" />
- </item>
-<!-- waterway=stream -->
- <item type="water_line" order="0-4">
- <polyline color="#b5d6f1" width="1" />
- <label label_size="8" />
- </item>
-<!-- railway=subway -->
- <item type="rail" order="6">
- <polyline color="#aaaaaa" width="1" />
- </item>
- <item type="rail" order="7-8">
- <polyline color="#aaaaaa" width="2" />
- </item>
- <item type="rail" order="9-">
- <polyline color="#aaaaaa" width="6" />
- </item>
- <item type="ferry" order="5-">
- <polyline color="#000000" width="1" />
- </item>
- <item type="border_country" order="0-">
- <polyline color="#b8434e" width="1" />
- </item>
- <item type="border_state" order="0-">
- <polyline color="#808080" width="1" />
- </item>
- <item type="height_line_1" order="0-">
- <polyline color="#000000" width="1" />
- </item>
- <item type="height_line_2" order="0-">
- <polyline color="#000000" width="2" />
- </item>
-<!-- routing -->
- <item type="street_route" order="2">
- <polyline color="#0000a0" width="4" />
- </item>
- <item type="street_route" order="3-5">
- <polyline color="#0000a0" width="8" />
- </item>
- <item type="street_route" order="6">
- <polyline color="#0000a0" width="10" />
- </item>
- <item type="street_route" order="7-8">
- <polyline color="#0000a0" width="16" />
- </item>
- <item type="street_route" order="9-10">
- <polyline color="#0000a0" width="20" />
- </item>
- <item type="street_route" order="11">
- <polyline color="#0000a0" width="28" />
- </item>
- <item type="street_route" order="12">
- <polyline color="#0000a0" width="32" />
- </item>
- <item type="street_route" order="13">
- <polyline color="#0000a0" width="52" />
- </item>
- <item type="street_route" order="14">
- <polyline color="#0000a0" width="64" />
- </item>
- <item type="street_route" order="15">
- <polyline color="#0000a0" width="68" />
- </item>
- <item type="street_route" order="16">
- <polyline color="#0000a0" width="132" />
- </item>
- <item type="street_route" order="17">
- <polyline color="#0000a0" width="268" />
- </item>
- <item type="street_route" order="18">
- <polyline color="#0000a0" width="530" />
- </item>
-<!-- highway=service,footway, ,... -->
- <item type="street_nopass" order="10">
- <polyline color="#efeaa0" width="1" />
- </item>
- <item type="street_nopass" order="11-12">
- <polyline color="#efeaa0" width="2" />
- </item>
- <item type="street_nopass" order="13-">
- <polyline color="#efeaa0" width="4" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="10">
- <polyline color="#d2d2d2" width="4" />
- <polyline color="#ffffff" width="2" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="11">
- <polyline color="#d2d2d2" width="6" />
- <polyline color="#ffffff" width="4" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="12">
- <polyline color="#d2d2d2" width="10" />
- <polyline color="#ffffff" width="8" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="13">
- <polyline color="#d2d2d2" width="12" />
- <polyline color="#ffffff" width="9" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="14">
- <polyline color="#d2d2d2" width="15" />
- <polyline color="#ffffff" width="13" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="15">
- <polyline color="#d2d2d2" width="17" />
- <polyline color="#ffffff" width="14" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="16">
- <polyline color="#d2d2d2" width="33" />
- <polyline color="#ffffff" width="26" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="17">
- <polyline color="#d2d2d2" width="69" />
- <polyline color="#ffffff" width="61" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="18">
- <polyline color="#d2d2d2" width="132" />
- <polyline color="#ffffff" width="126" />
- </item>
-<!-- highway=tertiary -->
- <item type="street_2_city,street_2_land" order="7-8">
- <polyline color="#c4c4c4" width="2" />
- </item>
- <item type="street_2_city,street_2_land" order="9">
- <polyline color="#c4c4c4" width="4" />
- <polyline color="#f7f496" width="2" />
- </item>
- <item type="street_2_city,street_2_land" order="10">
- <polyline color="#c4c4c4" width="6" />
- <polyline color="#f7f496" width="4" />
- </item>
- <item type="street_2_city,street_2_land" order="11">
- <polyline color="#c4c4c4" width="8" />
- <polyline color="#f7f496" width="6" />
- </item>
- <item type="street_2_city,street_2_land" order="12">
- <polyline color="#c4c4c4" width="12" />
- <polyline color="#f7f496" width="9" />
- </item>
- <item type="street_2_city,street_2_land" order="13">
- <polyline color="#c4c4c4" width="15" />
- <polyline color="#f7f496" width="11" />
- </item>
- <item type="street_2_city,street_2_land" order="14">
- <polyline color="#c4c4c4" width="18" />
- <polyline color="#f7f496" width="14" />
- </item>
- <item type="street_2_city,street_2_land" order="15">
- <polyline color="#c4c4c4" width="21" />
- <polyline color="#f7f496" width="17" />
- </item>
- <item type="street_2_city,street_2_land" order="16">
- <polyline color="#c4c4c4" width="35" />
- <polyline color="#f7f496" width="30" />
- </item>
- <item type="street_2_city,street_2_land" order="17">
- <polyline color="#c4c4c4" width="73" />
- <polyline color="#f7f496" width="67" />
- </item>
- <item type="street_2_city,street_2_land" order="18">
- <polyline color="#c4c4c4" width="144" />
- <polyline color="#f7f496" width="138" />
- </item>
-<!-- highway=secondary -->
- <item type="street_3_city,street_3_land,ramp" order="7">
- <polyline color="#fdbf6f" width="1" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="8">
- <polyline color="#000000" width="2" />
- <polyline color="#fdbf6f" width="1" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="9">
- <polyline color="#000000" width="5" />
- <polyline color="#fdbf6f" width="3" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="10">
- <polyline color="#000000" width="8" />
- <polyline color="#fdbf6f" width="6" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="11">
- <polyline color="#000000" width="9" />
- <polyline color="#fdbf6f" width="7" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="12">
- <polyline color="#000000" width="11" />
- <polyline color="#fdbf6f" width="9" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="13">
- <polyline color="#000000" width="16" />
- <polyline color="#fdbf6f" width="14" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="14">
- <polyline color="#000000" width="19" />
- <polyline color="#fdbf6f" width="17" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="15">
- <polyline color="#000000" width="23" />
- <polyline color="#fdbf6f" width="21" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="16">
- <polyline color="#000000" width="36" />
- <polyline color="#fdbf6f" width="34" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="17">
- <polyline color="#000000" width="75" />
- <polyline color="#fdbf6f" width="73" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="18">
- <polyline color="#000000" width="152" />
- <polyline color="#fdbf6f" width="150" />
- </item>
-<!-- highway=primary -->
- <item type="street_4_city,street_4_land,street_n_lanes" order="2-6">
- <polyline color="#e46d71" width="1" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="7-8">
- <polyline color="#e46d71" width="3" />
- <polyline color="#e46d71" width="1" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="9">
- <polyline color="#e46d71" width="5" />
- <polyline color="#e46d71" width="3" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="10">
- <polyline color="#e46d71" width="6" />
- <polyline color="#e46d71" width="4" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="11">
- <polyline color="#e46d71" width="9" />
- <polyline color="#e46d71" width="7" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="12">
- <polyline color="#e46d71" width="13" />
- <polyline color="#e46d71" width="9" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="13">
- <polyline color="#e46d71" width="18" />
- <polyline color="#e46d71" width="14" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="14">
- <polyline color="#e46d71" width="21" />
- <polyline color="#e46d71" width="17" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="15">
- <polyline color="#e46d71" width="24" />
- <polyline color="#e46d71" width="20" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="16">
- <polyline color="#e46d71" width="39" />
- <polyline color="#e46d71" width="33" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="17">
- <polyline color="#e46d71" width="78" />
- <polyline color="#e46d71" width="72" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="18">
- <polyline color="#e46d71" width="156" />
- <polyline color="#e46d71" width="150" />
- </item>
-<!-- highway=motorway -->
- <item type="highway_city,highway_land" order="2">
- <polyline color="#809bc0" width="1" />
- </item>
- <item type="highway_city,highway_land" order="3-5">
- <polyline color="#87908a" width="3" />
- <polyline color="#809bc0" width="1" />
- </item>
- <item type="highway_city,highway_land" order="6">
- <polyline color="#87908a" width="4" />
- <polyline color="#809bc0" width="2" />
- </item>
- <item type="highway_city,highway_land" order="7-8">
- <polyline color="#87908a" width="7" />
- <polyline color="#809bc0" width="5" />
- <polyline color="#809bc0" width="1" />
- </item>
- <item type="highway_city,highway_land" order="9-10">
- <polyline color="#87908a" width="9" />
- <polyline color="#809bc0" width="5" />
- <polyline color="#809bc0" width="1" />
- </item>
- <item type="highway_city,highway_land" order="11">
- <polyline color="#87908a" width="13" />
- <polyline color="#809bc0" width="9" />
- <polyline color="#809bc0" width="1" />
- </item>
- <item type="highway_city,highway_land" order="12">
- <polyline color="#87908a" width="15" />
- <polyline color="#809bc0" width="10" />
- <polyline color="#809bc0" width="1" />
- </item>
- <item type="highway_city,highway_land" order="13">
- <polyline color="#87908a" width="25" />
- <polyline color="#809bc0" width="17" />
- <polyline color="#809bc0" width="1" />
- </item>
- <item type="highway_city,highway_land" order="14">
- <polyline color="#87908a" width="31" />
- <polyline color="#809bc0" width="24" />
- <polyline color="#809bc0" width="1" />
- </item>
- <item type="highway_city,highway_land" order="15">
- <polyline color="#87908a" width="33" />
- <polyline color="#809bc0" width="27" />
- <polyline color="#809bc0" width="1" />
- </item>
- <item type="highway_city,highway_land" order="16">
- <polyline color="#87908a" width="65" />
- <polyline color="#809bc0" width="59" />
- <polyline color="#809bc0" width="1" />
- </item>
- <item type="highway_city,highway_land" order="17">
- <polyline color="#87908a" width="133" />
- <polyline color="#809bc0" width="127" />
- <polyline color="#809bc0" width="1" />
- </item>
- <item type="highway_city,highway_land" order="18">
- <polyline color="#87908a" width="264" />
- <polyline color="#809bc0" width="258" />
- <polyline color="#809bc0" width="1" />
- </item>
-<!-- unbekannte elemente -->
- <item type="street_unkn" order="11-">
- <polyline color="#f3d6b6" width="3" />
- </item>
- <item type="highway_exit_label" order="10-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
-<!-- highway=primary (font)-->
- <item type="highway_city,highway_land,street_4_city,street_4_land,street_n_lanes" order="10-18">
- <label label_size="9" />
- </item>
- <item type="street_2_city,street_2_land,street_3_city,street_3_land,ramp" order="11-18">
- <label label_size="9" />
- </item>
- <item type="street_nopass,street_0,street_1_city,street_1_land" order="12-18">
- <label label_size="9" />
- </item>
-<!-- place=suburb -->
- <item type="town_label,district_label,town_label_0e0,town_label_1e0,town_label_2e0,town_label_5e0,town_label_1e1,town_label_2e1,town_label_5e1,town_label_1e2,town_label_2e2,town_label_5e2,district_label_0e0,district_label_1e0,district_label_2e0,district_label_5e0,district_label_1e1,district_label_2e1,district_label_5e1,district_label_1e2,district_label_2e2,district_label_5e2" order="9-">
- <circle color="#000000" radius="3" label_size="9" />
- </item>
- <item type="district_label_1e3,district_label_2e3,district_label_5e3" order="11-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="town_label_1e3,town_label_2e3,town_label_5e3" order="10-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="district_label_1e4,district_label_2e4,district_label_5e4" order="9-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="town_label_1e4,town_label_2e4,town_label_5e4" order="8-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="district_label_1e5,district_label_2e5,district_label_5e5" order="6-">
- <circle color="#000000" radius="3" label_size="10" />
- </item>
-<!-- place=city -->
- <item type="town_label_1e5,town_label_2e5,town_label_5e5" order="4-">
- <circle color="#000000" radius="3" label_size="15" />
- </item>
- <item type="district_label_1e6,district_label_2e6,district_label_5e6" order="3-">
- <circle color="#000000" radius="3" label_size="15" />
- </item>
- <item type="town_label_1e6,town_label_2e6,town_label_5e6" order="2-">
- <circle color="#000000" radius="3" label_size="15" />
- </item>
- <item type="town_label_1e7,district_label_1e7" order="1-">
- <circle color="#000000" radius="3" label_size="15" />
- </item>
- <item type="flats,scrub,military_zone,marine_poly,plantation,tundra" order="0-">
- <polygon color="#a0a0a0" />
- <label label_size="5" />
- </item>
- <item type="rg_point" order="0-">
- <circle color="#FF089C" radius="10" />
- </item>
-
-<!-- !!!!...POIs...!!!! -->
-
-<!-- amenity=bank -->
- <item type="poi_bank" order="14-">
- <icon src="bank.xpm" />
- <circle color="#000000" radius="3" label_size="7" />
- </item>
-<!-- amenity=fuel -->
- <item type="poi_fuel" order="14-">
- <icon src="fuel.xpm" />
- <circle color="#000000" radius="3" label_size="7" />
- </item>
-<!-- amenity=hospitalg -->
- <item type="poi_hospital" order="14-">
- <icon src="hospital.xpm" />
- <circle color="#000000" radius="3" label_size="7" />
- </item>
-<!-- amenity=parking -->
- <item type="poi_car_parking" order="14-">
- <icon src="parking.xpm" />
- </item>
-<!-- amenity=police -->
- <item type="poi_police" order="14-">
- <icon src="police.xpm" />
- <circle color="#000000" radius="3" label_size="7" />
- </item>
-<!-- amenity=restaurant -->
- <item type="poi_restaurant" order="14-">
- <icon src="restaurant.xpm" />
- <circle color="#000000" radius="3" label_size="7" />
- </item>
-<!-- leisure=golf_curse -->
- <item type="poi_golf" order="14-">
- <icon src="golf.xpm" />
- <circle color="#000000" radius="3" label_size="7" />
- </item>
-<!-- tourism=hotel -->
- <item type="poi_hotel" order="14-">
- <icon src="hotel.xpm" />
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- </layer>
- </layout>
-</navit>
-</config>
-
-
diff --git a/navit/osd.c b/navit/osd.c
deleted file mode 100644
index d078ff27..00000000
--- a/navit/osd.c
+++ /dev/null
@@ -1,100 +0,0 @@
-#if 0
-//#include <math.h>
-#include <stdio.h>
-#include <glib.h>
-#include "point.h"
-//#include "coord.h"
-#include "graphics.h"
-//#include "transform.h"
-//#include "route.h"
-#include "vehicle.h"
-#include "container.h"
-#include "osd.h"
-
-void
-osd_set_next_command(char *new_command,char *new_road){
- extern struct container *co;
- // struct osd *this=co->osd;
- strcpy(co->osd->command,new_command);
- strcpy(co->osd->road_name,new_road);
- osd_draw(co->osd, co);
-}
-
-void
-osd_draw(struct osd *osd, struct container *co)
-{
- double *speed;
- struct point p;
-
- if (! co->vehicle)
- return;
-
- speed=vehicle_speed_get(co->vehicle);
- osd->gr->draw_mode(osd->gr, draw_mode_begin);
- p.x=0;
- p.y=0;
- osd->gr->draw_rectangle(osd->gr, osd->bg, &p, 360, 80);
- p.x=10;
- p.y=20;
-// osd->gr->draw_text(osd->gr, osd->green, NULL, osd->font, osd->command, &p, 0x13000, 0);
- char osd_data[256];
- sprintf(osd_data,"%.1f km/h",(*speed));
- osd->gr->draw_text(osd->gr, osd->green, NULL, osd->font, osd_data, &p, 0x13000, 0);
- p.x=10;
- p.y=40;
- osd->gr->draw_text(osd->gr, osd->green, NULL, osd->font, osd->command, &p, 0x13000, 0);
-// osd->gr->draw_text(osd->gr, osd->green, NULL, osd->font, "Overlay", &p, 0x10000, 0);
-// printf("Text %s should appear\n",osd->command);
- osd->gr->draw_mode(osd->gr, draw_mode_end);
-}
-
-
-struct osd *
-osd_new(struct container *co)
-{
- printf("Spawning an OSD\n");
- struct osd *this=g_new0(struct osd, 1);
- struct point p;
- p.x=100;
- p.y=10;
- this->gr=co->gra->overlay_new(co->gra, &p, 360, 80);
- this->bg=this->gr->gc_new(this->gr);
- this->gr->gc_set_foreground(this->bg, 0, 0, 0);
- this->white=this->gr->gc_new(this->gr);
- this->gr->gc_set_foreground(this->white, 0xffff, 0xffff, 0xffff);
- this->gr->gc_set_linewidth(this->white, 10);
- this->green=this->gr->gc_new(this->gr);
- this->gr->gc_set_foreground(this->green, 0x0, 0xffff, 0x0);
- this->gr->gc_set_linewidth(this->green, 10);
-
- this->font=this->gr->font_new(this->gr, 200);
- osd_draw(this, co);
- return this;
-}
-#endif
-
-#include <glib.h>
-#include "debug.h"
-#include "plugin.h"
-#include "osd.h"
-
-
-struct osd {
- struct osd_methods meth;
- struct osd_priv *priv;
-};
-
-struct osd *
-osd_new(struct navit *nav, const char *type, struct attr **attrs)
-{
- struct osd *o;
- struct osd_priv *(*new)(struct navit *nav, struct osd_methods *meth, struct attr **attrs);
-
- new=plugin_get_osd_type(type);
- if (! new)
- return NULL;
- o=g_new0(struct osd, 1);
- o->priv=new(nav, &o->meth, attrs);
- return o;
-}
-
diff --git a/navit/osd.h b/navit/osd.h
deleted file mode 100644
index 9a50e99b..00000000
--- a/navit/osd.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef NAVIT_OSD_H
-#define NAVIT_OSD_H
-
-struct osd_methods {
- void (*osd_destroy)(struct osd_priv *osd);
-};
-
-/* prototypes */
-struct attr;
-struct navit;
-struct osd;
-struct osd *osd_new(struct navit *nav, const char *type, struct attr **attrs);
-/* end of prototypes */
-
-#endif
-
diff --git a/navit/osd/core/Makefile.am b/navit/osd/core/Makefile.am
deleted file mode 100644
index 8e731e41..00000000
--- a/navit/osd/core/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=osd_core
-moduleosd_LTLIBRARIES = libosd_core.la
-libosd_core_la_SOURCES = osd_core.c
diff --git a/navit/osd/core/osd_core.c b/navit/osd/core/osd_core.c
deleted file mode 100644
index 588bedae..00000000
--- a/navit/osd/core/osd_core.c
+++ /dev/null
@@ -1,578 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <glib.h>
-#include <time.h>
-#include <stdlib.h>
-#include <string.h>
-#include "config.h"
-#include "item.h"
-#include "point.h"
-#include "coord.h"
-#include "graphics.h"
-#include "transform.h"
-#include "route.h"
-#include "navit.h"
-#include "plugin.h"
-#include "debug.h"
-#include "callback.h"
-#include "color.h"
-#include "vehicle.h"
-#include "navigation.h"
-#include "track.h"
-#include "map.h"
-
-struct compass {
- struct point p;
- int w,h;
- struct graphics *gr;
- struct graphics_gc *bg;
- struct graphics_gc *white;
- struct graphics_gc *green;
- struct graphics_font *font;
-};
-
-
-static void
-transform_rotate(struct point *center, int angle, struct point *p, int count)
-{
- int i,x,y;
- double dx,dy;
- for (i = 0 ; i < count ; i++)
- {
- dx=sin(M_PI*angle/180.0);
- dy=cos(M_PI*angle/180.0);
- x=dy*p->x-dx*p->y;
- y=dx*p->x+dy*p->y;
-
- p->x=center->x+x;
- p->y=center->y+y;
- p++;
- }
-}
-
-static void
-handle(struct graphics *gr, struct graphics_gc *gc, struct point *p, int r, int dir)
-{
- struct point ph[3];
- int l=r*0.4;
-
- ph[0].x=0;
- ph[0].y=r;
- ph[1].x=0;
- ph[1].y=-r;
- transform_rotate(p, dir, ph, 2);
- graphics_draw_lines(gr, gc, ph, 2);
- ph[0].x=-l;
- ph[0].y=-r+l;
- ph[1].x=0;
- ph[1].y=-r;
- ph[2].x=l;
- ph[2].y=-r+l;
- transform_rotate(p, dir, ph, 3);
- graphics_draw_lines(gr, gc, ph, 3);
-}
-
-static void
-format_distance(char *buffer, double distance)
-{
- if (distance >= 100000)
- sprintf(buffer,"%.0f km", distance/1000);
- else if (distance >= 10000)
- sprintf(buffer,"%.1f km", distance/1000);
- else if (distance >= 300)
- sprintf(buffer,"%.0f m", round(distance/25)*25);
- else if (distance >= 50)
- sprintf(buffer,"%.0f m", round(distance/10)*10);
- else if (distance >= 10)
- sprintf(buffer,"%.0f m", distance);
- else
- sprintf(buffer,"%.1f m", distance);
-}
-
-static void
-osd_compass_draw(struct compass *this, struct navit *nav, struct vehicle *v)
-{
- struct point p;
- struct attr attr_dir, destination_attr, position_attr;
- double dir,vdir=0;
- char buffer[16];
- struct coord c1, c2;
- enum projection pro;
-
- graphics_draw_mode(this->gr, draw_mode_begin);
- p.x=0;
- p.y=0;
- graphics_draw_rectangle(this->gr, this->bg, &p, this->w, this->h);
- p.x=30;
- p.y=30;
- graphics_draw_circle(this->gr, this->white, &p, 50);
- if (v && vehicle_get_attr(v, attr_position_direction, &attr_dir)) {
- vdir=*attr_dir.u.numd;
- handle(this->gr, this->white, &p, 20, -vdir);
- }
- if (navit_get_attr(nav, attr_destination, &destination_attr, NULL) && v && vehicle_get_attr(v, attr_position_coord_geo, &position_attr)) {
- pro=destination_attr.u.pcoord->pro;
- transform_from_geo(pro, position_attr.u.coord_geo, &c1);
- c2.x=destination_attr.u.pcoord->x;
- c2.y=destination_attr.u.pcoord->y;
- dir=atan2(c2.x-c1.x,c2.y-c1.y)*180.0/M_PI;
- dir-=vdir;
- handle(this->gr, this->green, &p, 20, dir);
- format_distance(buffer, transform_distance(pro, &c1, &c2));
- p.x=8;
- p.y=72;
- graphics_draw_text(this->gr, this->green, NULL, this->font, buffer, &p, 0x10000, 0);
- }
- graphics_draw_mode(this->gr, draw_mode_end);
-}
-
-static void
-osd_compass_init(struct compass *this, struct navit *nav)
-{
- struct graphics *navit_gr;
- struct color c;
- navit_gr=navit_get_graphics(nav);
- this->gr=graphics_overlay_new(navit_gr, &this->p, this->w, this->h);
-
- this->bg=graphics_gc_new(this->gr);
- c.r=0; c.g=0; c.b=0;
- graphics_gc_set_foreground(this->bg, &c);
-
- this->white=graphics_gc_new(this->gr);
- c.r=65535; c.g=65535; c.b=65535;
- graphics_gc_set_foreground(this->white, &c);
- graphics_gc_set_linewidth(this->white, 2);
-
- this->green=graphics_gc_new(this->gr);
- c.r=0; c.g=65535; c.b=0;
- graphics_gc_set_foreground(this->green, &c);
- graphics_gc_set_linewidth(this->green, 2);
-
- this->font=graphics_font_new(this->gr, 200, 1);
- navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_compass_draw), attr_position_coord_geo, this));
-
- osd_compass_draw(this, nav, NULL);
-}
-
-static struct osd_priv *
-osd_compass_new(struct navit *nav, struct osd_methods *meth, struct attr **attrs)
-{
- struct compass *this=g_new0(struct compass, 1);
- struct attr *attr;
- this->p.x=20;
- this->p.y=20;
- this->w=60;
- this->h=80;
- attr=attr_search(attrs, NULL, attr_x);
- if (attr)
- this->p.x=attr->u.num;
- attr=attr_search(attrs, NULL, attr_y);
- if (attr)
- this->p.y=attr->u.num;
- navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_compass_init), attr_navit, this));
- return (struct osd_priv *) this;
-}
-
-struct eta {
- struct point p;
- int w,h;
- struct graphics *gr;
- struct graphics_gc *bg;
- struct graphics_gc *white;
- struct graphics_font *font;
- struct graphics_image *flag;
- int active;
- char last_eta[16];
- char last_distance[16];
-};
-
-static void
-osd_eta_draw(struct eta *this, struct navit *navit, struct vehicle *v)
-{
- struct point p;
- char eta[16];
- char distance[16];
- int days=0,do_draw=0;
- time_t etat;
- struct tm tm,eta_tm,eta_tm0;
- struct attr attr;
- struct navigation *nav=NULL;
- struct map *map=NULL;
- struct map_rect *mr=NULL;
- struct item *item=NULL;
-
-
- eta[0]='\0';
- distance[0]='\0';
-
- if (navit)
- nav=navit_get_navigation(navit);
- if (nav)
- map=navigation_get_map(nav);
- if (map)
- mr=map_rect_new(map, NULL);
- if (mr)
- item=map_rect_get_item(mr);
- if (item) {
- if (item_attr_get(item, attr_destination_length, &attr)) {
- format_distance(distance, attr.u.num);
- }
- if (item_attr_get(item, attr_destination_time, &attr)) {
- etat=time(NULL);
- tm=*localtime(&etat);
- etat+=attr.u.num/10;
- eta_tm=*localtime(&etat);
- if (tm.tm_year != eta_tm.tm_year || tm.tm_mon != eta_tm.tm_mon || tm.tm_mday != eta_tm.tm_mday) {
- eta_tm0=eta_tm;
- eta_tm0.tm_sec=0;
- eta_tm0.tm_min=0;
- eta_tm0.tm_hour=0;
- tm.tm_sec=0;
- tm.tm_min=0;
- tm.tm_hour=0;
- days=(mktime(&eta_tm0)-mktime(&tm)+43200)/86400;
- }
- if (days)
- sprintf(eta, "%d+%02d:%02d", days, eta_tm.tm_hour, eta_tm.tm_min);
- else
- sprintf(eta, " %02d:%02d", eta_tm.tm_hour, eta_tm.tm_min);
- }
- if (this->active != 1 || strcmp(this->last_distance, distance) || strcmp(this->last_eta, eta)) {
- this->active=1;
- strcpy(this->last_distance, distance);
- strcpy(this->last_eta, eta);
- do_draw=1;
- }
- } else {
- if (this->active != 0) {
- this->active=0;
- do_draw=1;
- }
- }
- if (mr)
- map_rect_destroy(mr);
-
- if (do_draw) {
- graphics_draw_mode(this->gr, draw_mode_begin);
- p.x=0;
- p.y=0;
- graphics_draw_rectangle(this->gr, this->bg, &p, this->w, this->h);
- p.x=6;
- p.y=6;
- if (this->flag)
- graphics_draw_image(this->gr, this->white, &p, this->flag);
- if (eta[0]) {
- p.x=28;
- p.y=28;
- graphics_draw_text(this->gr, this->white, NULL, this->font, "ETA", &p, 0x10000, 0);
- p.x=6;
- p.y=42;
- graphics_draw_text(this->gr, this->white, NULL, this->font, eta, &p, 0x10000, 0);
- }
- if (distance[0]) {
- p.x=6;
- p.y=56;
- graphics_draw_text(this->gr, this->white, NULL, this->font, distance, &p, 0x10000, 0);
- }
- graphics_draw_mode(this->gr, draw_mode_end);
- }
-}
-
-static void
-osd_eta_init(struct eta *this, struct navit *nav)
-{
- struct graphics *navit_gr;
- struct color c;
- char *flag=g_strjoin(NULL,getenv("NAVIT_SHAREDIR"), "/xpm/flag_wh_bk.xpm", NULL);
- navit_gr=navit_get_graphics(nav);
- this->gr=graphics_overlay_new(navit_gr, &this->p, this->w, this->h);
-
- this->bg=graphics_gc_new(this->gr);
- c.r=0; c.g=0; c.b=0;
- graphics_gc_set_foreground(this->bg, &c);
-
- this->white=graphics_gc_new(this->gr);
- c.r=65535; c.g=65535; c.b=65535;
- graphics_gc_set_foreground(this->white, &c);
- graphics_gc_set_linewidth(this->white, 2);
-
- this->font=graphics_font_new(this->gr, 200, 1);
- this->flag=graphics_image_new(this->gr, flag);
- navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_eta_draw), attr_position_coord_geo, this));
-
- osd_eta_draw(this, nav, NULL);
- g_free(flag);
-}
-
-static struct osd_priv *
-osd_eta_new(struct navit *nav, struct osd_methods *meth, struct attr **attrs)
-{
- struct eta *this=g_new0(struct eta, 1);
- struct attr *attr;
- this->p.x=-80;
- this->p.y=20;
- this->w=60;
- this->h=60;
- this->active=-1;
- attr=attr_search(attrs, NULL, attr_x);
- if (attr)
- this->p.x=attr->u.num;
- attr=attr_search(attrs, NULL, attr_y);
- if (attr)
- this->p.y=attr->u.num;
- navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_eta_init), attr_navit, this));
- return (struct osd_priv *) this;
-}
-
-struct osd_navigation {
- struct point p;
- int w,h;
- struct graphics *gr;
- struct graphics_gc *bg;
- struct graphics_gc *white;
- struct graphics_font *font;
- int active;
- char last_distance[16];
- char *last_name;
-};
-
-static void
-osd_navigation_draw(struct osd_navigation *this, struct navit *navit, struct vehicle *v)
-{
- struct point p;
- char distance[16];
- int do_draw=0;
- struct attr attr;
- struct navigation *nav=NULL;
- struct map *map=NULL;
- struct map_rect *mr=NULL;
- struct item *item=NULL;
- struct graphics_image *gr_image;
- char *image;
- char *name="unknown";
-
- distance[0]='\0';
-
- if (navit)
- nav=navit_get_navigation(navit);
- if (nav)
- map=navigation_get_map(nav);
- if (map)
- mr=map_rect_new(map, NULL);
- if (mr)
- item=map_rect_get_item(mr);
- if (item) {
- name=item_to_name(item->type);
- dbg(1,"name=%s\n", name);
- if (item_attr_get(item, attr_length, &attr)) {
- format_distance(distance, attr.u.num);
- }
- if (this->active != 1 || strcmp(this->last_distance, distance) || this->last_name != name) {
- this->active=1;
- strcpy(this->last_distance, distance);
- this->last_name=name;
- do_draw=1;
- }
- } else {
- if (this->active != 0) {
- this->active=0;
- do_draw=1;
- }
- }
- if (mr)
- map_rect_destroy(mr);
-
- if (do_draw) {
- graphics_draw_mode(this->gr, draw_mode_begin);
- p.x=0;
- p.y=0;
- graphics_draw_rectangle(this->gr, this->bg, &p, this->w, this->h);
- if (this->active) {
- image=g_strjoin(NULL,getenv("NAVIT_SHAREDIR"), "/xpm/", name, "_32.xpm", NULL);
- gr_image=graphics_image_new(this->gr, image);
- if (! gr_image) {
- g_free(image);
- image=g_strjoin(NULL,getenv("NAVIT_SHAREDIR"), "/xpm/unknown.xpm", NULL);
- gr_image=graphics_image_new(this->gr, image);
- }
- dbg(1,"gr_image=%p\n", gr_image);
- if (gr_image) {
- p.x=(this->w-gr_image->width)/2;
- p.y=(46-gr_image->height)/2;
- graphics_draw_image(this->gr, this->white, &p, gr_image);
- graphics_image_free(this->gr, gr_image);
- }
- p.x=12;
- p.y=56;
- graphics_draw_text(this->gr, this->white, NULL, this->font, distance, &p, 0x10000, 0);
- }
- graphics_draw_mode(this->gr, draw_mode_end);
- }
-}
-
-static void
-osd_navigation_init(struct osd_navigation *this, struct navit *nav)
-{
- struct graphics *navit_gr;
- struct color c;
- navit_gr=navit_get_graphics(nav);
- this->gr=graphics_overlay_new(navit_gr, &this->p, this->w, this->h);
-
- this->bg=graphics_gc_new(this->gr);
- c.r=0; c.g=0; c.b=0;
- graphics_gc_set_foreground(this->bg, &c);
-
- this->white=graphics_gc_new(this->gr);
- c.r=65535; c.g=65535; c.b=65535;
- graphics_gc_set_foreground(this->white, &c);
- graphics_gc_set_linewidth(this->white, 2);
-
- this->font=graphics_font_new(this->gr, 200, 1);
- navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_navigation_draw), attr_position_coord_geo, this));
-
- osd_navigation_draw(this, nav, NULL);
-}
-
-static struct osd_priv *
-osd_navigation_new(struct navit *nav, struct osd_methods *meth, struct attr **attrs)
-{
- struct osd_navigation *this=g_new0(struct osd_navigation, 1);
- struct attr *attr;
- this->p.x=20;
- this->p.y=-80;
- this->w=60;
- this->h=60;
- this->active=-1;
- attr=attr_search(attrs, NULL, attr_x);
- if (attr)
- this->p.x=attr->u.num;
- attr=attr_search(attrs, NULL, attr_y);
- if (attr)
- this->p.y=attr->u.num;
- navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_navigation_init), attr_navit, this));
- return (struct osd_priv *) this;
-}
-
-struct osd_street_name {
- struct point p;
- int w,h;
- struct graphics *gr;
- struct graphics_gc *bg;
- struct graphics_gc *white;
- struct graphics_font *font;
- int active;
- struct item item;
-};
-
-static void
-osd_street_name_draw(struct osd_street_name *this, struct navit *navit, struct vehicle *v)
-{
- struct point p;
- char distance[16];
- int do_draw=0;
- struct attr attr_name1, attr_name2;
- char *name1=NULL,*name2=NULL;
- struct tracking *tr=NULL;
- struct map_rect *mr=NULL;
- struct item *item=NULL;
- char *name=NULL;
-
- distance[0]='\0';
- if (navit)
- tr=navit_get_tracking(navit);
- if (tr)
- item=tracking_get_current_item(tr);
- dbg(1,"navit=%p tr=%p item=%p\n", navit, tr, item);
- if (item) {
- if (!item_is_equal(*item, this->item)) {
- do_draw=1;
- this->item=*item;
- mr=map_rect_new(item->map,NULL);
- item=map_rect_get_item_byid(mr, item->id_hi, item->id_lo);
- if (item_attr_get(item, attr_street_name, &attr_name1))
- name1=map_convert_string(item->map, attr_name1.u.str);
- if (item_attr_get(item, attr_street_name_systematic, &attr_name2))
- name2=map_convert_string(item->map, attr_name2.u.str);
- printf("name1=%s name2=%s\n", name1, name2);
- map_rect_destroy(mr);
- if (name1 && name2)
- name=g_strdup_printf("%s/%s", name2,name1);
- else
- name=g_strdup(name1?name1:name2);
- map_convert_free(name1);
- map_convert_free(name2);
- this->active=1;
- }
- } else {
- if (this->item.map || this->active)
- do_draw=1;
- this->active=0;
- memset(&this->item, 0, sizeof(this->item));
- name=NULL;
- }
- if (do_draw) {
- dbg(1,"name=%s\n", name);
- graphics_draw_mode(this->gr, draw_mode_begin);
- p.x=0;
- p.y=0;
- graphics_draw_rectangle(this->gr, this->bg, &p, 32767, 32767);
- if (name) {
- p.x=2;
- p.y=12;
- graphics_draw_text(this->gr, this->white, NULL, this->font, name, &p, 0x10000, 0);
- }
- graphics_draw_mode(this->gr, draw_mode_end);
- }
-}
-
-static void
-osd_street_name_init(struct osd_street_name *this, struct navit *nav)
-{
- struct graphics *navit_gr;
- struct color c;
- navit_gr=navit_get_graphics(nav);
- this->active=-1;
- this->gr=graphics_overlay_new(navit_gr, &this->p, this->w, this->h);
-
- this->bg=graphics_gc_new(this->gr);
- c.r=0; c.g=0; c.b=0;
- graphics_gc_set_foreground(this->bg, &c);
-
- this->white=graphics_gc_new(this->gr);
- c.r=65535; c.g=65535; c.b=65535;
- graphics_gc_set_foreground(this->white, &c);
-
- this->font=graphics_font_new(this->gr, 200, 1);
- navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_street_name_draw), attr_position_coord_geo, this));
-
- osd_street_name_draw(this, nav, NULL);
-}
-
-static struct osd_priv *
-osd_street_name_new(struct navit *nav, struct osd_methods *meth, struct attr **attrs)
-{
- struct osd_street_name *this=g_new0(struct osd_street_name, 1);
- struct attr *attr;
- this->p.x=90;
- this->p.y=-36;
- this->w=150;
- this->h=16;
- attr=attr_search(attrs, NULL, attr_x);
- if (attr)
- this->p.x=attr->u.num;
- attr=attr_search(attrs, NULL, attr_y);
- if (attr)
- this->p.y=attr->u.num;
- navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_street_name_init), attr_navit, this));
- return (struct osd_priv *) this;
-}
-
-void
-plugin_init(void)
-{
- plugin_register_osd_type("compass", osd_compass_new);
- plugin_register_osd_type("eta", osd_eta_new);
- plugin_register_osd_type("navigation", osd_navigation_new);
- plugin_register_osd_type("street_name", osd_street_name_new);
-}
-
diff --git a/navit/osm2navit.c b/navit/osm2navit.c
deleted file mode 100644
index 7491ec00..00000000
--- a/navit/osm2navit.c
+++ /dev/null
@@ -1,2444 +0,0 @@
-
-#define _FILE_OFFSET_BITS 64
-#define _LARGEFILE_SOURCE
-#define _LARGEFILE64_SOURCE
-#include <glib.h>
-#include <assert.h>
-#include <string.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <getopt.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <zlib.h>
-#include "item.h"
-#include "zipfile.h"
-#include "config.h"
-
-#define BUFFER_SIZE 1280
-
-#define GENERATE_INDEX
-
-#if 1
-#define debug_tile(x) 0
-#else
-#define debug_tile(x) (!strcmp(x,"bcdbd") || !strcmp(x,"bcdbd") || !strcmp(x,"bcdbda") || !strcmp(x,"bcdbdb") || !strcmp(x,"bcdbdba") || !strcmp(x,"bcdbdbb") || !strcmp(x,"bcdbdbba") || !strcmp(x,"bcdbdbaa") || !strcmp(x,"bcdbdbacaa") || !strcmp(x,"bcdbdbacab") || !strcmp(x,"bcdbdbacaba") || !strcmp(x,"bcdbdbacabaa") || !strcmp(x,"bcdbdbacabab") || !strcmp(x,"bcdbdbacababb") || !strcmp(x,"bcdbdbacababba") || !strcmp(x,"bcdbdbacababbb") || !strcmp(x,"bcdbdbacababbd") || !strcmp(x,"bcdbdbacababaa") || !strcmp(x,"bcdbdbacababab") || !strcmp(x,"bcdbdbacababac") || !strcmp(x,"bcdbdbacababad") || !strcmp(x,"bcdbdbacabaaa") || !strcmp(x,"bcdbdbacabaaba") || !strcmp(x,"bcdbdbacabaabb") || !strcmp(x,"bcdbdbacabaabc") || !strcmp(x,"bcdbdbacabaabd") || !strcmp(x,"bcdbdbacabaaaa") || !strcmp(x,"bcdbdbacabaaab") || !strcmp(x,"bcdbdbacabaaac") || !strcmp(x,"bcdbdbacabaaad") || 0)
-#endif
-
-#define IS_TOWN(item) ((item).type >= type_town_label && (item).type <= type_town_label_1e7)
-#define IS_STREET(item) ((item).type >= type_street_nopass && (item).type <= type_ferry)
-
-static GHashTable *dedupe_ways_hash;
-
-static int attr_debug_level=1;
-static int nodeid,wayid;
-static int report,phase;
-static int ignore_unkown = 0, coverage=0;
-
-static char *attrmap={
- "n *=* point_unkn\n"
- "n amenity=hospital poi_hospital\n"
- "n amenity=atm poi_bank\n"
- "n amenity=bank poi_bank\n"
- "n amenity=pub poi_bar\n"
- "n amenity=cafe poi_cafe\n"
- "n amenity=bus_station poi_bus_station\n"
- "n amenity=parking poi_car_parking\n"
- "n amenity=cinema poi_cinema\n"
- "n amenity=fire_station poi_firebrigade\n"
- "n amenity=fuel poi_fuel\n"
- "n amenity=courthouse poi_justice\n"
- "n amenity=library poi_library\n"
- "n amenity=pharmacy poi_pharmacy\n"
- "n amenity=place_of_worship,religion=christian poi_church\n"
- "n amenity=police poi_police\n"
- "n amenity=post_office poi_post\n"
- "n amenity=post_box poi_post\n"
- "n amenity=public_building poi_public_office\n"
- "n amenity=restaurant poi_restaurant\n"
- "n amenity=fast_food poi_fastfood\n"
- "n amenity=toilets poi_restroom\n"
- "n amenity=school poi_school\n"
- "n amenity=university poi_school\n"
- "n amenity=college poi_school\n"
- "n amenity=telephone poi_telephone\n"
- "n amenity=theatre poi_theater\n"
- "n amenity=townhall poi_townhall\n"
- "n highway=bus_stop poi_bus_stop\n"
- "n highway=mini_roundabout mini_roundabout\n"
- "n highway=motorway_junction highway_exit\n"
- "n highway=traffic_signals traffic_signals\n"
- "n highway=turning_circle turning_circle\n"
- "n leisure=slipway poi_boat_ramp\n"
- "n leisure=fishing poi_fish\n"
- "n sport=golf poi_golf\n"
- "n leisure=golf_course poi_golf\n"
- "n leisure=marina poi_marine\n"
- "n leisure=sports_centre poi_sport\n"
- "n leisure=stadium poi_stadium\n"
- "n shop=supermarket poi_shopping\n"
- "n shop=convenience poi_shop_grocery\n"
- "n tourism=attraction poi_attraction\n"
- "n tourism=camp_site poi_camp_rv\n"
- "n tourism=caravan_site poi_camp_rv\n"
- "n tourism=hotel poi_hotel\n"
- "n tourism=motel poi_hotel\n"
- "n tourism=guest_house poi_hotel\n"
- "n tourism=hostel poi_hotel\n"
- "n tourism=information poi_information\n"
- "n tourism=museum poi_museum_history\n"
- "n tourism=picnic_site poi_picnic\n"
- "n tourism=theme_park poi_resort\n"
- "n tourism=zoo poi_zoo\n"
- "n amenity=grave_yard poi_cemetery\n"
- "n landuse=cemetery poi_cemetery\n"
- "n military=airfield poi_military\n"
- "n military=bunker poi_military\n"
- "n military=barracks poi_military\n"
- "n military=range poi_military\n"
- "n military=danger_area poi_danger_area\n"
- "n sport=swimming poi_swimming\n"
- "n sport=skiing poi_skiing\n"
- "n aeroway=aerodrome poi_airport\n"
- "n aeroway=airport poi_airport\n"
- "n aeroway=terminal poi_airport\n"
- "n aeroway=helipad poi_heliport\n"
- "n man_made=tower poi_tower\n"
- "n natural=bay poi_bay\n"
- "n natural=peak poi_peak\n"
- "n place=suburb district_label\n"
- "n place=city town_label_2e5\n"
- "n place=town town_label_2e4\n"
- "n place=village town_label_2e3\n"
- "n place=hamlet town_label_2e2\n"
- "n place=locality town_label_2e0\n"
- "n railway=halt poi_rail_halt\n"
- "n railway=level_crossing poi_level_crossing\n"
- "n railway=station poi_rail_station\n"
- "n railway=tram_stop poi_rail_tram_stop\n"
- "w *=* street_unkn\n"
- "w amenity=place_of_worship poly_building\n"
- "w building=* poly_building\n"
- "w aeroway=aerodrome poly_airport\n"
- "w aeroway=apron poly_apron\n"
- "w aeroway=runway aeroway_runway\n"
- "w aeroway=taxiway aeroway_taxiway\n"
- "w aeroway=terminal poly_terminal\n"
- "w highway=bridleway bridleway\n"
- "w highway=cycleway cycleway\n"
- "w highway=cyclepath cycleway\n"
- "w cycleway=track cycleway\n"
- "w highway=footway footway\n"
- "w highway=steps steps\n"
- "w highway=unsurfaced track_gravelled\n"
- "w highway=track track_gravelled\n"
- "w highway=track,tracktype=grade1 track_paved\n"
- "w highway=track,surface=paved track_paved\n"
- "w highway=track,tracktype=grade2 track_gravelled\n"
- "w highway=track,surface=gravel track_gravelled\n"
- "w highway=track,tracktype=grade3 track_unpaved\n"
- "w highway=track,surface=unpaved track_unpaved\n"
- "w highway=track,tracktype=grade4 track_ground\n"
- "w highway=track,surface=ground track_ground\n"
- "w highway=track,tracktype=grade5 track_grass\n"
- "w highway=track,surface=grass track_grass\n"
- "w highway=service street_service\n"
- "w highway=construction street_construction\n"
- "w highway=pedestrian street_pedestrian\n"
- "w highway=pedestrian,area=1 poly_pedestrian\n"
- "w highway=plaza poly_plaza\n"
- "w landuse=plaza poly_plaza\n"
- "w highway=residential street_1_city\n"
- "w highway=living_street living_street\n"
- "w highway=unclassified street_1_city\n"
- "w highway=road street_1_city\n"
- "w highway=minor street_1_land\n"
- "w highway=tertiary street_2_city\n"
- "w highway=secondary street_3_city\n"
- "w highway=primary street_4_city\n"
- "w highway=primary_link ramp\n"
- "w highway=trunk street_4_city\n"
- "w highway=trunk_link ramp\n"
- "w highway=motorway highway_city\n"
- "w highway=motorway_link ramp\n"
- "w historic=town gate poly_building\n"
- "w amenity=parking poly_car_parking\n"
- "w landuse=allotments poly_allotments\n"
- "w landuse=cemetery poly_cemetery\n"
- "w amenity=grave_yard poly_cemetery\n"
- "w landuse=forest poly_wood\n"
- "w landuse=industrial poly_industry\n"
- "w landuse=residential poly_town\n"
- "w landuse=residential,area=1 poly_town\n"
- "w amenity=college poly_college\n"
- "w amenity=university poly_university\n"
- "w tourism=camp_site poly_camp_site\n"
- "w tourism=caravan_site poly_caravan_site\n"
- "w tourism=picnic_site poly_picnic_site\n"
- "w tourism=theme_park poly_theme_park\n"
- "w tourism=attraction poly_attraction\n"
- "w tourism=zoo poly_zoo\n"
- "w tourism=artwork poly_artwork\n"
- "w historic=archaeological_site poly_archaeological_site\n"
- "w historic=ruins poly_ruins\n"
- "w historic=battlefield poly_battlefield\n"
- "w landuse=quarry poly_quarry\n"
- "w landuse=landfill poly_landfill\n"
- "w landuse=retail poly_retail\n"
- "w landuse=commercial poly_commercial\n"
- "w landuse=brownfield poly_brownfield\n"
- "w landuse=greenfield poly_greenfield\n"
- "w landuse=construction poly_construction\n"
- "w landuse=railway poly_railway\n"
- "w natural=glacier poly_glacier\n"
- "w natural=scree poly_scree\n"
- "w natural=scrub poly_scrub\n"
- "w natural=fell poly_fell\n"
- "w natural=heath poly_heath\n"
- "w natural=marsh poly_marsh\n"
- "w natural=mud poly_mud\n"
- "w natural=beach poly_beach\n"
- "w natural=land poly_land\n"
- "w landuse=basin poly_basin\n"
- "w landuse=reservoir poly_reservoir\n"
- "w landuse=farm poly_farm\n"
- "w landuse=vineyard poly_farm\n"
- "w leisure=park poly_park\n"
- "w landuse=village_green poly_village_green\n"
- "w landuse=recreation_ground poly_recreation_ground\n"
- "w natural=wood poly_wood\n"
- "w natural=water poly_water\n"
- "w natural=coastline water_line\n"
- "w place=suburb poly_town\n"
- "w place=town poly_town\n"
- "w landuse=military poly_military\n"
- "w military=airfield poly_airfield\n"
- "w military=barracks poly_barracks\n"
- "w military=danger_area poly_danger_area\n"
- "w military=range poly_range\n"
- "w military=naval_base poly_naval_base\n"
- "w power=line powerline\n"
- "w railway=rail rail\n"
- "w railway=narrow_gauge rail_narrow_gauge\n"
- "w railway=light_rail rail_light\n"
- "w railway=subway rail_subway\n"
- "w railway=tram rail_tram\n"
- "w railway=monorail rail_mono\n"
- "w railway=preserved rail_preserved\n"
- "w railway=disused rail_disused\n"
- "w railway=abandoned rail_abandoned\n"
- "w aerialway=cable_car lift_cable_car\n"
- "w aerialway=chair_lift lift_chair\n"
- "w aerialway=drag_lift lift_drag\n"
- "w leisure=golf_course poly_golf_course\n"
- "w sport=* poly_sport\n"
- "w leisure=sports_centre poly_sport\n"
- "w leisure=stadium poly_sports_stadium\n"
- "w leisure=track poly_sports_track\n"
- "w leisure=pitch poly_sports_pitch\n"
- "w leisure=water_park poly_water_park\n"
- "w leisure=marina poly_marina\n"
- "w leisure=fishing poly_fishing\n"
- "w leisure=garden poly_garden\n"
- "w leisure=common poly_common\n"
- "w leisure=playground poly_playground\n"
- "w leisure=nature_reserve poly_nature_reserve\n"
- "w waterway=canal water_canal\n"
- "w waterway=river water_river\n"
- "w waterway=stream water_stream\n"
- "w waterway=drain water_drain\n"
- "w waterway=riverbank poly_water\n"
- "w boundary=administrative border_country\n"
- "w boundary=civil border_civil\n"
- "w boundary=political border_political\n"
- "w boundary=national_park border_national_park\n"
- "w route=ferry ferry\n"
- "w highway=bus_guideway bus_guideway\n"
-};
-
-struct coord {
- int x;
- int y;
-} coord_buffer[65536];
-
-#define IS_REF(c) ((c).x >= (1 << 30))
-#define REF(c) ((c).y)
-#define SET_REF(c,ref) do { (c).x = 1 << 30; (c).y = ref ; } while(0)
-
-struct rect {
- struct coord l,h;
-};
-
-static void bbox_extend(struct coord *c, struct rect *r);
-
-#ifdef GENERATE_INDEX
-
-static GHashTable *aux_tile_hash;
-GList *aux_tile_list;
-
-struct country_table {
- int countryid;
- char *names;
- FILE *file;
- int size;
- int count;
- struct rect r;
-} country_table[] = {
- { 40,"Austria,Österreich,AUT"},
- {124,"Canada"},
- {276,"Germany,Deutschland,Bundesrepublik Deutschland"},
- {528,"Nederland,The Netherlands,Niederlande,NL"},
- {756,"Schweiz"},
-};
-
-static GHashTable *country_table_hash;
-#endif
-
-struct attr_mapping {
- enum item_type type;
- int attr_present_idx_count;
- int attr_present_idx[0];
-};
-
-static struct attr_mapping **attr_mapping_node;
-static int attr_mapping_node_count;
-static struct attr_mapping **attr_mapping_way;
-static int attr_mapping_way_count;
-
-static char *attr_present;
-static int attr_present_count;
-static GHashTable *attr_hash;
-
-
-static GHashTable *strings_hash = NULL;
-
-
-static char* string_hash_lookup( const char* key )
-{
- char* key_ptr = NULL;
-
- if ( strings_hash == NULL ) {
- strings_hash = g_hash_table_new(g_str_hash, g_str_equal);
- }
-
- if ( ( key_ptr = g_hash_table_lookup(strings_hash, key )) == NULL ) {
- key_ptr = g_strdup( key );
- g_hash_table_insert(strings_hash, key_ptr, (gpointer)key_ptr );
-
- }
- return key_ptr;
-}
-
-static void
-build_attrmap_line(char *line)
-{
- char *t=NULL,*kvl=NULL,*i=NULL,*p,*kv;
- struct attr_mapping ***attr_mapping_curr,*attr_mapping=g_malloc0(sizeof(struct attr_mapping));
- int idx,attr_mapping_count=0,*attr_mapping_curr_count;
- t=line;
- p=strchr(t,'\t');
- if (p) {
- while (*p == '\t')
- *p++='\0';
- kvl=p;
- p=strchr(kvl,'\t');
- }
- if (p) {
- while (*p == '\t')
- *p++='\0';
- i=p;
- }
- if (t[0] == 'w') {
- if (! i)
- i="street_unkn";
- attr_mapping_curr=&attr_mapping_way;
- attr_mapping_curr_count=&attr_mapping_way_count;
- } else {
- if (! i)
- i="point_unkn";
- attr_mapping_curr=&attr_mapping_node;
- attr_mapping_curr_count=&attr_mapping_node_count;
- }
- attr_mapping->type=item_from_name(i);
- while ((kv=strtok(kvl, ","))) {
- kvl=NULL;
- if (!(idx=(int)g_hash_table_lookup(attr_hash, kv))) {
- idx=attr_present_count++;
- g_hash_table_insert(attr_hash, kv, (gpointer) idx);
- }
- attr_mapping=g_realloc(attr_mapping, sizeof(struct attr_mapping)+(attr_mapping_count+1)*sizeof(int));
- attr_mapping->attr_present_idx[attr_mapping_count++]=idx;
- attr_mapping->attr_present_idx_count=attr_mapping_count;
- }
- *attr_mapping_curr=g_realloc(*attr_mapping_curr, sizeof(**attr_mapping_curr)*(*attr_mapping_curr_count+1));
- (*attr_mapping_curr)[(*attr_mapping_curr_count)++]=attr_mapping;
-}
-
-static void
-build_attrmap(char *map)
-{
- char *p;
- attr_hash=g_hash_table_new(g_str_hash, g_str_equal);
- attr_present_count=1;
- while (map) {
- p=strchr(map,'\n');
- if (p)
- *p++='\0';
- if (strlen(map))
- build_attrmap_line(map);
- map=p;
- }
- attr_present=g_malloc0(sizeof(*attr_present)*attr_present_count);
-}
-
-#ifdef GENERATE_INDEX
-static void
-build_countrytable(void)
-{
- int i;
- char *names,*str,*tok;
- country_table_hash=g_hash_table_new(g_str_hash, g_str_equal);
- for (i = 0 ; i < sizeof(country_table)/sizeof(struct country_table) ; i++) {
- names=g_strdup(country_table[i].names);
- str=names;
- while ((tok=strtok(str, ","))) {
- str=NULL;
- g_hash_table_insert(country_table_hash, tok, (gpointer)&country_table[i]);
- }
- }
-}
-#endif
-
-
-
-static int processed_nodes, processed_nodes_out, processed_ways, processed_relations, processed_tiles;
-static int in_way, in_node, in_relation;
-
-static void
-sig_alrm(int sig)
-{
-#ifndef _WIN32
- signal(SIGALRM, sig_alrm);
-#endif
- alarm(30);
- fprintf(stderr,"PROGRESS%d: Processed %d nodes (%d out) %d ways %d relations %d tiles\n", phase, processed_nodes, processed_nodes_out, processed_ways, processed_relations, processed_tiles);
-}
-
-struct item_bin {
- int len;
- enum item_type type;
- int clen;
-} item;
-
-struct attr_bin {
- int len;
- enum attr_type type;
-};
-
-struct attr_bin label_attr = {
- 0, attr_label
-};
-char label_attr_buffer[BUFFER_SIZE];
-
-struct attr_bin town_name_attr = {
- 0, attr_town_name
-};
-
-struct attr_bin street_name_attr = {
- 0, attr_street_name
-};
-
-struct attr_bin street_name_systematic_attr = {
- 0, attr_street_name_systematic
-};
-char street_name_systematic_attr_buffer[BUFFER_SIZE];
-
-struct attr_bin debug_attr = {
- 0, attr_debug
-};
-char debug_attr_buffer[BUFFER_SIZE];
-
-struct attr_bin flags_attr = {
- 0, attr_flags
-};
-int flags_attr_value;
-
-char is_in_buffer[BUFFER_SIZE];
-
-
-static void write_zipmember(FILE *out, FILE *dir_out, char *name, int filelen, char *data, int data_size, int compression_level);
-
-static void
-pad_text_attr(struct attr_bin *a, char *buffer)
-{
- int l;
- if (buffer && buffer[0]) {
- l=strlen(buffer)+1;
- while (l % 4)
- buffer[l++]='\0';
- a->len=l/4+1;
- } else
- a->len=0;
-}
-
-static int
-xml_get_attribute(char *xml, char *attribute, char *buffer, int buffer_size)
-{
- int len=strlen(attribute);
- char *pos,*i,s,attr[len+2];
- strcpy(attr, attribute);
- strcpy(attr+len, "=");
- pos=strstr(xml, attr);
- if (! pos)
- return 0;
- pos+=len+1;
- s=*pos++;
- if (! s)
- return 0;
- i=strchr(pos, s);
- if (! i)
- return 0;
- if (i - pos > buffer_size) {
- fprintf(stderr,"Buffer overflow %d vs %d\n", i-pos, buffer_size);
- return 0;
- }
- strncpy(buffer, pos, i-pos);
- buffer[i-pos]='\0';
- return 1;
-}
-
-static int node_is_tagged;
-
-static void
-add_tag(char *k, char *v)
-{
- GHashTable *value_hash;
- enum item_type type;
- int idx,level=2;
- char buffer[BUFFER_SIZE*2+2];
- if (! strcmp(k,"ele"))
- level=9;
- if (! strcmp(k,"time"))
- level=9;
- if (! strcmp(k,"created_by"))
- level=9;
- if (! strncmp(k,"tiger:",6) || !strcmp(k,"AND_nodes"))
- level=9;
- if (! strcmp(k,"converted_by") || ! strcmp(k,"source"))
- level=8;
- if (! strncmp(k,"osmarender:",11) || !strncmp(k,"svg:",4))
- level=8;
- if (! strcmp(k,"layer"))
- level=7;
- if (! strcasecmp(v,"true") || ! strcasecmp(v,"yes"))
- v="1";
- if (! strcmp(k,"oneway")) {
- if (!strcmp(v,"1")) {
- flags_attr_value=AF_ONEWAY;
- flags_attr.len=2;
- }
- if (! strcmp(v,"-1")) {
- flags_attr_value=AF_ONEWAYREV;
- flags_attr.len=2;
- }
- if (!in_way)
- level=6;
- else
- level=5;
- }
- if (! strcmp(k,"junction")) {
- if (! strcmp(v,"roundabout")) {
- flags_attr_value=AF_ONEWAY;
- flags_attr.len=2;
- }
- }
- if (! strcmp(k,"maxspeed")) {
- level=5;
- }
- if (! strcmp(k,"bicycle")) {
- level=5;
- }
- if (! strcmp(k,"foot")) {
- level=5;
- }
- if (! strcmp(k,"note"))
- level=5;
- if (! strcmp(k,"name")) {
- strcpy(label_attr_buffer, v);
- pad_text_attr(&label_attr, label_attr_buffer);
- level=5;
- }
- if (! strcmp(k,"ref")) {
- if (in_way) {
- strcpy(street_name_systematic_attr_buffer, v);
- pad_text_attr(&street_name_systematic_attr, street_name_systematic_attr_buffer);
- }
- level=5;
- }
- if (! strcmp(k,"is_in")) {
- strcpy(is_in_buffer, v);
- level=5;
- }
- if (! strcmp(k,"lanes")) {
- level=5;
- }
- if (attr_debug_level >= level) {
- int bytes_left = sizeof( debug_attr_buffer ) - strlen(debug_attr_buffer) - 1;
- if ( bytes_left > 0 )
- {
- snprintf(debug_attr_buffer+strlen(debug_attr_buffer), bytes_left, " %s=%s", k, v);
- debug_attr_buffer[ sizeof( debug_attr_buffer ) - 1 ] = '\0';
- node_is_tagged=1;
- }
- }
- if (level < 6)
- node_is_tagged=1;
- if (level >= 5)
- return;
-
- strcpy(buffer,"*=*");
- if ((idx=(int)g_hash_table_lookup(attr_hash, buffer)))
- attr_present[idx]=1;
-
- sprintf(buffer,"%s=*", k);
- if ((idx=(int)g_hash_table_lookup(attr_hash, buffer)))
- attr_present[idx]=2;
-
- sprintf(buffer,"*=%s", v);
- if ((idx=(int)g_hash_table_lookup(attr_hash, buffer)))
- attr_present[idx]=2;
-
- sprintf(buffer,"%s=%s", k, v);
- if ((idx=(int)g_hash_table_lookup(attr_hash, buffer)))
- attr_present[idx]=4;
-}
-
-struct entity {
- char *entity;
- char c;
-} entities[]= {
- {"&qout;",'"'},
- {"&apos;",'\''},
- {"&amp;",'&'},
- {"&lt;",'<'},
- {"&gt;",'>'},
-};
-
-static void
-decode_entities(char *buffer)
-{
- char *pos=buffer;
- int i,len,found;
-
- while ((pos=strchr(pos, '&'))) {
- found=0;
- for (i = 0 ; i < sizeof(entities)/sizeof(struct entity); i++) {
- len=strlen(entities[i].entity);
- if (!strncmp(pos, entities[i].entity, len)) {
- *pos=entities[i].c;
- memmove(pos+1, pos+len, strlen(pos+len)+1);
- found=1;
- break;
- }
- }
- pos++;
- }
-}
-
-static int
-parse_tag(char *p)
-{
- char k_buffer[BUFFER_SIZE];
- char v_buffer[BUFFER_SIZE];
- if (!xml_get_attribute(p, "k", k_buffer, BUFFER_SIZE))
- return 0;
- if (!xml_get_attribute(p, "v", v_buffer, BUFFER_SIZE))
- return 0;
- decode_entities(v_buffer);
- add_tag(k_buffer, v_buffer);
- return 1;
-}
-
-
-struct buffer {
- int malloced_step;
- size_t malloced;
- unsigned char *base;
- size_t size;
-};
-
-static struct tile_head {
- int num_subtiles;
- int total_size;
- char *name;
- char *zip_data;
- int total_size_used;
- int zipnum;
- int process;
- struct tile_head *next;
- // char subtiles[0];
-} *tile_head_root;
-
-
-int coord_count;
-
-struct node_item {
- int id;
- char ref_node;
- char ref_way;
- char ref_ref;
- char dummy;
- struct coord c;
-};
-
-static struct buffer node_buffer = {
- 64*1024*1024,
-};
-
-
-static char** th_get_subtile( const struct tile_head* th, int idx )
-{
- char* subtile_ptr = NULL;
- subtile_ptr = (char*)th + sizeof( struct tile_head ) + idx * sizeof( char *);
- return (char**)subtile_ptr;
-}
-
-static void
-extend_buffer(struct buffer *b)
-{
- b->malloced+=b->malloced_step;
- b->base=realloc(b->base, b->malloced);
- if (b->base == NULL) {
- fprintf(stderr,"realloc of %d bytes failed\n",b->malloced);
- exit(1);
- }
-
-}
-
-int nodeid_last;
-GHashTable *node_hash;
-
-static void
-node_buffer_to_hash(void)
-{
- int i,count=node_buffer.size/sizeof(struct node_item);
- struct node_item *ni=(struct node_item *)node_buffer.base;
- for (i = 0 ; i < count ; i++)
- g_hash_table_insert(node_hash, (gpointer)(ni[i].id), (gpointer)i);
-}
-
-static struct node_item *ni;
-
-static void
-add_node(int id, double lat, double lon)
-{
- if (node_buffer.size + sizeof(struct node_item) > node_buffer.malloced)
- extend_buffer(&node_buffer);
- node_is_tagged=0;
- nodeid=id;
- item.type=type_point_unkn;
- label_attr.len=0;
- town_name_attr.len=0;
- debug_attr.len=0;
- is_in_buffer[0]='\0';
- sprintf(debug_attr_buffer,"nodeid=%d", nodeid);
- ni=(struct node_item *)(node_buffer.base+node_buffer.size);
- ni->id=id;
- ni->ref_node=0;
- ni->ref_way=0;
- ni->ref_ref=0;
- ni->dummy=0;
- ni->c.x=lon*6371000.0*M_PI/180;
- ni->c.y=log(tan(M_PI_4+lat*M_PI/360))*6371000.0;
- node_buffer.size+=sizeof(struct node_item);
- if (! node_hash) {
- if (ni->id > nodeid_last) {
- nodeid_last=ni->id;
- } else {
- fprintf(stderr,"INFO: Nodes out of sequence (new %d vs old %d), adding hash\n", ni->id, nodeid_last);
- node_hash=g_hash_table_new(NULL, NULL);
- node_buffer_to_hash();
- }
- } else
- if (!g_hash_table_lookup(node_hash, (gpointer)(ni->id)))
- g_hash_table_insert(node_hash, (gpointer)(ni->id), (gpointer)(ni-(struct node_item *)node_buffer.base));
- else {
- node_buffer.size-=sizeof(struct node_item);
- nodeid=0;
- }
-
-}
-
-static int
-parse_node(char *p)
-{
- char id_buffer[BUFFER_SIZE];
- char lat_buffer[BUFFER_SIZE];
- char lon_buffer[BUFFER_SIZE];
- if (!xml_get_attribute(p, "id", id_buffer, BUFFER_SIZE))
- return 0;
- if (!xml_get_attribute(p, "lat", lat_buffer, BUFFER_SIZE))
- return 0;
- if (!xml_get_attribute(p, "lon", lon_buffer, BUFFER_SIZE))
- return 0;
- add_node(atoi(id_buffer), atof(lat_buffer), atof(lon_buffer));
- return 1;
-}
-
-
-static struct node_item *
-node_item_get(int id)
-{
- struct node_item *ni=(struct node_item *)(node_buffer.base);
- int count=node_buffer.size/sizeof(struct node_item);
- int interval=count/4;
- int p=count/2;
- if (node_hash) {
- int i;
- i=(int)(g_hash_table_lookup(node_hash, (gpointer)id));
- return ni+i;
- }
- while (ni[p].id != id) {
-#if 0
- fprintf(stderr,"p=%d count=%d interval=%d id=%d ni[p].id=%d\n", p, count, interval, id, ni[p].id);
-#endif
- if (ni[p].id < id) {
- p+=interval;
- if (interval == 1) {
- if (p >= count)
- return NULL;
- if (ni[p].id > id)
- return NULL;
- } else {
- if (p >= count)
- p=count-1;
- }
- } else {
- p-=interval;
- if (interval == 1) {
- if (p < 0)
- return NULL;
- if (ni[p].id < id)
- return NULL;
- } else {
- if (p < 0)
- p=0;
- }
- }
- if (interval > 1)
- interval/=2;
- }
-
- return &ni[p];
-}
-
-static void
-node_ref_way(int id)
-{
- struct node_item *ni=node_item_get(id);
- if (! ni) {
- fprintf(stderr,"WARNING: node id %d not found\n", id);
- return;
- }
- ni->ref_way++;
-}
-
-
-static void
-add_way(int id)
-{
- wayid=id;
- coord_count=0;
- item.type=type_street_unkn;
- label_attr.len=0;
- street_name_attr.len=0;
- street_name_systematic_attr.len=0;
- debug_attr.len=0;
- flags_attr.len=0;
- sprintf(debug_attr_buffer,"wayid=%d", wayid);
-}
-
-static int
-parse_way(char *p)
-{
- char id_buffer[BUFFER_SIZE];
- if (!xml_get_attribute(p, "id", id_buffer, BUFFER_SIZE))
- return 0;
- add_way(atoi(id_buffer));
- return 1;
-}
-
-static int
-parse_relation(char *p)
-{
- debug_attr_buffer[0]='\0';
- return 1;
-}
-
-static void
-write_attr(FILE *out, struct attr_bin *attr, void *buffer)
-{
- if (attr->len) {
- fwrite(attr, sizeof(*attr), 1, out);
- fwrite(buffer, (attr->len-1)*4, 1, out);
- }
-}
-
-static int
-attr_longest_match(struct attr_mapping **mapping, int mapping_count, enum item_type *types, int types_count)
-{
- int i,j,longest=0,ret=0,sum,val;
- struct attr_mapping *curr;
- for (i = 0 ; i < mapping_count ; i++) {
- sum=0;
- curr=mapping[i];
- for (j = 0 ; j < curr->attr_present_idx_count ; j++) {
- val=attr_present[curr->attr_present_idx[j]];
- if (val)
- sum+=val;
- else {
- sum=-1;
- break;
- }
- }
- if (sum > longest) {
- longest=sum;
- ret=0;
- }
- if (sum > 0 && sum == longest && ret < types_count)
- types[ret++]=curr->type;
- }
- memset(attr_present, 0, sizeof(*attr_present)*attr_present_count);
- return ret;
-}
-
-static void
-end_way(FILE *out)
-{
- int alen=0,count;
- enum item_type types[5];
-
- if (! out)
- return;
- if (dedupe_ways_hash) {
- if (g_hash_table_lookup(dedupe_ways_hash, (gpointer)wayid))
- return;
- g_hash_table_insert(dedupe_ways_hash, (gpointer)wayid, (gpointer)1);
- }
- count=attr_longest_match(attr_mapping_way, attr_mapping_way_count, types, sizeof(types)/sizeof(enum item_type));
- pad_text_attr(&debug_attr, debug_attr_buffer);
- if (label_attr.len)
- alen+=label_attr.len+1;
- if (street_name_systematic_attr.len)
- alen+=street_name_systematic_attr.len+1;
- if (debug_attr.len)
- alen+=debug_attr.len+1;
- if (flags_attr.len)
- alen+=flags_attr.len+1;
- if (count)
- item.type=types[0];
- else
- item.type=type_street_unkn;
- if (coverage && IS_STREET(item))
- item.type=type_coverage;
- item.clen=coord_count*2;
- item.len=item.clen+2+alen;
- fwrite(&item, sizeof(item), 1, out);
- fwrite(coord_buffer, coord_count*sizeof(struct coord), 1, out);
- if (IS_STREET(item)) {
- street_name_attr.len=label_attr.len;
- write_attr(out, &street_name_attr, label_attr_buffer);
- } else
- write_attr(out, &label_attr, label_attr_buffer);
- write_attr(out, &street_name_systematic_attr, street_name_systematic_attr_buffer);
- write_attr(out, &debug_attr, debug_attr_buffer);
- write_attr(out, &flags_attr, &flags_attr_value);
-}
-
-static void
-end_node(FILE *out)
-{
- int alen=0,conflict=0,count;
- enum item_type types[5];
- struct country_table *result=NULL, *lookup;
- if (!out || ! node_is_tagged || ! nodeid)
- return;
- count=attr_longest_match(attr_mapping_node, attr_mapping_node_count, types, sizeof(types)/sizeof(enum item_type));
- pad_text_attr(&debug_attr, debug_attr_buffer);
- if (label_attr.len)
- alen+=label_attr.len+1;
- if (debug_attr.len)
- alen+=debug_attr.len+1;
- if (count)
- item.type=types[0];
- else
- item.type=type_point_unkn;
- item.clen=2;
- item.len=item.clen+2+alen;
- fwrite(&item, sizeof(item), 1, out);
- fwrite(&ni->c, 1*sizeof(struct coord), 1, out);
- if (IS_TOWN(item)) {
- town_name_attr.len=label_attr.len;
- write_attr(out, &town_name_attr, label_attr_buffer);
- } else
- write_attr(out, &label_attr, label_attr_buffer);
- write_attr(out, &debug_attr, debug_attr_buffer);
-#ifdef GENERATE_INDEX
- if (IS_TOWN(item) && town_name_attr.len) {
- char *tok,*buf=is_in_buffer;
- while ((tok=strtok(buf, ","))) {
- while (*tok==' ')
- tok++;
- lookup=g_hash_table_lookup(country_table_hash,tok);
- if (lookup) {
- if (result && result->countryid != lookup->countryid) {
- fprintf(stderr,"conflict for %s %s country %d vs %d\n", label_attr_buffer, debug_attr_buffer, lookup->countryid, result->countryid);
- conflict=1;
- } else
- result=lookup;
- }
- buf=NULL;
- }
- if (result && !conflict) {
- if (!result->file) {
- char *name=g_strdup_printf("country_%d.bin.unsorted", result->countryid);
- result->file=fopen(name,"wb");
- g_free(name);
- }
- if (result->file) {
- item.clen=2;
- item.len=item.clen+2+label_attr.len+1;
- fwrite(&item, sizeof(item), 1, result->file);
- fwrite(&ni->c, 1*sizeof(struct coord), 1, result->file);
- write_attr(result->file, &town_name_attr, label_attr_buffer);
- result->count++;
- result->size+=(item.clen+3+label_attr.len+1)*4;
- }
-
- }
- }
-#endif
- processed_nodes_out++;
-}
-
-static int
-sort_countries_compare(const void *p1, const void *p2)
-{
- struct item_bin *ib1=*((struct item_bin **)p1),*ib2=*((struct item_bin **)p2);
- struct attr_bin *attr1,*attr2;
- char *s1,*s2;
- assert(ib1->clen==2);
- assert(ib2->clen==2);
- attr1=(struct attr_bin *)((int *)(ib1+1)+ib1->clen);
- attr2=(struct attr_bin *)((int *)(ib2+1)+ib1->clen);
- assert(attr1->type == attr_town_name);
- assert(attr2->type == attr_town_name);
- s1=(char *)(attr1+1);
- s2=(char *)(attr2+1);
- return strcmp(s1, s2);
-#if 0
- fprintf(stderr,"sort_countries_compare p1=%p p2=%p %s %s\n",p1,p2,s1,s2);
-#endif
- return 0;
-}
-
-#ifdef GENERATE_INDEX
-static void
-sort_countries(void)
-{
- int i,j;
- struct country_table *co;
- struct coord *c;
- struct item_bin *ib;
- FILE *f;
- char *p,*buffer,**idx,*name;
- for (i = 0 ; i < sizeof(country_table)/sizeof(struct country_table) ; i++) {
- co=&country_table[i];
- if (co->file) {
- fclose(co->file);
- co->file=NULL;
- }
- if (co->size) {
- buffer=malloc(co->size);
- assert(buffer != NULL);
- idx=malloc(co->count*sizeof(void *));
- assert(idx != NULL);
- name=g_strdup_printf("country_%d.bin.unsorted", co->countryid);
- f=fopen(name,"rb");
- assert(f != NULL);
- fread(buffer, co->size, 1, f);
- fclose(f);
- unlink(name);
- g_free(name);
- p=buffer;
- for (j = 0 ; j < co->count ; j++) {
- idx[j]=p;
- p+=(*((int *)p)+1)*4;
- }
- qsort(idx, co->count, sizeof(void *), sort_countries_compare);
- name=g_strdup_printf("country_%d.bin", co->countryid);
- f=fopen(name,"w");
- for (j = 0 ; j < co->count ; j++) {
- ib=(struct item_bin *)(idx[j]);
- c=(struct coord *)(ib+1);
- fwrite(ib, (ib->len+1)*4, 1, f);
- if (j)
- bbox_extend(c, &co->r);
- else
- co->r.l=*c;
- co->r.h=*c;
- }
- fclose(f);
- }
- }
-}
-#endif
-
-static void
-add_nd(char *p, int ref)
-{
- int len;
- struct node_item *ni;
- ni=node_item_get(ref);
- if (ni) {
-#if 0
- coord_buffer[coord_count++]=ni->c;
-#else
- SET_REF(coord_buffer[coord_count], ref);
- coord_count++;
-#endif
- ni->ref_way++;
- } else {
- len=strlen(p);
- if (len > 0 && p[len-1]=='\n')
- p[len-1]='\0';
- fprintf(stderr,"WARNING: way %d: node %d not found (%s)\n",wayid,ref,p);
- }
- if (coord_count > 65536) {
- fprintf(stderr,"ERROR: Overflow\n");
- exit(1);
- }
-}
-
-static int
-parse_nd(char *p)
-{
- char ref_buffer[BUFFER_SIZE];
- if (!xml_get_attribute(p, "ref", ref_buffer, BUFFER_SIZE))
- return 0;
- add_nd(p, atoi(ref_buffer));
- return 1;
-}
-
-
-static void
-save_buffer(char *filename, struct buffer *b)
-{
- FILE *f;
- f=fopen(filename,"wb+");
- fwrite(b->base, b->size, 1, f);
- fclose(f);
-}
-
-static void
-load_buffer(char *filename, struct buffer *b)
-{
- FILE *f;
- if (b->base)
- free(b->base);
- b->malloced=0;
- f=fopen(filename,"rb");
- fseek(f, 0, SEEK_END);
- b->size=b->malloced=ftell(f);
- fprintf(stderr,"reading %d bytes from %s\n", b->size, filename);
- fseek(f, 0, SEEK_SET);
- b->base=malloc(b->size);
- assert(b->base != NULL);
- fread(b->base, b->size, 1, f);
- fclose(f);
-}
-
-static int
-phase1(FILE *in, FILE *out_ways, FILE *out_nodes)
-{
- int size=4096;
- char buffer[size];
- char *p;
- sig_alrm(0);
- while (fgets(buffer, size, in)) {
- p=strchr(buffer,'<');
- if (! p) {
- fprintf(stderr,"WARNING: wrong line %s\n", buffer);
- continue;
- }
- if (!strncmp(p, "<?xml ",6)) {
- } else if (!strncmp(p, "<osm ",5)) {
- } else if (!strncmp(p, "<bound ",7)) {
- } else if (!strncmp(p, "<node ",6)) {
- if (!parse_node(p))
- fprintf(stderr,"WARNING: failed to parse %s\n", buffer);
- in_node=1;
- processed_nodes++;
- } else if (!strncmp(p, "<tag ",5)) {
- if (!parse_tag(p))
- fprintf(stderr,"WARNING: failed to parse %s\n", buffer);
- } else if (!strncmp(p, "<way ",5)) {
- in_way=1;
- if (!parse_way(p))
- fprintf(stderr,"WARNING: failed to parse %s\n", buffer);
- processed_ways++;
- } else if (!strncmp(p, "<nd ",4)) {
- if (!parse_nd(p))
- fprintf(stderr,"WARNING: failed to parse %s\n", buffer);
- } else if (!strncmp(p, "<relation ",10)) {
- in_relation=1;
- if (!parse_relation(p))
- fprintf(stderr,"WARNING: failed to parse %s\n", buffer);
- processed_relations++;
- } else if (!strncmp(p, "<member ",8)) {
- } else if (!strncmp(p, "</node>",7)) {
- in_node=0;
- end_node(out_nodes);
- } else if (!strncmp(p, "</way>",6)) {
- in_way=0;
- end_way(out_ways);
- } else if (!strncmp(p, "</relation>",11)) {
- in_relation=0;
- } else if (!strncmp(p, "</osm>",6)) {
- } else {
- fprintf(stderr,"WARNING: unknown tag in %s\n", buffer);
- }
- }
- sig_alrm(0);
- alarm(0);
- return 1;
-}
-
-static char buffer[150000];
-
-int bytes_read=0;
-
-static struct item_bin *
-read_item(FILE *in)
-{
- struct item_bin *ib=(struct item_bin *) buffer;
- int r,s;
- r=fread(ib, sizeof(*ib), 1, in);
- if (r != 1)
- return NULL;
- bytes_read+=r;
- assert((ib->len+1) < sizeof(buffer));
- s=(ib->len+1)*4-sizeof(*ib);
- r=fread(ib+1, s, 1, in);
- if (r != 1)
- return NULL;
- bytes_read+=r;
- return ib;
-}
-
-static void
-bbox_extend(struct coord *c, struct rect *r)
-{
- if (c->x < r->l.x)
- r->l.x=c->x;
- if (c->y < r->l.y)
- r->l.y=c->y;
- if (c->x > r->h.x)
- r->h.x=c->x;
- if (c->y > r->h.y)
- r->h.y=c->y;
-}
-
-static void
-bbox(struct coord *c, int count, struct rect *r)
-{
- if (! count)
- return;
- r->l=*c;
- r->h=*c;
- while (--count) {
- c++;
- bbox_extend(c, r);
- }
-}
-
-static int
-contains_bbox(int xl, int yl, int xh, int yh, struct rect *r)
-{
- if (r->h.x < xl || r->h.x > xh) {
- return 0;
- }
- if (r->l.x > xh || r->l.x < xl) {
- return 0;
- }
- if (r->h.y < yl || r->h.y > yh) {
- return 0;
- }
- if (r->l.y > yh || r->l.y < yl) {
- return 0;
- }
- return 1;
-
-}
-struct rect world_bbox = {
- { -20000000, -20000000},
- { 20000000, 20000000},
-};
-
-static void
-tile(struct rect *r, char *ret, int max)
-{
- int x0,x1,x2,x3,x4;
- int y0,y1,y2,y3,y4;
- int i;
- x0=world_bbox.l.x;
- y0=world_bbox.l.y;
- x4=world_bbox.h.x;
- y4=world_bbox.h.y;
- for (i = 0 ; i < max ; i++) {
- x2=(x0+x4)/2;
- y2=(y0+y4)/2;
- x1=(x0+x2)/2;
- y1=(y0+y2)/2;
- x3=(x2+x4)/2;
- y3=(y2+y4)/2;
- if ( contains_bbox(x0,y0,x2,y2,r)) {
- strcat(ret,"d");
- x4=x2;
- y4=y2;
- } else if (contains_bbox(x2,y0,x4,y2,r)) {
- strcat(ret,"c");
- x0=x2;
- y4=y2;
- } else if (contains_bbox(x0,y2,x2,y4,r)) {
- strcat(ret,"b");
- x4=x2;
- y0=y2;
- } else if (contains_bbox(x2,y2,x4,y4,r)) {
- strcat(ret,"a");
- x0=x2;
- y0=y2;
- } else
- return;
- }
-}
-
-static void
-tile_bbox(char *tile, struct rect *r)
-{
- struct coord c;
- *r=world_bbox;
- while (*tile) {
- c.x=(r->l.x+r->h.x)/2;
- c.y=(r->l.y+r->h.y)/2;
- switch (*tile) {
- case 'a':
- r->l.x=c.x;
- r->l.y=c.y;
- break;
- case 'b':
- r->h.x=c.x;
- r->l.y=c.y;
- break;
- case 'c':
- r->l.x=c.x;
- r->h.y=c.y;
- break;
- case 'd':
- r->h.x=c.x;
- r->h.y=c.y;
- break;
- }
- tile++;
- }
-}
-
-GHashTable *tile_hash;
-GHashTable *tile_hash2;
-
-static void
-tile_extend(char *tile, struct item_bin *ib, GList **tiles_list)
-{
- struct tile_head *th=NULL;
- if (debug_tile(tile))
- fprintf(stderr,"Tile:Writing %d bytes to '%s' (%p,%p)\n", (ib->len+1)*4, tile, g_hash_table_lookup(tile_hash, tile), tile_hash2 ? g_hash_table_lookup(tile_hash2, tile) : NULL);
- if (tile_hash2)
- th=g_hash_table_lookup(tile_hash2, tile);
- if (!th)
- th=g_hash_table_lookup(tile_hash, tile);
- if (! th) {
- th=malloc(sizeof(struct tile_head)+ sizeof( char* ) );
- assert(th != NULL);
- // strcpy(th->subtiles, tile);
- th->num_subtiles=1;
- th->total_size=0;
- th->total_size_used=0;
- th->zipnum=0;
- th->zip_data=NULL;
- th->name=string_hash_lookup(tile);
- *th_get_subtile( th, 0 ) = th->name;
-
- if (tile_hash2)
- g_hash_table_insert(tile_hash2, string_hash_lookup( th->name ), th);
- if (tiles_list)
- *tiles_list=g_list_append(*tiles_list, string_hash_lookup( th->name ) );
- processed_tiles++;
- if (debug_tile(tile))
- fprintf(stderr,"new '%s'\n", tile);
- }
- th->total_size+=ib->len*4+4;
- if (debug_tile(tile))
- fprintf(stderr,"New total size of %s(%p):%d\n", th->name, th, th->total_size);
- g_hash_table_insert(tile_hash, string_hash_lookup( th->name ), th);
-}
-
-static int
-tile_data_size(char *tile)
-{
- struct tile_head *th;
- th=g_hash_table_lookup(tile_hash, tile);
- if (! th)
- return 0;
- return th->total_size;
-}
-
-static int
-merge_tile(char *base, char *sub)
-{
- struct tile_head *thb, *ths;
- thb=g_hash_table_lookup(tile_hash, base);
- ths=g_hash_table_lookup(tile_hash, sub);
- if (! ths)
- return 0;
- if (debug_tile(base) || debug_tile(sub))
- fprintf(stderr,"merging '%s'(%p) (%d) with '%s'(%p) (%d)\n", base, thb, thb ? thb->total_size : 0, sub, ths, ths->total_size);
- if (! thb) {
- thb=ths;
- g_hash_table_remove(tile_hash, sub);
- thb->name=string_hash_lookup(base);
- g_hash_table_insert(tile_hash, string_hash_lookup( thb->name ), thb);
-
- } else {
- thb=realloc(thb, sizeof(struct tile_head)+( ths->num_subtiles+thb->num_subtiles ) * sizeof( char*) );
- assert(thb != NULL);
- memcpy( th_get_subtile( thb, thb->num_subtiles ), th_get_subtile( ths, 0 ), ths->num_subtiles * sizeof( char*) );
- thb->num_subtiles+=ths->num_subtiles;
- thb->total_size+=ths->total_size;
- g_hash_table_insert(tile_hash, string_hash_lookup( thb->name ), thb);
- g_hash_table_remove(tile_hash, sub);
- g_free(ths);
- }
- return 1;
-}
-
-
-static void
-get_tiles_list_func(char *key, struct tile_head *th, GList **list)
-{
- *list=g_list_prepend(*list, key);
-}
-
-static GList *
-get_tiles_list(void)
-{
- GList *ret=NULL;
- g_hash_table_foreach(tile_hash, (GHFunc)get_tiles_list_func, &ret);
- return ret;
-}
-
-#if 0
-static void
-write_tile(char *key, struct tile_head *th, gpointer dummy)
-{
- FILE *f;
- char buffer[1024];
- fprintf(stderr,"DEBUG: Writing %s\n", key);
- strcpy(buffer,"tiles/");
- strcat(buffer,key);
-#if 0
- strcat(buffer,".bin");
-#endif
- f=fopen(buffer, "wb+");
- while (th) {
- fwrite(th->data, th->size, 1, f);
- th=th->next;
- }
- fclose(f);
-}
-#endif
-
-static void
-write_item(char *tile, struct item_bin *ib)
-{
- struct tile_head *th;
- int size;
-
- th=g_hash_table_lookup(tile_hash2, tile);
- if (! th)
- th=g_hash_table_lookup(tile_hash, tile);
- if (th) {
- if (th->process != 0 && th->process != 1) {
- fprintf(stderr,"error with tile '%s' of length %d\n", tile, strlen(tile));
- abort();
- }
- if (! th->process)
- return;
- if (debug_tile(tile))
- fprintf(stderr,"Data:Writing %d bytes to '%s' (%p,%p)\n", (ib->len+1)*4, tile, g_hash_table_lookup(tile_hash, tile), tile_hash2 ? g_hash_table_lookup(tile_hash2, tile) : NULL);
- size=(ib->len+1)*4;
- if (th->total_size_used+size > th->total_size) {
- fprintf(stderr,"Overflow in tile %s (used %d max %d item %d)\n", tile, th->total_size_used, th->total_size, size);
- exit(1);
- return;
- }
- memcpy(th->zip_data+th->total_size_used, ib, size);
- th->total_size_used+=size;
- } else {
- fprintf(stderr,"no tile hash found for %s\n", tile);
- exit(1);
- }
-}
-
-
-static void
-write_item_part(FILE *out, struct item_bin *orig, int first, int last)
-{
- struct item_bin new;
- struct coord *c=(struct coord *)(orig+1);
- char *attr=(char *)(c+orig->clen/2);
- int attr_len=orig->len-orig->clen-2;
- processed_ways++;
- new.type=orig->type;
- new.clen=(last-first+1)*2;
- new.len=new.clen+attr_len+2;
-#if 0
- fprintf(stderr,"first %d last %d type 0x%x len %d clen %d attr_len %d\n", first, last, new.type, new.len, new.clen, attr_len);
-#endif
- fwrite(&new, sizeof(new), 1, out);
- fwrite(c+first, new.clen*4, 1, out);
- fwrite(attr, attr_len*4, 1, out);
-}
-
-static int
-phase2(FILE *in, FILE *out)
-{
- struct coord *c;
- int i,ccount,last,ndref;
- struct item_bin *ib;
- struct node_item *ni;
-
- processed_nodes=processed_nodes_out=processed_ways=processed_relations=processed_tiles=0;
- sig_alrm(0);
- while ((ib=read_item(in))) {
-#if 0
- fprintf(stderr,"type 0x%x len %d clen %d\n", ib->type, ib->len, ib->clen);
-#endif
- ccount=ib->clen/2;
- c=(struct coord *)(ib+1);
- last=0;
- for (i = 0 ; i < ccount ; i++) {
- if (IS_REF(c[i])) {
- ndref=REF(c[i]);
- ni=node_item_get(ndref);
-#if 0
- fprintf(stderr,"ni=%p\n", ni);
-#endif
- c[i]=ni->c;
- if (ni->ref_way > 1 && i != 0 && i != ccount-1 && IS_STREET(*ib)) {
- write_item_part(out, ib, last, i);
- last=i;
- }
- }
- }
- write_item_part(out, ib, last, ccount-1);
- }
- sig_alrm(0);
- alarm(0);
- return 0;
-}
-
-static void
-phase34_process_file(int phase, FILE *in)
-{
- struct item_bin *ib;
- struct rect r;
- char buffer[1024];
- int max;
-
- while ((ib=read_item(in))) {
- if (ib->type < 0x80000000)
- processed_nodes++;
- else
- processed_ways++;
- bbox((struct coord *)(ib+1), ib->clen/2, &r);
- buffer[0]='\0';
- max=14;
- if (ib->type == type_street_n_lanes || ib->type == type_highway_city || ib->type == type_highway_land || ib->type == type_ramp)
- max=8;
- if (ib->type == type_street_3_city || ib->type == type_street_4_city || ib->type == type_street_3_land || ib->type == type_street_4_land)
- max=12;
-
- tile(&r, buffer, max);
-#if 0
- fprintf(stderr,"%s\n", buffer);
-#endif
- if (phase == 3)
- tile_extend(buffer, ib, NULL);
- else
- write_item(buffer, ib);
- }
-}
-
-struct index_item {
- struct item_bin item;
- struct rect r;
- struct attr_bin attr_order_limit;
- short min;
- short max;
- struct attr_bin attr_zipfile_ref;
- int zipfile_ref;
-};
-
-static void
-index_submap_add(int phase, struct tile_head *th, GList **tiles_list)
-{
- struct index_item ii;
- int len=strlen(th->name);
- char index_tile[len+1];
-
- ii.min=(len > 4) ? len-4 : 0;
- ii.max=255;
- strcpy(index_tile, th->name);
- if (len > 6)
- len=6;
- else
- len=0;
- index_tile[len]=0;
- tile_bbox(th->name, &ii.r);
-
- ii.item.len=sizeof(ii)/4-1;
- ii.item.type=type_submap;
- ii.item.clen=4;
-
- ii.attr_order_limit.len=2;
- ii.attr_order_limit.type=attr_order_limit;
-
- ii.attr_zipfile_ref.len=2;
- ii.attr_zipfile_ref.type=attr_zipfile_ref;
- ii.zipfile_ref=th->zipnum;
-
- if (phase == 3)
- tile_extend(index_tile, (struct item_bin *)&ii, tiles_list);
- else
- write_item(index_tile, (struct item_bin *)&ii);
-#if 0
- unsigned int *c=(unsigned int *)&ii;
- int i;
- for (i = 0 ; i < sizeof(ii)/4 ; i++) {
- fprintf(stderr,"%08x ", c[i]);
- }
- fprintf(stderr,"\n");
-#endif
-}
-
-static int
-add_tile_hash(struct tile_head *th)
-{
- int idx,len,maxnamelen=0;
- char **data;
-
-#if 0
- g_hash_table_insert(tile_hash2, string_hash_lookup( th->name ), th);
-#endif
- for( idx = 0; idx < th->num_subtiles; idx++ ) {
-
- data = th_get_subtile( th, idx );
-
- if (debug_tile(data) || debug_tile(th->name)) {
- fprintf(stderr,"Parent for '%s' is '%s'\n", *data, th->name);
- }
-
- g_hash_table_insert(tile_hash2, *data, th);
-
- len = strlen( *data );
-
- if (len > maxnamelen) {
- maxnamelen=len;
- }
- }
- return maxnamelen;
-}
-
-
-static int
-create_tile_hash(void)
-{
- struct tile_head *th;
- int len,maxnamelen=0;
-
- tile_hash2=g_hash_table_new(g_str_hash, g_str_equal);
- th=tile_head_root;
- while (th) {
- len=add_tile_hash(th);
- if (len > maxnamelen)
- maxnamelen=len;
- th=th->next;
- }
- return maxnamelen;
-}
-
-static void
-create_tile_hash_list(GList *list)
-{
- GList *next;
- struct tile_head *th;
-
- tile_hash2=g_hash_table_new(g_str_hash, g_str_equal);
-
- fprintf(stderr,"list=%p\n", list);
- next=g_list_first(list);
- while (next) {
- th=g_hash_table_lookup(tile_hash, next->data);
- if (!th) {
- fprintf(stderr,"No tile found for '%s'\n", (char *)(next->data));
- }
- add_tile_hash(th);
- next=g_list_next(next);
- }
-}
-
-static void
-destroy_tile_hash(void)
-{
- g_hash_table_destroy(tile_hash2);
- tile_hash2=NULL;
-}
-
-static int zipnum;
-
-static void write_countrydir(int phase, int maxnamelen);
-
-static void
-write_tilesdir(int phase, int maxlen, FILE *out)
-{
- int idx,len;
- GList *tiles_list,*next;
- char **data;
- struct tile_head *th,**last=NULL;
- zipnum=0;
-
- tiles_list=get_tiles_list();
- if (phase == 3)
- create_tile_hash_list(tiles_list);
- next=g_list_first(tiles_list);
- last=&tile_head_root;
- if (! maxlen) {
- while (next) {
- if (strlen(next->data) > maxlen)
- maxlen=strlen(next->data);
- next=g_list_next(next);
- }
- }
- len=maxlen;
- while (len >= 0) {
-#if 0
- fprintf(stderr,"PROGRESS: collecting tiles with len=%d\n", len);
-#endif
-#ifdef GENERATE_INDEX
- if (! len)
- write_countrydir(phase, maxlen);
-#endif
- next=g_list_first(tiles_list);
- while (next) {
- if (strlen(next->data) == len) {
- th=g_hash_table_lookup(tile_hash, next->data);
- if (phase == 3) {
- *last=th;
- last=&th->next;
- th->next=NULL;
- th->zipnum=zipnum;
- fprintf(out,"%s:%d",(char *)next->data,th->total_size);
-
- for ( idx = 0; idx< th->num_subtiles; idx++ ){
- data= th_get_subtile( th, idx );
- fprintf(out,":%s", *data);
- }
-
- fprintf(out,"\n");
- }
- if (th->name[0])
- index_submap_add(phase, th, &tiles_list);
- zipnum++;
- processed_tiles++;
- }
- next=g_list_next(next);
- }
- len--;
- }
-}
-
-static void
-merge_tiles(void)
-{
- struct tile_head *th;
- char basetile[1024];
- char subtile[1024];
- GList *tiles_list_sorted,*last;
- int i,i_min,len,size_all,size[5],size_min,work_done;
- long long zip_size;
-
- do {
- tiles_list_sorted=get_tiles_list();
- fprintf(stderr,"PROGRESS: sorting %d tiles\n", g_list_length(tiles_list_sorted));
- tiles_list_sorted=g_list_sort(tiles_list_sorted, (GCompareFunc)strcmp);
- fprintf(stderr,"PROGRESS: sorting %d tiles done\n", g_list_length(tiles_list_sorted));
- last=g_list_last(tiles_list_sorted);
- zip_size=0;
- while (last) {
- th=g_hash_table_lookup(tile_hash, last->data);
- zip_size+=th->total_size;
- last=g_list_previous(last);
- }
- fprintf(stderr,"DEBUG: size=%Ld\n", zip_size);
- last=g_list_last(tiles_list_sorted);
- work_done=0;
- while (last) {
- processed_tiles++;
- len=strlen(last->data);
- if (len >= 1) {
- strcpy(basetile,last->data);
- basetile[len-1]='\0';
- strcpy(subtile,last->data);
- for (i = 0 ; i < 4 ; i++) {
- subtile[len-1]='a'+i;
- size[i]=tile_data_size(subtile);
- }
- size[4]=tile_data_size(basetile);
- size_all=size[0]+size[1]+size[2]+size[3]+size[4];
- if (size_all < 65536 && size_all > 0 && size_all != size[4]) {
- for (i = 0 ; i < 4 ; i++) {
- subtile[len-1]='a'+i;
- work_done+=merge_tile(basetile, subtile);
- }
- } else {
- for (;;) {
- size_min=size_all;
- i_min=-1;
- for (i = 0 ; i < 4 ; i++) {
- if (size[i] && size[i] < size_min) {
- size_min=size[i];
- i_min=i;
- }
- }
- if (i_min == -1)
- break;
- if (size[4]+size_min >= 65536)
- break;
- subtile[len-1]='a'+i_min;
- work_done+=merge_tile(basetile, subtile);
- size[4]+=size[i_min];
- size[i_min]=0;
- }
- }
- }
- last=g_list_previous(last);
- }
- g_list_free(tiles_list_sorted);
- fprintf(stderr,"PROGRESS: merged %d tiles\n", work_done);
- } while (work_done);
-}
-
-struct country_index_item {
- struct item_bin item;
- struct attr_bin attr_country_id;
- int country_id;
- struct attr_bin attr_zipfile_ref;
- int zipfile_ref;
-};
-
-static void
-index_country_add(int phase, int country_id, int zipnum)
-{
- struct country_index_item ii;
- char *index_tile="";
-
- ii.item.len=sizeof(ii)/4-1;
- ii.item.type=type_countryindex;
- ii.item.clen=0;
-
- ii.attr_country_id.len=2;
- ii.attr_country_id.type=attr_country_id;
- ii.country_id=country_id;
-
- ii.attr_zipfile_ref.len=2;
- ii.attr_zipfile_ref.type=attr_zipfile_ref;
- ii.zipfile_ref=zipnum;
-
- if (phase == 3)
- tile_extend(index_tile, (struct item_bin *)&ii, NULL);
- else
- write_item(index_tile, (struct item_bin *)&ii);
-}
-
-#ifdef GENERATE_INDEX
-struct aux_tile {
- char *name;
- char *filename;
- int size;
-};
-
-static int
-add_aux_tile(int phase, char *name, char *filename, int size)
-{
- struct aux_tile *at;
- if (phase == 3) {
- at=g_new0(struct aux_tile, 1);
- at->name=g_strdup(name);
- at->filename=g_strdup(filename);
- at->size=size;
- aux_tile_list=g_list_append(aux_tile_list, at);
- }
- return zipnum++;
-}
-
-static int
-write_aux_tiles(FILE *out, FILE *dir_out, int compression_level, int namelen)
-{
- GList *l=aux_tile_list;
- struct aux_tile *at;
- char *buffer;
- FILE *f;
- int count=0;
-
- while (l) {
- at=l->data;
- buffer=malloc(at->size);
- assert(buffer != NULL);
- f=fopen(at->filename,"r");
- assert(f != NULL);
- fread(buffer, at->size, 1, f);
- fclose(f);
- write_zipmember(out, dir_out, at->name, namelen, buffer, at->size, compression_level);
- count++;
- l=g_list_next(l);
- }
- return count;
-}
-
-static void
-write_countrydir(int phase, int maxnamelen)
-{
- int i,zipnum;
- int max=11;
- char tilename[32];
- char searchtile[32];
- char filename[32];
- struct country_table *co;
- for (i = 0 ; i < sizeof(country_table)/sizeof(struct country_table) ; i++) {
- co=&country_table[i];
- if (co->size) {
- tilename[0]='\0';
- tile(&co->r, tilename, max);
- sprintf(searchtile,"%ss%d", tilename, 0);
- sprintf(filename,"country_%d.bin", co->countryid);
- zipnum=add_aux_tile(phase, searchtile, filename, co->size);
- index_country_add(phase,co->countryid,zipnum);
- }
- }
-}
-
-static void
-remove_countryfiles(void)
-{
- int i;
- char filename[32];
- struct country_table *co;
-
- for (i = 0 ; i < sizeof(country_table)/sizeof(struct country_table) ; i++) {
- co=&country_table[i];
- if (co->size) {
- sprintf(filename,"country_%d.bin", co->countryid);
- unlink(filename);
- }
- }
-}
-#endif
-
-static int
-phase34(int phase, int maxnamelen, FILE *ways_in, FILE *nodes_in, FILE *tilesdir_out)
-{
-
- processed_nodes=processed_nodes_out=processed_ways=processed_relations=processed_tiles=0;
- bytes_read=0;
- sig_alrm(0);
- if (phase == 3)
- tile_hash=g_hash_table_new(g_str_hash, g_str_equal);
- if (ways_in)
- phase34_process_file(phase, ways_in);
- if (nodes_in)
- phase34_process_file(phase, nodes_in);
- fprintf(stderr,"read %d bytes\n", bytes_read);
- if (phase == 3)
- merge_tiles();
- sig_alrm(0);
- alarm(0);
- write_tilesdir(phase, maxnamelen, tilesdir_out);
-
- return 0;
-
-}
-
-static int
-phase3(FILE *ways_in, FILE *nodes_in, FILE *tilesdir_out)
-{
- return phase34(3, 0, ways_in, nodes_in, tilesdir_out);
-}
-
-static long long zipoffset;
-static int zipdir_size;
-
-static int
-compress2_int(Byte *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level)
-{
- z_stream stream;
- int err;
-
- stream.next_in = (Bytef*)source;
- stream.avail_in = (uInt)sourceLen;
- stream.next_out = dest;
- stream.avail_out = (uInt)*destLen;
- if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
-
- stream.zalloc = (alloc_func)0;
- stream.zfree = (free_func)0;
- stream.opaque = (voidpf)0;
-
- err = deflateInit2(&stream, level, Z_DEFLATED, -15, 9, Z_DEFAULT_STRATEGY);
- if (err != Z_OK) return err;
-
- err = deflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- deflateEnd(&stream);
- return err == Z_OK ? Z_BUF_ERROR : err;
- }
- *destLen = stream.total_out;
-
- err = deflateEnd(&stream);
- return err;
-}
-
-static void
-write_zipmember(FILE *out, FILE *dir_out, char *name, int filelen, char *data, int data_size, int compression_level)
-{
- struct zip_lfh lfh = {
- 0x04034b50,
- 0x0a,
- 0x0,
- 0x0,
- 0xbe2a,
- 0x5d37,
- 0x0,
- 0x0,
- 0x0,
- filelen,
- 0x0,
- };
- struct zip_cd cd = {
- 0x02014b50,
- 0x17,
- 0x00,
- 0x0a,
- 0x00,
- 0x0000,
- 0x0,
- 0xbe2a,
- 0x5d37,
- 0x0,
- 0x0,
- 0x0,
- filelen,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0,
- zipoffset,
- };
- char filename[filelen+1];
- int error,crc,len,comp_size=data_size;
- uLongf destlen=data_size+data_size/500+12;
- char compbuffer[destlen];
-
- crc=crc32(0, NULL, 0);
- crc=crc32(crc, (unsigned char *)data, data_size);
- if (compression_level) {
- error=compress2_int((Byte *)compbuffer, &destlen, (Bytef *)data, data_size, compression_level);
- if (error == Z_OK) {
- if (destlen < data_size) {
- data=compbuffer;
- comp_size=destlen;
- }
- } else {
- fprintf(stderr,"compress2 returned %d\n", error);
- }
- }
- lfh.zipcrc=crc;
- lfh.zipsize=comp_size;
- lfh.zipuncmp=data_size;
- lfh.zipmthd=compression_level ? 8:0;
- cd.zipccrc=crc;
- cd.zipcsiz=comp_size;
- cd.zipcunc=data_size;
- cd.zipcmthd=compression_level ? 8:0;
- strcpy(filename, name);
- len=strlen(filename);
- while (len < filelen) {
- filename[len++]='_';
- }
- filename[filelen]='\0';
- fwrite(&lfh, sizeof(lfh), 1, out);
- fwrite(filename, filelen, 1, out);
- fwrite(data, comp_size, 1, out);
- zipoffset+=sizeof(lfh)+filelen+comp_size;
- fwrite(&cd, sizeof(cd), 1, dir_out);
- fwrite(filename, filelen, 1, dir_out);
- zipdir_size+=sizeof(cd)+filelen;
-}
-
-static int
-process_slice(FILE *ways_in, FILE *nodes_in, int size, int maxnamelen, FILE *out, FILE *dir_out, int compression_level)
-{
- struct tile_head *th;
- char *slice_data,*zip_data;
- int zipfiles=0;
-
- slice_data=malloc(size);
- assert(slice_data != NULL);
- zip_data=slice_data;
- th=tile_head_root;
- while (th) {
- if (th->process) {
- th->zip_data=zip_data;
- zip_data+=th->total_size;
- }
- th=th->next;
- }
- if (ways_in)
- fseek(ways_in, 0, SEEK_SET);
- if (nodes_in)
- fseek(nodes_in, 0, SEEK_SET);
- phase34(4, maxnamelen, ways_in, nodes_in, NULL);
-
- th=tile_head_root;
- while (th) {
- if (th->process) {
-#ifdef GENERATE_INDEX
- if (! strlen(th->name))
- zipfiles+=write_aux_tiles(out, dir_out, compression_level, maxnamelen);
-#endif
- if (th->total_size != th->total_size_used) {
- fprintf(stderr,"Size error '%s': %d vs %d\n", th->name, th->total_size, th->total_size_used);
- exit(1);
- } else {
- if (strlen(th->name))
- write_zipmember(out, dir_out, th->name, maxnamelen, th->zip_data, th->total_size, compression_level);
- else {
- write_zipmember(out, dir_out, "index", sizeof("index")-1, th->zip_data, th->total_size, compression_level);
- }
- zipfiles++;
- }
- }
- th=th->next;
- }
- free(slice_data);
-
- return zipfiles;
-}
-
-static void
-cat(FILE *in, FILE *out)
-{
- size_t size;
- char buffer[4096];
- while ((size=fread(buffer, 1, 4096, in)))
- fwrite(buffer, 1, size, out);
-}
-
-static int
-phase4(FILE *ways_in, FILE *nodes_in, FILE *out, FILE *dir_out, int compression_level)
-{
- int slice_size=1024*1024*1024;
- int maxnamelen,size,slices;
- int zipfiles=0;
- struct tile_head *th,*th2;
- struct zip_eoc eoc = {
- 0x06054b50,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0,
- 0x0,
- 0x0,
- };
-
- maxnamelen=create_tile_hash();
-
- th=tile_head_root;
- size=0;
- slices=0;
- fprintf(stderr, "Maximum slice size %d\n", slice_size);
- while (th) {
- if (size + th->total_size > slice_size) {
- fprintf(stderr,"Slice %d is of size %d\n", slices, size);
- size=0;
- slices++;
- }
- size+=th->total_size;
- th=th->next;
- }
- if (size)
- fprintf(stderr,"Slice %d is of size %d\n", slices, size);
- th=tile_head_root;
- size=0;
- slices=0;
- while (th) {
- th2=tile_head_root;
- while (th2) {
- th2->process=0;
- th2=th2->next;
- }
- size=0;
- while (th && size+th->total_size < slice_size) {
- size+=th->total_size;
- th->process=1;
- th=th->next;
- }
- zipfiles+=process_slice(ways_in, nodes_in, size, maxnamelen, out, dir_out, compression_level);
- slices++;
- }
- fseek(dir_out, 0, SEEK_SET);
- cat(dir_out, out);
- eoc.zipenum=zipfiles;
- eoc.zipecenn=zipfiles;
- eoc.zipecsz=zipdir_size;
- eoc.zipeofst=zipoffset;
- fwrite(&eoc, sizeof(eoc), 1, out);
- sig_alrm(0);
- alarm(0);
- return 0;
-}
-
-static void
-usage(FILE *f)
-{
- fprintf(f,"\n");
- fprintf(f,"osm2navit - parse osm textfile and converts to NavIt binfile format\n\n");
- fprintf(f,"Usage :\n");
- fprintf(f,"bzcat planet.osm.bz2 | osm2navit mymap.bin\n");
- fprintf(f,"Available switches:\n");
- fprintf(f,"-h (--help) : this screen\n");
- fprintf(f,"-N (--nodes-only) : process only nodes\n");
- fprintf(f,"-W (--ways-only) : process only ways\n");
- fprintf(f,"-a (--attr-debug-level) : control which data is included in the debug attribute\n");
- fprintf(f,"-c (--dump-coordinates) : dump coordinates after phase 1\n");
- fprintf(f,"-e (--end) : end at specified phase\n");
- fprintf(f,"-k (--keep-tmpfiles) : do not delete tmp files after processing. useful to reuse them\n\n");
- fprintf(f,"-o (--coverage) : map every street to item overage\n");
- fprintf(f,"-s (--start) : start at specified phase\n");
- fprintf(f,"-i (--input-file) : specify the input file name (OSM), overrules default stdin\n");
- fprintf(f,"-w (--dedupe-ways) : ensure no duplicate ways or nodes. useful when using several input files\n");
- fprintf(f,"-z (--compression-level) : set the compression level\n");
- exit(1);
-}
-
-int main(int argc, char **argv)
-{
- FILE *ways=NULL,*ways_split=NULL,*nodes=NULL,*tilesdir,*zipdir,*res;
- char *map=g_strdup(attrmap);
- int c,start=1,end=4,dump_coordinates=0;
- int keep_tmpfiles=0;
- int process_nodes=1, process_ways=1;
- int compression_level=9;
- char *result;
- FILE* input_file = stdin;
-
-
- while (1) {
-#if 0
- int this_option_optind = optind ? optind : 1;
-#endif
- int option_index = 0;
- static struct option long_options[] = {
- {"attr-debug-level", 1, 0, 'a'},
- {"compression-level", 1, 0, 'z'},
- {"coverage", 0, 0, 'o'},
- {"dedupe-ways", 0, 0, 'w'},
- {"end", 1, 0, 'e'},
- {"help", 0, 0, 'h'},
- {"keep-tmpfiles", 0, 0, 'k'},
- {"nodes-only", 0, 0, 'N'},
- {"start", 1, 0, 's'},
- {"input-file", 1, 0, 'i'},
- {"ignore-unknown", 0, 0, 'n'},
- {"ways-only", 0, 0, 'W'},
- {0, 0, 0, 0}
- };
- c = getopt_long (argc, argv, "Nni:Wa:ce:hks:w", long_options, &option_index);
- if (c == -1)
- break;
- switch (c) {
- case 'N':
- process_ways=0;
- break;
- case 'W':
- process_nodes=0;
- break;
- case 'a':
- attr_debug_level=atoi(optarg);
- break;
- case 'c':
- dump_coordinates=1;
- break;
- case 'e':
- end=atoi(optarg);
- break;
- case 'h':
- usage(stdout);
- break;
- case 'n':
- fprintf(stderr,"I will IGNORE unknown types\n");
- ignore_unkown=1;
- break;
- case 'k':
- fprintf(stderr,"I will KEEP tmp files\n");
- keep_tmpfiles=1;
- break;
- case 'o':
- coverage=1;
- break;
- case 's':
- start=atoi(optarg);
- break;
- case 'w':
- dedupe_ways_hash=g_hash_table_new(NULL, NULL);
- break;
- case 'i':
- input_file = fopen( optarg, "r" );
- if ( input_file == NULL )
- {
- fprintf( stderr, "\nInput file (%s) not found\n", optarg );
- exit( -1 );
- }
- break;
- case 'z':
- compression_level=atoi(optarg);
- break;
- case '?':
- usage(stderr);
- break;
- default:
- fprintf(stderr,"c=%d\n", c);
- }
-
- }
- if (optind != argc-1)
- usage(stderr);
- result=argv[optind];
- build_attrmap(map);
-#ifdef GENERATE_INDEX
- build_countrytable();
-#endif
-
-
- if (start == 1) {
- if (process_ways)
- ways=fopen("ways.tmp","wb+");
- if (process_nodes)
- nodes=fopen("nodes.tmp","wb+");
- phase=1;
- fprintf(stderr,"PROGRESS: Phase 1: collecting data\n");
- phase1(input_file,ways,nodes);
- if (ways)
- fclose(ways);
- if (nodes)
- fclose(nodes);
-#ifdef GENERATE_INDEX
- fprintf(stderr,"PROGRESS: Phase 1: sorting countries\n");
- sort_countries();
-#endif
- }
- if (end == 1 || dump_coordinates)
- save_buffer("coords.tmp",&node_buffer);
- if (end == 1)
- exit(0);
- if (start == 2)
- load_buffer("coords.tmp",&node_buffer);
- if (start <= 2) {
- if (process_ways) {
- ways=fopen("ways.tmp","rb");
- ways_split=fopen("ways_split.tmp","wb+");
- phase=2;
- fprintf(stderr,"PROGRESS: Phase 2: finding intersections\n");
- phase2(ways,ways_split);
- fclose(ways_split);
- fclose(ways);
- if(!keep_tmpfiles)
- remove("ways.tmp");
- } else
- fprintf(stderr,"PROGRESS: Skipping Phase 2\n");
- }
- free(node_buffer.base);
- node_buffer.base=NULL;
- node_buffer.malloced=0;
- node_buffer.size=0;
- if (end == 2)
- exit(0);
- if (start <= 3) {
- phase=3;
- fprintf(stderr,"PROGRESS: Phase 3: generating tiles\n");
- if (process_ways)
- ways_split=fopen("ways_split.tmp","rb");
- if (process_nodes)
- nodes=fopen("nodes.tmp","rb");
- tilesdir=fopen("tilesdir.tmp","wb+");
- phase3(ways_split,nodes,tilesdir);
- fclose(tilesdir);
- if (nodes)
- fclose(nodes);
- if (ways_split)
- fclose(ways_split);
- }
- if (end == 3)
- exit(0);
- if (start <= 4) {
- phase=4;
- fprintf(stderr,"PROGRESS: Phase 4: assembling map\n");
- if (process_ways)
- ways_split=fopen("ways_split.tmp","rb");
- if (process_nodes)
- nodes=fopen("nodes.tmp","rb");
- res=fopen(result,"wb+");
- zipdir=fopen("zipdir.tmp","wb+");
- phase4(ways_split,nodes,res,zipdir,compression_level);
- fclose(zipdir);
- fclose(res);
- if (nodes)
- fclose(nodes);
- if (ways_split)
- fclose(ways_split);
- if(!keep_tmpfiles) {
- remove("nodes.tmp");
- remove("ways_split.tmp");
- remove("tilesdir.tmp");
- remove("zipdir.tmp");
-#ifdef GENERATE_INDEX
- remove_countryfiles();
-#endif
- }
- }
- return 0;
-}
diff --git a/navit/param.c b/navit/param.c
deleted file mode 100644
index 94157a58..00000000
--- a/navit/param.c
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include "param.h"
-
-void
-param_add_string(char *name, char *value, struct param_list **param, int *count)
-{
- if (*count > 0) {
- (*param)->name=malloc(strlen(value)+strlen(name)+2);
- (*param)->value=(*param)->name+strlen(name)+1;
- strcpy((*param)->name, name);
- strcpy((*param)->value, value);
- (*count)--;
- (*param)++;
- }
-
-}
-
-void
-param_add_dec(char *name, unsigned long value, struct param_list **param, int *count)
-{
- char buffer[1024];
- sprintf(buffer, "%ld", value);
- param_add_string(name, buffer, param, count);
-}
-
-
-void
-param_add_hex(char *name, unsigned long value, struct param_list **param, int *count)
-{
- char buffer[1024];
- sprintf(buffer, "0x%lx", value);
- param_add_string(name, buffer, param, count);
-}
-
-void
-param_add_hex_sig(char *name, long value, struct param_list **param, int *count)
-{
- char buffer[1024];
- if (value < 0)
- sprintf(buffer, "-0x%lx", -value);
- else
- sprintf(buffer, "0x%lx", value);
- param_add_string(name, buffer, param, count);
-}
diff --git a/navit/param.h b/navit/param.h
deleted file mode 100644
index e450cc72..00000000
--- a/navit/param.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef NAVIT_PARAM_H
-#define NAVIT_PARAM_H
-
-struct param_list {
- char *name;
- char *value;
-};
-
-void param_add_string(char *name, char *value, struct param_list **param, int *count);
-void param_add_dec(char *name, unsigned long value, struct param_list **param, int *count);
-void param_add_hex(char *name, unsigned long value, struct param_list **param, int *count);
-void param_add_hex_sig(char *name, long value, struct param_list **param, int *count);
-
-#endif
-
diff --git a/navit/phrase.c b/navit/phrase.c
deleted file mode 100644
index dcdbad2e..00000000
--- a/navit/phrase.c
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <time.h>
-#include <glib.h>
-#include "coord.h"
-#include "item.h"
-#include "route.h"
-#include "speech.h"
-#include "phrase.h"
-
-void
-phrase_route_calc(void *speech)
-{
-#if 0
- if (! speech)
- return;
- speech_say(speech,"Die Route wird berechnet\n");
-#endif
-}
-
-void
-phrase_route_calculated(void *speech, void *route)
-{
-#if 0
- struct tm *eta;
-#endif
- if (! speech)
- return;
-
-#if 0 /* FIXME */
- eta=route_get_eta(route);
-
- speech_sayf(speech,"Die Route wurde berechnet, geschätzte Ankunftszeit %d Uhr %d Entfernung %4.0f Kilometer", eta->tm_hour,eta->tm_min,route_get_len(route)/1000);
-#endif
-
-}
diff --git a/navit/phrase.h b/navit/phrase.h
deleted file mode 100644
index 5fd1af26..00000000
--- a/navit/phrase.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef NAVIT_PHRASE_H
-#define NAVIT_PHRASE_H
-
-void phrase_route_calc(void *speech);
-void phrase_route_calculated(void *speech, void *route);
-
-#endif
-
diff --git a/navit/plugin.c b/navit/plugin.c
deleted file mode 100644
index 7f523016..00000000
--- a/navit/plugin.c
+++ /dev/null
@@ -1,200 +0,0 @@
-#include <glib.h>
-#include <gmodule.h>
-#include "config.h"
-#include "plugin.h"
-#include "file.h"
-#define PLUGIN_C
-#include "plugin.h"
-
-struct plugin {
- int active;
- int lazy;
- char *name;
- GModule *mod;
- void (*init)(void);
-};
-
-struct plugins {
- GHashTable *hash;
- GList *list;
-};
-
-struct plugin *
-plugin_new(char *plugin)
-{
- struct plugin *ret;
- if (! g_module_supported()) {
- return NULL;
- }
- ret=g_new0(struct plugin, 1);
- ret->name=g_strdup(plugin);
- return ret;
-
-}
-
-int
-plugin_load(struct plugin *pl)
-{
- gpointer init;
-
- GModule *mod;
-
- if (pl->mod) {
- g_warning("can't load '%s', already loaded\n", pl->name);
- return 0;
- }
- mod=g_module_open(pl->name, G_MODULE_BIND_LOCAL | (pl->lazy ? G_MODULE_BIND_LAZY : 0));
- if (! mod) {
- g_warning("can't load '%s', Error '%s'\n", pl->name, g_module_error());
- return 0;
- }
- if (!g_module_symbol(mod, "plugin_init", &init)) {
- g_warning("can't load '%s', plugin_init not found\n", pl->name);
- g_module_close(mod);
- return 0;
- } else {
- pl->mod=mod;
- pl->init=init;
- }
- return 1;
-}
-
-char *
-plugin_get_name(struct plugin *pl)
-{
- return pl->name;
-}
-
-int
-plugin_get_active(struct plugin *pl)
-{
- return pl->active;
-}
-
-void
-plugin_set_active(struct plugin *pl, int active)
-{
- pl->active=active;
-}
-
-void
-plugin_set_lazy(struct plugin *pl, int lazy)
-{
- pl->lazy=lazy;
-}
-
-void
-plugin_call_init(struct plugin *pl)
-{
- pl->init();
-}
-
-void
-plugin_unload(struct plugin *pl)
-{
- g_module_close(pl->mod);
- pl->mod=NULL;
-}
-
-void
-plugin_destroy(struct plugin *pl)
-{
- g_free(pl);
-}
-
-struct plugins *
-plugins_new(void)
-{
- struct plugins *ret=g_new0(struct plugins, 1);
- ret->hash=g_hash_table_new(g_str_hash, g_str_equal);
- return ret;
-}
-
-void
-plugins_add_path(struct plugins *pls, const char *path, int active, int lazy)
-{
- struct file_wordexp *we;
- int i, count;
- char **array;
- char *name;
- struct plugin *pl;
-
- we=file_wordexp_new(path);
- count=file_wordexp_get_count(we);
- array=file_wordexp_get_array(we);
- for (i = 0 ; i < count ; i++) {
- name=array[i];
- if (! (pl=g_hash_table_lookup(pls->hash, name))) {
- pl=plugin_new(name);
- if (! pl) {
- g_warning("failed to create plugin '%s'\n", name);
- continue;
- }
- g_hash_table_insert(pls->hash, plugin_get_name(pl), pl);
- pls->list=g_list_append(pls->list, pl);
- } else {
- pls->list=g_list_remove(pls->list, pl);
- pls->list=g_list_append(pls->list, pl);
- }
- plugin_set_active(pl, active);
- plugin_set_lazy(pl, lazy);
- }
- file_wordexp_destroy(we);
-}
-
-void
-plugins_init(struct plugins *pls)
-{
-#ifdef USE_PLUGINS
- struct plugin *pl;
- GList *l;
-
- l=pls->list;
- while (l) {
- pl=l->data;
- if (plugin_get_active(pl))
- if (!plugin_load(pl))
- plugin_set_active(pl, 0);
- l=g_list_next(l);
- }
- l=pls->list;
- while (l) {
- pl=l->data;
- if (plugin_get_active(pl))
- plugin_call_init(pl);
- l=g_list_next(l);
- }
-#endif
-}
-
-void
-plugins_destroy(struct plugins *pls)
-{
- GList *l;
- struct plugin *pl;
-
- l=pls->list;
- while (l) {
- pl=l->data;
- plugin_unload(pl);
- plugin_destroy(pl);
- }
- g_list_free(pls->list);
- g_hash_table_destroy(pls->hash);
- g_free(pls);
-}
-
-void *
-plugin_get_type(enum plugin_type type, const char *name)
-{
- GList *l;
- struct name_val *nv;
- l=plugin_types[type];
- while (l) {
- nv=l->data;
- if (!g_ascii_strcasecmp(nv->name, name))
- return nv->val;
- l=g_list_next(l);
- }
- return NULL;
-}
diff --git a/navit/plugin.h b/navit/plugin.h
deleted file mode 100644
index bdd0e5d4..00000000
--- a/navit/plugin.h
+++ /dev/null
@@ -1,137 +0,0 @@
-#ifndef PLUGIN_C
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct plugin;
-
-enum plugin_type {
- plugin_type_graphics,
- plugin_type_gui,
- plugin_type_map,
- plugin_type_osd,
- plugin_type_speech,
- plugin_type_vehicle,
- plugin_type_last,
-};
-#endif
-
-struct container;
-struct popup;
-struct popup_item;
-#undef PLUGIN_FUNC1
-#undef PLUGIN_FUNC3
-#undef PLUGIN_FUNC4
-#undef PLUGIN_TYPE
-#define PLUGIN_PROTO(name,args...) void name(args)
-
-#ifdef PLUGIN_C
-#define PLUGIN_REGISTER(name,args...) \
-void \
-plugin_register_##name(PLUGIN_PROTO((*func),args)) \
-{ \
- plugin_##name##_func=func; \
-}
-
-#define PLUGIN_CALL(name,args...) \
-{ \
- if (plugin_##name##_func) \
- (*plugin_##name##_func)(args); \
-}
-
-#define PLUGIN_FUNC1(name,t1,p1) \
-PLUGIN_PROTO((*plugin_##name##_func),t1 p1); \
-void plugin_call_##name(t1 p1) PLUGIN_CALL(name,p1) \
-PLUGIN_REGISTER(name,t1 p1)
-
-#define PLUGIN_FUNC3(name,t1,p1,t2,p2,t3,p3) \
-PLUGIN_PROTO((*plugin_##name##_func),t1 p1,t2 p2,t3 p3); \
-void plugin_call_##name(t1 p1,t2 p2, t3 p3) PLUGIN_CALL(name,p1,p2,p3) \
-PLUGIN_REGISTER(name,t1 p1,t2 p2,t3 p3)
-
-#define PLUGIN_FUNC4(name,t1,p1,t2,p2,t3,p3,t4,p4) \
-PLUGIN_PROTO((*plugin_##name##_func),t1 p1,t2 p2,t3 p3,t4 p4); \
-void plugin_call_##name(t1 p1,t2 p2, t3 p3, t4 p4) PLUGIN_CALL(name,p1,p2,p3,p4) \
-PLUGIN_REGISTER(name,t1 p1,t2 p2,t3 p3,t4 p4)
-
-struct name_val {
- char *name;
- void *val;
-};
-
-GList *plugin_types[plugin_type_last];
-
-#define PLUGIN_TYPE(type,newargs) \
-struct type##_priv; \
-struct type##_methods; \
-void \
-plugin_register_##type##_type(const char *name, struct type##_priv *(*new_) newargs) \
-{ \
- struct name_val *nv; \
- nv=g_new(struct name_val, 1); \
- nv->name=g_strdup(name); \
- nv->val=new_; \
- plugin_types[plugin_type_##type]=g_list_append(plugin_types[plugin_type_##type], nv); \
-} \
- \
-void * \
-plugin_get_##type##_type(const char *name) \
-{ \
- return plugin_get_type(plugin_type_##type, name); \
-}
-
-#else
-#define PLUGIN_FUNC1(name,t1,p1) \
-void plugin_register_##name(void(*func)(t1 p1)); \
-void plugin_call_##name(t1 p1);
-
-#define PLUGIN_FUNC3(name,t1,p1,t2,p2,t3,p3) \
-void plugin_register_##name(void(*func)(t1 p1,t2 p2,t3 p3)); \
-void plugin_call_##name(t1 p1,t2 p2,t3 p3);
-
-#define PLUGIN_FUNC4(name,t1,p1,t2,p2,t3,p3,t4,p4) \
-void plugin_register_##name(void(*func)(t1 p1,t2 p2,t3 p3,t4 p4)); \
-void plugin_call_##name(t1 p1,t2 p2,t3 p3,t4 p4);
-
-#define PLUGIN_TYPE(type,newargs) \
-struct type##_priv; \
-struct type##_methods; \
-void plugin_register_##type##_type(const char *name, struct type##_priv *(*new_) newargs); \
-void *plugin_get_##type##_type(const char *name);
-
-#endif
-
-#include "plugin_def.h"
-
-#ifndef USE_PLUGINS
-#define plugin_module_cat3(pre,mod,post) pre##mod##post
-#define plugin_module_cat2(pre,mod,post) plugin_module_cat3(pre,mod,post)
-#define plugin_module_cat(pre,post) plugin_module_cat2(pre,MODULE,post)
-#define plugin_init plugin_module_cat(module_,_init)
-#endif
-
-void plugin_init(void);
-
-/* prototypes */
-struct plugin *plugin_new(char *plugin);
-int plugin_load(struct plugin *pl);
-char *plugin_get_name(struct plugin *pl);
-int plugin_get_active(struct plugin *pl);
-void plugin_set_active(struct plugin *pl, int active);
-void plugin_set_lazy(struct plugin *pl, int lazy);
-void plugin_call_init(struct plugin *pl);
-void plugin_unload(struct plugin *pl);
-void plugin_destroy(struct plugin *pl);
-struct plugins *plugins_new(void);
-void plugins_add_path(struct plugins *pls, const char *path, int active, int lazy);
-void plugins_init(struct plugins *pls);
-void plugins_destroy(struct plugins *pls);
-void *plugin_get_type(enum plugin_type type, const char *name);
-/* end of prototypes */
-
-#ifdef __cplusplus
-}
-#endif
-
-
diff --git a/navit/plugin_def.h b/navit/plugin_def.h
deleted file mode 100644
index 3d82b5b2..00000000
--- a/navit/plugin_def.h
+++ /dev/null
@@ -1,11 +0,0 @@
-struct attr;
-struct navit;
-struct callback_list;
-PLUGIN_FUNC1(draw, struct container *, co)
-PLUGIN_FUNC3(popup, struct container *, map, struct popup *, p, struct popup_item **, list)
-PLUGIN_TYPE(graphics, (struct graphics_methods *meth, struct attr **attrs))
-PLUGIN_TYPE(gui, (struct navit *nav, struct gui_methods *meth, struct attr **attrs))
-PLUGIN_TYPE(map, (struct map_methods *meth, struct attr **attrs))
-PLUGIN_TYPE(osd, (struct navit *nav, struct osd_methods *meth, struct attr **attrs))
-PLUGIN_TYPE(speech, (char *data, struct speech_methods *meth))
-PLUGIN_TYPE(vehicle, (struct vehicle_methods *meth, struct callback_list *cbl, struct attr **attrs))
diff --git a/navit/point.h b/navit/point.h
deleted file mode 100644
index 7f75dd13..00000000
--- a/navit/point.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef NAVIT_POINT_H
-#define NAVIT_POINT_H
-
-struct point {
- int x;
- int y;
-};
-
-struct point_rect {
- struct point lu;
- struct point rl;
-};
-#endif
diff --git a/navit/popup.c b/navit/popup.c
deleted file mode 100644
index 8e8450f6..00000000
--- a/navit/popup.c
+++ /dev/null
@@ -1,260 +0,0 @@
-#include <windows.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <libintl.h>
-#include <glib.h>
-#include "popup.h"
-#include "debug.h"
-#include "navit.h"
-#include "coord.h"
-#include "gui.h"
-#include "menu.h"
-#include "point.h"
-#include "transform.h"
-#include "projection.h"
-#include "map.h"
-#include "graphics.h"
-#include "item.h"
-#include "callback.h"
-#include "route.h"
-
-#define _(STRING) gettext(STRING)
-#if 0
-static void
-popup_set_no_passing(struct popup_item *item, void *param)
-{
-#if 0
- struct display_list *l=param;
- struct segment *seg=(struct segment *)(l->data);
- struct street_str *str=(struct street_str *)(seg->data[0]);
- char log[256];
- int segid=str->segid;
- if (segid < 0)
- segid=-segid;
-
- sprintf(log,"Attributes Street 0x%x updated: limit=0x%x(0x%x)", segid, 0x33, str->limit);
- str->limit=0x33;
- log_write(log, seg->blk_inf.file, str, sizeof(*str));
-#endif
-}
-
-#endif
-
-static void
-popup_set_destination(struct navit *nav, struct pcoord *pc)
-{
- struct coord c;
- struct coord_geo g;
- char buffer[1024];
- char buffer_geo[1024];
- c.x = pc->x;
- c.y = pc->y;
- transform_to_geo(transform_get_projection(navit_get_trans(nav)), &c, &g);
- transform_geo_text(&g, buffer_geo);
- sprintf(buffer,"Map Point %s", buffer_geo);
- navit_set_destination(nav, pc, buffer);
-}
-
-static void
-popup_set_bookmark(struct navit *nav, struct pcoord *pc)
-{
- struct coord c;
- struct coord_geo g;
- char buffer[1024];
- char buffer_geo[1024];
- c.x = pc->x;
- c.y = pc->y;
- transform_to_geo(pc->pro, &c, &g);
- transform_geo_text(&g, buffer_geo);
- sprintf(buffer,"Map Point %s", buffer_geo);
- if (!gui_add_bookmark(navit_get_gui(nav), pc, buffer))
- navit_add_bookmark(nav, pc, buffer);
-}
-
-
-extern void *vehicle;
-
-static void
-popup_set_position(struct navit *nav, struct pcoord *pc)
-{
- dbg(0,"%p %p\n", nav, pc);
- navit_set_position(nav, pc);
-}
-
-#if 0
-static void
-popup_break_crossing(struct display_list *l)
-{
- struct segment *seg=(struct segment *)(l->data);
- struct street_str *str=(struct street_str *)(seg->data[0]);
- char log[256];
- int segid=str->segid;
- if (segid < 0)
- segid=-segid;
-
- sprintf(log,"Coordinates Street 0x%x updated: limit=0x%x(0x%x)", segid, 0x33, str->limit);
- str->limit=0x33;
- log_write(log, seg->blk_inf.file, str, sizeof(*str));
-}
-#endif
-
-
-#define popup_printf(menu, type, fmt...) popup_printf_cb(menu, type, NULL, fmt)
-
-static void *
-popup_printf_cb(void *menu, enum menu_type type, struct callback *cb, const char *fmt, ...)
-{
- gchar *str;
- va_list ap;
- void *ret;
-
- va_start(ap, fmt);
- str=g_strdup_vprintf(fmt, ap);
- dbg(0,"%s\n", str);
- ret=menu_add(menu, str, type, cb);
- va_end(ap);
- g_free(str);
- return ret;
-}
-
-static void
-popup_show_attr_val(struct map *map, void *menu, struct attr *attr)
-{
- char *attr_name=attr_to_name(attr->type);
- char *str;
-
- str=attr_to_text(attr, map, 1);
- popup_printf(menu, menu_type_menu, "%s: %s", attr_name, str);
- g_free(str);
-}
-
-#if 0
-static void
-popup_show_attr(void *menu, struct item *item, enum attr_type attr_type)
-{
- struct attr attr;
- memset(&attr, 0, sizeof(attr));
- attr.type=attr_type;
- if (item_attr_get(item, attr_type, &attr))
- popup_show_attr_val(menu, &attr);
-}
-#endif
-
-static void
-popup_show_attrs(struct map *map, void *menu, struct item *item)
-{
-#if 0
- popup_show_attr(menu, item, attr_debug);
- popup_show_attr(menu, item, attr_address);
- popup_show_attr(menu, item, attr_phone);
- popup_show_attr(menu, item, attr_phone);
- popup_show_attr(menu, item, attr_entry_fee);
- popup_show_attr(menu, item, attr_open_hours);
-#else
- struct attr attr;
- for (;;) {
- memset(&attr, 0, sizeof(attr));
- if (item_attr_get(item, attr_any, &attr))
- popup_show_attr_val(map, menu, &attr);
- else
- break;
- }
-
-#endif
-}
-
-static void
-popup_show_item(struct navit *nav, void *popup, struct displayitem *di)
-{
- struct map_rect *mr;
- void *menu, *menu_map, *menu_item;
- char *label;
- struct item *item;
-
- label=graphics_displayitem_get_label(di);
- item=graphics_displayitem_get_item(di);
-
- if (label)
- menu=popup_printf(popup, menu_type_submenu, "%s '%s'", item_to_name(item->type), label);
- else
- menu=popup_printf(popup, menu_type_submenu, "%s", item_to_name(item->type));
- menu_item=popup_printf(menu, menu_type_submenu, "Item");
- popup_printf(menu_item, menu_type_menu, "type: 0x%x", item->type);
- popup_printf(menu_item, menu_type_menu, "id: 0x%x 0x%x", item->id_hi, item->id_lo);
- if (item->map) {
- mr=map_rect_new(item->map,NULL);
- item=map_rect_get_item_byid(mr, item->id_hi, item->id_lo);
- dbg(1,"item=%p\n", item);
- if (item) {
- popup_show_attrs(item->map, menu_item, item);
- if (item->type < type_line) {
- struct coord co;
- struct pcoord *c;
- if (item_coord_get(item, &co, 1)) {
- c=g_new(struct pcoord, 1);
- c->pro = transform_get_projection(navit_get_trans(nav));
- c->x = co.x;
- c->y = co.y;
- popup_printf_cb(menu_item, menu_type_menu, callback_new_2(callback_cast(popup_set_position), nav, c), _("Set as position"));
- popup_printf_cb(menu_item, menu_type_menu, callback_new_2(callback_cast(popup_set_destination), nav, c), _("Set as destination"));
- popup_printf_cb(menu_item, menu_type_menu, callback_new_2(callback_cast(popup_set_bookmark), nav, c), _("Add as bookmark"));
- }
- }
- }
- map_rect_destroy(mr);
- menu_map=popup_printf(menu, menu_type_submenu, "Map");
- } else {
- popup_printf(menu, menu_type_menu, "(No map)");
- }
-}
-
-static void
-popup_display(struct navit *nav, void *popup, struct point *p)
-{
- struct displaylist_handle *dlh;
- struct displaylist *display;
- struct displayitem *di;
-
- display=navit_get_displaylist(nav);
- dlh=graphics_displaylist_open(display);
- while ((di=graphics_displaylist_next(dlh))) {
- if (graphics_displayitem_within_dist(di, p, 5)) {
- popup_show_item(nav, popup, di);
- }
- }
- graphics_displaylist_close(dlh);
-}
-
-static struct pcoord c;
-
-void
-popup(struct navit *nav, int button, struct point *p)
-{
- void *popup,*men;
- char buffer[1024];
- struct coord_geo g;
- struct coord co;
-
- popup=gui_popup_new(navit_get_gui(nav));
- if (! popup)
- return;
- transform_reverse(navit_get_trans(nav), p, &co);
- men=popup_printf(popup, menu_type_submenu, _("Point 0x%x 0x%x"), co.x, co.y);
- popup_printf(men, menu_type_menu, _("Screen coord : %d %d"), p->x, p->y);
- transform_to_geo(transform_get_projection(navit_get_trans(nav)), &co, &g);
- transform_geo_text(&g, buffer);
- popup_printf(men, menu_type_menu, "%s", buffer);
- popup_printf(men, menu_type_menu, "%f %f", g.lat, g.lng);
- dbg(0,"%p %p\n", nav, &c);
- c.pro = transform_get_projection(navit_get_trans(nav));
- c.x = co.x;
- c.y = co.y;
- popup_printf_cb(men, menu_type_menu, callback_new_2(callback_cast(popup_set_position), nav, &c), _("Set as position"));
- popup_printf_cb(men, menu_type_menu, callback_new_2(callback_cast(popup_set_destination), nav, &c), _("Set as destination"));
- popup_printf_cb(men, menu_type_menu, callback_new_2(callback_cast(popup_set_bookmark), nav, &c), _("Add as bookmark"));
- popup_display(nav, popup, p);
- menu_popup(popup);
-}
diff --git a/navit/popup.h b/navit/popup.h
deleted file mode 100644
index 3738c35d..00000000
--- a/navit/popup.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef NAVIT_POPUP_H
-#define NAVIT_POPUP_H
-
-struct navit;
-struct point;
-void popup(struct navit *nav, int button, struct point *p);
-
-#endif
diff --git a/navit/profile.c b/navit/profile.c
deleted file mode 100644
index 677af4ba..00000000
--- a/navit/profile.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include "profile.h"
-#include "debug.h"
-
-void
-profile_timer(int level, const char *module, const char *function, const char *fmt, ...)
-{
- va_list ap;
- static struct timeval last[3];
- struct timeval curr;
- int msec,usec;
- char buffer[strlen(module)+20];
-
- va_start(ap, fmt);
- if (level < 0)
- level=0;
- if (level > 2)
- level=2;
- if (fmt) {
- gettimeofday(&curr, NULL);
- msec=(curr.tv_usec-last[level].tv_usec)/1000+
- (curr.tv_sec-last[level].tv_sec)*1000;
-
- sprintf(buffer, "profile:%s", module);
- debug_vprintf(1, buffer, strlen(buffer), function, strlen(function), 1, fmt, ap);
- if (msec >= 100)
- debug_printf(1, buffer, strlen(buffer), function, strlen(function), 0, " %d msec\n", msec);
- else {
- usec=(curr.tv_usec-last[level].tv_usec)+(curr.tv_sec-last[level].tv_sec)*1000*1000;
- debug_printf(1, buffer, strlen(buffer), function, strlen(function), 0, " %d.%d msec\n", usec/1000, usec%1000);
- }
- gettimeofday(&last[level], NULL);
- } else {
- gettimeofday(&curr, NULL);
- for (level = 0 ; level < 3 ; level++)
- last[level]=curr;
- }
- va_end(ap);
-}
diff --git a/navit/profile.h b/navit/profile.h
deleted file mode 100644
index 4afa16ae..00000000
--- a/navit/profile.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef NAVIT_PROFILE_H
-#define NAVIT_PROFILE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-#define profile_str2(x) #x
-#define profile_str1(x) profile_str2(x)
-#define profile_module profile_str1(MODULE)
-#define profile(level,fmt...) profile_timer(level,profile_module,__PRETTY_FUNCTION__,fmt)
-void profile_timer(int level, const char *module, const char *function, const char *fmt, ...);
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/navit/projection.c b/navit/projection.c
deleted file mode 100644
index 614a9c0f..00000000
--- a/navit/projection.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <string.h>
-#include <glib.h>
-#include "coord.h"
-#include "debug.h"
-#include "projection.h"
-
-struct projection_name {
- enum projection projection;
- char *name;
-};
-
-
-struct projection_name projection_names[]={
- {projection_none, ""},
- {projection_mg, "mg"},
- {projection_garmin, "garmin"},
-};
-
-
-enum projection
-projection_from_name(const char *name)
-{
- int i;
-
- for (i=0 ; i < sizeof(projection_names)/sizeof(struct projection_name) ; i++) {
- if (! strcmp(projection_names[i].name, name))
- return projection_names[i].projection;
- }
- return projection_none;
-}
-
-char *
-projection_to_name(enum projection proj)
-{
- int i;
-
- for (i=0 ; i < sizeof(projection_names)/sizeof(struct projection_name) ; i++) {
- if (projection_names[i].projection == proj)
- return projection_names[i].name;
- }
- return NULL;
-}
-
diff --git a/navit/projection.h b/navit/projection.h
deleted file mode 100644
index bad3a483..00000000
--- a/navit/projection.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef NAVIT_PROJECTION_H
-#define NAVIT_PROJECTION_H
-
-enum projection {
- projection_none, projection_mg, projection_garmin
-};
-
-enum map_datum {
- map_datum_none, map_datum_wgs84, map_datum_dhdn
-};
-
-enum projection projection_from_name(const char *name);
-char * projection_to_name(enum projection proj);
-
-#endif
-
diff --git a/navit/route.c b/navit/route.c
deleted file mode 100644
index f8082b98..00000000
--- a/navit/route.c
+++ /dev/null
@@ -1,1780 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#if 0
-#include <math.h>
-#include <assert.h>
-#include <unistd.h>
-#include <sys/time.h>
-#endif
-#include <glib.h>
-#include "config.h"
-#include "debug.h"
-#include "profile.h"
-#include "coord.h"
-#include "projection.h"
-#include "map.h"
-#include "mapset.h"
-#include "item.h"
-#include "route.h"
-#include "track.h"
-#include "point.h"
-#include "graphics.h"
-#include "transform.h"
-#include "plugin.h"
-#include "fib.h"
-
-
-struct map_priv {
- struct route *route;
-};
-
-int debug_route=0;
-
-struct route_graph_point {
- struct route_graph_point *next;
- struct route_graph_point *hash_next;
- struct route_graph_segment *start;
- struct route_graph_segment *end;
- struct route_graph_segment *seg;
- struct fibheap_el *el;
- int value;
- struct coord c;
-};
-
-struct route_graph_segment {
- struct route_graph_segment *next;
- struct route_graph_segment *start_next;
- struct route_graph_segment *end_next;
- struct route_graph_point *start;
- struct route_graph_point *end;
- struct item item;
- int flags;
- int len;
- int offset;
-};
-
-struct route_path_segment {
- struct route_path_segment *next;
- struct item item;
- unsigned int offset;
-#if 0
- int time;
-#endif
- int length;
- int dir;
- unsigned ncoords;
- struct coord c[0];
-};
-
-struct route_info {
- struct coord c;
- struct coord lp;
- int pos;
-
- int dist;
- int dir;
-
- struct street_data *street;
-};
-
-struct route_path {
- struct route_path_segment *path;
- struct route_path_segment *path_last;
- /* XXX: path_hash is not necessery now */
- struct item_hash *path_hash;
-};
-
-#define RF_FASTEST (1<<0)
-#define RF_SHORTEST (1<<1)
-#define RF_AVOIDHW (1<<2)
-#define RF_AVOIDPAID (1<<3)
-#define RF_LOCKONROAD (1<<4)
-#define RF_SHOWGRAPH (1<<5)
-
-struct route {
- int version;
- struct mapset *ms;
- unsigned flags;
- struct route_info *pos;
- struct route_info *dst;
-
- struct route_graph *graph;
- struct route_path *path2;
- struct map *map;
- struct map *graph_map;
- int speedlist[route_item_last-route_item_first+1];
-};
-
-struct route_graph {
- struct route_graph_point *route_points;
- struct route_graph_segment *route_segments;
-#define HASH_SIZE 8192
- struct route_graph_point *hash[HASH_SIZE];
-};
-
-#define HASHCOORD(c) ((((c)->x +(c)->y) * 2654435761UL) & (HASH_SIZE-1))
-
-static struct route_info * route_find_nearest_street(struct mapset *ms, struct pcoord *c);
-static struct route_graph_point *route_graph_get_point(struct route_graph *this, struct coord *c);
-static void route_graph_update(struct route *this);
-static struct route_path *route_path_new(struct route_graph *this, struct route_path *oldpath, struct route_info *pos, struct route_info *dst, int *speedlist);
-static void route_process_street_graph(struct route_graph *this, struct item *item);
-static void route_graph_destroy(struct route_graph *this);
-static void route_path_update(struct route *this);
-
-static enum projection route_projection(struct route *route)
-{
- struct street_data *street;
- street = route->pos ? route->pos->street : route->dst->street;
- return map_projection(street->item.map);
-}
-
-static void
-route_path_destroy(struct route_path *this)
-{
- struct route_path_segment *c,*n;
- if (! this)
- return;
- if (this->path_hash) {
- item_hash_destroy(this->path_hash);
- this->path_hash=NULL;
- }
- c=this->path;
- while (c) {
- n=c->next;
- g_free(c);
- c=n;
- }
- g_free(this);
-}
-
-struct route *
-route_new(struct attr **attrs)
-{
- struct route *this=g_new0(struct route, 1);
- if (!this) {
- printf("%s:Out of memory\n", __FUNCTION__);
- return NULL;
- }
- return this;
-}
-
-void
-route_set_mapset(struct route *this, struct mapset *ms)
-{
- this->ms=ms;
-}
-
-struct mapset *
-route_get_mapset(struct route *this)
-{
- return this->ms;
-}
-
-struct route_info *
-route_get_pos(struct route *this)
-{
- return this->pos;
-}
-
-struct route_info *
-route_get_dst(struct route *this)
-{
- return this->dst;
-}
-
-int *
-route_get_speedlist(struct route *this)
-{
- return this->speedlist;
-}
-
-int
-route_get_path_set(struct route *this)
-{
- return this->path2 != NULL;
-}
-
-int
-route_set_speed(struct route *this, enum item_type type, int value)
-{
- if (type < route_item_first || type > route_item_last) {
- dbg(0,"street type %d out of range [%d,%d]", type, route_item_first, route_item_last);
- return 0;
- }
- this->speedlist[type-route_item_first]=value;
- return 1;
-}
-
-int
-route_contains(struct route *this, struct item *item)
-{
- if (! this->path2 || !this->path2->path_hash)
- return 0;
- return (int)item_hash_lookup(this->path2->path_hash, item);
-}
-
-static void
-route_path_update(struct route *this)
-{
- struct route_path *oldpath = NULL;
- if (! this->pos || ! this->dst) {
- route_path_destroy(this->path2);
- this->path2 = NULL;
- return;
- }
- /* the graph is destroyed when setting the destination */
- if (this->graph && this->pos && this->dst && this->path2) {
- // we can try to update
- oldpath = this->path2;
- this->path2 = NULL;
- }
- if (! this->graph || !(this->path2=route_path_new(this->graph, oldpath, this->pos, this->dst, this->speedlist))) {
- profile(0,NULL);
- route_graph_update(this);
- this->path2=route_path_new(this->graph, oldpath, this->pos, this->dst, this->speedlist);
- profile(1,"route_path_new");
- profile(0,"end");
- }
- if (oldpath) {
- /* Destroy what's left */
- route_path_destroy(oldpath);
- }
-}
-
-void
-route_set_position(struct route *this, struct pcoord *pos)
-{
- if (this->pos)
- route_info_free(this->pos);
- this->pos=NULL;
- this->pos=route_find_nearest_street(this->ms, pos);
- dbg(1,"this->pos=%p\n", this->pos);
- if (! this->pos)
- return;
- if (this->dst)
- route_path_update(this);
-}
-
-void
-route_set_position_from_tracking(struct route *this, struct tracking *tracking)
-{
- struct coord *c;
- struct route_info *ret;
-
- dbg(2,"enter\n");
- c=tracking_get_pos(tracking);
- ret=g_new0(struct route_info, 1);
- if (!ret) {
- printf("%s:Out of memory\n", __FUNCTION__);
- return;
- }
- if (this->pos)
- route_info_free(this->pos);
- this->pos=NULL;
- ret->c=*c;
- ret->lp=*c;
- ret->pos=tracking_get_segment_pos(tracking);
- ret->dist=0;
- ret->dir=0;
- ret->street=street_data_dup(tracking_get_street_data(tracking));
- dbg(3,"c->x=0x%x, c->y=0x%x pos=%d item=(0x%x,0x%x)\n", c->x, c->y, ret->pos, ret->street->item.id_hi, ret->street->item.id_lo);
- dbg(3,"street 0=(0x%x,0x%x) %d=(0x%x,0x%x)\n", ret->street->c[0].x, ret->street->c[0].y, ret->street->count-1, ret->street->c[ret->street->count-1].x, ret->street->c[ret->street->count-1].y);
- this->pos=ret;
- if (this->dst)
- route_path_update(this);
- dbg(2,"ret\n");
-}
-
-/* Used for debuging of route_rect, what routing sees */
-struct map_selection *route_selection;
-
-struct map_selection *
-route_rect(int order, struct coord *c1, struct coord *c2, int rel, int abs)
-{
- int dx,dy,sx=1,sy=1,d,m;
- struct map_selection *sel=g_new(struct map_selection, 1);
- if (!sel) {
- printf("%s:Out of memory\n", __FUNCTION__);
- return sel;
- }
- sel->order[layer_town]=0;
- sel->order[layer_poly]=0;
- sel->order[layer_street]=order;
- dbg(1,"%p %p\n", c1, c2);
- dx=c1->x-c2->x;
- dy=c1->y-c2->y;
- if (dx < 0) {
- sx=-1;
- sel->u.c_rect.lu.x=c1->x;
- sel->u.c_rect.rl.x=c2->x;
- } else {
- sel->u.c_rect.lu.x=c2->x;
- sel->u.c_rect.rl.x=c1->x;
- }
- if (dy < 0) {
- sy=-1;
- sel->u.c_rect.lu.y=c2->y;
- sel->u.c_rect.rl.y=c1->y;
- } else {
- sel->u.c_rect.lu.y=c1->y;
- sel->u.c_rect.rl.y=c2->y;
- }
- if (dx*sx > dy*sy)
- d=dx*sx;
- else
- d=dy*sy;
- m=d*rel/100+abs;
- sel->u.c_rect.lu.x-=m;
- sel->u.c_rect.rl.x+=m;
- sel->u.c_rect.lu.y+=m;
- sel->u.c_rect.rl.y-=m;
- sel->next=NULL;
- return sel;
-}
-
-static struct map_selection *
-route_calc_selection(struct coord *c1, struct coord *c2)
-{
- struct map_selection *ret,*sel;
- sel=route_rect(4, c1, c2, 25, 0);
- ret=sel;
- sel->next=route_rect(8, c1, c1, 0, 40000);
- sel=sel->next;
- sel->next=route_rect(18, c1, c1, 0, 10000);
- sel=sel->next;
- sel->next=route_rect(8, c2, c2, 0, 40000);
- sel=sel->next;
- sel->next=route_rect(18, c2, c2, 0, 10000);
- /* route_selection=ret; */
- return ret;
-}
-
-static void
-route_free_selection(struct map_selection *sel)
-{
- struct map_selection *next;
- while (sel) {
- next=sel->next;
- g_free(sel);
- sel=next;
- }
-}
-
-
-
-void
-route_set_destination(struct route *this, struct pcoord *dst)
-{
- profile(0,NULL);
- if (this->dst)
- route_info_free(this->dst);
- this->dst=NULL;
- if (dst)
- this->dst=route_find_nearest_street(this->ms, dst);
- profile(1,"find_nearest_street");
- route_graph_destroy(this->graph);
- this->graph=NULL;
- route_path_update(this);
- profile(0,"end");
-}
-
-static struct route_graph_point *
-route_graph_get_point(struct route_graph *this, struct coord *c)
-{
- struct route_graph_point *p;
- int hashval=HASHCOORD(c);
- p=this->hash[hashval];
- while (p) {
- if (p->c.x == c->x && p->c.y == c->y)
- return p;
- p=p->hash_next;
- }
- return NULL;
-}
-
-
-static struct route_graph_point *
-route_graph_add_point(struct route_graph *this, struct coord *f)
-{
- int hashval;
- struct route_graph_point *p;
-
- p=route_graph_get_point(this,f);
- if (!p) {
- hashval=HASHCOORD(f);
- if (debug_route)
- printf("p (0x%x,0x%x)\n", f->x, f->y);
- p=g_new(struct route_graph_point,1);
- if (!p) {
- printf("%s:Out of memory\n", __FUNCTION__);
- return p;
- }
- p->hash_next=this->hash[hashval];
- this->hash[hashval]=p;
- p->next=this->route_points;
- p->el=NULL;
- p->start=NULL;
- p->end=NULL;
- p->seg=NULL;
- p->value=INT_MAX;
- p->c=*f;
- this->route_points=p;
- }
- return p;
-}
-
-
-static void
-route_graph_free_points(struct route_graph *this)
-{
- struct route_graph_point *curr,*next;
- curr=this->route_points;
- while (curr) {
- next=curr->next;
- g_free(curr);
- curr=next;
- }
- this->route_points=NULL;
- memset(this->hash, 0, sizeof(this->hash));
-}
-
-static void
-route_graph_add_segment(struct route_graph *this, struct route_graph_point *start,
- struct route_graph_point *end, int len, struct item *item,
- int flags, int offset)
-{
- struct route_graph_segment *s;
- s = g_new0(struct route_graph_segment, 1);
- if (!s) {
- printf("%s:Out of memory\n", __FUNCTION__);
- return;
- }
- s->start=start;
- s->start_next=start->start;
- start->start=s;
- s->end=end;
- s->end_next=end->end;
- end->end=s;
- g_assert(len >= 0);
- s->len=len;
- s->item=*item;
- s->flags=flags;
- s->offset = offset;
- s->next=this->route_segments;
- this->route_segments=s;
- if (debug_route)
- printf("l (0x%x,0x%x)-(0x%x,0x%x)\n", start->c.x, start->c.y, end->c.x, end->c.y);
-}
-
-static int get_item_seg_coords(struct item *i, struct coord *c, int max,
- struct route_graph_segment *rgs)
-{
- struct map_rect *mr;
- struct item *item;
- int rc = 0, fs = 0, p = 0;
- struct coord c1;
- mr=map_rect_new(i->map, NULL);
- if (!mr)
- return 0;
- item = map_rect_get_item_byid(mr, i->id_hi, i->id_lo);
- if (item) {
- do {
- rc = item_coord_get(item, &c1, 1);
- if (rc) {
- if (!fs) {
- if (c1.x == rgs->start->c.x &&
- c1.y == rgs->start->c.y)
- fs = 1;
- }
- if (fs) {
- c[p++] = c1;
- if (c1.x == rgs->end->c.x &&
- c1.y == rgs->end->c.y)
- break;
- }
- }
- } while (rc);
- }
- map_rect_destroy(mr);
- return p;
-}
-
-static struct route_path_segment *
-route_extract_segment_from_path(struct route_path *path, struct item *item,
- int offset)
-{
- struct route_path_segment *sp = NULL, *s;
- s = path->path;
- while (s) {
- if (s->offset == offset && item_is_equal(s->item,*item)) {
- if (sp) {
- sp->next = s->next;
- break;
- } else {
- path->path = s->next;
- break;
- }
- }
- sp = s;
- s = s->next;
- }
- if (s)
- item_hash_remove(path->path_hash, item);
- return s;
-}
-
-static void
-route_path_add_item(struct route_path *this, struct route_path *oldpath,
- struct route_graph_segment *rgs, int len, int offset, int dir)
-{
- struct route_path_segment *segment;
- int ccnt = 0;
- struct coord ca[2048];
-
- if (oldpath) {
- ccnt = (int)item_hash_lookup(oldpath->path_hash, &rgs->item);
- if (ccnt) {
- segment = route_extract_segment_from_path(oldpath,
- &rgs->item, offset);
- if (segment)
- goto linkold;
- }
- }
-
- ccnt = get_item_seg_coords(&rgs->item, ca, 2047, rgs);
- segment= g_malloc0(sizeof(*segment) + sizeof(struct coord) * ccnt);
- if (!segment) {
- printf("%s:Out of memory\n", __FUNCTION__);
- return;
- }
- memcpy(segment->c, ca, ccnt * sizeof(struct coord));
- segment->ncoords = ccnt;
- segment->item=rgs->item;
- segment->offset = offset;
-linkold:
- segment->length=len;
- segment->dir=dir;
- segment->next=NULL;
- item_hash_insert(this->path_hash, &rgs->item, (void *)offset);
- if (!this->path)
- this->path=segment;
- if (this->path_last)
- this->path_last->next=segment;
- this->path_last=segment;
-}
-
-struct route_path_handle {
- struct route_path_segment *s;
-};
-
-struct route_path_handle *
-route_path_open(struct route *this)
-{
- struct route_path_handle *ret;
-
- if (! this->path2 || ! this->path2->path)
- return NULL;
-
- ret=g_new(struct route_path_handle, 1);
- if (!ret) {
- printf("%s:Out of memory\n", __FUNCTION__);
- return ret;
- }
- ret->s=this->path2->path;
- return ret;
-}
-
-struct route_path_segment *
-route_path_get_segment(struct route_path_handle *h)
-{
- struct route_path_segment *ret=h->s;
-
- if (ret)
- h->s=ret->next;
-
- return ret;
-}
-
-static struct coord *
-route_path_segment_get_helper(struct route_path_segment *s, int dir)
-{
- if (s->dir == dir)
- return &s->c[0];
- else
- return &s->c[s->ncoords-1];
-}
-
-struct coord *
-route_path_segment_get_start(struct route_path_segment *s)
-{
- return route_path_segment_get_helper(s, 1);
-}
-
-struct coord *
-route_path_segment_get_end(struct route_path_segment *s)
-{
- return route_path_segment_get_helper(s, -1);
-}
-
-struct item *
-route_path_segment_get_item(struct route_path_segment *s)
-{
- return &s->item;
-}
-
-void
-route_path_close(struct route_path_handle *h)
-{
- g_free(h);
-}
-
-static void
-route_graph_free_segments(struct route_graph *this)
-{
- struct route_graph_segment *curr,*next;
- curr=this->route_segments;
- while (curr) {
- next=curr->next;
- g_free(curr);
- curr=next;
- }
- this->route_segments=NULL;
-}
-
-static void
-route_graph_destroy(struct route_graph *this)
-{
- if (this) {
- route_graph_free_points(this);
- route_graph_free_segments(this);
- g_free(this);
- }
-}
-
-int
-route_time(int *speedlist, struct item *item, int len)
-{
- if (item->type < route_item_first || item->type > route_item_last) {
- dbg(0,"street type %d out of range [%d,%d]", item->type, route_item_first, route_item_last);
- return len*36;
- }
- return len*36/speedlist[item->type-route_item_first];
-}
-
-
-static int
-route_value(int *speedlist, struct item *item, int len)
-{
- int ret;
- if (len < 0) {
- printf("len=%d\n", len);
- }
- g_assert(len >= 0);
- ret=route_time(speedlist, item, len);
- dbg(1, "route_value(0x%x, %d)=%d\n", item->type, len, ret);
- return ret;
-}
-
-static void
-route_process_street_graph(struct route_graph *this, struct item *item)
-{
-#ifdef AVOID_FLOAT
- int len=0;
-#else
- double len=0;
-#endif
- struct route_graph_point *s_pnt,*e_pnt;
- struct coord c,l;
- struct attr attr;
- int flags = 0;
- int segmented = 0;
- int offset = 1;
-
- if (item_coord_get(item, &l, 1)) {
- if (item_attr_get(item, attr_flags, &attr)) {
- flags = attr.u.num;
- if (flags & AF_SEGMENTED)
- segmented = 1;
- }
- s_pnt=route_graph_add_point(this,&l);
- if (!segmented) {
- while (item_coord_get(item, &c, 1)) {
- len+=transform_distance(map_projection(item->map), &l, &c);
- l=c;
- }
- e_pnt=route_graph_add_point(this,&l);
- g_assert(len >= 0);
- route_graph_add_segment(this, s_pnt, e_pnt, len, item, flags, offset);
- } else {
- int isseg,rc;
- int sc = 0;
- do {
- isseg = item_coord_is_segment(item);
- rc = item_coord_get(item, &c, 1);
- if (rc) {
- len+=transform_distance(map_projection(item->map), &l, &c);
- l=c;
- if (isseg) {
- e_pnt=route_graph_add_point(this,&l);
- route_graph_add_segment(this, s_pnt, e_pnt, len, item, flags, offset);
- offset++;
- s_pnt=route_graph_add_point(this,&l);
- len = 0;
- }
- }
- } while(rc);
- e_pnt=route_graph_add_point(this,&l);
- g_assert(len >= 0);
- sc++;
- route_graph_add_segment(this, s_pnt, e_pnt, len, item, flags, offset);
- }
- }
-}
-
-static int
-compare(void *v1, void *v2)
-{
- struct route_graph_point *p1=v1;
- struct route_graph_point *p2=v2;
-#if 0
- if (debug_route)
- printf("compare %d (%p) vs %d (%p)\n", p1->value,p1,p2->value,p2);
-#endif
- return p1->value-p2->value;
-}
-
-int
-route_info_length(struct route_info *pos, struct route_info *dst, int dir)
-{
- struct route_info_handle *h;
- struct coord *c,*l;
- int ret=0;
- struct street_data *street;
-
- dbg(2,"enter pos=%p dst=%p dir=%d\n", pos, dst, dir);
- h=route_info_open(pos, dst, dir);
- if (! h) {
- dbg(2,"ret=-1\n");
- return -1;
- }
- street = pos ? pos->street : dst->street;
- l=route_info_get(h);
- while ((c=route_info_get(h))) {
- dbg(3,"c=%p\n", c);
- ret+=transform_distance(map_projection(street->item.map), c, l);
- l=c;
- }
- dbg(2,"ret=%d\n", ret);
- return ret;
-}
-
-static void
-route_graph_flood(struct route_graph *this, struct route_info *dst, int *speedlist)
-{
- struct route_graph_point *p_min,*end=NULL;
- struct route_graph_segment *s;
- int min,new,old,val;
- struct fibheap *heap;
- struct street_data *sd=dst->street;
-
- heap = fh_makeheap();
- fh_setcmp(heap, compare);
-
- if (! (sd->flags & AF_ONEWAYREV)) {
- end=route_graph_get_point(this, &sd->c[0]);
- g_assert(end != 0);
- end->value=route_value(speedlist, &sd->item, route_info_length(NULL, dst, -1));
- end->el=fh_insert(heap, end);
- }
-
- if (! (sd->flags & AF_ONEWAY)) {
- end=route_graph_get_point(this, &sd->c[sd->count-1]);
- g_assert(end != 0);
- end->value=route_value(speedlist, &sd->item, route_info_length(NULL, dst, 1));
- end->el=fh_insert(heap, end);
- }
-
- dbg(1,"0x%x,0x%x\n", end->c.x, end->c.y);
- for (;;) {
- p_min=fh_extractmin(heap);
- if (! p_min)
- break;
- min=p_min->value;
- if (debug_route)
- printf("extract p=%p free el=%p min=%d, 0x%x, 0x%x\n", p_min, p_min->el, min, p_min->c.x, p_min->c.y);
- p_min->el=NULL;
- s=p_min->start;
- while (s) {
- val=route_value(speedlist, &s->item, s->len);
-#if 0
- val+=val*2*street_route_contained(s->str->segid);
-#endif
- new=min+val;
- if (debug_route)
- printf("begin %d len %d vs %d (0x%x,0x%x)\n",new,val,s->end->value, s->end->c.x, s->end->c.y);
- if (new < s->end->value && !(s->flags & AF_ONEWAY)) {
- s->end->value=new;
- s->end->seg=s;
- if (! s->end->el) {
- if (debug_route)
- printf("insert_end p=%p el=%p val=%d ", s->end, s->end->el, s->end->value);
- s->end->el=fh_insert(heap, s->end);
- if (debug_route)
- printf("el new=%p\n", s->end->el);
- }
- else {
- if (debug_route)
- printf("replace_end p=%p el=%p val=%d\n", s->end, s->end->el, s->end->value);
- fh_replacedata(heap, s->end->el, s->end);
- }
- }
- if (debug_route)
- printf("\n");
- s=s->start_next;
- }
- s=p_min->end;
- while (s) {
- val=route_value(speedlist, &s->item, s->len);
- new=min+val;
- if (debug_route)
- printf("end %d len %d vs %d (0x%x,0x%x)\n",new,val,s->start->value,s->start->c.x, s->start->c.y);
- if (new < s->start->value && !(s->flags & AF_ONEWAYREV)) {
- old=s->start->value;
- s->start->value=new;
- s->start->seg=s;
- if (! s->start->el) {
- if (debug_route)
- printf("insert_start p=%p el=%p val=%d ", s->start, s->start->el, s->start->value);
- s->start->el=fh_insert(heap, s->start);
- if (debug_route)
- printf("el new=%p\n", s->start->el);
- }
- else {
- if (debug_route)
- printf("replace_start p=%p el=%p val=%d\n", s->start, s->start->el, s->start->value);
- fh_replacedata(heap, s->start->el, s->start);
- }
- }
- if (debug_route)
- printf("\n");
- s=s->end_next;
- }
- }
- fh_deleteheap(heap);
-}
-
-static struct route_path *
-route_path_new(struct route_graph *this, struct route_path *oldpath, struct route_info *pos, struct route_info *dst, int *speedlist)
-{
- struct route_graph_point *start1=NULL,*start2=NULL,*start;
- struct route_graph_segment *s=NULL;
- int len=0,segs=0;
- int ilen,seg_len;
-#if 0
- int time=0,hr,min,sec
-#endif
- unsigned int val1=0xffffffff,val2=0xffffffff;
- struct street_data *sd=pos->street;
- struct route_path *ret;
-
- if (! (sd->flags & AF_ONEWAY)) {
- start1=route_graph_get_point(this, &sd->c[0]);
- if (! start1)
- return NULL;
- val1=start1->value+route_value(speedlist, &sd->item, route_info_length(pos, NULL, -1));
- dbg(1,"start1: %d(route)+%d=%d\n", start1->value, val1-start1->value, val1);
- }
- if (! (sd->flags & AF_ONEWAYREV)) {
- start2=route_graph_get_point(this, &sd->c[sd->count-1]);
- if (! start2)
- return NULL;
- val2=start2->value+route_value(speedlist, &sd->item, route_info_length(pos, NULL, 1));
- dbg(1,"start2: %d(route)+%d=%d\n", start2->value, val2-start2->value, val2);
- }
- dbg(1,"val1=%d val2=%d\n", val1, val2);
- if (val1 == val2) {
- val1=start1->start->start->value;
- val2=start2->end->end->value;
- }
- if (start1 && (val1 < val2)) {
- start=start1;
- pos->dir=-1;
- } else {
- if (start2) {
- start=start2;
- pos->dir=1;
- } else {
- printf("no route found, pos blocked\n");
- return NULL;
- }
- }
- ret=g_new0(struct route_path, 1);
- if (!ret) {
- printf("%s:Out of memory\n", __FUNCTION__);
- return ret;
- }
- ret->path_hash=item_hash_new();
- dbg(1,"dir=%d\n", pos->dir);
- while ((s=start->seg)) {
- segs++;
-#if 0
- printf("start->value=%d 0x%x,0x%x\n", start->value, start->c.x, start->c.y);
-#endif
- seg_len=s->len;
- len+=seg_len;
- if (s->start == start) {
- route_path_add_item(ret, oldpath, s, seg_len, s->offset, 1);
- start=s->end;
- } else {
- route_path_add_item(ret, oldpath, s, seg_len, s->offset, -1);
- start=s->start;
- }
- }
- sd=dst->street;
- dbg(1,"start->value=%d 0x%x,0x%x\n", start->value, start->c.x, start->c.y);
- dbg(1,"dst sd->flags=%d sd->c[0]=0x%x,0x%x sd->c[sd->count-1]=0x%x,0x%x\n", sd->flags, sd->c[0].x,sd->c[0].y, sd->c[sd->count-1].x, sd->c[sd->count-1].y);
- if (start->c.x == sd->c[0].x && start->c.y == sd->c[0].y)
- dst->dir=-1;
- else if (start->c.x == sd->c[sd->count-1].x && start->c.y == sd->c[sd->count-1].y)
- dst->dir=1;
- else {
- printf("no route found\n");
- route_path_destroy(ret);
- return NULL;
- }
- ilen=route_info_length(pos, NULL, 0);
- len+=ilen;
-
- ilen=route_info_length(NULL, dst, 0);
- len+=ilen;
-
- dbg(1, "%d segments\n", segs);
- return ret;
-}
-
-static struct route_graph *
-route_graph_build(struct mapset *ms, struct coord *c1, struct coord *c2)
-{
- struct route_graph *ret=g_new0(struct route_graph, 1);
- struct map_selection *sel;
- struct mapset_handle *h;
- struct map_rect *mr;
- struct map *m;
- struct item *item;
-
- if (!ret) {
- printf("%s:Out of memory\n", __FUNCTION__);
- return ret;
- }
- sel=route_calc_selection(c1, c2);
- h=mapset_open(ms);
- while ((m=mapset_next(h,1))) {
- mr=map_rect_new(m, sel);
- if (! mr)
- continue;
- while ((item=map_rect_get_item(mr))) {
- if (item->type >= type_street_0 && item->type <= type_ferry) {
- route_process_street_graph(ret, item);
- }
- }
- map_rect_destroy(mr);
- }
- mapset_close(h);
- route_free_selection(sel);
-
- return ret;
-}
-
-static void
-route_graph_update(struct route *this)
-{
- route_graph_destroy(this->graph);
- profile(1,"graph_free");
- this->graph=route_graph_build(this->ms, &this->pos->c, &this->dst->c);
- profile(1,"route_graph_build");
- route_graph_flood(this->graph, this->dst, this->speedlist);
- profile(1,"route_graph_flood");
- this->version++;
-}
-
-struct street_data *
-street_get_data (struct item *item)
-{
- int maxcount=2000;
- struct coord c[maxcount];
- int count=0;
- struct street_data *ret;
- struct attr attr;
-
- while (count < maxcount) {
- if (!item_coord_get(item, &c[count], 1))
- break;
- count++;
- }
- if (count >= maxcount) {
- dbg(0, "count=%d maxcount=%d id_hi=0x%x id_lo=0x%x\n", count, maxcount, item->id_hi, item->id_lo);
- if (item_attr_get(item, attr_debug, &attr))
- dbg(0,"debug='%s'\n", attr.u.str);
- }
- g_assert(count < maxcount);
- ret=g_malloc(sizeof(struct street_data)+count*sizeof(struct coord));
- ret->item=*item;
- ret->count=count;
- if (item_attr_get(item, attr_flags, &attr))
- ret->flags=attr.u.num;
- else
- ret->flags=0;
- memcpy(ret->c, c, count*sizeof(struct coord));
-
- return ret;
-}
-
-struct street_data *
-street_data_dup(struct street_data *orig)
-{
- struct street_data *ret;
- int size=sizeof(struct street_data)+orig->count*sizeof(struct coord);
-
- ret=g_malloc(size);
- memcpy(ret, orig, size);
-
- return ret;
-}
-
-void
-street_data_free(struct street_data *sd)
-{
- g_free(sd);
-}
-
-static struct route_info *
-route_find_nearest_street(struct mapset *ms, struct pcoord *pc)
-{
- struct route_info *ret=NULL;
- int max_dist=1000;
- struct map_selection *sel;
- int dist,pos;
- struct mapset_handle *h;
- struct map *m;
- struct map_rect *mr;
- struct item *item;
- struct coord lp;
- struct street_data *sd;
- struct coord c;
- struct coord_geo g;
-
- c.x = pc->x;
- c.y = pc->y;
- /*
- * This is not correct for two reasons:
- * - You may need to go back first
- * - Currently we allow mixing of mapsets
- */
- sel = route_rect(18, &c, &c, 0, max_dist);
- h=mapset_open(ms);
- while ((m=mapset_next(h,1))) {
- c.x = pc->x;
- c.y = pc->y;
- if (map_projection(m) != pc->pro) {
- transform_to_geo(pc->pro, &c, &g);
- transform_from_geo(map_projection(m), &g, &c);
- }
- mr=map_rect_new(m, sel);
- if (! mr)
- continue;
- while ((item=map_rect_get_item(mr))) {
- if (item->type >= type_street_0 && item->type <= type_ferry) {
- sd=street_get_data(item);
- dist=transform_distance_polyline_sq(sd->c, sd->count, &c, &lp, &pos);
- if (!ret || dist < ret->dist) {
- if (ret) {
- street_data_free(ret->street);
- g_free(ret);
- }
- ret=g_new(struct route_info, 1);
- if (!ret) {
- printf("%s:Out of memory\n", __FUNCTION__);
- return ret;
- }
- ret->c=c;
- ret->lp=lp;
- ret->pos=pos;
- ret->dist=dist;
- ret->dir=0;
- ret->street=sd;
- dbg(1,"dist=%d id 0x%x 0x%x pos=%d\n", dist, item->id_hi, item->id_lo, pos);
- } else
- street_data_free(sd);
- }
- }
- map_rect_destroy(mr);
- }
- mapset_close(h);
- map_selection_destroy(sel);
-
- return ret;
-}
-
-void
-route_info_free(struct route_info *inf)
-{
- if (inf->street)
- street_data_free(inf->street);
- g_free(inf);
-}
-
-
-#include "point.h"
-
-struct street_data *
-route_info_street(struct route_info *rinf)
-{
- return rinf->street;
-}
-
-struct coord *
-route_info_point(struct route_info *rinf, int point)
-{
- struct street_data *sd=rinf->street;
- int dir;
-
- switch(point) {
- case -1:
- case 2:
- dir=(point == 2) ? rinf->dir : -rinf->dir;
- if (dir > 0)
- return &sd->c[sd->count-1];
- else
- return &sd->c[0];
- case 0:
- return &rinf->c;
- case 1:
- return &rinf->lp;
- }
- return NULL;
-
-}
-
-struct route_info_handle {
- struct route_info *start;
- struct route_info *curr;
- struct route_info *end;
- struct coord *last;
- int count;
- int iter;
- int pos;
- int endpos;
- int dir;
-};
-
-struct route_info_handle *
-route_info_open(struct route_info *start, struct route_info *end, int dir)
-{
- struct route_info_handle *ret=g_new0(struct route_info_handle, 1);
- struct route_info *curr;
- dbg(2,"enter start=%p end=%p dir=%d\n", start, end, dir);
- if (!ret) {
- printf("%s:Out of memory\n", __FUNCTION__);
- return ret;
- }
- ret->start=start;
- ret->end=end;
- if (start)
- curr=start;
- else
- curr=end;
- ret->endpos=-2;
- if (start && end) {
- if (start->street->item.map != end->street->item.map || start->street->item.id_hi != end->street->item.id_hi || start->street->item.id_lo != end->street->item.id_lo) {
- dbg(1,"return NULL\n");
- return NULL;
- }
- printf("trivial start=%d end=%d start dir %d end dir %d\n", start->pos, end->pos, start->dir, end->dir);
- if (start->pos == end->pos) {
- printf("fixme\n");
- start->dir=0;
- end->dir=0;
- }
- if (start->pos > end->pos) {
- printf("fixme\n");
- start->dir=-1;
- end->dir=1;
- }
- if (start->pos < end->pos) {
- printf("fixme\n");
- start->dir=1;
- end->dir=-1;
- }
- printf("trivial now start=%d end=%d start dir %d end dir %d\n", start->pos, end->pos, start->dir, end->dir);
- ret->endpos=end->pos;
- }
-
- if (!dir)
- dir=curr->dir;
- dbg(2,"dir=%d\n", dir);
- ret->dir=dir;
- ret->curr=curr;
- ret->pos=curr->pos;
- if (dir > 0) {
- ret->pos++;
- ret->endpos++;
- }
- dbg(2,"ret=%p\n",ret);
- return ret;
-}
-
-struct coord *
-route_info_get(struct route_info_handle *h)
-{
- struct coord *new;
- for (;;) {
- new=NULL;
- dbg(1,"iter=%d\n", h->iter);
- switch(h->iter) {
- case 0:
- if (h->start) {
- new=&h->start->c;
- h->iter++;
- break;
- } else {
- h->iter=2;
- continue;
- }
- case 1:
- new=&h->start->lp;
- h->iter++;
- break;
- case 2:
- dbg(1,"h->pos=%d\n", h->pos);
- if (h->dir && h->pos >= 0 && h->pos < h->curr->street->count && (h->end == NULL || h->endpos!=h->pos)) {
- new=&h->curr->street->c[h->pos];
- h->pos+=h->dir;
- } else {
- h->iter++;
- continue;
- }
- break;
- case 3:
- if (h->end) {
- new=&h->end->lp;
- h->iter++;
- break;
- }
- break;
- case 4:
- new=&h->end->c;
- h->iter++;
- break;
-
- }
- if (new) {
- dbg(1,"new=%p (0x%x,0x%x) last=%p\n", new, new->x, new->y, h->last);
- if (h->last && new->x == h->last->x && new->y == h->last->y)
- continue;
- h->last=new;
- return new;
- }
- return NULL;
- }
-}
-
-void
-route_info_close(struct route_info_handle *h)
-{
- g_free(h);
-}
-
-
-#if 0
-struct route_crossings *
-route_crossings_get(struct route *this, struct coord *c)
-{
- struct route_point *pnt;
- struct route_segment *seg;
- int crossings=0;
- struct route_crossings *ret;
-
- pnt=route_graph_get_point(this, c);
- seg=pnt->start;
- while (seg) {
- printf("start: 0x%x 0x%x\n", seg->item.id_hi, seg->item.id_lo);
- crossings++;
- seg=seg->start_next;
- }
- seg=pnt->end;
- while (seg) {
- printf("end: 0x%x 0x%x\n", seg->item.id_hi, seg->item.id_lo);
- crossings++;
- seg=seg->end_next;
- }
- ret=g_malloc(sizeof(struct route_crossings)+crossings*sizeof(struct route_crossing));
- ret->count=crossings;
- return ret;
-}
-#endif
-
-
-struct map_rect_priv {
- struct route_info_handle *ri;
- enum attr_type attr_next;
- int pos_next;
- int pos;
- struct map_priv *mpriv;
- struct item item;
- struct item *sitem;
- int length;
- unsigned int last_coord;
- struct route_path_segment *seg;
- struct route_graph_point *point;
- struct route_graph_segment *rseg;
- char *str;
-};
-
-static void
-rm_coord_rewind(void *priv_data)
-{
- struct map_rect_priv *mr = priv_data;
- mr->last_coord = 0;
-}
-
-static void
-rm_attr_rewind(void *priv_data)
-{
- struct map_rect_priv *mr = priv_data;
- mr->attr_next = attr_street_item;
-}
-
-static int
-rm_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
-{
- struct map_rect_priv *mr = priv_data;
- struct route_path_segment *seg=mr->seg;
- struct route *route=mr->mpriv->route;
- attr->type=attr_type;
- switch (attr_type) {
- case attr_any:
- while (mr->attr_next != attr_none) {
- if (rm_attr_get(priv_data, mr->attr_next, attr))
- return 1;
- }
- return 0;
- case attr_street_item:
- if (seg)
- attr->u.item=&seg->item;
- else
- attr->u.item=mr->sitem;
- mr->attr_next=attr_length;
- return 1;
- case attr_length:
- if (seg)
- attr->u.num=seg->length;
- else
- attr->u.num=mr->length;
- mr->attr_next=attr_time;
- return 1;
- case attr_time:
- if (seg)
- attr->u.num=route_time(route->speedlist, &seg->item, seg->length);
- else
- attr->u.num=route_time(route->speedlist, mr->sitem, mr->length);
- mr->attr_next=attr_none;
- return 1;
- default:
- attr->type=attr_none;
- return 0;
- }
- return 0;
-}
-
-static int
-rm_coord_get(void *priv_data, struct coord *c, int count)
-{
- struct map_rect_priv *mr = priv_data;
- struct route_path_segment *seg = mr->seg;
- struct coord *c1;
- int rc = 0,i;
- dbg(1,"pos=%d seg=%p\n", mr->pos, seg);
- switch (mr->pos) {
- case -1:
- for (i=0; i < count; i++) {
- if ((c1=route_info_get(mr->ri))) {
- c[i]=*c1;
- rc++;
- }
- }
- break;
- case 0:
- for (i=0; i < count; i++) {
- if (mr->last_coord >= seg->ncoords)
- break;
- if (i >= seg->ncoords)
- break;
- if (seg->dir < 0)
- c[i] = seg->c[seg->ncoords-++mr->last_coord];
- else
- c[i] = seg->c[mr->last_coord++];
- rc++;
- }
- break;
- case 1:
- for (i=0; i < count; i++) {
- if ((c1=route_info_get(mr->ri))) {
- c[i]=*c1;
- rc++;
- }
- }
- break;
- default:
- rc=0;
- }
- dbg(1,"return %d\n",rc);
- return rc;
-}
-
-static struct item_methods methods_route_item = {
- rm_coord_rewind,
- rm_coord_get,
- rm_attr_rewind,
- rm_attr_get,
-};
-
-static void
-rp_attr_rewind(void *priv_data)
-{
- struct map_rect_priv *mr = priv_data;
- mr->attr_next = attr_label;
-}
-
-static int
-rp_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
-{
- struct map_rect_priv *mr = priv_data;
- struct route_graph_point *p = mr->point;
- if (mr->item.type != type_rg_point)
- return 0;
- switch (attr_type) {
- case attr_any:
- while (mr->attr_next != attr_none) {
- if (rm_attr_get(priv_data, mr->attr_next, attr))
- return 1;
- }
- case attr_label:
- attr->type = attr_label;
- if (mr->str)
- g_free(mr->str);
- if (p->value != INT_MAX)
- mr->str=g_strdup_printf("%d", p->value);
- else
- mr->str=g_strdup("-");
- attr->u.str = mr->str;
- mr->attr_next=attr_none;
- return 1;
- case attr_debug:
- attr->type = attr_debug;
- if (mr->str)
- g_free(mr->str);
- mr->str=g_strdup_printf("x=%d y=%d", p->c.x, p->c.y);
- attr->u.str = mr->str;
- mr->attr_next=attr_none;
- return 1;
- default:
- return 0;
- }
-}
-
-static int
-rp_coord_get(void *priv_data, struct coord *c, int count)
-{
- struct map_rect_priv *mr = priv_data;
- struct route_graph_point *p = mr->point;
- struct route_graph_segment *seg = mr->rseg;
- int rc = 0,i;
- for (i=0; i < count; i++) {
- if (mr->item.type == type_rg_point) {
- if (mr->last_coord >= 1)
- break;
- c[i] = p->c;
- } else {
- if (mr->last_coord >= 2)
- break;
- if (mr->last_coord)
- c[i] = seg->end->c;
- else
- c[i] = seg->start->c;
- }
- mr->last_coord++;
- rc++;
- }
- return rc;
-}
-
-static struct item_methods methods_point_item = {
- rm_coord_rewind,
- rp_coord_get,
- rp_attr_rewind,
- rp_attr_get,
-};
-
-static void
-rm_destroy(struct map_priv *priv)
-{
- g_free(priv);
-}
-
-static struct map_rect_priv *
-rm_rect_new(struct map_priv *priv, struct map_selection *sel)
-{
- struct map_rect_priv * mr;
- dbg(1,"enter\n");
- if (! route_get_pos(priv->route))
- return NULL;
- if (! route_get_dst(priv->route))
- return NULL;
- if (! priv->route->path2)
- return NULL;
- mr=g_new0(struct map_rect_priv, 1);
- mr->mpriv = priv;
- mr->ri=route_info_open(route_get_pos(priv->route), route_get_dst(priv->route), 0);
- mr->pos_next=1;
- mr->sitem=&(route_get_pos(priv->route)->street->item);
- mr->item.priv_data = mr;
- mr->item.type = type_street_route;
- mr->item.meth = &methods_route_item;
- if (mr->ri) {
- mr->length=route_info_length(route_get_pos(priv->route), route_get_dst(priv->route), 0);
- } else {
- mr->ri=route_info_open(route_get_pos(priv->route), NULL, 0);
- mr->length=route_info_length(route_get_pos(priv->route), NULL, 0);
- mr->pos_next=-1;
- }
- return mr;
-}
-
-static struct map_rect_priv *
-rp_rect_new(struct map_priv *priv, struct map_selection *sel)
-{
- struct map_rect_priv * mr;
- dbg(1,"enter\n");
- if (! priv->route->graph || ! priv->route->graph->route_points)
- return NULL;
- mr=g_new0(struct map_rect_priv, 1);
- mr->mpriv = priv;
- mr->item.priv_data = mr;
- mr->item.type = type_rg_point;
- mr->item.meth = &methods_point_item;
- return mr;
-}
-
-static void
-rm_rect_destroy(struct map_rect_priv *mr)
-{
- if (mr->ri)
- route_info_close(mr->ri);
- if (mr->str)
- g_free(mr->str);
- g_free(mr);
-}
-
-static struct item *
-rp_get_item(struct map_rect_priv *mr)
-{
- struct route *r = mr->mpriv->route;
- struct route_graph_point *p = mr->point;
- struct route_graph_segment *seg = mr->rseg;
-
- if (mr->item.type == type_rg_point) {
- if (!p)
- p = r->graph->route_points;
- else
- p = p->next;
- if (p) {
- mr->point = p;
- mr->item.id_lo++;
- rm_coord_rewind(mr);
- rp_attr_rewind(mr);
- return &mr->item;
- } else
- mr->item.type = type_rg_segment;
- }
- if (!seg)
- seg=r->graph->route_segments;
- else
- seg=seg->next;
- if (seg) {
- mr->rseg = seg;
- mr->item.id_lo++;
- rm_coord_rewind(mr);
- rp_attr_rewind(mr);
- return &mr->item;
- }
- return NULL;
-
-}
-
-static struct item *
-rp_get_item_byid(struct map_rect_priv *mr, int id_hi, int id_lo)
-{
- struct item *ret=NULL;
- while (id_lo-- > 0)
- ret=rp_get_item(mr);
- return ret;
-}
-
-
-static struct item *
-rm_get_item(struct map_rect_priv *mr)
-{
- struct route *r = mr->mpriv->route;
- struct route_path_segment *seg = mr->seg;
- dbg(1,"enter\n", mr->pos);
-
- mr->pos=mr->pos_next;
- switch(mr->pos) {
- case -1:
- mr->pos_next=0;
- break;
- case 0:
- if (!seg)
- seg = r->path2->path;
- else
- seg = seg->next;
- if (seg) {
- mr->sitem = &seg->item;
- break;
- }
- mr->pos=1;
- route_info_close(mr->ri);
- mr->ri=route_info_open(NULL, route_get_dst(r), 0);
- mr->sitem=&(route_get_dst(r)->street->item);
- mr->length=route_info_length(NULL, route_get_dst(r), 0);
- case 1:
- mr->pos_next=2;
- break;
- case 2:
- return NULL;
- }
- mr->seg = seg;
- mr->last_coord = 0;
- mr->item.id_lo++;
- rm_attr_rewind(mr);
- return &mr->item;
-}
-
-static struct item *
-rm_get_item_byid(struct map_rect_priv *mr, int id_hi, int id_lo)
-{
- struct item *ret=NULL;
- while (id_lo-- > 0)
- ret=rm_get_item(mr);
- return ret;
-}
-
-static struct map_methods route_meth = {
- projection_mg,
- NULL,
- rm_destroy,
- rm_rect_new,
- rm_rect_destroy,
- rm_get_item,
- rm_get_item_byid,
- NULL,
- NULL,
- NULL,
-};
-
-static struct map_methods route_graph_meth = {
- projection_mg,
- NULL,
- rm_destroy,
- rp_rect_new,
- rm_rect_destroy,
- rp_get_item,
- rp_get_item_byid,
- NULL,
- NULL,
- NULL,
-};
-
-void
-route_toggle_routegraph_display(struct route *route)
-{
- if (route->flags & RF_SHOWGRAPH) {
- route->flags &= ~RF_SHOWGRAPH;
- } else {
- route->flags |= RF_SHOWGRAPH;
- }
-}
-
-static struct map_priv *
-route_map_new_helper(struct map_methods *meth, struct attr **attrs, int graph)
-{
- struct map_priv *ret;
- struct attr *route_attr;
-
- route_attr=attr_search(attrs, NULL, attr_route);
- if (! route_attr)
- return NULL;
- ret=g_new0(struct map_priv, 1);
- if (graph)
- *meth=route_graph_meth;
- else
- *meth=route_meth;
- ret->route=route_attr->u.route;
-
- return ret;
-}
-
-static struct map_priv *
-route_map_new(struct map_methods *meth, struct attr **attrs)
-{
- return route_map_new_helper(meth, attrs, 0);
-}
-
-static struct map_priv *
-route_graph_map_new(struct map_methods *meth, struct attr **attrs)
-{
- return route_map_new_helper(meth, attrs, 1);
-}
-
-static struct map *
-route_get_map_helper(struct route *this_, struct map **map, char *type)
-{
- struct attr route_attr;
- struct attr data_attr;
- struct attr *attrs_route[]={&route_attr, &data_attr, NULL};
- route_attr.type=attr_route;
- route_attr.u.route=this_;
- data_attr.type=attr_data;
- data_attr.u.str="";
-
- if (! *map)
- *map=map_new(type,attrs_route);
- return *map;
-}
-
-struct map *
-route_get_map(struct route *this_)
-{
- return route_get_map_helper(this_, &this_->map, "route");
-}
-
-
-struct map *
-route_get_graph_map(struct route *this_)
-{
- return route_get_map_helper(this_, &this_->graph_map, "route_graph");
-}
-
-void
-route_set_projection(struct route *this_, enum projection pro)
-{
-}
-
-void
-route_init(void)
-{
- plugin_register_map_type("route", route_map_new);
- plugin_register_map_type("route_graph", route_graph_map_new);
-}
diff --git a/navit/route.h b/navit/route.h
deleted file mode 100644
index 9fb4268e..00000000
--- a/navit/route.h
+++ /dev/null
@@ -1,84 +0,0 @@
-#ifndef NAVIT_ROUTE_H
-#define NAVIT_ROUTE_H
-
-struct route_crossing {
- long segid;
- int dir;
-};
-
-struct route_crossings {
- int count;
- struct route_crossing crossing[0];
-};
-
-struct street_data {
- struct item item;
- int count;
- int flags;
- struct coord c[0];
-};
-
-#define route_item_first type_street_0
-#define route_item_last type_ferry
-
-/* prototypes */
-enum item_type;
-struct coord;
-struct displaylist;
-struct item;
-struct map_selection;
-struct mapset;
-struct route;
-struct route_info;
-struct route_info_handle;
-struct route_path_coord_handle;
-struct route_path_handle;
-struct route_path_segment;
-struct street_data;
-struct tracking;
-struct transformation;
-struct route *route_new(struct attr **attrs);
-void route_set_mapset(struct route *this, struct mapset *ms);
-struct mapset *route_get_mapset(struct route *this);
-struct route_info *route_get_pos(struct route *this);
-struct route_info *route_get_dst(struct route *this);
-int *route_get_speedlist(struct route *this);
-int route_get_path_set(struct route *this);
-int route_set_speed(struct route *this, enum item_type type, int value);
-int route_contains(struct route *this, struct item *item);
-void route_set_position(struct route *this, struct pcoord *pos);
-void route_set_position_from_tracking(struct route *this, struct tracking *tracking);
-struct map_selection *route_rect(int order, struct coord *c1, struct coord *c2, int rel, int abs);
-void route_set_destination(struct route *this, struct pcoord *dst);
-struct route_path_handle *route_path_open(struct route *this);
-struct route_path_segment *route_path_get_segment(struct route_path_handle *h);
-struct coord *route_path_segment_get_start(struct route_path_segment *s);
-struct coord *route_path_segment_get_end(struct route_path_segment *s);
-struct item *route_path_segment_get_item(struct route_path_segment *s);
-int route_path_segment_get_length(struct route_path_segment *s);
-int route_path_segment_get_time(struct route_path_segment *s);
-void route_path_close(struct route_path_handle *h);
-struct route_path_coord_handle *route_path_coord_open(struct route *this);
-struct coord *route_path_coord_get(struct route_path_coord_handle *h);
-void route_path_coord_close(struct route_path_coord_handle *h);
-int route_time(int *speedlist, struct item *item, int len);
-int route_info_length(struct route_info *pos, struct route_info *dst, int dir);
-struct street_data *street_get_data(struct item *item);
-struct street_data *street_data_dup(struct street_data *orig);
-void street_data_free(struct street_data *sd);
-void route_info_free(struct route_info *inf);
-struct street_data *route_info_street(struct route_info *rinf);
-struct coord *route_info_point(struct route_info *rinf, int point);
-struct route_info_handle *route_info_open(struct route_info *start, struct route_info *end, int dir);
-struct coord *route_info_get(struct route_info_handle *h);
-void route_info_close(struct route_info_handle *h);
-void route_draw(struct route *this, struct transformation *t, struct displaylist *dsp);
-struct map *route_get_map(struct route *route);
-struct map *route_get_graph_map(struct route *route);
-void route_toggle_routegraph_display(struct route *route);
-void route_set_projection(struct route *this_, enum projection pro);
-void route_init(void);
-/* end of prototypes */
-
-#endif
-
diff --git a/navit/script/check_itemdef b/navit/script/check_itemdef
deleted file mode 100755
index 361f87be..00000000
--- a/navit/script/check_itemdef
+++ /dev/null
@@ -1,26 +0,0 @@
-#! /bin/sh
-function check_item
-{
- grep -q "[(,]$1)" ../item_def.h || echo "$1 missing"
-}
-
-echo osm2navit.c
-egrep '^ "[nw] +[^ ]+ +[^ ]+ +' ../osm2navit.c | sed "s/.* //" |
-while read -r x
-do
- check_item "${x%%\\n\"}"
-done
-
-echo "navit.xml"
-grep '<item type="' <../navit.xml | cut -d \" -f 2 | tr "," "\012" |
-while read -r x
-do
- check_item "$x"
-done
-
-echo "garmintypes.txt"
-grep ^0x ../data/garmin/garmintypes.txt | sed -e 's/[A-Z][A-Z]*, //' -e 's/.*= \([^,]*\),.*/\1/' |
-while read -r x
-do
- check_item "$x"
-done
diff --git a/navit/script/wiki2def b/navit/script/wiki2def
deleted file mode 100755
index ab834935..00000000
--- a/navit/script/wiki2def
+++ /dev/null
@@ -1,37 +0,0 @@
-#! /bin/bash
-rm -f item_def.h.wiki
-rm -f osmmap_def.h.wiki
-IFS="|"
-echo "/* This file is generated from http://wiki.navit-project.org/index.php/Item_def.h, do not edit it, edit the wiki page instead */" >item_def.h.wiki
-echo "/* This file is generated from http://wiki.navit-project.org/index.php/Item_def.h, do not edit it, edit the wiki page instead */" >osmmap_def.h.wiki
-type="n"
-wget -O - "http://wiki.navit-project.org/index.php/Item_def.h?action=edit" |
-awk '/<textarea/,/<\/textarea/ { print $0 }' |
-grep "^| " |
-sed -e 's/^| *//' -e 's/ *$//' -e 's/ *|/|/g' -e 's/| */|/g' -e 's/||/|/g' |
-while read id item description osmtags dummy
-do
- if [[ "$id" == colspan=* ]]
- then
- echo "/* $item */" >>item_def.h.wiki
- continue
- fi
- if [[ -z "$id" ]]
- then
- echo "ITEM($item)" >>item_def.h.wiki
- else
- echo "ITEM2($id,$item)" >>item_def.h.wiki
- if [ "$id" == "0x80000000" ]
- then
- type="w"
- fi
- fi
- if [[ -n "$osmtags" ]]
- then
- for osmtag in $(echo "$osmtags" | sed 's/&lt;br\/&gt;/|/g')
- do
- printf '"%s\t%s\t%s\t%s\\n"\n' $type $osmtag $item >> osmmap_def.h.wiki
- done
- fi
-done
-exit 0
diff --git a/navit/search.c b/navit/search.c
deleted file mode 100644
index f4db7736..00000000
--- a/navit/search.c
+++ /dev/null
@@ -1,332 +0,0 @@
-#include <glib.h>
-#include <string.h>
-#include "debug.h"
-#include "projection.h"
-#include "map.h"
-#include "mapset.h"
-#include "coord.h"
-#include "item.h"
-#include "search.h"
-
-struct search_list_level {
- struct mapset *ms;
- struct item *parent;
- struct attr attr;
- int partial;
- struct mapset_search *search;
- GHashTable *hash;
- GList *list,*curr,*last;
-};
-
-struct search_list {
- struct mapset *ms;
- int level;
- struct search_list_level levels[4];
- struct search_list_result result;
-};
-
-static guint
-search_item_hash_hash(gconstpointer key)
-{
- const struct item *itm=key;
- gconstpointer hashkey=(gconstpointer)(itm->id_hi^itm->id_lo);
- return g_direct_hash(hashkey);
-}
-
-static gboolean
-search_item_hash_equal(gconstpointer a, gconstpointer b)
-{
- const struct item *itm_a=a;
- const struct item *itm_b=b;
- if (item_is_equal_id(*itm_a, *itm_b))
- return TRUE;
- return FALSE;
-}
-
-struct search_list *
-search_list_new(struct mapset *ms)
-{
- struct search_list *ret;
-
- ret=g_new0(struct search_list, 1);
- ret->ms=ms;
-
- return ret;
-}
-
-static void search_list_search_free(struct search_list *sl, int level);
-void
-search_list_search(struct search_list *this_, struct attr *search_attr, int partial)
-{
- int level=-1;
- struct search_list_level *le;
- switch(search_attr->type) {
- case attr_country_all:
- case attr_country_id:
- case attr_country_iso2:
- case attr_country_iso3:
- case attr_country_car:
- case attr_country_name:
- level=0;
- break;
- case attr_town_postal:
- level=1;
- break;
- case attr_town_name:
- level=1;
- break;
- case attr_street_name:
- level=2;
- break;
- default:
- break;
- }
- dbg(0,"level=%d\n", level);
- if (level != -1) {
- this_->level=level;
- le=&this_->levels[level];
- le->attr=*search_attr;
- if (search_attr->type != attr_country_id)
- le->attr.u.str=g_strdup(search_attr->u.str);
- search_list_search_free(this_, level);
- le->partial=partial;
- if (level > 0) {
- le=&this_->levels[level-1];
- le->curr=le->list;
- }
- dbg(1,"le=%p partial=%d\n", le, partial);
- }
-}
-
-static struct search_list_country *
-search_list_country_new(struct item *item)
-{
- struct search_list_country *ret=g_new0(struct search_list_country, 1);
- struct attr attr;
-
- ret->item=*item;
- if (item_attr_get(item, attr_country_car, &attr))
- ret->car=g_strdup(attr.u.str);
- if (item_attr_get(item, attr_country_iso2, &attr))
- ret->iso2=g_strdup(attr.u.str);
- if (item_attr_get(item, attr_country_iso3, &attr))
- ret->iso3=g_strdup(attr.u.str);
- if (item_attr_get(item, attr_country_name, &attr))
- ret->name=g_strdup(attr.u.str);
- return ret;
-}
-
-static void
-search_list_country_destroy(struct search_list_country *this_)
-{
- g_free(this_->car);
- g_free(this_->iso2);
- g_free(this_->iso3);
- g_free(this_->name);
- g_free(this_);
-}
-
-static struct search_list_town *
-search_list_town_new(struct item *item)
-{
- struct search_list_town *ret=g_new0(struct search_list_town, 1);
- struct attr attr;
- struct coord c;
-
- ret->itemt=*item;
- if (item_attr_get(item, attr_town_streets_item, &attr)) {
- dbg(1,"town_assoc 0x%x 0x%x\n", attr.u.item->id_hi, attr.u.item->id_lo);
- ret->item=*attr.u.item;
- }
- else
- ret->item=*item;
- if (item_attr_get(item, attr_town_name, &attr))
- ret->name=map_convert_string(item->map,attr.u.str);
- if (item_attr_get(item, attr_town_postal, &attr))
- ret->postal=map_convert_string(item->map,attr.u.str);
- if (item_attr_get(item, attr_district_name, &attr))
- ret->district=map_convert_string(item->map,attr.u.str);
- if (item_coord_get(item, &c, 1)) {
- ret->c=g_new(struct pcoord, 1);
- ret->c->x=c.x;
- ret->c->y=c.y;
- ret->c->pro = map_projection(item->map);
- }
- return ret;
-}
-
-static void
-search_list_town_destroy(struct search_list_town *this_)
-{
- map_convert_free(this_->name);
- map_convert_free(this_->postal);
- if (this_->c)
- g_free(this_->c);
- g_free(this_);
-}
-
-static struct search_list_street *
-search_list_street_new(struct item *item)
-{
- struct search_list_street *ret=g_new0(struct search_list_street, 1);
- struct attr attr;
- struct coord c;
-
- ret->item=*item;
- if (item_attr_get(item, attr_street_name, &attr))
- ret->name=map_convert_string(item->map, attr.u.str);
- if (item_coord_get(item, &c, 1)) {
- ret->c=g_new(struct pcoord, 1);
- ret->c->x=c.x;
- ret->c->y=c.y;
- ret->c->pro = map_projection(item->map);
- }
- return ret;
-}
-
-static void
-search_list_street_destroy(struct search_list_street *this_)
-{
- map_convert_free(this_->name);
- if (this_->c)
- g_free(this_->c);
- g_free(this_);
-}
-
-
-static void
-search_list_result_destroy(int level, void *p)
-{
- switch (level) {
- case 0:
- search_list_country_destroy(p);
- break;
- case 1:
- search_list_town_destroy(p);
- break;
- case 2:
- search_list_street_destroy(p);
- break;
- }
-}
-
-static void
-search_list_search_free(struct search_list *sl, int level)
-{
- struct search_list_level *le=&sl->levels[level];
- GList *next,*curr;
- if (le->search) {
- mapset_search_destroy(le->search);
- le->search=NULL;
- }
-#if 0 /* FIXME */
- if (le->hash) {
- g_hash_table_destroy(le->hash);
- le->hash=NULL;
- }
-#endif
- curr=le->list;
- while (curr) {
- search_list_result_destroy(level, curr->data);
- next=g_list_next(curr);
- curr=next;
- }
- g_list_free(le->list);
- le->list=NULL;
- le->curr=NULL;
- le->last=NULL;
-
-}
-
-static int
-search_add_result(struct search_list_level *le, void *p)
-{
- if (! g_hash_table_lookup(le->hash, p)) {
- g_hash_table_insert(le->hash, p, (void *)1);
- le->list=g_list_append(le->list, p);
- return 1;
- }
- return 0;
-}
-
-struct search_list_result *
-search_list_get_result(struct search_list *this_)
-{
- struct search_list_level *le,*leu;
- struct item *item;
- int level=this_->level;
-
- dbg(1,"enter\n");
- le=&this_->levels[level];
- dbg(1,"le=%p\n", le);
- for (;;) {
- dbg(1,"le->search=%p\n", le->search);
- if (! le->search) {
- dbg(1,"partial=%d\n", le->partial);
- if (! level)
- le->parent=NULL;
- else {
- leu=&this_->levels[level-1];
- if (! leu->curr)
- break;
- le->parent=leu->curr->data;
- leu->last=leu->curr;
- leu->curr=g_list_next(leu->curr);
- }
- if (le->parent)
- dbg(1,"mapset_search_new with item(%d,%d)\n", le->parent->id_hi, le->parent->id_lo);
- dbg(1,"attr=%s\n", attr_to_name(le->attr.type));
- le->search=mapset_search_new(this_->ms, le->parent, &le->attr, le->partial);
- le->hash=g_hash_table_new(search_item_hash_hash, search_item_hash_equal);
- }
- dbg(1,"le->search=%p\n", le->search);
- item=mapset_search_get_item(le->search);
- dbg(1,"item=%p\n", item);
- if (item) {
- void *p=NULL;
- dbg(1,"id_hi=%d id_lo=%d\n", item->id_hi, item->id_lo);
- this_->result.country=NULL;
- this_->result.town=NULL;
- this_->result.street=NULL;
- this_->result.c=NULL;
- switch (level) {
- case 0:
- p=search_list_country_new(item);
- this_->result.country=p;
- break;
- case 1:
- p=search_list_town_new(item);
- this_->result.country=this_->levels[0].last->data;
- this_->result.town=p;
- this_->result.c=this_->result.town->c;
- break;
- case 2:
- p=search_list_street_new(item);
- this_->result.country=this_->levels[0].last->data;
- this_->result.town=this_->levels[1].last->data;
- this_->result.street=p;
- this_->result.c=this_->result.street->c;
- break;
- }
- if (p) {
- if (search_add_result(le, p))
- return &this_->result;
- else
- search_list_result_destroy(level, p);
- }
- } else {
- mapset_search_destroy(le->search);
- le->search=NULL;
- g_hash_table_destroy(le->hash);
- if (! level)
- break;
- }
- }
- return NULL;
-}
-
-void
-search_list_destroy(struct search_list *this_)
-{
- g_free(this_);
-}
diff --git a/navit/search.h b/navit/search.h
deleted file mode 100644
index 494e89c7..00000000
--- a/navit/search.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef NAVIT_SEARCH_H
-#define NAVIT_SEARCH_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-struct search_list_country {
- struct item item;
- char *car;
- char *iso2;
- char *iso3;
- char *name;
-};
-
-struct search_list_town {
- struct item item;
- struct item itemt;
- struct pcoord *c;
- char *postal;
- char *name;
- char *district;
-};
-
-struct search_list_street {
- struct item item;
- struct pcoord *c;
- char *name;
-};
-
-struct search_list_result {
- struct pcoord *c;
- struct search_list_country *country;
- struct search_list_town *town;
- struct search_list_street *street;
-};
-
-/* prototypes */
-struct attr;
-struct mapset;
-struct search_list;
-struct search_list_result;
-struct search_list *search_list_new(struct mapset *ms);
-void search_list_search(struct search_list *this_, struct attr *search_attr, int partial);
-struct search_list_result *search_list_get_result(struct search_list *this_);
-void search_list_destroy(struct search_list *this_);
-/* end of prototypes */
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/navit/speech.c b/navit/speech.c
deleted file mode 100644
index 0e49cd75..00000000
--- a/navit/speech.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include <glib.h>
-#include <string.h>
-#include "debug.h"
-#include "speech.h"
-#include "plugin.h"
-
-struct speech {
- struct speech_priv *priv;
- struct speech_methods meth;
-};
-
-struct speech *
-speech_new(const char *type, const char *data)
-{
- struct speech *this_;
- struct speech_priv *(*speech_new)(const char *data, struct speech_methods *meth);
-
- dbg(1,"enter type=%s data=%s\n", type, data);
- speech_new=plugin_get_speech_type(type);
- dbg(1,"new=%p\n", speech_new);
- if (! speech_new) {
- return NULL;
- }
- this_=g_new0(struct speech, 1);
- this_->priv=speech_new(data, &this_->meth);
- dbg(1, "say=%p\n", this_->meth.say);
- dbg(1,"priv=%p\n", this_->priv);
- if (! this_->priv) {
- g_free(this_);
- return NULL;
- }
- dbg(1,"return %p\n", this_);
- return this_;
-}
-
-int
-speech_say(struct speech *this_, const char *text)
-{
- dbg(1, "this_=%p text='%s' calling %p\n", this_, text, this_->meth.say);
- return (this_->meth.say)(this_->priv, text);
-}
diff --git a/navit/speech.h b/navit/speech.h
deleted file mode 100644
index 46f199ef..00000000
--- a/navit/speech.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef NAVIT_SPEECH_H
-#define NAVIT_SPEECH_H
-
-struct speech_priv;
-
-struct speech_methods {
- void (*destroy)(struct speech_priv *this_);
- int (*say)(struct speech_priv *this_, const char *text);
-};
-
-/* prototypes */
-struct speech * speech_new(const char *type, const char *data);
-int speech_say(struct speech *this_, const char *text);
-int speech_sayf(struct speech *this_, const char *format, ...);
-void speech_destroy(struct speech *this_);
-/* end of prototypes */
-
-#endif
-
diff --git a/navit/speech/Makefile.am b/navit/speech/Makefile.am
deleted file mode 100644
index b0ee9f5d..00000000
--- a/navit/speech/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-SUBDIRS=cmdline
-if SPEECH_SPEECH_DISPATCHER
- SUBDIRS += speech_dispatcher
-endif
diff --git a/navit/speech/cmdline/Makefile.am b/navit/speech/cmdline/Makefile.am
deleted file mode 100644
index f9e50b1a..00000000
--- a/navit/speech/cmdline/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=speech_cmdline
-modulespeech_LTLIBRARIES = libspeech_cmdline.la
-libspeech_cmdline_la_SOURCES = speech_cmdline.c
diff --git a/navit/speech/cmdline/speech_cmdline.c b/navit/speech/cmdline/speech_cmdline.c
deleted file mode 100644
index df3b9f12..00000000
--- a/navit/speech/cmdline/speech_cmdline.c
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <stdlib.h>
-#include <glib.h>
-#include "config.h"
-#include "plugin.h"
-#include "speech.h"
-
-struct speech_priv {
- char *cmdline;
-};
-
-static int
-speechd_say(struct speech_priv *this, const char *text)
-{
- char *cmdline;
-
- cmdline=g_strdup_printf(this->cmdline, text);
- return system(cmdline);
-}
-
-static void
-speechd_destroy(struct speech_priv *this) {
- g_free(this->cmdline);
- g_free(this);
-}
-
-static struct speech_methods speechd_meth = {
- speechd_destroy,
- speechd_say,
-};
-
-static struct speech_priv *
-speechd_new(char *data, struct speech_methods *meth) {
- struct speech_priv *this;
- if (! data)
- return NULL;
- this=g_new(struct speech_priv,1);
- this->cmdline=g_strdup(data);
- *meth=speechd_meth;
- return this;
-}
-
-
-void
-plugin_init(void)
-{
- plugin_register_speech_type("cmdline", speechd_new);
-}
diff --git a/navit/speech/speech_dispatcher/Makefile.am b/navit/speech/speech_dispatcher/Makefile.am
deleted file mode 100644
index c78f9d20..00000000
--- a/navit/speech/speech_dispatcher/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=speech_speech_dispatcher
-modulespeech_LTLIBRARIES = libspeech_speech_dispatcher.la
-libspeech_speech_dispatcher_la_SOURCES = speech_speech_dispatcher.c
-libspeech_speech_dispatcher_la_LIBADD = @SPEECHD_LIBS@
-
diff --git a/navit/speech/speech_dispatcher/speech_speech_dispatcher.c b/navit/speech/speech_dispatcher/speech_speech_dispatcher.c
deleted file mode 100644
index 87f5032f..00000000
--- a/navit/speech/speech_dispatcher/speech_speech_dispatcher.c
+++ /dev/null
@@ -1,67 +0,0 @@
-
-/* speechd simple client program
- * CVS revision: $Id: speech_speech_dispatcher.c,v 1.3 2007-07-08 20:41:35 martin-s Exp $
- * Author: Tomas Cerha <cerha@brailcom.cz> */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <stdarg.h>
-#include "config.h"
-#include <libspeechd.h>
-#include "plugin.h"
-#include "speech.h"
-
-struct speech_priv {
- SPDConnection *conn;
-};
-
-static int
-speechd_say(struct speech_priv *this, const char *text) {
- int err;
-
- err = spd_sayf(this->conn, SPD_MESSAGE, text);
- if (err != 1)
- return 1;
- return 0;
-}
-
-static void
-speechd_destroy(struct speech_priv *this) {
- spd_close(this->conn);
- g_free(this);
-}
-
-static struct speech_methods speechd_meth = {
- speechd_destroy,
- speechd_say,
-};
-
-static struct speech_priv *
-speechd_new(char *data, struct speech_methods *meth) {
- struct speech_priv *this;
- SPDConnection *conn;
-
- conn = spd_open("navit","main",NULL,SPD_MODE_SINGLE);
- if (! conn)
- return NULL;
- this=g_new(struct speech_priv,1);
- if (this) {
- this->conn=conn;
- *meth=speechd_meth;
- spd_set_punctuation(conn, SPD_PUNCT_NONE);
- }
- return this;
-}
-
-
-void
-plugin_init(void)
-{
- plugin_register_speech_type("speech_dispatcher", speechd_new);
-}
diff --git a/navit/tools/gpx2navit_txt/README b/navit/tools/gpx2navit_txt/README
deleted file mode 100644
index afa98531..00000000
--- a/navit/tools/gpx2navit_txt/README
+++ /dev/null
@@ -1,117 +0,0 @@
-==============
-gpx2navit_txt README
-==============
-bodenseepingu
-4/01/2008
-
-What's This
-===========
- gpx2navit_txt is a converter from GPX file to Navit Text map format
-
-For gpx2navit_txt was the original code from gpx2shp used and modified.
-This is a output of Metro Manila Transit Map Project by JOCV (Japan
-Overseas Cooperation Volunteers) program of JICA (Japan International
-Cooperation Agency in 2004. It is provided you on GPL2.
-
-
-How to Use
-==========
-- Basic
- There are three types of data on GPX that are waypoint, trkpoint and
-route. gpx2navit_txt converts the data to navit file(s)
-Please try to convert a sample file "pinatest2.gpx" in this archive.
-
- prompt> gpx2navit_txt pinatest2.gpx
- prompt> ls
- pinatest2.gpx (source gpx)
- pinatest2_meta.txt (meta data may be there)
-
- You can convert only a certain type of data like only waypoint or
-track point using option '-w' (waypoint), '-t' (trackpoint) or '-r'
-(route).
-
- prompt> gpx2navit_txt -r pinatest2.gpx
-
-- Convert path data to points and etc
- As default, track point and route data is converted as a arc data but
-you can convert it other ways using option '-p'(convert as point) and
-'-e' (as edge). The edge file has '_edg' in the filename and the point
-file has '_pnt' in the filename.
-
- prompt> gpx2navit_txt -p -e pinatest2.gpx
-
-- Statistics
- If you add '-s' option you can see a conversion summery.
-
- prompt> gpx2navit_txt -s pinatest2.gpx
- Track Points:
- track count: 4
- point count: 658
- total length: 156565.627989
- unconverted: 0( 0.00%)
- Routes:
- route count: 1
- point count: 323
- total length: 9258.618971
- unconverted: 0( 0.00%)
- Waypoints:
- point count: 118
-
-- Noise reduction
- gpx2navit_txt has several thresholds to reduct the noise path data. The
-value can set as '--min-points', '--min-length' and '--min-time'. Please
-try a example below.
-
- prompt> gpx2navit_txt --min-points 6 -s pinatest2.gpx
- gpx2navit_txt:../pinatest3.gpx:3962 track was not converted because of
- less then 6 points. (<- this path is not converted because the path
- has only 5 points)
- Track Points:
- track count: 3
- point count: 653
- total length: 156439.490642
- unconverted: 1(25.00%)
- Routes:
- route count: 1
- point count: 323
- total length: 9258.618971
- unconverted: 0( 0.00%)
- Waypoints:
- point count: 118
-
-
-- Length and time units
- You can choose any length related units that are supported by proj4
-for attribute table using
- '--length-unit' (for length column, default: m),
- '--time-unit' (for time column, default: sec),
- '--speed-length-unit' (for speed column, default: km),
- '--speed-time-unit' (for speed column, default: hour) and
- '--length-ellipsoid' (for length calculation, default: UGS84).
- You can see the supported units by 'geod -lu' and 'geod -le' command.
- Supported time unit are 'sec', 'min', 'hour' and 'day'.
-
-- Other futures
- There are other futures in gpx2navit_txt. Please check the option list using
-
- gpx2navit_txt --help
-
-Problem or Suggestion
-=====================
-Please let me know about your opinion in English by e-mail.
- bodenseepingu at users.sourceforge.net
- navit on sourceforge.net
- http://gpx2shp.sourceforge.jp/ for original gpx2shp
- todo for gpx2navit_txt
-
-Acknowledgments
-===============
-NEDA (National Economic and Development Authority) Region IV-B office
- My generous counter part
-Yoshio Tanaka
- My project leader gpx2shp
-Petter Reinholdtsen
- Many support to develop this
-Frank Warmerdam and the team
- shapelib and proj4
-bodenseepingu for modifications towards navit
diff --git a/navit/tools/gpx2navit_txt/src/elementControl.c b/navit/tools/gpx2navit_txt/src/elementControl.c
deleted file mode 100644
index 40bbe44c..00000000
--- a/navit/tools/gpx2navit_txt/src/elementControl.c
+++ /dev/null
@@ -1,226 +0,0 @@
-#include "gpx2navit_txt.h"
-
-void startElementControl(parsedata * pdata, const char *element,
- const char **attr);
-void endElementControl(parsedata * pdata, const char *element);
-
-/*
- * This method controls tag start event.
- * It corrects attributes.
- */
-void
-startElementControl(parsedata * pdata, const char *element,
- const char **attr)
-{
- int i;
- static int isFirstTrk = 1;
- static int isFirstRte = 1;
- static int isFirstPathpt = 1;
- for (i = 0; attr[i]; i += 2) {
- if (!strcmp(attr[i], "lon")) {
- pdata->attr->lon = atof(attr[i + 1]);
- }
- if (!strcmp(attr[i], "lat")) {
- pdata->attr->lat = atof(attr[i + 1]);
- }
- if (!strcmp(attr[i], "minlon")) {
- pdata->attr->minlon = atof(attr[i + 1]);
- }
- if (!strcmp(attr[i], "minlat")) {
- pdata->attr->minlat = atof(attr[i + 1]);
- }
- if (!strcmp(attr[i], "maxlon")) {
- pdata->attr->maxlon = atof(attr[i + 1]);
- }
- if (!strcmp(attr[i], "maxlat")) {
- pdata->attr->maxlat = atof(attr[i + 1]);
- }
- if (!strcmp(attr[i], "author")) {
- strcpy(pdata->attr->author, attr[i + 1]);
- }
- }
- if (pdata->prop->parseTrk) {
- if (!strcmp(element, "trk")) {
- if (isFirstTrk) {
- isFirstTrk = 0;
- }
- }
- if (!strcmp(element, "trkseg")) {
- isFirstPathpt = 1;
- }
- if (!strcmp(element, "trkpt")) {
- if (isFirstPathpt) {
- initPathAttr(pdata->pattr, pdata->attr);
- isFirstPathpt = 0;
- }
- }
- }
- if (pdata->prop->parseRte) {
- if (!strcmp(element, "rte")) {
- if (isFirstRte) {
- isFirstRte = 0;
- isFirstPathpt = 1;
- }
- }
- if (!strcmp(element, "rtept")) {
- if (isFirstPathpt) {
- initPathAttr(pdata->pattr, pdata->attr);
- isFirstPathpt = 0;
- }
- }
- }
-}
-
-/**
- * This method is kicked by tag end event.
- * It corrects char elements when the element tag has some data,
- * then start to convert when tag is top level tag like <wpt>.
- */
-void endElementControl(parsedata * pdata, const char *element)
-{
- static int isFirstWpt = 1;
- static int isFirstTrkAsPoint = 1;
- static int isFirstRteAsPoint = 1;
- /* common elements */
- if (!strcmp(element, "name")) {
- strcpy(pdata->attr->name, pdata->databuf);
- }
- if (!strcmp(element, "cmt")) {
- strcpy(pdata->attr->cmt, pdata->databuf);
- }
- if (!strcmp(element, "desc")) {
- strcpy(pdata->attr->desc, pdata->databuf);
- }
- if (!strcmp(element, "src")) {
- strcpy(pdata->attr->src, pdata->databuf);
- }
- if (!strcmp(element, "link")) {
- strcpy(pdata->attr->link, pdata->databuf);
- }
- if (!strcmp(element, "type")) {
- strcpy(pdata->attr->type, pdata->databuf);
- }
- /* waypoint and metadata elements */
- if (!strcmp(element, "time")) {
- strcpy(pdata->attr->time, pdata->databuf);
- }
- /* route and track point elements */
- if (!strcmp(element, "number")) {
- pdata->attr->number = atoi(pdata->databuf);
- }
- /* waypoint elements */
- if (!strcmp(element, "ele")) {
- pdata->attr->ele = atof(pdata->databuf);
- }
- if (!strcmp(element, "magvar")) {
- pdata->attr->magvar = atof(pdata->databuf);
- }
- if (!strcmp(element, "geoidheight")) {
- pdata->attr->geoidheight = atof(pdata->databuf);
- }
- if (!strcmp(element, "sym")) {
- strcpy(pdata->attr->sym, pdata->databuf);
- }
- if (!strcmp(element, "fix")) {
- strcpy(pdata->attr->fix, pdata->databuf);
- }
- if (!strcmp(element, "sat")) {
- pdata->attr->sat = atoi(pdata->databuf);
- }
- if (!strcmp(element, "hdop")) {
- pdata->attr->hdop = atof(pdata->databuf);
- }
- if (!strcmp(element, "vdop")) {
- pdata->attr->vdop = atof(pdata->databuf);
- }
- if (!strcmp(element, "pdop")) {
- pdata->attr->pdop = atof(pdata->databuf);
- }
- if (!strcmp(element, "ageofdgpsdata")) {
- pdata->attr->ageofdgpsdata = atof(pdata->databuf);
- }
- /* metadata elements */
- if (!strcmp(element, "author")) {
- strcpy(pdata->attr->author, pdata->databuf);
- }
- if (!strcmp(element, "keywords")) {
- strcpy(pdata->attr->keywords, pdata->databuf);
- }
- if (!strcmp(element, "copyright")) {
- strcpy(pdata->attr->copyright, pdata->databuf);
- }
- if (!strcmp(element, "year")) {
- pdata->attr->year = atoi(pdata->databuf);
- }
- if (!strcmp(element, "license")) {
- strcpy(pdata->attr->license, pdata->databuf);
- }
- if (!strcmp(element, "bounds")) {
- /* none */
- }
- /* top elements */
- /* set waypoint data */
- if (!strcmp(element, "wpt")) {
- if (pdata->prop->parseWpt) {
- if (isFirstWpt) {
- isFirstWpt = 0;
- }
- //todo
- if (DEBUG) {
- fprintf(stderr,"\neectrl wpt %s %s",
- pdata->attr->desc,pdata->attr->name);
- }
- setWpt(pdata);
- wipeAttr(pdata->attr);
- }
- }
- /* set trackpoint data */
- if (!strcmp(element, "trkpt")) {
- if (pdata->prop->parseTrk) {
- setPathData(pdata->pattr, pdata->attr);
- if (!pdata->prop->isFast)
- setPathInterval(pdata);
- }
- /* set trackpoint data as point */
- if (pdata->prop->isPoint) {
- if (isFirstTrkAsPoint) {
- isFirstTrkAsPoint = 0;
- }
- setWpt(pdata);
- }
- wipeAttr(pdata->attr);
- }
- /* write trackpoint */
- if (!strcmp(element, "trkseg")) {
- if (pdata->prop->parseTrk) {
- setPath( pdata);
- }
- }
- /* set route data */
- if (!strcmp(element, "rtept")) {
- if (pdata->prop->parseRte) {
- setPathData(pdata->pattr, pdata->attr);
- if (!pdata->prop->isFast)
- setPathInterval(pdata);
- }
- /* set route data as point */
- if (pdata->prop->isPoint) {
- if (isFirstRteAsPoint) {
- isFirstRteAsPoint = 0;
- }
- setWpt( pdata);
- }
- wipeAttr(pdata->attr);
- }
- /* write route */
- if (!strcmp(element, "rte")) {
- if (pdata->prop->parseRte) {
- setPath( pdata);
- }
- }
- if (!strcmp(element, "metadata")) {
- setMetadata(pdata);
- wipeAttr(pdata->attr);
- }
- pdata->bufptr = NULL; //reset bufptr now
-}
diff --git a/navit/tools/gpx2navit_txt/src/emess.h b/navit/tools/gpx2navit_txt/src/emess.h
deleted file mode 100644
index b35bc250..00000000
--- a/navit/tools/gpx2navit_txt/src/emess.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Error message processing header file */
-#ifndef EMESS_H
-#define EMESS_H
-
-#ifndef lint
-/*static char EMESS_H_ID[] = "@(#)emess.h 4.1 93/03/08 GIE REL";*/
-#endif
-
-struct EMESS {
- char *File_name, /* input file name */
- *Prog_name; /* name of program */
- int File_line; /* approximate line read
- where error occured */
-};
-
-#ifdef EMESS_ROUTINE /* use type */
-/* for emess procedure */
-struct EMESS emess_dat = { (char *)0, (char *)0, 0 };
-
-#ifdef sun /* Archaic SunOs 4.1.1, etc. */
-extern char *sys_errlist[];
-#define strerror(n) (sys_errlist[n])
-#endif
-
-#else /* for for calling procedures */
-
-extern struct EMESS emess_dat;
-void emess(int, char *, ...);
-
-#endif /* use type */
-
-#endif /* end EMESS_H */
diff --git a/navit/tools/gpx2navit_txt/src/errorcode.h b/navit/tools/gpx2navit_txt/src/errorcode.h
deleted file mode 100644
index efaf88d8..00000000
--- a/navit/tools/gpx2navit_txt/src/errorcode.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef ERRORCODE_H
-#define ERRORCODE_H
-
-/* os level */
-#define ERR_OUTOFMEMORY 11
-#define ERR_CANNOTOPEN 12
-#define ERR_CREATEFILE 13
-#define ERR_READERROR 14
-#define ERR_FREEFAILED 15
-/* option */
-#define ERR_NOARGS 21
-#define ERR_WRONGOPTION 22
-#define ERR_OPTIONCONFRICT 23
-/* parser */
-#define ERR_ISNOTGPX 31
-#define ERR_PARSEERROR 32
-/* unit */
-#define ERR_ELLPSUNIT 41
-#define ERR_LENGTHUNIT 42
-#define ERR_TIMEUNIT 43
-
-#endif /* ERRORCODE_H */
diff --git a/navit/tools/gpx2navit_txt/src/geod_for.c b/navit/tools/gpx2navit_txt/src/geod_for.c
deleted file mode 100644
index 4466a1d2..00000000
--- a/navit/tools/gpx2navit_txt/src/geod_for.c
+++ /dev/null
@@ -1,108 +0,0 @@
-#ifndef lint
-static const char SCCSID[] =
- "@(#)geod_for.c 4.6 95/09/23 GIE REL";
-#endif
-# include "projects.h"
-# include "geodesic.h"
-# define MERI_TOL 1e-9
-static double th1, costh1, sinth1, sina12, cosa12, M, N, c1, c2, D, P, s1;
-static int merid, signS;
-void geod_pre(void)
-{
- al12 = adjlon(al12); /* reduce to +- 0-PI */
- signS = fabs(al12) > HALFPI ? 1 : 0;
- th1 = ellipse ? atan(onef * tan(phi1)) : phi1;
- costh1 = cos(th1);
- sinth1 = sin(th1);
- if ((merid = fabs(sina12 = sin(al12)) < MERI_TOL)) {
- sina12 = 0.;
- cosa12 = fabs(al12) < HALFPI ? 1. : -1.;
- M = 0.;
- } else {
- cosa12 = cos(al12);
- M = costh1 * sina12;
- }
- N = costh1 * cosa12;
- if (ellipse) {
- if (merid) {
- c1 = 0.;
- c2 = f4;
- D = 1. - c2;
- D *= D;
- P = c2 / D;
- } else {
- c1 = geod_f * M;
- c2 = f4 * (1. - M * M);
- D = (1. - c2) * (1. - c2 - c1 * M);
- P = (1. + .5 * c1 * M) * c2 / D;
- }
- }
- if (merid)
- s1 = HALFPI - th1;
- else {
- s1 = (fabs(M) >= 1.) ? 0. : acos(M);
- s1 = sinth1 / sin(s1);
- s1 = (fabs(s1) >= 1.) ? 0. : acos(s1);
- }
-}
-void geod_for(void)
-{
- double d, sind, u, V, X, ds, cosds, sinds, ss = 0, de;
-
- if (ellipse) {
- d = geod_S / (D * geod_a);
- if (signS)
- d = -d;
- u = 2. * (s1 - d);
- V = cos(u + d);
- X = c2 * c2 * (sind = sin(d)) * cos(d) * (2. * V * V - 1.);
- ds = d + X - 2. * P * V * (1. - 2. * P * cos(u)) * sind;
- ss = s1 + s1 - ds;
- } else {
- ds = geod_S / geod_a;
- if (signS)
- ds = -ds;
- }
- cosds = cos(ds);
- sinds = sin(ds);
- if (signS)
- sinds = -sinds;
- al21 = N * cosds - sinth1 * sinds;
- if (merid) {
- phi2 = atan(tan(HALFPI + s1 - ds) / onef);
- if (al21 > 0.) {
- al21 = PI;
- if (signS)
- de = PI;
- else {
- phi2 = -phi2;
- de = 0.;
- }
- } else {
- al21 = 0.;
- if (signS) {
- phi2 = -phi2;
- de = 0;
- } else
- de = PI;
- }
- } else {
- al21 = atan(M / al21);
- if (al21 > 0)
- al21 += PI;
- if (al12 < 0.)
- al21 -= PI;
- al21 = adjlon(al21);
- phi2 = atan(-(sinth1 * cosds + N * sinds) * sin(al21) /
- (ellipse ? onef * M : M));
- de = atan2(sinds * sina12,
- (costh1 * cosds - sinth1 * sinds * cosa12));
- if (ellipse) {
- if (signS)
- de += c1 * ((1. - c2) * ds + c2 * sinds * cos(ss));
- else
- de -= c1 * ((1. - c2) * ds - c2 * sinds * cos(ss));
- }
- }
- lam2 = adjlon(lam1 + de);
-}
diff --git a/navit/tools/gpx2navit_txt/src/geod_inv.c b/navit/tools/gpx2navit_txt/src/geod_inv.c
deleted file mode 100644
index d938da8a..00000000
--- a/navit/tools/gpx2navit_txt/src/geod_inv.c
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifndef lint
-static const char SCCSID[] =
- "@(#)geod_inv.c 4.5 95/09/23 GIE REL";
-#endif
-# include "projects.h"
-# include "geodesic.h"
-# define DTOL 1e-12
-void geod_inv(void)
-{
- double th1,
- th2,
- thm,
- dthm,
- dlamm,
- dlam,
- sindlamm,
- costhm,
- sinthm,
- cosdthm,
- sindthm, L, E, cosd, d, X, Y, T, sind, tandlammp, u, v, D, A, B;
-
- if (ellipse) {
- th1 = atan(onef * tan(phi1));
- th2 = atan(onef * tan(phi2));
- } else {
- th1 = phi1;
- th2 = phi2;
- }
- thm = .5 * (th1 + th2);
- dthm = .5 * (th2 - th1);
- dlamm = .5 * (dlam = adjlon(lam2 - lam1));
- if (fabs(dlam) < DTOL && fabs(dthm) < DTOL) {
- al12 = al21 = geod_S = 0.;
- return;
- }
- sindlamm = sin(dlamm);
- costhm = cos(thm);
- sinthm = sin(thm);
- cosdthm = cos(dthm);
- sindthm = sin(dthm);
- L = sindthm * sindthm + (cosdthm * cosdthm - sinthm * sinthm)
- * sindlamm * sindlamm;
- d = acos(cosd = 1 - L - L);
- if (ellipse) {
- E = cosd + cosd;
- sind = sin(d);
- Y = sinthm * cosdthm;
- Y *= (Y + Y) / (1. - L);
- T = sindthm * costhm;
- T *= (T + T) / L;
- X = Y + T;
- Y -= T;
- T = d / sind;
- D = 4. * T * T;
- A = D * E;
- B = D + D;
- geod_S = geod_a * sind * (T - f4 * (T * X - Y) +
- f64 * (X * (A + (T - .5 * (A - E)) * X) -
- Y * (B + E * Y) + D * X * Y));
- tandlammp = tan(.5 * (dlam - .25 * (Y + Y - E * (4. - X)) *
- (f2 * T + f64 * (32. * T - (20. * T - A)
- * X - (B +
- 4.) * Y)) *
- tan(dlam)));
- } else {
- geod_S = geod_a * d;
- tandlammp = tan(dlamm);
- }
- u = atan2(sindthm, (tandlammp * costhm));
- v = atan2(cosdthm, (tandlammp * sinthm));
- al12 = adjlon(TWOPI + v - u);
- al21 = adjlon(TWOPI - v - u);
-}
diff --git a/navit/tools/gpx2navit_txt/src/geod_set.c b/navit/tools/gpx2navit_txt/src/geod_set.c
deleted file mode 100644
index 1ba2ef42..00000000
--- a/navit/tools/gpx2navit_txt/src/geod_set.c
+++ /dev/null
@@ -1,95 +0,0 @@
-#ifndef lint
-/*
- * static const char SCCSID[]="@(#)geod_set.c 4.8 95/09/23 GIE REL";
- */
-#endif
-
-#define _IN_GEOD_SET
-
-#include <string.h>
-#include "projects.h"
-#include "geodesic.h"
-#include "emess.h"
-void geod_set(int argc, char **argv)
-{
- paralist *start = 0, *curr = NULL; /* added NULL */
- double es;
- char *name;
- int i;
-
-/*
- * put arguments into internal linked list
- */
- if (argc <= 0)
- emess(1, "no arguments in initialization list");
- for (i = 0; i < argc; ++i)
- if (i)
- curr = curr->next = pj_mkparam(argv[i]);
- else
- start = curr = pj_mkparam(argv[i]);
-/*
- * set elliptical parameters
- */
- if (pj_ell_set(start, &geod_a, &es))
- emess(1, "ellipse setup failure");
-/*
- * set units
- */
- if ((name = pj_param(start, "sunits").s)) { /* added parentheses */
- char *s;
-
- for (i = 0; (s = pj_units[i].id) && strcmp(name, s); ++i);
- if (!s)
- emess(1, "%s unknown unit conversion id", name);
- fr_meter = 1. / (to_meter = atof(pj_units[i].to_meter));
- } else
- to_meter = fr_meter = 1.;
- if ((ellipse = es != 0.)) { /* added parentheses */
- onef = sqrt(1. - es);
- geod_f = 1 - onef;
- f2 = geod_f / 2;
- f4 = geod_f / 4;
- f64 = geod_f * geod_f / 64;
- } else {
- onef = 1.;
- geod_f = f2 = f4 = f64 = 0.;
- }
-/*
- * check if line or arc mode
- */
- if (pj_param(start, "tlat_1").i) {
- double del_S;
-#undef f
- phi1 = pj_param(start, "rlat_1").f;
- lam1 = pj_param(start, "rlon_1").f;
- if (pj_param(start, "tlat_2").i) {
- phi2 = pj_param(start, "rlat_2").f;
- lam2 = pj_param(start, "rlon_2").f;
- geod_inv();
- geod_pre();
- } else if ((geod_S = pj_param(start, "dS").f)) { /* added
- * parentheses
- */
- al12 = pj_param(start, "rA").f;
- geod_pre();
- geod_for();
- } else
- emess(1, "incomplete geodesic/arc info");
- if ((n_alpha = pj_param(start, "in_A").i) > 0) {
- if (!(del_alpha = pj_param(start, "rdel_A").f))
- emess(1, "del azimuth == 0");
- } else if ((del_S = fabs(pj_param(start, "ddel_S").f))) { /* added
- * parentheses
- */
- n_S = geod_S / del_S + .5;
- } else if ((n_S = pj_param(start, "in_S").i) <= 0)
- emess(1, "no interval divisor selected");
- }
-/*
- * free up linked list
- */
- for (; start; start = curr) {
- curr = start->next;
- pj_dalloc(start);
- }
-}
diff --git a/navit/tools/gpx2navit_txt/src/geodesic.h b/navit/tools/gpx2navit_txt/src/geodesic.h
deleted file mode 100644
index b9aa853d..00000000
--- a/navit/tools/gpx2navit_txt/src/geodesic.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef lint
-/*static char GEODESIC_H_ID[] = "@(#)geodesic.h 4.3 95/08/19 GIE REL"; */
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _IN_GEOD_SET
-# define GEOD_EXTERN extern
-#else
-# define GEOD_EXTERN
-#endif
-
-GEOD_EXTERN struct geodesic {
- double A;
- double LAM1, PHI1, ALPHA12;
- double LAM2, PHI2, ALPHA21;
- double DIST;
- double ONEF, FLAT, FLAT2, FLAT4, FLAT64;
- int ELLIPSE;
-} GEODESIC;
-
-# define geod_a GEODESIC.A
-# define lam1 GEODESIC.LAM1
-# define phi1 GEODESIC.PHI1
-# define al12 GEODESIC.ALPHA12
-# define lam2 GEODESIC.LAM2
-# define phi2 GEODESIC.PHI2
-# define al21 GEODESIC.ALPHA21
-# define geod_S GEODESIC.DIST
-# define geod_f GEODESIC.FLAT
-# define onef GEODESIC.ONEF
-# define f2 GEODESIC.FLAT2
-# define f4 GEODESIC.FLAT4
-# define ff2 GEODESIC.FLAT4
-# define f64 GEODESIC.FLAT64
-# define ellipse GEODESIC.ELLIPSE
-
-
-GEOD_EXTERN int n_alpha, n_S;
-GEOD_EXTERN double to_meter, fr_meter, del_alpha;
-
-void geod_set(int, char **);
-void geod_for(void);
-void geod_pre(void);
-void geod_inv(void);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/navit/tools/gpx2navit_txt/src/gpx2navit_txt.h b/navit/tools/gpx2navit_txt/src/gpx2navit_txt.h
deleted file mode 100644
index cd4b5e49..00000000
--- a/navit/tools/gpx2navit_txt/src/gpx2navit_txt.h
+++ /dev/null
@@ -1,273 +0,0 @@
-#ifndef GPX2SHP_H_INCLUDED
-#define GPX2SHP_H_INCLUDED
-
-#define PROG gpx2navit_txt
-#define FILENAMELENGTH 255 /* 255 is max length for dbf string column */
-#define COMMENTLENGTH 255 /* 255 is max length for dbf string column */
-#define NAMELENGTH 32
-#define TIMELENGTH 32
-#define TYPELENGTH 16
-#define BUFFSIZE 8192
-#define DATABUFSIZE 16
-#define failToWriteAttr(S, T) failToWriteAttrRep((S), (T),__FILE__, __LINE__ )
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <libgen.h>
-#include <getopt.h>
-#include <time.h>
-#include <assert.h>
-#include <expat.h>
-#include "errorcode.h"
-//#include "shapefil.h"
-
-
-#define DEBUG 0
-/**
- * make xml parent and child list
- */
-typedef struct parent {
- char *name; /** element name */
- struct parent *parentptr;
- /** parent pointer */
-} parent;
-
-/**
- * set attribute columns on/off
- */
-typedef struct g2scolumns {
-/**
- * each member corresponds to attribute column of attribute table
- */
- int name;
- int cmt;
- int desc;
- int src;
- int link;
- int type;
- int time;
- int number;
- int ele;
- int magvar;
- int geoidheight;
- int sym;
- int fix;
- int sat;
- int hdop;
- int vdop;
- int pdop;
- int ageofdgpsdata;
- int dgpsid;
- int length;
- int interval;
- int speed;
- int points;
- int gpxline;
-} g2scolumns;
-
-/**
- * store each path attribute values for trackpoint and route.
- */
-typedef struct pathattr {
- char name[NAMELENGTH];
- char cmt[COMMENTLENGTH];
- char desc[COMMENTLENGTH];
- char src[COMMENTLENGTH];
- char link[FILENAMELENGTH];
- int number;
- char type[TYPELENGTH];
- double length;
- double interval;
- double speed;
- /*
- double *x;
- double *y;
- double *z;
- */
- double *point;
- int count;
-} pathattr;
-
-/**
- * store each point attribute values.
- */
-typedef struct g2sattr {
-/**
- * the structure cames from GPX1.1 format
- */
- double lon;
- double lat;
- double minlon;
- double minlat;
- double maxlon;
- double maxlat;
- char name[NAMELENGTH];
- char cmt[COMMENTLENGTH];
- char desc[COMMENTLENGTH];
- char src[COMMENTLENGTH];
- char link[FILENAMELENGTH];
- char type[TYPELENGTH];
- char time[TIMELENGTH];
- int number;
- double ele;
- double magvar;
- double geoidheight;
- char sym[NAMELENGTH];
- char fix[NAMELENGTH];
- int sat;
- double hdop;
- double vdop;
- double pdop;
- double ageofdgpsdata;
- int dgpsid;
- char author[NAMELENGTH];
- char keywords[NAMELENGTH];
- char copyright[NAMELENGTH];
- int year;
- char license[NAMELENGTH];
-} g2sattr;
-
-/**
- * statistics structure
- */
-typedef struct g2sstats {
- int trkpoints; /** track point total count */
- int trkcount; /** track path total count */
- double trklength; /** track total length */
- int rtepoints; /** route point total count */
- int rtecount; /** route path totol count */
- double rtelength; /** route total length */
- int wptpoints; /** way point total count */
- int trkunconverted; /** unconverted track path count */
- int rteunconverted; /** unconverted route path count */
-} g2sstats;
-
-/**
- * cluster of all dbfhandles
- */
-//typedef struct dbfhandles {
-// DBFHandle trk; /** for track */
-// DBFHandle wpt; /** for waypoint */
-// DBFHandle rte; /** for route */
-// DBFHandle trk_edg; /** for track each edge */
-// DBFHandle trk_pnt; /** for track each point */
-// DBFHandle rte_edg; /** for route each edge */
-// DBFHandle rte_pnt; /** for route each point */
-//} dbfhandles;
-
-/**
- * cluster of all shphandles
- */
-//typedef struct shphandles {
-// SHPHandle trk; /** for track */
-// SHPHandle wpt; /** for waypoint */
-// SHPHandle rte; /** for route */
-// SHPHandle trk_edg; /** for track each edge */
-// SHPHandle trk_pnt; /** for track each point */
-// SHPHandle rte_edg; /** for route each edge */
-// SHPHandle rte_pnt; /** for route each point */
-//} shphandles;
-
-/**
- * propaties structure for gpx2navit_txt
- */
-typedef struct g2sprop {
- int parseWpt; /** convert waypoint data or not */
- int parseTrk; /** convert track data or not */
- int parseRte; /** convert route data or not */
- int is3d; /** using 3D mode */
- int isEdge; /** convert path data as each separated path */
- int isPoint; /** convert path data as point */
- int isFast; /** fast mode that skips path check */
- int needsStats; /** shows statistics at last */
- int minpoints; /** minimum points to convert as a path */
- int minlength; /** minimum length to convert as a path */
- int mintime; /** minimum time to convert as a path */
- int verbose; /** verbose mode on/off */
- char *sourcefile; /** source .gpx file */
- char *output; /** output file base name */
- char *ellipsoid; /** ellipsoid type to calculate length */
- char *lengthUnit; /** length unit for attributes*/
- double length2meter;/** meter value of lenght unit */
- char *timeUnit; /** time unit for attributes */
- double time2sec; /** value to convert time unit to second */
- char *speedLengthUnit;
- /** lenght unit to calculate speed*/
- double speed2meter; /** meter value of speedLengthUnit */
- char *speedTimeUnit;/** time unit to calculate speed */
- int speed2sec; /** value to convert speedTimeUnit to seconde */
- g2sstats *stats; /** convert statistics */
- g2scolumns *cols; /** attribute table column switch */
-} g2sprop;
-
-/**
- * userdata structure between expat methods
- */
-typedef struct parsedata {
- int depth; /** xml path depth */
- char *databuf; /** character buffer in tags */
- char *bufptr; /** pointer to databuf to add '\0' to databuf */
- int failed; /** xml parse failed flag */
- int failedid; /** xml parse failed id */
- XML_Parser parser; /** xml parser itself*/
- parent *parent; /** pointer to parent node */
- parent *current; /** pointer to current node */
- FILE *fp; /** File handle to write out data points*/
-// shphandles *shps; /** .shp file cluster that is used in this program */
-// dbfhandles *dbfs; /** .dbf file cluster that is used in this program */
- g2sattr *attr; /** each point attributes */
- pathattr *pattr; /** each path attributes */
- g2sprop *prop; /** propaties for this program */
-} parsedata;
-
-/* utils.c */
-void checkEllpsUnit(char *unit);
-double checkLengthUnit(char *unit);
-int checkTimeUnit(char *unit);
-double getTimeInterval(char *_t, char *t);
-double getSpeed(double length, double ti, double to_meter, int to_sec);
-double getDistance(double _x, double _y, double x, double y);
-//void closeShpFiles(shphandles * shps);
-//void closeDbfFiles(dbfhandles * dbfs);
-void *myMallocRep(size_t size, const char *fileName, int line);
-
-/* misc.c */
-void failToWriteAttrRep(int iShape, int col, char *file, int line);
-void showStats(g2sprop * prop);
-void wipePathAttr(pathattr * pattr);
-pathattr *createPathAttr(void);
-void wipeAttr(g2sattr * attr);
-void setColsDefault(g2scolumns * cols);
-g2scolumns *createCols(void);
-g2sattr *createAttr(void);
-g2sprop *createProp(void);
-void closeProp(g2sprop * prop);
-//shphandles *createShps(void);
-//dbfhandles *createDbfs(void);
-parsedata *createParsedata(XML_Parser parser, g2sprop * prop);
-void closeParsedata(parsedata * pdata);
-
-/* parser.c */
-void parseMain(g2sprop * pr);
-
-/* elementControl.c */
-void startElementControl(parsedata * pdata, const char *element,
- const char **attr);
-void endElementControl(parsedata * pdata, const char *element);
-
-/* setwpt.c */
-void setWpt( parsedata * pdata);
-
-/* setpath.c */
-void initPathAttr(pathattr * pattr, g2sattr * attr);
-void setPathInterval(parsedata *pdata);
-void setPathData(pathattr * parrt, g2sattr * attr);
-void setPath( parsedata * pdata);
-
-/* setmetadata.c */
-void setMetadata(parsedata * pdata);
-
-#endif
diff --git a/navit/tools/gpx2navit_txt/src/main.c b/navit/tools/gpx2navit_txt/src/main.c
deleted file mode 100644
index af8df875..00000000
--- a/navit/tools/gpx2navit_txt/src/main.c
+++ /dev/null
@@ -1,389 +0,0 @@
-#include "gpx2navit_txt.h"
-#include "geodesic.h"
-
-void version(void);
-void usage(char **argv);
-void setDefault(g2sprop * prop);
-void setOptions(int argc, char **argv, g2sprop * prop);
-
-/**
- * Shows a version
- */
-void version(void)
-{
- fprintf(stdout, "gpx2navit_txt 0.1\n");
- fprintf(stdout, "\n");
- fprintf(stdout, "by Toshihiro Hiraoka\n");
- fprintf(stdout, " Petter Reinholdtsen\n");
-}
-
-/**
- * Shows a usage message
- */
-void usage(char **argv)
-{
- fprintf(stdout, "Usage: %s gpxfile [options] [-o output basename]\n",
- argv[0]);
- fprintf(stdout,
- "-o, --output Sets output basename. The default is (source file\n");
- fprintf(stdout, " name) - (extention name)\n");
- fprintf
- (stdout,
- "-w, --waypoints Converts only waypoints data from a gpx file.\n");
- fprintf(stdout,
- "-t, --trackpoints Converts only trackpoints data from a gpx file.\n");
- fprintf(stdout,
- "-r, --routes Converts only routes data from a gpx file.\n");
- fprintf(stdout,
- "-a, --all Converts all types of data from a gpx file.(default)\n");
- fprintf(stdout,
- "-e, --as-edge Makes a separated output by each edges.\n");
- fprintf(stdout,
- "-p, --as-point Makes a separated output by each points.\n");
- fprintf(stdout,
- "-s, --stats Shows simple statistics of the outputs.\n");
- fprintf(stdout,
- "-b, --basic-columns Stores only basic data as attribures to \n");
- fprintf(stdout,
- " reduce memory and storage usage.\n");
- fprintf(stdout,
- " (ele, name, cmt, type, time, fix, sym and number).\n");
- fprintf(stdout,
- "-L, --no-length Removes length column from a waypoint or trackpoint\n");
- fprintf(stdout, " attribute table.\n");
- fprintf
- (stdout,
- "-S, --no-speed Removes speed column from a waypoint or trackpoint\n");
- fprintf(stdout, " attribute table.\n");
- fprintf
- (stdout,
- "-T, --no-time Removes time column from an attribute table.\n");
- fprintf(stdout,
- "-g, --gpxline Adds line number of GPX file as attribures.\n");
- fprintf
- (stdout,
- "-f, --fast Make it faster without any checks.\n");
- fprintf(stdout,
- "-3, --3d Converts data using 3d format. (It's not compatible\n");
- fprintf(stdout, " for Arcview 3.x.)\n");
- fprintf(stdout,
- " --min-points Sets path minimum points to convert for noise reduction.\n");
- fprintf(stdout, " Default is 2.\n");
- fprintf(stdout,
- " --min-length Sets path minimum length to convert for noise reduction.\n");
- fprintf(stdout, " Default is 0.\n");
- fprintf(stdout,
- " --min-time Sets path minimum time period to convert for noise\n");
- fprintf(stdout, " reduction.\n");
- fprintf(stdout, " Default is 0.\n");
- fprintf(stdout,
- " --length-unit Sets length unit from m,km,feet,mi and etc.\n");
- fprintf(stdout, " The default is m.\n");
- fprintf(stdout,
- " You can see the unit list from \"geod -lu\" command.\n");
- fprintf
- (stdout,
- " --time-unit Sets time unit. The default is sec.\n");
- fprintf(stdout,
- " You can set from day, hour, min and sec.\n");
- fprintf(stdout,
- " --speed-length-unit Sets length unit for speed.\n");
- fprintf(stdout, " The default is km.\n");
- fprintf(stdout,
- " You can see the unit list from \"geod -lu\" command.\n");
- fprintf(stdout,
- " --speed-time-unit Sets time unit for speed calulation. Default is hour.\n");
- fprintf(stdout,
- " You can set from day, hour, min and sec.\n");
- fprintf(stdout,
- " --length-ellipsoid Sets length ellipsoid like UGS84, clrk66. The default is\n");
- fprintf(stdout, " UGS84.\n");
- fprintf
- (stdout,
- " You can see the unit list from \"geod -le\" command.\n");
- fprintf(stdout, "-v, --verbose Gives many messages.\n");
- fprintf(stdout, " --version Shows version.\n");
- fprintf(stdout, "-h, --help Shows this list.\n");
-}
-
-/**
- * Sets default values to the properties when there is no user setting.
- */
-void setDefault(g2sprop * prop)
-{
- char *pargv[2];
- int pargc = 2;
- char *ellps;
- /* if there are no options like -p,-w,-e, sets as -a */
- if (!(prop->parseWpt | prop->parseTrk | prop->parseRte)) {
- prop->parseWpt = 1;
- prop->parseTrk = 1;
- prop->parseRte = 1;
- }
- /* if there is no output setting, sets it as [sourcefile name] - ".gpx" */
- if (prop->output == NULL) {
- char *dot = strrchr(prop->sourcefile, '.');
- prop->output =
- (char *) malloc(sizeof(char) * strlen(prop->sourcefile) + 1);
- if (0 == strcmp(dot, ".gpx")) {
- int len = dot - prop->sourcefile;
- strncpy(prop->output, prop->sourcefile, len);
- prop->output[len] = 0;
- } else {
- fprintf(stderr,
- "The source file doesn't have .gpx extension.\n");
- exit(ERR_ISNOTGPX);
- }
- }
- /* sets ellipsoid "WGS84" */
- if (prop->ellipsoid == NULL) {
- prop->ellipsoid = (char *) malloc(sizeof(char) * 7);
- strcpy(prop->ellipsoid, "WGS84");
- }
- /* sets lengthUnit "m" */
- if (prop->lengthUnit == NULL) {
- prop->lengthUnit = (char *) malloc(sizeof(char) * 2);
- strcpy(prop->lengthUnit, "m");
- }
- /* sets timeUnit "sec" */
- if (prop->timeUnit == NULL) {
- prop->timeUnit = (char *) malloc(sizeof(char) * 4);
- strcpy(prop->timeUnit, "sec");
- }
- /* sets speedLengthUnit "km" */
- if (prop->speedLengthUnit == NULL) {
- prop->speedLengthUnit = (char *) malloc(sizeof(char) * 3);
- strcpy(prop->speedLengthUnit, "km");
- }
- /* sets speedTimeUnit "hour" */
- if (prop->speedTimeUnit == NULL) {
- prop->speedTimeUnit = (char *) malloc(sizeof(char) * 5);
- strcpy(prop->speedTimeUnit, "hour");
- }
- /* sets ellipsoid setting to geod* programs */
- ellps = malloc(sizeof(char) * (strlen(prop->ellipsoid) + 8));
- strcpy(ellps, "+ellps=");
- strcat(ellps, prop->ellipsoid);
- pargv[0] = ellps;
- pargv[1] = prop->lengthUnit;
- checkEllpsUnit(prop->ellipsoid);
- prop->length2meter = checkLengthUnit(prop->lengthUnit);
- prop->time2sec = checkTimeUnit(prop->timeUnit);
- prop->speed2meter = checkLengthUnit(prop->speedLengthUnit);
- prop->speed2sec = checkTimeUnit(prop->speedTimeUnit);
- geod_set(pargc, pargv);
- if (prop->verbose) {
- printf("source filename:\t%s\n", prop->sourcefile);
- printf("output file base name:\t%s\n", prop->output);
- }
- free(ellps);
-}
-
-/**
- * Set options from command arguments
- */
-void setOptions(int argc, char **argv, g2sprop * prop)
-{
- int result;
- /* option struct for getopt_long */
- struct option const long_options[] = {
- {"waypoints", no_argument, 0, 'w'},
- {"trackpoints", no_argument, 0, 't'},
- {"routes", no_argument, 0, 'r'},
- {"output", required_argument, 0, 'o'},
- {"as-edge", no_argument, 0, 'e'},
- {"as-point", no_argument, 0, 'p'},
- {"min-points", required_argument, 0, 'P'},
- {"min-length", required_argument, 0, 'l'},
- {"min-time", required_argument, 0, 'm'},
- {"stats", no_argument, 0, 's'},
- {"basic-columns", no_argument, 0, 'b'},
- {"fast", no_argument, 0, 'f'},
- {"length-unit", required_argument, 0, '4'},
- {"time-unit", required_argument, 0, '8'},
- {"length-ellipsoid", required_argument, 0, '7'},
- {"speed-length-unit", required_argument, 0, '5'},
- {"speed-time-unit", required_argument, 0, '6'},
- {"no-speed", no_argument, 0, 'S'},
- {"no-length", no_argument, 0, 'L'},
- {"no-time", no_argument, 0, 'T'},
- {"verbose", no_argument, 0, 'v'},
- {"gpxline", no_argument, 0, 'g'},
- {"all", no_argument, 0, 'a'},
- {"version", no_argument, 0, 'V'},
- {"help", no_argument, 0, '?'},
- {0, no_argument, 0, '0'},
- };
- if (argc <= 1) {
- fprintf(stderr, "There is no argument.\n");
- usage(argv);
- exit(ERR_NOARGS);
- }
- /* set option attributes */
- while ((result =
- getopt_long(argc, argv, "3wtrao:epfP:l:m:bS4:5:6:7:8:LTSsvg0",
- long_options, NULL)) != -1) {
- switch (result) {
- case '3': /* 3d output */
- prop->is3d = 1;
- break;
- case 'w': /* converts only waypoint */
- prop->parseWpt = 1;
- break;
- case 't': /* converts only trackpoint */
- prop->parseTrk = 1;
- break;
- case 'r': /* converts only route */
- prop->parseRte = 1;
- break;
- case 'a': /* converts all */
- prop->parseWpt = 1;
- prop->parseTrk = 1;
- prop->parseRte = 1;
- break;
- case 'o': /* sets basename of output file */
- prop->output =
- (char *) malloc(sizeof(char) * strlen(optarg) + 1);
- strcpy(prop->output, optarg);
- break;
- case 'e': /* make output by each edges */
- if (prop->isEdge) {
- fprintf(stderr, "option -e cannot use with -f\n");
- exit(ERR_OPTIONCONFRICT);
- }
- prop->isEdge = 1;
- break;
- case 'p': /* make output by each edges */
- prop->isPoint = 1;
- break;
- case 'f': /* make it faster */
- if (prop->isEdge) {
- fprintf(stderr, "option -f cannot use with -e\n");
- exit(ERR_OPTIONCONFRICT);
- }
- prop->isFast = 1;
- prop->cols->desc = 0;
- prop->cols->src = 0;
- prop->cols->link = 0;
- prop->cols->magvar = 0;
- prop->cols->geoidheight = 0;
- prop->cols->sat = 0;
- prop->cols->hdop = 0;
- prop->cols->vdop = 0;
- prop->cols->pdop = 0;
- prop->cols->ageofdgpsdata = 0;
- prop->cols->dgpsid = 0;
- prop->cols->length = 0;
- prop->cols->interval = 0;
- prop->cols->speed = 0;
- break;
- case 'P': /* sets minimun points as a path */
- prop->minpoints = atoi(optarg);
- break;
- case 'l': /* sets minimun length as a path */
- prop->minlength = atoi(optarg);
- break;
- case 'm': /* sets minimun time as a path */
- prop->mintime = atoi(optarg);
- break;
- case 'b': /* use only some columns */
- prop->cols->desc = 0;
- prop->cols->src = 0;
- prop->cols->link = 0;
- prop->cols->magvar = 0;
- prop->cols->geoidheight = 0;
- prop->cols->sat = 0;
- prop->cols->hdop = 0;
- prop->cols->vdop = 0;
- prop->cols->pdop = 0;
- prop->cols->ageofdgpsdata = 0;
- prop->cols->dgpsid = 0;
- prop->cols->length = 0;
- prop->cols->interval = 0;
- prop->cols->speed = 0;
- break;
- case 'S': /* doesn't make speed column */
- prop->cols->speed = 0;
- break;
- case '4': /* sets length unit */
- prop->lengthUnit = malloc(sizeof(char) * (strlen(optarg) + 1));
- strcpy(prop->lengthUnit, optarg);
- break;
- case '5': /* sets length unit for calculating speed */
- prop->speedLengthUnit =
- malloc(sizeof(char) * (strlen(optarg) + 1));
- strcpy(prop->speedLengthUnit, optarg);
- break;
- case '6': /* sets time unit for calculating speed */
- prop->speedTimeUnit =
- malloc(sizeof(char) * (strlen(optarg) + 1));
- strcpy(prop->speedTimeUnit, optarg);
- break;
- case '7': /* sets ellipsoid for calculating length */
- prop->ellipsoid = malloc(sizeof(char) * (strlen(optarg) + 1));
- strcpy(prop->ellipsoid, optarg);
- break;
- case '8': /* sets time unit */
- prop->timeUnit = malloc(sizeof(char) * (strlen(optarg) + 1));
- strcpy(prop->timeUnit, optarg);
- break;
- case 'L': /* doesn't make length column */
- prop->cols->length = 0;
- break;
- case 'T': /* doesn't make time column */
- prop->cols->interval = 0;
- break;
- case 's': /* shows source file stats */
- prop->needsStats = 1;
- break;
- case 'v': /* verbose mode */
- prop->verbose = 1;
- break;
- case 'V': /* shows version */
- version();
- exit(EXIT_SUCCESS);
- break;
- case 'g': /* adds gpx line number column */
- prop->cols->gpxline = 1;
- break;
- case ':':
- usage(argv);
- exit(ERR_WRONGOPTION);
- break;
- case '0':
- usage(argv);
- exit(ERR_WRONGOPTION);
- break;
- default:
- usage(argv);
- exit(ERR_WRONGOPTION);
- break;
- }
- }
- /* gets a source file name */
- if(argv[optind] == NULL) {
- fprintf(stderr, "There is no gpxfile description.\n");
- usage(argv);
- exit(ERR_WRONGOPTION);
- }
- prop->sourcefile = malloc(sizeof(char) * (strlen(argv[optind]) + 1));
- /** @note needs to change here to support
- * a several files convertion */
- strcpy(prop->sourcefile, argv[optind]);
- setDefault(prop);
-}
-
-/**
- * Main
- */
-int main(int argc, char **argv)
-{
- g2sprop *prop;
- prop = createProp();
- setOptions(argc, argv, prop);
- parseMain(prop);
- if (prop->needsStats)
- showStats(prop);
- closeProp(prop);
- return (0);
-}
diff --git a/navit/tools/gpx2navit_txt/src/misc.c b/navit/tools/gpx2navit_txt/src/misc.c
deleted file mode 100644
index b5fddd34..00000000
--- a/navit/tools/gpx2navit_txt/src/misc.c
+++ /dev/null
@@ -1,344 +0,0 @@
-#include "gpx2navit_txt.h"
-
-void failToWriteAttrRep(int iShape, int col, char *file, int line);
-void showStats(g2sprop * prop);
-void wipePathAttr(pathattr * pattr);
-pathattr *createPathAttr(void);
-void wipeAttr(g2sattr * attr);
-void setColsDefault(g2scolumns * cols);
-g2scolumns *createCols(void);
-g2sattr *createAttr(void);
-g2sprop *createProp(void);
-void closeProp(g2sprop * prop);
-//shphandles *createShps(void);
-//dbfhandles *createDbfs(void);
-parsedata *createParsedata(XML_Parser parser, g2sprop * prop);
-void closeParsedata(parsedata * pdata);
-
-/**
- * message when fail to write attribute
- */
-void failToWriteAttrRep(int iShape, int col, char *file, int line)
-{
- printf("Fail to write a attribute at %s:%i. shapeid:%i col:%i\n", file,
- line, iShape, col);
-}
-
-/**
- * shows short statistics
- */
-void showStats(g2sprop * prop)
-{
- g2sstats *stats = prop->stats;
- double ratio;
- if (prop->needsStats) {
- if (prop->parseTrk) {
- if (stats->trkunconverted != 0) {
- ratio =
- (double) stats->trkunconverted / (stats->trkcount +
- stats->
- trkunconverted) *
- 100;
- } else {
- ratio = 0;
- }
- printf("Track Points:\n");
- printf("\ttrack count:\t%i\n", stats->trkcount);
- printf("\tpoint count:\t%i\n", stats->trkpoints);
- if (!prop->isFast) {
- printf("\ttotal length:\t%f\n", stats->trklength);
- printf("\tunconverted:\t%i(%5.2f%%)\n",
- stats->trkunconverted, ratio);
- }
- }
- if (prop->parseRte) {
- if (stats->rteunconverted != 0) {
- ratio =
- (double) stats->rteunconverted / (stats->rtecount +
- stats->
- rteunconverted) *
- 100;
- } else {
- ratio = 0;
- }
- printf("Routes:\n");
- printf("\troute count:\t%i\n", stats->rtecount);
- printf("\tpoint count:\t%i\n", stats->rtepoints);
- if (!prop->isFast) {
- printf("\ttotal length:\t%f\n", stats->rtelength);
- printf("\tunconverted:\t%i(%5.2f%%)\n",
- stats->rteunconverted, ratio);
- }
- }
- if (prop->parseWpt) {
- printf("Waypoints:\n");
- printf("\tpoint count:\t%i\n", stats->wptpoints);
- }
- }
-}
-
-/**
- * clears a path attribute structure
- */
-void wipePathAttr(pathattr * pattr)
-{
- pattr->name[0] = '\0';
- pattr->cmt[0] = '\0';
- pattr->desc[0] = '\0';
- pattr->src[0] = '\0';
- pattr->link[0] = '\0';
- pattr->number = 0;
- pattr->type[0] = '\0';
- pattr->length = 0;
- pattr->interval = 0;
- pattr->speed = 0;
- //pattr->point = NULL;
- pattr->count = 0;
-}
-
-/**
- * creates a new path attribute
- */
-pathattr *createPathAttr(void)
-{
- pathattr *pattr;
- pattr = (pathattr *) malloc(sizeof(pathattr));
- wipePathAttr(pattr);
- return pattr;
-}
-
-/**
- * clears a element attribute structure
- */
-void wipeAttr(g2sattr * attr)
-{
- attr->lon = 0;
- attr->lat = 0;
- attr->minlon = 0;
- attr->minlat = 0;
- attr->maxlon = 0;
- attr->maxlat = 0;
- attr->name[0] = '\0';
- attr->cmt[0] = '\0';
- attr->desc[0] = '\0';
- attr->src[0] = '\0';
- attr->link[0] = '\0';
- attr->type[0] = '\0';
- attr->time[0] = '\0';
- attr->number = 0;
- attr->ele = 0;
- attr->magvar = 0;
- attr->geoidheight = 0;
- attr->sym[0] = '\0';
- attr->fix[0] = '\0';
- attr->sat = 0;
- attr->hdop = 0;
- attr->vdop = 0;
- attr->pdop = 0;
- attr->ageofdgpsdata = 0;
- attr->dgpsid = 0;
- attr->author[0] = '\0';
- attr->keywords[0] = '\0';
- attr->copyright[0] = '\0';
- attr->year = 0;
- attr->license[0] = '\0';
- attr->minlat = 0;
- attr->minlon = 0;
- attr->maxlat = 0;
- attr->maxlon = 0;
-}
-
-/**
- * sets default values to a column properties.
- */
-void setColsDefault(g2scolumns * cols)
-{
- cols->name = 1;
- cols->cmt = 1;
- cols->desc = 1;
- cols->src = 1;
- cols->link = 1;
- cols->type = 1;
- cols->time = 1;
- cols->number = 1;
- cols->ele = 1;
- cols->magvar = 1;
- cols->geoidheight = 1;
- cols->sym = 1;
- cols->fix = 1;
- cols->sat = 1;
- cols->hdop = 1;
- cols->vdop = 1;
- cols->pdop = 1;
- cols->ageofdgpsdata = 1;
- cols->dgpsid = 1;
- cols->length = 1;
- cols->interval = 1;
- cols->speed = 1;
- cols->points = 1;
- cols->gpxline = 0;
-}
-
-/**
- * creates a column structure
- */
-g2scolumns *createCols(void)
-{
- g2scolumns *cols;
- cols = (g2scolumns *) malloc(sizeof(g2scolumns));
- setColsDefault(cols);
- return cols;
-}
-
-/**
- * creates a element attribute structure.
- */
-g2sattr *createAttr(void)
-{
- g2sattr *attr;
- attr = (g2sattr *) malloc(sizeof(g2sattr));
- wipeAttr(attr);
- return attr;
-}
-
-/**
- * creates a properties structure for gpx2shp
- */
-g2sprop *createProp(void)
-{
- g2sprop *prop;
- g2sstats *stats;
- g2scolumns *cols;
- prop = malloc(sizeof(g2sprop));
- stats = malloc(sizeof(g2sstats));
- cols = createCols();
- prop->stats = stats;
- prop->parseWpt = 0;
- prop->parseTrk = 0;
- prop->parseRte = 0;
- prop->minpoints = 2;
- prop->minlength = 0;
- prop->mintime = 0;
- prop->is3d = 0;
- prop->isEdge = 0;
- prop->isPoint = 0;
- prop->isFast = 0;
- prop->needsStats = 0;
- prop->verbose = 0;
- prop->output = NULL;
- prop->ellipsoid = NULL;
- prop->lengthUnit = NULL;
- prop->speedLengthUnit = NULL;
- prop->speedTimeUnit = NULL;
- prop->timeUnit = NULL;
- prop->stats->trkcount = 0;
- prop->stats->trkpoints = 0;
- prop->stats->trklength = 0;
- prop->stats->trkunconverted = 0;
- prop->stats->rtecount = 0;
- prop->stats->rtepoints = 0;
- prop->stats->rtelength = 0;
- prop->stats->rteunconverted = 0;
- prop->stats->wptpoints = 0;
- prop->cols = cols;
- return prop;
-}
-
-/**
- * close and free a propertires structure
- */
-void closeProp(g2sprop * prop)
-{
- free(prop->stats);
- free(prop->sourcefile);
- free(prop->ellipsoid);
- free(prop->timeUnit);
- free(prop->speedLengthUnit);
- free(prop->speedTimeUnit);
- free(prop->lengthUnit);
- free(prop->output);
- free(prop->cols);
- free(prop);
-}
-
-/**
- * creates a shapehandles structure
- */
-//shphandles *createShps(void)
-//{
-// shphandles *shps;
-// shps = malloc(sizeof(shphandles));
-// shps->trk = NULL;
-// shps->wpt = NULL;
-// shps->rte = NULL;
-// shps->trk_edg = NULL;
-// shps->rte_edg = NULL;
-// shps->trk_pnt = NULL;
-// shps->rte_pnt = NULL;
-// return shps;
-//}
-
-/**
- * creates a dbfhandles structure
- */
-/* dbfhandles *createDbfs(void)
-{
- dbfhandles *dbfs;
- dbfs = malloc(sizeof(dbfhandles));
- dbfs->trk = NULL;
- dbfs->wpt = NULL;
- dbfs->rte = NULL;
- dbfs->trk_edg = NULL;
- dbfs->rte_edg = NULL;
- dbfs->trk_pnt = NULL;
- dbfs->rte_pnt = NULL;
- return dbfs;
-} */
-
-/**
- * creates a parse structure
- */
-parsedata *createParsedata(XML_Parser parser, g2sprop * prop)
-{
- parsedata *pdata = (parsedata *) malloc(sizeof(parsedata));
- pdata->fp = NULL;
- //shphandles *shps = createShps();
- //dbfhandles *dbfs = createDbfs();
- pathattr *pattr = createPathAttr();
- g2sattr *attr = createAttr();
- parent *p = (parent *) malloc(sizeof(parent));
- parent *c = (parent *) malloc(sizeof(parent));
- p->name = NULL;
- p->parentptr = NULL;
- c->name = "root";
- c->parentptr = p;
- pdata->depth = 0;
- pdata->databuf = malloc(sizeof(char) * DATABUFSIZE);
- pdata->bufptr = NULL;
- pdata->failed = 0;
- pdata->failedid = 0;
- pdata->parser = parser;
- pdata->parent = p;
- pdata->current = c;
- //pdata->shps = shps;
- //pdata->dbfs = dbfs;
- pdata->prop = prop;
- pdata->pattr = pattr;
- pdata->attr = attr;
- return pdata;
-}
-
-/*
- * close and free resoures
- */
-void closeParsedata(parsedata * pdata)
-{
- //free(pdata->shps);
- //free(pdata->dbfs);
- free(pdata->parent);
- free(pdata->current);
- free(pdata->databuf);
- free(pdata->attr);
- free(pdata->pattr);
- free(pdata);
-}
diff --git a/navit/tools/gpx2navit_txt/src/parser.c b/navit/tools/gpx2navit_txt/src/parser.c
deleted file mode 100644
index 70104daf..00000000
--- a/navit/tools/gpx2navit_txt/src/parser.c
+++ /dev/null
@@ -1,148 +0,0 @@
-#include "gpx2navit_txt.h"
-
-void charHandle(void *userdata, const XML_Char * data, int length);
-void startElement(void *userdata, const char *element, const char **attr);
-void endElement(void *userdata, const char *element);
-void parseMain(g2sprop * prop);
-
-/**
- * a handler to parse charctor data on expat
- */
-void charHandle(void *userdata, const XML_Char * data, int length)
-{
- static int bufsize = DATABUFSIZE;
- static int string_length = 0;
- int new_length;
- static int begin_copy = 0;
- int i;
- parsedata *pdata = (parsedata *) userdata;
- if (pdata->bufptr == NULL) {
- //start of buffer -->pdata->bufptr set to 0 at endelement
- string_length = 0;
- begin_copy = 0; //begin to copy after first space
- pdata->bufptr= pdata->databuf;
- }
- new_length = string_length + length + 1; //additonal 0
- if (bufsize < new_length) {
- pdata->databuf =
- realloc(pdata->databuf, new_length);
- bufsize = new_length;
- //because of realloc the pointer may have changed
- pdata->bufptr = pdata->databuf + string_length;
- }
- // because expat calls this routine several times on special chars
- // we need to do following
- // --concat strings until reset (bufptr set to NULL)
- // --filter out blank chars at begin of string
- for (i=0; i<length;i++) {
- if (begin_copy || !isspace(data[i])) {
- *pdata->bufptr = data[i];
- pdata->bufptr++;
- string_length ++;
- begin_copy = 1;
- if (DEBUG) fprintf(stderr,"%c",data[i]);
- }
- }
- *pdata->bufptr = '\0';
-}
-
-/**
- * a handler when a element starts
- */
-void startElement(void *userdata, const char *element, const char **attr)
-{
- parsedata *pdata = (parsedata *) userdata;
- pdata->parent = pdata->current;
- pdata->current = malloc(sizeof(parent));
- pdata->current->name = malloc(sizeof(char) * (strlen(element) + 1));
- strcpy(pdata->current->name, element);
- pdata->current->parentptr = pdata->parent;
- startElementControl(pdata, element, attr);
- if (pdata->prop->verbose) {
- int i;
- for (i = 0; i < pdata->depth; i++)
- printf(" ");
- printf("<%s>: ", element);
- for (i = 0; attr[i]; i += 2) {
- printf(" %s='%s'", attr[i], attr[i + 1]);
- }
- printf("\n");
- }
- pdata->depth++;
-}
-
-/**
- * a handler when a element ends
- */
-void endElement(void *userdata, const char *element)
-{
- parsedata *pdata = (parsedata *) userdata;
- endElementControl(pdata, element);
- pdata->depth--;
- if (pdata->prop->verbose) {
- int i;
- for (i = 0; i < pdata->depth; i++)
- printf(" ");
- printf("</%s>:%s\n ", element,pdata->parent->name);
- }
- free(pdata->current->name);
- free(pdata->current);
- pdata->current = pdata->parent;
- pdata->parent = pdata->parent->parentptr;
-}
-
-void parseMain(g2sprop * prop)
-{
- FILE *fp;
- char buff[BUFFSIZE];
- XML_Parser parser;
- parsedata *pdata;
- fp = fopen(prop->sourcefile, "r");
- if (fp == NULL) {
- fprintf(stderr, "Cannot open gpx file: %s\n", prop->sourcefile);
- exit(ERR_CANNOTOPEN);
- }
- parser = XML_ParserCreate(NULL);
- if (!parser) {
- fprintf(stderr, "Couldn't allocate memory for parser\n");
- exit(ERR_OUTOFMEMORY);
- }
- pdata = createParsedata(parser, prop);
-
- char *output_wpt =
- (char *) malloc(sizeof(char) * (strlen(pdata->prop->output) + 9));
- strcpy(output_wpt, pdata->prop->output);
- strcat(output_wpt, "_nav.txt");
- pdata->fp = fopen(output_wpt,"w");
- if (pdata->fp == NULL)
- {
- //todo
- fprintf(stderr,"Failure opening File %s for writing",output_wpt);
- exit(1);
- }
- free(output_wpt);
- XML_SetUserData(parser, pdata);
- XML_SetElementHandler(parser, startElement, endElement);
- XML_SetCharacterDataHandler(parser, charHandle);
- for (;;) {
- int done;
- int len;
- fgets(buff, BUFFSIZE, fp);
- len = (int) strlen(buff);
- if (ferror(fp)) {
- fprintf(stderr, "Read error file: %s\n", prop->sourcefile);
- exit(ERR_READERROR);
- }
- done = feof(fp);
- if (done)
- break;
- if (!XML_Parse(parser, buff, len, done)) {
- fprintf(stderr, "Parse error at line %d:\n%s\n",
- XML_GetCurrentLineNumber(parser),
- XML_ErrorString(XML_GetErrorCode(parser)));
- exit(ERR_PARSEERROR);
- }
- }
- fclose(pdata->fp); //close out file
- closeParsedata(pdata);
-}
diff --git a/navit/tools/gpx2navit_txt/src/setmeta.c b/navit/tools/gpx2navit_txt/src/setmeta.c
deleted file mode 100644
index 9d23ffd1..00000000
--- a/navit/tools/gpx2navit_txt/src/setmeta.c
+++ /dev/null
@@ -1,54 +0,0 @@
-#include "gpx2navit_txt.h"
-
-/**
- * store gpx metadata into text file
- */
-void setMetadata(parsedata * pdata)
-{
- g2sprop *prop = pdata->prop;
- g2sattr *attr = pdata->attr;
- FILE *metafile;
- char *output = malloc(sizeof(char) * (strlen(prop->output) + 10));
- strcpy(output, prop->output);
- strcat(output, "_meta.txt");
- metafile = fopen(output, "w");
- if (metafile == NULL) {
- fprintf(stderr, "Cannot create file: %s\n", output);
- exit(ERR_CREATEFILE);
- }
- if (attr->name) {
- fprintf(metafile, "name\t%s\n", attr->name);
- }
- if (attr->desc) {
- fprintf(metafile, "description\t%s\n", attr->desc);
- }
- if (attr->author) {
- fprintf(metafile, "author\t%s\n", attr->author);
- }
- if (attr->copyright) {
- fprintf(metafile, "copyright\t%s\n", attr->copyright);
- }
- if (attr->link) {
- fprintf(metafile, "link\t%s\n", attr->link);
- }
- if (attr->time) {
- fprintf(metafile, "time\t%s\n", attr->time);
- }
- if (attr->keywords) {
- fprintf(metafile, "keywords\t%s\n", attr->keywords);
- }
- if (attr->minlat) {
- fprintf(metafile, "min latitude\t%f\n", attr->minlat);
- }
- if (attr->minlon) {
- fprintf(metafile, "min longitude\t%f\n", attr->minlon);
- }
- if (attr->maxlat) {
- fprintf(metafile, "max latitude\t%f\n", attr->maxlat);
- }
- if (attr->maxlon) {
- fprintf(metafile, "max longitude\t%f\n", attr->maxlon);
- }
- fclose(metafile);
- free(output);
-}
diff --git a/navit/tools/gpx2navit_txt/src/setpath.c b/navit/tools/gpx2navit_txt/src/setpath.c
deleted file mode 100644
index 5402e4ea..00000000
--- a/navit/tools/gpx2navit_txt/src/setpath.c
+++ /dev/null
@@ -1,241 +0,0 @@
-#include "gpx2navit_txt.h"
-
-void initPathAttr(pathattr * pattr, g2sattr * attr);
-void setEdge(parsedata * pdata, double _x, double _y, double _z,
- double length, double interval, double speed);
-void setPathInterval(parsedata * pdata);
-void setPathData(pathattr * pattr, g2sattr * attr);
-void countUnconverted(parsedata * pdata);
-void countPath(parsedata * pdata);
-int checkPath(parsedata * pdata);
-void setPath( parsedata * pdata);
-
-
-
-/**
- * initialize a path attribute
- */
-void initPathAttr(pathattr * pattr, g2sattr * attr)
-{
- strcpy(pattr->name, attr->name);
- strcpy(pattr->cmt, attr->cmt);
- strcpy(pattr->desc, attr->desc);
- strcpy(pattr->src, attr->src);
- strcpy(pattr->link, attr->link);
- pattr->number = attr->number;
- strcpy(pattr->type, attr->type);
- pattr->length = 0;
- pattr->interval = 0;
- pattr->speed = 0;
- pattr->count = 0;
- pattr->point = NULL;
-}
-
-
-/**
- * set edge data and store it
- */
-void setEdge(parsedata * pdata, double _x, double _y, double _z,
- double length, double interval, double speed)
-{
- pathattr *pattr = pdata->pattr;
- static int isFirstTrkAsEdge = 1;
- static int isFirstRteAsEdge = 1;
- double x[2], y[2], z[2];
- double _length, _interval, _speed;
- if (!strcmp(pdata->current->name, "trkpt")) {
- if (isFirstTrkAsEdge) {
- isFirstTrkAsEdge = 0;
- }
- } else {
- if (isFirstRteAsEdge) {
- isFirstRteAsEdge = 0;
- }
- }
- _length = pattr->length;
- _interval = pattr->interval;
- _speed = pattr->speed;
- pattr->length = length;
- pattr->interval = interval;
- pattr->speed = speed;
- x[0] = _x;
- y[0] = _y;
- z[0] = _z;
- x[1] = pdata->attr->lon;
- y[1] = pdata->attr->lat;
- z[1] = pdata->attr->ele;
- if (pdata->prop->is3d) {
- } else {
- }
- pattr->length = _length;
- pattr->interval = _interval;
- pattr->speed = _speed;
-}
-
-/**
- * sets interval data between two track points
- */
-void setPathInterval(parsedata * pdata)
-{
- pathattr *pattr = pdata->pattr;
- g2sattr *attr = pdata->attr;
- g2sprop *prop = pdata->prop;
- static char _t[TIMELENGTH];
- double intvl = 0;
- static double _x, _y, _z;
- double leng = 0;
- double spd;
- if (pattr->count == 1) {
- strcpy(_t, attr->time);
- } else {
- /* time interval */
- intvl = getTimeInterval(_t, attr->time);
- pattr->interval = pattr->interval + intvl;
- strcpy(_t, attr->time);
- /* length interval */
- leng = getDistance(_x, _y, attr->lon, attr->lat);
- pattr->length = pattr->length + leng;
- /* interval speed */
- spd = getSpeed(leng, intvl, prop->speed2meter, prop->speed2sec);
- /* sets edge data */
- if (prop->isEdge) {
- setEdge(pdata, _x, _y, _z, leng, intvl, spd);
- }
- }
- _x = attr->lon;
- _y = attr->lat;
- _z = attr->ele;
-}
-
-/**
- * sets each track point data in array.
- */
-void setPathData(pathattr * pattr, g2sattr * attr)
-{
- const int reallocsize = 100;
- if (pattr->count == 0) {
- pattr->point = malloc(sizeof(double) * 3 * reallocsize);
- }
- if ((pattr->count % reallocsize) == 0) {
- pattr->point = realloc(pattr->point,
- sizeof(double) * 3 * (pattr->count +
- reallocsize));
- }
- pattr->point[pattr->count * 3] = attr->lon;
- pattr->point[pattr->count * 3 + 1] = attr->lat;
- pattr->point[pattr->count * 3 + 2] = attr->ele;
- pattr->count++;
-}
-
-/**
- * counts paths that wasn't converted
- */
-void countUnconverted(parsedata * pdata)
-{
- g2sstats *stats = pdata->prop->stats;
- if (!strcmp(pdata->current->name, "trkseg"))
- stats->trkunconverted++;
- else
- stats->rteunconverted++;
-}
-
-/**
- * counts paths
- */
-void countPath(parsedata * pdata)
-{
- g2sstats *stats = pdata->prop->stats;
- pathattr *pattr = pdata->pattr;
- if (!strcmp(pdata->current->name, "trkseg")) {
- stats->trkcount++;
- stats->trklength += pattr->length;
- stats->trkpoints += pattr->count;
- } else {
- stats->rtecount++;
- stats->rtelength += pattr->length;
- stats->rtepoints += pattr->count;
- }
-}
-
-int checkPath(parsedata * pdata)
-{
- pathattr *pattr = pdata->pattr;
- g2sprop *prop = pdata->prop;
- /* check point count. */
- if (pattr->count < prop->minpoints) {
- fprintf
- (stderr,
- "gpx2navit_txt:%s:%i track was not converted because of less then %d points. \n",
- prop->sourcefile, XML_GetCurrentLineNumber(pdata->parser),
- prop->minpoints);
- countUnconverted(pdata);
- return 0;
- /* check path length */
- } else if (pattr->length < prop->minlength * prop->length2meter) {
- fprintf
- (stderr,
- "gpx2navit_txt:%s:%i track was not converted because it is shorter than %dm.\n",
- prop->sourcefile, XML_GetCurrentLineNumber(pdata->parser),
- prop->minlength);
- countUnconverted(pdata);
- return 0;
- /* check path time */
- } else if (pattr->interval < prop->mintime * prop->time2sec) {
- fprintf
- (stderr,
- "gpx2navit_txt:%s:%i track was not converted because it is shorter than %d sed.\n",
- prop->sourcefile, XML_GetCurrentLineNumber(pdata->parser),
- prop->mintime);
- countUnconverted(pdata);
- return 0;
- /* check path speed */
- } else if (pattr->speed == .0) {
- fprintf
- (stderr,
- "gpx2navit_txt:%s:%i track was not converted because no move recorded.\n",
- prop->sourcefile, XML_GetCurrentLineNumber(pdata->parser));
- countUnconverted(pdata);
- return 0;
- }
- return 1;
-}
-
-/**
- * saves path data into files.
- */
-void setPath( parsedata * pdata)
-{
- pathattr *pattr = pdata->pattr;
- g2sprop *prop = pdata->prop;
- int isOk = 0;
- pattr->speed =
- getSpeed(pattr->length, pattr->interval, prop->speed2meter,
- prop->speed2sec);
- if (prop->isFast) {
- isOk = 1;
- } else {
- isOk = checkPath(pdata);
- }
- if (isOk) {
- double x[pattr->count];
- double y[pattr->count];
- double z[pattr->count];
- int i;
- fprintf(pdata->fp,"type=track label=\"%s\" desc=\"%s\" type=\"%s\"\ length=\"%5.3f\" count=\"%5d\"\n"
- ,pdata->pattr->name,pdata->pattr->desc,
- pdata->pattr->type,pdata->pattr->length,
- pdata->pattr->count);
-
- for (i = 0; i < pattr->count; i++) {
- x[i] = pattr->point[i * 3];
- y[i] = pattr->point[i * 3 + 1];
- z[i] = pattr->point[i * 3 + 2];
- fprintf(pdata->fp,"%3.6f %4.6f\n",x[i],y[i]);
- }
- if (pdata->prop->is3d) {
- } else {
- }
- countPath(pdata);
- }
- free(pattr->point);
-}
diff --git a/navit/tools/gpx2navit_txt/src/setwpt.c b/navit/tools/gpx2navit_txt/src/setwpt.c
deleted file mode 100644
index 9af217f0..00000000
--- a/navit/tools/gpx2navit_txt/src/setwpt.c
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "gpx2navit_txt.h"
-
-void setWpt(parsedata * pdata);
-
-/**
- * save point objects in *_wpt or *_pnt file
- */
-void setWpt( parsedata * pdata)
-{
- double x[1], y[1], z[1];
- x[0] = pdata->attr->lon;
- y[0] = pdata->attr->lat;
- z[0] = pdata->attr->ele;
- if (pdata->prop->is3d) {
- //nothing at the moment
- } else {
- //do not know if i will change something here
- }
- // Write attributes to file first line waypoint-info, second line coords
- char poi_type[20]="poi_attraction";
- if (!strcmp(pdata->attr->type,"Geocache|Traditional Cache"))
- strcpy(poi_type,"poi_gc_tradi");
- if (!strcmp(pdata->attr->type,"Geocache|Multi-cache"))
- strcpy(poi_type,"poi_gc_multi");
- if (!strcmp(pdata->attr->type,"Geocache|Unknown Cache"))
- strcpy(poi_type,"poi_gc_mystery");
- if (!strcmp(pdata->attr->type,"Geocache|Event Cache"))
- strcpy(poi_type,"poi_gc_event");
- if (!strcmp(pdata->attr->type,"Geocache")) //for OC
- strcpy(poi_type,"poi_gc_tradi");
- if (!strcmp(pdata->attr->type,"Waypoint|Parking Area"))
- strcpy(poi_type,"poi_car_parking");
- if (!strcmp(pdata->attr->type,"Waypoint|Question to Answer"))
- strcpy(poi_type,"poi_gc_question");
- if (!strcmp(pdata->attr->type,"Waypoint|Reference Point"))
- strcpy(poi_type,"poi_gc_reference");
- if (!strcmp(pdata->attr->type,"Waypoint|Stages of a Multicache"))
- strcpy(poi_type,"poi_gc_stages");
-
- //generate the file
- fprintf(pdata->fp,"type=%s label=\"%s\" description=\"%s\" gc_type=\"%s\"\n",
- poi_type,pdata->attr->name,pdata->attr->desc,pdata->attr->type);
- fprintf(pdata->fp,"%3.6f %4.6f\n",x[0],y[0]);
-
- //writeWptAttribute(hDBF, pdata, iShape);
- if (!strcmp(pdata->current->name, "wpt")) {
- pdata->prop->stats->wptpoints++;
- }
- return;
-}
-
-
diff --git a/navit/tools/gpx2navit_txt/src/utils.c b/navit/tools/gpx2navit_txt/src/utils.c
deleted file mode 100644
index b9b72479..00000000
--- a/navit/tools/gpx2navit_txt/src/utils.c
+++ /dev/null
@@ -1,199 +0,0 @@
-#include "gpx2navit_txt.h"
-#include "projects.h"
-#include "geodesic.h"
-
-double getDistanceCore(char *p1, char *l1, char *p2, char *l2);
-void checkEllpsUnit(char *unit);
-double checkLengthUnit(char *unit);
-int checkTimeUnit(char *unit);
-double getTimeInterval(char *_t, char *t);
-double getSpeed(double length, double ti, double to_meter, int to_sec);
-double getDistance(double _x, double _y, double x, double y);
-// todo void closeShpFiles(shphandles * shps);
-// todo void closeDbfFiles(dbfhandles * dbfs);
-void *myMallocRep(size_t size, const char *fileName, int line);
-
-void checkEllpsUnit(char *unit)
-{
-/*
- * checks ellipse unit can be used by proj4
- */
- int isOK = 0;
- struct PJ_ELLPS *el; /* project.h of proj4 */
- for (el = pj_ellps; el->id; ++el) {
- if (!strcmp(el->id, unit)) {
- isOK = 1;
- }
- }
- if (!isOK) {
- fputs
- ("The ellipse argument is not correct or supported by libproj\n",
- stderr);
- fputs("You can choose the argument from a list below.\n\n",
- stderr);
- for (el = pj_ellps; el->id; el++) {
- printf("%10s\t%s\n", el->id, el->name);
- }
- exit(ERR_ELLPSUNIT);
- }
-}
-
-double checkLengthUnit(char *unit)
-{
-/*
- * checks length unit can be used by proj4
- * then returns unit value to meter
- */
- int isOK = 0;
- double to_meter = 0;
- struct PJ_UNITS *ut; /* project.h of proj4 */
- for (ut = pj_units; ut->id; ut++) {
- if (!strcmp(ut->id, unit)) {
- isOK = 1;
- to_meter = atof(ut->to_meter);
- }
- }
- if (!isOK) {
- fputs
- ("The length unit argument is not correct or supported by libproj.\n",
- stderr);
- fputs("You can choose the argument from a list below.\n\n",
- stderr);
- for (ut = pj_units; ut->id; ut++) {
- printf("%s\t%s\n", ut->id, ut->name);
- }
- exit(ERR_LENGTHUNIT);
- }
- return to_meter;
-}
-
-int checkTimeUnit(char *unit)
-{
- char *u[8] = { "sec", "s", "min", "m", "hour", "h", "day", "d" };
- int p[8] = { 1, 1, 60, 60, 3600, 3600, 86400, 86400 };
- int i, to_sec = 0;
- for (i = 0; i < 8; i++) {
- if (!strcmp(u[i], unit)) {
- to_sec = p[i];
- }
- }
- if (!to_sec) {
- fputs("The time unit argument is not correct.\n", stderr);
- fputs("You can choose the argument from sec, min, hour or day.\n",
- stderr);
- exit(ERR_TIMEUNIT);
- }
- return to_sec;
-}
-
-double getTimeInterval(char *_t, char *t)
-{
-/*
- * Returns a time interval between _t and t.
- * The arguments should be "YYYY-MM-DDThh:mm:ssZ" (xml schema
- * datetime format without time zone) format.
- */
- double ti;
- struct tm _tt;
- struct tm tt;
- time_t _tmt, tmt;
- memset(&_tt, 0, sizeof(_tt));
- memset(&tt, 0, sizeof(tt));
- sscanf(_t, "%d-%d-%dT%d:%d:%dZ", &_tt.tm_year, &_tt.tm_mon,
- &_tt.tm_mday, &_tt.tm_hour, &_tt.tm_min, &_tt.tm_sec);
- _tt.tm_year -= 1900;
- _tt.tm_mon -= 1;
- sscanf(t, "%d-%d-%dT%d:%d:%d", &tt.tm_year, &tt.tm_mon, &tt.tm_mday,
- &tt.tm_hour, &tt.tm_min, &tt.tm_sec);
- tt.tm_year -= 1900;
- tt.tm_mon -= 1;
- _tmt = mktime(&_tt);
- tmt = mktime(&tt);
- ti = difftime(tmt, _tmt);
- return ti;
-}
-
-double getSpeed(double length, double ti, double to_meter, int to_sec)
-{
-/*
- * Culculates speed from length and time.
- */
- double speed;
- if (!length || !ti)
- speed = 0;
- else
- speed = (length / to_meter) / (ti / to_sec);
- return speed;
-}
-
-double getDistanceCore(char *p1, char *l1, char *p2, char *l2)
-{
- /*
- * Culculates a geodesic length between two points
- * using geod_*.c
- */
- phi1 = dmstor(p1, &p1);
- lam1 = dmstor(l1, &l1);
- phi2 = dmstor(p2, &p2);
- lam2 = dmstor(l2, &l2);
- geod_inv();
- return geod_S;
-}
-
-double getDistance(double _x, double _y, double x, double y)
-{
- /*
- * Culculates a geodesic length between two points
- */
- double length;
- char p1[17], l1[17], p2[17], l2[17];
- sprintf(p1, "%f", _x);
- sprintf(l1, "%f", _y);
- sprintf(p2, "%f", x);
- sprintf(l2, "%f", y);
- length = getDistanceCore(p1, l1, p2, l2);
- return length;
-}
-
-//todo void closeShpFiles(shphandles * shps)
-//{
- /*
- * Closes all SHP files if they opened
- */
-// if (shps->wpt)
-// SHPClose(shps->wpt);
-// if (shps->trk)
-// SHPClose(shps->trk);
-// if (shps->trk_edg)
-// SHPClose(shps->trk_edg);
-// if (shps->trk_pnt)
-// SHPClose(shps->trk_pnt);
-// if (shps->rte)
-// SHPClose(shps->rte);
-// if (shps->rte_edg)
-// SHPClose(shps->rte_edg);
-// if (shps->rte_pnt)
-// SHPClose(shps->rte_pnt);
-//}
-
-//todo void closeDbfFiles(dbfhandles * dbfs)
-//{
- /*
- * Closes all DBF files if they opened
- */
-// if (dbfs->wpt)
-// DBFClose(dbfs->wpt);
-// if (dbfs->trk)
-// DBFClose(dbfs->trk);
-// if (dbfs->trk_edg)
-// DBFClose(dbfs->trk_edg);
-// if (dbfs->trk_pnt)
-// DBFClose(dbfs->trk_pnt);
-// if (dbfs->rte)
-// DBFClose(dbfs->rte);
-// if (dbfs->rte_edg)
-// DBFClose(dbfs->rte_edg);
-// if (dbfs->rte_pnt)
-// DBFClose(dbfs->rte_pnt);
-//}
-
diff --git a/navit/track.c b/navit/track.c
deleted file mode 100644
index 3f08b9a0..00000000
--- a/navit/track.c
+++ /dev/null
@@ -1,318 +0,0 @@
-#include <glib.h>
-#include <string.h>
-#include "item.h"
-#include "attr.h"
-#include "track.h"
-#include "debug.h"
-#include "transform.h"
-#include "coord.h"
-#include "route.h"
-#include "projection.h"
-#include "map.h"
-#include "mapset.h"
-
-struct tracking_line
-{
- struct street_data *street;
-#if 0
- long segid;
- int linenum;
- struct coord c[2];
- struct coord lpnt;
- int value;
- int dir;
-#endif
- struct tracking_line *next;
- int angle[0];
-};
-
-
-struct tracking {
- struct mapset *ms;
-#if 0
- struct transformation t;
-#endif
- struct coord last_updated;
- struct tracking_line *lines;
-#if 0
- struct tracking_line **last_ptr;
-#endif
- struct tracking_line *curr_line;
- int pos;
- struct coord curr[2];
- struct coord last_in;
- struct coord last_out;
-};
-
-
-int angle_factor=30;
-int connected_pref=-10;
-int nostop_pref=10;
-int offroad_limit_pref=5000;
-
-
-struct coord *
-tracking_get_pos(struct tracking *tr)
-{
- return &tr->last_out;
-}
-
-int
-tracking_get_segment_pos(struct tracking *tr)
-{
- return tr->pos;
-}
-
-struct street_data *
-tracking_get_street_data(struct tracking *tr)
-{
- return tr->curr_line->street;
-}
-
-int
-tracking_get_current_attr(struct tracking *_this, enum attr_type type, struct attr *attr)
-{
- struct item *item;
- struct map_rect *mr;
- int result=0;
- if (! _this->curr_line || ! _this->curr_line->street)
- return 0;
- item=&_this->curr_line->street->item;
- mr=map_rect_new(item->map,NULL);
- item=map_rect_get_item_byid(mr, item->id_hi, item->id_lo);
- if (item_attr_get(item, type, attr))
- result=1;
- map_rect_destroy(mr);
- return result;
-}
-
-struct item *
-tracking_get_current_item(struct tracking *_this)
-{
- if (! _this->curr_line || ! _this->curr_line->street)
- return NULL;
- return &_this->curr_line->street->item;
-}
-
-static void
-tracking_get_angles(struct tracking_line *tl)
-{
- int i;
- struct street_data *sd=tl->street;
- for (i = 0 ; i < sd->count-1 ; i++)
- tl->angle[i]=transform_get_angle_delta(&sd->c[i], &sd->c[i+1], 0);
-}
-
-static void
-tracking_doupdate_lines(struct tracking *tr, struct coord *cc)
-{
- int max_dist=1000;
- struct map_selection *sel=route_rect(18, cc, cc, 0, max_dist);
- struct mapset_handle *h;
- struct map *m;
- struct map_rect *mr;
- struct item *item;
- struct street_data *street;
- struct tracking_line *tl;
-#if 0
- struct coord c;
-#endif
-
- dbg(1,"enter\n");
- h=mapset_open(tr->ms);
- while ((m=mapset_next(h,1))) {
- mr=map_rect_new(m, sel);
- if (! mr)
- continue;
- while ((item=map_rect_get_item(mr))) {
- if (item->type >= type_street_0 && item->type <= type_ferry) {
- street=street_get_data(item);
- tl=g_malloc(sizeof(struct tracking_line)+(street->count-1)*sizeof(int));
- tl->street=street;
- tracking_get_angles(tl);
- tl->next=tr->lines;
- tr->lines=tl;
- }
- }
- map_rect_destroy(mr);
- }
- mapset_close(h);
- map_selection_destroy(sel);
- dbg(1, "exit\n");
-#if 0
-
- struct transformation t;
-
- tr->last_ptr=&tr->lines;
- transform_setup_source_rect_limit(&t,c,1000);
- transform_setup_source_rect_limit(&tr->t,c,1000);
-
-
- profile_timer(NULL);
- street_get_block(tr->ma,&t,tst_callback,tr);
- profile_timer("end");
-#endif
-}
-
-
-static void
-tracking_free_lines(struct tracking *tr)
-{
- struct tracking_line *tl=tr->lines,*next;
- dbg(1,"enter(tr=%p)\n", tr);
-
- while (tl) {
- next=tl->next;
- street_data_free(tl->street);
- g_free(tl);
- tl=next;
- }
- tr->lines=NULL;
-}
-
-static int
-tracking_angle_abs_diff(int a1, int a2, int full)
-{
- int ret;
-
- if (a2 > a1)
- ret=(a2-a1)%full;
- else
- ret=(a1-a2)%full;
- if (ret > full/2)
- ret=full-ret;
- return ret;
-}
-
-static int
-tracking_angle_delta(int vehicle_angle, int street_angle, int dir)
-{
- int full=180;
- int ret;
- if (dir) {
- full=360;
- if (dir < 0)
- street_angle=(street_angle+180)%360;
- }
- ret=tracking_angle_abs_diff(vehicle_angle, street_angle, full);
-
- return ret*ret;
-}
-
-static int
-tracking_is_connected(struct coord *c1, struct coord *c2)
-{
- if (c1[0].x == c2[0].x && c1[0].y == c2[0].y)
- return 1;
- if (c1[0].x == c2[1].x && c1[0].y == c2[1].y)
- return 1;
- if (c1[1].x == c2[0].x && c1[1].y == c2[0].y)
- return 1;
- if (c1[1].x == c2[1].x && c1[1].y == c2[1].y)
- return 1;
- return 0;
-}
-
-int
-tracking_update(struct tracking *tr, struct coord *c, int angle)
-{
- struct tracking_line *t;
- int i,value,min=0;
- struct coord lpnt;
-#if 0
- int min,dist;
- int debug=0;
-#endif
- dbg(1,"enter(%p,%p,%d)\n", tr, c, angle);
- dbg(1,"c=0x%x,0x%x\n", c->x, c->y);
-
- if (c->x == tr->last_in.x && c->y == tr->last_in.y) {
- *c=tr->last_out;
- return 0;
- }
- tr->last_in=*c;
- if (!tr->lines || transform_distance_sq(&tr->last_updated, c) > 250000) {
- dbg(1, "update\n");
- tracking_free_lines(tr);
- tracking_doupdate_lines(tr, c);
- tr->last_updated=*c;
- dbg(1,"update end\n");
- }
-
- t=tr->lines;
- if (! t)
- return 0;
- tr->curr_line=NULL;
- while (t) {
- struct street_data *sd=t->street;
- int dir = 0;
- switch(sd->flags & AF_ONEWAYMASK) {
- case 0:
- dir=0;
- break;
- case 1:
- dir=1;
- break;
- case 2:
- dir=-1;
- break;
- case 3:
- t=t->next;
- continue;
- }
- for (i = 0; i < sd->count-1 ; i++) {
- dbg(2, "%d: (0x%x,0x%x)-(0x%x,0x%x)\n", i, sd->c[i].x, sd->c[i].y, sd->c[i+1].x, sd->c[i+1].y);
- value=transform_distance_line_sq(&sd->c[i], &sd->c[i+1], c, &lpnt);
- if (value < INT_MAX/2)
- value += tracking_angle_delta(angle, t->angle[i], dir)*angle_factor>>4;
- if (tracking_is_connected(tr->curr, &sd->c[i]))
- value += connected_pref;
- if (lpnt.x == tr->last_out.x && lpnt.y == tr->last_out.y)
- value += nostop_pref;
- if (! tr->curr_line || value < min) {
- tr->curr_line=t;
- tr->pos=i;
- tr->curr[0]=sd->c[i];
- tr->curr[1]=sd->c[i+1];
- dbg(1,"lpnt.x=0x%x,lpnt.y=0x%x pos=%d %d+%d+%d+%d=%d\n", lpnt.x, lpnt.y, i,
- transform_distance_line_sq(&sd->c[i], &sd->c[i+1], c, &lpnt),
- tracking_angle_delta(angle, t->angle[i], 0)*angle_factor,
- tracking_is_connected(tr->curr, &sd->c[i]) ? connected_pref : 0,
- lpnt.x == tr->last_out.x && lpnt.y == tr->last_out.y ? nostop_pref : 0,
- value
- );
- tr->last_out=lpnt;
- min=value;
- }
- }
- t=t->next;
- }
- dbg(1,"tr->curr_line=%p min=%d\n", tr->curr_line, min);
- if (!tr->curr_line || min > offroad_limit_pref)
- return 0;
- dbg(1,"found 0x%x,0x%x\n", tr->last_out.x, tr->last_out.y);
- *c=tr->last_out;
- return 1;
-}
-
-struct tracking *
-tracking_new(struct mapset *ms)
-{
- struct tracking *this=g_new0(struct tracking, 1);
- this->ms=ms;
-
- return this;
-}
-
-void
-tracking_set_mapset(struct tracking *this, struct mapset *ms)
-{
- this->ms=ms;
-}
-
-void
-tracking_destroy(struct tracking *tr)
-{
- tracking_free_lines(tr);
- g_free(tr);
-}
diff --git a/navit/track.h b/navit/track.h
deleted file mode 100644
index 69024ef1..00000000
--- a/navit/track.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef NAVIT_TRACK_H
-#define NAVIT_TRACK_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* prototypes */
-struct coord;
-struct mapset;
-struct street_data;
-struct tracking;
-struct coord *tracking_get_pos(struct tracking *tr);
-int tracking_get_segment_pos(struct tracking *tr);
-struct street_data *tracking_get_street_data(struct tracking *tr);
-int tracking_update(struct tracking *tr, struct coord *c, int angle);
-struct tracking *tracking_new(struct mapset *ms);
-void tracking_set_mapset(struct tracking *this_, struct mapset *ms);
-int tracking_get_current_attr(struct tracking *_this, enum attr_type type, struct attr *attr);
-struct item *tracking_get_current_item(struct tracking *_this);
-void tracking_destroy(struct tracking *tr);
-/* end of prototypes */
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/navit/transform.c b/navit/transform.c
deleted file mode 100644
index 0abe6fbd..00000000
--- a/navit/transform.c
+++ /dev/null
@@ -1,747 +0,0 @@
-#include <assert.h>
-#include <stdio.h>
-#include <math.h>
-#include <limits.h>
-#include <glib.h>
-#include <string.h>
-#include "config.h"
-#include "coord.h"
-#include "debug.h"
-#include "map.h"
-#include "transform.h"
-#include "projection.h"
-#include "point.h"
-
-struct transformation {
- long scale; /* Scale factor */
- int angle; /* Rotation angle */
- double cos_val,sin_val; /* cos and sin of rotation angle */
- enum projection pro;
- struct map_selection *map_sel;
- struct map_selection *screen_sel;
- struct point screen_center;
- struct coord map_center; /* Center of source rectangle */
-};
-
-struct transformation *
-transform_new(void)
-{
- struct transformation *this_;
-
- this_=g_new0(struct transformation, 1);
-
- return this_;
-}
-
-static const double gar2geo_units = 360.0/(1<<24);
-static const double geo2gar_units = 1/(360.0/(1<<24));
-
-void
-transform_to_geo(enum projection pro, struct coord *c, struct coord_geo *g)
-{
- switch (pro) {
- case projection_mg:
- g->lng=c->x/6371000.0/M_PI*180;
- g->lat=atan(exp(c->y/6371000.0))/M_PI*360-90;
- break;
- case projection_garmin:
- g->lng=c->x*gar2geo_units;
- g->lat=c->y*gar2geo_units;
- break;
- default:
- break;
- }
-}
-
-void
-transform_from_geo(enum projection pro, struct coord_geo *g, struct coord *c)
-{
- switch (pro) {
- case projection_mg:
- c->x=g->lng*6371000.0*M_PI/180;
- c->y=log(tan(M_PI_4+g->lat*M_PI/360))*6371000.0;
- break;
- case projection_garmin:
- c->x=g->lng*geo2gar_units;
- c->y=g->lat*geo2gar_units;
- break;
- default:
- break;
- }
-}
-
-void
-transform_from_to(struct coord *cfrom, enum projection from, struct coord *cto, enum projection to)
-{
- struct coord_geo g;
- transform_to_geo(from, cfrom, &g);
- transform_from_geo(to, &g, cto);
-}
-
-void
-transform_geo_to_cart(struct coord_geo *geo, double a, double b, struct coord_geo_cart *cart)
-{
- double n,ee=1-b*b/(a*a);
- n = a/sqrt(1-ee*sin(geo->lat)*sin(geo->lat));
- cart->x=n*cos(geo->lat)*cos(geo->lng);
- cart->y=n*cos(geo->lat)*sin(geo->lng);
- cart->z=n*(1-ee)*sin(geo->lat);
-}
-
-void
-transform_cart_to_geo(struct coord_geo_cart *cart, double a, double b, struct coord_geo *geo)
-{
- double lat,lati,n,ee=1-b*b/(a*a), lng = atan(cart->y/cart->x);
-
- lat = atan(cart->z / sqrt((cart->x * cart->x) + (cart->y * cart->y)));
- do
- {
- lati = lat;
-
- n = a / sqrt(1-ee*sin(lat)*sin(lat));
- lat = atan((cart->z + ee * n * sin(lat)) / sqrt(cart->x * cart->x + cart->y * cart->y));
- }
- while (fabs(lat - lati) >= 0.000000000000001);
-
- geo->lng=lng/M_PI*180;
- geo->lat=lat/M_PI*180;
-}
-
-
-void
-transform_datum(struct coord_geo *from, enum map_datum from_datum, struct coord_geo *to, enum map_datum to_datum)
-{
-}
-
-int
-transform(struct transformation *t, enum projection pro, struct coord *c, struct point *p, int count, int unique)
-{
- struct coord c1;
- int xcn, ycn;
- struct coord_geo g;
-#ifdef AVOID_FLOAT
- int xc,yc;
-#else
- double xc,yc;
-#endif
- int i,j = 0;
- for (i=0; i < count; i++) {
- if (pro == t->pro) {
- xc=c[i].x;
- yc=c[i].y;
- } else {
- transform_to_geo(pro, &c[i], &g);
- transform_from_geo(t->pro, &g, &c1);
- xc=c1.x;
- yc=c1.y;
- }
-// dbg(2,"0x%x, 0x%x - 0x%x,0x%x contains 0x%x,0x%x\n", t->r.lu.x, t->r.lu.y, t->r.rl.x, t->r.rl.y, c->x, c->y);
-// ret=coord_rect_contains(&t->r, c);
- xc-=t->map_center.x;
- yc-=t->map_center.y;
- yc=-yc;
- if (t->angle) {
- xcn=xc*t->cos_val+yc*t->sin_val;
- ycn=-xc*t->sin_val+yc*t->cos_val;
- xc=xcn;
- yc=ycn;
- }
- xc=xc*16;
- yc=yc*16;
-#ifndef AVOID_FLOAT
- if (t->scale!=1) {
- xc=xc/(double)(t->scale);
- yc=yc/(double)(t->scale);
- }
-#else
- if (t->scale!=1) {
- xc=xc/t->scale;
- yc=yc/t->scale;
- }
-#endif
- xc+=t->screen_center.x;
- yc+=t->screen_center.y;
- if (xc < -0x8000)
- xc=-0x8000;
- if (xc > 0x7fff) {
- xc=0x7fff;
- }
- if (yc < -0x8000)
- yc=-0x8000;
- if (yc > 0x7fff)
- yc=0x7fff;
- if (j == 0 || !unique || p[j-1].x != xc || p[j-1].y != yc) {
- p[j].x=xc;
- p[j].y=yc;
- j++;
- }
- }
- return j;
-}
-
-void
-transform_reverse(struct transformation *t, struct point *p, struct coord *c)
-{
- int xc,yc;
- xc=p->x;
- yc=p->y;
- xc-=t->screen_center.x;
- yc-=t->screen_center.y;
- xc=xc*t->scale/16;
- yc=-yc*t->scale/16;
- if (t->angle) {
- int xcn, ycn;
- xcn=xc*t->cos_val+yc*t->sin_val;
- ycn=-xc*t->sin_val+yc*t->cos_val;
- xc=xcn;
- yc=ycn;
- }
- c->x=t->map_center.x+xc;
- c->y=t->map_center.y+yc;
-}
-
-enum projection
-transform_get_projection(struct transformation *this_)
-{
- return this_->pro;
-}
-
-void
-transform_set_projection(struct transformation *this_, enum projection pro)
-{
- this_->pro=pro;
-}
-
-static int
-min4(int v1,int v2, int v3, int v4)
-{
- int res=v1;
- if (v2 < res)
- res=v2;
- if (v3 < res)
- res=v3;
- if (v4 < res)
- res=v4;
- return res;
-}
-
-static int
-max4(int v1,int v2, int v3, int v4)
-{
- int res=v1;
- if (v2 > res)
- res=v2;
- if (v3 > res)
- res=v3;
- if (v4 > res)
- res=v4;
- return res;
-}
-
-struct map_selection *
-transform_get_selection(struct transformation *this_, enum projection pro, int order)
-{
-
- struct map_selection *ret,*curri,*curro;
- struct coord_geo g;
- int i;
-
- ret=map_selection_dup(this_->map_sel);
- curri=this_->map_sel;
- curro=ret;
- while (curri) {
- if (this_->pro != pro) {
- transform_to_geo(this_->pro, &curri->u.c_rect.lu, &g);
- transform_from_geo(pro, &g, &curro->u.c_rect.lu);
- dbg(1,"%f,%f", g.lat, g.lng);
- transform_to_geo(this_->pro, &curri->u.c_rect.rl, &g);
- transform_from_geo(pro, &g, &curro->u.c_rect.rl);
- dbg(1,": - %f,%f\n", g.lat, g.lng);
- }
- dbg(1,"transform rect for %d is %d,%d - %d,%d\n", pro, curro->u.c_rect.lu.x, curro->u.c_rect.lu.y, curro->u.c_rect.rl.x, curro->u.c_rect.rl.y);
- for (i = 0 ; i < layer_end ; i++)
- curro->order[i]+=order;
- curri=curri->next;
- curro=curro->next;
- }
- return ret;
-}
-
-struct coord *
-transform_center(struct transformation *this_)
-{
- return &this_->map_center;
-}
-
-void
-transform_set_angle(struct transformation *t,int angle)
-{
- t->angle=angle;
- t->cos_val=cos(M_PI*t->angle/180);
- t->sin_val=sin(M_PI*t->angle/180);
-}
-
-int
-transform_get_angle(struct transformation *this_,int angle)
-{
- return this_->angle;
-}
-
-void
-transform_set_screen_selection(struct transformation *t, struct map_selection *sel)
-{
- map_selection_destroy(t->screen_sel);
- t->screen_sel=map_selection_dup(sel);
- if (sel) {
- t->screen_center.x=(sel->u.p_rect.rl.x-sel->u.p_rect.lu.x)/2;
- t->screen_center.y=(sel->u.p_rect.rl.y-sel->u.p_rect.lu.y)/2;
- }
-}
-
-#if 0
-void
-transform_set_size(struct transformation *t, int width, int height)
-{
- t->width=width;
- t->height=height;
-}
-#endif
-
-void
-transform_get_size(struct transformation *t, int *width, int *height)
-{
- struct point_rect *r;
- if (t->screen_sel) {
- r=&t->screen_sel->u.p_rect;
- *width=r->rl.x-r->lu.x;
- *height=r->rl.y-r->lu.y;
- }
-}
-
-void
-transform_setup(struct transformation *t, struct pcoord *c, int scale, int angle)
-{
- t->pro=c->pro;
- t->map_center.x=c->x;
- t->map_center.y=c->y;
- t->scale=scale;
- transform_set_angle(t, angle);
-}
-
-#if 0
-
-void
-transform_setup_source_rect_limit(struct transformation *t, struct coord *center, int limit)
-{
- t->center=*center;
- t->scale=1;
- t->angle=0;
- t->r.lu.x=center->x-limit;
- t->r.rl.x=center->x+limit;
- t->r.rl.y=center->y-limit;
- t->r.lu.y=center->y+limit;
-}
-#endif
-
-void
-transform_setup_source_rect(struct transformation *t)
-{
- int i;
- struct coord screen[4];
- struct point screen_pnt[4];
- struct point_rect *pr;
- struct map_selection *ms,*msm,*next,**msm_last;
- ms=t->map_sel;
- while (ms) {
- next=ms->next;
- g_free(ms);
- ms=next;
- }
- t->map_sel=NULL;
- msm_last=&t->map_sel;
- ms=t->screen_sel;
- while (ms) {
- msm=g_new0(struct map_selection, 1);
- *msm=*ms;
- pr=&ms->u.p_rect;
- screen_pnt[0].x=pr->lu.x;
- screen_pnt[0].y=pr->lu.y;
- screen_pnt[1].x=pr->rl.x;
- screen_pnt[1].y=pr->lu.y;
- screen_pnt[2].x=pr->lu.x;
- screen_pnt[2].y=pr->rl.y;
- screen_pnt[3].x=pr->rl.x;
- screen_pnt[3].y=pr->rl.y;
- for (i = 0 ; i < 4 ; i++) {
- transform_reverse(t, &screen_pnt[i], &screen[i]);
- }
- msm->u.c_rect.lu.x=min4(screen[0].x,screen[1].x,screen[2].x,screen[3].x);
- msm->u.c_rect.rl.x=max4(screen[0].x,screen[1].x,screen[2].x,screen[3].x);
- msm->u.c_rect.rl.y=min4(screen[0].y,screen[1].y,screen[2].y,screen[3].y);
- msm->u.c_rect.lu.y=max4(screen[0].y,screen[1].y,screen[2].y,screen[3].y);
- *msm_last=msm;
- msm_last=&msm->next;
- ms=ms->next;
- }
-}
-
-long
-transform_get_scale(struct transformation *t)
-{
- return t->scale;
-}
-
-void
-transform_set_scale(struct transformation *t, long scale)
-{
- t->scale=scale;
-}
-
-
-int
-transform_get_order(struct transformation *t)
-{
- int scale=t->scale;
- int order=0;
- while (scale > 1) {
- order++;
- scale>>=1;
- }
- order=18-order;
- if (order < 0)
- order=0;
- return order;
-}
-
-
-void
-transform_geo_text(struct coord_geo *g, char *buffer)
-{
- double lng=g->lng;
- double lat=g->lat;
- char lng_c='E';
- char lat_c='N';
-
- if (lng < 0) {
- lng=-lng;
- lng_c='W';
- }
- if (lat < 0) {
- lat=-lat;
- lat_c='S';
- }
-
- sprintf(buffer,"%02.0f%07.4f%c %03.0f%07.4f%c", floor(lat), fmod(lat*60,60), lat_c, floor(lng), fmod(lng*60,60), lng_c);
-
-}
-
-#define TWOPI (M_PI*2)
-#define GC2RAD(c) ((c) * TWOPI/(1<<24))
-#define minf(a,b) ((a) < (b) ? (a) : (b))
-
-static double
-transform_distance_garmin(struct coord *c1, struct coord *c2)
-{
-#ifdef USE_HALVESINE
- static const int earth_radius = 6371*1000; //m change accordingly
-// static const int earth_radius = 3960; //miles
-
-//Point 1 cords
- float lat1 = GC2RAD(c1->y);
- float long1 = GC2RAD(c1->x);
-
-//Point 2 cords
- float lat2 = GC2RAD(c2->y);
- float long2 = GC2RAD(c2->x);
-
-//Haversine Formula
- float dlong = long2-long1;
- float dlat = lat2-lat1;
-
- float sinlat = sinf(dlat/2);
- float sinlong = sinf(dlong/2);
-
- float a=(sinlat*sinlat)+cosf(lat1)*cosf(lat2)*(sinlong*sinlong);
- float c=2*asinf(minf(1,sqrt(a)));
-#ifdef AVOID_FLOAT
- return round(earth_radius*c);
-#else
- return earth_radius*c;
-#endif
-#else
-#define GMETER 2.3887499999999999
- double dx,dy;
- dx=c1->x-c2->x;
- dy=c1->y-c2->y;
- return sqrt(dx*dx+dy*dy)*GMETER;
-#undef GMETER
-#endif
-}
-
-double
-transform_scale(int y)
-{
- struct coord c;
- struct coord_geo g;
- c.x=0;
- c.y=y;
- transform_to_geo(projection_mg, &c, &g);
- return 1/cos(g.lat/180*M_PI);
-}
-
-#ifdef AVOID_FLOAT
-static int
-tab_sqrt[]={14142,13379,12806,12364,12018,11741,11517,11333,11180,11051,10943,10850,10770,10701,10640,10587,10540,10499,10462,10429,10400,10373,10349,10327,10307,10289,10273,10257,10243,10231,10219,10208};
-#endif
-
-double
-transform_distance(enum projection pro, struct coord *c1, struct coord *c2)
-{
- if (pro == projection_mg) {
-#ifndef AVOID_FLOAT
- double dx,dy,scale=transform_scale((c1->y+c2->y)/2);
- dx=c1->x-c2->x;
- dy=c1->y-c2->y;
- return sqrt(dx*dx+dy*dy)/scale;
-#else
- int dx,dy,f,scale=15539;
- dx=c1->x-c2->x;
- dy=c1->y-c2->y;
- if (dx < 0)
- dx=-dx;
- if (dy < 0)
- dy=-dy;
- while (dx > 20000 || dy > 20000) {
- dx/=10;
- dy/=10;
- scale/=10;
- }
- if (! dy)
- return dx*10000/scale;
- if (! dx)
- return dy*10000/scale;
- if (dx > dy) {
- f=dx*8/dy-8;
- if (f >= 32)
- return dx*10000/scale;
- return dx*tab_sqrt[f]/scale;
- } else {
- f=dy*8/dx-8;
- if (f >= 32)
- return dy*10000/scale;
- return dy*tab_sqrt[f]/scale;
- }
-#endif
- } else if (pro == projection_garmin) {
- return transform_distance_garmin(c1, c2);
- } else {
- printf("Unknown projection: %d\n", pro);
- return 0;
- }
-}
-
-int
-transform_distance_sq(struct coord *c1, struct coord *c2)
-{
- int dx=c1->x-c2->x;
- int dy=c1->y-c2->y;
-
- if (dx > 32767 || dy > 32767 || dx < -32767 || dy < -32767)
- return INT_MAX;
- else
- return dx*dx+dy*dy;
-}
-
-int
-transform_distance_line_sq(struct coord *l0, struct coord *l1, struct coord *ref, struct coord *lpnt)
-{
- int vx,vy,wx,wy;
- int c1,c2;
- int climit=1000000;
- struct coord l;
-
- vx=l1->x-l0->x;
- vy=l1->y-l0->y;
- wx=ref->x-l0->x;
- wy=ref->y-l0->y;
-
- c1=vx*wx+vy*wy;
- if ( c1 <= 0 ) {
- if (lpnt)
- *lpnt=*l0;
- return transform_distance_sq(l0, ref);
- }
- c2=vx*vx+vy*vy;
- if ( c2 <= c1 ) {
- if (lpnt)
- *lpnt=*l1;
- return transform_distance_sq(l1, ref);
- }
- while (c1 > climit || c2 > climit) {
- c1/=256;
- c2/=256;
- }
- l.x=l0->x+vx*c1/c2;
- l.y=l0->y+vy*c1/c2;
- if (lpnt)
- *lpnt=l;
- return transform_distance_sq(&l, ref);
-}
-
-int
-transform_distance_polyline_sq(struct coord *c, int count, struct coord *ref, struct coord *lpnt, int *pos)
-{
- int i,dist,distn;
- struct coord lp;
- if (count < 2)
- return INT_MAX;
- if (pos)
- *pos=0;
- dist=transform_distance_line_sq(&c[0], &c[1], ref, lpnt);
- for (i=2 ; i < count ; i++) {
- distn=transform_distance_line_sq(&c[i-1], &c[i], ref, &lp);
- if (distn < dist) {
- dist=distn;
- if (lpnt)
- *lpnt=lp;
- if (pos)
- *pos=i-1;
- }
- }
- return dist;
-}
-
-
-void
-transform_print_deg(double deg)
-{
- printf("%2.0f:%2.0f:%2.4f", floor(deg), fmod(deg*60,60), fmod(deg*3600,60));
-}
-
-#ifdef AVOID_FLOAT
-static int tab_atan[]={0,262,524,787,1051,1317,1584,1853,2126,2401,2679,2962,3249,3541,3839,4142,4452,4770,5095,5430,5774,6128,6494,6873,7265,7673,8098,8541,9004,9490,10000,10538};
-
-static int
-atan2_int_lookup(int val)
-{
- int len=sizeof(tab_atan)/sizeof(int);
- int i=len/2;
- int p=i-1;
- for (;;) {
- i>>=1;
- if (val < tab_atan[p])
- p-=i;
- else
- if (val < tab_atan[p+1])
- return p+(p>>1);
- else
- p+=i;
- }
-}
-
-static int
-atan2_int(int dx, int dy)
-{
- int f,mul=1,add=0,ret;
- if (! dx) {
- return dy < 0 ? 180 : 0;
- }
- if (! dy) {
- return dx < 0 ? -90 : 90;
- }
- if (dx < 0) {
- dx=-dx;
- mul=-1;
- }
- if (dy < 0) {
- dy=-dy;
- add=180*mul;
- mul*=-1;
- }
- while (dx > 20000 || dy > 20000) {
- dx/=10;
- dy/=10;
- }
- if (dx > dy) {
- ret=90-atan2_int_lookup(dy*10000/dx);
- } else {
- ret=atan2_int_lookup(dx*10000/dy);
- }
- return ret*mul+add;
-}
-#endif
-
-int
-transform_get_angle_delta(struct coord *c1, struct coord *c2, int dir)
-{
- int dx=c2->x-c1->x;
- int dy=c2->y-c1->y;
-#ifndef AVOID_FLOAT
- double angle;
- angle=atan2(dx,dy);
- angle*=180/M_PI;
-#else
- int angle;
- angle=atan2_int(dx,dy);
-#endif
- if (dir == -1)
- angle=angle-180;
- if (angle < 0)
- angle+=360;
- return angle;
-}
-
-int
-transform_within_border(struct transformation *this_, struct point *p, int border)
-{
- struct map_selection *ms=this_->screen_sel;
- while (ms) {
- struct point_rect *r=&ms->u.p_rect;
- if (p->x >= r->lu.x+border && p->x <= r->rl.x-border &&
- p->y >= r->lu.y+border && p->y <= r->rl.y-border)
- return 1;
- ms=ms->next;
- }
- return 0;
-}
-
-/*
-Note: there are many mathematically equivalent ways to express these formulas. As usual, not all of them are computationally equivalent.
-
-L = latitude in radians (positive north)
-Lo = longitude in radians (positive east)
-E = easting (meters)
-N = northing (meters)
-
-For the sphere
-
-E = r Lo
-N = r ln [ tan (pi/4 + L/2) ]
-
-where
-
-r = radius of the sphere (meters)
-ln() is the natural logarithm
-
-For the ellipsoid
-
-E = a Lo
-N = a * ln ( tan (pi/4 + L/2) * ( (1 - e * sin (L)) / (1 + e * sin (L))) ** (e/2) )
-
-
- e
- -
- pi L 1 - e sin(L) 2
- = a ln( tan( ---- + ---) (--------------) )
- 4 2 1 + e sin(L)
-
-
-where
-
-a = the length of the semi-major axis of the ellipsoid (meters)
-e = the first eccentricity of the ellipsoid
-
-
-*/
-
-
diff --git a/navit/transform.h b/navit/transform.h
deleted file mode 100644
index b47a268c..00000000
--- a/navit/transform.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef NAVIT_TRANSFORM_H
-#define NAVIT_TRANSFORM_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* prototypes */
-enum projection;
-struct coord;
-struct coord_geo;
-struct map_selection;
-struct pcoord;
-struct point;
-struct transformation;
-struct transformation *transform_new(void);
-void transform_to_geo(enum projection pro, struct coord *c, struct coord_geo *g);
-void transform_from_geo(enum projection pro, struct coord_geo *g, struct coord *c);
-void transform_from_to(struct coord *cfrom, enum projection from, struct coord *cto, enum projection to);
-int transform(struct transformation *t, enum projection pro, struct coord *c, struct point *p, int count, int flags);
-void transform_reverse(struct transformation *t, struct point *p, struct coord *c);
-enum projection transform_get_projection(struct transformation *this_);
-void transform_set_projection(struct transformation *this_, enum projection pro);
-struct map_selection *transform_get_selection(struct transformation *this_, enum projection pro, int order);
-struct coord *transform_center(struct transformation *this_);
-void transform_set_angle(struct transformation *t, int angle);
-int transform_get_angle(struct transformation *this_, int angle);
-void transform_set_screen_selection(struct transformation *t, struct map_selection *sel);
-void transform_get_size(struct transformation *t, int *width, int *height);
-void transform_setup(struct transformation *t, struct pcoord *c, int scale, int angle);
-void transform_setup_source_rect(struct transformation *t);
-long transform_get_scale(struct transformation *t);
-void transform_set_scale(struct transformation *t, long scale);
-int transform_get_order(struct transformation *t);
-void transform_geo_text(struct coord_geo *g, char *buffer);
-double transform_scale(int y);
-double transform_distance(enum projection pro, struct coord *c1, struct coord *c2);
-int transform_distance_sq(struct coord *c1, struct coord *c2);
-int transform_distance_line_sq(struct coord *l0, struct coord *l1, struct coord *ref, struct coord *lpnt);
-int transform_distance_polyline_sq(struct coord *c, int count, struct coord *ref, struct coord *lpnt, int *pos);
-void transform_print_deg(double deg);
-int transform_get_angle_delta(struct coord *c1, struct coord *c2, int dir);
-int transform_within_border(struct transformation *this_, struct point *p, int border);
-/* end of prototypes */
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/navit/types.h b/navit/types.h
deleted file mode 100644
index 0fa5b5a9..00000000
--- a/navit/types.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef NAVIT_TYPES_H
-#define NAVIT_TYPES_H
-#include <stdint.h>
-
-typedef int8_t s8;
-typedef uint8_t u8;
-typedef int16_t s16;
-typedef uint16_t u16;
-typedef int32_t s32;
-typedef uint32_t u32;
-
-#endif
diff --git a/navit/util.c b/navit/util.c
deleted file mode 100644
index 1d56f92c..00000000
--- a/navit/util.c
+++ /dev/null
@@ -1,55 +0,0 @@
-#include <glib.h>
-#include <ctype.h>
-#include "util.h"
-
-void
-strtoupper(char *dest, const char *src)
-{
- while (*src)
- *dest++=toupper(*src++);
- *dest='\0';
-}
-
-void
-strtolower(char *dest, const char *src)
-{
- while (*src)
- *dest++=tolower(*src++);
- *dest='\0';
-}
-
-
-static void
-hash_callback(gpointer key, gpointer value, gpointer user_data)
-{
- GList **l=user_data;
- *l=g_list_prepend(*l, value);
-}
-
-GList *
-g_hash_to_list(GHashTable *h)
-{
- GList *ret=NULL;
- g_hash_table_foreach(h, hash_callback, &ret);
-
- return ret;
-}
-
-
-#if defined(_UNICODE)
-wchar_t* newSysString(const char *toconvert)
-{
- int newstrlen = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, toconvert, -1, 0, 0);
- wchar_t *newstring = g_new(wchar_t,newstrlen);
- MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, toconvert, -1, newstring, newstrlen) ;
- return newstring;
-}
-#else
-char * newSysString(const char *toconvert)
-{
- char *newstring = g_new(byte,strlen(toconvert)+1);
- strcpy(newstring, toconvert);
- return newstring;
-}
-#endif
-
diff --git a/navit/util.h b/navit/util.h
deleted file mode 100644
index 511acf35..00000000
--- a/navit/util.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef NAVIT_types_H
-#define NAVIT_types_H
-
-#include <ctype.h>
-#include <windows.h>
-#include <wchar.h>
-#include <glib.h>
-
-void strtoupper(char *dest, const char *src);
-void strtolower(char *dest, const char *src);
-GList * g_hash_to_list(GHashTable *h);
-
-TCHAR* newSysString(const char *);
-
-
-#define UTF8_TO_UNICODE(UTF8NAME,UNICODENAME) \
- int UTF8_LENGTH = strlen(UTF8NAME); \
- wchar_t UNICODENAME[UTF8_LENGTH + 1]; \
- mbstowcs(UNICODENAME, UTF8NAME, UTF8_LENGTH + 1);
-
-#define UNICODE_TO_UTF8(UNICODENAME,UTF8NAME) \
- int UNICODE_LENGTH = lstrlen(UNICODENAME); \
- char UTF8NAME[UNICODE_LENGTH + 1]; \
- wcstombs(UTF8NAME, UNICODENAME, UNICODE_LENGTH + 1);
-
-
-#ifdef _UNICODE
-
-#define _sntprintf _snwprintf
-#define stprintf swprintf
-
-#define TCHAR_TO_UTF8(PARAM1,PARAM2) UNICODE_TO_UTF8(PARAM1,PARAM2)
-#define UTF8_TO_TCHAR(PARAM1,PARAM2) UTF8_TO_UNICODE(PARAM1,PARAM2)
-
-
-#else //_UNICODE
-
-#define TCHAR_TO_UTF8(PARAM1,PARAM2) \
- char *PARAM2 = PARAM1;
-
-#define UTF8_TO_TCHAR(PARAM1,PARAM2) \
- char *PARAM2 = PARAM1;
-
-
-#define _sntprintf _snprintf
-#define stprintf sprintf
-
-#endif //_UNICODE
-
-#endif
-
diff --git a/navit/vehicle.c b/navit/vehicle.c
deleted file mode 100644
index 5d93142d..00000000
--- a/navit/vehicle.c
+++ /dev/null
@@ -1,197 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-#include "config.h"
-#include "debug.h"
-#include "coord.h"
-#include "item.h"
-#include "log.h"
-#include "callback.h"
-#include "plugin.h"
-#include "vehicle.h"
-
-struct vehicle {
- char *name;
- struct vehicle_priv *priv;
- struct vehicle_methods meth;
- struct callback_list *cbl;
- struct log *nmea_log, *gpx_log;
-};
-
-static void
-vehicle_log_nmea(struct vehicle *this_, struct log *log)
-{
- struct attr pos_attr;
- if (!this_->meth.position_attr_get)
- return;
- if (!this_->meth.position_attr_get(this_->priv, attr_position_nmea, &pos_attr))
- return;
- log_write(log, pos_attr.u.str, strlen(pos_attr.u.str));
-}
-
-static void
-vehicle_log_gpx(struct vehicle *this_, struct log *log)
-{
- struct attr pos_attr;
- char buffer[256];
- if (!this_->meth.position_attr_get)
- return;
- if (!this_->meth.position_attr_get(this_->priv, attr_position_coord_geo, &pos_attr))
- return;
- sprintf(buffer,"<trkpt lat=\"%f\" lon=\"%f\" />\n", pos_attr.u.coord_geo->lat, pos_attr.u.coord_geo->lng);
- log_write(log, buffer, strlen(buffer));
-}
-
-
-static void
-vehicle_log_textfile(struct vehicle *this_, struct log *log)
-{
- struct attr pos_attr;
- char buffer[256];
- if (!this_->meth.position_attr_get)
- return;
- if (!this_->meth.position_attr_get(this_->priv, attr_position_coord_geo, &pos_attr))
- return;
- sprintf(buffer,"%f %f type=trackpoint\n", pos_attr.u.coord_geo->lng, pos_attr.u.coord_geo->lat);
- log_write(log, buffer, strlen(buffer));
-}
-
-static int
-vehicle_add_log(struct vehicle *this_, struct log *log)
-{
- struct callback *cb;
- struct attr type_attr;
- if (!log_get_attr(log, attr_type, &type_attr, NULL))
- return 1;
-
- if (!strcmp(type_attr.u.str, "nmea")) {
- cb=callback_new_2(callback_cast(vehicle_log_nmea), this_, log);
- } else if (!strcmp(type_attr.u.str, "gpx")) {
- char *header =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx version=\"1.0\" creator=\"Navit http://navit.sourceforge.net\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.topografix.com/GPX/1/0\" xsi:schemaLocation=\"http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd\">\n<trk>\n<trkseg>\n";
- char *trailer = "</trkseg>\n</trk>\n</gpx>\n";
- log_set_header(log, header, strlen(header));
- log_set_trailer(log, trailer, strlen(trailer));
- cb=callback_new_2(callback_cast(vehicle_log_gpx), this_, log);
- } else if (!strcmp(type_attr.u.str, "textfile")) {
- char *header = "type=track\n";
- log_set_header(log, header, strlen(header));
- cb=callback_new_2(callback_cast(vehicle_log_textfile), this_, log);
- } else
- return 1;
- callback_list_add(this_->cbl, cb);
- return 0;
-}
-
-struct vehicle *
-vehicle_new(struct attr **attrs)
-{
- struct vehicle *this_;
- struct attr *source;
- struct vehicle_priv *(*vehicletype_new) (struct vehicle_methods *
- meth,
- struct callback_list *
- cbl,
- struct attr ** attrs);
- char *type, *colon;
- struct attr *name;
-
- dbg(1, "enter\n");
- source = attr_search(attrs, NULL, attr_source);
- if (!source) {
- dbg(0, "no source\n");
- return NULL;
- }
-
- type = g_strdup(source->u.str);
- colon = index(type, ':');
- if (colon)
- *colon = '\0';
- dbg(1, "source='%s' type='%s'\n", source->u.str, type);
-
- vehicletype_new = plugin_get_vehicle_type(type);
- if (!vehicletype_new) {
- dbg(0, "invalid type\n");
- return NULL;
- }
- this_ = g_new0(struct vehicle, 1);
- this_->cbl = callback_list_new();
- this_->priv = vehicletype_new(&this_->meth, this_->cbl, attrs);
- if (!this_->priv) {
- dbg(0, "vehicletype_new failed\n");
- callback_list_destroy(this_->cbl);
- g_free(this_);
- return NULL;
- }
- dbg(1, "leave\n");
-
- if ((name=attr_search(attrs, NULL, attr_name))) {
- this_->name=g_strdup(name->u.str);
- } else {
- this_->name=g_strdup("Noname");
- }
- return this_;
-}
-
-int
-vehicle_get_attr(struct vehicle *this_, enum attr_type type, struct attr *attr)
-{
- switch (type) {
- case attr_name:
- attr->u.str=this_->name;
- break;
- default:
- if (this_->meth.position_attr_get) {
- return this_->meth.position_attr_get(this_->priv, type, attr);
- } else {
- return 0;
- }
- }
- attr->type=type;
- return 1;
-}
-
-int
-vehicle_set_attr(struct vehicle *this_, struct attr *attr,
- struct attr **attrs)
-{
- if (this_->meth.set_attr)
- return this_->meth.set_attr(this_->priv, attr, attrs);
- return 0;
-}
-
-int
-vehicle_add_attr(struct vehicle *this_, struct attr *attr)
-{
- switch (attr->type) {
- case attr_callback:
- callback_list_add(this_->cbl, attr->u.callback);
- break;
- case attr_log:
- return vehicle_add_log(this_, attr->u.log);
- default:
- return 0;
- }
- return 1;
-}
-
-int
-vehicle_remove_attr(struct vehicle *this_, struct attr *attr)
-{
- switch (attr->type) {
- case attr_callback:
- callback_list_remove(this_->cbl, attr->u.callback);
- break;
- default:
- return 0;
- }
- return 1;
-}
-
-void
-vehicle_destroy(struct vehicle *this_)
-{
- callback_list_destroy(this_->cbl);
- if(this_->name) g_free(this_->name);
- g_free(this_);
-}
diff --git a/navit/vehicle.h b/navit/vehicle.h
deleted file mode 100644
index 971bd3f2..00000000
--- a/navit/vehicle.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef NAVIT_VEHICLE_H
-#define NAVIT_VEHICLE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-struct vehicle;
-struct vehicle_priv;
-enum attr_type;
-struct attr;
-
-struct vehicle_methods {
- void (*destroy)(struct vehicle_priv *priv);
- int (*position_attr_get)(struct vehicle_priv *priv, enum attr_type type, struct attr *attr);
- int (*set_attr)(struct vehicle_priv *priv, struct attr *attr, struct attr **attrs);
-
-};
-
-/* prototypes */
-struct vehicle *vehicle_new(struct attr **attrs);
-int vehicle_get_attr(struct vehicle *this_, enum attr_type type, struct attr *attr);
-int vehicle_set_attr(struct vehicle *this_, struct attr *attr, struct attr **attrs);
-int vehicle_add_attr(struct vehicle *this_, struct attr *attr);
-int vehicle_remove_attr(struct vehicle *this_, struct attr *attr);
-void vehicle_destroy(struct vehicle *this_);
-/* end of prototypes */
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/navit/vehicle/Makefile.am b/navit/vehicle/Makefile.am
deleted file mode 100644
index 8901833f..00000000
--- a/navit/vehicle/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-SUBDIRS=demo file
-if VEHICLE_GPSD
- SUBDIRS += gpsd
-endif
diff --git a/navit/vehicle/demo/Makefile.am b/navit/vehicle/demo/Makefile.am
deleted file mode 100644
index d61030b0..00000000
--- a/navit/vehicle/demo/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=vehicle_demo
-modulevehicle_LTLIBRARIES = libvehicle_demo.la
-libvehicle_demo_la_SOURCES = vehicle_demo.c
diff --git a/navit/vehicle/demo/vehicle_demo.c b/navit/vehicle/demo/vehicle_demo.c
deleted file mode 100644
index 46b9c68d..00000000
--- a/navit/vehicle/demo/vehicle_demo.c
+++ /dev/null
@@ -1,176 +0,0 @@
-#include <glib.h>
-#include <string.h>
-#include "config.h"
-#include "debug.h"
-#include "coord.h"
-#include "item.h"
-#include "navit.h"
-#include "map.h"
-#include "route.h"
-#include "callback.h"
-#include "transform.h"
-#include "plugin.h"
-#include "vehicle.h"
-
-struct vehicle_priv {
- int interval;
- int position_set;
- struct callback_list *cbl;
- struct navit *navit;
- struct coord_geo geo;
- struct coord last;
- double config_speed;
- double speed;
- double direction;
-};
-
-static void
-vehicle_demo_destroy(struct vehicle_priv *priv)
-{
- g_free(priv);
-}
-
-static int
-vehicle_demo_position_attr_get(struct vehicle_priv *priv,
- enum attr_type type, struct attr *attr)
-{
- switch (type) {
- case attr_position_speed:
- attr->u.numd = &priv->speed;
- break;
- case attr_position_direction:
- attr->u.numd = &priv->direction;
- break;
- case attr_position_coord_geo:
- attr->u.coord_geo = &priv->geo;
- break;
- default:
- return 0;
- }
- attr->type = type;
- return 1;
-}
-
-static int
-vehicle_demo_set_attr(struct vehicle_priv *priv, struct attr *attr,
- struct attr **attrs)
-{
- if (attr->type == attr_navit) {
- priv->navit = attr->u.navit;
- return 1;
- }
- return 0;
-}
-
-struct vehicle_methods vehicle_demo_methods = {
- vehicle_demo_destroy,
- vehicle_demo_position_attr_get,
- vehicle_demo_set_attr,
-};
-
-static int
-vehicle_demo_timer(struct vehicle_priv *priv)
-{
- struct coord c, c2, pos, ci;
- int slen, len, dx, dy;
- struct route *route=NULL;
- struct map *route_map=NULL;
- struct map_rect *mr=NULL;
- struct item *item=NULL;
-
- len = (priv->config_speed * priv->interval / 1000)/ 3.6;
- dbg(1, "###### Entering simulation loop\n");
- if (priv->navit)
- route=navit_get_route(priv->navit);
- if (route)
- route_map=route_get_map(route);
- if (route_map)
- mr=map_rect_new(route_map, NULL);
- if (mr)
- item=map_rect_get_item(mr);
- if (mr && item_coord_get(item, &pos, 1)) {
- priv->position_set=0;
- dbg(1, "current pos=0x%x,0x%x\n", pos.x, pos.y);
- dbg(1, "last pos=0x%x,0x%x\n", priv->last.x, priv->last.y);
- if (priv->last.x == pos.x && priv->last.y == pos.y) {
- dbg(1, "endless loop\n");
- }
- priv->last = pos;
- while (item && priv->config_speed) {
- if (!item_coord_get(item, &c, 1)) {
- item=map_rect_get_item(mr);
- continue;
- }
- dbg(1, "next pos=0x%x,0x%x\n", c.x, c.y);
- slen = transform_distance(projection_mg, &pos, &c);
- dbg(1, "len=%d slen=%d\n", len, slen);
- if (slen < len) {
- len -= slen;
- pos = c;
- } else {
- if (item_coord_get(item, &c2, 1) || map_rect_get_item(mr)) {
- dx = c.x - pos.x;
- dy = c.y - pos.y;
- ci.x = pos.x + dx * len / slen;
- ci.y = pos.y + dy * len / slen;
- priv->direction =
- transform_get_angle_delta(&pos, &c, 0);
- priv->speed=priv->config_speed;
- } else {
- ci.x = pos.x;
- ci.y = pos.y;
- priv->speed=0;
- dbg(0,"destination reached\n");
- }
- dbg(1, "ci=0x%x,0x%x\n", ci.x, ci.y);
- transform_to_geo(projection_mg, &ci,
- &priv->geo);
- callback_list_call_0(priv->cbl);
- break;
- }
- }
- } else {
- if (priv->position_set)
- callback_list_call_0(priv->cbl);
- }
- if (mr)
- map_rect_destroy(mr);
- return 1;
-}
-
-
-
-static struct vehicle_priv *
-vehicle_demo_new(struct vehicle_methods
- *meth, struct callback_list
- *cbl, struct attr **attrs)
-{
- struct vehicle_priv *ret;
- struct attr *interval,*speed,*position_coord_geo;
-
- dbg(1, "enter\n");
- ret = g_new0(struct vehicle_priv, 1);
- ret->cbl = cbl;
- ret->interval=1000;
- ret->config_speed=40;
- if ((speed=attr_search(attrs, NULL, attr_speed))) {
- ret->config_speed=speed->u.num;
- }
- if ((interval=attr_search(attrs, NULL, attr_interval)))
- ret->interval=interval->u.num;
- if ((position_coord_geo=attr_search(attrs, NULL, attr_position_coord_geo))) {
- ret->geo=*(position_coord_geo->u.coord_geo);
- ret->position_set=1;
- dbg(0,"position_set %f %f\n", ret->geo.lat, ret->geo.lng);
- }
- *meth = vehicle_demo_methods;
- g_timeout_add(ret->interval, (GSourceFunc) vehicle_demo_timer, ret);
- return ret;
-}
-
-void
-plugin_init(void)
-{
- dbg(1, "enter\n");
- plugin_register_vehicle_type("demo", vehicle_demo_new);
-}
diff --git a/navit/vehicle/file/Makefile.am b/navit/vehicle/file/Makefile.am
deleted file mode 100644
index 51064ad4..00000000
--- a/navit/vehicle/file/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=vehicle_file
-modulevehicle_LTLIBRARIES = libvehicle_file.la
-libvehicle_file_la_SOURCES = vehicle_file.c
diff --git a/navit/vehicle/file/vehicle_file.c b/navit/vehicle/file/vehicle_file.c
deleted file mode 100644
index 86dc4e19..00000000
--- a/navit/vehicle/file/vehicle_file.c
+++ /dev/null
@@ -1,500 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <glib.h>
-#include <sys/stat.h>
-#ifdef _WIN32
- #include <serial_io.h>
-#else
-#include <termios.h>
-#endif
-#include <math.h>
-#include "config.h"
-#include "debug.h"
-#include "callback.h"
-#include "plugin.h"
-#include "coord.h"
-#include "item.h"
-#include "vehicle.h"
-
-static void vehicle_file_disable_watch(struct vehicle_priv *priv);
-static void vehicle_file_enable_watch(struct vehicle_priv *priv);
-static void vehicle_file_parse(struct vehicle_priv *priv, char *buffer);
-static int vehicle_file_open(struct vehicle_priv *priv);
-static void vehicle_file_close(struct vehicle_priv *priv);
-
-
-enum file_type {
- file_type_pipe = 1, file_type_device, file_type_file
-};
-
-static int buffer_size = 256;
-
-struct vehicle_priv {
- char *source;
- enum file_type file_type;
- struct callback_list *cbl;
- int fd;
- FILE *file;
- guint watch;
- GIOChannel *iochan;
- char *buffer;
- int buffer_pos;
- char *nmea_data;
- char *nmea_data_buf;
-
- struct coord_geo geo;
- double speed;
- double direction;
- double height;
- int status;
- int sats_used;
- int time;
- int on_eof;
-#ifdef _WIN32
- int no_data_count;
-#endif
-};
-
-#ifdef _WIN32
-static int vehicle_win32_serial_track(struct vehicle_priv *priv)
-{
-
- static char buffer[2048] = {0,};
- static int current_index = 0;
- const int chunk_size = 1024;
-
- if ( priv->no_data_count > 5 )
- {
- vehicle_file_close( priv );
- priv->no_data_count = 0;
- }
-
- if ( priv->fd <= 0 )
- {
- vehicle_file_open( priv );
- }
-
- if ( current_index >= ( sizeof( buffer ) - chunk_size ) )
- {
- // discard
- current_index = 0;
- memset( buffer, 0 , sizeof( buffer ) );
- }
-
- int dwBytes = serial_io_read( priv->fd, &buffer[ current_index ], chunk_size );
- if ( dwBytes > 0 )
- {
- current_index += dwBytes;
-
- char* return_pos = NULL;
- while ( ( return_pos = strchr( buffer, '\n' ) ) != NULL )
- {
- char return_buffer[1024];
- int bytes_to_copy = return_pos - buffer + 1;
- memcpy( return_buffer, buffer, bytes_to_copy );
- return_buffer[ bytes_to_copy + 1 ] = '\0';
-
- // printf( "received %d : '%s' bytes to copy\n", bytes_to_copy, return_buffer );
- vehicle_file_parse( priv, return_buffer );
-
- current_index -= bytes_to_copy;
- memmove( buffer, &buffer[ bytes_to_copy ] , sizeof( buffer ) - bytes_to_copy );
- }
-
- }
- else
- {
- priv->no_data_count++;
- }
- return 1;
-}
-#endif
-
-static int
-vehicle_file_open(struct vehicle_priv *priv)
-{
-#if defined(_WIN32) || defined(__CEGCC__)
- dbg(1, "enter vehicle_file_open, priv->source='%s'\n", priv->source);
-
- if ( priv->source )
- {
- char* raw_setting_str = g_strdup( priv->source );
-
- char* strport = strchr(raw_setting_str, ':' );
- char* strsettings = strchr(raw_setting_str, ' ' );
-
- if ( strport && strsettings )
- {
- strport++;
- *strsettings = '\0';
- strsettings++;
-
- dbg(1, "calling serial_io_init('%s', '%s')\n", strport, strsettings );
- priv->fd=serial_io_init( strport, strsettings );
- }
- g_free( raw_setting_str );
- }
-#else
- char *name;
- struct stat st;
- struct termios tio;
-
- name = priv->source + 5;
- if (!strncmp(priv->source, "file:", 5)) {
- priv->fd = open(name, O_RDONLY | O_NDELAY);
- if (priv->fd < 0)
- return 0;
- stat(name, &st);
- if (S_ISREG(st.st_mode)) {
- priv->file_type = file_type_file;
- } else {
- tcgetattr(priv->fd, &tio);
- cfmakeraw(&tio);
- cfsetispeed(&tio, B4800);
- cfsetospeed(&tio, B4800);
- tio.c_cc[VMIN] = 16;
- tio.c_cc[VTIME] = 1;
- tcsetattr(priv->fd, TCSANOW, &tio);
- priv->file_type = file_type_device;
- }
- } else {
- priv->file = popen(name, "r");
- if (!priv->file)
- return 0;
- priv->fd = fileno(priv->file);
- priv->file_type = file_type_pipe;
- }
- priv->iochan = g_io_channel_unix_new(priv->fd);
-#endif
- return 1;
-}
-
-static void
-vehicle_file_close(struct vehicle_priv *priv)
-{
-#ifdef _WIN32
- serial_io_shutdown( priv->fd );
-#else
- GError *error = NULL;
- if (priv->iochan) {
- g_io_channel_shutdown(priv->iochan, 0, &error);
- priv->iochan = NULL;
- }
- if (priv->file)
- pclose(priv->file);
- else if (priv->fd >= 0)
- close(priv->fd);
-#endif
- priv->file = NULL;
- priv->fd = -1;
-}
-
-static int
-vehicle_file_enable_watch_timer(gpointer t)
-{
- struct vehicle_priv *priv = t;
- vehicle_file_enable_watch(priv);
- dbg(1, "enter\n");
-
- return FALSE;
-}
-
-
-static void
-vehicle_file_parse(struct vehicle_priv *priv, char *buffer)
-{
- char *nmea_data_buf, *p, *item[16];
- double lat, lng;
- int i, bcsum;
- int len = strlen(buffer);
- unsigned char csum = 0;
-
- dbg(1, "buffer='%s'\n", buffer);
- for (;;) {
- if (len < 4) {
- dbg(0, "'%s' too short\n", buffer);
- return;
- }
- if (buffer[len - 1] == '\r' || buffer[len - 1] == '\n')
- buffer[--len] = '\0';
- else
- break;
- }
- if (buffer[0] != '$') {
- dbg(0, "no leading $ in '%s'\n", buffer);
- return;
- }
- if (buffer[len - 3] != '*') {
- dbg(0, "no *XX in '%s'\n", buffer);
- return;
- }
- for (i = 1; i < len - 3; i++) {
- csum ^= (unsigned char) (buffer[i]);
- }
- if (!sscanf(buffer + len - 2, "%x", &bcsum)) {
- dbg(0, "no checksum in '%s'\n", buffer);
- return;
- }
- if (bcsum != csum) {
- dbg(0, "wrong checksum in '%s'\n", buffer);
- return;
- }
-
- if (!priv->nmea_data_buf || strlen(priv->nmea_data_buf) < 65536) {
- nmea_data_buf=g_strconcat(priv->nmea_data_buf ? priv->nmea_data_buf : "", buffer, "\n", NULL);
- g_free(priv->nmea_data_buf);
- priv->nmea_data_buf=nmea_data_buf;
- } else {
- dbg(0, "nmea buffer overflow, discarding '%s'\n", buffer);
- }
- i = 0;
- p = buffer;
- while (i < 16) {
- item[i++] = p;
- while (*p && *p != ',')
- p++;
- if (!*p)
- break;
- *p++ = '\0';
- }
-
- if (!strncmp(buffer, "$GPGGA", 6)) {
- /* 1 1111
- 0 1 2 3 4 5 6 7 8 9 0 1234
- $GPGGA,184424.505,4924.2811,N,01107.8846,E,1,05,2.5,408.6,M,,,,0000*0C
- UTC of Fix[1],Latitude[2],N/S[3],Longitude[4],E/W[5],Quality(0=inv,1=gps,2=dgps)[6],Satelites used[7],
- HDOP[8],Altitude[9],"M"[10],height of geoid[11], "M"[12], time since dgps update[13], dgps ref station [14]
- */
- lat = g_ascii_strtod(item[2], NULL);
- priv->geo.lat = floor(lat / 100);
- lat -= priv->geo.lat * 100;
- priv->geo.lat += lat / 60;
-
- if (!strcasecmp(item[3],"S"))
- priv->geo.lat=-priv->geo.lat;
-
- lng = g_ascii_strtod(item[4], NULL);
- priv->geo.lng = floor(lng / 100);
- lng -= priv->geo.lng * 100;
- priv->geo.lng += lng / 60;
-
- if (!strcasecmp(item[5],"W"))
- priv->geo.lng=-priv->geo.lng;
-
- sscanf(item[6], "%d", &priv->status);
- sscanf(item[7], "%d", &priv->sats_used);
- priv->height = g_ascii_strtod(item[9], NULL);
- g_free(priv->nmea_data);
- priv->nmea_data=priv->nmea_data_buf;
- priv->nmea_data_buf=NULL;
-
- callback_list_call_0(priv->cbl);
-
-#ifndef _WIN32
- if (priv->file_type == file_type_file) {
- vehicle_file_disable_watch(priv);
- g_timeout_add(priv->time,
- vehicle_file_enable_watch_timer,
- priv);
- }
-#endif
- }
- if (!strncmp(buffer, "$GPVTG", 6)) {
- /* 0 1 2 34 5 6 7 8
- $GPVTG,143.58,T,,M,0.26,N,0.5,K*6A
- Course Over Ground Degrees True[1],"T"[2],Course Over Ground Degrees Magnetic[3],"M"[4],
- Speed in Knots[5],"N"[6],"Speed in KM/H"[7],"K"[8]
- */
- priv->direction = g_ascii_strtod( item[1], NULL );
- priv->speed = g_ascii_strtod( item[7], NULL );
- }
- if (!strncmp(buffer, "$GPRMC", 6)) {
- /* 1 1
- 0 1 2 3 4 5 6 7 8 9 0 1
- $GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A
- Time[1],Active/Void[2],lat[3],N/S[4],long[5],W/E[6],speed in knots[7],track angle[8],date[9],
- magnetic variation[10],magnetic variation direction[11]
- */
- priv->direction = g_ascii_strtod( item[8], NULL );
- priv->speed = g_ascii_strtod( item[7], NULL );
- priv->speed *= 1.852;
- }
-}
-
-#ifndef _WIN32
-static gboolean
-vehicle_file_io(GIOChannel * iochan, GIOCondition condition, gpointer t)
-{
- struct vehicle_priv *priv = t;
- int size;
- char *str, *tok;
-
- dbg(1, "enter condition=%d\n", condition);
- if (condition == G_IO_IN) {
- size =
- read(g_io_channel_unix_get_fd(iochan),
- priv->buffer + priv->buffer_pos,
- buffer_size - priv->buffer_pos - 1);
- if (size <= 0) {
- switch (priv->on_eof) {
- case 0:
- vehicle_file_close(priv);
- vehicle_file_open(priv);
- break;
- case 1:
- break;
- case 2:
- exit(0);
- break;
- }
- return TRUE;
- }
- priv->buffer_pos += size;
- priv->buffer[priv->buffer_pos] = '\0';
- dbg(1, "size=%d pos=%d buffer='%s'\n", size,
- priv->buffer_pos, priv->buffer);
- str = priv->buffer;
- while ((tok = index(str, '\n'))) {
- *tok++ = '\0';
- dbg(1, "line='%s'\n", str);
- vehicle_file_parse(priv, str);
- str = tok;
- }
- if (str != priv->buffer) {
- size = priv->buffer + priv->buffer_pos - str;
- memmove(priv->buffer, str, size + 1);
- priv->buffer_pos = size;
- dbg(1, "now pos=%d buffer='%s'\n",
- priv->buffer_pos, priv->buffer);
- } else if (priv->buffer_pos == buffer_size - 1) {
- dbg(0,
- "Overflow. Most likely wrong baud rate or no nmea protocol\n");
- priv->buffer_pos = 0;
- }
- return TRUE;
- }
- return FALSE;
-}
-#endif
-
-static void
-vehicle_file_enable_watch(struct vehicle_priv *priv)
-{
-#ifdef _WIN32
- g_timeout_add(500, vehicle_win32_serial_track, priv);
-#else
- priv->watch =
- g_io_add_watch(priv->iochan, G_IO_IN | G_IO_ERR | G_IO_HUP,
- vehicle_file_io, priv);
-#endif
-}
-
-static void
-vehicle_file_disable_watch(struct vehicle_priv *priv)
-{
-#ifndef _WIN32
- if (priv->watch)
- g_source_remove(priv->watch);
- priv->watch = 0;
-#endif
-}
-
-
-static void
-vehicle_file_destroy(struct vehicle_priv *priv)
-{
- vehicle_file_close(priv);
- if (priv->source)
- g_free(priv->source);
- if (priv->buffer)
- g_free(priv->buffer);
- g_free(priv);
-}
-
-static int
-vehicle_file_position_attr_get(struct vehicle_priv *priv,
- enum attr_type type, struct attr *attr)
-{
- switch (type) {
- case attr_position_height:
- attr->u.numd = &priv->height;
- break;
- case attr_position_speed:
- attr->u.numd = &priv->speed;
- break;
- case attr_position_direction:
- attr->u.numd = &priv->direction;
- break;
- case attr_position_sats_used:
- attr->u.num = priv->sats_used;
- break;
- case attr_position_coord_geo:
- attr->u.coord_geo = &priv->geo;
- break;
- case attr_position_nmea:
- attr->u.str=priv->nmea_data;
- if (! attr->u.str)
- return 0;
- break;
- default:
- return 0;
- }
- attr->type = type;
- return 1;
-}
-
-struct vehicle_methods vehicle_file_methods = {
- vehicle_file_destroy,
- vehicle_file_position_attr_get,
-};
-
-static struct vehicle_priv *
-vehicle_file_new_file(struct vehicle_methods
- *meth, struct callback_list
- *cbl, struct attr **attrs)
-{
- struct vehicle_priv *ret;
- struct attr *source;
- struct attr *time;
- struct attr *on_eof;
-
- dbg(1, "enter\n");
- source = attr_search(attrs, NULL, attr_source);
- ret = g_new0(struct vehicle_priv, 1);
- ret->fd = -1;
- ret->cbl = cbl;
- ret->source = g_strdup(source->u.str);
- ret->buffer = g_malloc(buffer_size);
- ret->time=1000;
- time = attr_search(attrs, NULL, attr_time);
- if (time)
- ret->time=time->u.num;
- on_eof = attr_search(attrs, NULL, attr_on_eof);
- if (on_eof && !strcasecmp(on_eof->u.str, "stop"))
- ret->on_eof=1;
- if (on_eof && !strcasecmp(on_eof->u.str, "exit"))
- ret->on_eof=2;
- dbg(0,"on_eof=%d\n", ret->on_eof);
- *meth = vehicle_file_methods;
- if (vehicle_file_open(ret)) {
- vehicle_file_enable_watch(ret);
- return ret;
- }
-
-#ifdef _WIN32
- ret->no_data_count = 0;
-#endif
- dbg(0, "Failed to open '%s'\n", ret->source);
- vehicle_file_destroy(ret);
- return NULL;
-}
-
-void
-plugin_init(void)
-{
- dbg(1, "enter\n");
- plugin_register_vehicle_type("file", vehicle_file_new_file);
- plugin_register_vehicle_type("pipe", vehicle_file_new_file);
-}
diff --git a/navit/vehicle/gpsd/Makefile.am b/navit/vehicle/gpsd/Makefile.am
deleted file mode 100644
index b41529b4..00000000
--- a/navit/vehicle/gpsd/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=vehicle_gpsd
-modulevehicle_LTLIBRARIES = libvehicle_gpsd.la
-libvehicle_gpsd_la_SOURCES = vehicle_gpsd.c
-libvehicle_gpsd_la_LIBADD = @GPSD_LIBS@
diff --git a/navit/vehicle/gpsd/vehicle_gpsd.c b/navit/vehicle/gpsd/vehicle_gpsd.c
deleted file mode 100644
index ac7f0c0d..00000000
--- a/navit/vehicle/gpsd/vehicle_gpsd.c
+++ /dev/null
@@ -1,285 +0,0 @@
-#include <config.h>
-#include <gps.h>
-#include <string.h>
-#include <glib.h>
-#include <math.h>
-#include "debug.h"
-#include "callback.h"
-#include "plugin.h"
-#include "coord.h"
-#include "item.h"
-#include "vehicle.h"
-
-static struct vehicle_priv {
- char *source;
- char *gpsd_query;
- struct callback_list *cbl;
- GIOChannel *iochan;
- guint retry_interval;
- guint watch;
- struct gps_data_t *gps;
- struct coord_geo geo;
- double speed;
- double direction;
- double height;
- int status;
- int sats;
- int sats_used;
- char *nmea_data;
- char *nmea_data_buf;
- guint retry_timer;
-} *vehicle_last;
-
-#define DEFAULT_RETRY_INTERVAL 10 // seconds
-#define MIN_RETRY_INTERVAL 1 // seconds
-
-static gboolean vehicle_gpsd_io(GIOChannel * iochan,
- GIOCondition condition, gpointer t);
-
-
-
-static void
-vehicle_gpsd_callback(struct gps_data_t *data, char *buf, size_t len,
- int level)
-{
- char *pos,*nmea_data_buf;
- struct vehicle_priv *priv = vehicle_last;
- if (buf[0] == '$' && len > 0) {
- char buffer[len+2];
- buffer[len+1]='\0';
- memcpy(buffer, buf, len);
- pos=strchr(buffer,'\n');
- if (pos) {
- *++pos='\0';
- if (!priv->nmea_data_buf || strlen(priv->nmea_data_buf) < 65536) {
- nmea_data_buf=g_strconcat(priv->nmea_data_buf ? priv->nmea_data_buf : "", buffer, NULL);
- g_free(priv->nmea_data_buf);
- priv->nmea_data_buf=nmea_data_buf;
- } else {
- dbg(0, "nmea buffer overflow, discarding '%s'\n", buffer);
- }
- }
- }
- dbg(1,"data->set=0x%x\n", data->set);
- // If data->fix.speed is NAN, then the drawing gets jumpy.
- if (isnan(data->fix.speed)) {
- return;
- }
- dbg(2,"speed ok\n");
- if (data->set & SPEED_SET) {
- priv->speed = data->fix.speed * 3.6;
- data->set &= ~SPEED_SET;
- }
- if (data->set & TRACK_SET) {
- priv->direction = data->fix.track;
- data->set &= ~TRACK_SET;
- }
- if (data->set & ALTITUDE_SET) {
- priv->height = data->fix.altitude;
- data->set &= ~ALTITUDE_SET;
- }
- if (data->set & SATELLITE_SET) {
- priv->sats_used = data->satellites_used;
- priv->sats = data->satellites;
- data->set &= ~SATELLITE_SET;
- }
- if (data->set & STATUS_SET) {
- priv->status = data->status;
- data->set &= ~STATUS_SET;
- }
- if (data->set & PDOP_SET) {
- dbg(0, "pdop : %g\n", data->pdop);
- data->set &= ~PDOP_SET;
- }
- if (data->set & LATLON_SET) {
- priv->geo.lat = data->fix.latitude;
- priv->geo.lng = data->fix.longitude;
- dbg(1,"lat=%f lng=%f\n", priv->geo.lat, priv->geo.lng);
- g_free(priv->nmea_data);
- priv->nmea_data=priv->nmea_data_buf;
- priv->nmea_data_buf=NULL;
- callback_list_call_0(priv->cbl);
- data->set &= ~LATLON_SET;
- }
-}
-
-/**
- * Attempt to open the gps device.
- * Return FALSE if retry not required
- * Return TRUE to try again
- */
-static gboolean
-vehicle_gpsd_try_open(gpointer *data)
-{
- struct vehicle_priv *priv = (struct vehicle_priv *)data;
- char *source = g_strdup(priv->source);
- char *colon = index(source + 7, ':');
- if (colon) {
- *colon = '\0';
- priv->gps = gps_open(source + 7, colon + 1);
- } else
- priv->gps = gps_open(source + 7, NULL);
- g_free(source);
-
- if (!priv->gps){
- g_warning("gps_open failed for '%s'. Retrying in %d seconds. Have you started gpsd?\n", priv->source, priv->retry_interval);
- return TRUE;
- }
- gps_query(priv->gps, priv->gpsd_query);
- gps_set_raw_hook(priv->gps, vehicle_gpsd_callback);
- priv->iochan = g_io_channel_unix_new(priv->gps->gps_fd);
- priv->watch =
- g_io_add_watch(priv->iochan, G_IO_IN | G_IO_ERR | G_IO_HUP,
- vehicle_gpsd_io, priv);
- dbg(0,"Connected to gpsd fd=%d iochan=%p watch=%p\n", priv->gps->gps_fd, priv->iochan, priv->watch);
- return FALSE;
-}
-
-/**
- * Open a connection to gpsd. Will re-try the connection if it fails
- */
-static void
-vehicle_gpsd_open(struct vehicle_priv *priv)
-{
- priv->retry_timer=0;
- if (vehicle_gpsd_try_open((gpointer *)priv)) {
- priv->retry_timer = g_timeout_add(priv->retry_interval*1000, (GSourceFunc)vehicle_gpsd_try_open, (gpointer *)priv);
- }
-}
-
-static void
-vehicle_gpsd_close(struct vehicle_priv *priv)
-{
- GError *error = NULL;
-
- if (priv->watch) {
- g_source_remove(priv->watch);
- priv->watch = 0;
- }
- if (priv->retry_timer) {
- g_source_remove(priv->retry_timer);
- priv->retry_timer=0;
- }
- if (priv->iochan) {
- g_io_channel_shutdown(priv->iochan, 0, &error);
- priv->iochan = NULL;
- }
- if (priv->gps) {
- gps_close(priv->gps);
- priv->gps = NULL;
- }
-}
-
-static gboolean
-vehicle_gpsd_io(GIOChannel * iochan, GIOCondition condition, gpointer t)
-{
- struct vehicle_priv *priv = t;
-
- dbg(1, "enter condition=%d\n", condition);
- if (condition == G_IO_IN) {
- if (priv->gps) {
- vehicle_last = priv;
- if (gps_poll(priv->gps)) {
- g_warning("gps_poll failed\n");
- vehicle_gpsd_close(priv);
- vehicle_gpsd_open(priv);
- }
- }
- return TRUE;
- }
- return FALSE;
-}
-
-static void
-vehicle_gpsd_destroy(struct vehicle_priv *priv)
-{
- vehicle_gpsd_close(priv);
- if (priv->source)
- g_free(priv->source);
- if (priv->gpsd_query)
- g_free(priv->gpsd_query);
- g_free(priv);
-}
-
-static int
-vehicle_gpsd_position_attr_get(struct vehicle_priv *priv,
- enum attr_type type, struct attr *attr)
-{
- switch (type) {
- case attr_position_height:
- attr->u.numd = &priv->height;
- break;
- case attr_position_speed:
- attr->u.numd = &priv->speed;
- break;
- case attr_position_direction:
- attr->u.numd = &priv->direction;
- break;
- case attr_position_sats:
- attr->u.num = priv->sats;
- break;
- case attr_position_sats_used:
- attr->u.num = priv->sats_used;
- break;
- case attr_position_coord_geo:
- attr->u.coord_geo = &priv->geo;
- break;
- case attr_position_nmea:
- attr->u.str=priv->nmea_data;
- if (! attr->u.str)
- return 0;
- break;
- default:
- return 0;
- }
- attr->type = type;
- return 1;
-}
-
-struct vehicle_methods vehicle_gpsd_methods = {
- vehicle_gpsd_destroy,
- vehicle_gpsd_position_attr_get,
-};
-
-static struct vehicle_priv *
-vehicle_gpsd_new_gpsd(struct vehicle_methods
- *meth, struct callback_list
- *cbl, struct attr **attrs)
-{
- struct vehicle_priv *ret;
- struct attr *source, *query, *retry_int;
-
- dbg(1, "enter\n");
- source = attr_search(attrs, NULL, attr_source);
- ret = g_new0(struct vehicle_priv, 1);
- ret->source = g_strdup(source->u.str);
- query = attr_search(attrs, NULL, attr_gpsd_query);
- if (query) {
- ret->gpsd_query = g_strconcat(query->u.str, "\n", NULL);
- } else {
- ret->gpsd_query = g_strdup("w+x\n");
- }
- dbg(1,"Format string for gpsd_query: %s\n",ret->gpsd_query);
- retry_int = attr_search(attrs, NULL, attr_retry_interval);
- if (retry_int) {
- ret->retry_interval = retry_int->u.num;
- if (ret->retry_interval < MIN_RETRY_INTERVAL) {
- dbg(0, "Retry interval %d too small, setting to %d\n", ret->retry_interval, MIN_RETRY_INTERVAL);
- ret->retry_interval = MIN_RETRY_INTERVAL;
- }
- } else {
- dbg(0, "Retry interval not defined, setting to %d\n", DEFAULT_RETRY_INTERVAL);
- ret->retry_interval = DEFAULT_RETRY_INTERVAL;
- }
- ret->cbl = cbl;
- *meth = vehicle_gpsd_methods;
- vehicle_gpsd_open(ret);
- return ret;
-}
-
-void
-plugin_init(void)
-{
- dbg(1, "enter\n");
- plugin_register_vehicle_type("gpsd", vehicle_gpsd_new_gpsd);
-}
diff --git a/navit/xmlconfig.c b/navit/xmlconfig.c
deleted file mode 100644
index 726b43e0..00000000
--- a/navit/xmlconfig.c
+++ /dev/null
@@ -1,1097 +0,0 @@
-#include <glib.h>
-#include <glib/gprintf.h>
-#include <string.h>
-#include "debug.h"
-#include "file.h"
-#include "coord.h"
-#include "layout.h"
-#include "mapset.h"
-#include "projection.h"
-#include "map.h"
-#include "navigation.h"
-#include "navit.h"
-#include "plugin.h"
-#include "route.h"
-#include "speech.h"
-#include "track.h"
-#include "vehicle.h"
-#include "point.h"
-#include "graphics.h"
-#include "gui.h"
-#include "osd.h"
-#include "log.h"
-#include "xmlconfig.h"
-#include "config.h"
-
-struct xistate {
- struct xistate *parent;
- struct xistate *child;
- const gchar *element;
- gchar **attribute_names;
- gchar **attribute_values;
-};
-
-struct xmldocument {
- const gchar *href;
- const gchar *xpointer;
- gpointer user_data;
- struct xistate *first;
- struct xistate *last;
- int active;
- int level;
-};
-
-struct xmlstate {
- const gchar **attribute_names;
- const gchar **attribute_values;
- struct xmlstate *parent;
- struct attr element_attr;
- const gchar *element;
- GError **error;
- struct element_func *func;
- struct xmldocument *document;
-};
-
-
-
-static struct attr ** convert_to_attrs(struct xmlstate *state)
-{
- const gchar **attribute_name=state->attribute_names;
- const gchar **attribute_value=state->attribute_values;
- int count=0;
- struct attr **ret;
-
- while (*attribute_name) {
- count++;
- attribute_name++;
- }
- ret=g_new(struct attr *, count+1);
- attribute_name=state->attribute_names;
- count=0;
- while (*attribute_name) {
- ret[count]=attr_new_from_text(*attribute_name,*attribute_value);
- if (ret[count])
- count++;
- attribute_name++;
- attribute_value++;
- }
- ret[count]=NULL;
- dbg(1,"ret=%p\n", ret);
- return ret;
-}
-
-
-static const char * find_attribute(struct xmlstate *state, const char *attribute, int required)
-{
- const gchar **attribute_name=state->attribute_names;
- const gchar **attribute_value=state->attribute_values;
- while(*attribute_name) {
- if(! g_ascii_strcasecmp(attribute,*attribute_name))
- return *attribute_value;
- attribute_name++;
- attribute_value++;
- }
- if (required)
- g_set_error(state->error,G_MARKUP_ERROR,G_MARKUP_ERROR_INVALID_CONTENT, "element '%s' is missing attribute '%s'", state->element, attribute);
- return NULL;
-}
-
-static int
-find_color(struct xmlstate *state, int required, struct color *color)
-{
- const char *value;
- int r,g,b,a;
-
- value=find_attribute(state, "color", required);
- if (! value)
- return 0;
- if(strlen(value)==7){
- sscanf(value,"#%02x%02x%02x", &r, &g, &b);
- color->r = (r << 8) | r;
- color->g = (g << 8) | g;
- color->b = (b << 8) | b;
- color->a = (65535);
- } else if(strlen(value)==9){
- sscanf(value,"#%02x%02x%02x%02x", &r, &g, &b, &a);
- color->r = (r << 8) | r;
- color->g = (g << 8) | g;
- color->b = (b << 8) | b;
- color->a = (a << 8) | a;
- } else {
- dbg(0,"color %i has unknown format\n",value);
- }
- return 1;
-}
-
-static int
-find_order(struct xmlstate *state, int required, int *min, int *max)
-{
- const char *value, *pos;
- int ret;
-
- *min=0;
- *max=18;
- value=find_attribute(state, "order", required);
- if (! value)
- return 0;
- pos=strchr(value, '-');
- if (! pos) {
- ret=sscanf(value,"%d",min);
- *max=*min;
- } else if (pos == value)
- ret=sscanf(value,"-%d",max);
- else
- ret=sscanf(value,"%d-%d", min, max);
- return ret;
-}
-
-static int
-find_boolean(struct xmlstate *state, const char *attribute, int deflt, int required)
-{
- const char *value;
-
- value=find_attribute(state, attribute, required);
- if (! value)
- return deflt;
- if (g_ascii_strcasecmp(value,"no") && g_ascii_strcasecmp(value,"0") && g_ascii_strcasecmp(value,"false"))
- return 1;
- return 0;
-}
-
-static int
-convert_number(const char *val)
-{
- if (val)
- return g_ascii_strtoull(val,NULL,0);
- else
- return 0;
-}
-
-static int
-convert_number_list(const char *val, int *table, int size)
-{
- char *tok,*str,*val_str,*saveptr=NULL;
- int i;
- str=val_str=g_strdup(val);
- for (i=0; i<size && (tok=strtok_r(str, ",", &saveptr)); i++) {
- table[i]=convert_number(tok);
- str=NULL;
- }
- g_free(val_str);
- return i;
-}
-
-static int
-xmlconfig_config(struct xmlstate *state)
-{
- state->element_attr.u.data = (void *)1;
- return 1;
-}
-
-static int
-xmlconfig_plugin(struct xmlstate *state)
-{
- const char *path;
- int active,lazy;
-
- state->element_attr.u.data=state->parent->element_attr.u.data;
- path=find_attribute(state, "path", 1);
- if (! path)
- return 0;
- active=find_boolean(state, "active", 1, 0);
- lazy=find_boolean(state, "lazy", 1, 0);
- plugins_add_path(state->parent->element_attr.u.data, path, active, lazy);
- return 1;
-}
-
-static int
-xmlconfig_speech(struct xmlstate *state)
-{
- const char *type;
- const char *data;
- type=find_attribute(state, "type", 1);
- if (! type)
- return 0;
- data=find_attribute(state, "data", 0);
- state->element_attr.u.data = speech_new(type, data);
- if (! state->element_attr.u.data)
- return 0;
- navit_set_speech(state->parent->element_attr.u.data, state->element_attr.u.data);
- return 1;
-}
-
-static int
-xmlconfig_debug(struct xmlstate *state)
-{
- const char *name,*level;
- name=find_attribute(state, "name", 1);
- if (! name)
- return 0;
- level=find_attribute(state, "level", 1);
- if (! level)
- return 0;
- debug_level_set(name, convert_number(level));
- return 1;
-}
-
-static int
-xmlconfig_vehicle(struct xmlstate *state)
-{
- struct attr **attrs;
- attrs=convert_to_attrs(state);
-
- state->element_attr.u.data = vehicle_new(attrs);
- if (! state->element_attr.u.data)
- return 0;
- navit_add_vehicle(state->parent->element_attr.u.data, state->element_attr.u.data, attrs);
- return 1;
-}
-
-static int
-xmlconfig_log_vehicle(struct xmlstate *state)
-{
- struct attr attr;
- struct attr **attrs;
- attrs=convert_to_attrs(state);
- state->element_attr.u.data = log_new(attrs);
- if (! state->element_attr.u.data)
- return 0;
- attr.type=attr_log;
- attr.u.log=state->element_attr.u.data;
- if (vehicle_add_attr(state->parent->element_attr.u.data, &attr))
- return 0;
- return 1;
-}
-
-static int
-xmlconfig_log_navit(struct xmlstate *state)
-{
- struct attr attr;
- struct attr **attrs;
- attrs=convert_to_attrs(state);
- state->element_attr.u.data = log_new(attrs);
- if (! state->element_attr.u.data)
- return 0;
- attr.type=attr_log;
- attr.u.log=state->element_attr.u.data;
- if (navit_add_attr(state->parent->element_attr.u.data, &attr))
- return 0;
- return 1;
-}
-
-
-static int
-xmlconfig_window_items(struct xmlstate *state)
-{
- int distance=-1;
- enum item_type itype;
- const char *name=find_attribute(state, "name", 1);
- const char *value=find_attribute(state, "distance", 0);
- const char *type=find_attribute(state, "type", 1);
- char *tok,*str,*type_str,*saveptr=NULL;
- if (! name || !type)
- return 0;
- if (value)
- distance=convert_number(value);
- state->element_attr.u.data = navit_window_items_new(name, distance);
- type_str=g_strdup(type);
- str=type_str;
- while ((tok=strtok_r(str, ",", &saveptr))) {
- itype=item_from_name(tok);
- navit_window_items_add_item(state->element_attr.u.data, itype);
- str=NULL;
- }
- g_free(type_str);
-
- navit_add_window_items(state->parent->element_attr.u.data, state->element_attr.u.data);
-
- return 1;
-}
-
-
-static int
-xmlconfig_tracking(struct xmlstate *state)
-{
- state->element_attr.u.data = tracking_new(NULL);
- navit_tracking_add(state->parent->element_attr.u.data, state->element_attr.u.data);
- return 1;
-}
-
-static int
-xmlconfig_route(struct xmlstate *state)
-{
- struct attr **attrs;
- struct attr route_attr;
-
- attrs=convert_to_attrs(state);
- state->element_attr.u.data = route_new(attrs);
- if (! state->element_attr.u.data) {
- dbg(0,"Failed to create route object\n");
- return 0;
- }
- route_attr.type=attr_route;
- route_attr.u.route=state->element_attr.u.data;
- return navit_add_attr(state->parent->element_attr.u.data, &route_attr);
-}
-
-static int
-xmlconfig_speed(struct xmlstate *state)
-{
- const char *type;
- const char *value;
- int v;
- enum item_type itype;
- char *saveptr=NULL, *tok, *type_str, *str;
-
- type=find_attribute(state, "type", 1);
- if (! type)
- return 0;
- value=find_attribute(state, "value", 1);
- if (! value)
- return 0;
- v=convert_number(value);
- type_str=g_strdup(type);
- str=type_str;
- while ((tok=strtok_r(str, ",", &saveptr))) {
- itype=item_from_name(tok);
- route_set_speed(state->parent->element_attr.u.data, itype, v);
- str=NULL;
- }
- g_free(type_str);
-
- return 1;
-}
-
-
-static int
-xmlconfig_navigation(struct xmlstate *state)
-{
- struct attr **attrs;
- struct attr navigation_attr;
-
- attrs=convert_to_attrs(state);
- state->element_attr.u.data = navigation_new(attrs);
- if (! state->element_attr.u.data) {
- dbg(0,"Failed to create navigation object\n");
- return 0;
- }
- navigation_attr.type=attr_navigation;
- navigation_attr.u.navigation=state->element_attr.u.data;
- return navit_add_attr(state->parent->element_attr.u.data, &navigation_attr);
-}
-
-static int
-xmlconfig_osd(struct xmlstate *state)
-{
- struct attr **attrs;
- const char *type=find_attribute(state, "type", 1);
- if (! type)
- return 0;
- attrs=convert_to_attrs(state);
- state->element_attr.u.data = osd_new(state->parent->element_attr.u.data, type, attrs);
- return 1;
-}
-
-static int
-xmlconfig_announce(struct xmlstate *state)
-{
- const char *type,*value;
- char key[32];
- int level[3];
- int i;
- enum item_type itype;
- char *saveptr=NULL, *tok, *type_str, *str;
-
- type=find_attribute(state, "type", 1);
- if (! type)
- return 0;
- for (i = 0 ; i < 3 ; i++) {
- sprintf(key,"level%d", i);
- value=find_attribute(state, key, 0);
- if (value)
- level[i]=convert_number(value);
- else
- level[i]=-1;
- }
- type_str=g_strdup(type);
- str=type_str;
- while ((tok=strtok_r(str, ",", &saveptr))) {
- itype=item_from_name(tok);
- navigation_set_announce(state->parent->element_attr.u.data, itype, level);
- str=NULL;
- }
- g_free(type_str);
- return 1;
-}
-
-static int
-xmlconfig_mapset(struct xmlstate *state)
-{
- state->element_attr.u.data = mapset_new();
- if (! state->element_attr.u.data)
- return 0;
- navit_add_mapset(state->parent->element_attr.u.data, state->element_attr.u.data);
-
- return 1;
-}
-
-static int
-xmlconfig_map(struct xmlstate *state)
-{
- struct attr **attrs;
- const char *type=find_attribute(state, "type", 1);
- if (! type)
- return 0;
- attrs=convert_to_attrs(state);
- state->element_attr.u.data = map_new(type, attrs);
- if (! state->element_attr.u.data)
- return 0;
- if (!find_boolean(state, "active", 1, 0))
- map_set_active(state->element_attr.u.data, 0);
- mapset_add(state->parent->element_attr.u.data, state->element_attr.u.data);
-
- return 1;
-}
-
-static int
-xmlconfig_layout(struct xmlstate *state)
-{
- const char *name=find_attribute(state, "name", 1);
- struct color color = {0xffff, 0xefef, 0xb7b7, 0xffff};
-
- if (! name)
- return 0;
- find_color(state, 0, &color);
- state->element_attr.u.data = layout_new(name, &color);
- if (! state->element_attr.u.data)
- return 0;
- navit_add_layout(state->parent->element_attr.u.data, state->element_attr.u.data);
- return 1;
-}
-
-static int
-xmlconfig_layer(struct xmlstate *state)
-{
- const char *name=find_attribute(state, "name", 1);
- if (! name)
- return 0;
- state->element_attr.u.data = layer_new(name, convert_number(find_attribute(state, "details", 0)));
- if (! state->element_attr.u.data)
- return 0;
- layout_add_layer(state->parent->element_attr.u.data, state->element_attr.u.data);
- return 1;
-}
-
-static int
-xmlconfig_item(struct xmlstate *state)
-{
- const char *type=find_attribute(state, "type", 1);
- int min, max;
- enum item_type itype;
- char *saveptr=NULL, *tok, *type_str, *str;
-
- if (! type)
- return 0;
- if (! find_order(state, 1, &min, &max))
- return 0;
- state->element_attr.u.data=itemtype_new(min, max);
- if (! state->element_attr.u.data)
- return 0;
- type_str=g_strdup(type);
- str=type_str;
- layer_add_itemtype(state->parent->element_attr.u.data, state->element_attr.u.data);
- while ((tok=strtok_r(str, ",", &saveptr))) {
- itype=item_from_name(tok);
- itemtype_add_type(state->element_attr.u.data, itype);
- str=NULL;
- }
- g_free(type_str);
-
- return 1;
-}
-
-static int
-xmlconfig_polygon(struct xmlstate *state)
-{
- struct color color;
-
- if (! find_color(state, 1, &color))
- return 0;
- state->element_attr.u.data=polygon_new(&color);
- if (! state->element_attr.u.data)
- return 0;
- itemtype_add_element(state->parent->element_attr.u.data, state->element_attr.u.data);
-
- return 1;
-}
-
-static int
-xmlconfig_polyline(struct xmlstate *state)
-{
- struct color color;
- const char *width, *dash, *directed;
- int w=0, d=0, dt[4], ds=0;
-
- if (! find_color(state, 1, &color))
- return 0;
- width=find_attribute(state, "width", 0);
- if (width)
- w=convert_number(width);
- dash=find_attribute(state, "dash", 0);
- if (dash)
- ds=convert_number_list(dash, dt, sizeof(dt)/sizeof(*dt));
- directed=find_attribute(state, "directed", 0);
- if (directed)
- d=convert_number(directed);
-
- state->element_attr.u.data=polyline_new(&color, w, d, dt, ds);
- if (! state->element_attr.u.data)
- return 0;
- itemtype_add_element(state->parent->element_attr.u.data, state->element_attr.u.data);
-
- return 1;
-}
-
-static int
-xmlconfig_circle(struct xmlstate *state)
-{
- struct color color;
- const char *width, *radius, *label_size;
- int w=0,r=0,ls=0;
-
- if (! find_color(state, 1, &color))
- return 0;
- width=find_attribute(state, "width", 0);
- if (width)
- w=convert_number(width);
- radius=find_attribute(state, "radius", 0);
- if (radius)
- r=convert_number(radius);
- label_size=find_attribute(state, "label_size", 0);
- if (label_size)
- ls=convert_number(label_size);
- state->element_attr.u.data=circle_new(&color, r, w, ls);
- if (! state->element_attr.u.data)
- return 0;
- itemtype_add_element(state->parent->element_attr.u.data, state->element_attr.u.data);
-
- return 1;
-}
-
-static int
-xmlconfig_label(struct xmlstate *state)
-{
- const char *label_size;
- int ls=0;
-
- label_size=find_attribute(state, "label_size", 0);
- if (label_size)
- ls=convert_number(label_size);
- state->element_attr.u.data=label_new(ls);
- if (! state->element_attr.u.data)
- return 0;
- itemtype_add_element(state->parent->element_attr.u.data, state->element_attr.u.data);
-
- return 1;
-}
-
-static int
-xmlconfig_icon(struct xmlstate *state)
-{
- const char *src=find_attribute(state, "src", 1);
-
- if (! src)
- return 0;
- state->element_attr.u.data=icon_new(src);
- if (! state->element_attr.u.data)
- return 0;
- itemtype_add_element(state->parent->element_attr.u.data, state->element_attr.u.data);
-
- return 1;
-}
-
-static int
-xmlconfig_image(struct xmlstate *state)
-{
- state->element_attr.u.data=image_new();
- if (! state->element_attr.u.data)
- return 0;
- itemtype_add_element(state->parent->element_attr.u.data, state->element_attr.u.data);
-
- return 1;
-}
-
-#define NEW(x) (void *(*)(struct attr *, struct attr **))(x)
-#define ADD(x) (int (*)(void *, struct attr *attr))(x)
-#define INIT(x) (int (*)(void *))(x)
-#define DESTROY(x) (void (*)(void *))(x)
-struct element_func {
- char *name;
- char *parent;
- int (*func)(struct xmlstate *state);
- void *(*new)(struct attr *parent, struct attr **attrs);
- int (*add_attr)(void *, struct attr *attr);
- int (*init)(void *);
- void (*destroy)(void *);
-} elements[] = {
- { "config", NULL, xmlconfig_config},
- { "debug", "config", xmlconfig_debug},
- { "navit", "config", NULL, NEW(navit_new), ADD(navit_add_attr), INIT(navit_init), DESTROY(navit_destroy)},
- { "graphics", "navit", NULL, NEW(graphics_new), NULL, NULL, NULL},
- { "gui", "navit", NULL, NEW(gui_new), NULL, NULL, NULL},
- { "layout", "navit", xmlconfig_layout},
- { "layer", "layout", xmlconfig_layer},
- { "item", "layer", xmlconfig_item},
- { "circle", "item", xmlconfig_circle},
- { "icon", "item", xmlconfig_icon},
- { "image", "item", xmlconfig_image},
- { "label", "item", xmlconfig_label},
- { "polygon", "item", xmlconfig_polygon},
- { "polyline", "item", xmlconfig_polyline},
- { "mapset", "navit", xmlconfig_mapset},
- { "map", "mapset", xmlconfig_map},
- { "navigation", "navit", xmlconfig_navigation},
- { "osd", "navit", xmlconfig_osd},
- { "announce", "navigation", xmlconfig_announce},
- { "speech", "navit", xmlconfig_speech},
- { "tracking", "navit", xmlconfig_tracking},
- { "route", "navit", xmlconfig_route},
- { "speed", "route", xmlconfig_speed},
- { "vehicle", "navit", xmlconfig_vehicle},
- { "log", "vehicle", xmlconfig_log_vehicle},
- { "log", "navit", xmlconfig_log_navit},
- { "window_items", "navit", xmlconfig_window_items},
- { "plugins", "config", NULL, NEW(plugins_new), NULL, INIT(plugins_init), NULL},
- { "plugin", "plugins", xmlconfig_plugin},
- {},
-};
-
-static void
-start_element(GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- gpointer user_data,
- GError **error)
-{
- struct xmlstate *new=NULL, **parent = user_data;
- struct element_func *e=elements,*func=NULL;
- int found=0;
- const char *parent_name=NULL;
- char *s,*sep="",*possible_parents;
- dbg(2,"name='%s' parent='%s'\n", element_name, *parent ? (*parent)->element:NULL);
- possible_parents=g_strdup("");
- if (*parent)
- parent_name=(*parent)->element;
- while (e->name) {
- if (!g_ascii_strcasecmp(element_name, e->name)) {
- found=1;
- s=g_strconcat(possible_parents,sep,e->parent,NULL);
- g_free(possible_parents);
- possible_parents=s;
- sep=",";
- if ((parent_name && e->parent && !g_ascii_strcasecmp(parent_name, e->parent)) ||
- (!parent_name && !e->parent))
- func=e;
- }
- e++;
- }
- if (! found) {
- g_set_error(error,G_MARKUP_ERROR,G_MARKUP_ERROR_UNKNOWN_ELEMENT,
- "Unknown element '%s'", element_name);
- g_free(possible_parents);
- return;
- }
- if (! func) {
- g_set_error(error,G_MARKUP_ERROR,G_MARKUP_ERROR_INVALID_CONTENT,
- "Element '%s' within unexpected context '%s'. Expected '%s'%s",
- element_name, parent_name, possible_parents, ! strcmp(possible_parents, "config") ? "\nPlease add <config> </config> tags at the beginning/end of your navit.xml": "");
- g_free(possible_parents);
- return;
- }
- g_free(possible_parents);
-
- new=g_new(struct xmlstate, 1);
- new->attribute_names=attribute_names;
- new->attribute_values=attribute_values;
- new->parent=*parent;
- new->element_attr.u.data=NULL;
- new->element=element_name;
- new->error=error;
- new->func=func;
- *parent=new;
- if (!find_boolean(new, "enabled", 1, 0))
- return;
- if (new->parent && !new->parent->element_attr.u.data)
- return;
- if (func->func) {
- if (!func->func(new)) {
- return;
- }
- } else {
- struct attr **attrs;
-
- attrs=convert_to_attrs(new);
- new->element_attr.type=attr_none;
- new->element_attr.u.data = func->new(&new->parent->element_attr, attrs);
- if (! new->element_attr.u.data)
- return;
- new->element_attr.type=attr_from_name(element_name);
- if (new->parent->func->add_attr)
- new->parent->func->add_attr(new->parent->element_attr.u.data, &new->element_attr);
- }
- return;
-}
-
-
-/* Called for close tags </foo> */
-static void
-end_element (GMarkupParseContext *context,
- const gchar *element_name,
- gpointer user_data,
- GError **error)
-{
- struct xmlstate *curr, **state = user_data;
-
- dbg(2,"name='%s'\n", element_name);
- curr=*state;
- if (curr->func->init)
- curr->func->init(curr->element_attr.u.data);
- *state=curr->parent;
- g_free(curr);
-}
-
-static gboolean parse_file(struct xmldocument *document, GError **error);
-
-static void
-xinclude(GMarkupParseContext *context, const gchar **attribute_names, const gchar **attribute_values, struct xmldocument *doc_old, GError **error)
-{
- struct xmldocument doc_new;
- struct file_wordexp *we;
- int i,count;
- const char *href=NULL;
- char **we_files;
-
- if (doc_old->level >= 16) {
- g_set_error(error,G_MARKUP_ERROR,G_MARKUP_ERROR_INVALID_CONTENT, "xi:include recursion too deep");
- return;
- }
- memset(&doc_new, 0, sizeof(doc_new));
- i=0;
- while (attribute_names[i]) {
- if(!g_ascii_strcasecmp("href", attribute_names[i])) {
- if (!href)
- href=attribute_values[i];
- else {
- g_set_error(error,G_MARKUP_ERROR,G_MARKUP_ERROR_INVALID_CONTENT, "xi:include has more than one href");
- return;
- }
- } else if(!g_ascii_strcasecmp("xpointer", attribute_names[i])) {
- if (!doc_new.xpointer)
- doc_new.xpointer=attribute_values[i];
- else {
- g_set_error(error,G_MARKUP_ERROR,G_MARKUP_ERROR_INVALID_CONTENT, "xi:include has more than one xpointer");
- return;
- }
- } else {
- g_set_error(error,G_MARKUP_ERROR,G_MARKUP_ERROR_INVALID_CONTENT, "xi:include has invalid attributes");
- return;
- }
- i++;
- }
- if (!doc_new.xpointer && !href) {
- g_set_error(error,G_MARKUP_ERROR,G_MARKUP_ERROR_INVALID_CONTENT, "xi:include has neither href nor xpointer");
- return;
- }
- doc_new.level=doc_old->level+1;
- doc_new.user_data=doc_old->user_data;
- if (! href) {
- dbg(1,"no href, using '%s'\n", doc_old->href);
- doc_new.href=doc_old->href;
- parse_file(&doc_new, error);
- } else {
- dbg(1,"expanding '%s'\n", href);
- we=file_wordexp_new(href);
- we_files=file_wordexp_get_array(we);
- count=file_wordexp_get_count(we);
- dbg(1,"%d results\n", count);
- for (i = 0 ; i < count ; i++) {
- dbg(1,"result[%d]='%s'\n", i, we_files[i]);
- doc_new.href=we_files[i];
- parse_file(&doc_new, error);
- }
- file_wordexp_destroy(we);
-
- }
-
-}
-static int
-strncmp_len(const char *s1, int s1len, const char *s2)
-{
- int ret;
-#if 0
- char c[s1len+1];
- strncpy(c, s1, s1len);
- c[s1len]='\0';
- dbg(0,"'%s' vs '%s'\n", c, s2);
-#endif
-
- ret=strncmp(s1, s2, s1len);
- if (ret)
- return ret;
- return strlen(s2)-s1len;
-}
-
-static int
-xpointer_value(const char *test, int len, struct xistate *elem, const char **out, int out_len)
-{
- int i,ret=0;
- if (len <= 0 || out_len <= 0) {
- return 0;
- }
- if (!(strncmp_len(test,len,"name(.)"))) {
- out[0]=elem->element;
- return 1;
- }
- if (test[0] == '@') {
- i=0;
- while (elem->attribute_names[i] && out_len > 0) {
- if (!strncmp_len(test+1,len-1,elem->attribute_names[i])) {
- out[ret++]=elem->attribute_values[i];
- out_len--;
- }
- i++;
- }
- return ret;
- }
- return 0;
-}
-
-static int
-xpointer_test(const char *test, int len, struct xistate *elem)
-{
- int eq,i,count,vlen,cond_req=1,cond=0;
- char c;
- const char *tmp[16];
-
- if (!len)
- return 0;
- c=test[len-1];
- if (c != '\'' && c != '"')
- return 0;
- eq=strcspn(test, "=");
- if (eq >= len || test[eq+1] != c)
- return 0;
- vlen=eq;
- if (eq > 0 && test[eq-1] == '!') {
- cond_req=0;
- vlen--;
- }
- count=xpointer_value(test,vlen,elem,tmp,16);
- for (i = 0 ; i < count ; i++) {
- if (!strncmp_len(test+eq+2,len-eq-3, tmp[i]))
- cond=1;
- }
- if (cond == cond_req)
- return 1;
- return 0;
-}
-
-static int
-xpointer_element_match(const char *xpointer, int len, struct xistate *elem)
-{
- int len_test;
- len_test=strcspn(xpointer, "[");
- if (len_test > len)
- len_test=len;
- if (strncmp_len(xpointer, len_test, elem->element) && (len_test != 1 || xpointer[0] != '*'))
- return 0;
- if (len_test == len)
- return 1;
- if (xpointer[len-1] != ']')
- return 0;
- return xpointer_test(xpointer+len_test+1, len-len_test-2, elem);
-}
-
-static int
-xpointer_xpointer_match(const char *xpointer, int len, struct xistate *first)
-{
- const char *c;
- int s;
- dbg(2,"%s\n", xpointer);
- if (xpointer[0] != '/')
- return 0;
- c=xpointer+1;
- len--;
- do {
- s=strcspn(c, "/");
- if (s > len)
- s=len;
- if (! xpointer_element_match(c, s, first))
- return 0;
- first=first->child;
- c+=s+1;
- len-=s+1;
- } while (s < len && first);
- if (s < len)
- return 0;
- return 1;
-}
-
-static int
-xpointer_match(const char *xpointer, struct xistate *first)
-{
- char *prefix="xpointer(";
- int len=strlen(xpointer);
- if (! xpointer)
- return 1;
- if (strncmp(xpointer,prefix,strlen(prefix)))
- return 0;
- if (xpointer[len-1] != ')')
- return 0;
- return xpointer_xpointer_match(xpointer+strlen(prefix), len-strlen(prefix)-1, first);
-
-}
-
-static void
-xi_start_element(GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- gpointer user_data,
- GError **error)
-{
- struct xmldocument *doc=user_data;
- struct xistate *xistate;
- int i,count=0;
- while (attribute_names[count++]);
- xistate=g_new0(struct xistate, 1);
- xistate->element=element_name;
- xistate->attribute_names=g_new(char *, count);
- xistate->attribute_values=g_new(char *, count);
- for (i = 0 ; i < count ; i++) {
- xistate->attribute_names[i]=g_strdup(attribute_names[i]);
- xistate->attribute_values[i]=g_strdup(attribute_values[i]);
- }
- xistate->parent=doc->last;
-
- if (doc->last) {
- doc->last->child=xistate;
- } else
- doc->first=xistate;
- doc->last=xistate;
- if (doc->active > 0 || xpointer_match(doc->xpointer, doc->first)) {
- if(!g_ascii_strcasecmp("xi:include", element_name)) {
- xinclude(context, attribute_names, attribute_values, doc, error);
- return;
- }
- start_element(context, element_name, attribute_names, attribute_values, doc->user_data, error);
- doc->active++;
- }
-
-}
-
-static void
-xi_end_element (GMarkupParseContext *context,
- const gchar *element_name,
- gpointer user_data,
- GError **error)
-{
- struct xmldocument *doc=user_data;
- struct xistate *xistate=doc->last;
- int i=0;
- doc->last=doc->last->parent;
- if (! doc->last)
- doc->first=NULL;
- else
- doc->last->child=NULL;
- if (doc->active > 0) {
- if(!g_ascii_strcasecmp("xi:include", element_name)) {
- return;
- }
- end_element(context, element_name, doc->user_data, error);
- doc->active--;
- }
- while (xistate->attribute_names[i]) {
- g_free(xistate->attribute_names[i]);
- g_free(xistate->attribute_values[i]);
- i++;
- }
- g_free(xistate->attribute_names);
- g_free(xistate->attribute_values);
- g_free(xistate);
-}
-
-/* Called for character data */
-/* text is not nul-terminated */
-static void
-xi_text (GMarkupParseContext *context,
- const gchar *text,
- gsize text_len,
- gpointer user_data,
- GError **error)
-{
-}
-
-
-
-static const GMarkupParser parser = {
- xi_start_element,
- xi_end_element,
- xi_text,
- NULL,
- NULL
-};
-
-static gboolean
-parse_file(struct xmldocument *document, GError **error)
-{
- GMarkupParseContext *context;
- gchar *contents, *message;
- gsize len;
- gint line, chr;
- gboolean result;
-
- dbg(1,"enter filename='%s'\n", document->href);
- context = g_markup_parse_context_new (&parser, 0, document, NULL);
-
- if (!g_file_get_contents (document->href, &contents, &len, error)) {
- g_markup_parse_context_free (context);
- return FALSE;
- }
- document->active=document->xpointer ? 0:1;
- document->first=NULL;
- document->last=NULL;
- result = g_markup_parse_context_parse (context, contents, len, error);
- if (!result && error && *error) {
- g_markup_parse_context_get_position(context, &line, &chr);
- message=g_strdup_printf("%s at line %d, char %d\n", (*error)->message, line, chr);
- g_free((*error)->message);
- (*error)->message=message;
- }
- g_markup_parse_context_free (context);
- g_free (contents);
- dbg(1,"return %d\n", result);
-
- return result;
-}
-
-gboolean config_load(char *filename, GError **error)
-{
- struct xmldocument document;
- struct xmlstate *curr=NULL;
- gboolean result;
-
- dbg(1,"enter filename='%s'\n", filename);
- memset(&document, 0, sizeof(document));
- document.href=filename;
- document.user_data=&curr;
- result=parse_file(&document, error);
- if (result && curr) {
- g_set_error(error,G_MARKUP_ERROR,G_MARKUP_ERROR_PARSE, "element '%s' not closed", curr->element);
- result=FALSE;
- }
- dbg(1,"return %d\n", result);
- return result;
-}
-
diff --git a/navit/xmlconfig.h b/navit/xmlconfig.h
deleted file mode 100644
index 2e03aa62..00000000
--- a/navit/xmlconfig.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef NAVIT_XMLCONFIG_H
-#define NAVIT_XMLCONFIG_H
-
-struct container;
-gboolean config_load(char *filename,GError **error);
-
-#endif
-
diff --git a/navit/xpm/Makefile.am b/navit/xpm/Makefile.am
deleted file mode 100644
index 8687603b..00000000
--- a/navit/xpm/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-include $(top_srcdir)/Makefile.inc
-xpm_DATA = airport.xpm attraction.xpm bank.xpm bar.xpm bus.xpm cafe.xpm camping.xpm car_dealer.xpm church.xpm cinema.xpm dumping-station.xpm exit.xpm fastfood.xpm firebrigade.xpm flag_bk_tr.xpm flag_bk_wh.xpm flag_bl_wh.xpm flag_wh_bk.xpm fuel.xpm golf.xpm highway_exit.xpm hospital.xpm hotel.xpm information.xpm library.xpm museum.xpm nav_left_1.xpm nav_left_2.xpm nav_right_1.xpm nav_right_2.xpm nav_straight.xpm parking.xpm pharmacy.xpm picnic.xpm police.xpm post.xpm restaurant.xpm restroom.xpm skiing.xpm sports.xpm swimming.xpm telephone.xpm theater.xpm tower.xpm traffic_signals.xpm trailerpark.xpm unknown.xpm gc_tradi.xpm gc_multi.xpm gc_mystery.xpm gc_event.xpm
-xpm_DATA += gc_reference.xpm gc_webcam.xpm gc_question.xpm gc_stages.xpm
-xpm_DATA += shopping.xpm heliport.xpm cursor.xpm peak.xpm mini_roundabout.xpm
-xpm_DATA += townhall.xpm level_crossing.xpm boat_ramp.xpm
-EXTRA_DIST = $(xpm_DATA)
-#burgerking.ico:
-# wget http://www.burgerking.de/favicon.ico -O burgerking.ico
diff --git a/navit/xpm/airport.xpm b/navit/xpm/airport.xpm
deleted file mode 100644
index ea40e00d..00000000
--- a/navit/xpm/airport.xpm
+++ /dev/null
@@ -1,75 +0,0 @@
-/* XPM */
-static char * airport_xpm[] = {
-"16 16 56 1",
-" c None",
-". c #03705F",
-"+ c #0F7767",
-"@ c #0F7766",
-"# c #DBEAE8",
-"$ c #D9EAE7",
-"% c #FEFEFE",
-"& c #FAFCFB",
-"* c #F8FAFA",
-"= c #FBFDFC",
-"- c #FCFDFD",
-"; c #0A7463",
-"> c #73B0A6",
-", c #F8FBFB",
-"' c #F9FBFB",
-") c #82B7AE",
-"! c #58A095",
-"~ c #057160",
-"{ c #5CA398",
-"] c #F8FBFA",
-"^ c #FFFFFF",
-"/ c #FBFCFC",
-"( c #E1EDEB",
-"_ c #077261",
-": c #459689",
-"< c #EFF6F5",
-"[ c #6FADA3",
-"} c #2E897B",
-"| c #F1F7F6",
-"1 c #FAFCFC",
-"2 c #388E81",
-"3 c #ECF4F3",
-"4 c #F3F8F7",
-"5 c #EDF5F3",
-"6 c #519C90",
-"7 c #0A7464",
-"8 c #FDFEFE",
-"9 c #087362",
-"0 c #4A988C",
-"a c #AED1CC",
-"b c #61A59B",
-"c c #529D91",
-"d c #0B7564",
-"e c #F7FAFA",
-"f c #338B7D",
-"g c #66A89E",
-"h c #077362",
-"i c #B4D4CF",
-"j c #E7F1F0",
-"k c #097363",
-"l c #DCEBE9",
-"m c #218172",
-"n c #348C7E",
-"o c #047160",
-"p c #278476",
-"q c #30897B",
-".......+@.......",
-".......#$.......",
-".......%%.......",
-".......&*.......",
-".......=-.......",
-".......&-.......",
-".....;>,')!.....",
-"...~{]^^^^/(_...",
-"..:^^^^^^^^^<[..",
-"}|^^^^/^-1/^^^(2",
-"3^4567.88.90#'^a",
-"bcd....e^....f6g",
-"......./1.......",
-".....hi%%jk.....",
-".....l^--^^.....",
-".....mno.pq....."};
diff --git a/navit/xpm/attraction.xpm b/navit/xpm/attraction.xpm
deleted file mode 100644
index f5771b02..00000000
--- a/navit/xpm/attraction.xpm
+++ /dev/null
@@ -1,141 +0,0 @@
-/* XPM */
-static char * attraction_xpm[] = {
-"16 16 122 2",
-" c None",
-". c #CC1400",
-"+ c #AE1100",
-"@ c #FB1800",
-"# c #BA1200",
-"$ c #FF1900",
-"% c #F61800",
-"& c #DA1500",
-"* c #DE1500",
-"= c #E51600",
-"- c #C31300",
-"; c #810C00",
-"> c #F01700",
-", c #FE1800",
-"' c #8B0D00",
-") c #8D0D00",
-"! c #D21400",
-"~ c #BB1200",
-"{ c #9D0F00",
-"] c #B21100",
-"^ c #AF1100",
-"/ c #AC1000",
-"( c #D61500",
-"_ c #8C0D00",
-": c #C11200",
-"< c #D71500",
-"[ c #9F0F00",
-"} c #D31400",
-"| c #C71300",
-"1 c #920E00",
-"2 c #F81800",
-"3 c #CD1400",
-"4 c #EE1700",
-"5 c #DC1500",
-"6 c #F71800",
-"7 c #840D00",
-"8 c #B31100",
-"9 c #E61600",
-"0 c #A41000",
-"a c #970E00",
-"b c #8A0D00",
-"c c #B61100",
-"d c #D11400",
-"e c #990F00",
-"f c #8E0D00",
-"g c #C81300",
-"h c #EB1700",
-"i c #E41600",
-"j c #E71600",
-"k c #B91200",
-"l c #B81200",
-"m c #EC1700",
-"n c #C61300",
-"o c #950E00",
-"p c #E01600",
-"q c #DB1500",
-"r c #9C0F00",
-"s c #AA1000",
-"t c #C01200",
-"u c #FA1800",
-"v c #E31600",
-"w c #DF1500",
-"x c #F91800",
-"y c #940E00",
-"z c #F31700",
-"A c #EF1700",
-"B c #D51400",
-"C c #B11100",
-"D c #890D00",
-"E c #A10F00",
-"F c #840C00",
-"G c #F11700",
-"H c #930E00",
-"I c #BE1200",
-"J c #FC1800",
-"K c #850D00",
-"L c #F51800",
-"M c #860D00",
-"N c #DD1500",
-"O c #A91000",
-"P c #EA1700",
-"Q c #E81600",
-"R c #FD1800",
-"S c #A61000",
-"T c #F41700",
-"U c #E11600",
-"V c #B41100",
-"W c #A00F00",
-"X c #D91500",
-"Y c #F21700",
-"Z c #C91300",
-"` c #960E00",
-" . c #CF1400",
-".. c #980E00",
-"+. c #D41400",
-"@. c #820C00",
-"#. c #A20F00",
-"$. c #D61400",
-"%. c #BF1200",
-"&. c #830C00",
-"*. c #9A0F00",
-"=. c #D01400",
-"-. c #A71000",
-";. c #CA1300",
-">. c #B51100",
-",. c #EA1600",
-"'. c #E21600",
-"). c #E91600",
-"!. c #A81000",
-"~. c #B01100",
-"{. c #F41800",
-"]. c #8E0E00",
-"^. c #CB1300",
-"/. c #ED1700",
-"(. c #D81500",
-"_. c #C51300",
-":. c #AD1100",
-"<. c #BD1200",
-"[. c #CE1400",
-"}. c #C21300",
-"|. c #910E00",
-"1. c #C41300",
-" ",
-" $ { ",
-" $ $ ",
-" $ $ ",
-" $ $ ",
-" $ $ $ $ ",
-"$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ ",
-" $ $ $ $ $ $ $ $ $ $ $ $ ",
-" $ $ $ $ $ $ $ $ $ $ ",
-" $ $ $ $ $ $ $ $ ",
-" $ $ $ $ $ $ ",
-" $ $ $ $ $ $ $ $ ",
-" $ $ $ $ $ $ $ ",
-" $ $ $ $ ",
-" $ $ $ ",
-" $ $ "};
diff --git a/navit/xpm/bar.xpm b/navit/xpm/bar.xpm
deleted file mode 100644
index c4da0cc2..00000000
--- a/navit/xpm/bar.xpm
+++ /dev/null
@@ -1,52 +0,0 @@
-/* XPM */
-static char * bar_xpm[] = {
-"14 16 33 1",
-" c None",
-". c #FFFFFF",
-"+ c #F3F5F9",
-"@ c #AAC0EC",
-"# c #99B4E9",
-"$ c #97B2E9",
-"% c #ACC2ED",
-"& c #F5F8FD",
-"* c #B3C6EB",
-"= c #3869CF",
-"- c #2D63D3",
-"; c #2F65D3",
-"> c #B0C2E8",
-", c #F7F7F7",
-"' c #8FA1C4",
-") c #3D6ED1",
-"! c #3166D3",
-"~ c #3368D4",
-"{ c #3066D3",
-"] c #4172D5",
-"^ c #AFC0E4",
-"/ c #FBFBFB",
-"( c #B9CBEE",
-"_ c #4374D7",
-": c #BACCF0",
-"< c #4474D7",
-"[ c #B8CAEE",
-"} c #8CAAE6",
-"| c #95B0E8",
-"1 c #BDC8DF",
-"2 c #688FDF",
-"3 c #B0BBD2",
-"4 c #F4F4F3",
-" ............ ",
-"+@#########$%&",
-".*=-;;;;;;;=>.",
-" ,')!~~~~{]^/ ",
-" ,(_;~~{):. ",
-" .(]{{]*. ",
-" .(<<[. ",
-" .}}. ",
-" .$|. ",
-" .||. ",
-" .||. ",
-" .||. ",
-" .||. ",
-" .||. ",
-" .||. ",
-" ,12234 "};
diff --git a/navit/xpm/bus.xpm b/navit/xpm/bus.xpm
deleted file mode 100644
index ec7460d4..00000000
--- a/navit/xpm/bus.xpm
+++ /dev/null
@@ -1,165 +0,0 @@
-/* XPM */
-static char *bus[] = {
-/* columns rows colors chars-per-pixel */
-"30 12 147 2",
-" c #0C0C0C",
-". c #0E0E0E",
-"X c #101010",
-"o c gray8",
-"O c #161616",
-"+ c gray10",
-"@ c #1D1D1D",
-"# c #1E1E1E",
-"$ c gray14",
-"% c gray15",
-"& c gray17",
-"* c #323232",
-"= c gray21",
-"- c #3A3A3A",
-"; c #3B3C3C",
-": c gray27",
-"> c #464646",
-", c #565656",
-"< c #5B5B5B",
-"1 c #5D6262",
-"2 c #606060",
-"3 c #6B6D6D",
-"4 c #6E7777",
-"5 c #008080",
-"6 c #018080",
-"7 c #018181",
-"8 c #028181",
-"9 c #038181",
-"0 c #038282",
-"q c #048282",
-"w c #058282",
-"e c #068383",
-"r c #078383",
-"t c #088484",
-"y c #0A8585",
-"u c #0B8686",
-"i c #0C8686",
-"p c #0D8686",
-"a c #0F8787",
-"s c #108888",
-"d c #148A8A",
-"f c #158A8A",
-"g c #168A8A",
-"h c #178B8B",
-"j c #188C8C",
-"k c #198C8C",
-"l c #1A8D8D",
-"z c #1B8D8D",
-"x c #1C8D8D",
-"c c #1E8E8E",
-"v c #1E8F8F",
-"b c #1F8F8F",
-"n c #208F8F",
-"m c #219090",
-"M c #229191",
-"N c #259191",
-"B c #279393",
-"V c #289393",
-"C c #299494",
-"Z c #2B9595",
-"A c #2C9595",
-"S c #329999",
-"D c #359A9A",
-"F c #379A9A",
-"G c #389B9B",
-"H c #3A9898",
-"J c #3B9D9D",
-"K c #3F9898",
-"L c #3C9D9D",
-"P c #3D9E9E",
-"I c #3F9F9F",
-"U c #469494",
-"Y c #469797",
-"T c #4E9494",
-"R c #549393",
-"E c #579393",
-"W c #42A0A0",
-"Q c #43A0A0",
-"! c #43A1A1",
-"~ c #44A0A0",
-"^ c #46A2A2",
-"/ c #4AA4A4",
-"( c #4BA5A5",
-") c #4CA5A5",
-"_ c #4EA6A6",
-"` c #57A3A3",
-"' c #52A8A8",
-"] c #59ACAC",
-"[ c #5AACAC",
-"{ c #5FAEAE",
-"} c #62A7A7",
-"| c #64B1B1",
-" . c #66B2B2",
-".. c #7EAAAA",
-"X. c #77BABA",
-"o. c #7BBCBC",
-"O. c #7DBEBE",
-"+. c #7EBEBE",
-"@. c gray51",
-"#. c #868686",
-"$. c gray53",
-"%. c gray54",
-"&. c #8D8D8D",
-"*. c #889A9A",
-"=. c #9F9F9F",
-"-. c #86A0A0",
-";. c #80ABAB",
-":. c gray72",
-">. c #B8BBBB",
-",. c #8CC4C4",
-"<. c #8FC6C6",
-"1. c #9CCCCC",
-"2. c #A0CECE",
-"3. c #A3D0D0",
-"4. c #A5D1D1",
-"5. c #A6D2D2",
-"6. c #A8D2D2",
-"7. c #AED5D5",
-"8. c #AFD6D6",
-"9. c #B0D7D7",
-"0. c #B1D7D7",
-"q. c #B8DADA",
-"w. c #B9DBDB",
-"e. c #BFDEDE",
-"r. c #C3C3C3",
-"t. c gray81",
-"y. c #C0DFDF",
-"u. c #D7DDDD",
-"i. c #C6E1E1",
-"p. c #C9E3E3",
-"a. c #D0E6E6",
-"s. c #D6E9E9",
-"d. c #D7EAEA",
-"f. c #DBE7E7",
-"g. c #D8EAEA",
-"h. c #DBECEC",
-"j. c #DDECEC",
-"k. c #E4E4E4",
-"l. c #E1EEEE",
-"z. c #E6F1F1",
-"x. c #EAF3F3",
-"c. c #EEF5F5",
-"v. c gray94",
-"b. c #F0F6F6",
-"n. c #F6F9F9",
-"m. c #F9FAFA",
-"M. c gray99",
-/* pixels */
-"b.^ h h j d j h h d j j d d d d j d d d j d d d j d j d h _ ",
-"a.l j Y ! Y W u Z Y ! Y D e P ! ! Y M u ^ Y W G t G ! Y N 8.",
-"w.s ' m.m.m.b.n 5.m.m.m.9.d l.m.M.M. .Z m.m.m.w.v e.m.n.[ e.",
-"9.u O.M.M.M.s.h p.M.M.M.<.v z.M.M.M.] Y M.M.M.5.M p.M.x.P 2.",
-"3.u X.e.e.e.<.h 1.e.e.e. .v 9.e.e.e.P / e.e.e.o.v 2.e.2.b +.",
-",.0 e t t t r 7 r e u r t 0 t t u r 7 e e u e e 0 t u e 7 _ ",
-"{ 7 7 7 7 7 5 5 7 5 5 5 5 5 7 7 5 5 5 5 5 5 7 7 7 7 7 5 7 S ",
-"J s K R T H 7 7 5 5 5 5 5 5 7 7 5 5 7 N U E Y l 7 7 7 7 5 V ",
-"Z } 1 X # 4 _ 5 5 5 7 5 5 5 5 5 7 7 M -.& ; ..p 5 5 5 7 M ",
-"P *.. :.%.+ ..n l l l l h l l h j j ` > , r.= 3 Y l l l l V ",
-"h.:.o @.2 $ u.g.g.g.s.g.s.s.s.s.s.s.g.< - &.% #.l.d.s.s.s.s.",
-"M.v.#.# * =.M.M.M.M.M.M.M.M.M.M.M.M.M.t.> O < k.M.M.M.M.M.M."
-};
diff --git a/navit/xpm/cafe.xpm b/navit/xpm/cafe.xpm
deleted file mode 100644
index a61aebc1..00000000
--- a/navit/xpm/cafe.xpm
+++ /dev/null
@@ -1,25 +0,0 @@
-/* XPM */
-static char * cafe_xpm[] = {
-"16 16 6 1",
-" c None",
-". c #FFFFFF",
-"+ c #0000FF",
-"@ c #FEFEFE",
-"# c #000000",
-"$ c #808080",
-" .............. ",
-".++++++++++++++.",
-".++++++++++++++.",
-".++@@@@@@@@@@++.",
-".++@@.####.@@++.",
-".++@##....##@++.",
-".++@#######$#++.",
-".++@#######$#++.",
-".++@########@++.",
-".++@.######.@++.",
-".++#..####.@#++.",
-".++@########@++.",
-".++@@@@@@@@@@++.",
-".++++++++++++++.",
-".++++++++++++++.",
-" .............. "};
diff --git a/navit/xpm/camping.xpm b/navit/xpm/camping.xpm
deleted file mode 100644
index 86ff7d46..00000000
--- a/navit/xpm/camping.xpm
+++ /dev/null
@@ -1,24 +0,0 @@
-/* XPM */
-static char *camping[]={
-"16 16 5 1",
-". c None",
-"b c #000000",
-"a c #0000ff",
-"c c #c6c6c6",
-"# c #ffffff",
-".##############.",
-"#aaaaaaaaaaaaaa#",
-"#aaaaaaaaaaaaaa#",
-"#aa####bb####aa#",
-"#aa###cbbc###aa#",
-"#aa###b##b###aa#",
-"#aa##cb##bc##aa#",
-"#aa##bc##cb##aa#",
-"#aa#cb#bb#bc#aa#",
-"#aa#bccbbccb#aa#",
-"#aacb#bbbb#bcaa#",
-"#aabbbbbbbbbbaa#",
-"#aa##########aa#",
-"#aaaaaaaaaaaaaa#",
-"#aaaaaaaaaaaaaa#",
-".##############."};
diff --git a/navit/xpm/car_dealer.xpm b/navit/xpm/car_dealer.xpm
deleted file mode 100644
index 892f10b2..00000000
--- a/navit/xpm/car_dealer.xpm
+++ /dev/null
@@ -1,26 +0,0 @@
-/* XPM */
-static char *car_dealer[]={
-"16 16 7 1",
-". c None",
-"c c #000000",
-"a c #0000ff",
-"b c #7f7f7f",
-"d c #bfbfbf",
-"e c #f6f6fa",
-"# c #ffffff",
-".##############.",
-"#aaaaaaaaaaaaaa#",
-"#a############a#",
-"#a####bccb####a#",
-"#a##dccccccd##a#",
-"#a#####cc#####a#",
-"#a##dccccccd##a#",
-"#a####bccbe###a#",
-"#a#####cc#####a#",
-"#a####dccd####a#",
-"#a####dccd####a#",
-"#a####bccb####a#",
-"#a####bccb####a#",
-"#a############a#",
-"#aaaaaaaaaaaaaa#",
-".##############."};
diff --git a/navit/xpm/church.xpm b/navit/xpm/church.xpm
deleted file mode 100644
index c14ed21f..00000000
--- a/navit/xpm/church.xpm
+++ /dev/null
@@ -1,24 +0,0 @@
-/* XPM */
-static char * church_xpm[] = {
-"10 16 5 1",
-" c None",
-". c #FFFFFF",
-"+ c #2F2F2F",
-"@ c #B1B1B1",
-"# c #000000",
-" .++. ",
-" .++. ",
-" ...++... ",
-".+++@@+++.",
-".+++@@+++.",
-" ...++... ",
-" .++. ",
-" ...++... ",
-".########.",
-".########.",
-".########.",
-".########.",
-".########.",
-".########.",
-".########.",
-".########."};
diff --git a/navit/xpm/golf.xpm b/navit/xpm/golf.xpm
deleted file mode 100644
index 637387cc..00000000
--- a/navit/xpm/golf.xpm
+++ /dev/null
@@ -1,275 +0,0 @@
-/* XPM */
-static char * golf_xpm[] = {
-"16 16 256 2",
-" c #3D3D3D",
-". c #696969",
-"+ c #393939",
-"@ c #474747",
-"# c #3A3223",
-"$ c #0D0D0D",
-"% c #060606",
-"& c #4A412F",
-"* c #5A5A5A",
-"= c #555555",
-"- c #15110B",
-"; c #514632",
-"> c #121212",
-", c #221D13",
-"' c #6E5C3B",
-") c #4D3E22",
-"! c #292929",
-"~ c #161616",
-"{ c #2B2B2B",
-"] c #222222",
-"^ c #564B37",
-"/ c #1E1E1E",
-"( c #242424",
-"_ c #29251B",
-": c #202020",
-"< c #090909",
-"[ c #1C1C1C",
-"} c #110E08",
-"| c #020202",
-"1 c #181818",
-"2 c #1A1A1A",
-"3 c #080807",
-"4 c #0F0C07",
-"5 c #010101",
-"6 c #ADADAD",
-"7 c #65583D",
-"8 c #FEFEFE",
-"9 c #484848",
-"0 c #909090",
-"a c #292317",
-"b c #3C3424",
-"c c #504631",
-"d c #4C3D21",
-"e c #62573F",
-"f c #6E5D3C",
-"g c #867552",
-"h c #886D36",
-"i c #6C6C6C",
-"j c #F7F7F7",
-"k c #FDFDFD",
-"l c #A2A2A2",
-"m c #FAFAFA",
-"n c #FBFBFB",
-"o c #6D6D6D",
-"p c #C7C7C7",
-"q c #F1F1F1",
-"r c #989898",
-"s c #FFCE6D",
-"t c #D4D4D4",
-"u c #262626",
-"v c #F6F6F6",
-"w c #F5F5F5",
-"x c #B1B1B1",
-"y c #FFD278",
-"z c #ACACAC",
-"A c #505050",
-"B c #D1D1D1",
-"C c #BEBEBE",
-"D c #BDBDBD",
-"E c #B0B0B0",
-"F c #9A9A9A",
-"G c #404040",
-"H c #8F8F8F",
-"I c #A3A3A3",
-"J c #F3F3F3",
-"K c #635840",
-"L c #4C4C4C",
-"M c #878787",
-"N c #FCFCFC",
-"O c #CDCDCD",
-"P c #D7D7D7",
-"Q c #4D4D4D",
-"R c #A1A1A1",
-"S c #C3C3C3",
-"T c #373737",
-"U c #F0F0F0",
-"V c #F4F4F4",
-"W c #E1E1E1",
-"X c #F2F2F2",
-"Y c #DBDBDB",
-"Z c #B2B2B2",
-"` c #A9A9A9",
-" . c #424242",
-".. c #BFBFBF",
-"+. c #7D7D7D",
-"@. c #D0D0D0",
-"#. c #EAEAEA",
-"$. c #8B8B8B",
-"%. c #2C2C2C",
-"&. c #898989",
-"*. c #AEAEAE",
-"=. c #F9F9F9",
-"-. c #272115",
-";. c #5C5C5C",
-">. c #D8D8D8",
-",. c #DFDFDF",
-"'. c #494949",
-"). c #B3B3B3",
-"!. c #2F2F2F",
-"~. c #888888",
-"{. c #515151",
-"]. c #9D9D9D",
-"^. c #6F6F6F",
-"/. c #2F281B",
-"(. c #434343",
-"_. c #2D271B",
-":. c #F5C86E",
-"<. c #6B6B6B",
-"[. c #A18D63",
-"}. c #DCB568",
-"|. c #5B4D32",
-"1. c #554729",
-"2. c #F2C469",
-"3. c #D2D2D2",
-"4. c #BA9E66",
-"5. c #86734E",
-"6. c #FACB6F",
-"7. c #D0AF6D",
-"8. c #FDCB69",
-"9. c #9E9E9E",
-"0. c #A5A5A5",
-"a. c #666666",
-"b. c #B7B7B7",
-"c. c #777777",
-"d. c #927B4D",
-"e. c #5C5038",
-"f. c #E6E6E6",
-"g. c #6E6E6E",
-"h. c #6A6A6A",
-"i. c #040403",
-"j. c #9B7E43",
-"k. c #67583A",
-"l. c #999999",
-"m. c #EFEFEF",
-"n. c #3E3729",
-"o. c #62553A",
-"p. c #CBCBCB",
-"q. c #828282",
-"r. c #FACC6E",
-"s. c #D5B370",
-"t. c #524732",
-"u. c #443B29",
-"v. c #DCDCDC",
-"w. c #93805A",
-"x. c #ABABAB",
-"y. c #BBBBBB",
-"z. c #C1C1C1",
-"A. c #6C5B3A",
-"B. c #DDB86D",
-"C. c #756341",
-"D. c #BCBCBC",
-"E. c #483F2D",
-"F. c #8B7854",
-"G. c #F9C866",
-"H. c #FDCD6F",
-"I. c #787878",
-"J. c #B49455",
-"K. c #E7BE6B",
-"L. c #716348",
-"M. c #E2BA6C",
-"N. c #62563F",
-"O. c #847351",
-"P. c #A88D55",
-"Q. c #AE8F50",
-"R. c #A28B5E",
-"S. c #E3E3E3",
-"T. c #C8C8C8",
-"U. c #D2B06C",
-"V. c #A7A7A7",
-"W. c #303030",
-"X. c #201B12",
-"Y. c #4E3F23",
-"Z. c #9B9B9B",
-"`. c #CECECE",
-" + c #5F533D",
-".+ c #5F543E",
-"++ c #9B8457",
-"@+ c #848484",
-"#+ c #727272",
-"$+ c #65583E",
-"%+ c #66583E",
-"&+ c #EAC06C",
-"*+ c #ECC068",
-"=+ c #8C8C8C",
-"-+ c #FECC6A",
-";+ c #322E26",
-">+ c #939393",
-",+ c #B5B5B5",
-"'+ c #C6C6C6",
-")+ c #F5C971",
-"!+ c #D5D5D5",
-"~+ c #776748",
-"{+ c #959595",
-"]+ c #534832",
-"^+ c #C3A363",
-"/+ c #AA8B4D",
-"(+ c #AD8E4F",
-"_+ c #7F7F7F",
-":+ c #0C0B09",
-"<+ c #F8F8F8",
-"[+ c #7A7A7A",
-"}+ c #444444",
-"|+ c #403828",
-"1+ c #A38851",
-"2+ c #443C2D",
-"3+ c #FECC66",
-"4+ c #EBEBEB",
-"5+ c #957E4F",
-"6+ c #DADADA",
-"7+ c #BFA166",
-"8+ c #636363",
-"9+ c #504227",
-"0+ c #CCCCCC",
-"a+ c #D3B372",
-"b+ c #757575",
-"c+ c #988256",
-"d+ c #B9B9B9",
-"e+ c #AC9363",
-"f+ c #C2C2C2",
-"g+ c #64573D",
-"h+ c #AFAFAF",
-"i+ c #605031",
-"j+ c #E8E8E8",
-"k+ c #E9E9E9",
-"l+ c #E5E5E5",
-"m+ c #705E3D",
-"n+ c #D3D3D3",
-"o+ c #565656",
-"p+ c #B8B8B8",
-"q+ c #B6B6B6",
-"r+ c #A6A6A6",
-"s+ c #584D36",
-"t+ c #5B4F37",
-"u+ c #5E523A",
-"v+ c #353535",
-"w+ c #969696",
-"x+ c #979797",
-"y+ c #8D8D8D",
-"z+ c #4B422F",
-"A+ c #5D5D5D",
-"B+ c #7B7B7B",
-"C+ c #020201",
-"D+ c #FFCF6F",
-"E+ c #FFCC66",
-"F+ c #FFFFFF",
-"G+ c #000000",
-"G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+",
-"G+G+G+G+F+F+F+F+F+F+F+F+v.G+G+G+",
-"G+G+G+G+G+G+O n G+5 k+F+z G+G+G+",
-"G+G+G+G+G+G+F+F+G+F+8 F+G+G+G+G+",
-"G+G+G+G+G+G+G+G+F+W 3 F+G+G+G+G+",
-"G+G+G+G+G+G+G+F+F+j F+G+G+G+G+G+",
-"G+G+G+G+G+G+r F+F+F+G+G+G+G+G+G+",
-"G+G+G+G+G+G+l F+F+6 G+G+G+G+G+G+",
-"G+G+G+G+G+G+l F+F+6 G+G+G+G+G+G+",
-"G+G+G+G+G+G+6 F+F+6 G+G+G+G+G+G+",
-"G+G+G+G+G+G+*.F+F+6 G+G+G+G+G+G+",
-"G+G+G+G+G+G+j F+F+6 G+G+G+G+G+G+",
-"G+G+G+G+G+k F+| F+6 G+G+G+G+G+G+",
-"G+G+G+G+F+w 5 G+F+6 G+G+G+G+G+G+",
-"G+G+G+G+G+G+G+G+F+].G+G+G+G+G+G+",
-"G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+G+"};
diff --git a/navit/xpm/heliport.xpm b/navit/xpm/heliport.xpm
deleted file mode 100644
index ef350c08..00000000
--- a/navit/xpm/heliport.xpm
+++ /dev/null
@@ -1,19 +0,0 @@
-/* XPM */
-static char * heliport_xpm[] = {
-"20 12 4 1",
-" c None",
-". c #FFFFFF",
-"+ c #000000",
-"@ c #000070",
-" .+. ",
-" ...... .+. ",
-".++++++....+.. ",
-" ......+++++++......",
-". ..++...++++++",
-"@. .+@@@@@......",
-"@. .+@@@@ @@@. ",
-"@@....@@@@@@ @. ",
-"@@@@@@@@@@@@ @.",
-"........@@@@ @.",
-" .@@@@@ @@.",
-" ..@@@@@@@. "};
diff --git a/navit/xpm/information.xpm b/navit/xpm/information.xpm
deleted file mode 100644
index 08ea5798..00000000
--- a/navit/xpm/information.xpm
+++ /dev/null
@@ -1,70 +0,0 @@
-/* XPM */
-static char * information_xpm[] = {
-"16 16 51 1",
-" c #156907",
-". c #1D6E0F",
-"+ c #83B07C",
-"@ c #A7C7A2",
-"# c #55934B",
-"$ c #A7C6A2",
-"% c #FDFDFD",
-"& c #FAFCFA",
-"* c #4C8D42",
-"= c #1E6F11",
-"- c #F8FBF8",
-"; c #A0C39B",
-"> c #1F6F12",
-", c #A0C29B",
-"' c #B2CDAE",
-") c #FBFCFB",
-"! c #508F45",
-"~ c #217014",
-"{ c #93BA8C",
-"] c #B5D0B1",
-"^ c #5E9855",
-"/ c #75A970",
-"( c #D5E5D5",
-"_ c #D5E5D4",
-": c #D9E7D8",
-"< c #DBE8DA",
-"[ c #6FA368",
-"} c #1A6C0C",
-"| c #F4F8F3",
-"1 c #83B17D",
-"2 c #E4EEE2",
-"3 c #82AF7B",
-"4 c #E3EDE1",
-"5 c #7FAD78",
-"6 c #80AE79",
-"7 c #DFEBDE",
-"8 c #84B17E",
-"9 c #DFEADD",
-"0 c #1B6C0D",
-"a c #EFF4ED",
-"b c #A0C29A",
-"c c #186B0A",
-"d c #2E7C24",
-"e c #93BB8F",
-"f c #E3EDE3",
-"g c #E2EDE2",
-"h c #DCE9DC",
-"i c #DDEADD",
-"j c #D6E5D6",
-"k c #599754",
-"l c #25741A",
-" .+@# ",
-" $%%&* ",
-" =-%%%; ",
-" >&%%%, ",
-" '%%)! ",
-" ~{]^ ",
-" /(_:<[ ",
-" }|%%%1 ",
-" 2%%%3 ",
-" 4%%%5 ",
-" 4%%%6 ",
-" 7%%%8 ",
-" 9%%%3 ",
-" 0a%%%b ",
-" cdefghijkl ",
-" "};
diff --git a/navit/xpm/level_crossing.xpm b/navit/xpm/level_crossing.xpm
deleted file mode 100644
index 83b2d716..00000000
--- a/navit/xpm/level_crossing.xpm
+++ /dev/null
@@ -1,16 +0,0 @@
-/* XPM */
-static char * level_crossing_xpm[] = {
-"11 11 2 1",
-" c None",
-". c #797774",
-". .",
-".. ..",
-" .. .. ",
-" .. .. ",
-" .. .. ",
-" ... ",
-" .. .. ",
-" .. .. ",
-" .. .. ",
-".. ..",
-". ."};
diff --git a/navit/xpm/picnic.xpm b/navit/xpm/picnic.xpm
deleted file mode 100644
index b2729966..00000000
--- a/navit/xpm/picnic.xpm
+++ /dev/null
@@ -1,66 +0,0 @@
-/* XPM */
-static char *picnic[] = {
-/* columns rows colors chars-per-pixel */
-"16 15 45 1",
-" c #000023",
-". c #060629",
-"X c #0A0A2D",
-"o c #141436",
-"O c #1B1B3E",
-"+ c #1F1F41",
-"@ c #262648",
-"# c #28284A",
-"$ c #29294C",
-"% c #2B2B4D",
-"& c #353558",
-"* c #37375A",
-"= c #404062",
-"- c #454567",
-"; c #48486B",
-": c #4A4A6C",
-"> c #4C4C6F",
-", c #535375",
-"< c #2727C6",
-"1 c #646486",
-"2 c #666688",
-"3 c #68688B",
-"4 c #737396",
-"5 c #7B7B9D",
-"6 c #7E7EA1",
-"7 c #4D4DCF",
-"8 c #8181A4",
-"9 c #8A8AAD",
-"0 c #8C8CAE",
-"q c #9898BB",
-"w c #9A9ABC",
-"e c #A6A6C9",
-"r c #AFAFD2",
-"t c #B4B4D6",
-"y c #B9B9DB",
-"u c #BDBDDF",
-"i c #B5B5E8",
-"p c #C2C2E4",
-"a c #C9C9EF",
-"s c #CECEF1",
-"d c #CFCFF1",
-"f c #D0D0F2",
-"g c #D1D1F2",
-"h c #F6F6FC",
-"j c None",
-/* pixels */
-"jjgggggdgddgddjj",
-"jadgggdgdggggddj",
-"ddgq,,,,,,,,,gdd",
-"dgd4 .ddd",
-"dddie* :: 6eddd",
-"ddddt+ yy wddgd",
-"dddd3 #pd2 +ddgg",
-"d>%%. o#%o .%%%0",
-"d@ . 6",
-"ddd- =dgdd0 ddd",
-"dgd Xqddddd% 2dd",
-"gg6 *dddddd* ,dd",
-"gg8,4gddgggi,,td",
-"jgggdgddggggdddj",
-"jjdgggggggggddjj"
-};
diff --git a/navit/xpm/skiing.xpm b/navit/xpm/skiing.xpm
deleted file mode 100644
index e62bbd5b..00000000
--- a/navit/xpm/skiing.xpm
+++ /dev/null
@@ -1,139 +0,0 @@
-/* XPM */
-static char *skiing[] = {
-/* columns rows colors chars-per-pixel */
-"32 32 101 2",
-" c #000000030000",
-". c #000001430000",
-"X c #000002470000",
-"o c #0000034C0000",
-"O c #0000057D0000",
-"+ c #000006C60000",
-"@ c #000007920000",
-"# c #0000084A0000",
-"$ c #000009AD0000",
-"% c #00000A890000",
-"& c #00000B5E0000",
-"* c #00000C9B0000",
-"= c #00000E7E0000",
-"- c #00000FB70000",
-"; c #000010F30000",
-": c #000011AC0000",
-"> c #000012800000",
-", c #000013A40000",
-"< c #0000147A0000",
-"1 c #000015510000",
-"2 c #000017790000",
-"3 c #000018EC0000",
-"4 c #000019C80000",
-"5 c #00001AA40000",
-"6 c #00001BBA0000",
-"7 c #00001C600000",
-"8 c #00001D780000",
-"9 c #00001EB60000",
-"0 c #00001FAB0000",
-"q c #000020C70000",
-"w c #000021AB0000",
-"e c #000023EA0000",
-"r c #000024840000",
-"t c #000025800000",
-"y c #000026560000",
-"u c #000028F00000",
-"i c #000029DE0000",
-"p c #00002BBB0000",
-"a c #00002CD30000",
-"s c #00002D9D0000",
-"d c #00002F090000",
-"f c #00002F830000",
-"g c #000030C90000",
-"h c #000033850000",
-"j c #000034550000",
-"k c #000035CD0000",
-"l c #000037470000",
-"z c #000038850000",
-"x c #000039830000",
-"c c #00003B910000",
-"v c #00003CC80000",
-"b c #00003D6B0000",
-"n c #00003F540000",
-"m c #000040DF0000",
-"M c #000041E80000",
-"N c #000043FD0000",
-"B c #000044B00000",
-"V c #000045D40000",
-"C c #000046E20000",
-"Z c #000049040000",
-"A c #000049D10000",
-"S c #00004AE40000",
-"D c #00004D0F0000",
-"F c #00004EE20000",
-"G c #000052920000",
-"H c #000053B00000",
-"J c #000054CF0000",
-"K c #0000555F0000",
-"L c #000056810000",
-"P c #000058C80000",
-"I c #000059EE0000",
-"U c #00005C200000",
-"Y c #00005CD30000",
-"T c #00005DCC0000",
-"R c #000060580000",
-"E c #0000621F0000",
-"W c #000064AB0000",
-"Q c #000069120000",
-"! c #000069FD0000",
-"~ c #00006BD70000",
-"^ c #00006CF50000",
-"/ c #00006E050000",
-"( c #00006EF50000",
-") c #00006FE70000",
-"_ c #0000721D0000",
-"` c #000073640000",
-"' c #000074070000",
-"] c #000074AB0000",
-"[ c #000075F50000",
-"{ c #000077090000",
-"} c #000077E70000",
-"| c #000079130000",
-" . c #000079DC0000",
-".. c #00007A840000",
-"X. c #00007BD50000",
-"o. c #00007CD40000",
-"O. c #00007E280000",
-"+. c #00007F280000",
-"@. c #00007FD40000",
-"#. c #000080800000",
-"$. c None",
-/* pixels */
-"$.$.@.@.@.@.@.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.$.$.",
-"$.@.@. #.#.$.",
-"@.@. #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#. #.#.",
-"@. @.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#. #.",
-"#. #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#. #.",
-"#. #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#. #.",
-"#. #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#. #.",
-"#. #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#. #.",
-"#. #.#.#.#.#.#.#.#.#.#.#.#.#.#.@.@.@.@.@.@.@.@.#.#.#.#.#.#. #.",
-"#. #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.@.@.@.#.@.@.@.#.#.#.#.#.#. #.",
-"#. #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.@.@.#.#.@.@.#.@.@.#.#.#. #.",
-"#. #.#.#.#.#.#.#.#.#.#.#.#.#.#.@.@.Q F A v h v o.@.@.@.#.#. #.",
-"#. #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.' v > * * * 1 A j c ) #.#. #.",
-"#. #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.o.K t # @ > # q @ * c #.#. #.",
-"#. #.#.#.#.#.#.#.#.#.#.#.#.#.#.@.@.] B > * 3 # 1 q #.#. #.",
-"#. #.#.#.#.#.#.#.#.#.#.#.#.#.#.@.) B q * > * * q # v #.#. #.",
-"#. #.#.#.#.#.#.#.@.@.@.@.@.@.@.) v > * 1 # 7 3 7 j @.@. #.",
-"#. #.#.#.#.#.#.#.@.@.@.@.@.@.@.G 1 # > * # 7 7 7 @.@. #.",
-"#. #.#.#.#.@.#.#.#.@.@.@.#.@.@.B * * 3 # 1 3 7 @ j #.#. #.",
-"#. #.#.#.#.@.@.#.#.@.@...) ] ..c @ 1 1 i G I K # # E #.#. #.",
-"#. #.#.@.@.@.@.#.#.#.#.Q v A I t > 1 3 U @.@.U @ q o.#.#. #.",
-"#. #.#.@.@.@.@.#.#.#.#.E c c h > @ > 1 s ..@.] B # B @.#.#. #.",
-"#. #.#.o.@.@.@.#.#.#.#.] ' U t 1 3 > m ..@.) h * ' @.#.#. #.",
-"#. #.#.) ' ..@.#.#.#.#...U t @ @ 7 t t B U ' I 7 s #.#.#.#. #.",
-"#. #.#.c m F W ) ) ' ] G 3 @ 7 v K ..' K m j 1 K @.@.@.#. #.",
-"#. #.#...W A h i s v c 1 # t I o.@.@.@.@.o.I q o.@.@.@.#. #.",
-"#. #.#.@.@.o.@.@...U B s q t v K ) ] ....o.o.@.@.@.@.@.#.#. #.",
-"#. #.#.@.@.@.@.@.@.@.#.@.@.) F j q 7 h A W ..o.o.o.] ] #.#. #.",
-"#. #.@.#.#.#.#.#.#.#.#.#.#.#.@.@...E B s q q j h 7 E #. #.",
-"#.#. #.#.#.#.#.#.#.#.#.#.#.#.@.@.@.@.@.@.@.@.@.@.@.#. #.#.",
-"$.#.#. #.#.$.",
-"$.$.#.#.#.#.#.#.#.#.#.#.#.#.@.@.@.@.@.@.@.@.@.@.@.@.#.#.#.#.$.$."
-};
diff --git a/navit/xpm/sports.xpm b/navit/xpm/sports.xpm
deleted file mode 100644
index 567f8bb9..00000000
--- a/navit/xpm/sports.xpm
+++ /dev/null
@@ -1,95 +0,0 @@
-/* XPM */
-static char *sports[] = {
-/* columns rows colors chars-per-pixel */
-"16 16 73 1",
-" c black",
-". c #010101",
-"X c #000200",
-"o c #020202",
-"O c #0C0C0C",
-"+ c #001B00",
-"@ c #001C00",
-"# c #0D150D",
-"$ c #1E1E1E",
-"% c #002100",
-"& c #002300",
-"* c #003A00",
-"= c #003F00",
-"- c #1F251F",
-"; c #212D21",
-": c gray17",
-"> c #213421",
-", c gray19",
-"< c #343434",
-"1 c #393939",
-"2 c gray23",
-"3 c gray24",
-"4 c #054105",
-"5 c #004C00",
-"6 c #0E4E0E",
-"7 c #005100",
-"8 c #005B00",
-"9 c #025F02",
-"0 c #0B510B",
-"q c #006700",
-"w c #006D00",
-"e c #007A00",
-"r c #007D00",
-"t c #007E00",
-"y c #007F00",
-"u c #205720",
-"i c gray25",
-"p c #444444",
-"a c gray27",
-"s c #4E4E4E",
-"d c gray32",
-"f c #5B5B5B",
-"g c #5D5D5D",
-"h c #5D6B5D",
-"j c #606660",
-"k c #6D6D6D",
-"l c gray43",
-"z c #6F6F6F",
-"x c gray46",
-"c c #777777",
-"v c gray47",
-"b c gray50",
-"n c #008000",
-"m c #808080",
-"M c #808B80",
-"N c #838A83",
-"B c #828E82",
-"V c gray55",
-"C c #A7A7A7",
-"Z c #ADAEAD",
-"A c gray70",
-"S c #B6B6B6",
-"D c #C5C5C5",
-"F c #C8C8C8",
-"G c gray84",
-"H c #DADADA",
-"J c #DFDFDF",
-"K c gray91",
-"L c gray98",
-"P c gray99",
-"I c #FEFEFE",
-"U c gray100",
-"Y c None",
-/* pixels */
-"Y Y",
-" nnnnnnnnnnnn ",
-" nnnnnnnnnnnnnn ",
-" nnnny74*5ennnn ",
-" nnn9>SKdih8nnn ",
-" nnw#aIIxPIhqnn ",
-" nn& gk< zJ2@nn ",
-" nn-fII$ mk nn ",
-" nnZmIDs,3IH2nn ",
-" nnMi2vIIvFbNnn ",
-" nn6 <GPa :unn ",
-" nny&OCSV +ynn ",
-" nnny0BAS;=yynn ",
-" nnnnnnnnnynnnn ",
-" nnnnnnnnnnnn ",
-"Y Y"
-};
diff --git a/navit/xpm/zoo.xpm b/navit/xpm/zoo.xpm
deleted file mode 100644
index 5e2194da..00000000
--- a/navit/xpm/zoo.xpm
+++ /dev/null
@@ -1,40 +0,0 @@
-/* XPM */
-static char * zoo_xpm[] = {
-"32 32 5 1",
-" c None",
-". c #000000",
-"+ c #363636",
-"@ c #2C2C2C",
-"# c #FFFFFF",
-" ",
-" ",
-" ",
-" ",
-" .... ....... ",
-" ..................... ",
-" ....................... ",
-" .......................... ",
-" ............................ ",
-" ............................ ",
-" ............................. ",
-" ............................. ",
-".............................. ",
-".......................+@ ......",
-"..................... ### .....",
-"..................... ### ... ",
-"..................... ## ... ",
-"............. ....... ### ... ",
-"......... ....... #### ...",
-"......... ....... ## ...",
-"......... ........ ## ...",
-"......... ........ ..",
-"......... ......... ..",
-"......... ... .... ..",
-"... .... ... ... ..",
-"... .... ..... .... ..",
-"... .... ..... .... ..",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/navit/zipfile.h b/navit/zipfile.h
deleted file mode 100644
index 695576d3..00000000
--- a/navit/zipfile.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef __ZIPFILE_H__
-
-struct zip_lfh {
- int ziplocsig;
- short zipver;
- short zipgenfld;
- short zipmthd;
- short ziptime;
- short zipdate;
- int zipcrc;
- unsigned int zipsize;
- unsigned int zipuncmp;
- unsigned short zipfnln;
- unsigned short zipxtraln;
- char zipname[0];
-} __attribute__ ((packed));
-
-struct zip_cd {
- int zipcensig;
- char zipcver;
- char zipcos;
- char zipcvxt;
- char zipcexos;
- short zipcflg;
- short zipcmthd;
- short ziptim;
- short zipdat;
- int zipccrc;
- unsigned int zipcsiz;
- unsigned int zipcunc;
- unsigned short zipcfnl;
- unsigned short zipcxtl;
- unsigned short zipccml;
- unsigned short zipdsk;
- unsigned short zipint;
- unsigned int zipext;
- unsigned int zipofst;
- char zipcfn[0];
-} __attribute__ ((packed));
-
-struct zip_eoc {
- int zipesig;
- unsigned short zipedsk;
- unsigned short zipecen;
- unsigned short zipenum;
- unsigned short zipecenn;
- unsigned int zipecsz;
- unsigned int zipeofst;
- short zipecoml;
- char zipecom[0];
-} __attribute__ ((packed));
-
-#define __ZIPFILE_H__
-
-#endif
diff --git a/navit_nls.h b/navit_nls.h
new file mode 100644
index 00000000..d6ac7fe9
--- /dev/null
+++ b/navit_nls.h
@@ -0,0 +1,23 @@
+#ifndef __NAVIT_NLS_H__
+#include "config.h"
+
+#ifdef ENABLE_NLS
+#include <libintl.h>
+#define _(STRING) gettext(STRING)
+#define gettext_noop(String) String
+#define _n(STRING) gettext_noop(STRING)
+#else
+#define _(STRING) STRING
+#define _n(STRING) STRING
+#define gettext(STRING) STRING
+static inline const char *ngettext(const char *msgid, const char *msgid_plural, unsigned long int n)
+{
+ if (n == 1) {
+ return msgid;
+ } else {
+ return msgid_plural;
+ }
+}
+#endif
+#define __NAVIT_NLS_H__
+#endif
diff --git a/osd.c b/osd.c
new file mode 100644
index 00000000..dc056101
--- /dev/null
+++ b/osd.c
@@ -0,0 +1,301 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include "debug.h"
+#include "plugin.h"
+#include "item.h"
+#include "color.h"
+#include "point.h"
+#include "navit.h"
+#include "graphics.h"
+#include "command.h"
+#include "callback.h"
+#include "osd.h"
+
+
+struct osd {
+ struct osd_methods meth;
+ struct osd_priv *priv;
+};
+
+struct osd *
+osd_new(struct attr *parent, struct attr **attrs)
+{
+ struct osd *o;
+ struct osd_priv *(*new)(struct navit *nav, struct osd_methods *meth, struct attr **attrs);
+ struct attr *type=attr_search(attrs, NULL, attr_type);
+
+ if (! type)
+ return NULL;
+ new=plugin_get_osd_type(type->u.str);
+ if (! new)
+ return NULL;
+ o=g_new0(struct osd, 1);
+ o->priv=new(parent->u.navit, &o->meth, attrs);
+ return o;
+}
+
+void
+osd_wrap_point(struct point *p, struct navit *nav)
+{
+ if (p->x < 0)
+ p->x += navit_get_width(nav);
+ if (p->y < 0)
+ p->y += navit_get_height(nav);
+
+}
+
+void
+osd_std_click(struct osd_item *this, struct navit *nav, int pressed, int button, struct point *p)
+{
+ struct point bp = this->p;
+ osd_wrap_point(&bp, nav);
+ if ((p->x < bp.x || p->y < bp.y || p->x > bp.x + this->w || p->y > bp.y + this->h || !this->configured) && !this->pressed)
+ return;
+ if (navit_ignore_button(nav))
+ return;
+ this->pressed = pressed;
+ if (pressed) {
+ struct attr navit;
+ navit.type=attr_navit;
+ navit.u.navit=nav;
+ dbg(0, "calling command '%s'\n", this->command);
+ command_evaluate(&navit, this->command);
+ }
+}
+
+void
+osd_std_resize(struct osd_item *item)
+{
+ graphics_overlay_resize(item->gr, &item->p, item->w, item->h, 65535, 1);
+}
+
+static void
+osd_std_calculate_sizes(struct osd_item *item, struct osd_priv *priv, int w, int h)
+{
+ struct attr vehicle_attr;
+
+ if (item->rel_w) {
+ item->w = (item->rel_w * w) / 100;
+ }
+
+ if (item->rel_h) {
+ item->h = (item->rel_h * h) / 100;
+ }
+
+ if (item->rel_x) {
+ item->p.x = (item->rel_x * w) / 100;
+ }
+
+ if (item->rel_y) {
+ item->p.y = (item->rel_y * h) / 100;
+ }
+
+ osd_std_resize(item);
+ if (item->meth.draw) {
+ if (navit_get_attr(item->navit, attr_vehicle, &vehicle_attr, NULL)) {
+ item->meth.draw(priv, item->navit, vehicle_attr.u.vehicle);
+ }
+ }
+}
+
+static void
+osd_std_reconfigure(struct osd_item *item, struct command_saved *cs)
+{
+ if (!command_saved_error(cs)) {
+ graphics_overlay_disable(item->gr, !command_saved_get_int(cs));
+ } else {
+ dbg(0, "Error in saved command: %i\n", command_saved_error(cs));
+ }
+}
+
+void
+osd_set_std_attr(struct attr **attrs, struct osd_item *item, int flags)
+{
+ struct attr *attr;
+
+ item->flags=flags;
+ item->osd_configuration=-1;
+ item->color_white.r = 0xffff;
+ item->color_white.g = 0xffff;
+ item->color_white.b = 0xffff;
+ item->color_white.a = 0xffff;
+ item->text_color.r = 0xffff;
+ item->text_color.g = 0xffff;
+ item->text_color.b = 0xffff;
+ item->text_color.a = 0xffff;
+ if (flags & 1) {
+ item->color_bg.r = 0x0808;
+ item->color_bg.g = 0x0808;
+ item->color_bg.b = 0xf8f8;
+ item->color_bg.a = 0x0000;
+ } else {
+ item->color_bg.r = 0x0;
+ item->color_bg.g = 0x0;
+ item->color_bg.b = 0x0;
+ item->color_bg.a = 0x5fff;
+ }
+
+ attr=attr_search(attrs, NULL, attr_osd_configuration);
+ if (attr)
+ item->osd_configuration = attr->u.num;
+
+ attr=attr_search(attrs, NULL, attr_enable_expression);
+ if (attr) {
+ item->enable_cs = command_saved_new(attr->u.str, item->navit, NULL);
+ }
+
+ attr = attr_search(attrs, NULL, attr_w);
+ if (attr) {
+ if (attr->u.num > ATTR_REL_MAXABS) {
+ item->rel_w = attr->u.num - ATTR_REL_RELSHIFT;
+ } else {
+ item->rel_w = 0;
+ item->w = attr->u.num;
+ }
+ }
+
+ attr = attr_search(attrs, NULL, attr_h);
+ if (attr) {
+ if (attr->u.num > ATTR_REL_MAXABS) {
+ item->rel_h = attr->u.num - ATTR_REL_RELSHIFT;
+ } else {
+ item->rel_h = 0;
+ item->h = attr->u.num;
+ }
+ }
+
+ attr = attr_search(attrs, NULL, attr_x);
+ if (attr) {
+ if (attr->u.num > ATTR_REL_MAXABS) {
+ item->rel_x = attr->u.num - ATTR_REL_RELSHIFT;
+ } else {
+ item->rel_x = 0;
+ item->p.x = attr->u.num;
+ }
+ }
+
+ attr = attr_search(attrs, NULL, attr_y);
+ if (attr) {
+ if (attr->u.num > ATTR_REL_MAXABS) {
+ item->rel_y = attr->u.num - ATTR_REL_RELSHIFT;
+ } else {
+ item->rel_y = 0;
+ item->p.y = attr->u.num;
+ }
+ }
+
+ attr = attr_search(attrs, NULL, attr_font_size);
+ if (attr)
+ item->font_size = attr->u.num;
+
+ attr=attr_search(attrs, NULL, attr_background_color);
+ if (attr)
+ item->color_bg=*attr->u.color;
+ attr = attr_search(attrs, NULL, attr_command);
+ if (attr)
+ item->command = g_strdup(attr->u.str);
+ attr=attr_search(attrs, NULL, attr_text_color);
+ if (attr)
+ item->text_color=*attr->u.color;
+ attr=attr_search(attrs, NULL, attr_flags);
+ if (attr)
+ item->attr_flags=attr->u.num;
+}
+
+void
+osd_std_config(struct osd_item *item, struct navit *navit)
+{
+ struct attr attr;
+ dbg(1,"enter\n");
+ if (item->enable_cs) {
+ item->reconfig_cb = callback_new_1(callback_cast(osd_std_reconfigure), item);
+ command_saved_set_cb(item->enable_cs, item->reconfig_cb);
+
+ if (!command_saved_error(item->enable_cs)) {
+ item->configured = !! command_saved_get_int(item->enable_cs);
+ } else {
+ dbg(0, "Error in saved command: %i.\n", command_saved_error(item->enable_cs));
+ }
+ } else {
+ if (!navit_get_attr(navit, attr_osd_configuration, &attr, NULL))
+ attr.u.num=-1;
+ item->configured = !!(attr.u.num & item->osd_configuration);
+ }
+ graphics_overlay_disable(item->gr, !item->configured);
+}
+
+void
+osd_set_std_graphic(struct navit *nav, struct osd_item *item, struct osd_priv *priv)
+{
+ struct graphics *navit_gr;
+
+ navit_gr = navit_get_graphics(nav);
+ item->gr = graphics_overlay_new(navit_gr, &item->p, item->w, item->h, 65535, 1);
+
+ item->graphic_bg = graphics_gc_new(item->gr);
+ graphics_gc_set_foreground(item->graphic_bg, &item->color_bg);
+ graphics_background_gc(item->gr, item->graphic_bg);
+
+ item->graphic_fg_white = graphics_gc_new(item->gr);
+ graphics_gc_set_foreground(item->graphic_fg_white, &item->color_white);
+
+ if (item->flags & 2) {
+ item->font = graphics_font_new(item->gr, item->font_size, 1);
+ item->graphic_fg_text = graphics_gc_new(item->gr);
+ graphics_gc_set_foreground(item->graphic_fg_text, &item->text_color);
+ }
+
+ item->cb = callback_new_attr_2(callback_cast(osd_std_config), attr_osd_configuration, item, nav);
+ navit_add_callback(nav, item->cb);
+
+ item->resize_cb = callback_new_attr_2(callback_cast(osd_std_calculate_sizes), attr_resize, item, priv);
+ graphics_add_callback(navit_gr, item->resize_cb);
+
+ osd_std_config(item, nav);
+}
+
+void
+osd_std_draw(struct osd_item *item)
+{
+ struct point p[2];
+ int flags=item->attr_flags;
+
+ graphics_draw_mode(item->gr, draw_mode_begin);
+ p[0].x=0;
+ p[0].y=0;
+ graphics_draw_rectangle(item->gr, item->graphic_bg, p, item->w, item->h);
+ p[1].x=item->w-1;
+ p[1].y=0;
+ if (flags & 1)
+ graphics_draw_lines(item->gr, item->graphic_fg_text, p, 2);
+ p[0].x=item->w-1;
+ p[0].y=item->h-1;
+ if (flags & 2)
+ graphics_draw_lines(item->gr, item->graphic_fg_text, p, 2);
+ p[1].x=0;
+ p[1].y=item->h-1;
+ if (flags & 4)
+ graphics_draw_lines(item->gr, item->graphic_fg_text, p, 2);
+ p[0].x=0;
+ p[0].y=0;
+ if (flags & 8)
+ graphics_draw_lines(item->gr, item->graphic_fg_text, p, 2);
+}
diff --git a/osd.h b/osd.h
new file mode 100644
index 00000000..e7bc91a8
--- /dev/null
+++ b/osd.h
@@ -0,0 +1,68 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_OSD_H
+#define NAVIT_OSD_H
+
+struct osd_priv;
+
+struct osd_methods {
+ void (*osd_destroy)(struct osd_priv *osd);
+};
+
+#define osd_draw_cast(x) (void (*)(struct osd_priv *osd, struct navit *navit, struct vehicle *v))(x)
+
+struct osd_item_methods {
+ void (*draw)(struct osd_priv *osd, struct navit *navit, struct vehicle *v);
+};
+
+struct osd_item {
+ struct point p;
+ struct osd_item_methods meth;
+ int flags, attr_flags, w, h, fg_line_width, font_size, osd_configuration, configured;
+ int rel_w, rel_h, rel_x, rel_y;
+ struct color color_bg, color_white, text_color;
+ struct navit *navit;
+ struct graphics *gr;
+ struct graphics_gc *graphic_bg, *graphic_fg_white, *graphic_fg_text;
+ struct graphics_font *font;
+ struct callback *cb;
+ struct callback *resize_cb;
+ struct callback *reconfig_cb;
+ int pressed;
+ char *command;
+ struct command_saved *enable_cs;
+};
+
+/* prototypes */
+struct attr;
+struct navit;
+struct osd;
+struct osd *osd_new(struct attr *parent, struct attr **attrs);
+void osd_wrap_point(struct point *p, struct navit *nav);
+void osd_std_click(struct osd_item *this, struct navit *nav, int pressed, int button, struct point *p);
+void osd_set_std_attr(struct attr **attrs, struct osd_item *item, int flags);
+void osd_std_config(struct osd_item *item, struct navit *navit);
+void osd_set_std_graphic(struct navit *nav, struct osd_item *item, struct osd_priv *priv);
+void osd_std_resize(struct osd_item *item);
+void osd_std_draw(struct osd_item *item);
+/* end of prototypes */
+
+#endif
+
diff --git a/navit/osd/Makefile.am b/osd/Makefile.am
index eabd6910..eabd6910 100644
--- a/navit/osd/Makefile.am
+++ b/osd/Makefile.am
diff --git a/osd/core/Makefile.am b/osd/core/Makefile.am
new file mode 100644
index 00000000..55940820
--- /dev/null
+++ b/osd/core/Makefile.am
@@ -0,0 +1,10 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=osd_core
+if PLUGINS
+ moduleosd_LTLIBRARIES = libosd_core.la
+else
+ noinst_LTLIBRARIES = libosd_core.la
+endif
+libosd_core_la_SOURCES = osd_core.c
+libosd_core_la_LDFLAGS = -module -avoid-version
+
diff --git a/osd/core/osd_core.c b/osd/core/osd_core.c
new file mode 100644
index 00000000..3803b60f
--- /dev/null
+++ b/osd/core/osd_core.c
@@ -0,0 +1,1243 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <math.h>
+#include <stdio.h>
+#include <glib.h>
+#include <time.h>
+#include <stdlib.h>
+#include <string.h>
+#include "config.h"
+#include "item.h"
+#include "point.h"
+#include "coord.h"
+#include "graphics.h"
+#include "transform.h"
+#include "route.h"
+#include "navit.h"
+#include "plugin.h"
+#include "debug.h"
+#include "callback.h"
+#include "color.h"
+#include "vehicle.h"
+#include "navigation.h"
+#include "track.h"
+#include "map.h"
+#include "file.h"
+#include "attr.h"
+#include "command.h"
+#include "navit_nls.h"
+#include "messages.h"
+#include "vehicleprofile.h"
+#include "roadprofile.h"
+#include "osd.h"
+#include "speech.h"
+
+struct compass {
+ struct osd_item osd_item;
+ int width;
+ struct graphics_gc *green;
+};
+
+static void
+transform_rotate(struct point *center, int angle, struct point *p,
+ int count)
+{
+ int i, x, y;
+ double dx, dy;
+ for (i = 0; i < count; i++) {
+ dx = sin(M_PI * angle / 180.0);
+ dy = cos(M_PI * angle / 180.0);
+ x = dy * p->x - dx * p->y;
+ y = dx * p->x + dy * p->y;
+
+ p->x = center->x + x;
+ p->y = center->y + y;
+ p++;
+ }
+}
+
+static void
+handle(struct graphics *gr, struct graphics_gc *gc, struct point *p, int r,
+ int dir)
+{
+ struct point ph[3];
+ int l = r * 0.4;
+
+ ph[0].x = 0;
+ ph[0].y = r;
+ ph[1].x = 0;
+ ph[1].y = -r;
+ transform_rotate(p, dir, ph, 2);
+ graphics_draw_lines(gr, gc, ph, 2);
+ ph[0].x = -l;
+ ph[0].y = -r + l;
+ ph[1].x = 0;
+ ph[1].y = -r;
+ ph[2].x = l;
+ ph[2].y = -r + l;
+ transform_rotate(p, dir, ph, 3);
+ graphics_draw_lines(gr, gc, ph, 3);
+}
+
+static char *
+format_distance(double distance, char *sep)
+{
+ if (distance >= 100000)
+ return g_strdup_printf("%.0f%skm", distance / 1000, sep);
+ else if (distance >= 10000)
+ return g_strdup_printf("%.1f%skm", distance / 1000, sep);
+ else if (distance >= 300)
+ return g_strdup_printf("%.0f%sm", round(distance / 25) * 25, sep);
+ else if (distance >= 50)
+ return g_strdup_printf("%.0f%sm", round(distance / 10) * 10, sep);
+ else if (distance >= 10)
+ return g_strdup_printf("%.0f%sm", distance, sep);
+ else
+ return g_strdup_printf("%.1f%sm", distance, sep);
+}
+
+static char *
+format_time(struct tm *tm, int days)
+{
+ if (days)
+ return g_strdup_printf("%d+%02d:%02d", days, tm->tm_hour, tm->tm_min);
+ else
+ return g_strdup_printf("%02d:%02d", tm->tm_hour, tm->tm_min);
+}
+
+static char *
+format_speed(double speed, char *sep)
+{
+ return g_strdup_printf("%.0f%skm/h", speed, sep);
+}
+
+static char *
+format_float(double num)
+{
+ return g_strdup_printf("%f", num);
+}
+
+static char *
+format_float_0(double num)
+{
+ return g_strdup_printf("%.0f", num);
+}
+
+static void
+osd_compass_draw(struct compass *this, struct navit *nav,
+ struct vehicle *v)
+{
+ struct point p,bbox[4];
+ struct attr attr_dir, destination_attr, position_attr;
+ double dir, vdir = 0;
+ char *buffer;
+ struct coord c1, c2;
+ enum projection pro;
+
+ osd_std_draw(&this->osd_item);
+ p.x = this->osd_item.w/2;
+ p.y = this->osd_item.w/2;
+ graphics_draw_circle(this->osd_item.gr,
+ this->osd_item.graphic_fg_white, &p, this->osd_item.w*5/6);
+ if (v) {
+ if (vehicle_get_attr(v, attr_position_direction, &attr_dir, NULL)) {
+ vdir = *attr_dir.u.numd;
+ handle(this->osd_item.gr, this->osd_item.graphic_fg_white, &p, this->osd_item.w/3, -vdir);
+ }
+
+ if (navit_get_attr(nav, attr_destination, &destination_attr, NULL)
+ && vehicle_get_attr(v, attr_position_coord_geo,&position_attr, NULL)) {
+ pro = destination_attr.u.pcoord->pro;
+ transform_from_geo(pro, position_attr.u.coord_geo, &c1);
+ c2.x = destination_attr.u.pcoord->x;
+ c2.y = destination_attr.u.pcoord->y;
+ dir = atan2(c2.x - c1.x, c2.y - c1.y) * 180.0 / M_PI;
+ dir -= vdir;
+ handle(this->osd_item.gr, this->green, &p, this->osd_item.w/3, dir);
+ buffer=format_distance(transform_distance(pro, &c1, &c2),"");
+ graphics_get_text_bbox(this->osd_item.gr, this->osd_item.font, buffer, 0x10000, 0, bbox, 0);
+ p.x=(this->osd_item.w-bbox[2].x)/2;
+ p.y = this->osd_item.h-this->osd_item.h/10;
+ graphics_draw_text(this->osd_item.gr, this->green, NULL, this->osd_item.font, buffer, &p, 0x10000, 0);
+ g_free(buffer);
+ }
+ }
+ graphics_draw_mode(this->osd_item.gr, draw_mode_end);
+}
+
+
+
+static void
+osd_compass_init(struct compass *this, struct navit *nav)
+{
+ struct color c;
+
+ osd_set_std_graphic(nav, &this->osd_item, (struct osd_priv *)this);
+
+ this->green = graphics_gc_new(this->osd_item.gr);
+ c.r = 0;
+ c.g = 65535;
+ c.b = 0;
+ c.a = 65535;
+ graphics_gc_set_foreground(this->green, &c);
+ graphics_gc_set_linewidth(this->green, this->width);
+ graphics_gc_set_linewidth(this->osd_item.graphic_fg_white, this->width);
+
+ navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_compass_draw), attr_position_coord_geo, this));
+
+ osd_compass_draw(this, nav, NULL);
+}
+
+static struct osd_priv *
+osd_compass_new(struct navit *nav, struct osd_methods *meth,
+ struct attr **attrs)
+{
+ struct compass *this = g_new0(struct compass, 1);
+ struct attr *attr;
+ this->osd_item.p.x = 20;
+ this->osd_item.p.y = 20;
+ this->osd_item.w = 60;
+ this->osd_item.h = 80;
+ this->osd_item.navit = nav;
+ this->osd_item.font_size = 200;
+ this->osd_item.meth.draw = osd_draw_cast(osd_compass_draw);
+ osd_set_std_attr(attrs, &this->osd_item, 2);
+ attr = attr_search(attrs, NULL, attr_width);
+ this->width=attr ? attr->u.num : 2;
+ navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_compass_init), attr_navit, this));
+ return (struct osd_priv *) this;
+}
+
+struct osd_button {
+ int use_overlay;
+ struct osd_item item;
+ struct callback *draw_cb,*navit_init_cb;
+ struct graphics_image *img;
+ char *src;
+};
+
+static void
+osd_button_draw(struct osd_button *this, struct navit *nav)
+{
+ struct point bp = this->item.p;
+ osd_wrap_point(&bp, nav);
+ graphics_draw_image(this->item.gr, this->item.graphic_bg, &bp, this->img);
+}
+
+static void
+osd_button_init(struct osd_button *this, struct navit *nav)
+{
+ struct graphics *gra = navit_get_graphics(nav);
+ dbg(1, "enter\n");
+ this->img = graphics_image_new(gra, this->src);
+ if (!this->img) {
+ dbg(1, "failed to load '%s'\n", this->src);
+ return;
+ }
+ if (!this->item.w)
+ this->item.w=this->img->width;
+ if (!this->item.h)
+ this->item.h=this->img->height;
+ if (this->use_overlay) {
+ struct graphics_image *img;
+ struct point p;
+ osd_set_std_graphic(nav, &this->item, (struct osd_priv *)this);
+ img=graphics_image_new(this->item.gr, this->src);
+ p.x=(this->item.w-this->img->width)/2;
+ p.y=(this->item.h-this->img->height)/2;
+ osd_std_draw(&this->item);
+ graphics_draw_image(this->item.gr, this->item.graphic_bg, &p, img);
+ graphics_draw_mode(this->item.gr, draw_mode_end);
+ graphics_image_free(this->item.gr, img);
+ } else {
+ this->item.configured=1;
+ this->item.gr=gra;
+ this->item.graphic_bg=graphics_gc_new(this->item.gr);
+ graphics_add_callback(gra, this->draw_cb=callback_new_attr_2(callback_cast(osd_button_draw), attr_postdraw, this, nav));
+ }
+ navit_add_callback(nav, this->navit_init_cb = callback_new_attr_1(callback_cast (osd_std_click), attr_button, &this->item));
+}
+
+static struct osd_priv *
+osd_button_new(struct navit *nav, struct osd_methods *meth,
+ struct attr **attrs)
+{
+ struct osd_button *this = g_new0(struct osd_button, 1);
+ struct attr *attr;
+
+ this->item.navit = nav;
+ this->item.meth.draw = osd_draw_cast(osd_button_draw);
+
+ osd_set_std_attr(attrs, &this->item, 1);
+
+ attr=attr_search(attrs, NULL, attr_use_overlay);
+ if (attr)
+ this->use_overlay=attr->u.num;
+ if (!this->item.command) {
+ dbg(0, "no command\n");
+ goto error;
+ }
+ attr = attr_search(attrs, NULL, attr_src);
+ if (!attr) {
+ dbg(0, "no src\n");
+ goto error;
+ }
+
+ this->src = g_strjoin(NULL, getenv("NAVIT_SHAREDIR"), "/xpm/", attr->u.str, NULL);
+ // TODO make ~ and/or $HOME work too
+ if (!file_exists(this->src))
+ this->src = g_strjoin(NULL, attr->u.str, NULL);
+
+ navit_add_callback(nav, this->navit_init_cb = callback_new_attr_1(callback_cast (osd_button_init), attr_navit, this));
+
+ return (struct osd_priv *) this;
+ error:
+ g_free(this);
+ return NULL;
+}
+
+struct nav_next_turn {
+ struct osd_item osd_item;
+ char *test_text;
+ char *icon_src;
+ int icon_h, icon_w, active;
+ char *last_name;
+};
+
+static void
+osd_nav_next_turn_draw(struct nav_next_turn *this, struct navit *navit,
+ struct vehicle *v)
+{
+ struct point p;
+ int do_draw = 0;
+ struct navigation *nav = NULL;
+ struct map *map = NULL;
+ struct map_rect *mr = NULL;
+ struct item *item = NULL;
+ struct graphics_image *gr_image;
+ char *image;
+ char *name = "unknown";
+
+
+ if (navit)
+ nav = navit_get_navigation(navit);
+ if (nav)
+ map = navigation_get_map(nav);
+ if (map)
+ mr = map_rect_new(map, NULL);
+ if (mr)
+ while ((item = map_rect_get_item(mr))
+ && (item->type == type_nav_position || item->type == type_nav_none));
+ if (item) {
+ name = item_to_name(item->type);
+ dbg(1, "name=%s\n", name);
+ if (this->active != 1 || this->last_name != name) {
+ this->active = 1;
+ this->last_name = name;
+ do_draw = 1;
+ }
+ } else {
+ if (this->active != 0) {
+ this->active = 0;
+ do_draw = 1;
+ }
+ }
+ if (mr)
+ map_rect_destroy(mr);
+
+ if (do_draw) {
+ osd_std_draw(&this->osd_item);
+ if (this->active) {
+ image = g_strdup_printf(this->icon_src, name);
+ dbg(1, "image=%s\n", image);
+ gr_image =
+ graphics_image_new_scaled(this->osd_item.gr,
+ image, this->icon_w,
+ this->icon_h);
+ if (!gr_image) {
+ g_free(image);
+ image =
+ g_strjoin(NULL,
+ getenv("NAVIT_SHAREDIR"),
+ "/xpm/unknown.xpm", NULL);
+ gr_image =
+ graphics_image_new_scaled(this->
+ osd_item.gr,
+ image,
+ this->icon_w,
+ this->
+ icon_h);
+ }
+ dbg(1, "gr_image=%p\n", gr_image);
+ if (gr_image) {
+ p.x =
+ (this->osd_item.w -
+ gr_image->width) / 2;
+ p.y =
+ (this->osd_item.h -
+ gr_image->height) / 2;
+ graphics_draw_image(this->osd_item.gr,
+ this->osd_item.
+ graphic_fg_white, &p,
+ gr_image);
+ graphics_image_free(this->osd_item.gr,
+ gr_image);
+ }
+ g_free(image);
+ }
+ graphics_draw_mode(this->osd_item.gr, draw_mode_end);
+ }
+}
+
+static void
+osd_nav_next_turn_init(struct nav_next_turn *this, struct navit *nav)
+{
+ osd_set_std_graphic(nav, &this->osd_item, (struct osd_priv *)this);
+ navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_nav_next_turn_draw), attr_position_coord_geo, this));
+ osd_nav_next_turn_draw(this, nav, NULL);
+}
+
+static struct osd_priv *
+osd_nav_next_turn_new(struct navit *nav, struct osd_methods *meth,
+ struct attr **attrs)
+{
+ struct nav_next_turn *this = g_new0(struct nav_next_turn, 1);
+ struct attr *attr;
+
+ this->osd_item.p.x = 20;
+ this->osd_item.p.y = -80;
+ this->osd_item.w = 70;
+ this->osd_item.navit = nav;
+ this->osd_item.h = 70;
+ this->osd_item.font_size = 200;
+ this->osd_item.meth.draw = osd_draw_cast(osd_nav_next_turn_draw);
+ osd_set_std_attr(attrs, &this->osd_item, 0);
+
+ this->icon_w = -1;
+ this->icon_h = -1;
+ this->active = -1;
+
+ attr = attr_search(attrs, NULL, attr_icon_w);
+ if (attr)
+ this->icon_w = attr->u.num;
+
+ attr = attr_search(attrs, NULL, attr_icon_h);
+ if (attr)
+ this->icon_h = attr->u.num;
+
+ attr = attr_search(attrs, NULL, attr_icon_src);
+ if (attr) {
+ struct file_wordexp *we;
+ char **array;
+ we = file_wordexp_new(attr->u.str);
+ array = file_wordexp_get_array(we);
+ this->icon_src = g_strdup(array[0]);
+ file_wordexp_destroy(we);
+ } else
+ this->icon_src =
+ g_strjoin(NULL, getenv("NAVIT_SHAREDIR"),
+ "/xpm/%s_wh.svg", NULL);
+
+ navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_nav_next_turn_init), attr_navit, this));
+ return (struct osd_priv *) this;
+}
+
+struct nav_toggle_announcer
+{
+ int w,h;
+ struct callback *navit_init_cb;
+ struct osd_item item;
+ char *icon_src;
+ int icon_h, icon_w, active, last_state;
+};
+
+static void
+osd_nav_toggle_announcer_draw(struct nav_toggle_announcer *this, struct navit *navit, struct vehicle *v)
+{
+ struct point p;
+ int do_draw = 0;
+ struct graphics_image *gr_image;
+ char *path;
+ char *gui_sound_off = "gui_sound_off";
+ char *gui_sound_on = "gui_sound";
+ struct attr attr, speechattr;
+
+ if (this->last_state == -1)
+ {
+ if (!navit_get_attr(navit, attr_speech, &speechattr, NULL))
+ if (!speech_get_attr(speechattr.u.speech, attr_active, &attr, NULL))
+ attr.u.num = 1;
+ this->active = attr.u.num;
+ } else
+ this->active = !this->active;
+
+ if(this->active != this->last_state)
+ {
+ this->last_state = this->active;
+ do_draw = 1;
+ }
+
+ if (do_draw)
+ {
+ graphics_draw_mode(this->item.gr, draw_mode_begin);
+ p.x = 0;
+ p.y = 0;
+ graphics_draw_rectangle(this->item.gr, this->item.graphic_bg, &p, this->item.w, this->item.h);
+
+ if (this->active)
+ path = g_strdup_printf(this->icon_src, gui_sound_on);
+ else
+ path = g_strdup_printf(this->icon_src, gui_sound_off);
+
+ gr_image = graphics_image_new_scaled(this->item.gr, path, this->icon_w, this->icon_h);
+ if (!gr_image)
+ {
+ g_free(path);
+ path = g_strjoin(NULL, getenv("NAVIT_SHAREDIR"), "/xpm/unknown.xpm", NULL);
+ gr_image = graphics_image_new_scaled(this->item.gr, path, this->icon_w, this->icon_h);
+ }
+
+ dbg(1, "gr_image=%p\n", gr_image);
+
+ if (gr_image)
+ {
+ p.x = (this->item.w - gr_image->width) / 2;
+ p.y = (this->item.h - gr_image->height) / 2;
+ graphics_draw_image(this->item.gr, this->item.graphic_fg_white, &p, gr_image);
+ graphics_image_free(this->item.gr, gr_image);
+ }
+
+ g_free(path);
+ graphics_draw_mode(this->item.gr, draw_mode_end);
+ }
+}
+
+static void
+osd_nav_toggle_announcer_init(struct nav_toggle_announcer *this, struct navit *nav)
+{
+ osd_set_std_graphic(nav, &this->item, (struct osd_priv *)this);
+ navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_nav_toggle_announcer_draw), attr_speech, this));
+ navit_add_callback(nav, this->navit_init_cb = callback_new_attr_1(callback_cast(osd_std_click), attr_button, &this->item));
+ osd_nav_toggle_announcer_draw(this, nav, NULL);
+}
+
+static struct osd_priv *
+osd_nav_toggle_announcer_new(struct navit *nav, struct osd_methods *meth, struct attr **attrs)
+{
+ struct nav_toggle_announcer *this = g_new0(struct nav_toggle_announcer, 1);
+ struct attr *attr;
+ char *command = "navit_announcer_toggle";
+
+ this->item.w = 48;
+ this->item.h = 48;
+ this->item.p.x = -64;
+ this->item.navit = nav;
+ this->item.p.y = 76;
+ this->item.meth.draw = osd_draw_cast(osd_nav_toggle_announcer_draw);
+
+ osd_set_std_attr(attrs, &this->item, 0);
+
+ this->icon_w = -1;
+ this->icon_h = -1;
+ this->last_state = -1;
+
+ attr = attr_search(attrs, NULL, attr_icon_src);
+ if (attr) {
+ struct file_wordexp *we;
+ char **array;
+ we = file_wordexp_new(attr->u.str);
+ array = file_wordexp_get_array(we);
+ this->icon_src = g_strdup(array[0]);
+ file_wordexp_destroy(we);
+ } else
+ this->icon_src =
+ g_strjoin(NULL, getenv("NAVIT_SHAREDIR"),
+ "/xpm/%s_32.xpm", NULL);
+
+ this->item.command = g_strdup(command);
+
+ navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_nav_toggle_announcer_init), attr_navit, this));
+ return (struct osd_priv *) this;
+}
+
+struct osd_speed_warner {
+ struct osd_item item;
+ struct graphics_gc *red;
+ int width;
+ int active;
+ int d;
+};
+
+static void
+osd_speed_warner_draw(struct osd_speed_warner *this, struct navit *navit, struct vehicle *v)
+{
+ struct point p[4];
+ char *text="60";
+
+ osd_std_draw(&this->item);
+ p[0].x=this->item.w/2-this->d/4;
+ p[0].y=this->item.h/2-this->d/4;
+ graphics_draw_rectangle(this->item.gr, this->item.graphic_fg_white, p, this->d/2, this->d/2);
+ p[0].x=this->item.w/2;
+ p[0].y=this->item.h/2;
+ graphics_draw_circle(this->item.gr, this->item.graphic_fg_white, p, this->d/2);
+ graphics_draw_circle(this->item.gr, this->red, p, this->d-this->width*2);
+ graphics_get_text_bbox(this->item.gr, this->item.font, text, 0x10000, 0, p, 0);
+ p[0].x=(this->item.w-p[2].x)/2;
+ p[0].y=(this->item.h+p[2].y)/2-p[2].y;
+ graphics_draw_text(this->item.gr, this->item.graphic_fg_text, NULL, this->item.font, text, p, 0x10000, 0);
+ graphics_draw_mode(this->item.gr, draw_mode_end);
+}
+
+static void
+osd_speed_warner_init(struct osd_speed_warner *this, struct navit *nav)
+{
+ osd_set_std_graphic(nav, &this->item, (struct osd_priv *)this);
+ navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_speed_warner_draw), attr_position_coord_geo, this));
+ this->red=graphics_gc_new(this->item.gr);
+ graphics_gc_set_foreground(this->red, &(struct color ){0xffff,0,0,0xffff});
+ graphics_gc_set_linewidth(this->red, this->width);
+ graphics_gc_set_linewidth(this->item.graphic_fg_white, this->d/4+2);
+ osd_speed_warner_draw(this, nav, NULL);
+}
+
+static struct osd_priv *
+osd_speed_warner_new(struct navit *nav, struct osd_methods *meth, struct attr **attrs)
+{
+ struct osd_speed_warner *this=g_new0(struct osd_speed_warner, 1);
+ this->item.p.x=-80;
+ this->item.p.y=20;
+ this->item.w=60;
+ this->item.navit = nav;
+ this->item.h=60;
+ this->active=-1;
+ this->item.meth.draw = osd_draw_cast(osd_speed_warner_draw);
+ osd_set_std_attr(attrs, &this->item, 2);
+ this->d=this->item.w;
+ if (this->item.h < this->d)
+ this->d=this->item.h;
+ this->width=this->d/10;
+ navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_speed_warner_init), attr_navit, this));
+ return (struct osd_priv *) this;
+}
+
+struct osd_text {
+ struct osd_item osd_item;
+ int active;
+ char *text;
+ int align;
+ char last_text[16];
+};
+
+static char *
+osd_text_format_attr(struct attr *attr, char *format)
+{
+ struct tm tm, text_tm, text_tm0;
+ time_t textt;
+ int days=0;
+ char buffer[1024];
+
+ switch (attr->type) {
+ case attr_position_speed:
+ return format_speed(*attr->u.numd,"");
+ case attr_position_height:
+ case attr_position_direction:
+ return format_float_0(*attr->u.numd);
+ case attr_position_magnetic_direction:
+ return g_strdup_printf("%d",attr->u.num);
+ case attr_position_coord_geo:
+ coord_format(attr->u.coord_geo->lat,attr->u.coord_geo->lng,DEGREES_MINUTES_SECONDS,buffer,sizeof(buffer));
+ return g_strdup(buffer);
+ case attr_destination_time:
+ if (!format || (strcmp(format,"arrival") && strcmp(format,"remaining")))
+ break;
+ textt = time(NULL);
+ tm = *localtime(&textt);
+ if (!strcmp(format,"remaining")) {
+ textt-=tm.tm_hour*3600+tm.tm_min*60+tm.tm_sec;
+ tm = *localtime(&textt);
+ }
+ textt += attr->u.num / 10;
+ text_tm = *localtime(&textt);
+ if (tm.tm_year != text_tm.tm_year || tm.tm_mon != text_tm.tm_mon || tm.tm_mday != text_tm.tm_mday) {
+ text_tm0 = text_tm;
+ text_tm0.tm_sec = 0;
+ text_tm0.tm_min = 0;
+ text_tm0.tm_hour = 0;
+ tm.tm_sec = 0;
+ tm.tm_min = 0;
+ tm.tm_hour = 0;
+ days = (mktime(&text_tm0) - mktime(&tm) + 43200) / 86400;
+ }
+ return format_time(&text_tm, days);
+ case attr_length:
+ case attr_destination_length:
+ if (!format)
+ break;
+ if (!strcmp(format,"named"))
+ return format_distance(attr->u.num,"");
+ if (!strcmp(format,"value") || !strcmp(format,"unit")) {
+ char *ret,*tmp=format_distance(attr->u.num," ");
+ char *pos=strchr(tmp,' ');
+ if (! pos)
+ return tmp;
+ *pos++='\0';
+ if (!strcmp(format,"value"))
+ return tmp;
+ ret=g_strdup(pos);
+ g_free(tmp);
+ return ret;
+ }
+ default:
+ break;
+ }
+ return attr_to_text(attr, NULL, 1);
+}
+
+static char *
+osd_text_split(char *in, char **index)
+{
+ char *pos;
+ int len;
+ if (index)
+ *index=NULL;
+ len=strcspn(in,"[.");
+ in+=len;
+ switch (in[0]) {
+ case '\0':
+ return in;
+ case '.':
+ *in++='\0';
+ return in;
+ case '[':
+ if (!index)
+ return NULL;
+ *in++='\0';
+ *index=in;
+ pos=strchr(in,']');
+ if (pos) {
+ *pos++='\0';
+ if (*pos == '.') {
+ *pos++='\0';
+ }
+ return pos;
+ }
+ return NULL;
+ }
+ return NULL;
+}
+
+static void
+osd_text_draw(struct osd_text *this, struct navit *navit, struct vehicle *v)
+{
+ struct point p, p2[4];
+ char *str,*next,*last,*start,*end,*key,*subkey,*index,*value;
+ int do_draw = 0;
+ struct attr attr, vehicle_attr, maxspeed_attr;
+ struct navigation *nav = NULL;
+ struct tracking *tracking = NULL;
+ struct route *route = NULL;
+ struct map *nav_map = NULL;
+ struct map_rect *nav_mr = NULL;
+ struct item *item;
+ int offset,lines;
+ int height=this->osd_item.font_size*13/256;
+ int yspacing=height/2;
+ int xspacing=height/4;
+ enum attr_type attr_type;
+
+ vehicle_attr.u.vehicle=NULL;
+ do_draw=1;
+ str=g_strdup(this->text);
+ while ((start=strstr(str, "${"))) {
+ item=NULL;
+ end=strstr(str,"}");
+ if (! end)
+ break;
+ *end++='\0';
+ value=NULL;
+ key=start+2;
+ subkey=osd_text_split(key,NULL);
+ if (!strcmp(key,"navigation") && subkey) {
+ if (navit && !nav)
+ nav = navit_get_navigation(navit);
+ if (nav && !nav_map)
+ nav_map = navigation_get_map(nav);
+ if (nav_map)
+ key=osd_text_split(subkey,&index);
+ if (nav_map && !strcmp(subkey,"item")) {
+ if (nav_map)
+ nav_mr = map_rect_new(nav_map, NULL);
+ if (nav_mr) {
+ item = map_rect_get_item(nav_mr);
+ }
+ offset=0;
+ if (index)
+ offset=atoi(index);
+ while (item) {
+ if (item->type == type_nav_none)
+ item=map_rect_get_item(nav_mr);
+ else if (!offset)
+ break;
+ else {
+ offset--;
+ item=map_rect_get_item(nav_mr);
+ }
+ }
+ if (item) {
+ dbg(1,"name %s\n", item_to_name(item->type));
+ subkey=osd_text_split(key,&index);
+ attr_type=attr_from_name(key);
+ dbg(1,"type %s\n", attr_to_name(attr_type));
+ if (item_attr_get(item, attr_type, &attr))
+ value=osd_text_format_attr(&attr, index);
+ else
+ dbg(1,"failed\n");
+ }
+ }
+ } else if (!strcmp(key,"tracking") && subkey) {
+ if (navit) {
+ tracking = navit_get_tracking(navit);
+ route = navit_get_route(navit);
+ }
+ if (tracking) {
+ key=osd_text_split(subkey,&index);
+ if (!strcmp(subkey, "item") && key) {
+ item=tracking_get_current_item(tracking);
+ if (item && !strcmp(key,"route_speed")) {
+ double routespeed = -1;
+ int *flags=tracking_get_current_flags(tracking);
+ if (flags && (*flags & AF_SPEED_LIMIT) && tracking_get_attr(tracking, attr_maxspeed, &maxspeed_attr, NULL)) {
+ routespeed = maxspeed_attr.u.num;
+ value = format_speed(routespeed, "");
+ }
+
+ if (routespeed == -1) {
+ struct vehicleprofile *prof=navit_get_vehicleprofile(navit);
+ struct roadprofile *rprof=NULL;
+ if (prof)
+ rprof=vehicleprofile_get_roadprofile(prof, item->type);
+ if (rprof) {
+ routespeed=rprof->speed;
+ value=format_speed(routespeed,"");
+ }
+ }
+ }
+ }
+ }
+ } else if (!strcmp(key,"vehicle") && subkey) {
+ if (navit && !vehicle_attr.u.vehicle) {
+ navit_get_attr(navit, attr_vehicle, &vehicle_attr, NULL);
+ }
+ if (vehicle_attr.u.vehicle) {
+ key=osd_text_split(subkey,&index);
+ attr_type=attr_from_name(subkey);
+ if (vehicle_get_attr(vehicle_attr.u.vehicle, attr_type, &attr, NULL)) {
+ value=osd_text_format_attr(&attr, index);
+ }
+ }
+
+ } else if (!strcmp(key,"navit") && subkey) {
+ if (navit) {
+ key = osd_text_split(subkey, &index);
+ if (!strcmp(subkey,"messages")) {
+ struct message *msg;
+ int len,offset;
+ char *tmp;
+
+ msg = navit_get_messages(navit);
+ len = 0;
+ while (msg) {
+ len+= strlen(msg->text) + 2;
+
+ msg = msg->next;
+ }
+
+ value = g_malloc(len +1);
+
+ msg = navit_get_messages(navit);
+ offset = 0;
+ while (msg) {
+ tmp = g_stpcpy((value+offset), msg->text);
+ g_stpcpy(tmp, "\\n");
+ offset += strlen(msg->text) + 2;
+
+ msg = msg->next;
+ }
+
+ value[len] = '\0';
+ }
+ }
+ }
+ *start='\0';
+ next=g_strdup_printf("%s%s%s",str,value ? value:" ",end);
+ g_free(value);
+ g_free(str);
+ str=next;
+ }
+ lines=0;
+ next=str;
+ last=str;
+ while ((next=strstr(next, "\\n"))) {
+ last = next;
+ lines++;
+ next++;
+ }
+
+ while (*last) {
+ if (! g_ascii_isspace(*last)) {
+ lines++;
+ break;
+ }
+ last++;
+ }
+
+ dbg(1,"this->align=%d\n", this->align);
+ switch (this->align & 51) {
+ case 1:
+ p.y=0;
+ break;
+ case 2:
+ p.y=(this->osd_item.h-lines*(height+yspacing)-yspacing);
+ break;
+ case 16: // Grow from top to bottom
+ p.y = 0;
+ if (lines != 0) {
+ this->osd_item.h = (lines-1) * (height+yspacing) + height;
+ } else {
+ this->osd_item.h = 0;
+ }
+
+ if (do_draw) {
+ osd_std_resize(&this->osd_item);
+ }
+ default:
+ p.y=(this->osd_item.h-lines*(height+yspacing)-yspacing)/2;
+ }
+ if (do_draw) {
+ osd_std_draw(&this->osd_item);
+ while (str) {
+ next=strstr(str, "\\n");
+ if (next) {
+ *next='\0';
+ next+=2;
+ }
+ graphics_get_text_bbox(this->osd_item.gr,
+ this->osd_item.font,
+ str, 0x10000,
+ 0x0, p2, 0);
+ switch (this->align & 12) {
+ case 4:
+ p.x=xspacing;
+ break;
+ case 8:
+ p.x=this->osd_item.w-(p2[2].x-p2[0].x)-xspacing;
+ break;
+ default:
+ p.x = ((p2[0].x - p2[2].x) / 2) + (this->osd_item.w / 2);
+ }
+ p.y += height+yspacing;
+ graphics_draw_text(this->osd_item.gr,
+ this->osd_item.graphic_fg_text,
+ NULL, this->osd_item.font,
+ str, &p, 0x10000,
+ 0);
+ str=next;
+ }
+ graphics_draw_mode(this->osd_item.gr, draw_mode_end);
+ }
+
+}
+
+static void
+osd_text_init(struct osd_text *this, struct navit *nav)
+{
+
+ osd_set_std_graphic(nav, &this->osd_item, (struct osd_priv *)this);
+ navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_text_draw), attr_position_coord_geo, this));
+ osd_text_draw(this, nav, NULL);
+
+}
+
+static struct osd_priv *
+osd_text_new(struct navit *nav, struct osd_methods *meth,
+ struct attr **attrs)
+{
+ struct osd_text *this = g_new0(struct osd_text, 1);
+ struct attr *attr;
+
+ this->osd_item.p.x = -80;
+ this->osd_item.p.y = 20;
+ this->osd_item.w = 60;
+ this->osd_item.h = 20;
+ this->osd_item.navit = nav;
+ this->osd_item.font_size = 200;
+ this->osd_item.meth.draw = osd_draw_cast(osd_text_draw);
+ osd_set_std_attr(attrs, &this->osd_item, 2);
+
+ this->active = -1;
+
+ attr = attr_search(attrs, NULL, attr_label);
+ if (attr)
+ this->text = g_strdup(attr->u.str);
+ else
+ this->text = NULL;
+ attr = attr_search(attrs, NULL, attr_align);
+ if (attr)
+ this->align=attr->u.num;
+
+ navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_text_init), attr_navit, this));
+ return (struct osd_priv *) this;
+}
+
+struct gps_status {
+ struct osd_item osd_item;
+ char *icon_src;
+ int icon_h, icon_w, active;
+ int strength;
+};
+
+static void
+osd_gps_status_draw(struct gps_status *this, struct navit *navit,
+ struct vehicle *v)
+{
+ struct point p;
+ int do_draw = 0;
+ struct graphics_image *gr_image;
+ char *image;
+ struct attr attr, vehicle_attr;
+ int strength=-1;
+
+ if (navit && navit_get_attr(navit, attr_vehicle, &vehicle_attr, NULL)) {
+ if (vehicle_get_attr(vehicle_attr.u.vehicle, attr_position_fix_type, &attr, NULL)) {
+ switch(attr.u.num) {
+ case 1:
+ case 2:
+ strength=2;
+ if (vehicle_get_attr(vehicle_attr.u.vehicle, attr_position_sats_used, &attr, NULL)) {
+ dbg(1,"num=%d\n", attr.u.num);
+ if (attr.u.num >= 3)
+ strength=attr.u.num-1;
+ if (strength > 5)
+ strength=5;
+ if (strength > 3) {
+ if (vehicle_get_attr(vehicle_attr.u.vehicle, attr_position_hdop, &attr, NULL)) {
+ if (*attr.u.numd > 2.0 && strength > 4)
+ strength=4;
+ if (*attr.u.numd > 4.0 && strength > 3)
+ strength=3;
+ }
+ }
+ }
+ break;
+ default:
+ strength=1;
+ }
+ }
+ }
+ if (this->strength != strength) {
+ this->strength=strength;
+ do_draw=1;
+ }
+ if (do_draw) {
+ osd_std_draw(&this->osd_item);
+ if (this->active) {
+ image = g_strdup_printf(this->icon_src, strength);
+ gr_image = graphics_image_new_scaled(this->osd_item.gr, image, this->icon_w, this->icon_h);
+ if (gr_image) {
+ p.x = (this->osd_item.w - gr_image->width) / 2;
+ p.y = (this->osd_item.h - gr_image->height) / 2;
+ graphics_draw_image(this->osd_item.gr, this->osd_item. graphic_fg_white, &p, gr_image);
+ graphics_image_free(this->osd_item.gr, gr_image);
+ }
+ g_free(image);
+ }
+ graphics_draw_mode(this->osd_item.gr, draw_mode_end);
+ }
+}
+
+static void
+osd_gps_status_init(struct gps_status *this, struct navit *nav)
+{
+ osd_set_std_graphic(nav, &this->osd_item, (struct osd_priv *)this);
+ navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_gps_status_draw), attr_position_coord_geo, this));
+ osd_gps_status_draw(this, nav, NULL);
+}
+
+static struct osd_priv *
+osd_gps_status_new(struct navit *nav, struct osd_methods *meth,
+ struct attr **attrs)
+{
+ struct gps_status *this = g_new0(struct gps_status, 1);
+ struct attr *attr;
+
+ this->osd_item.p.x = 20;
+ this->osd_item.p.y = -80;
+ this->osd_item.w = 60;
+ this->osd_item.navit = nav;
+ this->osd_item.h = 40;
+ this->osd_item.font_size = 200;
+ this->osd_item.meth.draw = osd_draw_cast(osd_gps_status_draw);
+ osd_set_std_attr(attrs, &this->osd_item, 0);
+
+ this->icon_w = -1;
+ this->icon_h = -1;
+ this->active = -1;
+ this->strength = -2;
+
+ attr = attr_search(attrs, NULL, attr_icon_w);
+ if (attr)
+ this->icon_w = attr->u.num;
+
+ attr = attr_search(attrs, NULL, attr_icon_h);
+ if (attr)
+ this->icon_h = attr->u.num;
+
+ attr = attr_search(attrs, NULL, attr_icon_src);
+ if (attr) {
+ struct file_wordexp *we;
+ char **array;
+ we = file_wordexp_new(attr->u.str);
+ array = file_wordexp_get_array(we);
+ this->icon_src = g_strdup(array[0]);
+ file_wordexp_destroy(we);
+ } else
+ this->icon_src = g_strjoin(NULL, getenv("NAVIT_SHAREDIR"), "/xpm/gui_strength_%d_32_32.png", NULL);
+
+ navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_gps_status_init), attr_navit, this));
+ return (struct osd_priv *) this;
+}
+
+
+struct volume {
+ struct osd_item osd_item;
+ char *icon_src;
+ int icon_h, icon_w, active;
+ int strength;
+ struct callback *click_cb;
+};
+
+static void
+osd_volume_draw(struct volume *this, struct navit *navit)
+{
+ struct point p;
+ struct graphics_image *gr_image;
+ char *image;
+
+ osd_std_draw(&this->osd_item);
+ if (this->active) {
+ image = g_strdup_printf(this->icon_src, this->strength);
+ gr_image = graphics_image_new_scaled(this->osd_item.gr, image, this->icon_w, this->icon_h);
+ if (gr_image) {
+ p.x = (this->osd_item.w - gr_image->width) / 2;
+ p.y = (this->osd_item.h - gr_image->height) / 2;
+ graphics_draw_image(this->osd_item.gr, this->osd_item. graphic_fg_white, &p, gr_image);
+ graphics_image_free(this->osd_item.gr, gr_image);
+ }
+ g_free(image);
+ }
+ graphics_draw_mode(this->osd_item.gr, draw_mode_end);
+}
+
+static void
+osd_volume_click(struct volume *this, struct navit *nav, int pressed, int button, struct point *p)
+{
+ struct point bp = this->osd_item.p;
+ osd_wrap_point(&bp, nav);
+ if ((p->x < bp.x || p->y < bp.y || p->x > bp.x + this->osd_item.w || p->y > bp.y + this->osd_item.h) && !this->osd_item.pressed)
+ return;
+ navit_ignore_button(nav);
+ if (pressed) {
+ if (p->y - bp.y < this->osd_item.h/2)
+ this->strength++;
+ else
+ this->strength--;
+ if (this->strength < 0)
+ this->strength=0;
+ if (this->strength > 5)
+ this->strength=5;
+ osd_volume_draw(this, nav);
+ }
+}
+static void
+osd_volume_init(struct volume *this, struct navit *nav)
+{
+ osd_set_std_graphic(nav, &this->osd_item, (struct osd_priv *)this);
+ navit_add_callback(nav, this->click_cb = callback_new_attr_1(callback_cast (osd_volume_click), attr_button, this));
+ osd_volume_draw(this, nav);
+}
+
+static struct osd_priv *
+osd_volume_new(struct navit *nav, struct osd_methods *meth,
+ struct attr **attrs)
+{
+ struct volume *this = g_new0(struct volume, 1);
+ struct attr *attr;
+
+ this->osd_item.p.x = 20;
+ this->osd_item.p.y = -80;
+ this->osd_item.w = 60;
+ this->osd_item.navit = nav;
+ this->osd_item.h = 40;
+ this->osd_item.font_size = 200;
+ this->osd_item.meth.draw = osd_draw_cast(osd_volume_draw);
+ osd_set_std_attr(attrs, &this->osd_item, 0);
+
+ this->icon_w = -1;
+ this->icon_h = -1;
+ this->active = -1;
+ this->strength = -1;
+
+ attr = attr_search(attrs, NULL, attr_icon_w);
+ if (attr)
+ this->icon_w = attr->u.num;
+
+ attr = attr_search(attrs, NULL, attr_icon_h);
+ if (attr)
+ this->icon_h = attr->u.num;
+
+ attr = attr_search(attrs, NULL, attr_icon_src);
+ if (attr) {
+ struct file_wordexp *we;
+ char **array;
+ we = file_wordexp_new(attr->u.str);
+ array = file_wordexp_get_array(we);
+ this->icon_src = g_strdup(array[0]);
+ file_wordexp_destroy(we);
+ } else
+ this->icon_src = g_strjoin(NULL, getenv("NAVIT_SHAREDIR"), "/xpm/gui_strength_%d_32_32.png", NULL);
+
+ navit_add_callback(nav, callback_new_attr_1(callback_cast(osd_volume_init), attr_navit, this));
+ return (struct osd_priv *) this;
+}
+
+
+void
+plugin_init(void)
+{
+ plugin_register_osd_type("compass", osd_compass_new);
+ plugin_register_osd_type("navigation_next_turn", osd_nav_next_turn_new);
+ plugin_register_osd_type("button", osd_button_new);
+ plugin_register_osd_type("toggle_announcer", osd_nav_toggle_announcer_new);
+ plugin_register_osd_type("speed_warner", osd_speed_warner_new);
+ plugin_register_osd_type("text", osd_text_new);
+ plugin_register_osd_type("gps_status", osd_gps_status_new);
+ plugin_register_osd_type("volume", osd_volume_new);
+}
diff --git a/osm2navit.c b/osm2navit.c
new file mode 100644
index 00000000..2daf86e3
--- /dev/null
+++ b/osm2navit.c
@@ -0,0 +1,3460 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#define _FILE_OFFSET_BITS 64
+#define _LARGEFILE_SOURCE
+#define _LARGEFILE64_SOURCE
+#include <glib.h>
+#include <assert.h>
+#include <string.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <getopt.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <zlib.h>
+#include "file.h"
+#include "item.h"
+#include "map.h"
+#include "zipfile.h"
+#include "main.h"
+#include "config.h"
+#include "linguistics.h"
+#include "plugin.h"
+#ifdef HAVE_POSTGRESQL
+#include <libpq-fe.h>
+#endif
+
+#define BUFFER_SIZE 1280
+
+typedef long int osmid;
+
+
+#if 1
+#define debug_tile(x) 0
+#else
+#define debug_tile(x) (!strcmp(x,"bcdbd") || !strcmp(x,"bcdbd") || !strcmp(x,"bcdbda") || !strcmp(x,"bcdbdb") || !strcmp(x,"bcdbdba") || !strcmp(x,"bcdbdbb") || !strcmp(x,"bcdbdbba") || !strcmp(x,"bcdbdbaa") || !strcmp(x,"bcdbdbacaa") || !strcmp(x,"bcdbdbacab") || !strcmp(x,"bcdbdbacaba") || !strcmp(x,"bcdbdbacabaa") || !strcmp(x,"bcdbdbacabab") || !strcmp(x,"bcdbdbacababb") || !strcmp(x,"bcdbdbacababba") || !strcmp(x,"bcdbdbacababbb") || !strcmp(x,"bcdbdbacababbd") || !strcmp(x,"bcdbdbacababaa") || !strcmp(x,"bcdbdbacababab") || !strcmp(x,"bcdbdbacababac") || !strcmp(x,"bcdbdbacababad") || !strcmp(x,"bcdbdbacabaaa") || !strcmp(x,"bcdbdbacabaaba") || !strcmp(x,"bcdbdbacabaabb") || !strcmp(x,"bcdbdbacabaabc") || !strcmp(x,"bcdbdbacabaabd") || !strcmp(x,"bcdbdbacabaaaa") || !strcmp(x,"bcdbdbacabaaab") || !strcmp(x,"bcdbdbacabaaac") || !strcmp(x,"bcdbdbacabaaad") || 0)
+#endif
+
+
+static GHashTable *dedupe_ways_hash;
+
+static int attr_debug_level=1;
+static int nodeid,wayid;
+static int phase;
+static int ignore_unkown = 0, coverage=0;
+
+long long slice_size=1024*1024*1024;
+int slices;
+
+
+static char *attrmap={
+ "n *=* point_unkn\n"
+ "n Annehmlichkeit=Hochsitz poi_hunting_stand\n"
+ "n addr:housenumber=* house_number\n"
+ "n aeroway=aerodrome poi_airport\n"
+ "n aeroway=airport poi_airport\n"
+ "n aeroway=helipad poi_heliport\n"
+ "n aeroway=terminal poi_airport\n"
+ "n amenity=atm poi_bank\n"
+ "n amenity=bank poi_bank\n"
+ "n amenity=bench poi_bench\n"
+ "n amenity=biergarten poi_biergarten\n"
+ "n amenity=bus_station poi_bus_station\n"
+ "n amenity=cafe poi_cafe\n"
+ "n amenity=cinema poi_cinema\n"
+ "n amenity=college poi_school_college\n"
+ "n amenity=courthouse poi_justice\n"
+ "n amenity=drinking_water poi_potable_water\n"
+ "n amenity=fast_food poi_fastfood\n"
+ "n amenity=fire_station poi_firebrigade\n"
+ "n amenity=fountain poi_fountain\n"
+ "n amenity=fuel poi_fuel\n"
+ "n amenity=grave_yard poi_cemetery\n"
+ "n amenity=hospital poi_hospital\n"
+ "n amenity=hunting_stand poi_hunting_stand\n"
+ "n amenity=kindergarten poi_kindergarten\n"
+ "n amenity=library poi_library\n"
+ "n amenity=park_bench poi_bench\n"
+ "n amenity=parking poi_car_parking\n"
+ "n amenity=pharmacy poi_pharmacy\n"
+ "n amenity=place_of_worship,religion=christian poi_church\n"
+ "n amenity=police poi_police\n"
+ "n amenity=post_box poi_post_box\n"
+ "n amenity=post_office poi_post_office\n"
+ "n amenity=prison poi_prison\n"
+ "n amenity=pub poi_bar\n"
+ "n amenity=public_building poi_public_office\n"
+ "n amenity=restaurant poi_restaurant\n"
+ "n amenity=school poi_school\n"
+ "n amenity=shelter poi_shelter\n"
+ "n amenity=taxi poi_taxi\n"
+ "n amenity=tec_common tec_common\n"
+ "n amenity=telephone poi_telephone\n"
+ "n amenity=theatre poi_theater\n"
+ "n amenity=toilets poi_restroom\n"
+ "n amenity=toilets poi_toilets\n"
+ "n amenity=townhall poi_townhall\n"
+ "n amenity=university poi_school_university\n"
+ "n car=car_rental poi_car_rent\n"
+ "n highway=bus_station poi_bus_station\n"
+ "n highway=bus_stop poi_bus_stop\n"
+ "n highway=mini_roundabout mini_roundabout\n"
+ "n highway=motorway_junction highway_exit\n"
+ "n highway=traffic_signals traffic_signals\n"
+ "n highway=turning_circle turning_circle\n"
+ "n historic=boundary_stone poi_boundary_stone\n"
+ "n historic=castle poi_castle\n"
+ "n historic=memorial poi_memorial\n"
+ "n historic=monument poi_monument\n"
+ "n historic=ruins poi_ruins\n"
+ "n landuse=cemetery poi_cemetery\n"
+ "n leisure=fishing poi_fish\n"
+ "n leisure=golf_course poi_golf\n"
+ "n leisure=marina poi_marine\n"
+ "n leisure=slipway poi_boat_ramp\n"
+ "n leisure=sports_centre poi_sport\n"
+ "n leisure=stadium poi_stadium\n"
+ "n man_made=tower poi_tower\n"
+ "n military=airfield poi_military\n"
+ "n military=barracks poi_military\n"
+ "n military=bunker poi_military\n"
+ "n military=danger_area poi_danger_area\n"
+ "n military=range poi_military\n"
+ "n natural=bay poi_bay\n"
+ "n natural=peak poi_peak\n"
+ "n place=city town_label_2e5\n"
+ "n place=hamlet town_label_2e2\n"
+ "n place=locality town_label_2e0\n"
+ "n place=suburb district_label\n"
+ "n place=town town_label_2e4\n"
+ "n place=village town_label_2e3\n"
+ "n power=tower power_tower\n"
+ "n railway=halt poi_rail_halt\n"
+ "n railway=level_crossing poi_level_crossing\n"
+ "n railway=station poi_rail_station\n"
+ "n railway=tram_stop poi_rail_tram_stop\n"
+ "n shop=baker poi_shop_baker\n"
+ "n shop=butcher poi_shop_butcher\n"
+ "n shop=car_repair poi_repair_service\n"
+ "n shop=convenience poi_shop_grocery\n"
+ "n shop=kiosk poi_shop_kiosk\n"
+ "n shop=supermarket poi_shopping\n"
+ "n sport=baseball poi_baseball\n"
+ "n sport=basketball poi_basketball\n"
+ "n sport=climbing poi_climbing\n"
+ "n sport=golf poi_golf\n"
+ "n sport=motor_sports poi_motor_sport\n"
+ "n sport=skiing poi_skiing\n"
+ "n sport=soccer poi_soccer\n"
+ "n sport=stadium poi_stadium\n"
+ "n sport=swimming poi_swimming\n"
+ "n sport=tennis poi_tennis\n"
+ "n tourism=attraction poi_attraction\n"
+ "n tourism=camp_site poi_camp_rv\n"
+ "n tourism=caravan_site poi_camp_rv\n"
+ "n tourism=guest_house poi_guesthouse\n"
+ "n tourism=hostel poi_hostel\n"
+ "n tourism=hotel poi_hotel\n"
+ "n tourism=information poi_information\n"
+ "n tourism=motel poi_motel\n"
+ "n tourism=museum poi_museum_history\n"
+ "n tourism=picnic_site poi_picnic\n"
+ "n tourism=theme_park poi_resort\n"
+ "n tourism=viewpoint poi_viewpoint\n"
+ "n tourism=zoo poi_zoo\n"
+ "w *=* street_unkn\n"
+ "w addr:interpolation=even house_number_interpolation_even\n"
+ "w addr:interpolation=odd house_number_interpolation_odd\n"
+ "w addr:interpolation=all house_number_interpolation_all\n"
+ "w addr:interpolation=alphabetic house_number_interpolation_alphabetic\n"
+ "w aerialway=cable_car lift_cable_car\n"
+ "w aerialway=chair_lift lift_chair\n"
+ "w aerialway=drag_lift lift_drag\n"
+ "w aeroway=aerodrome poly_airport\n"
+ "w aeroway=apron poly_apron\n"
+ "w aeroway=runway aeroway_runway\n"
+ "w aeroway=taxiway aeroway_taxiway\n"
+ "w aeroway=terminal poly_terminal\n"
+ "w amenity=college poly_college\n"
+ "w amenity=grave_yard poly_cemetery\n"
+ "w amenity=parking poly_car_parking\n"
+ "w amenity=place_of_worship poly_building\n"
+ "w amenity=university poly_university\n"
+ "w boundary=administrative border_country\n"
+ "w boundary=civil border_civil\n"
+ "w boundary=national_park border_national_park\n"
+ "w boundary=political border_political\n"
+ "w building=* poly_building\n"
+ "w contour_ext=elevation_major height_line_1\n"
+ "w contour_ext=elevation_medium height_line_2\n"
+ "w contour_ext=elevation_minor height_line_3\n"
+#if 0 /* FIXME: Implement this as attribute */
+ "w cycleway=track cycleway\n"
+#endif
+ "w highway=bridleway bridleway\n"
+ "w highway=bus_guideway bus_guideway\n"
+ "w highway=construction street_construction\n"
+ "w highway=cyclepath cycleway\n"
+ "w highway=cycleway cycleway\n"
+ "w highway=footway footway\n"
+ "w highway=footway,piste:type=nordic footway_and_piste_nordic\n"
+ "w highway=living_street living_street\n"
+ "w highway=minor street_1_land\n"
+ "w highway=motorway highway_city\n"
+ "w highway=motorway_link ramp\n"
+ "w highway=parking_lane street_parking_lane\n"
+ "w highway=path path\n"
+ "w highway=path,bicycle=designated cycleway\n"
+ "w highway=path,foot=designated footway\n"
+ "w highway=path,horse=designated bridleway\n"
+ "w highway=path,sac_scale=alpine_hiking hiking_alpine\n"
+ "w highway=path,sac_scale=demanding_alpine_hiking hiking_alpine_demanding\n"
+ "w highway=path,sac_scale=demanding_mountain_hiking hiking_mountain_demanding\n"
+ "w highway=path,sac_scale=difficult_alpine_hiking hiking_alpine_difficult\n"
+ "w highway=path,sac_scale=hiking hiking\n"
+ "w highway=path,sac_scale=mountain_hiking hiking_mountain\n"
+ "w highway=pedestrian street_pedestrian\n"
+ "w highway=pedestrian,area=1 poly_pedestrian\n"
+ "w highway=plaza poly_plaza\n"
+ "w highway=primary street_4_city\n"
+ "w highway=primary_link ramp\n"
+ "w highway=residential street_1_city\n"
+ "w highway=residential,area=1 poly_street_1\n"
+ "w highway=road street_1_city\n"
+ "w highway=secondary street_3_city\n"
+ "w highway=secondary,area=1 poly_street_3\n"
+ "w highway=secondary_link ramp\n"
+ "w highway=service street_service\n"
+ "w highway=service,area=1 poly_service\n"
+ "w highway=service,service=parking_aisle street_parking_lane\n"
+ "w highway=steps steps\n"
+ "w highway=tertiary street_2_city\n"
+ "w highway=tertiary,area=1 poly_street_2\n"
+ "w highway=tertiary_link ramp\n"
+ "w highway=track track_gravelled\n"
+ "w highway=track,surface=grass track_grass\n"
+ "w highway=track,surface=gravel track_gravelled\n"
+ "w highway=track,surface=ground track_ground\n"
+ "w highway=track,surface=paved track_paved\n"
+ "w highway=track,surface=unpaved track_unpaved\n"
+ "w highway=track,tracktype=grade1 track_paved\n"
+ "w highway=track,tracktype=grade2 track_gravelled\n"
+ "w highway=track,tracktype=grade3 track_unpaved\n"
+ "w highway=track,tracktype=grade4 track_ground\n"
+ "w highway=track,tracktype=grade5 track_grass\n"
+ "w highway=trunk street_4_city\n"
+ "w highway=trunk_link ramp\n"
+ "w highway=unclassified street_1_city\n"
+ "w highway=unclassified,area=1 poly_street_1\n"
+ "w highway=unsurfaced track_gravelled\n"
+ "w historic=archaeological_site poly_archaeological_site\n"
+ "w historic=battlefield poly_battlefield\n"
+ "w historic=ruins poly_ruins\n"
+ "w historic=town gate poly_building\n"
+ "w landuse=allotments poly_allotments\n"
+ "w landuse=basin poly_basin\n"
+ "w landuse=brownfield poly_brownfield\n"
+ "w landuse=cemetery poly_cemetery\n"
+ "w landuse=commercial poly_commercial\n"
+ "w landuse=construction poly_construction\n"
+ "w landuse=farm poly_farm\n"
+ "w landuse=farmland poly_farm\n"
+ "w landuse=farmyard poly_town\n"
+ "w landuse=forest poly_wood\n"
+ "w landuse=greenfield poly_greenfield\n"
+ "w landuse=industrial poly_industry\n"
+ "w landuse=landfill poly_landfill\n"
+ "w landuse=military poly_military\n"
+ "w landuse=plaza poly_plaza\n"
+ "w landuse=quarry poly_quarry\n"
+ "w landuse=railway poly_railway\n"
+ "w landuse=recreation_ground poly_recreation_ground\n"
+ "w landuse=reservoir poly_reservoir\n"
+ "w landuse=residential poly_town\n"
+ "w landuse=residential,area=1 poly_town\n"
+ "w landuse=retail poly_retail\n"
+ "w landuse=village_green poly_village_green\n"
+ "w landuse=vineyard poly_farm\n"
+ "w leisure=common poly_common\n"
+ "w leisure=fishing poly_fishing\n"
+ "w leisure=garden poly_garden\n"
+ "w leisure=golf_course poly_golf_course\n"
+ "w leisure=marina poly_marina\n"
+ "w leisure=nature_reserve poly_nature_reserve\n"
+ "w leisure=park poly_park\n"
+ "w leisure=pitch poly_sports_pitch\n"
+ "w leisure=playground poly_playground\n"
+ "w leisure=sports_centre poly_sport\n"
+ "w leisure=stadium poly_sports_stadium\n"
+ "w leisure=track poly_sports_track\n"
+ "w leisure=water_park poly_water_park\n"
+ "w military=airfield poly_airfield\n"
+ "w military=barracks poly_barracks\n"
+ "w military=danger_area poly_danger_area\n"
+ "w military=naval_base poly_naval_base\n"
+ "w military=range poly_range\n"
+ "w natural=beach poly_beach\n"
+ "w natural=coastline water_line\n"
+ "w natural=fell poly_fell\n"
+ "w natural=glacier poly_glacier\n"
+ "w natural=heath poly_heath\n"
+ "w natural=land poly_land\n"
+ "w natural=marsh poly_marsh\n"
+ "w natural=mud poly_mud\n"
+ "w natural=scree poly_scree\n"
+ "w natural=scrub poly_scrub\n"
+ "w natural=water poly_water\n"
+ "w natural=wood poly_wood\n"
+ "w piste:type=downhill,piste:difficulty=advanced piste_downhill_advanced\n"
+ "w piste:type=downhill,piste:difficulty=easy piste_downhill_easy\n"
+ "w piste:type=downhill,piste:difficulty=expert piste_downhill_expert\n"
+ "w piste:type=downhill,piste:difficulty=freeride piste_downhill_freeride\n"
+ "w piste:type=downhill,piste:difficulty=intermediate piste_downhill_intermediate\n"
+ "w piste:type=downhill,piste:difficulty=novice piste_downhill_novice\n"
+ "w piste:type=nordic piste_nordic\n"
+ "w place=suburb poly_town\n"
+ "w place=town poly_town\n"
+ "w power=line powerline\n"
+ "w railway=abandoned rail_abandoned\n"
+ "w railway=disused rail_disused\n"
+ "w railway=light_rail rail_light\n"
+ "w railway=monorail rail_mono\n"
+ "w railway=narrow_gauge rail_narrow_gauge\n"
+ "w railway=preserved rail_preserved\n"
+ "w railway=rail rail\n"
+ "w railway=subway rail_subway\n"
+ "w railway=tram rail_tram\n"
+ "w route=ferry ferry\n"
+ "w route=ski piste_nordic\n"
+ "w sport=* poly_sport\n"
+ "w tourism=artwork poly_artwork\n"
+ "w tourism=attraction poly_attraction\n"
+ "w tourism=camp_site poly_camp_site\n"
+ "w tourism=caravan_site poly_caravan_site\n"
+ "w tourism=picnic_site poly_picnic_site\n"
+ "w tourism=theme_park poly_theme_park\n"
+ "w tourism=zoo poly_zoo\n"
+ "w waterway=canal water_canal\n"
+ "w waterway=drain water_drain\n"
+ "w waterway=river water_river\n"
+ "w waterway=riverbank poly_water\n"
+ "w waterway=stream water_stream\n"
+ "w barrier=ditch ditch\n"
+ "w barrier=hedge hedge\n"
+ "w barrier=fence fence\n"
+ "w barrier=wall wall\n"
+ "w barrier=retaining_wall retaining_wall\n"
+ "w barrier=city_wall city_wall\n"
+};
+
+
+static char buffer[400000];
+static struct item_bin *item_bin=(struct item_bin *)(void *)buffer;
+
+struct coord coord_buffer[65536];
+
+char *suffix="";
+
+#define IS_REF(c) ((c).x >= (1 << 30))
+#define REF(c) ((c).y)
+#define SET_REF(c,ref) do { (c).x = 1 << 30; (c).y = ref ; } while(0)
+
+struct rect {
+ struct coord l,h;
+};
+
+static void bbox_extend(struct coord *c, struct rect *r);
+
+GList *aux_tile_list;
+
+struct country_table {
+ int countryid;
+ char *names;
+ FILE *file;
+ int size;
+ struct rect r;
+} country_table[] = {
+ { 36,"Australia,AUS"},
+ { 40,"Austria,Österreich,AUT"},
+ { 56,"Belgium"},
+ {124,"Canada"},
+ {152,"Chile"},
+ {191,"Croatia,Republika Hrvatska,HR"},
+ {203,"Czech Republic,Česká republika,CZ"},
+ {208,"Denmark,Danmark,DK"},
+ {246,"Finland,Suomi"},
+ {250,"France,République française,FR"},
+ {276,"Germany,Deutschland,Bundesrepublik Deutschland"},
+ {348,"Hungary"},
+ {380,"Italy,Italia"},
+ {528,"Nederland,The Netherlands,Niederlande,NL"},
+ {578,"Norway,Norge,Noreg,NO"},
+ {616,"Poland,Polska,PL"},
+ {703,"Slovakia,Slovensko,SK"},
+ {705,"Slovenia,Republika Slovenija,SI"},
+ {724,"Spain,Espana,Espana,Reino de Espana"},
+ {752,"Sweden,Sverige,Konungariket Sverige,SE"},
+ {756,"Schweiz"},
+ {826,"United Kingdom,UK"},
+ {840,"USA"},
+ {999,"Unknown"},
+};
+
+static GHashTable *country_table_hash;
+
+struct attr_mapping {
+ enum item_type type;
+ int attr_present_idx_count;
+ int attr_present_idx[0];
+};
+
+static struct attr_mapping **attr_mapping_node;
+static int attr_mapping_node_count;
+static struct attr_mapping **attr_mapping_way;
+static int attr_mapping_way_count;
+
+static char *attr_present;
+static int attr_present_count;
+static GHashTable *attr_hash;
+
+
+static GHashTable *strings_hash = NULL;
+
+
+static char* string_hash_lookup( const char* key )
+{
+ char* key_ptr = NULL;
+
+ if ( strings_hash == NULL ) {
+ strings_hash = g_hash_table_new(g_str_hash, g_str_equal);
+ }
+
+ if ( ( key_ptr = g_hash_table_lookup(strings_hash, key )) == NULL ) {
+ key_ptr = g_strdup( key );
+ g_hash_table_insert(strings_hash, key_ptr, (gpointer)key_ptr );
+
+ }
+ return key_ptr;
+}
+
+static void
+build_attrmap_line(char *line)
+{
+ char *t=NULL,*kvl=NULL,*i=NULL,*p,*kv;
+ struct attr_mapping ***attr_mapping_curr,*attr_mapping=g_malloc0(sizeof(struct attr_mapping));
+ int idx,attr_mapping_count=0,*attr_mapping_curr_count;
+ t=line;
+ p=strchr(t,'\t');
+ if (p) {
+ while (*p == '\t')
+ *p++='\0';
+ kvl=p;
+ p=strchr(kvl,'\t');
+ }
+ if (p) {
+ while (*p == '\t')
+ *p++='\0';
+ i=p;
+ }
+ if (t[0] == 'w') {
+ if (! i)
+ i="street_unkn";
+ attr_mapping_curr=&attr_mapping_way;
+ attr_mapping_curr_count=&attr_mapping_way_count;
+ } else {
+ if (! i)
+ i="point_unkn";
+ attr_mapping_curr=&attr_mapping_node;
+ attr_mapping_curr_count=&attr_mapping_node_count;
+ }
+ attr_mapping->type=item_from_name(i);
+ while ((kv=strtok(kvl, ","))) {
+ kvl=NULL;
+ if (!(idx=(int)(long)g_hash_table_lookup(attr_hash, kv))) {
+ idx=attr_present_count++;
+ g_hash_table_insert(attr_hash, kv, (gpointer)(long)idx);
+ }
+ attr_mapping=g_realloc(attr_mapping, sizeof(struct attr_mapping)+(attr_mapping_count+1)*sizeof(int));
+ attr_mapping->attr_present_idx[attr_mapping_count++]=idx;
+ attr_mapping->attr_present_idx_count=attr_mapping_count;
+ }
+ *attr_mapping_curr=g_realloc(*attr_mapping_curr, sizeof(**attr_mapping_curr)*(*attr_mapping_curr_count+1));
+ (*attr_mapping_curr)[(*attr_mapping_curr_count)++]=attr_mapping;
+}
+
+static void
+build_attrmap(char *map)
+{
+ char *p;
+ attr_hash=g_hash_table_new(g_str_hash, g_str_equal);
+ attr_present_count=1;
+ while (map) {
+ p=strchr(map,'\n');
+ if (p)
+ *p++='\0';
+ if (strlen(map))
+ build_attrmap_line(map);
+ map=p;
+ }
+ attr_present=g_malloc0(sizeof(*attr_present)*attr_present_count);
+}
+
+static void
+build_countrytable(void)
+{
+ int i;
+ char *names,*str,*tok;
+ country_table_hash=g_hash_table_new(g_str_hash, g_str_equal);
+ for (i = 0 ; i < sizeof(country_table)/sizeof(struct country_table) ; i++) {
+ names=g_strdup(country_table[i].names);
+ str=names;
+ while ((tok=strtok(str, ","))) {
+ str=NULL;
+ g_hash_table_insert(country_table_hash, tok, (gpointer)&country_table[i]);
+ }
+ }
+}
+
+
+
+static int processed_nodes, processed_nodes_out, processed_ways, processed_relations, processed_tiles;
+static int in_way, in_node, in_relation;
+
+static void
+sig_alrm(int sig)
+{
+#ifndef _WIN32
+ signal(SIGALRM, sig_alrm);
+ alarm(30);
+#endif
+ fprintf(stderr,"PROGRESS%d: Processed %d nodes (%d out) %d ways %d relations %d tiles\n", phase, processed_nodes, processed_nodes_out, processed_ways, processed_relations, processed_tiles);
+}
+
+struct item_bin {
+ int len;
+ enum item_type type;
+ int clen;
+} item;
+
+struct attr_bin {
+ int len;
+ enum attr_type type;
+};
+
+int maxspeed_attr_value;
+
+char debug_attr_buffer[BUFFER_SIZE];
+
+int flags[4];
+
+int flags_attr_value;
+
+struct attr_bin osmid_attr;
+long int osmid_attr_value;
+
+char is_in_buffer[BUFFER_SIZE];
+
+char attr_strings_buffer[BUFFER_SIZE*16];
+int attr_strings_buffer_len;
+
+enum attr_strings {
+ attr_string_phone,
+ attr_string_fax,
+ attr_string_email,
+ attr_string_url,
+ attr_string_street_name,
+ attr_string_street_name_systematic,
+ attr_string_house_number,
+ attr_string_label,
+ attr_string_last,
+};
+
+char *attr_strings[attr_string_last];
+
+static void
+attr_strings_clear(void)
+{
+ attr_strings_buffer_len=0;
+ memset(attr_strings, 0, sizeof(attr_strings));
+}
+
+static void
+attr_strings_save(enum attr_strings id, char *str)
+{
+ attr_strings[id]=attr_strings_buffer+attr_strings_buffer_len;
+ strcpy(attr_strings[id], str);
+ attr_strings_buffer_len+=strlen(str)+1;
+}
+
+static void
+item_bin_init(struct item_bin *ib, enum item_type type)
+{
+ ib->clen=0;
+ ib->len=2;
+ ib->type=type;
+}
+
+static void
+item_bin_add_coord(struct item_bin *ib, struct coord *c, int count)
+{
+ struct coord *c2=(struct coord *)(ib+1);
+ c2+=ib->clen/2;
+ memcpy(c2, c, count*sizeof(struct coord));
+ ib->clen+=count*2;
+ ib->len+=count*2;
+}
+
+static void
+item_bin_add_coord_rect(struct item_bin *ib, struct rect *r)
+{
+ item_bin_add_coord(ib, &r->l, 1);
+ item_bin_add_coord(ib, &r->h, 1);
+}
+
+static void
+item_bin_add_attr(struct item_bin *ib, struct attr *attr)
+{
+ struct attr_bin *ab=(struct attr_bin *)((int *)ib+ib->len+1);
+ int size=attr_data_size(attr);
+ int pad=(4-(size%4))%4;
+ ab->type=attr->type;
+ memcpy(ab+1, attr_data_get(attr), size);
+ memset((unsigned char *)(ab+1)+size, 0, pad);
+ ab->len=(size+pad)/4+1;
+ ib->len+=ab->len+1;
+}
+
+static void
+item_bin_add_attr_int(struct item_bin *ib, enum attr_type type, int val)
+{
+ struct attr attr;
+ attr.type=type;
+ attr.u.num=val;
+ item_bin_add_attr(ib, &attr);
+}
+
+static void *
+item_bin_get_attr(struct item_bin *ib, enum attr_type type)
+{
+ unsigned char *s=(unsigned char *)ib;
+ unsigned char *e=(unsigned char *)(ib+(ib->len+1)*4);
+ s+=sizeof(struct item_bin)+ib->clen*4;
+ while (s < e) {
+ struct attr_bin *ab=(struct attr_bin *)s;
+ s+=(ab->len+1)*4;
+ if (ab->type == type) {
+ return (ab+1);
+ }
+ }
+ return NULL;
+}
+
+static long long
+item_bin_get_wayid(struct item_bin *ib)
+{
+ long long *ret=item_bin_get_attr(ib, attr_osm_wayid);
+ if (ret)
+ return *ret;
+ return 0;
+}
+
+static void
+item_bin_add_attr_longlong(struct item_bin *ib, enum attr_type type, long long val)
+{
+ struct attr attr;
+ attr.type=type;
+ attr.u.num64=&val;
+ item_bin_add_attr(ib, &attr);
+}
+
+static void
+item_bin_add_attr_string(struct item_bin *ib, enum attr_type type, char *str)
+{
+ struct attr attr;
+ if (! str)
+ return;
+ attr.type=type;
+ attr.u.str=str;
+ item_bin_add_attr(ib, &attr);
+}
+
+static void
+item_bin_add_attr_range(struct item_bin *ib, enum attr_type type, short min, short max)
+{
+ struct attr attr;
+ attr.type=type;
+ attr.u.range.min=min;
+ attr.u.range.max=max;
+ item_bin_add_attr(ib, &attr);
+}
+
+static void
+item_bin_write(struct item_bin *ib, FILE *out)
+{
+ fwrite(buffer, (ib->len+1)*4, 1, out);
+}
+
+static int
+item_bin_read(struct item_bin *ib, FILE *in)
+{
+ if (fread(ib, 4, 1, in) == 0)
+ return 0;
+ if (!ib->len)
+ return 1;
+ if (fread((unsigned char *)ib+4, ib->len*4, 1, in))
+ return 2;
+ return 0;
+}
+
+static int
+xml_get_attribute(char *xml, char *attribute, char *buffer, int buffer_size)
+{
+ int len=strlen(attribute);
+ char *pos,*i,s,attr[len+2];
+ strcpy(attr, attribute);
+ strcpy(attr+len, "=");
+ pos=strstr(xml, attr);
+ if (! pos)
+ return 0;
+ pos+=len+1;
+ s=*pos++;
+ if (! s)
+ return 0;
+ i=strchr(pos, s);
+ if (! i)
+ return 0;
+ if (i - pos > buffer_size) {
+ fprintf(stderr,"Buffer overflow %ld vs %d\n", (long)(i-pos), buffer_size);
+ return 0;
+ }
+ strncpy(buffer, pos, i-pos);
+ buffer[i-pos]='\0';
+ return 1;
+}
+
+static int node_is_tagged;
+static void relation_add_tag(char *k, char *v);
+
+static int
+access_value(char *v)
+{
+ if (!strcmp(v,"yes"))
+ return 1;
+ if (!strcmp(v,"designated"))
+ return 1;
+ if (!strcmp(v,"permissive"))
+ return 1;
+ if (!strcmp(v,"no"))
+ return 2;
+ if (!strcmp(v,"agricultural"))
+ return 2;
+ if (!strcmp(v,"forestry"))
+ return 2;
+ if (!strcmp(v,"private"))
+ return 2;
+ if (!strcmp(v,"delivery"))
+ return 2;
+ if (!strcmp(v,"destination"))
+ return 2;
+ return 3;
+}
+
+static void
+add_tag(char *k, char *v)
+{
+ int idx,level=2;
+ char buffer[BUFFER_SIZE*2+2];
+ if (! strcmp(k,"ele"))
+ level=9;
+ if (! strcmp(k,"time"))
+ level=9;
+ if (! strcmp(k,"created_by"))
+ level=9;
+ if (! strncmp(k,"tiger:",6) || !strcmp(k,"AND_nodes"))
+ level=9;
+ if (! strcmp(k,"converted_by") || ! strcmp(k,"source"))
+ level=8;
+ if (! strncmp(k,"osmarender:",11) || !strncmp(k,"svg:",4))
+ level=8;
+ if (! strcmp(k,"layer"))
+ level=7;
+ if (! strcasecmp(v,"true") || ! strcasecmp(v,"yes"))
+ v="1";
+ if (! strcmp(k,"oneway")) {
+ if (!strcmp(v,"1")) {
+ flags[0] |= AF_ONEWAY | AF_ROUNDABOUT_VALID;
+ }
+ if (! strcmp(v,"-1")) {
+ flags[0] |= AF_ONEWAYREV | AF_ROUNDABOUT_VALID;
+ }
+ if (!in_way)
+ level=6;
+ else
+ level=5;
+ }
+ if (! strcmp(k,"junction")) {
+ if (! strcmp(v,"roundabout"))
+ flags[0] |= AF_ONEWAY | AF_ROUNDABOUT | AF_ROUNDABOUT_VALID;
+ }
+ if (! strcmp(k,"maxspeed")) {
+ if (strstr(v, "mph")) {
+ maxspeed_attr_value = (int)floor(atof(v) * 1.609344);
+ } else {
+ maxspeed_attr_value = atoi(v);
+ }
+ if (maxspeed_attr_value)
+ flags[0] |= AF_SPEED_LIMIT;
+ level=5;
+ }
+ if (! strcmp(k,"access")) {
+ flags[access_value(v)] |= AF_DANGEROUS_GOODS|AF_EMERGENCY_VEHICLES|AF_TRANSPORT_TRUCK|AF_DELIVERY_TRUCK|AF_PUBLIC_BUS|AF_TAXI|AF_HIGH_OCCUPANCY_CAR|AF_CAR|AF_MOTORCYCLE|AF_MOPED|AF_HORSE|AF_BIKE|AF_PEDESTRIAN;
+ level=5;
+ }
+ if (! strcmp(k,"vehicle")) {
+ flags[access_value(v)] |= AF_DANGEROUS_GOODS|AF_EMERGENCY_VEHICLES|AF_TRANSPORT_TRUCK|AF_DELIVERY_TRUCK|AF_PUBLIC_BUS|AF_TAXI|AF_HIGH_OCCUPANCY_CAR|AF_CAR|AF_MOTORCYCLE|AF_MOPED|AF_BIKE;
+ level=5;
+ }
+ if (! strcmp(k,"motorvehicle")) {
+ flags[access_value(v)] |= AF_DANGEROUS_GOODS|AF_EMERGENCY_VEHICLES|AF_TRANSPORT_TRUCK|AF_DELIVERY_TRUCK|AF_PUBLIC_BUS|AF_TAXI|AF_HIGH_OCCUPANCY_CAR|AF_CAR|AF_MOTORCYCLE|AF_MOPED;
+ level=5;
+ }
+ if (! strcmp(k,"bicycle")) {
+ flags[access_value(v)] |= AF_BIKE;
+ level=5;
+ }
+ if (! strcmp(k,"foot")) {
+ flags[access_value(v)] |= AF_PEDESTRIAN;
+ level=5;
+ }
+ if (! strcmp(k,"horse")) {
+ flags[access_value(v)] |= AF_HORSE;
+ level=5;
+ }
+ if (! strcmp(k,"moped")) {
+ flags[access_value(v)] |= AF_MOPED;
+ level=5;
+ }
+ if (! strcmp(k,"motorcycle")) {
+ flags[access_value(v)] |= AF_MOTORCYCLE;
+ level=5;
+ }
+ if (! strcmp(k,"motorcar")) {
+ flags[access_value(v)] |= AF_CAR;
+ level=5;
+ }
+ if (! strcmp(k,"hov")) {
+ flags[access_value(v)] |= AF_HIGH_OCCUPANCY_CAR;
+ level=5;
+ }
+ if (! strcmp(k,"bus")) {
+ flags[access_value(v)] |= AF_PUBLIC_BUS;
+ level=5;
+ }
+ if (! strcmp(k,"taxi")) {
+ flags[access_value(v)] |= AF_TAXI;
+ level=5;
+ }
+ if (! strcmp(k,"goods")) {
+ flags[access_value(v)] |= AF_DELIVERY_TRUCK;
+ level=5;
+ }
+ if (! strcmp(k,"hgv")) {
+ flags[access_value(v)] |= AF_TRANSPORT_TRUCK;
+ level=5;
+ }
+ if (! strcmp(k,"emergency")) {
+ flags[access_value(v)] |= AF_EMERGENCY_VEHICLES;
+ level=5;
+ }
+ if (! strcmp(k,"hazmat")) {
+ flags[access_value(v)] |= AF_DANGEROUS_GOODS;
+ level=5;
+ }
+ if (! strcmp(k,"note"))
+ level=5;
+ if (! strcmp(k,"name")) {
+ attr_strings_save(attr_string_label, v);
+ level=5;
+ }
+ if (! strcmp(k,"addr:email")) {
+ attr_strings_save(attr_string_email, v);
+ level=5;
+ }
+ if (! strcmp(k,"addr:housenumber")) {
+ attr_strings_save(attr_string_house_number, v);
+ level=5;
+ }
+ if (! strcmp(k,"addr:street")) {
+ attr_strings_save(attr_string_street_name, v);
+ level=5;
+ }
+ if (! strcmp(k,"phone")) {
+ attr_strings_save(attr_string_phone, v);
+ level=5;
+ }
+ if (! strcmp(k,"fax")) {
+ attr_strings_save(attr_string_fax, v);
+ level=5;
+ }
+ if (! strcmp(k,"ref")) {
+ if (in_way)
+ attr_strings_save(attr_string_street_name_systematic, v);
+ level=5;
+ }
+ if (! strcmp(k,"is_in")) {
+ strcpy(is_in_buffer, v);
+ level=5;
+ }
+ if (! strcmp(k,"gnis:ST_alpha")) {
+ /* assume a gnis tag means it is part of the USA:
+ http://en.wikipedia.org/wiki/Geographic_Names_Information_System
+ many US towns do not have is_in tags
+ */
+ strcpy(is_in_buffer, "USA");
+ level=5;
+ }
+ if (! strcmp(k,"lanes")) {
+ level=5;
+ }
+ if (attr_debug_level >= level) {
+ int bytes_left = sizeof( debug_attr_buffer ) - strlen(debug_attr_buffer) - 1;
+ if ( bytes_left > 0 )
+ {
+ snprintf(debug_attr_buffer+strlen(debug_attr_buffer), bytes_left, " %s=%s", k, v);
+ debug_attr_buffer[ sizeof( debug_attr_buffer ) - 1 ] = '\0';
+ node_is_tagged=1;
+ }
+ }
+ if (level < 6)
+ node_is_tagged=1;
+ if (level >= 5)
+ return;
+
+ strcpy(buffer,"*=*");
+ if ((idx=(int)(long)g_hash_table_lookup(attr_hash, buffer)))
+ attr_present[idx]=1;
+
+ sprintf(buffer,"%s=*", k);
+ if ((idx=(int)(long)g_hash_table_lookup(attr_hash, buffer)))
+ attr_present[idx]=2;
+
+ sprintf(buffer,"*=%s", v);
+ if ((idx=(int)(long)g_hash_table_lookup(attr_hash, buffer)))
+ attr_present[idx]=2;
+
+ sprintf(buffer,"%s=%s", k, v);
+ if ((idx=(int)(long)g_hash_table_lookup(attr_hash, buffer)))
+ attr_present[idx]=4;
+}
+
+struct entity {
+ char *entity;
+ char c;
+} entities[]= {
+ {"&quot;",'"'},
+ {"&apos;",'\''},
+ {"&amp;",'&'},
+ {"&lt;",'<'},
+ {"&gt;",'>'},
+};
+
+static void
+decode_entities(char *buffer)
+{
+ char *pos=buffer;
+ int i,len,found;
+
+ while ((pos=strchr(pos, '&'))) {
+ found=0;
+ for (i = 0 ; i < sizeof(entities)/sizeof(struct entity); i++) {
+ len=strlen(entities[i].entity);
+ if (!strncmp(pos, entities[i].entity, len)) {
+ *pos=entities[i].c;
+ memmove(pos+1, pos+len, strlen(pos+len)+1);
+ found=1;
+ break;
+ }
+ }
+ pos++;
+ }
+}
+
+static int
+parse_tag(char *p)
+{
+ char k_buffer[BUFFER_SIZE];
+ char v_buffer[BUFFER_SIZE];
+ if (!xml_get_attribute(p, "k", k_buffer, BUFFER_SIZE))
+ return 0;
+ if (!xml_get_attribute(p, "v", v_buffer, BUFFER_SIZE))
+ return 0;
+ decode_entities(v_buffer);
+ if (in_relation)
+ relation_add_tag(k_buffer, v_buffer);
+ else
+ add_tag(k_buffer, v_buffer);
+ return 1;
+}
+
+
+struct buffer {
+ int malloced_step;
+ long long malloced;
+ unsigned char *base;
+ long long size;
+};
+
+static void save_buffer(char *filename, struct buffer *b, long long offset);
+
+static struct tile_head {
+ int num_subtiles;
+ int total_size;
+ char *name;
+ char *zip_data;
+ int total_size_used;
+ int zipnum;
+ int process;
+ struct tile_head *next;
+ // char subtiles[0];
+} *tile_head_root;
+
+
+int coord_count;
+
+struct node_item {
+ int id;
+ char ref_node;
+ char ref_way;
+ char ref_ref;
+ char dummy;
+ struct coord c;
+};
+
+static struct buffer node_buffer = {
+ 64*1024*1024,
+};
+
+
+static char** th_get_subtile( const struct tile_head* th, int idx )
+{
+ char* subtile_ptr = NULL;
+ subtile_ptr = (char*)th + sizeof( struct tile_head ) + idx * sizeof( char *);
+ return (char**)subtile_ptr;
+}
+
+static void
+extend_buffer(struct buffer *b)
+{
+ b->malloced+=b->malloced_step;
+ b->base=realloc(b->base, b->malloced);
+ if (b->base == NULL) {
+ fprintf(stderr,"realloc of %d bytes failed\n",(int)b->malloced);
+ exit(1);
+ }
+
+}
+
+int nodeid_last;
+GHashTable *node_hash;
+
+static void
+node_buffer_to_hash(void)
+{
+ int i,count=node_buffer.size/sizeof(struct node_item);
+ struct node_item *ni=(struct node_item *)node_buffer.base;
+ for (i = 0 ; i < count ; i++)
+ g_hash_table_insert(node_hash, (gpointer)(long)(ni[i].id), (gpointer)(long)i);
+}
+
+static struct node_item *ni;
+
+static void
+flush_nodes(int final)
+{
+ fprintf(stderr,"flush_nodes %d\n",final);
+ save_buffer("coords.tmp",&node_buffer,slices*slice_size);
+ if (!final) {
+ node_buffer.size=0;
+ }
+ slices++;
+}
+
+static void
+add_node(int id, double lat, double lon)
+{
+ if (node_buffer.size + sizeof(struct node_item) > node_buffer.malloced)
+ extend_buffer(&node_buffer);
+ attr_strings_clear();
+ node_is_tagged=0;
+ nodeid=id;
+ item.type=type_point_unkn;
+ debug_attr_buffer[0]='\0';
+ is_in_buffer[0]='\0';
+ debug_attr_buffer[0]='\0';
+ osmid_attr.type=attr_osm_nodeid;
+ osmid_attr.len=3;
+ osmid_attr_value=id;
+ if (node_buffer.size + sizeof(struct node_item) > slice_size) {
+ flush_nodes(0);
+ }
+ ni=(struct node_item *)(node_buffer.base+node_buffer.size);
+ ni->id=id;
+ ni->ref_node=0;
+ ni->ref_way=0;
+ ni->ref_ref=0;
+ ni->dummy=0;
+ ni->c.x=lon*6371000.0*M_PI/180;
+ ni->c.y=log(tan(M_PI_4+lat*M_PI/360))*6371000.0;
+ node_buffer.size+=sizeof(struct node_item);
+ if (! node_hash) {
+ if (ni->id > nodeid_last) {
+ nodeid_last=ni->id;
+ } else {
+ fprintf(stderr,"INFO: Nodes out of sequence (new %d vs old %d), adding hash\n", ni->id, nodeid_last);
+ node_hash=g_hash_table_new(NULL, NULL);
+ node_buffer_to_hash();
+ }
+ } else
+ if (!g_hash_table_lookup(node_hash, (gpointer)(long)(ni->id)))
+ g_hash_table_insert(node_hash, (gpointer)(long)(ni->id), (gpointer)(long)(ni-(struct node_item *)node_buffer.base));
+ else {
+ node_buffer.size-=sizeof(struct node_item);
+ nodeid=0;
+ }
+
+}
+
+static int
+parse_node(char *p)
+{
+ char id_buffer[BUFFER_SIZE];
+ char lat_buffer[BUFFER_SIZE];
+ char lon_buffer[BUFFER_SIZE];
+ if (!xml_get_attribute(p, "id", id_buffer, BUFFER_SIZE))
+ return 0;
+ if (!xml_get_attribute(p, "lat", lat_buffer, BUFFER_SIZE))
+ return 0;
+ if (!xml_get_attribute(p, "lon", lon_buffer, BUFFER_SIZE))
+ return 0;
+ add_node(atoi(id_buffer), atof(lat_buffer), atof(lon_buffer));
+ return 1;
+}
+
+
+static struct node_item *
+node_item_get(int id)
+{
+ struct node_item *ni=(struct node_item *)(node_buffer.base);
+ int count=node_buffer.size/sizeof(struct node_item);
+ int interval=count/4;
+ int p=count/2;
+ if(interval==0) {
+ // If fewer than 4 nodes defined so far set interval to 1 to
+ // avoid infinite loop
+ interval = 1;
+ }
+ if (node_hash) {
+ int i;
+ i=(int)(long)(g_hash_table_lookup(node_hash, (gpointer)(long)id));
+ return ni+i;
+ }
+ if (ni[0].id > id)
+ return NULL;
+ if (ni[count-1].id < id)
+ return NULL;
+ while (ni[p].id != id) {
+#if 0
+ fprintf(stderr,"p=%d count=%d interval=%d id=%d ni[p].id=%d\n", p, count, interval, id, ni[p].id);
+#endif
+ if (ni[p].id < id) {
+ p+=interval;
+ if (interval == 1) {
+ if (p >= count)
+ return NULL;
+ if (ni[p].id > id)
+ return NULL;
+ } else {
+ if (p >= count)
+ p=count-1;
+ }
+ } else {
+ p-=interval;
+ if (interval == 1) {
+ if (p < 0)
+ return NULL;
+ if (ni[p].id < id)
+ return NULL;
+ } else {
+ if (p < 0)
+ p=0;
+ }
+ }
+ if (interval > 1)
+ interval/=2;
+ }
+
+ return &ni[p];
+}
+
+static void
+add_way(int id)
+{
+ wayid=id;
+ coord_count=0;
+ attr_strings_clear();
+ item.type=type_street_unkn;
+ debug_attr_buffer[0]='\0';
+ maxspeed_attr_value=0;
+ flags_attr_value = 0;
+ memset(flags, 0, sizeof(flags));
+ debug_attr_buffer[0]='\0';
+ osmid_attr_value=id;
+}
+
+static int
+parse_way(char *p)
+{
+ char id_buffer[BUFFER_SIZE];
+ if (!xml_get_attribute(p, "id", id_buffer, BUFFER_SIZE))
+ return 0;
+ add_way(atoi(id_buffer));
+ return 1;
+}
+
+static int
+add_id_attr(char *p, enum attr_type attr_type)
+{
+ long long id;
+ struct attr idattr = { attr_type };
+ char id_buffer[BUFFER_SIZE];
+ if (!xml_get_attribute(p, "id", id_buffer, BUFFER_SIZE))
+ return 0;
+ id=atoll(id_buffer);
+ idattr.u.num64=&id;
+ item_bin_add_attr(item_bin, &idattr);
+ return 1;
+}
+
+char relation_type[BUFFER_SIZE];
+
+
+static int
+parse_relation(char *p)
+{
+ debug_attr_buffer[0]='\0';
+ relation_type[0]='\0';
+ item_bin_init(item_bin, type_none);
+ if (!add_id_attr(p, attr_osm_relationid))
+ return 0;
+ return 1;
+}
+
+static void
+end_relation(FILE *turn_restrictions)
+{
+ struct item_bin *ib=(struct item_bin *)buffer;
+ if (!strcmp(relation_type, "restriction") && (ib->type == type_street_turn_restriction_no || ib->type == type_street_turn_restriction_only))
+ item_bin_write(item_bin, turn_restrictions);
+}
+
+static int
+parse_member(char *p)
+{
+ char type_buffer[BUFFER_SIZE];
+ char ref_buffer[BUFFER_SIZE];
+ char role_buffer[BUFFER_SIZE];
+ char member_buffer[BUFFER_SIZE*3+3];
+ struct attr memberattr = { attr_osm_member };
+ if (!xml_get_attribute(p, "type", type_buffer, BUFFER_SIZE))
+ return 0;
+ if (!xml_get_attribute(p, "ref", ref_buffer, BUFFER_SIZE))
+ return 0;
+ if (!xml_get_attribute(p, "role", role_buffer, BUFFER_SIZE))
+ return 0;
+ sprintf(member_buffer,"%s:%s:%s", type_buffer, ref_buffer, role_buffer);
+ memberattr.u.str=member_buffer;
+ item_bin_add_attr(item_bin, &memberattr);
+
+ return 1;
+}
+
+
+static void
+relation_add_tag(char *k, char *v)
+{
+ if (!strcmp(k,"type"))
+ strcpy(relation_type, v);
+ else if (!strcmp(k,"restriction")) {
+ if (strncmp(k,"no_",3)) {
+ item_bin->type=type_street_turn_restriction_no;
+ } else if (strncmp(k,"only_",5)) {
+ item_bin->type=type_street_turn_restriction_only;
+ }
+ }
+}
+
+
+static int
+attr_longest_match(struct attr_mapping **mapping, int mapping_count, enum item_type *types, int types_count)
+{
+ int i,j,longest=0,ret=0,sum,val;
+ struct attr_mapping *curr;
+ for (i = 0 ; i < mapping_count ; i++) {
+ sum=0;
+ curr=mapping[i];
+ for (j = 0 ; j < curr->attr_present_idx_count ; j++) {
+ val=attr_present[curr->attr_present_idx[j]];
+ if (val)
+ sum+=val;
+ else {
+ sum=-1;
+ break;
+ }
+ }
+ if (sum > longest) {
+ longest=sum;
+ ret=0;
+ }
+ if (sum > 0 && sum == longest && ret < types_count)
+ types[ret++]=curr->type;
+ }
+ memset(attr_present, 0, sizeof(*attr_present)*attr_present_count);
+ return ret;
+}
+
+static void
+end_way(FILE *out)
+{
+ int i,count;
+ int *def_flags,add_flags;
+ enum item_type types[10];
+
+ if (! out)
+ return;
+ if (dedupe_ways_hash) {
+ if (g_hash_table_lookup(dedupe_ways_hash, (gpointer)(long)wayid))
+ return;
+ g_hash_table_insert(dedupe_ways_hash, (gpointer)(long)wayid, (gpointer)1);
+ }
+ count=attr_longest_match(attr_mapping_way, attr_mapping_way_count, types, sizeof(types)/sizeof(enum item_type));
+ if (!count) {
+ count=1;
+ types[0]=type_street_unkn;
+ }
+ if (count >= 10) {
+ fprintf(stderr,"way id %ld\n",osmid_attr_value);
+ assert(count < 10);
+ }
+ for (i = 0 ; i < count ; i++) {
+ add_flags=0;
+ item_bin_init(item_bin,types[i]);
+ item_bin_add_coord(item_bin, coord_buffer, coord_count);
+ def_flags=item_get_default_flags(types[i]);
+ if (def_flags) {
+ if (coverage) {
+ item.type=type_coverage;
+ } else {
+ flags_attr_value=(*def_flags | flags[0] | flags[1]) & ~flags[2];
+ if (flags_attr_value != *def_flags)
+ add_flags=1;
+ }
+ }
+ item_bin_add_attr_string(item_bin, def_flags ? attr_street_name : attr_label, attr_strings[attr_string_label]);
+ item_bin_add_attr_string(item_bin, attr_street_name_systematic, attr_strings[attr_string_street_name_systematic]);
+ item_bin_add_attr_longlong(item_bin, attr_osm_wayid, osmid_attr_value);
+ if (debug_attr_buffer[0])
+ item_bin_add_attr_string(item_bin, attr_debug, debug_attr_buffer);
+ if (add_flags)
+ item_bin_add_attr_int(item_bin, attr_flags, flags_attr_value);
+ if (maxspeed_attr_value)
+ item_bin_add_attr_int(item_bin, attr_maxspeed, maxspeed_attr_value);
+ item_bin_write(item_bin,out);
+ }
+}
+
+static void
+end_node(FILE *out)
+{
+ int conflict,count,i;
+ enum item_type types[10];
+ struct country_table *result=NULL, *lookup;
+ if (!out || ! node_is_tagged || ! nodeid)
+ return;
+ count=attr_longest_match(attr_mapping_node, attr_mapping_node_count, types, sizeof(types)/sizeof(enum item_type));
+ if (!count) {
+ types[0]=type_point_unkn;
+ count=1;
+ }
+ assert(count < 10);
+ for (i = 0 ; i < count ; i++) {
+ conflict=0;
+ item_bin_init(item_bin, types[i]);
+ item_bin_add_coord(item_bin, &ni->c, 1);
+ item_bin_add_attr_string(item_bin, item_is_town(*item_bin) ? attr_town_name : attr_label, attr_strings[attr_string_label]);
+ item_bin_add_attr_string(item_bin, attr_house_number, attr_strings[attr_string_house_number]);
+ item_bin_add_attr_string(item_bin, attr_street_name, attr_strings[attr_string_street_name]);
+ item_bin_add_attr_string(item_bin, attr_phone, attr_strings[attr_string_phone]);
+ item_bin_add_attr_string(item_bin, attr_fax, attr_strings[attr_string_fax]);
+ item_bin_add_attr_string(item_bin, attr_email, attr_strings[attr_string_email]);
+ item_bin_add_attr_string(item_bin, attr_url, attr_strings[attr_string_url]);
+ item_bin_add_attr_longlong(item_bin, attr_osm_nodeid, osmid_attr_value);
+ item_bin_add_attr_string(item_bin, attr_debug, debug_attr_buffer);
+ item_bin_write(item_bin,out);
+ if (item_is_town(*item_bin) && attr_strings[attr_string_label]) {
+ char *tok,*buf=is_in_buffer;
+ if (!buf[0])
+ strcpy(is_in_buffer, "Unknown");
+ while ((tok=strtok(buf, ","))) {
+ while (*tok==' ')
+ tok++;
+ lookup=g_hash_table_lookup(country_table_hash,tok);
+ if (lookup) {
+ if (result && result->countryid != lookup->countryid) {
+ fprintf(stderr,"conflict for %s %s country %d vs %d\n", attr_strings[attr_string_label], debug_attr_buffer, lookup->countryid, result->countryid);
+ conflict=1;
+ } else
+ result=lookup;
+ }
+ buf=NULL;
+ }
+ if (result && !conflict) {
+ if (!result->file) {
+ char *name=g_strdup_printf("country_%d.bin.unsorted", result->countryid);
+ result->file=fopen(name,"wb");
+ g_free(name);
+ }
+ if (result->file) {
+ int i,words=0;
+ char *town_name=attr_strings[attr_string_label];
+ char *word=town_name;
+ do {
+ for (i = 0 ; i < 3 ; i++) {
+ char *str=linguistics_expand_special(word, i);
+ if (str) {
+ item_bin_init(item_bin, item_bin->type);
+ item_bin_add_coord(item_bin, &ni->c, 1);
+ if (i || words)
+ item_bin_add_attr_string(item_bin, attr_town_name_match, str);
+ item_bin_add_attr_string(item_bin, attr_town_name, town_name);
+ item_bin_write(item_bin, result->file);
+ g_free(str);
+ }
+ }
+ word=linguistics_next_word(word);
+ words++;
+ } while (word);
+ }
+
+ }
+ }
+ }
+ processed_nodes_out++;
+}
+
+static int
+sort_countries_compare(const void *p1, const void *p2)
+{
+ struct item_bin *ib1=*((struct item_bin **)p1),*ib2=*((struct item_bin **)p2);
+ struct attr_bin *attr1,*attr2;
+ char *s1,*s2;
+ assert(ib1->clen==2);
+ assert(ib2->clen==2);
+ attr1=(struct attr_bin *)((int *)(ib1+1)+ib1->clen);
+ attr2=(struct attr_bin *)((int *)(ib2+1)+ib1->clen);
+ assert(attr1->type == attr_town_name || attr1->type == attr_town_name_match);
+ assert(attr2->type == attr_town_name || attr2->type == attr_town_name_match);
+ s1=(char *)(attr1+1);
+ s2=(char *)(attr2+1);
+ return strcmp(s1, s2);
+#if 0
+ fprintf(stderr,"sort_countries_compare p1=%p p2=%p %s %s\n",p1,p2,s1,s2);
+#endif
+ return 0;
+}
+
+static void
+sort_countries(int keep_tmpfiles)
+{
+ int i,j,count;
+ struct country_table *co;
+ struct coord *c;
+ struct item_bin *ib;
+ FILE *f;
+ char *name;
+ unsigned char *p,**idx,*buffer;
+ for (i = 0 ; i < sizeof(country_table)/sizeof(struct country_table) ; i++) {
+ co=&country_table[i];
+ if (co->file) {
+ fclose(co->file);
+ co->file=NULL;
+ }
+ name=g_strdup_printf("country_%d.bin.unsorted", co->countryid);
+ if (file_get_contents(name, &buffer, &co->size)) {
+ if(!keep_tmpfiles)
+ unlink(name);
+ g_free(name);
+ ib=(struct item_bin *)buffer;
+ p=buffer;
+ count=0;
+ while (p < buffer+co->size) {
+ count++;
+ p+=(*((int *)p)+1)*4;
+ }
+ idx=malloc(count*sizeof(void *));
+ assert(idx != NULL);
+ p=buffer;
+ for (j = 0 ; j < count ; j++) {
+ idx[j]=p;
+ p+=(*((int *)p)+1)*4;
+ }
+ qsort(idx, count, sizeof(void *), sort_countries_compare);
+ name=g_strdup_printf("country_%d.bin", co->countryid);
+ f=fopen(name,"wb");
+ for (j = 0 ; j < count ; j++) {
+ ib=(struct item_bin *)(idx[j]);
+ c=(struct coord *)(ib+1);
+ fwrite(ib, (ib->len+1)*4, 1, f);
+ if (j)
+ bbox_extend(c, &co->r);
+ else {
+ co->r.l=*c;
+ co->r.h=*c;
+ }
+ }
+ fclose(f);
+ }
+ g_free(name);
+ }
+}
+
+static void
+node_ref_way(osmid node)
+{
+ struct node_item *ni;
+ ni=node_item_get(node);
+ if (ni)
+ ni->ref_way++;
+}
+
+static int
+resolve_ways(FILE *in, FILE *out)
+{
+ struct item_bin *ib=(struct item_bin *)buffer;
+ struct coord *c;
+ int i;
+
+ fseek(in, 0, SEEK_SET);
+ for (;;) {
+ switch (item_bin_read(ib, in)) {
+ case 0:
+ return 0;
+ case 2:
+ c=(struct coord *)(ib+1);
+ for (i = 0 ; i < ib->clen/2 ; i++) {
+ node_ref_way(REF(c[i]));
+ }
+ default:
+ continue;
+ }
+ }
+
+
+}
+
+static void
+add_nd(char *p, osmid ref)
+{
+ SET_REF(coord_buffer[coord_count], ref);
+ node_ref_way(ref);
+ coord_count++;
+ if (coord_count > 65536) {
+ fprintf(stderr,"ERROR: Overflow\n");
+ exit(1);
+ }
+}
+
+static int
+parse_nd(char *p)
+{
+ char ref_buffer[BUFFER_SIZE];
+ if (!xml_get_attribute(p, "ref", ref_buffer, BUFFER_SIZE))
+ return 0;
+ add_nd(p, atoi(ref_buffer));
+ return 1;
+}
+
+
+static void
+save_buffer(char *filename, struct buffer *b, long long offset)
+{
+ FILE *f;
+ f=fopen(filename,"rb+");
+ if (! f)
+ f=fopen(filename,"wb+");
+
+ assert(f != NULL);
+ fseek(f, offset, SEEK_SET);
+ fwrite(b->base, b->size, 1, f);
+ fclose(f);
+}
+
+static void
+load_buffer(char *filename, struct buffer *b, long long offset, long long size)
+{
+ FILE *f;
+ long long len;
+ int ret;
+ if (b->base)
+ free(b->base);
+ b->malloced=0;
+ f=fopen(filename,"rb");
+ fseek(f, 0, SEEK_END);
+ len=ftell(f);
+ if (offset+size > len) {
+ size=len-offset;
+ ret=1;
+ }
+ b->size=b->malloced=size;
+ fprintf(stderr,"reading %Ld bytes from %s at %Ld\n", b->size, filename, offset);
+ fseek(f, offset, SEEK_SET);
+ b->base=malloc(b->size);
+ assert(b->base != NULL);
+ fread(b->base, b->size, 1, f);
+ fclose(f);
+}
+
+static int
+phase1(FILE *in, FILE *out_ways, FILE *out_nodes, FILE *out_turn_restrictions)
+{
+ int size=BUFFER_SIZE;
+ char buffer[size];
+ char *p;
+ sig_alrm(0);
+ while (fgets(buffer, size, in)) {
+ p=strchr(buffer,'<');
+ if (! p) {
+ fprintf(stderr,"WARNING: wrong line %s\n", buffer);
+ continue;
+ }
+ if (!strncmp(p, "<?xml ",6)) {
+ } else if (!strncmp(p, "<osm ",5)) {
+ } else if (!strncmp(p, "<bound ",7)) {
+ } else if (!strncmp(p, "<node ",6)) {
+ if (!parse_node(p))
+ fprintf(stderr,"WARNING: failed to parse %s\n", buffer);
+ in_node=1;
+ processed_nodes++;
+ } else if (!strncmp(p, "<tag ",5)) {
+ if (!parse_tag(p))
+ fprintf(stderr,"WARNING: failed to parse %s\n", buffer);
+ } else if (!strncmp(p, "<way ",5)) {
+ in_way=1;
+ if (!parse_way(p))
+ fprintf(stderr,"WARNING: failed to parse %s\n", buffer);
+ processed_ways++;
+ } else if (!strncmp(p, "<nd ",4)) {
+ if (!parse_nd(p))
+ fprintf(stderr,"WARNING: failed to parse %s\n", buffer);
+ } else if (!strncmp(p, "<relation ",10)) {
+ in_relation=1;
+ if (!parse_relation(p))
+ fprintf(stderr,"WARNING: failed to parse %s\n", buffer);
+ processed_relations++;
+ } else if (!strncmp(p, "<member ",8)) {
+ if (!parse_member(p))
+ fprintf(stderr,"WARNING: failed to parse %s\n", buffer);
+ } else if (!strncmp(p, "</node>",7)) {
+ in_node=0;
+ end_node(out_nodes);
+ } else if (!strncmp(p, "</way>",6)) {
+ in_way=0;
+ end_way(out_ways);
+ } else if (!strncmp(p, "</relation>",11)) {
+ in_relation=0;
+ end_relation(out_turn_restrictions);
+ } else if (!strncmp(p, "</osm>",6)) {
+ } else {
+ fprintf(stderr,"WARNING: unknown tag in %s\n", buffer);
+ }
+ }
+ sig_alrm(0);
+#ifndef _WIN32
+ alarm(0);
+#endif
+ return 1;
+}
+
+#ifdef HAVE_POSTGRESQL
+static int
+phase1_db(char *dbstr, FILE *out_ways, FILE *out_nodes)
+{
+ PGconn *conn;
+ PGresult *res,*node,*way,*tag;
+ int count,tagged,i,j,k;
+ long min, max, id, tag_id, node_id;
+ char query[256];
+
+ sig_alrm(0);
+ conn=PQconnectdb(dbstr);
+ if (! conn) {
+ fprintf(stderr,"Failed to connect to database with '%s'\n",dbstr);
+ exit(1);
+ }
+ res=PQexec(conn, "begin");
+ if (! res) {
+ fprintf(stderr, "Cannot begin transaction: %s\n", PQerrorMessage(conn));
+ PQclear(res);
+ exit(1);
+ }
+ res=PQexec(conn, "set transaction isolation level serializable");
+ if (! res) {
+ fprintf(stderr, "Cannot set isolation level: %s\n", PQerrorMessage(conn));
+ PQclear(res);
+ exit(1);
+ }
+ res=PQexec(conn, "declare node cursor for select id,x(coordinate),y(coordinate) from node order by id");
+ if (! res) {
+ fprintf(stderr, "Cannot setup cursor for nodes: %s\n", PQerrorMessage(conn));
+ PQclear(res);
+ exit(1);
+ }
+ res=PQexec(conn, "declare way cursor for select id from way order by id");
+ if (! res) {
+ fprintf(stderr, "Cannot setup cursor for nodes: %s\n", PQerrorMessage(conn));
+ PQclear(res);
+ exit(1);
+ }
+ res=PQexec(conn, "declare relation cursor for select id from relation order by id");
+ if (! res) {
+ fprintf(stderr, "Cannot setup cursor for nodes: %s\n", PQerrorMessage(conn));
+ PQclear(res);
+ exit(1);
+ }
+ for (;;) {
+ node=PQexec(conn, "fetch 100000 from node");
+ if (! node) {
+ fprintf(stderr, "Cannot setup cursor for nodes: %s\n", PQerrorMessage(conn));
+ PQclear(node);
+ exit(1);
+ }
+ count=PQntuples(node);
+ if (! count)
+ break;
+ min=atol(PQgetvalue(node, 0, 0));
+ max=atol(PQgetvalue(node, count-1, 0));
+ sprintf(query,"select node_id,name,value from node_tag where node_id >= %ld and node_id <= %ld order by node_id", min, max);
+ tag=PQexec(conn, query);
+ if (! tag) {
+ fprintf(stderr, "Cannot query node_tag: %s\n", PQerrorMessage(conn));
+ exit(1);
+ }
+ j=0;
+ for (i = 0 ; i < count ; i++) {
+ id=atol(PQgetvalue(node, i, 0));
+ add_node(id, atof(PQgetvalue(node, i, 1)), atof(PQgetvalue(node, i, 2)));
+ tagged=0;
+ in_node=1;
+ processed_nodes++;
+ while (j < PQntuples(tag)) {
+ tag_id=atol(PQgetvalue(tag, j, 0));
+ if (tag_id == id) {
+ add_tag(PQgetvalue(tag, j, 1), PQgetvalue(tag, j, 2));
+ tagged=1;
+ j++;
+ }
+ if (tag_id < id)
+ j++;
+ if (tag_id > id)
+ break;
+ }
+ if (tagged)
+ end_node(out_nodes);
+ in_node=0;
+ }
+ PQclear(tag);
+ PQclear(node);
+ }
+ for (;;) {
+ way=PQexec(conn, "fetch 100000 from way");
+ if (! way) {
+ fprintf(stderr, "Cannot setup cursor for ways: %s\n", PQerrorMessage(conn));
+ PQclear(node);
+ exit(1);
+ }
+ count=PQntuples(way);
+ if (! count)
+ break;
+ min=atol(PQgetvalue(way, 0, 0));
+ max=atol(PQgetvalue(way, count-1, 0));
+ sprintf(query,"select way_id,node_id from way_node where way_id >= %ld and way_id <= %ld order by way_id,sequence_id", min, max);
+ node=PQexec(conn, query);
+ if (! node) {
+ fprintf(stderr, "Cannot query way_node: %s\n", PQerrorMessage(conn));
+ exit(1);
+ }
+ sprintf(query,"select way_id,name,value from way_tag where way_id >= %ld and way_id <= %ld order by way_id", min, max);
+ tag=PQexec(conn, query);
+ if (! tag) {
+ fprintf(stderr, "Cannot query way_tag: %s\n", PQerrorMessage(conn));
+ exit(1);
+ }
+ j=0;
+ k=0;
+ for (i = 0 ; i < count ; i++) {
+ id=atol(PQgetvalue(way, i, 0));
+ add_way(id);
+ tagged=0;
+ in_way=1;
+ processed_ways++;
+ while (k < PQntuples(node)) {
+ node_id=atol(PQgetvalue(node, k, 0));
+ if (node_id == id) {
+ add_nd("",atol(PQgetvalue(node, k, 1)));
+ tagged=1;
+ k++;
+ }
+ if (node_id < id)
+ k++;
+ if (node_id > id)
+ break;
+ }
+ while (j < PQntuples(tag)) {
+ tag_id=atol(PQgetvalue(tag, j, 0));
+ if (tag_id == id) {
+ add_tag(PQgetvalue(tag, j, 1), PQgetvalue(tag, j, 2));
+ tagged=1;
+ j++;
+ }
+ if (tag_id < id)
+ j++;
+ if (tag_id > id)
+ break;
+ }
+ if (tagged)
+ end_way(out_ways);
+ in_way=0;
+ }
+ PQclear(tag);
+ PQclear(node);
+ PQclear(way);
+ }
+
+ res=PQexec(conn, "commit");
+ if (! res) {
+ fprintf(stderr, "Cannot commit transaction: %s\n", PQerrorMessage(conn));
+ PQclear(res);
+ exit(1);
+ }
+ sig_alrm(0);
+#ifndef _WIN32
+ alarm(0);
+#endif
+ return 1;
+}
+#endif
+
+
+static void
+phase1_map(struct map *map, FILE *out_ways, FILE *out_nodes)
+{
+ struct map_rect *mr=map_rect_new(map, NULL);
+ struct item *item;
+ int count,max=16384;
+ struct coord ca[max];
+ struct attr attr;
+
+ while ((item = map_rect_get_item(mr))) {
+ count=item_coord_get(item, ca, item->type < type_line ? 1: max);
+ item_bin_init(item_bin, item->type);
+ item_bin_add_coord(item_bin, ca, count);
+ while (item_attr_get(item, attr_any, &attr)) {
+ item_bin_add_attr(item_bin, &attr);
+ }
+ if (item->type >= type_line)
+ item_bin_write(item_bin, out_ways);
+ else
+ item_bin_write(item_bin, out_nodes);
+ }
+ map_rect_destroy(mr);
+}
+
+
+int bytes_read=0;
+
+static struct item_bin *
+read_item(FILE *in)
+{
+ struct item_bin *ib=(struct item_bin *) buffer;
+ int r,s;
+ r=fread(ib, sizeof(*ib), 1, in);
+ if (r != 1)
+ return NULL;
+ bytes_read+=r;
+ assert((ib->len+1)*4 < sizeof(buffer));
+ s=(ib->len+1)*4-sizeof(*ib);
+ r=fread(ib+1, s, 1, in);
+ if (r != 1)
+ return NULL;
+ bytes_read+=r;
+ return ib;
+}
+
+static void
+bbox_extend(struct coord *c, struct rect *r)
+{
+ if (c->x < r->l.x)
+ r->l.x=c->x;
+ if (c->y < r->l.y)
+ r->l.y=c->y;
+ if (c->x > r->h.x)
+ r->h.x=c->x;
+ if (c->y > r->h.y)
+ r->h.y=c->y;
+}
+
+static void
+bbox(struct coord *c, int count, struct rect *r)
+{
+ if (! count)
+ return;
+ r->l=*c;
+ r->h=*c;
+ while (--count) {
+ c++;
+ bbox_extend(c, r);
+ }
+}
+
+static int
+contains_bbox(int xl, int yl, int xh, int yh, struct rect *r)
+{
+ if (r->h.x < xl || r->h.x > xh) {
+ return 0;
+ }
+ if (r->l.x > xh || r->l.x < xl) {
+ return 0;
+ }
+ if (r->h.y < yl || r->h.y > yh) {
+ return 0;
+ }
+ if (r->l.y > yh || r->l.y < yl) {
+ return 0;
+ }
+ return 1;
+
+}
+struct rect world_bbox = {
+ { -20000000, -20000000},
+ { 20000000, 20000000},
+};
+
+int overlap=1;
+
+static void
+tile(struct rect *r, char *suffix, char *ret, int max)
+{
+ int x0,x2,x4;
+ int y0,y2,y4;
+ int xo,yo;
+ int i;
+ x0=world_bbox.l.x;
+ y0=world_bbox.l.y;
+ x4=world_bbox.h.x;
+ y4=world_bbox.h.y;
+ for (i = 0 ; i < max ; i++) {
+ x2=(x0+x4)/2;
+ y2=(y0+y4)/2;
+ xo=(x4-x0)*overlap/100;
+ yo=(y4-y0)*overlap/100;
+ if ( contains_bbox(x0,y0,x2+xo,y2+yo,r)) {
+ strcat(ret,"d");
+ x4=x2+xo;
+ y4=y2+yo;
+ } else if (contains_bbox(x2-xo,y0,x4,y2+yo,r)) {
+ strcat(ret,"c");
+ x0=x2-xo;
+ y4=y2+yo;
+ } else if (contains_bbox(x0,y2-yo,x2+xo,y4,r)) {
+ strcat(ret,"b");
+ x4=x2+xo;
+ y0=y2-yo;
+ } else if (contains_bbox(x2-xo,y2-yo,x4,y4,r)) {
+ strcat(ret,"a");
+ x0=x2-xo;
+ y0=y2-yo;
+ } else
+ break;
+ }
+ if (suffix)
+ strcat(ret,suffix);
+}
+
+static void
+tile_bbox(char *tile, struct rect *r)
+{
+ struct coord c;
+ int xo,yo;
+ *r=world_bbox;
+ while (*tile) {
+ c.x=(r->l.x+r->h.x)/2;
+ c.y=(r->l.y+r->h.y)/2;
+ xo=(r->h.x-r->l.x)*overlap/100;
+ yo=(r->h.y-r->l.y)*overlap/100;
+ switch (*tile) {
+ case 'a':
+ r->l.x=c.x-xo;
+ r->l.y=c.y-yo;
+ break;
+ case 'b':
+ r->h.x=c.x+xo;
+ r->l.y=c.y-yo;
+ break;
+ case 'c':
+ r->l.x=c.x-xo;
+ r->h.y=c.y+yo;
+ break;
+ case 'd':
+ r->h.x=c.x+xo;
+ r->h.y=c.y+yo;
+ break;
+ }
+ tile++;
+ }
+}
+
+static int
+tile_len(char *tile)
+{
+ int ret=0;
+ while (tile[0] >= 'a' && tile[0] <= 'd') {
+ tile++;
+ ret++;
+ }
+ return ret;
+}
+
+GHashTable *tile_hash;
+GHashTable *tile_hash2;
+
+static void
+tile_extend(char *tile, struct item_bin *ib, GList **tiles_list)
+{
+ struct tile_head *th=NULL;
+ if (debug_tile(tile))
+ fprintf(stderr,"Tile:Writing %d bytes to '%s' (%p,%p)\n", (ib->len+1)*4, tile, g_hash_table_lookup(tile_hash, tile), tile_hash2 ? g_hash_table_lookup(tile_hash2, tile) : NULL);
+ if (tile_hash2)
+ th=g_hash_table_lookup(tile_hash2, tile);
+ if (!th)
+ th=g_hash_table_lookup(tile_hash, tile);
+ if (! th) {
+ th=malloc(sizeof(struct tile_head)+ sizeof( char* ) );
+ assert(th != NULL);
+ // strcpy(th->subtiles, tile);
+ th->num_subtiles=1;
+ th->total_size=0;
+ th->total_size_used=0;
+ th->zipnum=0;
+ th->zip_data=NULL;
+ th->name=string_hash_lookup(tile);
+ *th_get_subtile( th, 0 ) = th->name;
+
+ if (tile_hash2)
+ g_hash_table_insert(tile_hash2, string_hash_lookup( th->name ), th);
+ if (tiles_list)
+ *tiles_list=g_list_append(*tiles_list, string_hash_lookup( th->name ) );
+ processed_tiles++;
+ if (debug_tile(tile))
+ fprintf(stderr,"new '%s'\n", tile);
+ }
+ th->total_size+=ib->len*4+4;
+ if (debug_tile(tile))
+ fprintf(stderr,"New total size of %s(%p):%d\n", th->name, th, th->total_size);
+ g_hash_table_insert(tile_hash, string_hash_lookup( th->name ), th);
+}
+
+static int
+tile_data_size(char *tile)
+{
+ struct tile_head *th;
+ th=g_hash_table_lookup(tile_hash, tile);
+ if (! th)
+ return 0;
+ return th->total_size;
+}
+
+static int
+merge_tile(char *base, char *sub)
+{
+ struct tile_head *thb, *ths;
+ thb=g_hash_table_lookup(tile_hash, base);
+ ths=g_hash_table_lookup(tile_hash, sub);
+ if (! ths)
+ return 0;
+ if (debug_tile(base) || debug_tile(sub))
+ fprintf(stderr,"merging '%s'(%p) (%d) with '%s'(%p) (%d)\n", base, thb, thb ? thb->total_size : 0, sub, ths, ths->total_size);
+ if (! thb) {
+ thb=ths;
+ g_hash_table_remove(tile_hash, sub);
+ thb->name=string_hash_lookup(base);
+ g_hash_table_insert(tile_hash, string_hash_lookup( thb->name ), thb);
+
+ } else {
+ thb=realloc(thb, sizeof(struct tile_head)+( ths->num_subtiles+thb->num_subtiles ) * sizeof( char*) );
+ assert(thb != NULL);
+ memcpy( th_get_subtile( thb, thb->num_subtiles ), th_get_subtile( ths, 0 ), ths->num_subtiles * sizeof( char*) );
+ thb->num_subtiles+=ths->num_subtiles;
+ thb->total_size+=ths->total_size;
+ g_hash_table_insert(tile_hash, string_hash_lookup( thb->name ), thb);
+ g_hash_table_remove(tile_hash, sub);
+ g_free(ths);
+ }
+ return 1;
+}
+
+
+static void
+get_tiles_list_func(char *key, struct tile_head *th, GList **list)
+{
+ *list=g_list_prepend(*list, key);
+}
+
+static GList *
+get_tiles_list(void)
+{
+ GList *ret=NULL;
+ g_hash_table_foreach(tile_hash, (GHFunc)get_tiles_list_func, &ret);
+ return ret;
+}
+
+#if 0
+static void
+write_tile(char *key, struct tile_head *th, gpointer dummy)
+{
+ FILE *f;
+ char buffer[1024];
+ fprintf(stderr,"DEBUG: Writing %s\n", key);
+ strcpy(buffer,"tiles/");
+ strcat(buffer,key);
+#if 0
+ strcat(buffer,".bin");
+#endif
+ f=fopen(buffer, "wb+");
+ while (th) {
+ fwrite(th->data, th->size, 1, f);
+ th=th->next;
+ }
+ fclose(f);
+}
+#endif
+
+static void
+write_item(char *tile, struct item_bin *ib)
+{
+ struct tile_head *th;
+ int size;
+
+ th=g_hash_table_lookup(tile_hash2, tile);
+ if (! th)
+ th=g_hash_table_lookup(tile_hash, tile);
+ if (th) {
+ if (th->process != 0 && th->process != 1) {
+ fprintf(stderr,"error with tile '%s' of length %d\n", tile, (int)strlen(tile));
+ abort();
+ }
+ if (! th->process)
+ return;
+ if (debug_tile(tile))
+ fprintf(stderr,"Data:Writing %d bytes to '%s' (%p,%p)\n", (ib->len+1)*4, tile, g_hash_table_lookup(tile_hash, tile), tile_hash2 ? g_hash_table_lookup(tile_hash2, tile) : NULL);
+ size=(ib->len+1)*4;
+ if (th->total_size_used+size > th->total_size) {
+ fprintf(stderr,"Overflow in tile %s (used %d max %d item %d)\n", tile, th->total_size_used, th->total_size, size);
+ exit(1);
+ return;
+ }
+ memcpy(th->zip_data+th->total_size_used, ib, size);
+ th->total_size_used+=size;
+ } else {
+ fprintf(stderr,"no tile hash found for %s\n", tile);
+ exit(1);
+ }
+}
+
+static void
+write_item_part(FILE *out, FILE *out_graph, struct item_bin *orig, int first, int last)
+{
+ struct item_bin new;
+ struct coord *c=(struct coord *)(orig+1);
+ char *attr=(char *)(c+orig->clen/2);
+ int attr_len=orig->len-orig->clen-2;
+ processed_ways++;
+ new.type=orig->type;
+ new.clen=(last-first+1)*2;
+ new.len=new.clen+attr_len+2;
+#if 0
+ fprintf(stderr,"first %d last %d type 0x%x len %d clen %d attr_len %d\n", first, last, new.type, new.len, new.clen, attr_len);
+#endif
+ fwrite(&new, sizeof(new), 1, out);
+ fwrite(c+first, new.clen*4, 1, out);
+ fwrite(attr, attr_len*4, 1, out);
+#if 0
+ fwrite(&new, sizeof(new), 1, out_graph);
+ fwrite(c+first, new.clen*4, 1, out_graph);
+ fwrite(attr, attr_len*4, 1, out_graph);
+#endif
+}
+
+static int
+phase2(FILE *in, FILE *out, FILE *out_graph, FILE *out_coastline, int final)
+{
+ struct coord *c;
+ int i,ccount,last,remaining;
+ osmid ndref;
+ struct item_bin *ib;
+ struct node_item *ni;
+
+ processed_nodes=processed_nodes_out=processed_ways=processed_relations=processed_tiles=0;
+ sig_alrm(0);
+ while ((ib=read_item(in))) {
+#if 0
+ fprintf(stderr,"type 0x%x len %d clen %d\n", ib->type, ib->len, ib->clen);
+#endif
+ ccount=ib->clen/2;
+ if (ccount <= 1)
+ continue;
+ c=(struct coord *)(ib+1);
+ last=0;
+ for (i = 0 ; i < ccount ; i++) {
+ if (IS_REF(c[i])) {
+ ndref=REF(c[i]);
+ ni=node_item_get(ndref);
+ if (ni) {
+ c[i]=ni->c;
+ if (ni->ref_way > 1 && i != 0 && i != ccount-1 && i != last && item_get_default_flags(ib->type)) {
+ write_item_part(out, out_graph, ib, last, i);
+ last=i;
+ }
+ } else if (final) {
+ fprintf(stderr,"Non-existing node %Ld referenced from way %Ld\n", (long long)ndref, item_bin_get_wayid(ib));
+ remaining=(ib->len+1)*4-sizeof(struct item_bin)-i*sizeof(struct coord);
+ memmove(&c[i], &c[i+1], remaining);
+ ib->clen-=2;
+ ib->len-=2;
+ i--;
+ ccount--;
+ }
+ }
+ }
+ if (ccount) {
+ write_item_part(out, out_graph, ib, last, ccount-1);
+ if (final && ib->type == type_water_line && out_coastline) {
+ write_item_part(out_coastline, NULL, ib, last, ccount-1);
+ }
+ }
+ }
+ sig_alrm(0);
+#ifndef _WIN32
+ alarm(0);
+#endif
+ return 0;
+}
+
+struct tile_info {
+ int write;
+ int maxlen;
+ char *suffix;
+ GList **tiles_list;
+ FILE *tilesdir_out;
+};
+
+struct zip_info {
+ int zipnum;
+ int dir_size;
+ long long offset;
+ int compression_level;
+ int maxnamelen;
+ FILE *res;
+ FILE *index;
+ FILE *dir;
+};
+
+static void write_zipmember(struct zip_info *zip_info, char *name, int filelen, char *data, int data_size);
+
+static void
+tile_write_item_to_tile(struct tile_info *info, struct item_bin *ib, char *name)
+{
+ if (info->write)
+ write_item(name, ib);
+ else
+ tile_extend(name, ib, info->tiles_list);
+}
+
+static void
+tile_write_item_minmax(struct tile_info *info, struct item_bin *ib, int min, int max)
+{
+ struct rect r;
+ char buffer[1024];
+ bbox((struct coord *)(ib+1), ib->clen/2, &r);
+ buffer[0]='\0';
+ tile(&r, info->suffix, buffer, max);
+ tile_write_item_to_tile(info, ib, buffer);
+}
+
+static void
+phase34_process_file(struct tile_info *info, FILE *in)
+{
+ struct item_bin *ib;
+ int max;
+
+ while ((ib=read_item(in))) {
+ if (ib->type < 0x80000000)
+ processed_nodes++;
+ else
+ processed_ways++;
+ max=14;
+ if (ib->type == type_street_n_lanes || ib->type == type_highway_city || ib->type == type_highway_land || ib->type == type_ramp)
+ max=8;
+ if (ib->type == type_street_3_city || ib->type == type_street_4_city || ib->type == type_street_3_land || ib->type == type_street_4_land)
+ max=12;
+ tile_write_item_minmax(info, ib, 0, max);
+ }
+}
+
+static void
+index_init(struct zip_info *info, int version)
+{
+ item_bin_init(item_bin, type_map_information);
+ item_bin_add_attr_int(item_bin, attr_version, version);
+ item_bin_write(item_bin, info->index);
+}
+
+static void
+index_submap_add(struct tile_info *info, struct tile_head *th)
+{
+ int tlen=tile_len(th->name);
+ int len=tlen;
+ char index_tile[len+1+strlen(suffix)];
+ struct rect r;
+
+ strcpy(index_tile, th->name);
+ if (len > 6)
+ len=6;
+ else
+ len=0;
+ index_tile[len]=0;
+ if (tlen)
+ strcat(index_tile, suffix);
+ tile_bbox(th->name, &r);
+
+ item_bin_init(item_bin, type_submap);
+ item_bin_add_coord_rect(item_bin, &r);
+ item_bin_add_attr_range(item_bin, attr_order, (tlen > 4)?tlen-4 : 0, 255);
+ item_bin_add_attr_int(item_bin, attr_zipfile_ref, th->zipnum);
+ tile_write_item_to_tile(info, item_bin, index_tile);
+}
+
+static int
+add_tile_hash(struct tile_head *th)
+{
+ int idx,len,maxnamelen=0;
+ char **data;
+
+#if 0
+ g_hash_table_insert(tile_hash2, string_hash_lookup( th->name ), th);
+#endif
+ for( idx = 0; idx < th->num_subtiles; idx++ ) {
+
+ data = th_get_subtile( th, idx );
+
+ if (debug_tile(data) || debug_tile(th->name)) {
+ fprintf(stderr,"Parent for '%s' is '%s'\n", *data, th->name);
+ }
+
+ g_hash_table_insert(tile_hash2, *data, th);
+
+ len = strlen( *data );
+
+ if (len > maxnamelen) {
+ maxnamelen=len;
+ }
+ }
+ return maxnamelen;
+}
+
+
+static int
+create_tile_hash(void)
+{
+ struct tile_head *th;
+ int len,maxnamelen=0;
+
+ tile_hash2=g_hash_table_new(g_str_hash, g_str_equal);
+ th=tile_head_root;
+ while (th) {
+ len=add_tile_hash(th);
+ if (len > maxnamelen)
+ maxnamelen=len;
+ th=th->next;
+ }
+ return maxnamelen;
+}
+
+static void
+create_tile_hash_list(GList *list)
+{
+ GList *next;
+ struct tile_head *th;
+
+ tile_hash2=g_hash_table_new(g_str_hash, g_str_equal);
+
+ next=g_list_first(list);
+ while (next) {
+ th=g_hash_table_lookup(tile_hash, next->data);
+ if (!th) {
+ fprintf(stderr,"No tile found for '%s'\n", (char *)(next->data));
+ }
+ add_tile_hash(th);
+ next=g_list_next(next);
+ }
+}
+
+#if 0
+static void
+destroy_tile_hash(void)
+{
+ g_hash_table_destroy(tile_hash2);
+ tile_hash2=NULL;
+}
+#endif
+
+static void write_countrydir(struct zip_info *zip_info);
+
+static void
+write_tilesdir(struct tile_info *info, struct zip_info *zip_info, FILE *out)
+{
+ int idx,len,maxlen;
+ GList *next,*tiles_list;
+ char **data;
+ struct tile_head *th,**last=NULL;
+
+ tiles_list=get_tiles_list();
+ info->tiles_list=&tiles_list;
+ if (phase == 3)
+ create_tile_hash_list(tiles_list);
+ next=g_list_first(tiles_list);
+ last=&tile_head_root;
+ maxlen=info->maxlen;
+ if (! maxlen) {
+ while (next) {
+ if (strlen(next->data) > maxlen)
+ maxlen=strlen(next->data);
+ next=g_list_next(next);
+ }
+ }
+ len=maxlen;
+ while (len >= 0) {
+#if 0
+ fprintf(stderr,"PROGRESS: collecting tiles with len=%d\n", len);
+#endif
+ next=g_list_first(tiles_list);
+ while (next) {
+ if (strlen(next->data) == len) {
+ th=g_hash_table_lookup(tile_hash, next->data);
+ if (phase == 3) {
+ *last=th;
+ last=&th->next;
+ th->next=NULL;
+ th->zipnum=zip_info->zipnum;
+ fprintf(out,"%s:%d",(char *)next->data,th->total_size);
+
+ for ( idx = 0; idx< th->num_subtiles; idx++ ){
+ data= th_get_subtile( th, idx );
+ fprintf(out,":%s", *data);
+ }
+
+ fprintf(out,"\n");
+ }
+ if (th->name[0])
+ index_submap_add(info, th);
+ zip_info->zipnum++;
+ processed_tiles++;
+ }
+ next=g_list_next(next);
+ }
+ len--;
+ }
+}
+
+static void
+merge_tiles(struct tile_info *info)
+{
+ struct tile_head *th;
+ char basetile[1024];
+ char subtile[1024];
+ GList *tiles_list_sorted,*last;
+ int i,i_min,len,size_all,size[5],size_min,work_done;
+ long long zip_size;
+
+ do {
+ tiles_list_sorted=get_tiles_list();
+ fprintf(stderr,"PROGRESS: sorting %d tiles\n", g_list_length(tiles_list_sorted));
+ tiles_list_sorted=g_list_sort(tiles_list_sorted, (GCompareFunc)strcmp);
+ fprintf(stderr,"PROGRESS: sorting %d tiles done\n", g_list_length(tiles_list_sorted));
+ last=g_list_last(tiles_list_sorted);
+ zip_size=0;
+ while (last) {
+ th=g_hash_table_lookup(tile_hash, last->data);
+ zip_size+=th->total_size;
+ last=g_list_previous(last);
+ }
+ last=g_list_last(tiles_list_sorted);
+ work_done=0;
+ while (last) {
+ processed_tiles++;
+ len=tile_len(last->data);
+ if (len >= 1) {
+ strcpy(basetile,last->data);
+ basetile[len-1]='\0';
+ strcat(basetile, info->suffix);
+ strcpy(subtile,last->data);
+ for (i = 0 ; i < 4 ; i++) {
+ subtile[len-1]='a'+i;
+ size[i]=tile_data_size(subtile);
+ }
+ size[4]=tile_data_size(basetile);
+ size_all=size[0]+size[1]+size[2]+size[3]+size[4];
+ if (size_all < 65536 && size_all > 0 && size_all != size[4]) {
+ for (i = 0 ; i < 4 ; i++) {
+ subtile[len-1]='a'+i;
+ work_done+=merge_tile(basetile, subtile);
+ }
+ } else {
+ for (;;) {
+ size_min=size_all;
+ i_min=-1;
+ for (i = 0 ; i < 4 ; i++) {
+ if (size[i] && size[i] < size_min) {
+ size_min=size[i];
+ i_min=i;
+ }
+ }
+ if (i_min == -1)
+ break;
+ if (size[4]+size_min >= 65536)
+ break;
+ subtile[len-1]='a'+i_min;
+ work_done+=merge_tile(basetile, subtile);
+ size[4]+=size[i_min];
+ size[i_min]=0;
+ }
+ }
+ }
+ last=g_list_previous(last);
+ }
+ g_list_free(tiles_list_sorted);
+ fprintf(stderr,"PROGRESS: merged %d tiles\n", work_done);
+ } while (work_done);
+}
+
+static void
+index_country_add(struct zip_info *info, int country_id, int zipnum)
+{
+ item_bin_init(item_bin, type_countryindex);
+ item_bin_add_attr_int(item_bin, attr_country_id, country_id);
+ item_bin_add_attr_int(item_bin, attr_zipfile_ref, zipnum);
+ item_bin_write(item_bin, info->index);
+}
+
+struct aux_tile {
+ char *name;
+ char *filename;
+ int size;
+};
+
+static int
+add_aux_tile(struct zip_info *zip_info, char *name, char *filename, int size)
+{
+ struct aux_tile *at;
+ GList *l;
+ l=aux_tile_list;
+ while (l) {
+ at=l->data;
+ if (!strcmp(at->name, name)) {
+ fprintf(stderr,"exists %s vs %s\n",at->name, name);
+ return -1;
+ }
+ l=g_list_next(l);
+ }
+ at=g_new0(struct aux_tile, 1);
+ at->name=g_strdup(name);
+ at->filename=g_strdup(filename);
+ at->size=size;
+ aux_tile_list=g_list_append(aux_tile_list, at);
+ return zip_info->zipnum++;
+}
+
+static int
+write_aux_tiles(struct zip_info *zip_info)
+{
+ GList *l=aux_tile_list;
+ struct aux_tile *at;
+ char *buffer;
+ FILE *f;
+ int count=0;
+
+ while (l) {
+ at=l->data;
+ buffer=malloc(at->size);
+ assert(buffer != NULL);
+ f=fopen(at->filename,"rb");
+ assert(f != NULL);
+ fread(buffer, at->size, 1, f);
+ fclose(f);
+ write_zipmember(zip_info, at->name, zip_info->maxnamelen, buffer, at->size);
+ free(buffer);
+ count++;
+ l=g_list_next(l);
+ zip_info->zipnum++;
+ }
+ return count;
+}
+
+static void
+write_countrydir(struct zip_info *zip_info)
+{
+ int i,zipnum,num;
+ int max=11;
+ char tilename[32];
+ char filename[32];
+ char suffix[32];
+ struct country_table *co;
+ for (i = 0 ; i < sizeof(country_table)/sizeof(struct country_table) ; i++) {
+ co=&country_table[i];
+ if (co->size) {
+ num=0;
+ do {
+ tilename[0]='\0';
+ sprintf(suffix,"s%d", num);
+ num++;
+ tile(&co->r, suffix, tilename, max);
+ sprintf(filename,"country_%d.bin", co->countryid);
+ zipnum=add_aux_tile(zip_info, tilename, filename, co->size);
+ } while (zipnum == -1);
+ index_country_add(zip_info,co->countryid,zipnum);
+ }
+ }
+}
+
+static void
+write_index(struct zip_info *info)
+{
+ int size=ftell(info->index);
+ char buffer[size];
+
+ fseek(info->index, 0, SEEK_SET);
+ fread(buffer, size, 1, info->index);
+ write_zipmember(info, "index", strlen("index"), buffer, size);
+ info->zipnum++;
+}
+
+static void
+remove_countryfiles(void)
+{
+ int i;
+ char filename[32];
+ struct country_table *co;
+
+ for (i = 0 ; i < sizeof(country_table)/sizeof(struct country_table) ; i++) {
+ co=&country_table[i];
+ if (co->size) {
+ sprintf(filename,"country_%d.bin", co->countryid);
+ unlink(filename);
+ }
+ }
+}
+
+static int
+phase34(struct tile_info *info, struct zip_info *zip_info, FILE *ways_in, FILE *nodes_in)
+{
+
+ processed_nodes=processed_nodes_out=processed_ways=processed_relations=processed_tiles=0;
+ bytes_read=0;
+ sig_alrm(0);
+ if (! info->write)
+ tile_hash=g_hash_table_new(g_str_hash, g_str_equal);
+ if (ways_in)
+ phase34_process_file(info, ways_in);
+ if (nodes_in)
+ phase34_process_file(info, nodes_in);
+ if (! info->write)
+ merge_tiles(info);
+ sig_alrm(0);
+#ifndef _WIN32
+ alarm(0);
+#endif
+ write_tilesdir(info, zip_info, info->tilesdir_out);
+
+ return 0;
+
+}
+
+static void
+dump_coord(struct coord *c)
+{
+ printf("0x%x 0x%x",c->x, c->y);
+}
+
+static void
+dump(FILE *in)
+{
+ struct item_bin *ib;
+ struct coord *c;
+ struct attr_bin *a;
+ struct attr attr;
+ int *attr_start;
+ int *attr_end;
+ int i;
+ char *str;
+ while ((ib=read_item(in))) {
+ c=(struct coord *)(ib+1);
+ if (ib->type < type_line) {
+ dump_coord(c);
+ printf(" ");
+ }
+ attr_start=(int *)(ib+1)+ib->clen;
+ attr_end=(int *)ib+ib->len+1;
+ printf("type=%s", item_to_name(ib->type));
+ while (attr_start < attr_end) {
+ a=(struct attr_bin *)(attr_start);
+ attr_start+=a->len+1;
+ attr.type=a->type;
+ attr_data_set(&attr, (a+1));
+ str=attr_to_text(&attr, NULL, 1);
+ printf(" %s=\"%s\"", attr_to_name(a->type), str);
+ g_free(str);
+ }
+ printf(" debug=\"length=%d\"", ib->len);
+ printf("\n");
+ if (ib->type >= type_line) {
+ for (i = 0 ; i < ib->clen/2 ; i++) {
+ dump_coord(c+i);
+ printf("\n");
+ }
+
+ }
+ }
+}
+
+static int
+phase4(FILE *ways_in, FILE *nodes_in, char *suffix, FILE *tilesdir_out, struct zip_info *zip_info)
+{
+ struct tile_info info;
+ info.write=0;
+ info.maxlen=0;
+ info.suffix=suffix;
+ info.tiles_list=NULL;
+ info.tilesdir_out=tilesdir_out;
+ return phase34(&info, zip_info, ways_in, nodes_in);
+}
+
+static int
+compress2_int(Byte *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level)
+{
+ z_stream stream;
+ int err;
+
+ stream.next_in = (Bytef*)source;
+ stream.avail_in = (uInt)sourceLen;
+ stream.next_out = dest;
+ stream.avail_out = (uInt)*destLen;
+ if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
+
+ stream.zalloc = (alloc_func)0;
+ stream.zfree = (free_func)0;
+ stream.opaque = (voidpf)0;
+
+ err = deflateInit2(&stream, level, Z_DEFLATED, -15, 9, Z_DEFAULT_STRATEGY);
+ if (err != Z_OK) return err;
+
+ err = deflate(&stream, Z_FINISH);
+ if (err != Z_STREAM_END) {
+ deflateEnd(&stream);
+ return err == Z_OK ? Z_BUF_ERROR : err;
+ }
+ *destLen = stream.total_out;
+
+ err = deflateEnd(&stream);
+ return err;
+}
+
+static void
+write_zipmember(struct zip_info *zip_info, char *name, int filelen, char *data, int data_size)
+{
+ struct zip_lfh lfh = {
+ 0x04034b50,
+ 0x0a,
+ 0x0,
+ 0x0,
+ 0xbe2a,
+ 0x5d37,
+ 0x0,
+ 0x0,
+ 0x0,
+ filelen,
+ 0x0,
+ };
+ struct zip_cd cd = {
+ 0x02014b50,
+ 0x17,
+ 0x00,
+ 0x0a,
+ 0x00,
+ 0x0000,
+ 0x0,
+ 0xbe2a,
+ 0x5d37,
+ 0x0,
+ 0x0,
+ 0x0,
+ filelen,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x0,
+ zip_info->offset,
+ };
+ char filename[filelen+1];
+ int error,crc,len,comp_size=data_size;
+ uLongf destlen=data_size+data_size/500+12;
+ char *compbuffer;
+
+ compbuffer = malloc(destlen);
+ if (!compbuffer) {
+ fprintf(stderr, "No more memory.\n");
+ exit (1);
+ }
+
+ crc=crc32(0, NULL, 0);
+ crc=crc32(crc, (unsigned char *)data, data_size);
+#ifdef HAVE_ZLIB
+ if (zip_info->compression_level) {
+ error=compress2_int((Byte *)compbuffer, &destlen, (Bytef *)data, data_size, zip_info->compression_level);
+ if (error == Z_OK) {
+ if (destlen < data_size) {
+ data=compbuffer;
+ comp_size=destlen;
+ }
+ } else {
+ fprintf(stderr,"compress2 returned %d\n", error);
+ }
+ }
+#endif
+ lfh.zipcrc=crc;
+ lfh.zipsize=comp_size;
+ lfh.zipuncmp=data_size;
+ lfh.zipmthd=zip_info->compression_level ? 8:0;
+ cd.zipccrc=crc;
+ cd.zipcsiz=comp_size;
+ cd.zipcunc=data_size;
+ cd.zipcmthd=zip_info->compression_level ? 8:0;
+ strcpy(filename, name);
+ len=strlen(filename);
+ while (len < filelen) {
+ filename[len++]='_';
+ }
+ filename[filelen]='\0';
+ fwrite(&lfh, sizeof(lfh), 1, zip_info->res);
+ fwrite(filename, filelen, 1, zip_info->res);
+ fwrite(data, comp_size, 1, zip_info->res);
+ zip_info->offset+=sizeof(lfh)+filelen+comp_size;
+ fwrite(&cd, sizeof(cd), 1, zip_info->dir);
+ fwrite(filename, filelen, 1, zip_info->dir);
+ zip_info->dir_size+=sizeof(cd)+filelen;
+
+ free(compbuffer);
+}
+
+static int
+process_slice(FILE *ways_in, FILE *nodes_in, long long size, char *suffix, struct zip_info *zip_info)
+{
+ struct tile_head *th;
+ char *slice_data,*zip_data;
+ int zipfiles=0;
+ struct tile_info info;
+
+ slice_data=malloc(size);
+ assert(slice_data != NULL);
+ zip_data=slice_data;
+ th=tile_head_root;
+ while (th) {
+ if (th->process) {
+ th->zip_data=zip_data;
+ zip_data+=th->total_size;
+ }
+ th=th->next;
+ }
+ if (ways_in)
+ fseek(ways_in, 0, SEEK_SET);
+ if (nodes_in)
+ fseek(nodes_in, 0, SEEK_SET);
+ info.write=1;
+ info.maxlen=zip_info->maxnamelen;
+ info.suffix=suffix;
+ info.tiles_list=NULL;
+ info.tilesdir_out=NULL;
+ phase34(&info, zip_info, ways_in, nodes_in);
+
+ th=tile_head_root;
+ while (th) {
+ if (th->process) {
+ if (th->name[0]) {
+ if (th->total_size != th->total_size_used) {
+ fprintf(stderr,"Size error '%s': %d vs %d\n", th->name, th->total_size, th->total_size_used);
+ exit(1);
+ }
+ write_zipmember(zip_info, th->name, zip_info->maxnamelen, th->zip_data, th->total_size);
+ zipfiles++;
+ } else
+ fwrite(th->zip_data, th->total_size, 1, zip_info->index);
+ }
+ th=th->next;
+ }
+ free(slice_data);
+
+ return zipfiles;
+}
+
+static void
+cat(FILE *in, FILE *out)
+{
+ size_t size;
+ char buffer[4096];
+ while ((size=fread(buffer, 1, 4096, in)))
+ fwrite(buffer, 1, size, out);
+}
+
+static int
+phase5(FILE *ways_in, FILE *nodes_in, char *suffix, struct zip_info *zip_info)
+{
+ long long size;
+ int slices;
+ int zipnum,written_tiles;
+ struct tile_head *th,*th2;
+ create_tile_hash();
+
+ th=tile_head_root;
+ size=0;
+ slices=0;
+ fprintf(stderr, "Maximum slice size %Ld\n", slice_size);
+ while (th) {
+ if (size + th->total_size > slice_size) {
+ fprintf(stderr,"Slice %d is of size %Ld\n", slices, size);
+ size=0;
+ slices++;
+ }
+ size+=th->total_size;
+ th=th->next;
+ }
+ if (size)
+ fprintf(stderr,"Slice %d is of size %Ld\n", slices, size);
+ th=tile_head_root;
+ size=0;
+ slices=0;
+ while (th) {
+ th2=tile_head_root;
+ while (th2) {
+ th2->process=0;
+ th2=th2->next;
+ }
+ size=0;
+ while (th && size+th->total_size < slice_size) {
+ size+=th->total_size;
+ th->process=1;
+ th=th->next;
+ }
+ /* process_slice() modifies zip_info, but need to retain old info */
+ zipnum=zip_info->zipnum;
+ written_tiles=process_slice(ways_in, nodes_in, size, suffix, zip_info);
+ zip_info->zipnum=zipnum+written_tiles;
+ slices++;
+ }
+ return 0;
+}
+
+static int
+phase5_write_directory(struct zip_info *info)
+{
+ struct zip_eoc eoc = {
+ 0x06054b50,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x0000,
+ 0x0,
+ 0x0,
+ 0x0,
+ };
+
+ fseek(info->dir, 0, SEEK_SET);
+ cat(info->dir, info->res);
+ eoc.zipenum=info->zipnum;
+ eoc.zipecenn=info->zipnum;
+ eoc.zipecsz=info->dir_size;
+ eoc.zipeofst=info->offset;
+ fwrite(&eoc, sizeof(eoc), 1, info->res);
+ sig_alrm(0);
+#ifndef _WIN32
+ alarm(0);
+#endif
+ return 0;
+}
+
+
+
+static void
+usage(FILE *f)
+{
+ /* DEVELOPPERS : don't forget to update the manpage if you modify theses options */
+ fprintf(f,"\n");
+ fprintf(f,"osm2navit - parse osm textfile and converts to NavIt binfile format\n\n");
+ fprintf(f,"Usage :\n");
+ fprintf(f,"bzcat planet.osm.bz2 | osm2navit mymap.bin\n");
+ fprintf(f,"Available switches:\n");
+ fprintf(f,"-h (--help) : this screen\n");
+ fprintf(f,"-N (--nodes-only) : process only nodes\n");
+ fprintf(f,"-W (--ways-only) : process only ways\n");
+ fprintf(f,"-a (--attr-debug-level) : control which data is included in the debug attribute\n");
+ fprintf(f,"-c (--dump-coordinates) : dump coordinates after phase 1\n");
+#ifdef HAVE_POSTGRESQL
+ fprintf(f,"-d (--db) : get osm data out of a postgresql database with osm simple scheme and given connect string\n");
+#endif
+ fprintf(f,"-e (--end) : end at specified phase\n");
+ fprintf(f,"-k (--keep-tmpfiles) : do not delete tmp files after processing. useful to reuse them\n\n");
+ fprintf(f,"-o (--coverage) : map every street to item coverage\n");
+ fprintf(f,"-s (--start) : start at specified phase\n");
+ fprintf(f,"-i (--input-file) : specify the input file name (OSM), overrules default stdin\n");
+ fprintf(f,"-w (--dedupe-ways) : ensure no duplicate ways or nodes. useful when using several input files\n");
+ fprintf(f,"-z (--compression-level) : set the compression level\n");
+ exit(1);
+}
+
+static void
+process_binfile(FILE *in, FILE *out)
+{
+ struct item_bin *ib;
+ while ((ib=read_item(in))) {
+ fwrite(ib, (ib->len+1)*4, 1, out);
+ }
+}
+
+static struct plugins *plugins;
+
+static void add_plugin(char *path)
+{
+ struct attr **attrs;
+
+ if (! plugins)
+ plugins=plugins_new();
+ attrs=(struct attr*[]){&(struct attr){attr_path,{path}},NULL};
+ plugin_new(&(struct attr){attr_plugins,.u.plugins=plugins}, attrs);
+}
+
+static FILE *
+tempfile(char *suffix, char *name, int write)
+{
+ char buffer[4096];
+ sprintf(buffer,"%s_%s.tmp",name, suffix);
+ return fopen(buffer,write ? "wb+": "rb");
+}
+
+static void
+tempfile_unlink(char *suffix, char *name)
+{
+ char buffer[4096];
+ sprintf(buffer,"%s_%s.tmp",name, suffix);
+ unlink(buffer);
+}
+
+static void
+tempfile_rename(char *suffix, char *from, char *to)
+{
+ char buffer_from[4096],buffer_to[4096];
+ sprintf(buffer_from,"%s_%s.tmp",from,suffix);
+ sprintf(buffer_to,"%s_%s.tmp",to,suffix);
+ assert(rename(buffer_from, buffer_to) == 0);
+
+}
+
+int main(int argc, char **argv)
+{
+ FILE *ways=NULL,*ways_split=NULL,*nodes=NULL,*turn_restrictions=NULL,*graph=NULL,*coastline=NULL,*tilesdir;
+ char *map=g_strdup(attrmap);
+ int zipnum,c,start=1,end=99,dump_coordinates=0;
+ int keep_tmpfiles=0;
+ int process_nodes=1, process_ways=1;
+#ifdef HAVE_ZLIB
+ int compression_level=9;
+#else
+ int compression_level=0;
+#endif
+ int output=0;
+ int input=0;
+ char *result;
+#ifdef HAVE_POSTGRESQL
+ char *dbstr=NULL;
+#endif
+ FILE* input_file = stdin;
+ struct attr **attrs;
+ struct map *map_handle=NULL;
+#if 0
+ char *suffixes[]={"m0l0", "m0l1","m0l2","m0l3","m0l4","m0l5","m0l6"};
+#else
+ char *suffixes[]={""};
+#endif
+ int suffix_count=sizeof(suffixes)/sizeof(char *);
+ int i;
+ main_init(argv[0]);
+ struct zip_info zip_info;
+
+ while (1) {
+#if 0
+ int this_option_optind = optind ? optind : 1;
+#endif
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"attr-debug-level", 1, 0, 'a'},
+ {"binfile", 0, 0, 'b'},
+ {"compression-level", 1, 0, 'z'},
+ {"coverage", 0, 0, 'o'},
+#ifdef HAVE_POSTGRESQL
+ {"db", 1, 0, 'd'},
+#endif
+ {"dedupe-ways", 0, 0, 'w'},
+ {"dump", 0, 0, 'D'},
+ {"dump-coordinates", 0, 0, 'c'},
+ {"end", 1, 0, 'e'},
+ {"help", 0, 0, 'h'},
+ {"keep-tmpfiles", 0, 0, 'k'},
+ {"nodes-only", 0, 0, 'N'},
+ {"map", 1, 0, 'm'},
+ {"plugin", 1, 0, 'p'},
+ {"start", 1, 0, 's'},
+ {"input-file", 1, 0, 'i'},
+ {"ignore-unknown", 0, 0, 'n'},
+ {"ways-only", 0, 0, 'W'},
+ {"slice-size", 1, 0, 'S'},
+ {0, 0, 0, 0}
+ };
+ c = getopt_long (argc, argv, "DNWS:a:bc"
+#ifdef HAVE_POSTGRESQL
+ "d:"
+#endif
+ "e:hi:knm:p:s:wz:", long_options, &option_index);
+ if (c == -1)
+ break;
+ switch (c) {
+ case 'D':
+ output=1;
+ break;
+ case 'N':
+ process_ways=0;
+ break;
+ case 'S':
+ slice_size=atoll(optarg);
+ break;
+ case 'W':
+ process_nodes=0;
+ break;
+ case 'a':
+ attr_debug_level=atoi(optarg);
+ break;
+ case 'b':
+ input=1;
+ break;
+ case 'c':
+ dump_coordinates=1;
+ break;
+#ifdef HAVE_POSTGRESQL
+ case 'd':
+ dbstr=optarg;
+ break;
+#endif
+ case 'e':
+ end=atoi(optarg);
+ break;
+ case 'h':
+ usage(stdout);
+ break;
+ case 'm':
+ attrs=(struct attr*[]){
+ &(struct attr){attr_type,{"textfile"}},
+ &(struct attr){attr_data,{optarg}},
+ NULL};
+ add_plugin("$NAVIT_LIBDIR/*/${NAVIT_LIBPREFIX}libmap_textfile.so");
+ map_handle=map_new(NULL, attrs);
+ break;
+ case 'n':
+ fprintf(stderr,"I will IGNORE unknown types\n");
+ ignore_unkown=1;
+ break;
+ case 'k':
+ fprintf(stderr,"I will KEEP tmp files\n");
+ keep_tmpfiles=1;
+ break;
+ case 'o':
+ coverage=1;
+ break;
+ case 'p':
+ add_plugin(optarg);
+ break;
+ case 's':
+ start=atoi(optarg);
+ break;
+ case 'w':
+ dedupe_ways_hash=g_hash_table_new(NULL, NULL);
+ break;
+ case 'i':
+ input_file = fopen( optarg, "r" );
+ if ( input_file == NULL )
+ {
+ fprintf( stderr, "\nInput file (%s) not found\n", optarg );
+ exit( -1 );
+ }
+ break;
+#ifdef HAVE_ZLIB
+ case 'z':
+ compression_level=atoi(optarg);
+ break;
+#endif
+ case '?':
+ usage(stderr);
+ break;
+ default:
+ fprintf(stderr,"c=%d\n", c);
+ }
+
+ }
+ if (optind != argc-(output == 1 ? 0:1))
+ usage(stderr);
+ if (plugins)
+ plugins_init(plugins);
+ result=argv[optind];
+ build_attrmap(map);
+ build_countrytable();
+
+
+ if (input == 0) {
+ if (start == 1) {
+ unlink("coords.tmp");
+ if (process_ways)
+ ways=tempfile(suffix,"ways",1);
+ if (process_nodes)
+ nodes=tempfile(suffix,"nodes",1);
+ if (process_ways && process_nodes)
+ turn_restrictions=tempfile(suffix,"turn_restrictions",1);
+ phase=1;
+ fprintf(stderr,"PROGRESS: Phase 1: collecting data\n");
+#ifdef HAVE_POSTGRESQL
+ if (dbstr)
+ phase1_db(dbstr,ways,nodes);
+ else
+#endif
+ if (map_handle) {
+ phase1_map(map_handle,ways,nodes);
+ map_destroy(map_handle);
+ }
+ else
+ phase1(input_file,ways,nodes,turn_restrictions);
+ if (slices) {
+ fprintf(stderr,"%d slices\n",slices);
+ flush_nodes(1);
+ for (i = slices-2 ; i>=0 ; i--) {
+ fprintf(stderr, "slice %d of %d\n",slices-i-1,slices-1);
+ load_buffer("coords.tmp",&node_buffer, i*slice_size, slice_size);
+ resolve_ways(ways, NULL);
+ save_buffer("coords.tmp",&node_buffer, i*slice_size);
+ }
+ }
+ if (ways)
+ fclose(ways);
+ if (nodes)
+ fclose(nodes);
+ if (turn_restrictions)
+ fclose(turn_restrictions);
+ }
+ if (!slices) {
+ if (end == 1 || dump_coordinates)
+ flush_nodes(1);
+ else
+ slices++;
+ }
+ if (end == 1)
+ exit(0);
+ if (start == 2) {
+ load_buffer("coords.tmp",&node_buffer,0, slice_size);
+ }
+ if (start <= 2) {
+ if (process_ways) {
+ ways=tempfile(suffix,"ways",0);
+ phase=2;
+ fprintf(stderr,"PROGRESS: Phase 2: finding intersections\n");
+ for (i = 0 ; i < slices ; i++) {
+ int final=(i >= slices-1);
+ ways_split=tempfile(suffix,"ways_split",1);
+ graph=tempfile(suffix,"graph",1);
+ /* coastline=tempfile(suffix,"coastline",1); */
+ if (i)
+ load_buffer("coords.tmp",&node_buffer, i*slice_size, slice_size);
+ phase2(ways,ways_split,graph,coastline,final);
+ fclose(ways_split);
+ fclose(ways);
+ fclose(graph);
+ if (! final) {
+ tempfile_rename(suffix,"ways_split","ways_to_resolve");
+ ways=tempfile(suffix,"ways_to_resolve",0);
+ }
+ }
+ if(!keep_tmpfiles)
+ tempfile_unlink(suffix,"ways");
+ tempfile_unlink(suffix,"ways_to_resolve");
+ } else
+ fprintf(stderr,"PROGRESS: Skipping Phase 2\n");
+ }
+ free(node_buffer.base);
+ node_buffer.base=NULL;
+ node_buffer.malloced=0;
+ node_buffer.size=0;
+ if (end == 2)
+ exit(0);
+ } else {
+ ways_split=tempfile(suffix,"ways_split",0);
+ process_binfile(stdin, ways_split);
+ fclose(ways_split);
+ }
+ if (start <= 3) {
+ fprintf(stderr,"PROGRESS: Phase 3: sorting countries\n");
+ sort_countries(keep_tmpfiles);
+ }
+ if (end == 3)
+ exit(0);
+ if (output == 1) {
+ fprintf(stderr,"PROGRESS: Phase 4: dumping\n");
+ if (process_nodes) {
+ nodes=tempfile(suffix,"nodes",0);
+ if (nodes) {
+ dump(nodes);
+ fclose(nodes);
+ }
+ }
+ if (process_ways) {
+ ways_split=tempfile(suffix,"ways_split",0);
+ if (ways_split) {
+ dump(ways_split);
+ fclose(ways_split);
+ }
+ }
+ if (process_ways && process_nodes) {
+ turn_restrictions=tempfile(suffix,"turn_restrictions",0);
+ if (turn_restrictions) {
+ dump(turn_restrictions);
+ fclose(turn_restrictions);
+ }
+ }
+ exit(0);
+ }
+ for (i = 0 ; i < suffix_count ; i++) {
+ suffix=suffixes[i];
+ if (start <= 4) {
+ phase=3;
+ if (i == 0) {
+ memset(&zip_info, 0, sizeof(zip_info));
+ }
+ zipnum=zip_info.zipnum;
+ fprintf(stderr,"PROGRESS: Phase 4: generating tiles %s\n",suffix);
+ if (process_ways)
+ ways_split=tempfile(suffix,"ways_split",0);
+ if (process_nodes)
+ nodes=tempfile(suffix,"nodes",0);
+ tilesdir=tempfile(suffix,"tilesdir",1);
+ phase4(ways_split,nodes,suffix,tilesdir,&zip_info);
+ fclose(tilesdir);
+ if (nodes)
+ fclose(nodes);
+ if (ways_split)
+ fclose(ways_split);
+ zip_info.zipnum=zipnum;
+ }
+ if (end == 4)
+ exit(0);
+ if (start <= 5) {
+ phase=4;
+ fprintf(stderr,"PROGRESS: Phase 5: assembling map %s\n",suffix);
+ if (process_ways)
+ ways_split=tempfile(suffix,"ways_split",0);
+ if (process_nodes)
+ nodes=tempfile(suffix,"nodes",0);
+ if (i == 0) {
+ zip_info.dir_size=0;
+ zip_info.offset=0;
+ zip_info.maxnamelen=14+strlen(suffixes[0]);
+ zip_info.compression_level=compression_level;
+ zip_info.zipnum=0;
+ zip_info.dir=tempfile("zipdir","",1);
+ zip_info.index=tempfile("index","",1);
+ zip_info.res=fopen(result,"wb+");
+ index_init(&zip_info, 1);
+ }
+ phase5(ways_split,nodes,suffix,&zip_info);
+ if (nodes)
+ fclose(nodes);
+ if (ways_split)
+ fclose(ways_split);
+ if(!keep_tmpfiles) {
+ tempfile_unlink(suffix,"nodes");
+ tempfile_unlink(suffix,"ways_split");
+ tempfile_unlink(suffix,"turn_restrictions");
+ tempfile_unlink(suffix,"graph");
+ tempfile_unlink(suffix,"tilesdir");
+ tempfile_unlink("zipdir","");
+ unlink("coords.tmp");
+ }
+ if (i == suffix_count-1) {
+ zipnum=zip_info.zipnum;
+ write_countrydir(&zip_info);
+ zip_info.zipnum=zipnum;
+ write_aux_tiles(&zip_info);
+ write_index(&zip_info);
+ phase5_write_directory(&zip_info);
+ fclose(zip_info.index);
+ fclose(zip_info.dir);
+ fclose(zip_info.res);
+ if (!keep_tmpfiles) {
+ remove_countryfiles();
+ tempfile_unlink("index","");
+ }
+ }
+ }
+ }
+ return 0;
+}
diff --git a/param.c b/param.c
new file mode 100644
index 00000000..522f19fc
--- /dev/null
+++ b/param.c
@@ -0,0 +1,65 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "param.h"
+
+void
+param_add_string(char *name, char *value, struct param_list **param, int *count)
+{
+ if (*count > 0) {
+ (*param)->name=malloc(strlen(value)+strlen(name)+2);
+ (*param)->value=(*param)->name+strlen(name)+1;
+ strcpy((*param)->name, name);
+ strcpy((*param)->value, value);
+ (*count)--;
+ (*param)++;
+ }
+
+}
+
+void
+param_add_dec(char *name, unsigned long value, struct param_list **param, int *count)
+{
+ char buffer[1024];
+ sprintf(buffer, "%ld", value);
+ param_add_string(name, buffer, param, count);
+}
+
+
+void
+param_add_hex(char *name, unsigned long value, struct param_list **param, int *count)
+{
+ char buffer[1024];
+ sprintf(buffer, "0x%lx", value);
+ param_add_string(name, buffer, param, count);
+}
+
+void
+param_add_hex_sig(char *name, long value, struct param_list **param, int *count)
+{
+ char buffer[1024];
+ if (value < 0)
+ sprintf(buffer, "-0x%lx", -value);
+ else
+ sprintf(buffer, "0x%lx", value);
+ param_add_string(name, buffer, param, count);
+}
diff --git a/param.h b/param.h
new file mode 100644
index 00000000..d89e2583
--- /dev/null
+++ b/param.h
@@ -0,0 +1,34 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_PARAM_H
+#define NAVIT_PARAM_H
+
+struct param_list {
+ char *name;
+ char *value;
+};
+
+void param_add_string(char *name, char *value, struct param_list **param, int *count);
+void param_add_dec(char *name, unsigned long value, struct param_list **param, int *count);
+void param_add_hex(char *name, unsigned long value, struct param_list **param, int *count);
+void param_add_hex_sig(char *name, long value, struct param_list **param, int *count);
+
+#endif
+
diff --git a/phrase.c b/phrase.c
new file mode 100644
index 00000000..9c7edaaa
--- /dev/null
+++ b/phrase.c
@@ -0,0 +1,53 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <time.h>
+#include <glib.h>
+#include "coord.h"
+#include "item.h"
+#include "route.h"
+#include "speech.h"
+#include "phrase.h"
+
+void
+phrase_route_calc(void *speech)
+{
+#if 0
+ if (! speech)
+ return;
+ speech_say(speech,"Die Route wird berechnet\n");
+#endif
+}
+
+void
+phrase_route_calculated(void *speech, void *route)
+{
+#if 0
+ struct tm *eta;
+#endif
+ if (! speech)
+ return;
+
+#if 0 /* FIXME */
+ eta=route_get_eta(route);
+
+ speech_sayf(speech,"Die Route wurde berechnet, geschätzte Ankunftszeit %d Uhr %d Entfernung %4.0f Kilometer", eta->tm_hour,eta->tm_min,route_get_len(route)/1000);
+#endif
+
+}
diff --git a/phrase.h b/phrase.h
new file mode 100644
index 00000000..d184b379
--- /dev/null
+++ b/phrase.h
@@ -0,0 +1,27 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_PHRASE_H
+#define NAVIT_PHRASE_H
+
+void phrase_route_calc(void *speech);
+void phrase_route_calculated(void *speech, void *route);
+
+#endif
+
diff --git a/plugin.c b/plugin.c
new file mode 100644
index 00000000..5961dd84
--- /dev/null
+++ b/plugin.c
@@ -0,0 +1,358 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <string.h>
+#include <glib.h>
+#include "config.h"
+#ifdef USE_PLUGINS
+#ifdef HAVE_GMODULE
+#include <gmodule.h>
+#else
+#include <dlfcn.h>
+#endif
+#endif
+#include "plugin.h"
+#include "file.h"
+#define PLUGIN_C
+#include "plugin.h"
+#include "item.h"
+#include "debug.h"
+
+#ifdef USE_PLUGINS
+#ifndef HAVE_GMODULE
+typedef void * GModule;
+#define G_MODULE_BIND_LOCAL 1
+#define G_MODULE_BIND_LAZY 2
+static int
+g_module_supported(void)
+{
+ return 1;
+}
+
+static void *
+g_module_open(char *name, int flags)
+{
+ return dlopen(name,
+ (flags & G_MODULE_BIND_LAZY ? RTLD_LAZY : RTLD_NOW) |
+ (flags & G_MODULE_BIND_LOCAL ? RTLD_LOCAL : RTLD_GLOBAL));
+}
+
+static char *
+g_module_error(void)
+{
+ return dlerror();
+}
+
+static int
+g_module_symbol(GModule *handle, char *symbol, gpointer *addr)
+{
+ *addr=dlsym(handle, symbol);
+ return (*addr != NULL);
+}
+
+static void
+g_module_close(GModule *handle)
+{
+ dlclose(handle);
+}
+
+#endif
+#endif
+
+struct plugin {
+ int active;
+ int lazy;
+ int ondemand;
+ char *name;
+#ifdef USE_PLUGINS
+ GModule *mod;
+#endif
+ void (*init)(void);
+};
+
+struct plugins {
+ GHashTable *hash;
+ GList *list;
+} *pls;
+
+static struct plugin *
+plugin_new_from_path(char *plugin)
+{
+#ifdef USE_PLUGINS
+ struct plugin *ret;
+ if (! g_module_supported()) {
+ return NULL;
+ }
+ ret=g_new0(struct plugin, 1);
+ ret->name=g_strdup(plugin);
+ return ret;
+#else
+ return NULL;
+#endif
+}
+
+int
+plugin_load(struct plugin *pl)
+{
+#ifdef USE_PLUGINS
+ gpointer init;
+
+ GModule *mod;
+
+ if (pl->mod) {
+ dbg(0,"can't load '%s', already loaded\n", pl->name);
+ return 0;
+ }
+ mod=g_module_open(pl->name, G_MODULE_BIND_LOCAL | (pl->lazy ? G_MODULE_BIND_LAZY : 0));
+ if (! mod) {
+ dbg(0,"can't load '%s', Error '%s'\n", pl->name, g_module_error());
+ return 0;
+ }
+ if (!g_module_symbol(mod, "plugin_init", &init)) {
+ dbg(0,"can't load '%s', plugin_init not found\n", pl->name);
+ g_module_close(mod);
+ return 0;
+ } else {
+ pl->mod=mod;
+ pl->init=init;
+ }
+ return 1;
+#else
+ return 0;
+#endif
+}
+
+char *
+plugin_get_name(struct plugin *pl)
+{
+ return pl->name;
+}
+
+int
+plugin_get_active(struct plugin *pl)
+{
+ return pl->active;
+}
+
+void
+plugin_set_active(struct plugin *pl, int active)
+{
+ pl->active=active;
+}
+
+void
+plugin_set_lazy(struct plugin *pl, int lazy)
+{
+ pl->lazy=lazy;
+}
+
+#ifdef USE_PLUGINS
+static int
+plugin_get_ondemand(struct plugin *pl)
+{
+ return pl->ondemand;
+}
+#endif
+
+static void
+plugin_set_ondemand(struct plugin *pl, int ondemand)
+{
+ pl->ondemand=ondemand;
+}
+
+void
+plugin_call_init(struct plugin *pl)
+{
+ pl->init();
+}
+
+void
+plugin_unload(struct plugin *pl)
+{
+#ifdef USE_PLUGINS
+ g_module_close(pl->mod);
+ pl->mod=NULL;
+#endif
+}
+
+void
+plugin_destroy(struct plugin *pl)
+{
+ g_free(pl);
+}
+
+struct plugins *
+plugins_new(void)
+{
+ struct plugins *ret=g_new0(struct plugins, 1);
+ ret->hash=g_hash_table_new(g_str_hash, g_str_equal);
+ pls=ret;
+ return ret;
+}
+
+struct plugin *
+plugin_new(struct attr *parent, struct attr **attrs) {
+#ifdef USE_PLUGINS
+ struct attr *path_attr, *attr;
+ struct file_wordexp *we;
+ int active=1; // default active
+ int lazy=0, ondemand=0;
+ int i, count;
+ char **array;
+ char *name;
+ struct plugin *pl=NULL;
+ struct plugins *pls;
+
+ pls=parent->u.plugins;
+
+ if (! (path_attr=attr_search(attrs, NULL, attr_path))) {
+ dbg(0,"missing path\n");
+ return NULL;
+ }
+ if ( (attr=attr_search(attrs, NULL, attr_active))) {
+ active=attr->u.num;
+ }
+ if ( (attr=attr_search(attrs, NULL, attr_lazy))) {
+ lazy=attr->u.num;
+ }
+ if ( (attr=attr_search(attrs, NULL, attr_ondemand))) {
+ ondemand=attr->u.num;
+ }
+ dbg(1, "path=\"%s\", active=%d, lazy=%d, ondemand=%d\n",path_attr->u.str, active, lazy, ondemand);
+
+ we=file_wordexp_new(path_attr->u.str);
+ count=file_wordexp_get_count(we);
+ array=file_wordexp_get_array(we);
+ dbg(2,"expanded to %d words\n",count);
+ if (count != 1 || file_exists(array[0])) {
+ for (i = 0 ; i < count ; i++) {
+ name=array[i];
+ dbg(2,"name[%d]='%s'\n", i, name);
+ if (! (pl=g_hash_table_lookup(pls->hash, name))) {
+ pl=plugin_new_from_path(name);
+ if (! pl) {
+ dbg(0,"failed to create plugin '%s'\n", name);
+ continue;
+ }
+ g_hash_table_insert(pls->hash, plugin_get_name(pl), pl);
+ pls->list=g_list_append(pls->list, pl);
+ } else {
+ pls->list=g_list_remove(pls->list, pl);
+ pls->list=g_list_append(pls->list, pl);
+ }
+ plugin_set_active(pl, active);
+ plugin_set_lazy(pl, lazy);
+ plugin_set_ondemand(pl, ondemand);
+ }
+ file_wordexp_destroy(we);
+ }
+ return pl;
+#endif
+}
+
+void
+plugins_init(struct plugins *pls)
+{
+#ifdef USE_PLUGINS
+ struct plugin *pl;
+ GList *l;
+
+ l=pls->list;
+ while (l) {
+ pl=l->data;
+ if (! plugin_get_ondemand(pl)) {
+ if (plugin_get_active(pl))
+ if (!plugin_load(pl))
+ plugin_set_active(pl, 0);
+ if (plugin_get_active(pl))
+ plugin_call_init(pl);
+ }
+ l=g_list_next(l);
+ }
+#endif
+}
+
+void
+plugins_destroy(struct plugins *pls)
+{
+ GList *l;
+ struct plugin *pl;
+
+ l=pls->list;
+ while (l) {
+ pl=l->data;
+ plugin_unload(pl);
+ plugin_destroy(pl);
+ }
+ g_list_free(pls->list);
+ g_hash_table_destroy(pls->hash);
+ g_free(pls);
+}
+
+ void *
+plugin_get_type(enum plugin_type type, const char *type_name, const char *name)
+{
+ dbg(1, "type=\"%s\", name=\"%s\"\n", type_name, name);
+ GList *l,*lpls;
+ struct name_val *nv;
+ struct plugin *pl;
+ char *mod_name, *filename=NULL, *corename=NULL;
+ l=plugin_types[type];
+ while (l) {
+ nv=l->data;
+ if (!g_ascii_strcasecmp(nv->name, name))
+ return nv->val;
+ l=g_list_next(l);
+ }
+ if (!pls)
+ return NULL;
+ lpls=pls->list;
+ filename=g_strjoin("", "lib", type_name, "_", name, NULL);
+ corename=g_strjoin("", "lib", type_name, "_", "core", NULL);
+ while (lpls) {
+ pl=lpls->data;
+ if ((mod_name=g_strrstr(pl->name, "/")))
+ mod_name++;
+ else
+ mod_name=pl->name;
+ dbg(2,"compare '%s' with '%s'\n", mod_name, filename);
+ if (!g_ascii_strncasecmp(mod_name, filename, strlen(filename)) || !g_ascii_strncasecmp(mod_name, corename, strlen(corename))) {
+ dbg(1, "Loading module \"%s\"\n",pl->name) ;
+ if (plugin_get_active(pl))
+ if (!plugin_load(pl))
+ plugin_set_active(pl, 0);
+ if (plugin_get_active(pl))
+ plugin_call_init(pl);
+ l=plugin_types[type];
+ while (l) {
+ nv=l->data;
+ if (!g_ascii_strcasecmp(nv->name, name)) {
+ g_free(filename);
+ g_free(corename);
+ return nv->val;
+ }
+ l=g_list_next(l);
+ }
+ }
+ lpls=g_list_next(lpls);
+ }
+ g_free(filename);
+ g_free(corename);
+ return NULL;
+}
diff --git a/plugin.h b/plugin.h
new file mode 100644
index 00000000..4182bd36
--- /dev/null
+++ b/plugin.h
@@ -0,0 +1,158 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef PLUGIN_C
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct plugin;
+
+enum plugin_type {
+ plugin_type_graphics,
+ plugin_type_gui,
+ plugin_type_map,
+ plugin_type_osd,
+ plugin_type_speech,
+ plugin_type_vehicle,
+ plugin_type_event,
+ plugin_type_font,
+ plugin_type_last,
+};
+#endif
+
+struct container;
+struct popup;
+struct popup_item;
+#undef PLUGIN_FUNC1
+#undef PLUGIN_FUNC3
+#undef PLUGIN_FUNC4
+#undef PLUGIN_TYPE
+#define PLUGIN_PROTO(name,args...) void name(args)
+
+#ifdef PLUGIN_C
+#define PLUGIN_REGISTER(name,args...) \
+void \
+plugin_register_##name(PLUGIN_PROTO((*func),args)) \
+{ \
+ plugin_##name##_func=func; \
+}
+
+#define PLUGIN_CALL(name,args...) \
+{ \
+ if (plugin_##name##_func) \
+ (*plugin_##name##_func)(args); \
+}
+
+#define PLUGIN_FUNC1(name,t1,p1) \
+PLUGIN_PROTO((*plugin_##name##_func),t1 p1); \
+void plugin_call_##name(t1 p1) PLUGIN_CALL(name,p1) \
+PLUGIN_REGISTER(name,t1 p1)
+
+#define PLUGIN_FUNC3(name,t1,p1,t2,p2,t3,p3) \
+PLUGIN_PROTO((*plugin_##name##_func),t1 p1,t2 p2,t3 p3); \
+void plugin_call_##name(t1 p1,t2 p2, t3 p3) PLUGIN_CALL(name,p1,p2,p3) \
+PLUGIN_REGISTER(name,t1 p1,t2 p2,t3 p3)
+
+#define PLUGIN_FUNC4(name,t1,p1,t2,p2,t3,p3,t4,p4) \
+PLUGIN_PROTO((*plugin_##name##_func),t1 p1,t2 p2,t3 p3,t4 p4); \
+void plugin_call_##name(t1 p1,t2 p2, t3 p3, t4 p4) PLUGIN_CALL(name,p1,p2,p3,p4) \
+PLUGIN_REGISTER(name,t1 p1,t2 p2,t3 p3,t4 p4)
+
+struct name_val {
+ char *name;
+ void *val;
+};
+
+GList *plugin_types[plugin_type_last];
+
+#define PLUGIN_TYPE(type,newargs) \
+struct type##_priv; \
+struct type##_methods; \
+void \
+plugin_register_##type##_type(const char *name, struct type##_priv *(*new_) newargs) \
+{ \
+ struct name_val *nv; \
+ nv=g_new(struct name_val, 1); \
+ nv->name=g_strdup(name); \
+ nv->val=new_; \
+ plugin_types[plugin_type_##type]=g_list_append(plugin_types[plugin_type_##type], nv); \
+} \
+ \
+void * \
+plugin_get_##type##_type(const char *name) \
+{ \
+ return plugin_get_type(plugin_type_##type, #type, name); \
+}
+
+#else
+#define PLUGIN_FUNC1(name,t1,p1) \
+void plugin_register_##name(void(*func)(t1 p1)); \
+void plugin_call_##name(t1 p1);
+
+#define PLUGIN_FUNC3(name,t1,p1,t2,p2,t3,p3) \
+void plugin_register_##name(void(*func)(t1 p1,t2 p2,t3 p3)); \
+void plugin_call_##name(t1 p1,t2 p2,t3 p3);
+
+#define PLUGIN_FUNC4(name,t1,p1,t2,p2,t3,p3,t4,p4) \
+void plugin_register_##name(void(*func)(t1 p1,t2 p2,t3 p3,t4 p4)); \
+void plugin_call_##name(t1 p1,t2 p2,t3 p3,t4 p4);
+
+#define PLUGIN_TYPE(type,newargs) \
+struct type##_priv; \
+struct type##_methods; \
+void plugin_register_##type##_type(const char *name, struct type##_priv *(*new_) newargs); \
+void *plugin_get_##type##_type(const char *name);
+
+#endif
+
+#include "plugin_def.h"
+
+#ifndef USE_PLUGINS
+#define plugin_module_cat3(pre,mod,post) pre##mod##post
+#define plugin_module_cat2(pre,mod,post) plugin_module_cat3(pre,mod,post)
+#define plugin_module_cat(pre,post) plugin_module_cat2(pre,MODULE,post)
+#define plugin_init plugin_module_cat(module_,_init)
+#endif
+
+struct attr;
+
+/* prototypes */
+void plugin_init(void);
+int plugin_load(struct plugin *pl);
+char *plugin_get_name(struct plugin *pl);
+int plugin_get_active(struct plugin *pl);
+void plugin_set_active(struct plugin *pl, int active);
+void plugin_set_lazy(struct plugin *pl, int lazy);
+void plugin_call_init(struct plugin *pl);
+void plugin_unload(struct plugin *pl);
+void plugin_destroy(struct plugin *pl);
+struct plugins *plugins_new(void);
+struct plugin *plugin_new(struct attr *parent, struct attr ** attrs);
+void plugins_init(struct plugins *pls);
+void plugins_destroy(struct plugins *pls);
+void *plugin_get_type(enum plugin_type type, const char *type_name, const char *name);
+/* end of prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+
+
diff --git a/plugin_def.h b/plugin_def.h
new file mode 100644
index 00000000..36d49c7f
--- /dev/null
+++ b/plugin_def.h
@@ -0,0 +1,32 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+struct attr;
+struct navit;
+struct callback_list;
+PLUGIN_FUNC1(draw, struct container *, co)
+PLUGIN_FUNC3(popup, struct container *, map, struct popup *, p, struct popup_item **, list)
+PLUGIN_TYPE(graphics, (struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl))
+PLUGIN_TYPE(gui, (struct navit *nav, struct gui_methods *meth, struct attr **attrs))
+PLUGIN_TYPE(map, (struct map_methods *meth, struct attr **attrs))
+PLUGIN_TYPE(osd, (struct navit *nav, struct osd_methods *meth, struct attr **attrs))
+PLUGIN_TYPE(speech, (struct speech_methods *meth, struct attr **attrs))
+PLUGIN_TYPE(vehicle, (struct vehicle_methods *meth, struct callback_list *cbl, struct attr **attrs))
+PLUGIN_TYPE(event, (struct event_methods *meth))
+PLUGIN_TYPE(font, (void *meth))
diff --git a/po/Makefile.am b/po/Makefile.am
deleted file mode 100644
index bfac6ede..00000000
--- a/po/Makefile.am
+++ /dev/null
@@ -1,76 +0,0 @@
-CATALOGS = @MOFILES@
-
-CLEANFILES = $(CATALOGS) navit.pot
-
-# keep this sorted
-EXTRA_DIST = @POFILES@
-
-POTFILES = \
- $(top_srcdir)/navit/main.c \
- $(top_srcdir)/navit/navigation.c \
- $(top_srcdir)/navit/navit.c \
- $(top_srcdir)/navit/popup.c \
- $(top_srcdir)/navit/country.c \
- $(top_srcdir)/navit/gui/gtk/destination.c \
- $(top_srcdir)/navit/gui/gtk/gui_gtk_action.c \
- $(top_srcdir)/navit/gui/gtk/gui_gtk_statusbar.c
-
-
-SUFFIXES = .po .mo
-
-.po.mo:
- dir=`basename $@ .mo` ;\
- $(MSGFMT) --check --verbose --statistics --output-file=$@ $< && \
- mkdir -p ../locale/$$dir/LC_MESSAGES && \
- cp $@ ../locale/$$dir/LC_MESSAGES/navit.mo
-
-all: @MOFILES@
-
-@POFILES@: navit.pot
- if test "$(top_srcdir)" != "$(top_builddir)"; then \
- $(MSGMERGE) --no-fuzzy-matching --verbose -o $(top_builddir)/po/$@ $(top_srcdir)/po/$@ navit.pot; \
- else \
- $(MSGMERGE) --no-fuzzy-matching --update --verbose $@ navit.pot; \
- fi
-
-
-navit.pot: $(POTFILES)
- $(XGETTEXT) --default-domain=navit \
- --add-comments --keyword=_ --keyword=_n $(POTFILES)
- if cmp -s navit.po navit.pot; then \
- rm -f navit.po; \
- else \
- mv -f navit.po navit.pot; \
- fi
-
-install-data-local: $(CATALOGS)
- $(mkinstalldirs) $(DESTDIR)$(datadir)/locale
- chmod 755 $(DESTDIR)$(datadir)/locale
- for n in $(CATALOGS) __DuMmY ; do \
- if test "$$n" -a "$$n" != "__DuMmY" ; then \
- l=`basename $$n .mo`; \
- $(mkinstalldirs) $(DESTDIR)$(datadir)/locale/$$l/LC_MESSAGES; \
- chmod 755 $(DESTDIR)$(datadir)/locale/$$l; \
- chmod 755 $(DESTDIR)$(datadir)/locale/$$l/LC_MESSAGES; \
- $(INSTALL_DATA) -m 644 $$n $(DESTDIR)$(datadir)/locale/$$l/LC_MESSAGES/navit.mo; \
- fi; \
- done
-
-uninstall-local:
- for n in $(CATALOGS) __DuMmY ; do \
- if test "$$n" -a "$$n" != "__DuMmY" ; then \
- l=`basename $$n .mo`; \
- rm -f $(DESTDIR)$(datadir)/locale/$$l/LC_MESSAGES/navit.mo; \
- fi; \
- done
-
-distclean-local:
- for n in $(CATALOGS) __DuMmY ; do \
- if test "$$n" -a "$$n" != "__DuMmY" ; then \
- l=`basename $$n .mo`; \
- rm -f ../locale/$$l/LC_MESSAGES/navit.mo; \
- if test "$(top_srcdir)" != "$(top_builddir)"; then \
- rm -f $$l.po; \
- fi;\
- fi; \
- done
diff --git a/po/cs.po b/po/cs.po
deleted file mode 100644
index 234e7173..00000000
--- a/po/cs.po
+++ /dev/null
@@ -1,1745 +0,0 @@
-# translation of navit_cs.po to Čeština
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-#
-# Vaclav Cerny <vatoz@seznam.cz>, 2007.
-msgid ""
-msgstr ""
-"Project-Id-Version: Navit 0.1.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-05-26 17:12+0200\n"
-"PO-Revision-Date: 2008-05-27 15:21+0000\n"
-"Last-Translator: Vaclav Cerny <vatoz@seznam.cz>\n"
-"Language-Team: Čeština\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
-"X-Launchpad-Export-Date: 2008-05-30 21:28+0000\n"
-"X-Generator: Launchpad (build Unknown)\n"
-
-#, fuzzy
-#~ msgid "Turn %1$s%2$s %3$s"
-#~ msgstr "%s zaboÄte %s %s"
-
-#~ msgid "Moldova"
-#~ msgstr "Moldávie"
-
-#~ msgid "Syria"
-#~ msgstr "Sýrie"
-
-#~ msgid "Libia"
-#~ msgstr "Libie"
-
-#~ msgid "Palestinia"
-#~ msgstr "Palestina"
-
-#~ msgid "Macedonia"
-#~ msgstr "Makedonie"
-
-#~ msgid "VisibleBlocks"
-#~ msgstr "Viditelné bloky"
-
-#~ msgid "VisibleTowns"
-#~ msgstr "Viditelné města"
-
-#~ msgid "VisiblePolys"
-#~ msgstr "Viditelné mnohoúhelníky"
-
-#~ msgid "VisibleStreets"
-#~ msgstr "Viditelné silnice"
-
-#~ msgid "VisiblePoints"
-#~ msgstr "Viditelné body"
-
-#, fuzzy
-#~ msgid "RouteGraph"
-#~ msgstr "Trasa"
-
-#~ msgid "two kilometers"
-#~ msgstr "dva kilometry"
-
-#~ msgid "in two kilometers"
-#~ msgstr "za dva kilometry"
-
-#~ msgid "three kilometers"
-#~ msgstr "tři kilometry"
-
-#~ msgid "in three kilometers"
-#~ msgstr "za tři kilometry"
-
-#~ msgid "four kilometers"
-#~ msgstr "ÄtyÅ™i kilometry"
-
-#~ msgid "in four kilometers"
-#~ msgstr "za ÄtyÅ™i kilometry"
-
-#~ msgid "%d kilometers"
-#~ msgstr "%d kilometrů"
-
-#~ msgid "in %d kilometers"
-#~ msgstr "za %d kilometrů"
-
-#~ msgid "strength_pos"
-#~ msgstr "2"
-
-#~ msgid "direction_pos"
-#~ msgstr "3"
-
-#~ msgid "distance_pos"
-#~ msgstr "1"
-
-#: ../navit/main.c:111
-#, c-format
-msgid ""
-"navit usage:\n"
-"navit [options] [configfile]\n"
-"\t-c <file>: use <file> as config file\n"
-"\t-d <n>: set the debug output level to <n>. (TODO)\n"
-"\t-h: print this usage info and exit.\n"
-"\t-v: Print the version and exit.\n"
-msgstr ""
-
-#: ../navit/main.c:131
-#, c-format
-msgid "Running from source directory\n"
-msgstr "Běží ze zdrojového adresáře\n"
-
-#: ../navit/main.c:147
-#, c-format
-msgid "setting '%s' to '%s'\n"
-msgstr "nastavuji '%s' na '%s\n"
-
-#. We have not found an existing config file from all possibilities
-#: ../navit/main.c:248
-#, c-format
-msgid "No config file navit.xml, navit.xml.local found\n"
-msgstr "Nebyl nalezen soubor navit.xml, navit.xml.local nalezen\n"
-
-#: ../navit/main.c:255
-#, c-format
-msgid "Error parsing '%s': %s\n"
-msgstr "Chyba parsování '%s': %s\n"
-
-#: ../navit/main.c:258
-#, c-format
-msgid "Using '%s'\n"
-msgstr "Používám '%s'\n"
-
-#: ../navit/main.c:261
-#, c-format
-msgid "No instance has been created, exiting\n"
-msgstr "Nebyla vytvoÅ™ena instance, konÄím\n"
-
-#: ../navit/navigation.c:171
-#, c-format
-msgid "%d m"
-msgstr "%d m"
-
-#: ../navit/navigation.c:173
-#, c-format
-msgid "in %d m"
-msgstr "za %d m"
-
-#: ../navit/navigation.c:177
-#, c-format
-msgid "%d meters"
-msgstr "%d metrů"
-
-#: ../navit/navigation.c:179
-#, c-format
-msgid "in %d meters"
-msgstr "za %d metrů"
-
-#: ../navit/navigation.c:185
-#, c-format
-msgid "%d.%d kilometer"
-msgstr "%d.%d kilometrů"
-
-#: ../navit/navigation.c:187
-#, c-format
-msgid "in %d.%d kilometers"
-msgstr "za %d.%d kilometrů"
-
-#: ../navit/navigation.c:191
-#, c-format
-msgid "one kilometer"
-msgid_plural "%d kilometers"
-msgstr[0] "%d kilometr"
-msgstr[1] "%d kilometry"
-msgstr[2] "%d kilometrů"
-
-#: ../navit/navigation.c:193
-#, c-format
-msgid "in one kilometer"
-msgid_plural "in %d kilometers"
-msgstr[0] "za %d kilometr"
-msgstr[1] "za %d kilometry"
-msgstr[2] "za %d kilometrů"
-
-#: ../navit/navigation.c:447
-msgid "exit"
-msgstr ""
-
-#: ../navit/navigation.c:449
-msgid "ramp"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name
-#: ../navit/navigation.c:479
-#, c-format
-msgid "%sinto the street %s%s%s"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Male form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:483
-#, c-format
-msgid "%sinto the %s%s%s|male form"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Female form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:487
-#, c-format
-msgid "%sinto the %s%s%s|female form"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Neutral form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:491
-#, c-format
-msgid "%sinto the %s%s%s|neutral form"
-msgstr ""
-
-#: ../navit/navigation.c:497
-#, c-format
-msgid "into the %s"
-msgstr ""
-
-#: ../navit/navigation.c:518
-msgid "right"
-msgstr "vpravo"
-
-#: ../navit/navigation.c:525
-msgid "left"
-msgstr "vlevo"
-
-#: ../navit/navigation.c:529
-msgid "easily "
-msgstr "mírně "
-
-#: ../navit/navigation.c:533
-msgid "strongly "
-msgstr "silnÄ› "
-
-#: ../navit/navigation.c:536
-msgid "unknown "
-msgstr "neurÄitÄ› "
-
-#: ../navit/navigation.c:542
-msgid "When possible, please turn around"
-msgstr "Až to bude možné, otoÄte se"
-
-#: ../navit/navigation.c:549
-#, c-format
-msgid "Follow the road for the next %s"
-msgstr "PokraÄujte po další %s"
-
-#: ../navit/navigation.c:553
-msgid "soon"
-msgstr "brzy"
-
-#: ../navit/navigation.c:559
-msgid "now"
-msgstr "nyní"
-
-#: ../navit/navigation.c:562
-msgid "error"
-msgstr "chyba"
-
-#. TRANSLATORS: The first argument is strength, the second direction, the third distance and the fourth destination Example: 'Turn 'slightly' 'left' in '100 m' 'onto baker street'
-#: ../navit/navigation.c:591
-#, c-format
-msgid "Turn %1$s%2$s %3$s%4$s"
-msgstr ""
-
-#: ../navit/navigation.c:594
-#, c-format
-msgid "You have reached your destination %s"
-msgstr "Dorazili jste do cíle %s"
-
-#: ../navit/navit.c:664 ../navit/gui/gtk/gui_gtk_action.c:151
-msgid "Former Destinations"
-msgstr "Minulé cíle"
-
-#: ../navit/navit.c:674 ../navit/gui/gtk/gui_gtk_action.c:152
-msgid "Bookmarks"
-msgstr "Záložky"
-
-#: ../navit/navit.c:764
-msgid "Command"
-msgstr "Příkaz"
-
-#: ../navit/navit.c:769
-msgid "Length"
-msgstr "Délka"
-
-#: ../navit/navit.c:773 ../navit/navit.c:798
-msgid "km"
-msgstr "km"
-
-#: ../navit/navit.c:777 ../navit/navit.c:802
-msgid "m"
-msgstr "m"
-
-#: ../navit/navit.c:783
-msgid "Time"
-msgstr "ÄŒas"
-
-#: ../navit/navit.c:795
-msgid "Destination Length"
-msgstr "Cílová vzdálenost"
-
-#: ../navit/navit.c:808
-msgid "Destination Time"
-msgstr "Cílový Äas"
-
-#: ../navit/navit.c:837 ../navit/gui/gtk/gui_gtk_action.c:160
-msgid "Roadbook"
-msgstr "Itinerář"
-
-#: ../navit/popup.c:200 ../navit/popup.c:254
-msgid "Set as position"
-msgstr "Použít jako pozici"
-
-#: ../navit/popup.c:201 ../navit/popup.c:255
-msgid "Set as destination"
-msgstr "Nastavit jako cíl"
-
-#: ../navit/popup.c:202 ../navit/popup.c:256
-msgid "Add as bookmark"
-msgstr "Použít jako záložku"
-
-#: ../navit/popup.c:244
-#, c-format
-msgid "Point 0x%x 0x%x"
-msgstr ""
-
-#: ../navit/popup.c:245
-#, c-format
-msgid "Screen coord : %d %d"
-msgstr ""
-
-#. 020
-#: ../navit/country.c:24
-msgid "Andorra"
-msgstr "Andora"
-
-#. 784
-#: ../navit/country.c:25
-msgid "United Arab Emirates"
-msgstr "Spojené arabské emiráty"
-
-#. 004
-#: ../navit/country.c:26
-msgid "Afghanistan"
-msgstr "Afganistán"
-
-#. 028
-#: ../navit/country.c:27
-msgid "Antigua and Barbuda"
-msgstr "Antigua a Barbuda"
-
-#. 660
-#: ../navit/country.c:28
-msgid "Anguilla"
-msgstr "Anguilla"
-
-#. 008
-#: ../navit/country.c:29
-msgid "Albania"
-msgstr "Albánie"
-
-#. 051
-#: ../navit/country.c:30
-msgid "Armenia"
-msgstr "Arménie"
-
-#. 530
-#: ../navit/country.c:31
-msgid "Netherlands Antilles"
-msgstr "Nizozemské Antily"
-
-#. 024
-#: ../navit/country.c:32
-msgid "Angola"
-msgstr "Angola"
-
-#. 010
-#: ../navit/country.c:33
-msgid "Antarctica"
-msgstr "Antarktida"
-
-#. 032
-#: ../navit/country.c:34
-msgid "Argentina"
-msgstr "Argentina"
-
-#. 016
-#: ../navit/country.c:35
-msgid "American Samoa"
-msgstr "Americká Samoa"
-
-#. 040
-#: ../navit/country.c:36
-msgid "Austria"
-msgstr "Rakousko"
-
-#. 036
-#: ../navit/country.c:37
-msgid "Australia"
-msgstr "Austrálie"
-
-#. 533
-#: ../navit/country.c:38
-msgid "Aruba"
-msgstr "Aruba"
-
-#. 248
-#: ../navit/country.c:39
-msgid "Aland Islands"
-msgstr ""
-
-#. 031
-#: ../navit/country.c:40
-msgid "Azerbaijan"
-msgstr "Azerbajdžán"
-
-#. 070
-#: ../navit/country.c:41
-msgid "Bosnia and Herzegovina"
-msgstr "Bosna a Hercegovina"
-
-#. 052
-#: ../navit/country.c:42
-msgid "Barbados"
-msgstr "Barbados"
-
-#. 050
-#: ../navit/country.c:43
-msgid "Bangladesh"
-msgstr "Bangladéš"
-
-#. 056
-#: ../navit/country.c:44
-msgid "Belgium"
-msgstr "Belgie"
-
-#. 854
-#: ../navit/country.c:45
-msgid "Burkina Faso"
-msgstr "Burkina Faso"
-
-#. 100
-#: ../navit/country.c:46
-msgid "Bulgaria"
-msgstr "Bulharsko"
-
-#. 048
-#: ../navit/country.c:47
-msgid "Bahrain"
-msgstr "Bahrajn"
-
-#. 108
-#: ../navit/country.c:48
-msgid "Burundi"
-msgstr "Burundi"
-
-#. 204
-#: ../navit/country.c:49
-msgid "Benin"
-msgstr "Benin"
-
-#. 652
-#: ../navit/country.c:50
-msgid "Saint Barthelemy"
-msgstr ""
-
-#. 060
-#: ../navit/country.c:51
-msgid "Bermuda"
-msgstr "Bermudy"
-
-#. 096
-#: ../navit/country.c:52
-msgid "Brunei Darussalam"
-msgstr "Brunej"
-
-#. 068
-#: ../navit/country.c:53
-msgid "Bolivia"
-msgstr ""
-
-#. 076
-#: ../navit/country.c:54
-msgid "Brazil"
-msgstr "Brazílie"
-
-#. 044
-#: ../navit/country.c:55
-msgid "Bahamas"
-msgstr "Bahamy"
-
-#. 064
-#: ../navit/country.c:56
-msgid "Bhutan"
-msgstr "Bhután"
-
-#. 074
-#: ../navit/country.c:57
-msgid "Bouvet Island"
-msgstr "Bouvetův ostrov"
-
-#. 072
-#: ../navit/country.c:58
-msgid "Botswana"
-msgstr ""
-
-#. 112
-#: ../navit/country.c:59
-msgid "Belarus"
-msgstr "Bělorusko"
-
-#. 084
-#: ../navit/country.c:60
-msgid "Belize"
-msgstr ""
-
-#. 124
-#: ../navit/country.c:61
-msgid "Canada"
-msgstr ""
-
-#. 166
-#: ../navit/country.c:62
-msgid "Cocos (Keeling) Islands"
-msgstr ""
-
-#. 180
-#: ../navit/country.c:63
-msgid "Congo, Democratic Republic of the"
-msgstr ""
-
-#. 140
-#: ../navit/country.c:64
-msgid "Central African Republic"
-msgstr "Středoafrická republika"
-
-#. 178
-#: ../navit/country.c:65
-msgid "Congo"
-msgstr ""
-
-#. 756
-#: ../navit/country.c:66
-msgid "Switzerland"
-msgstr "Švýcarsko"
-
-#. 384
-#: ../navit/country.c:67
-msgid "Cote d'Ivoire"
-msgstr ""
-
-#. 184
-#: ../navit/country.c:68
-msgid "Cook Islands"
-msgstr ""
-
-#. 152
-#: ../navit/country.c:69
-msgid "Chile"
-msgstr ""
-
-#. 120
-#: ../navit/country.c:70
-msgid "Cameroon"
-msgstr ""
-
-#. 156
-#: ../navit/country.c:71
-msgid "China"
-msgstr ""
-
-#. 170
-#: ../navit/country.c:72
-msgid "Colombia"
-msgstr ""
-
-#. 188
-#: ../navit/country.c:73
-msgid "Costa Rica"
-msgstr ""
-
-#. 192
-#: ../navit/country.c:74
-msgid "Cuba"
-msgstr ""
-
-#. 132
-#: ../navit/country.c:75
-msgid "Cape Verde"
-msgstr ""
-
-#. 162
-#: ../navit/country.c:76
-msgid "Christmas Island"
-msgstr ""
-
-#. 196
-#: ../navit/country.c:77
-msgid "Cyprus"
-msgstr "Kypr"
-
-#. 203
-#: ../navit/country.c:78
-msgid "Czech Republic"
-msgstr "Česká republika"
-
-#. 276
-#: ../navit/country.c:79
-msgid "Germany"
-msgstr "Ňemecko"
-
-#. 262
-#: ../navit/country.c:80
-msgid "Djibouti"
-msgstr ""
-
-#. 208
-#: ../navit/country.c:81
-msgid "Denmark"
-msgstr "Dánsko"
-
-#. 212
-#: ../navit/country.c:82
-msgid "Dominica"
-msgstr ""
-
-#. 214
-#: ../navit/country.c:83
-msgid "Dominican Republic"
-msgstr ""
-
-#. 012
-#: ../navit/country.c:84
-msgid "Algeria"
-msgstr "Alžír"
-
-#. 218
-#: ../navit/country.c:85
-msgid "Ecuador"
-msgstr ""
-
-#. 233
-#: ../navit/country.c:86
-msgid "Estonia"
-msgstr "Estonsko"
-
-#. 818
-#: ../navit/country.c:87
-msgid "Egypt"
-msgstr "Egypt"
-
-#. 732
-#: ../navit/country.c:88
-msgid "Western Sahara"
-msgstr "Západní Sahara"
-
-#. 232
-#: ../navit/country.c:89
-msgid "Eritrea"
-msgstr ""
-
-#. 724
-#: ../navit/country.c:90
-msgid "Spain"
-msgstr "Španělsko"
-
-#. 231
-#: ../navit/country.c:91
-msgid "Ethiopia"
-msgstr ""
-
-#. 246
-#: ../navit/country.c:92
-msgid "Finland"
-msgstr "Finsko"
-
-#. 242
-#: ../navit/country.c:93
-msgid "Fiji"
-msgstr ""
-
-#. 238
-#: ../navit/country.c:94
-msgid "Falkland Islands (Malvinas)"
-msgstr ""
-
-#. 583
-#: ../navit/country.c:95
-msgid "Micronesia, Federated States of"
-msgstr ""
-
-#. 234
-#: ../navit/country.c:96
-msgid "Faroe Islands"
-msgstr "Farské ostrovy"
-
-#. 250
-#: ../navit/country.c:97
-msgid "France"
-msgstr "Francie"
-
-#. 266
-#: ../navit/country.c:98
-msgid "Gabon"
-msgstr ""
-
-#. 826
-#: ../navit/country.c:99
-msgid "United Kingdom"
-msgstr "Spojené království"
-
-#. 308
-#: ../navit/country.c:100
-msgid "Grenada"
-msgstr ""
-
-#. 268
-#: ../navit/country.c:101
-msgid "Georgia"
-msgstr "Gruzie"
-
-#. 254
-#: ../navit/country.c:102
-msgid "French Guiana"
-msgstr ""
-
-#. 831
-#: ../navit/country.c:103
-msgid "Guernsey"
-msgstr ""
-
-#. 288
-#: ../navit/country.c:104
-msgid "Ghana"
-msgstr ""
-
-#. 292
-#: ../navit/country.c:105
-msgid "Gibraltar"
-msgstr "Gibraltar"
-
-#. 304
-#: ../navit/country.c:106
-msgid "Greenland"
-msgstr ""
-
-#. 270
-#: ../navit/country.c:107
-msgid "Gambia"
-msgstr ""
-
-#. 324
-#: ../navit/country.c:108
-msgid "Guinea"
-msgstr ""
-
-#. 312
-#: ../navit/country.c:109
-msgid "Guadeloupe"
-msgstr ""
-
-#. 226
-#: ../navit/country.c:110
-msgid "Equatorial Guinea"
-msgstr ""
-
-#. 300
-#: ../navit/country.c:111
-msgid "Greece"
-msgstr "Řecko"
-
-#. 239
-#: ../navit/country.c:112
-msgid "South Georgia and the South Sandwich Islands"
-msgstr ""
-
-#. 320
-#: ../navit/country.c:113
-msgid "Guatemala"
-msgstr ""
-
-#. 316
-#: ../navit/country.c:114
-msgid "Guam"
-msgstr ""
-
-#. 624
-#: ../navit/country.c:115
-msgid "Guinea-Bissau"
-msgstr ""
-
-#. 328
-#: ../navit/country.c:116
-msgid "Guyana"
-msgstr ""
-
-#. 344
-#: ../navit/country.c:117
-msgid "Hong Kong"
-msgstr ""
-
-#. 334
-#: ../navit/country.c:118
-msgid "Heard Island and McDonald Islands"
-msgstr ""
-
-#. 340
-#: ../navit/country.c:119
-msgid "Honduras"
-msgstr ""
-
-#. 191
-#: ../navit/country.c:120
-msgid "Croatia"
-msgstr "Chorvatsko"
-
-#. 332
-#: ../navit/country.c:121
-msgid "Haiti"
-msgstr ""
-
-#. 348
-#: ../navit/country.c:122
-msgid "Hungary"
-msgstr "MaÄarsko"
-
-#. 360
-#: ../navit/country.c:123
-msgid "Indonesia"
-msgstr ""
-
-#. 372
-#: ../navit/country.c:124
-msgid "Ireland"
-msgstr "Irsko"
-
-#. 376
-#: ../navit/country.c:125
-msgid "Israel"
-msgstr "Izrael"
-
-#. 833
-#: ../navit/country.c:126
-msgid "Isle of Man"
-msgstr ""
-
-#. 356
-#: ../navit/country.c:127
-msgid "India"
-msgstr ""
-
-#. 086
-#: ../navit/country.c:128
-msgid "British Indian Ocean Territory"
-msgstr ""
-
-#. 368
-#: ../navit/country.c:129
-msgid "Iraq"
-msgstr ""
-
-#. 364
-#: ../navit/country.c:130
-msgid "Iran, Islamic Republic of"
-msgstr ""
-
-#. 352
-#: ../navit/country.c:131
-msgid "Iceland"
-msgstr "Island"
-
-#. 380
-#: ../navit/country.c:132
-msgid "Italy"
-msgstr "Itálie"
-
-#. 832
-#: ../navit/country.c:133
-msgid "Jersey"
-msgstr ""
-
-#. 388
-#: ../navit/country.c:134
-msgid "Jamaica"
-msgstr ""
-
-#. 400
-#: ../navit/country.c:135
-msgid "Jordan"
-msgstr "Jordánsko"
-
-#. 392
-#: ../navit/country.c:136
-msgid "Japan"
-msgstr ""
-
-#. 404
-#: ../navit/country.c:137
-msgid "Kenya"
-msgstr ""
-
-#. 417
-#: ../navit/country.c:138
-msgid "Kyrgyzstan"
-msgstr ""
-
-#. 116
-#: ../navit/country.c:139
-msgid "Cambodia"
-msgstr ""
-
-#. 296
-#: ../navit/country.c:140
-msgid "Kiribati"
-msgstr ""
-
-#. 174
-#: ../navit/country.c:141
-msgid "Comoros"
-msgstr ""
-
-#. 659
-#: ../navit/country.c:142
-msgid "Saint Kitts and Nevis"
-msgstr ""
-
-#. 408
-#: ../navit/country.c:143
-msgid "Korea, Democratic People's Republic of"
-msgstr ""
-
-#. 410
-#: ../navit/country.c:144
-msgid "Korea, Republic of"
-msgstr ""
-
-#. 414
-#: ../navit/country.c:145
-msgid "Kuwait"
-msgstr ""
-
-#. 136
-#: ../navit/country.c:146
-msgid "Cayman Islands"
-msgstr ""
-
-#. 398
-#: ../navit/country.c:147
-msgid "Kazakhstan"
-msgstr ""
-
-#. 418
-#: ../navit/country.c:148
-msgid "Lao People's Democratic Republic"
-msgstr ""
-
-#. 422
-#: ../navit/country.c:149
-msgid "Lebanon"
-msgstr "Libanon"
-
-#. 662
-#: ../navit/country.c:150
-msgid "Saint Lucia"
-msgstr ""
-
-#. 438
-#: ../navit/country.c:151
-msgid "Liechtenstein"
-msgstr "Lichtenštejnsko"
-
-#. 144
-#: ../navit/country.c:152
-msgid "Sri Lanka"
-msgstr ""
-
-#. 430
-#: ../navit/country.c:153
-msgid "Liberia"
-msgstr ""
-
-#. 426
-#: ../navit/country.c:154
-msgid "Lesotho"
-msgstr ""
-
-#. 440
-#: ../navit/country.c:155
-msgid "Lithuania"
-msgstr "Litva"
-
-#. 442
-#: ../navit/country.c:156
-msgid "Luxembourg"
-msgstr "Lucembursko"
-
-#. 428
-#: ../navit/country.c:157
-msgid "Latvia"
-msgstr "Lotyšsko"
-
-#. 434
-#: ../navit/country.c:158
-msgid "Libyan Arab Jamahiriya"
-msgstr ""
-
-#. 504
-#: ../navit/country.c:159
-msgid "Morocco"
-msgstr "Maroko"
-
-#. 492
-#: ../navit/country.c:160
-msgid "Monaco"
-msgstr "Monako"
-
-#. 498
-#: ../navit/country.c:161
-msgid "Moldova, Republic of"
-msgstr ""
-
-#. 499
-#: ../navit/country.c:162
-msgid "Montenegro"
-msgstr ""
-
-#. 663
-#: ../navit/country.c:163
-msgid "Saint Martin (French part)"
-msgstr ""
-
-#. 450
-#: ../navit/country.c:164
-msgid "Madagascar"
-msgstr ""
-
-#. 584
-#: ../navit/country.c:165
-msgid "Marshall Islands"
-msgstr ""
-
-#. 807
-#: ../navit/country.c:166
-msgid "Macedonia, the former Yugoslav Republic of"
-msgstr ""
-
-#. 466
-#: ../navit/country.c:167
-msgid "Mali"
-msgstr ""
-
-#. 104
-#: ../navit/country.c:168
-msgid "Myanmar"
-msgstr ""
-
-#. 496
-#: ../navit/country.c:169
-msgid "Mongolia"
-msgstr ""
-
-#. 446
-#: ../navit/country.c:170
-msgid "Macao"
-msgstr ""
-
-#. 580
-#: ../navit/country.c:171
-msgid "Northern Mariana Islands"
-msgstr ""
-
-#. 474
-#: ../navit/country.c:172
-msgid "Martinique"
-msgstr ""
-
-#. 478
-#: ../navit/country.c:173
-msgid "Mauritania"
-msgstr ""
-
-#. 500
-#: ../navit/country.c:174
-msgid "Montserrat"
-msgstr ""
-
-#. 470
-#: ../navit/country.c:175
-msgid "Malta"
-msgstr "Malta"
-
-#. 480
-#: ../navit/country.c:176
-msgid "Mauritius"
-msgstr ""
-
-#. 462
-#: ../navit/country.c:177
-msgid "Maldives"
-msgstr ""
-
-#. 454
-#: ../navit/country.c:178
-msgid "Malawi"
-msgstr ""
-
-#. 484
-#: ../navit/country.c:179
-msgid "Mexico"
-msgstr ""
-
-#. 458
-#: ../navit/country.c:180
-msgid "Malaysia"
-msgstr ""
-
-#. 508
-#: ../navit/country.c:181
-msgid "Mozambique"
-msgstr ""
-
-#. 516
-#: ../navit/country.c:182
-msgid "Namibia"
-msgstr ""
-
-#. 540
-#: ../navit/country.c:183
-msgid "New Caledonia"
-msgstr ""
-
-#. 562
-#: ../navit/country.c:184
-msgid "Niger"
-msgstr ""
-
-#. 574
-#: ../navit/country.c:185
-msgid "Norfolk Island"
-msgstr ""
-
-#. 566
-#: ../navit/country.c:186
-msgid "Nigeria"
-msgstr ""
-
-#. 558
-#: ../navit/country.c:187
-msgid "Nicaragua"
-msgstr ""
-
-#. 528
-#: ../navit/country.c:188
-msgid "Netherlands"
-msgstr "Nizozemí"
-
-#. 578
-#: ../navit/country.c:189
-msgid "Norway"
-msgstr "Norsko"
-
-#. 524
-#: ../navit/country.c:190
-msgid "Nepal"
-msgstr ""
-
-#. 520
-#: ../navit/country.c:191
-msgid "Nauru"
-msgstr ""
-
-#. 570
-#: ../navit/country.c:192
-msgid "Niue"
-msgstr ""
-
-#. 554
-#: ../navit/country.c:193
-msgid "New Zealand"
-msgstr ""
-
-#. 512
-#: ../navit/country.c:194
-msgid "Oman"
-msgstr ""
-
-#. 591
-#: ../navit/country.c:195
-msgid "Panama"
-msgstr ""
-
-#. 604
-#: ../navit/country.c:196
-msgid "Peru"
-msgstr ""
-
-#. 258
-#: ../navit/country.c:197
-msgid "French Polynesia"
-msgstr ""
-
-#. 598
-#: ../navit/country.c:198
-msgid "Papua New Guinea"
-msgstr ""
-
-#. 608
-#: ../navit/country.c:199
-msgid "Philippines"
-msgstr ""
-
-#. 586
-#: ../navit/country.c:200
-msgid "Pakistan"
-msgstr ""
-
-#. 616
-#: ../navit/country.c:201
-msgid "Poland"
-msgstr "Polsko"
-
-#. 666
-#: ../navit/country.c:202
-msgid "Saint Pierre and Miquelon"
-msgstr ""
-
-#. 612
-#: ../navit/country.c:203
-msgid "Pitcairn"
-msgstr ""
-
-#. 630
-#: ../navit/country.c:204
-msgid "Puerto Rico"
-msgstr ""
-
-#. 275
-#: ../navit/country.c:205
-msgid "Palestinian Territory, Occupied"
-msgstr ""
-
-#. 620
-#: ../navit/country.c:206
-msgid "Portugal"
-msgstr "Portugalsko"
-
-#. 585
-#: ../navit/country.c:207
-msgid "Palau"
-msgstr ""
-
-#. 600
-#: ../navit/country.c:208
-msgid "Paraguay"
-msgstr ""
-
-#. 634
-#: ../navit/country.c:209
-msgid "Qatar"
-msgstr ""
-
-#. 638
-#: ../navit/country.c:210
-msgid "Reunion"
-msgstr ""
-
-#. 642
-#: ../navit/country.c:211
-msgid "Romania"
-msgstr "Rumunsko"
-
-#. 688
-#: ../navit/country.c:212
-msgid "Serbia"
-msgstr "Srbsko"
-
-#. 643
-#: ../navit/country.c:213
-msgid "Russian Federation"
-msgstr "Ruská federace"
-
-#. 646
-#: ../navit/country.c:214
-msgid "Rwanda"
-msgstr ""
-
-#. 682
-#: ../navit/country.c:215
-msgid "Saudi Arabia"
-msgstr "Saudská Arábie"
-
-#. 090
-#: ../navit/country.c:216
-msgid "Solomon Islands"
-msgstr ""
-
-#. 690
-#: ../navit/country.c:217
-msgid "Seychelles"
-msgstr ""
-
-#. 736
-#: ../navit/country.c:218
-msgid "Sudan"
-msgstr ""
-
-#. 752
-#: ../navit/country.c:219
-msgid "Sweden"
-msgstr "Švédsko"
-
-#. 702
-#: ../navit/country.c:220
-msgid "Singapore"
-msgstr ""
-
-#. 654
-#: ../navit/country.c:221
-msgid "Saint Helena"
-msgstr ""
-
-#. 705
-#: ../navit/country.c:222
-msgid "Slovenia"
-msgstr "Slovinsko"
-
-#. 744
-#: ../navit/country.c:223
-msgid "Svalbard and Jan Mayen"
-msgstr "Svalbard a Jan Mayen"
-
-#. 703
-#: ../navit/country.c:224
-msgid "Slovakia"
-msgstr "Slovensko"
-
-#. 694
-#: ../navit/country.c:225
-msgid "Sierra Leone"
-msgstr ""
-
-#. 674
-#: ../navit/country.c:226
-msgid "San Marino"
-msgstr "San Marino"
-
-#. 686
-#: ../navit/country.c:227
-msgid "Senegal"
-msgstr ""
-
-#. 706
-#: ../navit/country.c:228
-msgid "Somalia"
-msgstr ""
-
-#. 740
-#: ../navit/country.c:229
-msgid "Suriname"
-msgstr ""
-
-#. 678
-#: ../navit/country.c:230
-msgid "Sao Tome and Principe"
-msgstr ""
-
-#. 222
-#: ../navit/country.c:231
-msgid "El Salvador"
-msgstr ""
-
-#. 760
-#: ../navit/country.c:232
-msgid "Syrian Arab Republic"
-msgstr ""
-
-#. 748
-#: ../navit/country.c:233
-msgid "Swaziland"
-msgstr ""
-
-#. 796
-#: ../navit/country.c:234
-msgid "Turks and Caicos Islands"
-msgstr ""
-
-#. 148
-#: ../navit/country.c:235
-msgid "Chad"
-msgstr ""
-
-#. 260
-#: ../navit/country.c:236
-msgid "French Southern Territories"
-msgstr ""
-
-#. 768
-#: ../navit/country.c:237
-msgid "Togo"
-msgstr ""
-
-#. 764
-#: ../navit/country.c:238
-msgid "Thailand"
-msgstr ""
-
-#. 762
-#: ../navit/country.c:239
-msgid "Tajikistan"
-msgstr ""
-
-#. 772
-#: ../navit/country.c:240
-msgid "Tokelau"
-msgstr ""
-
-#. 626
-#: ../navit/country.c:241
-msgid "Timor-Leste"
-msgstr ""
-
-#. 795
-#: ../navit/country.c:242
-msgid "Turkmenistan"
-msgstr ""
-
-#. 788
-#: ../navit/country.c:243
-msgid "Tunisia"
-msgstr "Tunis"
-
-#. 776
-#: ../navit/country.c:244
-msgid "Tonga"
-msgstr ""
-
-#. 792
-#: ../navit/country.c:245
-msgid "Turkey"
-msgstr "Turecko"
-
-#. 780
-#: ../navit/country.c:246
-msgid "Trinidad and Tobago"
-msgstr ""
-
-#. 798
-#: ../navit/country.c:247
-msgid "Tuvalu"
-msgstr ""
-
-#. 158
-#: ../navit/country.c:248
-msgid "Taiwan, Province of China"
-msgstr ""
-
-#. 834
-#: ../navit/country.c:249
-msgid "Tanzania, United Republic of"
-msgstr ""
-
-#. 804
-#: ../navit/country.c:250
-msgid "Ukraine"
-msgstr "Ukrajina"
-
-#. 800
-#: ../navit/country.c:251
-msgid "Uganda"
-msgstr ""
-
-#. 581
-#: ../navit/country.c:252
-msgid "United States Minor Outlying Islands"
-msgstr ""
-
-#. 840
-#: ../navit/country.c:253
-msgid "United States"
-msgstr ""
-
-#. 858
-#: ../navit/country.c:254
-msgid "Uruguay"
-msgstr ""
-
-#. 860
-#: ../navit/country.c:255
-msgid "Uzbekistan"
-msgstr ""
-
-#. 336
-#: ../navit/country.c:256
-msgid "Holy See (Vatican City State)"
-msgstr ""
-
-#. 670
-#: ../navit/country.c:257
-msgid "Saint Vincent and the Grenadines"
-msgstr ""
-
-#. 862
-#: ../navit/country.c:258
-msgid "Venezuela"
-msgstr ""
-
-#. 092
-#: ../navit/country.c:259
-msgid "Virgin Islands, British"
-msgstr ""
-
-#. 850
-#: ../navit/country.c:260
-msgid "Virgin Islands, U.S."
-msgstr ""
-
-#. 704
-#: ../navit/country.c:261
-msgid "Viet Nam"
-msgstr ""
-
-#. 548
-#: ../navit/country.c:262
-msgid "Vanuatu"
-msgstr ""
-
-#. 876
-#: ../navit/country.c:263
-msgid "Wallis and Futuna"
-msgstr ""
-
-#. 882
-#: ../navit/country.c:264
-msgid "Samoa"
-msgstr "Samoa"
-
-#. 887
-#: ../navit/country.c:265
-msgid "Yemen"
-msgstr "Jemen"
-
-#. 175
-#: ../navit/country.c:266
-msgid "Mayotte"
-msgstr ""
-
-#. 710
-#: ../navit/country.c:267
-msgid "South Africa"
-msgstr "Jihoafrická republika"
-
-#. 894
-#: ../navit/country.c:268
-msgid "Zambia"
-msgstr "Zambie"
-
-#. 716
-#: ../navit/country.c:269
-msgid "Zimbabwe"
-msgstr "Zimbabwe"
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:98
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-msgid "Car"
-msgstr "Automobil"
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso2"
-msgstr ""
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso3"
-msgstr ""
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:403
-msgid "Country"
-msgstr "ZemÄ›"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "Postal"
-msgstr "Poštovní"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "Town"
-msgstr "Město"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "District"
-msgstr "Kraj/Okres"
-
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-#: ../navit/gui/gtk/destination.c:412
-msgid "Street"
-msgstr "Ulice"
-
-#: ../navit/gui/gtk/destination.c:100 ../navit/gui/gtk/destination.c:414
-msgid "Number"
-msgstr "Číslo"
-
-#: ../navit/gui/gtk/destination.c:398
-msgid "Enter Destination"
-msgstr "Zadejte cíl"
-
-#: ../navit/gui/gtk/destination.c:405
-msgid "Zip Code"
-msgstr "PSČ"
-
-#: ../navit/gui/gtk/destination.c:407
-msgid "City"
-msgstr "Město"
-
-#: ../navit/gui/gtk/destination.c:409
-msgid "District/Township"
-msgstr "Kraj/Okres"
-
-#: ../navit/gui/gtk/destination.c:437 ../navit/gui/gtk/gui_gtk_action.c:153
-msgid "Map"
-msgstr "Mapa"
-
-#: ../navit/gui/gtk/destination.c:438
-msgid "Bookmark"
-msgstr "Záložka"
-
-#: ../navit/gui/gtk/destination.c:439 ../navit/gui/gtk/gui_gtk_action.c:166
-msgid "Destination"
-msgstr "Cíl"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:149
-msgid "Display"
-msgstr "Zobrazit"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:150
-msgid "Route"
-msgstr "Trasa"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:154
-msgid "Layout"
-msgstr "Rozvržení"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:155
-msgid "Projection"
-msgstr "Projekce"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:156
-msgid "Vehicle"
-msgstr "Vozidlo"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:157
-msgid "ZoomOut"
-msgstr "Zmenšit"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:158
-msgid "ZoomIn"
-msgstr "Zvětšit"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:159
-msgid "Refresh"
-msgstr "Obnovit"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:162 ../navit/gui/gtk/gui_gtk_action.c:164
-msgid "Info"
-msgstr "Informace"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:167
-msgid "Clear"
-msgstr "VyÄistit"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:168
-msgid "Test"
-msgstr "Vyzkoušet"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:169
-msgid "_Quit"
-msgstr "_Konec"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:176
-msgid "Cursor"
-msgstr "Kurzor"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:177
-msgid "Tracking"
-msgstr "Stopování"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:178
-msgid "Orientation"
-msgstr "Orientace"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:180 ../navit/gui/gtk/gui_gtk_action.c:182
-msgid "Fullscreen"
-msgstr "Celá obrazovka"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:190
-msgid "Data"
-msgstr "Data"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "N"
-msgstr "S"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NE"
-msgstr "SV"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "E"
-msgstr "V"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SE"
-msgstr "JV"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "S"
-msgstr "J"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SW"
-msgstr "JZ"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "W"
-msgstr "Z"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NW"
-msgstr "SZ"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:103
-#, c-format
-msgid "Route %4.0fkm %02d:%02d ETA"
-msgstr ""
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:148
-msgid "Route 0000km 0+00:00 ETA"
-msgstr ""
diff --git a/po/da.po b/po/da.po
deleted file mode 100644
index b105feb1..00000000
--- a/po/da.po
+++ /dev/null
@@ -1,1705 +0,0 @@
-# Danish translation for Navit
-# Copyright (C) 2008
-# This file is distributed under the same license as the navit package.
-# Glenn Sommer <glemsom@gmail.com>, 2008.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: Navit 0.1.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-05-26 17:12+0200\n"
-"PO-Revision-Date: 2008-05-27 04:46+0000\n"
-"Last-Translator: Glenn Sommer <Unknown>\n"
-"Language-Team: Glenn Sommer <glemsom@gmail.com>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Launchpad-Export-Date: 2008-05-30 21:28+0000\n"
-"X-Generator: Launchpad (build Unknown)\n"
-
-#~ msgid "Turn %1$s%2$s %3$s"
-#~ msgstr "Drej %1$s til %2$s %3$s"
-
-#~ msgid "Moldova"
-#~ msgstr "Moldova"
-
-#~ msgid "Syria"
-#~ msgstr "Syrien"
-
-#~ msgid "Libia"
-#~ msgstr "Liberia"
-
-#~ msgid "Palestinia"
-#~ msgstr "Palæstina"
-
-#~ msgid "Macedonia"
-#~ msgstr "Makedonien"
-
-#~ msgid "VisibleBlocks"
-#~ msgstr "Synlige Blokke"
-
-#~ msgid "VisibleTowns"
-#~ msgstr "Synlige byer"
-
-#~ msgid "VisiblePolys"
-#~ msgstr "Synlige Polygomer"
-
-#~ msgid "VisibleStreets"
-#~ msgstr "Synlige veje"
-
-#~ msgid "VisiblePoints"
-#~ msgstr "Synlige punkter"
-
-#: ../navit/main.c:111
-#, c-format
-msgid ""
-"navit usage:\n"
-"navit [options] [configfile]\n"
-"\t-c <file>: use <file> as config file\n"
-"\t-d <n>: set the debug output level to <n>. (TODO)\n"
-"\t-h: print this usage info and exit.\n"
-"\t-v: Print the version and exit.\n"
-msgstr ""
-
-#: ../navit/main.c:131
-#, c-format
-msgid "Running from source directory\n"
-msgstr "Afvikler fra kildekode mappen\n"
-
-#: ../navit/main.c:147
-#, c-format
-msgid "setting '%s' to '%s'\n"
-msgstr "sætter '%s' til '%s'\n"
-
-#. We have not found an existing config file from all possibilities
-#: ../navit/main.c:248
-#, c-format
-msgid "No config file navit.xml, navit.xml.local found\n"
-msgstr "Ingen konfigurationsfil navit.xml eller navit.xml.local fundet\n"
-
-#: ../navit/main.c:255
-#, c-format
-msgid "Error parsing '%s': %s\n"
-msgstr "Fejl ved analyse '%s': %s\n"
-
-#: ../navit/main.c:258
-#, c-format
-msgid "Using '%s'\n"
-msgstr "Bruger '%s'\n"
-
-#: ../navit/main.c:261
-#, c-format
-msgid "No instance has been created, exiting\n"
-msgstr "Ingen instanser er oprettet, afslutter\n"
-
-#: ../navit/navigation.c:171
-#, c-format
-msgid "%d m"
-msgstr "%d m"
-
-#: ../navit/navigation.c:173
-#, c-format
-msgid "in %d m"
-msgstr "i %d m"
-
-#: ../navit/navigation.c:177
-#, c-format
-msgid "%d meters"
-msgstr "%d meter"
-
-#: ../navit/navigation.c:179
-#, c-format
-msgid "in %d meters"
-msgstr "om %d meters"
-
-#: ../navit/navigation.c:185
-#, c-format
-msgid "%d.%d kilometer"
-msgstr "%d.%d kilometer"
-
-#: ../navit/navigation.c:187
-#, c-format
-msgid "in %d.%d kilometers"
-msgstr "om %d.%d kilometer"
-
-#: ../navit/navigation.c:191
-#, fuzzy, c-format
-msgid "one kilometer"
-msgid_plural "%d kilometers"
-msgstr[0] "én kilometer"
-msgstr[1] "én kilometer"
-
-#: ../navit/navigation.c:193
-#, fuzzy, c-format
-msgid "in one kilometer"
-msgid_plural "in %d kilometers"
-msgstr[0] "om én kilometer"
-msgstr[1] "om én kilometer"
-
-#: ../navit/navigation.c:447
-msgid "exit"
-msgstr ""
-
-#: ../navit/navigation.c:449
-msgid "ramp"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name
-#: ../navit/navigation.c:479
-#, c-format
-msgid "%sinto the street %s%s%s"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Male form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:483
-#, c-format
-msgid "%sinto the %s%s%s|male form"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Female form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:487
-#, c-format
-msgid "%sinto the %s%s%s|female form"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Neutral form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:491
-#, c-format
-msgid "%sinto the %s%s%s|neutral form"
-msgstr ""
-
-#: ../navit/navigation.c:497
-#, c-format
-msgid "into the %s"
-msgstr ""
-
-#: ../navit/navigation.c:518
-msgid "right"
-msgstr "højre"
-
-#: ../navit/navigation.c:525
-msgid "left"
-msgstr "venstre"
-
-#: ../navit/navigation.c:529
-msgid "easily "
-msgstr "blødt "
-
-#: ../navit/navigation.c:533
-msgid "strongly "
-msgstr "skarpt "
-
-#: ../navit/navigation.c:536
-msgid "unknown "
-msgstr "ukendt "
-
-#: ../navit/navigation.c:542
-msgid "When possible, please turn around"
-msgstr "NÃ¥r muligt, vend venligst om"
-
-#: ../navit/navigation.c:549
-#, c-format
-msgid "Follow the road for the next %s"
-msgstr "Følg vejen de næste %s"
-
-#: ../navit/navigation.c:553
-msgid "soon"
-msgstr "snart"
-
-#: ../navit/navigation.c:559
-msgid "now"
-msgstr "nu"
-
-#: ../navit/navigation.c:562
-msgid "error"
-msgstr "fejl"
-
-#. TRANSLATORS: The first argument is strength, the second direction, the third distance and the fourth destination Example: 'Turn 'slightly' 'left' in '100 m' 'onto baker street'
-#: ../navit/navigation.c:591
-#, c-format
-msgid "Turn %1$s%2$s %3$s%4$s"
-msgstr ""
-
-#: ../navit/navigation.c:594
-#, c-format
-msgid "You have reached your destination %s"
-msgstr "Du er fremme ved destinationen %s"
-
-#: ../navit/navit.c:664 ../navit/gui/gtk/gui_gtk_action.c:151
-msgid "Former Destinations"
-msgstr "Tidligere destinationer"
-
-#: ../navit/navit.c:674 ../navit/gui/gtk/gui_gtk_action.c:152
-msgid "Bookmarks"
-msgstr "Bogmærker"
-
-#: ../navit/navit.c:764
-msgid "Command"
-msgstr "Kommando"
-
-#: ../navit/navit.c:769
-msgid "Length"
-msgstr "Længde"
-
-#: ../navit/navit.c:773 ../navit/navit.c:798
-msgid "km"
-msgstr ""
-
-#: ../navit/navit.c:777 ../navit/navit.c:802
-msgid "m"
-msgstr ""
-
-#: ../navit/navit.c:783
-msgid "Time"
-msgstr "Tid"
-
-#: ../navit/navit.c:795
-msgid "Destination Length"
-msgstr "Længde til destinationen"
-
-#: ../navit/navit.c:808
-msgid "Destination Time"
-msgstr "Tid til destinationen"
-
-#: ../navit/navit.c:837 ../navit/gui/gtk/gui_gtk_action.c:160
-msgid "Roadbook"
-msgstr "Vejbog"
-
-#: ../navit/popup.c:200 ../navit/popup.c:254
-msgid "Set as position"
-msgstr "Sæt som position"
-
-#: ../navit/popup.c:201 ../navit/popup.c:255
-msgid "Set as destination"
-msgstr "Sæt som destination"
-
-#: ../navit/popup.c:202 ../navit/popup.c:256
-msgid "Add as bookmark"
-msgstr "Tilføj som bogmærke"
-
-#: ../navit/popup.c:244
-#, c-format
-msgid "Point 0x%x 0x%x"
-msgstr "Punkt 0x%x 0x%x"
-
-#: ../navit/popup.c:245
-#, fuzzy, c-format
-msgid "Screen coord : %d %d"
-msgstr "Skærm %d %d"
-
-#. 020
-#: ../navit/country.c:24
-msgid "Andorra"
-msgstr "Andorra"
-
-#. 784
-#: ../navit/country.c:25
-msgid "United Arab Emirates"
-msgstr ""
-
-#. 004
-#: ../navit/country.c:26
-msgid "Afghanistan"
-msgstr ""
-
-#. 028
-#: ../navit/country.c:27
-msgid "Antigua and Barbuda"
-msgstr ""
-
-#. 660
-#: ../navit/country.c:28
-msgid "Anguilla"
-msgstr ""
-
-#. 008
-#: ../navit/country.c:29
-msgid "Albania"
-msgstr "Albanien"
-
-#. 051
-#: ../navit/country.c:30
-msgid "Armenia"
-msgstr "Armenien"
-
-#. 530
-#: ../navit/country.c:31
-msgid "Netherlands Antilles"
-msgstr ""
-
-#. 024
-#: ../navit/country.c:32
-msgid "Angola"
-msgstr ""
-
-#. 010
-#: ../navit/country.c:33
-msgid "Antarctica"
-msgstr ""
-
-#. 032
-#: ../navit/country.c:34
-msgid "Argentina"
-msgstr ""
-
-#. 016
-#: ../navit/country.c:35
-msgid "American Samoa"
-msgstr ""
-
-#. 040
-#: ../navit/country.c:36
-msgid "Austria"
-msgstr "Australien"
-
-#. 036
-#: ../navit/country.c:37
-msgid "Australia"
-msgstr ""
-
-#. 533
-#: ../navit/country.c:38
-msgid "Aruba"
-msgstr ""
-
-#. 248
-#: ../navit/country.c:39
-msgid "Aland Islands"
-msgstr ""
-
-#. 031
-#: ../navit/country.c:40
-msgid "Azerbaijan"
-msgstr "Aserbajdsjan"
-
-#. 070
-#: ../navit/country.c:41
-msgid "Bosnia and Herzegovina"
-msgstr "Bosnien-Hercegovina"
-
-#. 052
-#: ../navit/country.c:42
-msgid "Barbados"
-msgstr ""
-
-#. 050
-#: ../navit/country.c:43
-msgid "Bangladesh"
-msgstr ""
-
-#. 056
-#: ../navit/country.c:44
-msgid "Belgium"
-msgstr "Belgien"
-
-#. 854
-#: ../navit/country.c:45
-msgid "Burkina Faso"
-msgstr ""
-
-#. 100
-#: ../navit/country.c:46
-msgid "Bulgaria"
-msgstr "Bulgarien"
-
-#. 048
-#: ../navit/country.c:47
-msgid "Bahrain"
-msgstr ""
-
-#. 108
-#: ../navit/country.c:48
-msgid "Burundi"
-msgstr ""
-
-#. 204
-#: ../navit/country.c:49
-msgid "Benin"
-msgstr ""
-
-#. 652
-#: ../navit/country.c:50
-msgid "Saint Barthelemy"
-msgstr ""
-
-#. 060
-#: ../navit/country.c:51
-msgid "Bermuda"
-msgstr ""
-
-#. 096
-#: ../navit/country.c:52
-msgid "Brunei Darussalam"
-msgstr ""
-
-#. 068
-#: ../navit/country.c:53
-msgid "Bolivia"
-msgstr ""
-
-#. 076
-#: ../navit/country.c:54
-msgid "Brazil"
-msgstr ""
-
-#. 044
-#: ../navit/country.c:55
-msgid "Bahamas"
-msgstr ""
-
-#. 064
-#: ../navit/country.c:56
-msgid "Bhutan"
-msgstr ""
-
-#. 074
-#: ../navit/country.c:57
-msgid "Bouvet Island"
-msgstr ""
-
-#. 072
-#: ../navit/country.c:58
-msgid "Botswana"
-msgstr ""
-
-#. 112
-#: ../navit/country.c:59
-msgid "Belarus"
-msgstr "Hvide-rusland"
-
-#. 084
-#: ../navit/country.c:60
-msgid "Belize"
-msgstr ""
-
-#. 124
-#: ../navit/country.c:61
-msgid "Canada"
-msgstr ""
-
-#. 166
-#: ../navit/country.c:62
-msgid "Cocos (Keeling) Islands"
-msgstr ""
-
-#. 180
-#: ../navit/country.c:63
-msgid "Congo, Democratic Republic of the"
-msgstr ""
-
-#. 140
-#: ../navit/country.c:64
-msgid "Central African Republic"
-msgstr ""
-
-#. 178
-#: ../navit/country.c:65
-msgid "Congo"
-msgstr ""
-
-#. 756
-#: ../navit/country.c:66
-msgid "Switzerland"
-msgstr "Schweiz"
-
-#. 384
-#: ../navit/country.c:67
-msgid "Cote d'Ivoire"
-msgstr ""
-
-#. 184
-#: ../navit/country.c:68
-msgid "Cook Islands"
-msgstr ""
-
-#. 152
-#: ../navit/country.c:69
-msgid "Chile"
-msgstr ""
-
-#. 120
-#: ../navit/country.c:70
-msgid "Cameroon"
-msgstr ""
-
-#. 156
-#: ../navit/country.c:71
-msgid "China"
-msgstr ""
-
-#. 170
-#: ../navit/country.c:72
-msgid "Colombia"
-msgstr ""
-
-#. 188
-#: ../navit/country.c:73
-msgid "Costa Rica"
-msgstr ""
-
-#. 192
-#: ../navit/country.c:74
-msgid "Cuba"
-msgstr ""
-
-#. 132
-#: ../navit/country.c:75
-msgid "Cape Verde"
-msgstr ""
-
-#. 162
-#: ../navit/country.c:76
-msgid "Christmas Island"
-msgstr ""
-
-#. 196
-#: ../navit/country.c:77
-msgid "Cyprus"
-msgstr "Cypern"
-
-#. 203
-#: ../navit/country.c:78
-msgid "Czech Republic"
-msgstr "Tjekkiet"
-
-#. 276
-#: ../navit/country.c:79
-msgid "Germany"
-msgstr "Tyskland"
-
-#. 262
-#: ../navit/country.c:80
-msgid "Djibouti"
-msgstr ""
-
-#. 208
-#: ../navit/country.c:81
-msgid "Denmark"
-msgstr "Danmark"
-
-#. 212
-#: ../navit/country.c:82
-msgid "Dominica"
-msgstr ""
-
-#. 214
-#: ../navit/country.c:83
-msgid "Dominican Republic"
-msgstr ""
-
-#. 012
-#: ../navit/country.c:84
-msgid "Algeria"
-msgstr "Algeriet"
-
-#. 218
-#: ../navit/country.c:85
-msgid "Ecuador"
-msgstr ""
-
-#. 233
-#: ../navit/country.c:86
-msgid "Estonia"
-msgstr "Estland"
-
-#. 818
-#: ../navit/country.c:87
-msgid "Egypt"
-msgstr "Egypten"
-
-#. 732
-#: ../navit/country.c:88
-msgid "Western Sahara"
-msgstr "Vestsahara"
-
-#. 232
-#: ../navit/country.c:89
-msgid "Eritrea"
-msgstr ""
-
-#. 724
-#: ../navit/country.c:90
-msgid "Spain"
-msgstr "Spanien"
-
-#. 231
-#: ../navit/country.c:91
-msgid "Ethiopia"
-msgstr ""
-
-#. 246
-#: ../navit/country.c:92
-msgid "Finland"
-msgstr "Finland"
-
-#. 242
-#: ../navit/country.c:93
-msgid "Fiji"
-msgstr ""
-
-#. 238
-#: ../navit/country.c:94
-msgid "Falkland Islands (Malvinas)"
-msgstr ""
-
-#. 583
-#: ../navit/country.c:95
-msgid "Micronesia, Federated States of"
-msgstr ""
-
-#. 234
-#: ../navit/country.c:96
-msgid "Faroe Islands"
-msgstr "Færøerne"
-
-#. 250
-#: ../navit/country.c:97
-msgid "France"
-msgstr "Frankring"
-
-#. 266
-#: ../navit/country.c:98
-msgid "Gabon"
-msgstr ""
-
-#. 826
-#: ../navit/country.c:99
-msgid "United Kingdom"
-msgstr "Storbritanien"
-
-#. 308
-#: ../navit/country.c:100
-msgid "Grenada"
-msgstr ""
-
-#. 268
-#: ../navit/country.c:101
-msgid "Georgia"
-msgstr "Georgien"
-
-#. 254
-#: ../navit/country.c:102
-msgid "French Guiana"
-msgstr ""
-
-#. 831
-#: ../navit/country.c:103
-msgid "Guernsey"
-msgstr ""
-
-#. 288
-#: ../navit/country.c:104
-msgid "Ghana"
-msgstr ""
-
-#. 292
-#: ../navit/country.c:105
-msgid "Gibraltar"
-msgstr "Gibraltar"
-
-#. 304
-#: ../navit/country.c:106
-msgid "Greenland"
-msgstr ""
-
-#. 270
-#: ../navit/country.c:107
-msgid "Gambia"
-msgstr ""
-
-#. 324
-#: ../navit/country.c:108
-msgid "Guinea"
-msgstr ""
-
-#. 312
-#: ../navit/country.c:109
-msgid "Guadeloupe"
-msgstr ""
-
-#. 226
-#: ../navit/country.c:110
-msgid "Equatorial Guinea"
-msgstr ""
-
-#. 300
-#: ../navit/country.c:111
-msgid "Greece"
-msgstr "Grækenland"
-
-#. 239
-#: ../navit/country.c:112
-msgid "South Georgia and the South Sandwich Islands"
-msgstr ""
-
-#. 320
-#: ../navit/country.c:113
-msgid "Guatemala"
-msgstr ""
-
-#. 316
-#: ../navit/country.c:114
-msgid "Guam"
-msgstr ""
-
-#. 624
-#: ../navit/country.c:115
-msgid "Guinea-Bissau"
-msgstr ""
-
-#. 328
-#: ../navit/country.c:116
-msgid "Guyana"
-msgstr ""
-
-#. 344
-#: ../navit/country.c:117
-msgid "Hong Kong"
-msgstr ""
-
-#. 334
-#: ../navit/country.c:118
-msgid "Heard Island and McDonald Islands"
-msgstr ""
-
-#. 340
-#: ../navit/country.c:119
-msgid "Honduras"
-msgstr ""
-
-#. 191
-#: ../navit/country.c:120
-msgid "Croatia"
-msgstr "Kroatien"
-
-#. 332
-#: ../navit/country.c:121
-msgid "Haiti"
-msgstr ""
-
-#. 348
-#: ../navit/country.c:122
-msgid "Hungary"
-msgstr "Ungarn"
-
-#. 360
-#: ../navit/country.c:123
-msgid "Indonesia"
-msgstr ""
-
-#. 372
-#: ../navit/country.c:124
-msgid "Ireland"
-msgstr "Irland"
-
-#. 376
-#: ../navit/country.c:125
-msgid "Israel"
-msgstr "Israel"
-
-#. 833
-#: ../navit/country.c:126
-msgid "Isle of Man"
-msgstr ""
-
-#. 356
-#: ../navit/country.c:127
-msgid "India"
-msgstr ""
-
-#. 086
-#: ../navit/country.c:128
-msgid "British Indian Ocean Territory"
-msgstr ""
-
-#. 368
-#: ../navit/country.c:129
-msgid "Iraq"
-msgstr ""
-
-#. 364
-#: ../navit/country.c:130
-msgid "Iran, Islamic Republic of"
-msgstr ""
-
-#. 352
-#: ../navit/country.c:131
-msgid "Iceland"
-msgstr "Island"
-
-#. 380
-#: ../navit/country.c:132
-msgid "Italy"
-msgstr "Italien"
-
-#. 832
-#: ../navit/country.c:133
-msgid "Jersey"
-msgstr ""
-
-#. 388
-#: ../navit/country.c:134
-msgid "Jamaica"
-msgstr ""
-
-#. 400
-#: ../navit/country.c:135
-msgid "Jordan"
-msgstr "Jordan"
-
-#. 392
-#: ../navit/country.c:136
-msgid "Japan"
-msgstr ""
-
-#. 404
-#: ../navit/country.c:137
-msgid "Kenya"
-msgstr ""
-
-#. 417
-#: ../navit/country.c:138
-msgid "Kyrgyzstan"
-msgstr ""
-
-#. 116
-#: ../navit/country.c:139
-msgid "Cambodia"
-msgstr ""
-
-#. 296
-#: ../navit/country.c:140
-msgid "Kiribati"
-msgstr ""
-
-#. 174
-#: ../navit/country.c:141
-msgid "Comoros"
-msgstr ""
-
-#. 659
-#: ../navit/country.c:142
-msgid "Saint Kitts and Nevis"
-msgstr ""
-
-#. 408
-#: ../navit/country.c:143
-msgid "Korea, Democratic People's Republic of"
-msgstr ""
-
-#. 410
-#: ../navit/country.c:144
-msgid "Korea, Republic of"
-msgstr ""
-
-#. 414
-#: ../navit/country.c:145
-msgid "Kuwait"
-msgstr ""
-
-#. 136
-#: ../navit/country.c:146
-msgid "Cayman Islands"
-msgstr ""
-
-#. 398
-#: ../navit/country.c:147
-msgid "Kazakhstan"
-msgstr ""
-
-#. 418
-#: ../navit/country.c:148
-msgid "Lao People's Democratic Republic"
-msgstr ""
-
-#. 422
-#: ../navit/country.c:149
-msgid "Lebanon"
-msgstr "Libanon"
-
-#. 662
-#: ../navit/country.c:150
-msgid "Saint Lucia"
-msgstr ""
-
-#. 438
-#: ../navit/country.c:151
-msgid "Liechtenstein"
-msgstr "Liechtenstein"
-
-#. 144
-#: ../navit/country.c:152
-msgid "Sri Lanka"
-msgstr ""
-
-#. 430
-#: ../navit/country.c:153
-msgid "Liberia"
-msgstr ""
-
-#. 426
-#: ../navit/country.c:154
-msgid "Lesotho"
-msgstr ""
-
-#. 440
-#: ../navit/country.c:155
-msgid "Lithuania"
-msgstr "Litauen"
-
-#. 442
-#: ../navit/country.c:156
-msgid "Luxembourg"
-msgstr "Luxembourg"
-
-#. 428
-#: ../navit/country.c:157
-msgid "Latvia"
-msgstr "Latvia"
-
-#. 434
-#: ../navit/country.c:158
-msgid "Libyan Arab Jamahiriya"
-msgstr ""
-
-#. 504
-#: ../navit/country.c:159
-msgid "Morocco"
-msgstr "Marokko"
-
-#. 492
-#: ../navit/country.c:160
-msgid "Monaco"
-msgstr "Monaco"
-
-#. 498
-#: ../navit/country.c:161
-msgid "Moldova, Republic of"
-msgstr ""
-
-#. 499
-#: ../navit/country.c:162
-msgid "Montenegro"
-msgstr ""
-
-#. 663
-#: ../navit/country.c:163
-msgid "Saint Martin (French part)"
-msgstr ""
-
-#. 450
-#: ../navit/country.c:164
-msgid "Madagascar"
-msgstr ""
-
-#. 584
-#: ../navit/country.c:165
-msgid "Marshall Islands"
-msgstr ""
-
-#. 807
-#: ../navit/country.c:166
-msgid "Macedonia, the former Yugoslav Republic of"
-msgstr ""
-
-#. 466
-#: ../navit/country.c:167
-msgid "Mali"
-msgstr ""
-
-#. 104
-#: ../navit/country.c:168
-msgid "Myanmar"
-msgstr ""
-
-#. 496
-#: ../navit/country.c:169
-msgid "Mongolia"
-msgstr ""
-
-#. 446
-#: ../navit/country.c:170
-msgid "Macao"
-msgstr ""
-
-#. 580
-#: ../navit/country.c:171
-msgid "Northern Mariana Islands"
-msgstr ""
-
-#. 474
-#: ../navit/country.c:172
-msgid "Martinique"
-msgstr ""
-
-#. 478
-#: ../navit/country.c:173
-msgid "Mauritania"
-msgstr ""
-
-#. 500
-#: ../navit/country.c:174
-msgid "Montserrat"
-msgstr ""
-
-#. 470
-#: ../navit/country.c:175
-msgid "Malta"
-msgstr "Malta"
-
-#. 480
-#: ../navit/country.c:176
-msgid "Mauritius"
-msgstr ""
-
-#. 462
-#: ../navit/country.c:177
-msgid "Maldives"
-msgstr ""
-
-#. 454
-#: ../navit/country.c:178
-msgid "Malawi"
-msgstr ""
-
-#. 484
-#: ../navit/country.c:179
-msgid "Mexico"
-msgstr ""
-
-#. 458
-#: ../navit/country.c:180
-msgid "Malaysia"
-msgstr ""
-
-#. 508
-#: ../navit/country.c:181
-msgid "Mozambique"
-msgstr ""
-
-#. 516
-#: ../navit/country.c:182
-msgid "Namibia"
-msgstr ""
-
-#. 540
-#: ../navit/country.c:183
-msgid "New Caledonia"
-msgstr ""
-
-#. 562
-#: ../navit/country.c:184
-msgid "Niger"
-msgstr ""
-
-#. 574
-#: ../navit/country.c:185
-msgid "Norfolk Island"
-msgstr ""
-
-#. 566
-#: ../navit/country.c:186
-msgid "Nigeria"
-msgstr ""
-
-#. 558
-#: ../navit/country.c:187
-msgid "Nicaragua"
-msgstr ""
-
-#. 528
-#: ../navit/country.c:188
-msgid "Netherlands"
-msgstr "Holland"
-
-#. 578
-#: ../navit/country.c:189
-msgid "Norway"
-msgstr "Norge"
-
-#. 524
-#: ../navit/country.c:190
-msgid "Nepal"
-msgstr ""
-
-#. 520
-#: ../navit/country.c:191
-msgid "Nauru"
-msgstr ""
-
-#. 570
-#: ../navit/country.c:192
-msgid "Niue"
-msgstr ""
-
-#. 554
-#: ../navit/country.c:193
-msgid "New Zealand"
-msgstr ""
-
-#. 512
-#: ../navit/country.c:194
-msgid "Oman"
-msgstr ""
-
-#. 591
-#: ../navit/country.c:195
-msgid "Panama"
-msgstr ""
-
-#. 604
-#: ../navit/country.c:196
-msgid "Peru"
-msgstr ""
-
-#. 258
-#: ../navit/country.c:197
-msgid "French Polynesia"
-msgstr ""
-
-#. 598
-#: ../navit/country.c:198
-msgid "Papua New Guinea"
-msgstr ""
-
-#. 608
-#: ../navit/country.c:199
-msgid "Philippines"
-msgstr ""
-
-#. 586
-#: ../navit/country.c:200
-msgid "Pakistan"
-msgstr ""
-
-#. 616
-#: ../navit/country.c:201
-msgid "Poland"
-msgstr "Polen"
-
-#. 666
-#: ../navit/country.c:202
-msgid "Saint Pierre and Miquelon"
-msgstr ""
-
-#. 612
-#: ../navit/country.c:203
-msgid "Pitcairn"
-msgstr ""
-
-#. 630
-#: ../navit/country.c:204
-msgid "Puerto Rico"
-msgstr ""
-
-#. 275
-#: ../navit/country.c:205
-msgid "Palestinian Territory, Occupied"
-msgstr ""
-
-#. 620
-#: ../navit/country.c:206
-msgid "Portugal"
-msgstr "Portugal"
-
-#. 585
-#: ../navit/country.c:207
-msgid "Palau"
-msgstr ""
-
-#. 600
-#: ../navit/country.c:208
-msgid "Paraguay"
-msgstr ""
-
-#. 634
-#: ../navit/country.c:209
-msgid "Qatar"
-msgstr ""
-
-#. 638
-#: ../navit/country.c:210
-msgid "Reunion"
-msgstr ""
-
-#. 642
-#: ../navit/country.c:211
-msgid "Romania"
-msgstr "Romænien"
-
-#. 688
-#: ../navit/country.c:212
-msgid "Serbia"
-msgstr "Serbien"
-
-#. 643
-#: ../navit/country.c:213
-msgid "Russian Federation"
-msgstr "Rusland"
-
-#. 646
-#: ../navit/country.c:214
-msgid "Rwanda"
-msgstr ""
-
-#. 682
-#: ../navit/country.c:215
-msgid "Saudi Arabia"
-msgstr "Saudi-Arabien"
-
-#. 090
-#: ../navit/country.c:216
-msgid "Solomon Islands"
-msgstr ""
-
-#. 690
-#: ../navit/country.c:217
-msgid "Seychelles"
-msgstr ""
-
-#. 736
-#: ../navit/country.c:218
-msgid "Sudan"
-msgstr ""
-
-#. 752
-#: ../navit/country.c:219
-msgid "Sweden"
-msgstr "Sverige"
-
-#. 702
-#: ../navit/country.c:220
-msgid "Singapore"
-msgstr ""
-
-#. 654
-#: ../navit/country.c:221
-msgid "Saint Helena"
-msgstr ""
-
-#. 705
-#: ../navit/country.c:222
-msgid "Slovenia"
-msgstr "Slovenien"
-
-#. 744
-#: ../navit/country.c:223
-msgid "Svalbard and Jan Mayen"
-msgstr ""
-
-#. 703
-#: ../navit/country.c:224
-msgid "Slovakia"
-msgstr "Slovakiet"
-
-#. 694
-#: ../navit/country.c:225
-msgid "Sierra Leone"
-msgstr ""
-
-#. 674
-#: ../navit/country.c:226
-msgid "San Marino"
-msgstr "San Marino"
-
-#. 686
-#: ../navit/country.c:227
-msgid "Senegal"
-msgstr ""
-
-#. 706
-#: ../navit/country.c:228
-msgid "Somalia"
-msgstr ""
-
-#. 740
-#: ../navit/country.c:229
-msgid "Suriname"
-msgstr ""
-
-#. 678
-#: ../navit/country.c:230
-msgid "Sao Tome and Principe"
-msgstr ""
-
-#. 222
-#: ../navit/country.c:231
-msgid "El Salvador"
-msgstr ""
-
-#. 760
-#: ../navit/country.c:232
-msgid "Syrian Arab Republic"
-msgstr ""
-
-#. 748
-#: ../navit/country.c:233
-msgid "Swaziland"
-msgstr ""
-
-#. 796
-#: ../navit/country.c:234
-msgid "Turks and Caicos Islands"
-msgstr ""
-
-#. 148
-#: ../navit/country.c:235
-msgid "Chad"
-msgstr ""
-
-#. 260
-#: ../navit/country.c:236
-msgid "French Southern Territories"
-msgstr ""
-
-#. 768
-#: ../navit/country.c:237
-msgid "Togo"
-msgstr ""
-
-#. 764
-#: ../navit/country.c:238
-msgid "Thailand"
-msgstr ""
-
-#. 762
-#: ../navit/country.c:239
-msgid "Tajikistan"
-msgstr ""
-
-#. 772
-#: ../navit/country.c:240
-msgid "Tokelau"
-msgstr ""
-
-#. 626
-#: ../navit/country.c:241
-msgid "Timor-Leste"
-msgstr ""
-
-#. 795
-#: ../navit/country.c:242
-msgid "Turkmenistan"
-msgstr ""
-
-#. 788
-#: ../navit/country.c:243
-msgid "Tunisia"
-msgstr "Tunesien"
-
-#. 776
-#: ../navit/country.c:244
-msgid "Tonga"
-msgstr ""
-
-#. 792
-#: ../navit/country.c:245
-msgid "Turkey"
-msgstr "Tyrkiet"
-
-#. 780
-#: ../navit/country.c:246
-msgid "Trinidad and Tobago"
-msgstr ""
-
-#. 798
-#: ../navit/country.c:247
-msgid "Tuvalu"
-msgstr ""
-
-#. 158
-#: ../navit/country.c:248
-msgid "Taiwan, Province of China"
-msgstr ""
-
-#. 834
-#: ../navit/country.c:249
-msgid "Tanzania, United Republic of"
-msgstr ""
-
-#. 804
-#: ../navit/country.c:250
-msgid "Ukraine"
-msgstr "Ukraine"
-
-#. 800
-#: ../navit/country.c:251
-msgid "Uganda"
-msgstr ""
-
-#. 581
-#: ../navit/country.c:252
-msgid "United States Minor Outlying Islands"
-msgstr ""
-
-#. 840
-#: ../navit/country.c:253
-msgid "United States"
-msgstr ""
-
-#. 858
-#: ../navit/country.c:254
-msgid "Uruguay"
-msgstr ""
-
-#. 860
-#: ../navit/country.c:255
-msgid "Uzbekistan"
-msgstr ""
-
-#. 336
-#: ../navit/country.c:256
-msgid "Holy See (Vatican City State)"
-msgstr ""
-
-#. 670
-#: ../navit/country.c:257
-msgid "Saint Vincent and the Grenadines"
-msgstr ""
-
-#. 862
-#: ../navit/country.c:258
-msgid "Venezuela"
-msgstr ""
-
-#. 092
-#: ../navit/country.c:259
-msgid "Virgin Islands, British"
-msgstr ""
-
-#. 850
-#: ../navit/country.c:260
-msgid "Virgin Islands, U.S."
-msgstr ""
-
-#. 704
-#: ../navit/country.c:261
-msgid "Viet Nam"
-msgstr ""
-
-#. 548
-#: ../navit/country.c:262
-msgid "Vanuatu"
-msgstr ""
-
-#. 876
-#: ../navit/country.c:263
-msgid "Wallis and Futuna"
-msgstr ""
-
-#. 882
-#: ../navit/country.c:264
-msgid "Samoa"
-msgstr ""
-
-#. 887
-#: ../navit/country.c:265
-msgid "Yemen"
-msgstr ""
-
-#. 175
-#: ../navit/country.c:266
-msgid "Mayotte"
-msgstr ""
-
-#. 710
-#: ../navit/country.c:267
-msgid "South Africa"
-msgstr ""
-
-#. 894
-#: ../navit/country.c:268
-msgid "Zambia"
-msgstr ""
-
-#. 716
-#: ../navit/country.c:269
-msgid "Zimbabwe"
-msgstr ""
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:98
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-msgid "Car"
-msgstr "Bil"
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso2"
-msgstr "Iso2"
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso3"
-msgstr "Iso3"
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:403
-msgid "Country"
-msgstr "Land"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "Postal"
-msgstr ""
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "Town"
-msgstr "By"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "District"
-msgstr "Område"
-
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-#: ../navit/gui/gtk/destination.c:412
-msgid "Street"
-msgstr "Gade"
-
-#: ../navit/gui/gtk/destination.c:100 ../navit/gui/gtk/destination.c:414
-msgid "Number"
-msgstr "Nummer"
-
-#: ../navit/gui/gtk/destination.c:398
-msgid "Enter Destination"
-msgstr "Indtast destination"
-
-#: ../navit/gui/gtk/destination.c:405
-msgid "Zip Code"
-msgstr "Postnummer"
-
-#: ../navit/gui/gtk/destination.c:407
-msgid "City"
-msgstr "By"
-
-#: ../navit/gui/gtk/destination.c:409
-msgid "District/Township"
-msgstr "Distrikt"
-
-#: ../navit/gui/gtk/destination.c:437 ../navit/gui/gtk/gui_gtk_action.c:153
-msgid "Map"
-msgstr "Kort"
-
-#: ../navit/gui/gtk/destination.c:438
-msgid "Bookmark"
-msgstr "Bogmærke"
-
-#: ../navit/gui/gtk/destination.c:439 ../navit/gui/gtk/gui_gtk_action.c:166
-msgid "Destination"
-msgstr "Destination"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:149
-msgid "Display"
-msgstr "Vis"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:150
-msgid "Route"
-msgstr "Rute"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:154
-msgid "Layout"
-msgstr "Layout"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:155
-msgid "Projection"
-msgstr "Visning"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:156
-msgid "Vehicle"
-msgstr "Køretøj"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:157
-msgid "ZoomOut"
-msgstr "Zoom ud"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:158
-msgid "ZoomIn"
-msgstr "Zoom ind"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:159
-msgid "Refresh"
-msgstr "Forny"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:162 ../navit/gui/gtk/gui_gtk_action.c:164
-msgid "Info"
-msgstr "Information"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:167
-msgid "Clear"
-msgstr "Ryd"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:168
-msgid "Test"
-msgstr "Test"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:169
-msgid "_Quit"
-msgstr "_Afslut"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:176
-msgid "Cursor"
-msgstr "Markør"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:177
-msgid "Tracking"
-msgstr "Sporing"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:178
-msgid "Orientation"
-msgstr "Retning"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:180 ../navit/gui/gtk/gui_gtk_action.c:182
-msgid "Fullscreen"
-msgstr "Fuldskærm"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:190
-msgid "Data"
-msgstr "Data"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "N"
-msgstr "N"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NE"
-msgstr "NØ"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "E"
-msgstr "Ø"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SE"
-msgstr "SØ"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "S"
-msgstr "S"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SW"
-msgstr "SV"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "W"
-msgstr "V"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NW"
-msgstr "NV"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:103
-#, c-format
-msgid "Route %4.0fkm %02d:%02d ETA"
-msgstr "Rute %4.0fkm %02d:%02d ETA"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:148
-msgid "Route 0000km 0+00:00 ETA"
-msgstr "Rute 0000km 0+00:00 ETA"
diff --git a/po/de.po b/po/de.po
deleted file mode 100644
index 9390ae64..00000000
--- a/po/de.po
+++ /dev/null
@@ -1,1687 +0,0 @@
-# German translations for navit
-# Copyright (C) 2007
-# This file is distributed under the same license as the navit package.
-# Martin Schaller <martin-s@sourceforge.net>, 2007.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: Navit 0.1.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-05-26 17:12+0200\n"
-"PO-Revision-Date: 2008-05-27 22:03+0000\n"
-"Last-Translator: singesang <Unknown>\n"
-"Language-Team: Martin Schaller <martin-s@sourceforge.net>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Launchpad-Export-Date: 2008-05-30 21:28+0000\n"
-"X-Generator: Launchpad (build Unknown)\n"
-
-#: ../navit/main.c:111
-#, c-format
-msgid ""
-"navit usage:\n"
-"navit [options] [configfile]\n"
-"\t-c <file>: use <file> as config file\n"
-"\t-d <n>: set the debug output level to <n>. (TODO)\n"
-"\t-h: print this usage info and exit.\n"
-"\t-v: Print the version and exit.\n"
-msgstr ""
-"navit [Optionen] [configdatei]\n"
-"\t-c <datei>: <datei> als Konfigurationsdatei benutzen.\n"
-"\t-d <n>: Debugkevek auf <n> setzen. (TODO)\n"
-"\t-h: Diese Hilfe anzeigen und beenden.\n"
-"\t-v: Versionsinfo anzeigen und beenden.\n"
-
-#: ../navit/main.c:131
-#, c-format
-msgid "Running from source directory\n"
-msgstr "Aufruf aus Quellverzeichnis\n"
-
-#: ../navit/main.c:147
-#, c-format
-msgid "setting '%s' to '%s'\n"
-msgstr "setze '%s' auf '%s'\n"
-
-#. We have not found an existing config file from all possibilities
-#: ../navit/main.c:248
-#, c-format
-msgid "No config file navit.xml, navit.xml.local found\n"
-msgstr "Keine Konfigurationsdatei navit.xml, navit.xml.local gefunden\n"
-
-#: ../navit/main.c:255
-#, c-format
-msgid "Error parsing '%s': %s\n"
-msgstr "Fehler beim Parsen von '%s': %s\n"
-
-#: ../navit/main.c:258
-#, c-format
-msgid "Using '%s'\n"
-msgstr "Benutze '%s'\n"
-
-#: ../navit/main.c:261
-#, c-format
-msgid "No instance has been created, exiting\n"
-msgstr "Es wurde keine Instanz erzeugt, Ende\n"
-
-#: ../navit/navigation.c:171
-#, c-format
-msgid "%d m"
-msgstr "%d Meter"
-
-#: ../navit/navigation.c:173
-#, c-format
-msgid "in %d m"
-msgstr "In %d metern"
-
-#: ../navit/navigation.c:177
-#, c-format
-msgid "%d meters"
-msgstr "%d Meter"
-
-#: ../navit/navigation.c:179
-#, c-format
-msgid "in %d meters"
-msgstr "In %d Metern"
-
-#: ../navit/navigation.c:185
-#, c-format
-msgid "%d.%d kilometer"
-msgstr "%d,%d Kilometer"
-
-#: ../navit/navigation.c:187
-#, c-format
-msgid "in %d.%d kilometers"
-msgstr "In %d,%d Kilometern"
-
-#: ../navit/navigation.c:191
-#, c-format
-msgid "one kilometer"
-msgid_plural "%d kilometers"
-msgstr[0] "einen Kilometer"
-msgstr[1] "%d Kilometer"
-
-#: ../navit/navigation.c:193
-#, c-format
-msgid "in one kilometer"
-msgid_plural "in %d kilometers"
-msgstr[0] "In einem Kilometer"
-msgstr[1] "In %d Kilometern"
-
-#: ../navit/navigation.c:447
-msgid "exit"
-msgstr "Ausfahrt"
-
-#: ../navit/navigation.c:449
-msgid "ramp"
-msgstr "Autobahnauffahrt"
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name
-#: ../navit/navigation.c:479
-#, c-format
-msgid "%sinto the street %s%s%s"
-msgstr "%sauf die Straße %s%s%s"
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Male form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:483
-#, c-format
-msgid "%sinto the %s%s%s|male form"
-msgstr "%sauf den %s%s%s"
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Female form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:487
-#, c-format
-msgid "%sinto the %s%s%s|female form"
-msgstr "%sauf die %s%s%s"
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Neutral form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:491
-#, c-format
-msgid "%sinto the %s%s%s|neutral form"
-msgstr "%sauf das %s%s%s"
-
-#: ../navit/navigation.c:497
-#, c-format
-msgid "into the %s"
-msgstr "auf die %s"
-
-#: ../navit/navigation.c:518
-msgid "right"
-msgstr "rechts"
-
-#: ../navit/navigation.c:525
-msgid "left"
-msgstr "links"
-
-#: ../navit/navigation.c:529
-msgid "easily "
-msgstr "leicht "
-
-#: ../navit/navigation.c:533
-msgid "strongly "
-msgstr "scharf "
-
-#: ../navit/navigation.c:536
-msgid "unknown "
-msgstr "unbekannt "
-
-#
-#: ../navit/navigation.c:542
-msgid "When possible, please turn around"
-msgstr "Wenn möglich bitte wenden"
-
-#: ../navit/navigation.c:549
-#, c-format
-msgid "Follow the road for the next %s"
-msgstr "Dem Straßenverlauf %s folgen"
-
-#: ../navit/navigation.c:553
-msgid "soon"
-msgstr "Demnächst"
-
-#: ../navit/navigation.c:559
-msgid "now"
-msgstr "Jetzt"
-
-#: ../navit/navigation.c:562
-msgid "error"
-msgstr "Fehler"
-
-# c-format
-#. TRANSLATORS: The first argument is strength, the second direction, the third distance and the fourth destination Example: 'Turn 'slightly' 'left' in '100 m' 'onto baker street'
-#: ../navit/navigation.c:591
-#, c-format
-msgid "Turn %1$s%2$s %3$s%4$s"
-msgstr "%3$s %1$s%2$s abbiegen%4$s"
-
-#: ../navit/navigation.c:594
-#, c-format
-msgid "You have reached your destination %s"
-msgstr "%s haben Sie ihr Ziel erreicht"
-
-#: ../navit/navit.c:664 ../navit/gui/gtk/gui_gtk_action.c:151
-msgid "Former Destinations"
-msgstr "Letzte Ziele"
-
-#: ../navit/navit.c:674 ../navit/gui/gtk/gui_gtk_action.c:152
-msgid "Bookmarks"
-msgstr "Lesezeichen"
-
-#: ../navit/navit.c:764
-msgid "Command"
-msgstr "Befehl"
-
-#: ../navit/navit.c:769
-msgid "Length"
-msgstr "Länge"
-
-#: ../navit/navit.c:773 ../navit/navit.c:798
-msgid "km"
-msgstr "km"
-
-#: ../navit/navit.c:777 ../navit/navit.c:802
-msgid "m"
-msgstr "m"
-
-#: ../navit/navit.c:783
-msgid "Time"
-msgstr "Zeit"
-
-#: ../navit/navit.c:795
-#, fuzzy
-msgid "Destination Length"
-msgstr "Verbleibende Strecke"
-
-#: ../navit/navit.c:808
-#, fuzzy
-msgid "Destination Time"
-msgstr "Fahrzeit"
-
-#: ../navit/navit.c:837 ../navit/gui/gtk/gui_gtk_action.c:160
-msgid "Roadbook"
-msgstr "Straßenliste"
-
-#: ../navit/popup.c:200 ../navit/popup.c:254
-msgid "Set as position"
-msgstr "Als Position setzen"
-
-#: ../navit/popup.c:201 ../navit/popup.c:255
-msgid "Set as destination"
-msgstr "Als Ziel setzen"
-
-#: ../navit/popup.c:202 ../navit/popup.c:256
-msgid "Add as bookmark"
-msgstr "Als Lesezeichen aufnehmen"
-
-#: ../navit/popup.c:244
-#, c-format
-msgid "Point 0x%x 0x%x"
-msgstr "Punkt 0x%x 0x%x"
-
-#: ../navit/popup.c:245
-#, c-format
-msgid "Screen coord : %d %d"
-msgstr "Bildschirm %d %d"
-
-#. 020
-#: ../navit/country.c:24
-msgid "Andorra"
-msgstr "Andorra"
-
-#. 784
-#: ../navit/country.c:25
-msgid "United Arab Emirates"
-msgstr "Vereinigte Arabische Emirate"
-
-#. 004
-#: ../navit/country.c:26
-msgid "Afghanistan"
-msgstr "Afghanistan"
-
-#. 028
-#: ../navit/country.c:27
-msgid "Antigua and Barbuda"
-msgstr "Antigua und Barbuda"
-
-#. 660
-#: ../navit/country.c:28
-msgid "Anguilla"
-msgstr "Anguilla"
-
-#. 008
-#: ../navit/country.c:29
-msgid "Albania"
-msgstr "Albanien"
-
-#. 051
-#: ../navit/country.c:30
-msgid "Armenia"
-msgstr "Armenien"
-
-#
-#. 530
-#: ../navit/country.c:31
-msgid "Netherlands Antilles"
-msgstr "Niederländische Antillen"
-
-#
-#. 024
-#: ../navit/country.c:32
-msgid "Angola"
-msgstr "Andorra"
-
-#. 010
-#: ../navit/country.c:33
-msgid "Antarctica"
-msgstr "Antarktis"
-
-#. 032
-#: ../navit/country.c:34
-msgid "Argentina"
-msgstr "Argentinien"
-
-#. 016
-#: ../navit/country.c:35
-msgid "American Samoa"
-msgstr "Amerikanisch-Samoa"
-
-#. 040
-#: ../navit/country.c:36
-msgid "Austria"
-msgstr "Österreich"
-
-#. 036
-#: ../navit/country.c:37
-msgid "Australia"
-msgstr "Australien"
-
-#. 533
-#: ../navit/country.c:38
-msgid "Aruba"
-msgstr "Aruba"
-
-#. 248
-#: ../navit/country.c:39
-msgid "Aland Islands"
-msgstr "Ã…land"
-
-#. 031
-#: ../navit/country.c:40
-msgid "Azerbaijan"
-msgstr "Aserbaidschan"
-
-#. 070
-#: ../navit/country.c:41
-msgid "Bosnia and Herzegovina"
-msgstr "Bosnien und Herzegowina"
-
-#. 052
-#: ../navit/country.c:42
-msgid "Barbados"
-msgstr "Barbados"
-
-#. 050
-#: ../navit/country.c:43
-msgid "Bangladesh"
-msgstr "Bangladesch"
-
-#. 056
-#: ../navit/country.c:44
-msgid "Belgium"
-msgstr "Belgien"
-
-#. 854
-#: ../navit/country.c:45
-msgid "Burkina Faso"
-msgstr "Burkina Faso"
-
-#. 100
-#: ../navit/country.c:46
-msgid "Bulgaria"
-msgstr "Bulgarien"
-
-#. 048
-#: ../navit/country.c:47
-msgid "Bahrain"
-msgstr "Bahrain"
-
-#. 108
-#: ../navit/country.c:48
-msgid "Burundi"
-msgstr "Burundi"
-
-#. 204
-#: ../navit/country.c:49
-msgid "Benin"
-msgstr "Benin"
-
-#. 652
-#: ../navit/country.c:50
-msgid "Saint Barthelemy"
-msgstr "Saint-Barthélemy"
-
-#. 060
-#: ../navit/country.c:51
-msgid "Bermuda"
-msgstr "Bermuda"
-
-#. 096
-#: ../navit/country.c:52
-msgid "Brunei Darussalam"
-msgstr "Brunei Darussalam"
-
-#. 068
-#: ../navit/country.c:53
-msgid "Bolivia"
-msgstr "Bolivien"
-
-#. 076
-#: ../navit/country.c:54
-msgid "Brazil"
-msgstr "Brasilien"
-
-#. 044
-#: ../navit/country.c:55
-msgid "Bahamas"
-msgstr "Bahamas"
-
-#. 064
-#: ../navit/country.c:56
-msgid "Bhutan"
-msgstr "Bhutan"
-
-#. 074
-#: ../navit/country.c:57
-msgid "Bouvet Island"
-msgstr "Bouvetinsel"
-
-#. 072
-#: ../navit/country.c:58
-msgid "Botswana"
-msgstr "Botsuana"
-
-#. 112
-#: ../navit/country.c:59
-msgid "Belarus"
-msgstr "Weißrussland"
-
-#. 084
-#: ../navit/country.c:60
-msgid "Belize"
-msgstr "Belize"
-
-#. 124
-#: ../navit/country.c:61
-msgid "Canada"
-msgstr "Kanada"
-
-#. 166
-#: ../navit/country.c:62
-msgid "Cocos (Keeling) Islands"
-msgstr "Kokosinseln"
-
-#. 180
-#: ../navit/country.c:63
-msgid "Congo, Democratic Republic of the"
-msgstr "Kongo, Demokratische Republik"
-
-#. 140
-#: ../navit/country.c:64
-msgid "Central African Republic"
-msgstr "Zentralafrikanische Republik"
-
-#. 178
-#: ../navit/country.c:65
-msgid "Congo"
-msgstr "Republik Kongo"
-
-#. 756
-#: ../navit/country.c:66
-msgid "Switzerland"
-msgstr "Schweiz"
-
-#. 384
-#: ../navit/country.c:67
-msgid "Cote d'Ivoire"
-msgstr "Côte d'Ivoire"
-
-#. 184
-#: ../navit/country.c:68
-msgid "Cook Islands"
-msgstr "Cookinseln"
-
-#. 152
-#: ../navit/country.c:69
-msgid "Chile"
-msgstr "Chile"
-
-#. 120
-#: ../navit/country.c:70
-msgid "Cameroon"
-msgstr "Kamerun"
-
-#. 156
-#: ../navit/country.c:71
-msgid "China"
-msgstr "China, Volksrepublik"
-
-#. 170
-#: ../navit/country.c:72
-msgid "Colombia"
-msgstr "Kolumbien"
-
-#. 188
-#: ../navit/country.c:73
-msgid "Costa Rica"
-msgstr "Costa Rica"
-
-#. 192
-#: ../navit/country.c:74
-msgid "Cuba"
-msgstr "Kuba"
-
-#. 132
-#: ../navit/country.c:75
-msgid "Cape Verde"
-msgstr "Kap Verde"
-
-#. 162
-#: ../navit/country.c:76
-msgid "Christmas Island"
-msgstr "Weihnachtsinsel"
-
-#. 196
-#: ../navit/country.c:77
-msgid "Cyprus"
-msgstr "Zypern"
-
-#. 203
-#: ../navit/country.c:78
-msgid "Czech Republic"
-msgstr "Tschechische Republik"
-
-#. 276
-#: ../navit/country.c:79
-msgid "Germany"
-msgstr "Deutschland"
-
-#. 262
-#: ../navit/country.c:80
-msgid "Djibouti"
-msgstr "Dschibuti"
-
-#. 208
-#: ../navit/country.c:81
-msgid "Denmark"
-msgstr "Dänemark"
-
-#. 212
-#: ../navit/country.c:82
-msgid "Dominica"
-msgstr "Dominica"
-
-#. 214
-#: ../navit/country.c:83
-msgid "Dominican Republic"
-msgstr "Dominikanische Republik"
-
-#. 012
-#: ../navit/country.c:84
-msgid "Algeria"
-msgstr "Algerien"
-
-#. 218
-#: ../navit/country.c:85
-msgid "Ecuador"
-msgstr "Ecuador"
-
-#. 233
-#: ../navit/country.c:86
-msgid "Estonia"
-msgstr "Estland"
-
-#. 818
-#: ../navit/country.c:87
-msgid "Egypt"
-msgstr "Ägypten"
-
-#. 732
-#: ../navit/country.c:88
-msgid "Western Sahara"
-msgstr "Westsahara"
-
-#. 232
-#: ../navit/country.c:89
-msgid "Eritrea"
-msgstr "Eritrea"
-
-#. 724
-#: ../navit/country.c:90
-msgid "Spain"
-msgstr "Spanien"
-
-#. 231
-#: ../navit/country.c:91
-msgid "Ethiopia"
-msgstr "Äthiopien"
-
-#. 246
-#: ../navit/country.c:92
-msgid "Finland"
-msgstr "Finnland"
-
-#. 242
-#: ../navit/country.c:93
-msgid "Fiji"
-msgstr "Fidschi"
-
-#. 238
-#: ../navit/country.c:94
-msgid "Falkland Islands (Malvinas)"
-msgstr "Falklandinseln"
-
-#. 583
-#: ../navit/country.c:95
-msgid "Micronesia, Federated States of"
-msgstr "Mikronesien"
-
-#. 234
-#: ../navit/country.c:96
-msgid "Faroe Islands"
-msgstr "Färöer"
-
-#. 250
-#: ../navit/country.c:97
-msgid "France"
-msgstr "Frankreich"
-
-#. 266
-#: ../navit/country.c:98
-msgid "Gabon"
-msgstr "Gabun"
-
-#. 826
-#: ../navit/country.c:99
-msgid "United Kingdom"
-msgstr "Grossbritannien"
-
-#. 308
-#: ../navit/country.c:100
-msgid "Grenada"
-msgstr "Grenada"
-
-#. 268
-#: ../navit/country.c:101
-msgid "Georgia"
-msgstr "Georgien"
-
-#. 254
-#: ../navit/country.c:102
-msgid "French Guiana"
-msgstr "Französisch-Guayana"
-
-#. 831
-#: ../navit/country.c:103
-msgid "Guernsey"
-msgstr "Guernsey"
-
-#. 288
-#: ../navit/country.c:104
-msgid "Ghana"
-msgstr "Ghana"
-
-#. 292
-#: ../navit/country.c:105
-msgid "Gibraltar"
-msgstr "Gibraltar"
-
-#. 304
-#: ../navit/country.c:106
-msgid "Greenland"
-msgstr "Grönland"
-
-#. 270
-#: ../navit/country.c:107
-msgid "Gambia"
-msgstr "Gambia"
-
-#. 324
-#: ../navit/country.c:108
-msgid "Guinea"
-msgstr "Guinea"
-
-#. 312
-#: ../navit/country.c:109
-msgid "Guadeloupe"
-msgstr "Guadeloupe"
-
-#. 226
-#: ../navit/country.c:110
-msgid "Equatorial Guinea"
-msgstr "Äquatorialguinea"
-
-#. 300
-#: ../navit/country.c:111
-msgid "Greece"
-msgstr "Griechenland"
-
-#. 239
-#: ../navit/country.c:112
-msgid "South Georgia and the South Sandwich Islands"
-msgstr "Südgeorgien und die Südlichen Sandwichinseln"
-
-#. 320
-#: ../navit/country.c:113
-msgid "Guatemala"
-msgstr "Guatemala"
-
-#. 316
-#: ../navit/country.c:114
-msgid "Guam"
-msgstr "Guam"
-
-#. 624
-#: ../navit/country.c:115
-msgid "Guinea-Bissau"
-msgstr "Guinea-Bissau"
-
-#. 328
-#: ../navit/country.c:116
-msgid "Guyana"
-msgstr "Guyana"
-
-#. 344
-#: ../navit/country.c:117
-msgid "Hong Kong"
-msgstr "Hongkong"
-
-#. 334
-#: ../navit/country.c:118
-msgid "Heard Island and McDonald Islands"
-msgstr "Heard- und McDonald-Inseln"
-
-#. 340
-#: ../navit/country.c:119
-msgid "Honduras"
-msgstr "Honduras"
-
-#. 191
-#: ../navit/country.c:120
-msgid "Croatia"
-msgstr "Kroatien"
-
-#. 332
-#: ../navit/country.c:121
-msgid "Haiti"
-msgstr "Haiti"
-
-#. 348
-#: ../navit/country.c:122
-msgid "Hungary"
-msgstr "Ungarn"
-
-#. 360
-#: ../navit/country.c:123
-msgid "Indonesia"
-msgstr "Indonesien"
-
-#. 372
-#: ../navit/country.c:124
-msgid "Ireland"
-msgstr "Irland"
-
-#. 376
-#: ../navit/country.c:125
-msgid "Israel"
-msgstr "Israel"
-
-#. 833
-#: ../navit/country.c:126
-msgid "Isle of Man"
-msgstr "Insel Man"
-
-#. 356
-#: ../navit/country.c:127
-msgid "India"
-msgstr "Indien"
-
-#. 086
-#: ../navit/country.c:128
-msgid "British Indian Ocean Territory"
-msgstr "Britisches Territorium im Indischen Ozean"
-
-#. 368
-#: ../navit/country.c:129
-msgid "Iraq"
-msgstr "Irak"
-
-#. 364
-#: ../navit/country.c:130
-msgid "Iran, Islamic Republic of"
-msgstr "Iran, Islamische Republik"
-
-#. 352
-#: ../navit/country.c:131
-msgid "Iceland"
-msgstr "Island"
-
-#. 380
-#: ../navit/country.c:132
-msgid "Italy"
-msgstr "Italien"
-
-#. 832
-#: ../navit/country.c:133
-msgid "Jersey"
-msgstr "Jersey"
-
-#. 388
-#: ../navit/country.c:134
-msgid "Jamaica"
-msgstr "Jamaika"
-
-#. 400
-#: ../navit/country.c:135
-msgid "Jordan"
-msgstr "Jordanien"
-
-#. 392
-#: ../navit/country.c:136
-msgid "Japan"
-msgstr "Japan"
-
-#. 404
-#: ../navit/country.c:137
-msgid "Kenya"
-msgstr "Kenia"
-
-#. 417
-#: ../navit/country.c:138
-msgid "Kyrgyzstan"
-msgstr "Kirgisistan"
-
-#. 116
-#: ../navit/country.c:139
-msgid "Cambodia"
-msgstr "Kambodscha"
-
-#. 296
-#: ../navit/country.c:140
-msgid "Kiribati"
-msgstr "Kiribati"
-
-#. 174
-#: ../navit/country.c:141
-msgid "Comoros"
-msgstr "Komoren"
-
-#. 659
-#: ../navit/country.c:142
-msgid "Saint Kitts and Nevis"
-msgstr "St. Kitts und Nevis"
-
-#. 408
-#: ../navit/country.c:143
-msgid "Korea, Democratic People's Republic of"
-msgstr "Korea, Demokratische Volksrepublik"
-
-#. 410
-#: ../navit/country.c:144
-msgid "Korea, Republic of"
-msgstr "Tschechische Republik"
-
-#. 414
-#: ../navit/country.c:145
-msgid "Kuwait"
-msgstr "Kuwait"
-
-#. 136
-#: ../navit/country.c:146
-msgid "Cayman Islands"
-msgstr "Kaimaninseln"
-
-#. 398
-#: ../navit/country.c:147
-msgid "Kazakhstan"
-msgstr "Kasachstan"
-
-#. 418
-#: ../navit/country.c:148
-msgid "Lao People's Democratic Republic"
-msgstr "Laos, Demokratische Volksrepublik"
-
-#. 422
-#: ../navit/country.c:149
-msgid "Lebanon"
-msgstr "Libanon"
-
-#. 662
-#: ../navit/country.c:150
-msgid "Saint Lucia"
-msgstr "St. Lucia"
-
-#. 438
-#: ../navit/country.c:151
-msgid "Liechtenstein"
-msgstr "Lichtenstein"
-
-#. 144
-#: ../navit/country.c:152
-msgid "Sri Lanka"
-msgstr "Sri Lanka"
-
-#. 430
-#: ../navit/country.c:153
-msgid "Liberia"
-msgstr "Liberia"
-
-#. 426
-#: ../navit/country.c:154
-msgid "Lesotho"
-msgstr "Lesotho"
-
-#. 440
-#: ../navit/country.c:155
-msgid "Lithuania"
-msgstr "Litauen"
-
-#. 442
-#: ../navit/country.c:156
-msgid "Luxembourg"
-msgstr "Luxemburg"
-
-#. 428
-#: ../navit/country.c:157
-msgid "Latvia"
-msgstr "Lettland"
-
-#. 434
-#: ../navit/country.c:158
-msgid "Libyan Arab Jamahiriya"
-msgstr "Libysch-Arabische Dschamahirija"
-
-#. 504
-#: ../navit/country.c:159
-msgid "Morocco"
-msgstr "Marokko"
-
-#. 492
-#: ../navit/country.c:160
-msgid "Monaco"
-msgstr "Monaco"
-
-#. 498
-#: ../navit/country.c:161
-msgid "Moldova, Republic of"
-msgstr "Moldawien"
-
-#. 499
-#: ../navit/country.c:162
-msgid "Montenegro"
-msgstr "Montenegro"
-
-#. 663
-#: ../navit/country.c:163
-msgid "Saint Martin (French part)"
-msgstr "Saint-Martin (franz. Teil)"
-
-#. 450
-#: ../navit/country.c:164
-msgid "Madagascar"
-msgstr "Madagaskar"
-
-#. 584
-#: ../navit/country.c:165
-msgid "Marshall Islands"
-msgstr "Marshallinseln"
-
-#. 807
-#: ../navit/country.c:166
-msgid "Macedonia, the former Yugoslav Republic of"
-msgstr "Mazedonien, ehem. jugoslawische Republik"
-
-#. 466
-#: ../navit/country.c:167
-msgid "Mali"
-msgstr "Mali"
-
-#. 104
-#: ../navit/country.c:168
-msgid "Myanmar"
-msgstr "Burma"
-
-#. 496
-#: ../navit/country.c:169
-msgid "Mongolia"
-msgstr "Mongolei"
-
-#. 446
-#: ../navit/country.c:170
-msgid "Macao"
-msgstr "Macao"
-
-#. 580
-#: ../navit/country.c:171
-msgid "Northern Mariana Islands"
-msgstr "Nördliche Marianen"
-
-#. 474
-#: ../navit/country.c:172
-msgid "Martinique"
-msgstr "Martinique"
-
-#. 478
-#: ../navit/country.c:173
-msgid "Mauritania"
-msgstr "Mauretanien"
-
-#. 500
-#: ../navit/country.c:174
-msgid "Montserrat"
-msgstr "Montserrat"
-
-#. 470
-#: ../navit/country.c:175
-msgid "Malta"
-msgstr "Malta"
-
-#. 480
-#: ../navit/country.c:176
-msgid "Mauritius"
-msgstr "Mauritius"
-
-#. 462
-#: ../navit/country.c:177
-msgid "Maldives"
-msgstr "Malediven"
-
-#. 454
-#: ../navit/country.c:178
-msgid "Malawi"
-msgstr "Malawi"
-
-#. 484
-#: ../navit/country.c:179
-msgid "Mexico"
-msgstr "Mexiko"
-
-#. 458
-#: ../navit/country.c:180
-msgid "Malaysia"
-msgstr "Malaysia"
-
-#. 508
-#: ../navit/country.c:181
-msgid "Mozambique"
-msgstr "Mosambik"
-
-#. 516
-#: ../navit/country.c:182
-msgid "Namibia"
-msgstr "Namibia"
-
-#. 540
-#: ../navit/country.c:183
-msgid "New Caledonia"
-msgstr "Neukaledonien"
-
-#. 562
-#: ../navit/country.c:184
-msgid "Niger"
-msgstr "Niger"
-
-#. 574
-#: ../navit/country.c:185
-msgid "Norfolk Island"
-msgstr "Norfolkinsel"
-
-#. 566
-#: ../navit/country.c:186
-msgid "Nigeria"
-msgstr "Nigeria"
-
-#. 558
-#: ../navit/country.c:187
-msgid "Nicaragua"
-msgstr "Nicaragua"
-
-#. 528
-#: ../navit/country.c:188
-msgid "Netherlands"
-msgstr "Niederlande"
-
-#. 578
-#: ../navit/country.c:189
-msgid "Norway"
-msgstr "Norwegen"
-
-#. 524
-#: ../navit/country.c:190
-msgid "Nepal"
-msgstr "Nepal"
-
-#. 520
-#: ../navit/country.c:191
-msgid "Nauru"
-msgstr "Nauru"
-
-#. 570
-#: ../navit/country.c:192
-msgid "Niue"
-msgstr "Niue"
-
-#. 554
-#: ../navit/country.c:193
-msgid "New Zealand"
-msgstr "Neuseeland"
-
-#. 512
-#: ../navit/country.c:194
-msgid "Oman"
-msgstr "Oman"
-
-#. 591
-#: ../navit/country.c:195
-msgid "Panama"
-msgstr "Panama"
-
-#. 604
-#: ../navit/country.c:196
-msgid "Peru"
-msgstr "Peru"
-
-#. 258
-#: ../navit/country.c:197
-msgid "French Polynesia"
-msgstr "Französisch-Polynesien"
-
-#. 598
-#: ../navit/country.c:198
-msgid "Papua New Guinea"
-msgstr "Papua-Neuguinea"
-
-#. 608
-#: ../navit/country.c:199
-msgid "Philippines"
-msgstr "Philippinen"
-
-#. 586
-#: ../navit/country.c:200
-msgid "Pakistan"
-msgstr "Pakistan"
-
-#. 616
-#: ../navit/country.c:201
-msgid "Poland"
-msgstr "Polen"
-
-#. 666
-#: ../navit/country.c:202
-msgid "Saint Pierre and Miquelon"
-msgstr "Saint-Pierre und Miquelon"
-
-#. 612
-#: ../navit/country.c:203
-msgid "Pitcairn"
-msgstr "Pitcairninseln"
-
-#. 630
-#: ../navit/country.c:204
-msgid "Puerto Rico"
-msgstr "Puerto Rico"
-
-#. 275
-#: ../navit/country.c:205
-msgid "Palestinian Territory, Occupied"
-msgstr "Palästinensische Autonomiegebiete"
-
-#. 620
-#: ../navit/country.c:206
-msgid "Portugal"
-msgstr "Portugal"
-
-#. 585
-#: ../navit/country.c:207
-msgid "Palau"
-msgstr "Palau"
-
-#. 600
-#: ../navit/country.c:208
-msgid "Paraguay"
-msgstr "Paraguay"
-
-#. 634
-#: ../navit/country.c:209
-msgid "Qatar"
-msgstr "Katar"
-
-#. 638
-#: ../navit/country.c:210
-msgid "Reunion"
-msgstr "Réunion"
-
-#. 642
-#: ../navit/country.c:211
-msgid "Romania"
-msgstr "Rumänien"
-
-#. 688
-#: ../navit/country.c:212
-msgid "Serbia"
-msgstr "Serbien"
-
-#. 643
-#: ../navit/country.c:213
-msgid "Russian Federation"
-msgstr "Rußland"
-
-#. 646
-#: ../navit/country.c:214
-msgid "Rwanda"
-msgstr "Ruanda"
-
-#
-#. 682
-#: ../navit/country.c:215
-msgid "Saudi Arabia"
-msgstr "Saudi-Arabien"
-
-#. 090
-#: ../navit/country.c:216
-msgid "Solomon Islands"
-msgstr "Salomonen"
-
-#. 690
-#: ../navit/country.c:217
-msgid "Seychelles"
-msgstr "Seychellen"
-
-#. 736
-#: ../navit/country.c:218
-msgid "Sudan"
-msgstr "Sudan"
-
-#. 752
-#: ../navit/country.c:219
-msgid "Sweden"
-msgstr "Schweden"
-
-#. 702
-#: ../navit/country.c:220
-msgid "Singapore"
-msgstr "Singapur"
-
-#. 654
-#: ../navit/country.c:221
-msgid "Saint Helena"
-msgstr "St. Helena"
-
-#. 705
-#: ../navit/country.c:222
-msgid "Slovenia"
-msgstr "Slowenien"
-
-#. 744
-#: ../navit/country.c:223
-msgid "Svalbard and Jan Mayen"
-msgstr "Svalbard und Jan Mayen"
-
-#. 703
-#: ../navit/country.c:224
-msgid "Slovakia"
-msgstr "Slowakei"
-
-#. 694
-#: ../navit/country.c:225
-msgid "Sierra Leone"
-msgstr "Sierra Leone"
-
-#. 674
-#: ../navit/country.c:226
-msgid "San Marino"
-msgstr "San Marino"
-
-#. 686
-#: ../navit/country.c:227
-msgid "Senegal"
-msgstr "Senegal"
-
-#. 706
-#: ../navit/country.c:228
-msgid "Somalia"
-msgstr "Somalia"
-
-#. 740
-#: ../navit/country.c:229
-msgid "Suriname"
-msgstr "Suriname"
-
-#. 678
-#: ../navit/country.c:230
-msgid "Sao Tome and Principe"
-msgstr "São Tomé und Príncipe"
-
-#. 222
-#: ../navit/country.c:231
-msgid "El Salvador"
-msgstr "El Salvador"
-
-#. 760
-#: ../navit/country.c:232
-msgid "Syrian Arab Republic"
-msgstr "Syrien, Arabische Republik"
-
-#. 748
-#: ../navit/country.c:233
-msgid "Swaziland"
-msgstr "Swasiland"
-
-#. 796
-#: ../navit/country.c:234
-msgid "Turks and Caicos Islands"
-msgstr "Turks- und Caicosinseln"
-
-#. 148
-#: ../navit/country.c:235
-msgid "Chad"
-msgstr "Tschad"
-
-#. 260
-#: ../navit/country.c:236
-msgid "French Southern Territories"
-msgstr "Französische Süd- und Antarktisgebiete"
-
-#. 768
-#: ../navit/country.c:237
-msgid "Togo"
-msgstr "Togo"
-
-#. 764
-#: ../navit/country.c:238
-msgid "Thailand"
-msgstr "Thailand"
-
-#. 762
-#: ../navit/country.c:239
-msgid "Tajikistan"
-msgstr "Tadschikistan"
-
-#. 772
-#: ../navit/country.c:240
-msgid "Tokelau"
-msgstr "Tokelau"
-
-#. 626
-#: ../navit/country.c:241
-msgid "Timor-Leste"
-msgstr "Osttimor"
-
-#. 795
-#: ../navit/country.c:242
-msgid "Turkmenistan"
-msgstr "Turkmenistan"
-
-#. 788
-#: ../navit/country.c:243
-msgid "Tunisia"
-msgstr "Tunesien"
-
-#. 776
-#: ../navit/country.c:244
-msgid "Tonga"
-msgstr "Tonga"
-
-#. 792
-#: ../navit/country.c:245
-msgid "Turkey"
-msgstr "Türkei"
-
-#. 780
-#: ../navit/country.c:246
-msgid "Trinidad and Tobago"
-msgstr "Trinidad und Tobago"
-
-#. 798
-#: ../navit/country.c:247
-msgid "Tuvalu"
-msgstr "Tuvalu"
-
-#. 158
-#: ../navit/country.c:248
-msgid "Taiwan, Province of China"
-msgstr "Republik China"
-
-#. 834
-#: ../navit/country.c:249
-msgid "Tanzania, United Republic of"
-msgstr "Tansania, Vereinigte Republik"
-
-#. 804
-#: ../navit/country.c:250
-msgid "Ukraine"
-msgstr "Ukraine"
-
-#. 800
-#: ../navit/country.c:251
-msgid "Uganda"
-msgstr "Uganda"
-
-#. 581
-#: ../navit/country.c:252
-msgid "United States Minor Outlying Islands"
-msgstr "United States Minor Outlying Islands"
-
-#. 840
-#: ../navit/country.c:253
-msgid "United States"
-msgstr "Vereinigte Staaten von Amerika"
-
-#. 858
-#: ../navit/country.c:254
-msgid "Uruguay"
-msgstr "Uruguay"
-
-#. 860
-#: ../navit/country.c:255
-msgid "Uzbekistan"
-msgstr "Usbekistan"
-
-#. 336
-#: ../navit/country.c:256
-msgid "Holy See (Vatican City State)"
-msgstr "Vatikanstadt"
-
-#. 670
-#: ../navit/country.c:257
-msgid "Saint Vincent and the Grenadines"
-msgstr "St. Vincent und die Grenadinen"
-
-#. 862
-#: ../navit/country.c:258
-msgid "Venezuela"
-msgstr "Venezuela"
-
-#. 092
-#: ../navit/country.c:259
-msgid "Virgin Islands, British"
-msgstr "Britische Jungferninseln"
-
-#. 850
-#: ../navit/country.c:260
-msgid "Virgin Islands, U.S."
-msgstr "Amerikanische Jungferninseln"
-
-#. 704
-#: ../navit/country.c:261
-msgid "Viet Nam"
-msgstr "Vietnam"
-
-#. 548
-#: ../navit/country.c:262
-msgid "Vanuatu"
-msgstr "Vanuatu"
-
-#. 876
-#: ../navit/country.c:263
-msgid "Wallis and Futuna"
-msgstr "Wallis und Futuna"
-
-#. 882
-#: ../navit/country.c:264
-msgid "Samoa"
-msgstr "Samoa"
-
-#. 887
-#: ../navit/country.c:265
-msgid "Yemen"
-msgstr "Jemen"
-
-#. 175
-#: ../navit/country.c:266
-msgid "Mayotte"
-msgstr "Mayotte"
-
-#. 710
-#: ../navit/country.c:267
-msgid "South Africa"
-msgstr "Südafrika"
-
-#. 894
-#: ../navit/country.c:268
-msgid "Zambia"
-msgstr "Sambia"
-
-#. 716
-#: ../navit/country.c:269
-msgid "Zimbabwe"
-msgstr "Simbabwe"
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:98
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-msgid "Car"
-msgstr "Auto"
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso2"
-msgstr "Iso2"
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso3"
-msgstr "Iso3"
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:403
-msgid "Country"
-msgstr "Land"
-
-#
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "Postal"
-msgstr "PLZ"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "Town"
-msgstr "Ort"
-
-#
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "District"
-msgstr "Ortsteil"
-
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-#: ../navit/gui/gtk/destination.c:412
-msgid "Street"
-msgstr "Straße"
-
-#: ../navit/gui/gtk/destination.c:100 ../navit/gui/gtk/destination.c:414
-msgid "Number"
-msgstr "Nummer"
-
-#
-#: ../navit/gui/gtk/destination.c:398
-msgid "Enter Destination"
-msgstr "Ziel eingeben"
-
-#: ../navit/gui/gtk/destination.c:405
-msgid "Zip Code"
-msgstr "PLZ"
-
-#: ../navit/gui/gtk/destination.c:407
-msgid "City"
-msgstr "Ort"
-
-#: ../navit/gui/gtk/destination.c:409
-msgid "District/Township"
-msgstr "Ortsteil/Gemeinde"
-
-#: ../navit/gui/gtk/destination.c:437 ../navit/gui/gtk/gui_gtk_action.c:153
-msgid "Map"
-msgstr "Karte"
-
-#: ../navit/gui/gtk/destination.c:438
-msgid "Bookmark"
-msgstr "Lesezeichen"
-
-#: ../navit/gui/gtk/destination.c:439 ../navit/gui/gtk/gui_gtk_action.c:166
-msgid "Destination"
-msgstr "Ziel"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:149
-msgid "Display"
-msgstr "Anzeige"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:150
-msgid "Route"
-msgstr "Route"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:154
-msgid "Layout"
-msgstr "Layout"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:155
-msgid "Projection"
-msgstr "Projektion"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:156
-msgid "Vehicle"
-msgstr "Fahrzeug"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:157
-msgid "ZoomOut"
-msgstr "Verkleinern"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:158
-msgid "ZoomIn"
-msgstr "Vergrößern"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:159
-msgid "Refresh"
-msgstr "Aktualisieren"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:162 ../navit/gui/gtk/gui_gtk_action.c:164
-msgid "Info"
-msgstr "Info"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:167
-msgid "Clear"
-msgstr "Löschen"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:168
-msgid "Test"
-msgstr "Test"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:169
-msgid "_Quit"
-msgstr "Beenden"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:176
-msgid "Cursor"
-msgstr "Marke"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:177
-msgid "Tracking"
-msgstr "Spurverfolgung"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:178
-msgid "Orientation"
-msgstr "Orientierung"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:180 ../navit/gui/gtk/gui_gtk_action.c:182
-msgid "Fullscreen"
-msgstr "Vollbild"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:190
-msgid "Data"
-msgstr "Daten"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "N"
-msgstr "N"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NE"
-msgstr "NO"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "E"
-msgstr "O"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SE"
-msgstr "SO"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "S"
-msgstr "S"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SW"
-msgstr "SW"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "W"
-msgstr "W"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NW"
-msgstr "NW"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:103
-#, c-format
-msgid "Route %4.0fkm %02d:%02d ETA"
-msgstr "Route %4.0fkm %02d:%02d ETA"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:148
-msgid "Route 0000km 0+00:00 ETA"
-msgstr "Route 0000km 0+00:00 ETA"
diff --git a/po/es.po b/po/es.po
deleted file mode 100644
index d64a9337..00000000
--- a/po/es.po
+++ /dev/null
@@ -1,1760 +0,0 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: Navit 0.1.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-05-26 17:12+0200\n"
-"PO-Revision-Date: 2008-05-30 16:45+0000\n"
-"Last-Translator: Emilio Gómez Fernández <Unknown>\n"
-"Language-Team: Chris Eubank <cteubank@gmail.com>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Launchpad-Export-Date: 2008-05-30 21:28+0000\n"
-"X-Generator: Launchpad (build Unknown)\n"
-"X-Poedit-Bookmarks: -1,-1,-1,23,-1,-1,-1,-1,-1,-1\n"
-
-#, fuzzy
-#~ msgid "Turn %1$s%2$s %3$s"
-#~ msgstr "Gire %s%s %s"
-
-#~ msgid "Moldova"
-#~ msgstr "Moldavia"
-
-#~ msgid "Syria"
-#~ msgstr "Siria"
-
-#~ msgid "Libia"
-#~ msgstr "Libia"
-
-#~ msgid "Palestinia"
-#~ msgstr "Palestina"
-
-#~ msgid "Macedonia"
-#~ msgstr "Macedonia"
-
-#~ msgid "VisibleBlocks"
-#~ msgstr "BloquesVisibles"
-
-#~ msgid "VisibleTowns"
-#~ msgstr "CuidadesVisibles"
-
-#~ msgid "VisiblePolys"
-#~ msgstr "PoligonosVisibles"
-
-#~ msgid "VisibleStreets"
-#~ msgstr "CallesVisibles"
-
-#~ msgid "VisiblePoints"
-#~ msgstr "PuntosVisibles"
-
-#, fuzzy
-#~ msgid "RouteGraph"
-#~ msgstr "Ruta"
-
-#~ msgid "two kilometers"
-#~ msgstr "dos kilómetros"
-
-#~ msgid "in two kilometers"
-#~ msgstr "en dos kilómetros"
-
-#~ msgid "three kilometers"
-#~ msgstr "tres kilómetros"
-
-#~ msgid "in three kilometers"
-#~ msgstr "en tres kilómetros"
-
-#~ msgid "four kilometers"
-#~ msgstr "cuatro kilómetros"
-
-#~ msgid "in four kilometers"
-#~ msgstr "en cuatro kilómetros"
-
-#~ msgid "%d kilometers"
-#~ msgstr "%d kilómetros"
-
-#~ msgid "in %d kilometers"
-#~ msgstr "en %d kilómetros"
-
-#~ msgid "strength_pos"
-#~ msgstr "fuerza_pos"
-
-#~ msgid "direction_pos"
-#~ msgstr "dirección_pos"
-
-#~ msgid "distance_pos"
-#~ msgstr "distancia_pos"
-
-#: ../navit/main.c:111
-#, fuzzy, c-format
-msgid ""
-"navit usage:\n"
-"navit [options] [configfile]\n"
-"\t-c <file>: use <file> as config file\n"
-"\t-d <n>: set the debug output level to <n>. (TODO)\n"
-"\t-h: print this usage info and exit.\n"
-"\t-v: Print the version and exit.\n"
-msgstr ""
-"Uso de navit:\n"
-"navit [options] [configfile]\n"
-"\t-c <file>: usar <file> como archivo de configuración\n"
-"\t-d <n>: establecer el nivel de salida de depuración para <n>. (TODO)\n"
-"\t-h: imprimir este uso y salir. \n"
-"\t-v: Imprimir la versión y salir.\n"
-
-#: ../navit/main.c:131
-#, c-format
-msgid "Running from source directory\n"
-msgstr "Ejecutando desde el directorio de las fuentes\n"
-
-#: ../navit/main.c:147
-#, c-format
-msgid "setting '%s' to '%s'\n"
-msgstr ""
-
-#. We have not found an existing config file from all possibilities
-#: ../navit/main.c:248
-#, fuzzy, c-format
-msgid "No config file navit.xml, navit.xml.local found\n"
-msgstr "No se ha encontrado navit.xml o navit.xml.local\n"
-
-#: ../navit/main.c:255
-#, c-format
-msgid "Error parsing '%s': %s\n"
-msgstr "Error leyendo '%s': %s\n"
-
-#: ../navit/main.c:258
-#, c-format
-msgid "Using '%s'\n"
-msgstr "Usando '%s'\n"
-
-#: ../navit/main.c:261
-#, c-format
-msgid "No instance has been created, exiting\n"
-msgstr "No se ha creado una instancia, saliendo\n"
-
-#: ../navit/navigation.c:171
-#, fuzzy, c-format
-msgid "%d m"
-msgstr "%d metros"
-
-#: ../navit/navigation.c:173
-#, fuzzy, c-format
-msgid "in %d m"
-msgstr "en %d metros"
-
-#: ../navit/navigation.c:177
-#, c-format
-msgid "%d meters"
-msgstr "%d metros"
-
-#: ../navit/navigation.c:179
-#, c-format
-msgid "in %d meters"
-msgstr "en %d metros"
-
-#: ../navit/navigation.c:185
-#, c-format
-msgid "%d.%d kilometer"
-msgstr "%d.%d kilómetro"
-
-#: ../navit/navigation.c:187
-#, c-format
-msgid "in %d.%d kilometers"
-msgstr "en %d.%d kilómetros"
-
-#: ../navit/navigation.c:191
-#, fuzzy, c-format
-msgid "one kilometer"
-msgid_plural "%d kilometers"
-msgstr[0] "un kilómetro"
-msgstr[1] "un kilómetro"
-
-#: ../navit/navigation.c:193
-#, fuzzy, c-format
-msgid "in one kilometer"
-msgid_plural "in %d kilometers"
-msgstr[0] "en un kilómetro"
-msgstr[1] "en un kilómetro"
-
-#: ../navit/navigation.c:447
-msgid "exit"
-msgstr "salir"
-
-#: ../navit/navigation.c:449
-msgid "ramp"
-msgstr "desnivel"
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name
-#: ../navit/navigation.c:479
-#, c-format
-msgid "%sinto the street %s%s%s"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Male form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:483
-#, c-format
-msgid "%sinto the %s%s%s|male form"
-msgstr "%sinto the %s%s%s|male form"
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Female form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:487
-#, c-format
-msgid "%sinto the %s%s%s|female form"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Neutral form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:491
-#, c-format
-msgid "%sinto the %s%s%s|neutral form"
-msgstr ""
-
-#: ../navit/navigation.c:497
-#, c-format
-msgid "into the %s"
-msgstr ""
-
-#: ../navit/navigation.c:518
-msgid "right"
-msgstr "derecha"
-
-#: ../navit/navigation.c:525
-msgid "left"
-msgstr "izquerida"
-
-#: ../navit/navigation.c:529
-msgid "easily "
-msgstr "suavemente "
-
-#: ../navit/navigation.c:533
-msgid "strongly "
-msgstr "brúscamente "
-
-#: ../navit/navigation.c:536
-msgid "unknown "
-msgstr "desconocido "
-
-#: ../navit/navigation.c:542
-#, fuzzy
-msgid "When possible, please turn around"
-msgstr "Cuando sea posible, gire a la"
-
-#: ../navit/navigation.c:549
-#, c-format
-msgid "Follow the road for the next %s"
-msgstr "Continue hasta %s"
-
-#: ../navit/navigation.c:553
-msgid "soon"
-msgstr "pronto"
-
-#: ../navit/navigation.c:559
-msgid "now"
-msgstr "ahora"
-
-#: ../navit/navigation.c:562
-msgid "error"
-msgstr "error"
-
-#. TRANSLATORS: The first argument is strength, the second direction, the third distance and the fourth destination Example: 'Turn 'slightly' 'left' in '100 m' 'onto baker street'
-#: ../navit/navigation.c:591
-#, c-format
-msgid "Turn %1$s%2$s %3$s%4$s"
-msgstr "Gire %1$s%2$s %3$s%4$s"
-
-#: ../navit/navigation.c:594
-#, c-format
-msgid "You have reached your destination %s"
-msgstr "Ha llegado a su destino %s"
-
-#: ../navit/navit.c:664 ../navit/gui/gtk/gui_gtk_action.c:151
-#, fuzzy
-msgid "Former Destinations"
-msgstr "Destino"
-
-#: ../navit/navit.c:674 ../navit/gui/gtk/gui_gtk_action.c:152
-msgid "Bookmarks"
-msgstr "Marcadores"
-
-#: ../navit/navit.c:764
-#, fuzzy
-msgid "Command"
-msgstr "Polonia"
-
-#: ../navit/navit.c:769
-msgid "Length"
-msgstr "Longitud"
-
-#: ../navit/navit.c:773 ../navit/navit.c:798
-msgid "km"
-msgstr "km"
-
-#: ../navit/navit.c:777 ../navit/navit.c:802
-msgid "m"
-msgstr "m"
-
-#: ../navit/navit.c:783
-msgid "Time"
-msgstr "Tiempo"
-
-#: ../navit/navit.c:795
-#, fuzzy
-msgid "Destination Length"
-msgstr "Destino"
-
-#: ../navit/navit.c:808
-#, fuzzy
-msgid "Destination Time"
-msgstr "tiempo de recorrido"
-
-#: ../navit/navit.c:837 ../navit/gui/gtk/gui_gtk_action.c:160
-msgid "Roadbook"
-msgstr "Guía"
-
-#: ../navit/popup.c:200 ../navit/popup.c:254
-msgid "Set as position"
-msgstr "Fijar una posición"
-
-#: ../navit/popup.c:201 ../navit/popup.c:255
-#, fuzzy
-msgid "Set as destination"
-msgstr "Destino"
-
-#: ../navit/popup.c:202 ../navit/popup.c:256
-msgid "Add as bookmark"
-msgstr "Añadir a favoritos"
-
-#: ../navit/popup.c:244
-#, c-format
-msgid "Point 0x%x 0x%x"
-msgstr "Punto 0x%x 0x%x"
-
-#: ../navit/popup.c:245
-#, fuzzy, c-format
-msgid "Screen coord : %d %d"
-msgstr "Coordenadas de pantalla : %d %d"
-
-#. 020
-#: ../navit/country.c:24
-msgid "Andorra"
-msgstr "Andorra"
-
-#. 784
-#: ../navit/country.c:25
-msgid "United Arab Emirates"
-msgstr "Emiratos Ãrabes Unidos"
-
-#. 004
-#: ../navit/country.c:26
-msgid "Afghanistan"
-msgstr "Afganistán"
-
-#. 028
-#: ../navit/country.c:27
-msgid "Antigua and Barbuda"
-msgstr "Antigua y Barbuda"
-
-#. 660
-#: ../navit/country.c:28
-msgid "Anguilla"
-msgstr "Anguila"
-
-#. 008
-#: ../navit/country.c:29
-msgid "Albania"
-msgstr "Albania"
-
-#. 051
-#: ../navit/country.c:30
-msgid "Armenia"
-msgstr "Armenia"
-
-#. 530
-#: ../navit/country.c:31
-msgid "Netherlands Antilles"
-msgstr "Antillas Holandesas"
-
-#. 024
-#: ../navit/country.c:32
-msgid "Angola"
-msgstr "Angola"
-
-#. 010
-#: ../navit/country.c:33
-msgid "Antarctica"
-msgstr "Antártica"
-
-#. 032
-#: ../navit/country.c:34
-msgid "Argentina"
-msgstr "Argentina"
-
-#. 016
-#: ../navit/country.c:35
-msgid "American Samoa"
-msgstr "Samoa Americana"
-
-#. 040
-#: ../navit/country.c:36
-msgid "Austria"
-msgstr "Austria"
-
-#. 036
-#: ../navit/country.c:37
-msgid "Australia"
-msgstr "Australia"
-
-#. 533
-#: ../navit/country.c:38
-msgid "Aruba"
-msgstr "Aruba"
-
-#. 248
-#: ../navit/country.c:39
-msgid "Aland Islands"
-msgstr "Islas de Ã…land"
-
-#. 031
-#: ../navit/country.c:40
-msgid "Azerbaijan"
-msgstr "Azerbaiyán"
-
-#. 070
-#: ../navit/country.c:41
-msgid "Bosnia and Herzegovina"
-msgstr "Bosnia y Herzegovina"
-
-#. 052
-#: ../navit/country.c:42
-msgid "Barbados"
-msgstr "Barbados"
-
-#. 050
-#: ../navit/country.c:43
-msgid "Bangladesh"
-msgstr "Bangladesh"
-
-#. 056
-#: ../navit/country.c:44
-msgid "Belgium"
-msgstr "Bélgica"
-
-#. 854
-#: ../navit/country.c:45
-msgid "Burkina Faso"
-msgstr "Burkina Faso"
-
-#. 100
-#: ../navit/country.c:46
-msgid "Bulgaria"
-msgstr "Bulgaria"
-
-#. 048
-#: ../navit/country.c:47
-msgid "Bahrain"
-msgstr "Bahrain"
-
-#. 108
-#: ../navit/country.c:48
-msgid "Burundi"
-msgstr "Burundi"
-
-#. 204
-#: ../navit/country.c:49
-msgid "Benin"
-msgstr "Benín"
-
-#. 652
-#: ../navit/country.c:50
-msgid "Saint Barthelemy"
-msgstr "San Bartolomé"
-
-#. 060
-#: ../navit/country.c:51
-msgid "Bermuda"
-msgstr "Bermudas"
-
-#. 096
-#: ../navit/country.c:52
-msgid "Brunei Darussalam"
-msgstr "Brunei Darussalam"
-
-#. 068
-#: ../navit/country.c:53
-msgid "Bolivia"
-msgstr "Bolivia"
-
-#. 076
-#: ../navit/country.c:54
-msgid "Brazil"
-msgstr "Brasil"
-
-#. 044
-#: ../navit/country.c:55
-msgid "Bahamas"
-msgstr "Bahamas"
-
-#. 064
-#: ../navit/country.c:56
-msgid "Bhutan"
-msgstr "Bután"
-
-#. 074
-#: ../navit/country.c:57
-msgid "Bouvet Island"
-msgstr "Isla Bouvet"
-
-#. 072
-#: ../navit/country.c:58
-msgid "Botswana"
-msgstr "Botsuana"
-
-#. 112
-#: ../navit/country.c:59
-msgid "Belarus"
-msgstr "Bielorrusia"
-
-#. 084
-#: ../navit/country.c:60
-msgid "Belize"
-msgstr "Belice"
-
-#. 124
-#: ../navit/country.c:61
-msgid "Canada"
-msgstr "Canadá"
-
-#. 166
-#: ../navit/country.c:62
-msgid "Cocos (Keeling) Islands"
-msgstr "Islas de Cocos (Keeling)"
-
-#. 180
-#: ../navit/country.c:63
-msgid "Congo, Democratic Republic of the"
-msgstr "Congo, República Democrática del"
-
-#. 140
-#: ../navit/country.c:64
-msgid "Central African Republic"
-msgstr "República Centroafricana"
-
-#. 178
-#: ../navit/country.c:65
-msgid "Congo"
-msgstr "Congo"
-
-#. 756
-#: ../navit/country.c:66
-msgid "Switzerland"
-msgstr "Suiza"
-
-#. 384
-#: ../navit/country.c:67
-msgid "Cote d'Ivoire"
-msgstr "Costa de Marfil"
-
-#. 184
-#: ../navit/country.c:68
-msgid "Cook Islands"
-msgstr "Islas Cook"
-
-#. 152
-#: ../navit/country.c:69
-msgid "Chile"
-msgstr "Chile"
-
-#. 120
-#: ../navit/country.c:70
-msgid "Cameroon"
-msgstr "Camerún"
-
-#. 156
-#: ../navit/country.c:71
-msgid "China"
-msgstr "China"
-
-#. 170
-#: ../navit/country.c:72
-msgid "Colombia"
-msgstr "Colombia"
-
-#. 188
-#: ../navit/country.c:73
-msgid "Costa Rica"
-msgstr "Costa Rica"
-
-#. 192
-#: ../navit/country.c:74
-msgid "Cuba"
-msgstr "Cuba"
-
-#. 132
-#: ../navit/country.c:75
-msgid "Cape Verde"
-msgstr "Cabo Verde"
-
-#. 162
-#: ../navit/country.c:76
-msgid "Christmas Island"
-msgstr "Isla Natividad"
-
-#. 196
-#: ../navit/country.c:77
-msgid "Cyprus"
-msgstr "Chipre"
-
-#. 203
-#: ../navit/country.c:78
-msgid "Czech Republic"
-msgstr "República Checa"
-
-#. 276
-#: ../navit/country.c:79
-msgid "Germany"
-msgstr "Alemania"
-
-#. 262
-#: ../navit/country.c:80
-msgid "Djibouti"
-msgstr "República de Yibuti"
-
-#. 208
-#: ../navit/country.c:81
-msgid "Denmark"
-msgstr "Dinamarca"
-
-#. 212
-#: ../navit/country.c:82
-msgid "Dominica"
-msgstr "Dominica"
-
-#. 214
-#: ../navit/country.c:83
-msgid "Dominican Republic"
-msgstr "República Dominicana"
-
-#. 012
-#: ../navit/country.c:84
-msgid "Algeria"
-msgstr "Argelia"
-
-#. 218
-#: ../navit/country.c:85
-msgid "Ecuador"
-msgstr "Ecuador"
-
-#. 233
-#: ../navit/country.c:86
-msgid "Estonia"
-msgstr "Estonia"
-
-#. 818
-#: ../navit/country.c:87
-msgid "Egypt"
-msgstr "Egipto"
-
-#. 732
-#: ../navit/country.c:88
-msgid "Western Sahara"
-msgstr "Sahara Occidental"
-
-#. 232
-#: ../navit/country.c:89
-msgid "Eritrea"
-msgstr "Eritrea"
-
-#. 724
-#: ../navit/country.c:90
-msgid "Spain"
-msgstr "España"
-
-#. 231
-#: ../navit/country.c:91
-msgid "Ethiopia"
-msgstr "Etiopía"
-
-#. 246
-#: ../navit/country.c:92
-msgid "Finland"
-msgstr "Finlandia"
-
-#. 242
-#: ../navit/country.c:93
-msgid "Fiji"
-msgstr "Fiyi"
-
-#. 238
-#: ../navit/country.c:94
-msgid "Falkland Islands (Malvinas)"
-msgstr "Islas Malvinas"
-
-#. 583
-#: ../navit/country.c:95
-msgid "Micronesia, Federated States of"
-msgstr "Estados Federados de Micronesia"
-
-#. 234
-#: ../navit/country.c:96
-msgid "Faroe Islands"
-msgstr "Islas Feroe"
-
-#. 250
-#: ../navit/country.c:97
-msgid "France"
-msgstr "Francia"
-
-#. 266
-#: ../navit/country.c:98
-msgid "Gabon"
-msgstr "Gabón"
-
-#. 826
-#: ../navit/country.c:99
-msgid "United Kingdom"
-msgstr "Reino Unido"
-
-#. 308
-#: ../navit/country.c:100
-msgid "Grenada"
-msgstr "Grenada"
-
-#. 268
-#: ../navit/country.c:101
-msgid "Georgia"
-msgstr "Georgia"
-
-#. 254
-#: ../navit/country.c:102
-msgid "French Guiana"
-msgstr "Guinea Francesa"
-
-#. 831
-#: ../navit/country.c:103
-msgid "Guernsey"
-msgstr "Guernesey"
-
-#. 288
-#: ../navit/country.c:104
-msgid "Ghana"
-msgstr "Ghana"
-
-#. 292
-#: ../navit/country.c:105
-msgid "Gibraltar"
-msgstr "Gibraltar"
-
-#. 304
-#: ../navit/country.c:106
-msgid "Greenland"
-msgstr "Groenlandia"
-
-#. 270
-#: ../navit/country.c:107
-msgid "Gambia"
-msgstr "Gambia"
-
-#. 324
-#: ../navit/country.c:108
-msgid "Guinea"
-msgstr "Guinea"
-
-#. 312
-#: ../navit/country.c:109
-msgid "Guadeloupe"
-msgstr "Guadalupe"
-
-#. 226
-#: ../navit/country.c:110
-msgid "Equatorial Guinea"
-msgstr "Guinea Ecuatorial"
-
-#. 300
-#: ../navit/country.c:111
-msgid "Greece"
-msgstr "Grecia"
-
-#. 239
-#: ../navit/country.c:112
-msgid "South Georgia and the South Sandwich Islands"
-msgstr "Islas Georgias del Sur y Sandwich del Sur"
-
-#. 320
-#: ../navit/country.c:113
-msgid "Guatemala"
-msgstr "Guatemala"
-
-#. 316
-#: ../navit/country.c:114
-msgid "Guam"
-msgstr "Guam"
-
-#. 624
-#: ../navit/country.c:115
-msgid "Guinea-Bissau"
-msgstr "Guinea-Bissau"
-
-#. 328
-#: ../navit/country.c:116
-msgid "Guyana"
-msgstr "Guayana"
-
-#. 344
-#: ../navit/country.c:117
-msgid "Hong Kong"
-msgstr "Hong Kong"
-
-#. 334
-#: ../navit/country.c:118
-msgid "Heard Island and McDonald Islands"
-msgstr "Islas Heard y McDonald"
-
-#. 340
-#: ../navit/country.c:119
-msgid "Honduras"
-msgstr "Honduras"
-
-#. 191
-#: ../navit/country.c:120
-msgid "Croatia"
-msgstr "Croacia"
-
-#. 332
-#: ../navit/country.c:121
-msgid "Haiti"
-msgstr "Haiti"
-
-#. 348
-#: ../navit/country.c:122
-msgid "Hungary"
-msgstr "Hungría"
-
-#. 360
-#: ../navit/country.c:123
-msgid "Indonesia"
-msgstr "Indonesia"
-
-#. 372
-#: ../navit/country.c:124
-msgid "Ireland"
-msgstr "Irlanda"
-
-#. 376
-#: ../navit/country.c:125
-msgid "Israel"
-msgstr "Israel"
-
-#. 833
-#: ../navit/country.c:126
-msgid "Isle of Man"
-msgstr "Isla de Man"
-
-#. 356
-#: ../navit/country.c:127
-msgid "India"
-msgstr "India"
-
-#. 086
-#: ../navit/country.c:128
-msgid "British Indian Ocean Territory"
-msgstr "Territorio Británico en el Océano Indico"
-
-#. 368
-#: ../navit/country.c:129
-msgid "Iraq"
-msgstr "Iraq"
-
-#. 364
-#: ../navit/country.c:130
-msgid "Iran, Islamic Republic of"
-msgstr "Irán"
-
-#. 352
-#: ../navit/country.c:131
-msgid "Iceland"
-msgstr "Islandia"
-
-#. 380
-#: ../navit/country.c:132
-msgid "Italy"
-msgstr "Italia"
-
-#. 832
-#: ../navit/country.c:133
-msgid "Jersey"
-msgstr "Jersey"
-
-#. 388
-#: ../navit/country.c:134
-msgid "Jamaica"
-msgstr "Jamaica"
-
-#. 400
-#: ../navit/country.c:135
-msgid "Jordan"
-msgstr "Jordania"
-
-#. 392
-#: ../navit/country.c:136
-msgid "Japan"
-msgstr "Japón"
-
-#. 404
-#: ../navit/country.c:137
-msgid "Kenya"
-msgstr "Kenia"
-
-#. 417
-#: ../navit/country.c:138
-msgid "Kyrgyzstan"
-msgstr "Kirguistán"
-
-#. 116
-#: ../navit/country.c:139
-msgid "Cambodia"
-msgstr "Camboya"
-
-#. 296
-#: ../navit/country.c:140
-msgid "Kiribati"
-msgstr "Kiribati"
-
-#. 174
-#: ../navit/country.c:141
-msgid "Comoros"
-msgstr "Comoras"
-
-#. 659
-#: ../navit/country.c:142
-msgid "Saint Kitts and Nevis"
-msgstr "San Cristóbal y Nieves"
-
-#. 408
-#: ../navit/country.c:143
-msgid "Korea, Democratic People's Republic of"
-msgstr "Corea, República Democrática Popular de"
-
-#. 410
-#: ../navit/country.c:144
-msgid "Korea, Republic of"
-msgstr "Corea, República de"
-
-#. 414
-#: ../navit/country.c:145
-msgid "Kuwait"
-msgstr "Kuwait"
-
-#. 136
-#: ../navit/country.c:146
-msgid "Cayman Islands"
-msgstr "Islas Caimán"
-
-#. 398
-#: ../navit/country.c:147
-msgid "Kazakhstan"
-msgstr "Kazajstán"
-
-#. 418
-#: ../navit/country.c:148
-msgid "Lao People's Democratic Republic"
-msgstr "República Democrática Popular Lao"
-
-#. 422
-#: ../navit/country.c:149
-msgid "Lebanon"
-msgstr "Líbano"
-
-#. 662
-#: ../navit/country.c:150
-msgid "Saint Lucia"
-msgstr "Santa Lucía"
-
-#. 438
-#: ../navit/country.c:151
-msgid "Liechtenstein"
-msgstr "Liechtenstein"
-
-#. 144
-#: ../navit/country.c:152
-msgid "Sri Lanka"
-msgstr "Sri Lanka"
-
-#. 430
-#: ../navit/country.c:153
-msgid "Liberia"
-msgstr "Liberia"
-
-#. 426
-#: ../navit/country.c:154
-msgid "Lesotho"
-msgstr "Lesoto"
-
-#. 440
-#: ../navit/country.c:155
-msgid "Lithuania"
-msgstr "Lituania"
-
-#. 442
-#: ../navit/country.c:156
-msgid "Luxembourg"
-msgstr "Luxemburgo"
-
-#. 428
-#: ../navit/country.c:157
-msgid "Latvia"
-msgstr "Letonia"
-
-#. 434
-#: ../navit/country.c:158
-msgid "Libyan Arab Jamahiriya"
-msgstr "Libia"
-
-#. 504
-#: ../navit/country.c:159
-msgid "Morocco"
-msgstr "Marruecos"
-
-#. 492
-#: ../navit/country.c:160
-msgid "Monaco"
-msgstr "Mónaco"
-
-#. 498
-#: ../navit/country.c:161
-msgid "Moldova, Republic of"
-msgstr "Moldavia, República de"
-
-#. 499
-#: ../navit/country.c:162
-msgid "Montenegro"
-msgstr "Montenegro"
-
-#. 663
-#: ../navit/country.c:163
-msgid "Saint Martin (French part)"
-msgstr "San Martín (zona francesa)"
-
-#. 450
-#: ../navit/country.c:164
-msgid "Madagascar"
-msgstr "Madagascar"
-
-#. 584
-#: ../navit/country.c:165
-msgid "Marshall Islands"
-msgstr "Islas Marshall"
-
-#. 807
-#: ../navit/country.c:166
-msgid "Macedonia, the former Yugoslav Republic of"
-msgstr "Antigua República Yugoslava de Macedonia"
-
-#. 466
-#: ../navit/country.c:167
-msgid "Mali"
-msgstr "Mali"
-
-#. 104
-#: ../navit/country.c:168
-msgid "Myanmar"
-msgstr "Myanmar"
-
-#. 496
-#: ../navit/country.c:169
-msgid "Mongolia"
-msgstr "Mongolia"
-
-#. 446
-#: ../navit/country.c:170
-msgid "Macao"
-msgstr "Macao"
-
-#. 580
-#: ../navit/country.c:171
-msgid "Northern Mariana Islands"
-msgstr "Islas Marianas del Norte"
-
-#. 474
-#: ../navit/country.c:172
-msgid "Martinique"
-msgstr "Martinica"
-
-#. 478
-#: ../navit/country.c:173
-msgid "Mauritania"
-msgstr "Mauritania"
-
-#. 500
-#: ../navit/country.c:174
-msgid "Montserrat"
-msgstr "Montserrat"
-
-#. 470
-#: ../navit/country.c:175
-msgid "Malta"
-msgstr "Malta"
-
-#. 480
-#: ../navit/country.c:176
-msgid "Mauritius"
-msgstr "Mauricio"
-
-#. 462
-#: ../navit/country.c:177
-msgid "Maldives"
-msgstr "Maldivas"
-
-#. 454
-#: ../navit/country.c:178
-msgid "Malawi"
-msgstr "Malawi"
-
-#. 484
-#: ../navit/country.c:179
-msgid "Mexico"
-msgstr "México"
-
-#. 458
-#: ../navit/country.c:180
-msgid "Malaysia"
-msgstr "Malasia"
-
-#. 508
-#: ../navit/country.c:181
-msgid "Mozambique"
-msgstr "Mozambique"
-
-#. 516
-#: ../navit/country.c:182
-msgid "Namibia"
-msgstr "Namibia"
-
-#. 540
-#: ../navit/country.c:183
-msgid "New Caledonia"
-msgstr "Nueva Caledonia"
-
-#. 562
-#: ../navit/country.c:184
-msgid "Niger"
-msgstr "Níger"
-
-#. 574
-#: ../navit/country.c:185
-msgid "Norfolk Island"
-msgstr "Isla Norfolk"
-
-#. 566
-#: ../navit/country.c:186
-msgid "Nigeria"
-msgstr "Nigeria"
-
-#. 558
-#: ../navit/country.c:187
-msgid "Nicaragua"
-msgstr "Nicaragua"
-
-#. 528
-#: ../navit/country.c:188
-msgid "Netherlands"
-msgstr "Países Bajos"
-
-#. 578
-#: ../navit/country.c:189
-msgid "Norway"
-msgstr "Noruega"
-
-#. 524
-#: ../navit/country.c:190
-msgid "Nepal"
-msgstr "Nepal"
-
-#. 520
-#: ../navit/country.c:191
-msgid "Nauru"
-msgstr "Nauru"
-
-#. 570
-#: ../navit/country.c:192
-msgid "Niue"
-msgstr "Niue"
-
-#. 554
-#: ../navit/country.c:193
-msgid "New Zealand"
-msgstr "Nueva Zelanda"
-
-#. 512
-#: ../navit/country.c:194
-msgid "Oman"
-msgstr "Omán"
-
-#. 591
-#: ../navit/country.c:195
-msgid "Panama"
-msgstr "Panamá"
-
-#. 604
-#: ../navit/country.c:196
-msgid "Peru"
-msgstr "Perú"
-
-#. 258
-#: ../navit/country.c:197
-msgid "French Polynesia"
-msgstr "Polinesia Francesa"
-
-#. 598
-#: ../navit/country.c:198
-msgid "Papua New Guinea"
-msgstr "Papúa Nueva Guinea"
-
-#. 608
-#: ../navit/country.c:199
-msgid "Philippines"
-msgstr "Filipinas"
-
-#. 586
-#: ../navit/country.c:200
-msgid "Pakistan"
-msgstr "Pakistán"
-
-#. 616
-#: ../navit/country.c:201
-msgid "Poland"
-msgstr "Polonia"
-
-#. 666
-#: ../navit/country.c:202
-msgid "Saint Pierre and Miquelon"
-msgstr "San Pedro y Miquelón"
-
-#. 612
-#: ../navit/country.c:203
-msgid "Pitcairn"
-msgstr "Pitcairn"
-
-#. 630
-#: ../navit/country.c:204
-msgid "Puerto Rico"
-msgstr "Puerto Rico"
-
-#. 275
-#: ../navit/country.c:205
-msgid "Palestinian Territory, Occupied"
-msgstr "Territorio Palestino Ocupado"
-
-#. 620
-#: ../navit/country.c:206
-msgid "Portugal"
-msgstr "Portugal"
-
-#. 585
-#: ../navit/country.c:207
-msgid "Palau"
-msgstr "Palau"
-
-#. 600
-#: ../navit/country.c:208
-msgid "Paraguay"
-msgstr "Paraguay"
-
-#. 634
-#: ../navit/country.c:209
-msgid "Qatar"
-msgstr "Qatar"
-
-#. 638
-#: ../navit/country.c:210
-msgid "Reunion"
-msgstr "Reunión"
-
-#. 642
-#: ../navit/country.c:211
-msgid "Romania"
-msgstr "Rumania"
-
-#. 688
-#: ../navit/country.c:212
-msgid "Serbia"
-msgstr "Serbia"
-
-#. 643
-#: ../navit/country.c:213
-msgid "Russian Federation"
-msgstr "Federación de Rusia"
-
-#. 646
-#: ../navit/country.c:214
-msgid "Rwanda"
-msgstr "Ruanda"
-
-#. 682
-#: ../navit/country.c:215
-msgid "Saudi Arabia"
-msgstr "Arabia Saudita"
-
-#. 090
-#: ../navit/country.c:216
-msgid "Solomon Islands"
-msgstr "Islas Salomón"
-
-#. 690
-#: ../navit/country.c:217
-msgid "Seychelles"
-msgstr "Seychelles"
-
-#. 736
-#: ../navit/country.c:218
-msgid "Sudan"
-msgstr "Sudán"
-
-#. 752
-#: ../navit/country.c:219
-msgid "Sweden"
-msgstr "Suecia"
-
-#. 702
-#: ../navit/country.c:220
-msgid "Singapore"
-msgstr "Singapur"
-
-#. 654
-#: ../navit/country.c:221
-msgid "Saint Helena"
-msgstr "Santa Helena"
-
-#. 705
-#: ../navit/country.c:222
-msgid "Slovenia"
-msgstr "Eslovenia"
-
-#. 744
-#: ../navit/country.c:223
-msgid "Svalbard and Jan Mayen"
-msgstr "Svalbard y Jan Mayen"
-
-#. 703
-#: ../navit/country.c:224
-msgid "Slovakia"
-msgstr "Eslovaquia"
-
-#. 694
-#: ../navit/country.c:225
-msgid "Sierra Leone"
-msgstr "Sierra Leona"
-
-#. 674
-#: ../navit/country.c:226
-msgid "San Marino"
-msgstr "San Marino"
-
-#. 686
-#: ../navit/country.c:227
-msgid "Senegal"
-msgstr "Senegal"
-
-#. 706
-#: ../navit/country.c:228
-msgid "Somalia"
-msgstr "Somalia"
-
-#. 740
-#: ../navit/country.c:229
-msgid "Suriname"
-msgstr "Surinam"
-
-#. 678
-#: ../navit/country.c:230
-msgid "Sao Tome and Principe"
-msgstr "Santo Tomé y Príncipe"
-
-#. 222
-#: ../navit/country.c:231
-msgid "El Salvador"
-msgstr "El Salvador"
-
-#. 760
-#: ../navit/country.c:232
-msgid "Syrian Arab Republic"
-msgstr "República Ãrabe de Siria"
-
-#. 748
-#: ../navit/country.c:233
-msgid "Swaziland"
-msgstr "Suazilandia"
-
-#. 796
-#: ../navit/country.c:234
-msgid "Turks and Caicos Islands"
-msgstr "Islas Turcas y Caicos"
-
-#. 148
-#: ../navit/country.c:235
-msgid "Chad"
-msgstr "Chad"
-
-#. 260
-#: ../navit/country.c:236
-msgid "French Southern Territories"
-msgstr "Territorios Australes Franceses"
-
-#. 768
-#: ../navit/country.c:237
-msgid "Togo"
-msgstr "Togo"
-
-#. 764
-#: ../navit/country.c:238
-msgid "Thailand"
-msgstr "Tailandia"
-
-#. 762
-#: ../navit/country.c:239
-msgid "Tajikistan"
-msgstr "Tayikistán"
-
-#. 772
-#: ../navit/country.c:240
-msgid "Tokelau"
-msgstr "Tokelau"
-
-#. 626
-#: ../navit/country.c:241
-msgid "Timor-Leste"
-msgstr "Timor Oriental"
-
-#. 795
-#: ../navit/country.c:242
-msgid "Turkmenistan"
-msgstr "Turkmenistán"
-
-#. 788
-#: ../navit/country.c:243
-msgid "Tunisia"
-msgstr "Túnez"
-
-#. 776
-#: ../navit/country.c:244
-msgid "Tonga"
-msgstr "Tonga"
-
-#. 792
-#: ../navit/country.c:245
-msgid "Turkey"
-msgstr "Turquía"
-
-#. 780
-#: ../navit/country.c:246
-msgid "Trinidad and Tobago"
-msgstr "Trinidad y Tobago"
-
-#. 798
-#: ../navit/country.c:247
-msgid "Tuvalu"
-msgstr "Tuvalu"
-
-#. 158
-#: ../navit/country.c:248
-msgid "Taiwan, Province of China"
-msgstr "Taiwán, Provincia de China"
-
-#. 834
-#: ../navit/country.c:249
-msgid "Tanzania, United Republic of"
-msgstr "Tanzania, República Unida de"
-
-#. 804
-#: ../navit/country.c:250
-msgid "Ukraine"
-msgstr "Ucrania"
-
-#. 800
-#: ../navit/country.c:251
-msgid "Uganda"
-msgstr "Uganda"
-
-#. 581
-#: ../navit/country.c:252
-msgid "United States Minor Outlying Islands"
-msgstr "Islas Ultramarinas Menores de los Estados Unidos"
-
-#. 840
-#: ../navit/country.c:253
-msgid "United States"
-msgstr "Estados Unidos"
-
-#. 858
-#: ../navit/country.c:254
-msgid "Uruguay"
-msgstr "Uruguay"
-
-#. 860
-#: ../navit/country.c:255
-msgid "Uzbekistan"
-msgstr "Uzbekistán"
-
-#. 336
-#: ../navit/country.c:256
-msgid "Holy See (Vatican City State)"
-msgstr "Santa Sede (Ciudad Estado del Vaticano)"
-
-#. 670
-#: ../navit/country.c:257
-msgid "Saint Vincent and the Grenadines"
-msgstr "San Vicente y las Granadinas"
-
-#. 862
-#: ../navit/country.c:258
-msgid "Venezuela"
-msgstr "Venezuela"
-
-#. 092
-#: ../navit/country.c:259
-msgid "Virgin Islands, British"
-msgstr "Islas Vírgenes, Británicas"
-
-#. 850
-#: ../navit/country.c:260
-msgid "Virgin Islands, U.S."
-msgstr "Islas Vírgenes, EE.UU."
-
-#. 704
-#: ../navit/country.c:261
-msgid "Viet Nam"
-msgstr "Vietnam"
-
-#. 548
-#: ../navit/country.c:262
-msgid "Vanuatu"
-msgstr "Vanuatu"
-
-#. 876
-#: ../navit/country.c:263
-msgid "Wallis and Futuna"
-msgstr "Wallis y Futuna"
-
-#. 882
-#: ../navit/country.c:264
-msgid "Samoa"
-msgstr "Samoa"
-
-#. 887
-#: ../navit/country.c:265
-msgid "Yemen"
-msgstr "Yemen"
-
-#. 175
-#: ../navit/country.c:266
-msgid "Mayotte"
-msgstr "Mayotte"
-
-#. 710
-#: ../navit/country.c:267
-msgid "South Africa"
-msgstr "Sudáfrica"
-
-#. 894
-#: ../navit/country.c:268
-msgid "Zambia"
-msgstr "Zambia"
-
-#. 716
-#: ../navit/country.c:269
-msgid "Zimbabwe"
-msgstr "Zimbabue"
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:98
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-#, fuzzy
-msgid "Car"
-msgstr "Limpiar"
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso2"
-msgstr "Iso2"
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso3"
-msgstr "Iso3"
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:403
-msgid "Country"
-msgstr "País"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-#, fuzzy
-msgid "Postal"
-msgstr "Portugal"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "Town"
-msgstr "Ciudad"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-#, fuzzy
-msgid "District"
-msgstr "Distrito"
-
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-#: ../navit/gui/gtk/destination.c:412
-msgid "Street"
-msgstr "Calle"
-
-#: ../navit/gui/gtk/destination.c:100 ../navit/gui/gtk/destination.c:414
-msgid "Number"
-msgstr "Número"
-
-#: ../navit/gui/gtk/destination.c:398
-#, fuzzy
-msgid "Enter Destination"
-msgstr "Destino"
-
-#: ../navit/gui/gtk/destination.c:405
-msgid "Zip Code"
-msgstr "Código Postal"
-
-#: ../navit/gui/gtk/destination.c:407
-msgid "City"
-msgstr "Cuidad"
-
-#: ../navit/gui/gtk/destination.c:409
-msgid "District/Township"
-msgstr "Distrito"
-
-#: ../navit/gui/gtk/destination.c:437 ../navit/gui/gtk/gui_gtk_action.c:153
-msgid "Map"
-msgstr "Mapa"
-
-#: ../navit/gui/gtk/destination.c:438
-msgid "Bookmark"
-msgstr "Marcador"
-
-#: ../navit/gui/gtk/destination.c:439 ../navit/gui/gtk/gui_gtk_action.c:166
-msgid "Destination"
-msgstr "Destino"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:149
-msgid "Display"
-msgstr "Visualización"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:150
-msgid "Route"
-msgstr "Ruta"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:154
-msgid "Layout"
-msgstr "Diseño"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:155
-msgid "Projection"
-msgstr "Proyección"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:156
-msgid "Vehicle"
-msgstr "Vehículo"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:157
-msgid "ZoomOut"
-msgstr "Alejar"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:158
-msgid "ZoomIn"
-msgstr "Aumentar"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:159
-msgid "Refresh"
-msgstr "Refrescar"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:162 ../navit/gui/gtk/gui_gtk_action.c:164
-msgid "Info"
-msgstr "Información"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:167
-msgid "Clear"
-msgstr "Limpiar"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:168
-msgid "Test"
-msgstr "Probar"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:169
-msgid "_Quit"
-msgstr "_Salir"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:176
-msgid "Cursor"
-msgstr "Puntero"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:177
-msgid "Tracking"
-msgstr "Posicionando"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:178
-msgid "Orientation"
-msgstr "Orientación"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:180 ../navit/gui/gtk/gui_gtk_action.c:182
-msgid "Fullscreen"
-msgstr "Pantalla completa"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:190
-msgid "Data"
-msgstr "Datos"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "N"
-msgstr "N"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NE"
-msgstr "NE"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "E"
-msgstr "E"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SE"
-msgstr "SE"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "S"
-msgstr "S"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SW"
-msgstr "SO"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "W"
-msgstr "O"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NW"
-msgstr "NO"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:103
-#, c-format
-msgid "Route %4.0fkm %02d:%02d ETA"
-msgstr "Ruta %4.0fkm %02d:%02d TEL"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:148
-msgid "Route 0000km 0+00:00 ETA"
-msgstr "Ruta 0000km 0+00:00 TEL"
diff --git a/po/fi.po b/po/fi.po
deleted file mode 100644
index 893d795e..00000000
--- a/po/fi.po
+++ /dev/null
@@ -1,1740 +0,0 @@
-# Finnish translations for navit
-# Copyright (C) 2007
-# This file is distributed under the same license as the navit package.
-# Ossi Berg <o.berg@mail.com>, 2007.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: Navit 0.1.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-05-26 17:12+0200\n"
-"PO-Revision-Date: 2008-05-27 04:46+0000\n"
-"Last-Translator: Ossi Berg <Unknown>\n"
-"Language-Team: Ossi Berg <o.berg@mail.com>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Launchpad-Export-Date: 2008-05-30 21:28+0000\n"
-"X-Generator: Launchpad (build Unknown)\n"
-
-#~ msgid "Turn %1$s%2$s %3$s"
-#~ msgstr "Käänny %3$s %1$s%2$s"
-
-#~ msgid "Moldova"
-#~ msgstr "Moldova"
-
-#~ msgid "Syria"
-#~ msgstr "Syyria"
-
-#~ msgid "Libia"
-#~ msgstr "Libya"
-
-#~ msgid "Palestinia"
-#~ msgstr "Palestiina"
-
-#~ msgid "Macedonia"
-#~ msgstr "Makedonia"
-
-#~ msgid "VisibleBlocks"
-#~ msgstr "Näkyvät korttelit"
-
-#~ msgid "VisibleTowns"
-#~ msgstr "Näkyvät paikkakunnat"
-
-#~ msgid "VisiblePolys"
-#~ msgstr "Näkyvät monikulmio"
-
-#~ msgid "VisibleStreets"
-#~ msgstr "Näkyvät kadut"
-
-#~ msgid "VisiblePoints"
-#~ msgstr "Näkyvät pisteet"
-
-#~ msgid "RouteGraph"
-#~ msgstr "Tiepiirros"
-
-#~ msgid "two kilometers"
-#~ msgstr "kaksi kilometriä"
-
-#~ msgid "in two kilometers"
-#~ msgstr "kahden kilometrin päästä"
-
-#~ msgid "three kilometers"
-#~ msgstr "kolme kilometriä"
-
-#~ msgid "in three kilometers"
-#~ msgstr "kolmen kilometrin päästä"
-
-#~ msgid "four kilometers"
-#~ msgstr "neljä kilometriä"
-
-#~ msgid "in four kilometers"
-#~ msgstr "neljän kilometrin päästä"
-
-#~ msgid "%d kilometers"
-#~ msgstr "%d kilometriä"
-
-#~ msgid "in %d kilometers"
-#~ msgstr "%d kilometrin päästä"
-
-#: ../navit/main.c:111
-#, c-format
-msgid ""
-"navit usage:\n"
-"navit [options] [configfile]\n"
-"\t-c <file>: use <file> as config file\n"
-"\t-d <n>: set the debug output level to <n>. (TODO)\n"
-"\t-h: print this usage info and exit.\n"
-"\t-v: Print the version and exit.\n"
-msgstr ""
-
-#: ../navit/main.c:131
-#, c-format
-msgid "Running from source directory\n"
-msgstr "Ajetaan lähdehakemistosta\n"
-
-#: ../navit/main.c:147
-#, c-format
-msgid "setting '%s' to '%s'\n"
-msgstr "asetetaan '%s' arvoon '%s'\n"
-
-#. We have not found an existing config file from all possibilities
-#: ../navit/main.c:248
-#, c-format
-msgid "No config file navit.xml, navit.xml.local found\n"
-msgstr "Ei asetustiedostoita navit.xml tai navit.xml.local\n"
-
-#: ../navit/main.c:255
-#, c-format
-msgid "Error parsing '%s': %s\n"
-msgstr "Virhe tulkitessa '%s': %s\n"
-
-#: ../navit/main.c:258
-#, c-format
-msgid "Using '%s'\n"
-msgstr "Käytetään '%s'\n"
-
-#: ../navit/main.c:261
-#, c-format
-msgid "No instance has been created, exiting\n"
-msgstr "Esimerkkiä ei tehty, lopetetaan\n"
-
-#: ../navit/navigation.c:171
-#, c-format
-msgid "%d m"
-msgstr "%d m"
-
-#: ../navit/navigation.c:173
-#, c-format
-msgid "in %d m"
-msgstr "%d m päästä"
-
-#: ../navit/navigation.c:177
-#, c-format
-msgid "%d meters"
-msgstr "%d metriä"
-
-#: ../navit/navigation.c:179
-#, c-format
-msgid "in %d meters"
-msgstr "%d metrin päästä"
-
-#: ../navit/navigation.c:185
-#, c-format
-msgid "%d.%d kilometer"
-msgstr "%d,%d kilometri"
-
-#: ../navit/navigation.c:187
-#, c-format
-msgid "in %d.%d kilometers"
-msgstr "%d,%d kilometrin päästä"
-
-#: ../navit/navigation.c:191
-#, c-format
-msgid "one kilometer"
-msgid_plural "%d kilometers"
-msgstr[0] "yksi kilometri"
-msgstr[1] "%d kilometriä"
-
-#: ../navit/navigation.c:193
-#, c-format
-msgid "in one kilometer"
-msgid_plural "in %d kilometers"
-msgstr[0] "Kilometrin päästä"
-msgstr[1] "%d kilometrin päästä"
-
-#: ../navit/navigation.c:447
-msgid "exit"
-msgstr ""
-
-#: ../navit/navigation.c:449
-msgid "ramp"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name
-#: ../navit/navigation.c:479
-#, c-format
-msgid "%sinto the street %s%s%s"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Male form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:483
-#, c-format
-msgid "%sinto the %s%s%s|male form"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Female form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:487
-#, c-format
-msgid "%sinto the %s%s%s|female form"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Neutral form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:491
-#, c-format
-msgid "%sinto the %s%s%s|neutral form"
-msgstr ""
-
-#: ../navit/navigation.c:497
-#, c-format
-msgid "into the %s"
-msgstr ""
-
-#: ../navit/navigation.c:518
-msgid "right"
-msgstr "vasemmalle"
-
-#: ../navit/navigation.c:525
-msgid "left"
-msgstr "oikealle"
-
-#: ../navit/navigation.c:529
-msgid "easily "
-msgstr "loivasti "
-
-#: ../navit/navigation.c:533
-msgid "strongly "
-msgstr "jyrkästi "
-
-#: ../navit/navigation.c:536
-msgid "unknown "
-msgstr "tuntematon "
-
-#
-#: ../navit/navigation.c:542
-msgid "When possible, please turn around"
-msgstr "Käänny ympäri"
-
-#: ../navit/navigation.c:549
-#, c-format
-msgid "Follow the road for the next %s"
-msgstr "Seuraa tätä tietä %s"
-
-#: ../navit/navigation.c:553
-msgid "soon"
-msgstr "pian"
-
-#: ../navit/navigation.c:559
-msgid "now"
-msgstr "nyt"
-
-#: ../navit/navigation.c:562
-msgid "error"
-msgstr "virhe"
-
-#. TRANSLATORS: The first argument is strength, the second direction, the third distance and the fourth destination Example: 'Turn 'slightly' 'left' in '100 m' 'onto baker street'
-#: ../navit/navigation.c:591
-#, c-format
-msgid "Turn %1$s%2$s %3$s%4$s"
-msgstr ""
-
-#: ../navit/navigation.c:594
-#, c-format
-msgid "You have reached your destination %s"
-msgstr "Olet saavuttanut kohteesi %s"
-
-#: ../navit/navit.c:664 ../navit/gui/gtk/gui_gtk_action.c:151
-msgid "Former Destinations"
-msgstr "Aiemmat kohteet"
-
-#: ../navit/navit.c:674 ../navit/gui/gtk/gui_gtk_action.c:152
-msgid "Bookmarks"
-msgstr "Kirjanmerkit"
-
-#: ../navit/navit.c:764
-#, fuzzy
-msgid "Command"
-msgstr "Puola"
-
-#: ../navit/navit.c:769
-msgid "Length"
-msgstr ""
-
-#: ../navit/navit.c:773 ../navit/navit.c:798
-msgid "km"
-msgstr ""
-
-#: ../navit/navit.c:777 ../navit/navit.c:802
-msgid "m"
-msgstr ""
-
-#: ../navit/navit.c:783
-msgid "Time"
-msgstr ""
-
-#: ../navit/navit.c:795
-#, fuzzy
-msgid "Destination Length"
-msgstr "Kohde"
-
-#: ../navit/navit.c:808
-#, fuzzy
-msgid "Destination Time"
-msgstr "Kohde"
-
-#: ../navit/navit.c:837 ../navit/gui/gtk/gui_gtk_action.c:160
-msgid "Roadbook"
-msgstr "Ohjeistaja"
-
-#: ../navit/popup.c:200 ../navit/popup.c:254
-msgid "Set as position"
-msgstr "Aseta sijainniksi"
-
-#: ../navit/popup.c:201 ../navit/popup.c:255
-msgid "Set as destination"
-msgstr "Aseta kohteeksi"
-
-#: ../navit/popup.c:202 ../navit/popup.c:256
-msgid "Add as bookmark"
-msgstr "Lisää kirjanmerkiksi"
-
-#: ../navit/popup.c:244
-#, c-format
-msgid "Point 0x%x 0x%x"
-msgstr "Piste 0x%x 0x%x"
-
-#: ../navit/popup.c:245
-#, fuzzy, c-format
-msgid "Screen coord : %d %d"
-msgstr "Ruutu %d %d"
-
-#. 020
-#: ../navit/country.c:24
-msgid "Andorra"
-msgstr "Andorra"
-
-#. 784
-#: ../navit/country.c:25
-msgid "United Arab Emirates"
-msgstr ""
-
-#. 004
-#: ../navit/country.c:26
-msgid "Afghanistan"
-msgstr ""
-
-#. 028
-#: ../navit/country.c:27
-msgid "Antigua and Barbuda"
-msgstr ""
-
-#. 660
-#: ../navit/country.c:28
-msgid "Anguilla"
-msgstr ""
-
-#. 008
-#: ../navit/country.c:29
-msgid "Albania"
-msgstr "Albania"
-
-#. 051
-#: ../navit/country.c:30
-msgid "Armenia"
-msgstr "Armenia"
-
-#. 530
-#: ../navit/country.c:31
-msgid "Netherlands Antilles"
-msgstr ""
-
-#. 024
-#: ../navit/country.c:32
-msgid "Angola"
-msgstr ""
-
-#. 010
-#: ../navit/country.c:33
-msgid "Antarctica"
-msgstr ""
-
-#. 032
-#: ../navit/country.c:34
-msgid "Argentina"
-msgstr ""
-
-#. 016
-#: ../navit/country.c:35
-msgid "American Samoa"
-msgstr ""
-
-#. 040
-#: ../navit/country.c:36
-msgid "Austria"
-msgstr "Itävalta"
-
-#. 036
-#: ../navit/country.c:37
-msgid "Australia"
-msgstr ""
-
-#. 533
-#: ../navit/country.c:38
-msgid "Aruba"
-msgstr ""
-
-#. 248
-#: ../navit/country.c:39
-msgid "Aland Islands"
-msgstr ""
-
-#. 031
-#: ../navit/country.c:40
-msgid "Azerbaijan"
-msgstr "Azerbaizan"
-
-#. 070
-#: ../navit/country.c:41
-msgid "Bosnia and Herzegovina"
-msgstr "Bosnia ja Hertsegovina"
-
-#. 052
-#: ../navit/country.c:42
-msgid "Barbados"
-msgstr ""
-
-#. 050
-#: ../navit/country.c:43
-msgid "Bangladesh"
-msgstr ""
-
-#. 056
-#: ../navit/country.c:44
-msgid "Belgium"
-msgstr "Belgia"
-
-#. 854
-#: ../navit/country.c:45
-msgid "Burkina Faso"
-msgstr ""
-
-#. 100
-#: ../navit/country.c:46
-msgid "Bulgaria"
-msgstr "Bulgaria"
-
-#. 048
-#: ../navit/country.c:47
-msgid "Bahrain"
-msgstr ""
-
-#. 108
-#: ../navit/country.c:48
-msgid "Burundi"
-msgstr ""
-
-#. 204
-#: ../navit/country.c:49
-msgid "Benin"
-msgstr ""
-
-#. 652
-#: ../navit/country.c:50
-msgid "Saint Barthelemy"
-msgstr ""
-
-#. 060
-#: ../navit/country.c:51
-msgid "Bermuda"
-msgstr ""
-
-#. 096
-#: ../navit/country.c:52
-msgid "Brunei Darussalam"
-msgstr ""
-
-#. 068
-#: ../navit/country.c:53
-msgid "Bolivia"
-msgstr ""
-
-#. 076
-#: ../navit/country.c:54
-msgid "Brazil"
-msgstr ""
-
-#. 044
-#: ../navit/country.c:55
-msgid "Bahamas"
-msgstr ""
-
-#. 064
-#: ../navit/country.c:56
-msgid "Bhutan"
-msgstr ""
-
-#. 074
-#: ../navit/country.c:57
-msgid "Bouvet Island"
-msgstr ""
-
-#. 072
-#: ../navit/country.c:58
-msgid "Botswana"
-msgstr ""
-
-#. 112
-#: ../navit/country.c:59
-msgid "Belarus"
-msgstr "Valko-Venäjä"
-
-#. 084
-#: ../navit/country.c:60
-msgid "Belize"
-msgstr ""
-
-#. 124
-#: ../navit/country.c:61
-msgid "Canada"
-msgstr ""
-
-#. 166
-#: ../navit/country.c:62
-msgid "Cocos (Keeling) Islands"
-msgstr ""
-
-#. 180
-#: ../navit/country.c:63
-msgid "Congo, Democratic Republic of the"
-msgstr ""
-
-#. 140
-#: ../navit/country.c:64
-msgid "Central African Republic"
-msgstr ""
-
-#. 178
-#: ../navit/country.c:65
-msgid "Congo"
-msgstr ""
-
-#. 756
-#: ../navit/country.c:66
-msgid "Switzerland"
-msgstr "Sveitsi"
-
-#. 384
-#: ../navit/country.c:67
-msgid "Cote d'Ivoire"
-msgstr ""
-
-#. 184
-#: ../navit/country.c:68
-msgid "Cook Islands"
-msgstr ""
-
-#. 152
-#: ../navit/country.c:69
-msgid "Chile"
-msgstr ""
-
-#. 120
-#: ../navit/country.c:70
-msgid "Cameroon"
-msgstr ""
-
-#. 156
-#: ../navit/country.c:71
-msgid "China"
-msgstr ""
-
-#. 170
-#: ../navit/country.c:72
-msgid "Colombia"
-msgstr ""
-
-#. 188
-#: ../navit/country.c:73
-msgid "Costa Rica"
-msgstr ""
-
-#. 192
-#: ../navit/country.c:74
-msgid "Cuba"
-msgstr ""
-
-#. 132
-#: ../navit/country.c:75
-msgid "Cape Verde"
-msgstr ""
-
-#. 162
-#: ../navit/country.c:76
-msgid "Christmas Island"
-msgstr ""
-
-#. 196
-#: ../navit/country.c:77
-msgid "Cyprus"
-msgstr "Kypros"
-
-#. 203
-#: ../navit/country.c:78
-msgid "Czech Republic"
-msgstr "Tsekin tasavalta"
-
-#. 276
-#: ../navit/country.c:79
-msgid "Germany"
-msgstr "Saksa"
-
-#. 262
-#: ../navit/country.c:80
-msgid "Djibouti"
-msgstr ""
-
-#. 208
-#: ../navit/country.c:81
-msgid "Denmark"
-msgstr "Tanska"
-
-#. 212
-#: ../navit/country.c:82
-msgid "Dominica"
-msgstr ""
-
-#. 214
-#: ../navit/country.c:83
-msgid "Dominican Republic"
-msgstr ""
-
-#. 012
-#: ../navit/country.c:84
-msgid "Algeria"
-msgstr "Algeria"
-
-#. 218
-#: ../navit/country.c:85
-msgid "Ecuador"
-msgstr ""
-
-#. 233
-#: ../navit/country.c:86
-msgid "Estonia"
-msgstr "Viro"
-
-#. 818
-#: ../navit/country.c:87
-msgid "Egypt"
-msgstr "Egypti"
-
-#. 732
-#: ../navit/country.c:88
-msgid "Western Sahara"
-msgstr "Länsi-Sahara"
-
-#. 232
-#: ../navit/country.c:89
-msgid "Eritrea"
-msgstr ""
-
-#. 724
-#: ../navit/country.c:90
-msgid "Spain"
-msgstr "Espanja"
-
-#. 231
-#: ../navit/country.c:91
-msgid "Ethiopia"
-msgstr ""
-
-#. 246
-#: ../navit/country.c:92
-msgid "Finland"
-msgstr "Suomi"
-
-#. 242
-#: ../navit/country.c:93
-msgid "Fiji"
-msgstr ""
-
-#. 238
-#: ../navit/country.c:94
-msgid "Falkland Islands (Malvinas)"
-msgstr ""
-
-#. 583
-#: ../navit/country.c:95
-msgid "Micronesia, Federated States of"
-msgstr ""
-
-#. 234
-#: ../navit/country.c:96
-msgid "Faroe Islands"
-msgstr "Färsaaret"
-
-#. 250
-#: ../navit/country.c:97
-msgid "France"
-msgstr "Ranska"
-
-#. 266
-#: ../navit/country.c:98
-msgid "Gabon"
-msgstr ""
-
-#. 826
-#: ../navit/country.c:99
-msgid "United Kingdom"
-msgstr "Iso-Britannia"
-
-#. 308
-#: ../navit/country.c:100
-msgid "Grenada"
-msgstr ""
-
-#. 268
-#: ../navit/country.c:101
-msgid "Georgia"
-msgstr "Georgia"
-
-#. 254
-#: ../navit/country.c:102
-msgid "French Guiana"
-msgstr ""
-
-#. 831
-#: ../navit/country.c:103
-msgid "Guernsey"
-msgstr ""
-
-#. 288
-#: ../navit/country.c:104
-msgid "Ghana"
-msgstr ""
-
-#. 292
-#: ../navit/country.c:105
-msgid "Gibraltar"
-msgstr "Gibraltar"
-
-#. 304
-#: ../navit/country.c:106
-msgid "Greenland"
-msgstr ""
-
-#. 270
-#: ../navit/country.c:107
-msgid "Gambia"
-msgstr ""
-
-#. 324
-#: ../navit/country.c:108
-msgid "Guinea"
-msgstr ""
-
-#. 312
-#: ../navit/country.c:109
-msgid "Guadeloupe"
-msgstr ""
-
-#. 226
-#: ../navit/country.c:110
-msgid "Equatorial Guinea"
-msgstr ""
-
-#. 300
-#: ../navit/country.c:111
-msgid "Greece"
-msgstr "Kreikka"
-
-#. 239
-#: ../navit/country.c:112
-msgid "South Georgia and the South Sandwich Islands"
-msgstr ""
-
-#. 320
-#: ../navit/country.c:113
-msgid "Guatemala"
-msgstr ""
-
-#. 316
-#: ../navit/country.c:114
-msgid "Guam"
-msgstr ""
-
-#. 624
-#: ../navit/country.c:115
-msgid "Guinea-Bissau"
-msgstr ""
-
-#. 328
-#: ../navit/country.c:116
-msgid "Guyana"
-msgstr ""
-
-#. 344
-#: ../navit/country.c:117
-msgid "Hong Kong"
-msgstr ""
-
-#. 334
-#: ../navit/country.c:118
-msgid "Heard Island and McDonald Islands"
-msgstr ""
-
-#. 340
-#: ../navit/country.c:119
-msgid "Honduras"
-msgstr ""
-
-#. 191
-#: ../navit/country.c:120
-msgid "Croatia"
-msgstr "Kroatia"
-
-#. 332
-#: ../navit/country.c:121
-msgid "Haiti"
-msgstr ""
-
-#. 348
-#: ../navit/country.c:122
-msgid "Hungary"
-msgstr "Unkari"
-
-#. 360
-#: ../navit/country.c:123
-msgid "Indonesia"
-msgstr ""
-
-#. 372
-#: ../navit/country.c:124
-msgid "Ireland"
-msgstr "Irlanti"
-
-#. 376
-#: ../navit/country.c:125
-msgid "Israel"
-msgstr "Israel"
-
-#. 833
-#: ../navit/country.c:126
-msgid "Isle of Man"
-msgstr ""
-
-#. 356
-#: ../navit/country.c:127
-msgid "India"
-msgstr ""
-
-#. 086
-#: ../navit/country.c:128
-msgid "British Indian Ocean Territory"
-msgstr ""
-
-#. 368
-#: ../navit/country.c:129
-msgid "Iraq"
-msgstr ""
-
-#. 364
-#: ../navit/country.c:130
-msgid "Iran, Islamic Republic of"
-msgstr ""
-
-#. 352
-#: ../navit/country.c:131
-msgid "Iceland"
-msgstr "Islanti"
-
-#. 380
-#: ../navit/country.c:132
-msgid "Italy"
-msgstr "Italia"
-
-#. 832
-#: ../navit/country.c:133
-msgid "Jersey"
-msgstr ""
-
-#. 388
-#: ../navit/country.c:134
-msgid "Jamaica"
-msgstr ""
-
-#. 400
-#: ../navit/country.c:135
-msgid "Jordan"
-msgstr "Jordania"
-
-#. 392
-#: ../navit/country.c:136
-msgid "Japan"
-msgstr ""
-
-#. 404
-#: ../navit/country.c:137
-msgid "Kenya"
-msgstr ""
-
-#. 417
-#: ../navit/country.c:138
-msgid "Kyrgyzstan"
-msgstr ""
-
-#. 116
-#: ../navit/country.c:139
-msgid "Cambodia"
-msgstr ""
-
-#. 296
-#: ../navit/country.c:140
-msgid "Kiribati"
-msgstr ""
-
-#. 174
-#: ../navit/country.c:141
-msgid "Comoros"
-msgstr ""
-
-#. 659
-#: ../navit/country.c:142
-msgid "Saint Kitts and Nevis"
-msgstr ""
-
-#. 408
-#: ../navit/country.c:143
-msgid "Korea, Democratic People's Republic of"
-msgstr ""
-
-#. 410
-#: ../navit/country.c:144
-msgid "Korea, Republic of"
-msgstr ""
-
-#. 414
-#: ../navit/country.c:145
-msgid "Kuwait"
-msgstr ""
-
-#. 136
-#: ../navit/country.c:146
-msgid "Cayman Islands"
-msgstr ""
-
-#. 398
-#: ../navit/country.c:147
-msgid "Kazakhstan"
-msgstr ""
-
-#. 418
-#: ../navit/country.c:148
-msgid "Lao People's Democratic Republic"
-msgstr ""
-
-#. 422
-#: ../navit/country.c:149
-msgid "Lebanon"
-msgstr "Libanon"
-
-#. 662
-#: ../navit/country.c:150
-msgid "Saint Lucia"
-msgstr ""
-
-#. 438
-#: ../navit/country.c:151
-msgid "Liechtenstein"
-msgstr "Lichtenstein"
-
-#. 144
-#: ../navit/country.c:152
-msgid "Sri Lanka"
-msgstr ""
-
-#. 430
-#: ../navit/country.c:153
-msgid "Liberia"
-msgstr ""
-
-#. 426
-#: ../navit/country.c:154
-msgid "Lesotho"
-msgstr ""
-
-#. 440
-#: ../navit/country.c:155
-msgid "Lithuania"
-msgstr "Liettua"
-
-#. 442
-#: ../navit/country.c:156
-msgid "Luxembourg"
-msgstr "Luxemburg"
-
-#. 428
-#: ../navit/country.c:157
-msgid "Latvia"
-msgstr "Latvia"
-
-#. 434
-#: ../navit/country.c:158
-msgid "Libyan Arab Jamahiriya"
-msgstr ""
-
-#. 504
-#: ../navit/country.c:159
-msgid "Morocco"
-msgstr "Marokko"
-
-#. 492
-#: ../navit/country.c:160
-msgid "Monaco"
-msgstr "Monaco"
-
-#. 498
-#: ../navit/country.c:161
-msgid "Moldova, Republic of"
-msgstr ""
-
-#. 499
-#: ../navit/country.c:162
-msgid "Montenegro"
-msgstr ""
-
-#. 663
-#: ../navit/country.c:163
-msgid "Saint Martin (French part)"
-msgstr ""
-
-#. 450
-#: ../navit/country.c:164
-msgid "Madagascar"
-msgstr ""
-
-#. 584
-#: ../navit/country.c:165
-msgid "Marshall Islands"
-msgstr ""
-
-#. 807
-#: ../navit/country.c:166
-msgid "Macedonia, the former Yugoslav Republic of"
-msgstr ""
-
-#. 466
-#: ../navit/country.c:167
-msgid "Mali"
-msgstr ""
-
-#. 104
-#: ../navit/country.c:168
-msgid "Myanmar"
-msgstr ""
-
-#. 496
-#: ../navit/country.c:169
-msgid "Mongolia"
-msgstr ""
-
-#. 446
-#: ../navit/country.c:170
-msgid "Macao"
-msgstr ""
-
-#. 580
-#: ../navit/country.c:171
-msgid "Northern Mariana Islands"
-msgstr ""
-
-#. 474
-#: ../navit/country.c:172
-msgid "Martinique"
-msgstr ""
-
-#. 478
-#: ../navit/country.c:173
-msgid "Mauritania"
-msgstr ""
-
-#. 500
-#: ../navit/country.c:174
-msgid "Montserrat"
-msgstr ""
-
-#. 470
-#: ../navit/country.c:175
-msgid "Malta"
-msgstr "Malta"
-
-#. 480
-#: ../navit/country.c:176
-msgid "Mauritius"
-msgstr ""
-
-#. 462
-#: ../navit/country.c:177
-msgid "Maldives"
-msgstr ""
-
-#. 454
-#: ../navit/country.c:178
-msgid "Malawi"
-msgstr ""
-
-#. 484
-#: ../navit/country.c:179
-msgid "Mexico"
-msgstr ""
-
-#. 458
-#: ../navit/country.c:180
-msgid "Malaysia"
-msgstr ""
-
-#. 508
-#: ../navit/country.c:181
-msgid "Mozambique"
-msgstr ""
-
-#. 516
-#: ../navit/country.c:182
-msgid "Namibia"
-msgstr ""
-
-#. 540
-#: ../navit/country.c:183
-msgid "New Caledonia"
-msgstr ""
-
-#. 562
-#: ../navit/country.c:184
-msgid "Niger"
-msgstr ""
-
-#. 574
-#: ../navit/country.c:185
-msgid "Norfolk Island"
-msgstr ""
-
-#. 566
-#: ../navit/country.c:186
-msgid "Nigeria"
-msgstr ""
-
-#. 558
-#: ../navit/country.c:187
-msgid "Nicaragua"
-msgstr ""
-
-#. 528
-#: ../navit/country.c:188
-msgid "Netherlands"
-msgstr "Alankomaat"
-
-#. 578
-#: ../navit/country.c:189
-msgid "Norway"
-msgstr "Norja"
-
-#. 524
-#: ../navit/country.c:190
-msgid "Nepal"
-msgstr ""
-
-#. 520
-#: ../navit/country.c:191
-msgid "Nauru"
-msgstr ""
-
-#. 570
-#: ../navit/country.c:192
-msgid "Niue"
-msgstr ""
-
-#. 554
-#: ../navit/country.c:193
-msgid "New Zealand"
-msgstr ""
-
-#. 512
-#: ../navit/country.c:194
-msgid "Oman"
-msgstr ""
-
-#. 591
-#: ../navit/country.c:195
-msgid "Panama"
-msgstr ""
-
-#. 604
-#: ../navit/country.c:196
-msgid "Peru"
-msgstr ""
-
-#. 258
-#: ../navit/country.c:197
-msgid "French Polynesia"
-msgstr ""
-
-#. 598
-#: ../navit/country.c:198
-msgid "Papua New Guinea"
-msgstr ""
-
-#. 608
-#: ../navit/country.c:199
-msgid "Philippines"
-msgstr ""
-
-#. 586
-#: ../navit/country.c:200
-msgid "Pakistan"
-msgstr ""
-
-#. 616
-#: ../navit/country.c:201
-msgid "Poland"
-msgstr "Puola"
-
-#. 666
-#: ../navit/country.c:202
-msgid "Saint Pierre and Miquelon"
-msgstr ""
-
-#. 612
-#: ../navit/country.c:203
-msgid "Pitcairn"
-msgstr ""
-
-#. 630
-#: ../navit/country.c:204
-msgid "Puerto Rico"
-msgstr ""
-
-#. 275
-#: ../navit/country.c:205
-msgid "Palestinian Territory, Occupied"
-msgstr ""
-
-#. 620
-#: ../navit/country.c:206
-msgid "Portugal"
-msgstr "Portugali"
-
-#. 585
-#: ../navit/country.c:207
-msgid "Palau"
-msgstr ""
-
-#. 600
-#: ../navit/country.c:208
-msgid "Paraguay"
-msgstr ""
-
-#. 634
-#: ../navit/country.c:209
-msgid "Qatar"
-msgstr ""
-
-#. 638
-#: ../navit/country.c:210
-msgid "Reunion"
-msgstr ""
-
-#. 642
-#: ../navit/country.c:211
-msgid "Romania"
-msgstr "Romania"
-
-#. 688
-#: ../navit/country.c:212
-msgid "Serbia"
-msgstr "Serbia"
-
-#. 643
-#: ../navit/country.c:213
-msgid "Russian Federation"
-msgstr "Venäjä"
-
-#. 646
-#: ../navit/country.c:214
-msgid "Rwanda"
-msgstr ""
-
-#
-#. 682
-#: ../navit/country.c:215
-msgid "Saudi Arabia"
-msgstr "Saudi-Arabia"
-
-#. 090
-#: ../navit/country.c:216
-msgid "Solomon Islands"
-msgstr ""
-
-#. 690
-#: ../navit/country.c:217
-msgid "Seychelles"
-msgstr ""
-
-#. 736
-#: ../navit/country.c:218
-msgid "Sudan"
-msgstr ""
-
-#. 752
-#: ../navit/country.c:219
-msgid "Sweden"
-msgstr "Ruotsi"
-
-#. 702
-#: ../navit/country.c:220
-msgid "Singapore"
-msgstr ""
-
-#. 654
-#: ../navit/country.c:221
-msgid "Saint Helena"
-msgstr ""
-
-#. 705
-#: ../navit/country.c:222
-msgid "Slovenia"
-msgstr "Slovenia"
-
-#. 744
-#: ../navit/country.c:223
-msgid "Svalbard and Jan Mayen"
-msgstr "Svalbard ja Jan Mayen"
-
-#. 703
-#: ../navit/country.c:224
-msgid "Slovakia"
-msgstr "Slovakia"
-
-#. 694
-#: ../navit/country.c:225
-msgid "Sierra Leone"
-msgstr ""
-
-#. 674
-#: ../navit/country.c:226
-msgid "San Marino"
-msgstr "San Marino"
-
-#. 686
-#: ../navit/country.c:227
-msgid "Senegal"
-msgstr ""
-
-#. 706
-#: ../navit/country.c:228
-msgid "Somalia"
-msgstr ""
-
-#. 740
-#: ../navit/country.c:229
-msgid "Suriname"
-msgstr ""
-
-#. 678
-#: ../navit/country.c:230
-msgid "Sao Tome and Principe"
-msgstr ""
-
-#. 222
-#: ../navit/country.c:231
-msgid "El Salvador"
-msgstr ""
-
-#. 760
-#: ../navit/country.c:232
-msgid "Syrian Arab Republic"
-msgstr ""
-
-#. 748
-#: ../navit/country.c:233
-msgid "Swaziland"
-msgstr ""
-
-#. 796
-#: ../navit/country.c:234
-msgid "Turks and Caicos Islands"
-msgstr ""
-
-#. 148
-#: ../navit/country.c:235
-msgid "Chad"
-msgstr ""
-
-#. 260
-#: ../navit/country.c:236
-msgid "French Southern Territories"
-msgstr ""
-
-#. 768
-#: ../navit/country.c:237
-msgid "Togo"
-msgstr ""
-
-#. 764
-#: ../navit/country.c:238
-msgid "Thailand"
-msgstr ""
-
-#. 762
-#: ../navit/country.c:239
-msgid "Tajikistan"
-msgstr ""
-
-#. 772
-#: ../navit/country.c:240
-msgid "Tokelau"
-msgstr ""
-
-#. 626
-#: ../navit/country.c:241
-msgid "Timor-Leste"
-msgstr ""
-
-#. 795
-#: ../navit/country.c:242
-msgid "Turkmenistan"
-msgstr ""
-
-#. 788
-#: ../navit/country.c:243
-msgid "Tunisia"
-msgstr "Tunisia"
-
-#. 776
-#: ../navit/country.c:244
-msgid "Tonga"
-msgstr ""
-
-#. 792
-#: ../navit/country.c:245
-msgid "Turkey"
-msgstr "Turkki"
-
-#. 780
-#: ../navit/country.c:246
-msgid "Trinidad and Tobago"
-msgstr ""
-
-#. 798
-#: ../navit/country.c:247
-msgid "Tuvalu"
-msgstr ""
-
-#. 158
-#: ../navit/country.c:248
-msgid "Taiwan, Province of China"
-msgstr ""
-
-#. 834
-#: ../navit/country.c:249
-msgid "Tanzania, United Republic of"
-msgstr ""
-
-#. 804
-#: ../navit/country.c:250
-msgid "Ukraine"
-msgstr "Ukraina"
-
-#. 800
-#: ../navit/country.c:251
-msgid "Uganda"
-msgstr ""
-
-#. 581
-#: ../navit/country.c:252
-msgid "United States Minor Outlying Islands"
-msgstr ""
-
-#. 840
-#: ../navit/country.c:253
-msgid "United States"
-msgstr ""
-
-#. 858
-#: ../navit/country.c:254
-msgid "Uruguay"
-msgstr ""
-
-#. 860
-#: ../navit/country.c:255
-msgid "Uzbekistan"
-msgstr ""
-
-#. 336
-#: ../navit/country.c:256
-msgid "Holy See (Vatican City State)"
-msgstr ""
-
-#. 670
-#: ../navit/country.c:257
-msgid "Saint Vincent and the Grenadines"
-msgstr ""
-
-#. 862
-#: ../navit/country.c:258
-msgid "Venezuela"
-msgstr ""
-
-#. 092
-#: ../navit/country.c:259
-msgid "Virgin Islands, British"
-msgstr ""
-
-#. 850
-#: ../navit/country.c:260
-msgid "Virgin Islands, U.S."
-msgstr ""
-
-#. 704
-#: ../navit/country.c:261
-msgid "Viet Nam"
-msgstr ""
-
-#. 548
-#: ../navit/country.c:262
-msgid "Vanuatu"
-msgstr ""
-
-#. 876
-#: ../navit/country.c:263
-msgid "Wallis and Futuna"
-msgstr ""
-
-#. 882
-#: ../navit/country.c:264
-msgid "Samoa"
-msgstr ""
-
-#. 887
-#: ../navit/country.c:265
-msgid "Yemen"
-msgstr ""
-
-#. 175
-#: ../navit/country.c:266
-msgid "Mayotte"
-msgstr ""
-
-#. 710
-#: ../navit/country.c:267
-msgid "South Africa"
-msgstr ""
-
-#. 894
-#: ../navit/country.c:268
-msgid "Zambia"
-msgstr ""
-
-#. 716
-#: ../navit/country.c:269
-msgid "Zimbabwe"
-msgstr ""
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:98
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-msgid "Car"
-msgstr "Auto"
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso2"
-msgstr "Iso2"
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso3"
-msgstr "Iso3"
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:403
-msgid "Country"
-msgstr "Maa"
-
-#
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "Postal"
-msgstr "Postinumero"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "Town"
-msgstr "Paikkakunta"
-
-#
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "District"
-msgstr "Alue"
-
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-#: ../navit/gui/gtk/destination.c:412
-msgid "Street"
-msgstr "Katu"
-
-#: ../navit/gui/gtk/destination.c:100 ../navit/gui/gtk/destination.c:414
-msgid "Number"
-msgstr "Numero"
-
-#
-#: ../navit/gui/gtk/destination.c:398
-msgid "Enter Destination"
-msgstr "Anna kohde"
-
-#: ../navit/gui/gtk/destination.c:405
-msgid "Zip Code"
-msgstr "Postinumero"
-
-#: ../navit/gui/gtk/destination.c:407
-msgid "City"
-msgstr "Kaupunki"
-
-#: ../navit/gui/gtk/destination.c:409
-msgid "District/Township"
-msgstr "Maakunta"
-
-#: ../navit/gui/gtk/destination.c:437 ../navit/gui/gtk/gui_gtk_action.c:153
-msgid "Map"
-msgstr "Kartta"
-
-#: ../navit/gui/gtk/destination.c:438
-msgid "Bookmark"
-msgstr "Kirjanmerkki"
-
-#: ../navit/gui/gtk/destination.c:439 ../navit/gui/gtk/gui_gtk_action.c:166
-msgid "Destination"
-msgstr "Kohde"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:149
-msgid "Display"
-msgstr "Näyttö"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:150
-msgid "Route"
-msgstr "Reitti"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:154
-msgid "Layout"
-msgstr "Pohja"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:155
-msgid "Projection"
-msgstr "Projektio"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:156
-msgid "Vehicle"
-msgstr "Kulkuneuvo"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:157
-msgid "ZoomOut"
-msgstr "Loitonna"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:158
-msgid "ZoomIn"
-msgstr "Lähennä"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:159
-msgid "Refresh"
-msgstr "Päivitä"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:162 ../navit/gui/gtk/gui_gtk_action.c:164
-msgid "Info"
-msgstr "Info"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:167
-msgid "Clear"
-msgstr "Tyhjennä"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:168
-msgid "Test"
-msgstr "Testi"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:169
-msgid "_Quit"
-msgstr "Sulje"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:176
-msgid "Cursor"
-msgstr "Osoitin"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:177
-msgid "Tracking"
-msgstr "Reititys"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:178
-msgid "Orientation"
-msgstr "Asento"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:180 ../navit/gui/gtk/gui_gtk_action.c:182
-msgid "Fullscreen"
-msgstr "Koko ruutu"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:190
-msgid "Data"
-msgstr "Tieto"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "N"
-msgstr ""
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NE"
-msgstr ""
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "E"
-msgstr ""
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SE"
-msgstr ""
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "S"
-msgstr ""
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SW"
-msgstr ""
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "W"
-msgstr ""
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NW"
-msgstr ""
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:103
-#, c-format
-msgid "Route %4.0fkm %02d:%02d ETA"
-msgstr ""
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:148
-msgid "Route 0000km 0+00:00 ETA"
-msgstr ""
diff --git a/po/fr.po b/po/fr.po
deleted file mode 100644
index 98f0257e..00000000
--- a/po/fr.po
+++ /dev/null
@@ -1,1753 +0,0 @@
-# French translations for navit
-# Copyright (C) 2007
-# This file is distributed under the same license as the navit package.
-# 'KaZeR' <kazer@altern.org>
-# 'Nekohayo' <nekohayo arobas gmail point com>
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: Navit 0.1.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-05-26 17:12+0200\n"
-"PO-Revision-Date: 2008-05-27 12:07+0000\n"
-"Last-Translator: KaZeR <Unknown>\n"
-"Language-Team: KaZeR <kazer@altern.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=2; plural=n > 1;\n"
-"X-Launchpad-Export-Date: 2008-05-30 21:28+0000\n"
-"X-Generator: Launchpad (build Unknown)\n"
-
-#~ msgid "Moldova"
-#~ msgstr "Moldavie"
-
-#~ msgid "Palestinia"
-#~ msgstr "Palestine"
-
-#~ msgid "VisibleBlocks"
-#~ msgstr "Blocs visibles"
-
-#~ msgid "VisibleTowns"
-#~ msgstr "Villes visibles"
-
-#~ msgid "VisiblePolys"
-#~ msgstr "Polys visibles"
-
-#~ msgid "VisibleStreets"
-#~ msgstr "Rues visibles"
-
-#~ msgid "VisiblePoints"
-#~ msgstr "Points visibles"
-
-#~ msgid "RouteGraph"
-#~ msgstr "RouteGraph"
-
-#~ msgid "two kilometers"
-#~ msgstr "deux kilomètres"
-
-#~ msgid "in two kilometers"
-#~ msgstr "dans deux kilomètres"
-
-#~ msgid "three kilometers"
-#~ msgstr "trois kilomètres"
-
-#~ msgid "in three kilometers"
-#~ msgstr "dans trois kilomètres"
-
-#~ msgid "four kilometers"
-#~ msgstr "quatre kilomètres"
-
-#~ msgid "in four kilometers"
-#~ msgstr "dans quatre kilomètres"
-
-#~ msgid "%d kilometers"
-#~ msgstr "%d kilomètres"
-
-#~ msgid "in %d kilometers"
-#~ msgstr "dans %d kilomètres"
-
-#~ msgid "strength_pos"
-#~ msgstr "2"
-
-#~ msgid "direction_pos"
-#~ msgstr "3"
-
-#~ msgid "distance_pos"
-#~ msgstr "1"
-
-#: ../navit/main.c:111
-#, c-format
-msgid ""
-"navit usage:\n"
-"navit [options] [configfile]\n"
-"\t-c <file>: use <file> as config file\n"
-"\t-d <n>: set the debug output level to <n>. (TODO)\n"
-"\t-h: print this usage info and exit.\n"
-"\t-v: Print the version and exit.\n"
-msgstr ""
-"utilisation de navit:\n"
-"navit [options] [fichier de configuration]\n"
-"\t-c <fichier>: utiliser <fichier> comme source de configuration\n"
-"\t-d <n>: définir le niveau de verbosité à <n>. (non implémenté)\n"
-"\t-h: afficher ce message et quitter\n"
-"\t-v: afficher la version et quitter\n"
-
-#: ../navit/main.c:131
-#, c-format
-msgid "Running from source directory\n"
-msgstr "Execution depuis le dossier source\n"
-
-#: ../navit/main.c:147
-#, c-format
-msgid "setting '%s' to '%s'\n"
-msgstr "'%s' mis à '%s'\n"
-
-#. We have not found an existing config file from all possibilities
-#: ../navit/main.c:248
-#, c-format
-msgid "No config file navit.xml, navit.xml.local found\n"
-msgstr "Fichier de configuration navit.xml ou navit.xml.local non trouvé\n"
-
-#: ../navit/main.c:255
-#, c-format
-msgid "Error parsing '%s': %s\n"
-msgstr "Erreur lors du traitement de '%s': %s\n"
-
-#: ../navit/main.c:258
-#, c-format
-msgid "Using '%s'\n"
-msgstr "Utilisation de '%s'\n"
-
-#: ../navit/main.c:261
-#, c-format
-msgid "No instance has been created, exiting\n"
-msgstr "Pas d'instance créée, sortie\n"
-
-#: ../navit/navigation.c:171
-#, c-format
-msgid "%d m"
-msgstr "%d m"
-
-#: ../navit/navigation.c:173
-#, c-format
-msgid "in %d m"
-msgstr "dans %d m"
-
-#: ../navit/navigation.c:177
-#, c-format
-msgid "%d meters"
-msgstr "%d mètres"
-
-#: ../navit/navigation.c:179
-#, c-format
-msgid "in %d meters"
-msgstr "dans %d mètres"
-
-#: ../navit/navigation.c:185
-#, c-format
-msgid "%d.%d kilometer"
-msgstr "%d,%d kilomètre"
-
-#: ../navit/navigation.c:187
-#, c-format
-msgid "in %d.%d kilometers"
-msgstr "dans %d.%d kilomètres"
-
-#: ../navit/navigation.c:191
-#, c-format
-msgid "one kilometer"
-msgid_plural "%d kilometers"
-msgstr[0] "un kilomètre"
-msgstr[1] "%d kilomètres"
-
-#: ../navit/navigation.c:193
-#, c-format
-msgid "in one kilometer"
-msgid_plural "in %d kilometers"
-msgstr[0] "dans un kilomètre"
-msgstr[1] "dans %d kilomètres"
-
-#: ../navit/navigation.c:447
-msgid "exit"
-msgstr "sortie"
-
-# sémantique foireuse. c'est "turn left ramp", en français ça sortait "tournez à droite bretelle", donc j'ai remplacé par "sur la bretelle"
-#: ../navit/navigation.c:449
-msgid "ramp"
-msgstr "sur la bretelle"
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name
-#: ../navit/navigation.c:479
-#, c-format
-msgid "%sinto the street %s%s%s"
-msgstr "%ssur %s%s%s"
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Male form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:483
-#, c-format
-msgid "%sinto the %s%s%s|male form"
-msgstr "%ssur le %s%s%s|male form"
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Female form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:487
-#, c-format
-msgid "%sinto the %s%s%s|female form"
-msgstr "%ssur la %s%s%s|female form"
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Neutral form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:491
-#, c-format
-msgid "%sinto the %s%s%s|neutral form"
-msgstr "%ssur l'%s%s%s|neutral form"
-
-# utilisé pour les "références" de route. Par exemple, "tournez sur la 43".
-#: ../navit/navigation.c:497
-#, c-format
-msgid "into the %s"
-msgstr "sur la %s"
-
-# tournez à droite
-#: ../navit/navigation.c:518
-msgid "right"
-msgstr "à droite"
-
-# tournez à gauche
-#: ../navit/navigation.c:525
-msgid "left"
-msgstr "à gauche"
-
-# utilisé pour les changements de voie pour les sorties?
-#: ../navit/navigation.c:529
-msgid "easily "
-msgstr "légèrement "
-
-#: ../navit/navigation.c:533
-msgid "strongly "
-msgstr "fortement "
-
-# attention à l'espace à la fin
-#: ../navit/navigation.c:536
-msgid "unknown "
-msgstr "inconnu "
-
-#: ../navit/navigation.c:542
-msgid "When possible, please turn around"
-msgstr "Dès que possible, faites demi-tour"
-
-#: ../navit/navigation.c:549
-#, c-format
-msgid "Follow the road for the next %s"
-msgstr "Suivez la route sur %s"
-
-#: ../navit/navigation.c:553
-msgid "soon"
-msgstr "bientôt"
-
-#: ../navit/navigation.c:559
-msgid "now"
-msgstr "maintenant"
-
-#: ../navit/navigation.c:562
-msgid "error"
-msgstr "erreur"
-
-# espace important après le 2
-#. TRANSLATORS: The first argument is strength, the second direction, the third distance and the fourth destination Example: 'Turn 'slightly' 'left' in '100 m' 'onto baker street'
-#: ../navit/navigation.c:591
-#, c-format
-msgid "Turn %1$s%2$s %3$s%4$s"
-msgstr "%3$s, tournez %1$s%2$s %4$s"
-
-#: ../navit/navigation.c:594
-#, c-format
-msgid "You have reached your destination %s"
-msgstr "Vous êtes arrivé à votre destination %s"
-
-#: ../navit/navit.c:664 ../navit/gui/gtk/gui_gtk_action.c:151
-msgid "Former Destinations"
-msgstr "Destinations précédentes"
-
-#: ../navit/navit.c:674 ../navit/gui/gtk/gui_gtk_action.c:152
-msgid "Bookmarks"
-msgstr "Signets"
-
-#: ../navit/navit.c:764
-msgid "Command"
-msgstr "Commande"
-
-#: ../navit/navit.c:769
-msgid "Length"
-msgstr "Distance"
-
-#: ../navit/navit.c:773 ../navit/navit.c:798
-msgid "km"
-msgstr "km"
-
-#: ../navit/navit.c:777 ../navit/navit.c:802
-msgid "m"
-msgstr "m"
-
-#: ../navit/navit.c:783
-msgid "Time"
-msgstr "Durée"
-
-#: ../navit/navit.c:795
-#, fuzzy
-msgid "Destination Length"
-msgstr "Distance à parcourir"
-
-#: ../navit/navit.c:808
-msgid "Destination Time"
-msgstr "Temps de parcours"
-
-#: ../navit/navit.c:837 ../navit/gui/gtk/gui_gtk_action.c:160
-msgid "Roadbook"
-msgstr "Carnet de route"
-
-#: ../navit/popup.c:200 ../navit/popup.c:254
-msgid "Set as position"
-msgstr "Définir comme position"
-
-#: ../navit/popup.c:201 ../navit/popup.c:255
-msgid "Set as destination"
-msgstr "Définir comme destination"
-
-#: ../navit/popup.c:202 ../navit/popup.c:256
-msgid "Add as bookmark"
-msgstr "Ajouter aux favoris"
-
-#: ../navit/popup.c:244
-#, c-format
-msgid "Point 0x%x 0x%x"
-msgstr "Point 0x%x 0x%x"
-
-#: ../navit/popup.c:245
-#, c-format
-msgid "Screen coord : %d %d"
-msgstr "Coord. à l'écran : %d %d"
-
-#. 020
-#: ../navit/country.c:24
-msgid "Andorra"
-msgstr "Andorre"
-
-#. 784
-#: ../navit/country.c:25
-msgid "United Arab Emirates"
-msgstr "Émirats Arabes Unis"
-
-#. 004
-#: ../navit/country.c:26
-msgid "Afghanistan"
-msgstr "Afghanistan"
-
-#. 028
-#: ../navit/country.c:27
-msgid "Antigua and Barbuda"
-msgstr "Antigua et Barbuda"
-
-#. 660
-#: ../navit/country.c:28
-msgid "Anguilla"
-msgstr ""
-
-#. 008
-#: ../navit/country.c:29
-msgid "Albania"
-msgstr "Albanie"
-
-#. 051
-#: ../navit/country.c:30
-msgid "Armenia"
-msgstr "Arménie"
-
-#. 530
-#: ../navit/country.c:31
-msgid "Netherlands Antilles"
-msgstr "Antilles Néérlandaises"
-
-#. 024
-#: ../navit/country.c:32
-msgid "Angola"
-msgstr "Angola"
-
-#. 010
-#: ../navit/country.c:33
-msgid "Antarctica"
-msgstr "Antarctique"
-
-#. 032
-#: ../navit/country.c:34
-msgid "Argentina"
-msgstr "Argentine"
-
-#. 016
-#: ../navit/country.c:35
-msgid "American Samoa"
-msgstr "Samoa américaines"
-
-#. 040
-#: ../navit/country.c:36
-msgid "Austria"
-msgstr "Autriche"
-
-#. 036
-#: ../navit/country.c:37
-msgid "Australia"
-msgstr "Australie"
-
-#. 533
-#: ../navit/country.c:38
-msgid "Aruba"
-msgstr "Aruba"
-
-#. 248
-#: ../navit/country.c:39
-msgid "Aland Islands"
-msgstr "Åland, îles"
-
-#. 031
-#: ../navit/country.c:40
-msgid "Azerbaijan"
-msgstr "Azerbaïdjan"
-
-#. 070
-#: ../navit/country.c:41
-msgid "Bosnia and Herzegovina"
-msgstr "Bosnie Herzégovine"
-
-#. 052
-#: ../navit/country.c:42
-msgid "Barbados"
-msgstr "Barbades"
-
-#. 050
-#: ../navit/country.c:43
-msgid "Bangladesh"
-msgstr "Bengladesh"
-
-#. 056
-#: ../navit/country.c:44
-msgid "Belgium"
-msgstr "Belgique"
-
-#. 854
-#: ../navit/country.c:45
-msgid "Burkina Faso"
-msgstr "Burkina Faso"
-
-#. 100
-#: ../navit/country.c:46
-msgid "Bulgaria"
-msgstr "Bulgarie"
-
-#. 048
-#: ../navit/country.c:47
-msgid "Bahrain"
-msgstr ""
-
-#. 108
-#: ../navit/country.c:48
-msgid "Burundi"
-msgstr "Burundi"
-
-#. 204
-#: ../navit/country.c:49
-msgid "Benin"
-msgstr "Benin"
-
-#. 652
-#: ../navit/country.c:50
-msgid "Saint Barthelemy"
-msgstr "Saint Barthelemy"
-
-#. 060
-#: ../navit/country.c:51
-msgid "Bermuda"
-msgstr "Bermudes"
-
-#. 096
-#: ../navit/country.c:52
-msgid "Brunei Darussalam"
-msgstr ""
-
-#. 068
-#: ../navit/country.c:53
-msgid "Bolivia"
-msgstr "Bolivie"
-
-#. 076
-#: ../navit/country.c:54
-msgid "Brazil"
-msgstr "Brésil"
-
-#. 044
-#: ../navit/country.c:55
-msgid "Bahamas"
-msgstr "Bahamas"
-
-#. 064
-#: ../navit/country.c:56
-msgid "Bhutan"
-msgstr ""
-
-#. 074
-#: ../navit/country.c:57
-msgid "Bouvet Island"
-msgstr "ÃŽles Bouvet"
-
-#. 072
-#: ../navit/country.c:58
-msgid "Botswana"
-msgstr "Botswana"
-
-#. 112
-#: ../navit/country.c:59
-msgid "Belarus"
-msgstr "Biélorussie"
-
-#. 084
-#: ../navit/country.c:60
-msgid "Belize"
-msgstr "Belize"
-
-#. 124
-#: ../navit/country.c:61
-msgid "Canada"
-msgstr "Canada"
-
-#. 166
-#: ../navit/country.c:62
-msgid "Cocos (Keeling) Islands"
-msgstr "Iles Cocos"
-
-#. 180
-#: ../navit/country.c:63
-msgid "Congo, Democratic Republic of the"
-msgstr "Répulique démocratique du Congo"
-
-#. 140
-#: ../navit/country.c:64
-msgid "Central African Republic"
-msgstr "République Centrafricaine"
-
-#. 178
-#: ../navit/country.c:65
-msgid "Congo"
-msgstr "Congo"
-
-#. 756
-#: ../navit/country.c:66
-msgid "Switzerland"
-msgstr "Suisse"
-
-#. 384
-#: ../navit/country.c:67
-msgid "Cote d'Ivoire"
-msgstr "Cote d'Ivoire"
-
-#. 184
-#: ../navit/country.c:68
-msgid "Cook Islands"
-msgstr "ÃŽles Cook"
-
-#. 152
-#: ../navit/country.c:69
-msgid "Chile"
-msgstr "Chili"
-
-#. 120
-#: ../navit/country.c:70
-msgid "Cameroon"
-msgstr "Cameroun"
-
-#. 156
-#: ../navit/country.c:71
-msgid "China"
-msgstr "Chine"
-
-#. 170
-#: ../navit/country.c:72
-msgid "Colombia"
-msgstr "Colombie"
-
-#. 188
-#: ../navit/country.c:73
-msgid "Costa Rica"
-msgstr "Costa Rica"
-
-#. 192
-#: ../navit/country.c:74
-msgid "Cuba"
-msgstr "Cuba"
-
-#. 132
-#: ../navit/country.c:75
-msgid "Cape Verde"
-msgstr "Cap Vert"
-
-#. 162
-#: ../navit/country.c:76
-#, fuzzy
-msgid "Christmas Island"
-msgstr "Christmas, ÃŽle"
-
-#. 196
-#: ../navit/country.c:77
-msgid "Cyprus"
-msgstr "Chypre"
-
-#. 203
-#: ../navit/country.c:78
-msgid "Czech Republic"
-msgstr "République Tchèque"
-
-#. 276
-#: ../navit/country.c:79
-msgid "Germany"
-msgstr "Allemagne"
-
-#. 262
-#: ../navit/country.c:80
-msgid "Djibouti"
-msgstr "Djibouti"
-
-#. 208
-#: ../navit/country.c:81
-msgid "Denmark"
-msgstr "Danemark"
-
-#. 212
-#: ../navit/country.c:82
-msgid "Dominica"
-msgstr "Dominique"
-
-#. 214
-#: ../navit/country.c:83
-msgid "Dominican Republic"
-msgstr "République Dominicaine"
-
-#. 012
-#: ../navit/country.c:84
-msgid "Algeria"
-msgstr "Algérie"
-
-#. 218
-#: ../navit/country.c:85
-msgid "Ecuador"
-msgstr "Equateur"
-
-#. 233
-#: ../navit/country.c:86
-msgid "Estonia"
-msgstr "Estonie"
-
-#. 818
-#: ../navit/country.c:87
-msgid "Egypt"
-msgstr "Égypte"
-
-#. 732
-#: ../navit/country.c:88
-msgid "Western Sahara"
-msgstr "Sahara occidental"
-
-#. 232
-#: ../navit/country.c:89
-msgid "Eritrea"
-msgstr "Erythrée"
-
-#. 724
-#: ../navit/country.c:90
-msgid "Spain"
-msgstr "Espagne"
-
-#. 231
-#: ../navit/country.c:91
-msgid "Ethiopia"
-msgstr "Ethiopie"
-
-#. 246
-#: ../navit/country.c:92
-msgid "Finland"
-msgstr "Finlande"
-
-#. 242
-#: ../navit/country.c:93
-msgid "Fiji"
-msgstr "Fiji"
-
-#. 238
-#: ../navit/country.c:94
-msgid "Falkland Islands (Malvinas)"
-msgstr ""
-
-#. 583
-#: ../navit/country.c:95
-msgid "Micronesia, Federated States of"
-msgstr "Micronésie, États fédérés de"
-
-#. 234
-#: ../navit/country.c:96
-msgid "Faroe Islands"
-msgstr "ÃŽles Feroe"
-
-#. 250
-#: ../navit/country.c:97
-msgid "France"
-msgstr "France"
-
-#. 266
-#: ../navit/country.c:98
-msgid "Gabon"
-msgstr "Gabon"
-
-#. 826
-#: ../navit/country.c:99
-msgid "United Kingdom"
-msgstr "Royaume-Uni"
-
-#. 308
-#: ../navit/country.c:100
-msgid "Grenada"
-msgstr "Grenade"
-
-#. 268
-#: ../navit/country.c:101
-msgid "Georgia"
-msgstr "Géorgie"
-
-#. 254
-#: ../navit/country.c:102
-msgid "French Guiana"
-msgstr "Guyanne française"
-
-#. 831
-#: ../navit/country.c:103
-msgid "Guernsey"
-msgstr "Guernsey"
-
-#. 288
-#: ../navit/country.c:104
-msgid "Ghana"
-msgstr "Ghana"
-
-#. 292
-#: ../navit/country.c:105
-msgid "Gibraltar"
-msgstr "Gibraltar"
-
-#. 304
-#: ../navit/country.c:106
-msgid "Greenland"
-msgstr "Groenland"
-
-#. 270
-#: ../navit/country.c:107
-msgid "Gambia"
-msgstr "Gambie"
-
-#. 324
-#: ../navit/country.c:108
-msgid "Guinea"
-msgstr "Guinée"
-
-#. 312
-#: ../navit/country.c:109
-msgid "Guadeloupe"
-msgstr "Guadeloupe"
-
-#. 226
-#: ../navit/country.c:110
-msgid "Equatorial Guinea"
-msgstr "Guinée équatoriale"
-
-#. 300
-#: ../navit/country.c:111
-msgid "Greece"
-msgstr "Grèce"
-
-#. 239
-#: ../navit/country.c:112
-msgid "South Georgia and the South Sandwich Islands"
-msgstr "Géorgie du Sud et Îles Sandwich du Sud"
-
-#. 320
-#: ../navit/country.c:113
-msgid "Guatemala"
-msgstr "Guatemala"
-
-#. 316
-#: ../navit/country.c:114
-msgid "Guam"
-msgstr "Guam"
-
-#. 624
-#: ../navit/country.c:115
-msgid "Guinea-Bissau"
-msgstr "Guinée-Bissau"
-
-#. 328
-#: ../navit/country.c:116
-msgid "Guyana"
-msgstr "Guyane"
-
-#. 344
-#: ../navit/country.c:117
-msgid "Hong Kong"
-msgstr "Hong-kong"
-
-#. 334
-#: ../navit/country.c:118
-msgid "Heard Island and McDonald Islands"
-msgstr "Heard, ÃŽle et McDonald, ÃŽles"
-
-#. 340
-#: ../navit/country.c:119
-msgid "Honduras"
-msgstr "Honduras"
-
-#. 191
-#: ../navit/country.c:120
-msgid "Croatia"
-msgstr "Croatie"
-
-#. 332
-#: ../navit/country.c:121
-msgid "Haiti"
-msgstr "Haiti"
-
-#. 348
-#: ../navit/country.c:122
-msgid "Hungary"
-msgstr "Hongrie"
-
-#. 360
-#: ../navit/country.c:123
-msgid "Indonesia"
-msgstr "Indonésie"
-
-#. 372
-#: ../navit/country.c:124
-msgid "Ireland"
-msgstr "Irlande"
-
-#. 376
-#: ../navit/country.c:125
-msgid "Israel"
-msgstr "Israël"
-
-#. 833
-#: ../navit/country.c:126
-msgid "Isle of Man"
-msgstr "Ile de Man"
-
-#. 356
-#: ../navit/country.c:127
-msgid "India"
-msgstr "Inde"
-
-#. 086
-#: ../navit/country.c:128
-msgid "British Indian Ocean Territory"
-msgstr "Océan Indien, Territoire britannique de l'"
-
-#. 368
-#: ../navit/country.c:129
-msgid "Iraq"
-msgstr "Irak"
-
-#. 364
-#: ../navit/country.c:130
-msgid "Iran, Islamic Republic of"
-msgstr "Iran, République islamique d'"
-
-#. 352
-#: ../navit/country.c:131
-msgid "Iceland"
-msgstr "Islande"
-
-#. 380
-#: ../navit/country.c:132
-msgid "Italy"
-msgstr "Italie"
-
-#. 832
-#: ../navit/country.c:133
-msgid "Jersey"
-msgstr "Jersey"
-
-#. 388
-#: ../navit/country.c:134
-msgid "Jamaica"
-msgstr "Jamaique"
-
-#. 400
-#: ../navit/country.c:135
-msgid "Jordan"
-msgstr "Jordanie"
-
-#. 392
-#: ../navit/country.c:136
-msgid "Japan"
-msgstr "Japon"
-
-#. 404
-#: ../navit/country.c:137
-msgid "Kenya"
-msgstr "Kenya"
-
-#. 417
-#: ../navit/country.c:138
-msgid "Kyrgyzstan"
-msgstr "Kirghizstan"
-
-#. 116
-#: ../navit/country.c:139
-msgid "Cambodia"
-msgstr "Cambodge"
-
-#. 296
-#: ../navit/country.c:140
-msgid "Kiribati"
-msgstr "Kiribati"
-
-#. 174
-#: ../navit/country.c:141
-#, fuzzy
-msgid "Comoros"
-msgstr "Comores"
-
-#. 659
-#: ../navit/country.c:142
-msgid "Saint Kitts and Nevis"
-msgstr "Saint Kitts et Nevis"
-
-#. 408
-#: ../navit/country.c:143
-msgid "Korea, Democratic People's Republic of"
-msgstr "Corée, République populaire démocratique de"
-
-#. 410
-#: ../navit/country.c:144
-msgid "Korea, Republic of"
-msgstr "Corée, République de"
-
-#. 414
-#: ../navit/country.c:145
-msgid "Kuwait"
-msgstr "Koweït"
-
-#. 136
-#: ../navit/country.c:146
-msgid "Cayman Islands"
-msgstr "ÃŽles Cayman"
-
-#. 398
-#: ../navit/country.c:147
-msgid "Kazakhstan"
-msgstr "Kazakhstan"
-
-#. 418
-#: ../navit/country.c:148
-msgid "Lao People's Democratic Republic"
-msgstr "Laos"
-
-#. 422
-#: ../navit/country.c:149
-msgid "Lebanon"
-msgstr "Liban"
-
-#. 662
-#: ../navit/country.c:150
-msgid "Saint Lucia"
-msgstr "Sainte-Lucie"
-
-#. 438
-#: ../navit/country.c:151
-msgid "Liechtenstein"
-msgstr "Liechtenstein"
-
-#. 144
-#: ../navit/country.c:152
-msgid "Sri Lanka"
-msgstr "Sri Lanka"
-
-#. 430
-#: ../navit/country.c:153
-msgid "Liberia"
-msgstr "Libéria"
-
-#. 426
-#: ../navit/country.c:154
-msgid "Lesotho"
-msgstr "Lesotho"
-
-#. 440
-#: ../navit/country.c:155
-msgid "Lithuania"
-msgstr "Lithuanie"
-
-#. 442
-#: ../navit/country.c:156
-msgid "Luxembourg"
-msgstr "Luxembourg"
-
-#. 428
-#: ../navit/country.c:157
-msgid "Latvia"
-msgstr "Lettonie"
-
-#. 434
-#: ../navit/country.c:158
-msgid "Libyan Arab Jamahiriya"
-msgstr "Libye"
-
-#. 504
-#: ../navit/country.c:159
-msgid "Morocco"
-msgstr "Maroc"
-
-#. 492
-#: ../navit/country.c:160
-msgid "Monaco"
-msgstr "Monaco"
-
-#. 498
-#: ../navit/country.c:161
-msgid "Moldova, Republic of"
-msgstr "Moldova, République de"
-
-#. 499
-#: ../navit/country.c:162
-msgid "Montenegro"
-msgstr "Montenegro"
-
-#. 663
-#: ../navit/country.c:163
-#, fuzzy
-msgid "Saint Martin (French part)"
-msgstr "Saint Martin"
-
-#. 450
-#: ../navit/country.c:164
-msgid "Madagascar"
-msgstr "Madagascar"
-
-#. 584
-#: ../navit/country.c:165
-msgid "Marshall Islands"
-msgstr "ÃŽles Marshall"
-
-#. 807
-#: ../navit/country.c:166
-msgid "Macedonia, the former Yugoslav Republic of"
-msgstr "Macédoine"
-
-#. 466
-#: ../navit/country.c:167
-msgid "Mali"
-msgstr "Mali"
-
-#. 104
-#: ../navit/country.c:168
-msgid "Myanmar"
-msgstr "Myanmar"
-
-#. 496
-#: ../navit/country.c:169
-msgid "Mongolia"
-msgstr "Mongolie"
-
-#. 446
-#: ../navit/country.c:170
-msgid "Macao"
-msgstr "Macao"
-
-#. 580
-#: ../navit/country.c:171
-msgid "Northern Mariana Islands"
-msgstr "ÃŽles Mariannes du Nord"
-
-#. 474
-#: ../navit/country.c:172
-msgid "Martinique"
-msgstr "Martinique"
-
-#. 478
-#: ../navit/country.c:173
-msgid "Mauritania"
-msgstr "Mauritanie"
-
-#. 500
-#: ../navit/country.c:174
-msgid "Montserrat"
-msgstr "Montserrat"
-
-#. 470
-#: ../navit/country.c:175
-msgid "Malta"
-msgstr "Malte"
-
-#. 480
-#: ../navit/country.c:176
-msgid "Mauritius"
-msgstr "Iles Maurice"
-
-#. 462
-#: ../navit/country.c:177
-msgid "Maldives"
-msgstr "Maldives"
-
-#. 454
-#: ../navit/country.c:178
-msgid "Malawi"
-msgstr "Malawi"
-
-#. 484
-#: ../navit/country.c:179
-msgid "Mexico"
-msgstr "Mexique"
-
-#. 458
-#: ../navit/country.c:180
-msgid "Malaysia"
-msgstr "Malaisie"
-
-#. 508
-#: ../navit/country.c:181
-msgid "Mozambique"
-msgstr "Mozambique"
-
-#. 516
-#: ../navit/country.c:182
-msgid "Namibia"
-msgstr "Namibie"
-
-#. 540
-#: ../navit/country.c:183
-msgid "New Caledonia"
-msgstr "Nouvelle Calédonie"
-
-#. 562
-#: ../navit/country.c:184
-msgid "Niger"
-msgstr "Niger"
-
-#. 574
-#: ../navit/country.c:185
-msgid "Norfolk Island"
-msgstr "ÃŽle Norfolk"
-
-#. 566
-#: ../navit/country.c:186
-msgid "Nigeria"
-msgstr "Nigeria"
-
-#. 558
-#: ../navit/country.c:187
-msgid "Nicaragua"
-msgstr "Nicaragua"
-
-#. 528
-#: ../navit/country.c:188
-msgid "Netherlands"
-msgstr "Pays-Bas"
-
-#. 578
-#: ../navit/country.c:189
-msgid "Norway"
-msgstr "Norvège"
-
-#. 524
-#: ../navit/country.c:190
-msgid "Nepal"
-msgstr "Népal"
-
-#. 520
-#: ../navit/country.c:191
-msgid "Nauru"
-msgstr "Nauru"
-
-#. 570
-#: ../navit/country.c:192
-msgid "Niue"
-msgstr "Niue"
-
-#. 554
-#: ../navit/country.c:193
-msgid "New Zealand"
-msgstr "Nouvelle-Zélande"
-
-#. 512
-#: ../navit/country.c:194
-msgid "Oman"
-msgstr "Oman"
-
-#. 591
-#: ../navit/country.c:195
-msgid "Panama"
-msgstr "Panama"
-
-#. 604
-#: ../navit/country.c:196
-msgid "Peru"
-msgstr "Pérou"
-
-#. 258
-#: ../navit/country.c:197
-msgid "French Polynesia"
-msgstr "Polynésie Française"
-
-#. 598
-#: ../navit/country.c:198
-msgid "Papua New Guinea"
-msgstr "Papouasie-Nouvelle-Guinée"
-
-#. 608
-#: ../navit/country.c:199
-msgid "Philippines"
-msgstr "Philippines"
-
-#. 586
-#: ../navit/country.c:200
-msgid "Pakistan"
-msgstr "Pakistan"
-
-#. 616
-#: ../navit/country.c:201
-msgid "Poland"
-msgstr "Pologne"
-
-#. 666
-#: ../navit/country.c:202
-msgid "Saint Pierre and Miquelon"
-msgstr "Saint-Pierre-et-Miquelon"
-
-#. 612
-#: ../navit/country.c:203
-msgid "Pitcairn"
-msgstr "ÃŽles Pitcairn"
-
-#. 630
-#: ../navit/country.c:204
-msgid "Puerto Rico"
-msgstr "Puerto Rico"
-
-#. 275
-#: ../navit/country.c:205
-msgid "Palestinian Territory, Occupied"
-msgstr "Palestine"
-
-#. 620
-#: ../navit/country.c:206
-msgid "Portugal"
-msgstr "Portugal"
-
-#. 585
-#: ../navit/country.c:207
-msgid "Palau"
-msgstr "Palau"
-
-#. 600
-#: ../navit/country.c:208
-msgid "Paraguay"
-msgstr "Paraguay"
-
-#. 634
-#: ../navit/country.c:209
-msgid "Qatar"
-msgstr "Qatar"
-
-#. 638
-#: ../navit/country.c:210
-msgid "Reunion"
-msgstr "Réunion"
-
-#. 642
-#: ../navit/country.c:211
-msgid "Romania"
-msgstr "Roumanie"
-
-#. 688
-#: ../navit/country.c:212
-msgid "Serbia"
-msgstr "Serbie"
-
-#. 643
-#: ../navit/country.c:213
-msgid "Russian Federation"
-msgstr "Russie"
-
-#. 646
-#: ../navit/country.c:214
-msgid "Rwanda"
-msgstr "Rwanda"
-
-#. 682
-#: ../navit/country.c:215
-msgid "Saudi Arabia"
-msgstr "Arabie Saoudite"
-
-#. 090
-#: ../navit/country.c:216
-msgid "Solomon Islands"
-msgstr "ÃŽles Solomon"
-
-#. 690
-#: ../navit/country.c:217
-msgid "Seychelles"
-msgstr "Seychelles"
-
-#. 736
-#: ../navit/country.c:218
-msgid "Sudan"
-msgstr "Sudan"
-
-#. 752
-#: ../navit/country.c:219
-msgid "Sweden"
-msgstr "Suède"
-
-#. 702
-#: ../navit/country.c:220
-msgid "Singapore"
-msgstr "Singapour"
-
-#. 654
-#: ../navit/country.c:221
-msgid "Saint Helena"
-msgstr "Sainte Hélène"
-
-#. 705
-#: ../navit/country.c:222
-msgid "Slovenia"
-msgstr "Slovènie"
-
-#. 744
-#: ../navit/country.c:223
-msgid "Svalbard and Jan Mayen"
-msgstr "Svalbard et île Jan Mayen"
-
-#. 703
-#: ../navit/country.c:224
-msgid "Slovakia"
-msgstr "Slovaquie"
-
-#. 694
-#: ../navit/country.c:225
-msgid "Sierra Leone"
-msgstr "Sierra Leone"
-
-#. 674
-#: ../navit/country.c:226
-msgid "San Marino"
-msgstr "Saint-Marin"
-
-#. 686
-#: ../navit/country.c:227
-msgid "Senegal"
-msgstr "Sénégal"
-
-#. 706
-#: ../navit/country.c:228
-msgid "Somalia"
-msgstr "Somalie"
-
-#. 740
-#: ../navit/country.c:229
-#, fuzzy
-msgid "Suriname"
-msgstr "Suriname"
-
-#. 678
-#: ../navit/country.c:230
-msgid "Sao Tome and Principe"
-msgstr "Sao Tomé-et-Principe"
-
-#. 222
-#: ../navit/country.c:231
-msgid "El Salvador"
-msgstr "Salvador"
-
-#. 760
-#: ../navit/country.c:232
-#, fuzzy
-msgid "Syrian Arab Republic"
-msgstr "Syrie"
-
-#. 748
-#: ../navit/country.c:233
-#, fuzzy
-msgid "Swaziland"
-msgstr "Swaziland"
-
-#. 796
-#: ../navit/country.c:234
-msgid "Turks and Caicos Islands"
-msgstr "Îles Turques et Caïques"
-
-#. 148
-#: ../navit/country.c:235
-msgid "Chad"
-msgstr "Tchad"
-
-#. 260
-#: ../navit/country.c:236
-#, fuzzy
-msgid "French Southern Territories"
-msgstr "Terres australes françaises"
-
-#. 768
-#: ../navit/country.c:237
-msgid "Togo"
-msgstr "Togo"
-
-#. 764
-#: ../navit/country.c:238
-msgid "Thailand"
-msgstr "Thailande"
-
-#. 762
-#: ../navit/country.c:239
-#, fuzzy
-msgid "Tajikistan"
-msgstr "Tadjikistan"
-
-#. 772
-#: ../navit/country.c:240
-msgid "Tokelau"
-msgstr "Tokelau"
-
-#. 626
-#: ../navit/country.c:241
-msgid "Timor-Leste"
-msgstr "Timor-Leste"
-
-#. 795
-#: ../navit/country.c:242
-msgid "Turkmenistan"
-msgstr "Turkmenistan"
-
-#. 788
-#: ../navit/country.c:243
-msgid "Tunisia"
-msgstr "Tunisie"
-
-#. 776
-#: ../navit/country.c:244
-msgid "Tonga"
-msgstr "Tonga"
-
-#. 792
-#: ../navit/country.c:245
-msgid "Turkey"
-msgstr "Turquie"
-
-#. 780
-#: ../navit/country.c:246
-msgid "Trinidad and Tobago"
-msgstr "Trinité et Tobago"
-
-#. 798
-#: ../navit/country.c:247
-msgid "Tuvalu"
-msgstr "Tuvalu"
-
-#. 158
-#: ../navit/country.c:248
-msgid "Taiwan, Province of China"
-msgstr "Taiwan, province de la Chine"
-
-#. 834
-#: ../navit/country.c:249
-msgid "Tanzania, United Republic of"
-msgstr "Tanzanie, République unie de"
-
-#. 804
-#: ../navit/country.c:250
-msgid "Ukraine"
-msgstr "Ukraine"
-
-#. 800
-#: ../navit/country.c:251
-msgid "Uganda"
-msgstr "Uganda"
-
-#. 581
-#: ../navit/country.c:252
-msgid "United States Minor Outlying Islands"
-msgstr "Îles périphériques mineures des Etats-Unis"
-
-#. 840
-#: ../navit/country.c:253
-msgid "United States"
-msgstr "États-Unis"
-
-#. 858
-#: ../navit/country.c:254
-msgid "Uruguay"
-msgstr "Uruguay"
-
-#. 860
-#: ../navit/country.c:255
-msgid "Uzbekistan"
-msgstr "Ouzbékistan"
-
-#. 336
-#: ../navit/country.c:256
-msgid "Holy See (Vatican City State)"
-msgstr "Saint-Siège (état de la cité du Vatican)"
-
-#. 670
-#: ../navit/country.c:257
-msgid "Saint Vincent and the Grenadines"
-msgstr "Saint-Vincent-et-les Grenadines"
-
-#. 862
-#: ../navit/country.c:258
-msgid "Venezuela"
-msgstr "Venezuela"
-
-#. 092
-#: ../navit/country.c:259
-msgid "Virgin Islands, British"
-msgstr "ÃŽles Vierges britanniques"
-
-#. 850
-#: ../navit/country.c:260
-msgid "Virgin Islands, U.S."
-msgstr "Îles Vierges des États-Unis"
-
-#. 704
-#: ../navit/country.c:261
-msgid "Viet Nam"
-msgstr "Viêt Nam"
-
-#. 548
-#: ../navit/country.c:262
-#, fuzzy
-msgid "Vanuatu"
-msgstr "Vanuatu"
-
-#. 876
-#: ../navit/country.c:263
-msgid "Wallis and Futuna"
-msgstr "Wallis et Futuna"
-
-#. 882
-#: ../navit/country.c:264
-msgid "Samoa"
-msgstr "Samoa"
-
-#. 887
-#: ../navit/country.c:265
-msgid "Yemen"
-msgstr "Yemen"
-
-#. 175
-#: ../navit/country.c:266
-msgid "Mayotte"
-msgstr "Mayotte"
-
-#. 710
-#: ../navit/country.c:267
-msgid "South Africa"
-msgstr "Afrique du Sud"
-
-#. 894
-#: ../navit/country.c:268
-msgid "Zambia"
-msgstr "Zambie"
-
-#. 716
-#: ../navit/country.c:269
-msgid "Zimbabwe"
-msgstr "Zimbabwe"
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:98
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-msgid "Car"
-msgstr "Voiture"
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso2"
-msgstr "iso2"
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso3"
-msgstr "iso3"
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:403
-msgid "Country"
-msgstr "Pays"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "Postal"
-msgstr "Code postal"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "Town"
-msgstr "Ville"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "District"
-msgstr "Quartier"
-
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-#: ../navit/gui/gtk/destination.c:412
-msgid "Street"
-msgstr "Rue"
-
-#: ../navit/gui/gtk/destination.c:100 ../navit/gui/gtk/destination.c:414
-msgid "Number"
-msgstr "Numéro"
-
-#: ../navit/gui/gtk/destination.c:398
-msgid "Enter Destination"
-msgstr "Entrez une destination"
-
-#: ../navit/gui/gtk/destination.c:405
-msgid "Zip Code"
-msgstr "Code postal"
-
-#: ../navit/gui/gtk/destination.c:407
-msgid "City"
-msgstr "Ville"
-
-#: ../navit/gui/gtk/destination.c:409
-msgid "District/Township"
-msgstr "Canton"
-
-#: ../navit/gui/gtk/destination.c:437 ../navit/gui/gtk/gui_gtk_action.c:153
-msgid "Map"
-msgstr "Carte"
-
-#: ../navit/gui/gtk/destination.c:438
-msgid "Bookmark"
-msgstr "Signet"
-
-#: ../navit/gui/gtk/destination.c:439 ../navit/gui/gtk/gui_gtk_action.c:166
-msgid "Destination"
-msgstr "Destination"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:149
-msgid "Display"
-msgstr "_Affichage"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:150
-msgid "Route"
-msgstr "_Route"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:154
-msgid "Layout"
-msgstr "Calques"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:155
-msgid "Projection"
-msgstr "Projection"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:156
-msgid "Vehicle"
-msgstr "Véhicule"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:157
-msgid "ZoomOut"
-msgstr "Zoom arrière"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:158
-msgid "ZoomIn"
-msgstr "Zoom avant"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:159
-msgid "Refresh"
-msgstr "Rafraîchir"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:162 ../navit/gui/gtk/gui_gtk_action.c:164
-msgid "Info"
-msgstr "Info"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:167
-msgid "Clear"
-msgstr "Effacer"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:168
-msgid "Test"
-msgstr "Test"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:169
-msgid "_Quit"
-msgstr "_Quitter"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:176
-msgid "Cursor"
-msgstr "Afficher le curseur"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:177
-msgid "Tracking"
-msgstr "Coller le curseur à la route"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:178
-msgid "Orientation"
-msgstr "Conserver l'orientation vers le Nord"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:180 ../navit/gui/gtk/gui_gtk_action.c:182
-msgid "Fullscreen"
-msgstr "Plein écran"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:190
-msgid "Data"
-msgstr "Données"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "N"
-msgstr "N"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NE"
-msgstr "NE"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "E"
-msgstr "E"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SE"
-msgstr "SE"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "S"
-msgstr "S"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SW"
-msgstr "SW"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "W"
-msgstr "W"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NW"
-msgstr "NW"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:103
-#, c-format
-msgid "Route %4.0fkm %02d:%02d ETA"
-msgstr "Trajet restant %4.0f km heure d'arrivée estimée %02d:%02d"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:148
-msgid "Route 0000km 0+00:00 ETA"
-msgstr "Trajet 0000 km temps estimé 0+00:00"
diff --git a/po/it.po b/po/it.po
deleted file mode 100644
index d3ff7cf0..00000000
--- a/po/it.po
+++ /dev/null
@@ -1,1688 +0,0 @@
-# translation of it.po to Italiano
-# Italian translations for navit
-# Copyright (C) 2007, 2008
-# This file is distributed under the same license as the navit package.
-# Andrea GHENSI <andrea.ghensi@gmail.com> 2007
-#
-# Niccolo Rigacci <niccolo@rigacci.org>, 2008.
-msgid ""
-msgstr ""
-"Project-Id-Version: Navit 0.1.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-05-26 17:12+0200\n"
-"PO-Revision-Date: 2008-05-29 14:32+0000\n"
-"Last-Translator: Niccolo Rigacci <niccolo@rigacci.org>\n"
-"Language-Team: Italiano\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Launchpad-Export-Date: 2008-05-30 21:28+0000\n"
-"X-Generator: Launchpad (build Unknown)\n"
-
-#~ msgid "Turn %1$s%2$s %3$s"
-#~ msgstr "%3$s svoltare %1$sa %2$s"
-
-#~ msgid "Turn %1$s%2$s %3$s onto %4$s"
-#~ msgstr "%3$s svoltare %1$sa %2$s su %4$s"
-
-#~ msgid "Turn %1$s%2$s %3$s into %4$s"
-#~ msgstr "%3$s svoltare %1$sa %2$s in %4$s"
-
-#: ../navit/main.c:111
-#, c-format
-msgid ""
-"navit usage:\n"
-"navit [options] [configfile]\n"
-"\t-c <file>: use <file> as config file\n"
-"\t-d <n>: set the debug output level to <n>. (TODO)\n"
-"\t-h: print this usage info and exit.\n"
-"\t-v: Print the version and exit.\n"
-msgstr ""
-"Uso: navit [OPZIONE...] [FILE]\n"
-"\t-c <file>: usa <file> come file di configurazione.\n"
-"\t-d <n>: imposta il livello delle informazioni di debug a <n>. (TODO)\n"
-"\t-h: mostra questo aiuto.\n"
-"\t-v: mostra la versione di Navit ed esce.\n"
-
-#: ../navit/main.c:131
-#, c-format
-msgid "Running from source directory\n"
-msgstr "Esecuzione dalla cartella di compilazione\n"
-
-#: ../navit/main.c:147
-#, c-format
-msgid "setting '%s' to '%s'\n"
-msgstr "impostazione di '%s' a '%s'\n"
-
-#. We have not found an existing config file from all possibilities
-#: ../navit/main.c:248
-#, c-format
-msgid "No config file navit.xml, navit.xml.local found\n"
-msgstr "File di configurazione navit.xml o navit.xml.local non trovato\n"
-
-#: ../navit/main.c:255
-#, c-format
-msgid "Error parsing '%s': %s\n"
-msgstr "Errore di sintassi in '%s': %s\n"
-
-#: ../navit/main.c:258
-#, c-format
-msgid "Using '%s'\n"
-msgstr "Lettura di '%s'\n"
-
-#: ../navit/main.c:261
-#, c-format
-msgid "No instance has been created, exiting\n"
-msgstr "Impossbile creare un'istanza, uscita dal programma\n"
-
-#: ../navit/navigation.c:171
-#, c-format
-msgid "%d m"
-msgstr "%d m"
-
-#: ../navit/navigation.c:173
-#, c-format
-msgid "in %d m"
-msgstr "fra %d m"
-
-#: ../navit/navigation.c:177
-#, c-format
-msgid "%d meters"
-msgstr "%d metri"
-
-#: ../navit/navigation.c:179
-#, c-format
-msgid "in %d meters"
-msgstr "fra %d metri"
-
-#: ../navit/navigation.c:185
-#, c-format
-msgid "%d.%d kilometer"
-msgstr "%d,%d chilometri"
-
-#: ../navit/navigation.c:187
-#, c-format
-msgid "in %d.%d kilometers"
-msgstr "fra %d,%d chilometri"
-
-#: ../navit/navigation.c:191
-#, c-format
-msgid "one kilometer"
-msgid_plural "%d kilometers"
-msgstr[0] "un chilometro"
-msgstr[1] "%d chilometri"
-
-#: ../navit/navigation.c:193
-#, c-format
-msgid "in one kilometer"
-msgid_plural "in %d kilometers"
-msgstr[0] "fra un chilometro"
-msgstr[1] "fra %d chilometri"
-
-#: ../navit/navigation.c:447
-msgid "exit"
-msgstr "uscita"
-
-#: ../navit/navigation.c:449
-msgid "ramp"
-msgstr "rampa"
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name
-#: ../navit/navigation.c:479
-#, c-format
-msgid "%sinto the street %s%s%s"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Male form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:483
-#, c-format
-msgid "%sinto the %s%s%s|male form"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Female form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:487
-#, c-format
-msgid "%sinto the %s%s%s|female form"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Neutral form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:491
-#, c-format
-msgid "%sinto the %s%s%s|neutral form"
-msgstr ""
-
-#: ../navit/navigation.c:497
-#, c-format
-msgid "into the %s"
-msgstr ""
-
-#: ../navit/navigation.c:518
-msgid "right"
-msgstr "destra"
-
-#: ../navit/navigation.c:525
-msgid "left"
-msgstr "sinistra"
-
-#: ../navit/navigation.c:529
-msgid "easily "
-msgstr "leggermente "
-
-#: ../navit/navigation.c:533
-msgid "strongly "
-msgstr "decisamente "
-
-#: ../navit/navigation.c:536
-msgid "unknown "
-msgstr "facendo quasi inversione "
-
-#: ../navit/navigation.c:542
-msgid "When possible, please turn around"
-msgstr "Appena possibile, invertire il senso di marcia"
-
-#: ../navit/navigation.c:549
-#, c-format
-msgid "Follow the road for the next %s"
-msgstr "Seguire la strada per i prossimi %s"
-
-#: ../navit/navigation.c:553
-msgid "soon"
-msgstr "tra poco"
-
-#: ../navit/navigation.c:559
-msgid "now"
-msgstr "adesso"
-
-#: ../navit/navigation.c:562
-msgid "error"
-msgstr "errore"
-
-#. TRANSLATORS: The first argument is strength, the second direction, the third distance and the fourth destination Example: 'Turn 'slightly' 'left' in '100 m' 'onto baker street'
-#: ../navit/navigation.c:591
-#, c-format
-msgid "Turn %1$s%2$s %3$s%4$s"
-msgstr ""
-
-#: ../navit/navigation.c:594
-#, c-format
-msgid "You have reached your destination %s"
-msgstr "Destinazione raggiunta %s"
-
-#: ../navit/navit.c:664 ../navit/gui/gtk/gui_gtk_action.c:151
-msgid "Former Destinations"
-msgstr "Destinazioni precedenti"
-
-#: ../navit/navit.c:674 ../navit/gui/gtk/gui_gtk_action.c:152
-msgid "Bookmarks"
-msgstr "Segnalibri"
-
-#: ../navit/navit.c:764
-msgid "Command"
-msgstr "Indicazione"
-
-#: ../navit/navit.c:769
-msgid "Length"
-msgstr "Distanza"
-
-#: ../navit/navit.c:773 ../navit/navit.c:798
-msgid "km"
-msgstr "km"
-
-#: ../navit/navit.c:777 ../navit/navit.c:802
-msgid "m"
-msgstr "m"
-
-#: ../navit/navit.c:783
-msgid "Time"
-msgstr "Tempo"
-
-#: ../navit/navit.c:795
-msgid "Destination Length"
-msgstr "Distanza all'arrivo"
-
-#: ../navit/navit.c:808
-msgid "Destination Time"
-msgstr "Tempo all'arrivo"
-
-#: ../navit/navit.c:837 ../navit/gui/gtk/gui_gtk_action.c:160
-msgid "Roadbook"
-msgstr "Quaderno di viaggio"
-
-#: ../navit/popup.c:200 ../navit/popup.c:254
-msgid "Set as position"
-msgstr "Imposta come posizione"
-
-#: ../navit/popup.c:201 ../navit/popup.c:255
-msgid "Set as destination"
-msgstr "Imposta come destinazione"
-
-#: ../navit/popup.c:202 ../navit/popup.c:256
-msgid "Add as bookmark"
-msgstr "Aggiungi come segnalibro"
-
-#: ../navit/popup.c:244
-#, c-format
-msgid "Point 0x%x 0x%x"
-msgstr "Punto 0x%x, 0x%x"
-
-#: ../navit/popup.c:245
-#, c-format
-msgid "Screen coord : %d %d"
-msgstr "Coordinate schermo: %d, %d"
-
-#. 020
-#: ../navit/country.c:24
-msgid "Andorra"
-msgstr "Andorra"
-
-#. 784
-#: ../navit/country.c:25
-msgid "United Arab Emirates"
-msgstr "Emirati Arabi Uniti"
-
-#. 004
-#: ../navit/country.c:26
-msgid "Afghanistan"
-msgstr "Afghanistan"
-
-#. 028
-#: ../navit/country.c:27
-msgid "Antigua and Barbuda"
-msgstr "Antigua e Barbuda"
-
-#. 660
-#: ../navit/country.c:28
-msgid "Anguilla"
-msgstr "Anguilla"
-
-#. 008
-#: ../navit/country.c:29
-msgid "Albania"
-msgstr "Albania"
-
-#. 051
-#: ../navit/country.c:30
-msgid "Armenia"
-msgstr "Armenia"
-
-#. 530
-#: ../navit/country.c:31
-msgid "Netherlands Antilles"
-msgstr "Antille olandesi"
-
-#. 024
-#: ../navit/country.c:32
-msgid "Angola"
-msgstr "Angola"
-
-#. 010
-#: ../navit/country.c:33
-msgid "Antarctica"
-msgstr "Antartide"
-
-#. 032
-#: ../navit/country.c:34
-msgid "Argentina"
-msgstr "Argentina"
-
-#. 016
-#: ../navit/country.c:35
-msgid "American Samoa"
-msgstr "Samoa Americane"
-
-#. 040
-#: ../navit/country.c:36
-msgid "Austria"
-msgstr "Austria"
-
-#. 036
-#: ../navit/country.c:37
-msgid "Australia"
-msgstr "Australia"
-
-#. 533
-#: ../navit/country.c:38
-msgid "Aruba"
-msgstr "Aruba"
-
-#. 248
-#: ../navit/country.c:39
-msgid "Aland Islands"
-msgstr "Isole Ã…land"
-
-#. 031
-#: ../navit/country.c:40
-msgid "Azerbaijan"
-msgstr "Azerbaigian"
-
-#. 070
-#: ../navit/country.c:41
-msgid "Bosnia and Herzegovina"
-msgstr "Bosnia - Herzegovina"
-
-#. 052
-#: ../navit/country.c:42
-msgid "Barbados"
-msgstr "Barbados"
-
-#. 050
-#: ../navit/country.c:43
-msgid "Bangladesh"
-msgstr "Bangladesh"
-
-#. 056
-#: ../navit/country.c:44
-msgid "Belgium"
-msgstr "Belgio"
-
-#. 854
-#: ../navit/country.c:45
-msgid "Burkina Faso"
-msgstr "Burkina Faso"
-
-#. 100
-#: ../navit/country.c:46
-msgid "Bulgaria"
-msgstr "Bulgaria"
-
-#. 048
-#: ../navit/country.c:47
-msgid "Bahrain"
-msgstr "Bahrain"
-
-#. 108
-#: ../navit/country.c:48
-msgid "Burundi"
-msgstr "Burundi"
-
-#. 204
-#: ../navit/country.c:49
-msgid "Benin"
-msgstr "Benin"
-
-#. 652
-#: ../navit/country.c:50
-msgid "Saint Barthelemy"
-msgstr "Saint-Barthélemy"
-
-#. 060
-#: ../navit/country.c:51
-msgid "Bermuda"
-msgstr "Bermuda"
-
-#. 096
-#: ../navit/country.c:52
-msgid "Brunei Darussalam"
-msgstr "Brunei"
-
-#. 068
-#: ../navit/country.c:53
-msgid "Bolivia"
-msgstr "Bolivia"
-
-#. 076
-#: ../navit/country.c:54
-msgid "Brazil"
-msgstr "Brasile"
-
-#. 044
-#: ../navit/country.c:55
-msgid "Bahamas"
-msgstr "Bahamas"
-
-#. 064
-#: ../navit/country.c:56
-msgid "Bhutan"
-msgstr "Bhutan"
-
-#. 074
-#: ../navit/country.c:57
-msgid "Bouvet Island"
-msgstr "Isola Bouvet"
-
-#. 072
-#: ../navit/country.c:58
-msgid "Botswana"
-msgstr "Botswana"
-
-#. 112
-#: ../navit/country.c:59
-msgid "Belarus"
-msgstr "Bielorussia"
-
-#. 084
-#: ../navit/country.c:60
-msgid "Belize"
-msgstr "Belize"
-
-#. 124
-#: ../navit/country.c:61
-msgid "Canada"
-msgstr "Canada"
-
-#. 166
-#: ../navit/country.c:62
-msgid "Cocos (Keeling) Islands"
-msgstr "Isole Cocos"
-
-#. 180
-#: ../navit/country.c:63
-msgid "Congo, Democratic Republic of the"
-msgstr "Congo, Repubblica Democratica del"
-
-#. 140
-#: ../navit/country.c:64
-msgid "Central African Republic"
-msgstr "Repubblica Centrafricana"
-
-#. 178
-#: ../navit/country.c:65
-msgid "Congo"
-msgstr "Congo"
-
-#. 756
-#: ../navit/country.c:66
-msgid "Switzerland"
-msgstr "Svizzera"
-
-#. 384
-#: ../navit/country.c:67
-msgid "Cote d'Ivoire"
-msgstr "Costa d'Avorio"
-
-#. 184
-#: ../navit/country.c:68
-msgid "Cook Islands"
-msgstr "Isole Cook"
-
-#. 152
-#: ../navit/country.c:69
-msgid "Chile"
-msgstr "Cile"
-
-#. 120
-#: ../navit/country.c:70
-msgid "Cameroon"
-msgstr "Camerun"
-
-#. 156
-#: ../navit/country.c:71
-msgid "China"
-msgstr "Cina"
-
-#. 170
-#: ../navit/country.c:72
-msgid "Colombia"
-msgstr "Colombia"
-
-#. 188
-#: ../navit/country.c:73
-msgid "Costa Rica"
-msgstr "Costa Rica"
-
-#. 192
-#: ../navit/country.c:74
-msgid "Cuba"
-msgstr "Cuba"
-
-#. 132
-#: ../navit/country.c:75
-msgid "Cape Verde"
-msgstr "Capo Verde"
-
-#. 162
-#: ../navit/country.c:76
-msgid "Christmas Island"
-msgstr "Isola di Natale"
-
-#. 196
-#: ../navit/country.c:77
-msgid "Cyprus"
-msgstr "Cipro"
-
-#. 203
-#: ../navit/country.c:78
-msgid "Czech Republic"
-msgstr "Repubblica Ceca"
-
-#. 276
-#: ../navit/country.c:79
-msgid "Germany"
-msgstr "Germania"
-
-#. 262
-#: ../navit/country.c:80
-msgid "Djibouti"
-msgstr "Gibuti"
-
-#. 208
-#: ../navit/country.c:81
-msgid "Denmark"
-msgstr "Danimarca"
-
-#. 212
-#: ../navit/country.c:82
-msgid "Dominica"
-msgstr "Dominica"
-
-#. 214
-#: ../navit/country.c:83
-msgid "Dominican Republic"
-msgstr "Repubblica Dominicana"
-
-#. 012
-#: ../navit/country.c:84
-msgid "Algeria"
-msgstr "Algeria"
-
-#. 218
-#: ../navit/country.c:85
-msgid "Ecuador"
-msgstr "Ecuador"
-
-#. 233
-#: ../navit/country.c:86
-msgid "Estonia"
-msgstr "Estonia"
-
-#. 818
-#: ../navit/country.c:87
-msgid "Egypt"
-msgstr "Egitto"
-
-#. 732
-#: ../navit/country.c:88
-msgid "Western Sahara"
-msgstr "Sahara Occidentale"
-
-#. 232
-#: ../navit/country.c:89
-msgid "Eritrea"
-msgstr "Eritrea"
-
-#. 724
-#: ../navit/country.c:90
-msgid "Spain"
-msgstr "Spagna"
-
-#. 231
-#: ../navit/country.c:91
-msgid "Ethiopia"
-msgstr "Etiopia"
-
-#. 246
-#: ../navit/country.c:92
-msgid "Finland"
-msgstr "Finlandia"
-
-#. 242
-#: ../navit/country.c:93
-msgid "Fiji"
-msgstr "Figi"
-
-#. 238
-#: ../navit/country.c:94
-msgid "Falkland Islands (Malvinas)"
-msgstr "Isole Falkland (Malvinas)"
-
-#. 583
-#: ../navit/country.c:95
-msgid "Micronesia, Federated States of"
-msgstr "Stati Federati di Micronesia"
-
-#. 234
-#: ../navit/country.c:96
-msgid "Faroe Islands"
-msgstr "Isole Fær Øer"
-
-#. 250
-#: ../navit/country.c:97
-msgid "France"
-msgstr "Francia"
-
-#. 266
-#: ../navit/country.c:98
-msgid "Gabon"
-msgstr "Gabon"
-
-#. 826
-#: ../navit/country.c:99
-msgid "United Kingdom"
-msgstr "Regno Unito"
-
-#. 308
-#: ../navit/country.c:100
-msgid "Grenada"
-msgstr "Grenada"
-
-#. 268
-#: ../navit/country.c:101
-msgid "Georgia"
-msgstr "Georgia"
-
-#. 254
-#: ../navit/country.c:102
-msgid "French Guiana"
-msgstr "Guyana Francese"
-
-#. 831
-#: ../navit/country.c:103
-msgid "Guernsey"
-msgstr "Guernsey"
-
-#. 288
-#: ../navit/country.c:104
-msgid "Ghana"
-msgstr "Ghana"
-
-#. 292
-#: ../navit/country.c:105
-msgid "Gibraltar"
-msgstr "Gibilterra"
-
-#. 304
-#: ../navit/country.c:106
-msgid "Greenland"
-msgstr "Groenlandia"
-
-#. 270
-#: ../navit/country.c:107
-msgid "Gambia"
-msgstr "Gambia"
-
-#. 324
-#: ../navit/country.c:108
-msgid "Guinea"
-msgstr "Guinea"
-
-#. 312
-#: ../navit/country.c:109
-msgid "Guadeloupe"
-msgstr "Guadalupa"
-
-#. 226
-#: ../navit/country.c:110
-msgid "Equatorial Guinea"
-msgstr "Guinea Equatoriale"
-
-#. 300
-#: ../navit/country.c:111
-msgid "Greece"
-msgstr "Grecia"
-
-#. 239
-#: ../navit/country.c:112
-msgid "South Georgia and the South Sandwich Islands"
-msgstr "Georgia del Sud e Isole delle Sandwich meridionali"
-
-#. 320
-#: ../navit/country.c:113
-msgid "Guatemala"
-msgstr "Guatemala"
-
-#. 316
-#: ../navit/country.c:114
-msgid "Guam"
-msgstr "Guam"
-
-#. 624
-#: ../navit/country.c:115
-msgid "Guinea-Bissau"
-msgstr "Guinea-Bissau"
-
-#. 328
-#: ../navit/country.c:116
-msgid "Guyana"
-msgstr "Guyana"
-
-#. 344
-#: ../navit/country.c:117
-msgid "Hong Kong"
-msgstr "Hong Kong"
-
-#. 334
-#: ../navit/country.c:118
-msgid "Heard Island and McDonald Islands"
-msgstr "Isole Heard e McDonald"
-
-#. 340
-#: ../navit/country.c:119
-msgid "Honduras"
-msgstr "Honduras"
-
-#. 191
-#: ../navit/country.c:120
-msgid "Croatia"
-msgstr "Croazia"
-
-#. 332
-#: ../navit/country.c:121
-msgid "Haiti"
-msgstr "Haiti"
-
-#. 348
-#: ../navit/country.c:122
-msgid "Hungary"
-msgstr "Ungheria"
-
-#. 360
-#: ../navit/country.c:123
-msgid "Indonesia"
-msgstr "Indonesia"
-
-#. 372
-#: ../navit/country.c:124
-msgid "Ireland"
-msgstr "Irlanda"
-
-#. 376
-#: ../navit/country.c:125
-msgid "Israel"
-msgstr "Israele"
-
-#. 833
-#: ../navit/country.c:126
-msgid "Isle of Man"
-msgstr "Isola di Man"
-
-#. 356
-#: ../navit/country.c:127
-msgid "India"
-msgstr "India"
-
-#. 086
-#: ../navit/country.c:128
-msgid "British Indian Ocean Territory"
-msgstr "Territorio Britannico dell'Oceano Indiano"
-
-#. 368
-#: ../navit/country.c:129
-msgid "Iraq"
-msgstr "Iraq"
-
-#. 364
-#: ../navit/country.c:130
-msgid "Iran, Islamic Republic of"
-msgstr "Iran, Repubblica Islamica dell'"
-
-#. 352
-#: ../navit/country.c:131
-msgid "Iceland"
-msgstr "Islanda"
-
-#. 380
-#: ../navit/country.c:132
-msgid "Italy"
-msgstr "Italia"
-
-#. 832
-#: ../navit/country.c:133
-msgid "Jersey"
-msgstr "Jersey"
-
-#. 388
-#: ../navit/country.c:134
-msgid "Jamaica"
-msgstr "Giamaica"
-
-#. 400
-#: ../navit/country.c:135
-msgid "Jordan"
-msgstr "Giordania"
-
-#. 392
-#: ../navit/country.c:136
-msgid "Japan"
-msgstr "Giappone"
-
-#. 404
-#: ../navit/country.c:137
-msgid "Kenya"
-msgstr "Kenya"
-
-#. 417
-#: ../navit/country.c:138
-msgid "Kyrgyzstan"
-msgstr "Kirghizistan"
-
-#. 116
-#: ../navit/country.c:139
-msgid "Cambodia"
-msgstr "Cambogia"
-
-#. 296
-#: ../navit/country.c:140
-msgid "Kiribati"
-msgstr "Kiribati"
-
-#. 174
-#: ../navit/country.c:141
-msgid "Comoros"
-msgstr "Comore"
-
-#. 659
-#: ../navit/country.c:142
-msgid "Saint Kitts and Nevis"
-msgstr "Saint Kitts e Nevis"
-
-#. 408
-#: ../navit/country.c:143
-msgid "Korea, Democratic People's Republic of"
-msgstr "Corea, Repubblica Democratica Popolare di"
-
-#. 410
-#: ../navit/country.c:144
-msgid "Korea, Republic of"
-msgstr "Corea, Repubblica di"
-
-#. 414
-#: ../navit/country.c:145
-msgid "Kuwait"
-msgstr "Kuwait"
-
-#. 136
-#: ../navit/country.c:146
-msgid "Cayman Islands"
-msgstr "Isole Cayman"
-
-#. 398
-#: ../navit/country.c:147
-msgid "Kazakhstan"
-msgstr "Kazakistan"
-
-#. 418
-#: ../navit/country.c:148
-msgid "Lao People's Democratic Republic"
-msgstr "Laos, Repubblica popolare democratica del"
-
-#. 422
-#: ../navit/country.c:149
-msgid "Lebanon"
-msgstr "Libano"
-
-#. 662
-#: ../navit/country.c:150
-msgid "Saint Lucia"
-msgstr "Santa Lucia"
-
-#. 438
-#: ../navit/country.c:151
-msgid "Liechtenstein"
-msgstr "Liechtenstein"
-
-#. 144
-#: ../navit/country.c:152
-msgid "Sri Lanka"
-msgstr "Sri Lanka"
-
-#. 430
-#: ../navit/country.c:153
-msgid "Liberia"
-msgstr "Liberia"
-
-#. 426
-#: ../navit/country.c:154
-msgid "Lesotho"
-msgstr "Lesotho"
-
-#. 440
-#: ../navit/country.c:155
-msgid "Lithuania"
-msgstr "Lituania"
-
-#. 442
-#: ../navit/country.c:156
-msgid "Luxembourg"
-msgstr "Lussemburgo"
-
-#. 428
-#: ../navit/country.c:157
-msgid "Latvia"
-msgstr "Lettonia"
-
-#. 434
-#: ../navit/country.c:158
-msgid "Libyan Arab Jamahiriya"
-msgstr "Libia"
-
-#. 504
-#: ../navit/country.c:159
-msgid "Morocco"
-msgstr "Marocco"
-
-#. 492
-#: ../navit/country.c:160
-msgid "Monaco"
-msgstr "Principato di Monaco"
-
-#. 498
-#: ../navit/country.c:161
-msgid "Moldova, Republic of"
-msgstr "Moldavia"
-
-#. 499
-#: ../navit/country.c:162
-msgid "Montenegro"
-msgstr "Montenegro"
-
-#. 663
-#: ../navit/country.c:163
-msgid "Saint Martin (French part)"
-msgstr "Saint-Martin (parte francese)"
-
-#. 450
-#: ../navit/country.c:164
-msgid "Madagascar"
-msgstr "Madagascar"
-
-#. 584
-#: ../navit/country.c:165
-msgid "Marshall Islands"
-msgstr "Isole Marshall"
-
-#. 807
-#: ../navit/country.c:166
-msgid "Macedonia, the former Yugoslav Republic of"
-msgstr "Repubblica di Macedonia"
-
-#. 466
-#: ../navit/country.c:167
-msgid "Mali"
-msgstr "Mali"
-
-#. 104
-#: ../navit/country.c:168
-msgid "Myanmar"
-msgstr "Myanmar"
-
-#. 496
-#: ../navit/country.c:169
-msgid "Mongolia"
-msgstr "Mongolia"
-
-#. 446
-#: ../navit/country.c:170
-msgid "Macao"
-msgstr "Macao"
-
-#. 580
-#: ../navit/country.c:171
-msgid "Northern Mariana Islands"
-msgstr "Isole Marianne Settentrionali"
-
-#. 474
-#: ../navit/country.c:172
-msgid "Martinique"
-msgstr "Martinica"
-
-#. 478
-#: ../navit/country.c:173
-msgid "Mauritania"
-msgstr "Mauritania"
-
-#. 500
-#: ../navit/country.c:174
-msgid "Montserrat"
-msgstr "Montserrat"
-
-#. 470
-#: ../navit/country.c:175
-msgid "Malta"
-msgstr "Malta"
-
-#. 480
-#: ../navit/country.c:176
-msgid "Mauritius"
-msgstr "Mauritius"
-
-#. 462
-#: ../navit/country.c:177
-msgid "Maldives"
-msgstr "Maldive"
-
-#. 454
-#: ../navit/country.c:178
-msgid "Malawi"
-msgstr "Malawi"
-
-#. 484
-#: ../navit/country.c:179
-msgid "Mexico"
-msgstr "Messico"
-
-#. 458
-#: ../navit/country.c:180
-msgid "Malaysia"
-msgstr "Malesia"
-
-#. 508
-#: ../navit/country.c:181
-msgid "Mozambique"
-msgstr "Mozambico"
-
-#. 516
-#: ../navit/country.c:182
-msgid "Namibia"
-msgstr "Namibia"
-
-#. 540
-#: ../navit/country.c:183
-msgid "New Caledonia"
-msgstr "Nuova Caledonia"
-
-#. 562
-#: ../navit/country.c:184
-msgid "Niger"
-msgstr "Niger"
-
-#. 574
-#: ../navit/country.c:185
-msgid "Norfolk Island"
-msgstr "Isola Norfolk"
-
-#. 566
-#: ../navit/country.c:186
-msgid "Nigeria"
-msgstr "Nigeria"
-
-#. 558
-#: ../navit/country.c:187
-msgid "Nicaragua"
-msgstr "Nicaragua"
-
-#. 528
-#: ../navit/country.c:188
-msgid "Netherlands"
-msgstr "Olanda"
-
-#. 578
-#: ../navit/country.c:189
-msgid "Norway"
-msgstr "Norvegia"
-
-#. 524
-#: ../navit/country.c:190
-msgid "Nepal"
-msgstr "Nepal"
-
-#. 520
-#: ../navit/country.c:191
-msgid "Nauru"
-msgstr "Nauru"
-
-#. 570
-#: ../navit/country.c:192
-msgid "Niue"
-msgstr "Niue"
-
-#. 554
-#: ../navit/country.c:193
-msgid "New Zealand"
-msgstr "Nuova Zelanda"
-
-#. 512
-#: ../navit/country.c:194
-msgid "Oman"
-msgstr "Oman"
-
-#. 591
-#: ../navit/country.c:195
-msgid "Panama"
-msgstr "Panama"
-
-#. 604
-#: ../navit/country.c:196
-msgid "Peru"
-msgstr "Perù"
-
-#. 258
-#: ../navit/country.c:197
-msgid "French Polynesia"
-msgstr "Polinesia francese"
-
-#. 598
-#: ../navit/country.c:198
-msgid "Papua New Guinea"
-msgstr "Papua Nuova Guinea"
-
-#. 608
-#: ../navit/country.c:199
-msgid "Philippines"
-msgstr "Filippine"
-
-#. 586
-#: ../navit/country.c:200
-msgid "Pakistan"
-msgstr "Pakistan"
-
-#. 616
-#: ../navit/country.c:201
-msgid "Poland"
-msgstr "Polonia"
-
-#. 666
-#: ../navit/country.c:202
-msgid "Saint Pierre and Miquelon"
-msgstr "Saint-Pierre e Miquelon"
-
-#. 612
-#: ../navit/country.c:203
-msgid "Pitcairn"
-msgstr "Isole Pitcairn"
-
-#. 630
-#: ../navit/country.c:204
-msgid "Puerto Rico"
-msgstr "Porto Rico"
-
-#. 275
-#: ../navit/country.c:205
-msgid "Palestinian Territory, Occupied"
-msgstr "Palestina"
-
-#. 620
-#: ../navit/country.c:206
-msgid "Portugal"
-msgstr "Portogallo"
-
-#. 585
-#: ../navit/country.c:207
-msgid "Palau"
-msgstr "Palau"
-
-#. 600
-#: ../navit/country.c:208
-msgid "Paraguay"
-msgstr "Paraguay"
-
-#. 634
-#: ../navit/country.c:209
-msgid "Qatar"
-msgstr "Qatar"
-
-#. 638
-#: ../navit/country.c:210
-msgid "Reunion"
-msgstr "Isola della Riunione"
-
-#. 642
-#: ../navit/country.c:211
-msgid "Romania"
-msgstr "Romania"
-
-#. 688
-#: ../navit/country.c:212
-msgid "Serbia"
-msgstr "Serbia"
-
-#. 643
-#: ../navit/country.c:213
-msgid "Russian Federation"
-msgstr "Federazione Russa"
-
-#. 646
-#: ../navit/country.c:214
-msgid "Rwanda"
-msgstr "Ruanda"
-
-#. 682
-#: ../navit/country.c:215
-msgid "Saudi Arabia"
-msgstr "Arabia Saudita"
-
-#. 090
-#: ../navit/country.c:216
-msgid "Solomon Islands"
-msgstr "Isole Salomone"
-
-#. 690
-#: ../navit/country.c:217
-msgid "Seychelles"
-msgstr "Seychelles"
-
-#. 736
-#: ../navit/country.c:218
-msgid "Sudan"
-msgstr "Sudan"
-
-#. 752
-#: ../navit/country.c:219
-msgid "Sweden"
-msgstr "Svezia"
-
-#. 702
-#: ../navit/country.c:220
-msgid "Singapore"
-msgstr "Singapore"
-
-#. 654
-#: ../navit/country.c:221
-msgid "Saint Helena"
-msgstr "Sant'Elena"
-
-#. 705
-#: ../navit/country.c:222
-msgid "Slovenia"
-msgstr "Slovenia"
-
-#. 744
-#: ../navit/country.c:223
-msgid "Svalbard and Jan Mayen"
-msgstr "Svalbard e Jan Mayen"
-
-#. 703
-#: ../navit/country.c:224
-msgid "Slovakia"
-msgstr "Slovacchia"
-
-#. 694
-#: ../navit/country.c:225
-msgid "Sierra Leone"
-msgstr "Sierra Leone"
-
-#. 674
-#: ../navit/country.c:226
-msgid "San Marino"
-msgstr "San Marino"
-
-#. 686
-#: ../navit/country.c:227
-msgid "Senegal"
-msgstr "Senegal"
-
-#. 706
-#: ../navit/country.c:228
-msgid "Somalia"
-msgstr "Somalia"
-
-#. 740
-#: ../navit/country.c:229
-msgid "Suriname"
-msgstr "Suriname"
-
-#. 678
-#: ../navit/country.c:230
-msgid "Sao Tome and Principe"
-msgstr "São Tomé e Príncipe"
-
-#. 222
-#: ../navit/country.c:231
-msgid "El Salvador"
-msgstr "El Salvador"
-
-#. 760
-#: ../navit/country.c:232
-msgid "Syrian Arab Republic"
-msgstr "Siria"
-
-#. 748
-#: ../navit/country.c:233
-msgid "Swaziland"
-msgstr "Swaziland"
-
-#. 796
-#: ../navit/country.c:234
-msgid "Turks and Caicos Islands"
-msgstr "Turks e Caicos"
-
-#. 148
-#: ../navit/country.c:235
-msgid "Chad"
-msgstr "Ciad"
-
-#. 260
-#: ../navit/country.c:236
-msgid "French Southern Territories"
-msgstr "Terre Australi e Antartiche Francesi"
-
-#. 768
-#: ../navit/country.c:237
-msgid "Togo"
-msgstr "Togo"
-
-#. 764
-#: ../navit/country.c:238
-msgid "Thailand"
-msgstr "Thailandia"
-
-#. 762
-#: ../navit/country.c:239
-msgid "Tajikistan"
-msgstr "Tagikistan"
-
-#. 772
-#: ../navit/country.c:240
-msgid "Tokelau"
-msgstr "Tokelau"
-
-#. 626
-#: ../navit/country.c:241
-msgid "Timor-Leste"
-msgstr "Timor Est"
-
-#. 795
-#: ../navit/country.c:242
-msgid "Turkmenistan"
-msgstr "Turkmenistan"
-
-#. 788
-#: ../navit/country.c:243
-msgid "Tunisia"
-msgstr "Tunisia"
-
-#. 776
-#: ../navit/country.c:244
-msgid "Tonga"
-msgstr "Tonga"
-
-#. 792
-#: ../navit/country.c:245
-msgid "Turkey"
-msgstr "Turchia"
-
-#. 780
-#: ../navit/country.c:246
-msgid "Trinidad and Tobago"
-msgstr "Trinidad e Tobago"
-
-#. 798
-#: ../navit/country.c:247
-msgid "Tuvalu"
-msgstr "Tuvalu"
-
-#. 158
-#: ../navit/country.c:248
-msgid "Taiwan, Province of China"
-msgstr "Taiwan"
-
-#. 834
-#: ../navit/country.c:249
-msgid "Tanzania, United Republic of"
-msgstr "Tanzania"
-
-#. 804
-#: ../navit/country.c:250
-msgid "Ukraine"
-msgstr "Ucraina"
-
-#. 800
-#: ../navit/country.c:251
-msgid "Uganda"
-msgstr "Uganda"
-
-#. 581
-#: ../navit/country.c:252
-msgid "United States Minor Outlying Islands"
-msgstr "Isole minori esterne degli Stati Uniti"
-
-#. 840
-#: ../navit/country.c:253
-msgid "United States"
-msgstr "Stati Uniti"
-
-#. 858
-#: ../navit/country.c:254
-msgid "Uruguay"
-msgstr "Uruguay"
-
-#. 860
-#: ../navit/country.c:255
-msgid "Uzbekistan"
-msgstr "Uzbekistan"
-
-#. 336
-#: ../navit/country.c:256
-msgid "Holy See (Vatican City State)"
-msgstr "Città del Vaticano"
-
-#. 670
-#: ../navit/country.c:257
-msgid "Saint Vincent and the Grenadines"
-msgstr "Saint Vincent e Grenadine"
-
-#. 862
-#: ../navit/country.c:258
-msgid "Venezuela"
-msgstr "Venezuela"
-
-#. 092
-#: ../navit/country.c:259
-msgid "Virgin Islands, British"
-msgstr "Isole Vergini britanniche"
-
-#. 850
-#: ../navit/country.c:260
-msgid "Virgin Islands, U.S."
-msgstr "Isole Vergini americane"
-
-#. 704
-#: ../navit/country.c:261
-msgid "Viet Nam"
-msgstr "Vietnam"
-
-#. 548
-#: ../navit/country.c:262
-msgid "Vanuatu"
-msgstr "Vanuatu"
-
-#. 876
-#: ../navit/country.c:263
-msgid "Wallis and Futuna"
-msgstr "Wallis e Futuna"
-
-#. 882
-#: ../navit/country.c:264
-msgid "Samoa"
-msgstr "Samoa"
-
-#. 887
-#: ../navit/country.c:265
-msgid "Yemen"
-msgstr "Yemen"
-
-#. 175
-#: ../navit/country.c:266
-msgid "Mayotte"
-msgstr "Mayotte"
-
-#. 710
-#: ../navit/country.c:267
-msgid "South Africa"
-msgstr "Sudafrica"
-
-#. 894
-#: ../navit/country.c:268
-msgid "Zambia"
-msgstr "Zambia"
-
-#. 716
-#: ../navit/country.c:269
-msgid "Zimbabwe"
-msgstr "Zimbabwe"
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:98
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-msgid "Car"
-msgstr "Sigla"
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso2"
-msgstr "Iso2"
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso3"
-msgstr "Iso3"
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:403
-msgid "Country"
-msgstr "Stato"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "Postal"
-msgstr "Postale"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "Town"
-msgstr "Centro abitato"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "District"
-msgstr "Regione"
-
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-#: ../navit/gui/gtk/destination.c:412
-msgid "Street"
-msgstr "Via"
-
-#: ../navit/gui/gtk/destination.c:100 ../navit/gui/gtk/destination.c:414
-msgid "Number"
-msgstr "Numero"
-
-#: ../navit/gui/gtk/destination.c:398
-msgid "Enter Destination"
-msgstr "Destinazione"
-
-#: ../navit/gui/gtk/destination.c:405
-msgid "Zip Code"
-msgstr "Codice postale"
-
-#: ../navit/gui/gtk/destination.c:407
-msgid "City"
-msgstr "Città"
-
-#: ../navit/gui/gtk/destination.c:409
-msgid "District/Township"
-msgstr "Regione/provincia"
-
-#: ../navit/gui/gtk/destination.c:437 ../navit/gui/gtk/gui_gtk_action.c:153
-msgid "Map"
-msgstr "Mappa"
-
-#: ../navit/gui/gtk/destination.c:438
-msgid "Bookmark"
-msgstr "Segnalibro"
-
-#: ../navit/gui/gtk/destination.c:439 ../navit/gui/gtk/gui_gtk_action.c:166
-msgid "Destination"
-msgstr "Destinazione"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:149
-msgid "Display"
-msgstr "Visualizza"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:150
-msgid "Route"
-msgstr "Percorso"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:154
-msgid "Layout"
-msgstr "Layout"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:155
-msgid "Projection"
-msgstr "Proiezione"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:156
-msgid "Vehicle"
-msgstr "Veicolo"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:157
-msgid "ZoomOut"
-msgstr "Zoom -"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:158
-msgid "ZoomIn"
-msgstr "Zoom +"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:159
-msgid "Refresh"
-msgstr "Aggiorna"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:162 ../navit/gui/gtk/gui_gtk_action.c:164
-msgid "Info"
-msgstr "Informazioni"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:167
-msgid "Clear"
-msgstr "Pulisci"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:168
-msgid "Test"
-msgstr "Test"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:169
-msgid "_Quit"
-msgstr "_Esci"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:176
-msgid "Cursor"
-msgstr "Posizione attuale"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:177
-msgid "Tracking"
-msgstr "Posizione forzata su strada"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:178
-msgid "Orientation"
-msgstr "Orienta mappa a nord"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:180 ../navit/gui/gtk/gui_gtk_action.c:182
-msgid "Fullscreen"
-msgstr "Schermo intero"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:190
-msgid "Data"
-msgstr "Dati"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "N"
-msgstr "N"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NE"
-msgstr "NE"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "E"
-msgstr "E"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SE"
-msgstr "SE"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "S"
-msgstr "S"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SW"
-msgstr "SO"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "W"
-msgstr "O"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NW"
-msgstr "NO"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:103
-#, c-format
-msgid "Route %4.0fkm %02d:%02d ETA"
-msgstr "Percorso %4.0f km, %02d:%02d ETA"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:148
-msgid "Route 0000km 0+00:00 ETA"
-msgstr "Percorso 0000 km, 00:00 ETA"
diff --git a/po/nl.po b/po/nl.po
deleted file mode 100644
index 9e853aa8..00000000
--- a/po/nl.po
+++ /dev/null
@@ -1,1710 +0,0 @@
-# German translations for navit
-# Copyright (C) 2007
-# This file is distributed under the same license as the navit package.
-# Albert Faber, 2007.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: Navit 0.1.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-05-26 17:12+0200\n"
-"PO-Revision-Date: 2008-05-30 20:41+0000\n"
-"Last-Translator: Ed Kapitein <Unknown>\n"
-"Language-Team: afaber\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=2; plural=n != 1;\n"
-"X-Launchpad-Export-Date: 2008-05-30 21:28+0000\n"
-"X-Generator: Launchpad (build Unknown)\n"
-
-#~ msgid "Turn %1$s%2$s %3$s"
-#~ msgstr "%3$s %1$s%2$s afslaan"
-
-#~ msgid "Moldova"
-#~ msgstr "Moldavië"
-
-#~ msgid "Palestinia"
-#~ msgstr "Palestina"
-
-#~ msgid "VisibleBlocks"
-#~ msgstr "Toon blokken"
-
-#~ msgid "VisibleTowns"
-#~ msgstr "Zichtbare Steden"
-
-#~ msgid "VisiblePolys"
-#~ msgstr "Toon polygonen"
-
-#~ msgid "VisibleStreets"
-#~ msgstr "Toon straten"
-
-#~ msgid "VisiblePoints"
-#~ msgstr "Toon punten"
-
-#: ../navit/main.c:111
-#, fuzzy, c-format
-msgid ""
-"navit usage:\n"
-"navit [options] [configfile]\n"
-"\t-c <file>: use <file> as config file\n"
-"\t-d <n>: set the debug output level to <n>. (TODO)\n"
-"\t-h: print this usage info and exit.\n"
-"\t-v: Print the version and exit.\n"
-msgstr ""
-"navit gebruik:\n"
-"navit [opties] [configuratie bestand]\n"
-"\t-c <bestand>: gebruik <bestand> als configuratie bestand\n"
-"\t-d <n>: stel het debug niveau in op <n>. (nog niet actief)\n"
-"\t-h: print deze help pagina en stop.\n"
-"\t-v: Print de versie en stop.\n"
-
-#: ../navit/main.c:131
-#, c-format
-msgid "Running from source directory\n"
-msgstr "Gestart vanuit de bron directory\n"
-
-#: ../navit/main.c:147
-#, c-format
-msgid "setting '%s' to '%s'\n"
-msgstr "setting '%s' naar '%s'\n"
-
-#. We have not found an existing config file from all possibilities
-#: ../navit/main.c:248
-#, c-format
-msgid "No config file navit.xml, navit.xml.local found\n"
-msgstr "Geen config file navit.xml, navit.xml.local gevonden\n"
-
-#: ../navit/main.c:255
-#, c-format
-msgid "Error parsing '%s': %s\n"
-msgstr "Error bij het verwerken van '%s': %s\n"
-
-#: ../navit/main.c:258
-#, c-format
-msgid "Using '%s'\n"
-msgstr "Gebruik '%s'\n"
-
-#: ../navit/main.c:261
-#, c-format
-msgid "No instance has been created, exiting\n"
-msgstr "Geen instantie ge-creerd, beëindigen\n"
-
-#: ../navit/navigation.c:171
-#, c-format
-msgid "%d m"
-msgstr "%d Meter"
-
-#: ../navit/navigation.c:173
-#, c-format
-msgid "in %d m"
-msgstr "na %d meter"
-
-#: ../navit/navigation.c:177
-#, c-format
-msgid "%d meters"
-msgstr "%d Meter"
-
-#: ../navit/navigation.c:179
-#, c-format
-msgid "in %d meters"
-msgstr "na %d meter"
-
-#: ../navit/navigation.c:185
-#, c-format
-msgid "%d.%d kilometer"
-msgstr "%d,%d kilometer"
-
-#: ../navit/navigation.c:187
-#, c-format
-msgid "in %d.%d kilometers"
-msgstr "na %d,%d kilometer"
-
-#: ../navit/navigation.c:191
-#, c-format
-msgid "one kilometer"
-msgid_plural "%d kilometers"
-msgstr[0] "een kilometer"
-msgstr[1] "%d kilometer"
-
-#: ../navit/navigation.c:193
-#, c-format
-msgid "in one kilometer"
-msgid_plural "in %d kilometers"
-msgstr[0] "na één kilometer"
-msgstr[1] "in %d kilometer"
-
-#: ../navit/navigation.c:447
-#, fuzzy
-msgid "exit"
-msgstr "afslag"
-
-#: ../navit/navigation.c:449
-#, fuzzy
-msgid "ramp"
-msgstr "helling"
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name
-#: ../navit/navigation.c:479
-#, fuzzy, c-format
-msgid "%sinto the street %s%s%s"
-msgstr "%sin the straat %s%s%s"
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Male form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:483
-#, fuzzy, c-format
-msgid "%sinto the %s%s%s|male form"
-msgstr "%sin de %s%s%s|male form"
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Female form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:487
-#, fuzzy, c-format
-msgid "%sinto the %s%s%s|female form"
-msgstr "%sin de %s%s%s|female form"
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Neutral form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:491
-#, fuzzy, c-format
-msgid "%sinto the %s%s%s|neutral form"
-msgstr "%sin het %s%s%s|neutral form"
-
-#: ../navit/navigation.c:497
-#, fuzzy, c-format
-msgid "into the %s"
-msgstr "in de %s"
-
-#: ../navit/navigation.c:518
-msgid "right"
-msgstr "rechts"
-
-#: ../navit/navigation.c:525
-msgid "left"
-msgstr "links"
-
-#: ../navit/navigation.c:529
-msgid "easily "
-msgstr "flauwe "
-
-#: ../navit/navigation.c:533
-msgid "strongly "
-msgstr "scherpe "
-
-#: ../navit/navigation.c:536
-msgid "unknown "
-msgstr "niet bekend "
-
-#
-#: ../navit/navigation.c:542
-msgid "When possible, please turn around"
-msgstr "Wanneer mogelijk, omkeren"
-
-#: ../navit/navigation.c:549
-#, c-format
-msgid "Follow the road for the next %s"
-msgstr "Weg volgen voor %s"
-
-#: ../navit/navigation.c:553
-msgid "soon"
-msgstr "binnenkort"
-
-#: ../navit/navigation.c:559
-msgid "now"
-msgstr "nu"
-
-#: ../navit/navigation.c:562
-msgid "error"
-msgstr "error"
-
-#. TRANSLATORS: The first argument is strength, the second direction, the third distance and the fourth destination Example: 'Turn 'slightly' 'left' in '100 m' 'onto baker street'
-#: ../navit/navigation.c:591
-#, fuzzy, c-format
-msgid "Turn %1$s%2$s %3$s%4$s"
-msgstr "Ga %3$s %1$s naar %2$s %4$s"
-
-# over 200 meter links aanhouden
-#: ../navit/navigation.c:594
-#, c-format
-msgid "You have reached your destination %s"
-msgstr "%s bestemming bereikt"
-
-#: ../navit/navit.c:664 ../navit/gui/gtk/gui_gtk_action.c:151
-msgid "Former Destinations"
-msgstr "Vorige bestemmingen"
-
-#: ../navit/navit.c:674 ../navit/gui/gtk/gui_gtk_action.c:152
-msgid "Bookmarks"
-msgstr "Bookmarks"
-
-#: ../navit/navit.c:764
-msgid "Command"
-msgstr "Opdracht"
-
-#: ../navit/navit.c:769
-msgid "Length"
-msgstr "Lengte"
-
-#: ../navit/navit.c:773 ../navit/navit.c:798
-msgid "km"
-msgstr "km"
-
-#: ../navit/navit.c:777 ../navit/navit.c:802
-msgid "m"
-msgstr "m"
-
-#: ../navit/navit.c:783
-msgid "Time"
-msgstr "Tijd"
-
-#: ../navit/navit.c:795
-msgid "Destination Length"
-msgstr "Afstand"
-
-#: ../navit/navit.c:808
-msgid "Destination Time"
-msgstr "Aankomsttijd"
-
-#: ../navit/navit.c:837 ../navit/gui/gtk/gui_gtk_action.c:160
-msgid "Roadbook"
-msgstr "Route"
-
-#: ../navit/popup.c:200 ../navit/popup.c:254
-msgid "Set as position"
-msgstr "Zet als positie"
-
-#: ../navit/popup.c:201 ../navit/popup.c:255
-msgid "Set as destination"
-msgstr "Zet als bestemming"
-
-#: ../navit/popup.c:202 ../navit/popup.c:256
-msgid "Add as bookmark"
-msgstr "Opnemen als bladwijzer"
-
-#: ../navit/popup.c:244
-#, c-format
-msgid "Point 0x%x 0x%x"
-msgstr "Punt 0x%x 0x%x"
-
-#: ../navit/popup.c:245
-#, c-format
-msgid "Screen coord : %d %d"
-msgstr "Scherm %d %d"
-
-#. 020
-#: ../navit/country.c:24
-msgid "Andorra"
-msgstr "Andorra"
-
-#. 784
-#: ../navit/country.c:25
-msgid "United Arab Emirates"
-msgstr "Verenigde Arabische Emiraten"
-
-#. 004
-#: ../navit/country.c:26
-msgid "Afghanistan"
-msgstr "Afghanistan"
-
-#. 028
-#: ../navit/country.c:27
-msgid "Antigua and Barbuda"
-msgstr "Antigua en Barbuda"
-
-#. 660
-#: ../navit/country.c:28
-msgid "Anguilla"
-msgstr "Anguilla"
-
-#. 008
-#: ../navit/country.c:29
-msgid "Albania"
-msgstr "Albanië"
-
-#. 051
-#: ../navit/country.c:30
-msgid "Armenia"
-msgstr "Armenië"
-
-#. 530
-#: ../navit/country.c:31
-msgid "Netherlands Antilles"
-msgstr "Nederlandse Antillen"
-
-#. 024
-#: ../navit/country.c:32
-msgid "Angola"
-msgstr "Angola"
-
-#. 010
-#: ../navit/country.c:33
-msgid "Antarctica"
-msgstr "Antarctica"
-
-#. 032
-#: ../navit/country.c:34
-msgid "Argentina"
-msgstr "Argentinië"
-
-#. 016
-#: ../navit/country.c:35
-msgid "American Samoa"
-msgstr "Samoa"
-
-#. 040
-#: ../navit/country.c:36
-msgid "Austria"
-msgstr "Oostenrijk"
-
-#. 036
-#: ../navit/country.c:37
-msgid "Australia"
-msgstr "Australië"
-
-#. 533
-#: ../navit/country.c:38
-msgid "Aruba"
-msgstr "Aruba"
-
-#. 248
-#: ../navit/country.c:39
-msgid "Aland Islands"
-msgstr "Färöer eilanden"
-
-#. 031
-#: ../navit/country.c:40
-msgid "Azerbaijan"
-msgstr "Azerbeidjan"
-
-#. 070
-#: ../navit/country.c:41
-msgid "Bosnia and Herzegovina"
-msgstr "Bosnië en Herzegovina"
-
-#. 052
-#: ../navit/country.c:42
-msgid "Barbados"
-msgstr "Barbados"
-
-#. 050
-#: ../navit/country.c:43
-msgid "Bangladesh"
-msgstr "Bangladesh"
-
-#. 056
-#: ../navit/country.c:44
-msgid "Belgium"
-msgstr "België"
-
-#. 854
-#: ../navit/country.c:45
-msgid "Burkina Faso"
-msgstr "Burkina Faso"
-
-#. 100
-#: ../navit/country.c:46
-msgid "Bulgaria"
-msgstr "Bulgarije"
-
-#. 048
-#: ../navit/country.c:47
-msgid "Bahrain"
-msgstr "Bahrein"
-
-#. 108
-#: ../navit/country.c:48
-msgid "Burundi"
-msgstr "Burundi"
-
-#. 204
-#: ../navit/country.c:49
-msgid "Benin"
-msgstr "Benin"
-
-#. 652
-#: ../navit/country.c:50
-msgid "Saint Barthelemy"
-msgstr "Saint-Barthélemy"
-
-#. 060
-#: ../navit/country.c:51
-msgid "Bermuda"
-msgstr "Bermuda"
-
-#. 096
-#: ../navit/country.c:52
-msgid "Brunei Darussalam"
-msgstr "Brunei"
-
-#. 068
-#: ../navit/country.c:53
-msgid "Bolivia"
-msgstr "Bolivia"
-
-#. 076
-#: ../navit/country.c:54
-msgid "Brazil"
-msgstr "Brazilië"
-
-#. 044
-#: ../navit/country.c:55
-msgid "Bahamas"
-msgstr "Bahama's"
-
-#. 064
-#: ../navit/country.c:56
-msgid "Bhutan"
-msgstr "Bhutan"
-
-#. 074
-#: ../navit/country.c:57
-msgid "Bouvet Island"
-msgstr "Bouvet eiland"
-
-#. 072
-#: ../navit/country.c:58
-msgid "Botswana"
-msgstr "Botswana"
-
-#. 112
-#: ../navit/country.c:59
-msgid "Belarus"
-msgstr "Wit-Rusland"
-
-#. 084
-#: ../navit/country.c:60
-msgid "Belize"
-msgstr "Belize"
-
-#. 124
-#: ../navit/country.c:61
-msgid "Canada"
-msgstr "Canada"
-
-#. 166
-#: ../navit/country.c:62
-msgid "Cocos (Keeling) Islands"
-msgstr "Cocoseilanden"
-
-#. 180
-#: ../navit/country.c:63
-msgid "Congo, Democratic Republic of the"
-msgstr "Congo-Kinshasa"
-
-#. 140
-#: ../navit/country.c:64
-msgid "Central African Republic"
-msgstr "Centraal Afrikaanse Republiek"
-
-#. 178
-#: ../navit/country.c:65
-msgid "Congo"
-msgstr "Congo-Brazzaville"
-
-#. 756
-#: ../navit/country.c:66
-msgid "Switzerland"
-msgstr "Zwitserland"
-
-#. 384
-#: ../navit/country.c:67
-msgid "Cote d'Ivoire"
-msgstr "Ivoorkust"
-
-#. 184
-#: ../navit/country.c:68
-msgid "Cook Islands"
-msgstr "Cookeilanden"
-
-#. 152
-#: ../navit/country.c:69
-msgid "Chile"
-msgstr "Chili"
-
-#. 120
-#: ../navit/country.c:70
-msgid "Cameroon"
-msgstr "Kameroen"
-
-#. 156
-#: ../navit/country.c:71
-msgid "China"
-msgstr "China"
-
-#. 170
-#: ../navit/country.c:72
-msgid "Colombia"
-msgstr "Colombia"
-
-#. 188
-#: ../navit/country.c:73
-msgid "Costa Rica"
-msgstr "Costa Rica"
-
-#. 192
-#: ../navit/country.c:74
-msgid "Cuba"
-msgstr "Cuba"
-
-#. 132
-#: ../navit/country.c:75
-msgid "Cape Verde"
-msgstr "Kaap Verdië"
-
-#. 162
-#: ../navit/country.c:76
-msgid "Christmas Island"
-msgstr "Kersteiland"
-
-#. 196
-#: ../navit/country.c:77
-msgid "Cyprus"
-msgstr "Cyprus"
-
-#. 203
-#: ../navit/country.c:78
-msgid "Czech Republic"
-msgstr "Tsjechië"
-
-#. 276
-#: ../navit/country.c:79
-msgid "Germany"
-msgstr "Duitsland"
-
-#. 262
-#: ../navit/country.c:80
-msgid "Djibouti"
-msgstr "Djibouti"
-
-#. 208
-#: ../navit/country.c:81
-msgid "Denmark"
-msgstr "Denemarken"
-
-#. 212
-#: ../navit/country.c:82
-msgid "Dominica"
-msgstr "Dominica"
-
-#. 214
-#: ../navit/country.c:83
-msgid "Dominican Republic"
-msgstr "Dominicaanse Republiek"
-
-#. 012
-#: ../navit/country.c:84
-msgid "Algeria"
-msgstr "Algerije"
-
-#. 218
-#: ../navit/country.c:85
-msgid "Ecuador"
-msgstr "Ecuador"
-
-#. 233
-#: ../navit/country.c:86
-msgid "Estonia"
-msgstr "Estland"
-
-#. 818
-#: ../navit/country.c:87
-msgid "Egypt"
-msgstr "Egypte"
-
-#. 732
-#: ../navit/country.c:88
-msgid "Western Sahara"
-msgstr "Westsahara"
-
-#. 232
-#: ../navit/country.c:89
-msgid "Eritrea"
-msgstr "Eritrea"
-
-#. 724
-#: ../navit/country.c:90
-msgid "Spain"
-msgstr "Spanje"
-
-#. 231
-#: ../navit/country.c:91
-msgid "Ethiopia"
-msgstr "Ethiopië"
-
-#. 246
-#: ../navit/country.c:92
-msgid "Finland"
-msgstr "Finland"
-
-#. 242
-#: ../navit/country.c:93
-msgid "Fiji"
-msgstr "Fiji"
-
-#. 238
-#: ../navit/country.c:94
-msgid "Falkland Islands (Malvinas)"
-msgstr "Falkland Eilanden"
-
-#. 583
-#: ../navit/country.c:95
-msgid "Micronesia, Federated States of"
-msgstr "Micronesië"
-
-#. 234
-#: ../navit/country.c:96
-msgid "Faroe Islands"
-msgstr "Färöer"
-
-#. 250
-#: ../navit/country.c:97
-msgid "France"
-msgstr "Frankrijk"
-
-#. 266
-#: ../navit/country.c:98
-msgid "Gabon"
-msgstr "Gabon"
-
-#. 826
-#: ../navit/country.c:99
-msgid "United Kingdom"
-msgstr "Verenigd Koninkrijk"
-
-#. 308
-#: ../navit/country.c:100
-msgid "Grenada"
-msgstr "Grenada"
-
-#. 268
-#: ../navit/country.c:101
-msgid "Georgia"
-msgstr "Georgië"
-
-#. 254
-#: ../navit/country.c:102
-msgid "French Guiana"
-msgstr "Frans Guiana"
-
-#. 831
-#: ../navit/country.c:103
-msgid "Guernsey"
-msgstr "Guernsey"
-
-#. 288
-#: ../navit/country.c:104
-msgid "Ghana"
-msgstr "Ghana"
-
-#. 292
-#: ../navit/country.c:105
-msgid "Gibraltar"
-msgstr "Gibraltar"
-
-#. 304
-#: ../navit/country.c:106
-msgid "Greenland"
-msgstr "Groenland"
-
-#. 270
-#: ../navit/country.c:107
-msgid "Gambia"
-msgstr "Gambia"
-
-#. 324
-#: ../navit/country.c:108
-msgid "Guinea"
-msgstr "Papoea-Nieuw-Guinea"
-
-#. 312
-#: ../navit/country.c:109
-msgid "Guadeloupe"
-msgstr "Guadeloupe"
-
-#. 226
-#: ../navit/country.c:110
-msgid "Equatorial Guinea"
-msgstr "Equitoriaal Guinea"
-
-#. 300
-#: ../navit/country.c:111
-msgid "Greece"
-msgstr "Griekenland"
-
-#. 239
-#: ../navit/country.c:112
-msgid "South Georgia and the South Sandwich Islands"
-msgstr "Zuid Georgia en de zuidelijke Sandwich eilanden"
-
-#. 320
-#: ../navit/country.c:113
-msgid "Guatemala"
-msgstr "Guatemala"
-
-#. 316
-#: ../navit/country.c:114
-msgid "Guam"
-msgstr "Guam"
-
-#. 624
-#: ../navit/country.c:115
-msgid "Guinea-Bissau"
-msgstr "Guinee-Bissau"
-
-#. 328
-#: ../navit/country.c:116
-msgid "Guyana"
-msgstr "Guyana"
-
-#. 344
-#: ../navit/country.c:117
-msgid "Hong Kong"
-msgstr "Hong Kong"
-
-#. 334
-#: ../navit/country.c:118
-msgid "Heard Island and McDonald Islands"
-msgstr "Heard en McDonald eilanden"
-
-#. 340
-#: ../navit/country.c:119
-msgid "Honduras"
-msgstr "Honduras"
-
-#. 191
-#: ../navit/country.c:120
-msgid "Croatia"
-msgstr "Kroatië"
-
-#. 332
-#: ../navit/country.c:121
-msgid "Haiti"
-msgstr "Haiti"
-
-#. 348
-#: ../navit/country.c:122
-msgid "Hungary"
-msgstr "Hongarije"
-
-#. 360
-#: ../navit/country.c:123
-msgid "Indonesia"
-msgstr "Indonesië"
-
-#. 372
-#: ../navit/country.c:124
-msgid "Ireland"
-msgstr "Ierland"
-
-#. 376
-#: ../navit/country.c:125
-msgid "Israel"
-msgstr "Israël"
-
-#. 833
-#: ../navit/country.c:126
-msgid "Isle of Man"
-msgstr "Eiland van Man"
-
-#. 356
-#: ../navit/country.c:127
-msgid "India"
-msgstr "India"
-
-#. 086
-#: ../navit/country.c:128
-msgid "British Indian Ocean Territory"
-msgstr "Brits Territorium in de Indische Oceaan"
-
-#. 368
-#: ../navit/country.c:129
-msgid "Iraq"
-msgstr "Irak"
-
-#. 364
-#: ../navit/country.c:130
-msgid "Iran, Islamic Republic of"
-msgstr "Iran"
-
-#. 352
-#: ../navit/country.c:131
-msgid "Iceland"
-msgstr "IJsland"
-
-#. 380
-#: ../navit/country.c:132
-msgid "Italy"
-msgstr "Italië"
-
-#. 832
-#: ../navit/country.c:133
-msgid "Jersey"
-msgstr "Jersey"
-
-#. 388
-#: ../navit/country.c:134
-msgid "Jamaica"
-msgstr "Jamaica"
-
-#. 400
-#: ../navit/country.c:135
-msgid "Jordan"
-msgstr "Jordanie"
-
-#. 392
-#: ../navit/country.c:136
-msgid "Japan"
-msgstr "Japan"
-
-#. 404
-#: ../navit/country.c:137
-msgid "Kenya"
-msgstr "Kenia"
-
-#. 417
-#: ../navit/country.c:138
-msgid "Kyrgyzstan"
-msgstr "Kirgizië"
-
-#. 116
-#: ../navit/country.c:139
-msgid "Cambodia"
-msgstr "Cambodja"
-
-#. 296
-#: ../navit/country.c:140
-msgid "Kiribati"
-msgstr "Kiribati"
-
-#. 174
-#: ../navit/country.c:141
-msgid "Comoros"
-msgstr "Comoren"
-
-#. 659
-#: ../navit/country.c:142
-msgid "Saint Kitts and Nevis"
-msgstr "Saint Kitts en Nevis"
-
-#. 408
-#: ../navit/country.c:143
-msgid "Korea, Democratic People's Republic of"
-msgstr "ZuidKorea"
-
-#. 410
-#: ../navit/country.c:144
-msgid "Korea, Republic of"
-msgstr "Noord-Korea"
-
-#. 414
-#: ../navit/country.c:145
-msgid "Kuwait"
-msgstr "Koeweit"
-
-#. 136
-#: ../navit/country.c:146
-msgid "Cayman Islands"
-msgstr "Caymaneilanden"
-
-#. 398
-#: ../navit/country.c:147
-msgid "Kazakhstan"
-msgstr "Kazachstan"
-
-#. 418
-#: ../navit/country.c:148
-msgid "Lao People's Democratic Republic"
-msgstr "Laos"
-
-#. 422
-#: ../navit/country.c:149
-msgid "Lebanon"
-msgstr "Libanon"
-
-#. 662
-#: ../navit/country.c:150
-msgid "Saint Lucia"
-msgstr "Saint Lucia"
-
-#. 438
-#: ../navit/country.c:151
-msgid "Liechtenstein"
-msgstr "Lichtenstein"
-
-#. 144
-#: ../navit/country.c:152
-msgid "Sri Lanka"
-msgstr "Sri Lanka"
-
-#. 430
-#: ../navit/country.c:153
-msgid "Liberia"
-msgstr "Liberia"
-
-#. 426
-#: ../navit/country.c:154
-msgid "Lesotho"
-msgstr "Lesotho"
-
-#. 440
-#: ../navit/country.c:155
-msgid "Lithuania"
-msgstr "Litouwen"
-
-#. 442
-#: ../navit/country.c:156
-msgid "Luxembourg"
-msgstr "Luxemburg"
-
-#. 428
-#: ../navit/country.c:157
-msgid "Latvia"
-msgstr "Letland"
-
-#. 434
-#: ../navit/country.c:158
-msgid "Libyan Arab Jamahiriya"
-msgstr "Libië"
-
-#. 504
-#: ../navit/country.c:159
-msgid "Morocco"
-msgstr "Marokko"
-
-#. 492
-#: ../navit/country.c:160
-msgid "Monaco"
-msgstr "Monaco"
-
-#. 498
-#: ../navit/country.c:161
-msgid "Moldova, Republic of"
-msgstr "Moldavië"
-
-#. 499
-#: ../navit/country.c:162
-msgid "Montenegro"
-msgstr "Montenegro"
-
-#. 663
-#: ../navit/country.c:163
-msgid "Saint Martin (French part)"
-msgstr "Sint-Maarten (Franse Antillen)"
-
-#. 450
-#: ../navit/country.c:164
-msgid "Madagascar"
-msgstr "Madagascar"
-
-#. 584
-#: ../navit/country.c:165
-msgid "Marshall Islands"
-msgstr "Marshall eilanden"
-
-#. 807
-#: ../navit/country.c:166
-msgid "Macedonia, the former Yugoslav Republic of"
-msgstr "Macedonië"
-
-#. 466
-#: ../navit/country.c:167
-msgid "Mali"
-msgstr "Mali"
-
-#. 104
-#: ../navit/country.c:168
-msgid "Myanmar"
-msgstr "Myanmar"
-
-#. 496
-#: ../navit/country.c:169
-msgid "Mongolia"
-msgstr "Mongolië"
-
-#. 446
-#: ../navit/country.c:170
-msgid "Macao"
-msgstr "Macao"
-
-#. 580
-#: ../navit/country.c:171
-msgid "Northern Mariana Islands"
-msgstr "Noordelijke Marianen"
-
-#. 474
-#: ../navit/country.c:172
-msgid "Martinique"
-msgstr "Martinique"
-
-#. 478
-#: ../navit/country.c:173
-msgid "Mauritania"
-msgstr "Mauretanië"
-
-#. 500
-#: ../navit/country.c:174
-msgid "Montserrat"
-msgstr "Montserrat"
-
-#. 470
-#: ../navit/country.c:175
-msgid "Malta"
-msgstr "Malta"
-
-#. 480
-#: ../navit/country.c:176
-msgid "Mauritius"
-msgstr "Mauritius"
-
-#. 462
-#: ../navit/country.c:177
-msgid "Maldives"
-msgstr "Maldiven"
-
-#. 454
-#: ../navit/country.c:178
-msgid "Malawi"
-msgstr "Malawi"
-
-#. 484
-#: ../navit/country.c:179
-msgid "Mexico"
-msgstr "Mexico"
-
-#. 458
-#: ../navit/country.c:180
-msgid "Malaysia"
-msgstr "Maleisië"
-
-#. 508
-#: ../navit/country.c:181
-msgid "Mozambique"
-msgstr "Mozambique"
-
-#. 516
-#: ../navit/country.c:182
-msgid "Namibia"
-msgstr "Namibië"
-
-#. 540
-#: ../navit/country.c:183
-msgid "New Caledonia"
-msgstr "Nieuw Caledonië"
-
-#. 562
-#: ../navit/country.c:184
-msgid "Niger"
-msgstr "Niger"
-
-#. 574
-#: ../navit/country.c:185
-msgid "Norfolk Island"
-msgstr "Norfolk"
-
-#. 566
-#: ../navit/country.c:186
-msgid "Nigeria"
-msgstr "Nigeria"
-
-#. 558
-#: ../navit/country.c:187
-msgid "Nicaragua"
-msgstr "NIcaragua"
-
-#. 528
-#: ../navit/country.c:188
-msgid "Netherlands"
-msgstr "Nederland"
-
-#. 578
-#: ../navit/country.c:189
-msgid "Norway"
-msgstr "Noorwegen"
-
-#. 524
-#: ../navit/country.c:190
-msgid "Nepal"
-msgstr "Nepal"
-
-#. 520
-#: ../navit/country.c:191
-msgid "Nauru"
-msgstr "Nauru"
-
-#. 570
-#: ../navit/country.c:192
-msgid "Niue"
-msgstr "Niue"
-
-#. 554
-#: ../navit/country.c:193
-msgid "New Zealand"
-msgstr "Nieuw Zeeland"
-
-#. 512
-#: ../navit/country.c:194
-msgid "Oman"
-msgstr "Oman"
-
-#. 591
-#: ../navit/country.c:195
-msgid "Panama"
-msgstr "Panama"
-
-#. 604
-#: ../navit/country.c:196
-msgid "Peru"
-msgstr "Peru"
-
-#. 258
-#: ../navit/country.c:197
-msgid "French Polynesia"
-msgstr "Frans Polynesië"
-
-#. 598
-#: ../navit/country.c:198
-msgid "Papua New Guinea"
-msgstr "Papua Nieuw Guinea"
-
-#. 608
-#: ../navit/country.c:199
-msgid "Philippines"
-msgstr "Philippijnen"
-
-#. 586
-#: ../navit/country.c:200
-msgid "Pakistan"
-msgstr "Pakistan"
-
-#. 616
-#: ../navit/country.c:201
-msgid "Poland"
-msgstr "Polen"
-
-#. 666
-#: ../navit/country.c:202
-msgid "Saint Pierre and Miquelon"
-msgstr "Saint-Pierre en Miquelon"
-
-#. 612
-#: ../navit/country.c:203
-msgid "Pitcairn"
-msgstr "Pitcairneilanden"
-
-#. 630
-#: ../navit/country.c:204
-msgid "Puerto Rico"
-msgstr "Puerto Rico"
-
-#. 275
-#: ../navit/country.c:205
-msgid "Palestinian Territory, Occupied"
-msgstr "Palestijns Gebied, Bezet"
-
-#. 620
-#: ../navit/country.c:206
-msgid "Portugal"
-msgstr "Portugal"
-
-#. 585
-#: ../navit/country.c:207
-msgid "Palau"
-msgstr "Palau"
-
-#. 600
-#: ../navit/country.c:208
-msgid "Paraguay"
-msgstr "Paraguay"
-
-#. 634
-#: ../navit/country.c:209
-msgid "Qatar"
-msgstr "Qatar"
-
-#. 638
-#: ../navit/country.c:210
-msgid "Reunion"
-msgstr "Réunion"
-
-#. 642
-#: ../navit/country.c:211
-msgid "Romania"
-msgstr "Roemenië"
-
-#. 688
-#: ../navit/country.c:212
-msgid "Serbia"
-msgstr "Servië"
-
-#. 643
-#: ../navit/country.c:213
-msgid "Russian Federation"
-msgstr "Rusland"
-
-#. 646
-#: ../navit/country.c:214
-msgid "Rwanda"
-msgstr "Rwanda"
-
-#
-#. 682
-#: ../navit/country.c:215
-msgid "Saudi Arabia"
-msgstr "Saudi-Arabië"
-
-#. 090
-#: ../navit/country.c:216
-msgid "Solomon Islands"
-msgstr "Salomonseilanden"
-
-#. 690
-#: ../navit/country.c:217
-msgid "Seychelles"
-msgstr "Seychellen"
-
-#. 736
-#: ../navit/country.c:218
-msgid "Sudan"
-msgstr "Soedan"
-
-#. 752
-#: ../navit/country.c:219
-msgid "Sweden"
-msgstr "Zweden"
-
-#. 702
-#: ../navit/country.c:220
-msgid "Singapore"
-msgstr "Singapore"
-
-#. 654
-#: ../navit/country.c:221
-msgid "Saint Helena"
-msgstr "Sint-Helena"
-
-#. 705
-#: ../navit/country.c:222
-msgid "Slovenia"
-msgstr "Slovenië"
-
-#. 744
-#: ../navit/country.c:223
-msgid "Svalbard and Jan Mayen"
-msgstr "Svalbard und Jan Mayen"
-
-#. 703
-#: ../navit/country.c:224
-msgid "Slovakia"
-msgstr "Slowakije"
-
-#. 694
-#: ../navit/country.c:225
-msgid "Sierra Leone"
-msgstr "Siërra Leone"
-
-#. 674
-#: ../navit/country.c:226
-msgid "San Marino"
-msgstr "San Marino"
-
-#. 686
-#: ../navit/country.c:227
-msgid "Senegal"
-msgstr "Senegal"
-
-#. 706
-#: ../navit/country.c:228
-msgid "Somalia"
-msgstr "Somalië"
-
-#. 740
-#: ../navit/country.c:229
-msgid "Suriname"
-msgstr "Suriname"
-
-#. 678
-#: ../navit/country.c:230
-msgid "Sao Tome and Principe"
-msgstr "Sao Tomé en Principe"
-
-#. 222
-#: ../navit/country.c:231
-msgid "El Salvador"
-msgstr "El Salvador"
-
-#. 760
-#: ../navit/country.c:232
-msgid "Syrian Arab Republic"
-msgstr "Syrië"
-
-#. 748
-#: ../navit/country.c:233
-msgid "Swaziland"
-msgstr "Swasiland"
-
-#. 796
-#: ../navit/country.c:234
-msgid "Turks and Caicos Islands"
-msgstr "Turks- en Caicoseilanden"
-
-#. 148
-#: ../navit/country.c:235
-msgid "Chad"
-msgstr "Tjaad"
-
-#. 260
-#: ../navit/country.c:236
-msgid "French Southern Territories"
-msgstr "Franse Zuidelijke en Antarctische Gebieden"
-
-#. 768
-#: ../navit/country.c:237
-msgid "Togo"
-msgstr "Togo"
-
-#. 764
-#: ../navit/country.c:238
-msgid "Thailand"
-msgstr "Thailand"
-
-#. 762
-#: ../navit/country.c:239
-msgid "Tajikistan"
-msgstr "Tadzjikistan"
-
-#. 772
-#: ../navit/country.c:240
-msgid "Tokelau"
-msgstr "Tokelau-eilanden"
-
-#. 626
-#: ../navit/country.c:241
-msgid "Timor-Leste"
-msgstr "Oost-Timor"
-
-#. 795
-#: ../navit/country.c:242
-msgid "Turkmenistan"
-msgstr "Turkmenistan"
-
-#. 788
-#: ../navit/country.c:243
-msgid "Tunisia"
-msgstr "Tunesië"
-
-#. 776
-#: ../navit/country.c:244
-msgid "Tonga"
-msgstr "Tonga"
-
-#. 792
-#: ../navit/country.c:245
-msgid "Turkey"
-msgstr "Turkije"
-
-#. 780
-#: ../navit/country.c:246
-msgid "Trinidad and Tobago"
-msgstr "Trinidad en Tobago"
-
-#. 798
-#: ../navit/country.c:247
-msgid "Tuvalu"
-msgstr "Tuvalu"
-
-#. 158
-#: ../navit/country.c:248
-msgid "Taiwan, Province of China"
-msgstr "Taiwan"
-
-#. 834
-#: ../navit/country.c:249
-msgid "Tanzania, United Republic of"
-msgstr "Tanzania"
-
-#. 804
-#: ../navit/country.c:250
-msgid "Ukraine"
-msgstr "Oekraïne"
-
-#. 800
-#: ../navit/country.c:251
-msgid "Uganda"
-msgstr "Oeganda"
-
-#. 581
-#: ../navit/country.c:252
-msgid "United States Minor Outlying Islands"
-msgstr "Kleine Pacifische eilanden van de Verenigde Staten"
-
-#. 840
-#: ../navit/country.c:253
-msgid "United States"
-msgstr "Verenigde Staten"
-
-#. 858
-#: ../navit/country.c:254
-msgid "Uruguay"
-msgstr "Uruguay"
-
-#. 860
-#: ../navit/country.c:255
-msgid "Uzbekistan"
-msgstr "Uzbekistan"
-
-#. 336
-#: ../navit/country.c:256
-msgid "Holy See (Vatican City State)"
-msgstr "Vaticaanstad"
-
-#. 670
-#: ../navit/country.c:257
-msgid "Saint Vincent and the Grenadines"
-msgstr "Saint Vincent en de Grenadines"
-
-#. 862
-#: ../navit/country.c:258
-msgid "Venezuela"
-msgstr "Venezuela"
-
-#. 092
-#: ../navit/country.c:259
-msgid "Virgin Islands, British"
-msgstr "Britse Maagdeneilanden"
-
-#. 850
-#: ../navit/country.c:260
-msgid "Virgin Islands, U.S."
-msgstr "Maagdeneilanden, USA"
-
-#. 704
-#: ../navit/country.c:261
-msgid "Viet Nam"
-msgstr "Vietnam"
-
-#. 548
-#: ../navit/country.c:262
-msgid "Vanuatu"
-msgstr "Vanuatu"
-
-#. 876
-#: ../navit/country.c:263
-msgid "Wallis and Futuna"
-msgstr "Wallis en Futuna"
-
-#. 882
-#: ../navit/country.c:264
-msgid "Samoa"
-msgstr "Samoa"
-
-#. 887
-#: ../navit/country.c:265
-msgid "Yemen"
-msgstr "Jemen"
-
-#. 175
-#: ../navit/country.c:266
-msgid "Mayotte"
-msgstr "Mayotte"
-
-#. 710
-#: ../navit/country.c:267
-msgid "South Africa"
-msgstr "Zuid Africa"
-
-#. 894
-#: ../navit/country.c:268
-msgid "Zambia"
-msgstr "Zambia"
-
-#. 716
-#: ../navit/country.c:269
-msgid "Zimbabwe"
-msgstr "Zimbabwe"
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:98
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-msgid "Car"
-msgstr "Auto"
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso2"
-msgstr "Iso2"
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso3"
-msgstr "Iso3"
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:403
-msgid "Country"
-msgstr "Land"
-
-#
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "Postal"
-msgstr "Postcode"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "Town"
-msgstr "Plaats"
-
-#
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "District"
-msgstr "District"
-
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-#: ../navit/gui/gtk/destination.c:412
-msgid "Street"
-msgstr "Straat"
-
-#: ../navit/gui/gtk/destination.c:100 ../navit/gui/gtk/destination.c:414
-msgid "Number"
-msgstr "Nummer"
-
-#
-#: ../navit/gui/gtk/destination.c:398
-msgid "Enter Destination"
-msgstr "Bestemming"
-
-#: ../navit/gui/gtk/destination.c:405
-msgid "Zip Code"
-msgstr "Postcode"
-
-#: ../navit/gui/gtk/destination.c:407
-msgid "City"
-msgstr "Stad"
-
-#: ../navit/gui/gtk/destination.c:409
-msgid "District/Township"
-msgstr "Gebied"
-
-#: ../navit/gui/gtk/destination.c:437 ../navit/gui/gtk/gui_gtk_action.c:153
-msgid "Map"
-msgstr "Kaart"
-
-#: ../navit/gui/gtk/destination.c:438
-msgid "Bookmark"
-msgstr "Markeren"
-
-#: ../navit/gui/gtk/destination.c:439 ../navit/gui/gtk/gui_gtk_action.c:166
-msgid "Destination"
-msgstr "Bestemming"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:149
-msgid "Display"
-msgstr "Tonen"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:150
-msgid "Route"
-msgstr "Route"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:154
-msgid "Layout"
-msgstr "Opmaak"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:155
-msgid "Projection"
-msgstr "Projectie"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:156
-msgid "Vehicle"
-msgstr "Voertuig"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:157
-msgid "ZoomOut"
-msgstr "Verkleinen"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:158
-msgid "ZoomIn"
-msgstr "Vergroten"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:159
-msgid "Refresh"
-msgstr "Verversen"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:162 ../navit/gui/gtk/gui_gtk_action.c:164
-msgid "Info"
-msgstr "Info"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:167
-msgid "Clear"
-msgstr "Wissen"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:168
-msgid "Test"
-msgstr "Test"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:169
-msgid "_Quit"
-msgstr "Beëindigen"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:176
-msgid "Cursor"
-msgstr "Cursor"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:177
-msgid "Tracking"
-msgstr "Volgen"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:178
-msgid "Orientation"
-msgstr "Oriëntatie"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:180 ../navit/gui/gtk/gui_gtk_action.c:182
-msgid "Fullscreen"
-msgstr "Beeldvullend"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:190
-msgid "Data"
-msgstr "Data"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "N"
-msgstr "N"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NE"
-msgstr "NO"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "E"
-msgstr "O"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SE"
-msgstr "ZO"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "S"
-msgstr "Z"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SW"
-msgstr "ZW"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "W"
-msgstr "W"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NW"
-msgstr "NW"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:103
-#, c-format
-msgid "Route %4.0fkm %02d:%02d ETA"
-msgstr "Route %4.0fkm %02d:%02d Aankomsttijd"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:148
-msgid "Route 0000km 0+00:00 ETA"
-msgstr "Route 0000km 0+00:00 Aankomsttijd"
diff --git a/po/no.po b/po/no.po
deleted file mode 100644
index 43f515a5..00000000
--- a/po/no.po
+++ /dev/null
@@ -1,1677 +0,0 @@
-# Norwegian translations for navit
-# Copyright (C) 2008
-# This file is distributed under the same license as the navit package.
-# Bendik Brenne <bendik@xplore.nu>, 2008.
-# Helge Hafting <helge.hafting@aitel.hist.no>
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: Navit 0.1.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-02-18 18:06+0100\n"
-"PO-Revision-Date: 2008-02-20 19:02+0100\n"
-"Last-Translator: Bendik Brenne <bendik@xplore.nu>\n"
-"Language-Team: Bendik Brenne <bendik@xplore.nu>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=2; plural=n != 1;\n"
-
-#: ../src/main.c:143
-#, c-format
-msgid "Running from source directory\n"
-msgstr "Kjører fra kildemappa\n"
-
-#: ../src/main.c:159
-#, c-format
-msgid "setting '%s' to '%s'\n"
-msgstr "setter '%s' til '%s'\n"
-
-#: ../src/main.c:237
-#, c-format
-msgid "No config file navit.xml, navit.xml.local found\n"
-msgstr "Ingen fil navit.xml, fant navit.xml.local\n"
-
-#: ../src/main.c:241
-#, c-format
-msgid "Error parsing '%s': %s\n"
-msgstr "Feil ved parsing av '%s': %s\n"
-
-#: ../src/main.c:244
-#, c-format
-msgid "Using '%s'\n"
-msgstr "Bruker '%s'\n"
-
-#: ../src/main.c:247
-#, c-format
-msgid "No instance has been created, exiting\n"
-msgstr "Ingen instans er blitt opprettet, avslutter\n"
-
-#: ../src/navigation.c:162
-#, c-format
-msgid "%d m"
-msgstr "%d meter"
-
-#: ../src/navigation.c:164
-#, c-format
-msgid "in %d m"
-msgstr "om %d meter"
-
-#: ../src/navigation.c:168
-#, c-format
-msgid "%d meters"
-msgstr "%d meter"
-
-#: ../src/navigation.c:170
-#, c-format
-msgid "in %d meters"
-msgstr "om %d meter"
-
-#: ../src/navigation.c:176
-#, c-format
-msgid "%d.%d kilometer"
-msgstr "%d,%d kilometer"
-
-#: ../src/navigation.c:178
-#, c-format
-msgid "in %d.%d kilometers"
-msgstr "om %d,%d kilometer"
-
-#: ../src/navigation.c:182
-#, c-format
-msgid "one kilometer"
-msgid_plural "%d kilometers"
-msgstr[0] "én kilometer"
-msgstr[1] "%d kilometer"
-
-#: ../src/navigation.c:184
-#, c-format
-msgid "in one kilometer"
-msgid_plural "in %d kilometers"
-msgstr[0] "om én kilometer"
-msgstr[1] "om %d kilometer"
-
-#: ../src/navigation.c:402
-msgid "right"
-msgstr "høyre"
-
-#: ../src/navigation.c:409
-msgid "left"
-msgstr "venstre"
-
-#: ../src/navigation.c:413
-msgid "easily "
-msgstr "slakt "
-
-#: ../src/navigation.c:417
-msgid "strongly "
-msgstr "skarpt "
-
-#: ../src/navigation.c:420
-msgid "unknown "
-msgstr "ukjent "
-
-#: ../src/navigation.c:426
-msgid "When possible, please turn around"
-msgstr "Snu, om det er mulig"
-
-#: ../src/navigation.c:433
-#, c-format
-msgid "Follow the road for the next %s"
-msgstr "Følg veien de neste %s"
-
-#: ../src/navigation.c:437
-msgid "soon"
-msgstr "snart"
-
-#: ../src/navigation.c:443
-msgid "now"
-msgstr "nå"
-
-#: ../src/navigation.c:446
-msgid "error"
-msgstr "feil"
-
-#. TRANSLATORS: The first argument is strength, the second direction and the third distance
-#: ../src/navigation.c:450
-#, c-format
-msgid "Turn %1$s%2$s %3$s"
-msgstr "Sving %1$stil %2$s %3$s"
-
-#: ../src/navigation.c:453
-#, c-format
-msgid "You have reached your destination %s"
-msgstr "Du har nådd ditt reisemål %s"
-
-#: ../src/navit.c:675 ../src/gui/gtk/gui_gtk_action.c:198
-msgid "Layout"
-msgstr "Layout"
-
-#: ../src/navit.c:691
-msgid "Projection"
-msgstr "Projeksjon"
-
-#: ../src/navit.c:746
-msgid "Former Destinations"
-msgstr "Tidligere reisemål"
-
-#: ../src/navit.c:756
-msgid "Bookmarks"
-msgstr "Bokmerker"
-
-#: ../src/navit.c:794
-msgid "Vehicle"
-msgstr "Kjøretøy"
-
-#: ../src/navit.c:863
-msgid "Command"
-msgstr "Instruks"
-
-#: ../src/navit.c:868
-msgid "Length"
-msgstr "Avstand"
-
-#: ../src/navit.c:872 ../src/navit.c:897
-msgid "km"
-msgstr "km"
-
-#: ../src/navit.c:876 ../src/navit.c:901
-msgid "m"
-msgstr "m"
-
-#: ../src/navit.c:882
-msgid "Time"
-msgstr "Tid"
-
-#: ../src/navit.c:894
-msgid "Destination Length"
-msgstr "Avstand til målet"
-
-#: ../src/navit.c:907
-msgid "Destination Time"
-msgstr "Tid til målet"
-
-#: ../src/navit.c:936 ../src/gui/gtk/gui_gtk_action.c:202
-msgid "Roadbook"
-msgstr "Kjørebok"
-
-#: ../src/navit.c:1169 ../src/gui/gtk/destination.c:368
-#: ../src/gui/gtk/gui_gtk_action.c:197
-msgid "Map"
-msgstr "Kart"
-
-#: ../src/navit.c:1176 ../src/gui/gtk/gui_gtk_action.c:196
-msgid "Route"
-msgstr "Rute"
-
-#: ../src/popup.c:229
-#, c-format
-msgid "Point 0x%x 0x%x"
-msgstr "Punkt 0x%x 0x%x"
-
-#: ../src/popup.c:230
-#, c-format
-msgid "Screen coord : %d %d"
-msgstr "Skjerm koord: %d %d"
-
-#: ../src/popup.c:239
-msgid "Set as position"
-msgstr "Sett som posisjon"
-
-#: ../src/popup.c:240
-msgid "Set as destination"
-msgstr "Sett som destinasjon"
-
-#: ../src/popup.c:241
-msgid "Add as bookmark"
-msgstr "Legg til som bokmerke"
-
-#. 020
-#: ../src/country.c:24
-msgid "Andorra"
-msgstr "Andorra"
-
-#. 784
-#: ../src/country.c:25
-msgid "United Arab Emirates"
-msgstr "De forente arabiske emirater"
-
-#. 004
-#: ../src/country.c:26
-msgid "Afghanistan"
-msgstr "Afghanistan"
-
-#. 028
-#: ../src/country.c:27
-msgid "Antigua and Barbuda"
-msgstr "Antigua og Barbuda"
-
-#. 660
-#: ../src/country.c:28
-msgid "Anguilla"
-msgstr "Anguilla"
-
-#. 008
-#: ../src/country.c:29
-msgid "Albania"
-msgstr "Albania"
-
-#. 051
-#: ../src/country.c:30
-msgid "Armenia"
-msgstr "Armenia"
-
-#. 530
-#: ../src/country.c:31
-msgid "Netherlands Antilles"
-msgstr "De nederlandske Antillene"
-
-#. 024
-#: ../src/country.c:32
-msgid "Angola"
-msgstr "Angola"
-
-#. 010
-#: ../src/country.c:33
-msgid "Antarctica"
-msgstr "Antarktis"
-
-#. 032
-#: ../src/country.c:34
-msgid "Argentina"
-msgstr "Argentina"
-
-#. 016
-#: ../src/country.c:35
-msgid "American Samoa"
-msgstr "Amerikansk Samoa"
-
-#. 040
-#: ../src/country.c:36
-msgid "Austria"
-msgstr "Østerrike"
-
-#. 036
-#: ../src/country.c:37
-msgid "Australia"
-msgstr "Australia"
-
-#. 533
-#: ../src/country.c:38
-msgid "Aruba"
-msgstr "Aruba"
-
-#. 248
-#: ../src/country.c:39
-msgid "Aland Islands"
-msgstr "Ã…land"
-
-#. 031
-#: ../src/country.c:40
-msgid "Azerbaijan"
-msgstr "Azerbaijan"
-
-#. 070
-#: ../src/country.c:41
-msgid "Bosnia and Herzegovina"
-msgstr "Bosnia and Herzegovina"
-
-#. 052
-#: ../src/country.c:42
-msgid "Barbados"
-msgstr "Barbados"
-
-#. 050
-#: ../src/country.c:43
-msgid "Bangladesh"
-msgstr "Bangladesh"
-
-#. 056
-#: ../src/country.c:44
-msgid "Belgium"
-msgstr "Belgia"
-
-#. 854
-#: ../src/country.c:45
-msgid "Burkina Faso"
-msgstr "Burkina Faso"
-
-#. 100
-#: ../src/country.c:46
-msgid "Bulgaria"
-msgstr "Bulgaria"
-
-#. 048
-#: ../src/country.c:47
-msgid "Bahrain"
-msgstr "Bahrain"
-
-#. 108
-#: ../src/country.c:48
-msgid "Burundi"
-msgstr "Burundi"
-
-#. 204
-#: ../src/country.c:49
-msgid "Benin"
-msgstr "Benin"
-
-#. 652
-#: ../src/country.c:50
-msgid "Saint Barthelemy"
-msgstr "Saint Barthelemy"
-
-#. 060
-#: ../src/country.c:51
-msgid "Bermuda"
-msgstr "Bermuda"
-
-#. 096
-#: ../src/country.c:52
-msgid "Brunei Darussalam"
-msgstr "Brunei"
-
-#. 068
-#: ../src/country.c:53
-msgid "Bolivia"
-msgstr "Bolivia"
-
-#. 076
-#: ../src/country.c:54
-msgid "Brazil"
-msgstr "Brazil"
-
-#. 044
-#: ../src/country.c:55
-msgid "Bahamas"
-msgstr "Bahamas"
-
-#. 064
-#: ../src/country.c:56
-msgid "Bhutan"
-msgstr "Bhutan"
-
-#. 074
-#: ../src/country.c:57
-msgid "Bouvet Island"
-msgstr "Bouvetøya"
-
-#. 072
-#: ../src/country.c:58
-msgid "Botswana"
-msgstr "Botswana"
-
-#. 112
-#: ../src/country.c:59
-msgid "Belarus"
-msgstr "Hvite-Russland"
-
-#. 084
-#: ../src/country.c:60
-msgid "Belize"
-msgstr "Belize"
-
-#. 124
-#: ../src/country.c:61
-msgid "Canada"
-msgstr "Kanada"
-
-#. 166
-#: ../src/country.c:62
-msgid "Cocos (Keeling) Islands"
-msgstr "Kokosøyene"
-
-#. 180
-#: ../src/country.c:63
-msgid "Congo, Democratic Republic of the"
-msgstr "Kongo, Den demokratiske republikken"
-
-#. 140
-#: ../src/country.c:64
-msgid "Central African Republic"
-msgstr "Den sentralafrikanske republikk"
-
-#. 178
-#: ../src/country.c:65
-msgid "Congo"
-msgstr "Kongo"
-
-#. 756
-#: ../src/country.c:66
-msgid "Switzerland"
-msgstr "Sveits"
-
-#. 384
-#: ../src/country.c:67
-msgid "Cote d'Ivoire"
-msgstr "Elfenbenskysten"
-
-#. 184
-#: ../src/country.c:68
-msgid "Cook Islands"
-msgstr "Cookøyene"
-
-#. 152
-#: ../src/country.c:69
-msgid "Chile"
-msgstr "Chile"
-
-#. 120
-#: ../src/country.c:70
-msgid "Cameroon"
-msgstr "Kamerun"
-
-#. 156
-#: ../src/country.c:71
-msgid "China"
-msgstr "Kina"
-
-#. 170
-#: ../src/country.c:72
-msgid "Colombia"
-msgstr "Colombia"
-
-#. 188
-#: ../src/country.c:73
-msgid "Costa Rica"
-msgstr "Costa Rica"
-
-#. 192
-#: ../src/country.c:74
-msgid "Cuba"
-msgstr "Kuba"
-
-#. 132
-#: ../src/country.c:75
-msgid "Cape Verde"
-msgstr "Kapp Verde"
-
-#. 162
-#: ../src/country.c:76
-msgid "Christmas Island"
-msgstr "Christmasøya"
-
-#. 196
-#: ../src/country.c:77
-msgid "Cyprus"
-msgstr "Kypros"
-
-#. 203
-#: ../src/country.c:78
-msgid "Czech Republic"
-msgstr "Tsjekkia"
-
-#. 276
-#: ../src/country.c:79
-msgid "Germany"
-msgstr "Tyskland"
-
-#. 262
-#: ../src/country.c:80
-msgid "Djibouti"
-msgstr "Djibouti"
-
-#. 208
-#: ../src/country.c:81
-msgid "Denmark"
-msgstr "Danmark"
-
-#. 212
-#: ../src/country.c:82
-msgid "Dominica"
-msgstr "Dominica"
-
-#. 214
-#: ../src/country.c:83
-msgid "Dominican Republic"
-msgstr "Den dominikanske republikk"
-
-#. 012
-#: ../src/country.c:84
-msgid "Algeria"
-msgstr "Algeria"
-
-#. 218
-#: ../src/country.c:85
-msgid "Ecuador"
-msgstr "Ecuador"
-
-#. 233
-#: ../src/country.c:86
-msgid "Estonia"
-msgstr "Estland"
-
-#. 818
-#: ../src/country.c:87
-msgid "Egypt"
-msgstr "Egypt"
-
-#. 732
-#: ../src/country.c:88
-msgid "Western Sahara"
-msgstr "Vest-Sahara"
-
-#. 232
-#: ../src/country.c:89
-msgid "Eritrea"
-msgstr "Eritrea"
-
-#. 724
-#: ../src/country.c:90
-msgid "Spain"
-msgstr "Spania"
-
-#. 231
-#: ../src/country.c:91
-msgid "Ethiopia"
-msgstr "Etiopia"
-
-#. 246
-#: ../src/country.c:92
-msgid "Finland"
-msgstr "Finnland"
-
-#. 242
-#: ../src/country.c:93
-msgid "Fiji"
-msgstr "Fiji"
-
-#. 238
-#: ../src/country.c:94
-msgid "Falkland Islands (Malvinas)"
-msgstr "Falklandsøyene"
-
-#. 583
-#: ../src/country.c:95
-msgid "Micronesia, Federated States of"
-msgstr "Mikronesia"
-
-#. 234
-#: ../src/country.c:96
-msgid "Faroe Islands"
-msgstr "Færøyene"
-
-#. 250
-#: ../src/country.c:97
-msgid "France"
-msgstr "Frankrike"
-
-#. 266
-#: ../src/country.c:98
-msgid "Gabon"
-msgstr "Gabon"
-
-#. 826
-#: ../src/country.c:99
-msgid "United Kingdom"
-msgstr "Storbritannia"
-
-#. 308
-#: ../src/country.c:100
-msgid "Grenada"
-msgstr "Grenada"
-
-#. 268
-#: ../src/country.c:101
-msgid "Georgia"
-msgstr "Georgia"
-
-#. 254
-#: ../src/country.c:102
-msgid "French Guiana"
-msgstr "Fransk Guyana"
-
-#. 831
-#: ../src/country.c:103
-msgid "Guernsey"
-msgstr "Guernsey"
-
-#. 288
-#: ../src/country.c:104
-msgid "Ghana"
-msgstr "Ghana"
-
-#. 292
-#: ../src/country.c:105
-msgid "Gibraltar"
-msgstr "Gibraltar"
-
-#. 304
-#: ../src/country.c:106
-msgid "Greenland"
-msgstr "Grønland"
-
-#. 270
-#: ../src/country.c:107
-msgid "Gambia"
-msgstr "Gambia"
-
-#. 324
-#: ../src/country.c:108
-msgid "Guinea"
-msgstr "Guinea"
-
-#. 312
-#: ../src/country.c:109
-msgid "Guadeloupe"
-msgstr "Guadeloupe"
-
-#. 226
-#: ../src/country.c:110
-msgid "Equatorial Guinea"
-msgstr "Ekvatorial-Guinea"
-
-#. 300
-#: ../src/country.c:111
-msgid "Greece"
-msgstr "Hellas"
-
-#. 239
-#: ../src/country.c:112
-msgid "South Georgia and the South Sandwich Islands"
-msgstr "Sør-Georgia og Sør-Sandwichøyene"
-
-#. 320
-#: ../src/country.c:113
-msgid "Guatemala"
-msgstr "Guatemala"
-
-#. 316
-#: ../src/country.c:114
-msgid "Guam"
-msgstr "Guam"
-
-#. 624
-#: ../src/country.c:115
-msgid "Guinea-Bissau"
-msgstr "Guinea-Bissau"
-
-#. 328
-#: ../src/country.c:116
-msgid "Guyana"
-msgstr "Guyana"
-
-#. 344
-#: ../src/country.c:117
-msgid "Hong Kong"
-msgstr "Hong Kong"
-
-#. 334
-#: ../src/country.c:118
-msgid "Heard Island and McDonald Islands"
-msgstr "Heard- og McDonald-øyene"
-
-#. 340
-#: ../src/country.c:119
-msgid "Honduras"
-msgstr "Honduras"
-
-#. 191
-#: ../src/country.c:120
-msgid "Croatia"
-msgstr "Kroatia"
-
-#. 332
-#: ../src/country.c:121
-msgid "Haiti"
-msgstr "Haiti"
-
-#. 348
-#: ../src/country.c:122
-msgid "Hungary"
-msgstr "Ungarn"
-
-#. 360
-#: ../src/country.c:123
-msgid "Indonesia"
-msgstr "Indonesia"
-
-#. 372
-#: ../src/country.c:124
-msgid "Ireland"
-msgstr "Irland"
-
-#. 376
-#: ../src/country.c:125
-msgid "Israel"
-msgstr "Israel"
-
-#. 833
-#: ../src/country.c:126
-msgid "Isle of Man"
-msgstr "Man"
-
-#. 356
-#: ../src/country.c:127
-msgid "India"
-msgstr "India"
-
-#. 086
-#: ../src/country.c:128
-msgid "British Indian Ocean Territory"
-msgstr "Det britiske territoriet i Indiahavet"
-
-#. 368
-#: ../src/country.c:129
-msgid "Iraq"
-msgstr "Irak"
-
-#. 364
-#: ../src/country.c:130
-msgid "Iran, Islamic Republic of"
-msgstr "Iran"
-
-#. 352
-#: ../src/country.c:131
-msgid "Iceland"
-msgstr "Island"
-
-#. 380
-#: ../src/country.c:132
-msgid "Italy"
-msgstr "Italia"
-
-#. 832
-#: ../src/country.c:133
-msgid "Jersey"
-msgstr "Jersey"
-
-#. 388
-#: ../src/country.c:134
-msgid "Jamaica"
-msgstr "Jamaica"
-
-#. 400
-#: ../src/country.c:135
-msgid "Jordan"
-msgstr "Jordan"
-
-#. 392
-#: ../src/country.c:136
-msgid "Japan"
-msgstr "Japan"
-
-#. 404
-#: ../src/country.c:137
-msgid "Kenya"
-msgstr "Kenya"
-
-#. 417
-#: ../src/country.c:138
-msgid "Kyrgyzstan"
-msgstr "Kirgisistan"
-
-#. 116
-#: ../src/country.c:139
-msgid "Cambodia"
-msgstr "Kambodsja"
-
-#. 296
-#: ../src/country.c:140
-msgid "Kiribati"
-msgstr "Kiribati"
-
-#. 174
-#: ../src/country.c:141
-msgid "Comoros"
-msgstr "Komorene"
-
-#. 659
-#: ../src/country.c:142
-msgid "Saint Kitts and Nevis"
-msgstr "Saint Kitts og Nevis"
-
-#. 408
-#: ../src/country.c:143
-msgid "Korea, Democratic People's Republic of"
-msgstr "Nord-Korea"
-
-#. 410
-#: ../src/country.c:144
-msgid "Korea, Republic of"
-msgstr "Sør-Korea"
-
-#. 414
-#: ../src/country.c:145
-msgid "Kuwait"
-msgstr "Kuwait"
-
-#. 136
-#: ../src/country.c:146
-msgid "Cayman Islands"
-msgstr "Caymanøyene"
-
-#. 398
-#: ../src/country.c:147
-msgid "Kazakhstan"
-msgstr "Kazakhstan"
-
-#. 418
-#: ../src/country.c:148
-msgid "Lao People's Democratic Republic"
-msgstr "Laos"
-
-#. 422
-#: ../src/country.c:149
-msgid "Lebanon"
-msgstr "Libanon"
-
-#. 662
-#: ../src/country.c:150
-msgid "Saint Lucia"
-msgstr "Saint Lucia"
-
-#. 438
-#: ../src/country.c:151
-msgid "Liechtenstein"
-msgstr "Lichtenstein"
-
-#. 144
-#: ../src/country.c:152
-msgid "Sri Lanka"
-msgstr "Sri Lanka"
-
-#. 430
-#: ../src/country.c:153
-msgid "Liberia"
-msgstr "Liberia"
-
-#. 426
-#: ../src/country.c:154
-msgid "Lesotho"
-msgstr "Lesotho"
-
-#. 440
-#: ../src/country.c:155
-msgid "Lithuania"
-msgstr "Litauen"
-
-#. 442
-#: ../src/country.c:156
-msgid "Luxembourg"
-msgstr "Luxembourg"
-
-#. 428
-#: ../src/country.c:157
-msgid "Latvia"
-msgstr "Latvia"
-
-#. 434
-#: ../src/country.c:158
-msgid "Libyan Arab Jamahiriya"
-msgstr "Libya"
-
-#. 504
-#: ../src/country.c:159
-msgid "Morocco"
-msgstr "Marokko"
-
-#. 492
-#: ../src/country.c:160
-msgid "Monaco"
-msgstr "Monaco"
-
-#. 498
-#: ../src/country.c:161
-msgid "Moldova, Republic of"
-msgstr "Moldova"
-
-#. 499
-#: ../src/country.c:162
-msgid "Montenegro"
-msgstr "Montenegro"
-
-#. 663
-#: ../src/country.c:163
-msgid "Saint Martin (French part)"
-msgstr "Saint Martin (Fransk del)"
-
-#. 450
-#: ../src/country.c:164
-msgid "Madagascar"
-msgstr "Madagascar"
-
-#. 584
-#: ../src/country.c:165
-msgid "Marshall Islands"
-msgstr "Marshalløyene"
-
-#. 807
-#: ../src/country.c:166
-msgid "Macedonia, the former Yugoslav Republic of"
-msgstr "Makedonia"
-
-#. 466
-#: ../src/country.c:167
-msgid "Mali"
-msgstr "Mali"
-
-#. 104
-#: ../src/country.c:168
-msgid "Myanmar"
-msgstr "Burma"
-
-#. 496
-#: ../src/country.c:169
-msgid "Mongolia"
-msgstr "Mongolia"
-
-#. 446
-#: ../src/country.c:170
-msgid "Macao"
-msgstr "Macao"
-
-#. 580
-#: ../src/country.c:171
-msgid "Northern Mariana Islands"
-msgstr "Nord-Marianene"
-
-#. 474
-#: ../src/country.c:172
-msgid "Martinique"
-msgstr "Martinique"
-
-#. 478
-#: ../src/country.c:173
-msgid "Mauritania"
-msgstr "Mauritania"
-
-#. 500
-#: ../src/country.c:174
-msgid "Montserrat"
-msgstr "Montserrat"
-
-#. 470
-#: ../src/country.c:175
-msgid "Malta"
-msgstr "Malta"
-
-#. 480
-#: ../src/country.c:176
-msgid "Mauritius"
-msgstr "Mauritius"
-
-#. 462
-#: ../src/country.c:177
-msgid "Maldives"
-msgstr "Maldivene"
-
-#. 454
-#: ../src/country.c:178
-msgid "Malawi"
-msgstr "Malawi"
-
-#. 484
-#: ../src/country.c:179
-msgid "Mexico"
-msgstr "Mexico"
-
-#. 458
-#: ../src/country.c:180
-msgid "Malaysia"
-msgstr "Malaysia"
-
-#. 508
-#: ../src/country.c:181
-msgid "Mozambique"
-msgstr "Mosambik"
-
-#. 516
-#: ../src/country.c:182
-msgid "Namibia"
-msgstr "Namibia"
-
-#. 540
-#: ../src/country.c:183
-msgid "New Caledonia"
-msgstr "Ny-Caledonia"
-
-#. 562
-#: ../src/country.c:184
-msgid "Niger"
-msgstr "Niger"
-
-#. 574
-#: ../src/country.c:185
-msgid "Norfolk Island"
-msgstr "Norfolkøya"
-
-#. 566
-#: ../src/country.c:186
-msgid "Nigeria"
-msgstr "Nigeria"
-
-#. 558
-#: ../src/country.c:187
-msgid "Nicaragua"
-msgstr "Nicaragua"
-
-#. 528
-#: ../src/country.c:188
-msgid "Netherlands"
-msgstr "Nederland"
-
-#. 578
-#: ../src/country.c:189
-msgid "Norway"
-msgstr "Norge"
-
-#. 524
-#: ../src/country.c:190
-msgid "Nepal"
-msgstr "Nepal"
-
-#. 520
-#: ../src/country.c:191
-msgid "Nauru"
-msgstr "Nauru"
-
-#. 570
-#: ../src/country.c:192
-msgid "Niue"
-msgstr "Niue"
-
-#. 554
-#: ../src/country.c:193
-msgid "New Zealand"
-msgstr "New Zealand"
-
-#. 512
-#: ../src/country.c:194
-msgid "Oman"
-msgstr "Oman"
-
-#. 591
-#: ../src/country.c:195
-msgid "Panama"
-msgstr "Panama"
-
-#. 604
-#: ../src/country.c:196
-msgid "Peru"
-msgstr "Peru"
-
-#. 258
-#: ../src/country.c:197
-msgid "French Polynesia"
-msgstr "Fransk Polynesia"
-
-#. 598
-#: ../src/country.c:198
-msgid "Papua New Guinea"
-msgstr "Papua Ny-Guinea"
-
-#. 608
-#: ../src/country.c:199
-msgid "Philippines"
-msgstr "Filippinene"
-
-#. 586
-#: ../src/country.c:200
-msgid "Pakistan"
-msgstr "Pakistan"
-
-#. 616
-#: ../src/country.c:201
-msgid "Poland"
-msgstr "Polen"
-
-#. 666
-#: ../src/country.c:202
-msgid "Saint Pierre and Miquelon"
-msgstr "Saint-Pierre og Miquelon"
-
-#. 612
-#: ../src/country.c:203
-msgid "Pitcairn"
-msgstr "Pitcairnøyene"
-
-#. 630
-#: ../src/country.c:204
-msgid "Puerto Rico"
-msgstr "Puerto Rico"
-
-#. 275
-#: ../src/country.c:205
-msgid "Palestinian Territory, Occupied"
-msgstr "Palestinia"
-
-#. 620
-#: ../src/country.c:206
-msgid "Portugal"
-msgstr "Portugal"
-
-#. 585
-#: ../src/country.c:207
-msgid "Palau"
-msgstr "Palau"
-
-#. 600
-#: ../src/country.c:208
-msgid "Paraguay"
-msgstr "Paraguay"
-
-#. 634
-#: ../src/country.c:209
-msgid "Qatar"
-msgstr "Qatar"
-
-#. 638
-#: ../src/country.c:210
-msgid "Reunion"
-msgstr "Reunion"
-
-#. 642
-#: ../src/country.c:211
-msgid "Romania"
-msgstr "Romania"
-
-#. 688
-#: ../src/country.c:212
-msgid "Serbia"
-msgstr "Serbia"
-
-#. 643
-#: ../src/country.c:213
-msgid "Russian Federation"
-msgstr "Russland"
-
-#. 646
-#: ../src/country.c:214
-msgid "Rwanda"
-msgstr "Rwanda"
-
-#. 682
-#: ../src/country.c:215
-msgid "Saudi Arabia"
-msgstr "Saudi-Arabia"
-
-#. 090
-#: ../src/country.c:216
-msgid "Solomon Islands"
-msgstr "Salomonøyene"
-
-#. 690
-#: ../src/country.c:217
-msgid "Seychelles"
-msgstr "Seychellene"
-
-#. 736
-#: ../src/country.c:218
-msgid "Sudan"
-msgstr "Sudan"
-
-#. 752
-#: ../src/country.c:219
-msgid "Sweden"
-msgstr "Sverige"
-
-#. 702
-#: ../src/country.c:220
-msgid "Singapore"
-msgstr "Singapore"
-
-#. 654
-#: ../src/country.c:221
-msgid "Saint Helena"
-msgstr "Saint Helena"
-
-#. 705
-#: ../src/country.c:222
-msgid "Slovenia"
-msgstr "Slovenia"
-
-#. 744
-#: ../src/country.c:223
-msgid "Svalbard and Jan Mayen"
-msgstr "Svalbard og Jan Mayen"
-
-#. 703
-#: ../src/country.c:224
-msgid "Slovakia"
-msgstr "Slovakia"
-
-#. 694
-#: ../src/country.c:225
-msgid "Sierra Leone"
-msgstr "Sierra Leone"
-
-#. 674
-#: ../src/country.c:226
-msgid "San Marino"
-msgstr "San Marino"
-
-#. 686
-#: ../src/country.c:227
-msgid "Senegal"
-msgstr "Senegal"
-
-#. 706
-#: ../src/country.c:228
-msgid "Somalia"
-msgstr "Somalia"
-
-#. 740
-#: ../src/country.c:229
-msgid "Suriname"
-msgstr "Surinam"
-
-#. 678
-#: ../src/country.c:230
-msgid "Sao Tome and Principe"
-msgstr "Sao Tome and Principe"
-
-#. 222
-#: ../src/country.c:231
-msgid "El Salvador"
-msgstr "El Salvador"
-
-#. 760
-#: ../src/country.c:232
-msgid "Syrian Arab Republic"
-msgstr "Syria"
-
-#. 748
-#: ../src/country.c:233
-msgid "Swaziland"
-msgstr "Swaziland"
-
-#. 796
-#: ../src/country.c:234
-msgid "Turks and Caicos Islands"
-msgstr "Turks- og Caicosøyene"
-
-#. 148
-#: ../src/country.c:235
-msgid "Chad"
-msgstr "Tsjad"
-
-#. 260
-#: ../src/country.c:236
-msgid "French Southern Territories"
-msgstr "De franske sørterritorier"
-
-#. 768
-#: ../src/country.c:237
-msgid "Togo"
-msgstr "Togo"
-
-#. 764
-#: ../src/country.c:238
-msgid "Thailand"
-msgstr "Thailand"
-
-#. 762
-#: ../src/country.c:239
-msgid "Tajikistan"
-msgstr "Tajikistan"
-
-#. 772
-#: ../src/country.c:240
-msgid "Tokelau"
-msgstr "Tokelau"
-
-#. 626
-#: ../src/country.c:241
-msgid "Timor-Leste"
-msgstr "Øst-Timor"
-
-#. 795
-#: ../src/country.c:242
-msgid "Turkmenistan"
-msgstr "Turkmenistan"
-
-#. 788
-#: ../src/country.c:243
-msgid "Tunisia"
-msgstr "Tunisia"
-
-#. 776
-#: ../src/country.c:244
-msgid "Tonga"
-msgstr "Tonga"
-
-#. 792
-#: ../src/country.c:245
-msgid "Turkey"
-msgstr "Tyrkia"
-
-#. 780
-#: ../src/country.c:246
-msgid "Trinidad and Tobago"
-msgstr "Trinidad og Tobago"
-
-#. 798
-#: ../src/country.c:247
-msgid "Tuvalu"
-msgstr "Tuvalu"
-
-#. 158
-#: ../src/country.c:248
-msgid "Taiwan, Province of China"
-msgstr "Taiwan, Provins av Kina"
-
-#. 834
-#: ../src/country.c:249
-msgid "Tanzania, United Republic of"
-msgstr "Tanzania, Den forente republikken"
-
-#. 804
-#: ../src/country.c:250
-msgid "Ukraine"
-msgstr "Ukraina"
-
-#. 800
-#: ../src/country.c:251
-msgid "Uganda"
-msgstr "Uganda"
-
-#. 581
-#: ../src/country.c:252
-msgid "United States Minor Outlying Islands"
-msgstr "De forente staters små fjerntliggende øyer"
-
-#. 840
-#: ../src/country.c:253
-msgid "United States"
-msgstr "Amerikas forente stater"
-
-#. 858
-#: ../src/country.c:254
-msgid "Uruguay"
-msgstr "Uruguay"
-
-#. 860
-#: ../src/country.c:255
-msgid "Uzbekistan"
-msgstr "Usbekistan"
-
-#. 336
-#: ../src/country.c:256
-msgid "Holy See (Vatican City State)"
-msgstr "Vatikanstaten"
-
-#. 670
-#: ../src/country.c:257
-msgid "Saint Vincent and the Grenadines"
-msgstr "Saint Vincent og Grenadinene"
-
-#. 862
-#: ../src/country.c:258
-msgid "Venezuela"
-msgstr "Venezuela"
-
-#. 092
-#: ../src/country.c:259
-msgid "Virgin Islands, British"
-msgstr "Jomfruøyene, De britiske"
-
-#. 850
-#: ../src/country.c:260
-msgid "Virgin Islands, U.S."
-msgstr "Jomfruøyene, De amerikanske"
-
-#. 704
-#: ../src/country.c:261
-msgid "Viet Nam"
-msgstr "Vietnam"
-
-#. 548
-#: ../src/country.c:262
-msgid "Vanuatu"
-msgstr "Vanuatu"
-
-#. 876
-#: ../src/country.c:263
-msgid "Wallis and Futuna"
-msgstr "Wallis- og Futunaøyene"
-
-#. 882
-#: ../src/country.c:264
-msgid "Samoa"
-msgstr "Samoa"
-
-#. 887
-#: ../src/country.c:265
-msgid "Yemen"
-msgstr "Yemen"
-
-#. 175
-#: ../src/country.c:266
-msgid "Mayotte"
-msgstr "Mayotte"
-
-#. 710
-#: ../src/country.c:267
-msgid "South Africa"
-msgstr "Sør-Afrika"
-
-#. 894
-#: ../src/country.c:268
-msgid "Zambia"
-msgstr "Zambia"
-
-#. 716
-#: ../src/country.c:269
-msgid "Zimbabwe"
-msgstr "Zimbabwe"
-
-#: ../src/gui/gtk/destination.c:96 ../src/gui/gtk/destination.c:97
-#: ../src/gui/gtk/destination.c:98 ../src/gui/gtk/destination.c:99
-msgid "Car"
-msgstr "Bil"
-
-#: ../src/gui/gtk/destination.c:96
-msgid "Iso2"
-msgstr "Iso2"
-
-#: ../src/gui/gtk/destination.c:96
-msgid "Iso3"
-msgstr "Iso3"
-
-#: ../src/gui/gtk/destination.c:96 ../src/gui/gtk/destination.c:334
-msgid "Country"
-msgstr "Land"
-
-#: ../src/gui/gtk/destination.c:97 ../src/gui/gtk/destination.c:98
-#: ../src/gui/gtk/destination.c:99
-msgid "Postal"
-msgstr "Post"
-
-#: ../src/gui/gtk/destination.c:97 ../src/gui/gtk/destination.c:98
-#: ../src/gui/gtk/destination.c:99
-msgid "Town"
-msgstr "By"
-
-#: ../src/gui/gtk/destination.c:97 ../src/gui/gtk/destination.c:98
-#: ../src/gui/gtk/destination.c:99
-msgid "District"
-msgstr "Distrikt/Kommune"
-
-#: ../src/gui/gtk/destination.c:98 ../src/gui/gtk/destination.c:99
-#: ../src/gui/gtk/destination.c:343
-msgid "Street"
-msgstr "Gate"
-
-#: ../src/gui/gtk/destination.c:99 ../src/gui/gtk/destination.c:345
-msgid "Number"
-msgstr "Nummer"
-
-#: ../src/gui/gtk/destination.c:329
-msgid "Enter Destination"
-msgstr "Oppgi reisemålet"
-
-#: ../src/gui/gtk/destination.c:336
-msgid "Zip Code"
-msgstr "Postnummer"
-
-#: ../src/gui/gtk/destination.c:338
-msgid "City"
-msgstr "By"
-
-#: ../src/gui/gtk/destination.c:340
-msgid "District/Township"
-msgstr "Distrikt/Kommune"
-
-#: ../src/gui/gtk/destination.c:369
-msgid "Bookmark"
-msgstr "Bokmerke"
-
-#: ../src/gui/gtk/destination.c:370 ../src/gui/gtk/gui_gtk_action.c:208
-msgid "Destination"
-msgstr "Destinasjon"
-
-#: ../src/gui/gtk/gui_gtk_action.c:195
-msgid "Display"
-msgstr "Display"
-
-#: ../src/gui/gtk/gui_gtk_action.c:199
-msgid "ZoomOut"
-msgstr "ZoomUt"
-
-#: ../src/gui/gtk/gui_gtk_action.c:200
-msgid "ZoomIn"
-msgstr "ZoomInn"
-
-#: ../src/gui/gtk/gui_gtk_action.c:201
-msgid "Refresh"
-msgstr "Oppdater"
-
-#: ../src/gui/gtk/gui_gtk_action.c:204 ../src/gui/gtk/gui_gtk_action.c:206
-msgid "Info"
-msgstr "Info"
-
-#: ../src/gui/gtk/gui_gtk_action.c:209
-msgid "Clear"
-msgstr "Fjern"
-
-#: ../src/gui/gtk/gui_gtk_action.c:210
-msgid "Test"
-msgstr "Test"
-
-#: ../src/gui/gtk/gui_gtk_action.c:211
-msgid "_Quit"
-msgstr "Avslutt"
-
-#: ../src/gui/gtk/gui_gtk_action.c:218
-msgid "Cursor"
-msgstr "Markør"
-
-#: ../src/gui/gtk/gui_gtk_action.c:219
-msgid "Tracking"
-msgstr "Sporing"
-
-#: ../src/gui/gtk/gui_gtk_action.c:220
-msgid "Orientation"
-msgstr "Orientering"
-
-#: ../src/gui/gtk/gui_gtk_action.c:222 ../src/gui/gtk/gui_gtk_action.c:224
-msgid "Fullscreen"
-msgstr "Fullskjerm"
-
-#: ../src/gui/gtk/gui_gtk_action.c:232
-msgid "Data"
-msgstr "Data"
-
-#: ../src/gui/gtk/gui_gtk_action.c:233
-msgid "VisibleBlocks"
-msgstr "Synlige blokker"
-
-#: ../src/gui/gtk/gui_gtk_action.c:234
-msgid "VisibleTowns"
-msgstr "Synlige byer"
-
-#: ../src/gui/gtk/gui_gtk_action.c:235
-msgid "VisiblePolys"
-msgstr "Synlige polygon"
-
-#: ../src/gui/gtk/gui_gtk_action.c:236
-msgid "VisibleStreets"
-msgstr "Synlige gater"
-
-#: ../src/gui/gtk/gui_gtk_action.c:237
-msgid "VisiblePoints"
-msgstr "Synlige punkt"
-
-#: ../src/gui/gtk/gui_gtk_statusbar.c:48 ../src/gui/gtk/gui_gtk_statusbar.c:83
-msgid "N"
-msgstr "N"
-
-#: ../src/gui/gtk/gui_gtk_statusbar.c:48 ../src/gui/gtk/gui_gtk_statusbar.c:83
-msgid "NE"
-msgstr "NØ"
-
-#: ../src/gui/gtk/gui_gtk_statusbar.c:48 ../src/gui/gtk/gui_gtk_statusbar.c:83
-msgid "E"
-msgstr "Ø"
-
-#: ../src/gui/gtk/gui_gtk_statusbar.c:48 ../src/gui/gtk/gui_gtk_statusbar.c:83
-msgid "SE"
-msgstr "SØ"
-
-#: ../src/gui/gtk/gui_gtk_statusbar.c:48 ../src/gui/gtk/gui_gtk_statusbar.c:83
-msgid "S"
-msgstr "S"
-
-#: ../src/gui/gtk/gui_gtk_statusbar.c:48 ../src/gui/gtk/gui_gtk_statusbar.c:83
-msgid "SW"
-msgstr "SV"
-
-#: ../src/gui/gtk/gui_gtk_statusbar.c:48 ../src/gui/gtk/gui_gtk_statusbar.c:83
-msgid "W"
-msgstr "V"
-
-#: ../src/gui/gtk/gui_gtk_statusbar.c:48 ../src/gui/gtk/gui_gtk_statusbar.c:83
-msgid "NW"
-msgstr "NV"
-
-#: ../src/gui/gtk/gui_gtk_statusbar.c:105
-#, c-format
-msgid "Route %4.0fkm %02d:%02d ETA"
-msgstr "Rute %4.0fkm %02d:%02d ETA"
-
-#: ../src/gui/gtk/gui_gtk_statusbar.c:156
-msgid "Route 0000km 0+00:00 ETA"
-msgstr "Rute 0000km 0+00:00 ETA"
-
-#~ msgid "Moldova"
-#~ msgstr "Moldova"
-
-#~ msgid "Palestinia"
-#~ msgstr "Palestina"
-
-#~ msgid "RouteGraph"
-#~ msgstr "Rutegraf"
-
-#~ msgid "two kilometers"
-#~ msgstr "to kilometer"
-
-#~ msgid "in two kilometers"
-#~ msgstr "om to Kilometer"
-
-#~ msgid "three kilometers"
-#~ msgstr "tre kilometer"
-
-#~ msgid "in three kilometers"
-#~ msgstr "om tre kilometer"
-
-#~ msgid "four kilometers"
-#~ msgstr "fire kilometer"
-
-#~ msgid "in four kilometers"
-#~ msgstr "om fire kilometer"
-
-#~ msgid "%d kilometers"
-#~ msgstr "%d kilometer"
-
-#~ msgid "in %d kilometers"
-#~ msgstr "om %d kilometer"
-
-#~ msgid "strength_pos"
-#~ msgstr "2"
-
-#~ msgid "direction_pos"
-#~ msgstr "3"
-
-#~ msgid "distance_pos"
-#~ msgstr "1"
diff --git a/po/pl.po b/po/pl.po
deleted file mode 100644
index 36f6bd33..00000000
--- a/po/pl.po
+++ /dev/null
@@ -1,1755 +0,0 @@
-# Polish translations for navit.
-# Copyright (C) 2007.
-# This file is distributed under the same license as the Navit package.
-# Michael "Mineque" Madej <mineque@quanteam.pl>, 2007.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: Navit 0.1.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-05-26 17:12+0200\n"
-"PO-Revision-Date: 2008-05-29 21:34+0000\n"
-"Last-Translator: Mineque <Unknown>\n"
-"Language-Team: Translators\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
-"|| n%100>=20) ? 1 : 2;\n"
-"X-Launchpad-Export-Date: 2008-05-30 21:28+0000\n"
-"X-Generator: Launchpad (build Unknown)\n"
-"X-Poedit-Country: POLAND\n"
-"X-Poedit-Language: Polish\n"
-
-#, fuzzy
-#~ msgid "Turn %1$s%2$s %3$s"
-#~ msgstr "Skręć %s%s %s"
-
-#~ msgid "Moldova"
-#~ msgstr "Mołdawia"
-
-#~ msgid "Syria"
-#~ msgstr "Syria"
-
-#~ msgid "Libia"
-#~ msgstr "Libia"
-
-#~ msgid "Palestinia"
-#~ msgstr "Palestyna"
-
-#~ msgid "Macedonia"
-#~ msgstr "Macedonia"
-
-#~ msgid "VisibleBlocks"
-#~ msgstr "Widoczne bloki"
-
-#~ msgid "VisibleTowns"
-#~ msgstr "Widoczne miasta"
-
-#~ msgid "VisiblePolys"
-#~ msgstr "Widoczne poly"
-
-#~ msgid "VisibleStreets"
-#~ msgstr "Widoczne ulice"
-
-#~ msgid "VisiblePoints"
-#~ msgstr "Widoczne punkty"
-
-#, fuzzy
-#~ msgid "RouteGraph"
-#~ msgstr "Trasa"
-
-#~ msgid "two kilometers"
-#~ msgstr "dwa kilometry"
-
-#~ msgid "in two kilometers"
-#~ msgstr "za dwa kilometry"
-
-#~ msgid "three kilometers"
-#~ msgstr "trzy kilometry"
-
-#~ msgid "in three kilometers"
-#~ msgstr "za trzy kilometry"
-
-#~ msgid "four kilometers"
-#~ msgstr "cztery kilometry"
-
-#~ msgid "in four kilometers"
-#~ msgstr "za cztery kilometry"
-
-#~ msgid "%d kilometers"
-#~ msgstr "%d kilometrów"
-
-#~ msgid "in %d kilometers"
-#~ msgstr "za %d kilometrów"
-
-#~ msgid "strength_pos"
-#~ msgstr "siła_pos"
-
-#~ msgid "direction_pos"
-#~ msgstr "kierunek_pos"
-
-#~ msgid "distance_pos"
-#~ msgstr "odległość_pos"
-
-#: ../navit/main.c:111
-#, c-format
-msgid ""
-"navit usage:\n"
-"navit [options] [configfile]\n"
-"\t-c <file>: use <file> as config file\n"
-"\t-d <n>: set the debug output level to <n>. (TODO)\n"
-"\t-h: print this usage info and exit.\n"
-"\t-v: Print the version and exit.\n"
-msgstr ""
-
-#: ../navit/main.c:131
-#, c-format
-msgid "Running from source directory\n"
-msgstr "Uruchamiam z katalogu źródłowego\n"
-
-#: ../navit/main.c:147
-#, c-format
-msgid "setting '%s' to '%s'\n"
-msgstr ""
-
-#. We have not found an existing config file from all possibilities
-#: ../navit/main.c:248
-#, fuzzy, c-format
-msgid "No config file navit.xml, navit.xml.local found\n"
-msgstr "Nie znaleziono pliku navit.xml, został znaleziony navit.xml.local\n"
-
-#: ../navit/main.c:255
-#, c-format
-msgid "Error parsing '%s': %s\n"
-msgstr "BÅ‚Ä…d w trakcie przetwarzania '%s': %s\n"
-
-#: ../navit/main.c:258
-#, c-format
-msgid "Using '%s'\n"
-msgstr "Używam '%s'\n"
-
-#: ../navit/main.c:261
-#, c-format
-msgid "No instance has been created, exiting\n"
-msgstr "Brak instancji Navit, kończe\n"
-
-#: ../navit/navigation.c:171
-#, fuzzy, c-format
-msgid "%d m"
-msgstr "%d metrów"
-
-#: ../navit/navigation.c:173
-#, fuzzy, c-format
-msgid "in %d m"
-msgstr "za %d metrów"
-
-#: ../navit/navigation.c:177
-#, c-format
-msgid "%d meters"
-msgstr "%d metrów"
-
-#: ../navit/navigation.c:179
-#, c-format
-msgid "in %d meters"
-msgstr "za %d metrów"
-
-#: ../navit/navigation.c:185
-#, c-format
-msgid "%d.%d kilometer"
-msgstr "%d.%d kilometra"
-
-#: ../navit/navigation.c:187
-#, c-format
-msgid "in %d.%d kilometers"
-msgstr "za %d.%d kilometrów"
-
-#: ../navit/navigation.c:191
-#, fuzzy, c-format
-msgid "one kilometer"
-msgid_plural "%d kilometers"
-msgstr[0] "jeden kilometr"
-msgstr[1] "jeden kilometr"
-
-#: ../navit/navigation.c:193
-#, fuzzy, c-format
-msgid "in one kilometer"
-msgid_plural "in %d kilometers"
-msgstr[0] "za kilometr"
-msgstr[1] "za kilometr"
-
-#: ../navit/navigation.c:447
-msgid "exit"
-msgstr "wyjście"
-
-#: ../navit/navigation.c:449
-msgid "ramp"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name
-#: ../navit/navigation.c:479
-#, c-format
-msgid "%sinto the street %s%s%s"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Male form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:483
-#, c-format
-msgid "%sinto the %s%s%s|male form"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Female form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:487
-#, c-format
-msgid "%sinto the %s%s%s|female form"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Neutral form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:491
-#, c-format
-msgid "%sinto the %s%s%s|neutral form"
-msgstr ""
-
-#: ../navit/navigation.c:497
-#, c-format
-msgid "into the %s"
-msgstr ""
-
-#: ../navit/navigation.c:518
-msgid "right"
-msgstr "w prawo"
-
-#: ../navit/navigation.c:525
-msgid "left"
-msgstr "w lewo"
-
-#: ../navit/navigation.c:529
-msgid "easily "
-msgstr "Å‚atwo "
-
-#: ../navit/navigation.c:533
-msgid "strongly "
-msgstr "silnie "
-
-#: ../navit/navigation.c:536
-msgid "unknown "
-msgstr "nieznane "
-
-#: ../navit/navigation.c:542
-#, fuzzy
-msgid "When possible, please turn around"
-msgstr "Skręć gdy będzie możliwość"
-
-#: ../navit/navigation.c:549
-#, c-format
-msgid "Follow the road for the next %s"
-msgstr "Podążaj drogą przez następne %s"
-
-#: ../navit/navigation.c:553
-msgid "soon"
-msgstr "wkrótce"
-
-#: ../navit/navigation.c:559
-msgid "now"
-msgstr "teraz"
-
-#: ../navit/navigation.c:562
-msgid "error"
-msgstr "błąd"
-
-#. TRANSLATORS: The first argument is strength, the second direction, the third distance and the fourth destination Example: 'Turn 'slightly' 'left' in '100 m' 'onto baker street'
-#: ../navit/navigation.c:591
-#, c-format
-msgid "Turn %1$s%2$s %3$s%4$s"
-msgstr ""
-
-#: ../navit/navigation.c:594
-#, c-format
-msgid "You have reached your destination %s"
-msgstr "Dotarłeś do celu %s"
-
-#: ../navit/navit.c:664 ../navit/gui/gtk/gui_gtk_action.c:151
-#, fuzzy
-msgid "Former Destinations"
-msgstr "Cel"
-
-#: ../navit/navit.c:674 ../navit/gui/gtk/gui_gtk_action.c:152
-msgid "Bookmarks"
-msgstr "Zakładki"
-
-#: ../navit/navit.c:764
-#, fuzzy
-msgid "Command"
-msgstr "Polska"
-
-#: ../navit/navit.c:769
-msgid "Length"
-msgstr ""
-
-#: ../navit/navit.c:773 ../navit/navit.c:798
-msgid "km"
-msgstr "km"
-
-#: ../navit/navit.c:777 ../navit/navit.c:802
-msgid "m"
-msgstr "m"
-
-#: ../navit/navit.c:783
-msgid "Time"
-msgstr ""
-
-#: ../navit/navit.c:795
-msgid "Destination Length"
-msgstr "Odległość do celu"
-
-#: ../navit/navit.c:808
-#, fuzzy
-msgid "Destination Time"
-msgstr "Czas do celu"
-
-#: ../navit/navit.c:837 ../navit/gui/gtk/gui_gtk_action.c:160
-msgid "Roadbook"
-msgstr "Szczegóły trasy"
-
-#: ../navit/popup.c:200 ../navit/popup.c:254
-msgid "Set as position"
-msgstr "Ustaw jako pozycjÄ™"
-
-#: ../navit/popup.c:201 ../navit/popup.c:255
-#, fuzzy
-msgid "Set as destination"
-msgstr "Cel"
-
-#: ../navit/popup.c:202 ../navit/popup.c:256
-msgid "Add as bookmark"
-msgstr "Dodaj jako zakładkę"
-
-#: ../navit/popup.c:244
-#, c-format
-msgid "Point 0x%x 0x%x"
-msgstr "Punkt 0x%x 0x%x"
-
-#: ../navit/popup.c:245
-#, c-format
-msgid "Screen coord : %d %d"
-msgstr ""
-
-#. 020
-#: ../navit/country.c:24
-msgid "Andorra"
-msgstr "Andora"
-
-#. 784
-#: ../navit/country.c:25
-msgid "United Arab Emirates"
-msgstr "Zjednoczone Emiraty Arabskie"
-
-#. 004
-#: ../navit/country.c:26
-msgid "Afghanistan"
-msgstr "Afganistan"
-
-#. 028
-#: ../navit/country.c:27
-msgid "Antigua and Barbuda"
-msgstr "Antigua i Barbuda"
-
-#. 660
-#: ../navit/country.c:28
-msgid "Anguilla"
-msgstr "Anguilla"
-
-#. 008
-#: ../navit/country.c:29
-msgid "Albania"
-msgstr "Albania"
-
-#. 051
-#: ../navit/country.c:30
-msgid "Armenia"
-msgstr "Armenia"
-
-#. 530
-#: ../navit/country.c:31
-msgid "Netherlands Antilles"
-msgstr "Antyle Holenderskie"
-
-#. 024
-#: ../navit/country.c:32
-msgid "Angola"
-msgstr "Angola"
-
-#. 010
-#: ../navit/country.c:33
-msgid "Antarctica"
-msgstr "Antarktyka"
-
-#. 032
-#: ../navit/country.c:34
-msgid "Argentina"
-msgstr "Argentyna"
-
-#. 016
-#: ../navit/country.c:35
-msgid "American Samoa"
-msgstr "Samoa Amerykańskie"
-
-#. 040
-#: ../navit/country.c:36
-msgid "Austria"
-msgstr "Austria"
-
-#. 036
-#: ../navit/country.c:37
-msgid "Australia"
-msgstr "Australia"
-
-#. 533
-#: ../navit/country.c:38
-msgid "Aruba"
-msgstr "Aruba"
-
-#. 248
-#: ../navit/country.c:39
-msgid "Aland Islands"
-msgstr "Wyspy Alandzkie"
-
-#. 031
-#: ../navit/country.c:40
-msgid "Azerbaijan"
-msgstr "Azerbejdżan"
-
-#. 070
-#: ../navit/country.c:41
-msgid "Bosnia and Herzegovina"
-msgstr "Bośnia i Hercegowina"
-
-#. 052
-#: ../navit/country.c:42
-msgid "Barbados"
-msgstr "Barbados"
-
-#. 050
-#: ../navit/country.c:43
-msgid "Bangladesh"
-msgstr "Bangladesz"
-
-#. 056
-#: ../navit/country.c:44
-msgid "Belgium"
-msgstr "Belgia"
-
-#. 854
-#: ../navit/country.c:45
-msgid "Burkina Faso"
-msgstr "Burkina Faso"
-
-#. 100
-#: ../navit/country.c:46
-msgid "Bulgaria"
-msgstr "Bułgaria"
-
-#. 048
-#: ../navit/country.c:47
-msgid "Bahrain"
-msgstr "Bahrajn"
-
-#. 108
-#: ../navit/country.c:48
-msgid "Burundi"
-msgstr "Republika Burundi"
-
-#. 204
-#: ../navit/country.c:49
-msgid "Benin"
-msgstr "Pekin"
-
-#. 652
-#: ../navit/country.c:50
-msgid "Saint Barthelemy"
-msgstr "Saint-Barthélemy"
-
-#. 060
-#: ../navit/country.c:51
-msgid "Bermuda"
-msgstr "Bermudy"
-
-#. 096
-#: ../navit/country.c:52
-msgid "Brunei Darussalam"
-msgstr "Państwo Brunei Siedziba Pokoju"
-
-#. 068
-#: ../navit/country.c:53
-msgid "Bolivia"
-msgstr "Boliwia"
-
-#. 076
-#: ../navit/country.c:54
-msgid "Brazil"
-msgstr "Brazylia"
-
-#. 044
-#: ../navit/country.c:55
-msgid "Bahamas"
-msgstr "Bahamy"
-
-#. 064
-#: ../navit/country.c:56
-msgid "Bhutan"
-msgstr "Bhutan"
-
-#. 074
-#: ../navit/country.c:57
-msgid "Bouvet Island"
-msgstr "Wyspa Bouveta"
-
-#. 072
-#: ../navit/country.c:58
-msgid "Botswana"
-msgstr "Botswana"
-
-#. 112
-#: ../navit/country.c:59
-msgid "Belarus"
-msgstr "Białoruś"
-
-#. 084
-#: ../navit/country.c:60
-msgid "Belize"
-msgstr "Belize"
-
-#. 124
-#: ../navit/country.c:61
-msgid "Canada"
-msgstr "Kanada"
-
-#. 166
-#: ../navit/country.c:62
-msgid "Cocos (Keeling) Islands"
-msgstr "Wyspy Kokosowe (Keelinga)"
-
-#. 180
-#: ../navit/country.c:63
-msgid "Congo, Democratic Republic of the"
-msgstr "Demokratyczna Republika Konga"
-
-#. 140
-#: ../navit/country.c:64
-msgid "Central African Republic"
-msgstr "Republika Åšrodkowej Afryki"
-
-#. 178
-#: ../navit/country.c:65
-msgid "Congo"
-msgstr "Kongo"
-
-#. 756
-#: ../navit/country.c:66
-msgid "Switzerland"
-msgstr "Szwajcaria"
-
-#. 384
-#: ../navit/country.c:67
-msgid "Cote d'Ivoire"
-msgstr "Wybrzeże Kości Słoniowej"
-
-#. 184
-#: ../navit/country.c:68
-msgid "Cook Islands"
-msgstr "Wyspy Cook'a"
-
-#. 152
-#: ../navit/country.c:69
-msgid "Chile"
-msgstr "Chile"
-
-#. 120
-#: ../navit/country.c:70
-msgid "Cameroon"
-msgstr "Kamerun"
-
-#. 156
-#: ../navit/country.c:71
-msgid "China"
-msgstr "Chiny"
-
-#. 170
-#: ../navit/country.c:72
-msgid "Colombia"
-msgstr "Kolumbia"
-
-#. 188
-#: ../navit/country.c:73
-msgid "Costa Rica"
-msgstr "Kostaryka"
-
-#. 192
-#: ../navit/country.c:74
-msgid "Cuba"
-msgstr "Kuba"
-
-#. 132
-#: ../navit/country.c:75
-msgid "Cape Verde"
-msgstr "Zielony PrzylÄ…dek"
-
-#. 162
-#: ../navit/country.c:76
-msgid "Christmas Island"
-msgstr "Wyspy Bożego Narodzenia"
-
-#. 196
-#: ../navit/country.c:77
-msgid "Cyprus"
-msgstr "Cypr"
-
-#. 203
-#: ../navit/country.c:78
-msgid "Czech Republic"
-msgstr "Republika Czeska"
-
-#. 276
-#: ../navit/country.c:79
-msgid "Germany"
-msgstr "Niemcy"
-
-#. 262
-#: ../navit/country.c:80
-msgid "Djibouti"
-msgstr "Dżibuti"
-
-#. 208
-#: ../navit/country.c:81
-msgid "Denmark"
-msgstr "Dania"
-
-#. 212
-#: ../navit/country.c:82
-msgid "Dominica"
-msgstr "Dominika"
-
-#. 214
-#: ../navit/country.c:83
-msgid "Dominican Republic"
-msgstr "Republika Dominikańska"
-
-#. 012
-#: ../navit/country.c:84
-msgid "Algeria"
-msgstr "Algeria"
-
-#. 218
-#: ../navit/country.c:85
-msgid "Ecuador"
-msgstr "Ekwador"
-
-#. 233
-#: ../navit/country.c:86
-msgid "Estonia"
-msgstr "Estonia"
-
-#. 818
-#: ../navit/country.c:87
-msgid "Egypt"
-msgstr "Egipt"
-
-#. 732
-#: ../navit/country.c:88
-msgid "Western Sahara"
-msgstr "Zachodnia Sahara"
-
-#. 232
-#: ../navit/country.c:89
-msgid "Eritrea"
-msgstr "Erytrea"
-
-#. 724
-#: ../navit/country.c:90
-msgid "Spain"
-msgstr "Hiszpania"
-
-#. 231
-#: ../navit/country.c:91
-msgid "Ethiopia"
-msgstr "Etiopia"
-
-#. 246
-#: ../navit/country.c:92
-msgid "Finland"
-msgstr "Finlandia"
-
-#. 242
-#: ../navit/country.c:93
-msgid "Fiji"
-msgstr "Fidżi"
-
-#. 238
-#: ../navit/country.c:94
-msgid "Falkland Islands (Malvinas)"
-msgstr "Falklandy (Malwiny)"
-
-#. 583
-#: ../navit/country.c:95
-msgid "Micronesia, Federated States of"
-msgstr "Mikronezja"
-
-#. 234
-#: ../navit/country.c:96
-msgid "Faroe Islands"
-msgstr "Wyspy Faroe"
-
-#. 250
-#: ../navit/country.c:97
-msgid "France"
-msgstr "Francja"
-
-#. 266
-#: ../navit/country.c:98
-msgid "Gabon"
-msgstr "Gabon"
-
-#. 826
-#: ../navit/country.c:99
-msgid "United Kingdom"
-msgstr "Zjednoczone Królestwo"
-
-#. 308
-#: ../navit/country.c:100
-msgid "Grenada"
-msgstr "Grenada"
-
-#. 268
-#: ../navit/country.c:101
-msgid "Georgia"
-msgstr "Georgia"
-
-#. 254
-#: ../navit/country.c:102
-msgid "French Guiana"
-msgstr "Gujana Francuska"
-
-#. 831
-#: ../navit/country.c:103
-msgid "Guernsey"
-msgstr ""
-
-#. 288
-#: ../navit/country.c:104
-msgid "Ghana"
-msgstr ""
-
-#. 292
-#: ../navit/country.c:105
-msgid "Gibraltar"
-msgstr "Gibraltar"
-
-#. 304
-#: ../navit/country.c:106
-msgid "Greenland"
-msgstr "Grenlandia"
-
-#. 270
-#: ../navit/country.c:107
-msgid "Gambia"
-msgstr ""
-
-#. 324
-#: ../navit/country.c:108
-msgid "Guinea"
-msgstr ""
-
-#. 312
-#: ../navit/country.c:109
-msgid "Guadeloupe"
-msgstr ""
-
-#. 226
-#: ../navit/country.c:110
-msgid "Equatorial Guinea"
-msgstr ""
-
-#. 300
-#: ../navit/country.c:111
-msgid "Greece"
-msgstr "Grecja"
-
-#. 239
-#: ../navit/country.c:112
-msgid "South Georgia and the South Sandwich Islands"
-msgstr ""
-
-#. 320
-#: ../navit/country.c:113
-msgid "Guatemala"
-msgstr ""
-
-#. 316
-#: ../navit/country.c:114
-msgid "Guam"
-msgstr ""
-
-#. 624
-#: ../navit/country.c:115
-msgid "Guinea-Bissau"
-msgstr ""
-
-#. 328
-#: ../navit/country.c:116
-msgid "Guyana"
-msgstr ""
-
-#. 344
-#: ../navit/country.c:117
-msgid "Hong Kong"
-msgstr ""
-
-#. 334
-#: ../navit/country.c:118
-msgid "Heard Island and McDonald Islands"
-msgstr ""
-
-#. 340
-#: ../navit/country.c:119
-msgid "Honduras"
-msgstr ""
-
-#. 191
-#: ../navit/country.c:120
-msgid "Croatia"
-msgstr "Chorwacja"
-
-#. 332
-#: ../navit/country.c:121
-msgid "Haiti"
-msgstr ""
-
-#. 348
-#: ../navit/country.c:122
-msgid "Hungary"
-msgstr "Węgry"
-
-#. 360
-#: ../navit/country.c:123
-msgid "Indonesia"
-msgstr ""
-
-#. 372
-#: ../navit/country.c:124
-msgid "Ireland"
-msgstr "Irlandia"
-
-#. 376
-#: ../navit/country.c:125
-msgid "Israel"
-msgstr "Izrael"
-
-#. 833
-#: ../navit/country.c:126
-msgid "Isle of Man"
-msgstr ""
-
-#. 356
-#: ../navit/country.c:127
-msgid "India"
-msgstr ""
-
-#. 086
-#: ../navit/country.c:128
-msgid "British Indian Ocean Territory"
-msgstr "Brytyjskie Terytorium Oceanu Indyjskiego"
-
-#. 368
-#: ../navit/country.c:129
-msgid "Iraq"
-msgstr "Irak"
-
-#. 364
-#: ../navit/country.c:130
-msgid "Iran, Islamic Republic of"
-msgstr "Iran"
-
-#. 352
-#: ../navit/country.c:131
-msgid "Iceland"
-msgstr "Islandia"
-
-#. 380
-#: ../navit/country.c:132
-msgid "Italy"
-msgstr "WÅ‚ochy"
-
-#. 832
-#: ../navit/country.c:133
-msgid "Jersey"
-msgstr "Jersey"
-
-#. 388
-#: ../navit/country.c:134
-msgid "Jamaica"
-msgstr "Jamajka"
-
-#. 400
-#: ../navit/country.c:135
-msgid "Jordan"
-msgstr "Jorndan"
-
-#. 392
-#: ../navit/country.c:136
-msgid "Japan"
-msgstr "Japonia"
-
-#. 404
-#: ../navit/country.c:137
-msgid "Kenya"
-msgstr "Kenia"
-
-#. 417
-#: ../navit/country.c:138
-msgid "Kyrgyzstan"
-msgstr "Kirgistan"
-
-#. 116
-#: ../navit/country.c:139
-msgid "Cambodia"
-msgstr "Kambodża"
-
-#. 296
-#: ../navit/country.c:140
-msgid "Kiribati"
-msgstr "Kiribati"
-
-#. 174
-#: ../navit/country.c:141
-msgid "Comoros"
-msgstr ""
-
-#. 659
-#: ../navit/country.c:142
-msgid "Saint Kitts and Nevis"
-msgstr ""
-
-#. 408
-#: ../navit/country.c:143
-msgid "Korea, Democratic People's Republic of"
-msgstr ""
-
-#. 410
-#: ../navit/country.c:144
-msgid "Korea, Republic of"
-msgstr ""
-
-#. 414
-#: ../navit/country.c:145
-msgid "Kuwait"
-msgstr ""
-
-#. 136
-#: ../navit/country.c:146
-msgid "Cayman Islands"
-msgstr ""
-
-#. 398
-#: ../navit/country.c:147
-msgid "Kazakhstan"
-msgstr ""
-
-#. 418
-#: ../navit/country.c:148
-msgid "Lao People's Democratic Republic"
-msgstr ""
-
-#. 422
-#: ../navit/country.c:149
-msgid "Lebanon"
-msgstr "Liban"
-
-#. 662
-#: ../navit/country.c:150
-msgid "Saint Lucia"
-msgstr ""
-
-#. 438
-#: ../navit/country.c:151
-msgid "Liechtenstein"
-msgstr "Lichtenstein"
-
-#. 144
-#: ../navit/country.c:152
-msgid "Sri Lanka"
-msgstr ""
-
-#. 430
-#: ../navit/country.c:153
-msgid "Liberia"
-msgstr ""
-
-#. 426
-#: ../navit/country.c:154
-msgid "Lesotho"
-msgstr ""
-
-#. 440
-#: ../navit/country.c:155
-msgid "Lithuania"
-msgstr "Litwa"
-
-#. 442
-#: ../navit/country.c:156
-msgid "Luxembourg"
-msgstr "Luksemburg"
-
-#. 428
-#: ../navit/country.c:157
-msgid "Latvia"
-msgstr "Åotwa"
-
-#. 434
-#: ../navit/country.c:158
-msgid "Libyan Arab Jamahiriya"
-msgstr ""
-
-#. 504
-#: ../navit/country.c:159
-msgid "Morocco"
-msgstr "Maroko"
-
-#. 492
-#: ../navit/country.c:160
-msgid "Monaco"
-msgstr "Monako"
-
-#. 498
-#: ../navit/country.c:161
-msgid "Moldova, Republic of"
-msgstr ""
-
-#. 499
-#: ../navit/country.c:162
-msgid "Montenegro"
-msgstr ""
-
-#. 663
-#: ../navit/country.c:163
-msgid "Saint Martin (French part)"
-msgstr ""
-
-#. 450
-#: ../navit/country.c:164
-msgid "Madagascar"
-msgstr ""
-
-#. 584
-#: ../navit/country.c:165
-msgid "Marshall Islands"
-msgstr ""
-
-#. 807
-#: ../navit/country.c:166
-msgid "Macedonia, the former Yugoslav Republic of"
-msgstr ""
-
-#. 466
-#: ../navit/country.c:167
-msgid "Mali"
-msgstr ""
-
-#. 104
-#: ../navit/country.c:168
-msgid "Myanmar"
-msgstr ""
-
-#. 496
-#: ../navit/country.c:169
-msgid "Mongolia"
-msgstr ""
-
-#. 446
-#: ../navit/country.c:170
-msgid "Macao"
-msgstr ""
-
-#. 580
-#: ../navit/country.c:171
-msgid "Northern Mariana Islands"
-msgstr ""
-
-#. 474
-#: ../navit/country.c:172
-msgid "Martinique"
-msgstr ""
-
-#. 478
-#: ../navit/country.c:173
-msgid "Mauritania"
-msgstr ""
-
-#. 500
-#: ../navit/country.c:174
-msgid "Montserrat"
-msgstr ""
-
-#. 470
-#: ../navit/country.c:175
-msgid "Malta"
-msgstr "Malta"
-
-#. 480
-#: ../navit/country.c:176
-msgid "Mauritius"
-msgstr ""
-
-#. 462
-#: ../navit/country.c:177
-msgid "Maldives"
-msgstr ""
-
-#. 454
-#: ../navit/country.c:178
-msgid "Malawi"
-msgstr ""
-
-#. 484
-#: ../navit/country.c:179
-msgid "Mexico"
-msgstr ""
-
-#. 458
-#: ../navit/country.c:180
-msgid "Malaysia"
-msgstr ""
-
-#. 508
-#: ../navit/country.c:181
-msgid "Mozambique"
-msgstr ""
-
-#. 516
-#: ../navit/country.c:182
-msgid "Namibia"
-msgstr ""
-
-#. 540
-#: ../navit/country.c:183
-msgid "New Caledonia"
-msgstr ""
-
-#. 562
-#: ../navit/country.c:184
-msgid "Niger"
-msgstr ""
-
-#. 574
-#: ../navit/country.c:185
-msgid "Norfolk Island"
-msgstr ""
-
-#. 566
-#: ../navit/country.c:186
-msgid "Nigeria"
-msgstr ""
-
-#. 558
-#: ../navit/country.c:187
-msgid "Nicaragua"
-msgstr ""
-
-#. 528
-#: ../navit/country.c:188
-msgid "Netherlands"
-msgstr "Holandia"
-
-#. 578
-#: ../navit/country.c:189
-msgid "Norway"
-msgstr "Norwegia"
-
-#. 524
-#: ../navit/country.c:190
-msgid "Nepal"
-msgstr ""
-
-#. 520
-#: ../navit/country.c:191
-msgid "Nauru"
-msgstr ""
-
-#. 570
-#: ../navit/country.c:192
-msgid "Niue"
-msgstr ""
-
-#. 554
-#: ../navit/country.c:193
-msgid "New Zealand"
-msgstr "Nowa Zelandia"
-
-#. 512
-#: ../navit/country.c:194
-msgid "Oman"
-msgstr "Oman"
-
-#. 591
-#: ../navit/country.c:195
-msgid "Panama"
-msgstr "Panama"
-
-#. 604
-#: ../navit/country.c:196
-msgid "Peru"
-msgstr "Peru"
-
-#. 258
-#: ../navit/country.c:197
-msgid "French Polynesia"
-msgstr "Polinezja Francuska"
-
-#. 598
-#: ../navit/country.c:198
-msgid "Papua New Guinea"
-msgstr "Papua Nowa Gwinea"
-
-#. 608
-#: ../navit/country.c:199
-msgid "Philippines"
-msgstr "Filipiny"
-
-#. 586
-#: ../navit/country.c:200
-msgid "Pakistan"
-msgstr "Pakistan"
-
-#. 616
-#: ../navit/country.c:201
-msgid "Poland"
-msgstr "Polska"
-
-#. 666
-#: ../navit/country.c:202
-msgid "Saint Pierre and Miquelon"
-msgstr ""
-
-#. 612
-#: ../navit/country.c:203
-msgid "Pitcairn"
-msgstr ""
-
-#. 630
-#: ../navit/country.c:204
-msgid "Puerto Rico"
-msgstr ""
-
-#. 275
-#: ../navit/country.c:205
-msgid "Palestinian Territory, Occupied"
-msgstr "Terytorium Palestyńskie, okupowane"
-
-#. 620
-#: ../navit/country.c:206
-msgid "Portugal"
-msgstr "Portugalia"
-
-#. 585
-#: ../navit/country.c:207
-msgid "Palau"
-msgstr "Palau"
-
-#. 600
-#: ../navit/country.c:208
-msgid "Paraguay"
-msgstr "Paragwaj"
-
-#. 634
-#: ../navit/country.c:209
-msgid "Qatar"
-msgstr "Katar"
-
-#. 638
-#: ../navit/country.c:210
-msgid "Reunion"
-msgstr ""
-
-#. 642
-#: ../navit/country.c:211
-msgid "Romania"
-msgstr "Rumunia"
-
-#. 688
-#: ../navit/country.c:212
-msgid "Serbia"
-msgstr "Serbia"
-
-#. 643
-#: ../navit/country.c:213
-msgid "Russian Federation"
-msgstr "Federacja Rosyjska"
-
-#. 646
-#: ../navit/country.c:214
-msgid "Rwanda"
-msgstr ""
-
-#. 682
-#: ../navit/country.c:215
-#, fuzzy
-msgid "Saudi Arabia"
-msgstr "Arabia Saudyjska"
-
-#. 090
-#: ../navit/country.c:216
-msgid "Solomon Islands"
-msgstr ""
-
-#. 690
-#: ../navit/country.c:217
-msgid "Seychelles"
-msgstr ""
-
-#. 736
-#: ../navit/country.c:218
-msgid "Sudan"
-msgstr ""
-
-#. 752
-#: ../navit/country.c:219
-msgid "Sweden"
-msgstr "Szwecja"
-
-#. 702
-#: ../navit/country.c:220
-msgid "Singapore"
-msgstr ""
-
-#. 654
-#: ../navit/country.c:221
-msgid "Saint Helena"
-msgstr ""
-
-#. 705
-#: ../navit/country.c:222
-msgid "Slovenia"
-msgstr "SÅ‚owenia"
-
-#. 744
-#: ../navit/country.c:223
-msgid "Svalbard and Jan Mayen"
-msgstr "Svalbard i Jan Mayen"
-
-#. 703
-#: ../navit/country.c:224
-msgid "Slovakia"
-msgstr "SÅ‚owacja"
-
-#. 694
-#: ../navit/country.c:225
-msgid "Sierra Leone"
-msgstr ""
-
-#. 674
-#: ../navit/country.c:226
-msgid "San Marino"
-msgstr "San Marino"
-
-#. 686
-#: ../navit/country.c:227
-msgid "Senegal"
-msgstr ""
-
-#. 706
-#: ../navit/country.c:228
-msgid "Somalia"
-msgstr ""
-
-#. 740
-#: ../navit/country.c:229
-msgid "Suriname"
-msgstr ""
-
-#. 678
-#: ../navit/country.c:230
-msgid "Sao Tome and Principe"
-msgstr ""
-
-#. 222
-#: ../navit/country.c:231
-msgid "El Salvador"
-msgstr ""
-
-#. 760
-#: ../navit/country.c:232
-msgid "Syrian Arab Republic"
-msgstr ""
-
-#. 748
-#: ../navit/country.c:233
-msgid "Swaziland"
-msgstr ""
-
-#. 796
-#: ../navit/country.c:234
-msgid "Turks and Caicos Islands"
-msgstr ""
-
-#. 148
-#: ../navit/country.c:235
-msgid "Chad"
-msgstr ""
-
-#. 260
-#: ../navit/country.c:236
-msgid "French Southern Territories"
-msgstr ""
-
-#. 768
-#: ../navit/country.c:237
-msgid "Togo"
-msgstr ""
-
-#. 764
-#: ../navit/country.c:238
-msgid "Thailand"
-msgstr ""
-
-#. 762
-#: ../navit/country.c:239
-msgid "Tajikistan"
-msgstr ""
-
-#. 772
-#: ../navit/country.c:240
-msgid "Tokelau"
-msgstr ""
-
-#. 626
-#: ../navit/country.c:241
-msgid "Timor-Leste"
-msgstr ""
-
-#. 795
-#: ../navit/country.c:242
-msgid "Turkmenistan"
-msgstr ""
-
-#. 788
-#: ../navit/country.c:243
-msgid "Tunisia"
-msgstr "Tunezja"
-
-#. 776
-#: ../navit/country.c:244
-msgid "Tonga"
-msgstr ""
-
-#. 792
-#: ../navit/country.c:245
-msgid "Turkey"
-msgstr "Turcja"
-
-#. 780
-#: ../navit/country.c:246
-msgid "Trinidad and Tobago"
-msgstr ""
-
-#. 798
-#: ../navit/country.c:247
-msgid "Tuvalu"
-msgstr ""
-
-#. 158
-#: ../navit/country.c:248
-msgid "Taiwan, Province of China"
-msgstr ""
-
-#. 834
-#: ../navit/country.c:249
-msgid "Tanzania, United Republic of"
-msgstr ""
-
-#. 804
-#: ../navit/country.c:250
-msgid "Ukraine"
-msgstr "Ukraina"
-
-#. 800
-#: ../navit/country.c:251
-msgid "Uganda"
-msgstr ""
-
-#. 581
-#: ../navit/country.c:252
-msgid "United States Minor Outlying Islands"
-msgstr ""
-
-#. 840
-#: ../navit/country.c:253
-msgid "United States"
-msgstr ""
-
-#. 858
-#: ../navit/country.c:254
-msgid "Uruguay"
-msgstr ""
-
-#. 860
-#: ../navit/country.c:255
-msgid "Uzbekistan"
-msgstr ""
-
-#. 336
-#: ../navit/country.c:256
-msgid "Holy See (Vatican City State)"
-msgstr ""
-
-#. 670
-#: ../navit/country.c:257
-msgid "Saint Vincent and the Grenadines"
-msgstr ""
-
-#. 862
-#: ../navit/country.c:258
-msgid "Venezuela"
-msgstr ""
-
-#. 092
-#: ../navit/country.c:259
-msgid "Virgin Islands, British"
-msgstr ""
-
-#. 850
-#: ../navit/country.c:260
-msgid "Virgin Islands, U.S."
-msgstr ""
-
-#. 704
-#: ../navit/country.c:261
-msgid "Viet Nam"
-msgstr ""
-
-#. 548
-#: ../navit/country.c:262
-msgid "Vanuatu"
-msgstr ""
-
-#. 876
-#: ../navit/country.c:263
-msgid "Wallis and Futuna"
-msgstr ""
-
-#. 882
-#: ../navit/country.c:264
-msgid "Samoa"
-msgstr ""
-
-#. 887
-#: ../navit/country.c:265
-msgid "Yemen"
-msgstr ""
-
-#. 175
-#: ../navit/country.c:266
-msgid "Mayotte"
-msgstr ""
-
-#. 710
-#: ../navit/country.c:267
-msgid "South Africa"
-msgstr ""
-
-#. 894
-#: ../navit/country.c:268
-msgid "Zambia"
-msgstr ""
-
-#. 716
-#: ../navit/country.c:269
-msgid "Zimbabwe"
-msgstr ""
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:98
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-msgid "Car"
-msgstr ""
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso2"
-msgstr ""
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso3"
-msgstr ""
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:403
-msgid "Country"
-msgstr "Państwo"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-#, fuzzy
-msgid "Postal"
-msgstr "Portugalia"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "Town"
-msgstr ""
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-#, fuzzy
-msgid "District"
-msgstr "Dzielnica/Okręg miejski"
-
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-#: ../navit/gui/gtk/destination.c:412
-msgid "Street"
-msgstr "Ulica"
-
-#: ../navit/gui/gtk/destination.c:100 ../navit/gui/gtk/destination.c:414
-msgid "Number"
-msgstr "Numer"
-
-#: ../navit/gui/gtk/destination.c:398
-#, fuzzy
-msgid "Enter Destination"
-msgstr "Cel"
-
-#: ../navit/gui/gtk/destination.c:405
-msgid "Zip Code"
-msgstr "Kod Pocztowy"
-
-#: ../navit/gui/gtk/destination.c:407
-msgid "City"
-msgstr "Miasto"
-
-#: ../navit/gui/gtk/destination.c:409
-msgid "District/Township"
-msgstr "Dzielnica/Okręg miejski"
-
-#: ../navit/gui/gtk/destination.c:437 ../navit/gui/gtk/gui_gtk_action.c:153
-msgid "Map"
-msgstr "Mapa"
-
-#: ../navit/gui/gtk/destination.c:438
-msgid "Bookmark"
-msgstr ""
-
-#: ../navit/gui/gtk/destination.c:439 ../navit/gui/gtk/gui_gtk_action.c:166
-msgid "Destination"
-msgstr "Cel"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:149
-msgid "Display"
-msgstr "Pokaż"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:150
-msgid "Route"
-msgstr "Trasa"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:154
-msgid "Layout"
-msgstr "Układ kolorów"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:155
-msgid "Projection"
-msgstr "Odwzorowanie"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:156
-msgid "Vehicle"
-msgstr ""
-
-#: ../navit/gui/gtk/gui_gtk_action.c:157
-msgid "ZoomOut"
-msgstr "Oddal"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:158
-msgid "ZoomIn"
-msgstr "Zbliż"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:159
-msgid "Refresh"
-msgstr "Odświerz"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:162 ../navit/gui/gtk/gui_gtk_action.c:164
-msgid "Info"
-msgstr "Info"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:167
-msgid "Clear"
-msgstr "Wyczyść"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:168
-msgid "Test"
-msgstr "Test"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:169
-msgid "_Quit"
-msgstr "Zakończ"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:176
-msgid "Cursor"
-msgstr "Kursor"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:177
-msgid "Tracking"
-msgstr ""
-
-#: ../navit/gui/gtk/gui_gtk_action.c:178
-msgid "Orientation"
-msgstr "Orientacja"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:180 ../navit/gui/gtk/gui_gtk_action.c:182
-msgid "Fullscreen"
-msgstr "Pełny ekran"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:190
-msgid "Data"
-msgstr "Dane"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "N"
-msgstr "N"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NE"
-msgstr "NE"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "E"
-msgstr "E"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SE"
-msgstr "SE"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "S"
-msgstr "S"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SW"
-msgstr "SW"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "W"
-msgstr "W"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NW"
-msgstr "NW"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:103
-#, c-format
-msgid "Route %4.0fkm %02d:%02d ETA"
-msgstr ""
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:148
-msgid "Route 0000km 0+00:00 ETA"
-msgstr ""
diff --git a/po/ru.po b/po/ru.po
deleted file mode 100644
index c6a461d0..00000000
--- a/po/ru.po
+++ /dev/null
@@ -1,1711 +0,0 @@
-# Russian translations for navit.
-# Copyright (C) 2008.
-# This file is distributed under the same license as the PACKAGE package.
-# Rustam Usmanov <zcc@mail.ru>, 2008.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: Navit 0.1.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-05-26 17:12+0200\n"
-"PO-Revision-Date: 2008-05-27 08:55+0000\n"
-"Last-Translator: Nkolay Parukhin <nik@sevpinro.ru>\n"
-"Language-Team: Rustam T. Usmanov\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
-"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
-"X-Launchpad-Export-Date: 2008-05-30 21:28+0000\n"
-"X-Generator: Launchpad (build Unknown)\n"
-
-#~ msgid "Turn %1$s%2$s %3$s"
-#~ msgstr "Поверните %1$s%2$s %3$s"
-
-#~ msgid "Moldova"
-#~ msgstr "МолдавиÑ"
-
-#~ msgid "Palestinia"
-#~ msgstr "ПалеÑтина"
-
-#~ msgid "VisibleBlocks"
-#~ msgstr "ВидимыеБлоки"
-
-#~ msgid "VisibleTowns"
-#~ msgstr "ВидимыеГорода"
-
-#~ msgid "VisiblePolys"
-#~ msgstr "ВидимыеПолигоны"
-
-#~ msgid "VisibleStreets"
-#~ msgstr "ВидимыеУлицы"
-
-#~ msgid "VisiblePoints"
-#~ msgstr "ВидимыеТочки"
-
-#: ../navit/main.c:111
-#, c-format
-msgid ""
-"navit usage:\n"
-"navit [options] [configfile]\n"
-"\t-c <file>: use <file> as config file\n"
-"\t-d <n>: set the debug output level to <n>. (TODO)\n"
-"\t-h: print this usage info and exit.\n"
-"\t-v: Print the version and exit.\n"
-msgstr ""
-"иÑпользование navit:\n"
-"navit [options] [configfile]\n"
-"\t-c <file>: иÑпользовать <file> как файл конфигурации\n"
-"\t-d <n>: задать уровень отладочных Ñообщений <n>. (TODO)\n"
-"\t-h: вывеÑти Ñту информацию и выйти.\n"
-"\t-v: вывеÑти верÑию и выйти.\n"
-
-#: ../navit/main.c:131
-#, c-format
-msgid "Running from source directory\n"
-msgstr "ЗапуÑк в иÑходном каталоге\n"
-
-#: ../navit/main.c:147
-#, c-format
-msgid "setting '%s' to '%s'\n"
-msgstr "уÑтановка '%s' в '%s'\n"
-
-#. We have not found an existing config file from all possibilities
-#: ../navit/main.c:248
-#, c-format
-msgid "No config file navit.xml, navit.xml.local found\n"
-msgstr "Ðе найден конфигурационный файл navit.xml, navit.xml.local\n"
-
-#: ../navit/main.c:255
-#, c-format
-msgid "Error parsing '%s': %s\n"
-msgstr "Ошибка разбора '%s': %s\n"
-
-#: ../navit/main.c:258
-#, c-format
-msgid "Using '%s'\n"
-msgstr "ИÑпользуетÑÑ '%s'\n"
-
-#: ../navit/main.c:261
-#, c-format
-msgid "No instance has been created, exiting\n"
-msgstr "ЭкземплÑÑ€ не Ñоздан, выходим\n"
-
-#: ../navit/navigation.c:171
-#, c-format
-msgid "%d m"
-msgstr "%d м"
-
-#: ../navit/navigation.c:173
-#, c-format
-msgid "in %d m"
-msgstr "через %d м"
-
-#: ../navit/navigation.c:177
-#, c-format
-msgid "%d meters"
-msgstr "%d метров"
-
-#: ../navit/navigation.c:179
-#, c-format
-msgid "in %d meters"
-msgstr "через %d метров"
-
-#: ../navit/navigation.c:185
-#, c-format
-msgid "%d.%d kilometer"
-msgstr "%d.%d километр"
-
-#: ../navit/navigation.c:187
-#, c-format
-msgid "in %d.%d kilometers"
-msgstr "через %d.%d километр(а,ов"
-
-#: ../navit/navigation.c:191
-#, c-format
-msgid "one kilometer"
-msgid_plural "%d kilometers"
-msgstr[0] "%d километр"
-msgstr[1] "%d километра"
-msgstr[2] "%d километров"
-
-#: ../navit/navigation.c:193
-#, c-format
-msgid "in one kilometer"
-msgid_plural "in %d kilometers"
-msgstr[0] "через %d километр"
-msgstr[1] "%d километра"
-msgstr[2] "%d километров"
-
-#: ../navit/navigation.c:447
-#, fuzzy
-msgid "exit"
-msgstr "выезд"
-
-#: ../navit/navigation.c:449
-#, fuzzy
-msgid "ramp"
-msgstr "въезд"
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name
-#: ../navit/navigation.c:479
-#, c-format
-msgid "%sinto the street %s%s%s"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Male form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:483
-#, c-format
-msgid "%sinto the %s%s%s|male form"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Female form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:487
-#, c-format
-msgid "%sinto the %s%s%s|female form"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Neutral form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:491
-#, c-format
-msgid "%sinto the %s%s%s|neutral form"
-msgstr ""
-
-#: ../navit/navigation.c:497
-#, c-format
-msgid "into the %s"
-msgstr ""
-
-#: ../navit/navigation.c:518
-msgid "right"
-msgstr "направо"
-
-#: ../navit/navigation.c:525
-msgid "left"
-msgstr "налево"
-
-#: ../navit/navigation.c:529
-msgid "easily "
-msgstr "Ñлегка "
-
-#: ../navit/navigation.c:533
-msgid "strongly "
-msgstr "Ñильно "
-
-#: ../navit/navigation.c:536
-msgid "unknown "
-msgstr "неизвеÑтно "
-
-#: ../navit/navigation.c:542
-msgid "When possible, please turn around"
-msgstr "РазвернитеÑÑŒ, пожалуйÑта, еÑли Ñто возможно"
-
-#: ../navit/navigation.c:549
-#, c-format
-msgid "Follow the road for the next %s"
-msgstr "ДвигайтеÑÑŒ по дороге Ñледующие %s"
-
-#: ../navit/navigation.c:553
-msgid "soon"
-msgstr "Ñкоро"
-
-#: ../navit/navigation.c:559
-msgid "now"
-msgstr "ÑейчаÑ"
-
-#: ../navit/navigation.c:562
-msgid "error"
-msgstr "ошибка"
-
-#. TRANSLATORS: The first argument is strength, the second direction, the third distance and the fourth destination Example: 'Turn 'slightly' 'left' in '100 m' 'onto baker street'
-#: ../navit/navigation.c:591
-#, c-format
-msgid "Turn %1$s%2$s %3$s%4$s"
-msgstr "Поверните %1$s%2$s %3$s%4$s"
-
-#: ../navit/navigation.c:594
-#, c-format
-msgid "You have reached your destination %s"
-msgstr "Ð’Ñ‹ прибыли в пункт Ð½Ð°Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ %s"
-
-#: ../navit/navit.c:664 ../navit/gui/gtk/gui_gtk_action.c:151
-msgid "Former Destinations"
-msgstr "Прошлые пункты назначениÑ"
-
-#: ../navit/navit.c:674 ../navit/gui/gtk/gui_gtk_action.c:152
-msgid "Bookmarks"
-msgstr "Закладки"
-
-#: ../navit/navit.c:764
-msgid "Command"
-msgstr "Команда"
-
-#: ../navit/navit.c:769
-msgid "Length"
-msgstr "Длина"
-
-#: ../navit/navit.c:773 ../navit/navit.c:798
-msgid "km"
-msgstr "км"
-
-#: ../navit/navit.c:777 ../navit/navit.c:802
-msgid "m"
-msgstr "м"
-
-#: ../navit/navit.c:783
-msgid "Time"
-msgstr "ВремÑ"
-
-#: ../navit/navit.c:795
-msgid "Destination Length"
-msgstr "ДиÑÑ‚Ð°Ð½Ñ†Ð¸Ñ Ð´Ð¾ пункта назначениÑ"
-
-#: ../navit/navit.c:808
-msgid "Destination Time"
-msgstr "Ð’Ñ€ÐµÐ¼Ñ Ð´Ð¾ пункта назначениÑ"
-
-#: ../navit/navit.c:837 ../navit/gui/gtk/gui_gtk_action.c:160
-msgid "Roadbook"
-msgstr "Дорожный Ñправочник"
-
-#: ../navit/popup.c:200 ../navit/popup.c:254
-msgid "Set as position"
-msgstr "УÑтановить как пункт отправлениÑ"
-
-#: ../navit/popup.c:201 ../navit/popup.c:255
-msgid "Set as destination"
-msgstr "УÑтановить как пункт назначениÑ"
-
-#: ../navit/popup.c:202 ../navit/popup.c:256
-msgid "Add as bookmark"
-msgstr "Добавить в закладки"
-
-#: ../navit/popup.c:244
-#, c-format
-msgid "Point 0x%x 0x%x"
-msgstr "Точка 0x%x 0x%x"
-
-#: ../navit/popup.c:245
-#, fuzzy, c-format
-msgid "Screen coord : %d %d"
-msgstr "Экран %d %d"
-
-#. 020
-#: ../navit/country.c:24
-msgid "Andorra"
-msgstr "Ðндорра"
-
-#. 784
-#: ../navit/country.c:25
-msgid "United Arab Emirates"
-msgstr "Объединенные ÐрабÑкие Эмираты"
-
-#. 004
-#: ../navit/country.c:26
-msgid "Afghanistan"
-msgstr "ÐфганиÑтан"
-
-#. 028
-#: ../navit/country.c:27
-msgid "Antigua and Barbuda"
-msgstr "Ðнтига и Барбуда"
-
-#. 660
-#: ../navit/country.c:28
-msgid "Anguilla"
-msgstr "Ðнгуила"
-
-#. 008
-#: ../navit/country.c:29
-msgid "Albania"
-msgstr "ÐлбаниÑ"
-
-#. 051
-#: ../navit/country.c:30
-msgid "Armenia"
-msgstr "ÐрмениÑ"
-
-#. 530
-#: ../navit/country.c:31
-msgid "Netherlands Antilles"
-msgstr "ÐнтильÑкие (ÐидерланÑкие) оÑтрова"
-
-#. 024
-#: ../navit/country.c:32
-msgid "Angola"
-msgstr "Ðнгола"
-
-#. 010
-#: ../navit/country.c:33
-msgid "Antarctica"
-msgstr "Ðнтарктика"
-
-#. 032
-#: ../navit/country.c:34
-msgid "Argentina"
-msgstr "Ðргентина"
-
-#. 016
-#: ../navit/country.c:35
-msgid "American Samoa"
-msgstr "Ðмерик. Самоа"
-
-#. 040
-#: ../navit/country.c:36
-msgid "Austria"
-msgstr "ÐвÑтриÑ"
-
-#. 036
-#: ../navit/country.c:37
-msgid "Australia"
-msgstr "ÐвÑтралиÑ"
-
-#. 533
-#: ../navit/country.c:38
-msgid "Aruba"
-msgstr "Ðруба"
-
-#. 248
-#: ../navit/country.c:39
-msgid "Aland Islands"
-msgstr "ФарерÑкие ОÑтрова"
-
-#. 031
-#: ../navit/country.c:40
-msgid "Azerbaijan"
-msgstr "Ðзербайджан"
-
-#. 070
-#: ../navit/country.c:41
-msgid "Bosnia and Herzegovina"
-msgstr "БоÑÐ½Ð¸Ñ Ð¸ Герцеговина"
-
-#. 052
-#: ../navit/country.c:42
-msgid "Barbados"
-msgstr "БарбадоÑ"
-
-#. 050
-#: ../navit/country.c:43
-msgid "Bangladesh"
-msgstr "Бангладеш"
-
-#. 056
-#: ../navit/country.c:44
-msgid "Belgium"
-msgstr "БельгиÑ"
-
-#. 854
-#: ../navit/country.c:45
-msgid "Burkina Faso"
-msgstr "Буркина-ФаÑо"
-
-#. 100
-#: ../navit/country.c:46
-msgid "Bulgaria"
-msgstr "БолгариÑ"
-
-#. 048
-#: ../navit/country.c:47
-msgid "Bahrain"
-msgstr "Бахрейн"
-
-#. 108
-#: ../navit/country.c:48
-msgid "Burundi"
-msgstr "Бурунди"
-
-#. 204
-#: ../navit/country.c:49
-msgid "Benin"
-msgstr "Бенин"
-
-#. 652
-#: ../navit/country.c:50
-msgid "Saint Barthelemy"
-msgstr "Сен-Бартелемей"
-
-#. 060
-#: ../navit/country.c:51
-msgid "Bermuda"
-msgstr "Бермуда"
-
-#. 096
-#: ../navit/country.c:52
-#, fuzzy
-msgid "Brunei Darussalam"
-msgstr "Брюней ДаруÑÑалам"
-
-#. 068
-#: ../navit/country.c:53
-msgid "Bolivia"
-msgstr "БоливиÑ"
-
-#. 076
-#: ../navit/country.c:54
-msgid "Brazil"
-msgstr "БразилиÑ"
-
-#. 044
-#: ../navit/country.c:55
-msgid "Bahamas"
-msgstr "Багамы"
-
-#. 064
-#: ../navit/country.c:56
-msgid "Bhutan"
-msgstr "Бутан"
-
-#. 074
-#: ../navit/country.c:57
-#, fuzzy
-msgid "Bouvet Island"
-msgstr "ФарерÑкие ОÑтрова"
-
-#. 072
-#: ../navit/country.c:58
-msgid "Botswana"
-msgstr "БотÑвана"
-
-#. 112
-#: ../navit/country.c:59
-msgid "Belarus"
-msgstr "БелоруÑÑиÑ"
-
-#. 084
-#: ../navit/country.c:60
-msgid "Belize"
-msgstr "Белиз"
-
-#. 124
-#: ../navit/country.c:61
-msgid "Canada"
-msgstr "Канада"
-
-#. 166
-#: ../navit/country.c:62
-msgid "Cocos (Keeling) Islands"
-msgstr "КокоÑовые (Килинговы) ОÑтрова"
-
-#. 180
-#: ../navit/country.c:63
-msgid "Congo, Democratic Republic of the"
-msgstr "Конго, ДемократичеÑÐºÐ°Ñ Ð ÐµÑпублика"
-
-#. 140
-#: ../navit/country.c:64
-msgid "Central African Republic"
-msgstr "Ð¦ÐµÐ½Ñ‚Ñ€Ð°Ð»ÑŒÐ½Ñ ÐфриканÑÐºÐ°Ñ Ð ÐµÑпублика"
-
-#. 178
-#: ../navit/country.c:65
-msgid "Congo"
-msgstr "Конго"
-
-#. 756
-#: ../navit/country.c:66
-msgid "Switzerland"
-msgstr "ШвейцариÑ"
-
-#. 384
-#: ../navit/country.c:67
-msgid "Cote d'Ivoire"
-msgstr "Кот-д'Ивуар"
-
-#. 184
-#: ../navit/country.c:68
-msgid "Cook Islands"
-msgstr "Кука ОÑтрова"
-
-#. 152
-#: ../navit/country.c:69
-msgid "Chile"
-msgstr "Чили"
-
-#. 120
-#: ../navit/country.c:70
-msgid "Cameroon"
-msgstr "Камерон"
-
-#. 156
-#: ../navit/country.c:71
-msgid "China"
-msgstr "Китай"
-
-#. 170
-#: ../navit/country.c:72
-msgid "Colombia"
-msgstr "КолумбиÑ"
-
-#. 188
-#: ../navit/country.c:73
-msgid "Costa Rica"
-msgstr "КоÑта Рика"
-
-#. 192
-#: ../navit/country.c:74
-msgid "Cuba"
-msgstr "Куба"
-
-#. 132
-#: ../navit/country.c:75
-#, fuzzy
-msgid "Cape Verde"
-msgstr "кап ВердÑ"
-
-#. 162
-#: ../navit/country.c:76
-msgid "Christmas Island"
-msgstr "РождеÑтвенÑкие ОÑтрова"
-
-#. 196
-#: ../navit/country.c:77
-msgid "Cyprus"
-msgstr "Кипр"
-
-#. 203
-#: ../navit/country.c:78
-msgid "Czech Republic"
-msgstr "ЧешÑÐºÐ°Ñ Ð ÐµÑпублика"
-
-#. 276
-#: ../navit/country.c:79
-msgid "Germany"
-msgstr "ГерманиÑ"
-
-#. 262
-#: ../navit/country.c:80
-msgid "Djibouti"
-msgstr "Джибути"
-
-#. 208
-#: ../navit/country.c:81
-msgid "Denmark"
-msgstr "ДаниÑ"
-
-#. 212
-#: ../navit/country.c:82
-msgid "Dominica"
-msgstr "Доминика"
-
-#. 214
-#: ../navit/country.c:83
-msgid "Dominican Republic"
-msgstr "ДоминиканÑÐºÐ°Ñ Ð ÐµÑпублика"
-
-#. 012
-#: ../navit/country.c:84
-msgid "Algeria"
-msgstr "Ðлжир"
-
-#. 218
-#: ../navit/country.c:85
-msgid "Ecuador"
-msgstr "Эквадор"
-
-#. 233
-#: ../navit/country.c:86
-msgid "Estonia"
-msgstr "ЭÑтониÑ"
-
-#. 818
-#: ../navit/country.c:87
-msgid "Egypt"
-msgstr "Египет"
-
-#. 732
-#: ../navit/country.c:88
-msgid "Western Sahara"
-msgstr "Ð—Ð°Ð¿Ð°Ð´Ð½Ð°Ñ Ð¡Ð°Ñ…Ð°Ñ€Ð°"
-
-#. 232
-#: ../navit/country.c:89
-msgid "Eritrea"
-msgstr "ЭритреÑ"
-
-#. 724
-#: ../navit/country.c:90
-msgid "Spain"
-msgstr "ИÑпаниÑ"
-
-#. 231
-#: ../navit/country.c:91
-msgid "Ethiopia"
-msgstr "ЭФиопиÑ"
-
-#. 246
-#: ../navit/country.c:92
-msgid "Finland"
-msgstr "ФинлÑндиÑ"
-
-#. 242
-#: ../navit/country.c:93
-msgid "Fiji"
-msgstr "Фиджи"
-
-#. 238
-#: ../navit/country.c:94
-msgid "Falkland Islands (Malvinas)"
-msgstr "ФолклендÑкие ОÑтрова"
-
-#. 583
-#: ../navit/country.c:95
-msgid "Micronesia, Federated States of"
-msgstr "МикронÑзиÑ, Федеративные Штаты"
-
-#. 234
-#: ../navit/country.c:96
-msgid "Faroe Islands"
-msgstr "ФарерÑкие ОÑтрова"
-
-#. 250
-#: ../navit/country.c:97
-msgid "France"
-msgstr "ФранциÑ"
-
-#. 266
-#: ../navit/country.c:98
-msgid "Gabon"
-msgstr "Габон"
-
-#. 826
-#: ../navit/country.c:99
-msgid "United Kingdom"
-msgstr "ВеликобританиÑ"
-
-#. 308
-#: ../navit/country.c:100
-msgid "Grenada"
-msgstr "Гренада"
-
-#. 268
-#: ../navit/country.c:101
-msgid "Georgia"
-msgstr "ГрузиÑ"
-
-#. 254
-#: ../navit/country.c:102
-msgid "French Guiana"
-msgstr "Ð¤Ñ€Ð°Ð½Ñ†ÑƒÐ·ÐºÐ°Ñ Ð“Ð²Ð¸Ð½ÐµÑ"
-
-#. 831
-#: ../navit/country.c:103
-#, fuzzy
-msgid "Guernsey"
-msgstr "ГерманиÑ"
-
-#. 288
-#: ../navit/country.c:104
-msgid "Ghana"
-msgstr "Гхана"
-
-#. 292
-#: ../navit/country.c:105
-msgid "Gibraltar"
-msgstr "Гибралтар"
-
-#. 304
-#: ../navit/country.c:106
-msgid "Greenland"
-msgstr "ГренландиÑ"
-
-#. 270
-#: ../navit/country.c:107
-msgid "Gambia"
-msgstr "ГамбиÑ"
-
-#. 324
-#: ../navit/country.c:108
-msgid "Guinea"
-msgstr "ГвинеÑ"
-
-#. 312
-#: ../navit/country.c:109
-msgid "Guadeloupe"
-msgstr "Гуаделупа"
-
-#. 226
-#: ../navit/country.c:110
-msgid "Equatorial Guinea"
-msgstr "Ð­ÐºÐ²Ð°Ñ‚Ð¾Ñ€Ð¸Ð°Ð»ÑŒÐ½Ð°Ñ Ð“Ð²Ð¸Ð½ÐµÑ"
-
-#. 300
-#: ../navit/country.c:111
-msgid "Greece"
-msgstr "ГрециÑ"
-
-#. 239
-#: ../navit/country.c:112
-msgid "South Georgia and the South Sandwich Islands"
-msgstr "Ð®Ð¶Ð½Ð°Ñ Ð“ÐµÐ¾Ñ€Ð³Ð¸Ñ Ð¸ Южные Сандвичевы ОÑтрова"
-
-#. 320
-#: ../navit/country.c:113
-msgid "Guatemala"
-msgstr "Гватемала"
-
-#. 316
-#: ../navit/country.c:114
-msgid "Guam"
-msgstr "Гуам"
-
-#. 624
-#: ../navit/country.c:115
-msgid "Guinea-Bissau"
-msgstr "ГвинеÑ-БиÑау"
-
-#. 328
-#: ../navit/country.c:116
-msgid "Guyana"
-msgstr "Гуана"
-
-#. 344
-#: ../navit/country.c:117
-msgid "Hong Kong"
-msgstr "Гонк Конг"
-
-#. 334
-#: ../navit/country.c:118
-msgid "Heard Island and McDonald Islands"
-msgstr "ОÑтров Херд и оÑтрова Макдональд"
-
-#. 340
-#: ../navit/country.c:119
-msgid "Honduras"
-msgstr "ГандураÑ"
-
-#. 191
-#: ../navit/country.c:120
-msgid "Croatia"
-msgstr "ХорватиÑ"
-
-#. 332
-#: ../navit/country.c:121
-msgid "Haiti"
-msgstr "Гаити"
-
-#. 348
-#: ../navit/country.c:122
-msgid "Hungary"
-msgstr "ВенгриÑ"
-
-#. 360
-#: ../navit/country.c:123
-msgid "Indonesia"
-msgstr "ИндонезиÑ"
-
-#. 372
-#: ../navit/country.c:124
-msgid "Ireland"
-msgstr "ИрландиÑ"
-
-#. 376
-#: ../navit/country.c:125
-msgid "Israel"
-msgstr "Израиль"
-
-#. 833
-#: ../navit/country.c:126
-msgid "Isle of Man"
-msgstr "ОÑтров ÐœÑн"
-
-#. 356
-#: ../navit/country.c:127
-msgid "India"
-msgstr "ИндиÑ"
-
-#. 086
-#: ../navit/country.c:128
-msgid "British Indian Ocean Territory"
-msgstr "БританÑÐºÐ°Ñ Ð¢ÐµÑ€Ñ€Ð¸Ñ‚Ð¾Ñ€Ð¸Ñ Ð˜Ð½Ð´Ð¸Ñкого Океана"
-
-#. 368
-#: ../navit/country.c:129
-msgid "Iraq"
-msgstr "Ирак"
-
-#. 364
-#: ../navit/country.c:130
-msgid "Iran, Islamic Republic of"
-msgstr "Ирак, ИÑламÑÐºÐ°Ñ Ð”ÐµÐ¼Ð¾ÐºÑ€Ð°Ñ‚Ð¸Ñ‡ÐµÑÐºÐ°Ñ Ð ÐµÑпублика"
-
-#. 352
-#: ../navit/country.c:131
-msgid "Iceland"
-msgstr "ИÑландиÑ"
-
-#. 380
-#: ../navit/country.c:132
-msgid "Italy"
-msgstr "ИталиÑ"
-
-#. 832
-#: ../navit/country.c:133
-msgid "Jersey"
-msgstr "ДжерÑи"
-
-#. 388
-#: ../navit/country.c:134
-msgid "Jamaica"
-msgstr "Йамайка"
-
-#. 400
-#: ../navit/country.c:135
-msgid "Jordan"
-msgstr "ИорданиÑ"
-
-#. 392
-#: ../navit/country.c:136
-msgid "Japan"
-msgstr "ЯпониÑ"
-
-#. 404
-#: ../navit/country.c:137
-msgid "Kenya"
-msgstr "КениÑ"
-
-#. 417
-#: ../navit/country.c:138
-msgid "Kyrgyzstan"
-msgstr "Киргизтан"
-
-#. 116
-#: ../navit/country.c:139
-msgid "Cambodia"
-msgstr "КомбодиÑ"
-
-#. 296
-#: ../navit/country.c:140
-msgid "Kiribati"
-msgstr "Кирибати"
-
-#. 174
-#: ../navit/country.c:141
-msgid "Comoros"
-msgstr "КоморÑкие ОÑтрова"
-
-#. 659
-#: ../navit/country.c:142
-msgid "Saint Kitts and Nevis"
-msgstr "Сен ÐšÐ¸Ñ‚Ñ Ð¸ ÐевиÑ"
-
-#. 408
-#: ../navit/country.c:143
-msgid "Korea, Democratic People's Republic of"
-msgstr "КореÑ, ДемократичеÑÐºÐ°Ñ Ð ÐµÑпублика"
-
-#. 410
-#: ../navit/country.c:144
-msgid "Korea, Republic of"
-msgstr "КореÑ, РеÑпублика"
-
-#. 414
-#: ../navit/country.c:145
-msgid "Kuwait"
-msgstr "Кювайт"
-
-#. 136
-#: ../navit/country.c:146
-msgid "Cayman Islands"
-msgstr "КайманÑкие ОÑтрова"
-
-#. 398
-#: ../navit/country.c:147
-msgid "Kazakhstan"
-msgstr "КазахÑтан"
-
-#. 418
-#: ../navit/country.c:148
-msgid "Lao People's Democratic Republic"
-msgstr "Лао, ДемократичеÑÐºÐ°Ñ Ð ÐµÑпублика"
-
-#. 422
-#: ../navit/country.c:149
-msgid "Lebanon"
-msgstr "Ливан"
-
-#. 662
-#: ../navit/country.c:150
-msgid "Saint Lucia"
-msgstr "Сен-ЛуÑиÑ"
-
-#. 438
-#: ../navit/country.c:151
-msgid "Liechtenstein"
-msgstr "Лихтенштейн"
-
-#. 144
-#: ../navit/country.c:152
-msgid "Sri Lanka"
-msgstr "Шри Ланка"
-
-#. 430
-#: ../navit/country.c:153
-msgid "Liberia"
-msgstr "ЛибериÑ"
-
-#. 426
-#: ../navit/country.c:154
-msgid "Lesotho"
-msgstr "ЛеÑото"
-
-#. 440
-#: ../navit/country.c:155
-msgid "Lithuania"
-msgstr "Литва"
-
-#. 442
-#: ../navit/country.c:156
-msgid "Luxembourg"
-msgstr "ЛюкÑембург"
-
-#. 428
-#: ../navit/country.c:157
-msgid "Latvia"
-msgstr "ЛатвиÑ"
-
-#. 434
-#: ../navit/country.c:158
-msgid "Libyan Arab Jamahiriya"
-msgstr "ЛивиÑ"
-
-#. 504
-#: ../navit/country.c:159
-msgid "Morocco"
-msgstr "Марокко"
-
-#. 492
-#: ../navit/country.c:160
-msgid "Monaco"
-msgstr "Монако"
-
-#. 498
-#: ../navit/country.c:161
-msgid "Moldova, Republic of"
-msgstr "МолдовиÑ, РеÑпублика"
-
-#. 499
-#: ../navit/country.c:162
-msgid "Montenegro"
-msgstr "ЧерногориÑ"
-
-#. 663
-#: ../navit/country.c:163
-msgid "Saint Martin (French part)"
-msgstr "Сен-Мартин (Ð¤Ñ€Ð°Ð½Ñ†ÑƒÐ·ÐºÐ°Ñ Ñ‡Ð°ÑÑ‚ÑŒ)"
-
-#. 450
-#: ../navit/country.c:164
-msgid "Madagascar"
-msgstr "МадагаÑкар"
-
-#. 584
-#: ../navit/country.c:165
-msgid "Marshall Islands"
-msgstr "Маршаловы ОÑтрова"
-
-#. 807
-#: ../navit/country.c:166
-msgid "Macedonia, the former Yugoslav Republic of"
-msgstr "МакедониÑ, Ð±Ñ‹Ð²ÑˆÐ°Ñ Ñ€ÐµÑпублика ЮгоÑлавии"
-
-#. 466
-#: ../navit/country.c:167
-msgid "Mali"
-msgstr "Мали"
-
-#. 104
-#: ../navit/country.c:168
-msgid "Myanmar"
-msgstr "МьÑнма"
-
-#. 496
-#: ../navit/country.c:169
-msgid "Mongolia"
-msgstr "МонголиÑ"
-
-#. 446
-#: ../navit/country.c:170
-msgid "Macao"
-msgstr "Мокао"
-
-#. 580
-#: ../navit/country.c:171
-msgid "Northern Mariana Islands"
-msgstr "Северные МарианÑкие ОÑтрова"
-
-#. 474
-#: ../navit/country.c:172
-msgid "Martinique"
-msgstr "Мартиника"
-
-#. 478
-#: ../navit/country.c:173
-msgid "Mauritania"
-msgstr "МавританиÑ"
-
-#. 500
-#: ../navit/country.c:174
-msgid "Montserrat"
-msgstr "МонтÑеррат"
-
-#. 470
-#: ../navit/country.c:175
-msgid "Malta"
-msgstr "Мальта"
-
-#. 480
-#: ../navit/country.c:176
-msgid "Mauritius"
-msgstr "Маврикий"
-
-#. 462
-#: ../navit/country.c:177
-msgid "Maldives"
-msgstr "Мальдивы"
-
-#. 454
-#: ../navit/country.c:178
-msgid "Malawi"
-msgstr "Малави"
-
-#. 484
-#: ../navit/country.c:179
-msgid "Mexico"
-msgstr "МекÑика"
-
-#. 458
-#: ../navit/country.c:180
-msgid "Malaysia"
-msgstr "МалазиÑ"
-
-#. 508
-#: ../navit/country.c:181
-msgid "Mozambique"
-msgstr "Мозамбик"
-
-#. 516
-#: ../navit/country.c:182
-msgid "Namibia"
-msgstr "ÐамибиÑ"
-
-#. 540
-#: ../navit/country.c:183
-msgid "New Caledonia"
-msgstr "ÐÐ¾Ð²Ð°Ñ ÐšÐ°Ð»ÐµÐ´Ð¾Ð½Ð¸Ñ"
-
-#. 562
-#: ../navit/country.c:184
-msgid "Niger"
-msgstr "Ðигер"
-
-#. 574
-#: ../navit/country.c:185
-msgid "Norfolk Island"
-msgstr "Ðорфолк ОÑтров"
-
-#. 566
-#: ../navit/country.c:186
-msgid "Nigeria"
-msgstr "ÐигериÑ"
-
-#. 558
-#: ../navit/country.c:187
-msgid "Nicaragua"
-msgstr "Ðикарагуа"
-
-#. 528
-#: ../navit/country.c:188
-msgid "Netherlands"
-msgstr "Ðидерланды"
-
-#. 578
-#: ../navit/country.c:189
-msgid "Norway"
-msgstr "ÐорвегиÑ"
-
-#. 524
-#: ../navit/country.c:190
-msgid "Nepal"
-msgstr "Ðепал"
-
-#. 520
-#: ../navit/country.c:191
-msgid "Nauru"
-msgstr "Ðауру"
-
-#. 570
-#: ../navit/country.c:192
-msgid "Niue"
-msgstr "ÐиуÑ"
-
-#. 554
-#: ../navit/country.c:193
-msgid "New Zealand"
-msgstr "ÐÐ¾Ð²Ð°Ñ Ð—ÐµÐ»Ð°Ð½Ð´Ð¸Ñ"
-
-#. 512
-#: ../navit/country.c:194
-msgid "Oman"
-msgstr "Оман"
-
-#. 591
-#: ../navit/country.c:195
-msgid "Panama"
-msgstr "Панама"
-
-#. 604
-#: ../navit/country.c:196
-msgid "Peru"
-msgstr "Перу"
-
-#. 258
-#: ../navit/country.c:197
-msgid "French Polynesia"
-msgstr "ФранцуÑÐºÐ°Ñ ÐŸÐ¾Ð»Ð¸Ð½ÐµÐ·Ð¸Ñ"
-
-#. 598
-#: ../navit/country.c:198
-msgid "Papua New Guinea"
-msgstr "Папуа ÐÐ¾Ð²Ð°Ñ Ð“Ð²Ð¸Ð½ÐµÑ"
-
-#. 608
-#: ../navit/country.c:199
-msgid "Philippines"
-msgstr "Филипины"
-
-#. 586
-#: ../navit/country.c:200
-msgid "Pakistan"
-msgstr "ПакиÑтан"
-
-#. 616
-#: ../navit/country.c:201
-msgid "Poland"
-msgstr "Польша"
-
-#. 666
-#: ../navit/country.c:202
-msgid "Saint Pierre and Miquelon"
-msgstr "Сен-Пьер и Микелон"
-
-#. 612
-#: ../navit/country.c:203
-msgid "Pitcairn"
-msgstr "ПиткÑрн"
-
-#. 630
-#: ../navit/country.c:204
-msgid "Puerto Rico"
-msgstr "ПуÑрто Рико"
-
-#. 275
-#: ../navit/country.c:205
-msgid "Palestinian Territory, Occupied"
-msgstr "ПалеÑтина"
-
-#. 620
-#: ../navit/country.c:206
-msgid "Portugal"
-msgstr "ПортугалиÑ"
-
-#. 585
-#: ../navit/country.c:207
-msgid "Palau"
-msgstr "Палау"
-
-#. 600
-#: ../navit/country.c:208
-msgid "Paraguay"
-msgstr "Парагваи"
-
-#. 634
-#: ../navit/country.c:209
-msgid "Qatar"
-msgstr "Катар"
-
-#. 638
-#: ../navit/country.c:210
-msgid "Reunion"
-msgstr "Реюньон"
-
-#. 642
-#: ../navit/country.c:211
-msgid "Romania"
-msgstr "РумыниÑ"
-
-#. 688
-#: ../navit/country.c:212
-msgid "Serbia"
-msgstr "СербиÑ"
-
-#. 643
-#: ../navit/country.c:213
-msgid "Russian Federation"
-msgstr "РоÑÑийÑÐºÐ°Ñ Ð¤ÐµÐ´ÐµÑ€Ð°Ñ†Ð¸Ñ"
-
-#. 646
-#: ../navit/country.c:214
-msgid "Rwanda"
-msgstr "Руанда"
-
-#. 682
-#: ../navit/country.c:215
-msgid "Saudi Arabia"
-msgstr "СаудовÑÐºÐ°Ñ ÐравиÑ"
-
-#. 090
-#: ../navit/country.c:216
-msgid "Solomon Islands"
-msgstr "СоломонÑкие ОÑтрова"
-
-#. 690
-#: ../navit/country.c:217
-msgid "Seychelles"
-msgstr "СейшельÑкие ОÑтрова"
-
-#. 736
-#: ../navit/country.c:218
-msgid "Sudan"
-msgstr "Судан"
-
-#. 752
-#: ../navit/country.c:219
-msgid "Sweden"
-msgstr "ШвециÑ"
-
-#. 702
-#: ../navit/country.c:220
-msgid "Singapore"
-msgstr "Сингапур"
-
-#. 654
-#: ../navit/country.c:221
-msgid "Saint Helena"
-msgstr "Сент-Хелен"
-
-#. 705
-#: ../navit/country.c:222
-msgid "Slovenia"
-msgstr "СловениÑ"
-
-#. 744
-#: ../navit/country.c:223
-msgid "Svalbard and Jan Mayen"
-msgstr "Свальбард и Ян Майен"
-
-#. 703
-#: ../navit/country.c:224
-msgid "Slovakia"
-msgstr "СловакиÑ"
-
-#. 694
-#: ../navit/country.c:225
-msgid "Sierra Leone"
-msgstr "Сиерра Леоне"
-
-#. 674
-#: ../navit/country.c:226
-msgid "San Marino"
-msgstr "Сан Марино"
-
-#. 686
-#: ../navit/country.c:227
-msgid "Senegal"
-msgstr "Сенегал"
-
-#. 706
-#: ../navit/country.c:228
-msgid "Somalia"
-msgstr "Сомали"
-
-#. 740
-#: ../navit/country.c:229
-msgid "Suriname"
-msgstr "Суринам"
-
-#. 678
-#: ../navit/country.c:230
-msgid "Sao Tome and Principe"
-msgstr "Сао-Томе и ПринÑипи"
-
-#. 222
-#: ../navit/country.c:231
-msgid "El Salvador"
-msgstr "Эль Сальвадор"
-
-#. 760
-#: ../navit/country.c:232
-msgid "Syrian Arab Republic"
-msgstr "СириÑ, ÐрабÑÐºÐ°Ñ Ð ÐµÑпублика"
-
-#. 748
-#: ../navit/country.c:233
-msgid "Swaziland"
-msgstr "ШвейцариÑ"
-
-#. 796
-#: ../navit/country.c:234
-msgid "Turks and Caicos Islands"
-msgstr "Ð¢ÐµÑ€ÐºÑ Ð¸ КайкоÑ"
-
-#. 148
-#: ../navit/country.c:235
-msgid "Chad"
-msgstr "Чад"
-
-#. 260
-#: ../navit/country.c:236
-msgid "French Southern Territories"
-msgstr "Францизкие Южные Территории"
-
-#. 768
-#: ../navit/country.c:237
-msgid "Togo"
-msgstr "Того"
-
-#. 764
-#: ../navit/country.c:238
-msgid "Thailand"
-msgstr "Таиланд"
-
-#. 762
-#: ../navit/country.c:239
-msgid "Tajikistan"
-msgstr "ТаджикиÑтан"
-
-#. 772
-#: ../navit/country.c:240
-msgid "Tokelau"
-msgstr "Токелау"
-
-#. 626
-#: ../navit/country.c:241
-msgid "Timor-Leste"
-msgstr "ВоÑточный Тимор"
-
-#. 795
-#: ../navit/country.c:242
-msgid "Turkmenistan"
-msgstr "ТуркмениÑтан"
-
-#. 788
-#: ../navit/country.c:243
-msgid "Tunisia"
-msgstr "ТуниÑ"
-
-#. 776
-#: ../navit/country.c:244
-msgid "Tonga"
-msgstr "Тонга"
-
-#. 792
-#: ../navit/country.c:245
-msgid "Turkey"
-msgstr "ТурциÑ"
-
-#. 780
-#: ../navit/country.c:246
-msgid "Trinidad and Tobago"
-msgstr "Тринидад и Тобаго"
-
-#. 798
-#: ../navit/country.c:247
-msgid "Tuvalu"
-msgstr "Тувалу"
-
-#. 158
-#: ../navit/country.c:248
-msgid "Taiwan, Province of China"
-msgstr "Тайвань, ÐŸÑ€Ð¾Ð²Ð¸Ð½Ñ†Ð¸Ñ ÐšÐ¸Ñ‚Ð°Ñ"
-
-#. 834
-#: ../navit/country.c:249
-msgid "Tanzania, United Republic of"
-msgstr "ТанзиÑ, ÐžÐ±ÑŠÐµÐ´ÐµÐ½ÐµÐ½Ð½Ð°Ñ Ð ÐµÑпублика"
-
-#. 804
-#: ../navit/country.c:250
-msgid "Ukraine"
-msgstr "Украина"
-
-#. 800
-#: ../navit/country.c:251
-msgid "Uganda"
-msgstr "Уганда"
-
-#. 581
-#: ../navit/country.c:252
-msgid "United States Minor Outlying Islands"
-msgstr "Внешние Малые ОÑтрова Соединённых Штатов"
-
-#. 840
-#: ../navit/country.c:253
-msgid "United States"
-msgstr "СШÐ"
-
-#. 858
-#: ../navit/country.c:254
-msgid "Uruguay"
-msgstr "Уругвай"
-
-#. 860
-#: ../navit/country.c:255
-msgid "Uzbekistan"
-msgstr "УзбекиÑтан"
-
-#. 336
-#: ../navit/country.c:256
-msgid "Holy See (Vatican City State)"
-msgstr "Ватикан"
-
-#. 670
-#: ../navit/country.c:257
-msgid "Saint Vincent and the Grenadines"
-msgstr "Сент-ВинÑент и Гренадины"
-
-#. 862
-#: ../navit/country.c:258
-msgid "Venezuela"
-msgstr "ВенеÑуÑла"
-
-#. 092
-#: ../navit/country.c:259
-msgid "Virgin Islands, British"
-msgstr "ВиргинÑкие ОÑтрова, БританиÑ"
-
-#. 850
-#: ../navit/country.c:260
-msgid "Virgin Islands, U.S."
-msgstr "ВиргинÑкие ОÑтрова, СШÐ"
-
-#. 704
-#: ../navit/country.c:261
-msgid "Viet Nam"
-msgstr "Вьетнам"
-
-#. 548
-#: ../navit/country.c:262
-msgid "Vanuatu"
-msgstr "Вануату"
-
-#. 876
-#: ../navit/country.c:263
-msgid "Wallis and Futuna"
-msgstr "Ð£Ð¾Ð»Ð»Ð¸Ñ Ð¸ Футуна"
-
-#. 882
-#: ../navit/country.c:264
-msgid "Samoa"
-msgstr "Самоа"
-
-#. 887
-#: ../navit/country.c:265
-msgid "Yemen"
-msgstr "Йемен"
-
-#. 175
-#: ../navit/country.c:266
-msgid "Mayotte"
-msgstr "Майотта"
-
-#. 710
-#: ../navit/country.c:267
-msgid "South Africa"
-msgstr "Ð®Ð¶Ð½Ð°Ñ Ðфрика"
-
-#. 894
-#: ../navit/country.c:268
-msgid "Zambia"
-msgstr "ЗамбиÑ"
-
-#. 716
-#: ../navit/country.c:269
-msgid "Zimbabwe"
-msgstr "ЗимбабвÑ"
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:98
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-msgid "Car"
-msgstr "Ðвто"
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso2"
-msgstr "Iso2"
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso3"
-msgstr "Iso3"
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:403
-msgid "Country"
-msgstr "Страна"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "Postal"
-msgstr "ИндекÑ"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "Town"
-msgstr "Город"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "District"
-msgstr "Район"
-
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-#: ../navit/gui/gtk/destination.c:412
-msgid "Street"
-msgstr "Улица"
-
-#: ../navit/gui/gtk/destination.c:100 ../navit/gui/gtk/destination.c:414
-msgid "Number"
-msgstr "Ðомер"
-
-#: ../navit/gui/gtk/destination.c:398
-msgid "Enter Destination"
-msgstr "Введите пункт назначениÑ"
-
-#: ../navit/gui/gtk/destination.c:405
-msgid "Zip Code"
-msgstr "ИндекÑ"
-
-#: ../navit/gui/gtk/destination.c:407
-msgid "City"
-msgstr "Город"
-
-#: ../navit/gui/gtk/destination.c:409
-msgid "District/Township"
-msgstr "Район"
-
-#: ../navit/gui/gtk/destination.c:437 ../navit/gui/gtk/gui_gtk_action.c:153
-msgid "Map"
-msgstr "Карта"
-
-#: ../navit/gui/gtk/destination.c:438
-msgid "Bookmark"
-msgstr "Закладка"
-
-#: ../navit/gui/gtk/destination.c:439 ../navit/gui/gtk/gui_gtk_action.c:166
-msgid "Destination"
-msgstr "Пункт назначениÑ"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:149
-msgid "Display"
-msgstr "ДиÑплей"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:150
-msgid "Route"
-msgstr "Маршрут"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:154
-msgid "Layout"
-msgstr "Схема"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:155
-msgid "Projection"
-msgstr "ПроекциÑ"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:156
-msgid "Vehicle"
-msgstr "Т/Ñ"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:157
-msgid "ZoomOut"
-msgstr "Уменьшить"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:158
-msgid "ZoomIn"
-msgstr "Увеличить"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:159
-msgid "Refresh"
-msgstr "Обновить"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:162 ../navit/gui/gtk/gui_gtk_action.c:164
-msgid "Info"
-msgstr "ИнформациÑ"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:167
-msgid "Clear"
-msgstr "ОчиÑтить"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:168
-msgid "Test"
-msgstr "ТеÑÑ‚"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:169
-msgid "_Quit"
-msgstr "_Выход"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:176
-msgid "Cursor"
-msgstr "КурÑор"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:177
-msgid "Tracking"
-msgstr "Слежение"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:178
-msgid "Orientation"
-msgstr "ОриентациÑ"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:180 ../navit/gui/gtk/gui_gtk_action.c:182
-msgid "Fullscreen"
-msgstr "Во веÑÑŒ Ñкран"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:190
-msgid "Data"
-msgstr "Данные"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "N"
-msgstr "С"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NE"
-msgstr "СВ"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "E"
-msgstr "Ð’"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SE"
-msgstr "ЮВ"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "S"
-msgstr "Ю"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SW"
-msgstr "ЮЗ"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "W"
-msgstr "З"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NW"
-msgstr "СЗ"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:103
-#, c-format
-msgid "Route %4.0fkm %02d:%02d ETA"
-msgstr "Маршрут %4.0fкм %02d:%02d РВП"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:148
-msgid "Route 0000km 0+00:00 ETA"
-msgstr "Маршрут 0000км 0+00:00 РВП"
diff --git a/po/sk.po b/po/sk.po
deleted file mode 100644
index 4d779dbe..00000000
--- a/po/sk.po
+++ /dev/null
@@ -1,1707 +0,0 @@
-# Translation of Navit to Slovak language
-# Copyright (C) 2008 THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: Navit 0.1.0\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-05-26 17:12+0200\n"
-"PO-Revision-Date: 2008-05-27 04:48+0000\n"
-"Last-Translator: Eduard DRUSA <Unknown>\n"
-"Language-Team: SlovenÄina\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=3; plural=(n==1) ? 1 : (n>=2 && n<=4) ? 2 : 0;\n"
-"X-Launchpad-Export-Date: 2008-05-30 21:28+0000\n"
-"X-Generator: Launchpad (build Unknown)\n"
-
-#~ msgid "Turn %1$s%2$s %3$s"
-#~ msgstr "OdboÄte %1$s%2$s %3$s"
-
-#~ msgid "Moldova"
-#~ msgstr "Moldavsko"
-
-#~ msgid "Syria"
-#~ msgstr "Sýria"
-
-#~ msgid "Libia"
-#~ msgstr "Líbya"
-
-#~ msgid "Palestinia"
-#~ msgstr "Palestína"
-
-#~ msgid "Macedonia"
-#~ msgstr "Macedónsko"
-
-#~ msgid "VisibleBlocks"
-#~ msgstr "Viditeľné bloky"
-
-#~ msgid "VisibleTowns"
-#~ msgstr "Viditeľné mestá"
-
-#~ msgid "VisiblePolys"
-#~ msgstr "Viditeľné polygony"
-
-#~ msgid "VisibleStreets"
-#~ msgstr "Viditeľné ulice"
-
-#~ msgid "VisiblePoints"
-#~ msgstr "Viditeľné body"
-
-#: ../navit/main.c:111
-#, c-format
-msgid ""
-"navit usage:\n"
-"navit [options] [configfile]\n"
-"\t-c <file>: use <file> as config file\n"
-"\t-d <n>: set the debug output level to <n>. (TODO)\n"
-"\t-h: print this usage info and exit.\n"
-"\t-v: Print the version and exit.\n"
-msgstr ""
-
-#: ../navit/main.c:131
-#, c-format
-msgid "Running from source directory\n"
-msgstr "Beží zo zdrojového adresára\n"
-
-#: ../navit/main.c:147
-#, c-format
-msgid "setting '%s' to '%s'\n"
-msgstr "nastavujem '%s' na '%s'\n"
-
-#. We have not found an existing config file from all possibilities
-#: ../navit/main.c:248
-#, c-format
-msgid "No config file navit.xml, navit.xml.local found\n"
-msgstr "NenaÅ¡iel sa konfiguraÄný súbor navit.xml ani navit.xml.local\n"
-
-#: ../navit/main.c:255
-#, c-format
-msgid "Error parsing '%s': %s\n"
-msgstr "Chyba pri spracovávaní '%s': %s\n"
-
-#: ../navit/main.c:258
-#, c-format
-msgid "Using '%s'\n"
-msgstr "Používam '%s'\n"
-
-#: ../navit/main.c:261
-#, c-format
-msgid "No instance has been created, exiting\n"
-msgstr "Nebola vytvorená žiadna inÅ¡tancia, ukonÄujem beh\n"
-
-#: ../navit/navigation.c:171
-#, c-format
-msgid "%d m"
-msgstr "%d m"
-
-#: ../navit/navigation.c:173
-#, c-format
-msgid "in %d m"
-msgstr "o %d m"
-
-#: ../navit/navigation.c:177
-#, c-format
-msgid "%d meters"
-msgstr "%d metrov"
-
-#: ../navit/navigation.c:179
-#, c-format
-msgid "in %d meters"
-msgstr "o %d metrov"
-
-#: ../navit/navigation.c:185
-#, c-format
-msgid "%d.%d kilometer"
-msgstr "%d.%d kilometra"
-
-#: ../navit/navigation.c:187
-#, c-format
-msgid "in %d.%d kilometers"
-msgstr "o %d.%d kilometrov"
-
-#: ../navit/navigation.c:191
-#, c-format
-msgid "one kilometer"
-msgid_plural "%d kilometers"
-msgstr[0] "%d kilometrov"
-msgstr[1] "jeden kilometer"
-msgstr[2] "%d kilometrov"
-
-#: ../navit/navigation.c:193
-#, c-format
-msgid "in one kilometer"
-msgid_plural "in %d kilometers"
-msgstr[0] "o %d kilometrov"
-msgstr[1] "o jeden kilometer"
-msgstr[2] "o %d kilometrov"
-
-#: ../navit/navigation.c:447
-msgid "exit"
-msgstr ""
-
-#: ../navit/navigation.c:449
-msgid "ramp"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name
-#: ../navit/navigation.c:479
-#, c-format
-msgid "%sinto the street %s%s%s"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Male form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:483
-#, c-format
-msgid "%sinto the %s%s%s|male form"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Female form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:487
-#, c-format
-msgid "%sinto the %s%s%s|female form"
-msgstr ""
-
-#. TRANSLATORS: Arguments: 1: Prefix (Space if required) 2: Street Name 3: Separator (Space if required), 4: Systematic Street Name. Neutral form. The stuff after | doesn't have to be included
-#: ../navit/navigation.c:491
-#, c-format
-msgid "%sinto the %s%s%s|neutral form"
-msgstr ""
-
-#: ../navit/navigation.c:497
-#, c-format
-msgid "into the %s"
-msgstr ""
-
-#: ../navit/navigation.c:518
-msgid "right"
-msgstr "vpravo"
-
-#: ../navit/navigation.c:525
-msgid "left"
-msgstr "vľavo"
-
-#: ../navit/navigation.c:529
-msgid "easily "
-msgstr "mierne "
-
-#: ../navit/navigation.c:533
-msgid "strongly "
-msgstr "prudko "
-
-#: ../navit/navigation.c:536
-msgid "unknown "
-msgstr "neznámy "
-
-#: ../navit/navigation.c:542
-msgid "When possible, please turn around"
-msgstr "Ak je to možné, prosím, otoÄte sa"
-
-#: ../navit/navigation.c:549
-#, c-format
-msgid "Follow the road for the next %s"
-msgstr "PokraÄujte naÄalej po ceste %s"
-
-#: ../navit/navigation.c:553
-msgid "soon"
-msgstr "onedlho"
-
-#: ../navit/navigation.c:559
-msgid "now"
-msgstr "teraz"
-
-#: ../navit/navigation.c:562
-msgid "error"
-msgstr "chyba"
-
-#. TRANSLATORS: The first argument is strength, the second direction, the third distance and the fourth destination Example: 'Turn 'slightly' 'left' in '100 m' 'onto baker street'
-#: ../navit/navigation.c:591
-#, c-format
-msgid "Turn %1$s%2$s %3$s%4$s"
-msgstr ""
-
-#: ../navit/navigation.c:594
-#, c-format
-msgid "You have reached your destination %s"
-msgstr "Do svojho cieľa dorazite %s"
-
-#: ../navit/navit.c:664 ../navit/gui/gtk/gui_gtk_action.c:151
-msgid "Former Destinations"
-msgstr "Predošlé cieľe"
-
-#: ../navit/navit.c:674 ../navit/gui/gtk/gui_gtk_action.c:152
-msgid "Bookmarks"
-msgstr "Záložky"
-
-#: ../navit/navit.c:764
-msgid "Command"
-msgstr "Príkaz"
-
-#: ../navit/navit.c:769
-msgid "Length"
-msgstr "Vzdialenosť"
-
-#: ../navit/navit.c:773 ../navit/navit.c:798
-msgid "km"
-msgstr "km"
-
-#: ../navit/navit.c:777 ../navit/navit.c:802
-msgid "m"
-msgstr "m"
-
-#: ../navit/navit.c:783
-msgid "Time"
-msgstr "ÄŒas"
-
-#: ../navit/navit.c:795
-msgid "Destination Length"
-msgstr "Vzdialenosť cieľa"
-
-#: ../navit/navit.c:808
-msgid "Destination Time"
-msgstr "Čas k cieľu"
-
-#: ../navit/navit.c:837 ../navit/gui/gtk/gui_gtk_action.c:160
-msgid "Roadbook"
-msgstr "Plán trasy"
-
-#: ../navit/popup.c:200 ../navit/popup.c:254
-msgid "Set as position"
-msgstr "Nastaviť ako pozíciu"
-
-#: ../navit/popup.c:201 ../navit/popup.c:255
-msgid "Set as destination"
-msgstr "Nastaviť ako cieľ"
-
-#: ../navit/popup.c:202 ../navit/popup.c:256
-msgid "Add as bookmark"
-msgstr "Pridať ako záložku"
-
-#: ../navit/popup.c:244
-#, c-format
-msgid "Point 0x%x 0x%x"
-msgstr "Bod 0x%x 0x%x"
-
-#: ../navit/popup.c:245
-#, c-format
-msgid "Screen coord : %d %d"
-msgstr "Súradnice obrazovky: %d %d"
-
-#. 020
-#: ../navit/country.c:24
-msgid "Andorra"
-msgstr "Andorra"
-
-#. 784
-#: ../navit/country.c:25
-msgid "United Arab Emirates"
-msgstr ""
-
-#. 004
-#: ../navit/country.c:26
-msgid "Afghanistan"
-msgstr ""
-
-#. 028
-#: ../navit/country.c:27
-msgid "Antigua and Barbuda"
-msgstr ""
-
-#. 660
-#: ../navit/country.c:28
-msgid "Anguilla"
-msgstr ""
-
-#. 008
-#: ../navit/country.c:29
-msgid "Albania"
-msgstr "Albánsko"
-
-#. 051
-#: ../navit/country.c:30
-msgid "Armenia"
-msgstr "Arménsko"
-
-#. 530
-#: ../navit/country.c:31
-msgid "Netherlands Antilles"
-msgstr ""
-
-#. 024
-#: ../navit/country.c:32
-msgid "Angola"
-msgstr ""
-
-#. 010
-#: ../navit/country.c:33
-msgid "Antarctica"
-msgstr ""
-
-#. 032
-#: ../navit/country.c:34
-msgid "Argentina"
-msgstr ""
-
-#. 016
-#: ../navit/country.c:35
-msgid "American Samoa"
-msgstr ""
-
-#. 040
-#: ../navit/country.c:36
-msgid "Austria"
-msgstr "Rakúsko"
-
-#. 036
-#: ../navit/country.c:37
-msgid "Australia"
-msgstr ""
-
-#. 533
-#: ../navit/country.c:38
-msgid "Aruba"
-msgstr ""
-
-#. 248
-#: ../navit/country.c:39
-msgid "Aland Islands"
-msgstr ""
-
-#. 031
-#: ../navit/country.c:40
-msgid "Azerbaijan"
-msgstr "Azerbajdžan"
-
-#. 070
-#: ../navit/country.c:41
-msgid "Bosnia and Herzegovina"
-msgstr "Bosna a Hercegovina"
-
-#. 052
-#: ../navit/country.c:42
-msgid "Barbados"
-msgstr ""
-
-#. 050
-#: ../navit/country.c:43
-msgid "Bangladesh"
-msgstr ""
-
-#. 056
-#: ../navit/country.c:44
-msgid "Belgium"
-msgstr "Belgicko"
-
-#. 854
-#: ../navit/country.c:45
-msgid "Burkina Faso"
-msgstr ""
-
-#. 100
-#: ../navit/country.c:46
-msgid "Bulgaria"
-msgstr "Bulharsko"
-
-#. 048
-#: ../navit/country.c:47
-msgid "Bahrain"
-msgstr ""
-
-#. 108
-#: ../navit/country.c:48
-msgid "Burundi"
-msgstr ""
-
-#. 204
-#: ../navit/country.c:49
-msgid "Benin"
-msgstr ""
-
-#. 652
-#: ../navit/country.c:50
-msgid "Saint Barthelemy"
-msgstr ""
-
-#. 060
-#: ../navit/country.c:51
-msgid "Bermuda"
-msgstr ""
-
-#. 096
-#: ../navit/country.c:52
-msgid "Brunei Darussalam"
-msgstr ""
-
-#. 068
-#: ../navit/country.c:53
-msgid "Bolivia"
-msgstr ""
-
-#. 076
-#: ../navit/country.c:54
-msgid "Brazil"
-msgstr ""
-
-#. 044
-#: ../navit/country.c:55
-msgid "Bahamas"
-msgstr ""
-
-#. 064
-#: ../navit/country.c:56
-msgid "Bhutan"
-msgstr ""
-
-#. 074
-#: ../navit/country.c:57
-msgid "Bouvet Island"
-msgstr ""
-
-#. 072
-#: ../navit/country.c:58
-msgid "Botswana"
-msgstr ""
-
-#. 112
-#: ../navit/country.c:59
-msgid "Belarus"
-msgstr "Bielorusko"
-
-#. 084
-#: ../navit/country.c:60
-msgid "Belize"
-msgstr ""
-
-#. 124
-#: ../navit/country.c:61
-msgid "Canada"
-msgstr ""
-
-#. 166
-#: ../navit/country.c:62
-msgid "Cocos (Keeling) Islands"
-msgstr ""
-
-#. 180
-#: ../navit/country.c:63
-msgid "Congo, Democratic Republic of the"
-msgstr ""
-
-#. 140
-#: ../navit/country.c:64
-msgid "Central African Republic"
-msgstr ""
-
-#. 178
-#: ../navit/country.c:65
-msgid "Congo"
-msgstr ""
-
-#. 756
-#: ../navit/country.c:66
-msgid "Switzerland"
-msgstr "Å vajÄiarsko"
-
-#. 384
-#: ../navit/country.c:67
-msgid "Cote d'Ivoire"
-msgstr ""
-
-#. 184
-#: ../navit/country.c:68
-msgid "Cook Islands"
-msgstr ""
-
-#. 152
-#: ../navit/country.c:69
-msgid "Chile"
-msgstr ""
-
-#. 120
-#: ../navit/country.c:70
-msgid "Cameroon"
-msgstr ""
-
-#. 156
-#: ../navit/country.c:71
-msgid "China"
-msgstr ""
-
-#. 170
-#: ../navit/country.c:72
-msgid "Colombia"
-msgstr ""
-
-#. 188
-#: ../navit/country.c:73
-msgid "Costa Rica"
-msgstr ""
-
-#. 192
-#: ../navit/country.c:74
-msgid "Cuba"
-msgstr ""
-
-#. 132
-#: ../navit/country.c:75
-msgid "Cape Verde"
-msgstr ""
-
-#. 162
-#: ../navit/country.c:76
-msgid "Christmas Island"
-msgstr ""
-
-#. 196
-#: ../navit/country.c:77
-msgid "Cyprus"
-msgstr "Cyprus"
-
-#. 203
-#: ../navit/country.c:78
-msgid "Czech Republic"
-msgstr "Česká Republika"
-
-#. 276
-#: ../navit/country.c:79
-msgid "Germany"
-msgstr "Nemecko"
-
-#. 262
-#: ../navit/country.c:80
-msgid "Djibouti"
-msgstr ""
-
-#. 208
-#: ../navit/country.c:81
-msgid "Denmark"
-msgstr "Dánsko"
-
-#. 212
-#: ../navit/country.c:82
-msgid "Dominica"
-msgstr ""
-
-#. 214
-#: ../navit/country.c:83
-msgid "Dominican Republic"
-msgstr ""
-
-#. 012
-#: ../navit/country.c:84
-msgid "Algeria"
-msgstr "Alžírsko"
-
-#. 218
-#: ../navit/country.c:85
-msgid "Ecuador"
-msgstr ""
-
-#. 233
-#: ../navit/country.c:86
-msgid "Estonia"
-msgstr "Estónsko"
-
-#. 818
-#: ../navit/country.c:87
-msgid "Egypt"
-msgstr "Egypt"
-
-#. 732
-#: ../navit/country.c:88
-msgid "Western Sahara"
-msgstr "Západná Sahara"
-
-#. 232
-#: ../navit/country.c:89
-msgid "Eritrea"
-msgstr ""
-
-#. 724
-#: ../navit/country.c:90
-msgid "Spain"
-msgstr "Å panielsko"
-
-#. 231
-#: ../navit/country.c:91
-msgid "Ethiopia"
-msgstr ""
-
-#. 246
-#: ../navit/country.c:92
-msgid "Finland"
-msgstr "Fínsko"
-
-#. 242
-#: ../navit/country.c:93
-msgid "Fiji"
-msgstr ""
-
-#. 238
-#: ../navit/country.c:94
-msgid "Falkland Islands (Malvinas)"
-msgstr ""
-
-#. 583
-#: ../navit/country.c:95
-msgid "Micronesia, Federated States of"
-msgstr ""
-
-#. 234
-#: ../navit/country.c:96
-msgid "Faroe Islands"
-msgstr "Faerské ostrovy"
-
-#. 250
-#: ../navit/country.c:97
-msgid "France"
-msgstr "Francúzsko"
-
-#. 266
-#: ../navit/country.c:98
-msgid "Gabon"
-msgstr ""
-
-#. 826
-#: ../navit/country.c:99
-msgid "United Kingdom"
-msgstr "Spojené kráľovstvo"
-
-#. 308
-#: ../navit/country.c:100
-msgid "Grenada"
-msgstr ""
-
-#. 268
-#: ../navit/country.c:101
-msgid "Georgia"
-msgstr "Gruzínsko"
-
-#. 254
-#: ../navit/country.c:102
-msgid "French Guiana"
-msgstr ""
-
-#. 831
-#: ../navit/country.c:103
-msgid "Guernsey"
-msgstr ""
-
-#. 288
-#: ../navit/country.c:104
-msgid "Ghana"
-msgstr ""
-
-#. 292
-#: ../navit/country.c:105
-msgid "Gibraltar"
-msgstr "Gibraltár"
-
-#. 304
-#: ../navit/country.c:106
-msgid "Greenland"
-msgstr ""
-
-#. 270
-#: ../navit/country.c:107
-msgid "Gambia"
-msgstr ""
-
-#. 324
-#: ../navit/country.c:108
-msgid "Guinea"
-msgstr ""
-
-#. 312
-#: ../navit/country.c:109
-msgid "Guadeloupe"
-msgstr ""
-
-#. 226
-#: ../navit/country.c:110
-msgid "Equatorial Guinea"
-msgstr ""
-
-#. 300
-#: ../navit/country.c:111
-msgid "Greece"
-msgstr "Grécko"
-
-#. 239
-#: ../navit/country.c:112
-msgid "South Georgia and the South Sandwich Islands"
-msgstr ""
-
-#. 320
-#: ../navit/country.c:113
-msgid "Guatemala"
-msgstr ""
-
-#. 316
-#: ../navit/country.c:114
-msgid "Guam"
-msgstr ""
-
-#. 624
-#: ../navit/country.c:115
-msgid "Guinea-Bissau"
-msgstr ""
-
-#. 328
-#: ../navit/country.c:116
-msgid "Guyana"
-msgstr ""
-
-#. 344
-#: ../navit/country.c:117
-msgid "Hong Kong"
-msgstr ""
-
-#. 334
-#: ../navit/country.c:118
-msgid "Heard Island and McDonald Islands"
-msgstr ""
-
-#. 340
-#: ../navit/country.c:119
-msgid "Honduras"
-msgstr ""
-
-#. 191
-#: ../navit/country.c:120
-msgid "Croatia"
-msgstr "Chorvátsko"
-
-#. 332
-#: ../navit/country.c:121
-msgid "Haiti"
-msgstr ""
-
-#. 348
-#: ../navit/country.c:122
-msgid "Hungary"
-msgstr "MaÄarsko"
-
-#. 360
-#: ../navit/country.c:123
-msgid "Indonesia"
-msgstr ""
-
-#. 372
-#: ../navit/country.c:124
-msgid "Ireland"
-msgstr "Ãrsko"
-
-#. 376
-#: ../navit/country.c:125
-msgid "Israel"
-msgstr "Izrael"
-
-#. 833
-#: ../navit/country.c:126
-msgid "Isle of Man"
-msgstr ""
-
-#. 356
-#: ../navit/country.c:127
-msgid "India"
-msgstr ""
-
-#. 086
-#: ../navit/country.c:128
-msgid "British Indian Ocean Territory"
-msgstr ""
-
-#. 368
-#: ../navit/country.c:129
-msgid "Iraq"
-msgstr ""
-
-#. 364
-#: ../navit/country.c:130
-msgid "Iran, Islamic Republic of"
-msgstr ""
-
-#. 352
-#: ../navit/country.c:131
-msgid "Iceland"
-msgstr "Island"
-
-#. 380
-#: ../navit/country.c:132
-msgid "Italy"
-msgstr "Taliansko"
-
-#. 832
-#: ../navit/country.c:133
-msgid "Jersey"
-msgstr ""
-
-#. 388
-#: ../navit/country.c:134
-msgid "Jamaica"
-msgstr ""
-
-#. 400
-#: ../navit/country.c:135
-msgid "Jordan"
-msgstr "Jordánsko"
-
-#. 392
-#: ../navit/country.c:136
-msgid "Japan"
-msgstr ""
-
-#. 404
-#: ../navit/country.c:137
-msgid "Kenya"
-msgstr ""
-
-#. 417
-#: ../navit/country.c:138
-msgid "Kyrgyzstan"
-msgstr ""
-
-#. 116
-#: ../navit/country.c:139
-msgid "Cambodia"
-msgstr ""
-
-#. 296
-#: ../navit/country.c:140
-msgid "Kiribati"
-msgstr ""
-
-#. 174
-#: ../navit/country.c:141
-msgid "Comoros"
-msgstr ""
-
-#. 659
-#: ../navit/country.c:142
-msgid "Saint Kitts and Nevis"
-msgstr ""
-
-#. 408
-#: ../navit/country.c:143
-msgid "Korea, Democratic People's Republic of"
-msgstr ""
-
-#. 410
-#: ../navit/country.c:144
-msgid "Korea, Republic of"
-msgstr ""
-
-#. 414
-#: ../navit/country.c:145
-msgid "Kuwait"
-msgstr ""
-
-#. 136
-#: ../navit/country.c:146
-msgid "Cayman Islands"
-msgstr ""
-
-#. 398
-#: ../navit/country.c:147
-msgid "Kazakhstan"
-msgstr ""
-
-#. 418
-#: ../navit/country.c:148
-msgid "Lao People's Democratic Republic"
-msgstr ""
-
-#. 422
-#: ../navit/country.c:149
-msgid "Lebanon"
-msgstr "Libanon"
-
-#. 662
-#: ../navit/country.c:150
-msgid "Saint Lucia"
-msgstr ""
-
-#. 438
-#: ../navit/country.c:151
-msgid "Liechtenstein"
-msgstr "Lichtenštajnsko"
-
-#. 144
-#: ../navit/country.c:152
-msgid "Sri Lanka"
-msgstr ""
-
-#. 430
-#: ../navit/country.c:153
-msgid "Liberia"
-msgstr ""
-
-#. 426
-#: ../navit/country.c:154
-msgid "Lesotho"
-msgstr ""
-
-#. 440
-#: ../navit/country.c:155
-msgid "Lithuania"
-msgstr "Litva"
-
-#. 442
-#: ../navit/country.c:156
-msgid "Luxembourg"
-msgstr "Luxembursko"
-
-#. 428
-#: ../navit/country.c:157
-msgid "Latvia"
-msgstr "Lotyšsko"
-
-#. 434
-#: ../navit/country.c:158
-msgid "Libyan Arab Jamahiriya"
-msgstr ""
-
-#. 504
-#: ../navit/country.c:159
-msgid "Morocco"
-msgstr "Maroko"
-
-#. 492
-#: ../navit/country.c:160
-msgid "Monaco"
-msgstr "Monako"
-
-#. 498
-#: ../navit/country.c:161
-msgid "Moldova, Republic of"
-msgstr ""
-
-#. 499
-#: ../navit/country.c:162
-msgid "Montenegro"
-msgstr ""
-
-#. 663
-#: ../navit/country.c:163
-msgid "Saint Martin (French part)"
-msgstr ""
-
-#. 450
-#: ../navit/country.c:164
-msgid "Madagascar"
-msgstr ""
-
-#. 584
-#: ../navit/country.c:165
-msgid "Marshall Islands"
-msgstr ""
-
-#. 807
-#: ../navit/country.c:166
-msgid "Macedonia, the former Yugoslav Republic of"
-msgstr ""
-
-#. 466
-#: ../navit/country.c:167
-msgid "Mali"
-msgstr ""
-
-#. 104
-#: ../navit/country.c:168
-msgid "Myanmar"
-msgstr ""
-
-#. 496
-#: ../navit/country.c:169
-msgid "Mongolia"
-msgstr ""
-
-#. 446
-#: ../navit/country.c:170
-msgid "Macao"
-msgstr ""
-
-#. 580
-#: ../navit/country.c:171
-msgid "Northern Mariana Islands"
-msgstr ""
-
-#. 474
-#: ../navit/country.c:172
-msgid "Martinique"
-msgstr ""
-
-#. 478
-#: ../navit/country.c:173
-msgid "Mauritania"
-msgstr ""
-
-#. 500
-#: ../navit/country.c:174
-msgid "Montserrat"
-msgstr ""
-
-#. 470
-#: ../navit/country.c:175
-msgid "Malta"
-msgstr "Malta"
-
-#. 480
-#: ../navit/country.c:176
-msgid "Mauritius"
-msgstr ""
-
-#. 462
-#: ../navit/country.c:177
-msgid "Maldives"
-msgstr ""
-
-#. 454
-#: ../navit/country.c:178
-msgid "Malawi"
-msgstr ""
-
-#. 484
-#: ../navit/country.c:179
-msgid "Mexico"
-msgstr ""
-
-#. 458
-#: ../navit/country.c:180
-msgid "Malaysia"
-msgstr ""
-
-#. 508
-#: ../navit/country.c:181
-msgid "Mozambique"
-msgstr ""
-
-#. 516
-#: ../navit/country.c:182
-msgid "Namibia"
-msgstr ""
-
-#. 540
-#: ../navit/country.c:183
-msgid "New Caledonia"
-msgstr ""
-
-#. 562
-#: ../navit/country.c:184
-msgid "Niger"
-msgstr ""
-
-#. 574
-#: ../navit/country.c:185
-msgid "Norfolk Island"
-msgstr ""
-
-#. 566
-#: ../navit/country.c:186
-msgid "Nigeria"
-msgstr ""
-
-#. 558
-#: ../navit/country.c:187
-msgid "Nicaragua"
-msgstr ""
-
-#. 528
-#: ../navit/country.c:188
-msgid "Netherlands"
-msgstr "Holandsko"
-
-#. 578
-#: ../navit/country.c:189
-msgid "Norway"
-msgstr "Nórsko"
-
-#. 524
-#: ../navit/country.c:190
-msgid "Nepal"
-msgstr ""
-
-#. 520
-#: ../navit/country.c:191
-msgid "Nauru"
-msgstr ""
-
-#. 570
-#: ../navit/country.c:192
-msgid "Niue"
-msgstr ""
-
-#. 554
-#: ../navit/country.c:193
-msgid "New Zealand"
-msgstr ""
-
-#. 512
-#: ../navit/country.c:194
-msgid "Oman"
-msgstr ""
-
-#. 591
-#: ../navit/country.c:195
-msgid "Panama"
-msgstr ""
-
-#. 604
-#: ../navit/country.c:196
-msgid "Peru"
-msgstr ""
-
-#. 258
-#: ../navit/country.c:197
-msgid "French Polynesia"
-msgstr ""
-
-#. 598
-#: ../navit/country.c:198
-msgid "Papua New Guinea"
-msgstr ""
-
-#. 608
-#: ../navit/country.c:199
-msgid "Philippines"
-msgstr ""
-
-#. 586
-#: ../navit/country.c:200
-msgid "Pakistan"
-msgstr ""
-
-#. 616
-#: ../navit/country.c:201
-msgid "Poland"
-msgstr "Poľsko"
-
-#. 666
-#: ../navit/country.c:202
-msgid "Saint Pierre and Miquelon"
-msgstr ""
-
-#. 612
-#: ../navit/country.c:203
-msgid "Pitcairn"
-msgstr ""
-
-#. 630
-#: ../navit/country.c:204
-msgid "Puerto Rico"
-msgstr ""
-
-#. 275
-#: ../navit/country.c:205
-msgid "Palestinian Territory, Occupied"
-msgstr ""
-
-#. 620
-#: ../navit/country.c:206
-msgid "Portugal"
-msgstr "Portugalsko"
-
-#. 585
-#: ../navit/country.c:207
-msgid "Palau"
-msgstr ""
-
-#. 600
-#: ../navit/country.c:208
-msgid "Paraguay"
-msgstr ""
-
-#. 634
-#: ../navit/country.c:209
-msgid "Qatar"
-msgstr ""
-
-#. 638
-#: ../navit/country.c:210
-msgid "Reunion"
-msgstr ""
-
-#. 642
-#: ../navit/country.c:211
-msgid "Romania"
-msgstr "Rumunsko"
-
-#. 688
-#: ../navit/country.c:212
-msgid "Serbia"
-msgstr "Srbsko"
-
-#. 643
-#: ../navit/country.c:213
-msgid "Russian Federation"
-msgstr "Rusko"
-
-#. 646
-#: ../navit/country.c:214
-msgid "Rwanda"
-msgstr ""
-
-#. 682
-#: ../navit/country.c:215
-msgid "Saudi Arabia"
-msgstr "Saudská Arábia"
-
-#. 090
-#: ../navit/country.c:216
-msgid "Solomon Islands"
-msgstr ""
-
-#. 690
-#: ../navit/country.c:217
-msgid "Seychelles"
-msgstr ""
-
-#. 736
-#: ../navit/country.c:218
-msgid "Sudan"
-msgstr ""
-
-#. 752
-#: ../navit/country.c:219
-msgid "Sweden"
-msgstr "Švédsko"
-
-#. 702
-#: ../navit/country.c:220
-msgid "Singapore"
-msgstr ""
-
-#. 654
-#: ../navit/country.c:221
-msgid "Saint Helena"
-msgstr ""
-
-#. 705
-#: ../navit/country.c:222
-msgid "Slovenia"
-msgstr "Slovinsko"
-
-#. 744
-#: ../navit/country.c:223
-msgid "Svalbard and Jan Mayen"
-msgstr "Å picbergy a Jan Mayen"
-
-#. 703
-#: ../navit/country.c:224
-msgid "Slovakia"
-msgstr "Slovenská Republika"
-
-#. 694
-#: ../navit/country.c:225
-msgid "Sierra Leone"
-msgstr ""
-
-#. 674
-#: ../navit/country.c:226
-msgid "San Marino"
-msgstr "San Marino"
-
-#. 686
-#: ../navit/country.c:227
-msgid "Senegal"
-msgstr ""
-
-#. 706
-#: ../navit/country.c:228
-msgid "Somalia"
-msgstr ""
-
-#. 740
-#: ../navit/country.c:229
-msgid "Suriname"
-msgstr ""
-
-#. 678
-#: ../navit/country.c:230
-msgid "Sao Tome and Principe"
-msgstr ""
-
-#. 222
-#: ../navit/country.c:231
-msgid "El Salvador"
-msgstr ""
-
-#. 760
-#: ../navit/country.c:232
-msgid "Syrian Arab Republic"
-msgstr ""
-
-#. 748
-#: ../navit/country.c:233
-msgid "Swaziland"
-msgstr ""
-
-#. 796
-#: ../navit/country.c:234
-msgid "Turks and Caicos Islands"
-msgstr ""
-
-#. 148
-#: ../navit/country.c:235
-msgid "Chad"
-msgstr ""
-
-#. 260
-#: ../navit/country.c:236
-msgid "French Southern Territories"
-msgstr ""
-
-#. 768
-#: ../navit/country.c:237
-msgid "Togo"
-msgstr ""
-
-#. 764
-#: ../navit/country.c:238
-msgid "Thailand"
-msgstr ""
-
-#. 762
-#: ../navit/country.c:239
-msgid "Tajikistan"
-msgstr ""
-
-#. 772
-#: ../navit/country.c:240
-msgid "Tokelau"
-msgstr ""
-
-#. 626
-#: ../navit/country.c:241
-msgid "Timor-Leste"
-msgstr ""
-
-#. 795
-#: ../navit/country.c:242
-msgid "Turkmenistan"
-msgstr ""
-
-#. 788
-#: ../navit/country.c:243
-msgid "Tunisia"
-msgstr "Tunisko"
-
-#. 776
-#: ../navit/country.c:244
-msgid "Tonga"
-msgstr ""
-
-#. 792
-#: ../navit/country.c:245
-msgid "Turkey"
-msgstr "Turecko"
-
-#. 780
-#: ../navit/country.c:246
-msgid "Trinidad and Tobago"
-msgstr ""
-
-#. 798
-#: ../navit/country.c:247
-msgid "Tuvalu"
-msgstr ""
-
-#. 158
-#: ../navit/country.c:248
-msgid "Taiwan, Province of China"
-msgstr ""
-
-#. 834
-#: ../navit/country.c:249
-msgid "Tanzania, United Republic of"
-msgstr ""
-
-#. 804
-#: ../navit/country.c:250
-msgid "Ukraine"
-msgstr "Ukrajina"
-
-#. 800
-#: ../navit/country.c:251
-msgid "Uganda"
-msgstr ""
-
-#. 581
-#: ../navit/country.c:252
-msgid "United States Minor Outlying Islands"
-msgstr ""
-
-#. 840
-#: ../navit/country.c:253
-msgid "United States"
-msgstr ""
-
-#. 858
-#: ../navit/country.c:254
-msgid "Uruguay"
-msgstr ""
-
-#. 860
-#: ../navit/country.c:255
-msgid "Uzbekistan"
-msgstr ""
-
-#. 336
-#: ../navit/country.c:256
-msgid "Holy See (Vatican City State)"
-msgstr ""
-
-#. 670
-#: ../navit/country.c:257
-msgid "Saint Vincent and the Grenadines"
-msgstr ""
-
-#. 862
-#: ../navit/country.c:258
-msgid "Venezuela"
-msgstr ""
-
-#. 092
-#: ../navit/country.c:259
-msgid "Virgin Islands, British"
-msgstr ""
-
-#. 850
-#: ../navit/country.c:260
-msgid "Virgin Islands, U.S."
-msgstr ""
-
-#. 704
-#: ../navit/country.c:261
-msgid "Viet Nam"
-msgstr ""
-
-#. 548
-#: ../navit/country.c:262
-msgid "Vanuatu"
-msgstr ""
-
-#. 876
-#: ../navit/country.c:263
-msgid "Wallis and Futuna"
-msgstr ""
-
-#. 882
-#: ../navit/country.c:264
-msgid "Samoa"
-msgstr ""
-
-#. 887
-#: ../navit/country.c:265
-msgid "Yemen"
-msgstr ""
-
-#. 175
-#: ../navit/country.c:266
-msgid "Mayotte"
-msgstr ""
-
-#. 710
-#: ../navit/country.c:267
-msgid "South Africa"
-msgstr ""
-
-#. 894
-#: ../navit/country.c:268
-msgid "Zambia"
-msgstr ""
-
-#. 716
-#: ../navit/country.c:269
-msgid "Zimbabwe"
-msgstr ""
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:98
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-msgid "Car"
-msgstr "Vozidlo"
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso2"
-msgstr "Iso2"
-
-#: ../navit/gui/gtk/destination.c:97
-msgid "Iso3"
-msgstr "Iso3"
-
-#: ../navit/gui/gtk/destination.c:97 ../navit/gui/gtk/destination.c:403
-msgid "Country"
-msgstr "Krajina"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "Postal"
-msgstr "PSČ"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "Town"
-msgstr "Mesto"
-
-#: ../navit/gui/gtk/destination.c:98 ../navit/gui/gtk/destination.c:99
-#: ../navit/gui/gtk/destination.c:100
-msgid "District"
-msgstr "Kraj"
-
-#: ../navit/gui/gtk/destination.c:99 ../navit/gui/gtk/destination.c:100
-#: ../navit/gui/gtk/destination.c:412
-msgid "Street"
-msgstr "Ulica"
-
-#: ../navit/gui/gtk/destination.c:100 ../navit/gui/gtk/destination.c:414
-msgid "Number"
-msgstr "Číslo"
-
-#: ../navit/gui/gtk/destination.c:398
-msgid "Enter Destination"
-msgstr "UveÄte cieľ"
-
-#: ../navit/gui/gtk/destination.c:405
-msgid "Zip Code"
-msgstr "PSČ"
-
-#: ../navit/gui/gtk/destination.c:407
-msgid "City"
-msgstr "Mesto"
-
-#: ../navit/gui/gtk/destination.c:409
-msgid "District/Township"
-msgstr "Kraj/Okres"
-
-#: ../navit/gui/gtk/destination.c:437 ../navit/gui/gtk/gui_gtk_action.c:153
-msgid "Map"
-msgstr "Mapa"
-
-#: ../navit/gui/gtk/destination.c:438
-msgid "Bookmark"
-msgstr "Záložka"
-
-#: ../navit/gui/gtk/destination.c:439 ../navit/gui/gtk/gui_gtk_action.c:166
-msgid "Destination"
-msgstr "Cieľ"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:149
-msgid "Display"
-msgstr "Displej"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:150
-msgid "Route"
-msgstr "Trasa"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:154
-msgid "Layout"
-msgstr "ZnaÄenie"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:155
-msgid "Projection"
-msgstr "Projekcia"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:156
-msgid "Vehicle"
-msgstr "Vozidlo"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:157
-msgid "ZoomOut"
-msgstr "Oddialiť"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:158
-msgid "ZoomIn"
-msgstr "Priblížiť"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:159
-msgid "Refresh"
-msgstr "Obnoviť"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:162 ../navit/gui/gtk/gui_gtk_action.c:164
-msgid "Info"
-msgstr "Informácie"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:167
-msgid "Clear"
-msgstr "VyÄistiÅ¥"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:168
-msgid "Test"
-msgstr "Otestovať"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:169
-msgid "_Quit"
-msgstr "_Koniec"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:176
-msgid "Cursor"
-msgstr "Kurzor"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:177
-msgid "Tracking"
-msgstr "Stopovanie"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:178
-msgid "Orientation"
-msgstr "Orientácia"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:180 ../navit/gui/gtk/gui_gtk_action.c:182
-msgid "Fullscreen"
-msgstr "Celá obrazovka"
-
-#: ../navit/gui/gtk/gui_gtk_action.c:190
-msgid "Data"
-msgstr "Dáta"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "N"
-msgstr "S"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NE"
-msgstr "SV"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "E"
-msgstr "V"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SE"
-msgstr "JV"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "S"
-msgstr "J"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "SW"
-msgstr "JZ"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "W"
-msgstr "Z"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:46
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:81
-msgid "NW"
-msgstr "SZ"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:103
-#, c-format
-msgid "Route %4.0fkm %02d:%02d ETA"
-msgstr "Cesta %4.0fkm Äas %02d:%02d"
-
-#: ../navit/gui/gtk/gui_gtk_statusbar.c:148
-msgid "Route 0000km 0+00:00 ETA"
-msgstr "Cesta 0000km Äas 0+00:00"
diff --git a/point.h b/point.h
new file mode 100644
index 00000000..cc5ccdd6
--- /dev/null
+++ b/point.h
@@ -0,0 +1,32 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_POINT_H
+#define NAVIT_POINT_H
+
+struct point {
+ int x;
+ int y;
+};
+
+struct point_rect {
+ struct point lu;
+ struct point rl;
+};
+#endif
diff --git a/popup.c b/popup.c
new file mode 100644
index 00000000..704ad7b1
--- /dev/null
+++ b/popup.c
@@ -0,0 +1,352 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <glib.h>
+#include "popup.h"
+#include "debug.h"
+#include "navit.h"
+#include "coord.h"
+#include "gui.h"
+#include "menu.h"
+#include "point.h"
+#include "transform.h"
+#include "projection.h"
+#include "item.h"
+#include "map.h"
+#include "graphics.h"
+#include "callback.h"
+#include "route.h"
+#include "navit_nls.h"
+
+#if 0
+static void
+popup_set_no_passing(struct popup_item *item, void *param)
+{
+#if 0
+ struct display_list *l=param;
+ struct segment *seg=(struct segment *)(l->data);
+ struct street_str *str=(struct street_str *)(seg->data[0]);
+ char log[256];
+ int segid=str->segid;
+ if (segid < 0)
+ segid=-segid;
+
+ sprintf(log,"Attributes Street 0x%x updated: limit=0x%x(0x%x)", segid, 0x33, str->limit);
+ str->limit=0x33;
+ log_write(log, seg->blk_inf.file, str, sizeof(*str));
+#endif
+}
+
+#endif
+
+static void
+popup_traffic_distortion(struct item *item, char *attr)
+{
+ FILE *map=fopen("distortion.txt","a");
+ struct coord c;
+ struct map_rect *mr;
+ fprintf(map,"type=traffic_distortion %s\n",attr);
+ mr=map_rect_new(item->map,NULL);
+ item=map_rect_get_item_byid(mr, item->id_hi, item->id_lo);
+ while (item_coord_get(item, &c, 1)) {
+ fprintf(map,"0x%x 0x%x\n",c.x,c.y);
+ }
+ fclose(map);
+}
+
+static void
+popup_traffic_distortion_blocked(struct item *item)
+{
+ dbg(0,"item=%p\n",item);
+ popup_traffic_distortion(item, "maxspeed=0");
+}
+
+static void
+popup_traffic_distortion_speed(struct item *item, int maxspeed)
+{
+ char buffer[256];
+ sprintf(buffer,"maxspeed=%d",maxspeed);
+ popup_traffic_distortion(item,buffer);
+}
+
+static void
+popup_traffic_distortion_delay(struct item *item, int delay)
+{
+ char buffer[256];
+ sprintf(buffer,"delay=%d",delay*600);
+ popup_traffic_distortion(item,buffer);
+}
+
+static void
+popup_set_destination(struct navit *nav, struct pcoord *pc)
+{
+ struct coord c;
+ struct coord_geo g;
+ char buffer[1024];
+ char buffer_geo[1024];
+ c.x = pc->x;
+ c.y = pc->y;
+ transform_to_geo(transform_get_projection(navit_get_trans(nav)), &c, &g);
+ coord_format(g.lat,g.lng,DEGREES_MINUTES_SECONDS,buffer_geo,sizeof(buffer_geo));
+ sprintf(buffer,"Map Point %s", buffer_geo);
+ navit_set_destination(nav, pc, buffer, 1);
+}
+
+static void
+popup_set_bookmark(struct navit *nav, struct pcoord *pc)
+{
+ struct coord c;
+ struct coord_geo g;
+ char buffer[1024];
+ char buffer_geo[1024];
+ c.x = pc->x;
+ c.y = pc->y;
+ transform_to_geo(pc->pro, &c, &g);
+ coord_format(g.lat,g.lng,DEGREES_MINUTES_SECONDS,buffer_geo,sizeof(buffer_geo));
+ sprintf(buffer,"Map Point %s", buffer_geo);
+ if (!gui_add_bookmark(navit_get_gui(nav), pc, buffer))
+ navit_add_bookmark(nav, pc, buffer);
+}
+
+
+extern void *vehicle;
+
+static void
+popup_set_position(struct navit *nav, struct pcoord *pc)
+{
+ dbg(1,"%p %p\n", nav, pc);
+ navit_set_position(nav, pc);
+}
+
+#if 0
+static void
+popup_break_crossing(struct display_list *l)
+{
+ struct segment *seg=(struct segment *)(l->data);
+ struct street_str *str=(struct street_str *)(seg->data[0]);
+ char log[256];
+ int segid=str->segid;
+ if (segid < 0)
+ segid=-segid;
+
+ sprintf(log,"Coordinates Street 0x%x updated: limit=0x%x(0x%x)", segid, 0x33, str->limit);
+ str->limit=0x33;
+ log_write(log, seg->blk_inf.file, str, sizeof(*str));
+}
+#endif
+
+
+#define popup_printf(menu, type, fmt...) popup_printf_cb(menu, type, NULL, fmt)
+
+static void *
+popup_printf_cb(void *menu, enum menu_type type, struct callback *cb, const char *fmt, ...)
+{
+ gchar *str,*us;
+ int usc=0;
+ va_list ap;
+ void *ret;
+
+ va_start(ap, fmt);
+ str=g_strdup_vprintf(fmt, ap);
+ dbg(0,"%s\n", str);
+ us=str;
+ while (*us) {
+ if (*us == '_')
+ usc++;
+ us++;
+ }
+ if (usc) {
+ gchar *str2=g_malloc(strlen(str)+usc+1);
+ gchar *us2=str2;
+ us=str;
+ while (*us) {
+ if (*us == '_')
+ *us2++=*us;
+ *us2++=*us++;
+ }
+ *us2='\0';
+ g_free(str);
+ str=str2;
+ }
+ ret=menu_add(menu, str, type, cb);
+ va_end(ap);
+ g_free(str);
+ return ret;
+}
+
+static void
+popup_show_attr_val(struct map *map, void *menu, struct attr *attr)
+{
+ char *attr_name=attr_to_name(attr->type);
+ char *str;
+
+ str=attr_to_text(attr, map, 1);
+ popup_printf(menu, menu_type_menu, "%s: %s", attr_name, str);
+ g_free(str);
+}
+
+#if 0
+static void
+popup_show_attr(void *menu, struct item *item, enum attr_type attr_type)
+{
+ struct attr attr;
+ memset(&attr, 0, sizeof(attr));
+ attr.type=attr_type;
+ if (item_attr_get(item, attr_type, &attr))
+ popup_show_attr_val(menu, &attr);
+}
+#endif
+
+static void
+popup_show_attrs(struct map *map, void *menu, struct item *item)
+{
+#if 0
+ popup_show_attr(menu, item, attr_debug);
+ popup_show_attr(menu, item, attr_address);
+ popup_show_attr(menu, item, attr_phone);
+ popup_show_attr(menu, item, attr_phone);
+ popup_show_attr(menu, item, attr_entry_fee);
+ popup_show_attr(menu, item, attr_open_hours);
+#else
+ struct attr attr;
+ for (;;) {
+ memset(&attr, 0, sizeof(attr));
+ if (item_attr_get(item, attr_any, &attr))
+ popup_show_attr_val(map, menu, &attr);
+ else
+ break;
+ }
+
+#endif
+}
+
+static void
+popup_show_item(struct navit *nav, void *popup, struct displayitem *di)
+{
+ struct map_rect *mr;
+ void *menu, *menu_map, *menu_item, *menu_dist;
+ char *label;
+ struct item *item,*diitem;
+
+ label=graphics_displayitem_get_label(di);
+ diitem=graphics_displayitem_get_item(di);
+
+ dbg_assert(diitem);
+
+ if (label)
+ menu=popup_printf(popup, menu_type_submenu, "%s '%s'", item_to_name(diitem->type), label);
+ else
+ menu=popup_printf(popup, menu_type_submenu, "%s", item_to_name(diitem->type));
+ menu_item=popup_printf(menu, menu_type_submenu, "Item");
+ popup_printf(menu_item, menu_type_menu, "type: 0x%x", diitem->type);
+ popup_printf(menu_item, menu_type_menu, "id: 0x%x 0x%x", diitem->id_hi, diitem->id_lo);
+ if (diitem->map) {
+ mr=map_rect_new(diitem->map,NULL);
+ item=map_rect_get_item_byid(mr, diitem->id_hi, diitem->id_lo);
+ dbg(1,"item=%p\n", item);
+ if (item) {
+ popup_show_attrs(item->map, menu_item, item);
+ if (item->type < type_line) {
+ struct coord co;
+ struct pcoord *c;
+ if (item_coord_get(item, &co, 1)) {
+ c=g_new(struct pcoord, 1);
+ c->pro = transform_get_projection(navit_get_trans(nav));
+ c->x = co.x;
+ c->y = co.y;
+ popup_printf_cb(menu_item, menu_type_menu, callback_new_2(callback_cast(popup_set_position), nav, c), _("Set as position"));
+ popup_printf_cb(menu_item, menu_type_menu, callback_new_2(callback_cast(popup_set_destination), nav, c), _("Set as destination"));
+ popup_printf_cb(menu_item, menu_type_menu, callback_new_2(callback_cast(popup_set_bookmark), nav, c), _("Add as bookmark"));
+ }
+ }
+ }
+ map_rect_destroy(mr);
+ menu_map=popup_printf(menu, menu_type_submenu, "Map");
+ } else {
+ popup_printf(menu, menu_type_menu, "(No map)");
+ }
+ if (item_get_default_flags(diitem->type)) {
+ int speeds[]={5,10,20,30,40,50,60,70,80,90,100};
+ int delays[]={1,2,3,5,10,15,20,30,45,60,75,90,120,150,180,240,300};
+ int i;
+ menu_dist=popup_printf(menu, menu_type_submenu, "Traffic distortion");
+ popup_printf_cb(menu_dist, menu_type_menu, callback_new_1(callback_cast(popup_traffic_distortion_blocked), diitem), "Blocked");
+ menu_item=popup_printf(menu_dist, menu_type_submenu,"Max speed");
+ for (i = 0 ; i < sizeof(speeds)/sizeof(int); i++) {
+ popup_printf_cb(menu_item, menu_type_menu, callback_new_2(callback_cast(popup_traffic_distortion_speed), diitem, speeds[i]), "%d km/h",speeds[i]);
+ }
+ menu_item=popup_printf(menu_dist, menu_type_submenu,"Delay");
+ for (i = 0 ; i < sizeof(delays)/sizeof(int); i++) {
+ popup_printf_cb(menu_item, menu_type_menu, callback_new_2(callback_cast(popup_traffic_distortion_delay), diitem, delays[i]*600), "%d min",delays[i]);
+ }
+ }
+}
+
+static void
+popup_display(struct navit *nav, void *popup, struct point *p)
+{
+ struct displaylist_handle *dlh;
+ struct displaylist *display;
+ struct displayitem *di;
+
+ display=navit_get_displaylist(nav);
+ dlh=graphics_displaylist_open(display);
+ while ((di=graphics_displaylist_next(dlh))) {
+ if (graphics_displayitem_within_dist(display, di, p, 5)) {
+ popup_show_item(nav, popup, di);
+ }
+ }
+ graphics_displaylist_close(dlh);
+}
+
+static struct pcoord c;
+
+void
+popup(struct navit *nav, int button, struct point *p)
+{
+ void *popup,*men;
+ char buffer[1024];
+ struct coord_geo g;
+ struct coord co;
+
+ popup=gui_popup_new(navit_get_gui(nav));
+ if (! popup)
+ return;
+ transform_reverse(navit_get_trans(nav), p, &co);
+ men=popup_printf(popup, menu_type_submenu, _("Point 0x%x 0x%x"), co.x, co.y);
+ popup_printf(men, menu_type_menu, _("Screen coord : %d %d"), p->x, p->y);
+ transform_to_geo(transform_get_projection(navit_get_trans(nav)), &co, &g);
+ coord_format(g.lat,g.lng,DEGREES_MINUTES_SECONDS,buffer,sizeof(buffer));
+ popup_printf(men, menu_type_menu, "%s", buffer);
+ popup_printf(men, menu_type_menu, "%f %f", g.lat, g.lng);
+ dbg(1,"%p %p\n", nav, &c);
+ c.pro = transform_get_projection(navit_get_trans(nav));
+ c.x = co.x;
+ c.y = co.y;
+ popup_printf_cb(men, menu_type_menu, callback_new_2(callback_cast(popup_set_position), nav, &c), _("Set as position"));
+ popup_printf_cb(men, menu_type_menu, callback_new_2(callback_cast(popup_set_destination), nav, &c), _("Set as destination"));
+ popup_printf_cb(men, menu_type_menu, callback_new_2(callback_cast(popup_set_bookmark), nav, &c), _("Add as bookmark"));
+ popup_display(nav, popup, p);
+ menu_popup(popup);
+}
diff --git a/popup.h b/popup.h
new file mode 100644
index 00000000..a4c17a68
--- /dev/null
+++ b/popup.h
@@ -0,0 +1,27 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_POPUP_H
+#define NAVIT_POPUP_H
+
+struct navit;
+struct point;
+void popup(struct navit *nav, int button, struct point *p);
+
+#endif
diff --git a/profile.c b/profile.c
new file mode 100644
index 00000000..7c733f14
--- /dev/null
+++ b/profile.c
@@ -0,0 +1,62 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include "profile.h"
+#include "debug.h"
+
+void
+profile_timer(int level, const char *module, const char *function, const char *fmt, ...)
+{
+ va_list ap;
+ static struct timeval last[10];
+ struct timeval curr;
+ int msec,usec;
+ char buffer[strlen(module)+20];
+
+ va_start(ap, fmt);
+ if (level < 0)
+ level=0;
+ if (level > 9)
+ level=9;
+ if (fmt) {
+ gettimeofday(&curr, NULL);
+ msec=(curr.tv_usec-last[level].tv_usec)/1000+
+ (curr.tv_sec-last[level].tv_sec)*1000;
+
+ sprintf(buffer, "profile:%s", module);
+ debug_vprintf(1, buffer, strlen(buffer), function, strlen(function), 1, fmt, ap);
+ if (msec >= 100)
+ debug_printf(1, buffer, strlen(buffer), function, strlen(function), 0, " %d msec\n", msec);
+ else {
+ usec=(curr.tv_usec-last[level].tv_usec)+(curr.tv_sec-last[level].tv_sec)*1000*1000;
+ debug_printf(1, buffer, strlen(buffer), function, strlen(function), 0, " %d.%d msec\n", usec/1000, usec%1000);
+ }
+ gettimeofday(&last[level], NULL);
+ } else {
+ gettimeofday(&curr, NULL);
+ while (level < 10)
+ last[level++]=curr;
+ }
+ va_end(ap);
+}
diff --git a/profile.h b/profile.h
new file mode 100644
index 00000000..31aae937
--- /dev/null
+++ b/profile.h
@@ -0,0 +1,36 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_PROFILE_H
+#define NAVIT_PROFILE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define profile_str2(x) #x
+#define profile_str1(x) profile_str2(x)
+#define profile_module profile_str1(MODULE)
+#define profile(level,fmt...) profile_timer(level,profile_module,__PRETTY_FUNCTION__,fmt)
+void profile_timer(int level, const char *module, const char *function, const char *fmt, ...);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/projection.c b/projection.c
new file mode 100644
index 00000000..a89ca381
--- /dev/null
+++ b/projection.c
@@ -0,0 +1,73 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <string.h>
+#include <glib.h>
+#include "coord.h"
+#include "debug.h"
+#include "projection.h"
+
+struct projection_name {
+ enum projection projection;
+ char *name;
+};
+
+
+struct projection_name projection_names[]={
+ {projection_none, ""},
+ {projection_mg, "mg"},
+ {projection_garmin, "garmin"},
+ {projection_utm, "utm"},
+ {projection_gk, "gk"},
+};
+
+
+enum projection
+projection_from_name(const char *name, struct coord *offset)
+{
+ int i;
+ int zone;
+ char ns;
+
+ for (i=0 ; i < sizeof(projection_names)/sizeof(struct projection_name) ; i++) {
+ if (! strcmp(projection_names[i].name, name))
+ return projection_names[i].projection;
+ }
+ if (offset) {
+ if (sscanf(name,"utm%d%c",&zone,&ns) == 2 && zone > 0 && zone <= 60 && (ns == 'n' || ns == 's')) {
+ offset->x=zone*1000000;
+ offset->y=(ns == 's' ? -10000000:0);
+ return projection_utm;
+ }
+ }
+ return projection_none;
+}
+
+char *
+projection_to_name(enum projection proj, struct coord *offset)
+{
+ int i;
+
+ for (i=0 ; i < sizeof(projection_names)/sizeof(struct projection_name) ; i++) {
+ if (projection_names[i].projection == proj)
+ return projection_names[i].name;
+ }
+ return NULL;
+}
+
diff --git a/projection.h b/projection.h
new file mode 100644
index 00000000..449c28fb
--- /dev/null
+++ b/projection.h
@@ -0,0 +1,36 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_PROJECTION_H
+#define NAVIT_PROJECTION_H
+
+enum projection {
+ projection_none, projection_mg, projection_garmin, projection_screen, projection_utm, projection_gk
+};
+
+enum map_datum {
+ map_datum_none, map_datum_wgs84, map_datum_dhdn
+};
+
+struct coord;
+enum projection projection_from_name(const char *name, struct coord *offset);
+char * projection_to_name(enum projection proj, struct coord *offset);
+
+#endif
+
diff --git a/projs/CodeBlocks/.cvsignore b/projs/CodeBlocks/.cvsignore
deleted file mode 100644
index 0d32a104..00000000
--- a/projs/CodeBlocks/.cvsignore
+++ /dev/null
@@ -1,15 +0,0 @@
-bin
-obj
-*.img
-*.bin
-navit.xml
-*.depend
-*.layout
-*.bak
-bak
-locale
-distr
-xpm
-*.bz2
-*.zip
-destination.txt
diff --git a/projs/CodeBlocks/Gpx2Navit.cbp b/projs/CodeBlocks/Gpx2Navit.cbp
deleted file mode 100644
index 7e114156..00000000
--- a/projs/CodeBlocks/Gpx2Navit.cbp
+++ /dev/null
@@ -1,127 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="Gpx2Navit" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="bin\Debug\gpx2navit" prefix_auto="1" extension_auto="1" />
- <Option working_dir="bin\Debug" />
- <Option object_output="obj\gpx2navit\Debug\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option use_console_runner="0" />
- <Option parameters="--input-file=d:\CB_Projects\netherlands.osm --attr-debug-level=0 -k netherlands.bin" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output="bin\Release\gpx2navit" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\gpx2navit\Release\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields -DMODULE=osm2navit" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\navit\tools\gpx2navit_txt\src" />
- </Compiler>
- <Linker>
- <Add library="user32" />
- <Add library="gtk-win32-2.0" />
- <Add library="gdk-win32-2.0" />
- <Add library="gdk_pixbuf-2.0" />
- <Add library="fib" />
- <Add library="freetype" />
- <Add library="z" />
- <Add library="gobject-2.0" />
- <Add library="gmodule-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add library="zdll" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="Win32Extra\sys\mman.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\sys\mman.h" />
- <Unit filename="Win32Extra\wordexp.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\wordexp.h" />
- <Unit filename="..\..\navit\attr.h" />
- <Unit filename="..\..\navit\attr_def.h" />
- <Unit filename="..\..\navit\coord.h" />
- <Unit filename="..\..\navit\country.h" />
- <Unit filename="..\..\navit\debug.h" />
- <Unit filename="..\..\navit\file.h" />
- <Unit filename="..\..\navit\item.h" />
- <Unit filename="..\..\navit\map.h" />
- <Unit filename="..\..\navit\param.h" />
- <Unit filename="..\..\navit\plugin.h" />
- <Unit filename="..\..\navit\tools\gpx2navit_txt\src\Makefile.am" />
- <Unit filename="..\..\navit\tools\gpx2navit_txt\src\elementControl.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\tools\gpx2navit_txt\src\emess.h" />
- <Unit filename="..\..\navit\tools\gpx2navit_txt\src\errorcode.h" />
- <Unit filename="..\..\navit\tools\gpx2navit_txt\src\geod_for.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\tools\gpx2navit_txt\src\geod_inv.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\tools\gpx2navit_txt\src\geod_set.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\tools\gpx2navit_txt\src\geodesic.h" />
- <Unit filename="..\..\navit\tools\gpx2navit_txt\src\gpx2navit_txt.h" />
- <Unit filename="..\..\navit\tools\gpx2navit_txt\src\main.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\tools\gpx2navit_txt\src\misc.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\tools\gpx2navit_txt\src\parser.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\tools\gpx2navit_txt\src\setmeta.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\tools\gpx2navit_txt\src\setpath.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\tools\gpx2navit_txt\src\setwpt.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\tools\gpx2navit_txt\src\utils.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\transform.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/LiberationMono-Regular.ttf b/projs/CodeBlocks/LiberationMono-Regular.ttf
deleted file mode 100644
index 92fb8508..00000000
--- a/projs/CodeBlocks/LiberationMono-Regular.ttf
+++ /dev/null
Binary files differ
diff --git a/projs/CodeBlocks/Navit.cbp b/projs/CodeBlocks/Navit.cbp
deleted file mode 100644
index 425ad0b7..00000000
--- a/projs/CodeBlocks/Navit.cbp
+++ /dev/null
@@ -1,300 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="Navit" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="bin\Debug\Navit" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Debug\" />
- <Option external_deps="bin\Debug\libvehicle_file.la;bin\Debug\libdata_binfile.la;bin\Debug\libgtk_graphics.la;bin\Debug\libgtk_gui.la;bin\Debug\libwin32_gui.la" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option use_console_runner="0" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add library="bin\Debug\libfib.a" />
- <Add library="bin\Debug\libvehicle_file.la" />
- <Add library="bin\Debug\libdata_binfile.la" />
- <Add library="bin\Debug\libgtk_graphics.la" />
- <Add library="bin\Debug\libgtk_gui.la" />
- <Add library="bin\Debug\libvehicle_demo.la" />
- <Add library="bin\Debug\libdata_poi_geodownload.la" />
- <Add library="bin\Debug\libmdb.a" />
- <Add library="bin\Debug\libdata_garmin.la" />
- <Add library="bin\Debug\libspeech_speech_dispatcher.la" />
- <Add library="bin\Debug\libdata_mg.la" />
- <Add library="bin\Debug\libdata_textfile.la" />
- <Add library="libgarmin.a" />
- <Add library="bin\Debug\libwin32_gui.la" />
- <Add library="ole32" />
- <Add library="user32" />
- <Add library="gdi32" />
- <Add library="gtk-win32-2.0" />
- <Add library="gdk-win32-2.0" />
- <Add library="gdk_pixbuf-2.0" />
- <Add library="freetype" />
- <Add library="z" />
- <Add library="gobject-2.0" />
- <Add library="gmodule-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add directory="bin\Debug" />
- <Add directory="." />
- <Add directory="Win32Extra\libgarmin" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output="bin\Release\Navit" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Release\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option use_console_runner="0" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add library="bin\Release\libfib.a" />
- <Add library="bin\Release\libvehicle_file.la" />
- <Add library="bin\Release\libdata_binfile.la" />
- <Add library="bin\Release\libgtk_graphics.la" />
- <Add library="bin\Release\libvehicle_demo.la" />
- <Add library="bin\Release\libgtk_gui.la" />
- <Add library="bin\Release\libdata_poi_geodownload.la" />
- <Add library="bin\Release\libmdb.a" />
- <Add library="bin\Release\libdata_garmin.la" />
- <Add library="bin\Release\libspeech_speech_dispatcher.la" />
- <Add library="bin\Release\libdata_mg.la" />
- <Add library="bin\Release\libdata_textfile.la" />
- <Add library="bin\Release\libwin32_gui.la" />
- <Add library="libgarmin.a" />
- <Add library="ole32" />
- <Add library="user32" />
- <Add library="gtk-win32-2.0" />
- <Add library="gdk-win32-2.0" />
- <Add library="gdk_pixbuf-2.0" />
- <Add library="freetype" />
- <Add library="z" />
- <Add library="gobject-2.0" />
- <Add library="gmodule-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add directory="." />
- <Add directory="Win32Extra\libgarmin" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DMODULE=Navit" />
- <Add option='-DPREFIX=\&quot;/usr/local\&quot;' />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="%GTK_DIR%\include\gtk-2.0" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\gtk-2.0\include" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include\cairo" />
- <Add directory="%GTK_DIR%\include\pango-1.0" />
- <Add directory="%GTK_DIR%\include\atk-1.0" />
- <Add directory="..\..\navit" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\navit\fib-1.1" />
- <Add directory="%GTK_DIR%\include\freetype2" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="Win32Extra\builtin.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\config.h" />
- <Unit filename="Win32Extra\serial_io.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\serial_io.h" />
- <Unit filename="Win32Extra\setenv.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\setenv.h" />
- <Unit filename="Win32Extra\sys\mman.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\sys\mman.h" />
- <Unit filename="Win32Extra\wordexp.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\wordexp.h" />
- <Unit filename="..\..\navit\Makefile" />
- <Unit filename="..\..\navit\Makefile.am" />
- <Unit filename="..\..\navit\Makefile.in" />
- <Unit filename="..\..\navit\attr.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\attr.h" />
- <Unit filename="..\..\navit\attr_def.h" />
- <Unit filename="..\..\navit\callback.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\callback.h" />
- <Unit filename="..\..\navit\color.h" />
- <Unit filename="..\..\navit\compass.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\compass.h" />
- <Unit filename="..\..\navit\coord.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\coord.h" />
- <Unit filename="..\..\navit\country.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\country.h" />
- <Unit filename="..\..\navit\cursor.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\cursor.h" />
- <Unit filename="..\..\navit\data.h" />
- <Unit filename="..\..\navit\data_window.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data_window.h" />
- <Unit filename="..\..\navit\data_window_int.h" />
- <Unit filename="..\..\navit\debug.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\debug.h" />
- <Unit filename="..\..\navit\destination.h" />
- <Unit filename="..\..\navit\draw_info.h" />
- <Unit filename="..\..\navit\file.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\file.h" />
- <Unit filename="..\..\navit\graphics.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\graphics.h" />
- <Unit filename="..\..\navit\gtkext.h" />
- <Unit filename="..\..\navit\gui.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\gui.h" />
- <Unit filename="..\..\navit\gui\gtk\gui_gtk.h" />
- <Unit filename="..\..\navit\item.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\item.h" />
- <Unit filename="..\..\navit\item_def.h" />
- <Unit filename="..\..\navit\layer.h" />
- <Unit filename="..\..\navit\layout.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\layout.h" />
- <Unit filename="..\..\navit\log.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\log.h" />
- <Unit filename="..\..\navit\main.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\main.h" />
- <Unit filename="..\..\navit\map-share.h" />
- <Unit filename="..\..\navit\map.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\map.h" />
- <Unit filename="..\..\navit\map_data.h" />
- <Unit filename="..\..\navit\mapset.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\mapset.h" />
- <Unit filename="..\..\navit\maptype.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\maptype.h" />
- <Unit filename="..\..\navit\menu.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\menu.h" />
- <Unit filename="..\..\navit\navigation.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\navigation.h" />
- <Unit filename="..\..\navit\navit.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\navit.h" />
- <Unit filename="..\..\navit\navit.xml" />
- <Unit filename="..\..\navit\osd.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\osd.h" />
- <Unit filename="..\..\navit\param.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\param.h" />
- <Unit filename="..\..\navit\phrase.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\phrase.h" />
- <Unit filename="..\..\navit\plugin.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\plugin.h" />
- <Unit filename="..\..\navit\plugin_def.h" />
- <Unit filename="..\..\navit\point.h" />
- <Unit filename="..\..\navit\popup.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\popup.h" />
- <Unit filename="..\..\navit\profile.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\profile.h" />
- <Unit filename="..\..\navit\projection.h" />
- <Unit filename="..\..\navit\route.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\route.h" />
- <Unit filename="..\..\navit\search.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\search.h" />
- <Unit filename="..\..\navit\speech.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\speech.h" />
- <Unit filename="..\..\navit\statusbar.h" />
- <Unit filename="..\..\navit\track.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\track.h" />
- <Unit filename="..\..\navit\transform.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\transform.h" />
- <Unit filename="..\..\navit\util.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\util.h" />
- <Unit filename="..\..\navit\vehicle.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\vehicle.h" />
- <Unit filename="..\..\navit\xmlconfig.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\xmlconfig.h" />
- <Unit filename="..\..\navit\zipfile.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/Navit.new.cbp b/projs/CodeBlocks/Navit.new.cbp
deleted file mode 100644
index a3574cf9..00000000
--- a/projs/CodeBlocks/Navit.new.cbp
+++ /dev/null
@@ -1,256 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="Navit" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="bin\Debug\Navi" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Debug\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option use_console_runner="0" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output="bin\Release\Navit" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Release\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option use_console_runner="0" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DMODULE=Navit" />
- <Add option='-DPREFIX=\&quot;/usr/local\&quot;' />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="%GTK_DIR%\include\gtk-2.0" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\gtk-2.0\include" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include\cairo" />
- <Add directory="%GTK_DIR%\include\pango-1.0" />
- <Add directory="%GTK_DIR%\include\atk-1.0" />
- <Add directory="..\..\navit" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\navit\fib-1.1" />
- <Add directory="D:\msys\1.10\freetype-2.3.5\include" />
- </Compiler>
- <Linker>
- <Add library="bin\Debug\libgtk_graphics.la" />
- <Add library="bin\Debug\libgtk_gui.la" />
- <Add library="bin\Debug\libdata_binfile.la" />
- <Add library="user32" />
- <Add library="gtk-win32-2.0" />
- <Add library="gdk-win32-2.0" />
- <Add library="gdk_pixbuf-2.0" />
- <Add library="fib" />
- <Add library="freetype" />
- <Add library="z" />
- <Add library="gobject-2.0" />
- <Add library="gmodule-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add library="bin\Debug\libvehicle_file.la" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="D:\msys\1.10\freetype-2.3.5\objs\.libs" />
- </Linker>
- <Unit filename="Win32Extra\config.h" />
- <Unit filename="Win32Extra\serial_io.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\serial_io.h" />
- <Unit filename="Win32Extra\setenv.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\setenv.h" />
- <Unit filename="Win32Extra\wordexp.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\wordexp.h" />
- <Unit filename="..\..\navit\Makefile" />
- <Unit filename="..\..\navit\Makefile.am" />
- <Unit filename="..\..\navit\Makefile.in" />
- <Unit filename="..\..\navit\attr.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\attr.h" />
- <Unit filename="..\..\navit\attr_def.h" />
- <Unit filename="..\..\navit\builtin.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\callback.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\callback.h" />
- <Unit filename="..\..\navit\color.h" />
- <Unit filename="..\..\navit\compass.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\compass.h" />
- <Unit filename="..\..\navit\coord.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\coord.h" />
- <Unit filename="..\..\navit\country.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\country.h" />
- <Unit filename="..\..\navit\cursor.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\cursor.h" />
- <Unit filename="..\..\navit\data.h" />
- <Unit filename="..\..\navit\data_window.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data_window.h" />
- <Unit filename="..\..\navit\data_window_int.h" />
- <Unit filename="..\..\navit\debug.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\debug.h" />
- <Unit filename="..\..\navit\destination.h" />
- <Unit filename="..\..\navit\draw_info.h" />
- <Unit filename="..\..\navit\file.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\file.h" />
- <Unit filename="..\..\navit\graphics.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\graphics.h" />
- <Unit filename="..\..\navit\gtkext.h" />
- <Unit filename="..\..\navit\gui.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\gui.h" />
- <Unit filename="..\..\navit\gui\gtk\gui_gtk.h" />
- <Unit filename="..\..\navit\item.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\item.h" />
- <Unit filename="..\..\navit\item_def.h" />
- <Unit filename="..\..\navit\layer.h" />
- <Unit filename="..\..\navit\layout.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\layout.h" />
- <Unit filename="..\..\navit\log.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\log.h" />
- <Unit filename="..\..\navit\main.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\main.h" />
- <Unit filename="..\..\navit\map-share.h" />
- <Unit filename="..\..\navit\map.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\map.h" />
- <Unit filename="..\..\navit\map_data.h" />
- <Unit filename="..\..\navit\mapset.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\mapset.h" />
- <Unit filename="..\..\navit\maptype.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\maptype.h" />
- <Unit filename="..\..\navit\menu.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\menu.h" />
- <Unit filename="..\..\navit\navigation.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\navigation.h" />
- <Unit filename="..\..\navit\navit.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\navit.h" />
- <Unit filename="..\..\navit\navit.xml" />
- <Unit filename="..\..\navit\osd.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\osd.h" />
- <Unit filename="..\..\navit\param.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\param.h" />
- <Unit filename="..\..\navit\phrase.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\phrase.h" />
- <Unit filename="..\..\navit\plugin.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\plugin.h" />
- <Unit filename="..\..\navit\plugin_def.h" />
- <Unit filename="..\..\navit\point.h" />
- <Unit filename="..\..\navit\popup.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\popup.h" />
- <Unit filename="..\..\navit\profile.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\profile.h" />
- <Unit filename="..\..\navit\projection.h" />
- <Unit filename="..\..\navit\route.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\route.h" />
- <Unit filename="..\..\navit\search.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\search.h" />
- <Unit filename="..\..\navit\speech.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\speech.h" />
- <Unit filename="..\..\navit\statusbar.h" />
- <Unit filename="..\..\navit\track.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\track.h" />
- <Unit filename="..\..\navit\transform.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\transform.h" />
- <Unit filename="..\..\navit\util.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\util.h" />
- <Unit filename="..\..\navit\vehicle.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\vehicle.h" />
- <Unit filename="..\..\navit\xmlconfig.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\xmlconfig.h" />
- <Unit filename="..\..\navit\zipfile.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/Navit.workspace b/projs/CodeBlocks/Navit.workspace
deleted file mode 100644
index 25283666..00000000
--- a/projs/CodeBlocks/Navit.workspace
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_workspace_file>
- <Workspace title="Navit">
- <Project filename="NavitCore.cbp" />
- <Project filename="win32_gui.cbp" />
- <Project filename="fib-1.1.cbp" />
- <Project filename="Osm2Navit.cbp" />
- <Project filename="Gpx2Navit.cbp" />
- <Project filename="gentypes.cbp" />
- <Project filename="data_textfile.cbp" />
- <Project filename="mdb.cbp" />
- <Project filename="vehicle_file.cbp" />
- <Project filename="vehicle_demo.cbp" />
- <Project filename="speech_speech_dispatcher.cbp" />
- <Project filename="binfile.cbp" />
- <Project filename="data_poi_geodownload.cbp" />
- <Project filename="data_mg.cbp" />
- <Project filename="data_garmin.cbp" />
- <Project filename="Navit_win32.cbp" active="1">
- <Depends filename="NavitCore.cbp" />
- <Depends filename="win32_gui.cbp" />
- <Depends filename="fib-1.1.cbp" />
- <Depends filename="Osm2Navit.cbp" />
- <Depends filename="gentypes.cbp" />
- <Depends filename="data_textfile.cbp" />
- <Depends filename="mdb.cbp" />
- <Depends filename="vehicle_file.cbp" />
- <Depends filename="vehicle_demo.cbp" />
- <Depends filename="speech_speech_dispatcher.cbp" />
- <Depends filename="binfile.cbp" />
- <Depends filename="data_poi_geodownload.cbp" />
- <Depends filename="data_mg.cbp" />
- <Depends filename="data_garmin.cbp" />
- </Project>
- <Project filename="gtk_gui.cbp" />
- <Project filename="gtk_graphics.cbp" />
- <Project filename="Navit_gtk.cbp">
- <Depends filename="NavitCore.cbp" />
- <Depends filename="win32_gui.cbp" />
- <Depends filename="fib-1.1.cbp" />
- <Depends filename="Osm2Navit.cbp" />
- <Depends filename="gentypes.cbp" />
- <Depends filename="data_textfile.cbp" />
- <Depends filename="mdb.cbp" />
- <Depends filename="vehicle_file.cbp" />
- <Depends filename="vehicle_demo.cbp" />
- <Depends filename="speech_speech_dispatcher.cbp" />
- <Depends filename="binfile.cbp" />
- <Depends filename="data_poi_geodownload.cbp" />
- <Depends filename="data_mg.cbp" />
- <Depends filename="data_garmin.cbp" />
- <Depends filename="gtk_gui.cbp" />
- <Depends filename="gtk_graphics.cbp" />
- </Project>
- </Workspace>
-</CodeBlocks_workspace_file>
diff --git a/projs/CodeBlocks/NavitCommonLib.cbp b/projs/CodeBlocks/NavitCommonLib.cbp
deleted file mode 100644
index ec18bdf1..00000000
--- a/projs/CodeBlocks/NavitCommonLib.cbp
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="NavitCommon" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\NavitCommonLib" prefix_auto="1" extension_auto="1" />
- <Option working_dir=".\bin\Debug" />
- <Option object_output=".\obj\Debug\" />
- <Option type="3" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\NavitCommonLib" prefix_auto="1" extension_auto="1" />
- <Option working_dir=".\bin\Release" />
- <Option object_output=".\obj\Release\" />
- <Option type="3" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option='-DMODULE=\&quot;Navit\&quot;' />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="Win32Extra" />
- <Add directory="%GTK_DIR%\include" />
- </Compiler>
- <Linker>
- <Add library="glib-2.0" />
- <Add library="z" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="Win32Extra\setenv.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\setenv.h" />
- <Unit filename="Win32Extra\sys\mman.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\sys\mman.h" />
- <Unit filename="Win32Extra\wordexp.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\wordexp.h" />
- <Unit filename="..\..\navit\callback.h" />
- <Unit filename="..\..\navit\debug.h" />
- <Unit filename="..\..\navit\file.h" />
- <Unit filename="..\..\navit\item.h" />
- <Unit filename="..\..\navit\map.h" />
- <Unit filename="..\..\navit\param.h" />
- <Unit filename="..\..\navit\search.h" />
- <Unit filename="..\..\navit\transform.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/NavitCore.cbp b/projs/CodeBlocks/NavitCore.cbp
deleted file mode 100644
index 32dadbf3..00000000
--- a/projs/CodeBlocks/NavitCore.cbp
+++ /dev/null
@@ -1,258 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="NavitCore" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="bin\Debug\libNavit" prefix_auto="1" extension_auto="1" />
- <Option working_dir="" />
- <Option object_output="obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- </Target>
- <Target title="Release">
- <Option output="bin\Release\libNavit" prefix_auto="1" extension_auto="1" />
- <Option working_dir="" />
- <Option object_output="obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- </Target>
- <Target title="DebugCeGcc">
- <Option output="bin\DebugCeGcc\libNavit" prefix_auto="1" extension_auto="1" />
- <Option working_dir="" />
- <Option object_output="obj\DebugCeGcc\" />
- <Option type="2" />
- <Option compiler="cegcc_compiler" />
- <Option projectIncludeDirsRelation="1" />
- <Compiler>
- <Add option="-g" />
- <Add directory="c:\MinGW\opt\cegcc\arm-wince-cegcc\include\glib-2.0\" />
- <Add directory="..\..\navit" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\navit\fib-1.1" />
- <Add directory="..\..\..\libs\zlib-1.2.3\include" />
- <Add directory="c:\MinGW\opt\cegcc\arm-wince-cegcc\lib\glib-2.0\include\" />
- </Compiler>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DMODULE=Navit" />
- <Add directory="$(GTK_DIR)\include" />
- <Add directory="$(GTK_DIR)\include\gtk-2.0" />
- <Add directory="$(GTK_DIR)\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\gtk-2.0\include" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include\cairo" />
- <Add directory="%GTK_DIR%\include\pango-1.0" />
- <Add directory="%GTK_DIR%\include\atk-1.0" />
- <Add directory="..\..\navit" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\navit\fib-1.1" />
- <Add directory="%GTK_DIR%\include\freetype2" />
- <Add directory="K:\Sourcecode\libs\zlib-1.2.3\include" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\navit\Makefile" />
- <Unit filename="..\..\navit\Makefile.am" />
- <Unit filename="..\..\navit\Makefile.in" />
- <Unit filename="..\..\navit\attr.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\attr.h" />
- <Unit filename="..\..\navit\attr_def.h" />
- <Unit filename="..\..\navit\callback.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\callback.h" />
- <Unit filename="..\..\navit\color.h" />
- <Unit filename="..\..\navit\compass.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\compass.h" />
- <Unit filename="..\..\navit\coord.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\coord.h" />
- <Unit filename="..\..\navit\country.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\country.h" />
- <Unit filename="..\..\navit\cursor.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\cursor.h" />
- <Unit filename="..\..\navit\data.h" />
- <Unit filename="..\..\navit\data_window.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data_window.h" />
- <Unit filename="..\..\navit\data_window_int.h" />
- <Unit filename="..\..\navit\debug.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\debug.h" />
- <Unit filename="..\..\navit\destination.h" />
- <Unit filename="..\..\navit\draw_info.h" />
- <Unit filename="..\..\navit\event.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\file.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\file.h" />
- <Unit filename="..\..\navit\graphics.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\graphics.h" />
- <Unit filename="..\..\navit\gtkext.h" />
- <Unit filename="..\..\navit\gui.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\gui.h" />
- <Unit filename="..\..\navit\gui\gtk\gui_gtk.h" />
- <Unit filename="..\..\navit\item.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\item.h" />
- <Unit filename="..\..\navit\item_def.h" />
- <Unit filename="..\..\navit\layer.h" />
- <Unit filename="..\..\navit\layout.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\layout.h" />
- <Unit filename="..\..\navit\log.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\log.h" />
- <Unit filename="..\..\navit\main.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\main.h" />
- <Unit filename="..\..\navit\map-share.h" />
- <Unit filename="..\..\navit\map.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\map.h" />
- <Unit filename="..\..\navit\map_data.h" />
- <Unit filename="..\..\navit\mapset.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\mapset.h" />
- <Unit filename="..\..\navit\maptype.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\maptype.h" />
- <Unit filename="..\..\navit\menu.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\menu.h" />
- <Unit filename="..\..\navit\navigation.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\navigation.h" />
- <Unit filename="..\..\navit\navit.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\navit.h" />
- <Unit filename="..\..\navit\navit.xml" />
- <Unit filename="..\..\navit\osd.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\osd.h" />
- <Unit filename="..\..\navit\param.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\param.h" />
- <Unit filename="..\..\navit\phrase.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\phrase.h" />
- <Unit filename="..\..\navit\plugin.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\plugin.h" />
- <Unit filename="..\..\navit\plugin_def.h" />
- <Unit filename="..\..\navit\point.h" />
- <Unit filename="..\..\navit\popup.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\popup.h" />
- <Unit filename="..\..\navit\profile.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\profile.h" />
- <Unit filename="..\..\navit\projection.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\projection.h" />
- <Unit filename="..\..\navit\route.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\route.h" />
- <Unit filename="..\..\navit\search.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\search.h" />
- <Unit filename="..\..\navit\speech.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\speech.h" />
- <Unit filename="..\..\navit\statusbar.h" />
- <Unit filename="..\..\navit\track.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\track.h" />
- <Unit filename="..\..\navit\transform.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\transform.h" />
- <Unit filename="..\..\navit\util.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\util.h" />
- <Unit filename="..\..\navit\vehicle.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\vehicle.h" />
- <Unit filename="..\..\navit\xmlconfig.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\xmlconfig.h" />
- <Unit filename="..\..\navit\zipfile.h" />
- <Unit filename="Win32Extra\config.h" />
- <Unit filename="Win32Extra\serial_io.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\serial_io.h" />
- <Unit filename="Win32Extra\setenv.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\setenv.h" />
- <Unit filename="Win32Extra\sys\mman.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\sys\mman.h" />
- <Unit filename="Win32Extra\wordexp.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\wordexp.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/Navit_gtk.cbp b/projs/CodeBlocks/Navit_gtk.cbp
deleted file mode 100644
index 199b1905..00000000
--- a/projs/CodeBlocks/Navit_gtk.cbp
+++ /dev/null
@@ -1,130 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="Navit_gtk" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="bin\Debug\Navit_gtk" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Debug\" />
- <Option external_deps="bin\Debug\libnavit.a;bin\Debug\libvehicle_file.la;bin\Debug\libdata_binfile.la;bin\Debug\libgtk_graphics.la;bin\Debug\libgtk_gui.la;bin\Debug\libwin32_gui.la;" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option parameters="Navit_gtk.xml" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add library="bin\Debug\libvehicle_file.la" />
- <Add library="bin\Debug\libdata_binfile.la" />
- <Add library="bin\Debug\libgtk_graphics.la" />
- <Add library="bin\Debug\libgtk_gui.la" />
- <Add library="bin\Debug\libvehicle_demo.la" />
- <Add library="bin\Debug\libdata_poi_geodownload.la" />
- <Add library="bin\Debug\libmdb.a" />
- <Add library="bin\Debug\libspeech_speech_dispatcher.la" />
- <Add library="bin\Debug\libdata_mg.la" />
- <Add library="bin\Debug\libdata_textfile.la" />
- <Add library="libgarmin.a" />
- <Add library="bin\Debug\libnavit.a" />
- <Add library="bin\Debug\libfib.a" />
- <Add library="ole32" />
- <Add library="user32" />
- <Add library="gdi32" />
- <Add library="gtk-win32-2.0" />
- <Add library="gdk-win32-2.0" />
- <Add library="gdk_pixbuf-2.0" />
- <Add library="freetype" />
- <Add library="fontconfig" />
- <Add library="z" />
- <Add library="gobject-2.0" />
- <Add library="gmodule-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add library="bin\Debug\libdata_garmin.la" />
- <Add library="Win32Extra\libgarmin\libgarmin.a" />
- <Add directory="bin\Debug" />
- <Add directory="." />
- <Add directory="Win32Extra\libgarmin" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output="bin\Release\Navit_gtk" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Release\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option use_console_runner="0" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add library="bin\Release\libvehicle_file.la" />
- <Add library="bin\Release\libdata_binfile.la" />
- <Add library="bin\Release\libgtk_graphics.la" />
- <Add library="bin\Release\libvehicle_demo.la" />
- <Add library="bin\Release\libgtk_gui.la" />
- <Add library="bin\Release\libdata_poi_geodownload.la" />
- <Add library="bin\Release\libmdb.a" />
- <Add library="bin\Release\libdata_garmin.la" />
- <Add library="bin\Release\libspeech_speech_dispatcher.la" />
- <Add library="bin\Release\libdata_mg.la" />
- <Add library="bin\Release\libdata_textfile.la" />
- <Add library="libgarmin.a" />
- <Add library="bin\Release\libnavit.a" />
- <Add library="bin\Release\libfib.a" />
- <Add library="ole32" />
- <Add library="user32" />
- <Add library="gtk-win32-2.0" />
- <Add library="gdk-win32-2.0" />
- <Add library="gdk_pixbuf-2.0" />
- <Add library="freetype" />
- <Add library="fontconfig" />
- <Add library="z" />
- <Add library="gobject-2.0" />
- <Add library="gmodule-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add directory="." />
- <Add directory="Win32Extra\libgarmin" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DMODULE=Navit" />
- <Add option='-DPREFIX=\&quot;/usr/local\&quot;' />
- <Add directory="Win32Extra" />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="%GTK_DIR%\include\gtk-2.0" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\gtk-2.0\include" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include\cairo" />
- <Add directory="%GTK_DIR%\include\pango-1.0" />
- <Add directory="%GTK_DIR%\include\atk-1.0" />
- <Add directory="..\..\navit" />
- <Add directory="..\..\navit\fib-1.1" />
- <Add directory="%GTK_DIR%\include\freetype2" />
- <Add directory="%ZLIB_DIR%\include" />
- <Add directory="%GTKGL%\include\gtkglext-1.0" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="..\..\..\libs\zlib-1.2.3\lib" />
- </Linker>
- <Unit filename="Win32Extra\navit_gtk.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger>
- <search_path add="C:\Programme\Development\libs\gtk+-2.12.9-bundle-20080402\bin" />
- </debugger>
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/Navit_no_plugin.cbp b/projs/CodeBlocks/Navit_no_plugin.cbp
deleted file mode 100644
index 94d5f0aa..00000000
--- a/projs/CodeBlocks/Navit_no_plugin.cbp
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="gui_gtk" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="bin\Debug\gui_gtk" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Debug\" />
- <Option type="3" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Option createStaticLib="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output="bin\Release\gui_gtk" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Release\" />
- <Option type="3" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Option createStaticLib="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-DBUILD_DLL" />
- <Add option='-DMODULE=\&quot;Navit\&quot;' />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="%GTK_DIR%\include\gtk-2.0" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\gtk-2.0\include" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include\cairo" />
- <Add directory="%GTK_DIR%\include\pango-1.0" />
- <Add directory="%GTK_DIR%\include\atk-1.0" />
- <Add directory="..\..\navit" />
- <Add directory="Win32Extra" />
- </Compiler>
- <Linker>
- <Add library="NavitCommonLib" />
- <Add library="user32" />
- <Add library="gtk-win32-2.0" />
- <Add library="gobject-2.0" />
- <Add library="gdk_pixbuf-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="main.cpp" />
- <Unit filename="main.h" />
- <Unit filename="..\..\navit\gui\gtk\datawindow.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\gui\gtk\destination.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\gui\gtk\gui_gtk.h" />
- <Unit filename="..\..\navit\gui\gtk\gui_gtk_action.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\gui\gtk\gui_gtk_statusbar.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\gui\gtk\gui_gtk_window.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/Navit_win32.cbp b/projs/CodeBlocks/Navit_win32.cbp
deleted file mode 100644
index 069a0ec9..00000000
--- a/projs/CodeBlocks/Navit_win32.cbp
+++ /dev/null
@@ -1,184 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="Navit_win32" />
- <Option pch_mode="2" />
- <Option default_target="DebugCeGcc" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="bin\Debug\Navit_win32" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Debug\" />
- <Option external_deps="bin\Debug\libnavit.a;bin\Debug\libvehicle_file.la;bin\Debug\libdata_binfile.la;bin\Debug\libgtk_graphics.la;bin\Debug\libgtk_gui.la;bin\Debug\libwin32_gui.la;" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add library="bin\Debug\libvehicle_file.la" />
- <Add library="bin\Debug\libdata_binfile.la" />
- <Add library="bin\Debug\libvehicle_demo.la" />
- <Add library="bin\Debug\libdata_poi_geodownload.la" />
- <Add library="bin\Debug\libmdb.a" />
- <Add library="bin\Debug\libspeech_speech_dispatcher.la" />
- <Add library="bin\Debug\libdata_mg.la" />
- <Add library="bin\Debug\libdata_textfile.la" />
- <Add library="libgarmin.a" />
- <Add library="bin\Debug\libwin32_gui.la" />
- <Add library="bin\Debug\libnavit.a" />
- <Add library="bin\Debug\libfib.a" />
- <Add library="ole32" />
- <Add library="user32" />
- <Add library="gdi32" />
- <Add library="z" />
- <Add library="gobject-2.0" />
- <Add library="gmodule-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add library="comctl32" />
- <Add library="bin\Debug\libdata_garmin.la" />
- <Add library="Win32Extra\libgarmin\libgarmin.a" />
- <Add directory="bin\Debug" />
- <Add directory="." />
- <Add directory="Win32Extra\libgarmin" />
- <Add directory="..\..\..\libs\zlib-1.2.3\lib" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output="bin\Release\Navit_win32" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\Release\" />
- <Option external_deps="bin\Release\libnavit.a;bin\Release\libvehicle_file.la;bin\Release\libdata_binfile.la;bin\Release\libgtk_graphics.la;bin\Release\libgtk_gui.la;bin\Release\libwin32_gui.la;" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add option="-Wl,-Map,navit_release.map" />
- <Add library="bin\Release\libvehicle_file.la" />
- <Add library="bin\Release\libdata_binfile.la" />
- <Add library="bin\Release\libvehicle_demo.la" />
- <Add library="bin\Release\libdata_poi_geodownload.la" />
- <Add library="bin\Release\libmdb.a" />
- <Add library="bin\Release\libspeech_speech_dispatcher.la" />
- <Add library="bin\Release\libdata_mg.la" />
- <Add library="bin\Release\libdata_textfile.la" />
- <Add library="bin\Release\libwin32_gui.la" />
- <Add library="libgarmin.a" />
- <Add library="bin\Release\libnavit.a" />
- <Add library="bin\Release\libfib.a" />
- <Add library="ole32" />
- <Add library="user32" />
- <Add library="gdi32" />
- <Add library="z" />
- <Add library="gobject-2.0" />
- <Add library="gmodule-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add library="comctl32" />
- <Add library="bin\Debug\libdata_garmin.la" />
- <Add library="Win32Extra\libgarmin\libgarmin.a" />
- <Add directory="." />
- <Add directory="Win32Extra\libgarmin" />
- <Add directory="..\..\..\libs\zlib-1.2.3\lib" />
- </Linker>
- </Target>
- <Target title="DebugCeGcc">
- <Option output="bin\DebugCeGcc\Navit_win32" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\DebugCeGcc\" />
- <Option external_deps="bin\DebugCeGcc\libnavit.a;bin\DebugCeGcc\libvehicle_file.la;bin\DebugCeGcc\libdata_binfile.la;bin\DebugCeGcc\libwin32_gui.la;bin\DebugCeGcc\libvehicle_demo.la;" />
- <Option type="1" />
- <Option compiler="cegcc_compiler" />
- <Option use_console_runner="0" />
- <Option host_application="Navit_win32.exe" />
- <Option projectCompilerOptionsRelation="1" />
- <Option projectLinkerOptionsRelation="1" />
- <Option projectIncludeDirsRelation="1" />
- <Option projectResourceIncludeDirsRelation="1" />
- <Option projectLibDirsRelation="1" />
- <Compiler>
- <Add option="-g" />
- <Add option="-DMODULE=Navit" />
- <Add directory="..\..\navit" />
- <Add directory="c:\MinGW\opt\cegcc\arm-wince-cegcc\include\glib-2.0" />
- <Add directory="C:\MinGW\opt\cegcc\arm-wince-cegcc\lib\glib-2.0\include" />
- </Compiler>
- <ResourceCompiler>
- <Add directory="win32gui\resources" />
- </ResourceCompiler>
- <Linker>
- <Add library="bin\DebugCeGcc\libvehicle_file.la" />
- <Add library="bin\DebugCeGcc\libvehicle_demo.la" />
- <Add library="bin\DebugCeGcc\libdata_binfile.la" />
- <Add library="bin\DebugCeGcc\libdata_mg.la" />
- <Add library="bin\DebugCeGcc\libdata_textfile.la" />
- <Add library="bin\DebugCeGcc\libwin32_gui.la" />
- <Add library="bin\DebugCeGcc\libnavit.a" />
- <Add library="bin\DebugCeGcc\libfib.a" />
- <Add library="ole32" />
- <Add library="gdi32" />
- <Add library="z" />
- <Add library="C:\MinGW\opt\cegcc\arm-wince-cegcc\lib\libgobject-2.0.a" />
- <Add library="C:\MinGW\opt\cegcc\arm-wince-cegcc\lib\libgmodule-2.0.a" />
- <Add library="C:\MinGW\opt\cegcc\arm-wince-cegcc\lib\libglib-2.0.a" />
- <Add library="commctrl" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add library="bin\DebugCeGcc\libdata_poi_geodownload.la" />
- <Add library="bin\DebugCeGcc\libmdb.a" />
- <Add directory="bin\Debug" />
- <Add directory="." />
- <Add directory="Win32Extra\libgarmin" />
- <Add directory="C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib" />
- <Add directory="C:\MinGW\opt\cegcc\arm-wince-cegcc\lib" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DMODULE=Navit" />
- <Add option='-DPREFIX=\&quot;/usr/local\&quot;' />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="%GTK_DIR%\include\gtk-2.0" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\gtk-2.0\include" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include\cairo" />
- <Add directory="%GTK_DIR%\include\pango-1.0" />
- <Add directory="%GTK_DIR%\include\atk-1.0" />
- <Add directory="..\..\navit" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\navit\fib-1.1" />
- <Add directory="%GTK_DIR%\include\freetype2" />
- </Compiler>
- <ResourceCompiler>
- <Add directory="win32gui\resources" />
- </ResourceCompiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="Win32Extra\navit_win32.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="win32gui\resources\resource.h" />
- <Unit filename="win32gui\resources\resource.rc">
- <Option compilerVar="WINDRES" />
- </Unit>
- <Unit filename="win32gui\win32_gui_notify.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="win32gui\win32_gui_notify.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger>
- <search_path add="C:\MinGW\opt\cegcc\arm-wince-cegcc\lib" />
- <search_path add="..\..\navit" />
- </debugger>
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/Osm2Navit.cbp b/projs/CodeBlocks/Osm2Navit.cbp
deleted file mode 100644
index 9dba57e0..00000000
--- a/projs/CodeBlocks/Osm2Navit.cbp
+++ /dev/null
@@ -1,123 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="Osm2Navit" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="bin\Debug\Osm2Navit" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\osm2navit\Debug\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option parameters="--input-file=germany.osm --attr-debug-level=5 germany2.bin" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output="bin\Release\Osm2Navit" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\osm2navit\Release\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields -DMODULE=osm2navit" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\..\libs\zlib-1.2.3\include" />
- </Compiler>
- <Linker>
- <Add library="user32" />
- <Add library="gtk-win32-2.0" />
- <Add library="gdk-win32-2.0" />
- <Add library="gdk_pixbuf-2.0" />
- <Add library="freetype" />
- <Add library="z" />
- <Add library="gobject-2.0" />
- <Add library="gmodule-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add library="zdll" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="..\..\..\libs\zlib-1.2.3\lib" />
- </Linker>
- <Unit filename="..\..\navit\attr.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\attr.h" />
- <Unit filename="..\..\navit\attr_def.h" />
- <Unit filename="..\..\navit\coord.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\coord.h" />
- <Unit filename="..\..\navit\country.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\country.h" />
- <Unit filename="..\..\navit\debug.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\debug.h" />
- <Unit filename="..\..\navit\file.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\file.h" />
- <Unit filename="..\..\navit\item.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\item.h" />
- <Unit filename="..\..\navit\map.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\map.h" />
- <Unit filename="..\..\navit\osm2navit.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\param.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\param.h" />
- <Unit filename="..\..\navit\plugin.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\plugin.h" />
- <Unit filename="..\..\navit\projection.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\transform.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\transform.h" />
- <Unit filename="Win32Extra\sys\mman.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\sys\mman.h" />
- <Unit filename="Win32Extra\wordexp.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\wordexp.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/Win32Extra/LiberationSans-Regular.ttf b/projs/CodeBlocks/Win32Extra/LiberationSans-Regular.ttf
deleted file mode 100644
index a788fbdd..00000000
--- a/projs/CodeBlocks/Win32Extra/LiberationSans-Regular.ttf
+++ /dev/null
Binary files differ
diff --git a/projs/CodeBlocks/Win32Extra/X11/XF86keysym.h b/projs/CodeBlocks/Win32Extra/X11/XF86keysym.h
deleted file mode 100644
index ee783c2f..00000000
--- a/projs/CodeBlocks/Win32Extra/X11/XF86keysym.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/* $XFree86: xc/include/XF86keysym.h,v 1.16 2003/02/11 02:51:10 dawes Exp $ */
-
-/*
- * XFree86 vendor specific keysyms.
- *
- * The XFree86 keysym range is 0x10080001 - 0x1008FFFF.
- *
- * When adding new entries, the xc/lib/XKeysymDB file should also be
- * updated to make the new entries visible to Xlib.
- */
-
-/*
- * ModeLock
- *
- * This one is old, and not really used any more since XKB offers this
- * functionality.
- */
-
-#define XF86XK_ModeLock 0x1008FF01 /* Mode Switch Lock */
-
-/*
- * Note, 0x1008FF02 - 0x1008FF0F are free and should be used for misc new
- * keysyms that don't fit into any of the groups below.
- *
- * 0x1008FF64, 0x1008FF6F, 0x1008FF71, 0x1008FF83 are no longer used,
- * and should be used first for new keysyms.
- *
- * Check in keysymdef.h for generic symbols before adding new XFree86-specific
- * symbols here.
- */
-
-
-/*
- * Keys found on some "Internet" keyboards.
- */
-#define XF86XK_Standby 0x1008FF10
-#define XF86XK_AudioLowerVolume 0x1008FF11
-#define XF86XK_AudioMute 0x1008FF12
-#define XF86XK_AudioRaiseVolume 0x1008FF13
-#define XF86XK_AudioPlay 0x1008FF14
-#define XF86XK_AudioStop 0x1008FF15
-#define XF86XK_AudioPrev 0x1008FF16
-#define XF86XK_AudioNext 0x1008FF17
-#define XF86XK_HomePage 0x1008FF18
-#define XF86XK_Mail 0x1008FF19
-#define XF86XK_Start 0x1008FF1A
-#define XF86XK_Search 0x1008FF1B
-#define XF86XK_AudioRecord 0x1008FF1C
-
-/* These are sometimes found on PDA's (e.g. Palm, PocketPC or elsewhere) */
-#define XF86XK_Calculator 0x1008FF1D
-#define XF86XK_Memo 0x1008FF1E
-#define XF86XK_ToDoList 0x1008FF1F
-#define XF86XK_Calendar 0x1008FF20
-#define XF86XK_PowerDown 0x1008FF21
-#define XF86XK_ContrastAdjust 0x1008FF22
-#define XF86XK_RockerUp 0x1008FF23
-#define XF86XK_RockerDown 0x1008FF24
-#define XF86XK_RockerEnter 0x1008FF25
-
-/* Some more "Internet" keyboard symbols */
-#define XF86XK_Back 0x1008FF26
-#define XF86XK_Forward 0x1008FF27
-#define XF86XK_Stop 0x1008FF28
-#define XF86XK_Refresh 0x1008FF29
-#define XF86XK_PowerOff 0x1008FF2A
-#define XF86XK_WakeUp 0x1008FF2B
-#define XF86XK_Eject 0x1008FF2C
-#define XF86XK_ScreenSaver 0x1008FF2D
-#define XF86XK_WWW 0x1008FF2E
-#define XF86XK_Sleep 0x1008FF2F
-#define XF86XK_Favorites 0x1008FF30
-#define XF86XK_AudioPause 0x1008FF31
-#define XF86XK_AudioMedia 0x1008FF32
-#define XF86XK_MyComputer 0x1008FF33
-#define XF86XK_VendorHome 0x1008FF34
-#define XF86XK_LightBulb 0x1008FF35
-#define XF86XK_Shop 0x1008FF36
-#define XF86XK_History 0x1008FF37
-#define XF86XK_OpenURL 0x1008FF38
-#define XF86XK_AddFavorite 0x1008FF39
-#define XF86XK_HotLinks 0x1008FF3A
-#define XF86XK_BrightnessAdjust 0x1008FF3B
-#define XF86XK_Finance 0x1008FF3C
-#define XF86XK_Community 0x1008FF3D
-#define XF86XK_AudioRewind 0x1008FF3E
-#define XF86XK_XF86BackForward 0x1008FF3F
-#define XF86XK_Launch0 0x1008FF40
-#define XF86XK_Launch1 0x1008FF41
-#define XF86XK_Launch2 0x1008FF42
-#define XF86XK_Launch3 0x1008FF43
-#define XF86XK_Launch4 0x1008FF44
-#define XF86XK_Launch5 0x1008FF45
-#define XF86XK_Launch6 0x1008FF46
-#define XF86XK_Launch7 0x1008FF47
-#define XF86XK_Launch8 0x1008FF48
-#define XF86XK_Launch9 0x1008FF49
-#define XF86XK_LaunchA 0x1008FF4A
-#define XF86XK_LaunchB 0x1008FF4B
-#define XF86XK_LaunchC 0x1008FF4C
-#define XF86XK_LaunchD 0x1008FF4D
-#define XF86XK_LaunchE 0x1008FF4E
-#define XF86XK_LaunchF 0x1008FF4F
-
-#define XF86XK_ApplicationLeft 0x1008FF50
-#define XF86XK_ApplicationRight 0x1008FF51
-#define XF86XK_Book 0x1008FF52
-#define XF86XK_CD 0x1008FF53
-#define XF86XK_Calculater 0x1008FF54
-#define XF86XK_Clear 0x1008FF55
-#define XF86XK_Close 0x1008FF56
-#define XF86XK_Copy 0x1008FF57
-#define XF86XK_Cut 0x1008FF58
-#define XF86XK_Display 0x1008FF59
-#define XF86XK_DOS 0x1008FF5A
-#define XF86XK_Documents 0x1008FF5B
-#define XF86XK_Excel 0x1008FF5C
-#define XF86XK_Explorer 0x1008FF5D
-#define XF86XK_Game 0x1008FF5E
-#define XF86XK_Go 0x1008FF5F
-#define XF86XK_iTouch 0x1008FF60
-#define XF86XK_LogOff 0x1008FF61
-#define XF86XK_Market 0x1008FF62
-#define XF86XK_Meeting 0x1008FF63
-#define XF86XK_MenuKB 0x1008FF65
-#define XF86XK_MenuPB 0x1008FF66
-#define XF86XK_MySites 0x1008FF67
-#define XF86XK_New 0x1008FF68
-#define XF86XK_News 0x1008FF69
-#define XF86XK_OfficeHome 0x1008FF6A
-#define XF86XK_Open 0x1008FF6B
-#define XF86XK_Option 0x1008FF6C
-#define XF86XK_Paste 0x1008FF6D
-#define XF86XK_Phone 0x1008FF6E
-#define XF86XK_Q 0x1008FF70
-#define XF86XK_Reply 0x1008FF72
-#define XF86XK_Reload 0x1008FF73
-#define XF86XK_RotateWindows 0x1008FF74
-#define XF86XK_RotationPB 0x1008FF75
-#define XF86XK_RotationKB 0x1008FF76
-#define XF86XK_Save 0x1008FF77
-#define XF86XK_ScrollUp 0x1008FF78
-#define XF86XK_ScrollDown 0x1008FF79
-#define XF86XK_ScrollClick 0x1008FF7A
-#define XF86XK_Send 0x1008FF7B
-#define XF86XK_Spell 0x1008FF7C
-#define XF86XK_SplitScreen 0x1008FF7D
-#define XF86XK_Support 0x1008FF7E
-#define XF86XK_TaskPane 0x1008FF7F
-#define XF86XK_Terminal 0x1008FF80
-#define XF86XK_Tools 0x1008FF81
-#define XF86XK_Travel 0x1008FF82
-#define XF86XK_UserPB 0x1008FF84
-#define XF86XK_User1KB 0x1008FF85
-#define XF86XK_User2KB 0x1008FF86
-#define XF86XK_Video 0x1008FF87
-#define XF86XK_WheelButton 0x1008FF88
-#define XF86XK_Word 0x1008FF89
-#define XF86XK_Xfer 0x1008FF8A
-#define XF86XK_ZoomIn 0x1008FF8B
-#define XF86XK_ZoomOut 0x1008FF8C
-
-#define XF86XK_Away 0x1008FF8D
-#define XF86XK_Messenger 0x1008FF8E
-#define XF86XK_WebCam 0x1008FF8F
-#define XF86XK_MailForward 0x1008FF90
-#define XF86XK_Pictures 0x1008FF91
-#define XF86XK_Music 0x1008FF92
-
-/* Keys for special action keys (hot keys) */
-#define XF86XK_Switch_VT_1 0x1008FE01
-#define XF86XK_Switch_VT_2 0x1008FE02
-#define XF86XK_Switch_VT_3 0x1008FE03
-#define XF86XK_Switch_VT_4 0x1008FE04
-#define XF86XK_Switch_VT_5 0x1008FE05
-#define XF86XK_Switch_VT_6 0x1008FE06
-#define XF86XK_Switch_VT_7 0x1008FE07
-#define XF86XK_Switch_VT_8 0x1008FE08
-#define XF86XK_Switch_VT_9 0x1008FE09
-#define XF86XK_Switch_VT_10 0x1008FE0A
-#define XF86XK_Switch_VT_11 0x1008FE0B
-#define XF86XK_Switch_VT_12 0x1008FE0C
-
-#define XF86XK_Ungrab 0x1008FE20
-#define XF86XK_ClearGrab 0x1008FE21
-#define XF86XK_Next_VMode 0x1008FE22
-#define XF86XK_Prev_VMode 0x1008FE23
-
-
diff --git a/projs/CodeBlocks/Win32Extra/builtin.c b/projs/CodeBlocks/Win32Extra/builtin.c
deleted file mode 100644
index f2883c7b..00000000
--- a/projs/CodeBlocks/Win32Extra/builtin.c
+++ /dev/null
@@ -1,25 +0,0 @@
-extern void module_data_textfile_init(void);
-extern void module_data_binfile_init(void);
-extern void module_data_mg_init(void);
-extern void module_data_garmin_init(void);
-extern void module_data_poi_geodownload_init(void);
-extern void module_gtk_graphics_init(void);
-extern void module_gtk_gui_init(void);
-extern void module_vehicle_demo_init(void);
-extern void module_vehicle_file_init(void);
-extern void module_win32_gui_init(void);
-extern void module_speech_speech_dispatcher_init(void);
-extern void builtin_init(void);
-void builtin_init(void) {
- module_data_textfile_init();
- module_data_binfile_init();
- module_data_mg_init();
- module_win32_gui_init();
- module_data_garmin_init();
- module_data_poi_geodownload_init();
- module_gtk_graphics_init();
- module_gtk_gui_init();
- module_vehicle_demo_init();
- module_vehicle_file_init();
- module_speech_speech_dispatcher_init();
-}
diff --git a/projs/CodeBlocks/Win32Extra/byteswap.h b/projs/CodeBlocks/Win32Extra/byteswap.h
deleted file mode 100644
index a227dde5..00000000
--- a/projs/CodeBlocks/Win32Extra/byteswap.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef _BYTESWAP_H
-#define _BYTESWAP_H
-
-static inline unsigned short bswap_16(unsigned short x) {
- return (x>>8) | (x<<8);
-}
-
-static inline unsigned int bswap_32(unsigned int x) {
- return (bswap_16(x&0xffff)<<16) | (bswap_16(x>>16));
-}
-
-static inline unsigned long long bswap_64(unsigned long long x) {
- return (((unsigned long long)bswap_32(x&0xffffffffull))<<32) | (bswap_32(x>>32));
-}
-
-#endif
-
diff --git a/projs/CodeBlocks/Win32Extra/config.h b/projs/CodeBlocks/Win32Extra/config.h
deleted file mode 100644
index 019925b2..00000000
--- a/projs/CodeBlocks/Win32Extra/config.h
+++ /dev/null
@@ -1,417 +0,0 @@
-/* config.h. Generated from config.h.in by configure. */
-/* config.h.in. Generated from configure.in by autoheader. */
-
-/* Define to avoid floating point */
-/* #undef AVOID_FLOAT */
-
-/* Define to avoid unaligned access */
-/* #undef AVOID_UNALIGNED */
-
-/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
- systems. This function is required for `alloca.c' support on those systems.
- */
-/* #undef CRAY_STACKSEG_END */
-
-/* Define to 1 if using `alloca.c'. */
-/* #undef C_ALLOCA */
-
-/* Define to 1 if translation of program messages to the user's native
- language is requested. */
-#define ENABLE_NLS 1
-
-/* Define to 1 if you have `alloca', as a function or macro. */
-#define HAVE_ALLOCA 1
-
-/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
- */
-#define HAVE_ALLOCA_H 1
-
-/* Define to 1 if you have the `argz_count' function. */
-#define HAVE_ARGZ_COUNT 1
-
-/* Define to 1 if you have the <argz.h> header file. */
-#define HAVE_ARGZ_H 1
-
-/* Define to 1 if you have the `argz_next' function. */
-#define HAVE_ARGZ_NEXT 1
-
-/* Define to 1 if you have the `argz_stringify' function. */
-#define HAVE_ARGZ_STRINGIFY 1
-
-/* Define to 1 if you have the `asprintf' function. */
-#define HAVE_ASPRINTF 1
-
-/* Define to 1 if the compiler understands __builtin_expect. */
-#define HAVE_BUILTIN_EXPECT 1
-
-/* Define to 1 if you have the [CEGUI/CEGUI.h] header file. */
-/* #undef HAVE_CEGUI */
-
-/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
- CoreFoundation framework. */
-/* #undef HAVE_CFLOCALECOPYCURRENT */
-
-/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
- the CoreFoundation framework. */
-/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */
-
-/* Define if the GNU dcgettext() function is already present or preinstalled.
- */
-#define HAVE_DCGETTEXT 1
-
-/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you
- don't. */
-#define HAVE_DECL_FEOF_UNLOCKED 0
-
-/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if
- you don't. */
-#define HAVE_DECL_FGETS_UNLOCKED 0
-
-/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you
- don't. */
-#define HAVE_DECL_GETC_UNLOCKED 1
-
-/* Define to 1 if you have the declaration of `_snprintf', and to 0 if you
- don't. */
-#define HAVE_DECL__SNPRINTF 0
-
-/* Define to 1 if you have the declaration of `_snwprintf', and to 0 if you
- don't. */
-#define HAVE_DECL__SNWPRINTF 0
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#define HAVE_DLFCN_H 1
-
-/* Define to 1 if you have imlib2 */
-#define HAVE_FREETYPE2 1
-
-/* Define to 1 if you have the `fwprintf' function. */
-/* #undef HAVE_FWPRINTF */
-
-/* Define to 1 if you have the `getcwd' function. */
-#define HAVE_GETCWD 1
-
-/* Define to 1 if you have the `getegid' function. */
-#define HAVE_GETEGID 1
-
-/* Define to 1 if you have the `geteuid' function. */
-#define HAVE_GETEUID 1
-
-/* Define to 1 if you have the `getgid' function. */
-#define HAVE_GETGID 1
-
-/* Define to 1 if you have the `getpagesize' function. */
-#define HAVE_GETPAGESIZE 1
-
-/* Define if the GNU gettext() function is already present or preinstalled. */
-#define HAVE_GETTEXT 1
-
-/* Define to 1 if you have the `getuid' function. */
-#define HAVE_GETUID 1
-
-/* Define to 1 if you have the <GL/glc.h> header file. */
-/* #undef HAVE_GLC */
-
-/* Define to 1 if you have the <GL/glut.h> header file. */
-#define HAVE_GLUT
-
-/* Define to 1 if you have imlib2 */
-#define HAVE_GTK2 1
-
-/* Define if you have the iconv() function. */
-#define HAVE_ICONV 1
-
-/* Define to 1 if you have imlib2 */
-/* #undef HAVE_IMLIB2 */
-
-/* Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>. */
-#define HAVE_INTMAX_T 1
-
-/* Define if <inttypes.h> exists and doesn't clash with <sys/types.h>. */
-#define HAVE_INTTYPES_H 1
-
-/* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and
- declares uintmax_t. */
-#define HAVE_INTTYPES_H_WITH_UINTMAX 1
-
-/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
-#define HAVE_LANGINFO_CODESET 1
-
-/* Define if your <locale.h> file defines LC_MESSAGES. */
-#define HAVE_LC_MESSAGES 1
-
-/* Define to 1 if you have the `CEGUIBase' library (-lCEGUIBase). */
-/* #undef HAVE_LIBCEGUIBASE */
-
-/* Define to 1 if you have the `CEGUIFalagardWRBase' library
- (-lCEGUIFalagardWRBase). */
-/* #undef HAVE_LIBCEGUIFALAGARDWRBASE */
-
-/* Define to 1 if you have the `CEGUIOpenGLRenderer' library
- (-lCEGUIOpenGLRenderer). */
-/* #undef HAVE_LIBCEGUIOPENGLRENDERER */
-
-/* Define to 1 if you have the <gps.h> header file. */
-/* #undef HAVE_LIBGPS */
-
-/* Define to 1 if you have the <SDL/SDL.h> header file. */
-/* #undef HAVE_LIBSDL */
-
-/* Define to 1 if you have the <libspeechd.h> header file. */
-/* #undef HAVE_LIBSPEECHD */
-
-/* Define to 1 if you have the <limits.h> header file. */
-#define HAVE_LIMITS_H 1
-
-/* Define if you have the 'long double' type. */
-#define HAVE_LONG_DOUBLE 1
-
-/* Define if you have the 'long long' type. */
-#define HAVE_LONG_LONG 1
-
-/* Define to 1 if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define to 1 if you have the `mempcpy' function. */
-#define HAVE_MEMPCPY 1
-
-/* Define to 1 if you have a working `mmap' system call. */
-/* #undef HAVE_MMAP */
-
-/* Define to 1 if you have the `munmap' function. */
-#define HAVE_MUNMAP 1
-
-/* Define if you have <langinfo.h> and it defines the NL_LOCALE_NAME macro if
- _GNU_SOURCE is defined. */
-/* #undef HAVE_NL_LOCALE_NAME */
-
-/* Define to 1 if you have the <GL/gl.h> header file. */
-#define HAVE_OPENGL
-
-/* Define if your printf() function supports format strings with positions. */
-#define HAVE_POSIX_PRINTF 1
-
-/* Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE. */
-#define HAVE_PTHREAD_MUTEX_RECURSIVE 1
-
-/* Define if the POSIX multithreading library has read/write locks. */
-#define HAVE_PTHREAD_RWLOCK 1
-
-/* Define to 1 if you have the `putenv' function. */
-#define HAVE_PUTENV 1
-
-/* Define to 1 if you have python */
-#define HAVE_PYTHON 1
-
-/* Define to 1 if you have the `setenv' function. */
-#define HAVE_SETENV 1
-
-/* Define to 1 if you have the `setlocale' function. */
-#define HAVE_SETLOCALE 1
-
-/* Define to 1 if you have the `snprintf' function. */
-#define HAVE_SNPRINTF 1
-
-/* Define to 1 if you have the <stddef.h> header file. */
-#define HAVE_STDDEF_H 1
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#define HAVE_STDINT_H 1
-
-/* Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and declares
- uintmax_t. */
-#define HAVE_STDINT_H_WITH_UINTMAX 1
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the `stpcpy' function. */
-/* #undef HAVE_STPCPY */
-
-/* Define to 1 if you have the `strcasecmp' function. */
-#define HAVE_STRCASECMP 1
-
-/* Define to 1 if you have the `strdup' function. */
-#define HAVE_STRDUP 1
-
-/* Define to 1 if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define to 1 if you have the `strtoul' function. */
-#define HAVE_STRTOUL 1
-
-/* Define to 1 if you have the <sys/param.h> header file. */
-#define HAVE_SYS_PARAM_H 1
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the `tsearch' function. */
-#define HAVE_TSEARCH 1
-
-/* Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>. */
-#define HAVE_UINTMAX_T 1
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* Define if you have the 'unsigned long long' type. */
-#define HAVE_UNSIGNED_LONG_LONG 1
-
-/* Define to 1 or 0, depending whether the compiler supports simple visibility
- declarations. */
-#define HAVE_VISIBILITY 0
-
-/* Define if you have the 'wchar_t' type. */
-#define HAVE_WCHAR_T 1
-
-/* Define to 1 if you have the `wcslen' function. */
-#define HAVE_WCSLEN 1
-
-/* Define if you have the 'wint_t' type. */
-#define HAVE_WINT_T 1
-
-/* Define to 1 if you have the <zlib.h> header file. */
-#define HAVE_ZLIB
-
-/* Define to 1 if you have the `__fsetlocking' function. */
-/* #undef HAVE___FSETLOCKING */
-
-/* Define as const if the declaration of iconv() needs const. */
-#define ICONV_CONST const
-
-/* Define if integer division by zero raises signal SIGFPE. */
-#define INTDIV0_RAISES_SIGFPE 1
-
-/* Name of package */
-#define PACKAGE "navit"
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT ""
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME "navit"
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "navit 0.0.3"
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME "navit"
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION "0.0.3"
-
-/* Define if <inttypes.h> exists and defines unusable PRI* macros. */
-/* #undef PRI_MACROS_BROKEN */
-
-/* Define if the pthread_in_use() detection is hard. */
-/* #undef PTHREAD_IN_USE_DETECTION_HARD */
-
-/* Define as the maximum value of type 'size_t', if the system doesn't define
- it. */
-/* #undef SIZE_MAX */
-
-/* If using the C implementation of alloca, define if you know the
- direction of stack growth for your system; otherwise it will be
- automatically deduced at runtime.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown */
-/* #undef STACK_DIRECTION */
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Define if the POSIX multithreading library can be used. */
-#define USE_POSIX_THREADS 1
-
-/* Define if references to the POSIX multithreading library should be made
- weak. */
-/* #undef USE_POSIX_THREADS_WEAK */
-
-/* Define if the GNU Pth multithreading library can be used. */
-/* #undef USE_PTH_THREADS */
-
-/* Define if references to the GNU Pth multithreading library should be made
- weak. */
-/* #undef USE_PTH_THREADS_WEAK */
-
-/* Define if the old Solaris multithreading library can be used. */
-/* #undef USE_SOLARIS_THREADS */
-
-/* Define if references to the old Solaris multithreading library should be
- made weak. */
-/* #undef USE_SOLARIS_THREADS_WEAK */
-
-/* Define if the Win32 multithreading API can be used. */
-/* #undef USE_WIN32_THREADS */
-
-/* Version number of package */
-#define VERSION "0.0.3"
-
-/* Enable GNU extensions on systems that have them. */
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE 1
-#endif
-
-/* Define to `__inline__' or `__inline' if that's what the C compiler
- calls it, or to nothing if 'inline' is not supported under any name. */
-#ifndef __cplusplus
-/* #undef inline */
-#endif
-
-/* Define as the type of the result of subtracting two pointers, if the system
- doesn't define it. */
-/* #undef ptrdiff_t */
-
-/* Define to empty if the C compiler doesn't support this keyword. */
-/* #undef signed */
-
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-/* #undef size_t */
-
-/* Define to unsigned long or unsigned long long if <stdint.h> and
- <inttypes.h> don't define. */
-/* #undef uintmax_t */
-
-
-#define __libc_lock_t gl_lock_t
-#define __libc_lock_define gl_lock_define
-#define __libc_lock_define_initialized gl_lock_define_initialized
-#define __libc_lock_init gl_lock_init
-#define __libc_lock_lock gl_lock_lock
-#define __libc_lock_unlock gl_lock_unlock
-#define __libc_lock_recursive_t gl_recursive_lock_t
-#define __libc_lock_define_recursive gl_recursive_lock_define
-#define __libc_lock_define_initialized_recursive gl_recursive_lock_define_initialized
-#define __libc_lock_init_recursive gl_recursive_lock_init
-#define __libc_lock_lock_recursive gl_recursive_lock_lock
-#define __libc_lock_unlock_recursive gl_recursive_lock_unlock
-#define glthread_in_use libintl_thread_in_use
-#define glthread_lock_init libintl_lock_init
-#define glthread_lock_lock libintl_lock_lock
-#define glthread_lock_unlock libintl_lock_unlock
-#define glthread_lock_destroy libintl_lock_destroy
-#define glthread_rwlock_init libintl_rwlock_init
-#define glthread_rwlock_rdlock libintl_rwlock_rdlock
-#define glthread_rwlock_wrlock libintl_rwlock_wrlock
-#define glthread_rwlock_unlock libintl_rwlock_unlock
-#define glthread_rwlock_destroy libintl_rwlock_destroy
-#define glthread_recursive_lock_init libintl_recursive_lock_init
-#define glthread_recursive_lock_lock libintl_recursive_lock_lock
-#define glthread_recursive_lock_unlock libintl_recursive_lock_unlock
-#define glthread_recursive_lock_destroy libintl_recursive_lock_destroy
-#define glthread_once libintl_once
-#define glthread_once_call libintl_once_call
-#define glthread_once_singlethreaded libintl_once_singlethreaded
-
-#define index(a,b) strchr(a,b)
-#define strtok_r(s,d,p) strtok(s,d)
-
-#define alarm( a )
diff --git a/projs/CodeBlocks/Win32Extra/endian.h b/projs/CodeBlocks/Win32Extra/endian.h
deleted file mode 100644
index cabb6963..00000000
--- a/projs/CodeBlocks/Win32Extra/endian.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef ENDIAN_H_INCLUDED
-#define ENDIAN_H_INCLUDED
-
-#endif
-
diff --git a/projs/CodeBlocks/Win32Extra/libgarmin/libgarmin.a b/projs/CodeBlocks/Win32Extra/libgarmin/libgarmin.a
deleted file mode 100644
index 7d49bcb9..00000000
--- a/projs/CodeBlocks/Win32Extra/libgarmin/libgarmin.a
+++ /dev/null
Binary files differ
diff --git a/projs/CodeBlocks/Win32Extra/libgarmin/libgarmin.h b/projs/CodeBlocks/Win32Extra/libgarmin/libgarmin.h
deleted file mode 100644
index 8374fce9..00000000
--- a/projs/CodeBlocks/Win32Extra/libgarmin/libgarmin.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- Copyright (C) 2007 Alexander Atanasov <aatanasov@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; version 2 of the License.
-
- 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, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-
-*/
-
-#include <sys/types.h>
-
-#ifdef _WIN32
-#define u_int8_t unsigned char
-#define int8_t char
-#define int16_t short
-#define u_int16_t unsigned short
-#define int32_t int
-#define u_int32_t unsigned int
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-enum {
- L_LBL,
- L_NET,
- L_POI,
-};
-
-struct gcoord {
- int x;
- int y;
-};
-
-#define GS_COUNTRY 1
-#define GS_REGION 2
-#define GS_CITY 3
-#define GS_ZIP 4
-#define GS_ROAD 5
-#define GS_INTERSECT 6
-#define GS_HOUSENUMBER 7
-#define GS_POI 8
-
-#define GM_EXACT 0
-#define GM_START 1
-#define GM_ANY 2
-
-struct gar_search {
- unsigned char type;
- unsigned char match;
- char *needle;
- struct gobject *fromobj;
-};
-
-#define GO_POINT 1
-#define GO_POI 2
-#define GO_POLYLINE 3
-#define GO_POLYGON 4
-#define GO_ROAD 5
-
-struct gar_subfile;
-struct gar_objdraworder;
-
-struct gmap {
- struct gar_objdraworder *draworder;
- int subfiles;
- int lastsub;
- struct gar_subfile **subs;
- int zoomlevels;
- int basebits;
- int minlevel;
- int maxlevel;
-};
-
-struct gobject {
- int type;
- void *gptr;
- void *priv_data;
- struct gobject *next;
-};
-
-struct gar_rect {
- double lulat;
- double lulong;
- double rllat;
- double rllong;
-};
-
-
-/* Walk and parse all data */
-#define OPM_PARSE (1<<0)
-/* Call a callback w/ every object */
-#define OPM_DUMP (1<<1)
-/* Work as a map backend */
-#define OPM_GPS (1<<2)
-
-typedef void (*dump_fn)(struct gobject *obj);
-
-#define DBGM_LBLS (1<<0)
-#define DBGM_OBJSRC (1<<1)
-
-
-struct gar_config {
- int opm;
- int maxsubdivs; /* Load max N subdivs for OPM_GPS */
- dump_fn cb; /* Callback function for OPM_DUMP */
- unsigned debugmask; /* Debuging aid */
- int debuglevel; /* Debug level */
-};
-
-struct gimg;
-struct gar;
-
-typedef void (*log_fn)(char *file, int line, int level, char *fmt, ...)
- __attribute__ ((format(printf,4,5)));
-/* Default init w/ config, keep for the latest navit release */
-struct gar *gar_init(char *tbd, log_fn l);
-struct gar *gar_init_cfg(char *tbd, log_fn l, struct gar_config *cfg);
-void gar_free(struct gar *g);
-int gar_img_load(struct gar *gar, char *file, int data);
-struct gmap *gar_find_subfiles(struct gar *gar, void *select, int flags);
-void gar_free_gmap(struct gmap *g);
-int gar_get_zoomlevels(struct gar_subfile *sub);
-
-#define GO_GET_SORTED (1<<0)
-#define GO_GET_ROUTABLE (1<<1)
-#define GO_GET_SEARCH (1<<2)
-
-struct gobject *gar_get_object(struct gar *gar, void *ptr);
-int gar_get_objects(struct gmap *gm, int level, void *select,
- struct gobject **ret, int flags);
-void gar_free_objects(struct gobject *g);
-u_int8_t gar_obj_type(struct gobject *o);
-int gar_get_object_position(struct gobject *o, struct gcoord *ret);
-int gar_object_subtype(struct gobject *o);
-int gar_get_object_dcoord(struct gmap *gm, struct gobject *o, int ndelta, struct gcoord *ret);
-int gar_get_object_coord(struct gmap *gm, struct gobject *o, struct gcoord *ret);
-
-int gar_is_object_dcoord_node(struct gmap *gm, struct gobject *o, int ndelta);
-
-int gar_get_object_deltas(struct gobject *o);
-/* Get lbl as strdup'ed string */
-char *gar_get_object_lbl(struct gobject *o);
-int gar_get_object_intlbl(struct gobject *o);
-int gar_object_get_draw_order(struct gobject *o);
-char *gar_object_debug_str(struct gobject *o);
-/* Object index is (subdividx << 16) | (idx << 8) | otype */
-int gar_object_index(struct gobject *o);
-/* Object mapid is the id of the file containing the object */
-int gar_object_mapid(struct gobject *o);
-struct gobject *gar_get_object_by_id(struct gar *gar, unsigned int mapid,
- unsigned int objid);
-
-int gar_fat_file2fd(struct gimg *g, char *name, int fd);
-/* Get ptr to a dskimg file */
-struct gimg *gar_get_dskimg(struct gar *gar, char *file);
-
-#define F_ONEWAY (1<<0)
-#define F_SEGMENTED (1<<1)
-
-int gar_object_flags(struct gobject *o);
-
-
-#define GARDEG(x) ((x) < 0x800000 ? (double)(x) * 360.0 / 16777216.0 : -(double)((x) - 0x100000) * 360.0 / 16777216.0)
-#define GARRAD(x) ((x) < 0x800000 ? (double)(x) * TWOPI / 16777216.0 : -(double)((x) - 0x100000) * TWOPI / 16777216.0)
-#define DEGGAR(x) ((x) * (1/(360.0/(1<<24))))
-#define FEET2METER(x) ((x)/3.28084)
-
-#define POI_STREET_NUM (1<<0)
-#define POI_STREET (1<<1)
-#define POI_CITY (1<<2)
-#define POI_ZIP (1<<3)
-#define POI_PHONE (1<<4)
-#define POI_EXIT (1<<5)
-#define POI_TIDE_PREDICT (1<<6)
-#define POI_UNKNOW (1<<7)
-
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/projs/CodeBlocks/Win32Extra/navit_gtk.c b/projs/CodeBlocks/Win32Extra/navit_gtk.c
deleted file mode 100644
index c2aa0957..00000000
--- a/projs/CodeBlocks/Win32Extra/navit_gtk.c
+++ /dev/null
@@ -1,23 +0,0 @@
-extern void module_data_textfile_init(void);
-extern void module_data_binfile_init(void);
-extern void module_data_mg_init(void);
-extern void module_data_garmin_init(void);
-extern void module_data_poi_geodownload_init(void);
-extern void module_gtk_graphics_init(void);
-extern void module_gtk_gui_init(void);
-extern void module_vehicle_demo_init(void);
-extern void module_vehicle_file_init(void);
-extern void module_speech_speech_dispatcher_init(void);
-extern void builtin_init(void);
-void builtin_init(void) {
- module_data_textfile_init();
- module_data_binfile_init();
- module_data_mg_init();
- module_data_garmin_init();
- module_data_poi_geodownload_init();
- module_gtk_graphics_init();
- module_gtk_gui_init();
- module_vehicle_demo_init();
- module_vehicle_file_init();
- module_speech_speech_dispatcher_init();
-}
diff --git a/projs/CodeBlocks/Win32Extra/navit_win32.c b/projs/CodeBlocks/Win32Extra/navit_win32.c
deleted file mode 100644
index 4493ec5c..00000000
--- a/projs/CodeBlocks/Win32Extra/navit_win32.c
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-extern void module_data_textfile_init(void);
-extern void module_data_binfile_init(void);
-extern void module_data_mg_init(void);
-extern void module_win32_gui_init(void);
-extern void module_data_garmin_init(void);
-extern void module_data_poi_geodownload_init(void);
-extern void module_vehicle_demo_init(void);
-extern void module_vehicle_file_init(void);
-extern void module_speech_speech_dispatcher_init(void);
-
-void builtin_init(void) {
- module_data_textfile_init();
- module_data_binfile_init();
- module_data_mg_init();
- module_win32_gui_init();
- module_data_poi_geodownload_init();
- module_vehicle_demo_init();
- module_vehicle_file_init();
-#if !defined(__CEGCC__)
- module_data_garmin_init();
- module_speech_speech_dispatcher_init();
-#endif
-}
diff --git a/projs/CodeBlocks/Win32Extra/serial_io.c b/projs/CodeBlocks/Win32Extra/serial_io.c
deleted file mode 100644
index 07b8fa36..00000000
--- a/projs/CodeBlocks/Win32Extra/serial_io.c
+++ /dev/null
@@ -1,122 +0,0 @@
-#include <stdio.h>
-#include <windows.h>
-#include "serial_io.h"
-#include "util.h"
-
-int serial_io_init( const char* port, const char* strsettings )
-{
- HANDLE hCom = NULL;
-
- TCHAR strport[16];
- _sntprintf( strport, sizeof( strport ), "\\\\.\\%s", port );
-
- hCom = CreateFile(
- strport,
- GENERIC_WRITE | GENERIC_READ,
- 0,
- 0,
- OPEN_EXISTING,
- 0,
- NULL);
-
- if (hCom == INVALID_HANDLE_VALUE)
- {
- LPVOID lpMsgBuf;
-
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR) &lpMsgBuf,
- 0,
- NULL
- );
- // g_strSerialError = strPort + wxT(": ") + (LPTSTR) lpMsgBuf;
-
- // Free the buffer.
- LocalFree( lpMsgBuf );
- return -1;
- }
-
- DCB dcb;
-
- ZeroMemory(&dcb, sizeof(DCB));
-
- GetCommState(hCom, &dcb);
-
-// char strsettings[255];
-// snprintf( strsettings, sizeof( strsettings ), "baud=%d parity=N data=8 stop=1", baudrate );
-#if !defined(__CEGCC__)
- BuildCommDCB( strsettings, &dcb);
-#else
-// TODO
-#endif
- SetupComm(hCom, 4096, 4096);
-
- SetCommState(hCom, &dcb);
-
- COMMTIMEOUTS sCT;
-
- memset(&sCT, 0, sizeof(sCT));
- sCT.ReadTotalTimeoutConstant = 10;
-
- SetCommTimeouts(hCom, &sCT);
-
- return (int)hCom;
-}
-
-int serial_io_read( int fd, char * buffer, int buffer_size )
-{
- DWORD dwBytesIn = 0;
-
- if (fd <= 0)
- {
- // Sleep(1000);
- *buffer = 0;
- return 0;
- }
-
- ReadFile( (HANDLE)fd, buffer, buffer_size - 1, &dwBytesIn, NULL);
-
- if (dwBytesIn > 0)
- {
- printf( "GPS < %s\n",buffer );
- }
- if (dwBytesIn >= 0)
- {
- buffer[dwBytesIn] = 0;
- }
- else{
- buffer[0] = 0;
- }
- buffer[buffer_size - 1] = 0;
-
-
- if (dwBytesIn <= 0)
- {
- Sleep(50);
- dwBytesIn = 0;
- }
-
- return dwBytesIn;
-}
-
-int serial_io_write(int fd, const char * buffer)
-{
- DWORD dwBytesOut = 0;
-
- WriteFile((HANDLE)fd, buffer, strlen(buffer), &dwBytesOut, NULL);
-
- return dwBytesOut;
-}
-
-void serial_io_shutdown(int fd )
-{
- if (fd > 0)
- {
- CloseHandle((HANDLE)fd);
- }
-}
diff --git a/projs/CodeBlocks/Win32Extra/serial_io.h b/projs/CodeBlocks/Win32Extra/serial_io.h
deleted file mode 100644
index 4c7b8a31..00000000
--- a/projs/CodeBlocks/Win32Extra/serial_io.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef SERIAL_IO_H_INCLUDED
-#define SERIAL_IO_H_INCLUDED
-
-int serial_io_init( const char* port, const char* strsettings );
-int serial_io_read(int fd, char * buffer, int buffer_size );
-int WriteSerial(int fd, const char * buffer);
-void serial_io_shutdown(int fd );
-
-#endif
diff --git a/projs/CodeBlocks/Win32Extra/setenv.c b/projs/CodeBlocks/Win32Extra/setenv.c
deleted file mode 100644
index b1316935..00000000
--- a/projs/CodeBlocks/Win32Extra/setenv.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-
-
-#if !defined(__CEGCC__)
-int setenv(const char *name, const char *value, int overwrite)
-{
- char strPutEnv[512];
-
- char * hasKey = getenv ( name );
-
- if ( ( overwrite != 0 ) || ( hasKey == NULL ) )
- {
- snprintf( strPutEnv, sizeof( strPutEnv ), "%s=%s", name, value );
- strPutEnv[ sizeof( strPutEnv ) - 1 ] = '\0';
- _putenv( strPutEnv );
- }
- return 0;
-}
-#endif
-
diff --git a/projs/CodeBlocks/Win32Extra/setenv.h b/projs/CodeBlocks/Win32Extra/setenv.h
deleted file mode 100644
index 0d542a8f..00000000
--- a/projs/CodeBlocks/Win32Extra/setenv.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _SETENV_H_INCLUDED
-#define _SETENV_H_INCLUDED
-
-
-int setenv(const char *name, const char *value, int overwrite);
-
-
-#endif /* !_SETENV_H_INCLUDED */
-
diff --git a/projs/CodeBlocks/Win32Extra/speech_dispatcher_win32.c b/projs/CodeBlocks/Win32Extra/speech_dispatcher_win32.c
deleted file mode 100644
index 1542ac85..00000000
--- a/projs/CodeBlocks/Win32Extra/speech_dispatcher_win32.c
+++ /dev/null
@@ -1,96 +0,0 @@
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <stdarg.h>
-#include "config.h"
-#include "plugin.h"
-#include "speech.h"
-#include <windows.h>
-#define COBJMACROS
-#include <sapi.h>
-#include <objbase.h>
-#include <glib.h>
-
-const IID UUID_OF_ISPVOICE; // = {6C44DF74-72B9-4992-A1EC-EF996E0422D4};
-
-
-struct speech_priv {
- ISpVoice* pIspVoice;
-};
-
-static int
-speechd_say(struct speech_priv *this_, const char *text) {
- int err = 1;
-
- if ( this_->pIspVoice )
- {
- WCHAR* pWideString = g_utf8_to_utf16( text, -1, NULL, NULL, NULL );
- ISpVoice_Speak( this_->pIspVoice, pWideString, 0, NULL);
- g_free( pWideString );
- err = 0;
- }
- return err;
-}
-
-static void
-speechd_destroy(struct speech_priv *this) {
- g_free(this);
-}
-
-static struct speech_methods speechd_meth = {
- speechd_destroy,
- speechd_say,
-};
-
-static struct speech_priv *
-speechd_new(char *data, struct speech_methods *meth) {
- struct speech_priv *this_;
-
- this_=g_new(struct speech_priv,1);
-
- this_->pIspVoice = NULL;
-
-
- CLSID clsid_sape;
- CLSID* pw = &clsid_sape;
-
- CoInitialize(NULL);
-
- HRESULT hr = CLSIDFromProgID(L"SAPI.SpVoice", &clsid_sape);
-
- if ( 0 == hr )
- {
- IID UUID_OF_ISPVOICE; // = {6C44DF74-72B9-4992-A1EC-EF996E0422D4};
- UUID_OF_ISPVOICE.Data1 = 0x6C44DF74;
- UUID_OF_ISPVOICE.Data2 = 0x72B9;
- UUID_OF_ISPVOICE.Data3 = 0x4992;
- UUID_OF_ISPVOICE.Data4[0] = 161;
- UUID_OF_ISPVOICE.Data4[1] = 236;
- UUID_OF_ISPVOICE.Data4[2] = 239;
- UUID_OF_ISPVOICE.Data4[3] = 153;
- UUID_OF_ISPVOICE.Data4[4] = 110;
- UUID_OF_ISPVOICE.Data4[5] = 4;
- UUID_OF_ISPVOICE.Data4[6] = 34;
- UUID_OF_ISPVOICE.Data4[7] = 212;
-
- ISpVoice* pIspVoice;
- hr = CoCreateInstance( &clsid_sape, NULL, CLSCTX_ALL, &UUID_OF_ISPVOICE, &pIspVoice );
-
- if ( ( 0 == hr ) && ( this_ != NULL ) )
- {
- this_->pIspVoice = pIspVoice;
- }
- }
-
- // ISpVoice_Speak( pIspVoice, L"If you can hear this, SAPI is working", 0, NULL);
- *meth=speechd_meth;
- return this_;
-}
-
-
-void plugin_init(void)
-{
- plugin_register_speech_type("speech_dispatcher", speechd_new);
-}
diff --git a/projs/CodeBlocks/Win32Extra/sys/mman.c b/projs/CodeBlocks/Win32Extra/sys/mman.c
deleted file mode 100644
index d215dc5a..00000000
--- a/projs/CodeBlocks/Win32Extra/sys/mman.c
+++ /dev/null
@@ -1,184 +0,0 @@
-#include <windows.h>
-#include <stdio.h>
-#include <wchar.h>
-#include <ctype.h>
-#include "mman.h"
-
-void * mmap_readonly_win32( const char* name, long* map_handle_ptr, long* map_file_ptr )
-{
- void * mapped_ptr = NULL;
-#if defined(__CEGCC__)
-
- wchar_t filename[MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, name, strlen(name), 0, 0)];
- MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, name, strlen(name), filename, wcslen(filename)) ;
-
- HANDLE hFile = CreateFile (filename, GENERIC_READ, FILE_SHARE_READ,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
-#else
- HANDLE hFile = CreateFile (name, GENERIC_READ, FILE_SHARE_READ,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
-#endif
- *map_file_ptr = (long)hFile;
- *map_handle_ptr = 0;
-
- if ( hFile != INVALID_HANDLE_VALUE )
- {
- HANDLE hMapping = CreateFileMapping( (HANDLE)hFile, NULL, PAGE_READONLY, 0, 0, NULL);
- mapped_ptr = MapViewOfFile(hMapping, FILE_MAP_READ, 0 , 0, 0 );
- *map_handle_ptr = (long)hMapping;
- }
-
- return mapped_ptr;
-}
-
-void mmap_unmap_win32( void* mem_ptr, long map_handle, long map_file )
-{
- if ( mem_ptr != NULL )
- {
- UnmapViewOfFile( mem_ptr );
- }
- if ( map_handle != 0)
- {
- CloseHandle( (HANDLE)map_handle );
- }
- if ( map_file != 0 )
- {
- CloseHandle( (HANDLE)map_file );
- }
-}
-
-char *stristr(const char *String, const char *Pattern)
-{
- char *pptr, *sptr, *start;
-
- for (start = (char *)String; *start != (int)NULL; start++)
- {
- /* find start of pattern in string */
- for ( ; ((*start!=(int)NULL) && (toupper(*start) != toupper(*Pattern))); start++)
- ;
- if ((int)NULL == *start)
- return NULL;
-
- pptr = (char *)Pattern;
- sptr = (char *)start;
-
- while (toupper(*sptr) == toupper(*pptr))
- {
- sptr++;
- pptr++;
-
- /* if end of pattern then pattern was found */
-
- if ((int)NULL == *pptr)
- return (start);
- }
- }
- return NULL;
-}
-
-#ifndef SIZE_MAX
-# define SIZE_MAX ((size_t) -1)
-#endif
-#ifndef SSIZE_MAX
-# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
-#endif
-#if !HAVE_FLOCKFILE
-# undef flockfile
-# define flockfile(x) ((void) 0)
-#endif
-#if !HAVE_FUNLOCKFILE
-# undef funlockfile
-# define funlockfile(x) ((void) 0)
-#endif
-
-/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */
-#ifndef EOVERFLOW
-# define EOVERFLOW E2BIG
-#endif
-
-/* Read up to (and including) a DELIMITER from FP into *LINEPTR (and
- NUL-terminate it). *LINEPTR is a pointer returned from malloc (or
- NULL), pointing to *N characters of space. It is realloc'ed as
- necessary. Returns the number of characters read (not including
- the null terminator), or -1 on error or EOF. */
-
-ssize_t
-getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
-{
- ssize_t result;
- size_t cur_len = 0;
-
- if (lineptr == NULL || n == NULL || fp == NULL)
- {
- return -1;
- }
-
- flockfile (fp);
-
- if (*lineptr == NULL || *n == 0)
- {
- *n = 120;
- *lineptr = (char *) realloc (*lineptr, *n);
- if (*lineptr == NULL)
- {
- result = -1;
- goto unlock_return;
- }
- }
-
- for (;;)
- {
- int i;
-
- i = getc (fp);
- if (i == EOF)
- {
- result = -1;
- break;
- }
-
- /* Make enough space for len+1 (for final NUL) bytes. */
- if (cur_len + 1 >= *n)
- {
- size_t needed_max =
- SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
- size_t needed = 2 * *n + 1; /* Be generous. */
- char *new_lineptr;
-
- if (needed_max < needed)
- needed = needed_max;
- if (cur_len + 1 >= needed)
- {
- result = -1;
- goto unlock_return;
- }
-
- new_lineptr = (char *) realloc (*lineptr, needed);
- if (new_lineptr == NULL)
- {
- result = -1;
- goto unlock_return;
- }
-
- *lineptr = new_lineptr;
- *n = needed;
- }
-
- (*lineptr)[cur_len] = i;
- cur_len++;
-
- if (i == delimiter)
- break;
- }
- (*lineptr)[cur_len] = '\0';
- result = cur_len ? cur_len : result;
-
- unlock_return:
- funlockfile (fp); /* doesn't set errno */
-
- return result;
-}
-
-ssize_t
-getline (char **lineptr, size_t *n, FILE *stream)
-{
- return getdelim (lineptr, n, '\n', stream);
-}
diff --git a/projs/CodeBlocks/Win32Extra/wordexp.c b/projs/CodeBlocks/Win32Extra/wordexp.c
deleted file mode 100644
index faa2d656..00000000
--- a/projs/CodeBlocks/Win32Extra/wordexp.c
+++ /dev/null
@@ -1,53 +0,0 @@
-#include <sys/types.h>
-#include <assert.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "wordexp.h"
-
-int wordexp(const char * words, wordexp_t * we, int flags)
-{
- int error=0;
-
- assert(we != NULL);
- assert(words != NULL);
-
- we->we_wordc = 1;
- we->we_wordv = NULL;
- we->we_strings = NULL;
- we->we_nbytes = 0;
-
- we->we_wordv = malloc( we->we_wordc * sizeof( char* ) );
-
- we->we_nbytes = strlen( words ) + 1;
- we->we_strings = malloc( we->we_nbytes );
-
- we->we_wordv[0] = &we->we_strings[0];
-
- // copy string & terminate
- memcpy( we->we_strings, words, we->we_nbytes -1 );
- we->we_strings[ we->we_nbytes -1 ] = '\0';
-
- return error;
-}
-
-void wordfree(wordexp_t *we)
-{
- assert(we != NULL);
-
- if ( we->we_wordv )
- {
- free(we->we_wordv);
- }
- if ( we->we_strings )
- {
- free(we->we_strings);
- }
-
- we->we_wordv = NULL;
- we->we_strings = NULL;
- we->we_nbytes = 0;
- we->we_wordc = 0;
-}
diff --git a/projs/CodeBlocks/binfile.cbp b/projs/CodeBlocks/binfile.cbp
deleted file mode 100644
index 23089802..00000000
--- a/projs/CodeBlocks/binfile.cbp
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="binfile" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libdata_binfile.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libdata_binfile.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- <Target title="DebugCeGcc">
- <Option output=".\bin\DebugCeGcc\libdata_binfile.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\DebugCeGcc\" />
- <Option type="2" />
- <Option compiler="cegcc_compiler" />
- <Option createDefFile="1" />
- <Option projectIncludeDirsRelation="1" />
- <Compiler>
- <Add option="-g" />
- <Add directory="..\..\navit" />
- <Add directory="Win32Extra" />
- <Add directory="c:\MinGW\opt\cegcc\arm-wince-cegcc\include\glib-2.0\" />
- <Add directory="C:\MinGW\opt\cegcc\arm-wince-cegcc\lib\glib-2.0\include" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=data_binfile" />
- <Add option="-D__BYTE_ORDER=__LITTLE_ENDIAN" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\navit" />
- </Compiler>
- <Linker>
- <Add library="NavitCommonLib" />
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\navit\data\binfile\binfile.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/data_garmin.cbp b/projs/CodeBlocks/data_garmin.cbp
deleted file mode 100644
index e539c5c5..00000000
--- a/projs/CodeBlocks/data_garmin.cbp
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="data_garmin" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libdata_garmin.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libdata_garmin.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=data_garmin" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\navit" />
- <Add directory="." />
- <Add directory="Win32Extra\libgarmin" />
- </Compiler>
- <Linker>
- <Add library="NavitCommonLib" />
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\navit\data\garmin\gar2navit.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\garmin\garmin.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\garmin\garmin.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/data_garmin_img.cbp b/projs/CodeBlocks/data_garmin_img.cbp
deleted file mode 100644
index f6a08967..00000000
--- a/projs/CodeBlocks/data_garmin_img.cbp
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="data_garming_img" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libdata_garmin_img.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libdata_garmin_img.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=data_garmin_img" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\navit" />
- </Compiler>
- <Linker>
- <Add library="NavitCommonLib" />
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\navit\data\garmin_img\garmin_img.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/data_mg.cbp b/projs/CodeBlocks/data_mg.cbp
deleted file mode 100644
index b026927a..00000000
--- a/projs/CodeBlocks/data_mg.cbp
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="data_mg" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libdata_mg.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libdata_mg.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- <Target title="DebugCeGcc">
- <Option output=".\bin\DebugCeGcc\libdata_mg.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\objDebugCeGcc\" />
- <Option type="2" />
- <Option compiler="cegcc_compiler" />
- <Option createDefFile="1" />
- <Option projectIncludeDirsRelation="1" />
- <Compiler>
- <Add option="-g" />
- <Add directory="..\..\navit" />
- <Add directory="Win32Extra" />
- <Add directory="C:\MinGW\opt\cegcc\arm-wince-cegcc\include\glib-2.0" />
- <Add directory="C:\MinGW\opt\cegcc\arm-wince-cegcc\lib\glib-2.0\include" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=data_mg" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="..\..\navit" />
- <Add directory="Win32Extra" />
- </Compiler>
- <Linker>
- <Add library="NavitCommonLib" />
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\navit\data\mg\block.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\mg\map.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\mg\mg.h" />
- <Unit filename="..\..\navit\data\mg\poly.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\mg\street.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\mg\town.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\mg\tree.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/data_poi_geodownload.cbp b/projs/CodeBlocks/data_poi_geodownload.cbp
deleted file mode 100644
index b1d8b279..00000000
--- a/projs/CodeBlocks/data_poi_geodownload.cbp
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="data_poi_geodownload" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libdata_poi_geodownload.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libdata_poi_geodownload.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- <Target title="DebugCeGcc">
- <Option output=".\bin\DebugCeGcc\libdata_poi_geodownload.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\DebugCeGcc\" />
- <Option type="2" />
- <Option compiler="cegcc_compiler" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=data_poi_geodownload" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\navit" />
- <Add directory="..\..\navit\data\poi_geodownload\libmdb\include" />
- </Compiler>
- <Linker>
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\navit\data\poi_geodownload\poi_geodownload.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/data_textfile.cbp b/projs/CodeBlocks/data_textfile.cbp
deleted file mode 100644
index 63f83cb8..00000000
--- a/projs/CodeBlocks/data_textfile.cbp
+++ /dev/null
@@ -1,93 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="data_textfile" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libdata_textfile.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libdata_textfile.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- <Target title="DebugCeGcc">
- <Option output=".\bin\DebugCeGcc\libdata_textfile.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\DebugCeGcc\" />
- <Option type="2" />
- <Option compiler="cegcc_compiler" />
- <Option createDefFile="1" />
- <Option projectIncludeDirsRelation="1" />
- <Compiler>
- <Add option="-g" />
- <Add directory="..\..\..\libs\gtk+-2.12.9-bundle-20080402\include\glib-2.0" />
- <Add directory="..\..\..\libs\gtk+-2.12.9-bundle-20080402\include" />
- <Add directory="..\..\..\libs\gtk+-2.12.9-bundle-20080402\lib\glib-2.0\include" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\navit" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=data_textfile" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="..\..\" />
- <Add directory="..\" />
- <Add directory="D:\CB_Projects\Navit\src\" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\navit" />
- <Add directory="..\..\navit\data\poi_geodownload\libmdb\include" />
- </Compiler>
- <Linker>
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\navit\data\textfile\textfile.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\textfile\textfile.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/fib-1.1.cbp b/projs/CodeBlocks/fib-1.1.cbp
deleted file mode 100644
index f880d372..00000000
--- a/projs/CodeBlocks/fib-1.1.cbp
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="fib-1.1" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libfib.a" prefix_auto="0" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output="obj\fib-1.1\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- <Add option="-I." />
- </Compiler>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libfib.a" prefix_auto="0" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output="obj\fib-1.1\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- </Linker>
- </Target>
- <Target title="DebugCeGcc">
- <Option output=".\bin\DebugCeGcc\libfib.a" prefix_auto="0" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output="obj\DebugCeGcc\" />
- <Option type="2" />
- <Option compiler="cegcc_compiler" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- <Add option="-I." />
- </Compiler>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add directory="..\..\navit\fib-1.1" />
- </Compiler>
- <Unit filename="..\..\navit\fib-1.1\fib.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\fib-1.1\fib.h" />
- <Unit filename="..\..\navit\fib-1.1\fibpriv.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/gentypes.cbp b/projs/CodeBlocks/gentypes.cbp
deleted file mode 100644
index 3f1a4225..00000000
--- a/projs/CodeBlocks/gentypes.cbp
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="GenTypes" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="GenTypes" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\GenTypes\Debug\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Option use_console_runner="0" />
- <Option parameters="--input-file=d:\CB_Projects\netherlands.osm --attr-debug-level=0 -k netherlands.bin" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output="GenTypes" prefix_auto="1" extension_auto="1" />
- <Option object_output="obj\GenTypes\Release\" />
- <Option type="1" />
- <Option compiler="gcc" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields -DMODULE=GenTypes" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\navit" />
- </Compiler>
- <Linker>
- <Add library="user32" />
- <Add library="gtk-win32-2.0" />
- <Add library="gdk-win32-2.0" />
- <Add library="gdk_pixbuf-2.0" />
- <Add library="freetype" />
- <Add library="z" />
- <Add library="gobject-2.0" />
- <Add library="gmodule-2.0" />
- <Add library="glib-2.0" />
- <Add library="intl" />
- <Add library="zdll" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="..\..\..\libs\zlib-1.2.3\lib" />
- </Linker>
- <ExtraCommands>
- <Add after="GenTypes.exe ..\..\navit\data\garmin\garmintypes.txt ..\..\navit\data\garmin\g2nbuiltin.h" />
- </ExtraCommands>
- <Unit filename="..\..\navit\attr.h" />
- <Unit filename="..\..\navit\attr_def.h" />
- <Unit filename="..\..\navit\coord.h" />
- <Unit filename="..\..\navit\country.h" />
- <Unit filename="..\..\navit\data\garmin\gentypes.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\debug.h" />
- <Unit filename="..\..\navit\file.h" />
- <Unit filename="..\..\navit\item.h" />
- <Unit filename="..\..\navit\map.h" />
- <Unit filename="..\..\navit\param.h" />
- <Unit filename="..\..\navit\plugin.h" />
- <Unit filename="..\..\navit\transform.h" />
- <Unit filename="Win32Extra\wordexp.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="Win32Extra\wordexp.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/gtk_gl_ext.cbp b/projs/CodeBlocks/gtk_gl_ext.cbp
deleted file mode 100644
index 5d9e3055..00000000
--- a/projs/CodeBlocks/gtk_gl_ext.cbp
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="gtk_gl_ext" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libgtk_gl_ext.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libgtk_gl_ext.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=gtk_gl_ext" />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="%GTK_DIR%\include\gtk-2.0" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\gtk-2.0\include" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include\cairo" />
- <Add directory="%GTK_DIR%\include\pango-1.0" />
- <Add directory="%GTK_DIR%\include\atk-1.0" />
- <Add directory="..\..\navit" />
- <Add directory="Win32Extra" />
- <Add directory="%GTK_DIR%\include\freetype2" />
- <Add directory="%GTK_DIR%\include\gtkglext-1.0" />
- <Add directory="%GTK_DIR%\lib\gtkglext-1.0\include" />
- </Compiler>
- <Linker>
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\navit\graphics\gtk_gl_ext\graphics_gtk_gl_ext.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/gtk_graphics.cbp b/projs/CodeBlocks/gtk_graphics.cbp
deleted file mode 100644
index dc99bf0a..00000000
--- a/projs/CodeBlocks/gtk_graphics.cbp
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="gtk_graphics" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libgtk_graphics.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libgtk_graphics.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=gtk_graphics" />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="%GTK_DIR%\include\gtk-2.0" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\gtk-2.0\include" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include\cairo" />
- <Add directory="%GTK_DIR%\include\pango-1.0" />
- <Add directory="%GTK_DIR%\include\atk-1.0" />
- <Add directory="..\..\navit" />
- <Add directory="Win32Extra" />
- <Add directory="%GTK_DIR%\include\freetype2" />
- </Compiler>
- <Linker>
- <Add library="NavitCommonLib" />
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\navit\graphics\gtk_drawing_area\graphics_gtk_drawing_area.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/gtk_gui.cbp b/projs/CodeBlocks/gtk_gui.cbp
deleted file mode 100644
index 22e9d332..00000000
--- a/projs/CodeBlocks/gtk_gui.cbp
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="gtk_gui" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libgtk_gui.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libgtk_gui.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=gtk_gui" />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="%GTK_DIR%\include\gtk-2.0" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\gtk-2.0\include" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include\cairo" />
- <Add directory="%GTK_DIR%\include\pango-1.0" />
- <Add directory="%GTK_DIR%\include\atk-1.0" />
- <Add directory="..\..\navit" />
- <Add directory="Win32Extra" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\navit\gui\gtk\datawindow.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\gui\gtk\destination.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\gui\gtk\gui_gtk.h" />
- <Unit filename="..\..\navit\gui\gtk\gui_gtk_action.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\gui\gtk\gui_gtk_statusbar.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\gui\gtk\gui_gtk_window.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/gui_sdl.cbp b/projs/CodeBlocks/gui_sdl.cbp
deleted file mode 100644
index 1940923e..00000000
--- a/projs/CodeBlocks/gui_sdl.cbp
+++ /dev/null
@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="gui_sdl" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libgui_sdl.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libgui_sdl.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=gui_sdl" />
- <Add directory="%GTK_DIR%\include" />
- <Add directory="%GTK_DIR%\include\gtk-2.0" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\gtk-2.0\include" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="%GTK_DIR%\include\cairo" />
- <Add directory="%GTK_DIR%\include\pango-1.0" />
- <Add directory="%GTK_DIR%\include\atk-1.0" />
- <Add directory="..\..\navit" />
- <Add directory="Win32Extra" />
- <Add directory="D:\msys\local\include" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\navit\gui\sdl\Makefile.am" />
- <Unit filename="..\..\navit\gui\sdl\Makefile.in" />
- <Unit filename="..\..\navit\gui\sdl\cegui_keyboard.cpp" />
- <Unit filename="..\..\navit\gui\sdl\cegui_keyboard.h" />
- <Unit filename="..\..\navit\gui\sdl\gui_sdl.h" />
- <Unit filename="..\..\navit\gui\sdl\gui_sdl_window.cpp" />
- <Unit filename="..\..\navit\gui\sdl\sdl_events.cpp" />
- <Unit filename="..\..\navit\gui\sdl\sdl_events.h" />
- <Unit filename="..\..\navit\gui\sdl\wmcontrol.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\gui\sdl\wmcontrol.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/libgarmin.cbp b/projs/CodeBlocks/libgarmin.cbp
deleted file mode 100644
index 16c63e52..00000000
--- a/projs/CodeBlocks/libgarmin.cbp
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="libgarmin" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output="libgarmin" prefix_auto="1" extension_auto="1" />
- <Option working_dir="" />
- <Option object_output="obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- </Target>
- <Target title="Release">
- <Option output="libgarmin" prefix_auto="1" extension_auto="1" />
- <Option working_dir="" />
- <Option object_output="obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- </Compiler>
- <Unit filename="..\..\..\libgarmin\src\GarminTypedef.h" />
- <Unit filename="..\..\..\libgarmin\src\array.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\array.h" />
- <Unit filename="..\..\..\libgarmin\src\bsp.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\bsp.h" />
- <Unit filename="..\..\..\libgarmin\src\garmin.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\garmin_fat.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\garmin_fat.h" />
- <Unit filename="..\..\..\libgarmin\src\garmin_lbl.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\garmin_lbl.h" />
- <Unit filename="..\..\..\libgarmin\src\garmin_net.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\garmin_net.h" />
- <Unit filename="..\..\..\libgarmin\src\garmin_obj.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\garmin_order.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\garmin_order.h" />
- <Unit filename="..\..\..\libgarmin\src\garmin_rgn.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\garmin_rgn.h" />
- <Unit filename="..\..\..\libgarmin\src\garmin_subdiv.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\garmin_subdiv.h" />
- <Unit filename="..\..\..\libgarmin\src\garmin_tdb.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\garmin_tdb.h" />
- <Unit filename="..\..\..\libgarmin\src\garmin_typ.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\geoutils.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\geoutils.h" />
- <Unit filename="..\..\..\libgarmin\src\libgarmin.h" />
- <Unit filename="..\..\..\libgarmin\src\libgarmin_priv.h" />
- <Unit filename="..\..\..\libgarmin\src\list.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\..\libgarmin\src\list.h" />
- <Unit filename="main.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/make_builtin b/projs/CodeBlocks/make_builtin
deleted file mode 100644
index f8e1c655..00000000
--- a/projs/CodeBlocks/make_builtin
+++ /dev/null
@@ -1,7 +0,0 @@
-
-builtin.c:
- ls *.la | sed -e "s/.la/_init(void);/" -e "s/.*lib/extern void module_/" >builtin.c
- echo "extern void builtin_init(void);" >>builtin.c
- echo "void builtin_init(void) {" >>builtin.c
- ls *.la | sed -e "s/.la/_init();/" -e "s/.*lib/ module_/" >>builtin.c
- echo "}" >>builtin.c
diff --git a/projs/CodeBlocks/makefile_extra b/projs/CodeBlocks/makefile_extra
deleted file mode 100644
index 98c69c7d..00000000
--- a/projs/CodeBlocks/makefile_extra
+++ /dev/null
@@ -1,134 +0,0 @@
-SRC_GTK_PATH = D:/gtk
-SRC_GTK_BIN_PATH = $(SRC_GTK_PATH)/bin
-SRC_GTK_ETC_PATH = $(SRC_GTK_PATH)/etc
-SRC_GTK_LIB_PATH = $(SRC_GTK_PATH)/lib
-
-SRC_MO_PATH = ./locale
-
-SRC_NAVIT_EXE_PATH = ./bin/release
-SRC_XPM_PATH = ../../src/xpm
-
-DST_PATH = ./distr
-DST_BIN_PATH = $(DST_PATH)/bin
-DST_XPM_PATH = $(DST_BIN_PATH)/xpm
-DST_ETC_PATH = $(DST_PATH)/etc
-DST_LIB_PATH = $(DST_PATH)/lib
-DST_MAP_PATH = $(DST_PATH)/maps
-DST_MO_PATH = $(DST_BIN_PATH)/locale
-
-WIN32_DLLS = \
- iconv.dll \
- intl.dll \
- libglib-2.0-0.dll \
- libgmodule-2.0-0.dll \
- libgobject-2.0-0.dll \
- zlib1.dll
-
-GTK_DLLS = \
- freetype6.dll \
- iconv.dll \
- intl.dll \
- libatk-1.0-0.dll \
- libcairo-2.dll \
- libfontconfig-1.dll \
- libfreetype-6.dll \
- libgdk-win32-2.0-0.dll \
- libgdk_pixbuf-2.0-0.dll \
- libglib-2.0-0.dll \
- libgmodule-2.0-0.dll \
- libgobject-2.0-0.dll \
- libgtk-win32-2.0-0.dll \
- libpango-1.0-0.dll \
- libpangocairo-1.0-0.dll \
- libpangoft2-1.0-0.dll \
- libpangowin32-1.0-0.dll \
- libpng12.dll \
- libxml2.dll \
- zlib1.dll
-
-NAVIT_EXES_GTK = navit_gtk.exe osm2navit.exe
-NAVIT_EXES_W32 = navit_win32.exe osm2navit.exe
-
-
-SAMPLE_MAP=osm_bbox_11.3,47.9,11.7,48.2
-
-maps_DATA = $(SAMPLE_MAP).bin
-
-samplemap: $(SAMPLE_MAP).bin
-
-$(SAMPLE_MAP).osm.bz2:
- echo "Downloading osm sample map"
- wget -O $(SAMPLE_MAP).osm.bz2.tmp http://navit.sourceforge.net/maps/$(SAMPLE_MAP).osm.bz2
- mv $(SAMPLE_MAP).osm.bz2.tmp $(SAMPLE_MAP).osm.bz2
-
-$(SAMPLE_MAP).bin: $(SAMPLE_MAP).osm.bz2 ./bin/release/osm2navit.exe
- echo "Converting osm sample map"
- cp $(SAMPLE_MAP).osm.bz2 tmp.osm.bz2 ;
- bunzip2 tmp.osm.bz2;
- cat tmp.osm | ./bin/release/osm2navit.exe --attr-debug-level=5 $(SAMPLE_MAP).bin.tmp ;
- mv $(SAMPLE_MAP).bin.tmp $(SAMPLE_MAP).bin ;
- rm tmp.osm ;
-
-POFILES = cs.mo es.mo fr.mo nl.mo pl.mo de.mo fi.mo it.mo no.mo
-
-MSGFMT=msgfmt.exe
-
-%.mo:../../po/%.po
- $(MSGFMT) --check --verbose --statistics --output-file=$@ $< && \
- mkdir -p ./locale/$(basename $@)/LC_MESSAGES && \
- mv $@ ./locale/$(basename $@)/LC_MESSAGES/navit.mo
-
-
-locale: $(POFILES)
-locale_clean:
- rm -Rf locale
-
-distr_gtk: $(SAMPLE_MAP).bin $(POFILES)
- rm -Rf $(DISTR_TARGET_PATH);
- mkdir -p $(DST_BIN_PATH);
- mkdir -p $(DST_ETC_PATH);
- mkdir -p $(DST_LIB_PATH);
- for i in $(NAVIT_EXES_GTK); do \
- cp $(SRC_NAVIT_EXE_PATH)/$$i $(DST_BIN_PATH)/$$i; \
- done;
- for i in $(GTK_DLLS); do \
- cp $(SRC_GTK_BIN_PATH)/$$i $(DST_BIN_PATH)/$$i; \
- done;
- cp -r $(SRC_GTK_ETC_PATH)/* $(DST_ETC_PATH) ;
- mkdir -p $(DST_LIB_PATH)/gtk-2.0/2.10.0 ;
- cp -r $(SRC_GTK_LIB_PATH)/gtk-2.0/2.10.0/* $(DST_LIB_PATH)/gtk-2.0/2.10.0 ;
- mkdir -p $(DST_LIB_PATH)/pango ;
- cp -r $(SRC_GTK_LIB_PATH)/pango/* $(DST_LIB_PATH)/pango ;
- cp ./navit.xml.distr $(DST_BIN_PATH)/navit.xml ;
- cp ./*.ttf $(DST_BIN_PATH)/ ;
- mkdir -p $(DST_MAP_PATH) ;
- cp $(SAMPLE_MAP).bin $(DST_MAP_PATH)/ ;
- mkdir -p $(DST_XPM_PATH) ;
- cp -r $(SRC_XPM_PATH)/*.xpm $(DST_XPM_PATH)/ ;
- mkdir -p $(DST_MO_PATH) ;
- cp -r $(SRC_MO_PATH)/* $(DST_MO_PATH)/
-
-distr_win32: $(SAMPLE_MAP).bin $(POFILES)
- rm -Rf $(DISTR_TARGET_PATH);
- mkdir -p $(DST_BIN_PATH);
- mkdir -p $(DST_ETC_PATH);
- mkdir -p $(DST_LIB_PATH);
- for i in $(NAVIT_EXES); do \
- cp $(SRC_NAVIT_EXE_W32_PATH)/$$i $(DST_BIN_PATH)/$$i; \
- done;
- for i in $(WIN32_DLLS); do \
- cp $(SRC_GTK_BIN_PATH)/$$i $(DST_BIN_PATH)/$$i; \
- done;
- cp -r $(SRC_GTK_ETC_PATH)/* $(DST_ETC_PATH) ;
- mkdir -p $(DST_LIB_PATH)/gtk-2.0/2.10.0 ;
- cp -r $(SRC_GTK_LIB_PATH)/gtk-2.0/2.10.0/* $(DST_LIB_PATH)/gtk-2.0/2.10.0 ;
- mkdir -p $(DST_LIB_PATH)/pango ;
- cp -r $(SRC_GTK_LIB_PATH)/pango/* $(DST_LIB_PATH)/pango ;
- cp ./navit.xml.distr $(DST_BIN_PATH)/navit.xml ;
- cp ./*.ttf $(DST_BIN_PATH)/ ;
- mkdir -p $(DST_MAP_PATH) ;
- cp $(SAMPLE_MAP).bin $(DST_MAP_PATH)/ ;
- mkdir -p $(DST_XPM_PATH) ;
- cp -r $(SRC_XPM_PATH)/*.xpm $(DST_XPM_PATH)/ ;
- mkdir -p $(DST_MO_PATH) ;
- cp -r $(SRC_MO_PATH)/* $(DST_MO_PATH)/
diff --git a/projs/CodeBlocks/makefile_langfiles b/projs/CodeBlocks/makefile_langfiles
deleted file mode 100644
index bdbc6148..00000000
--- a/projs/CodeBlocks/makefile_langfiles
+++ /dev/null
@@ -1,19 +0,0 @@
-POFILES = cs.mo es.mo fr.mo nl.mo pl.mo de.mo fi.mo it.mo no.mo
-
-MSGFMT=msgfmt.exe
-
-%.mo:../../po/%.po
- $(MSGFMT) --check --verbose --statistics --output-file=$@ $< && \
- mkdir -p ./locale/$(basename $@)/LC_MESSAGES && \
- mv $@ ./locale/$(basename $@)/LC_MESSAGES/navit.mo
-
-.PHONY: all clean
-
-# nl.po: ..\..\nl.mo
-
-all: $(POFILES)
-
-clean:
- rm -rf locale/*
-
-
diff --git a/projs/CodeBlocks/mdb.cbp b/projs/CodeBlocks/mdb.cbp
deleted file mode 100644
index 548c2919..00000000
--- a/projs/CodeBlocks/mdb.cbp
+++ /dev/null
@@ -1,118 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="mdb" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libmdb.a" prefix_auto="0" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output="obj\mdb\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- <Add option="-I." />
- </Compiler>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libmdb.a" prefix_auto="0" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output="obj\mdb\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- </Linker>
- </Target>
- <Target title="DebugCeGcc">
- <Option output=".\bin\DebugCeGcc\libmdb.a" prefix_auto="0" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output="obj\DebugCeGcc\" />
- <Option type="2" />
- <Option compiler="cegcc_compiler" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- <Add option="-I." />
- </Compiler>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add directory="..\..\navit\data\poi_geodownload\libmdb\include" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- </Compiler>
- <Unit filename="..\..\navit\data\poi_geodownload\libmdb\backend.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\poi_geodownload\libmdb\catalog.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\poi_geodownload\libmdb\data.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\poi_geodownload\libmdb\dump.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\poi_geodownload\libmdb\file.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\poi_geodownload\libmdb\iconv.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\poi_geodownload\libmdb\index.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\poi_geodownload\libmdb\kkd.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\poi_geodownload\libmdb\like.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\poi_geodownload\libmdb\map.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\poi_geodownload\libmdb\mem.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\poi_geodownload\libmdb\money.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\poi_geodownload\libmdb\options.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\poi_geodownload\libmdb\props.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\poi_geodownload\libmdb\sargs.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\poi_geodownload\libmdb\stats.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\poi_geodownload\libmdb\table.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\poi_geodownload\libmdb\worktable.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\poi_geodownload\libmdb\write.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/navit.xml.distr b/projs/CodeBlocks/navit.xml.distr
deleted file mode 100644
index 0c22a500..00000000
--- a/projs/CodeBlocks/navit.xml.distr
+++ /dev/null
@@ -1,1006 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE navit SYSTEM "navit.dtd">
-<config>
-<plugins>
- <plugin path="$NAVIT_LIBDIR/*/${NAVIT_LIBPREFIX}lib*.so"/>
- <plugin path="$NAVIT_LIBDIR/*/${NAVIT_LIBPREFIX}libgraphics_null.so" active="no" />
-</plugins>
-<debug name="navit:do_draw" level="0" />
-<!--
-Center coordinates format:
-[D][D]DMM.ss[S][S]... N/S [D][D]DMM.ss[S][S]... E/W
-[-][D]D.d[d]... [-][D][D]D.d[d]...
-[-]0xX [-]0xX
-Change to your home coordinates.
--->
-<navit center="4808 N 1134 E" zoom="256" tracking="1" cursor="1" orientation="0">
- <gui type="gtk" />
- <graphics type="gtk_drawing_area" />
-<!-- For SDL, use rather the following lines
- <gui type="sdl" />
- <graphics type="opengl" />
--->
-<!-- <vehicle name="Com4" enabled="yes" active="1" source="file:COM4 baud=115200 parity=N data=8 stop=1" color="#0000ff"/> -->
- <vehicle name="Demo" enabled="yes" active="1" source="demo" color="#0000ff"/>
-
- <!-- <vehicle name="Meins" enabled="yes" source="gpsd://localhost" color="#0000ff"/> -->
- <!-- For SDL, you should add follow="1" refresh="1" to have the view centered on your position
- <vehicle name="Meins" enabled="yes" source="gpsd://localhost" color="#0000ff" follow="1" refresh="1"/>
- -->
-
- <vehicle name="Deins" enabled="no" source="gpsd://somehost" color="#0000aa"/>
- <tracking>
- </tracking>
- <route>
- <speed type="street_0,street_1_city" value="10" />
- <speed type="street_2_city" value="30" />
- <speed type="street_3_city" value="40" />
- <speed type="street_4_city" value="50" />
- <speed type="highway_city" value="80" />
- <speed type="street_1_land" value="60" />
- <speed type="street_2_land" value="65" />
- <speed type="street_3_land" value="70" />
- <speed type="street_4_land" value="80" />
- <speed type="street_n_lanes" value="120" />
- <speed type="highway_land" value="120" />
- <speed type="ramp" value="40" />
- <speed type="ferry" value="40" />
- </route>
- <navigation>
- <announce type="street_0,street_1_city" level0="10" level1="100" level2="200" unit="m" />
- <announce type="street_2_city,street_3_city,street_4_city,ramp" level0="20" level1="200" level2="500" unit="m" />
- <announce type="highway_city,street_1_land,street_2_land,street_3_land,street_4_land" level0="40" level1="400" level2="1000" unit="m" />
- <announce type="street_n_lanes,highway_land" level0="100" level1="1000" level2="2000" unit="m" />
-
- </navigation>
- <speech type="speech_dispatcher" data="echo 'Fix the speech tag in navit.xml to let navit say:' '%s'" />
-<!-- If you have the reiseplaner maps installed, set enabled="yes" in the next line -->
- <mapset enabled="no">
- <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map" />
- <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp1.smp" />
- <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp2.smp" />
- <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp3.smp" />
- <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp4.smp" />
- <map type="mg" enabled="yes" data="/opt/reiseplaner/travel/DE.map/smp5.smp" />
- </mapset>
-<!-- If you dont want to use the sample map, set enabled="no" in the next line -->
- <mapset enabled="yes">
- <map type="binfile" enabled="yes" data="../maps/osm_bbox_11.3,47.9,11.7,48.2.bin"/>
- </mapset>
-<!-- Sample mapset for garmin maps -->
- <mapset enabled="no">
- <map type="garmin" enabled="yes" data="/path/to/img" debug="4"/>
- </mapset>
-
- <layout name="Tag">
- <layer name="sea" details="0">
- <item type="poly_wood" order="0-">
- <polygon color="#8ec78d" />
- </item>
- <item type="poly_town" order="0-">
- <polygon color="#ffc895" />
- <polyline color="#ebb481" />
- </item>
- <item type="poly_water" order="0-">
- <polygon color="#82c8ea" />
- <polyline color="#5096b8" />
- <label label_size="5" />
- </item>
- <item type="poly_park" order="0-">
- <polygon color="#7cc334" />
- <label label_size="5" />
- </item>
- <item type="poly_airport" order="0-">
- <polygon color="#a0a0a0" />
- </item>
- <item type="poly_sport" order="0-">
- <polygon color="#4af04f" />
- </item>
- <item type="poly_industry,poly_place" order="0-">
- <polygon color="#e6e6e6" />
- </item>
- <item type="poly_building" order="0-">
- <polygon color="#b6a6a6" />
- </item>
- <item type="water_line" order="0-">
- <polyline color="#5096b8" width="1" />
- <label label_size="5" />
- </item>
- <item type="poly_apron" order="0-">
- <polygon color="#d0d0d0" />
- </item>
- <item type="poly_terminal" order="7-">
- <polygon color="#e3c6a6" />
- </item>
- <item type="poly_cemetery" order="1-">
- <polygon color="#bde3cb" />
- </item>
- <item type="poly_car_parking" order="1-">
- <polygon color="#e7cf87" />
- </item>
- <item type="rail" order="6-">
- <polyline color="#808080" width="3" />
- </item>
- <item type="ferry" order="5-">
- <polyline color="#000000" width="1" />
- </item>
- <item type="border_country" order="0-">
- <polyline color="#b8434e" width="1" />
- </item>
- <item type="border_state" order="0-">
- <polyline color="#808080" width="1" />
- </item>
- <item type="height_line_1" order="0-">
- <polyline color="#000000" width="1" />
- </item>
- <item type="height_line_2" order="0-">
- <polyline color="#000000" width="2" />
- </item>
- <item type="street_route" order="2">
- <polyline color="#0000a0" width="4" />
- </item>
- <item type="street_route" order="3-5">
- <polyline color="#0000a0" width="8" />
- </item>
- <item type="street_route" order="6">
- <polyline color="#0000a0" width="10" />
- </item>
- <item type="street_route" order="7-8">
- <polyline color="#0000a0" width="16" />
- </item>
- <item type="street_route" order="9-10">
- <polyline color="#0000a0" width="20" />
- </item>
- <item type="street_route" order="11">
- <polyline color="#0000a0" width="28" />
- </item>
- <item type="street_route" order="12">
- <polyline color="#0000a0" width="32" />
- </item>
- <item type="street_route" order="13">
- <polyline color="#0000a0" width="52" />
- </item>
- <item type="street_route" order="14">
- <polyline color="#0000a0" width="64" />
- </item>
- <item type="street_route" order="15">
- <polyline color="#0000a0" width="68" />
- </item>
- <item type="street_route" order="16">
- <polyline color="#0000a0" width="132" />
- </item>
- <item type="street_route" order="17">
- <polyline color="#0000a0" width="268" />
- </item>
- <item type="street_route" order="18">
- <polyline color="#0000a0" width="530" />
- </item>
- <item type="street_nopass" order="10-">
- <polyline color="#000000" width="1" />
- </item>
- <item type="street_pedestrian" order="10">
- <polyline color="#d2d2d2" width="3" />
- <polyline color="#dddddd" width="1" />
- </item>
- <item type="street_pedestrian" order="11">
- <polyline color="#d2d2d2" width="5" />
- <polyline color="#dddddd" width="3" />
- </item>
- <item type="street_pedestrian" order="12">
- <polyline color="#d2d2d2" width="8" />
- <polyline color="#dddddd" width="6" />
- </item>
- <item type="street_pedestrian" order="13">
- <polyline color="#d2d2d2" width="9" />
- <polyline color="#dddddd" width="7" />
- </item>
- <item type="street_pedestrian" order="14">
- <polyline color="#d2d2d2" width="13" />
- <polyline color="#dddddd" width="9" />
- </item>
- <item type="street_pedestrian" order="15">
- <polyline color="#d2d2d2" width="18" />
- <polyline color="#dddddd" width="14" />
- </item>
- <item type="street_pedestrian" order="16">
- <polyline color="#d2d2d2" width="21" />
- <polyline color="#dddddd" width="17" />
- </item>
- <item type="street_pedestrian" order="17">
- <polyline color="#d2d2d2" width="25" />
- <polyline color="#dddddd" width="21" />
- </item>
- <item type="street_pedestrian" order="18">
- <polyline color="#d2d2d2" width="40" />
- <polyline color="#dddddd" width="34" />
- </item>
- <item type="street_service" order="11">
- <polyline color="#d2d2d2" width="4" />
- <polyline color="#fefefe" width="2" />
- </item>
- <item type="street_service" order="12">
- <polyline color="#d2d2d2" width="5" />
- <polyline color="#fefefe" width="3" />
- </item>
- <item type="street_service" order="13">
- <polyline color="#d2d2d2" width="6" />
- <polyline color="#fefefe" width="4" />
- </item>
- <item type="street_service" order="14">
- <polyline color="#d2d2d2" width="7" />
- <polyline color="#fefefe" width="5" />
- </item>
- <item type="street_service" order="15">
- <polyline color="#d2d2d2" width="8" />
- <polyline color="#fefefe" width="6" />
- </item>
- <item type="street_service" order="16">
- <polyline color="#d2d2d2" width="9" />
- <polyline color="#fefefe" width="7" />
- </item>
- <item type="street_service" order="17">
- <polyline color="#d2d2d2" width="10" />
- <polyline color="#fefefe" width="8" />
- </item>
- <item type="street_service" order="18">
- <polyline color="#d2d2d2" width="11" />
- <polyline color="#fefefe" width="9" />
- </item>
-
- <item type="street_0,street_1_city,street_1_land" order="10">
- <polyline color="#d2d2d2" width="4" />
- <polyline color="#ffffff" width="2" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="11">
- <polyline color="#d2d2d2" width="6" />
- <polyline color="#ffffff" width="4" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="12">
- <polyline color="#d2d2d2" width="10" />
- <polyline color="#ffffff" width="8" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="13">
- <polyline color="#d2d2d2" width="12" />
- <polyline color="#ffffff" width="9" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="14">
- <polyline color="#d2d2d2" width="15" />
- <polyline color="#ffffff" width="13" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="15">
- <polyline color="#d2d2d2" width="17" />
- <polyline color="#ffffff" width="14" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="16">
- <polyline color="#d2d2d2" width="33" />
- <polyline color="#ffffff" width="26" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="17">
- <polyline color="#d2d2d2" width="69" />
- <polyline color="#ffffff" width="61" />
- </item>
- <item type="street_0,street_1_city,street_1_land" order="18">
- <polyline color="#d2d2d2" width="132" />
- <polyline color="#ffffff" width="126" />
- </item>
- <item type="street_2_city,street_2_land" order="7-8">
- <polyline color="#c0c0c0" width="2" />
- </item>
- <item type="street_2_city,street_2_land" order="9">
- <polyline color="#c0c0c0" width="4" />
- <polyline color="#ffff00" width="2" />
- </item>
- <item type="street_2_city,street_2_land" order="10">
- <polyline color="#c0c0c0" width="6" />
- <polyline color="#ffff00" width="4" />
- </item>
- <item type="street_2_city,street_2_land" order="11">
- <polyline color="#c0c0c0" width="8" />
- <polyline color="#ffff00" width="6" />
- </item>
- <item type="street_2_city,street_2_land" order="12">
- <polyline color="#c0c0c0" width="12" />
- <polyline color="#ffff00" width="9" />
- </item>
- <item type="street_2_city,street_2_land" order="13">
- <polyline color="#c0c0c0" width="15" />
- <polyline color="#ffff00" width="11" />
- </item>
- <item type="street_2_city,street_2_land" order="14">
- <polyline color="#c0c0c0" width="18" />
- <polyline color="#ffff00" width="14" />
- </item>
- <item type="street_2_city,street_2_land" order="15">
- <polyline color="#c0c0c0" width="21" />
- <polyline color="#ffff00" width="17" />
- </item>
- <item type="street_2_city,street_2_land" order="16">
- <polyline color="#c0c0c0" width="35" />
- <polyline color="#ffff00" width="30" />
- </item>
- <item type="street_2_city,street_2_land" order="17">
- <polyline color="#c0c0c0" width="73" />
- <polyline color="#ffff00" width="67" />
- </item>
- <item type="street_2_city,street_2_land" order="18">
- <polyline color="#c0c0c0" width="144" />
- <polyline color="#ffff00" width="138" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="7-8">
- <polyline color="#a0a0a0" width="3" />
- <polyline color="#ffff00" width="1" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="9">
- <polyline color="#a0a0a0" width="5" />
- <polyline color="#ffff00" width="3" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="10">
- <polyline color="#a0a0a0" width="8" />
- <polyline color="#ffff00" width="6" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="11">
- <polyline color="#a0a0a0" width="9" />
- <polyline color="#ffff00" width="7" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="12">
- <polyline color="#a0a0a0" width="13" />
- <polyline color="#ffff00" width="9" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="13">
- <polyline color="#a0a0a0" width="18" />
- <polyline color="#ffff00" width="14" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="14">
- <polyline color="#a0a0a0" width="21" />
- <polyline color="#ffff00" width="17" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="15">
- <polyline color="#a0a0a0" width="25" />
- <polyline color="#ffff00" width="21" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="16">
- <polyline color="#a0a0a0" width="40" />
- <polyline color="#ffff00" width="34" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="17">
- <polyline color="#a0a0a0" width="79" />
- <polyline color="#ffff00" width="73" />
- </item>
- <item type="street_3_city,street_3_land,ramp" order="18">
- <polyline color="#a0a0a0" width="156" />
- <polyline color="#ffff00" width="150" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="2-6">
- <polyline color="#404040" width="1" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="7-8">
- <polyline color="#404040" width="3" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="9">
- <polyline color="#000000" width="5" />
- <polyline color="#ff0000" width="3" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="10">
- <polyline color="#000000" width="6" />
- <polyline color="#ff0000" width="4" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="11">
- <polyline color="#000000" width="9" />
- <polyline color="#ff0000" width="7" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="12">
- <polyline color="#000000" width="13" />
- <polyline color="#ff0000" width="9" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="13">
- <polyline color="#000000" width="18" />
- <polyline color="#ff0000" width="14" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="14">
- <polyline color="#000000" width="21" />
- <polyline color="#ff0000" width="17" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="15">
- <polyline color="#000000" width="24" />
- <polyline color="#ff0000" width="20" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="16">
- <polyline color="#000000" width="39" />
- <polyline color="#ff0000" width="33" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="17">
- <polyline color="#000000" width="78" />
- <polyline color="#ff0000" width="72" />
- </item>
- <item type="street_4_city,street_4_land,street_n_lanes" order="18">
- <polyline color="#000000" width="156" />
- <polyline color="#ff0000" width="150" />
- </item>
- <item type="highway_city,highway_land" order="2">
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="3-5">
- <polyline color="#ff0000" width="3" />
- <polyline color="#ffff00" width="1" />
- </item>
- <item type="highway_city,highway_land" order="6">
- <polyline color="#ff0000" width="4" />
- <polyline color="#ffff00" width="2" />
- </item>
- <item type="highway_city,highway_land" order="7-8">
- <polyline color="#ff0000" width="7" />
- <polyline color="#ffff00" width="5" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="9-10">
- <polyline color="#ff0000" width="9" />
- <polyline color="#ffff00" width="5" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="11">
- <polyline color="#ff0000" width="13" />
- <polyline color="#ffff00" width="9" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="12">
- <polyline color="#ff0000" width="15" />
- <polyline color="#ffff00" width="10" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="13">
- <polyline color="#ff0000" width="25" />
- <polyline color="#ffff00" width="17" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="14">
- <polyline color="#ff0000" width="31" />
- <polyline color="#ffff00" width="24" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="15">
- <polyline color="#ff0000" width="33" />
- <polyline color="#ffff00" width="27" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="16">
- <polyline color="#ff0000" width="65" />
- <polyline color="#ffff00" width="59" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="17">
- <polyline color="#ff0000" width="133" />
- <polyline color="#ffff00" width="127" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="highway_city,highway_land" order="18">
- <polyline color="#ff0000" width="264" />
- <polyline color="#ffff00" width="258" />
- <polyline color="#ff0000" width="1" />
- </item>
- <item type="street_unkn" order="0-">
- <polyline color="#8080ff" width="3" />
- </item>
- <item type="highway_exit_label" order="10-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="highway_city,highway_land,street_4_city,street_4_land,street_n_lanes" order="10-18">
- <label label_size="8" />
- </item>
- <item type="street_2_city,street_2_land,street_3_city,street_3_land,ramp" order="11-18">
- <label label_size="9" />
- </item>
- <item type="street_nopass,street_0,street_1_city,street_1_land" order="12-18">
- <label label_size="9" />
- </item>
- <item type="aeroway_taxiway" order="10">
- <polyline color="#989994" width="4" />
- <polyline color="#d3dbbc" width="2" />
- </item>
- <item type="aeroway_taxiway" order="11">
- <polyline color="#989994" width="6" />
- <polyline color="#d3dbbc" width="4" />
- </item>
- <item type="aeroway_taxiway" order="12">
- <polyline color="#989994" width="10" />
- <polyline color="#d3dbbc" width="8" />
- </item>
- <item type="aeroway_taxiway" order="13">
- <polyline color="#989994" width="12" />
- <polyline color="#d3dbbc" width="9" />
- </item>
- <item type="aeroway_taxiway" order="14">
- <polyline color="#989994" width="15" />
- <polyline color="#d3dbbc" width="13" />
- </item>
- <item type="aeroway_taxiway" order="15">
- <polyline color="#989994" width="17" />
- <polyline color="#d3dbbc" width="14" />
- </item>
- <item type="aeroway_taxiway" order="16">
- <polyline color="#989994" width="33" />
- <polyline color="#d3dbbc" width="26" />
- </item>
- <item type="aeroway_taxiway" order="17">
- <polyline color="#989994" width="69" />
- <polyline color="#d3dbbc" width="61" />
- </item>
- <item type="aeroway_taxiway" order="18">
- <polyline color="#989994" width="132" />
- <polyline color="#d3dbbc" width="126" />
- </item>
- <item type="aeroway_runway" order="2-6">
- <polyline color="#404040" width="1" />
- </item>
- <item type="aeroway_runway" order="7-8">
- <polyline color="#404040" width="3" />
- <polyline color="#d3dbbc" width="1" />
- </item>
- <item type="aeroway_runway" order="9">
- <polyline color="#6b6f5f" width="5" />
- <polyline color="#d3dbbc" width="3" />
- </item>
- <item type="aeroway_runway" order="10">
- <polyline color="#6b6f5f" width="6" />
- <polyline color="#d3dbbc" width="4" />
- </item>
- <item type="aeroway_runway" order="11">
- <polyline color="#6b6f5f" width="9" />
- <polyline color="#d3dbbc" width="7" />
- </item>
- <item type="aeroway_runway" order="12">
- <polyline color="#6b6f5f" width="13" />
- <polyline color="#d3dbbc" width="9" />
- </item>
- <item type="aeroway_runway" order="13">
- <polyline color="#6b6f5f" width="18" />
- <polyline color="#d3dbbc" width="14" />
- </item>
- <item type="aeroway_runway" order="14">
- <polyline color="#6b6f5f" width="21" />
- <polyline color="#d3dbbc" width="17" />
- </item>
- <item type="aeroway_runway" order="15">
- <polyline color="#6b6f5f" width="24" />
- <polyline color="#d3dbbc" width="20" />
- </item>
- <item type="aeroway_runway" order="16">
- <polyline color="#6b6f5f" width="39" />
- <polyline color="#d3dbbc" width="33" />
- </item>
- <item type="aeroway_runway" order="17">
- <polyline color="#6b6f5f" width="78" />
- <polyline color="#d3dbbc" width="72" />
- </item>
- <item type="aeroway_runway" order="18">
- <polyline color="#6b6f5f" width="156" />
- <polyline color="#d3dbbc" width="150" />
- </item>
- <item type="town_label,district_label,town_label_0e0,town_label_1e0,town_label_2e0,town_label_5e0,town_label_1e1,town_label_2e1,town_label_5e1,town_label_1e2,town_label_2e2,town_label_5e2,district_label_0e0,district_label_1e0,district_label_2e0,district_label_5e0,district_label_1e1,district_label_2e1,district_label_5e1,district_label_1e2,district_label_2e2,district_label_5e2" order="12-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="district_label_1e3,district_label_2e3,district_label_5e3" order="11-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="town_label_1e3,town_label_2e3,town_label_5e3" order="10-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="district_label_1e4,district_label_2e4,district_label_5e4" order="9-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="town_label_1e4,town_label_2e4,town_label_5e4" order="8-">
- <circle color="#000000" radius="3" label_size="7" />
- </item>
- <item type="district_label_1e5,district_label_2e5,district_label_5e5" order="6-">
- <circle color="#000000" radius="3" label_size="10" />
- </item>
- <item type="town_label_1e5,town_label_2e5,town_label_5e5" order="4-">
- <circle color="#000000" radius="3" label_size="10" />
- </item>
- <item type="district_label_1e6,district_label_2e6,district_label_5e6" order="3-">
- <circle color="#000000" radius="3" label_size="15" />
- </item>
- <item type="town_label_1e6,town_label_2e6,town_label_5e6" order="2-">
- <circle color="#000000" radius="3" label_size="15" />
- </item>
- <item type="town_label_1e7,district_label_1e7" order="1-">
- <circle color="#000000" radius="3" label_size="15" />
- </item>
- <item type="track" order="3-">
- <polyline color="#3f3f3f" width="1" />
- </item>
-
- <item type="poi_airport" order="5-">
- <icon src="airport.xpm" />
- </item>
- <item type="town_ghost" order="0-">
- <icon src="ghost_town.xpm" />
- </item>
- <item type="poi_hotel" order="12-">
- <icon src="hotel.xpm" />
- </item>
- <item type="poi_car_parking" order="11-">
- <icon src="parking.xpm" />
- </item>
- <item type="poi_car_dealer_parts" order="0-">
- <icon src="car_dealer.xpm" />
- </item>
- <item type="poi_fuel" order="10-">
- <icon src="fuel.xpm" />
- </item>
- <item type="poi_shopping" order="0-">
- <icon src="shopping.xpm" />
- </item>
- <item type="poi_attraction" order="5-">
- <icon src="attraction.xpm" />
- </item>
- <item type="poi_cafe" order="12-">
- <icon src="cafe.xpm" />
- </item>
- <item type="poi_bar" order="12-">
- <icon src="bar.xpm" />
- </item>
- <item type="poi_bridge" order="0-">
- <icon src="bridge.xpm" />
- </item>
- <item type="highway_exit" order="11-">
- <icon src="exit.xpm" />
- </item>
- <item type="poi_camp_rv" order="9-">
- <icon src="camping.xpm" />
- </item>
- <item type="poi_museum_history" order="12-">
- <icon src="museum.xpm" />
- </item>
- <item type="poi_hospital" order="12-">
- <icon src="hospital.xpm" />
- </item>
- <item type="point_unkn" order="0-">
- <circle color="#8080ff" radius="3" />
- </item>
- <item type="poi_dining" order="12-">
- <icon src="dining.xpm" />
- </item>
- <item type="poi_fastfood" order="12-">
- <icon src="fastfood.xpm" />
- </item>
- <item type="poi_police" order="12-">
- <icon src="police.xpm" />
- </item>
- <item type="poi_auto_club" order="0-">
- <icon src="auto_club.xpm" />
- </item>
- <item type="poi_autoservice" order="0-">
- <icon src="autoservice.xpm" />
- </item>
- <item type="poi_bank" order="12-">
- <icon src="bank.xpm" />
- </item>
- <item type="poi_bay" order="0-">
- <icon src="bay.xpm" />
- </item>
- <item type="poi_bend" order="0-">
- <icon src="bend.xpm" />
- </item>
- <item type="poi_boat_ramp" order="0-">
- <icon src="boat_ramp.xpm" />
- </item>
- <item type="poi_border_station" order="0-">
- <icon src="border_station.xpm" />
- </item>
- <item type="poi_bowling" order="0-">
- <icon src="bowling.xpm" />
- </item>
- <item type="poi_bus_station" order="12-">
- <icon src="bus.xpm" />
- </item>
- <item type="poi_bus_stop" order="12-">
- <icon src="bus.xpm" />
- </item>
- <item type="poi_bussines_service" order="0-">
- <icon src="bussines_service.xpm" />
- </item>
- <item type="poi_car_rent" order="0-">
- <icon src="car_rent.xpm" />
- </item>
- <item type="poi_car_wash" order="0-">
- <icon src="car_wash.xpm" />
- </item>
- <item type="poi_casino" order="0-">
- <icon src="casino.xpm" />
- </item>
- <item type="poi_cemetery" order="0-">
- <icon src="cemetery.xpm" />
- </item>
- <item type="poi_church" order="11-">
- <icon src="church.xpm" />
- </item>
- <item type="poi_cinema" order="12-">
- <icon src="cinema.xpm" />
- </item>
- <item type="poi_civil" order="0-">
- <icon src="civil.xpm" />
- </item>
- <item type="poi_communication" order="0-">
- <icon src="communication.xpm" />
- </item>
- <item type="poi_concert" order="0-">
- <icon src="concert.xpm" />
- </item>
- <item type="poi_cove" order="0-">
- <icon src="cove.xpm" />
- </item>
- <item type="poi_crossing" order="0-">
- <icon src="crossing.xpm" />
- </item>
- <item type="poi_dam" order="0-">
- <icon src="dam.xpm" />
- </item>
- <item type="poi_danger_area" order="0-">
- <icon src="danger_area.xpm" />
- </item>
- <item type="poi_dangerous" order="0-">
- <icon src="dangerous.xpm" />
- </item>
- <item type="poi_daymark" order="0-">
- <icon src="daymark.xpm" />
- </item>
- <item type="poi_diving" order="0-">
- <icon src="diving.xpm" />
- </item>
- <item type="poi_drinking_water" order="0-">
- <icon src="drinking_water.xpm" />
- </item>
- <item type="poi_emergency" order="0-">
- <icon src="emergency.xpm" />
- </item>
- <item type="poi_fair" order="0-">
- <icon src="fair.xpm" />
- </item>
- <item type="poi_firebrigade" order="12-">
- <icon src="firebrigade.xpm" />
- </item>
- <item type="poi_fish" order="0-">
- <icon src="fish.xpm" />
- </item>
- <item type="poi_forbiden_area" order="0-">
- <icon src="forbiden_area.xpm" />
- </item>
- <item type="poi_garmin" order="0-">
- <icon src="garmin.xpm" />
- </item>
- <item type="poi_golf" order="12-">
- <icon src="golf.xpm" />
- </item>
- <item type="poi_goverment_building" order="0-">
- <icon src="goverment_building.xpm" />
- </item>
- <item type="poi_height" order="0-">
- <icon src="height.xpm" />
- </item>
- <item type="poi_heliport" order="0-">
- <icon src="heliport.xpm" />
- </item>
- <item type="poi_hotspring" order="0-">
- <icon src="hotspring.xpm" />
- </item>
- <item type="poi_icesport" order="0-">
- <icon src="icesport.xpm" />
- </item>
- <item type="poi_information" order="12-">
- <icon src="information.xpm" />
- </item>
- <item type="poi_justice" order="0-">
- <icon src="justice.xpm" />
- </item>
- <item type="poi_landmark" order="0-">
- <icon src="landmark.xpm" />
- </item>
- <item type="poi_levee" order="0-">
- <icon src="levee.xpm" />
- </item>
- <item type="poi_library" order="12-">
- <icon src="library.xpm" />
- </item>
- <item type="poi_locale" order="0-">
- <icon src="locale.xpm" />
- </item>
- <item type="poi_loudspeaker" order="0-">
- <icon src="loudspeaker.xpm" />
- </item>
- <item type="poi_mall" order="0-">
- <icon src="mall.xpm" />
- </item>
- <item type="poi_manmade_feature" order="0-">
- <icon src="manmade_feature.xpm" />
- </item>
- <item type="poi_marine" order="0-">
- <icon src="marine.xpm" />
- </item>
- <item type="poi_marine_type" order="0-">
- <icon src="marine_type.xpm" />
- </item>
- <item type="poi_mark" order="0-">
- <icon src="mark.xpm" />
- </item>
- <item type="poi_military" order="0-">
- <icon src="military.xpm" />
- </item>
- <item type="poi_mine" order="0-">
- <icon src="mine.xpm" />
- </item>
- <item type="poi_nondangerous" order="0-">
- <icon src="nondangerous.xpm" />
- </item>
- <item type="poi_oil_field" order="0-">
- <icon src="oil_field.xpm" />
- </item>
- <item type="poi_personal_service" order="0-">
- <icon src="personal_service.xpm" />
- </item>
- <item type="poi_pharmacy" order="12-">
- <icon src="pharmacy.xpm" />
- </item>
- <item type="poi_post" order="13-">
- <icon src="post.xpm" />
- </item>
- <item type="poi_public_office" order="0-">
- <icon src="public_office.xpm" />
- </item>
- <item type="poi_repair_service" order="0-">
- <icon src="repair_service.xpm" />
- </item>
- <item type="poi_resort" order="0-">
- <icon src="resort.xpm" />
- </item>
- <item type="poi_rest_room" order="13-">
- <icon src="rest_room.xpm" />
- </item>
- <item type="poi_restaurant" order="12-">
- <icon src="restaurant.xpm" />
- </item>
- <item type="poi_restricted_area" order="0-">
- <icon src="restricted_area.xpm" />
- </item>
- <item type="poi_restroom" order="13-">
- <icon src="restroom.xpm" />
- </item>
- <item type="poi_sailing" order="0-">
- <icon src="sailing.xpm" />
- </item>
- <item type="poi_scenic_area" order="0-">
- <icon src="scenic_area.xpm" />
- </item>
- <item type="poi_school" order="12-">
- <icon src="school.xpm" />
- </item>
- <item type="poi_service" order="0-">
- <icon src="service.xpm" />
- </item>
- <item type="poi_shop_apparel" order="0-">
- <icon src="shop_apparel.xpm" />
- </item>
- <item type="poi_shop_computer" order="0-">
- <icon src="shop_computer.xpm" />
- </item>
- <item type="poi_shop_department" order="0-">
- <icon src="shop_department.xpm" />
- </item>
- <item type="poi_shop_furnish" order="0-">
- <icon src="shop_furnish.xpm" />
- </item>
- <item type="poi_shop_grocery" order="0-">
- <icon src="shop_grocery.xpm" />
- </item>
- <item type="poi_shop_handg" order="0-">
- <icon src="shop_handg.xpm" />
- </item>
- <item type="poi_shop_merchandise" order="0-">
- <icon src="shop_merchandise.xpm" />
- </item>
- <item type="poi_shop_retail" order="0-">
- <icon src="shop_retail.xpm" />
- </item>
- <item type="poi_shower" order="0-">
- <icon src="shower.xpm" />
- </item>
- <item type="poi_skiing" order="12-">
- <icon src="skiing.xpm" />
- </item>
- <item type="poi_social_service" order="0-">
- <icon src="social_service.xpm" />
- </item>
- <item type="poi_sounding" order="0-">
- <icon src="sounding.xpm" />
- </item>
- <item type="poi_sport" order="0-">
- <icon src="sport.xpm" />
- </item>
- <item type="poi_stadium" order="0-">
- <icon src="stadium.xpm" />
- </item>
- <item type="poi_subdivision" order="0-">
- <icon src="subdivision.xpm" />
- </item>
- <item type="poi_swimming" order="12-">
- <icon src="swimming.xpm" />
- </item>
- <item type="poi_telephone" order="13-">
- <icon src="telephone.xpm" />
- </item>
- <item type="poi_theater" order="12-">
- <icon src="theater.xpm" />
- </item>
- <item type="poi_tide" order="0-">
- <icon src="tide.xpm" />
- </item>
- <item type="poi_tower" order="13-">
- <icon src="tower.xpm" />
- </item>
- <item type="poi_trail" order="0-">
- <icon src="trail.xpm" />
- </item>
- <item type="poi_truck_stop" order="0-">
- <icon src="truck_stop.xpm" />
- </item>
- <item type="poi_tunnel" order="0-">
- <icon src="tunnel.xpm" />
- </item>
- <item type="poi_wine" order="0-">
- <icon src="wine.xpm" />
- </item>
- <item type="poi_worship" order="0-">
- <icon src="worship.xpm" />
- </item>
- <item type="poi_wrecker" order="0-">
- <icon src="wrecker.xpm" />
- </item>
- <item type="poi_zoo" order="0-">
- <icon src="zoo.xpm" />
- </item>
- <item type="poi_picnic" order="11-">
- <icon src="picnic.xpm" />
- </item>
- <item type="poi_gc_multi" order="0-">
- <icon src="gc_multi.xpm" />
- </item>
- <item type="poi_gc_tradi" order="0-">
- <icon src="gc_tradi.xpm" />
- </item>
- <item type="poi_gc_event" order="0-">
- <icon src="gc_event.xpm" />
- </item>
- <item type="poi_gc_mystery" order="0-">
- <icon src="gc_mystery.xpm" />
- </item>
- <item type="poi_gc_question" order="0-">
- <icon src="gc_question.xpm" />
- </item>
- <item type="poi_gc_stages" order="0-">
- <icon src="gc_stages.xpm" />
- </item>
- <item type="poi_gc_reference" order="0-">
- <icon src="gc_reference.xpm" />
- </item>
- <item type="poi_gc_webcam" order="0-">
- <icon src="gc_webcam.xpm" />
- </item>
- <item type="traffic_signals" order="13-">
- <icon src="traffic_signals.xpm" />
- </item>
- <item type="poly_flats,poly_scrub,poly_military_zone,poly_marine,plantation,tundra" order="0-">
- <polygon color="#a0a0a0" />
- <label label_size="5" />
- </item>
- <item type="rg_segment" order="0-">
- <polyline color="#FF089C" width="1" />
- </item>
- <item type="rg_point" order="0-">
- <circle color="#FF089C" radius="10" label_size="7" />
- </item>
- </layer>
- </layout>
- <layout name="Nacht">
- </layout>
-</navit>
-</config>
diff --git a/projs/CodeBlocks/speech_speech_dispatcher.cbp b/projs/CodeBlocks/speech_speech_dispatcher.cbp
deleted file mode 100644
index 73ca13a1..00000000
--- a/projs/CodeBlocks/speech_speech_dispatcher.cbp
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="speech" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libspeech_speech_dispatcher.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libspeech_speech_dispatcher.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=speech_speech_dispatcher" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\navit" />
- <Add directory="." />
- <Add directory="Win32Extra\libgarmin" />
- <Add directory="k:\Sourcecode\libs\Microsoft Speech SDK 5.1\Include" />
- </Compiler>
- <Linker>
- <Add library="NavitCommonLib" />
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="Win32Extra\speech_dispatcher_win32.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="..\..\navit\data\garmin\garmin.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/vehicle_demo.cbp b/projs/CodeBlocks/vehicle_demo.cbp
deleted file mode 100644
index 52c17f77..00000000
--- a/projs/CodeBlocks/vehicle_demo.cbp
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="vehicle_demo" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libvehicle_demo.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libvehicle_demo.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- <Target title="DebugCeGcc">
- <Option output=".\bin\DebugCeGcc\libvehicle_demo.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\DebugCeGcc\" />
- <Option type="2" />
- <Option compiler="cegcc_compiler" />
- <Option createDefFile="1" />
- <Option projectIncludeDirsRelation="1" />
- <Compiler>
- <Add option="-g" />
- <Add directory="..\..\..\libs\gtk+-2.12.9-bundle-20080402\include\glib-2.0" />
- <Add directory="..\..\..\libs\gtk+-2.12.9-bundle-20080402\include" />
- <Add directory="..\..\..\libs\gtk+-2.12.9-bundle-20080402\lib\glib-2.0\include" />
- <Add directory="..\..\navit" />
- <Add directory="Win32Extra" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=vehicle_demo" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\navit" />
- </Compiler>
- <Linker>
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\navit\vehicle\demo\vehicle_demo.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/vehicle_file.cbp b/projs/CodeBlocks/vehicle_file.cbp
deleted file mode 100644
index 957fc60b..00000000
--- a/projs/CodeBlocks/vehicle_file.cbp
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="vehicle_file" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libvehicle_file.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Debug\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libvehicle_file.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\Release\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Release" />
- </Linker>
- </Target>
- <Target title="DebugCeGcc">
- <Option output=".\bin\DebugCeGcc\libvehicle_file.la" prefix_auto="1" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output=".\obj\DebugCeGcc\" />
- <Option type="2" />
- <Option compiler="cegcc_compiler" />
- <Option createDefFile="1" />
- <Option projectIncludeDirsRelation="1" />
- <Compiler>
- <Add option="-g" />
- <Add directory="..\..\..\libs\gtk+-2.12.9-bundle-20080402\include\glib-2.0" />
- <Add directory="..\..\..\libs\gtk+-2.12.9-bundle-20080402\include" />
- <Add directory="..\..\..\libs\gtk+-2.12.9-bundle-20080402\lib\glib-2.0\include" />
- <Add directory="..\..\navit" />
- <Add directory="Win32Extra" />
- </Compiler>
- <Linker>
- <Add directory="%GTK_DIR%\lib" />
- <Add directory="bin\Debug" />
- </Linker>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DBUILD_DLL" />
- <Add option="-DMODULE=vehicle_file" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="Win32Extra" />
- <Add directory="..\..\navit" />
- </Compiler>
- <Linker>
- <Add library="glib-2.0" />
- <Add library="user32" />
- <Add library="intl" />
- <Add library="iconv" />
- <Add directory="%GTK_DIR%\lib" />
- </Linker>
- <Unit filename="..\..\navit\vehicle\file\vehicle_file.c">
- <Option compilerVar="CC" />
- </Unit>
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/win32_gui.cbp b/projs/CodeBlocks/win32_gui.cbp
deleted file mode 100644
index 2f8b4beb..00000000
--- a/projs/CodeBlocks/win32_gui.cbp
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_project_file>
- <FileVersion major="1" minor="6" />
- <Project>
- <Option title="win32_gui" />
- <Option pch_mode="2" />
- <Option compiler="gcc" />
- <Build>
- <Target title="Debug">
- <Option output=".\bin\Debug\libwin32_gui.la" prefix_auto="0" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output="obj\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-g" />
- <Add option="-I." />
- </Compiler>
- </Target>
- <Target title="Release">
- <Option output=".\bin\Release\libwin32_gui.la" prefix_auto="0" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output="obj\" />
- <Option type="2" />
- <Option compiler="gcc" />
- <Option createDefFile="1" />
- <Compiler>
- <Add option="-O2" />
- </Compiler>
- <Linker>
- <Add option="-s" />
- </Linker>
- </Target>
- <Target title="DebugCeGcc">
- <Option output=".\bin\DebugCeGcc\libwin32_gui.la" prefix_auto="0" extension_auto="0" />
- <Option working_dir="" />
- <Option object_output="obj\DebugCeGcc\" />
- <Option type="2" />
- <Option compiler="cegcc_compiler" />
- <Option createDefFile="1" />
- <Option projectIncludeDirsRelation="1" />
- <Compiler>
- <Add option="-g" />
- <Add option="-I." />
- <Add directory="..\..\navit" />
- <Add directory="Win32Extra" />
- <Add directory="c:\MinGW\opt\cegcc\arm-wince-cegcc\include\glib-2.0\" />
- <Add directory="C:\MinGW\opt\cegcc\arm-wince-cegcc\lib\glib-2.0\include" />
- </Compiler>
- </Target>
- </Build>
- <Compiler>
- <Add option="-Wall" />
- <Add option="-mms-bitfields" />
- <Add option="-DMODULE=win32_gui" />
- <Add option="-D_WIN32_IE=0x400" />
- <Add directory="%GTK_DIR%\include\glib-2.0" />
- <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
- <Add directory="..\..\navit" />
- <Add directory="Win32Extra" />
- </Compiler>
- <Unit filename="win32gui\win32_graphics.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="win32gui\win32_gui.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="win32gui\win32_gui.h" />
- <Unit filename="win32gui\win32_gui_destination.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="win32gui\win32_gui_notify.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="win32gui\win32_gui_notify.h" />
- <Unit filename="win32gui\xpm2bmp.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="win32gui\xpm2bmp.h" />
- <Extensions>
- <code_completion />
- <envvars />
- <debugger />
- </Extensions>
- </Project>
-</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/win32gui/resources/navit.ico b/projs/CodeBlocks/win32gui/resources/navit.ico
deleted file mode 100644
index 6d7a952b..00000000
--- a/projs/CodeBlocks/win32gui/resources/navit.ico
+++ /dev/null
Binary files differ
diff --git a/projs/CodeBlocks/win32gui/resources/resource.h b/projs/CodeBlocks/win32gui/resources/resource.h
deleted file mode 100644
index 55bcc2d7..00000000
--- a/projs/CodeBlocks/win32gui/resources/resource.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <windows.h>
-
-#define IDI_NAVIT 1100
-#define IDB_NAVITTOOLBAR 1101
diff --git a/projs/CodeBlocks/win32gui/win32_graphics.c b/projs/CodeBlocks/win32gui/win32_graphics.c
deleted file mode 100644
index 254201c1..00000000
--- a/projs/CodeBlocks/win32gui/win32_graphics.c
+++ /dev/null
@@ -1,788 +0,0 @@
-#include <windows.h>
-#include <wchar.h>
-#include <wingdi.h>
-#include <glib.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#if defined(__CEGCC__)
-#include <libintl.h>
-#endif
-#include "config.h"
-#include "debug.h"
-#include "point.h"
-#include "graphics.h"
-#include "color.h"
-#include "plugin.h"
-#include "win32_gui.h"
-#include "xpm2bmp.h"
-#include "util.h"
-
-#ifndef GET_WHEEL_DELTA_WPARAM
- #define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam))
-#endif
-
-
-static GHashTable *image_cache_hash = NULL;
-
-
-HFONT EzCreateFont (HDC hdc, TCHAR * szFaceName, int iDeciPtHeight,
- int iDeciPtWidth, int iAttributes, BOOL fLogRes) ;
-
-#define EZ_ATTR_BOLD 1
-#define EZ_ATTR_ITALIC 2
-#define EZ_ATTR_UNDERLINE 4
-#define EZ_ATTR_STRIKEOUT 8
-
-HFONT EzCreateFont (HDC hdc, TCHAR * szFaceName, int iDeciPtHeight,
- int iDeciPtWidth, int iAttributes, BOOL fLogRes)
-{
- FLOAT cxDpi, cyDpi ;
- HFONT hFont ;
- LOGFONT lf ;
- POINT pt ;
- TEXTMETRIC tm ;
-
- SaveDC (hdc) ;
-
-#if !defined(__CEGCC__)
- SetGraphicsMode (hdc, GM_ADVANCED) ;
- ModifyWorldTransform (hdc, NULL, MWT_IDENTITY) ;
-#endif
- SetViewportOrgEx (hdc, 0, 0, NULL) ;
-#if !defined(__CEGCC__)
- SetWindowOrgEx (hdc, 0, 0, NULL) ;
-#endif
- if (fLogRes)
- {
- cxDpi = (FLOAT) GetDeviceCaps (hdc, LOGPIXELSX) ;
- cyDpi = (FLOAT) GetDeviceCaps (hdc, LOGPIXELSY) ;
- }
- else
- {
- cxDpi = (FLOAT) (25.4 * GetDeviceCaps (hdc, HORZRES) /
- GetDeviceCaps (hdc, HORZSIZE)) ;
-
- cyDpi = (FLOAT) (25.4 * GetDeviceCaps (hdc, VERTRES) /
- GetDeviceCaps (hdc, VERTSIZE)) ;
- }
-
- pt.x = (int) (iDeciPtWidth * cxDpi / 72) ;
- pt.y = (int) (iDeciPtHeight * cyDpi / 72) ;
-
-#if !defined(__CEGCC__)
- DPtoLP (hdc, &pt, 1) ;
-#endif
- lf.lfHeight = - (int) (fabs (pt.y) / 10.0 + 0.5) ;
- lf.lfWidth = 0 ;
- lf.lfEscapement = 0 ;
- lf.lfOrientation = 0 ;
- lf.lfWeight = iAttributes & EZ_ATTR_BOLD ? 700 : 0 ;
- lf.lfItalic = iAttributes & EZ_ATTR_ITALIC ? 1 : 0 ;
- lf.lfUnderline = iAttributes & EZ_ATTR_UNDERLINE ? 1 : 0 ;
- lf.lfStrikeOut = iAttributes & EZ_ATTR_STRIKEOUT ? 1 : 0 ;
- lf.lfCharSet = DEFAULT_CHARSET ;
- lf.lfOutPrecision = 0 ;
- lf.lfClipPrecision = 0 ;
- lf.lfQuality = 0 ;
- lf.lfPitchAndFamily = 0 ;
-
- lstrcpy (lf.lfFaceName, szFaceName) ;
-
- hFont = CreateFontIndirect (&lf) ;
-
- if (iDeciPtWidth != 0)
- {
- hFont = (HFONT) SelectObject (hdc, hFont) ;
-
- GetTextMetrics (hdc, &tm) ;
-
- DeleteObject (SelectObject (hdc, hFont)) ;
-
- lf.lfWidth = (int) (tm.tmAveCharWidth *
- fabs (pt.x) / fabs (pt.y) + 0.5) ;
-
- hFont = CreateFontIndirect (&lf) ;
- }
-
- RestoreDC (hdc, -1) ;
- return hFont ;
-}
-
-struct graphics_image_priv {
- PXPM2BMP pxpm;
-};
-
-
-void ErrorExit(LPTSTR lpszFunction)
-{
- // Retrieve the system error message for the last-error code
-
- LPVOID lpMsgBuf;
- LPVOID lpDisplayBuf;
- DWORD dw = GetLastError();
-
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- dw,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &lpMsgBuf,
- 0, NULL );
-
- lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT,
- (lstrlen((LPCTSTR)lpMsgBuf)+lstrlen((LPCTSTR)lpszFunction)+40)*sizeof(TCHAR));
- stprintf ((LPTSTR)lpDisplayBuf, TEXT("%s failed with error %d: %s"), lpszFunction, (int)dw, (char *)lpMsgBuf);
-
- dbg( 0, "%s\n", (char *)lpDisplayBuf );
- MessageBox(NULL, (LPCTSTR)lpDisplayBuf, TEXT("Error"), MB_OK);
-
- LocalFree(lpMsgBuf);
- LocalFree(lpDisplayBuf);
- ExitProcess(dw);
-}
-
-
-
-struct graphics_gc_priv {
- HWND hwnd;
- int line_width;
- COLORREF fg_color;
- COLORREF bg_color;
- struct graphics_priv *gr;
-};
-
-
-//struct graphics_priv *g_gra;
-
-static HDC hMemDC;
-static HBITMAP hBitmap;
-static HBITMAP hOldBitmap;
-
-// Fills the region 'rgn' in graded colours
-static void MakeMemoryDC(HANDLE hWnd, HDC hdc )
-{
- if ( hMemDC )
- {
- if ( hOldBitmap )
- {
- SelectObject( hMemDC, hOldBitmap );
- DeleteObject( hBitmap );
- hBitmap = NULL;
- hOldBitmap = NULL;
- }
- }
-
- // Creates memory DC
- hMemDC = CreateCompatibleDC(hdc);
- if ( hMemDC )
- {
- RECT rectRgn;
- GetClientRect( hWnd, &rectRgn );
-
- int Width = rectRgn.right - rectRgn.left;
- int Height = rectRgn.bottom - rectRgn.top;
- dbg( 1, "resize memDC to: %d %d \n", Width, Height );
-
- hBitmap = CreateCompatibleBitmap(hdc, Width, Height );
-
- if ( hBitmap )
- {
- hOldBitmap = (HBITMAP) SelectObject( hMemDC, hBitmap);
- }
- }
-}
-
-static void HandleButtonClick( struct graphics_priv *gra_priv, int updown, int button, long lParam )
-{
- int xPos = LOWORD(lParam);
- int yPos = HIWORD(lParam);
-
- if (gra_priv->button_callback )
- {
- struct point pt = {xPos, yPos};
- (*gra_priv->button_callback)(gra_priv->button_callback_data, updown, button, &pt);
- }
-}
-
-static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
-{
-
-//if ( Message != 15 )
-//printf( "CHILD %d %d %d \n", Message, wParam, lParam );
-
- struct graphics_priv* gra_priv = (struct graphics_priv*)GetWindowLongPtr( hwnd , DWLP_USER );
-
- switch(Message)
- {
- case WM_CREATE:
- {
- HDC hdc;
- hdc = GetDC( hwnd );
- MakeMemoryDC(hwnd, hdc );
- ReleaseDC( hwnd, hdc );
- }
- break;
- case WM_COMMAND:
- switch(LOWORD(wParam))
- {
- case WM_USER + 1:
- break;
- }
- break;
- case WM_CLOSE:
- DestroyWindow(hwnd);
- break;
- case WM_USER+1:
- if ( gra_priv )
- {
- RECT rc ;
- HDC hdc;
-
- GetClientRect( hwnd, &rc );
- gra_priv->width = rc.right;
- gra_priv->height = rc.bottom;
-
- hdc = GetDC( hwnd );
- MakeMemoryDC(hwnd, hdc );
- ReleaseDC( hwnd, hdc );
- }
- break;
-
- case WM_SIZE:
- /*
- if ( gra_priv )
- {
- //graphics = GetWindowLong( hwnd, DWL_USER, 0 );
-
-
- {
- HDC hdc;
- hdc = GetDC( hwnd );
- MakeMemoryDC(hwnd, hdc );
- ReleaseDC( hwnd, hdc );
- }
- (*gra_priv->resize_callback)(gra_priv->resize_callback_data, gra_priv->width, gra_priv->height);
-
-
- }
- */
- if ( gra_priv )
- {
- gra_priv->width = LOWORD( lParam );
- gra_priv->height = HIWORD( lParam );
- (*gra_priv->resize_callback)(gra_priv->resize_callback_data, gra_priv->width, gra_priv->height);
- dbg( 1, "resize gfx to: %d %d \n", gra_priv->width, gra_priv->height );
- }
- break;
- case WM_DESTROY:
- PostQuitMessage(0);
- exit( 0 );
- break;
- case WM_PAINT:
- if ( gra_priv )
- {
- HDC hdc = GetDC(hwnd );
- if ( hMemDC )
- {
- BitBlt( hdc, 0, 0, gra_priv->width , gra_priv->height, hMemDC, 0, 0, SRCCOPY );
- }
- ReleaseDC( hwnd, hdc );
- }
- break;
- case WM_MOUSEMOVE:
- {
- int xPos = LOWORD(lParam);
- int yPos = HIWORD(lParam);
- struct point pt = {xPos, yPos};
-
- dbg( 2, "WM_MOUSEMOVE: %d %d \n", xPos, yPos );
- (*gra_priv->motion_callback)(gra_priv->motion_callback_data, &pt);
- }
-
- break;
-
- case WM_LBUTTONDOWN:
- HandleButtonClick( gra_priv,1, 1,lParam );
- break;
- case WM_LBUTTONUP:
- HandleButtonClick( gra_priv, 0, 1,lParam );
- break;
- case WM_RBUTTONDOWN:
- HandleButtonClick( gra_priv, 1, 3,lParam );
- break;
- case WM_RBUTTONUP:
- HandleButtonClick( gra_priv, 0, 3,lParam );
- break;
-
- default:
- return DefWindowProc(hwnd, Message, wParam, lParam);
- }
- return 0;
-}
-
-
-static const TCHAR g_szClassName[] = TEXT("NAVGRA");
-
-HANDLE CreateGraphicsWindows( struct graphics_priv* gr )
-{
- WNDCLASS wc;
- HWND hwnd;
- RECT rcParent;
-
-// wc.cbSize = sizeof(WNDCLASSEX);
- wc.style = 0;
- wc.lpfnWndProc = WndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 64;
- wc.hInstance = NULL;
- wc.hIcon = NULL;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = g_szClassName;
-// wc.hIconSm = NULL;
-
-
- GetClientRect( gr->wnd_parent_handle,&rcParent);
-
- if(!RegisterClass(&wc))
- {
- ErrorExit( TEXT("Window Registration Failed!") );
- return NULL;
- }
-
- gr->width = rcParent.right - rcParent.left;
- gr->height = rcParent.bottom - rcParent.top;
-#if defined(__CEGCC__)
- (*gr->resize_callback)(gr->resize_callback_data, gr->width, gr->height);
-#endif
- hwnd = CreateWindow( g_szClassName,
- TEXT(""),
- WS_CHILD ,
- 0,
- 0,
- gr->width,
- gr->height,
- gr->wnd_parent_handle,
- (HMENU)ID_CHILD_GFX,
- NULL,
- NULL);
-
- if(hwnd == NULL)
- {
- ErrorExit( TEXT("Window Creation Failed!") );
- return NULL;
- }
-
- SetWindowLongPtr( hwnd , DWLP_USER, (LONG_PTR)gr );
-
- ShowWindow( hwnd, TRUE );
- UpdateWindow( hwnd );
-
- gr->wnd_handle = hwnd;
-
- PostMessage( gr->wnd_parent_handle, WM_USER + 1, 0, 0 );
-
- return hwnd;
-}
-
-
-
-static void graphics_destroy(struct graphics_priv *gr)
-{
- g_free( gr );
-}
-
-
-static void gc_destroy(struct graphics_gc_priv *gc)
-{
- g_free( gc );
-}
-
-static void gc_set_linewidth(struct graphics_gc_priv *gc, int w)
-{
- gc->line_width = w;
-}
-
-static void gc_set_dashes(struct graphics_gc_priv *gc, int width, int offset, unsigned char dash_list[], int n)
-{
-// gdk_gc_set_dashes(gc->gc, 0, (gint8 *)dash_list, n);
-// gdk_gc_set_line_attributes(gc->gc, 1, GDK_LINE_ON_OFF_DASH, GDK_CAP_ROUND, GDK_JOIN_ROUND);
-}
-
-
-
-//static void gc_set_color(struct graphics_gc_priv *gc, struct color *c, int fg)
-//{
-//
-// gc->fg_color = RGB( c->r, c->g, c->b );
-//}
-
-static void gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
-{
- gc->fg_color = RGB( c->r, c->g, c->b );
-}
-
-static void gc_set_background(struct graphics_gc_priv *gc, struct color *c)
-{
- gc->bg_color = RGB( c->r, c->g, c->b );
- if ( hMemDC )
- SetBkColor( hMemDC, gc->bg_color );
-
-}
-
-static struct graphics_gc_methods gc_methods = {
- gc_destroy,
- gc_set_linewidth,
- gc_set_dashes,
- gc_set_foreground,
- gc_set_background
-};
-
-static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth)
-{
- struct graphics_gc_priv *gc=g_new(struct graphics_gc_priv, 1);
- *meth=gc_methods;
- gc->hwnd = gr->wnd_handle;
- gc->line_width = 1;
- gc->fg_color = RGB( 0,0,0 );
- gc->bg_color = RGB( 255,255,255 );
- return gc;
-}
-
-
-static void draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
-{
- int i;
- HPEN holdpen;
- HPEN hpen;
-
- hpen = CreatePen( PS_SOLID, gc->line_width, gc->fg_color );
- holdpen = SelectObject( hMemDC, hpen );
-
- SetBkColor( hMemDC, gc->bg_color );
-
- int first = 1;
- for ( i = 0; i< count; i++ )
- {
- if ( first )
- {
- first = 0;
- MoveToEx( hMemDC, p[0].x, p[0].y, NULL );
- }
- else
- {
- LineTo( hMemDC, p[i].x, p[i].y );
- }
- }
-
- SelectObject( hMemDC, holdpen );
- DeleteObject( hpen );
-}
-
-static void draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
-{
-
- //if (gr->mode == draw_mode_begin || gr->mode == draw_mode_end)
- {
- int i;
- POINT points[ count ];
- for ( i=0;i< count; i++ )
- {
- points[i].x = p[i].x;
- points[i].y = p[i].y;
- }
- HBRUSH holdbrush;
- HBRUSH hbrush;
-
- SetBkColor( hMemDC, gc->bg_color );
-
- hbrush = CreateSolidBrush( gc->fg_color );
- holdbrush = SelectObject( hMemDC, hbrush );
- Polygon( hMemDC, points,count );
- SelectObject( hMemDC, holdbrush );
- DeleteObject( hbrush );
- }
-}
-
-
-static void draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
-{
-// gdk_draw_rectangle(gr->drawable, gc->gc, TRUE, p->x, p->y, w, h);
-}
-
-static void draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r)
-{
- HDC dc = hMemDC;
-
- HPEN holdpen;
- HPEN hpen;
-
- hpen = CreatePen( PS_SOLID, gc->line_width, gc->fg_color );
- holdpen = SelectObject( dc, hpen );
-
- SetBkColor( hMemDC, gc->bg_color );
-
- Ellipse( dc, p->x - r, p->y -r, p->x + r, p->y + r );
-
- SelectObject( dc, holdpen );
- DeleteObject( hpen );
-
-// if (gr->mode == draw_mode_begin || gr->mode == draw_mode_end)
-// gdk_draw_arc(gr->drawable, gc->gc, FALSE, p->x-r/2, p->y-r/2, r, r, 0, 64*360);
-// if (gr->mode == draw_mode_end || gr->mode == draw_mode_cursor)
-// gdk_draw_arc(gr->widget->window, gc->gc, FALSE, p->x-r/2, p->y-r/2, r, r, 0, 64*360);
-}
-
-
-
-static void draw_restore(struct graphics_priv *gr, struct point *p, int w, int h)
-{
- InvalidateRect( gr->wnd_handle, NULL, FALSE );
-}
-
-static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
-{
- dbg( 1, "set draw_mode to %d\n", (int)mode );
-
- if ( mode == draw_mode_begin )
- {
- if ( gr->wnd_handle == NULL )
- {
- CreateGraphicsWindows( gr );
- }
- if ( gr->mode != draw_mode_begin )
- {
- if ( hMemDC )
- {
- RECT rcClient;
- HBRUSH bgBrush = CreateSolidBrush( gr->bg_color );
- GetClientRect( gr->wnd_handle, &rcClient );
- FillRect( hMemDC, &rcClient, bgBrush );
- DeleteObject( bgBrush );
- }
- }
- }
-
- // force paint
- if (mode == draw_mode_end && gr->mode == draw_mode_begin)
- {
- InvalidateRect( gr->wnd_handle, NULL, FALSE );
- }
-
- gr->mode=mode;
-
-}
-
-
-static void * get_data(struct graphics_priv *this_, char *type)
-{
- if ( strcmp( "wnd_parent_handle_ptr", type ) == 0 )
- {
- return &( this_->wnd_parent_handle );
- }
- if ( strcmp( "START_CLIENT", type ) == 0 )
- {
- CreateGraphicsWindows( this_ );
- return NULL;
- }
- return NULL;
-}
-
-
-static void register_resize_callback(struct graphics_priv *this_, void (*callback)(void *data, int w, int h), void *data)
-{
- this_->resize_callback=callback;
- this_->resize_callback_data=data;
-}
-
-static void register_motion_callback(struct graphics_priv *this_, void (*callback)(void *data, struct point *p), void *data)
-{
- this_->motion_callback=callback;
- this_->motion_callback_data=data;
-}
-
-static void register_button_callback(struct graphics_priv *this_, void (*callback)(void *data, int press, int button, struct point *p), void *data)
-{
- this_->button_callback=callback;
- this_->button_callback_data=data;
-}
-
-static void background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
-{
- RECT rcClient;
- HBRUSH bgBrush = CreateSolidBrush( gc->bg_color );
- GetClientRect( gr->wnd_handle, &rcClient );
- FillRect( hMemDC, &rcClient, bgBrush );
- DeleteObject( bgBrush );
- gr->bg_color = gc->bg_color;
-}
-
-struct graphics_font_priv {
- LOGFONT lf;
- HFONT hfont;
- int size;
-};
-
-static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
-{
- RECT rcClient;
- GetClientRect( gr->wnd_handle, &rcClient );
-
- int prevBkMode = SetBkMode( hMemDC, TRANSPARENT );
-
- if ( NULL == font->hfont )
- {
- font->hfont = EzCreateFont (hMemDC, TEXT ("Arial"), font->size/2, 0, 0, TRUE) ;
- GetObject ( font->hfont, sizeof (LOGFONT), &font->lf) ;
- }
-
-
- double angle = -atan2( dy, dx ) * 180 / 3.14159 ;
-
- SetTextAlign (hMemDC, TA_BASELINE) ;
- SetViewportOrgEx (hMemDC, p->x, p->y, NULL) ;
- font->lf.lfEscapement = font->lf.lfOrientation = ( angle * 10 ) ;
- DeleteObject (font->hfont) ;
-
- font->hfont = CreateFontIndirect (&font->lf);
- HFONT hOldFont = SelectObject(hMemDC, font->hfont );
-
- gunichar2* utf16 = NULL;
- glong utf16_len = 0;
-
- utf16 = g_utf8_to_utf16( text, -1, NULL, &utf16_len, NULL );
-#if defined(__CEGCC__)
- ExtTextOut(hMemDC, 0,0, ETO_OPAQUE, 0, utf16, (size_t)utf16_len,0 );
-#else
- TextOutW(hMemDC, 0,0, utf16, (size_t)utf16_len );
-#endif
- g_free( utf16 );
-
-
- SelectObject(hMemDC, hOldFont);
- DeleteObject (font->hfont) ;
-
- SetBkMode( hMemDC, prevBkMode );
-
- SetViewportOrgEx (hMemDC, 0, 0, NULL) ;
-
-}
-
-
-
-static void font_destroy(struct graphics_font_priv *font)
-{
- if ( font->hfont )
- {
- DeleteObject(font->hfont);
- }
- g_free(font);
-}
-
-static struct graphics_font_methods font_methods = {
- font_destroy
-};
-
-static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, int size, int flags)
-{
- struct graphics_font_priv *font=g_new(struct graphics_font_priv, 1);
- *meth = font_methods;
-
- font->hfont = NULL;
- font->size = size;
- // FontFamily fontFamily( "Liberation Mono");
-//font( &fontFamily, size, FontStyleRegular, UnitPoint );
- return font;
-}
-
-
-void image_cache_hash_add( const char* key, struct graphics_image_priv* val_ptr)
-{
- if ( image_cache_hash == NULL ) {
- image_cache_hash = g_hash_table_new(g_str_hash, g_str_equal);
- }
-
- if ( g_hash_table_lookup(image_cache_hash, key ) == NULL )
- {
- g_hash_table_insert(image_cache_hash, g_strdup( key ), (gpointer)val_ptr );
- }
-
-}
-
-struct graphics_image_priv* image_cache_hash_lookup( const char* key )
-{
- struct graphics_image_priv* val_ptr = NULL;
-
- if ( image_cache_hash != NULL )
- {
- val_ptr = g_hash_table_lookup(image_cache_hash, key );
- }
- return val_ptr;
-}
-
-
-
-static struct graphics_image_priv *image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h, struct point *hot)
-{
- struct graphics_image_priv* ret;
-
- if ( NULL == ( ret = image_cache_hash_lookup( name ) ) )
- {
- ret = g_new( struct graphics_image_priv, 1 );
- dbg( 1, "loading image '%s'\n", name );
- ret->pxpm = Xpm2bmp_new();
- Xpm2bmp_load( ret->pxpm, name );
- image_cache_hash_add( name, ret );
- }
-
- return ret;
-}
-
-static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
-{
- Xpm2bmp_paint( img->pxpm , hMemDC, p->x, p->y );
-}
-
-static struct graphics_methods graphics_methods = {
- graphics_destroy,
- draw_mode,
- draw_lines,
- draw_polygon,
- draw_rectangle,
- draw_circle,
- draw_text,
- draw_image,
-#ifdef HAVE_IMLIB2
- NULL, // draw_image_warp,
-#else
- NULL,
-#endif
- draw_restore,
- font_new,
- gc_new,
- background_gc,
- NULL, // overlay_new,
- image_new,
- get_data,
- register_resize_callback,
- register_button_callback,
- register_motion_callback,
-};
-
-static struct graphics_priv * graphics_win32_drawing_area_new_helper(struct graphics_methods *meth)
-{
- struct graphics_priv *this_=g_new0(struct graphics_priv,1);
- *meth=graphics_methods;
- this_->mode = -1;
- return this_;
-}
-
-struct graphics_priv* win32_graphics_new( struct graphics_methods *meth, struct attr **attrs)
-{
- struct graphics_priv* this_=graphics_win32_drawing_area_new_helper(meth);
- return this_;
-}
diff --git a/projs/CodeBlocks/win32gui/win32_gui.c b/projs/CodeBlocks/win32gui/win32_gui.c
deleted file mode 100644
index 89a7ba9d..00000000
--- a/projs/CodeBlocks/win32gui/win32_gui.c
+++ /dev/null
@@ -1,547 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <process.h>
-#include <windows.h>
-#include <wchar.h>
-#include <glib.h>
-#if defined(__CEGCC__)
-#include <libintl.h>
-#endif
-#include <Commctrl.h>
-#include "config.h"
-#include "plugin.h"
-#include "gui.h"
-#include "win32_gui.h"
-#include "point.h"
-#include "navit.h"
-#include "menu.h"
-#include "item.h"
-#include "attr.h"
-#include "callback.h"
-#include <commctrl.h>
-#include "debug.h"
-#include "util.h"
-
-
-//static GHashTable *popup_callback_hash = NULL;
-static GArray *popup_menu_array;
-
-const TCHAR g_szClassName[] = TEXT("navit_gui_class");
-
-static int menu_id = 0;
-
-gboolean message_pump( gpointer data )
-{
- MSG messages;
-
- Sleep( 1 );
-
- if (GetMessage (&messages, NULL, 0, 0))
- {
- TranslateMessage(&messages);
- DispatchMessage(&messages);
- }
- else{
- exit( 0 );
- }
- return TRUE;
-}
-
-
-
-//extern struct graphics_priv *g_gra;
-
-BOOL CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam)
-{
- LPRECT rcParent;
- int idChild;
-
- idChild = GetWindowLong(hwndChild, GWL_ID);
-
- if ( idChild == ID_CHILD_GFX )
- {
- rcParent = (LPRECT) lParam;
-
- MoveWindow( hwndChild, 0, 0, rcParent->right, rcParent->bottom, TRUE );
- PostMessage( hwndChild, WM_USER+1, 0, 0 );
- }
-
- return TRUE;
-}
-
-#ifndef GET_WHEEL_DELTA_WPARAM
- #define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam))
-#endif
-
-static void CreateToolBar(HWND hwnd)
-{
- // Create Toolbar
- HWND hTool;
- TBBUTTON tbb[8];
- TBADDBITMAP tbab;
- struct tagINITCOMMONCONTROLSEX initComm;
-
- initComm.dwSize = sizeof(struct tagINITCOMMONCONTROLSEX);
- initComm.dwICC = ICC_BAR_CLASSES | ICC_LISTVIEW_CLASSES;
- InitCommonControlsEx(&initComm);
-
- hTool = CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0,
- hwnd, (HMENU)ID_CHILD_TOOLBAR, GetModuleHandle(NULL), NULL);
-
- if(hTool == NULL)
- MessageBox(hwnd, TEXT("Could not create tool bar."), TEXT("Error"), MB_OK | MB_ICONERROR);
-
- SendMessage(hTool, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
-
- tbab.hInst = GetModuleHandle(NULL);
- tbab.nID = IDB_NAVITTOOLBAR;
- int iImageOffset = SendMessage(hTool, TB_ADDBITMAP, 10, (LPARAM) &tbab);
-
- int iStr;
-
- ZeroMemory(tbb, sizeof(tbb));
-
- tbb[0].iBitmap = iImageOffset;
- tbb[0].fsState = TBSTATE_ENABLED;
- tbb[0].fsStyle = TBSTYLE_BUTTON;
- tbb[0].idCommand = ID_DISPLAY_ZOOMIN;
- iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"ZoomIn" );
- tbb[0].iString = iStr;
-
- tbb[1].iBitmap = iImageOffset+1;
- tbb[1].fsState = TBSTATE_ENABLED;
- tbb[1].fsStyle = TBSTYLE_BUTTON;
- tbb[1].idCommand = ID_DISPLAY_ZOOMOUT;
- iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"ZoomOut" );
- tbb[1].iString = iStr;
-
- tbb[2].iBitmap = iImageOffset+4;
- tbb[2].fsState = TBSTATE_ENABLED;
- tbb[2].fsStyle = TBSTYLE_BUTTON;
- tbb[2].idCommand = ID_DISPLAY_REFRESH;
- iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"Refresh" );
- tbb[2].iString = iStr;
-
- tbb[3].iBitmap = iImageOffset+2;
- tbb[3].fsState = TBSTATE_ENABLED;
- tbb[3].fsStyle = TBSTYLE_BUTTON;
- tbb[3].idCommand = ID_DISPLAY_CURSOR;
- iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"Cursor" );
- tbb[3].iString = iStr;
-
- tbb[4].iBitmap = iImageOffset+5;
- tbb[4].fsState = TBSTATE_ENABLED;
- tbb[4].fsStyle = TBSTYLE_BUTTON;
- tbb[4].idCommand = ID_DISPLAY_ORIENT;
- iStr = SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"Orientation" );
- tbb[4].iString = iStr;
-
- tbb[5].iBitmap = iImageOffset+8;
- tbb[5].fsState = TBSTATE_ENABLED;
- tbb[5].fsStyle = TBSTYLE_BUTTON;
- tbb[5].idCommand = ID_DISPLAY_DESTINATION;
- iStr= SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"Destination" );
- tbb[5].iString = iStr;
-
- tbb[6].iBitmap = iImageOffset+3;
- tbb[6].fsState = TBSTATE_ENABLED;
- tbb[6].fsStyle = TBSTYLE_BUTTON;
- tbb[6].idCommand = ID_DISPLAY_ZOOMIN;
- iStr= SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"Roadbook" );
- tbb[6].iString = iStr;
-
- tbb[7].iBitmap = iImageOffset+9;
- tbb[7].fsState = TBSTATE_ENABLED;
- tbb[7].fsStyle = TBSTYLE_BUTTON;
- tbb[7].idCommand = ID_FILE_EXIT;
- iStr= SendMessage(hTool, TB_ADDSTRINGW, 0, (LPARAM) L"_Quit" );
- tbb[7].iString = iStr;
-
- SendMessage(hTool, TB_ADDBUTTONS, sizeof(tbb)/sizeof(TBBUTTON), (LPARAM)&tbb);
-}
-
-static void window_layout( HWND hwnd )
-{
-#if !defined(__CEGCC__)
- RECT rcClient;
- RECT rcTool;
- int iToolHeight;
-
- HWND hChild = GetDlgItem(hwnd, ID_CHILD_TOOLBAR);
- SendMessage(hChild, TB_AUTOSIZE, 0, 0);
-
-
- GetWindowRect(hChild, &rcTool);
- iToolHeight = rcTool.bottom - rcTool.top;
-
- GetClientRect(hwnd, &rcClient);
- dbg( 2, "BEFORE resize gui to: %d %d %d %d \n", rcClient.left, rcClient.right, rcClient.top, rcClient.bottom );
-
- rcClient.top += iToolHeight;
-
- dbg( 1, "resize gui to: %ld %ld %ld %ld \n", rcClient.left, rcClient.right, rcClient.top, rcClient.bottom );
-
-
- hChild = GetDlgItem(hwnd, ID_CHILD_GFX);
- if ( hChild )
- {
- MoveWindow( hChild, rcClient.left, rcClient.top, rcClient.right- rcClient.left, rcClient.bottom - rcClient.top, TRUE );
-// PostMessage( hChild, WM_USER+1, 0, 0 );
- }
-#endif
-}
-
-static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
-{
- dbg( 2, "PARENT %d %d %d \n", Message, wParam, lParam );
-
- switch(Message)
- {
- case WM_CREATE:
- {
- HMENU hMenu, hSubMenu;
-
- CreateToolBar( hwnd );
-
- hMenu = CreateMenu();
- // g_this_->hwnd = hwnd;
-
- hSubMenu = CreatePopupMenu();
-
- AppendMenuW(hSubMenu, MF_STRING, ID_DISPLAY_ZOOMIN, L"ZoomIn" );
- AppendMenuW(hSubMenu, MF_STRING, ID_DISPLAY_ZOOMOUT, L"ZoomOut" );
- AppendMenuW(hSubMenu, MF_STRING, ID_DISPLAY_REFRESH, L"Refresh" );
- AppendMenuW(hSubMenu, MF_STRING, ID_DISPLAY_DESTINATION, L"Destination" );
- AppendMenuW(hSubMenu, MF_STRING, ID_DISPLAY_REFRESH, L"Refresh");
- AppendMenuW(hSubMenu, MF_SEPARATOR, 0, NULL );
- AppendMenuW(hSubMenu, MF_STRING, ID_FILE_EXIT, L"_Quit" );
-
- AppendMenuW(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, L"Display" );
- hSubMenu = CreatePopupMenu();
- AppendMenu(hSubMenu, MF_STRING, ID_STUFF_GO, TEXT("&Go"));
- AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, TEXT("&Stuff"));
-
-#if !defined(__CEGCC__)
- SetMenu(hwnd, hMenu);
-#endif
-
- window_layout( hwnd );
-
- }
- break;
- case WM_COMMAND:
- {
- dbg( 1, "WM_COMMAND %d\n", LOWORD(wParam) );
- struct gui_priv* gui = (struct gui_priv*)GetWindowLongPtr( hwnd , DWLP_USER );
-
-
- switch(LOWORD(wParam))
- {
- case ID_DISPLAY_ZOOMIN:
- navit_zoom_in(gui->nav, 2, NULL);
- return 0;
- break;
- case ID_DISPLAY_ZOOMOUT:
- navit_zoom_out(gui->nav, 2, NULL);
- return 0;
- break;
- case ID_DISPLAY_REFRESH:
- navit_draw(gui->nav);
- return 0;
- break;
- case ID_DISPLAY_CURSOR:
- {
- struct attr attr;
- attr.type=attr_cursor;
- // TODO attr.u.num=gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
- if(!navit_set_attr(gui->nav, &attr)) {
- dbg(0, "Failed to set attr_cursor\n");
- }
- return 0;
- }
- break;
- case ID_DISPLAY_ORIENT:
- {
- struct attr attr;
-
- attr.type=attr_orientation;
- attr.u.num = 0; // TODO
- if(!navit_set_attr(gui->nav, &attr)) {
- dbg(0, "Failed to set attr_orientation\n");
- }
- return 0;
- }
- case ID_DISPLAY_DESTINATION:
- {
- create_destination_window(gui->nav);
- return 0;
- }
-
- case ID_FILE_EXIT:
- PostMessage(hwnd, WM_CLOSE, 0, 0);
- return 0;
- break;
- }
- if ( popup_menu_array )
- {
- struct menu_priv* priv = (struct menu_priv*)g_array_index( popup_menu_array, gint, LOWORD(wParam) - POPUP_MENU_OFFSET );
-
- if ( priv )
- {
- if ( priv->cb )
- {
- callback_call_0( priv->cb );
- return 0;
- }
- }
- }
- }
- break;
- case WM_USER + 1:
- window_layout( hwnd );
- return 0;
- break;
- case WM_CLOSE:
- DestroyWindow(hwnd);
- break;
- case WM_SIZE:
- window_layout( hwnd );
- return 0;
- break;
- case WM_DESTROY:
- PostQuitMessage(0);
- break;
-
-
- case WM_MOUSEWHEEL:
- {
- struct gui_priv* gui = (struct gui_priv*)GetWindowLongPtr( hwnd , DWLP_USER );
-
- short delta = GET_WHEEL_DELTA_WPARAM( wParam );
- if ( delta > 0 )
- {
- navit_zoom_in(gui->nav, 2, NULL);
- }
- else{
- navit_zoom_out(gui->nav, 2, NULL);
- }
- }
- break;
-
- default:
- return DefWindowProc(hwnd, Message, wParam, lParam);
- }
- return 0;
-}
-
-HANDLE CreateWin32Window( void )
-{
- WNDCLASS wc;
- HWND hwnd;
-
-// wc.cbSize = sizeof(WNDCLASSEX);
- wc.style = 0;
- wc.lpfnWndProc = WndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 32;
- wc.hInstance = NULL;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = g_szClassName;
-// wc.hIconSm = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_NAVIT));
- wc.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_NAVIT));
-
- if(!RegisterClass(&wc))
- {
- MessageBox(NULL, TEXT("Window Registration Failed!"), TEXT("Error!"), MB_ICONEXCLAMATION | MB_OK);
- return 0;
- }
-
- hwnd = CreateWindowEx(
- WS_EX_CLIENTEDGE,
- g_szClassName,
- TEXT("Navit"),
-#if defined(__CEGCC__)
- WS_SYSMENU | WS_CLIPCHILDREN,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
-#else
- WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
- CW_USEDEFAULT, CW_USEDEFAULT, 800, 600,
-#endif
- NULL, NULL, NULL, NULL);
-
- if(hwnd == NULL)
- {
- MessageBox(NULL, TEXT("Window Creation Failed!"), TEXT("Error!"), MB_ICONEXCLAMATION | MB_OK);
- return 0;
- }
-
- ShowWindow(hwnd, TRUE);
- UpdateWindow(hwnd);
-
- g_idle_add (message_pump, NULL);
-
- register_destination_window();
- return hwnd;
-}
-
-
-static int win32_gui_set_graphics(struct gui_priv *this_, struct graphics *gra)
-{
- HANDLE* wndHandle_ptr = graphics_get_data(gra, "wnd_parent_handle_ptr");
- *wndHandle_ptr = this_->hwnd;
- graphics_get_data(gra, "START_CLIENT");
- return 0;
-}
-
-
-//static void win32_gui_add_bookmark_do(struct gui_priv *gui)
-//{
-//// navit_add_bookmark(gui->nav, &gui->dialog_coord, gtk_entry_get_text(GTK_ENTRY(gui->dialog_entry)));
-//// gtk_widget_destroy(gui->dialog_win);
-//}
-
-static int win32_gui_add_bookmark(struct gui_priv *gui, struct pcoord *c, char *description)
-{
- return 1;
-}
-
-
-static struct menu_methods menu_methods;
-
-
-static struct menu_priv *add_menu( struct menu_priv *menu,
- struct menu_methods *meth,
- char *name,
- enum menu_type type,
- struct callback *cb)
-{
- struct menu_priv* ret = NULL;
-
- ret = g_new0(struct menu_priv, 1);
-
- *ret = *menu;
- *meth = menu_methods;
-
- TCHAR *menuname = newSysString(name);
-
- if ( type == menu_type_submenu )
- {
- HMENU hSubMenu = NULL;
- hSubMenu = CreatePopupMenu();
-
- AppendMenu(menu->hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, menuname );
-
- ret->hMenu = hSubMenu;
- }
- else
- {
- AppendMenu( menu->hMenu, MF_STRING, menu_id, menuname );
- }
-
- g_free(menuname);
- // g_hash_table_insert( popup_callback_hash, GINT_TO_POINTER( menu_id ), (gpointer)cb );
- g_array_append_val( popup_menu_array, ret );
-
- ret->cb = cb;
-
- menu_id++;
-
- return ret;
-
-}
-
-static void set_toggle(struct menu_priv *menu, int active)
-{
- // gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(menu->action), active);
-}
-
-static int get_toggle(struct menu_priv *menu)
-{
- // return gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(menu->action));
- return 0;
-}
-
-static struct menu_methods menu_methods = {
- add_menu,
- set_toggle,
- get_toggle,
-};
-
-static void popup_activate(struct menu_priv *menu)
-{
- POINT pnt;
- GetCursorPos( &pnt );
-
- if (menu->hMenu)
- {
- TrackPopupMenu( menu->hMenu, 0, pnt.x, pnt.y, 0, menu->wnd_handle, NULL );
- DestroyMenu( menu->hMenu );
- }
-}
-
-
-//static void popup_deactivate( struct menu_priv *menu )
-//{
-// DestroyMenu( menu->hMenu );
-//}
-
-struct menu_priv* win32_gui_popup_new(struct gui_priv *this_, struct menu_methods *meth)
-{
- struct menu_priv* ret = NULL;
-
- ret = g_new0(struct menu_priv, 1);
- *meth = menu_methods;
-
- menu_id = POPUP_MENU_OFFSET;
-
- if ( popup_menu_array )
- {
- g_array_free (popup_menu_array, TRUE);
- popup_menu_array = NULL;
- }
-
- popup_menu_array = g_array_new (FALSE, FALSE, sizeof (gint));
-
- ret->cb = NULL;
- ret->hMenu = CreatePopupMenu();
- ret->wnd_handle = this_->hwnd;
- meth->popup=popup_activate;
-
- dbg( 1, "create popup menu %d \n", (int)ret->hMenu );
-
- return ret;
-}
-
-struct gui_methods win32_gui_methods = {
- NULL, // win32_gui_menubar_new,
- win32_gui_popup_new,
- win32_gui_set_graphics,
- NULL,
- NULL,
- win32_gui_add_bookmark,
-};
-
-
-
-static struct gui_priv *win32_gui_new( struct navit *nav, struct gui_methods *meth, struct attr **attrs)
-{
- struct gui_priv *this_;
-
- *meth=win32_gui_methods;
-
- this_=g_new0(struct gui_priv, 1);
- this_->nav=nav;
-
- this_->hwnd = CreateWin32Window();
- SetWindowLongPtr( this_->hwnd , DWLP_USER, (LONG_PTR) this_ );
-
- return this_;
-}
-
-void plugin_init(void)
-{
- plugin_register_gui_type("win32", win32_gui_new);
- plugin_register_graphics_type("win32_graphics", win32_graphics_new);
-}
diff --git a/projs/CodeBlocks/win32gui/win32_gui.h b/projs/CodeBlocks/win32gui/win32_gui.h
deleted file mode 100644
index cdb6d302..00000000
--- a/projs/CodeBlocks/win32gui/win32_gui.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef WIN32_GUI_INCLUDED
-#define WIN32_GUI_INCLUDED
-
-#include "resources\resource.h"
-#include "coord.h"
-#include "point.h"
-#include "graphics.h"
-
-#define ID_CHILD_GFX 100
-#define ID_CHILD_TOOLBAR (ID_CHILD_GFX + 1)
-#define ID_CHILD_1 (ID_CHILD_TOOLBAR + 1)
-#define ID_CHILD_2 (ID_CHILD_1 + 1)
-#define ID_CHILD_3 (ID_CHILD_2 + 1)
-#define ID_CHILD_4 (ID_CHILD_4 + 1)
-
-#define ID_DISPLAY_ZOOMIN 200
-#define ID_DISPLAY_ZOOMOUT 201
-#define ID_DISPLAY_REFRESH 202
-#define ID_DISPLAY_CURSOR 203
-#define ID_DISPLAY_ORIENT 204
-#define ID_DISPLAY_DESTINATION 205
-
-#define ID_FILE_EXIT 9001
-#define ID_STUFF_GO 9002
-
-#define _(text) gettext(text)
-
-#define POPUP_MENU_OFFSET 4000
-
-struct statusbar_methods;
-struct menu_methods;
-struct datawindow_methods;
-struct navit;
-struct callback;
-
-
-struct menu_priv {
- HWND wnd_handle;
- HMENU hMenu;
- struct callback* cb;
-};
-
-struct gui_priv {
- struct navit *nav;
- HANDLE hwnd;
-};
-
-
-struct graphics_priv {
- struct point p;
- int width;
- int height;
- int library_init;
- int visible;
- HANDLE wnd_parent_handle;
- HANDLE wnd_handle;
- COLORREF bg_color;
-
-
- void (*resize_callback)(void *data, int w, int h);
- void *resize_callback_data;
- void (*motion_callback)(void *data, struct point *p);
- void *motion_callback_data;
- void (*button_callback)(void *data, int press, int button, struct point *p);
- void *button_callback_data;
- enum draw_mode_num mode;
-};
-
-
-struct graphics_priv* win32_graphics_new( struct graphics_methods *meth, struct attr **attrs);
-HANDLE create_destination_window( struct navit *nav );
-BOOL register_destination_window();
-
-
-#endif
diff --git a/projs/CodeBlocks/win32gui/win32_gui_destination.c b/projs/CodeBlocks/win32gui/win32_gui_destination.c
deleted file mode 100644
index 8f578dc5..00000000
--- a/projs/CodeBlocks/win32gui/win32_gui_destination.c
+++ /dev/null
@@ -1,405 +0,0 @@
-#include <windows.h>
-#include <windowsx.h>
-#include <commctrl.h>
-#include <glib.h>
-#include "item.h"
-#include "attr.h"
-#include "navit.h"
-#include "search.h"
-#include "debug.h"
-#include "util.h"
-#include "win32_gui_notify.h"
-#include "resources\resource.h"
-
-static const TCHAR g_szDestinationClassName[] = TEXT("navit_gui_destinationwindow_class");
-
-struct datawindow_priv
-{
- HWND hwnd;
- HWND hwndLabel;
- HWND hwndEdit;
- HWND hwndList;
- HWND hwndButtonPrev;
- HWND hwndButtonNext;
- enum attr_type currentSearchState;
- struct search_list *sl;
- struct navit *nav;
- struct notify_priv *notifications;
-};
-
-static void setlayout(struct datawindow_priv *datawindow)
-{
- LVCOLUMN lvc;
- lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
-
- RECT winrect;
- GetWindowRect (datawindow->hwndList, &winrect);
-
- lvc.iSubItem = 1;
- lvc.cx = (winrect.right - winrect.left) - 52 ;
- lvc.fmt = LVCFMT_LEFT; // left-aligned column
-
- switch (datawindow->currentSearchState)
- {
- case attr_country_name:
- {
- Edit_SetText(datawindow->hwndLabel, TEXT("Country"));
- lvc.pszText = TEXT("Country");
- }
- break;
- case attr_town_name:
- {
- Edit_SetText(datawindow->hwndLabel, TEXT("Postal or Town"));
- lvc.pszText = TEXT("Town");
- }
- break;
- case attr_street_name:
- {
- Edit_SetText(datawindow->hwndLabel, TEXT("Street"));
- lvc.pszText = TEXT("Street");
- }
- break;
- default:
- break;
-
- }
-
- (void)ListView_SetColumn(datawindow->hwndList, 1, &lvc);
-
- Edit_SetText(datawindow->hwndEdit, TEXT(""));
- SetFocus(datawindow->hwndEdit);
-}
-
-static void notify_apply(struct datawindow_priv *datawindow, int index, int param2)
-{
- TCHAR txtBuffer[1024];
- struct attr search_attr;
- struct search_list_result *res;
-
- if ( index >= 0 )
- {
- ListView_GetItemText(datawindow->hwndList, index, 1, txtBuffer, 1024);
-
- TCHAR_TO_UTF8(txtBuffer, search_string);
-
- search_attr.type = datawindow->currentSearchState;
- search_attr.u.str = search_string;
-
- search_list_search(datawindow->sl, &search_attr, 0);
- res=search_list_get_result(datawindow->sl);
- }
-
- switch (datawindow->currentSearchState)
- {
- case attr_country_name:
- {
- datawindow->currentSearchState = attr_town_name;
- }
- break;
- case attr_town_name:
- {
- datawindow->currentSearchState = attr_street_name;
- }
- break;
- case attr_street_name:
- {
- navit_set_destination(datawindow->nav, res->c, "Mein Test");
- DestroyWindow(datawindow->hwnd);
- }
- break;
- default:
- break;
-
- }
-
- setlayout(datawindow);
-
-}
-
-static void notify_back(struct datawindow_priv *datawindow, int param1, int param2)
-{
- switch (datawindow->currentSearchState)
- {
- case attr_country_name:
- break;
- case attr_town_name:
- {
- datawindow->currentSearchState = attr_country_name;
- }
- break;
- case attr_street_name:
- {
- datawindow->currentSearchState = attr_town_name;
- }
- break;
- default:
- break;
-
- }
-
- setlayout(datawindow);
-}
-
-static void notify_textchange(struct datawindow_priv *datawindow, int param1, int param2)
-{
-
- struct attr search_attr;
- struct search_list_result *res;
-
- int lineLength = Edit_LineLength(datawindow->hwndEdit, 0);
- TCHAR line[lineLength + 1];
- (void)Edit_GetLine(datawindow->hwndEdit, 0, line, lineLength + 1);
- line[lineLength] = 0;
-
-
- (void)ListView_DeleteAllItems( datawindow->hwndList);
-
- TCHAR_TO_UTF8(line, search_string);
-
- search_attr.type = datawindow->currentSearchState;
- search_attr.u.str = search_string;
-
- if (lineLength<1)
- return;
-
- search_list_search(datawindow->sl, &search_attr, 1);
-
-
- TCHAR *tcharBuffer = NULL;
- int listIndex = 0;
- LVITEM lvI;
-
- lvI.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE;
- lvI.state = 0;
- lvI.stateMask = 0;
-
- while ((res=search_list_get_result(datawindow->sl)) && listIndex < 50)
- {
-
- switch (search_attr.type)
- {
- case attr_country_name:
- tcharBuffer = newSysString(res->country->name);
- break;
- case attr_town_name:
- tcharBuffer = newSysString(res->town->name);
- break;
- case attr_street_name:
- if (res->street->name)
- {
- tcharBuffer = newSysString(res->street->name);
- }
- else
- {
- continue;
- }
- break;
- default:
- dbg(0, "Unhandled search type");
- }
-
- lvI.iItem = listIndex;
- lvI.iImage = listIndex;
- lvI.iSubItem = 0;
- lvI.lParam = (LPARAM) res->country->iso2;
- UTF8_TO_TCHAR(res->country->iso2, converted_iso2);
- lvI.pszText = converted_iso2;//LPSTR_TEXTCALLBACK; // sends an LVN_GETDISP message.
- (void)ListView_InsertItem(datawindow->hwndList, &lvI);
- ListView_SetItemText(datawindow->hwndList, listIndex, 1, tcharBuffer);
- g_free(tcharBuffer);
- dbg(0,"%s\n", res->country->name);
- listIndex++;
- }
-}
-
-static void notify_destroy(struct datawindow_priv *datawindow, int param1, int param2)
-{
- if ( datawindow )
- {
- search_list_destroy(datawindow->sl);
- g_free(datawindow);
- }
-}
-
-static void notify_size(struct datawindow_priv *datawindow, int width, int height)
-{
- if (datawindow)
- {
- MoveWindow(datawindow->hwndLabel,
- 0, 0, // starting x- and y-coordinates
- width, // width of client area
- 20, // height of client area
- TRUE); // repaint window
- MoveWindow(datawindow->hwndEdit,
- 0, 20, // starting x- and y-coordinates
- width, // width of client area
- 20, // height of client area
- TRUE); // repaint window
- MoveWindow(datawindow->hwndList,
- 0, 40, // starting x- and y-coordinates
- width, // width of client area
- height - 60, // height of client area
- TRUE); // repaint window
- MoveWindow(datawindow->hwndButtonPrev,
- 0, height - 20, // starting x- and y-coordinates
- width/2, // width of client area
- 20, // height of client area
- TRUE); // repaint window
- MoveWindow(datawindow->hwndButtonNext,
- width/2, height - 20, // starting x- and y-coordinates
- width/2, // width of client area
- 20, // height of client area
- TRUE); // repaint window
-
- setlayout(datawindow);
-
- }
-}
-
-static BOOL init_lv_columns(HWND hWndListView)
-{
-
-// struct LVCOLUMN lvc = {LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM,
-// LVCFMT_LEFT, 100, szText[iCol], 0, iCol, 0, 0 };
-
- TCHAR szText[][8] = {TEXT("Iso"),TEXT("Country")}; // temporary buffer
- LVCOLUMN lvc;
- int iCol;
-
- lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
-
- for (iCol = 0; iCol < 2; iCol++)
- {
- lvc.iSubItem = iCol;
- lvc.pszText = szText[iCol];
- lvc.cx = 50; // width of column in pixels
-
- if ( iCol < 2 )
- lvc.fmt = LVCFMT_LEFT; // left-aligned column
- else
- lvc.fmt = LVCFMT_RIGHT; // right-aligned column
-
- if (ListView_InsertColumn(hWndListView, iCol, &lvc) == -1)
- return FALSE;
- }
- return TRUE;
-}
-
-BOOL register_destination_window()
-{
- WNDCLASS wc;
-
- wc.style = 0;
- wc.lpfnWndProc = message_handler;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 32;
- wc.hInstance = NULL;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = g_szDestinationClassName;
- wc.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_NAVIT));
-
- if (!RegisterClass(&wc))
- {
- dbg(0, "Window Registration Failed!\n");
- return FALSE;
- }
- return TRUE;
-}
-
-HANDLE create_destination_window( struct navit *nav )
-{
-
-
- struct datawindow_priv *this_;
-
- this_=g_new0(struct datawindow_priv, 1);
- this_->nav = nav;
- this_->currentSearchState = attr_country_name;
- this_->sl=search_list_new(navit_get_mapset(this_->nav));
-
- this_->hwnd = CreateWindowEx(
- WS_EX_CLIENTEDGE,
- g_szDestinationClassName,
- TEXT("Destination Input"),
-#if defined(__CEGCC__)
- WS_SYSMENU | WS_CLIPCHILDREN,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
-#else
- WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
- CW_USEDEFAULT, CW_USEDEFAULT, 640, 480,
-#endif
- NULL, NULL, NULL, NULL);
-
- if (this_->hwnd == NULL)
- {
- dbg(0, "Window Creation Failed!\n");
- return 0;
- }
-
- this_->notifications = win32_gui_notify_new(this_);
- SetWindowLongPtr( this_->hwnd , DWLP_USER, (LONG_PTR) this_->notifications );
-
- this_->hwndLabel = CreateWindow(WC_STATIC, // predefined class
- TEXT("Country"), // no window title
- WS_CHILD | WS_VISIBLE | ES_LEFT , //| WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL
- 0, 0, 0, 0, // set size in WM_SIZE message
- this_->hwnd, // parent window
- NULL,//(HMENU) ID_EDITCHILD, // edit control ID
- (HINSTANCE) GetWindowLong(this_->hwnd, GWL_HINSTANCE),
- NULL); // pointer not needed
-
- this_->hwndEdit = CreateWindow(WC_EDIT, // predefined class
- NULL, // no window title
- WS_CHILD | WS_VISIBLE | ES_LEFT | WS_BORDER , //| WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL
- 0, 0, 0, 0, // set size in WM_SIZE message
- this_->hwnd, // parent window
- NULL,//(HMENU) ID_EDITCHILD, // edit control ID
- (HINSTANCE) GetWindowLong(this_->hwnd, GWL_HINSTANCE),
- NULL); // pointer not needed
-
- this_->hwndList = CreateWindow(WC_LISTVIEW, // predefined class
- NULL, // no window title
- WS_CHILD | WS_VISIBLE | ES_LEFT | WS_BORDER | LVS_REPORT , //| WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL
- 0, 0, 0, 0, // set size in WM_SIZE message
- this_->hwnd, // parent window
- NULL,//(HMENU) ID_EDITCHILD, // edit control ID
- (HINSTANCE) GetWindowLong(this_->hwnd, GWL_HINSTANCE),
- NULL); // pointer not needed
-
- this_->hwndButtonPrev = CreateWindow(WC_BUTTON, // predefined class
- TEXT("<<"), // no window title
- WS_CHILD | WS_VISIBLE | ES_LEFT | WS_BORDER | LVS_REPORT , //| WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL
- 0, 0, 0, 0, // set size in WM_SIZE message
- this_->hwnd, // parent window
- NULL,//(HMENU) ID_EDITCHILD, // edit control ID
- (HINSTANCE) GetWindowLong(this_->hwnd, GWL_HINSTANCE),
- NULL); // pointer not needed
- this_->hwndButtonNext = CreateWindow(WC_BUTTON, // predefined class
- TEXT(">>"), // no window title
- WS_CHILD | WS_VISIBLE | ES_LEFT | WS_BORDER | LVS_REPORT , //| WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL
- 0, 0, 0, 0, // set size in WM_SIZE message
- this_->hwnd, // parent window
- NULL,//(HMENU) ID_EDITCHILD, // edit control ID
- (HINSTANCE) GetWindowLong(this_->hwnd, GWL_HINSTANCE),
- NULL); // pointer not needed
- (void)ListView_SetExtendedListViewStyle(this_->hwndList,LVS_EX_FULLROWSELECT);
-
-
- win32_gui_notify( this_->notifications, this_->hwndEdit, CHANGE, notify_textchange);
- win32_gui_notify( this_->notifications, NULL, WINDOW_SIZE, notify_size);
- win32_gui_notify( this_->notifications, this_->hwndList, DBLCLICK, notify_apply);
- win32_gui_notify( this_->notifications, this_->hwnd, WINDOW_DESTROY, notify_destroy);
-
- win32_gui_notify( this_->notifications, this_->hwndButtonNext, BUTTON_CLICK, notify_apply);
- win32_gui_notify( this_->notifications, this_->hwndButtonPrev, BUTTON_CLICK, notify_back);
-
- init_lv_columns(this_->hwndList);
- SetFocus(this_->hwndEdit);
- ShowWindow(this_->hwnd, TRUE);
- UpdateWindow(this_->hwnd);
-
- return this_->hwnd;
-}
-
diff --git a/projs/CodeBlocks/win32gui/win32_gui_notify.c b/projs/CodeBlocks/win32gui/win32_gui_notify.c
deleted file mode 100644
index 1dea1b7a..00000000
--- a/projs/CodeBlocks/win32gui/win32_gui_notify.c
+++ /dev/null
@@ -1,130 +0,0 @@
-#include <windows.h>
-#include <windowsx.h>
-#include <commctrl.h>
-#include <glib.h>
-#include "win32_gui_notify.h"
-
-struct window_data
-{
- HWND hwnd;
- UINT message;
- void(*func)(struct datawindow_priv *parent, int param1, int param2);
-};
-
-struct notify_priv
-{
- GList *window_list;
- struct datawindow_priv *parent;
-
-};
-
-
-void win32_gui_notify(struct notify_priv* notify, HWND hwnd, int message_id, void(*func)(struct datawindow_priv *parent, int param1, int param2))
-{
- struct window_data *wnd_data = g_new( struct window_data,1);
-
- wnd_data->hwnd = hwnd;
- wnd_data->message = message_id;
- wnd_data->func = func;
-
- notify->window_list = g_list_append( notify->window_list, (gpointer) wnd_data );
-
-}
-
-struct notify_priv* win32_gui_notify_new(struct datawindow_priv *parent)
-{
- struct notify_priv* notify = g_new0(struct notify_priv,1);
- notify->parent = parent;
- return notify;
-}
-
-LRESULT CALLBACK message_handler(HWND hwnd, UINT win_message, WPARAM wParam, LPARAM lParam)
-{
- enum message_id message = INVALID;
- int param1 = -1;
- int param2 = -1;
- HWND hwndDlg = hwnd;
-
- switch (win_message)
- {
- case WM_CREATE:
- {
- message = WINDOW_CREATE;
- }
- break;
- case WM_SIZE:
- {
- message = WINDOW_SIZE;
- param1 = LOWORD(lParam);
- param2 = HIWORD(lParam);
- }
- break;
- case WM_DESTROY:
- {
- message = WINDOW_DESTROY;
- }
- break;
- case WM_NOTIFY:
- {
- hwndDlg = (((LPNMHDR)lParam)->hwndFrom);
- switch (((LPNMHDR)lParam)->code)
- {
- case NM_DBLCLK:
- {
- message = DBLCLICK;
- param1 = ((LPNMITEMACTIVATE)lParam)->iItem;
- }
- break;
- case NM_CLICK:
- message = CLICK;
- break;
- }
- }
- break;
- case WM_COMMAND:
- {
- hwndDlg = (HWND)lParam;
-
- switch (HIWORD(wParam))
- {
- case EN_CHANGE:
- {
- message = CHANGE;
- }
- break;
- case BN_CLICKED:
- {
- message = BUTTON_CLICK;
- }
- break;
- }
- }
- break;
-
- default:
- return DefWindowProc(hwnd, win_message, wParam, lParam);
- }
-
- struct notify_priv* notify_data = (struct notify_priv*)GetWindowLongPtr( hwnd , DWLP_USER );
-
- if ( message != INVALID && notify_data && notify_data->window_list )
- {
-
- GList* current_element = g_list_first(notify_data->window_list);
-
-
- struct window_data* wnd_data = NULL;
- while (current_element != NULL)
- {
- wnd_data = current_element->data;
-
- if ( (wnd_data->hwnd == hwndDlg || wnd_data->hwnd == NULL) && message == wnd_data->message)
- {
- wnd_data->func(notify_data->parent, param1, param2);
- }
-
- current_element = g_list_next(current_element);
- }
- }
- return FALSE;
-}
diff --git a/projs/CodeBlocks/win32gui/win32_gui_notify.h b/projs/CodeBlocks/win32gui/win32_gui_notify.h
deleted file mode 100644
index 7c791e15..00000000
--- a/projs/CodeBlocks/win32gui/win32_gui_notify.h
+++ /dev/null
@@ -1,18 +0,0 @@
-
-enum message_id
-{
- WINDOW_CREATE,
- WINDOW_SIZE,
- WINDOW_DESTROY,
- DBLCLICK,
- CLICK,
- CHANGE,
- BUTTON_CLICK,
- INVALID
-
-};
-
-struct datawindow_priv;
-struct notify_priv* win32_gui_notify_new();
-void win32_gui_notify(struct notify_priv* notify, HWND hwnd, int message_id, void(*func)(struct datawindow_priv *parent, int param1, int param2));
-LRESULT CALLBACK message_handler(HWND hwnd, UINT win_message, WPARAM wParam, LPARAM lParam);
diff --git a/projs/CodeBlocks/win32gui/window.c b/projs/CodeBlocks/win32gui/window.c
deleted file mode 100644
index 58569b49..00000000
--- a/projs/CodeBlocks/win32gui/window.c
+++ /dev/null
@@ -1,149 +0,0 @@
-#define WIN32_LEAN_AND_MEAN
-
-#include <windows.h>
-
-#include "resource.h"
-
-HINSTANCE hInst;
-
-BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- switch(uMsg)
- {
- case WM_INITDIALOG:
- /*
- * TODO: Add code to initialize the dialog.
- */
- return TRUE;
-
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- return TRUE;
-
- case WM_COMMAND:
- switch(LOWORD(wParam))
- {
- /*
- * TODO: Add more control ID's, when needed.
- */
- case IDC_BTN_QUIT:
- EndDialog(hwndDlg, 0);
- return TRUE;
-
- case IDC_BTN_TEST:
- MessageBox(hwndDlg, "You clicked \"Test\" button!", "Information", MB_ICONINFORMATION);
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-
-#include <windows.h>
-
-/* Declare Windows procedure */
-LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
-
-/* Make the class name into a global variable */
-char szClassName[ ] = "CodeBlocksWindowsApp";
-
-int WINAPI WinMain1 (HINSTANCE hThisInstance,
- HINSTANCE hPrevInstance,
- LPSTR lpszArgument,
- int nCmdShow)
-{
- HWND hwnd; /* This is the handle for our window */
- MSG messages; /* Here messages to the application are saved */
- WNDCLASSEX wincl; /* Data structure for the windowclass */
-
- /* The Window structure */
- wincl.hInstance = hThisInstance;
- wincl.lpszClassName = szClassName;
- wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */
- wincl.style = CS_DBLCLKS; /* Catch double-clicks */
- wincl.cbSize = sizeof (WNDCLASSEX);
-
- /* Use default icon and mouse-pointer */
- wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
- wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
- wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
- wincl.lpszMenuName = NULL; /* No menu */
- wincl.cbClsExtra = 0; /* No extra bytes after the window class */
- wincl.cbWndExtra = 0; /* structure or the window instance */
- /* Use Windows's default colour as the background of the window */
- wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
-
- /* Register the window class, and if it fails quit the program */
- if (!RegisterClassEx (&wincl))
- return 0;
-
- /* The class is registered, let's create the program*/
- hwnd = CreateWindowEx (
- 0, /* Extended possibilites for variation */
- szClassName, /* Classname */
- "Code::Blocks Template Windows App", /* Title Text */
- WS_OVERLAPPEDWINDOW, /* default window */
- CW_USEDEFAULT, /* Windows decides the position */
- CW_USEDEFAULT, /* where the window ends up on the screen */
- 544, /* The programs width */
- 375, /* and height in pixels */
- HWND_DESKTOP, /* The window is a child-window to desktop */
- NULL, /* No menu */
- hThisInstance, /* Program Instance handler */
- NULL /* No Window Creation data */
- );
-
- /* Make the window visible on the screen */
- ShowWindow (hwnd, nCmdShow);
-
- /* Run the message loop. It will run until GetMessage() returns 0 */
-
-#if 0
- while (GetMessage (&messages, NULL, 0, 0))
- {
- /* Translate virtual-key messages into character messages */
- TranslateMessage(&messages);
- /* Send message to WindowProcedure */
- DispatchMessage(&messages);
- }
-#endif
- /* The program return-value is 0 - The value that PostQuitMessage() gave */
- return messages.wParam;
-}
-
-
-/* This function is called by the Windows function DispatchMessage() */
-
-LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- switch (message) /* handle the messages */
- {
- case WM_MOUSEMOVE:
- {
- int xPos = LOWORD(lParam);
- int yPos = HIWORD(lParam);
- printf( "mouse at %d %d \n", xPos, yPos );
- }
-
- break;
- case WM_DESTROY:
- PostQuitMessage (0); /* send a WM_QUIT to the message queue */
- break;
- default: /* for messages that we don't deal with */
- return DefWindowProc (hwnd, message, wParam, lParam);
- }
-
- return 0;
-}
-
-/*
-
-int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
-{
- hInst = hInstance;
-
- // The user interface is a modal dialog box
- return DialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, DialogProc);
-}
-*/
diff --git a/projs/CodeBlocks/win32gui/xpm2bmp.c b/projs/CodeBlocks/win32gui/xpm2bmp.c
deleted file mode 100644
index 611d8fe0..00000000
--- a/projs/CodeBlocks/win32gui/xpm2bmp.c
+++ /dev/null
@@ -1,589 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <windows.h>
-#include <wingdi.h>
-#include "Xpm2bmp.h"
-
-#define _DBG
-
-// function prototypes
-static int CreateBitmapFromXpm( const char* filename, PXPM2BMP pXpm2bmp );
-
-// typedefs
-static XPMCOLORENTRY theRGBRecords[] =
-{
- {"ALICEBLUE", 240, 248, 255},
- {"ANTIQUEWHITE", 250, 235, 215},
- {"AQUAMARINE", 50, 191, 193},
- {"AZURE", 240, 255, 255},
- {"BEIGE", 245, 245, 220},
- {"BISQUE", 255, 228, 196},
- {"BLACK", 0, 0, 0},
- {"BLANCHEDALMOND", 255, 235, 205},
- {"BLUE", 0, 0, 255},
- {"BLUEVIOLET", 138, 43, 226},
- {"BROWN", 165, 42, 42},
- {"BURLYWOOD", 222, 184, 135},
- {"CADETBLUE", 95, 146, 158},
- {"CHARTREUSE", 127, 255, 0},
- {"CHOCOLATE", 210, 105, 30},
- {"CORAL", 255, 114, 86},
- {"CORNFLOWERBLUE", 34, 34, 152},
- {"CORNSILK", 255, 248, 220},
- {"CYAN", 0, 255, 255},
- {"DARKGOLDENROD", 184, 134, 11},
- {"DARKGREEN", 0, 86, 45},
- {"DARKKHAKI", 189, 183, 107},
- {"DARKOLIVEGREEN", 85, 86, 47},
- {"DARKORANGE", 255, 140, 0},
- {"DARKORCHID", 139, 32, 139},
- {"DARKSALMON", 233, 150, 122},
- {"DARKSEAGREEN", 143, 188, 143},
- {"DARKSLATEBLUE", 56, 75, 102},
- {"DARKSLATEGRAY", 47, 79, 79},
- {"DARKTURQUOISE", 0, 166, 166},
- {"DARKVIOLET", 148, 0, 211},
- {"DEEPPINK", 255, 20, 147},
- {"DEEPSKYBLUE", 0, 191, 255},
- {"DIMGRAY", 84, 84, 84},
- {"DODGERBLUE", 30, 144, 255},
- {"FIREBRICK", 142, 35, 35},
- {"FLORALWHITE", 255, 250, 240},
- {"FORESTGREEN", 80, 159, 105},
- {"GAINSBORO", 220, 220, 220},
- {"GHOSTWHITE", 248, 248, 255},
- {"GOLD", 218, 170, 0},
- {"GOLDENROD", 239, 223, 132},
- {"GRAY", 126, 126, 126},
- {"GRAY0", 0, 0, 0},
- {"GRAY1", 3, 3, 3},
- {"GRAY10", 26, 26, 26},
- {"GRAY100", 255, 255, 255},
- {"GRAY11", 28, 28, 28},
- {"GRAY12", 31, 31, 31},
- {"GRAY13", 33, 33, 33},
- {"GRAY14", 36, 36, 36},
- {"GRAY15", 38, 38, 38},
- {"GRAY16", 41, 41, 41},
- {"GRAY17", 43, 43, 43},
- {"GRAY18", 46, 46, 46},
- {"GRAY19", 48, 48, 48},
- {"GRAY2", 5, 5, 5},
- {"GRAY20", 51, 51, 51},
- {"GRAY21", 54, 54, 54},
- {"GRAY22", 56, 56, 56},
- {"GRAY23", 59, 59, 59},
- {"GRAY24", 61, 61, 61},
- {"GRAY25", 64, 64, 64},
- {"GRAY26", 66, 66, 66},
- {"GRAY27", 69, 69, 69},
- {"GRAY28", 71, 71, 71},
- {"GRAY29", 74, 74, 74},
- {"GRAY3", 8, 8, 8},
- {"GRAY30", 77, 77, 77},
- {"GRAY31", 79, 79, 79},
- {"GRAY32", 82, 82, 82},
- {"GRAY33", 84, 84, 84},
- {"GRAY34", 87, 87, 87},
- {"GRAY35", 89, 89, 89},
- {"GRAY36", 92, 92, 92},
- {"GRAY37", 94, 94, 94},
- {"GRAY38", 97, 97, 97},
- {"GRAY39", 99, 99, 99},
- {"GRAY4", 10, 10, 10},
- {"GRAY40", 102, 102, 102},
- {"GRAY41", 105, 105, 105},
- {"GRAY42", 107, 107, 107},
- {"GRAY43", 110, 110, 110},
- {"GRAY44", 112, 112, 112},
- {"GRAY45", 115, 115, 115},
- {"GRAY46", 117, 117, 117},
- {"GRAY47", 120, 120, 120},
- {"GRAY48", 122, 122, 122},
- {"GRAY49", 125, 125, 125},
- {"GRAY5", 13, 13, 13},
- {"GRAY50", 127, 127, 127},
- {"GRAY51", 130, 130, 130},
- {"GRAY52", 133, 133, 133},
- {"GRAY53", 135, 135, 135},
- {"GRAY54", 138, 138, 138},
- {"GRAY55", 140, 140, 140},
- {"GRAY56", 143, 143, 143},
- {"GRAY57", 145, 145, 145},
- {"GRAY58", 148, 148, 148},
- {"GRAY59", 150, 150, 150},
- {"GRAY6", 15, 15, 15},
- {"GRAY60", 153, 153, 153},
- {"GRAY61", 156, 156, 156},
- {"GRAY62", 158, 158, 158},
- {"GRAY63", 161, 161, 161},
- {"GRAY64", 163, 163, 163},
- {"GRAY65", 166, 166, 166},
- {"GRAY66", 168, 168, 168},
- {"GRAY67", 171, 171, 171},
- {"GRAY68", 173, 173, 173},
- {"GRAY69", 176, 176, 176},
- {"GRAY7", 18, 18, 18},
- {"GRAY70", 179, 179, 179},
- {"GRAY71", 181, 181, 181},
- {"GRAY72", 184, 184, 184},
- {"GRAY73", 186, 186, 186},
- {"GRAY74", 189, 189, 189},
- {"GRAY75", 191, 191, 191},
- {"GRAY76", 194, 194, 194},
- {"GRAY77", 196, 196, 196},
- {"GRAY78", 199, 199, 199},
- {"GRAY79", 201, 201, 201},
- {"GRAY8", 20, 20, 20},
- {"GRAY80", 204, 204, 204},
- {"GRAY81", 207, 207, 207},
- {"GRAY82", 209, 209, 209},
- {"GRAY83", 212, 212, 212},
- {"GRAY84", 214, 214, 214},
- {"GRAY85", 217, 217, 217},
- {"GRAY86", 219, 219, 219},
- {"GRAY87", 222, 222, 222},
- {"GRAY88", 224, 224, 224},
- {"GRAY89", 227, 227, 227},
- {"GRAY9", 23, 23, 23},
- {"GRAY90", 229, 229, 229},
- {"GRAY91", 232, 232, 232},
- {"GRAY92", 235, 235, 235},
- {"GRAY93", 237, 237, 237},
- {"GRAY94", 240, 240, 240},
- {"GRAY95", 242, 242, 242},
- {"GRAY96", 245, 245, 245},
- {"GRAY97", 247, 247, 247},
- {"GRAY98", 250, 250, 250},
- {"GRAY99", 252, 252, 252},
- {"GREEN", 0, 255, 0},
- {"GREENYELLOW", 173, 255, 47},
- {"HONEYDEW", 240, 255, 240},
- {"HOTPINK", 255, 105, 180},
- {"INDIANRED", 107, 57, 57},
- {"IVORY", 255, 255, 240},
- {"KHAKI", 179, 179, 126},
- {"LAVENDER", 230, 230, 250},
- {"LAVENDERBLUSH", 255, 240, 245},
- {"LAWNGREEN", 124, 252, 0},
- {"LEMONCHIFFON", 255, 250, 205},
- {"LIGHTBLUE", 176, 226, 255},
- {"LIGHTCORAL", 240, 128, 128},
- {"LIGHTCYAN", 224, 255, 255},
- {"LIGHTGOLDENROD", 238, 221, 130},
- {"LIGHTGOLDENRODYELLOW", 250, 250, 210},
- {"LIGHTGRAY", 168, 168, 168},
- {"LIGHTPINK", 255, 182, 193},
- {"LIGHTSALMON", 255, 160, 122},
- {"LIGHTSEAGREEN", 32, 178, 170},
- {"LIGHTSKYBLUE", 135, 206, 250},
- {"LIGHTSLATEBLUE", 132, 112, 255},
- {"LIGHTSLATEGRAY", 119, 136, 153},
- {"LIGHTSTEELBLUE", 124, 152, 211},
- {"LIGHTYELLOW", 255, 255, 224},
- {"LIMEGREEN", 0, 175, 20},
- {"LINEN", 250, 240, 230},
- {"MAGENTA", 255, 0, 255},
- {"MAROON", 143, 0, 82},
- {"MEDIUMAQUAMARINE", 0, 147, 143},
- {"MEDIUMBLUE", 50, 50, 204},
- {"MEDIUMFORESTGREEN", 50, 129, 75},
- {"MEDIUMGOLDENROD", 209, 193, 102},
- {"MEDIUMORCHID", 189, 82, 189},
- {"MEDIUMPURPLE", 147, 112, 219},
- {"MEDIUMSEAGREEN", 52, 119, 102},
- {"MEDIUMSLATEBLUE", 106, 106, 141},
- {"MEDIUMSPRINGGREEN", 35, 142, 35},
- {"MEDIUMTURQUOISE", 0, 210, 210},
- {"MEDIUMVIOLETRED", 213, 32, 121},
- {"MIDNIGHTBLUE", 47, 47, 100},
- {"MINTCREAM", 245, 255, 250},
- {"MISTYROSE", 255, 228, 225},
- {"MOCCASIN", 255, 228, 181},
- {"NAVAJOWHITE", 255, 222, 173},
- {"NAVY", 35, 35, 117},
- {"NAVYBLUE", 35, 35, 117},
- {"OLDLACE", 253, 245, 230},
- {"OLIVEDRAB", 107, 142, 35},
- {"ORANGE", 255, 135, 0},
- {"ORANGERED", 255, 69, 0},
- {"ORCHID", 239, 132, 239},
- {"PALEGOLDENROD", 238, 232, 170},
- {"PALEGREEN", 115, 222, 120},
- {"PALETURQUOISE", 175, 238, 238},
- {"PALEVIOLETRED", 219, 112, 147},
- {"PAPAYAWHIP", 255, 239, 213},
- {"PEACHPUFF", 255, 218, 185},
- {"PERU", 205, 133, 63},
- {"PINK", 255, 181, 197},
- {"PLUM", 197, 72, 155},
- {"POWDERBLUE", 176, 224, 230},
- {"PURPLE", 160, 32, 240},
- {"RED", 255, 0, 0},
- {"ROSYBROWN", 188, 143, 143},
- {"ROYALBLUE", 65, 105, 225},
- {"SADDLEBROWN", 139, 69, 19},
- {"SALMON", 233, 150, 122},
- {"SANDYBROWN", 244, 164, 96},
- {"SEAGREEN", 82, 149, 132},
- {"SEASHELL", 255, 245, 238},
- {"SIENNA", 150, 82, 45},
- {"SKYBLUE", 114, 159, 255},
- {"SLATEBLUE", 126, 136, 171},
- {"SLATEGRAY", 112, 128, 144},
- {"SNOW", 255, 250, 250},
- {"SPRINGGREEN", 65, 172, 65},
- {"STEELBLUE", 84, 112, 170},
- {"TAN", 222, 184, 135},
- {"THISTLE", 216, 191, 216},
- {"TOMATO", 255, 99, 71},
- {"TRANSPARENT", 0, 0, 1},
- {"TURQUOISE", 25, 204, 223},
- {"VIOLET", 156, 62, 206},
- {"VIOLETRED", 243, 62, 150},
- {"WHEAT", 245, 222, 179},
- {"WHITE", 255, 255, 255},
- {"WHITESMOKE", 245, 245, 245},
- {"YELLOW", 255, 255, 0},
- {"YELLOWGREEN", 50, 216, 56}
-};
-
-
-PXPM2BMP Xpm2bmp_new()
-{
- PXPM2BMP preturn = (PXPM2BMP)calloc( sizeof( XPM2BMP ) , 1 );
- return preturn;
-}
-
-
-int Xpm2bmp_load( PXPM2BMP pXpm2bmp, const char* filename )
-{
- return CreateBitmapFromXpm( filename, pXpm2bmp );
-}
-
-int Xpm2bmp_paint( PXPM2BMP pXpm2bmp, HDC hdc, int x1,int y1 )
-{
- StretchDIBits(hdc,
- x1, y1, pXpm2bmp->size_x, pXpm2bmp->size_y,
- 0, 0, pXpm2bmp->size_x, pXpm2bmp->size_y,
- pXpm2bmp->wimage_data_trans,
- (BITMAPINFO *)pXpm2bmp->bmih_trans,
- DIB_RGB_COLORS,
- SRCAND );
-
- StretchDIBits(hdc,
- x1, y1, pXpm2bmp->size_x, pXpm2bmp->size_y,
- 0, 0, pXpm2bmp->size_x, pXpm2bmp->size_y,
- pXpm2bmp->wimage_data,
- (BITMAPINFO *)pXpm2bmp->bmih,
- DIB_RGB_COLORS,
- SRCPAINT );
-
- return 0;
-}
-
-static int parse_line_values( const char* line, PXPM2BMP pXpm2bmp )
-{
- int return_value = 0;
- char* parse_line = (char*)line;
- char* tok;
- int value_pos = 0;
-
- parse_line = strchr( parse_line, '"' );
- parse_line++;
-
- tok = strtok( parse_line, " \t\n" );
-
- while ( tok != 0 )
- {
- int val = atoi( tok );
- switch ( value_pos )
- {
- case 0: pXpm2bmp->size_x = val; break;
- case 1: pXpm2bmp->size_y = val; break;
- case 2: pXpm2bmp->colors = val; break;
- case 3: pXpm2bmp->chars_per_pixel = val; break;
- case 4: pXpm2bmp->hotspot_x = val; break;
- case 5: pXpm2bmp->hotspot_y = val; break;
- }
- tok = strtok( NULL, " \t" );
- value_pos ++;
-
- }
-
- return return_value;
-}
-
-static int hex2int( char c )
-{
- if ((c >= '0') && (c <='9' )) return c - '0';
- if ((c >= 'A') && (c <= 'F')) return c - 'A' + 10;
- if ((c >= 'a') && (c <= 'f')) return c - 'a' + 10;
- return -1;
-}
-
-static DWORD string2hex16( const char* str )
-{
- int i1 = hex2int( str[0] );
- int i2 = hex2int( str[1] );
- if ( ( i1 >= 0 ) && ( i2 >= 0 ) )
- return i1*16+i2;
- return -1;
-}
-
-static int parse_color_values( const char* line, PXPM2BMP pXpm2bmp )
-{
- int return_value = 0;
- char* cq = strchr( line, '"' );
- char* cchar = strchr( cq+pXpm2bmp->chars_per_pixel+1, 'c' );
- char* chash = strchr( cq+pXpm2bmp->chars_per_pixel+1, '#' );
- char* qe = strchr( cq+pXpm2bmp->chars_per_pixel+1, '"' );
-
- cq++;
-
- if ( cq )
- {
- memcpy( pXpm2bmp->color_entires[ pXpm2bmp-> color_entires_size].color_str, cq, pXpm2bmp->chars_per_pixel + 1 );
- pXpm2bmp->color_entires[ pXpm2bmp-> color_entires_size].color_str[ pXpm2bmp->chars_per_pixel ] = '\0';
-
-
- if ( cchar && chash && qe)
- {
- chash++;
- *qe = 0;
- int len = strlen( chash );
-
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].r = string2hex16( &chash[0] );
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].g = string2hex16( &chash[len / 3] );
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].b = string2hex16( &chash[len * 2 / 3] );
-#ifdef _DBG
-printf( "adding color %s => %d RGB %lx %lx %lx to index %d\n",
- line,
- pXpm2bmp->color_entires_size,
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].r,
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].g,
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].b,
- pXpm2bmp->color_entires_size );
-#endif
- }
- else
- {
- int q;
- char *start = cchar + 1;
- char *end = start;
-
- while ( *start != 0 )
- {
- if ( ( *start != '\t' ) && ( *start != ' ' ) )
- {
- break;
- }
- start++;
- }
-
- end = start;
- while ( *end != 0 )
- {
- if ( ( *end == '\t' ) || ( *end == ' ' ) || ( *end == '"' ))
- {
- *end = 0;
- }
- end++;
- }
-
- start = strupr( start );
-
- for ( q=0; q < sizeof( theRGBRecords ) / sizeof( theRGBRecords[0] ); q++ )
- {
-
- if ( 0 == strcmp( start, theRGBRecords[q].color_str ) )
- {
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].r = theRGBRecords[q].r;
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].g = theRGBRecords[q].g;
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].b = theRGBRecords[q].b;
- }
- }
- if ( 0 == strcmp( start, "NONE" ) )
- {
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].r = 255;
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].g = 0;
- pXpm2bmp->color_entires[ pXpm2bmp->color_entires_size].b = 255;
- }
- }
- }
- pXpm2bmp->color_entires_size++;
-
- return return_value;
-}
-
-static int vv = 0;
-
-static int parse_pixel_line_values( const char* line, PXPM2BMP pXpm2bmp, unsigned char* pixel_data, unsigned char* pixel_data_trans )
-{
- int return_value = 0;
- int i,j;
-
-
- char* cq = strchr( line, '"' );
- int pix_idx = 0;
- int size_x = pXpm2bmp->size_x;
- int len = strlen( cq );
-
- cq++;
-
- if ( len > pXpm2bmp->chars_per_pixel * size_x )
- {
- for ( i=0; i< size_x; i++ )
- {
- int found = 0;
- char* cmp = &cq[ i * pXpm2bmp->chars_per_pixel];
-
- for ( j=0; j< pXpm2bmp-> color_entires_size; j++ )
- {
- if ( strncmp( cmp, pXpm2bmp->color_entires[ j ].color_str, pXpm2bmp->chars_per_pixel ) == 0 )
- {
- int r = pXpm2bmp->color_entires[ j ].r;
- int g = pXpm2bmp->color_entires[ j ].g;
- int b = pXpm2bmp->color_entires[ j ].b;
-
- if ( ( r == 255 ) && ( g == 0 ) && ( r == 255 ) )
- {
- r=g=b=0;
- pixel_data_trans[ pix_idx ] = 255;
- pixel_data_trans[ pix_idx+1 ] = 255;
- pixel_data_trans[ pix_idx+2 ] = 255;
- }
- else
- {
- pixel_data_trans[ pix_idx ] = 0;
- pixel_data_trans[ pix_idx+1 ] = 0;
- pixel_data_trans[ pix_idx+2 ] = 0;
- }
-
- // pixel_data[ pix_idx++ ] = pXpm2bmp->color_entires[ j ].r;
- // pixel_data[ pix_idx++ ] = pXpm2bmp->color_entires[ j ].g;
- // pixel_data[ pix_idx++ ] = pXpm2bmp->color_entires[ j ].b;
- pixel_data[ pix_idx++ ] = b;
- pixel_data[ pix_idx++ ] = g;
- pixel_data[ pix_idx++ ] = r;
- found = 1;
- vv++;
- break;
- }
- }
- if ( !found )
- {
- fprintf( stderr, "XPMLIB: error color not found\n" );
- }
-
- }
- }
- else
- {
- return_value = -1;
- fprintf( stderr, "XPMLIB: invalid line length\n" );
- }
- return return_value;
-}
-
-
-static int CreateBitmapFromXpm( const char* filename, PXPM2BMP pXpm2bmp )
-{
- int return_val = 0;
- unsigned char i, row;
- char line[ 1024 ];
- int nbytes ;
- FILE* file_xpm = fopen( filename, "r" );
-
- int phase = 0;
- row = 0;
-
- if ( file_xpm )
- {
- while ( fgets(line, sizeof( line ), file_xpm ) )
- {
-#ifdef _DBG
- printf( "PARSING: %s\n", line );
-#endif
- if ( line[ 0 ] != '"' )
- continue;
-
- switch ( phase )
- {
- case 0:
- parse_line_values( line, pXpm2bmp );
-#ifdef _DBG
- printf( "size_x %d\n", pXpm2bmp->size_x );
- printf( "size_y %d\n", pXpm2bmp->size_y );
-#endif
- phase = 1;
-
- pXpm2bmp->color_entires_size = 0;
- nbytes = ( pXpm2bmp->chars_per_pixel + 1 ) * pXpm2bmp->colors;
-
- pXpm2bmp->color_entires = calloc( sizeof( XPMCOLORENTRY ), pXpm2bmp->colors + 100 );
- pXpm2bmp->color_entires[0].color_str = calloc( nbytes, pXpm2bmp->colors );
- for ( i = 1; i< pXpm2bmp->colors; i++ )
- {
- pXpm2bmp->color_entires[i].color_str = pXpm2bmp->color_entires[0].color_str + ( pXpm2bmp->chars_per_pixel + 1 ) * i;
- }
-
- if (!(pXpm2bmp->dib = (unsigned char *)malloc(sizeof(BITMAPINFOHEADER) + pXpm2bmp->size_x * pXpm2bmp->size_y * 3)))
- {
- return 4;
- }
- if (!(pXpm2bmp->dib_trans = (unsigned char *)calloc(sizeof(BITMAPINFOHEADER) + pXpm2bmp->size_x * pXpm2bmp->size_y * 3,1)))
- {
- return 4;
- }
-
- memset(pXpm2bmp->dib, 0, sizeof(BITMAPINFOHEADER));
- pXpm2bmp->bmih = (BITMAPINFOHEADER *)pXpm2bmp->dib;
- pXpm2bmp->bmih->biSize = sizeof(BITMAPINFOHEADER);
- pXpm2bmp->bmih->biWidth = pXpm2bmp->size_x;
- pXpm2bmp->bmih->biHeight = -((long)pXpm2bmp->size_y);
- pXpm2bmp->bmih->biPlanes = 1;
- pXpm2bmp->bmih->biBitCount = 24;
- pXpm2bmp->bmih->biCompression = 0;
- pXpm2bmp->wimage_data = pXpm2bmp->dib + sizeof(BITMAPINFOHEADER);
-
-
- pXpm2bmp->bmih_trans = (BITMAPINFOHEADER *)pXpm2bmp->dib_trans;
- pXpm2bmp->bmih_trans->biSize = sizeof(BITMAPINFOHEADER);
- pXpm2bmp->bmih_trans->biWidth = pXpm2bmp->size_x;
- pXpm2bmp->bmih_trans->biHeight = -((long)pXpm2bmp->size_y);
- pXpm2bmp->bmih_trans->biPlanes = 1;
- pXpm2bmp->bmih_trans->biBitCount = 24;
- pXpm2bmp->bmih_trans->biCompression = 0;
- pXpm2bmp->wimage_data_trans = pXpm2bmp->dib_trans + sizeof(BITMAPINFOHEADER);
-// memset( pXpm2bmp->wimage_data_trans, 255, 5* 22 * 3 );
-
- break;
- case 1:
- parse_color_values( line, pXpm2bmp );
- if ( pXpm2bmp->color_entires_size >= pXpm2bmp->colors )
- {
- phase = 2;
- }
-
- break;
- case 2:
- parse_pixel_line_values( line, pXpm2bmp,
- pXpm2bmp->wimage_data + row * pXpm2bmp->size_x * 3,
- pXpm2bmp->wimage_data_trans + row * pXpm2bmp->size_x * 3 );
-
- row++;
- if ( row >= pXpm2bmp->size_y )
- {
- phase = 3;
- }
- break;
- }
-
- }
-
- fclose( file_xpm );
- }
- return return_val;
-}
diff --git a/projs/CodeBlocks/win32gui/xpm2bmp.h b/projs/CodeBlocks/win32gui/xpm2bmp.h
deleted file mode 100644
index 2fa028f1..00000000
--- a/projs/CodeBlocks/win32gui/xpm2bmp.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef Xpm2BMP_H_INCLUDED
-#define Xpm2BMP_H_INCLUDED
-
-#include <windows.h>
-#include "wingdi.h"
-
-typedef struct XPMCOLORENTRY_TAG
-{
- char* color_str;
- unsigned long r;
- unsigned long g;
- unsigned long b;
-} XPMCOLORENTRY, *PXPMCOLORENTRY;
-
-typedef struct XPM2BMP_TAG
-{
- unsigned short size_x;
- unsigned short size_y;
- unsigned short colors;
- unsigned short pixels;
- unsigned short chars_per_pixel;
- unsigned short hotspot_x;
- unsigned short hotspot_y;
-
- int color_entires_size;
- PXPMCOLORENTRY color_entires;
-
- unsigned char *dib;
- unsigned char *wimage_data;
- BITMAPINFOHEADER *bmih;
-
- unsigned char *dib_trans;
- unsigned char *wimage_data_trans;
- BITMAPINFOHEADER *bmih_trans;
-
-} XPM2BMP, *PXPM2BMP;
-
-
-PXPM2BMP Xpm2bmp_new();
-int Xpm2bmp_load( PXPM2BMP pXpm2bmp, const char* filename );
-int Xpm2bmp_paint( PXPM2BMP pXpm2bmp, HDC hdc, int x1,int y1 );
-
-
-#endif // Xpm2BMP_H_INCLUDED
diff --git a/roadprofile.c b/roadprofile.c
new file mode 100644
index 00000000..07c29299
--- /dev/null
+++ b/roadprofile.c
@@ -0,0 +1,79 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include "debug.h"
+#include "item.h"
+#include "roadprofile.h"
+
+static void
+roadprofile_set_attr_do(struct roadprofile *this, struct attr *attr)
+{
+ switch (attr->type) {
+ case attr_speed:
+ this->speed=attr->u.num;
+ break;
+ case attr_route_weight:
+ this->route_weight=attr->u.num;
+ break;
+ default:
+ break;
+ }
+}
+
+struct roadprofile *
+roadprofile_new(struct attr *parent, struct attr **attrs)
+{
+ struct roadprofile *this_;
+ struct attr **attr;
+ this_=g_new0(struct roadprofile, 1);
+ this_->attrs=attr_list_dup(attrs);
+ for (attr=attrs;*attr; attr++)
+ roadprofile_set_attr_do(this_, *attr);
+ return this_;
+}
+
+int
+roadprofile_get_attr(struct roadprofile *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
+{
+ return attr_generic_get_attr(this_->attrs, NULL, type, attr, iter);
+}
+
+int
+roadprofile_set_attr(struct roadprofile *this_, struct attr *attr)
+{
+ roadprofile_set_attr_do(this_, attr);
+ this_->attrs=attr_generic_set_attr(this_->attrs, attr);
+ return 1;
+}
+
+int
+roadprofile_add_attr(struct roadprofile *this_, struct attr *attr)
+{
+ this_->attrs=attr_generic_add_attr(this_->attrs, attr);
+ return 1;
+}
+
+int
+roadprofile_remove_attr(struct roadprofile *this_, struct attr *attr)
+{
+ this_->attrs=attr_generic_remove_attr(this_->attrs, attr);
+ return 1;
+}
+
diff --git a/roadprofile.h b/roadprofile.h
new file mode 100644
index 00000000..04d7263e
--- /dev/null
+++ b/roadprofile.h
@@ -0,0 +1,30 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+struct roadprofile {
+ struct attr **attrs;
+ int speed;
+ int route_weight;
+};
+
+struct roadprofile * roadprofile_new(struct attr *parent, struct attr **attrs);
+int roadprofile_get_attr(struct roadprofile *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
+int roadprofile_set_attr(struct roadprofile *this_, struct attr *attr);
+int roadprofile_add_attr(struct roadprofile *this_, struct attr *attr);
+int roadprofile_remove_attr(struct roadprofile *this_, struct attr *attr);
diff --git a/route.c b/route.c
new file mode 100644
index 00000000..7f989833
--- /dev/null
+++ b/route.c
@@ -0,0 +1,3170 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/** @file
+ * @brief Contains code related to finding a route from a position to a destination
+ *
+ * Routing uses segments, points and items. Items are items from the map: Streets, highways, etc.
+ * Segments represent such items, or parts of it. Generally, a segment is a driveable path. An item
+ * can be represented by more than one segment - in that case it is "segmented". Each segment has an
+ * "offset" associated, that indicates at which position in a segmented item this segment is - a
+ * segment representing a not-segmented item always has the offset 1.
+ * A point is located at the end of segments, often connecting several segments.
+ *
+ * The code in this file will make navit find a route between a position and a destination.
+ * It accomplishes this by first building a "route graph". This graph contains segments and
+ * points.
+ *
+ * After building this graph in route_graph_build(), the function route_graph_flood() assigns every
+ * point and segment a "value" which represents the "costs" of traveling from this point to the
+ * destination. This is done by Dijkstra's algorithm.
+ *
+ * When the graph is built a "route path" is created, which is a path in this graph from a given
+ * position to the destination determined at time of building the graph.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#if 0
+#include <math.h>
+#include <assert.h>
+#include <unistd.h>
+#include <sys/time.h>
+#endif
+#include <glib.h>
+#include "config.h"
+#include "debug.h"
+#include "profile.h"
+#include "coord.h"
+#include "projection.h"
+#include "item.h"
+#include "map.h"
+#include "mapset.h"
+#include "route.h"
+#include "track.h"
+#include "point.h"
+#include "graphics.h"
+#include "transform.h"
+#include "plugin.h"
+#include "fib.h"
+#include "event.h"
+#include "callback.h"
+#include "vehicleprofile.h"
+#include "roadprofile.h"
+
+
+struct map_priv {
+ struct route *route;
+};
+
+int debug_route=0;
+
+/**
+ * @brief A point in the route graph
+ *
+ * This represents a point in the route graph. A point usually connects two or more segments,
+ * but there are also points which don't do that (e.g. at the end of a dead-end).
+ */
+struct route_graph_point {
+ struct route_graph_point *hash_next; /**< Pointer to a chained hashlist of all route_graph_points with this hash */
+ struct route_graph_segment *start; /**< Pointer to a list of segments of which this point is the start. The links
+ * of this linked-list are in route_graph_segment->start_next.*/
+ struct route_graph_segment *end; /**< Pointer to a list of segments of which this pointer is the end. The links
+ * of this linked-list are in route_graph_segment->end_next. */
+ struct route_graph_segment *seg; /**< Pointer to the segment one should use to reach the destination at
+ * least costs */
+ struct fibheap_el *el; /**< When this point is put on a Fibonacci heap, this is a pointer
+ * to this point's heap-element */
+ int value; /**< The cost at which one can reach the destination from this point on */
+ struct coord c; /**< Coordinates of this point */
+ int flags; /**< Flags for this point (eg traffic distortion) */
+};
+
+#define RP_TRAFFIC_DISTORTION 1
+#define RP_TURN_RESTRICTION 2
+#define RP_TURN_RESTRICTION_RESOLVED 4
+
+/**
+ * @brief A segment in the route graph or path
+ *
+ * This is a segment in the route graph or path. A segment represents a driveable way.
+ */
+
+struct route_segment_data {
+ struct item item; /**< The item (e.g. street) that this segment represents. */
+ int flags;
+ int len; /**< Length of this segment */
+ /*NOTE: After a segment, various fields may follow, depending on what flags are set. Order of fields:
+ 1.) maxspeed Maximum allowed speed on this segment. Present if AF_SPEED_LIMIT is set.
+ 2.) offset If the item is segmented (i.e. represented by more than one segment), this
+ indicates the position of this segment in the item. Present if AF_SEGMENTED is set.
+ */
+};
+
+#define RSD_OFFSET(x) *((int *)route_segment_data_field_pos((x), attr_offset))
+#define RSD_MAXSPEED(x) *((int *)route_segment_data_field_pos((x), attr_maxspeed))
+
+
+
+/**
+ * @brief A segment in the route graph
+ *
+ * This is a segment in the route graph. A segment represents a driveable way.
+ */
+struct route_graph_segment {
+ struct route_graph_segment *next; /**< Linked-list pointer to a list of all route_graph_segments */
+ struct route_graph_segment *start_next; /**< Pointer to the next element in the list of segments that start at the
+ * same point. Start of this list is in route_graph_point->start. */
+ struct route_graph_segment *end_next; /**< Pointer to the next element in the list of segments that end at the
+ * same point. Start of this list is in route_graph_point->end. */
+ struct route_graph_point *start; /**< Pointer to the point this segment starts at. */
+ struct route_graph_point *end; /**< Pointer to the point this segment ends at. */
+ struct route_segment_data data; /**< The segment data */
+};
+
+/**
+ * @brief A traffic distortion
+ *
+ * This is distortion in the traffic where you can't drive as fast as usual or have to wait for some time
+ */
+struct route_traffic_distortion {
+ int maxspeed; /**< Maximum speed possible in km/h */
+ int delay; /**< Delay in tenths of seconds */
+};
+
+/**
+ * @brief A segment in the route path
+ *
+ * This is a segment in the route path.
+ */
+struct route_path_segment {
+ struct route_path_segment *next; /**< Pointer to the next segment in the path */
+ struct route_segment_data *data; /**< The segment data */
+ int direction; /**< Order in which the coordinates are ordered. >0 means "First
+ * coordinate of the segment is the first coordinate of the item", <=0
+ * means reverse. */
+ unsigned ncoords; /**< How many coordinates does this segment have? */
+ struct coord c[0]; /**< Pointer to the ncoords coordinates of this segment */
+ /* WARNING: There will be coordinates following here, so do not create new fields after c! */
+};
+
+/**
+ * @brief Usually represents a destination or position
+ *
+ * This struct usually represents a destination or position
+ */
+struct route_info {
+ struct coord c; /**< The actual destination / position */
+ struct coord lp; /**< The nearest point on a street to c */
+ int pos; /**< The position of lp within the coords of the street */
+ int lenpos; /**< Distance between lp and the end of the street */
+ int lenneg; /**< Distance between lp and the start of the street */
+ int lenextra; /**< Distance between lp and c */
+ int percent; /**< ratio of lenneg to lenght of whole street in percent */
+ struct street_data *street; /**< The street lp is on */
+ int street_direction; /**< Direction of vehicle on street -1 = Negative direction, 1 = Positive direction, 0 = Unknown */
+ int dir; /**< Direction to take when following the route -1 = Negative direction, 1 = Positive direction */
+};
+
+/**
+ * @brief A complete route path
+ *
+ * This structure describes a whole routing path
+ */
+struct route_path {
+ int in_use; /**< The path is in use and can not be updated */
+ int update_required; /**< The path needs to be updated after it is no longer in use */
+ int updated; /**< The path has only been updated */
+ struct route_path_segment *path; /**< The first segment in the path, i.e. the segment one should
+ * drive in next */
+ struct route_path_segment *path_last; /**< The last segment in the path */
+ /* XXX: path_hash is not necessery now */
+ struct item_hash *path_hash; /**< A hashtable of all the items represented by this route's segements */
+};
+
+/**
+ * @brief A complete route
+ *
+ * This struct holds all information about a route.
+ */
+struct route {
+ struct mapset *ms; /**< The mapset this route is built upon */
+ unsigned flags;
+ struct route_info *pos; /**< Current position within this route */
+ struct route_info *dst; /**< Destination of the route */
+
+ struct route_graph *graph; /**< Pointer to the route graph */
+ struct route_path *path2; /**< Pointer to the route path */
+ struct map *map;
+ struct map *graph_map;
+ struct callback * route_graph_done_cb ; /**< Callback when route graph is done */
+ struct callback * route_graph_flood_done_cb ; /**< Callback when route graph flooding is done */
+ struct callback_list *cbl2; /**< Callback list to call when route changes */
+ int destination_distance; /**< Distance to the destination at which the destination is considered "reached" */
+ struct vehicleprofile *vehicleprofile; /**< Routing preferences */
+ int route_status; /**< Route Status */
+};
+
+/**
+ * @brief A complete route graph
+ *
+ * This structure describes a whole routing graph
+ */
+struct route_graph {
+ int busy; /**< The graph is being built */
+ struct map_selection *sel; /**< The rectangle selection for the graph */
+ struct mapset_handle *h; /**< Handle to the mapset */
+ struct map *m; /**< Pointer to the currently active map */
+ struct map_rect *mr; /**< Pointer to the currently active map rectangle */
+ struct vehicleprofile *vehicleprofile; /**< The vehicle profile */
+ struct callback *idle_cb; /**< Idle callback to process the graph */
+ struct callback *done_cb; /**< Callback when graph is done */
+ struct event_idle *idle_ev; /**< The pointer to the idle event */
+ struct route_graph_segment *route_segments; /**< Pointer to the first route_graph_segment in the linked list of all segments */
+#define HASH_SIZE 8192
+ struct route_graph_point *hash[HASH_SIZE]; /**< A hashtable containing all route_graph_points in this graph */
+};
+
+#define HASHCOORD(c) ((((c)->x +(c)->y) * 2654435761UL) & (HASH_SIZE-1))
+
+/**
+ * @brief Iterator to iterate through all route graph segments in a route graph point
+ *
+ * This structure can be used to iterate through all route graph segments connected to a
+ * route graph point. Use this with the rp_iterator_* functions.
+ */
+struct route_graph_point_iterator {
+ struct route_graph_point *p; /**< The route graph point whose segments should be iterated */
+ int end; /**< Indicates if we have finished iterating through the "start" segments */
+ struct route_graph_segment *next; /**< The next segment to be returned */
+};
+
+static struct route_info * route_find_nearest_street(struct vehicleprofile *vehicleprofile, struct mapset *ms, struct pcoord *c);
+static struct route_graph_point *route_graph_get_point(struct route_graph *this, struct coord *c);
+static void route_graph_update(struct route *this, struct callback *cb, int async);
+static void route_graph_build_done(struct route_graph *rg, int cancel);
+static struct route_path *route_path_new(struct route_graph *this, struct route_path *oldpath, struct route_info *pos, struct route_info *dst, struct vehicleprofile *profile);
+static void route_process_street_graph(struct route_graph *this, struct item *item);
+static void route_graph_destroy(struct route_graph *this);
+static void route_path_update(struct route *this, int cancel, int async);
+
+/**
+ * @brief Returns the projection used for this route
+ *
+ * @param route The route to return the projection for
+ * @return The projection used for this route
+ */
+static enum projection route_projection(struct route *route)
+{
+ struct street_data *street;
+ if (!route->pos && !route->dst)
+ return projection_none;
+ street = route->pos ? route->pos->street : route->dst->street;
+ if (!street || !street->item.map)
+ return projection_none;
+ return map_projection(street->item.map);
+}
+
+/**
+ * @brief Creates a new graph point iterator
+ *
+ * This function creates a new route graph point iterator, that can be used to
+ * iterate through all segments connected to the point.
+ *
+ * @param p The route graph point to create the iterator from
+ * @return A new iterator.
+ */
+static struct route_graph_point_iterator
+rp_iterator_new(struct route_graph_point *p)
+{
+ struct route_graph_point_iterator it;
+
+ it.p = p;
+ if (p->start) {
+ it.next = p->start;
+ it.end = 0;
+ } else {
+ it.next = p->end;
+ it.end = 1;
+ }
+
+ return it;
+}
+
+/**
+ * @brief Gets the next segment connected to a route graph point from an iterator
+ *
+ * @param it The route graph point iterator to get the segment from
+ * @return The next segment or NULL if there are no more segments
+ */
+static struct route_graph_segment
+*rp_iterator_next(struct route_graph_point_iterator *it)
+{
+ struct route_graph_segment *ret;
+
+ ret = it->next;
+ if (!ret) {
+ return NULL;
+ }
+
+ if (!it->end) {
+ if (ret->start_next) {
+ it->next = ret->start_next;
+ } else {
+ it->next = it->p->end;
+ it->end = 1;
+ }
+ } else {
+ it->next = ret->end_next;
+ }
+
+ return ret;
+}
+
+/**
+ * @brief Checks if the last segment returned from a route_graph_point_iterator comes from the end
+ *
+ * @param it The route graph point iterator to be checked
+ * @return 1 if the last segment returned comes from the end of the route graph point, 0 otherwise
+ */
+static int
+rp_iterator_end(struct route_graph_point_iterator *it) {
+ if (it->end && (it->next != it->p->end)) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+/**
+ * @brief Destroys a route_path
+ *
+ * @param this The route_path to be destroyed
+ */
+static void
+route_path_destroy(struct route_path *this)
+{
+ struct route_path_segment *c,*n;
+ if (! this)
+ return;
+ if (this->path_hash) {
+ item_hash_destroy(this->path_hash);
+ this->path_hash=NULL;
+ }
+ c=this->path;
+ while (c) {
+ n=c->next;
+ g_free(c);
+ c=n;
+ }
+ g_free(this);
+}
+
+/**
+ * @brief Creates a completely new route structure
+ *
+ * @param attrs Not used
+ * @return The newly created route
+ */
+struct route *
+route_new(struct attr *parent, struct attr **attrs)
+{
+ struct route *this=g_new0(struct route, 1);
+ struct attr dest_attr;
+
+ if (attr_generic_get_attr(attrs, NULL, attr_destination_distance, &dest_attr, NULL)) {
+ this->destination_distance = dest_attr.u.num;
+ } else {
+ this->destination_distance = 50; // Default value
+ }
+ this->cbl2=callback_list_new();
+
+ return this;
+}
+
+/**
+ * @brief Checks if a segment is part of a roundabout
+ *
+ * This function checks if a segment is part of a roundabout.
+ *
+ * @param seg The segment to be checked
+ * @param level How deep to scan the route graph
+ * @param direction Set this to 1 if we're entering the segment through its end, to 0 otherwise
+ * @param origin Used internally, set to NULL
+ * @return 1 If a roundabout was detected, 0 otherwise
+ */
+static int
+route_check_roundabout(struct route_graph_segment *seg, int level, int direction, struct route_graph_segment *origin)
+{
+ struct route_graph_point_iterator it,it2;
+ struct route_graph_segment *cur;
+ int count=0;
+
+ if (!level) {
+ return 0;
+ }
+ if (!direction && !(seg->data.flags & AF_ONEWAY)) {
+ return 0;
+ }
+ if (direction && !(seg->data.flags & AF_ONEWAYREV)) {
+ return 0;
+ }
+ if (seg->data.flags & AF_ROUNDABOUT_VALID)
+ return 0;
+
+ if (!origin) {
+ origin = seg;
+ }
+
+ if (!direction) {
+ it = rp_iterator_new(seg->end);
+ } else {
+ it = rp_iterator_new(seg->start);
+ }
+ it2=it;
+
+ while ((cur = rp_iterator_next(&it2)))
+ count++;
+
+ if (count > 3)
+ return 0;
+ cur = rp_iterator_next(&it);
+ while (cur) {
+ if (cur == seg) {
+ cur = rp_iterator_next(&it);
+ continue;
+ }
+
+ if (cur->data.item.type != origin->data.item.type) {
+ // This street is of another type, can't be part of the roundabout
+ cur = rp_iterator_next(&it);
+ continue;
+ }
+
+ if (cur == origin) {
+ seg->data.flags |= AF_ROUNDABOUT;
+ return 1;
+ }
+
+ if (route_check_roundabout(cur, (level-1), rp_iterator_end(&it), origin)) {
+ seg->data.flags |= AF_ROUNDABOUT;
+ return 1;
+ }
+
+ cur = rp_iterator_next(&it);
+ }
+
+ return 0;
+}
+
+/**
+ * @brief Sets the mapset of the route passwd
+ *
+ * @param this The route to set the mapset for
+ * @param ms The mapset to set for this route
+ */
+void
+route_set_mapset(struct route *this, struct mapset *ms)
+{
+ this->ms=ms;
+}
+
+/**
+ * @brief Sets the vehicle profile of a route
+ *
+ * @param this The route to set the profile for
+ * @param prof The vehicle profile
+ */
+
+void
+route_set_profile(struct route *this, struct vehicleprofile *prof)
+{
+ if (this->vehicleprofile != prof) {
+ this->vehicleprofile=prof;
+ route_path_update(this, 1, 1);
+ }
+}
+
+/**
+ * @brief Returns the mapset of the route passed
+ *
+ * @param this The route to get the mapset of
+ * @return The mapset of the route passed
+ */
+struct mapset *
+route_get_mapset(struct route *this)
+{
+ return this->ms;
+}
+
+/**
+ * @brief Returns the current position within the route passed
+ *
+ * @param this The route to get the position for
+ * @return The position within the route passed
+ */
+struct route_info *
+route_get_pos(struct route *this)
+{
+ return this->pos;
+}
+
+/**
+ * @brief Returns the destination of the route passed
+ *
+ * @param this The route to get the destination for
+ * @return The destination of the route passed
+ */
+struct route_info *
+route_get_dst(struct route *this)
+{
+ return this->dst;
+}
+
+/**
+ * @brief Checks if the path is calculated for the route passed
+ *
+ * @param this The route to check
+ * @return True if the path is calculated, false if not
+ */
+int
+route_get_path_set(struct route *this)
+{
+ return this->path2 != NULL;
+}
+
+/**
+ * @brief Checks if the route passed contains a certain item within the route path
+ *
+ * This function checks if a certain items exists in the path that navit will guide
+ * the user to his destination. It does *not* check if this item exists in the route
+ * graph!
+ *
+ * @param this The route to check for this item
+ * @param item The item to search for
+ * @return True if the item was found, false if the item was not found or the route was not calculated
+ */
+int
+route_contains(struct route *this, struct item *item)
+{
+ if (! this->path2 || !this->path2->path_hash)
+ return 0;
+ if (item_hash_lookup(this->path2->path_hash, item))
+ return 1;
+ if (! this->pos || !this->pos->street)
+ return 0;
+ return item_is_equal(this->pos->street->item, *item);
+
+}
+
+/**
+ * @brief Checks if a route has reached its destination
+ *
+ * @param this The route to be checked
+ * @return True if the destination is "reached", false otherwise.
+ */
+int
+route_destination_reached(struct route *this)
+{
+ struct street_data *sd = NULL;
+ enum projection pro;
+
+ if (!this->pos)
+ return 0;
+
+ sd = this->pos->street;
+
+ if (!this->path2) {
+ return 0;
+ }
+
+ if (!item_is_equal(this->pos->street->item, this->dst->street->item)) {
+ return 0;
+ }
+
+ if ((sd->flags & AF_ONEWAY) && (this->pos->lenneg >= this->dst->lenneg)) { // We would have to drive against the one-way road
+ return 0;
+ }
+ if ((sd->flags & AF_ONEWAYREV) && (this->pos->lenpos >= this->dst->lenpos)) {
+ return 0;
+ }
+ pro=route_projection(this);
+ if (pro == projection_none)
+ return 0;
+
+ if (transform_distance(pro, &this->pos->c, &this->dst->lp) > this->destination_distance) {
+ return 0;
+ }
+
+ return 1;
+}
+
+static void
+route_path_update_done(struct route *this, int new_graph)
+{
+ struct route_path *oldpath=this->path2;
+ struct attr route_status;
+ route_status.type=attr_route_status;
+ if (this->path2 && this->path2->in_use) {
+ this->path2->update_required=1+new_graph;
+ return;
+ }
+ route_status.u.num=route_status_building_path;
+ route_set_attr(this, &route_status);
+
+ this->path2=route_path_new(this->graph, oldpath, this->pos, this->dst, this->vehicleprofile);
+ route_path_destroy(oldpath);
+ if (this->path2) {
+ if (!new_graph && this->path2->updated)
+ route_status.u.num=route_status_path_done_incremental;
+ else
+ route_status.u.num=route_status_path_done_new;
+ } else
+ route_status.u.num=route_status_not_found;
+ route_set_attr(this, &route_status);
+}
+
+/**
+ * @brief Updates the route graph and the route path if something changed with the route
+ *
+ * This will update the route graph and the route path of the route if some of the
+ * route's settings (destination, position) have changed.
+ *
+ * @attention For this to work the route graph has to be destroyed if the route's
+ * @attention destination is changed somewhere!
+ *
+ * @param this The route to update
+ */
+static void
+route_path_update(struct route *this, int cancel, int async)
+{
+ dbg(1,"enter %d\n", cancel);
+ if (! this->pos || ! this->dst) {
+ dbg(1,"destroy\n");
+ route_path_destroy(this->path2);
+ this->path2 = NULL;
+ return;
+ }
+ if (cancel) {
+ route_graph_destroy(this->graph);
+ this->graph=NULL;
+ }
+ /* the graph is destroyed when setting the destination */
+ if (this->graph) {
+ if (this->graph->busy) {
+ dbg(1,"busy building graph\n");
+ return;
+ }
+ // we can try to update
+ dbg(1,"try update\n");
+ route_path_update_done(this, 0);
+ } else {
+ route_path_destroy(this->path2);
+ this->path2 = NULL;
+ }
+ if (!this->graph || !this->path2) {
+ dbg(1,"rebuild graph\n");
+ if (! this->route_graph_flood_done_cb)
+ this->route_graph_flood_done_cb=callback_new_2(callback_cast(route_path_update_done), this, (long)1);
+ dbg(1,"route_graph_update\n");
+ route_graph_update(this, this->route_graph_flood_done_cb, async);
+ }
+}
+
+/**
+ * @brief This will calculate all the distances stored in a route_info
+ *
+ * @param ri The route_info to calculate the distances for
+ * @param pro The projection used for this route
+ */
+static void
+route_info_distances(struct route_info *ri, enum projection pro)
+{
+ int npos=ri->pos+1;
+ struct street_data *sd=ri->street;
+ /* 0 1 2 X 3 4 5 6 pos=2 npos=3 count=7 0,1,2 3,4,5,6*/
+ ri->lenextra=transform_distance(pro, &ri->lp, &ri->c);
+ ri->lenneg=transform_polyline_length(pro, sd->c, npos)+transform_distance(pro, &sd->c[ri->pos], &ri->lp);
+ ri->lenpos=transform_polyline_length(pro, sd->c+npos, sd->count-npos)+transform_distance(pro, &sd->c[npos], &ri->lp);
+ if (ri->lenneg || ri->lenpos)
+ ri->percent=(ri->lenneg*100)/(ri->lenneg+ri->lenpos);
+ else
+ ri->percent=50;
+}
+
+/**
+ * @brief This sets the current position of the route passed
+ *
+ * This will set the current position of the route passed to the street that is nearest to the
+ * passed coordinates. It also automatically updates the route.
+ *
+ * @param this The route to set the position of
+ * @param pos Coordinates to set as position
+ */
+void
+route_set_position(struct route *this, struct pcoord *pos)
+{
+ if (this->pos)
+ route_info_free(this->pos);
+ this->pos=NULL;
+ this->pos=route_find_nearest_street(this->vehicleprofile, this->ms, pos);
+
+ // If there is no nearest street, bail out.
+ if (!this->pos) return;
+
+ this->pos->street_direction=0;
+ dbg(1,"this->pos=%p\n", this->pos);
+ route_info_distances(this->pos, pos->pro);
+ route_path_update(this, 0, 1);
+}
+
+/**
+ * @brief Sets a route's current position based on coordinates from tracking
+ *
+ * @param this The route to set the current position of
+ * @param tracking The tracking to get the coordinates from
+ */
+void
+route_set_position_from_tracking(struct route *this, struct tracking *tracking, enum projection pro)
+{
+ struct coord *c;
+ struct route_info *ret;
+ struct street_data *sd;
+
+ dbg(2,"enter\n");
+ c=tracking_get_pos(tracking);
+ ret=g_new0(struct route_info, 1);
+ if (!ret) {
+ printf("%s:Out of memory\n", __FUNCTION__);
+ return;
+ }
+ if (this->pos)
+ route_info_free(this->pos);
+ this->pos=NULL;
+ ret->c=*c;
+ ret->lp=*c;
+ ret->pos=tracking_get_segment_pos(tracking);
+ ret->street_direction=tracking_get_street_direction(tracking);
+ sd=tracking_get_street_data(tracking);
+ if (sd) {
+ ret->street=street_data_dup(sd);
+ route_info_distances(ret, pro);
+ }
+ dbg(3,"c->x=0x%x, c->y=0x%x pos=%d item=(0x%x,0x%x)\n", c->x, c->y, ret->pos, ret->street->item.id_hi, ret->street->item.id_lo);
+ dbg(3,"street 0=(0x%x,0x%x) %d=(0x%x,0x%x)\n", ret->street->c[0].x, ret->street->c[0].y, ret->street->count-1, ret->street->c[ret->street->count-1].x, ret->street->c[ret->street->count-1].y);
+ this->pos=ret;
+ if (this->dst)
+ route_path_update(this, 0, 1);
+ dbg(2,"ret\n");
+}
+
+/* Used for debuging of route_rect, what routing sees */
+struct map_selection *route_selection;
+
+/**
+ * @brief Returns a single map selection
+ */
+struct map_selection *
+route_rect(int order, struct coord *c1, struct coord *c2, int rel, int abs)
+{
+ int dx,dy,sx=1,sy=1,d,m;
+ struct map_selection *sel=g_new(struct map_selection, 1);
+ if (!sel) {
+ printf("%s:Out of memory\n", __FUNCTION__);
+ return sel;
+ }
+ sel->order=order;
+ sel->range.min=route_item_first;
+ sel->range.max=route_item_last;
+ dbg(1,"%p %p\n", c1, c2);
+ dx=c1->x-c2->x;
+ dy=c1->y-c2->y;
+ if (dx < 0) {
+ sx=-1;
+ sel->u.c_rect.lu.x=c1->x;
+ sel->u.c_rect.rl.x=c2->x;
+ } else {
+ sel->u.c_rect.lu.x=c2->x;
+ sel->u.c_rect.rl.x=c1->x;
+ }
+ if (dy < 0) {
+ sy=-1;
+ sel->u.c_rect.lu.y=c2->y;
+ sel->u.c_rect.rl.y=c1->y;
+ } else {
+ sel->u.c_rect.lu.y=c1->y;
+ sel->u.c_rect.rl.y=c2->y;
+ }
+ if (dx*sx > dy*sy)
+ d=dx*sx;
+ else
+ d=dy*sy;
+ m=d*rel/100+abs;
+ sel->u.c_rect.lu.x-=m;
+ sel->u.c_rect.rl.x+=m;
+ sel->u.c_rect.lu.y+=m;
+ sel->u.c_rect.rl.y-=m;
+ sel->next=NULL;
+ return sel;
+}
+
+/**
+ * @brief Returns a list of map selections useable to create a route graph
+ *
+ * Returns a list of map selections useable to get a map rect from which items can be
+ * retrieved to build a route graph. The selections are a rectangle with
+ * c1 and c2 as two corners.
+ *
+ * @param c1 Corner 1 of the rectangle
+ * @param c2 Corder 2 of the rectangle
+ */
+static struct map_selection *
+route_calc_selection(struct coord *c1, struct coord *c2)
+{
+ struct map_selection *ret,*sel;
+ sel=route_rect(4, c1, c2, 25, 0);
+ ret=sel;
+ sel->next=route_rect(8, c1, c1, 0, 40000);
+ sel=sel->next;
+ sel->next=route_rect(18, c1, c1, 0, 10000);
+ sel=sel->next;
+ sel->next=route_rect(8, c2, c2, 0, 40000);
+ sel=sel->next;
+ sel->next=route_rect(18, c2, c2, 0, 10000);
+ /* route_selection=ret; */
+ return ret;
+}
+
+/**
+ * @brief Destroys a list of map selections
+ *
+ * @param sel Start of the list to be destroyed
+ */
+static void
+route_free_selection(struct map_selection *sel)
+{
+ struct map_selection *next;
+ while (sel) {
+ next=sel->next;
+ g_free(sel);
+ sel=next;
+ }
+}
+
+
+/**
+ * @brief Sets the destination of a route
+ *
+ * This sets the destination of a route to the street nearest to the coordinates passed
+ * and updates the route.
+ *
+ * @param this The route to set the destination for
+ * @param dst Coordinates to set as destination
+ */
+void
+route_set_destination(struct route *this, struct pcoord *dst, int async)
+{
+ profile(0,NULL);
+ if (this->dst)
+ route_info_free(this->dst);
+ this->dst=NULL;
+ if (dst) {
+ this->dst=route_find_nearest_street(this->vehicleprofile, this->ms, dst);
+ if(this->dst)
+ route_info_distances(this->dst, dst->pro);
+ } else {
+ struct attr route_status;
+ route_status.type=attr_route_status;
+ route_status.u.num=route_status_no_destination;
+ route_set_attr(this, &route_status);
+ }
+ profile(1,"find_nearest_street");
+
+ /* The graph has to be destroyed and set to NULL, otherwise route_path_update() doesn't work */
+ route_graph_destroy(this->graph);
+ this->graph=NULL;
+ route_path_update(this, 1, async);
+ profile(0,"end");
+}
+
+/**
+ * @brief Gets the route_graph_point with the specified coordinates
+ *
+ * @param this The route in which to search
+ * @param c Coordinates to search for
+ * @return The point at the specified coordinates or NULL if not found
+ */
+static struct route_graph_point *
+route_graph_get_point(struct route_graph *this, struct coord *c)
+{
+ struct route_graph_point *p;
+ int hashval=HASHCOORD(c);
+ p=this->hash[hashval];
+ while (p) {
+ if (p->c.x == c->x && p->c.y == c->y)
+ return p;
+ p=p->hash_next;
+ }
+ return NULL;
+}
+
+
+/**
+ * @brief Gets the last route_graph_point with the specified coordinates
+ *
+ * @param this The route in which to search
+ * @param c Coordinates to search for
+ * @return The point at the specified coordinates or NULL if not found
+ */
+static struct route_graph_point *
+route_graph_get_point_last(struct route_graph *this, struct coord *c)
+{
+ struct route_graph_point *p,*ret=NULL;
+ int hashval=HASHCOORD(c);
+ p=this->hash[hashval];
+ while (p) {
+ if (p->c.x == c->x && p->c.y == c->y)
+ ret=p;
+ p=p->hash_next;
+ }
+ return ret;
+}
+
+
+
+/**
+ * @brief Create a new point for the route graph with the specified coordinates
+ *
+ * @param this The route to insert the point into
+ * @param f The coordinates at which the point should be created
+ * @return The point created
+ */
+
+static struct route_graph_point *
+route_graph_point_new(struct route_graph *this, struct coord *f)
+{
+ int hashval;
+ struct route_graph_point *p;
+
+ hashval=HASHCOORD(f);
+ if (debug_route)
+ printf("p (0x%x,0x%x)\n", f->x, f->y);
+ p=g_new0(struct route_graph_point,1);
+ p->hash_next=this->hash[hashval];
+ this->hash[hashval]=p;
+ p->value=INT_MAX;
+ p->c=*f;
+ return p;
+}
+
+/**
+ * @brief Inserts a point into the route graph at the specified coordinates
+ *
+ * This will insert a point into the route graph at the coordinates passed in f.
+ * Note that the point is not yet linked to any segments.
+ *
+ * @param this The route to insert the point into
+ * @param f The coordinates at which the point should be inserted
+ * @return The point inserted or NULL on failure
+ */
+static struct route_graph_point *
+route_graph_add_point(struct route_graph *this, struct coord *f)
+{
+ struct route_graph_point *p;
+
+ p=route_graph_get_point(this,f);
+ if (!p)
+ p=route_graph_point_new(this,f);
+ return p;
+}
+
+/**
+ * @brief Frees all the memory used for points in the route graph passed
+ *
+ * @param this The route graph to delete all points from
+ */
+static void
+route_graph_free_points(struct route_graph *this)
+{
+ struct route_graph_point *curr,*next;
+ int i;
+ for (i = 0 ; i < HASH_SIZE ; i++) {
+ curr=this->hash[i];
+ while (curr) {
+ next=curr->hash_next;
+ g_free(curr);
+ curr=next;
+ }
+ this->hash[i]=NULL;
+ }
+}
+
+/**
+ * @brief Returns the position of a certain field appended to a route graph segment
+ *
+ * This function returns a pointer to a field that is appended to a route graph
+ * segment.
+ *
+ * @param seg The route graph segment the field is appended to
+ * @param type Type of the field that should be returned
+ * @return A pointer to a field of a certain type, or NULL if no such field is present
+ */
+static void *
+route_segment_data_field_pos(struct route_segment_data *seg, enum attr_type type)
+{
+ unsigned char *ptr;
+
+ ptr = ((unsigned char*)seg) + sizeof(struct route_segment_data);
+
+ if (seg->flags & AF_SPEED_LIMIT) {
+ if (type == attr_maxspeed)
+ return (void*)ptr;
+ ptr += sizeof(int);
+ }
+ if (seg->flags & AF_SEGMENTED) {
+ if (type == attr_offset)
+ return (void*)ptr;
+ ptr += sizeof(int);
+ }
+ return NULL;
+}
+
+/**
+ * @brief Calculates the size of a route_segment_data struct with given flags
+ *
+ * @param flags The flags of the route_segment_data
+ */
+
+static int
+route_segment_data_size(int flags)
+{
+ int ret=sizeof(struct route_segment_data);
+ if (flags & AF_SPEED_LIMIT)
+ ret+=sizeof(int);
+ if (flags & AF_SEGMENTED)
+ ret+=sizeof(int);
+ return ret;
+}
+
+
+static int
+route_graph_segment_is_duplicate(struct route_graph_point *start, struct item *item, int flags, int offset)
+{
+ struct route_graph_segment *s;
+ s=start->start;
+ while (s) {
+ if (item_is_equal(*item, s->data.item)) {
+ if (flags & AF_SEGMENTED) {
+ if (RSD_OFFSET(&s->data) == offset) {
+ return 1;
+ }
+ } else
+ return 1;
+ }
+ s=s->start_next;
+ }
+ return 0;
+}
+
+/**
+ * @brief Inserts a new segment into the route graph
+ *
+ * This function performs a check if a segment for the item specified already exists, and inserts
+ * a new segment representing this item if it does not.
+ *
+ * @param this The route graph to insert the segment into
+ * @param start The graph point which should be connected to the start of this segment
+ * @param end The graph point which should be connected to the end of this segment
+ * @param len The length of this segment
+ * @param item The item that is represented by this segment
+ * @param flags Flags for this segment
+ * @param offset If the item passed in "item" is segmented (i.e. divided into several segments), this indicates the position of this segment within the item
+ * @param maxspeed The maximum speed allowed on this segment in km/h. -1 if not known.
+ */
+static void
+route_graph_add_segment(struct route_graph *this, struct route_graph_point *start,
+ struct route_graph_point *end, int len, struct item *item,
+ int flags, int offset, int maxspeed)
+{
+ struct route_graph_segment *s;
+ int size;
+
+ size = sizeof(struct route_graph_segment)-sizeof(struct route_segment_data)+route_segment_data_size(flags);
+ s = g_malloc0(size);
+ if (!s) {
+ printf("%s:Out of memory\n", __FUNCTION__);
+ return;
+ }
+ s->start=start;
+ s->start_next=start->start;
+ start->start=s;
+ s->end=end;
+ s->end_next=end->end;
+ end->end=s;
+ dbg_assert(len >= 0);
+ s->data.len=len;
+ s->data.item=*item;
+ s->data.flags=flags;
+
+ if (flags & AF_SPEED_LIMIT)
+ RSD_MAXSPEED(&s->data)=maxspeed;
+ if (flags & AF_SEGMENTED)
+ RSD_OFFSET(&s->data)=offset;
+
+ s->next=this->route_segments;
+ this->route_segments=s;
+ if (debug_route)
+ printf("l (0x%x,0x%x)-(0x%x,0x%x)\n", start->c.x, start->c.y, end->c.x, end->c.y);
+}
+
+/**
+ * @brief Gets all the coordinates of an item
+ *
+ * This will get all the coordinates of the item i and return them in c,
+ * up to max coordinates. Additionally it is possible to limit the coordinates
+ * returned to all the coordinates of the item between the two coordinates
+ * start end end.
+ *
+ * @important Make shure that whatever c points to has enough memory allocated
+ * @important to hold max coordinates!
+ *
+ * @param i The item to get the coordinates of
+ * @param c Pointer to memory allocated for holding the coordinates
+ * @param max Maximum number of coordinates to return
+ * @param start First coordinate to get
+ * @param end Last coordinate to get
+ * @return The number of coordinates returned
+ */
+static int get_item_seg_coords(struct item *i, struct coord *c, int max,
+ struct coord *start, struct coord *end)
+{
+ struct map_rect *mr;
+ struct item *item;
+ int rc = 0, p = 0;
+ struct coord c1;
+ mr=map_rect_new(i->map, NULL);
+ if (!mr)
+ return 0;
+ item = map_rect_get_item_byid(mr, i->id_hi, i->id_lo);
+ if (item) {
+ rc = item_coord_get(item, &c1, 1);
+ while (rc && (c1.x != start->x || c1.y != start->y)) {
+ rc = item_coord_get(item, &c1, 1);
+ }
+ while (rc && p < max) {
+ c[p++] = c1;
+ if (c1.x == end->x && c1.y == end->y)
+ break;
+ rc = item_coord_get(item, &c1, 1);
+ }
+ }
+ map_rect_destroy(mr);
+ return p;
+}
+
+/**
+ * @brief Returns and removes one segment from a path
+ *
+ * @param path The path to take the segment from
+ * @param item The item whose segment to remove
+ * @param offset Offset of the segment within the item to remove. If the item is not segmented this should be 1.
+ * @return The segment removed
+ */
+static struct route_path_segment *
+route_extract_segment_from_path(struct route_path *path, struct item *item,
+ int offset)
+{
+ int soffset;
+ struct route_path_segment *sp = NULL, *s;
+ s = path->path;
+ while (s) {
+ if (item_is_equal(s->data->item,*item)) {
+ if (s->data->flags & AF_SEGMENTED)
+ soffset=RSD_OFFSET(s->data);
+ else
+ soffset=1;
+ if (soffset == offset) {
+ if (sp) {
+ sp->next = s->next;
+ break;
+ } else {
+ path->path = s->next;
+ break;
+ }
+ }
+ }
+ sp = s;
+ s = s->next;
+ }
+ if (s)
+ item_hash_remove(path->path_hash, item);
+ return s;
+}
+
+/**
+ * @brief Adds a segment and the end of a path
+ *
+ * @param this The path to add the segment to
+ * @param segment The segment to add
+ */
+static void
+route_path_add_segment(struct route_path *this, struct route_path_segment *segment)
+{
+ if (!this->path)
+ this->path=segment;
+ if (this->path_last)
+ this->path_last->next=segment;
+ this->path_last=segment;
+}
+
+/**
+ * @brief Adds a two coordinate line to a path
+ *
+ * This adds a new line to a path, creating a new segment for it.
+ *
+ * @param this The path to add the item to
+ * @param start coordinate to add to the start of the item. If none should be added, make this NULL.
+ * @param end coordinate to add to the end of the item. If none should be added, make this NULL.
+ * @param len The length of the item
+ */
+static void
+route_path_add_line(struct route_path *this, struct coord *start, struct coord *end, int len)
+{
+ int ccnt=2;
+ struct route_path_segment *segment;
+ int seg_size,seg_dat_size;
+
+ dbg(1,"line from 0x%x,0x%x-0x%x,0x%x\n", start->x, start->y, end->x, end->y);
+ seg_size=sizeof(*segment) + sizeof(struct coord) * ccnt;
+ seg_dat_size=sizeof(struct route_segment_data);
+ segment=g_malloc0(seg_size + seg_dat_size);
+ segment->data=(struct route_segment_data *)((char *)segment+seg_size);
+ segment->ncoords=ccnt;
+ segment->direction=0;
+ segment->c[0]=*start;
+ segment->c[1]=*end;
+ segment->data->len=len;
+ route_path_add_segment(this, segment);
+}
+
+/**
+ * @brief Inserts a new item into the path
+ *
+ * This function does almost the same as "route_path_add_item()", but identifies
+ * the item to add by a segment from the route graph. Another difference is that it "copies" the
+ * segment from the route graph, i.e. if the item is segmented, only the segment passed in rgs will
+ * be added to the route path, not all segments of the item.
+ *
+ * The function can be sped up by passing an old path already containing this segment in oldpath -
+ * the segment will then be extracted from this old path. Please note that in this case the direction
+ * parameter has no effect.
+ *
+ * @param this The path to add the item to
+ * @param oldpath Old path containing the segment to be added. Speeds up the function, but can be NULL.
+ * @param rgs Segment of the route graph that should be "copied" to the route path
+ * @param dir Order in which to add the coordinates. See route_path_add_item()
+ * @param pos Information about start point if this is the first segment
+ * @param dst Information about end point if this is the last segment
+ */
+
+static int
+route_path_add_item_from_graph(struct route_path *this, struct route_path *oldpath, struct route_graph_segment *rgs, int dir, struct route_info *pos, struct route_info *dst)
+{
+ struct route_path_segment *segment;
+ int i, ccnt, extra=0, ret=0;
+ struct coord *c,*cd,ca[2048];
+ int offset=1;
+ int seg_size,seg_dat_size;
+ int len=rgs->data.len;
+ if (rgs->data.flags & AF_SEGMENTED)
+ offset=RSD_OFFSET(&rgs->data);
+
+ dbg(1,"enter (0x%x,0x%x) dir=%d pos=%p dst=%p\n", rgs->data.item.id_hi, rgs->data.item.id_lo, dir, pos, dst);
+ if (oldpath) {
+ segment=item_hash_lookup(oldpath->path_hash, &rgs->data.item);
+ if (segment && segment->direction == dir) {
+ segment = route_extract_segment_from_path(oldpath, &rgs->data.item, offset);
+ if (segment) {
+ ret=1;
+ if (!pos)
+ goto linkold;
+ }
+ }
+ }
+
+ if (pos) {
+ if (dst) {
+ extra=2;
+ if (dst->lenneg >= pos->lenneg) {
+ dir=1;
+ ccnt=dst->pos-pos->pos;
+ c=pos->street->c+pos->pos+1;
+ len=dst->lenneg-pos->lenneg;
+ } else {
+ dir=-1;
+ ccnt=pos->pos-dst->pos;
+ c=pos->street->c+dst->pos+1;
+ len=pos->lenneg-dst->lenneg;
+ }
+ } else {
+ extra=1;
+ dbg(1,"pos dir=%d\n", dir);
+ dbg(1,"pos pos=%d\n", pos->pos);
+ dbg(1,"pos count=%d\n", pos->street->count);
+ if (dir > 0) {
+ c=pos->street->c+pos->pos+1;
+ ccnt=pos->street->count-pos->pos-1;
+ len=pos->lenpos;
+ } else {
+ c=pos->street->c;
+ ccnt=pos->pos+1;
+ len=pos->lenneg;
+ }
+ }
+ pos->dir=dir;
+ } else if (dst) {
+ extra=1;
+ dbg(1,"dst dir=%d\n", dir);
+ dbg(1,"dst pos=%d\n", dst->pos);
+ if (dir > 0) {
+ c=dst->street->c;
+ ccnt=dst->pos+1;
+ len=dst->lenpos;
+ } else {
+ c=dst->street->c+dst->pos+1;
+ ccnt=dst->street->count-dst->pos-1;
+ len=dst->lenneg;
+ }
+ } else {
+ ccnt=get_item_seg_coords(&rgs->data.item, ca, 2047, &rgs->start->c, &rgs->end->c);
+ c=ca;
+ }
+ seg_size=sizeof(*segment) + sizeof(struct coord) * (ccnt + extra);
+ seg_dat_size=route_segment_data_size(rgs->data.flags);
+ segment=g_malloc0(seg_size + seg_dat_size);
+ segment->data=(struct route_segment_data *)((char *)segment+seg_size);
+ segment->direction=dir;
+ cd=segment->c;
+ if (pos && (c[0].x != pos->lp.x || c[0].y != pos->lp.y))
+ *cd++=pos->lp;
+ if (dir < 0)
+ c+=ccnt-1;
+ for (i = 0 ; i < ccnt ; i++) {
+ *cd++=*c;
+ c+=dir;
+ }
+ segment->ncoords+=ccnt;
+ if (dst && (cd[-1].x != dst->lp.x || cd[-1].y != dst->lp.y))
+ *cd++=dst->lp;
+ segment->ncoords=cd-segment->c;
+ if (segment->ncoords <= 1) {
+ g_free(segment);
+ return 1;
+ }
+
+ /* We check if the route graph segment is part of a roundabout here, because this
+ * only matters for route graph segments which form parts of the route path */
+ if (!(rgs->data.flags & AF_ROUNDABOUT)) { // We identified this roundabout earlier
+ route_check_roundabout(rgs, 13, (dir < 1), NULL);
+ }
+
+ memcpy(segment->data, &rgs->data, seg_dat_size);
+linkold:
+ segment->data->len=len;
+ segment->next=NULL;
+ item_hash_insert(this->path_hash, &rgs->data.item, segment);
+
+ route_path_add_segment(this, segment);
+
+ return ret;
+}
+
+/**
+ * @brief Destroys all segments of a route graph
+ *
+ * @param this The graph to destroy all segments from
+ */
+static void
+route_graph_free_segments(struct route_graph *this)
+{
+ struct route_graph_segment *curr,*next;
+ curr=this->route_segments;
+ while (curr) {
+ next=curr->next;
+ g_free(curr);
+ curr=next;
+ }
+ this->route_segments=NULL;
+}
+
+/**
+ * @brief Destroys a route graph
+ *
+ * @param this The route graph to be destroyed
+ */
+static void
+route_graph_destroy(struct route_graph *this)
+{
+ if (this) {
+ route_graph_build_done(this, 1);
+ route_graph_free_points(this);
+ route_graph_free_segments(this);
+ g_free(this);
+ }
+}
+
+/**
+ * @brief Returns the time needed to drive len on item
+ *
+ * This function returns the time needed to drive len meters on
+ * the item passed in item in tenth of seconds.
+ *
+ * @param profile The routing preferences
+ * @param over The segment which is passed
+ * @return The time needed to drive len on item in thenth of senconds
+ */
+
+static int
+route_time_seg(struct vehicleprofile *profile, struct route_segment_data *over, struct route_traffic_distortion *dist)
+{
+ struct roadprofile *roadprofile=vehicleprofile_get_roadprofile(profile, over->item.type);
+ int speed,maxspeed;
+ if (!roadprofile || !roadprofile->route_weight)
+ return INT_MAX;
+ /* maxspeed_handling: 0=always, 1 only if maxspeed restricts the speed, 2 never */
+ speed=roadprofile->route_weight;
+ if (profile->maxspeed_handling != 2) {
+ if (over->flags & AF_SPEED_LIMIT) {
+ maxspeed=RSD_MAXSPEED(over);
+ if (!profile->maxspeed_handling)
+ speed=maxspeed;
+ } else
+ maxspeed=INT_MAX;
+ if (dist && maxspeed > dist->maxspeed)
+ maxspeed=dist->maxspeed;
+ if (maxspeed != INT_MAX && (profile->maxspeed_handling != 1 || maxspeed < speed))
+ speed=maxspeed;
+ }
+ if (!speed)
+ return INT_MAX;
+ return over->len*36/speed+(dist ? dist->delay : 0);
+}
+
+static int
+route_get_traffic_distortion(struct route_graph_segment *seg, struct route_traffic_distortion *ret)
+{
+ struct route_graph_point *start=seg->start;
+ struct route_graph_point *end=seg->end;
+ struct route_graph_segment *tmp,*found=NULL;
+ tmp=start->start;
+ while (tmp && !found) {
+ if (tmp->data.item.type == type_traffic_distortion && tmp->start == start && tmp->end == end)
+ found=tmp;
+ tmp=tmp->start_next;
+ }
+ tmp=start->end;
+ while (tmp && !found) {
+ if (tmp->data.item.type == type_traffic_distortion && tmp->end == start && tmp->start == end)
+ found=tmp;
+ tmp=tmp->end_next;
+ }
+ if (found) {
+ ret->delay=found->data.len;
+ if (found->data.flags & AF_SPEED_LIMIT)
+ ret->maxspeed=RSD_MAXSPEED(&found->data);
+ else
+ ret->maxspeed=INT_MAX;
+ return 1;
+ }
+ return 0;
+}
+
+/**
+ * @brief Returns the "costs" of driving from point from over segment over in direction dir
+ *
+ * @param profile The routing preferences
+ * @param from The point where we are starting
+ * @param over The segment we are using
+ * @param dir The direction of segment which we are driving
+ * @return The "costs" needed to drive len on item
+ */
+
+static int
+route_value_seg(struct vehicleprofile *profile, struct route_graph_point *from, struct route_graph_segment *over, int dir)
+{
+#if 0
+ dbg(0,"flags 0x%x mask 0x%x flags 0x%x\n", over->flags, dir >= 0 ? profile->flags_forward_mask : profile->flags_reverse_mask, profile->flags);
+#endif
+ if ((over->data.flags & (dir >= 0 ? profile->flags_forward_mask : profile->flags_reverse_mask)) != profile->flags)
+ return INT_MAX;
+ if (dir > 0 && (over->start->flags & RP_TURN_RESTRICTION))
+ return INT_MAX;
+ if (dir < 0 && (over->end->flags & RP_TURN_RESTRICTION))
+ return INT_MAX;
+ if (from && from->seg == over)
+ return INT_MAX;
+ if ((over->start->flags & RP_TRAFFIC_DISTORTION) && (over->end->flags & RP_TRAFFIC_DISTORTION)) {
+ struct route_traffic_distortion dist;
+ if (route_get_traffic_distortion(over, &dist))
+ return route_time_seg(profile, &over->data, &dist);
+ }
+ return route_time_seg(profile, &over->data, NULL);
+}
+
+/**
+ * @brief Adds a route distortion item to the route graph
+ *
+ * @param this The route graph to add to
+ * @param item The item to add
+ */
+static void
+route_process_traffic_distortion(struct route_graph *this, struct item *item)
+{
+ struct route_graph_point *s_pnt,*e_pnt;
+ struct coord c,l;
+ struct attr delay_attr, maxspeed_attr;
+ int len=0;
+ int flags = 0;
+ int offset = 1;
+ int maxspeed = INT_MAX;
+
+ if (item_coord_get(item, &l, 1)) {
+ s_pnt=route_graph_add_point(this,&l);
+ while (item_coord_get(item, &c, 1)) {
+ l=c;
+ }
+ e_pnt=route_graph_add_point(this,&l);
+ s_pnt->flags |= RP_TRAFFIC_DISTORTION;
+ e_pnt->flags |= RP_TRAFFIC_DISTORTION;
+ if (item_attr_get(item, attr_maxspeed, &maxspeed_attr)) {
+ flags |= AF_SPEED_LIMIT;
+ maxspeed=maxspeed_attr.u.num;
+ }
+ if (item_attr_get(item, attr_delay, &delay_attr))
+ len=delay_attr.u.num;
+ route_graph_add_segment(this, s_pnt, e_pnt, len, item, flags, offset, maxspeed);
+ }
+}
+
+/**
+ * @brief Adds a route distortion item to the route graph
+ *
+ * @param this The route graph to add to
+ * @param item The item to add
+ */
+static void
+route_process_turn_restriction(struct route_graph *this, struct item *item)
+{
+ struct route_graph_point *pnt[3];
+ struct coord c[4];
+ int i,count;
+
+ count=item_coord_get(item, c, 4);
+ if (count != 3) {
+ dbg(0,"wrong count %d\n",count);
+ return;
+ }
+ for (i = 0 ; i < 3 ; i++)
+ pnt[i]=route_graph_add_point(this,&c[i]);
+ pnt[1]->flags |= RP_TURN_RESTRICTION;
+ route_graph_add_segment(this, pnt[0], pnt[1], 0, item, 0, 0, 0);
+ route_graph_add_segment(this, pnt[1], pnt[2], 0, item, 0, 0, 0);
+}
+
+/**
+ * @brief Adds an item to the route graph
+ *
+ * This adds an item (e.g. a street) to the route graph, creating as many segments as needed for a
+ * segmented item.
+ *
+ * @param this The route graph to add to
+ * @param item The item to add
+ */
+static void
+route_process_street_graph(struct route_graph *this, struct item *item)
+{
+#ifdef AVOID_FLOAT
+ int len=0;
+#else
+ double len=0;
+#endif
+ struct route_graph_point *s_pnt,*e_pnt;
+ struct coord c,l;
+ struct attr flags_attr, maxspeed_attr;
+ int flags = 0;
+ int segmented = 0;
+ int offset = 1;
+ int maxspeed = -1;
+
+ if (item_coord_get(item, &l, 1)) {
+ int *default_flags=item_get_default_flags(item->type);
+ if (! default_flags)
+ return;
+ if (item_attr_get(item, attr_flags, &flags_attr)) {
+ flags = flags_attr.u.num;
+ if (flags & AF_SEGMENTED)
+ segmented = 1;
+ } else
+ flags = *default_flags;
+
+
+ if (flags & AF_SPEED_LIMIT) {
+ if (item_attr_get(item, attr_maxspeed, &maxspeed_attr)) {
+ maxspeed = maxspeed_attr.u.num;
+ }
+ }
+
+ s_pnt=route_graph_add_point(this,&l);
+ if (!segmented) {
+ while (item_coord_get(item, &c, 1)) {
+ len+=transform_distance(map_projection(item->map), &l, &c);
+ l=c;
+ }
+ e_pnt=route_graph_add_point(this,&l);
+ dbg_assert(len >= 0);
+ if (!route_graph_segment_is_duplicate(s_pnt, item, flags, offset))
+ route_graph_add_segment(this, s_pnt, e_pnt, len, item, flags, offset, maxspeed);
+ } else {
+ int isseg,rc;
+ int sc = 0;
+ do {
+ isseg = item_coord_is_node(item);
+ rc = item_coord_get(item, &c, 1);
+ if (rc) {
+ len+=transform_distance(map_projection(item->map), &l, &c);
+ l=c;
+ if (isseg) {
+ e_pnt=route_graph_add_point(this,&l);
+ if (!route_graph_segment_is_duplicate(s_pnt, item, flags, offset))
+ route_graph_add_segment(this, s_pnt, e_pnt, len, item, flags, offset, maxspeed);
+ offset++;
+ s_pnt=route_graph_add_point(this,&l);
+ len = 0;
+ }
+ }
+ } while(rc);
+ e_pnt=route_graph_add_point(this,&l);
+ dbg_assert(len >= 0);
+ sc++;
+ if (!route_graph_segment_is_duplicate(s_pnt, item, flags, offset))
+ route_graph_add_segment(this, s_pnt, e_pnt, len, item, flags, offset, maxspeed);
+ }
+ }
+}
+
+static struct route_graph_segment *
+route_graph_get_segment(struct route_graph *graph, struct street_data *sd)
+{
+ struct route_graph_point *start=route_graph_get_point(graph, &sd->c[0]);
+ struct route_graph_segment *s;
+
+ if (!start) {
+ return NULL;
+ }
+
+ s=start->start;
+ while (s) {
+ if (item_is_equal(sd->item, s->data.item))
+ return s;
+ s=s->start_next;
+ }
+ return NULL;
+}
+
+/**
+ * @brief Calculates the routing costs for each point
+ *
+ * This function is the heart of routing. It assigns each point in the route graph a
+ * cost at which one can reach the destination from this point on. Additionally it assigns
+ * each point a segment one should follow from this point on to reach the destination at the
+ * stated costs.
+ *
+ * This function uses Dijkstra's algorithm to do the routing. To understand it you should have a look
+ * at this algorithm.
+ */
+static void
+route_graph_flood(struct route_graph *this, struct route_info *dst, struct vehicleprofile *profile, struct callback *cb)
+{
+ struct route_graph_point *p_min;
+ struct route_graph_segment *s;
+ int min,new,old,val;
+ struct fibheap *heap; /* This heap will hold all points with "temporarily" calculated costs */
+
+ heap = fh_makekeyheap();
+
+ s=route_graph_get_segment(this, dst->street);
+ if (!s) {
+ dbg(0,"no segment for destination found\n");
+ return;
+ }
+ val=route_value_seg(profile, NULL, s, -1);
+ if (val != INT_MAX) {
+ val=val*(100-dst->percent)/100;
+ s->end->seg=s;
+ s->end->value=val;
+ s->end->el=fh_insertkey(heap, s->end->value, s->end);
+ }
+ val=route_value_seg(profile, NULL, s, 1);
+ if (val != INT_MAX) {
+ val=val*dst->percent/100;
+ s->start->seg=s;
+ s->start->value=val;
+ s->start->el=fh_insertkey(heap, s->start->value, s->start);
+ }
+ for (;;) {
+ p_min=fh_extractmin(heap); /* Starting Dijkstra by selecting the point with the minimum costs on the heap */
+ if (! p_min) /* There are no more points with temporarily calculated costs, Dijkstra has finished */
+ break;
+ min=p_min->value;
+ if (debug_route)
+ printf("extract p=%p free el=%p min=%d, 0x%x, 0x%x\n", p_min, p_min->el, min, p_min->c.x, p_min->c.y);
+ p_min->el=NULL; /* This point is permanently calculated now, we've taken it out of the heap */
+ s=p_min->start;
+ while (s) { /* Iterating all the segments leading away from our point to update the points at their ends */
+ val=route_value_seg(profile, p_min, s, -1);
+ if (val != INT_MAX) {
+ new=min+val;
+ if (debug_route)
+ printf("begin %d len %d vs %d (0x%x,0x%x)\n",new,val,s->end->value, s->end->c.x, s->end->c.y);
+ if (new < s->end->value) { /* We've found a less costly way to reach the end of s, update it */
+ s->end->value=new;
+ s->end->seg=s;
+ if (! s->end->el) {
+ if (debug_route)
+ printf("insert_end p=%p el=%p val=%d ", s->end, s->end->el, s->end->value);
+ s->end->el=fh_insertkey(heap, new, s->end);
+ if (debug_route)
+ printf("el new=%p\n", s->end->el);
+ }
+ else {
+ if (debug_route)
+ printf("replace_end p=%p el=%p val=%d\n", s->end, s->end->el, s->end->value);
+ fh_replacekey(heap, s->end->el, new);
+ }
+ }
+ if (debug_route)
+ printf("\n");
+ }
+ s=s->start_next;
+ }
+ s=p_min->end;
+ while (s) { /* Doing the same as above with the segments leading towards our point */
+ val=route_value_seg(profile, p_min, s, 1);
+ if (val != INT_MAX) {
+ new=min+val;
+ if (debug_route)
+ printf("end %d len %d vs %d (0x%x,0x%x)\n",new,val,s->start->value,s->start->c.x, s->start->c.y);
+ if (new < s->start->value) {
+ old=s->start->value;
+ s->start->value=new;
+ s->start->seg=s;
+ if (! s->start->el) {
+ if (debug_route)
+ printf("insert_start p=%p el=%p val=%d ", s->start, s->start->el, s->start->value);
+ s->start->el=fh_insertkey(heap, new, s->start);
+ if (debug_route)
+ printf("el new=%p\n", s->start->el);
+ }
+ else {
+ if (debug_route)
+ printf("replace_start p=%p el=%p val=%d\n", s->start, s->start->el, s->start->value);
+ fh_replacekey(heap, s->start->el, new);
+ }
+ }
+ if (debug_route)
+ printf("\n");
+ }
+ s=s->end_next;
+ }
+ }
+ fh_deleteheap(heap);
+ callback_call_0(cb);
+ dbg(1,"return\n");
+}
+
+/**
+ * @brief Starts an "offroad" path
+ *
+ * This starts a path that is not located on a street. It creates a new route path
+ * adding only one segment, that leads from pos to dest, and which is not associated with an item.
+ *
+ * @param this Not used
+ * @param pos The starting position for the new path
+ * @param dst The destination of the new path
+ * @param dir Not used
+ * @return The new path
+ */
+static struct route_path *
+route_path_new_offroad(struct route_graph *this, struct route_info *pos, struct route_info *dst)
+{
+ struct route_path *ret;
+
+ ret=g_new0(struct route_path, 1);
+ ret->path_hash=item_hash_new();
+ route_path_add_line(ret, &pos->c, &dst->c, pos->lenextra+dst->lenextra);
+ ret->updated=1;
+
+ return ret;
+}
+
+/**
+ * @brief Returns a coordinate at a given distance
+ *
+ * This function returns the coordinate, where the user will be if he
+ * follows the current route for a certain distance.
+ *
+ * @param this_ The route we're driving upon
+ * @param dist The distance in meters
+ * @return The coordinate where the user will be in that distance
+ */
+struct coord
+route_get_coord_dist(struct route *this_, int dist)
+{
+ int d,l,i,len;
+ int dx,dy;
+ double frac;
+ struct route_path_segment *cur;
+ struct coord ret;
+ enum projection pro=route_projection(this_);
+
+ d = dist;
+
+ if (!this_->path2 || pro == projection_none) {
+ return this_->pos->c;
+ }
+
+ ret = this_->pos->c;
+ cur = this_->path2->path;
+ while (cur) {
+ if (cur->data->len < d) {
+ d -= cur->data->len;
+ } else {
+ for (i=0; i < (cur->ncoords-1); i++) {
+ l = d;
+ len = (int)transform_polyline_length(pro, (cur->c + i), 2);
+ d -= len;
+ if (d <= 0) {
+ // We interpolate a bit here...
+ frac = (double)l / len;
+
+ dx = (cur->c + i + 1)->x - (cur->c + i)->x;
+ dy = (cur->c + i + 1)->y - (cur->c + i)->y;
+
+ ret.x = (cur->c + i)->x + (frac * dx);
+ ret.y = (cur->c + i)->y + (frac * dy);
+ return ret;
+ }
+ }
+ return cur->c[(cur->ncoords-1)];
+ }
+ cur = cur->next;
+ }
+
+ return this_->dst->c;
+}
+
+/**
+ * @brief Creates a new route path
+ *
+ * This creates a new non-trivial route. It therefore needs the routing information created by route_graph_flood, so
+ * make shure to run route_graph_flood() after changing the destination before using this function.
+ *
+ * @param this The route graph to create the route from
+ * @param oldpath (Optional) old path which may contain parts of the new part - this speeds things up a bit. May be NULL.
+ * @param pos The starting position of the route
+ * @param dst The destination of the route
+ * @param preferences The routing preferences
+ * @return The new route path
+ */
+static struct route_path *
+route_path_new(struct route_graph *this, struct route_path *oldpath, struct route_info *pos, struct route_info *dst, struct vehicleprofile *profile)
+{
+ struct route_graph_segment *first,*s=NULL;
+ struct route_graph_point *start;
+ struct route_info *posinfo, *dstinfo;
+ int segs=0;
+ int val1=INT_MAX,val2=INT_MAX;
+ int val;
+ struct route_path *ret;
+
+ if (! pos->street || ! dst->street)
+ return NULL;
+
+ if (profile->mode == 2 || (profile->mode == 0 && pos->lenextra + dst->lenextra > transform_distance(map_projection(pos->street->item.map), &pos->c, &dst->c)))
+ return route_path_new_offroad(this, pos, dst);
+
+ s=route_graph_get_segment(this, pos->street);
+ if (!s) {
+ dbg(0,"no segment for position found\n");
+ return NULL;
+ }
+ val=route_value_seg(profile, NULL, s, 1);
+ if (val != INT_MAX) {
+ val=val*(100-pos->percent)/100;
+ val1=s->end->value+val;
+ }
+ val=route_value_seg(profile, NULL, s, -1);
+ if (val != INT_MAX) {
+ val=val*pos->percent/100;
+ val2=s->start->value+val;
+ }
+ if (val1 == INT_MAX && val2 == INT_MAX) {
+ dbg(0,"no route found, pos blocked\n");
+ return NULL;
+ }
+ if (val1 == val2) {
+ val1=s->end->value;
+ val2=s->start->value;
+ }
+ if (val1 < val2)
+ start=s->start;
+ else
+ start=s->end;
+ ret=g_new0(struct route_path, 1);
+ ret->updated=1;
+ if (pos->lenextra)
+ route_path_add_line(ret, &pos->c, &pos->lp, pos->lenextra);
+ ret->path_hash=item_hash_new();
+ dstinfo=NULL;
+ posinfo=pos;
+ first=s;
+ while (s && !dstinfo) { /* following start->seg, which indicates the least costly way to reach our destination */
+ segs++;
+#if 0
+ printf("start->value=%d 0x%x,0x%x\n", start->value, start->c.x, start->c.y);
+#endif
+ if (s->start == start) {
+ if (item_is_equal(s->data.item, dst->street->item) && (s->end->seg == s || !posinfo))
+ dstinfo=dst;
+ if (!route_path_add_item_from_graph(ret, oldpath, s, 1, posinfo, dstinfo))
+ ret->updated=0;
+ start=s->end;
+ } else {
+ if (item_is_equal(s->data.item, dst->street->item) && (s->start->seg == s || !posinfo))
+ dstinfo=dst;
+ if (!route_path_add_item_from_graph(ret, oldpath, s, -1, posinfo, dstinfo))
+ ret->updated=0;
+ start=s->start;
+ }
+ posinfo=NULL;
+ s=start->seg;
+ }
+ if (dst->lenextra)
+ route_path_add_line(ret, &dst->lp, &dst->c, dst->lenextra);
+ dbg(1, "%d segments\n", segs);
+ return ret;
+}
+
+static int
+route_graph_build_next_map(struct route_graph *rg)
+{
+ do {
+ rg->m=mapset_next(rg->h, 1);
+ if (! rg->m)
+ return 0;
+ map_rect_destroy(rg->mr);
+ rg->mr=map_rect_new(rg->m, rg->sel);
+ } while (!rg->mr);
+
+ return 1;
+}
+
+
+static int
+is_turn_allowed(struct route_graph_point *p, struct route_graph_segment *from, struct route_graph_segment *to)
+{
+ struct route_graph_point *prev,*next;
+ struct route_graph_segment *tmp1,*tmp2;
+ int found;
+ if (from->start == p)
+ prev=from->end;
+ else
+ prev=from->start;
+ if (to->start == p)
+ next=to->end;
+ else
+ next=to->start;
+ dbg(1,"from 0x%x,0x%x over 0x%x,0x%x to 0x%x,0x%x\n",prev->c.x,prev->c.y,p->c.x,p->c.y,next->c.x,next->c.y);
+ tmp1=prev->start;
+ while (tmp1) {
+ if (tmp1->end == p &&
+ (tmp1->data.item.type == type_street_turn_restriction_no ||
+ tmp1->data.item.type == type_street_turn_restriction_only)) {
+ tmp2=next->end;
+ found=0;
+ while (tmp2) {
+ if (tmp2->start == p && item_is_equal(tmp1->data.item, tmp2->data.item)) {
+ found=1;
+ break;
+ }
+ tmp2=tmp2->end_next;
+ }
+ if (tmp1->data.item.type == type_street_turn_restriction_no && found) {
+ dbg(1,"not allowed\n");
+ return 0;
+ }
+ if (tmp1->data.item.type == type_street_turn_restriction_only && !found) {
+ dbg(1,"not allowed\n");
+ return 0;
+ }
+ }
+ tmp1=tmp1->start_next;
+ }
+ return 1;
+}
+
+static void
+route_graph_clone_segment(struct route_graph *this, struct route_graph_segment *s, struct route_graph_point *start, struct route_graph_point *end, int flags)
+{
+ int offset=0;
+ int maxspeed=0;
+ if (s->data.flags & AF_SPEED_LIMIT)
+ maxspeed=RSD_MAXSPEED(&s->data);
+ if (s->data.flags & AF_SEGMENTED)
+ offset=RSD_OFFSET(&s->data);
+ dbg(1,"cloning segment from %p (0x%x,0x%x) to %p (0x%x,0x%x)\n",start,start->c.x,start->c.y, end, end->c.x, end->c.y);
+ route_graph_add_segment(this, start, end, s->data.len+1, &s->data.item, s->data.flags | flags, offset, maxspeed);
+}
+
+static void
+route_graph_process_restriction_segment(struct route_graph *this, struct route_graph_point *p, struct route_graph_segment *s, int dir)
+{
+ struct route_graph_segment *tmp;
+ struct route_graph_point *pn;
+ dbg(1,"From %s\n",item_to_name(s->data.item.type));
+ pn=route_graph_point_new(this, &p->c);
+ if (dir > 0)
+ route_graph_clone_segment(this, s, pn, s->end, AF_ONEWAY);
+ else
+ route_graph_clone_segment(this, s, s->start, pn, AF_ONEWAYREV);
+ tmp=p->start;
+ while (tmp) {
+ if (tmp != s && tmp->data.item.type != type_street_turn_restriction_no &&
+ tmp->data.item.type != type_street_turn_restriction_only &&
+ is_turn_allowed(p, s, tmp))
+ route_graph_clone_segment(this, tmp, pn, tmp->end, AF_ONEWAYREV);
+ dbg(1,"To start %s\n",item_to_name(tmp->data.item.type));
+ tmp=tmp->start_next;
+ }
+ tmp=p->end;
+ while (tmp) {
+ if (tmp != s && tmp->data.item.type != type_street_turn_restriction_no &&
+ tmp->data.item.type != type_street_turn_restriction_only &&
+ is_turn_allowed(p, s, tmp))
+ route_graph_clone_segment(this, tmp, tmp->start, pn, AF_ONEWAY);
+ dbg(1,"To end %s\n",item_to_name(tmp->data.item.type));
+ tmp=tmp->end_next;
+ }
+}
+
+static void
+route_graph_process_restriction_point(struct route_graph *this, struct route_graph_point *p)
+{
+ struct route_graph_segment *tmp;
+ tmp=p->start;
+ dbg(1,"node 0x%x,0x%x\n",p->c.x,p->c.y);
+ while (tmp) {
+ if (tmp->data.item.type != type_street_turn_restriction_no &&
+ tmp->data.item.type != type_street_turn_restriction_only)
+ route_graph_process_restriction_segment(this, p, tmp, 1);
+ tmp=tmp->start_next;
+ }
+ tmp=p->end;
+ while (tmp) {
+ if (tmp->data.item.type != type_street_turn_restriction_no &&
+ tmp->data.item.type != type_street_turn_restriction_only)
+ route_graph_process_restriction_segment(this, p, tmp, -1);
+ tmp=tmp->end_next;
+ }
+ p->flags |= RP_TURN_RESTRICTION_RESOLVED;
+}
+
+static void
+route_graph_process_restrictions(struct route_graph *this)
+{
+ struct route_graph_point *curr;
+ int i;
+ dbg(1,"enter\n");
+ for (i = 0 ; i < HASH_SIZE ; i++) {
+ curr=this->hash[i];
+ while (curr) {
+ if (curr->flags & RP_TURN_RESTRICTION)
+ route_graph_process_restriction_point(this, curr);
+ curr=curr->hash_next;
+ }
+ }
+}
+
+static void
+route_graph_build_done(struct route_graph *rg, int cancel)
+{
+ dbg(1,"cancel=%d\n",cancel);
+ if (rg->idle_ev)
+ event_remove_idle(rg->idle_ev);
+ if (rg->idle_cb)
+ callback_destroy(rg->idle_cb);
+ map_rect_destroy(rg->mr);
+ mapset_close(rg->h);
+ route_free_selection(rg->sel);
+ rg->idle_ev=NULL;
+ rg->idle_cb=NULL;
+ rg->mr=NULL;
+ rg->h=NULL;
+ rg->sel=NULL;
+ route_graph_process_restrictions(rg);
+ if (! cancel)
+ callback_call_0(rg->done_cb);
+ rg->busy=0;
+}
+
+static void
+route_graph_build_idle(struct route_graph *rg)
+{
+ int count=1000;
+ struct item *item;
+
+ while (count > 0) {
+ for (;;) {
+ item=map_rect_get_item(rg->mr);
+ if (item)
+ break;
+ if (!route_graph_build_next_map(rg)) {
+ route_graph_build_done(rg, 0);
+ return;
+ }
+ }
+ if (item->type == type_traffic_distortion)
+ route_process_traffic_distortion(rg, item);
+ else if (item->type == type_street_turn_restriction_no || item->type == type_street_turn_restriction_only)
+ route_process_turn_restriction(rg, item);
+ else
+ route_process_street_graph(rg, item);
+ count--;
+ }
+}
+
+/**
+ * @brief Builds a new route graph from a mapset
+ *
+ * This function builds a new route graph from a map. Please note that this function does not
+ * add any routing information to the route graph - this has to be done via the route_graph_flood()
+ * function.
+ *
+ * The function does not create a graph covering the whole map, but only covering the rectangle
+ * between c1 and c2.
+ *
+ * @param ms The mapset to build the route graph from
+ * @param c1 Corner 1 of the rectangle to use from the map
+ * @param c2 Corner 2 of the rectangle to use from the map
+ * @param done_cb The callback which will be called when graph is complete
+ * @return The new route graph.
+ */
+static struct route_graph *
+route_graph_build(struct mapset *ms, struct coord *c1, struct coord *c2, struct callback *done_cb, int async)
+{
+ struct route_graph *ret=g_new0(struct route_graph, 1);
+
+ dbg(1,"enter\n");
+
+ ret->sel=route_calc_selection(c1, c2);
+ ret->h=mapset_open(ms);
+ ret->done_cb=done_cb;
+ ret->busy=1;
+ if (route_graph_build_next_map(ret)) {
+ if (async) {
+ ret->idle_cb=callback_new_1(callback_cast(route_graph_build_idle), ret);
+ ret->idle_ev=event_add_idle(50, ret->idle_cb);
+ }
+ } else
+ route_graph_build_done(ret, 0);
+
+ return ret;
+}
+
+static void
+route_graph_update_done(struct route *this, struct callback *cb)
+{
+ route_graph_flood(this->graph, this->dst, this->vehicleprofile, cb);
+}
+
+/**
+ * @brief Updates the route graph
+ *
+ * This updates the route graph after settings in the route have changed. It also
+ * adds routing information afterwards by calling route_graph_flood().
+ *
+ * @param this The route to update the graph for
+ */
+static void
+route_graph_update(struct route *this, struct callback *cb, int async)
+{
+ struct attr route_status;
+
+ route_status.type=attr_route_status;
+ route_graph_destroy(this->graph);
+ callback_destroy(this->route_graph_done_cb);
+ this->route_graph_done_cb=callback_new_2(callback_cast(route_graph_update_done), this, cb);
+ route_status.u.num=route_status_building_graph;
+ route_set_attr(this, &route_status);
+ this->graph=route_graph_build(this->ms, &this->pos->c, &this->dst->c, this->route_graph_done_cb, async);
+ if (! async) {
+ while (this->graph->busy)
+ route_graph_build_idle(this->graph);
+ }
+}
+
+/**
+ * @brief Gets street data for an item
+ *
+ * @param item The item to get the data for
+ * @return Street data for the item
+ */
+struct street_data *
+street_get_data (struct item *item)
+{
+ int count=0,*flags;
+ struct street_data *ret = NULL, *ret1;
+ struct attr flags_attr, maxspeed_attr;
+ const int step = 128;
+ int c;
+
+ do {
+ ret1=g_realloc(ret, sizeof(struct street_data)+(count+step)*sizeof(struct coord));
+ if (!ret1) {
+ if (ret)
+ g_free(ret);
+ return NULL;
+ }
+ ret = ret1;
+ c = item_coord_get(item, &ret->c[count], step);
+ count += c;
+ } while (c && c == step);
+
+ ret1=g_realloc(ret, sizeof(struct street_data)+count*sizeof(struct coord));
+ if (ret1)
+ ret = ret1;
+ ret->item=*item;
+ ret->count=count;
+ if (item_attr_get(item, attr_flags, &flags_attr))
+ ret->flags=flags_attr.u.num;
+ else {
+ flags=item_get_default_flags(item->type);
+ if (flags)
+ ret->flags=*flags;
+ else
+ ret->flags=0;
+ }
+
+ ret->maxspeed = -1;
+ if (ret->flags & AF_SPEED_LIMIT) {
+ if (item_attr_get(item, attr_maxspeed, &maxspeed_attr)) {
+ ret->maxspeed = maxspeed_attr.u.num;
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * @brief Copies street data
+ *
+ * @param orig The street data to copy
+ * @return The copied street data
+ */
+struct street_data *
+street_data_dup(struct street_data *orig)
+{
+ struct street_data *ret;
+ int size=sizeof(struct street_data)+orig->count*sizeof(struct coord);
+
+ ret=g_malloc(size);
+ memcpy(ret, orig, size);
+
+ return ret;
+}
+
+/**
+ * @brief Frees street data
+ *
+ * @param sd Street data to be freed
+ */
+void
+street_data_free(struct street_data *sd)
+{
+ g_free(sd);
+}
+
+/**
+ * @brief Finds the nearest street to a given coordinate
+ *
+ * @param ms The mapset to search in for the street
+ * @param pc The coordinate to find a street nearby
+ * @return The nearest street
+ */
+static struct route_info *
+route_find_nearest_street(struct vehicleprofile *vehicleprofile, struct mapset *ms, struct pcoord *pc)
+{
+ struct route_info *ret=NULL;
+ int max_dist=1000;
+ struct map_selection *sel;
+ int dist,mindist=0,pos;
+ struct mapset_handle *h;
+ struct map *m;
+ struct map_rect *mr;
+ struct item *item;
+ struct coord lp;
+ struct street_data *sd;
+ struct coord c;
+ struct coord_geo g;
+
+ ret=g_new0(struct route_info, 1);
+ mindist = INT_MAX;
+
+ h=mapset_open(ms);
+ while ((m=mapset_next(h,1))) {
+ c.x = pc->x;
+ c.y = pc->y;
+ if (map_projection(m) != pc->pro) {
+ transform_to_geo(pc->pro, &c, &g);
+ transform_from_geo(map_projection(m), &g, &c);
+ }
+ sel = route_rect(18, &c, &c, 0, max_dist);
+ if (!sel)
+ continue;
+ mr=map_rect_new(m, sel);
+ if (!mr) {
+ map_selection_destroy(sel);
+ continue;
+ }
+ while ((item=map_rect_get_item(mr))) {
+ if (item_get_default_flags(item->type)) {
+ sd=street_get_data(item);
+ if (!sd)
+ continue;
+ dist=transform_distance_polyline_sq(sd->c, sd->count, &c, &lp, &pos);
+ if (dist < mindist && (
+ (sd->flags & vehicleprofile->flags_forward_mask) == vehicleprofile->flags ||
+ (sd->flags & vehicleprofile->flags_reverse_mask) == vehicleprofile->flags)) {
+ mindist = dist;
+ if (ret->street) {
+ street_data_free(ret->street);
+ }
+ ret->c=c;
+ ret->lp=lp;
+ ret->pos=pos;
+ ret->street=sd;
+ dbg(1,"dist=%d id 0x%x 0x%x pos=%d\n", dist, item->id_hi, item->id_lo, pos);
+ } else {
+ street_data_free(sd);
+ }
+ }
+ }
+ map_selection_destroy(sel);
+ map_rect_destroy(mr);
+ }
+ mapset_close(h);
+
+ if (!ret->street || mindist > max_dist*max_dist) {
+ if (ret->street) {
+ street_data_free(ret->street);
+ dbg(1,"Much too far %d > %d\n", mindist, max_dist);
+ }
+ g_free(ret);
+ ret = NULL;
+ }
+
+ return ret;
+}
+
+/**
+ * @brief Destroys a route_info
+ *
+ * @param info The route info to be destroyed
+ */
+void
+route_info_free(struct route_info *inf)
+{
+ if (inf->street)
+ street_data_free(inf->street);
+ g_free(inf);
+}
+
+
+#include "point.h"
+
+/**
+ * @brief Returns street data for a route info
+ *
+ * @param rinf The route info to return the street data for
+ * @return Street data for the route info
+ */
+struct street_data *
+route_info_street(struct route_info *rinf)
+{
+ return rinf->street;
+}
+
+#if 0
+struct route_crossings *
+route_crossings_get(struct route *this, struct coord *c)
+{
+ struct route_point *pnt;
+ struct route_segment *seg;
+ int crossings=0;
+ struct route_crossings *ret;
+
+ pnt=route_graph_get_point(this, c);
+ seg=pnt->start;
+ while (seg) {
+ printf("start: 0x%x 0x%x\n", seg->item.id_hi, seg->item.id_lo);
+ crossings++;
+ seg=seg->start_next;
+ }
+ seg=pnt->end;
+ while (seg) {
+ printf("end: 0x%x 0x%x\n", seg->item.id_hi, seg->item.id_lo);
+ crossings++;
+ seg=seg->end_next;
+ }
+ ret=g_malloc(sizeof(struct route_crossings)+crossings*sizeof(struct route_crossing));
+ ret->count=crossings;
+ return ret;
+}
+#endif
+
+
+struct map_rect_priv {
+ struct route_info_handle *ri;
+ enum attr_type attr_next;
+ int pos;
+ struct map_priv *mpriv;
+ struct item item;
+ unsigned int last_coord;
+ struct route_path *path;
+ struct route_path_segment *seg,*seg_next;
+ struct route_graph_point *point;
+ struct route_graph_segment *rseg;
+ char *str;
+ int hash_bucket;
+ struct coord *coord_sel; /**< Set this to a coordinate if you want to filter for just a single route graph point */
+ struct route_graph_point_iterator it;
+};
+
+static void
+rm_coord_rewind(void *priv_data)
+{
+ struct map_rect_priv *mr = priv_data;
+ mr->last_coord = 0;
+}
+
+static void
+rm_attr_rewind(void *priv_data)
+{
+ struct map_rect_priv *mr = priv_data;
+ mr->attr_next = attr_street_item;
+}
+
+static int
+rm_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
+{
+ struct map_rect_priv *mr = priv_data;
+ struct route_path_segment *seg=mr->seg;
+ struct route *route=mr->mpriv->route;
+ if (mr->item.type != type_street_route)
+ return 0;
+ attr->type=attr_type;
+ switch (attr_type) {
+ case attr_any:
+ while (mr->attr_next != attr_none) {
+ if (rm_attr_get(priv_data, mr->attr_next, attr))
+ return 1;
+ }
+ return 0;
+ case attr_maxspeed:
+ mr->attr_next = attr_street_item;
+ if (seg && seg->data->flags && AF_SPEED_LIMIT) {
+ attr->u.num=RSD_MAXSPEED(seg->data);
+
+ } else {
+ return 0;
+ }
+ return 1;
+ case attr_street_item:
+ mr->attr_next=attr_direction;
+ if (seg && seg->data->item.map)
+ attr->u.item=&seg->data->item;
+ else
+ return 0;
+ return 1;
+ case attr_direction:
+ mr->attr_next=attr_route;
+ if (seg)
+ attr->u.num=seg->direction;
+ else
+ return 0;
+ return 1;
+ case attr_route:
+ mr->attr_next=attr_length;
+ attr->u.route = mr->mpriv->route;
+ return 1;
+ case attr_length:
+ mr->attr_next=attr_time;
+ if (seg)
+ attr->u.num=seg->data->len;
+ else
+ return 0;
+ return 1;
+ case attr_time:
+ mr->attr_next=attr_none;
+ if (seg)
+ attr->u.num=route_time_seg(route->vehicleprofile, seg->data, NULL);
+ else
+ return 0;
+ return 1;
+ case attr_label:
+ mr->attr_next=attr_none;
+ return 0;
+ default:
+ mr->attr_next=attr_none;
+ attr->type=attr_none;
+ return 0;
+ }
+ return 0;
+}
+
+static int
+rm_coord_get(void *priv_data, struct coord *c, int count)
+{
+ struct map_rect_priv *mr = priv_data;
+ struct route_path_segment *seg = mr->seg;
+ int i,rc=0;
+ struct route *r = mr->mpriv->route;
+ enum projection pro = route_projection(r);
+
+ if (pro == projection_none)
+ return 0;
+ if (mr->item.type == type_route_start || mr->item.type == type_route_start_reverse || mr->item.type == type_route_end) {
+ if (! count || mr->last_coord)
+ return 0;
+ mr->last_coord=1;
+ if (mr->item.type == type_route_start || mr->item.type == type_route_start_reverse)
+ c[0]=r->pos->c;
+ else
+ c[0]=r->dst->c;
+ return 1;
+ }
+ if (! seg)
+ return 0;
+ for (i=0; i < count; i++) {
+ if (mr->last_coord >= seg->ncoords)
+ break;
+ if (i >= seg->ncoords)
+ break;
+ if (pro != projection_mg)
+ transform_from_to(&seg->c[mr->last_coord++], pro,
+ &c[i],projection_mg);
+ else
+ c[i] = seg->c[mr->last_coord++];
+ rc++;
+ }
+ dbg(1,"return %d\n",rc);
+ return rc;
+}
+
+static struct item_methods methods_route_item = {
+ rm_coord_rewind,
+ rm_coord_get,
+ rm_attr_rewind,
+ rm_attr_get,
+};
+
+static void
+rp_attr_rewind(void *priv_data)
+{
+ struct map_rect_priv *mr = priv_data;
+ mr->attr_next = attr_label;
+}
+
+static int
+rp_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
+{
+ struct map_rect_priv *mr = priv_data;
+ struct route_graph_point *p = mr->point;
+ struct route_graph_segment *seg = mr->rseg;
+ struct route *route=mr->mpriv->route;
+
+ attr->type=attr_type;
+ switch (attr_type) {
+ case attr_any: // works only with rg_points for now
+ while (mr->attr_next != attr_none) {
+ dbg(0,"querying %s\n", attr_to_name(mr->attr_next));
+ if (rp_attr_get(priv_data, mr->attr_next, attr))
+ return 1;
+ }
+ return 0;
+ case attr_maxspeed:
+ mr->attr_next = attr_label;
+ if (mr->item.type != type_rg_segment)
+ return 0;
+ if (seg && (seg->data.flags & AF_SPEED_LIMIT)) {
+ attr->type = attr_maxspeed;
+ attr->u.num=RSD_MAXSPEED(&seg->data);
+ return 1;
+ } else {
+ return 0;
+ }
+ case attr_label:
+ mr->attr_next=attr_street_item;
+ if (mr->item.type != type_rg_point)
+ return 0;
+ attr->type = attr_label;
+ if (mr->str)
+ g_free(mr->str);
+ if (p->value != INT_MAX)
+ mr->str=g_strdup_printf("%d", p->value);
+ else
+ mr->str=g_strdup("-");
+ attr->u.str = mr->str;
+ return 1;
+ case attr_street_item:
+ mr->attr_next=attr_flags;
+ if (mr->item.type != type_rg_segment)
+ return 0;
+ if (seg && seg->data.item.map)
+ attr->u.item=&seg->data.item;
+ else
+ return 0;
+ return 1;
+ case attr_flags:
+ mr->attr_next = attr_direction;
+ if (mr->item.type != type_rg_segment)
+ return 0;
+ if (seg) {
+ attr->u.num = seg->data.flags;
+ } else {
+ return 0;
+ }
+ return 1;
+ case attr_direction:
+ mr->attr_next = attr_debug;
+ // This only works if the map has been opened at a single point, and in that case indicates if the
+ // segment returned last is connected to this point via its start (1) or its end (-1)
+ if (!mr->coord_sel || (mr->item.type != type_rg_segment))
+ return 0;
+ if (seg->start == mr->point) {
+ attr->u.num=1;
+ } else if (seg->end == mr->point) {
+ attr->u.num=-1;
+ } else {
+ return 0;
+ }
+ return 1;
+ case attr_debug:
+ mr->attr_next=attr_none;
+ if (mr->str)
+ g_free(mr->str);
+ switch (mr->item.type) {
+ case type_rg_point:
+ {
+ struct route_graph_segment *tmp;
+ int start=0;
+ int end=0;
+ tmp=p->start;
+ while (tmp) {
+ start++;
+ tmp=tmp->start_next;
+ }
+ tmp=p->end;
+ while (tmp) {
+ end++;
+ tmp=tmp->end_next;
+ }
+ mr->str=g_strdup_printf("%d %d %p (0x%x,0x%x)", start, end, p, p->c.x, p->c.y);
+ attr->u.str = mr->str;
+ }
+ return 1;
+ case type_rg_segment:
+ if (! seg)
+ return 0;
+ mr->str=g_strdup_printf("len %d time %d start %p end %p",seg->data.len, route_time_seg(route->vehicleprofile, &seg->data, NULL), seg->start, seg->end);
+ attr->u.str = mr->str;
+ return 1;
+ default:
+ return 0;
+ }
+ return 0;
+ default:
+ mr->attr_next=attr_none;
+ attr->type=attr_none;
+ return 0;
+ }
+}
+
+/**
+ * @brief Returns the coordinates of a route graph item
+ *
+ * @param priv_data The route graph item's private data
+ * @param c Pointer where to store the coordinates
+ * @param count How many coordinates to get at a max?
+ * @return The number of coordinates retrieved
+ */
+static int
+rp_coord_get(void *priv_data, struct coord *c, int count)
+{
+ struct map_rect_priv *mr = priv_data;
+ struct route_graph_point *p = mr->point;
+ struct route_graph_segment *seg = mr->rseg;
+ int rc = 0,i,dir;
+ struct route *r = mr->mpriv->route;
+ enum projection pro = route_projection(r);
+
+ if (pro == projection_none)
+ return 0;
+ for (i=0; i < count; i++) {
+ if (mr->item.type == type_rg_point) {
+ if (mr->last_coord >= 1)
+ break;
+ if (pro != projection_mg)
+ transform_from_to(&p->c, pro,
+ &c[i],projection_mg);
+ else
+ c[i] = p->c;
+ } else {
+ if (mr->last_coord >= 2)
+ break;
+ dir=0;
+ if (seg->end->seg == seg)
+ dir=1;
+ if (mr->last_coord)
+ dir=1-dir;
+ if (dir) {
+ if (pro != projection_mg)
+ transform_from_to(&seg->end->c, pro,
+ &c[i],projection_mg);
+ else
+ c[i] = seg->end->c;
+ } else {
+ if (pro != projection_mg)
+ transform_from_to(&seg->start->c, pro,
+ &c[i],projection_mg);
+ else
+ c[i] = seg->start->c;
+ }
+ }
+ mr->last_coord++;
+ rc++;
+ }
+ return rc;
+}
+
+static struct item_methods methods_point_item = {
+ rm_coord_rewind,
+ rp_coord_get,
+ rp_attr_rewind,
+ rp_attr_get,
+};
+
+static void
+rp_destroy(struct map_priv *priv)
+{
+ g_free(priv);
+}
+
+static void
+rm_destroy(struct map_priv *priv)
+{
+ g_free(priv);
+}
+
+static struct map_rect_priv *
+rm_rect_new(struct map_priv *priv, struct map_selection *sel)
+{
+ struct map_rect_priv * mr;
+ dbg(1,"enter\n");
+ if (! route_get_pos(priv->route))
+ return NULL;
+ if (! route_get_dst(priv->route))
+ return NULL;
+#if 0
+ if (! priv->route->path2)
+ return NULL;
+#endif
+ mr=g_new0(struct map_rect_priv, 1);
+ mr->mpriv = priv;
+ mr->item.priv_data = mr;
+ mr->item.type = type_none;
+ mr->item.meth = &methods_route_item;
+ if (priv->route->path2) {
+ mr->path=priv->route->path2;
+ mr->seg_next=mr->path->path;
+ mr->path->in_use++;
+ } else
+ mr->seg_next=NULL;
+ return mr;
+}
+
+/**
+ * @brief Opens a new map rectangle on the route graph's map
+ *
+ * This function opens a new map rectangle on the route graph's map.
+ * The "sel" parameter enables you to only search for a single route graph
+ * point on this map (or exactly: open a map rectangle that only contains
+ * this one point). To do this, pass here a single map selection, whose
+ * c_rect has both coordinates set to the same point. Otherwise this parameter
+ * has no effect.
+ *
+ * @param priv The route graph map's private data
+ * @param sel Here it's possible to specify a point for which to search. Please read the function's description.
+ * @return A new map rect's private data
+ */
+static struct map_rect_priv *
+rp_rect_new(struct map_priv *priv, struct map_selection *sel)
+{
+ struct map_rect_priv * mr;
+
+ dbg(1,"enter\n");
+ if (! priv->route->graph)
+ return NULL;
+ mr=g_new0(struct map_rect_priv, 1);
+ mr->mpriv = priv;
+ mr->item.priv_data = mr;
+ mr->item.type = type_rg_point;
+ mr->item.meth = &methods_point_item;
+ if (sel) {
+ if ((sel->u.c_rect.lu.x == sel->u.c_rect.rl.x) && (sel->u.c_rect.lu.y == sel->u.c_rect.rl.y)) {
+ mr->coord_sel = g_malloc(sizeof(struct coord));
+ *(mr->coord_sel) = sel->u.c_rect.lu;
+ }
+ }
+ return mr;
+}
+
+static void
+rm_rect_destroy(struct map_rect_priv *mr)
+{
+ if (mr->str)
+ g_free(mr->str);
+ if (mr->coord_sel) {
+ g_free(mr->coord_sel);
+ }
+ if (mr->path) {
+ mr->path->in_use--;
+ if (mr->path->update_required && !mr->path->in_use)
+ route_path_update_done(mr->mpriv->route, mr->path->update_required-1);
+ }
+
+ g_free(mr);
+}
+
+static struct item *
+rp_get_item(struct map_rect_priv *mr)
+{
+ struct route *r = mr->mpriv->route;
+ struct route_graph_point *p = mr->point;
+ struct route_graph_segment *seg = mr->rseg;
+
+ if (mr->item.type == type_rg_point) {
+ if (mr->coord_sel) {
+ // We are supposed to return only the point at one specified coordinate...
+ if (!p) {
+ p = route_graph_get_point_last(r->graph, mr->coord_sel);
+ if (!p) {
+ mr->point = NULL; // This indicates that no point has been found
+ } else {
+ mr->it = rp_iterator_new(p);
+ }
+ } else {
+ p = NULL;
+ }
+ } else {
+ if (!p) {
+ mr->hash_bucket=0;
+ p = r->graph->hash[0];
+ } else
+ p=p->hash_next;
+ while (!p) {
+ mr->hash_bucket++;
+ if (mr->hash_bucket >= HASH_SIZE)
+ break;
+ p = r->graph->hash[mr->hash_bucket];
+ }
+ }
+ if (p) {
+ mr->point = p;
+ mr->item.id_lo++;
+ rm_coord_rewind(mr);
+ rp_attr_rewind(mr);
+ return &mr->item;
+ } else
+ mr->item.type = type_rg_segment;
+ }
+
+ if (mr->coord_sel) {
+ if (!mr->point) { // This means that no point has been found
+ return NULL;
+ }
+ seg = rp_iterator_next(&(mr->it));
+ } else {
+ if (!seg)
+ seg=r->graph->route_segments;
+ else
+ seg=seg->next;
+ }
+
+ if (seg) {
+ mr->rseg = seg;
+ mr->item.id_lo++;
+ rm_coord_rewind(mr);
+ rp_attr_rewind(mr);
+ return &mr->item;
+ }
+ return NULL;
+
+}
+
+static struct item *
+rp_get_item_byid(struct map_rect_priv *mr, int id_hi, int id_lo)
+{
+ struct item *ret=NULL;
+ while (id_lo-- > 0)
+ ret=rp_get_item(mr);
+ return ret;
+}
+
+
+static struct item *
+rm_get_item(struct map_rect_priv *mr)
+{
+ struct route *route=mr->mpriv->route;
+ dbg(1,"enter\n", mr->pos);
+
+ switch (mr->item.type) {
+ case type_none:
+ if (route->pos && route->pos->street_direction && route->pos->street_direction != route->pos->dir)
+ mr->item.type=type_route_start_reverse;
+ else
+ mr->item.type=type_route_start;
+ if (route->pos)
+ break;
+ default:
+ mr->item.type=type_street_route;
+ mr->seg=mr->seg_next;
+ if (mr->seg) {
+ mr->seg_next=mr->seg->next;
+ break;
+ }
+ mr->item.type=type_route_end;
+ if (mr->mpriv->route->dst)
+ break;
+ case type_route_end:
+ return NULL;
+ }
+ mr->last_coord = 0;
+ mr->item.id_lo++;
+ rm_attr_rewind(mr);
+ return &mr->item;
+}
+
+static struct item *
+rm_get_item_byid(struct map_rect_priv *mr, int id_hi, int id_lo)
+{
+ struct item *ret=NULL;
+ while (id_lo-- > 0)
+ ret=rm_get_item(mr);
+ return ret;
+}
+
+static struct map_methods route_meth = {
+ projection_mg,
+ "utf-8",
+ rm_destroy,
+ rm_rect_new,
+ rm_rect_destroy,
+ rm_get_item,
+ rm_get_item_byid,
+ NULL,
+ NULL,
+ NULL,
+};
+
+static struct map_methods route_graph_meth = {
+ projection_mg,
+ "utf-8",
+ rp_destroy,
+ rp_rect_new,
+ rm_rect_destroy,
+ rp_get_item,
+ rp_get_item_byid,
+ NULL,
+ NULL,
+ NULL,
+};
+
+static struct map_priv *
+route_map_new_helper(struct map_methods *meth, struct attr **attrs, int graph)
+{
+ struct map_priv *ret;
+ struct attr *route_attr;
+
+ route_attr=attr_search(attrs, NULL, attr_route);
+ if (! route_attr)
+ return NULL;
+ ret=g_new0(struct map_priv, 1);
+ if (graph)
+ *meth=route_graph_meth;
+ else
+ *meth=route_meth;
+ ret->route=route_attr->u.route;
+
+ return ret;
+}
+
+static struct map_priv *
+route_map_new(struct map_methods *meth, struct attr **attrs)
+{
+ return route_map_new_helper(meth, attrs, 0);
+}
+
+static struct map_priv *
+route_graph_map_new(struct map_methods *meth, struct attr **attrs)
+{
+ return route_map_new_helper(meth, attrs, 1);
+}
+
+static struct map *
+route_get_map_helper(struct route *this_, struct map **map, char *type, char *description)
+{
+ if (! *map)
+ *map=map_new(NULL, (struct attr*[]){
+ &(struct attr){attr_type,{type}},
+ &(struct attr){attr_route,.u.route=this_},
+ &(struct attr){attr_data,{""}},
+ &(struct attr){attr_description,{description}},
+ NULL});
+
+ return *map;
+}
+
+/**
+ * @brief Returns a new map containing the route path
+ *
+ * This function returns a new map containing the route path.
+ *
+ * @important Do not map_destroy() this!
+ *
+ * @param this_ The route to get the map of
+ * @return A new map containing the route path
+ */
+struct map *
+route_get_map(struct route *this_)
+{
+ return route_get_map_helper(this_, &this_->map, "route","Route");
+}
+
+
+/**
+ * @brief Returns a new map containing the route graph
+ *
+ * This function returns a new map containing the route graph.
+ *
+ * @important Do not map_destroy() this!
+ *
+ * @param this_ The route to get the map of
+ * @return A new map containing the route graph
+ */
+struct map *
+route_get_graph_map(struct route *this_)
+{
+ return route_get_map_helper(this_, &this_->graph_map, "route_graph","Route Graph");
+}
+
+void
+route_set_projection(struct route *this_, enum projection pro)
+{
+}
+
+int
+route_set_attr(struct route *this_, struct attr *attr)
+{
+ int attr_updated=0;
+ switch (attr->type) {
+ case attr_route_status:
+ attr_updated = (this_->route_status != attr->u.num);
+ this_->route_status = attr->u.num;
+ break;
+ default:
+ return 0;
+ }
+ if (attr_updated)
+ callback_list_call_attr_2(this_->cbl2, attr->type, this_, attr);
+ return 1;
+}
+
+int
+route_add_attr(struct route *this_, struct attr *attr)
+{
+ switch (attr->type) {
+ case attr_callback:
+ dbg(1,"add\n");
+ callback_list_add(this_->cbl2, attr->u.callback);
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+int
+route_remove_attr(struct route *this_, struct attr *attr)
+{
+ switch (attr->type) {
+ case attr_callback:
+ callback_list_remove(this_->cbl2, attr->u.callback);
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+int
+route_get_attr(struct route *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
+{
+ int ret=1;
+ switch (type) {
+ case attr_map:
+ attr->u.map=route_get_map(this_);
+ ret=(attr->u.map != NULL);
+ break;
+ case attr_route_status:
+ attr->u.num=this_->route_status;
+ break;
+ default:
+ return 0;
+ }
+ attr->type=type;
+ return ret;
+}
+
+void
+route_init(void)
+{
+ plugin_register_map_type("route", route_map_new);
+ plugin_register_map_type("route_graph", route_graph_map_new);
+}
+
diff --git a/route.h b/route.h
new file mode 100644
index 00000000..e9b03c84
--- /dev/null
+++ b/route.h
@@ -0,0 +1,133 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/** @file
+ *
+ * @brief Contains exported code for route.c
+ *
+ * This file contains code that works together with route.c and that is exported to
+ * other modules.
+ */
+
+#ifndef NAVIT_ROUTE_H
+#define NAVIT_ROUTE_H
+
+enum route_status {
+ route_status_no_destination=0,
+ route_status_not_found=1|2,
+ route_status_building_path=1|4,
+ route_status_building_graph=1|4|8,
+ route_status_path_done_new=1|16,
+ route_status_path_done_incremental=1|32,
+};
+
+struct route_crossing {
+ long segid;
+ int dir;
+};
+
+struct route_crossings {
+ int count;
+ struct route_crossing crossing[0];
+};
+
+/**
+ * @brief Information about a street
+ *
+ * This contains information about a certain street
+ */
+struct street_data {
+ struct item item; /**< The map item for this street */
+ int count; /**< Number of coordinates this street has */
+ int flags;
+ int maxspeed; /**< Maximum speed allowed on this street. */
+ struct coord c[0]; /**< Pointer to the coordinates of this street.
+ * DO NOT INSERT FIELDS AFTER THIS. */
+};
+
+/* prototypes */
+enum item_type;
+struct coord;
+struct displaylist;
+struct item;
+struct map_selection;
+struct mapset;
+struct route;
+struct route_info;
+struct route_info_handle;
+struct route_path_coord_handle;
+struct route_path_handle;
+struct route_path_segment;
+struct route_preferences;
+struct street_data;
+struct tracking;
+struct transformation;
+struct route *route_new(struct attr *parent, struct attr **attrs);
+void route_set_mapset(struct route *this, struct mapset *ms);
+void route_set_profile(struct route *this, struct vehicleprofile *prof);
+struct mapset *route_get_mapset(struct route *this);
+struct route_info *route_get_pos(struct route *this);
+struct route_info *route_get_dst(struct route *this);
+int *route_get_speedlist(struct route *this);
+int route_get_path_set(struct route *this);
+int route_set_speed(struct route *this, enum item_type type, int value);
+int route_contains(struct route *this, struct item *item);
+void route_set_position(struct route *this, struct pcoord *pos);
+void route_set_position_from_tracking(struct route *this, struct tracking *tracking, enum projection pro);
+struct map_selection *route_rect(int order, struct coord *c1, struct coord *c2, int rel, int abs);
+void route_set_destination(struct route *this, struct pcoord *dst, int async);
+struct route_path_handle *route_path_open(struct route *this);
+struct route_path_segment *route_path_get_segment(struct route_path_handle *h);
+struct coord *route_path_segment_get_start(struct route_path_segment *s);
+struct coord *route_path_segment_get_end(struct route_path_segment *s);
+struct item *route_path_segment_get_item(struct route_path_segment *s);
+int route_path_segment_get_length(struct route_path_segment *s);
+int route_path_segment_get_time(struct route_path_segment *s);
+void route_path_close(struct route_path_handle *h);
+struct route_path_coord_handle *route_path_coord_open(struct route *this);
+struct coord *route_path_coord_get(struct route_path_coord_handle *h);
+void route_path_coord_close(struct route_path_coord_handle *h);
+int route_time(struct route_preferences *preferences, struct item *item, int len, int maxspeed);
+int route_info_length(struct route_info *pos, struct route_info *dst, int dir);
+struct street_data *street_get_data(struct item *item);
+struct street_data *street_data_dup(struct street_data *orig);
+void street_data_free(struct street_data *sd);
+void route_info_free(struct route_info *inf);
+struct street_data *route_info_street(struct route_info *rinf);
+struct coord *route_info_point(struct route_info *rinf, int point);
+struct route_info_handle *route_info_open(struct route_info *start, struct route_info *end, int dir);
+struct coord *route_info_get(struct route_info_handle *h);
+void route_info_close(struct route_info_handle *h);
+void route_draw(struct route *this, struct transformation *t, struct displaylist *dsp);
+struct map *route_get_map(struct route *route);
+struct map *route_get_graph_map(struct route *route);
+void route_set_projection(struct route *this_, enum projection pro);
+int route_destination_reached(struct route *this);
+int route_set_attr(struct route *this_, struct attr *attr);
+int route_add_attr(struct route *this_, struct attr *attr);
+int route_remove_attr(struct route *this_, struct attr *attr);
+int route_get_attr(struct route *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
+void route_init(void);
+int route_pos_contains(struct route *this, struct item *item);
+struct coord route_get_coord_dist(struct route *this_, int dist);
+
+/* end of prototypes */
+
+#endif
+
diff --git a/script/cabify.sh b/script/cabify.sh
new file mode 100755
index 00000000..18401a53
--- /dev/null
+++ b/script/cabify.sh
@@ -0,0 +1,83 @@
+#! /bin/bash
+
+function check_pocketcab()
+{
+ which pocketpc-cab &> /dev/null
+ if [ $? -ne 0 ]
+ then
+ echo "You don't have pocketpc-cab installed or not in PATH"
+ exit
+ fi
+}
+
+SRCDIR="../.."
+BASEDIR="navit"
+MAPSDIR=""
+CABLIST="/tmp/navit.lst"
+CABNAME=""
+
+check_pocketcab
+
+if [ "$1" == "" ]
+then
+ echo "$0 cabname [sourcedir [pocketinstalldir [navit.xml mapsdir]]]"
+ exit
+else
+ CABNAME="$1"
+fi
+[ "$2" != "" ] && SRCDIR="$2"
+[ "$3" != "" ] && BASEDIR="$3"
+if [ "$4" != "" ];
+then
+ NAVITXML="$4"
+else
+ NAVITXML=""
+fi
+[ "$5" != "" ] && MAPSDIR="$5"
+
+echo "Source dir: $SRCDIR"
+echo "PocketPc dir: $BASEDIR"
+[ "$NAVITXML" != "" ] && echo "Navitxml: $NAVITXML"
+[ "$MAPSDIR" != "" ] && echo "Maps: $MAPSDIR"
+
+echo -n > $CABLIST.$$
+
+for i in `ls $SRCDIR/locale/*/*/*.mo`
+do
+ bn="`basename "$i"`"
+ d=${i##$SRCDIR/}
+ echo "$i $BASEDIR/$d" >> $CABLIST.$$
+done
+
+for i in $SRCDIR/navit/xpm/*.xpm
+do
+ bn="`basename "$i"`"
+ echo "$i $BASEDIR/xpm/" >> $CABLIST.$$
+done
+
+echo "$SRCDIR/navit/navit.exe $BASEDIR/" >> $CABLIST.$$
+if [ "$NAVITXML" != "" ]
+then
+echo "$NAVITXML $BASEDIR/" >> $CABLIST.$$
+fi
+if [ "$MAPSDIR" != "" ]
+then
+for i in $MAPSDIR/*.bin
+do
+ bn="`basename "$i"`"
+ echo "$i $BASEDIR/maps/$bn" >> $CABLIST.$$
+done
+for i in $MAPSDIR/*.txt
+do
+ bn="`basename "$i"`"
+ echo "$i $BASEDIR/maps/$bn" >> $CABLIST.$$
+done
+for i in $MAPSDIR/*.img
+do
+ bn="`basename "$i"`"
+ echo "$i $BASEDIR/maps/$bn" >> $CABLIST.$$
+done
+fi
+pocketpc-cab -p "Navit Team" -a "Navit" $CABLIST.$$ $CABNAME
+rm $CABLIST.$$
+
diff --git a/script/check_itemdef b/script/check_itemdef
new file mode 100755
index 00000000..c2d23e45
--- /dev/null
+++ b/script/check_itemdef
@@ -0,0 +1,42 @@
+#! /bin/sh
+function check_item_def
+{
+ grep -q "[(,]$1)" ../item_def.h || echo "$1 missing"
+}
+
+function check_item_xml
+{
+ grep -q "^$1\$" check.$$ || echo "$1 will not be rendered"
+}
+
+
+awk '/<layout name="Car"/,/<\/layout/ { if (/<itemgra/) {print $0} }' < ../navit.xml | sed 's/.*item_types="\([^"]*\)".*/\1/' | tr "," "\012" | sort -u >check.$$
+echo item_def.h
+grep "^ITEM" ../item_def.h | sed -e "s/ITEM(\(.*\))/\1/" -e "s/ITEM2([^,]*,\(.*\))/\1/" |
+while read -r x
+do
+ check_item_xml "$x"
+done
+
+rm -f check.$$
+echo osm2navit.c
+egrep '^ "[nw] +[^ ]+ +[^ ]+' ../osm2navit.c | sed "s/.* //" | sort -u |
+while read -r x
+do
+ check_item_def "${x%%\\n\"}"
+done
+
+echo "navit.xml"
+grep '<itemgra item_types="' <../navit.xml | cut -d \" -f 2 | tr "," "\012" |
+while read -r x
+do
+ check_item_def "$x"
+done
+
+echo "garmintypes.txt"
+grep "^[0-9]" ../data/garmin/garmintypes.txt | sed -e 's/[A-Z][A-Z]*, //' -e 's/.*= \([^,]*\),.*/\1/' | sort -u |
+while read -r x
+do
+ check_item_def "$x"
+done
+
diff --git a/navit/script/download_index.html b/script/download_index.html
index fed33e17..fed33e17 100644
--- a/navit/script/download_index.html
+++ b/script/download_index.html
diff --git a/script/gensvg b/script/gensvg
new file mode 100755
index 00000000..b7a4241c
--- /dev/null
+++ b/script/gensvg
@@ -0,0 +1,266 @@
+#! /bin/sh
+
+makearrow()
+{
+cat <<EOT
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M $xl0,$yl0 L $xl1,$yl1 C $xcc0,$ycc0 $xcc1,$ycc1 $xc0,$yc0$extra"
+ style="fill:none;stroke:#${colval};stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate($xa0,$ya0) scale(3) rotate($angle)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#${colval};stroke:#${colval};stroke-linejoin:round"
+ />
+
+ </g>
+</svg>
+EOT
+}
+
+makeroundabout()
+{
+cat <<EOT
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M $xa0 $ya0 A $r $r 0 $long1 $sweep $xl1 $yl1"
+ style="fill:none;stroke:#${colval};stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M $xl0,$yl0 L $xl1,$yl1 A $r $r 0 $long2 $sweep $xa0 $ya0 L $xl2 $yl2"
+ style="fill:none;stroke:#${colval};stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate($xl2,$yl2) scale(2) rotate($angle)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#${colval};stroke:#${colval};stroke-linejoin:round"
+ />
+ </g>
+</svg>
+EOT
+}
+
+yl0=63
+for col in bk wh
+do
+ case $col in
+ bk)
+ colval="000000"
+ ;;
+ wh)
+ colval="ffffff"
+ ;;
+ esac
+ for dir in left right
+ do
+ xl0=32
+ xl1=32
+ angle=360
+ step=-45
+ xa=33.5
+ xb=26
+ xc=16
+ xd=22
+ xe=32
+ xf=28
+ if [ "$dir" = "right" ]
+ then
+ angle=0
+ step=45
+ xa=30.5
+ xb=$((64-xb))
+ xc=$((64-xc))
+ xd=$((64-xd))
+ xe=$((64-xe))
+ xf=$((64-xf))
+ fi
+ for st in 1 2 3
+ do
+ case $st in
+ 1)
+ yl1=42
+ yc0=20
+ ycc1=31
+ ycc0=31
+ ya0=20
+ xc0=$xd
+ xa0=$xd
+ xcc0=$xe
+ xcc1=$xe
+ ;;
+ 2)
+ yl1=25
+ yc0=20
+ ycc1=20
+ ycc0=22
+ ya0=20
+ xc0=$xd
+ xa0=$xd
+ xcc0=$xe
+ xcc1=$xf
+ ;;
+ 3)
+ yl1=32
+ yc0=26
+ ycc1=16
+ ycc0=10
+ ya0=26
+ xc0=$xc
+ xa0=$xc
+ xcc0=$xa
+ xcc1=$xb
+ ;;
+ esac
+ angle=$((angle+step))
+ filename="nav_${dir}_${st}_$col.svg"
+ extra=""
+ makearrow >$filename
+ done
+ filename="nav_turnaround_${dir}_$col.svg"
+ angle=180
+ xcc0=48
+ xc0=22
+ xcc1=22
+ xl0=48
+ xl1=48
+ xa0=22
+ if [ "$dir" = "right" ]
+ then
+ xcc0=$((64-$xcc0))
+ xc0=$((64-$xc0))
+ xcc1=$((64-$xcc1))
+ xl0=$((64-$xl0))
+ xl1=$((64-$xl1))
+ xa0=$((64-$xa0))
+ fi
+ yl1=20
+ yc0=20
+ ycc1=0
+ ycc0=0
+ ya0=35
+ extra=" L $xc0 $ya0"
+ makearrow >$filename
+ xl0=32
+ xl1=32
+ yl1=44
+ r=12
+ letter=l
+ angle=180
+ step=45
+ longa=1
+ longb=0
+ sweep=1
+ xa=26
+ xb=38
+ if [ "$dir" = "right" ]
+ then
+ letter=r
+ step=-45
+ longa=0
+ longb=1
+ sweep=0
+ xa=$((64-xa))
+ xb=$((64-xb))
+ fi
+ for st in 1 2 3 4 5 6 7 8
+ do
+ angle=$((angle+step))
+ if [ $angle -ge 360 ]
+ then
+ angle=$((angle-360))
+ fi
+ if [ $angle -lt 0 ]
+ then
+ angle=$((angle+360))
+ fi
+ xa0=40.46
+ ya0=40.46
+ long1=$longb
+ case $angle in
+ 0)
+ xa0=32
+ ya0=20
+ xl2=32
+ yl2=14
+ ;;
+ 45)
+ xa0=40.46
+ ya0=23.54
+ xl2=44.7
+ yl2=19.3
+ ;;
+ 90)
+ xa0=44
+ ya0=32
+ xl2=50
+ yl2=32
+ ;;
+ 135)
+ xa0=40.46
+ ya0=40.46
+ xl2=44.7
+ yl2=44.7
+ ;;
+ 180)
+ xa0=$xb
+ ya0=44
+ xl0=$xa
+ xl1=$xa
+ xl2=$xb
+ yl2=50
+ long1=0
+ ;;
+ 225)
+ xa0=23.54
+ ya0=40.46
+ xl2=19.3
+ yl2=44.7
+ long1=$longa
+ ;;
+ 270)
+ xa0=20
+ ya0=32
+ xl2=14
+ yl2=32
+ long1=$longa
+ ;;
+ 315)
+ xa0=23.54
+ ya0=23.54
+ xl2=19.3
+ yl2=19.3
+ long1=$longa
+ ;;
+ esac
+ long2=$((1-long1))
+ filename="nav_roundabout_${letter}${st}_$col.svg"
+ makeroundabout >$filename
+ done
+ done
+ filename="nav_straight_$col.svg"
+ xl0=32
+ xl1=32
+ yl1=32
+ xcc0=32
+ ycc0=10
+ xcc1=32
+ ycc1=16
+ xc0=32
+ yc0=26
+ xa0=32
+ ya0=26
+ angle=0
+ extra=""
+ makearrow >$filename
+done
+
diff --git a/navit/script/geotag b/script/geotag
index e025cbc6..e025cbc6 100755
--- a/navit/script/geotag
+++ b/script/geotag
diff --git a/navit/script/get_map b/script/get_map
index 7c8ef970..7c8ef970 100755
--- a/navit/script/get_map
+++ b/script/get_map
diff --git a/navit/script/gps_emu b/script/gps_emu
index f2eef3e5..f2eef3e5 100755
--- a/navit/script/gps_emu
+++ b/script/gps_emu
diff --git a/navit/script/gps_emu2 b/script/gps_emu2
index e9e79b42..e9e79b42 100755
--- a/navit/script/gps_emu2
+++ b/script/gps_emu2
diff --git a/navit/script/gps_emu3 b/script/gps_emu3
index 5c0ecf25..5c0ecf25 100755
--- a/navit/script/gps_emu3
+++ b/script/gps_emu3
diff --git a/script/gps_emu4 b/script/gps_emu4
new file mode 100755
index 00000000..8ff0faeb
--- /dev/null
+++ b/script/gps_emu4
@@ -0,0 +1,132 @@
+#! /usr/bin/perl
+use Glib qw/TRUE FALSE/;
+use Gtk2 '-init';
+
+sub exit_with_error
+{
+ my ($error)=@_;
+ print STDERR "$error\n";
+ exit(1);
+}
+
+sub process_one_packet
+{
+ $pos[$idx++]=tell(STDIN);
+ while (<STDIN>) {
+ if (!defined($match)) {
+ syswrite(STDOUT,$_) or exit_with_error $!;
+ } else {
+ $buffer.=$_;
+ }
+ if (/^\$GPRMC/) {
+ my($dummy,$time,$dummy)=split(/,/,$_);
+ $entry->set_text($time);
+ if (!defined($match)) {
+ return;
+ }
+ if (substr($time,0,length($match)) eq $match) {
+ undef $match;
+ syswrite(STDOUT,$buffer) or exit_with_error $!;
+ return;
+ }
+ $buffer='';
+ }
+ }
+}
+
+sub process_one_packet_at_idx
+{
+ ($idx)=@_;
+ seek(STDIN,$pos[$idx],SEEK_SET);
+ process_one_packet();
+}
+
+sub forward
+{
+ process_one_packet();
+ return 1;
+}
+
+sub backward
+{
+ if ($idx > 1) {
+ process_one_packet_at_idx($idx-2);
+ }
+ return 1;
+}
+
+sub add_timeout
+{
+ my ($interval,$dir)=@_;
+
+ if ($timeout > 0) {
+ Glib::Source->remove($timeout);
+ }
+ if ($dir > 0) {
+ forward();
+ $timeout=Glib::Timeout->add ($interval, \&forward);
+ }
+ if ($dir < 0) {
+ backward();
+ $timeout=Glib::Timeout->add ($interval, \&backward);
+ }
+}
+
+sub entry
+{
+ $match=$entry->get_text();
+ seek(STDIN,0,SEEK_SET);
+ process_one_packet();
+}
+
+$oldfh = select(STDOUT); $| = 1; select($oldfh);
+$window = Gtk2::Window->new('toplevel');
+$box = Gtk2::HBox->new();
+$window->add($box);
+$button = Gtk2::Button->new("Stop");
+$button->signal_connect(clicked => sub { add_timeout(0,0) });
+$box->add($button);
+$button = Gtk2::Button->new("100 Hz");
+$button->signal_connect(clicked => sub { add_timeout(10,-1); });
+$box->add($button);
+$button = Gtk2::Button->new("10 Hz");
+$button->signal_connect(clicked => sub { add_timeout(100,-1); });
+$box->add($button);
+$button = Gtk2::Button->new("4 Hz");
+$button->signal_connect(clicked => sub { add_timeout(250,-1); });
+$box->add($button);
+$button = Gtk2::Button->new("1 Hz");
+$button->signal_connect(clicked => sub { add_timeout(1000,-1); });
+$box->add($button);
+$button = Gtk2::Button->new("-");
+$button->signal_connect(clicked => sub { add_timeout(0,0) ; backward() });
+$box->add($button);
+$entry = Gtk2::Entry->new();
+$entry->set_text("???");
+$entry->signal_connect(activate => \&entry);
+$box->add($entry);
+$button = Gtk2::Button->new("+");
+$button->signal_connect(clicked => sub { add_timeout(0,0) ; forward() });
+$box->add($button);
+$button = Gtk2::Button->new("1 Hz");
+$button->signal_connect(clicked => sub { add_timeout(1000,1); });
+$box->add($button);
+$button = Gtk2::Button->new("4 Hz");
+$button->signal_connect(clicked => sub { add_timeout(250,1); });
+$box->add($button);
+$button = Gtk2::Button->new("10 Hz");
+$button->signal_connect(clicked => sub { add_timeout(100,1); });
+$box->add($button);
+$button = Gtk2::Button->new("100 Hz");
+$button->signal_connect(clicked => sub { add_timeout(10,1); });
+$box->add($button);
+$button = Gtk2::Button->new("Max");
+$button->signal_connect(clicked => sub { add_timeout(1,1); });
+$box->add($button);
+$window->show_all;
+if ($ARGV[0]) {
+ $match=$ARGV[0];
+ process_one_packet();
+}
+Gtk2->main;
+0;
diff --git a/navit/script/mapExtract.class.php b/script/mapExtract.class.php
index f5c4bbbc..f5c4bbbc 100644
--- a/navit/script/mapExtract.class.php
+++ b/script/mapExtract.class.php
diff --git a/navit/script/map_index.php b/script/map_index.php
index 57fd0d05..57fd0d05 100644
--- a/navit/script/map_index.php
+++ b/script/map_index.php
diff --git a/navit/script/mapextract.php b/script/mapextract.php
index 004b63ca..004b63ca 100644
--- a/navit/script/mapextract.php
+++ b/script/mapextract.php
diff --git a/script/osm/border_follower.pl b/script/osm/border_follower.pl
new file mode 100755
index 00000000..3a5b3116
--- /dev/null
+++ b/script/osm/border_follower.pl
@@ -0,0 +1,139 @@
+#! /usr/bin/perl
+# Do a
+# svn co http://svn.openstreetmap.org/applications/utils/perl_lib/Geo
+# and
+# svn co http://svn.openstreetmap.org/applications/utils/perl_lib/Utils
+# first
+# Example usage:
+# ./border_follower.pl 10359135 Germany 2 country state
+use Geo::OSM::APIClientV5;
+use Data::Dumper;
+$direction='left';
+if ($ARGV[0] eq '-r') {
+ $direction='right';
+ shift(@ARGV);
+}
+$first_wayid=$ARGV[0];
+$name=$ARGV[1];
+$required_admin_level=$ARGV[2];
+$type=$ARGV[3];
+$alt_type=$ARGV[4];
+$revers=0;
+$api=new Geo::OSM::APIClient(api=>'http://www.openstreetmap.org/api/0.5');
+$wayid=$first_wayid;
+$path="$first_wayid";
+sub error
+{
+ my ($message)=@_;
+ $node=$api->get_node($last);
+ print "$message at Node $last $node->{lat} $node->{lon}\n";
+ $lat=$node->{lat};
+ $lon=$node->{lon};
+ $latl=$node->{lat}-0.01;
+ $lath=$node->{lat}+0.01;
+ $lonl=$node->{lon}-0.01;
+ $lonh=$node->{lon}+0.01;
+ system("firefox 'http://www.informationfreeway.org/?lat=$lat&lon=$lon&zoom=12&layers=B000F000F' ; wget -O error.osm http://www.openstreetmap.org/api/0.5/map?bbox=$lonl,$latl,$lonh,$lath ; josm error.osm --selection=id:$last");
+ exit(1);
+}
+
+do {
+ print "Following $wayid\n";
+ $way=$api->get_way($wayid);
+# print Dumper($way->{'tags'});
+
+ $nodes=$way->nodes;
+ $tags = $way->tags;
+ $reverse=0;
+# print Dumper($tags);
+ while( my($k,$v) = splice @{$tags}, 0, 2 ) {
+ if (($k eq "$direction:$type" || $k eq "$direction:$alt_type") && $v eq $name) {
+ $reverse=1;
+ }
+ }
+ if ($reverse) {
+ $first=$nodes->[$#$nodes];
+ $last=$nodes->[0];
+ } else {
+ $first=$nodes->[0];
+ $last=$nodes->[$#$nodes];
+ }
+ $ways=$api->get_node_ways($last);
+
+# print "first=$first\n";
+# print "last=$last\n";
+
+ print "$#$ways Ways\n";
+ if ($#$ways <= 0) {
+ error "End";
+ }
+ $lastid=$wayid;
+ $count=0;
+ foreach $way (@$ways) {
+ $newid=$way->{'id'};
+ $timestamp=$way->{'timestamp'};
+ if ($newid == $lastid) {
+ next;
+ }
+ $nodes=$way->nodes;
+ print "way $newid ($#$nodes nodes) $timestamp\n";
+ my $tags = $way->tags;
+ $match=0;
+ $boundary=0;
+ $admin_level=0;
+ while( my($k,$v) = splice @{$tags}, 0, 2 ) {
+ print "tag: $k=$v\n";
+ if (($k eq "left:$type" || $k eq "right:$type")) {
+ if ($v eq $name) {
+ $match=1;
+ } else {
+ $neighbors{$v}=$newid;
+ }
+ }
+ if (($k eq "left:$alt_type" || $k eq "right:$alt_type") && $v eq $name) {
+ print "Warning: $k in $newid\n";
+ $match=1;
+ }
+ if ($k eq "boundary") {
+ if ($boundary == 0 && $v eq "administrative") {
+ $boundary=1;
+ } else {
+ $boundary=2;
+ }
+ }
+ if ($k eq "admin_level") {
+ if ($admin_level == 0 && $v eq $required_admin_level) {
+ $admin_level=1;
+ } else {
+ $admin_level=2;
+ }
+ }
+ }
+ if ($match) {
+ print "MATCH\n";
+ if ($boundary != 1 ) {
+ print "boundary $boundary wrong at $newid\n"
+ }
+ if ($admin_level != 1) {
+ print "admin_level $admin_level wrong at $newid\n"
+ }
+ $wayid=$newid;
+ $count++;
+ }
+ }
+ if ($count == 0) {
+ error "No connection"
+ } else {
+ if ($count > 1) {
+ error "Multiple connections ($count)"
+ } else {
+ $path="$path $wayid";
+ }
+ }
+} while ($wayid != $first_wayid);
+print "End reached\n";
+print "Path $path\n";
+while (($key,$value)=each(%neighbors)) {
+ print "Neighbor $key $value\n";
+}
+#print Dumper($ways);
diff --git a/script/osm/osmtool.pl b/script/osm/osmtool.pl
new file mode 100755
index 00000000..30a443fb
--- /dev/null
+++ b/script/osm/osmtool.pl
@@ -0,0 +1,126 @@
+#! /usr/bin/perl
+use Geo::OSM::APIClientV5;
+use Data::Dumper;
+
+sub print_error
+{
+ print Dumper($api->{last_error});
+ print 'Error:' . $api->{last_error}->rc . "\n";
+}
+
+sub print_entitiy
+{
+ my ($res)=@_;
+
+ my ($xml);
+ $xml=$res->xml;
+ $xml=~s/>/>\n/g;
+ print $xml;
+}
+
+sub remove_member
+{
+ my ($res,$type,$id)=@_;
+
+ my (@members);
+ my $found=0;
+ foreach my $member (@{$res->members}) {
+ if ($member->member_type eq $type && $member->ref eq $id) {
+ $found++;
+ } else {
+ push(@members, $member);
+ }
+ }
+ if ($found) {
+ $res->set_members(\@members);
+ }
+ return $found;
+}
+
+sub cmd_delete
+{
+ my($type,$id)=@_;
+ my($res);
+ $res=$api->get($type,$id);
+ if (!$api->delete($res)) {
+ print_error();
+ return 1;
+ }
+ return 0;
+}
+
+sub cmd_get
+{
+ my($type,$id)=@_;
+
+ my($res,$xml);
+ $res=$api->get($type,$id);
+ print_entitiy($res);
+}
+
+sub cmd_relations
+{
+ my($type,$id)=@_;
+
+ my($res,$xml);
+ $res=$api->get($type,$id,"relations");
+ print_entitiy($res);
+}
+
+sub cmd_remove_member_all
+{
+ my($type,$id)=@_;
+
+ my($res);
+ $res=$api->get($type,$id,"relations");
+ if (!remove_member($res,$type,$id)) {
+ print "Error:Member not found\n";
+ return 1;
+ }
+ if (!$api->modify($res)) {
+ print_error();
+ return 1;
+ }
+ return 0;
+}
+
+sub cmd_reload
+{
+ my($type,$id)=@_;
+ $res=$api->get($type,$id);
+ if (!$api->modify($res)) {
+ print_error();
+ return 1;
+ }
+ return 0;
+}
+
+sub command
+{
+ my(@arg)=@_;
+
+ if ($arg[0] eq 'delete') {
+ cmd_delete($arg[1],$arg[2]);
+ }
+ if ($arg[0] eq 'get') {
+ cmd_get($arg[1],$arg[2]);
+ }
+ if ($arg[0] eq 'relations') {
+ cmd_relations($arg[1],$arg[2]);
+ }
+ if ($arg[0] eq 'remove-member-all') {
+ cmd_remove_member_all($arg[1],$arg[2]);
+ }
+ if ($arg[0] eq 'reload') {
+ cmd_reload($arg[1],$arg[2]);
+ }
+}
+
+while (substr($ARGV[0],0,2) eq '--') {
+ $expr=substr($ARGV[0],2);
+ ($key,$value)=split('=',$expr,2);
+ $attr{$key}=$value;
+ shift;
+}
+$api=new Geo::OSM::APIClient(api=>'http://www.openstreetmap.org/api/0.5',%attr);
+command(@ARGV);
diff --git a/script/osm2navit_sea/osm2navit_sea.pl b/script/osm2navit_sea/osm2navit_sea.pl
new file mode 100644
index 00000000..a65c74d7
--- /dev/null
+++ b/script/osm2navit_sea/osm2navit_sea.pl
@@ -0,0 +1,1010 @@
+#!/usr/bin/perl -w
+#
+# Vincent "latouche" Touchard, vtouchar@latouche.info
+# 2008/09/10
+#
+# Transform a .osm file adding polygons representing the sea and islands.
+# The sea is a way with the tag natural=coastline_outer and the islands are
+# ways with the tag natural=coastline_inner.
+# Adding those tags to osm2navit allow the see to be viewed by navit
+#
+# To avoid big polygons, the map is divided into small tiles (0.5°x0.5°)
+#
+# usage:
+# osm2navit_sea.pl minlat minlon maxlat maxlon source_file output_file
+#
+# license: GPL
+#
+# history:
+# v1: first release
+# v2: 2008/09/06
+# - map split into tiles of 0.5x0.5°
+# v3: 2008/09/10
+# - detects islands vs lakes
+# takes each polygon and try to find is it is inside an other one. If true,
+# it is an island, if not, it is the sea. Should be a little more clever to detect
+# lake (tagged as natural=coastline instead of natural=water) inside islands.
+# This algo is not perfect but works in most cases
+# - sea tile with no way crossing are now drawn in a more clever way:
+# a node for each corner is added to nodes arrays and a way linking those
+# node is added. Those components are then added to the output file during
+# the last section of this script. This allow to detects islands in such tiles
+# as islands and not sea
+# v4: 2009/03/14
+# - new way to compute the intersection of a segment and the border of a tile
+# - don't use nodes that are out of the bbox specified as argument
+# - use lazy regex to parse the .osm file
+#
+# TODO:
+# - better lookup_handler (cf this fuction for more info)
+# - detect clockwise/anticlockwise ways => sea or land
+# for now -> every closed area is considered as land which is false.
+# some lakes are tags as natural=coastline instead of natural=water
+# ==> done, the algo should be improved for better results
+
+use strict;
+use warnings;
+
+use Math::Trig;
+use POSIX qw(ceil);
+use way;
+
+# lon € [-180, 180]
+# lat € [-85.0511, 85.0511]
+if ( @ARGV ne 6 ||
+ abs($ARGV[0]) > 85.0511 || abs($ARGV[2]) > 85.0511 ||
+ abs($ARGV[1]) > 180 || abs($ARGV[3]) > 180) {
+ print "Usage: osm2navit_sea.pl minlat minlon maxlat maxlon source_file output_file\n";
+ exit(1);
+}
+
+
+my $source=$ARGV[4];
+my $destination=$ARGV[5];
+
+my ($minlat, $minlong, $maxlat, $maxlong);
+my ($minlat2, $minlong2, $maxlat2, $maxlong2);
+
+$minlat=$ARGV[0];
+$minlong=$ARGV[1];
+$maxlat=$ARGV[2];
+$maxlong=$ARGV[3];
+
+#$minlat2=int($minlat*2)/2;
+#$minlong2=int($minlong*2)/2;
+#$maxlat2=ceil($maxlat*2)/2;
+#$maxlong2=ceil($maxlong*2)/2;
+
+$minlat2=$minlat;
+$minlong2=$minlong;
+$maxlat2=$maxlat;
+$maxlong2=$maxlong;
+
+
+#$rect_length=2*abs($maxlong-$minlong) + 2*abs($maxlat-$minlat);
+#
+#push (@corner_rect2lin, 0);
+#push (@corner_rect2lin, abs($maxlong-$minlong));
+#push (@corner_rect2lin, abs($maxlong-$minlong) + abs($maxlat-$minlat));
+#push (@corner_rect2lin, $rect_length - abs($maxlat-$minlat));
+
+my $osm_id=-1;
+
+my (%new_ways, %nodes, %ways, %tiles, @new_nodes);
+
+my ($i, $j, $way, $node, $tile);
+
+my $debug=0;
+
+sub debug {
+ print shift if ( $debug );
+}
+
+# project a node on a bounding box
+sub get_projection {
+ my ($lat, $lon, $minlat, $minlon, $maxlat, $maxlon) = @_;
+
+ my ($a, $b, $c, $d);
+
+ $a = abs( $lat - $minlat);
+ $b = abs( $lat - $maxlat);
+ $c = abs( $lon - $minlon);
+ $d = abs( $lon - $maxlon);
+
+
+ if ( $a <= $b ) {
+ if ( $a <= $c ) {
+ if ( $a <= $d ) {
+ # a
+ $lat=$minlat;
+ #$lon=$node->{"lon"};
+ } else {
+ # d
+ #$lat=$node->{"lat"};
+ $lon=$maxlon;
+ }
+ } else {
+ if ( $c <= $d ) {
+ # c
+ #$lat=$node->{"lat"};
+ $lon=$minlon;
+ } else {
+ #d
+ #$lat=$node->{"lat"};
+ $lon=$maxlon;
+ }
+ }
+ } else {
+ if ( $b <= $c ) {
+ if ( $b <= $d ) {
+ #b
+ $lat=$maxlat;
+ #$lon=$node->{"lon"};
+ } else {
+ # d
+ #$lat=$node->{"lat"};
+ $lon=$maxlon;
+ }
+ } else {
+ if ( $c <= $d ) {
+ # c
+ #$lat=$node->{"lat"};
+ $lon=$minlon;
+ } else {
+ #d
+ #$lat=$node->{"lat};
+ $lon=$maxlon;
+ }
+ }
+ }
+
+ return (($lat, $lon));
+}
+
+# Projet a node on a rectangle to a segment
+sub get_proj_rect2lin {
+ my ($lat, $lon, $minlat, $minlon, $maxlat, $maxlon) = @_;
+
+
+ if ($lat eq $maxlat) {
+ return abs($minlon - $lon);
+ } else {
+ if ($lon eq $maxlon) {
+ return abs($maxlon-$minlon) + abs($maxlat - $lat);
+ } else {
+ if ($lat eq $minlat) {
+ return abs($maxlon-$minlon) + abs($maxlat-$minlat) + abs($maxlon-$lon);
+ } else {
+ return 2*abs($maxlon-$minlon) + abs($maxlat-$minlat) + abs($minlat - $lat);
+ }
+ }
+ }
+}
+
+# projet a node from a segment to a rectangle
+sub getnode_proj_lin2rect {
+ my ($length, $minlat, $minlon, $maxlat, $maxlon) = @_;
+ my ($lat, $lon);
+
+ if ( $length > 2*abs($maxlon-$minlon) + abs($maxlat-$minlat)) {
+ $lat = ($minlat + $length - 2*abs($maxlon-$minlon) - abs($maxlat-$minlat));
+ $lon = ($minlon);
+ } else {
+ if ( $length > abs($maxlon-$minlon) + abs($maxlat-$minlat)) {
+ $lat = ($minlat);
+ $lon = ($maxlon - $length + abs($maxlon-$minlon) + abs($maxlat-$minlat));
+ } else {
+ if ( $length > abs($maxlon-$minlon)) {
+ $lat = ($maxlat - $length + abs($maxlon-$minlon));
+ $lon = ($maxlon);
+ } else {
+ $lat = ($maxlat);
+ $lon = ($minlon + $length);
+ }
+ }
+ }
+
+ return (($lat, $lon));
+}
+
+
+
+# get the distance between to nodes on the same rectangle
+sub get_path_length {
+ my ($lat1, $lon1, $lat2, $lon2, @box) = @_;
+
+ my ($a, $b, $rect_length, $dist);
+
+
+ $a = get_proj_rect2lin ( $lat1, $lon1, @box);
+ $b = get_proj_rect2lin ( $lat2, $lon2, @box);
+
+ $dist = $b - $a;
+ $rect_length = 2*abs( $box[2] - $box[0]) + 2*abs( $box[3] - $box[1]);
+ return $dist > 0 ? $dist : $dist + $rect_length;
+}
+
+# get the nodes to go through to join an other node over a rectangle
+sub get_path {
+ my ($lat1, $lon1, $lat2, $lon2, @box) = @_;
+
+ my ($a, $b, $rect_length, $dist, @corner_rect2lin);
+ my @path=();
+
+ $a = get_proj_rect2lin ( $lat1, $lon1, @box);
+ $b = get_proj_rect2lin ( $lat2, $lon2, @box);
+
+ $rect_length = 2*abs( $box[2] - $box[0]) + 2*abs( $box[3] - $box[1]);
+
+ $dist = $b - $a;
+ if ($dist <0) {
+ $b+=$rect_length;
+ }
+
+ @corner_rect2lin = ( 0,
+ abs( $box[3] - $box[1]),
+ abs( $box[3] - $box[1]) + abs( $box[2] - $box[0]),
+ $rect_length - abs( $box[2] - $box[0]));
+
+ foreach (@corner_rect2lin) {
+ if ($_ > $a && $_ < $b) {
+ my ($lat, $lon) = getnode_proj_lin2rect ($_, @box);
+ push (@path, {"lat" => $lat, "lon" => $lon});
+ }
+ }
+
+ foreach (@corner_rect2lin) {
+ if ($_ + $rect_length > $a && $_ + $rect_length < $b) {
+ my ($lat, $lon) = getnode_proj_lin2rect ($_, @box);
+ push (@path, {"lat" => $lat, "lon" => $lon});
+ }
+ }
+
+
+ return @path;
+}
+
+# type of tile at zoom12 (land, sea, both, unknown.
+# Uses oceantiles_12.dat for tiles@home project
+# it checks the tile at level 12 containing the point ($lat, $lon)
+# dx and dy are used to specify an offset: read tile (x+dx, y+dy)
+# A more clever way whould be to check all the tile contained in and area
+# and guess the final type
+# one sea or more => sea
+# one land or more => land
+# only both or unknown => since tiles are quite big, should be land
+#
+sub lookup_handler {
+ my ($lat, $lon, $dx, $dy) = @_;
+
+ # http://wiki.openstreetmap.org/index.php/Slippy_map_tilenames
+ # http://almien.co.uk/OSM/Tools/Coord
+ my $zoom=12;
+ # $tilex=int( ( $minlon +180)/360 *2**$zoom ) ;
+ my $tilex=int( ( $lon +180)/360 *2**$zoom ) ;
+ # $tiley=int( (1 - log(tan( $maxlat *pi/180) + sec( $maxlat *pi/180))/pi)/2 *2**$zoom ) ;
+ my $tiley=int( (1 - log(tan( $lat *pi/180) + sec( $lat *pi/180))/pi)/2 *2**$zoom ) ;
+
+
+ my $tileoffset = (($tiley+$dy) * (2**12)) + ($tilex+$dx);
+
+ my $fh;
+ open($fh, "<", "data/oceantiles_12.dat") or die ("Cannot open oceantiles_12.dat: $!");
+
+
+ seek $fh, int($tileoffset / 4), 0;
+ my $buffer;
+ read $fh, $buffer, 1;
+ $buffer = substr( $buffer."\0", 0, 1 );
+ $buffer = unpack "B*", $buffer;
+ my $str = substr( $buffer, 2*($tileoffset % 4), 2 );
+
+ close($fh);
+
+ #print "S" if $str eq "10";
+ #print "L" if $str eq "01";
+ #print "B" if $str eq "11";
+ #print "?" if $str eq "00";
+
+ return $str;
+}
+
+
+# return the intersection of a segment with the border of a tile
+sub intersec_way_tiles {
+ my ($node_in_lat, $node_in_lon,
+ $node_ext_lat,$node_ext_lon,
+ $tile_minlat, $tile_minlon, $tile_maxlat, $tile_maxlon) = @_;
+ my ($lat, $lon);
+
+ debug "intersec_way_tiles - $node_in_lat, $node_in_lon && $node_ext_lat,$node_ext_lon && $tile_minlat, $tile_minlon, $tile_maxlat, $tile_maxlon\n";
+
+ # case #1: node_ext above tile - try intersec with the top of the tile
+ if ($node_ext_lat > $tile_maxlat || $node_ext_lat < $tile_minlat) {
+ $lat = ($node_ext_lat > $tile_maxlat) ? $tile_maxlat : $tile_minlat;
+ if ($node_in_lat != $node_ext_lat) {
+ $lon = $node_in_lon + ($lat - $node_in_lat) * ($node_ext_lon - $node_in_lon) / ($node_ext_lat - $node_in_lat);
+ } else { # node_ext == node
+ $lon = $node_in_lon;
+ }
+ if ($lon > $tile_minlon && $lon < $tile_maxlon) {
+ return ($lat, $lon);
+ }
+ }
+ # case #2: node ext on the left or on the right of the tile
+ if ($node_ext_lon > $tile_maxlon || $node_ext_lon < $tile_minlon) {
+ $lon = ($node_ext_lon > $tile_maxlon) ? $tile_maxlon : $tile_minlon;
+ if ($node_in_lon != $node_ext_lon) {
+ $lat = $node_in_lat + ($lon - $node_in_lon) * ($node_ext_lat - $node_in_lat) / ($node_ext_lon - $node_in_lon); # thales
+ } else { # node_ext == node
+ $lat = $node_in_lat;
+ }
+ if ($lat > $tile_minlat && $lat < $tile_maxlat) {
+ return ($lat, $lon);
+ }
+ }
+
+ return ($node_ext_lat, $node_ext_lon);
+}
+
+# tells if a node is inside a polygon or not
+# not efficient a 100%, but quite good results
+# widely inspired from close-areas.pl from the T@h project
+sub polygon_contains_node {
+ my ($way, $node) = @_;
+
+
+ my $counter = 0;
+
+ my @way_nodes = $way->nodes();
+ my $p1 = $nodes{$way->first_node()};
+ my $n = scalar(@way_nodes);
+
+ for (my $i=1; $i < $n; $i++) {
+ my $p2 = $nodes{$way_nodes[$i]};
+
+ if ($node->{"lat"} > $p1->{"lat"} || $node->{"lat"} > $p2->{"lat"}) {
+ if ($node->{"lat"} < $p1->{"lat"} || $node->{"lat"} < $p2->{"lat"}) {
+ if ($node->{"lon"} < $p1->{"lon"} || $node->{"lon"} < $p2->{"lon"}) {
+ if ($p1->{"lat"} != $p2->{"lat"}) {
+ my $xint = ($node->{"lat"}-$p1->{"lat"})*($p2->{"lon"}-$p1->{"lon"})/($p2->{"lat"}-$p1->{"lat"})+$p1->{"lon"};
+ if ($p1->{"lon"} == $p2->{"lon"} || $node->{"lon"} <= $xint) {
+ $counter++;
+ }
+ }
+ }
+ }
+ }
+ $p1 = $p2;
+ }
+
+ return ($counter%2);
+}
+
+#################################
+print "initialising tiles\n";
+
+
+print "There will be ".ceil(abs($maxlong2-$minlong2)/0.5)."x".ceil(abs($maxlat2-$minlat2)/0.5)." tiles\n";
+
+my $nb_tiles_x = ceil(abs($maxlat2-$minlat2)/0.5);
+my $nb_tiles_y = ceil(abs($maxlong2-$minlong2)/0.5);
+
+for ($j=0; $j<$nb_tiles_x; $j++) {
+ for ($i=0; $i<$nb_tiles_y; $i++) {
+
+
+ my $type = lookup_handler ( $maxlat2-0.5*$j, $minlong2+0.5*$i, 0, 0);
+
+ print "S" if $type eq "10";
+ print "L" if $type eq "01";
+ print "B" if $type eq "11";
+ print "?" if $type eq "00";
+ my $tile_maxlon = $minlong2+0.5*$i + 0.5 > $maxlong2 ? $maxlong2 : $minlong2+0.5*$i + 0.5;
+ my $tile_minlat = $maxlat2-0.5*$j-0.5 < $minlat2 ? $minlat2 : $maxlat2-0.5*$j-0.5;
+ $tiles{$nb_tiles_x * $i+$j} = { "minlon" => $minlong2+0.5*$i, "maxlat" => $maxlat2-0.5*$j,
+ "maxlon" => $tile_maxlon, "minlat" => $tile_minlat,
+ "type" => $type, "id" => ($nb_tiles_x * $i+$j), "crossed" => 0};
+ }
+ print "\n";
+}
+
+print "\n";
+
+
+
+################################
+# find coastlines and store the nodes id
+print "Reading osm source file\n";
+
+my $input;
+my $output;
+open($input, "<$source") or die "Can't open $source: $!";
+
+my $way_id=0;
+my $is_coastline=0;
+my @nodes;
+while (<$input>) {
+
+ if ( /<way id=["'](\d+?)["']/) {
+ $way_id=$1;
+ $is_coastline=0;
+ @nodes=();
+ }
+ if ($way_id != 0) {
+ if ( /<nd ref=["'](\d+?)["']/) {
+ push(@nodes, $1);
+ }
+ if ( /<tag k=["']natural["'] v=["']coastline["']/) {
+ $is_coastline=1;
+ }
+ if ( /<\/way/ ) {
+ # forget node with only one element -> disturb the algo
+ if ( $is_coastline && scalar(@nodes) != 1 ) {
+ my $way=way->new($way_id);
+ $way->nodes(@nodes);
+ debug( "found coastline ".$way->id()." from ".$way->first_node()." to ".$way->last_node()." with ".$way->size()." nodes\n");
+ $ways{$way->id()}=$way;
+ }
+
+ $way_id=0;
+ }
+ }
+}
+
+close($input);
+
+
+
+
+###########################
+# to save memory, only retrieve usefull nodes
+print "Retrieving nodes:\n";
+
+$i=0;
+foreach (values %ways) {
+ foreach ($_->nodes()) {
+ $nodes{$_}={};
+ $i++;
+ }
+}
+debug("Created $i nodes\n");
+
+open($input, "<$source") or die "Can't open $source: $!";
+open($output, ">$destination") or die "Can't open $destination: $!";
+
+$i=0;
+while (<$input>) {
+ if ( /<node id=['"](\d+?)['"].* lat=['"](.+?)['"] lon=['"](.+?)['"]/ ) {
+ if ( exists($nodes{$1}) ) {
+ $nodes{$1}->{"id"}=$1;
+ $nodes{$1}->{"lat"}=$2;
+ $nodes{$1}->{"lon"}=$3;
+ $i++;
+ }
+ }
+ print $output $_ unless ( /<\/osm>/ );
+}
+close($input);
+
+debug("Retrieved $i nodes\n");
+
+
+
+############################
+# If the bounding box given as arguments to the program is smaller than the one used to generate
+# the input file, some nodes may be outside -> check for this before adding them to a tile
+print "Spliting data into tiles:\n";
+
+
+foreach $way (values %ways) {
+ #print "following new way\n";
+
+ my $new_way = way->new($osm_id--);
+ my @way_nodes = ();
+ my ($tile_id, $new_tile_id);
+ $tile_id = -1;
+ my $prev_node;
+
+ foreach $node ($way->nodes()) {
+
+ # node out of bbox -> skip the nodes until we reenter the bbox
+ if ($nodes{$node}->{"lat"} < $minlat2 || $nodes{$node}->{"lat"} > $maxlat2
+ || $nodes{$node}->{"lon"} < $minlong2 || $nodes{$node}->{"lon"} > $maxlong2) {
+
+ # previous node already skiped or 1st node out of the bbox
+ if ( $tile_id == -1 ) {
+ $prev_node = $node;
+
+
+ } else { # previous node in bbox, we add a node at the intersection of the current tile border and the segment [$node, $prev_node]
+
+ # find the intersection of the current way with the tiles
+ my $tile = $tiles{$tile_id};
+ my ($lat, $lon) = intersec_way_tiles (
+ $nodes{$prev_node}->{"lat"}, $nodes{$prev_node}->{"lon"},
+ $nodes{$node}->{"lat"}, $nodes{$node}->{"lon"},
+ $tile->{"minlat"}, $tile->{"minlon"}, $tile->{"maxlat"}, $tile->{"maxlon"});
+ my $mid_node = {"lat" => $lat, "lon" => $lon, "id" => $osm_id-- };
+
+ $nodes{ $mid_node->{"id"} } = $mid_node;
+ push( @new_nodes, $mid_node );
+
+ push ( @way_nodes, $mid_node->{"id"} );
+
+ # end way here
+ $new_way->nodes(@way_nodes);
+ $new_ways{$new_way->id()} = $new_way;
+ $ways{$new_way->id()} = $new_way;
+ push( @{$tiles{$tile_id}->{"ways"}}, $new_way->id());
+ $tiles{$tile_id}->{"crossed"}=1;
+
+ # begin new way
+ $new_way = way->new($osm_id--);
+ @way_nodes = ();
+
+ # reset title_id
+ $tile_id = -1;
+
+ }
+ } else {
+
+ my $tile_lat = int( ($maxlat2 - $nodes{$node}->{"lat"} ) / 0.5);
+ my $tile_lon = int( ($nodes{$node}->{"lon"} - $minlong2) / 0.5);
+ $new_tile_id = $nb_tiles_x * $tile_lon + $tile_lat;
+
+ if ( $tile_id == -1 ) {
+ $tile_id = $new_tile_id;
+
+ # we have reentered a tile -> add a node on its border at the intersec of the segment [$prev_node, $node]
+ if (defined $prev_node) {
+ # find the intersection of the current way with the tiles
+ my $tile = $tiles{$tile_id};
+ my ($lat, $lon) = intersec_way_tiles (
+ $nodes{$node}->{"lat"}, $nodes{$node}->{"lon"},
+ $nodes{$prev_node}->{"lat"}, $nodes{$prev_node}->{"lon"},
+ $tile->{"minlat"}, $tile->{"minlon"}, $tile->{"maxlat"}, $tile->{"maxlon"});
+ my $mid_node = {"lat" => $lat, "lon" => $lon, "id" => $osm_id-- };
+
+ $nodes{ $mid_node->{"id"} } = $mid_node;
+ push( @new_nodes, $mid_node );
+
+ push ( @way_nodes, $mid_node->{"id"} );
+
+ $tiles{$tile_id}->{"crossed"}=1;
+ }
+ }
+ # we have reach an other tile
+ if ( $new_tile_id != $tile_id ) {
+
+ my $tile = $tiles{$tile_id};
+ my $new_tile = $tiles{$new_tile_id};
+
+ # find the intersection of the way with the tiles
+ my ($lat, $lon) = intersec_way_tiles (
+ $nodes{$prev_node}->{"lat"}, $nodes{$prev_node}->{"lon"},
+ $nodes{$node}->{"lat"}, $nodes{$node}->{"lon"},
+ $tile->{"minlat"}, $tile->{"minlon"}, $tile->{"maxlat"}, $tile->{"maxlon"});
+ my $mid_node = {"lat" => $lat, "lon" => $lon, "id" => $osm_id-- };
+
+ $nodes{ $mid_node->{"id"} } = $mid_node;
+ push( @new_nodes, $mid_node );
+
+ push ( @way_nodes, $mid_node->{"id"} );
+
+ $new_way->nodes(@way_nodes);
+ $new_ways{$new_way->id()} = $new_way;
+ $ways{$new_way->id()} = $new_way;
+ push( @{$tiles{$tile_id}->{"ways"}}, $new_way->id());
+
+ # set both new and old tile as crossed by a way
+ # the new one is important because when we rich the end
+ # of the coast, there will be no "next way" to set it as
+ # crossed
+ $tiles{$tile_id}->{"crossed"}=1;
+ $tiles{$new_tile_id}->{"crossed"}=1;
+
+ $new_way = way->new($osm_id--);
+
+ @way_nodes=();
+
+
+ # first node on tile border
+ ($lat, $lon) = intersec_way_tiles (
+ $nodes{$node}->{"lat"}, $nodes{$node}->{"lon"},
+ $nodes{$prev_node}->{"lat"}, $nodes{$prev_node}->{"lon"},
+ $new_tile->{"minlat"}, $new_tile->{"minlon"}, $new_tile->{"maxlat"}, $new_tile->{"maxlon"});
+ my $mid_node2 = {"lat" => $lat, "lon" => $lon, "id" => $osm_id-- };
+
+ $nodes{ $mid_node2->{"id"} } = $mid_node2;
+ push( @new_nodes, $mid_node2 );
+
+ push ( @way_nodes, $mid_node2->{"id"} );
+
+ $tile_id = $new_tile_id;
+ }
+
+ push (@way_nodes, $node);
+ #print "Node $node added to tile $tile_id\n";
+ $prev_node=$node;
+ }
+ }
+
+ # if new way not empty, add it
+ if ( scalar(@way_nodes) > 1 && $tile_id != -1) {
+ $new_way->nodes(@way_nodes);
+ $new_ways{$new_way->id()} = $new_way;
+ $ways{$new_way->id()} = $new_way;
+ push( @{$tiles{$tile_id}->{"ways"}}, $new_way->id());
+ }
+
+ $way->distroy();
+
+}
+
+
+
+
+
+
+
+##############################################
+print "\n\nWorking on tiles:\n";
+
+
+#$tile = $tiles{54};
+foreach $tile (values %tiles) {
+
+ print( "->tile: ".$tile->{"id"}."\n");
+
+ my @box = ($tile->{"minlat"}, $tile->{"minlon"}, $tile->{"maxlat"}, $tile->{"maxlon"});
+
+ # No way going through the tile -> guess if it is sea or lanf
+ # SHould check if it containds nodes -> type unknown + nodes should mean sea + islands
+ unless ($tile->{"crossed"}) {
+ my $tile_is_sea=0;
+
+ # 00 => unknown
+ # 01 => land
+ # 10 => sea
+ # 11 => coast
+
+ # water
+ if ($tile->{"type"} eq "10") {
+ $tile_is_sea=1;
+
+ } elsif ($tile->{"type"} ne "01") { # not land
+
+ my %temp = ("00"=>0, "10"=>0, "01"=>0, "11"=>0);
+ $temp{lookup_handler($tile->{"maxlat"}, $tile->{"minlon"}, -1, 0)}++;
+ $temp{lookup_handler($tile->{"maxlat"}, $tile->{"minlon"}, +1, 0)}++;
+ $temp{lookup_handler($tile->{"maxlat"}, $tile->{"minlon"}, 0, -1)}++;
+ $temp{lookup_handler($tile->{"maxlat"}, $tile->{"minlon"}, 0, +1)}++;
+
+ if( $temp{"10"} > $temp{"01"} ) {
+ $tile_is_sea=1;
+ } elsif ( ($tile->{"type"} eq "11") and ( $temp{"01"} == 0 ) ) {
+ # if the tile is marked coast but no land near, assume it's a group of islands instead of lakes.
+ $tile_is_sea=1;
+ } # else = land
+
+ }
+
+ # add nodes and a way to draw the sea all over the tile
+ if ($tile_is_sea) {
+ my @way_nodes_id = ( $osm_id, $osm_id-1, $osm_id-2, $osm_id-3);
+ my @way_nodes = (
+ { "lat" => $tile->{"maxlat"}, "lon" => $tile->{"minlon"}, "id" => $osm_id--},
+ { "lat" => $tile->{"maxlat"}, "lon" => $tile->{"maxlon"}, "id" => $osm_id--},
+ { "lat" => $tile->{"minlat"}, "lon" => $tile->{"maxlon"}, "id" => $osm_id--},
+ { "lat" => $tile->{"minlat"}, "lon" => $tile->{"minlon"}, "id" => $osm_id--});
+
+ my $way = way->new($osm_id--);
+ $way->nodes(@way_nodes_id);
+
+ push( @new_nodes, @way_nodes );
+ foreach (@way_nodes) {
+ $nodes{$_->{"id"}} = $_;
+ }
+
+ $new_ways{$way->id()} = $way;
+ $ways{$way->id()} = $way;
+ push( @{$tile->{"ways"}}, $way->id());
+ }
+ }
+
+ # next tile if there is nothing in this one
+ next if ( ! $tile->{"ways"} );
+
+ #========================================
+ # merge ways that can be merged
+ debug "\tBuilding tree:\n";
+
+ foreach (@{$tile->{"ways"}}) {
+ $way = $new_ways{$_};
+ debug( "node ".$way->id()." (size: ".$way->size().")\n" );
+ # only for not yet complete polygons and ways without prev and next
+ if ($way->next() == 0 || $way->prev() == 0) {
+ foreach (@{$tile->{"ways"}}) {
+ my $way2=$new_ways{$_};
+ if ($way->last_node() == $way2->first_node() ) {
+ if ($way->next() == 0) {
+ debug( "\tnext = ".$way2->id()."\n");
+ $way->next($way2->id());
+ } else {
+ debug( "\t error: next way duplicated: old:".$way->next()." new:".$way2->id()." - node: ".$way->last_node()."\n");
+ }
+ }
+ if ($way->first_node() == $way2->last_node() ) {
+ if ($way->prev() == 0) {
+ debug( "\tprev = ".$way2->id()."\n");
+ $way->prev($way2->id());
+ } else {
+ debug( "\t error: prev way duplicated: old:".$way->prev()." new:".$way2->id()." - node: ".$way->first_node()."\n");
+ }
+ }
+ }
+ } else {
+ debug( "\tAlready ok\n" );
+ }
+ }
+ #=============================
+ # if some ways are not closed, we need to close them.
+ # It is done by adding new nodes on the border of the tile
+ # and joining them
+ debug ("\n\nClosing loops:\n");
+
+ my (@first_nodes, @last_nodes);
+
+ # project nodes on the border of the tile
+ # Some nodes are already on the border of the tile (mainly because of
+ # intersec_way_tiles)
+ foreach (@{$tile->{"ways"}}) {
+ my $way = $new_ways{$_};
+
+ next if ( $way->first_node() == $way->last_node()); # already a loop
+
+ if ( $way->prev() == 0) {
+ my @way_nodes = $way->nodes();
+
+ my $lat = $nodes{$way_nodes[0]}->{"lat"};
+ my $lon = $nodes{$way_nodes[0]}->{"lon"};
+ ($lat, $lon) = get_projection( $lat, $lon, $tile->{"minlat"}, $tile->{"minlon"}, $tile->{"maxlat"}, $tile->{"maxlon"} );
+ my $node = { "lat" => $lat, "lon" => $lon, "id" => ($osm_id--)};
+ unshift( @way_nodes, $node->{"id"} );
+ push( @new_nodes, $node );
+ $nodes{$node->{"id"}}=$node;
+ push( @first_nodes, $node->{"id"});
+
+ $way->nodes(@way_nodes);
+ }
+ if ( $way->next() == 0) {
+
+ my @way_nodes = $way->nodes();
+
+ my $lat = $nodes{$way_nodes[ @way_nodes - 1 ]}->{"lat"};
+ my $lon = $nodes{$way_nodes[ @way_nodes - 1 ]}->{"lon"};
+ ($lat, $lon) = get_projection( $lat, $lon, $tile->{"minlat"}, $tile->{"minlon"}, $tile->{"maxlat"}, $tile->{"maxlon"} );
+ my $node = { "lat" => $lat, "lon" => $lon, "id" => $osm_id--};
+ push( @way_nodes, $node->{"id"} );
+ push( @new_nodes, $node );
+ $nodes{$node->{"id"}}=$node;
+ push( @last_nodes, $node->{"id"});
+
+ $way->nodes(@way_nodes);
+
+ }
+
+ }
+
+ # link nodes -> find a way around the tile
+
+
+ my $last;
+ foreach $last (@last_nodes) {
+ debug "Looking for path ...\n";
+ my ($path1, $path2);
+ $path1=0;
+
+ # find the sortest path between nodes
+ # -> will give the next node around the tile
+ my $first;
+ my $first_elected;
+ foreach $first (@first_nodes) {
+ $path2=get_path_length($nodes{$last}->{"lat"},
+ $nodes{$last}->{"lon"},
+ $nodes{$first}->{"lat"},
+ $nodes{$first}->{"lon"},
+ @box);
+ if ($path1 == 0 || $path1 > $path2) {
+ $path1=$path2;
+ $first_elected=$first;
+ }
+ }
+
+ # get the path around the tile between the two nodes
+ my @path = get_path ( $nodes{$last}->{"lat"},
+ $nodes{$last}->{"lon"},
+ $nodes{$first_elected}->{"lat"},
+ $nodes{$first_elected}->{"lon"},
+ @box);
+
+ foreach (@path) {
+ $_->{"id"} = $osm_id--;
+ push(@new_nodes, $_);
+ $nodes{$_->{"id"}} = $_;
+ }
+
+
+ unshift(@path, $nodes{$last});
+ push(@path, $nodes{$first_elected});
+
+ my $way = way->new($osm_id--);
+ my @way_nodes=();
+ debug( "new way ".$way->id().":\n");
+ foreach (@path) {
+ push(@way_nodes, $_->{"id"});
+ debug( "nodes id: ".$_->{"id"}."\tlat: ".$_->{"lat"}." - long: ".$_->{"lon"}."\n");
+ }
+ $way->nodes(@way_nodes);
+
+ push( @{$tiles{$tile->{"id"}}->{"ways"}}, $way->id());
+ $new_ways{$way->id()} = $way;
+ $ways{$way->id()} = $way;
+
+
+
+ }
+
+
+ # linking the ways
+ # This time all ways should be loops because of the ways we added before
+ debug "\n\nBuilding tree with new ways:\n";
+
+ foreach (@{$tile->{"ways"}}) {
+ my $way = $new_ways{$_};
+ debug( "node ".$way->id()." (size: ".$way->size().")\n" );
+ # only for not yet complete polygons and ways without prev and next
+ if ($way->next() == 0 || $way->prev() == 0) {
+ foreach (@{$tile->{"ways"}}) {
+ my $way2=$new_ways{$_};
+ if ($way->last_node() == $way2->first_node() ) {
+ if ($way->next() == 0) {
+ debug( "\tnext = ".$way2->id()."\n");
+ $way->next($way2->id());
+ } else {
+ debug( "\t error: next way duplicated: old:".$way->next()." new:".$way2->id()." - node: ".$way->last_node()."\n");
+ }
+ }
+ if ($way->first_node() == $way2->last_node() ) {
+ if ($way->prev() == 0) {
+ debug( "\tprev = ".$way2->id()."\n");
+ $way->prev($way2->id());
+ } else {
+ debug( "\t error: prev way duplicated: old:".$way->prev()." new:".$way2->id()." - node: ".$way->first_node()."\n");
+ }
+ }
+ }
+ } else {
+ debug( "\tAlready ok\n" );
+ }
+ }
+
+
+ #merge ways to have only simple ways that are circular
+ debug "merge ways\n";
+
+ # copy into @a because we add new ways to the array inside the loop
+ # -> otherwise it creates an infinite loop
+ my @a = @{$tile->{"ways"}};
+ foreach (@a) {
+# print "way $_\n";
+ my $way = $new_ways{$_};
+ next unless ($way->is_alive());
+
+ my @way_nodes;
+ while ($way->is_alive()) {
+
+ push (@way_nodes, $way->nodes());
+
+ # Distroy the way -> it won't be counted twince thus this will stop the loop
+ # and it will free some memory
+ $way->distroy();
+ last if ($way->next() == 0);
+ $way=$new_ways{ $way->next() };
+ }
+ my $new_way = way->new($osm_id--);
+ $new_way->nodes(@way_nodes);
+
+ push( @{$tiles{$tile->{"id"}}->{"ways"}}, $new_way->id());
+ $new_ways{$new_way->id()} = $new_way;
+ $ways{$new_way->id()} = $new_way;
+
+ }
+
+
+ ## sort the ways between sea and land
+ foreach (@{$tile->{"ways"}}) {
+ my $way = $new_ways{$_};
+ next unless ($way->is_alive());
+# print "---- ".$way->id().": ".$way->first_node()." -> ".$way->last_node()."\n";
+ foreach (@{$tile->{"ways"}}) {
+ my $way2 = $new_ways{$_};
+ # - don't check if a way is included in itself
+ # - check only for ways of type "outer" which is the default type
+ # => actualy should ckeck it. if a not is inside a "inner" way then it belongs
+ # to a lake that is in an island
+ if ($way2->is_alive() && $way2->id() != $way->id() && $way2->type() eq "outer") {
+ if (polygon_contains_node($way2, $nodes{$way->first_node()})) {
+ $way->type("inner");
+ last;
+ }
+ }
+ }
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+########################################
+print "\n\nGenerating new data:\n";
+
+# add new nodes to output file
+foreach $node (@new_nodes) {
+ debug( "adding node ".$node->{"id"}." to osm file\n");
+ print $output " <node id=\"".$node->{"id"}."\" timestamp=\"2008-07-02T22:57:53Z\" user=\"latouche\" lat=\"".$node->{"lat"}."\" lon=\"".$node->{"lon"}."\"/>\n";
+}
+
+# add new ways (highway=motorway for debug)
+#foreach $way (values %new_ways) {
+# print $output " <way id=\"".$way->id()."\" timestamp=\"2008-07-02T22:57:53Z\" user=\"latouche\">\n";
+# foreach $node ($way->nodes()) {
+# print $output " <nd ref=\"".$node."\"/>\n" if defined $node;
+# }
+#
+# print $output " <tag k=\"highway\" v=\"motorway\"/>\n";
+# print $output " </way>\n";
+#
+#}
+
+
+# add new ways to output file
+foreach $tile (values %tiles) {
+ print( "Writing tile: ".$tile->{"id"}."\n");
+ foreach (@{$tile->{"ways"}}) {
+ my $way = $new_ways{$_};
+ my $type = "inner";
+ next unless ($way->is_alive());
+ print $output " <way id=\"".($osm_id--)."\" timestamp=\"2008-07-02T22:57:53Z\" user=\"latouche\">\n";
+ while ($way->is_alive()) {
+
+ $type = ($way->type() eq "outer") ? "water" : "land";
+
+ foreach $node ($way->nodes()) {
+ print "undef node in ".$way->id()."\n" unless defined $node;
+ print $output " <nd ref=\"".$node."\"/>\n" if defined $node;
+ }
+ $way->distroy();
+ last if ($way->next() == 0);
+ $way=$new_ways{ $way->next() };
+ }
+ print $output " <tag k=\"natural\" v=\"".$type."\"/>\n";
+ print $output " </way>\n";
+ }
+}
+
+
+print $output "</osm>\n";
+
+close($output);
+
+exit(0);
diff --git a/script/osm2navit_sea/way.pm b/script/osm2navit_sea/way.pm
new file mode 100644
index 00000000..e6bc7600
--- /dev/null
+++ b/script/osm2navit_sea/way.pm
@@ -0,0 +1,121 @@
+#!/usr/bin/perl -w
+#
+
+package way;
+
+use strict;
+use warnings;
+
+sub new {
+ my($class, $way_id) = @_;
+ my $self = bless({}, $class);
+
+ $self->{id} = $way_id;
+ $self->{first_node} = $self->{last_node} = $self->{prev} = $self->{next} = $self->{size} = 0;
+
+ $self->{type} = "outer";
+
+ $self->{is_alive} = 1;
+
+ $self->{nodes}=[];
+
+ return $self;
+}
+
+# id of the way
+sub id {
+ my $self = shift;
+
+ return $self->{id};
+}
+
+# way killed or not
+sub is_alive {
+ my $self = shift;
+
+ return $self->{is_alive};
+}
+
+# way type: outer or inner multipolygon => island or sea
+sub type {
+ my $self = shift;
+
+ if( @_ ) {
+ $self->{type} = shift;
+ }
+
+ return $self->{type};
+}
+
+# distroy way -> remove @nodes to free memory
+sub distroy {
+ my $self = shift;
+
+ $self->{nodes}=[];
+ $self->{is_alive} = 0;
+}
+
+# first node of the way
+sub first_node {
+ my $self = shift;
+ if( @{$self->{nodes}} ) {
+ return @{$self->{nodes}}[0];
+ } else {
+ return 0;
+ }
+}
+
+# last node the way
+sub last_node {
+ my $self = shift;
+ if( @{$self->{nodes}} ) {
+ return @{$self->{nodes}}[ $self->{size} -1 ];
+ } else {
+ return 0;
+ }
+}
+
+# next way
+sub next {
+ my $self = shift;
+ if( @_ ) {
+ $self->{next} = shift;
+ }
+ return $self->{next};
+}
+
+sub prev {
+ my $self = shift;
+ if( @_ ) {
+ $self->{prev} = shift;
+ }
+ return $self->{prev};
+}
+
+# number of node in the way
+sub size {
+ my $self = shift;
+ return $self->{size};
+}
+
+#nodes
+sub nodes {
+ my $self = shift;
+ if( @_ ) {
+
+ @{$self->{nodes}}=();
+ my $prev=0;
+ foreach (@_) {
+ unless ($_ eq $prev) {
+ $prev=$_;
+ push ( @{$self->{nodes}} , $_);
+ }
+ }
+
+ $self->{size} = scalar(@{$self->{nodes}});
+ }
+
+ return @{$self->{nodes}};
+}
+
+1;
diff --git a/script/wiki2def b/script/wiki2def
new file mode 100755
index 00000000..bbbbb5ba
--- /dev/null
+++ b/script/wiki2def
@@ -0,0 +1,60 @@
+#! /bin/bash
+rm -f item_def.h.wiki
+rm -f osmmap_def.h.wiki
+IFS="|"
+for file in item_def.h.wiki osmmap_def.h.wiki
+do
+ cat <<\EOT >$file
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/* This file is generated from http://wiki.navit-project.org/index.php/Item_def.h, do not edit it, edit the wiki page instead */
+EOT
+done
+type="n"
+wget -O - "http://wiki.navit-project.org/index.php/Item_def.h?action=edit" |
+awk '/<textarea/,/<\/textarea/ { print $0 }' |
+grep "^| " |
+sed -e 's/^| *//' -e 's/ *$//' -e 's/ *|/|/g' -e 's/| */|/g' -e 's/||/|/g' |
+while read id item description osmtags dummy
+do
+ if [[ "$id" == colspan=* ]]
+ then
+ echo "/* $item */" >>item_def.h.wiki
+ continue
+ fi
+ if [[ -z "$id" ]]
+ then
+ echo "ITEM($item)" >>item_def.h.wiki
+ else
+ echo "ITEM2($id,$item)" >>item_def.h.wiki
+ if [ "$id" == "0x80000000" ]
+ then
+ type="w"
+ fi
+ fi
+ if [[ -n "$osmtags" ]]
+ then
+ for osmtag in $(echo "$osmtags" | sed 's/&lt;br\/&gt;/|/g')
+ do
+ printf '"%s\t%s\t%s\t%s\\n"\n' $type $osmtag $item >> osmmap_def.h.wiki
+ done
+ fi
+done
+exit 0
diff --git a/search.c b/search.c
new file mode 100644
index 00000000..7c8b7fd9
--- /dev/null
+++ b/search.c
@@ -0,0 +1,687 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "debug.h"
+#include "projection.h"
+#include "item.h"
+#include "map.h"
+#include "mapset.h"
+#include "coord.h"
+#include "search.h"
+
+struct search_list_level {
+ struct mapset *ms;
+ struct search_list_common *parent;
+ struct attr attr;
+ int partial;
+ int selected;
+ struct mapset_search *search;
+ GHashTable *hash;
+ GList *list,*curr,*last;
+};
+
+struct search_list {
+ struct mapset *ms;
+ int level;
+ struct search_list_level levels[4];
+ struct search_list_result result;
+ struct search_list_result last_result;
+ int last_result_valid;
+};
+
+static guint
+search_item_hash_hash(gconstpointer key)
+{
+ const struct item *itm=key;
+ gconstpointer hashkey=(gconstpointer)(itm->id_hi^itm->id_lo);
+ return g_direct_hash(hashkey);
+}
+
+static gboolean
+search_item_hash_equal(gconstpointer a, gconstpointer b)
+{
+ const struct item *itm_a=a;
+ const struct item *itm_b=b;
+ if (item_is_equal_id(*itm_a, *itm_b))
+ return TRUE;
+ return FALSE;
+}
+
+struct search_list *
+search_list_new(struct mapset *ms)
+{
+ struct search_list *ret;
+
+ ret=g_new0(struct search_list, 1);
+ ret->ms=ms;
+
+ return ret;
+}
+
+static void search_list_search_free(struct search_list *sl, int level);
+
+static int
+search_list_level(enum attr_type attr_type)
+{
+ switch(attr_type) {
+ case attr_country_all:
+ case attr_country_id:
+ case attr_country_iso2:
+ case attr_country_iso3:
+ case attr_country_car:
+ case attr_country_name:
+ return 0;
+ case attr_town_postal:
+ return 1;
+ case attr_town_name:
+ case attr_district_name:
+ case attr_town_or_district_name:
+ return 1;
+ case attr_street_name:
+ return 2;
+ case attr_house_number:
+ return 3;
+ default:
+ dbg(0,"unknown search '%s'\n",attr_to_name(attr_type));
+ return -1;
+ }
+}
+
+void
+search_list_search(struct search_list *this_, struct attr *search_attr, int partial)
+{
+ struct search_list_level *le;
+ int level=search_list_level(search_attr->type);
+ dbg(1,"level=%d\n", level);
+ if (level != -1) {
+ this_->result.id=0;
+ this_->level=level;
+ le=&this_->levels[level];
+ le->attr=*search_attr;
+ if (search_attr->type != attr_country_id)
+ le->attr.u.str=g_strdup(search_attr->u.str);
+ search_list_search_free(this_, level);
+ le->partial=partial;
+ if (level > 0) {
+ le=&this_->levels[level-1];
+ le->curr=le->list;
+ }
+ dbg(1,"le=%p partial=%d\n", le, partial);
+ }
+}
+
+struct search_list_common *
+search_list_select(struct search_list *this_, enum attr_type attr_type, int id, int mode)
+{
+ int level=search_list_level(attr_type);
+ int num=0;
+ struct search_list_level *le;
+ struct search_list_common *slc;
+ GList *curr;
+ le=&this_->levels[level];
+ curr=le->list;
+ if (mode > 0 || !id)
+ le->selected=mode;
+ dbg(1,"enter level=%d %d %d %p\n", level, id, mode, curr);
+ while (curr) {
+ num++;
+ if (! id || num == id) {
+ slc=curr->data;
+ slc->selected=mode;
+ if (id) {
+ dbg(1,"found\n");
+ return slc;
+ }
+ }
+ curr=g_list_next(curr);
+ }
+ dbg(1,"not found\n");
+ return NULL;
+}
+
+static struct search_list_country *
+search_list_country_new(struct item *item)
+{
+ struct search_list_country *ret=g_new0(struct search_list_country, 1);
+ struct attr attr;
+
+ ret->common.item=ret->common.unique=*item;
+ if (item_attr_get(item, attr_country_car, &attr))
+ ret->car=g_strdup(attr.u.str);
+ if (item_attr_get(item, attr_country_iso2, &attr)) {
+ ret->iso2=g_strdup(attr.u.str);
+ ret->flag=g_strdup_printf("country_%s", ret->iso2);
+ }
+ if (item_attr_get(item, attr_country_iso3, &attr))
+ ret->iso3=g_strdup(attr.u.str);
+ if (item_attr_get(item, attr_country_name, &attr))
+ ret->name=g_strdup(attr.u.str);
+ return ret;
+}
+
+static void
+search_list_country_destroy(struct search_list_country *this_)
+{
+ g_free(this_->car);
+ g_free(this_->iso2);
+ g_free(this_->iso3);
+ g_free(this_->flag);
+ g_free(this_->name);
+ g_free(this_);
+}
+
+static struct search_list_town *
+search_list_town_new(struct item *item)
+{
+ struct search_list_town *ret=g_new0(struct search_list_town, 1);
+ struct attr attr;
+ struct coord c;
+
+ ret->itemt=*item;
+ ret->common.item=ret->common.unique=*item;
+ if (item_attr_get(item, attr_town_streets_item, &attr)) {
+ dbg(1,"town_assoc 0x%x 0x%x\n", attr.u.item->id_hi, attr.u.item->id_lo);
+ ret->common.unique=*attr.u.item;
+ }
+ if (item_attr_get(item, attr_town_name, &attr))
+ ret->name=map_convert_string(item->map,attr.u.str);
+ else
+ ret->name=NULL;
+ if (item_attr_get(item, attr_town_postal, &attr))
+ ret->common.postal=map_convert_string(item->map,attr.u.str);
+ else
+ ret->common.postal=NULL;
+ if (item_attr_get(item, attr_district_name, &attr))
+ ret->district=map_convert_string(item->map,attr.u.str);
+ else
+ ret->district=NULL;
+ if (item_coord_get(item, &c, 1)) {
+ ret->common.c=g_new(struct pcoord, 1);
+ ret->common.c->x=c.x;
+ ret->common.c->y=c.y;
+ ret->common.c->pro = map_projection(item->map);
+ }
+ return ret;
+}
+
+static void
+search_list_town_destroy(struct search_list_town *this_)
+{
+ map_convert_free(this_->name);
+ map_convert_free(this_->common.postal);
+ if (this_->common.c)
+ g_free(this_->common.c);
+ g_free(this_);
+}
+
+static void
+search_list_common_new(struct item *item, struct search_list_common *common)
+{
+ struct attr attr;
+ if (item_attr_get(item, attr_town_name, &attr))
+ common->town_name=map_convert_string(item->map, attr.u.str);
+ else
+ common->town_name=NULL;
+ if (item_attr_get(item, attr_district_name, &attr))
+ common->district_name=map_convert_string(item->map, attr.u.str);
+ else
+ common->district_name=NULL;
+ if (item_attr_get(item, attr_postal, &attr))
+ common->postal=map_convert_string(item->map, attr.u.str);
+ else
+ common->postal=NULL;
+}
+
+static struct search_list_street *
+search_list_street_new(struct item *item)
+{
+ struct search_list_street *ret=g_new0(struct search_list_street, 1);
+ struct attr attr;
+ struct coord c;
+
+ ret->common.item=ret->common.unique=*item;
+ if (item_attr_get(item, attr_street_name, &attr))
+ ret->name=map_convert_string(item->map, attr.u.str);
+ else
+ ret->name=NULL;
+ search_list_common_new(item, &ret->common);
+ if (item_coord_get(item, &c, 1)) {
+ ret->common.c=g_new(struct pcoord, 1);
+ ret->common.c->x=c.x;
+ ret->common.c->y=c.y;
+ ret->common.c->pro = map_projection(item->map);
+ }
+ return ret;
+}
+
+static void
+search_list_common_destroy(struct search_list_common *common)
+{
+ map_convert_free(common->town_name);
+ map_convert_free(common->district_name);
+ map_convert_free(common->postal);
+}
+
+static void
+search_list_street_destroy(struct search_list_street *this_)
+{
+ map_convert_free(this_->name);
+ search_list_common_destroy(&this_->common);
+ if (this_->common.c)
+ g_free(this_->common.c);
+ g_free(this_);
+}
+
+static struct search_list_house_number *
+search_list_house_number_new(struct item *item)
+{
+ struct search_list_house_number *ret=g_new0(struct search_list_house_number, 1);
+ struct attr attr;
+ struct coord c;
+
+ ret->common.item=ret->common.unique=*item;
+ if (item_attr_get(item, attr_house_number, &attr))
+ ret->house_number=map_convert_string(item->map, attr.u.str);
+ search_list_common_new(item, &ret->common);
+ if (item_coord_get(item, &c, 1)) {
+ ret->common.c=g_new(struct pcoord, 1);
+ ret->common.c->x=c.x;
+ ret->common.c->y=c.y;
+ ret->common.c->pro = map_projection(item->map);
+ }
+ return ret;
+}
+
+static void
+search_list_house_number_destroy(struct search_list_house_number *this_)
+{
+ map_convert_free(this_->house_number);
+ search_list_common_destroy(&this_->common);
+ if (this_->common.c)
+ g_free(this_->common.c);
+ g_free(this_);
+}
+
+static void
+search_list_result_destroy(int level, void *p)
+{
+ switch (level) {
+ case 0:
+ search_list_country_destroy(p);
+ break;
+ case 1:
+ search_list_town_destroy(p);
+ break;
+ case 2:
+ search_list_street_destroy(p);
+ break;
+ case 3:
+ search_list_house_number_destroy(p);
+ break;
+ }
+}
+
+static void
+search_list_search_free(struct search_list *sl, int level)
+{
+ struct search_list_level *le=&sl->levels[level];
+ GList *next,*curr;
+ if (le->search) {
+ mapset_search_destroy(le->search);
+ le->search=NULL;
+ }
+#if 0 /* FIXME */
+ if (le->hash) {
+ g_hash_table_destroy(le->hash);
+ le->hash=NULL;
+ }
+#endif
+ curr=le->list;
+ while (curr) {
+ search_list_result_destroy(level, curr->data);
+ next=g_list_next(curr);
+ curr=next;
+ }
+ g_list_free(le->list);
+ le->list=NULL;
+ le->curr=NULL;
+ le->last=NULL;
+
+}
+
+static char *
+postal_merge(char *mask, char *new)
+{
+ dbg(1,"enter %s %s\n", mask, new);
+ int i;
+ char *ret=NULL;
+ if (!new)
+ return NULL;
+ if (!mask)
+ return g_strdup(new);
+ i=0;
+ while (mask[i] && new[i]) {
+ if (mask[i] != '.' && mask[i] != new[i])
+ break;
+ i++;
+
+ }
+ if (mask[i]) {
+ ret=g_strdup(mask);
+ while (mask[i])
+ ret[i++]='.';
+ }
+ dbg(1,"merged %s with %s as %s\n", mask, new, ret);
+ return ret;
+}
+
+static int
+search_add_result(struct search_list_level *le, struct search_list_common *slc)
+{
+ struct search_list_common *slo;
+ char *merged;
+ slo=g_hash_table_lookup(le->hash, &slc->unique);
+ if (!slo) {
+ g_hash_table_insert(le->hash, &slc->unique, slc);
+ if (slc->postal && !slc->postal_mask) {
+ slc->postal_mask=g_strdup(slc->postal);
+ }
+ le->list=g_list_append(le->list, slc);
+ return 1;
+ }
+ merged=postal_merge(slo->postal_mask, slc->postal);
+ if (merged) {
+ g_free(slo->postal_mask);
+ slo->postal_mask=merged;
+ }
+ return 0;
+}
+
+struct search_list_result *
+search_list_get_result(struct search_list *this_)
+{
+ struct search_list_level *le,*leu;
+ struct item *item;
+ int level=this_->level;
+
+ dbg(1,"enter\n");
+ le=&this_->levels[level];
+ dbg(1,"le=%p\n", le);
+ for (;;) {
+ dbg(1,"le->search=%p\n", le->search);
+ if (! le->search) {
+ dbg(1,"partial=%d level=%d\n", le->partial, level);
+ if (! level)
+ le->parent=NULL;
+ else {
+ leu=&this_->levels[level-1];
+ dbg(1,"leu->curr=%p\n", leu->curr);
+ for (;;) {
+ struct search_list_common *slc;
+ if (! leu->curr)
+ return NULL;
+ le->parent=leu->curr->data;
+ leu->last=leu->curr;
+ leu->curr=g_list_next(leu->curr);
+ slc=(struct search_list_common *)(le->parent);
+ if (!slc)
+ break;
+ if (slc->selected == leu->selected)
+ break;
+ }
+ }
+ if (le->parent)
+ dbg(1,"mapset_search_new with item(%d,%d)\n", le->parent->item.id_hi, le->parent->item.id_lo);
+ dbg(1,"attr=%s\n", attr_to_name(le->attr.type));
+ le->search=mapset_search_new(this_->ms, &le->parent->item, &le->attr, le->partial);
+ le->hash=g_hash_table_new(search_item_hash_hash, search_item_hash_equal);
+ }
+ dbg(1,"le->search=%p\n", le->search);
+ item=mapset_search_get_item(le->search);
+ dbg(1,"item=%p\n", item);
+ if (item) {
+ void *p=NULL;
+ dbg(1,"id_hi=%d id_lo=%d\n", item->id_hi, item->id_lo);
+ this_->result.country=NULL;
+ this_->result.town=NULL;
+ this_->result.street=NULL;
+ this_->result.c=NULL;
+ switch (level) {
+ case 0:
+ p=search_list_country_new(item);
+ this_->result.country=p;
+ break;
+ case 1:
+ p=search_list_town_new(item);
+ this_->result.country=this_->levels[0].last->data;
+ this_->result.town=p;
+ this_->result.c=this_->result.town->common.c;
+ break;
+ case 2:
+ p=search_list_street_new(item);
+ this_->result.country=this_->levels[0].last->data;
+ this_->result.town=this_->levels[1].last->data;
+ this_->result.street=p;
+ this_->result.c=this_->result.street->common.c;
+ break;
+ case 3:
+ p=search_list_house_number_new(item);
+ this_->result.country=this_->levels[0].last->data;
+ this_->result.town=this_->levels[1].last->data;
+ this_->result.street=this_->levels[2].last->data;
+ this_->result.house_number=p;
+ this_->result.c=this_->result.street->common.c;
+
+ }
+ if (p) {
+ if (search_add_result(le, p)) {
+ this_->result.id++;
+ return &this_->result;
+ } else
+ search_list_result_destroy(level, p);
+ }
+ } else {
+ mapset_search_destroy(le->search);
+ le->search=NULL;
+ g_hash_table_destroy(le->hash);
+ if (! level)
+ break;
+ }
+ }
+ return NULL;
+}
+
+void
+search_list_destroy(struct search_list *this_)
+{
+ g_free(this_);
+}
+
+void
+search_init(void)
+{
+}
+
+#if 0
+static char *
+search_fix_spaces(char *str)
+{
+ int i;
+ int len=strlen(str);
+ char c,*s,*d,*ret=g_strdup(str);
+
+ for (i = 0 ; i < len ; i++) {
+ if (ret[i] == ',' || ret[i] == ',' || ret[i] == '/')
+ ret[i]=' ';
+ }
+ s=ret;
+ d=ret;
+ len=0;
+ do {
+ c=*s++;
+ if (c != ' ' || len != 0) {
+ *d++=c;
+ len++;
+ }
+ while (c == ' ' && *s == ' ')
+ s++;
+ if (c == ' ' && *s == '\0') {
+ d--;
+ len--;
+ }
+ } while (c);
+ return ret;
+}
+
+static GList *
+search_split_phrases(char *str)
+{
+ char *tmp,*s,*d;
+ s=str;
+ GList *ret=NULL;
+ do {
+ tmp=g_strdup(s);
+ d=tmp+strlen(s)-1;
+ ret=g_list_append(ret, g_strdup(s));
+ while (d >= tmp) {
+ if (*d == ' ') {
+ *d = '\0';
+ ret=g_list_append(ret, g_strdup(tmp));
+ }
+ d--;
+ }
+ g_free(tmp);
+ do {
+ s++;
+ if (*s == ' ') {
+ s++;
+ break;
+ }
+ } while (*s != '\0');
+ } while (*s != '\0');
+ return ret;
+}
+
+static void
+search_address_housenumber(struct search_list *sl, GList *phrases, GList *exclude1, GList *exclude2, GList *exclude3)
+{
+ struct search_list_result *slr;
+ GList *tmp=phrases;
+ int count=0;
+ struct attr attr;
+ attr.type=attr_street_name;
+ while (slr=search_list_get_result(sl)) {
+ dbg(0,"%p\n",slr);
+ dbg(0,"%p %p\n",slr->country,slr->town);
+ dbg(0,"%s %s %s %s %s\n",slr->country->car,slr->town->common.postal,slr->town->name,slr->town->district,slr->street->name);
+ count++;
+ }
+ if (!count)
+ return;
+ dbg(0,"count %d\n",count);
+ while (tmp) {
+ if (tmp != exclude1 && tmp != exclude2 && tmp != exclude3) {
+ attr.type=attr_house_number;
+ attr.u.str=tmp->data;
+ search_list_search(sl, &attr, 0);
+ while (slr=search_list_get_result(sl)) {
+ dbg(0,"result %s %s(%s) %s %s\n",slr->house_number->common.postal,slr->house_number->common.town_name, slr->house_number->common.district_name,slr->street->name,slr->house_number->house_number);
+ }
+
+ }
+ tmp=g_list_next(tmp);
+ }
+}
+static void
+search_address_street(struct search_list *sl, GList *phrases, GList *exclude1, GList *exclude2)
+{
+ struct search_list_result *slr;
+ GList *tmp=phrases;
+ int count=0;
+ struct attr attr;
+ attr.type=attr_street_name;
+ while (slr=search_list_get_result(sl)) {
+#if 0
+ dbg(0,"%s %s %s %s",slr->country->car,slr->town->name,slr->town->district,slr->street->name);
+#endif
+ dbg(0,"%s %s %s %s\n",slr->country->car,slr->town->common.postal,slr->town->name,slr->town->district);
+ count++;
+ }
+ if (!count)
+ return;
+ dbg(0,"count %d\n",count);
+ while (tmp) {
+ if (tmp != exclude1 && tmp != exclude2) {
+ attr.u.str=tmp->data;
+ search_list_search(sl, &attr, 0);
+ search_address_housenumber(sl, phrases, exclude1, exclude2, tmp);
+ }
+ tmp=g_list_next(tmp);
+ }
+}
+
+static void
+search_address_town(struct search_list *sl, GList *phrases, GList *exclude)
+{
+ GList *tmp=phrases;
+ int count=0;
+ struct attr attr;
+ attr.type=attr_town_or_district_name;
+ while (search_list_get_result(sl))
+ count++;
+ if (!count)
+ return;
+ dbg(0,"count %d\n",count);
+ while (tmp) {
+ if (tmp != exclude) {
+ attr.u.str=tmp->data;
+ search_list_search(sl, &attr, 0);
+ search_address_street(sl, phrases, exclude, tmp);
+ }
+ tmp=g_list_next(tmp);
+ }
+}
+
+void
+search_by_address(struct mapset *ms, char *addr)
+{
+ char *str=search_fix_spaces(addr);
+ GList *tmp,*phrases=search_split_phrases(str);
+ dbg(0,"enter %s\n",addr);
+ struct search_list *sl;
+ struct search_list_result *slr;
+ struct attr attr;
+ attr.type=attr_country_all;
+ tmp=phrases;
+ sl=search_list_new(ms);
+ while (tmp) {
+ attr.u.str=tmp->data;
+ search_list_search(sl, &attr, 0);
+ search_address_town(sl, phrases, tmp);
+ tmp=g_list_next(tmp);
+ }
+ search_list_search(sl, country_default(), 0);
+ search_address_town(sl, phrases, NULL);
+
+ g_free(str);
+}
+#endif
+
diff --git a/search.h b/search.h
new file mode 100644
index 00000000..04547bf7
--- /dev/null
+++ b/search.h
@@ -0,0 +1,88 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_SEARCH_H
+#define NAVIT_SEARCH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+struct search_list_common {
+ struct item unique,item;
+ int selected;
+ struct pcoord *c;
+ char *town_name;
+ char *district_name;
+ char *postal;
+ char *postal_mask;
+};
+
+struct search_list_country {
+ struct search_list_common common;
+ char *car;
+ char *iso2;
+ char *iso3;
+ char *name;
+ char *flag;
+};
+
+struct search_list_town {
+ struct search_list_common common;
+ struct item itemt;
+ char *name;
+ char *district;
+};
+
+struct search_list_street {
+ struct search_list_common common;
+ char *name;
+};
+
+struct search_list_house_number {
+ struct search_list_common common;
+ char *house_number;
+};
+
+struct search_list_result {
+ int id;
+ struct pcoord *c;
+ struct search_list_country *country;
+ struct search_list_town *town;
+ struct search_list_street *street;
+ struct search_list_house_number *house_number;
+};
+
+/* prototypes */
+struct attr;
+struct mapset;
+struct search_list;
+struct search_list_result;
+struct search_list *search_list_new(struct mapset *ms);
+void search_list_search(struct search_list *this_, struct attr *search_attr, int partial);
+struct search_list_common *search_list_select(struct search_list *this_, enum attr_type attr_type, int id, int mode);
+struct search_list_result *search_list_get_result(struct search_list *this_);
+void search_list_destroy(struct search_list *this_);
+void search_init(void);
+/* end of prototypes */
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/speech.c b/speech.c
new file mode 100644
index 00000000..b3df1694
--- /dev/null
+++ b/speech.c
@@ -0,0 +1,134 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "debug.h"
+#include "item.h"
+#include "speech.h"
+#include "plugin.h"
+
+struct speech {
+ struct speech_priv *priv;
+ struct speech_methods meth;
+ struct attr **attrs;
+};
+
+
+struct speech *
+speech_new(struct attr *parent, struct attr **attrs)
+{
+ struct speech *this_;
+ struct speech_priv *(*speech_new)(struct speech_methods *meth, struct attr **attrs);
+ struct attr *attr;
+
+ attr=attr_search(attrs, NULL, attr_type);
+ if (! attr) {
+ dbg(0,"type missing\n");
+ return NULL;
+ }
+ dbg(1,"type='%s'\n", attr->u.str);
+ speech_new=plugin_get_speech_type(attr->u.str);
+ dbg(1,"new=%p\n", speech_new);
+ if (! speech_new) {
+ dbg(0,"wrong type '%s'\n", attr->u.str);
+ return NULL;
+ }
+ this_=g_new0(struct speech, 1);
+ this_->priv=speech_new(&this_->meth, attrs);
+ this_->attrs=attr_list_dup(attrs);
+ dbg(1, "say=%p\n", this_->meth.say);
+ dbg(1,"priv=%p\n", this_->priv);
+ if (! this_->priv) {
+ g_free(this_);
+ return NULL;
+ }
+ dbg(1,"return %p\n", this_);
+
+ return this_;
+}
+
+int
+speech_say(struct speech *this_, const char *text)
+{
+ dbg(1, "this_=%p text='%s' calling %p\n", this_, text, this_->meth.say);
+ return (this_->meth.say)(this_->priv, text);
+}
+
+/**
+ * @brief Gets an attribute from a speech plugin
+ *
+ * @param this_ The speech plugin the attribute should be read from
+ * @param type The type of the attribute to be read
+ * @param attr Pointer to an attrib-structure where the attribute should be written to
+ * @param iter (NOT IMPLEMENTED) Used to iterate through all attributes of a type. Set this to NULL to get the first attribute, set this to an attr_iter to get the next attribute
+ * @return True if the attribute type was found, false if not
+ */
+
+int
+speech_get_attr(struct speech *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
+{
+ return attr_generic_get_attr(this_->attrs, NULL, type, attr, iter);
+}
+
+/**
+ * @brief Tries to estimate how long it will take to speak a certain string
+ *
+ * This function tries to estimate how long it will take to speak a certain string
+ * passed in str. It relies on the "characters per second"-value passed from the
+ * configuration.
+ *
+ * @param this_ The speech whose speed should be used
+ * @param str The string that should be estimated
+ * @return Time in tenth of seconds or -1 on error
+ */
+int
+speech_estimate_duration(struct speech *this_, char *str)
+{
+ int count;
+ struct attr cps_attr;
+
+ if (!speech_get_attr(this_,attr_cps,&cps_attr,NULL)) {
+ return -1;
+ }
+
+ count = strlen(str);
+
+ return (count * 10) / cps_attr.u.num;
+}
+
+/**
+ * @brief Sets an attribute from an speech plugin
+ *
+ * This sets an attribute of a speech plugin, overwriting an attribute of the same type if it
+ * already exists. This function also calls all the callbacks that are registred
+ * to be called when attributes change.
+ *
+ * @param this_ The speech plugin to set the attribute of
+ * @param attr The attribute to set
+ * @return True if the attr could be set, false otherwise
+ */
+
+int
+speech_set_attr(struct speech *this_, struct attr *attr)
+{
+ this_->attrs=attr_generic_set_attr(this_->attrs, attr);
+ //callback_list_call_attr_2(this_->attr_cbl, attr->type, this_, attr);
+ return 1;
+}
diff --git a/speech.h b/speech.h
new file mode 100644
index 00000000..ef7c594e
--- /dev/null
+++ b/speech.h
@@ -0,0 +1,41 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_SPEECH_H
+#define NAVIT_SPEECH_H
+
+struct speech_priv;
+
+struct speech_methods {
+ void (*destroy)(struct speech_priv *this_);
+ int (*say)(struct speech_priv *this_, const char *text);
+};
+
+/* prototypes */
+struct speech * speech_new(struct attr *parent, struct attr **attrs);
+int speech_say(struct speech *this_, const char *text);
+int speech_sayf(struct speech *this_, const char *format, ...);
+void speech_destroy(struct speech *this_);
+int speech_get_attr(struct speech *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
+int speech_set_attr(struct speech *this_, struct attr *attr);
+int speech_estimate_duration(struct speech *this_, char *str);
+/* end of prototypes */
+
+#endif
+
diff --git a/speech/Makefile.am b/speech/Makefile.am
new file mode 100644
index 00000000..03b17d89
--- /dev/null
+++ b/speech/Makefile.am
@@ -0,0 +1,7 @@
+SUBDIRS=
+if SPEECH_CMDLINE
+ SUBDIRS += cmdline
+endif
+if SPEECH_SPEECH_DISPATCHER
+ SUBDIRS += speech_dispatcher
+endif
diff --git a/speech/cmdline/Makefile.am b/speech/cmdline/Makefile.am
new file mode 100644
index 00000000..025d553e
--- /dev/null
+++ b/speech/cmdline/Makefile.am
@@ -0,0 +1,5 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=speech_cmdline
+modulespeech_LTLIBRARIES = libspeech_cmdline.la
+libspeech_cmdline_la_SOURCES = speech_cmdline.c
+libspeech_cmdline_la_LDFLAGS = -module -avoid-version
diff --git a/speech/cmdline/speech_cmdline.c b/speech/cmdline/speech_cmdline.c
new file mode 100644
index 00000000..ba8979ea
--- /dev/null
+++ b/speech/cmdline/speech_cmdline.c
@@ -0,0 +1,128 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdlib.h>
+#include <glib.h>
+#include "config.h"
+#include "item.h"
+#include "plugin.h"
+#include "speech.h"
+#ifdef HAVE_API_WIN32_BASE
+#include <windows.h>
+#include "util.h"
+#endif
+#ifdef USE_EXEC
+#include <sys/types.h>
+#include <unistd.h>
+#include <string.h>
+#endif
+
+struct speech_priv {
+ char *cmdline;
+};
+
+static int
+speechd_say(struct speech_priv *this, const char *text)
+{
+#ifdef USE_EXEC
+ if (!fork()) {
+ char *cmdline=g_strdup_printf(this->cmdline, text);
+ int argcmax=10;
+ char *argv[argcmax];
+ int argc=0;
+ char *pos=cmdline,end;
+ while (*pos && argc < argcmax-1) {
+ end=' ';
+ if (*pos == '\'' || *pos == '\"') {
+ end=*pos++;
+ }
+ argv[argc]=pos;
+ while (*pos && *pos != end)
+ pos++;
+ if (*pos)
+ *pos++='\0';
+ while (*pos == ' ')
+ pos++;
+ if (strcmp(argv[argc], "2>/dev/null") && strcmp(argv[argc],">/dev/null") && strcmp(argv[argc],"&"))
+ argc++;
+ }
+ argv[argc++]=NULL;
+ execvp(argv[0], argv);
+ exit(1);
+ }
+ return 0;
+#else
+#ifdef HAVE_API_WIN32_BASE
+ char *cmdline,*p;
+ PROCESS_INFORMATION pr;
+ LPCWSTR cmd,arg;
+ int ret;
+
+
+ cmdline=g_strdup_printf(this->cmdline, text);
+ p=cmdline;
+ while (*p != ' ' && *p != '\0')
+ p++;
+ if (*p == ' ')
+ *p++='\0';
+ cmd = newSysString(cmdline);
+ arg = newSysString(p);
+ ret=!CreateProcess(cmd, arg, NULL, NULL, 0, CREATE_NEW_CONSOLE, NULL, NULL, NULL, &pr);
+ g_free(cmd);
+ g_free(arg);
+ return ret;
+#else
+ char *cmdline;
+
+ cmdline=g_strdup_printf(this->cmdline, text);
+ return system(cmdline);
+#endif
+#endif
+}
+
+static void
+speechd_destroy(struct speech_priv *this) {
+ g_free(this->cmdline);
+ g_free(this);
+}
+
+static struct speech_methods speechd_meth = {
+ speechd_destroy,
+ speechd_say,
+};
+
+static struct speech_priv *
+speechd_new(struct speech_methods *meth, struct attr **attrs) {
+ struct speech_priv *this;
+ struct attr *data;
+ data=attr_search(attrs, NULL, attr_data);
+ if (! data)
+ return NULL;
+ this=g_new(struct speech_priv,1);
+ this->cmdline=g_strdup(data->u.str);
+ *meth=speechd_meth;
+ return this;
+}
+
+
+void
+plugin_init(void)
+{
+ plugin_register_speech_type("cmdline", speechd_new);
+}
diff --git a/speech/speech_dispatcher/Makefile.am b/speech/speech_dispatcher/Makefile.am
new file mode 100644
index 00000000..a040740e
--- /dev/null
+++ b/speech/speech_dispatcher/Makefile.am
@@ -0,0 +1,6 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=speech_speech_dispatcher
+modulespeech_LTLIBRARIES = libspeech_speech_dispatcher.la
+libspeech_speech_dispatcher_la_SOURCES = speech_speech_dispatcher.c
+libspeech_speech_dispatcher_la_LIBADD = @SPEECHD_LIBS@
+libspeech_speech_dispatcher_la_LDFLAGS = -module -avoid-version
diff --git a/speech/speech_dispatcher/speech_speech_dispatcher.c b/speech/speech_dispatcher/speech_speech_dispatcher.c
new file mode 100644
index 00000000..b2c0e2a0
--- /dev/null
+++ b/speech/speech_dispatcher/speech_speech_dispatcher.c
@@ -0,0 +1,81 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <stdarg.h>
+#include "config.h"
+#include <libspeechd.h>
+#include "plugin.h"
+#include "speech.h"
+
+struct speech_priv {
+ SPDConnection *conn;
+};
+
+static int
+speechd_say(struct speech_priv *this, const char *text) {
+ int err;
+
+ err = spd_sayf(this->conn, SPD_MESSAGE, text);
+ if (err != 1)
+ return 1;
+ return 0;
+}
+
+static void
+speechd_destroy(struct speech_priv *this) {
+ spd_close(this->conn);
+ g_free(this);
+}
+
+static struct speech_methods speechd_meth = {
+ speechd_destroy,
+ speechd_say,
+};
+
+static struct speech_priv *
+speechd_new(struct speech_methods *meth, struct attr **attrs) {
+ struct speech_priv *this;
+ SPDConnection *conn;
+
+ conn = spd_open("navit","main",NULL,SPD_MODE_SINGLE);
+ if (! conn)
+ return NULL;
+ this=g_new(struct speech_priv,1);
+ if (this) {
+ this->conn=conn;
+ *meth=speechd_meth;
+ spd_set_punctuation(conn, SPD_PUNCT_NONE);
+ }
+ return this;
+}
+
+
+void
+plugin_init(void)
+{
+ plugin_register_speech_type("speech_dispatcher", speechd_new);
+}
diff --git a/start.c b/start.c
new file mode 100644
index 00000000..f31631bb
--- /dev/null
+++ b/start.c
@@ -0,0 +1,187 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <getopt.h>
+#include "config.h"
+#include "version.h"
+#include "item.h"
+#include "coord.h"
+#include "main.h"
+#include "route.h"
+#include "navigation.h"
+#include "track.h"
+#include "debug.h"
+#include "event.h"
+#include "event_glib.h"
+#include "xmlconfig.h"
+#include "file.h"
+#include "search.h"
+#include "navit_nls.h"
+#include "atom.h"
+#ifdef HAVE_API_WIN32_CE
+#include <windows.h>
+#include <winbase.h>
+#endif
+
+char *version=PACKAGE_VERSION" "SVN_VERSION""NAVIT_VARIANT;
+
+static void
+print_usage(void)
+{
+ printf(_("navit usage:\nnavit [options] [configfile]\n\t-c <file>: use <file> as config file\n\t-d <n>: set the debug output level to <n>. (TODO)\n\t-h: print this usage info and exit.\n\t-v: Print the version and exit.\n"));
+}
+
+
+static gchar *
+get_home_directory(void)
+{
+ static gchar *homedir = NULL;
+
+ if (homedir) return homedir;
+ homedir = getenv("HOME");
+ if (!homedir)
+ {
+ dbg(0,"Could not find home directory. Using current directory as home directory.\n");
+ homedir = ".";
+ } else {
+ homedir=g_strdup(homedir);
+ }
+ return homedir;
+}
+
+int main(int argc, char **argv)
+{
+ xmlerror *error = NULL;
+ char *config_file = NULL;
+ int opt;
+ char *cp;
+
+ GList *list = NULL, *li;
+
+
+#ifdef HAVE_GLIB
+ event_glib_init();
+#endif
+ atom_init();
+ main_init(argv[0]);
+ main_init_nls();
+ debug_init(argv[0]);
+
+ cp = getenv("NAVIT_LOGFILE");
+ if (cp)
+ debug_set_logfile(cp);
+#ifdef HAVE_API_WIN32_CE
+ else
+ debug_set_logfile("/Storage Card/navit.log");
+#endif
+ file_init();
+#ifndef USE_PLUGINS
+ extern void builtin_init(void);
+ builtin_init();
+#endif
+ route_init();
+ navigation_init();
+ tracking_init();
+ search_init();
+ linguistics_init();
+ config_file=NULL;
+ opterr=0; //don't bomb out on errors.
+ if (argc > 1) {
+ /* DEVELOPPERS : don't forget to update the manpage if you modify theses options */
+ while((opt = getopt(argc, argv, ":hvc:d:")) != -1) {
+ switch(opt) {
+ case 'h':
+ print_usage();
+ exit(0);
+ break;
+ case 'v':
+ printf("%s %s\n", "navit", version);
+ exit(0);
+ break;
+ case 'c':
+ printf("config file n is set to `%s'\n", optarg);
+ config_file = optarg;
+ break;
+ case 'd':
+ printf("TODO Verbose option is set to `%s'\n", optarg);
+ break;
+ case ':':
+ fprintf(stderr, "navit: Error - Option `%c' needs a value\n", optopt);
+ print_usage();
+ exit(1);
+ break;
+ case '?':
+ fprintf(stderr, "navit: Error - No such option: `%c'\n", optopt);
+ print_usage();
+ exit(1);
+ }
+ }
+ }
+ // use 1st cmd line option that is left for the config file
+ if (optind < argc) config_file = argv[optind];
+
+ // if config file is explicitely given only look for it, otherwise try std paths
+ if (config_file) list = g_list_append(list,g_strdup(config_file));
+ else {
+ list = g_list_append(list,g_strjoin(NULL,get_home_directory(), "/.navit/navit.xml" , NULL));
+ list = g_list_append(list,g_strdup("navit.xml.local"));
+ list = g_list_append(list,g_strdup("navit.xml"));
+ list = g_list_append(list,g_strjoin(NULL,getenv("NAVIT_SHAREDIR"), "/navit.xml.local" , NULL));
+ list = g_list_append(list,g_strjoin(NULL,getenv("NAVIT_SHAREDIR"), "/navit.xml" , NULL));
+ #ifndef _WIN32
+ list = g_list_append(list,g_strdup("/etc/navit/navit.xml"));
+ #endif
+ }
+ li = list;
+ for (;;) {
+ if (li == NULL) {
+ // We have not found an existing config file from all possibilities
+ printf(_("No config file navit.xml, navit.xml.local found\n"));
+ exit(1);
+ }
+ // Try the next config file possibility from the list
+ config_file = li->data;
+ if (file_exists(config_file))
+ break;
+ else
+ g_free(config_file);
+ li = g_list_next(li);
+ }
+
+ if (!config_load(config_file, &error)) {
+ dbg(0, _("Error parsing '%s': %s\n"), config_file, error ? error->message : "");
+ } else {
+ dbg(0, _("Using '%s'\n"), config_file);
+ }
+ while (li) {
+ g_free(li->data);
+ li = g_list_next(li);
+ }
+ g_list_free(list);
+ if (! main_get_navit(NULL)) {
+ dbg(0, _("No instance has been created, exiting\n"));
+ exit(1);
+ }
+ event_main_loop_run();
+
+ return 0;
+}
diff --git a/startonce.sh b/startonce.sh
new file mode 100755
index 00000000..4053a11b
--- /dev/null
+++ b/startonce.sh
@@ -0,0 +1,81 @@
+#!/bin/sh
+
+# This script is part of navit, a navigation system.
+# It can be used to make shure that navit is only started
+# once. If navit is already running it will be brought to
+# the front.
+
+# Set this to a place where a pidfile should be stored.
+# Make shure you have write access...
+PIDFILE="/var/run/navit/navit.pid"
+
+# Set this to navit's executable.
+NAVIT="./navit"
+
+# Optional: Set this to an alternative configuration file
+#CONFIG="./navit.xml"
+
+############################################################
+### You should not need to edit anything below this line ###
+############################################################
+
+function check_wmctrl()
+{
+ which wmctrl > /dev/null
+
+ if [ $? -ne 0 ] ; then
+ echo "I need the 'wmctrl' program. Exit."
+ exit 1
+ fi
+}
+
+function start_navit()
+{
+ if [ "x" != "x$CONFIG" ] ; then
+ $NAVIT -c $CONFIG &
+ else
+ $NAVIT &
+ fi
+
+ pid=$!
+
+ echo -n "$pid" > $PIDFILE
+
+ if [ $? -eq 0 ] ; then
+ echo "Started navit with PID $pid."
+ else
+ kill $pid
+ echo "Could not create pidfile!"
+ exit 1
+ fi
+
+ # Waiting for navit to close...
+ wait $pid
+
+ rm $PIDFILE
+}
+
+function check_navit()
+{
+ if [ -f $PIDFILE ] ; then
+ pid=`cat $PIDFILE`
+ kill -0 $pid 2>/dev/null
+ if [ $? -eq 0 ] ; then
+ echo "Bringing Navit to front"
+
+ winid=`wmctrl -l -p | grep -e "^[^:blank:]*[:blank:]*[^:blank:]*[:blank:]*$pid[:blank:]*" | sed 's/ .*//'`
+ wmctrl -i -R $winid
+
+ exit 0
+ fi
+ fi
+}
+
+
+### Start of the main script ###
+
+check_wmctrl
+
+check_navit
+
+start_navit \ No newline at end of file
diff --git a/support/Makefile.am b/support/Makefile.am
new file mode 100644
index 00000000..8a488cde
--- /dev/null
+++ b/support/Makefile.am
@@ -0,0 +1,20 @@
+SUBDIRS=
+if SUPPORT_EZXML
+ SUBDIRS+=ezxml
+endif
+if SUPPORT_GLIB
+ SUBDIRS+=glib
+endif
+if SUPPORT_WORDEXP
+ SUBDIRS+=wordexp
+endif
+if SUPPORT_WIN32
+ SUBDIRS+=win32
+endif
+if SUPPORT_ZLIB
+ SUBDIRS+=zlib
+endif
+if SUPPORT_LIBC
+ SUBDIRS+=libc
+endif
+DIST_SUBDIRS=ezxml glib wordexp win32 zlib libc
diff --git a/support/ezxml/Makefile.am b/support/ezxml/Makefile.am
new file mode 100644
index 00000000..1b091a39
--- /dev/null
+++ b/support/ezxml/Makefile.am
@@ -0,0 +1,4 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=support_ezxml -DEZXML_NOMMAP
+noinst_LTLIBRARIES = libsupport_ezxml.la
+libsupport_ezxml_la_SOURCES = ezxml.c ezxml_init.c ezxml.h
diff --git a/support/ezxml/ezxml.c b/support/ezxml/ezxml.c
new file mode 100644
index 00000000..7095c775
--- /dev/null
+++ b/support/ezxml/ezxml.c
@@ -0,0 +1,1015 @@
+/* ezxml.c
+ *
+ * Copyright 2004-2006 Aaron Voisine <aaron@voisine.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <sys/types.h>
+#ifndef EZXML_NOMMAP
+#include <sys/mman.h>
+#endif // EZXML_NOMMAP
+#include <sys/stat.h>
+#include "ezxml.h"
+
+#define EZXML_WS "\t\r\n " // whitespace
+#define EZXML_ERRL 128 // maximum error string length
+
+typedef struct ezxml_root *ezxml_root_t;
+struct ezxml_root { // additional data for the root tag
+ struct ezxml xml; // is a super-struct built on top of ezxml struct
+ ezxml_t cur; // current xml tree insertion point
+ char *m; // original xml string
+ size_t len; // length of allocated memory for mmap, -1 for malloc
+ char *u; // UTF-8 conversion of string if original was UTF-16
+ char *s; // start of work area
+ char *e; // end of work area
+ char **ent; // general entities (ampersand sequences)
+ char ***attr; // default attributes
+ char ***pi; // processing instructions
+ short standalone; // non-zero if <?xml standalone="yes"?>
+ char err[EZXML_ERRL]; // error string
+};
+
+char *EZXML_NIL[] = { NULL }; // empty, null terminated array of strings
+
+// returns the first child tag with the given name or NULL if not found
+ezxml_t ezxml_child(ezxml_t xml, const char *name)
+{
+ xml = (xml) ? xml->child : NULL;
+ while (xml && strcmp(name, xml->name)) xml = xml->sibling;
+ return xml;
+}
+
+// returns the Nth tag with the same name in the same subsection or NULL if not
+// found
+ezxml_t ezxml_idx(ezxml_t xml, int idx)
+{
+ for (; xml && idx; idx--) xml = xml->next;
+ return xml;
+}
+
+// returns the value of the requested tag attribute or NULL if not found
+const char *ezxml_attr(ezxml_t xml, const char *attr)
+{
+ int i = 0, j = 1;
+ ezxml_root_t root = (ezxml_root_t)xml;
+
+ if (! xml || ! xml->attr) return NULL;
+ while (xml->attr[i] && strcmp(attr, xml->attr[i])) i += 2;
+ if (xml->attr[i]) return xml->attr[i + 1]; // found attribute
+
+ while (root->xml.parent) root = (ezxml_root_t)root->xml.parent; // root tag
+ for (i = 0; root->attr[i] && strcmp(xml->name, root->attr[i][0]); i++);
+ if (! root->attr[i]) return NULL; // no matching default attributes
+ while (root->attr[i][j] && strcmp(attr, root->attr[i][j])) j += 3;
+ return (root->attr[i][j]) ? root->attr[i][j + 1] : NULL; // found default
+}
+
+// same as ezxml_get but takes an already initialized va_list
+ezxml_t ezxml_vget(ezxml_t xml, va_list ap)
+{
+ char *name = va_arg(ap, char *);
+ int idx = -1;
+
+ if (name && *name) {
+ idx = va_arg(ap, int);
+ xml = ezxml_child(xml, name);
+ }
+ return (idx < 0) ? xml : ezxml_vget(ezxml_idx(xml, idx), ap);
+}
+
+// Traverses the xml tree to retrieve a specific subtag. Takes a variable
+// length list of tag names and indexes. The argument list must be terminated
+// by either an index of -1 or an empty string tag name. Example:
+// title = ezxml_get(library, "shelf", 0, "book", 2, "title", -1);
+// This retrieves the title of the 3rd book on the 1st shelf of library.
+// Returns NULL if not found.
+ezxml_t ezxml_get(ezxml_t xml, ...)
+{
+ va_list ap;
+ ezxml_t r;
+
+ va_start(ap, xml);
+ r = ezxml_vget(xml, ap);
+ va_end(ap);
+ return r;
+}
+
+// returns a null terminated array of processing instructions for the given
+// target
+const char **ezxml_pi(ezxml_t xml, const char *target)
+{
+ ezxml_root_t root = (ezxml_root_t)xml;
+ int i = 0;
+
+ if (! root) return (const char **)EZXML_NIL;
+ while (root->xml.parent) root = (ezxml_root_t)root->xml.parent; // root tag
+ while (root->pi[i] && strcmp(target, root->pi[i][0])) i++; // find target
+ return (const char **)((root->pi[i]) ? root->pi[i] + 1 : EZXML_NIL);
+}
+
+// set an error string and return root
+ezxml_t ezxml_err(ezxml_root_t root, char *s, const char *err, ...)
+{
+ va_list ap;
+ int line = 1;
+ char *t, fmt[EZXML_ERRL];
+
+ for (t = root->s; t < s; t++) if (*t == '\n') line++;
+ snprintf(fmt, EZXML_ERRL, "[error near line %d]: %s", line, err);
+
+ va_start(ap, err);
+ vsnprintf(root->err, EZXML_ERRL, fmt, ap);
+ va_end(ap);
+
+ return &root->xml;
+}
+
+// Recursively decodes entity and character references and normalizes new lines
+// ent is a null terminated array of alternating entity names and values. set t
+// to '&' for general entity decoding, '%' for parameter entity decoding, 'c'
+// for cdata sections, ' ' for attribute normalization, or '*' for non-cdata
+// attribute normalization. Returns s, or if the decoded string is longer than
+// s, returns a malloced string that must be freed.
+char *ezxml_decode(char *s, char **ent, char t)
+{
+ char *e, *r = s, *m = s;
+ long b, c, d, l;
+
+ for (; *s; s++) { // normalize line endings
+ while (*s == '\r') {
+ *(s++) = '\n';
+ if (*s == '\n') memmove(s, (s + 1), strlen(s));
+ }
+ }
+
+ for (s = r; ; ) {
+ while (*s && *s != '&' && (*s != '%' || t != '%') && !isspace(*s)) s++;
+
+ if (! *s) break;
+ else if (t != 'c' && ! strncmp(s, "&#", 2)) { // character reference
+ if (s[2] == 'x') c = strtol(s + 3, &e, 16); // base 16
+ else c = strtol(s + 2, &e, 10); // base 10
+ if (! c || *e != ';') { s++; continue; } // not a character ref
+
+ if (c < 0x80) *(s++) = c; // US-ASCII subset
+ else { // multi-byte UTF-8 sequence
+ for (b = 0, d = c; d; d /= 2) b++; // number of bits in c
+ b = (b - 2) / 5; // number of bytes in payload
+ *(s++) = (0xFF << (7 - b)) | (c >> (6 * b)); // head
+ while (b) *(s++) = 0x80 | ((c >> (6 * --b)) & 0x3F); // payload
+ }
+
+ memmove(s, strchr(s, ';') + 1, strlen(strchr(s, ';')));
+ }
+ else if ((*s == '&' && (t == '&' || t == ' ' || t == '*')) ||
+ (*s == '%' && t == '%')) { // entity reference
+ for (b = 0; ent[b] && strncmp(s + 1, ent[b], strlen(ent[b]));
+ b += 2); // find entity in entity list
+
+ if (ent[b++]) { // found a match
+ if ((c = strlen(ent[b])) - 1 > (e = strchr(s, ';')) - s) {
+ l = (d = (s - r)) + c + strlen(e); // new length
+ r = (r == m) ? strcpy(malloc(l), r) : realloc(r, l);
+ e = strchr((s = r + d), ';'); // fix up pointers
+ }
+
+ memmove(s + c, e + 1, strlen(e)); // shift rest of string
+ strncpy(s, ent[b], c); // copy in replacement text
+ }
+ else s++; // not a known entity
+ }
+ else if ((t == ' ' || t == '*') && isspace(*s)) *(s++) = ' ';
+ else s++; // no decoding needed
+ }
+
+ if (t == '*') { // normalize spaces for non-cdata attributes
+ for (s = r; *s; s++) {
+ if ((l = strspn(s, " "))) memmove(s, s + l, strlen(s + l) + 1);
+ while (*s && *s != ' ') s++;
+ }
+ if (--s >= r && *s == ' ') *s = '\0'; // trim any trailing space
+ }
+ return r;
+}
+
+// called when parser finds start of new tag
+void ezxml_open_tag(ezxml_root_t root, char *name, char **attr)
+{
+ ezxml_t xml = root->cur;
+
+ if (xml->name) xml = ezxml_add_child(xml, name, strlen(xml->txt));
+ else xml->name = name; // first open tag
+
+ xml->attr = attr;
+ root->cur = xml; // update tag insertion point
+}
+
+// called when parser finds character content between open and closing tag
+void ezxml_char_content(ezxml_root_t root, char *s, size_t len, char t)
+{
+ ezxml_t xml = root->cur;
+ char *m = s;
+ size_t l;
+
+ if (! xml || ! xml->name || ! len) return; // sanity check
+
+ s[len] = '\0'; // null terminate text (calling functions anticipate this)
+ len = strlen(s = ezxml_decode(s, root->ent, t)) + 1;
+
+ if (! *(xml->txt)) xml->txt = s; // initial character content
+ else { // allocate our own memory and make a copy
+ xml->txt = (xml->flags & EZXML_TXTM) // allocate some space
+ ? realloc(xml->txt, (l = strlen(xml->txt)) + len)
+ : strcpy(malloc((l = strlen(xml->txt)) + len), xml->txt);
+ strcpy(xml->txt + l, s); // add new char content
+ if (s != m) free(s); // free s if it was malloced by ezxml_decode()
+ }
+
+ if (xml->txt != m) ezxml_set_flag(xml, EZXML_TXTM);
+}
+
+// called when parser finds closing tag
+ezxml_t ezxml_close_tag(ezxml_root_t root, char *name, char *s)
+{
+ if (! root->cur || ! root->cur->name || strcmp(name, root->cur->name))
+ return ezxml_err(root, s, "unexpected closing tag </%s>", name);
+
+ root->cur = root->cur->parent;
+ return NULL;
+}
+
+// checks for circular entity references, returns non-zero if no circular
+// references are found, zero otherwise
+int ezxml_ent_ok(char *name, char *s, char **ent)
+{
+ int i;
+
+ for (; ; s++) {
+ while (*s && *s != '&') s++; // find next entity reference
+ if (! *s) return 1;
+ if (! strncmp(s + 1, name, strlen(name))) return 0; // circular ref.
+ for (i = 0; ent[i] && strncmp(ent[i], s + 1, strlen(ent[i])); i += 2);
+ if (ent[i] && ! ezxml_ent_ok(name, ent[i + 1], ent)) return 0;
+ }
+}
+
+// called when the parser finds a processing instruction
+void ezxml_proc_inst(ezxml_root_t root, char *s, size_t len)
+{
+ int i = 0, j = 1;
+ char *target = s;
+
+ s[len] = '\0'; // null terminate instruction
+ if (*(s += strcspn(s, EZXML_WS))) {
+ *s = '\0'; // null terminate target
+ s += strspn(s + 1, EZXML_WS) + 1; // skip whitespace after target
+ }
+
+ if (! strcmp(target, "xml")) { // <?xml ... ?>
+ if ((s = strstr(s, "standalone")) && ! strncmp(s + strspn(s + 10,
+ EZXML_WS "='\"") + 10, "yes", 3)) root->standalone = 1;
+ return;
+ }
+
+ if (! root->pi[0]) *(root->pi = malloc(sizeof(char **))) = NULL; //first pi
+
+ while (root->pi[i] && strcmp(target, root->pi[i][0])) i++; // find target
+ if (! root->pi[i]) { // new target
+ root->pi = realloc(root->pi, sizeof(char **) * (i + 2));
+ root->pi[i] = malloc(sizeof(char *) * 3);
+ root->pi[i][0] = target;
+ root->pi[i][1] = (char *)(root->pi[i + 1] = NULL); // terminate pi list
+ root->pi[i][2] = strdup(""); // empty document position list
+ }
+
+ while (root->pi[i][j]) j++; // find end of instruction list for this target
+ root->pi[i] = realloc(root->pi[i], sizeof(char *) * (j + 3));
+ root->pi[i][j + 2] = realloc(root->pi[i][j + 1], j + 1);
+ strcpy(root->pi[i][j + 2] + j - 1, (root->xml.name) ? ">" : "<");
+ root->pi[i][j + 1] = NULL; // null terminate pi list for this target
+ root->pi[i][j] = s; // set instruction
+}
+
+// called when the parser finds an internal doctype subset
+short ezxml_internal_dtd(ezxml_root_t root, char *s, size_t len)
+{
+ char q, *c, *t, *n = NULL, *v, **ent, **pe;
+ int i, j;
+
+ pe = memcpy(malloc(sizeof(EZXML_NIL)), EZXML_NIL, sizeof(EZXML_NIL));
+
+ for (s[len] = '\0'; s; ) {
+ while (*s && *s != '<' && *s != '%') s++; // find next declaration
+
+ if (! *s) break;
+ else if (! strncmp(s, "<!ENTITY", 8)) { // parse entity definitions
+ c = s += strspn(s + 8, EZXML_WS) + 8; // skip white space separator
+ n = s + strspn(s, EZXML_WS "%"); // find name
+ *(s = n + strcspn(n, EZXML_WS)) = ';'; // append ; to name
+
+ v = s + strspn(s + 1, EZXML_WS) + 1; // find value
+ if ((q = *(v++)) != '"' && q != '\'') { // skip externals
+ s = strchr(s, '>');
+ continue;
+ }
+
+ for (i = 0, ent = (*c == '%') ? pe : root->ent; ent[i]; i++);
+ ent = realloc(ent, (i + 3) * sizeof(char *)); // space for next ent
+ if (*c == '%') pe = ent;
+ else root->ent = ent;
+
+ *(++s) = '\0'; // null terminate name
+ if ((s = strchr(v, q))) *(s++) = '\0'; // null terminate value
+ ent[i + 1] = ezxml_decode(v, pe, '%'); // set value
+ ent[i + 2] = NULL; // null terminate entity list
+ if (! ezxml_ent_ok(n, ent[i + 1], ent)) { // circular reference
+ if (ent[i + 1] != v) free(ent[i + 1]);
+ ezxml_err(root, v, "circular entity declaration &%s", n);
+ break;
+ }
+ else ent[i] = n; // set entity name
+ }
+ else if (! strncmp(s, "<!ATTLIST", 9)) { // parse default attributes
+ t = s + strspn(s + 9, EZXML_WS) + 9; // skip whitespace separator
+ if (! *t) { ezxml_err(root, t, "unclosed <!ATTLIST"); break; }
+ if (*(s = t + strcspn(t, EZXML_WS ">")) == '>') continue;
+ else *s = '\0'; // null terminate tag name
+ for (i = 0; root->attr[i] && strcmp(n, root->attr[i][0]); i++);
+
+ while (*(n = ++s + strspn(s, EZXML_WS)) && *n != '>') {
+ if (*(s = n + strcspn(n, EZXML_WS))) *s = '\0'; // attr name
+ else { ezxml_err(root, t, "malformed <!ATTLIST"); break; }
+
+ s += strspn(s + 1, EZXML_WS) + 1; // find next token
+ c = (strncmp(s, "CDATA", 5)) ? "*" : " "; // is it cdata?
+ if (! strncmp(s, "NOTATION", 8))
+ s += strspn(s + 8, EZXML_WS) + 8;
+ s = (*s == '(') ? strchr(s, ')') : s + strcspn(s, EZXML_WS);
+ if (! s) { ezxml_err(root, t, "malformed <!ATTLIST"); break; }
+
+ s += strspn(s, EZXML_WS ")"); // skip white space separator
+ if (! strncmp(s, "#FIXED", 6))
+ s += strspn(s + 6, EZXML_WS) + 6;
+ if (*s == '#') { // no default value
+ s += strcspn(s, EZXML_WS ">") - 1;
+ if (*c == ' ') continue; // cdata is default, nothing to do
+ v = NULL;
+ }
+ else if ((*s == '"' || *s == '\'') && // default value
+ (s = strchr(v = s + 1, *s))) *s = '\0';
+ else { ezxml_err(root, t, "malformed <!ATTLIST"); break; }
+
+ if (! root->attr[i]) { // new tag name
+ root->attr = (! i) ? malloc(2 * sizeof(char **))
+ : realloc(root->attr,
+ (i + 2) * sizeof(char **));
+ root->attr[i] = malloc(2 * sizeof(char *));
+ root->attr[i][0] = t; // set tag name
+ root->attr[i][1] = (char *)(root->attr[i + 1] = NULL);
+ }
+
+ for (j = 1; root->attr[i][j]; j += 3); // find end of list
+ root->attr[i] = realloc(root->attr[i],
+ (j + 4) * sizeof(char *));
+
+ root->attr[i][j + 3] = NULL; // null terminate list
+ root->attr[i][j + 2] = c; // is it cdata?
+ root->attr[i][j + 1] = (v) ? ezxml_decode(v, root->ent, *c)
+ : NULL;
+ root->attr[i][j] = n; // attribute name
+ }
+ }
+ else if (! strncmp(s, "<!--", 4)) s = strstr(s + 4, "-->"); // comments
+ else if (! strncmp(s, "<?", 2)) { // processing instructions
+ if ((s = strstr(c = s + 2, "?>")))
+ ezxml_proc_inst(root, c, s++ - c);
+ }
+ else if (*s == '<') s = strchr(s, '>'); // skip other declarations
+ else if (*(s++) == '%' && ! root->standalone) break;
+ }
+
+ free(pe);
+ return ! *root->err;
+}
+
+// Converts a UTF-16 string to UTF-8. Returns a new string that must be freed
+// or NULL if no conversion was needed.
+char *ezxml_str2utf8(char **s, size_t *len)
+{
+ char *u;
+ size_t l = 0, sl, max = *len;
+ long c, d;
+ int b, be = (**s == '\xFE') ? 1 : (**s == '\xFF') ? 0 : -1;
+
+ if (be == -1) return NULL; // not UTF-16
+
+ u = malloc(max);
+ for (sl = 2; sl < *len - 1; sl += 2) {
+ c = (be) ? (((*s)[sl] & 0xFF) << 8) | ((*s)[sl + 1] & 0xFF) //UTF-16BE
+ : (((*s)[sl + 1] & 0xFF) << 8) | ((*s)[sl] & 0xFF); //UTF-16LE
+ if (c >= 0xD800 && c <= 0xDFFF && (sl += 2) < *len - 1) { // high-half
+ d = (be) ? (((*s)[sl] & 0xFF) << 8) | ((*s)[sl + 1] & 0xFF)
+ : (((*s)[sl + 1] & 0xFF) << 8) | ((*s)[sl] & 0xFF);
+ c = (((c & 0x3FF) << 10) | (d & 0x3FF)) + 0x10000;
+ }
+
+ while (l + 6 > max) u = realloc(u, max += EZXML_BUFSIZE);
+ if (c < 0x80) u[l++] = c; // US-ASCII subset
+ else { // multi-byte UTF-8 sequence
+ for (b = 0, d = c; d; d /= 2) b++; // bits in c
+ b = (b - 2) / 5; // bytes in payload
+ u[l++] = (0xFF << (7 - b)) | (c >> (6 * b)); // head
+ while (b) u[l++] = 0x80 | ((c >> (6 * --b)) & 0x3F); // payload
+ }
+ }
+ return *s = realloc(u, *len = l);
+}
+
+// frees a tag attribute list
+void ezxml_free_attr(char **attr) {
+ int i = 0;
+ char *m;
+
+ if (! attr || attr == EZXML_NIL) return; // nothing to free
+ while (attr[i]) i += 2; // find end of attribute list
+ m = attr[i + 1]; // list of which names and values are malloced
+ for (i = 0; m[i]; i++) {
+ if (m[i] & EZXML_NAMEM) free(attr[i * 2]);
+ if (m[i] & EZXML_TXTM) free(attr[(i * 2) + 1]);
+ }
+ free(m);
+ free(attr);
+}
+
+// parse the given xml string and return an ezxml structure
+ezxml_t ezxml_parse_str(char *s, size_t len)
+{
+ ezxml_root_t root = (ezxml_root_t)ezxml_new(NULL);
+ char q, e, *d, **attr, **a = NULL; // initialize a to avoid compile warning
+ int l, i, j;
+
+ root->m = s;
+ if (! len) return ezxml_err(root, NULL, "root tag missing");
+ root->u = ezxml_str2utf8(&s, &len); // convert utf-16 to utf-8
+ root->e = (root->s = s) + len; // record start and end of work area
+
+ e = s[len - 1]; // save end char
+ s[len - 1] = '\0'; // turn end char into null terminator
+
+ while (*s && *s != '<') s++; // find first tag
+ if (! *s) return ezxml_err(root, s, "root tag missing");
+
+ for (; ; ) {
+ attr = (char **)EZXML_NIL;
+ d = ++s;
+
+ if (isalpha(*s) || *s == '_' || *s == ':' || *s < '\0') { // new tag
+ if (! root->cur)
+ return ezxml_err(root, d, "markup outside of root element");
+
+ s += strcspn(s, EZXML_WS "/>");
+ while (isspace(*s)) *(s++) = '\0'; // null terminate tag name
+
+ if (*s && *s != '/' && *s != '>') // find tag in default attr list
+ for (i = 0; (a = root->attr[i]) && strcmp(a[0], d); i++);
+
+ for (l = 0; *s && *s != '/' && *s != '>'; l += 2) { // new attrib
+ attr = (l) ? realloc(attr, (l + 4) * sizeof(char *))
+ : malloc(4 * sizeof(char *)); // allocate space
+ attr[l + 3] = (l) ? realloc(attr[l + 1], (l / 2) + 2)
+ : malloc(2); // mem for list of maloced vals
+ strcpy(attr[l + 3] + (l / 2), " "); // value is not malloced
+ attr[l + 2] = NULL; // null terminate list
+ attr[l + 1] = ""; // temporary attribute value
+ attr[l] = s; // set attribute name
+
+ s += strcspn(s, EZXML_WS "=/>");
+ if (*s == '=' || isspace(*s)) {
+ *(s++) = '\0'; // null terminate tag attribute name
+ q = *(s += strspn(s, EZXML_WS "="));
+ if (q == '"' || q == '\'') { // attribute value
+ attr[l + 1] = ++s;
+ while (*s && *s != q) s++;
+ if (*s) *(s++) = '\0'; // null terminate attribute val
+ else {
+ ezxml_free_attr(attr);
+ return ezxml_err(root, d, "missing %c", q);
+ }
+
+ for (j = 1; a && a[j] && strcmp(a[j], attr[l]); j +=3);
+ attr[l + 1] = ezxml_decode(attr[l + 1], root->ent, (a
+ && a[j]) ? *a[j + 2] : ' ');
+ if (attr[l + 1] < d || attr[l + 1] > s)
+ attr[l + 3][l / 2] = EZXML_TXTM; // value malloced
+ }
+ }
+ while (isspace(*s)) s++;
+ }
+
+ if (*s == '/') { // self closing tag
+ *(s++) = '\0';
+ if ((*s && *s != '>') || (! *s && e != '>')) {
+ if (l) ezxml_free_attr(attr);
+ return ezxml_err(root, d, "missing >");
+ }
+ ezxml_open_tag(root, d, attr);
+ ezxml_close_tag(root, d, s);
+ }
+ else if ((q = *s) == '>' || (! *s && e == '>')) { // open tag
+ *s = '\0'; // temporarily null terminate tag name
+ ezxml_open_tag(root, d, attr);
+ *s = q;
+ }
+ else {
+ if (l) ezxml_free_attr(attr);
+ return ezxml_err(root, d, "missing >");
+ }
+ }
+ else if (*s == '/') { // close tag
+ s += strcspn(d = s + 1, EZXML_WS ">") + 1;
+ if (! (q = *s) && e != '>') return ezxml_err(root, d, "missing >");
+ *s = '\0'; // temporarily null terminate tag name
+ if (ezxml_close_tag(root, d, s)) return &root->xml;
+ if (isspace(*s = q)) s += strspn(s, EZXML_WS);
+ }
+ else if (! strncmp(s, "!--", 3)) { // xml comment
+ if (! (s = strstr(s + 3, "--")) || (*(s += 2) != '>' && *s) ||
+ (! *s && e != '>')) return ezxml_err(root, d, "unclosed <!--");
+ }
+ else if (! strncmp(s, "![CDATA[", 8)) { // cdata
+ if ((s = strstr(s, "]]>")))
+ ezxml_char_content(root, d + 8, (s += 2) - d - 10, 'c');
+ else return ezxml_err(root, d, "unclosed <![CDATA[");
+ }
+ else if (! strncmp(s, "!DOCTYPE", 8)) { // dtd
+ for (l = 0; *s && ((! l && *s != '>') || (l && (*s != ']' ||
+ *(s + strspn(s + 1, EZXML_WS) + 1) != '>')));
+ l = (*s == '[') ? 1 : l) s += strcspn(s + 1, "[]>") + 1;
+ if (! *s && e != '>')
+ return ezxml_err(root, d, "unclosed <!DOCTYPE");
+ d = (l) ? strchr(d, '[') + 1 : d;
+ if (l && ! ezxml_internal_dtd(root, d, s++ - d)) return &root->xml;
+ }
+ else if (*s == '?') { // <?...?> processing instructions
+ do { s = strchr(s, '?'); } while (s && *(++s) && *s != '>');
+ if (! s || (! *s && e != '>'))
+ return ezxml_err(root, d, "unclosed <?");
+ else ezxml_proc_inst(root, d + 1, s - d - 2);
+ }
+ else return ezxml_err(root, d, "unexpected <");
+
+ if (! s || ! *s) break;
+ *s = '\0';
+ d = ++s;
+ if (*s && *s != '<') { // tag character content
+ while (*s && *s != '<') s++;
+ if (*s) ezxml_char_content(root, d, s - d, '&');
+ else break;
+ }
+ else if (! *s) break;
+ }
+
+ if (! root->cur) return &root->xml;
+ else if (! root->cur->name) return ezxml_err(root, d, "root tag missing");
+ else return ezxml_err(root, d, "unclosed tag <%s>", root->cur->name);
+}
+
+// Wrapper for ezxml_parse_str() that accepts a file stream. Reads the entire
+// stream into memory and then parses it. For xml files, use ezxml_parse_file()
+// or ezxml_parse_fd()
+ezxml_t ezxml_parse_fp(FILE *fp)
+{
+ ezxml_root_t root;
+ size_t l, len = 0;
+ char *s;
+
+ if (! (s = malloc(EZXML_BUFSIZE))) return NULL;
+ do {
+ len += (l = fread((s + len), 1, EZXML_BUFSIZE, fp));
+ if (l == EZXML_BUFSIZE) s = realloc(s, len + EZXML_BUFSIZE);
+ } while (s && l == EZXML_BUFSIZE);
+
+ if (! s) return NULL;
+ root = (ezxml_root_t)ezxml_parse_str(s, len);
+ root->len = -1; // so we know to free s in ezxml_free()
+ return &root->xml;
+}
+
+// A wrapper for ezxml_parse_str() that accepts a file descriptor. First
+// attempts to mem map the file. Failing that, reads the file into memory.
+// Returns NULL on failure.
+ezxml_t ezxml_parse_fd(int fd)
+{
+ ezxml_root_t root;
+ struct stat st;
+ size_t l;
+ void *m;
+
+ if (fd == -1) return NULL;
+ fstat(fd, &st);
+
+#ifndef EZXML_NOMMAP
+ l = (st.st_size + sysconf(_SC_PAGESIZE) - 1) & ~(sysconf(_SC_PAGESIZE) -1);
+ if ((m = mmap(NULL, l, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0)) !=
+ MAP_FAILED) {
+ madvise(m, l, MADV_SEQUENTIAL); // optimize for sequential access
+ root = (ezxml_root_t)ezxml_parse_str(m, st.st_size);
+ madvise(m, root->len = l, MADV_NORMAL); // put it back to normal
+ }
+ else { // mmap failed, read file into memory
+#endif // EZXML_NOMMAP
+ l = read(fd, m = malloc(st.st_size), st.st_size);
+ root = (ezxml_root_t)ezxml_parse_str(m, l);
+ root->len = -1; // so we know to free s in ezxml_free()
+#ifndef EZXML_NOMMAP
+ }
+#endif // EZXML_NOMMAP
+ return &root->xml;
+}
+
+// a wrapper for ezxml_parse_fd that accepts a file name
+ezxml_t ezxml_parse_file(const char *file)
+{
+ int fd = open(file, O_RDONLY, 0);
+ ezxml_t xml = ezxml_parse_fd(fd);
+
+ if (fd >= 0) close(fd);
+ return xml;
+}
+
+// Encodes ampersand sequences appending the results to *dst, reallocating *dst
+// if length excedes max. a is non-zero for attribute encoding. Returns *dst
+char *ezxml_ampencode(const char *s, size_t len, char **dst, size_t *dlen,
+ size_t *max, short a)
+{
+ const char *e;
+
+ for (e = s + len; s != e; s++) {
+ while (*dlen + 10 > *max) *dst = realloc(*dst, *max += EZXML_BUFSIZE);
+
+ switch (*s) {
+ case '\0': return *dst;
+ case '&': *dlen += sprintf(*dst + *dlen, "&amp;"); break;
+ case '<': *dlen += sprintf(*dst + *dlen, "&lt;"); break;
+ case '>': *dlen += sprintf(*dst + *dlen, "&gt;"); break;
+ case '"': *dlen += sprintf(*dst + *dlen, (a) ? "&quot;" : "\""); break;
+ case '\n': *dlen += sprintf(*dst + *dlen, (a) ? "&#xA;" : "\n"); break;
+ case '\t': *dlen += sprintf(*dst + *dlen, (a) ? "&#x9;" : "\t"); break;
+ case '\r': *dlen += sprintf(*dst + *dlen, "&#xD;"); break;
+ default: (*dst)[(*dlen)++] = *s;
+ }
+ }
+ return *dst;
+}
+
+// Recursively converts each tag to xml appending it to *s. Reallocates *s if
+// its length excedes max. start is the location of the previous tag in the
+// parent tag's character content. Returns *s.
+char *ezxml_toxml_r(ezxml_t xml, char **s, size_t *len, size_t *max,
+ size_t start, char ***attr)
+{
+ int i, j;
+ char *txt = (xml->parent) ? xml->parent->txt : "";
+ size_t off = 0;
+
+ // parent character content up to this tag
+ *s = ezxml_ampencode(txt + start, xml->off - start, s, len, max, 0);
+
+ while (*len + strlen(xml->name) + 4 > *max) // reallocate s
+ *s = realloc(*s, *max += EZXML_BUFSIZE);
+
+ *len += sprintf(*s + *len, "<%s", xml->name); // open tag
+ for (i = 0; xml->attr[i]; i += 2) { // tag attributes
+ if (ezxml_attr(xml, xml->attr[i]) != xml->attr[i + 1]) continue;
+ while (*len + strlen(xml->attr[i]) + 7 > *max) // reallocate s
+ *s = realloc(*s, *max += EZXML_BUFSIZE);
+
+ *len += sprintf(*s + *len, " %s=\"", xml->attr[i]);
+ ezxml_ampencode(xml->attr[i + 1], -1, s, len, max, 1);
+ *len += sprintf(*s + *len, "\"");
+ }
+
+ for (i = 0; attr[i] && strcmp(attr[i][0], xml->name); i++);
+ for (j = 1; attr[i] && attr[i][j]; j += 3) { // default attributes
+ if (! attr[i][j + 1] || ezxml_attr(xml, attr[i][j]) != attr[i][j + 1])
+ continue; // skip duplicates and non-values
+ while (*len + strlen(attr[i][j]) + 7 > *max) // reallocate s
+ *s = realloc(*s, *max += EZXML_BUFSIZE);
+
+ *len += sprintf(*s + *len, " %s=\"", attr[i][j]);
+ ezxml_ampencode(attr[i][j + 1], -1, s, len, max, 1);
+ *len += sprintf(*s + *len, "\"");
+ }
+ *len += sprintf(*s + *len, ">");
+
+ *s = (xml->child) ? ezxml_toxml_r(xml->child, s, len, max, 0, attr) //child
+ : ezxml_ampencode(xml->txt, -1, s, len, max, 0); //data
+
+ while (*len + strlen(xml->name) + 4 > *max) // reallocate s
+ *s = realloc(*s, *max += EZXML_BUFSIZE);
+
+ *len += sprintf(*s + *len, "</%s>", xml->name); // close tag
+
+ while (txt[off] && off < xml->off) off++; // make sure off is within bounds
+ return (xml->ordered) ? ezxml_toxml_r(xml->ordered, s, len, max, off, attr)
+ : ezxml_ampencode(txt + off, -1, s, len, max, 0);
+}
+
+// Converts an ezxml structure back to xml. Returns a string of xml data that
+// must be freed.
+char *ezxml_toxml(ezxml_t xml)
+{
+ ezxml_t p = (xml) ? xml->parent : NULL, o = (xml) ? xml->ordered : NULL;
+ ezxml_root_t root = (ezxml_root_t)xml;
+ size_t len = 0, max = EZXML_BUFSIZE;
+ char *s = strcpy(malloc(max), ""), *t, *n;
+ int i, j, k;
+
+ if (! xml || ! xml->name) return realloc(s, len + 1);
+ while (root->xml.parent) root = (ezxml_root_t)root->xml.parent; // root tag
+
+ for (i = 0; ! p && root->pi[i]; i++) { // pre-root processing instructions
+ for (k = 2; root->pi[i][k - 1]; k++);
+ for (j = 1; (n = root->pi[i][j]); j++) {
+ if (root->pi[i][k][j - 1] == '>') continue; // not pre-root
+ while (len + strlen(t = root->pi[i][0]) + strlen(n) + 7 > max)
+ s = realloc(s, max += EZXML_BUFSIZE);
+ len += sprintf(s + len, "<?%s%s%s?>\n", t, *n ? " " : "", n);
+ }
+ }
+
+ xml->parent = xml->ordered = NULL;
+ s = ezxml_toxml_r(xml, &s, &len, &max, 0, root->attr);
+ xml->parent = p;
+ xml->ordered = o;
+
+ for (i = 0; ! p && root->pi[i]; i++) { // post-root processing instructions
+ for (k = 2; root->pi[i][k - 1]; k++);
+ for (j = 1; (n = root->pi[i][j]); j++) {
+ if (root->pi[i][k][j - 1] == '<') continue; // not post-root
+ while (len + strlen(t = root->pi[i][0]) + strlen(n) + 7 > max)
+ s = realloc(s, max += EZXML_BUFSIZE);
+ len += sprintf(s + len, "\n<?%s%s%s?>", t, *n ? " " : "", n);
+ }
+ }
+ return realloc(s, len + 1);
+}
+
+// free the memory allocated for the ezxml structure
+void ezxml_free(ezxml_t xml)
+{
+ ezxml_root_t root = (ezxml_root_t)xml;
+ int i, j;
+ char **a, *s;
+
+ if (! xml) return;
+ ezxml_free(xml->child);
+ ezxml_free(xml->ordered);
+
+ if (! xml->parent) { // free root tag allocations
+ for (i = 10; root->ent[i]; i += 2) // 0 - 9 are default entites (<>&"')
+ if ((s = root->ent[i + 1]) < root->s || s > root->e) free(s);
+ free(root->ent); // free list of general entities
+
+ for (i = 0; (a = root->attr[i]); i++) {
+ for (j = 1; a[j++]; j += 2) // free malloced attribute values
+ if (a[j] && (a[j] < root->s || a[j] > root->e)) free(a[j]);
+ free(a);
+ }
+ if (root->attr[0]) free(root->attr); // free default attribute list
+
+ for (i = 0; root->pi[i]; i++) {
+ for (j = 1; root->pi[i][j]; j++);
+ free(root->pi[i][j + 1]);
+ free(root->pi[i]);
+ }
+ if (root->pi[0]) free(root->pi); // free processing instructions
+
+ if (root->len == -1) free(root->m); // malloced xml data
+#ifndef EZXML_NOMMAP
+ else if (root->len) munmap(root->m, root->len); // mem mapped xml data
+#endif // EZXML_NOMMAP
+ if (root->u) free(root->u); // utf8 conversion
+ }
+
+ ezxml_free_attr(xml->attr); // tag attributes
+ if ((xml->flags & EZXML_TXTM)) free(xml->txt); // character content
+ if ((xml->flags & EZXML_NAMEM)) free(xml->name); // tag name
+ free(xml);
+}
+
+// return parser error message or empty string if none
+const char *ezxml_error(ezxml_t xml)
+{
+ while (xml && xml->parent) xml = xml->parent; // find root tag
+ return (xml) ? ((ezxml_root_t)xml)->err : "";
+}
+
+// returns a new empty ezxml structure with the given root tag name
+ezxml_t ezxml_new(const char *name)
+{
+ static char *ent[] = { "lt;", "&#60;", "gt;", "&#62;", "quot;", "&#34;",
+ "apos;", "&#39;", "amp;", "&#38;", NULL };
+ ezxml_root_t root = (ezxml_root_t)memset(malloc(sizeof(struct ezxml_root)),
+ '\0', sizeof(struct ezxml_root));
+ root->xml.name = (char *)name;
+ root->cur = &root->xml;
+ strcpy(root->err, root->xml.txt = "");
+ root->ent = memcpy(malloc(sizeof(ent)), ent, sizeof(ent));
+ root->attr = root->pi = (char ***)(root->xml.attr = EZXML_NIL);
+ return &root->xml;
+}
+
+// inserts an existing tag into an ezxml structure
+ezxml_t ezxml_insert(ezxml_t xml, ezxml_t dest, size_t off)
+{
+ ezxml_t cur, prev, head;
+
+ xml->next = xml->sibling = xml->ordered = NULL;
+ xml->off = off;
+ xml->parent = dest;
+
+ if ((head = dest->child)) { // already have sub tags
+ if (head->off <= off) { // not first subtag
+ for (cur = head; cur->ordered && cur->ordered->off <= off;
+ cur = cur->ordered);
+ xml->ordered = cur->ordered;
+ cur->ordered = xml;
+ }
+ else { // first subtag
+ xml->ordered = head;
+ dest->child = xml;
+ }
+
+ for (cur = head, prev = NULL; cur && strcmp(cur->name, xml->name);
+ prev = cur, cur = cur->sibling); // find tag type
+ if (cur && cur->off <= off) { // not first of type
+ while (cur->next && cur->next->off <= off) cur = cur->next;
+ xml->next = cur->next;
+ cur->next = xml;
+ }
+ else { // first tag of this type
+ if (prev && cur) prev->sibling = cur->sibling; // remove old first
+ xml->next = cur; // old first tag is now next
+ for (cur = head, prev = NULL; cur && cur->off <= off;
+ prev = cur, cur = cur->sibling); // new sibling insert point
+ xml->sibling = cur;
+ if (prev) prev->sibling = xml;
+ }
+ }
+ else dest->child = xml; // only sub tag
+
+ return xml;
+}
+
+// Adds a child tag. off is the offset of the child tag relative to the start
+// of the parent tag's character content. Returns the child tag.
+ezxml_t ezxml_add_child(ezxml_t xml, const char *name, size_t off)
+{
+ ezxml_t child;
+
+ if (! xml) return NULL;
+ child = (ezxml_t)memset(malloc(sizeof(struct ezxml)), '\0',
+ sizeof(struct ezxml));
+ child->name = (char *)name;
+ child->attr = EZXML_NIL;
+ child->txt = "";
+
+ return ezxml_insert(child, xml, off);
+}
+
+// sets the character content for the given tag and returns the tag
+ezxml_t ezxml_set_txt(ezxml_t xml, const char *txt)
+{
+ if (! xml) return NULL;
+ if (xml->flags & EZXML_TXTM) free(xml->txt); // existing txt was malloced
+ xml->flags &= ~EZXML_TXTM;
+ xml->txt = (char *)txt;
+ return xml;
+}
+
+// Sets the given tag attribute or adds a new attribute if not found. A value
+// of NULL will remove the specified attribute. Returns the tag given.
+ezxml_t ezxml_set_attr(ezxml_t xml, const char *name, const char *value)
+{
+ int l = 0, c;
+
+ if (! xml) return NULL;
+ while (xml->attr[l] && strcmp(xml->attr[l], name)) l += 2;
+ if (! xml->attr[l]) { // not found, add as new attribute
+ if (! value) return xml; // nothing to do
+ if (xml->attr == EZXML_NIL) { // first attribute
+ xml->attr = malloc(4 * sizeof(char *));
+ xml->attr[1] = strdup(""); // empty list of malloced names/vals
+ }
+ else xml->attr = realloc(xml->attr, (l + 4) * sizeof(char *));
+
+ xml->attr[l] = (char *)name; // set attribute name
+ xml->attr[l + 2] = NULL; // null terminate attribute list
+ xml->attr[l + 3] = realloc(xml->attr[l + 1],
+ (c = strlen(xml->attr[l + 1])) + 2);
+ strcpy(xml->attr[l + 3] + c, " "); // set name/value as not malloced
+ if (xml->flags & EZXML_DUP) xml->attr[l + 3][c] = EZXML_NAMEM;
+ }
+ else if (xml->flags & EZXML_DUP) free((char *)name); // name was strduped
+
+ for (c = l; xml->attr[c]; c += 2); // find end of attribute list
+ if (xml->attr[c + 1][l / 2] & EZXML_TXTM) free(xml->attr[l + 1]); //old val
+ if (xml->flags & EZXML_DUP) xml->attr[c + 1][l / 2] |= EZXML_TXTM;
+ else xml->attr[c + 1][l / 2] &= ~EZXML_TXTM;
+
+ if (value) xml->attr[l + 1] = (char *)value; // set attribute value
+ else { // remove attribute
+ if (xml->attr[c + 1][l / 2] & EZXML_NAMEM) free(xml->attr[l]);
+ memmove(xml->attr + l, xml->attr + l + 2, (c - l + 2) * sizeof(char*));
+ xml->attr = realloc(xml->attr, (c + 2) * sizeof(char *));
+ memmove(xml->attr[c + 1] + (l / 2), xml->attr[c + 1] + (l / 2) + 1,
+ (c / 2) - (l / 2)); // fix list of which name/vals are malloced
+ }
+ xml->flags &= ~EZXML_DUP; // clear strdup() flag
+ return xml;
+}
+
+// sets a flag for the given tag and returns the tag
+ezxml_t ezxml_set_flag(ezxml_t xml, short flag)
+{
+ if (xml) xml->flags |= flag;
+ return xml;
+}
+
+// removes a tag along with its subtags without freeing its memory
+ezxml_t ezxml_cut(ezxml_t xml)
+{
+ ezxml_t cur;
+
+ if (! xml) return NULL; // nothing to do
+ if (xml->next) xml->next->sibling = xml->sibling; // patch sibling list
+
+ if (xml->parent) { // not root tag
+ cur = xml->parent->child; // find head of subtag list
+ if (cur == xml) xml->parent->child = xml->ordered; // first subtag
+ else { // not first subtag
+ while (cur->ordered != xml) cur = cur->ordered;
+ cur->ordered = cur->ordered->ordered; // patch ordered list
+
+ cur = xml->parent->child; // go back to head of subtag list
+ if (strcmp(cur->name, xml->name)) { // not in first sibling list
+ while (strcmp(cur->sibling->name, xml->name))
+ cur = cur->sibling;
+ if (cur->sibling == xml) { // first of a sibling list
+ cur->sibling = (xml->next) ? xml->next
+ : cur->sibling->sibling;
+ }
+ else cur = cur->sibling; // not first of a sibling list
+ }
+
+ while (cur->next && cur->next != xml) cur = cur->next;
+ if (cur->next) cur->next = cur->next->next; // patch next list
+ }
+ }
+ xml->ordered = xml->sibling = xml->next = NULL;
+ return xml;
+}
+
+#ifdef EZXML_TEST // test harness
+int main(int argc, char **argv)
+{
+ ezxml_t xml;
+ char *s;
+ int i;
+
+ if (argc != 2) return fprintf(stderr, "usage: %s xmlfile\n", argv[0]);
+
+ xml = ezxml_parse_file(argv[1]);
+ printf("%s\n", (s = ezxml_toxml(xml)));
+ free(s);
+ i = fprintf(stderr, "%s", ezxml_error(xml));
+ ezxml_free(xml);
+ return (i) ? 1 : 0;
+}
+#endif // EZXML_TEST
diff --git a/support/ezxml/ezxml.h b/support/ezxml/ezxml.h
new file mode 100644
index 00000000..3e020788
--- /dev/null
+++ b/support/ezxml/ezxml.h
@@ -0,0 +1,167 @@
+/* ezxml.h
+ *
+ * Copyright 2004-2006 Aaron Voisine <aaron@voisine.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _EZXML_H
+#define _EZXML_H
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <fcntl.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define EZXML_BUFSIZE 1024 // size of internal memory buffers
+#define EZXML_NAMEM 0x80 // name is malloced
+#define EZXML_TXTM 0x40 // txt is malloced
+#define EZXML_DUP 0x20 // attribute name and value are strduped
+
+typedef struct ezxml *ezxml_t;
+struct ezxml {
+ char *name; // tag name
+ char **attr; // tag attributes { name, value, name, value, ... NULL }
+ char *txt; // tag character content, empty string if none
+ size_t off; // tag offset from start of parent tag character content
+ ezxml_t next; // next tag with same name in this section at this depth
+ ezxml_t sibling; // next tag with different name in same section and depth
+ ezxml_t ordered; // next tag, same section and depth, in original order
+ ezxml_t child; // head of sub tag list, NULL if none
+ ezxml_t parent; // parent tag, NULL if current tag is root tag
+ short flags; // additional information
+};
+
+// Given a string of xml data and its length, parses it and creates an ezxml
+// structure. For efficiency, modifies the data by adding null terminators
+// and decoding ampersand sequences. If you don't want this, copy the data and
+// pass in the copy. Returns NULL on failure.
+ezxml_t ezxml_parse_str(char *s, size_t len);
+
+// A wrapper for ezxml_parse_str() that accepts a file descriptor. First
+// attempts to mem map the file. Failing that, reads the file into memory.
+// Returns NULL on failure.
+ezxml_t ezxml_parse_fd(int fd);
+
+// a wrapper for ezxml_parse_fd() that accepts a file name
+ezxml_t ezxml_parse_file(const char *file);
+
+// Wrapper for ezxml_parse_str() that accepts a file stream. Reads the entire
+// stream into memory and then parses it. For xml files, use ezxml_parse_file()
+// or ezxml_parse_fd()
+ezxml_t ezxml_parse_fp(FILE *fp);
+
+// returns the first child tag (one level deeper) with the given name or NULL
+// if not found
+ezxml_t ezxml_child(ezxml_t xml, const char *name);
+
+// returns the next tag of the same name in the same section and depth or NULL
+// if not found
+#define ezxml_next(xml) ((xml) ? xml->next : NULL)
+
+// Returns the Nth tag with the same name in the same section at the same depth
+// or NULL if not found. An index of 0 returns the tag given.
+ezxml_t ezxml_idx(ezxml_t xml, int idx);
+
+// returns the name of the given tag
+#define ezxml_name(xml) ((xml) ? xml->name : NULL)
+
+// returns the given tag's character content or empty string if none
+#define ezxml_txt(xml) ((xml) ? xml->txt : "")
+
+// returns the value of the requested tag attribute, or NULL if not found
+const char *ezxml_attr(ezxml_t xml, const char *attr);
+
+// Traverses the ezxml sturcture to retrieve a specific subtag. Takes a
+// variable length list of tag names and indexes. The argument list must be
+// terminated by either an index of -1 or an empty string tag name. Example:
+// title = ezxml_get(library, "shelf", 0, "book", 2, "title", -1);
+// This retrieves the title of the 3rd book on the 1st shelf of library.
+// Returns NULL if not found.
+ezxml_t ezxml_get(ezxml_t xml, ...);
+
+// Converts an ezxml structure back to xml. Returns a string of xml data that
+// must be freed.
+char *ezxml_toxml(ezxml_t xml);
+
+// returns a NULL terminated array of processing instructions for the given
+// target
+const char **ezxml_pi(ezxml_t xml, const char *target);
+
+// frees the memory allocated for an ezxml structure
+void ezxml_free(ezxml_t xml);
+
+// returns parser error message or empty string if none
+const char *ezxml_error(ezxml_t xml);
+
+// returns a new empty ezxml structure with the given root tag name
+ezxml_t ezxml_new(const char *name);
+
+// wrapper for ezxml_new() that strdup()s name
+#define ezxml_new_d(name) ezxml_set_flag(ezxml_new(strdup(name)), EZXML_NAMEM)
+
+// Adds a child tag. off is the offset of the child tag relative to the start
+// of the parent tag's character content. Returns the child tag.
+ezxml_t ezxml_add_child(ezxml_t xml, const char *name, size_t off);
+
+// wrapper for ezxml_add_child() that strdup()s name
+#define ezxml_add_child_d(xml, name, off) \
+ ezxml_set_flag(ezxml_add_child(xml, strdup(name), off), EZXML_NAMEM)
+
+// sets the character content for the given tag and returns the tag
+ezxml_t ezxml_set_txt(ezxml_t xml, const char *txt);
+
+// wrapper for ezxml_set_txt() that strdup()s txt
+#define ezxml_set_txt_d(xml, txt) \
+ ezxml_set_flag(ezxml_set_txt(xml, strdup(txt)), EZXML_TXTM)
+
+// Sets the given tag attribute or adds a new attribute if not found. A value
+// of NULL will remove the specified attribute. Returns the tag given.
+ezxml_t ezxml_set_attr(ezxml_t xml, const char *name, const char *value);
+
+// Wrapper for ezxml_set_attr() that strdup()s name/value. Value cannot be NULL
+#define ezxml_set_attr_d(xml, name, value) \
+ ezxml_set_attr(ezxml_set_flag(xml, EZXML_DUP), strdup(name), strdup(value))
+
+// sets a flag for the given tag and returns the tag
+ezxml_t ezxml_set_flag(ezxml_t xml, short flag);
+
+// removes a tag along with its subtags without freeing its memory
+ezxml_t ezxml_cut(ezxml_t xml);
+
+// inserts an existing tag into an ezxml structure
+ezxml_t ezxml_insert(ezxml_t xml, ezxml_t dest, size_t off);
+
+// Moves an existing tag to become a subtag of dest at the given offset from
+// the start of dest's character content. Returns the moved tag.
+#define ezxml_move(xml, dest, off) ezxml_insert(ezxml_cut(xml), dest, off)
+
+// removes a tag along with all its subtags
+#define ezxml_remove(xml) ezxml_free(ezxml_cut(xml))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _EZXML_H
diff --git a/support/ezxml/ezxml_init.c b/support/ezxml/ezxml_init.c
new file mode 100644
index 00000000..32be387d
--- /dev/null
+++ b/support/ezxml/ezxml_init.c
@@ -0,0 +1,6 @@
+#include "plugin.h"
+
+void
+plugin_init(void)
+{
+}
diff --git a/support/glib/Makefile.am b/support/glib/Makefile.am
new file mode 100644
index 00000000..6412cbd2
--- /dev/null
+++ b/support/glib/Makefile.am
@@ -0,0 +1,9 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -I$(top_srcdir)/navit/support -DMODULE=support_glib
+noinst_LTLIBRARIES = libsupport_glib.la
+libsupport_glib_la_SOURCES = fake.c galiasdef.c gatomic.c gerror.c \
+ ghash.c glib_init.c glist.c gmem.c gmessages.c gprimes.c gprintf.c gslice.c \
+ gstrfuncs.c gstring.c gutils.c gutf8.c \
+ fake.h galias.h gerror.h ghash.h glib.h glibconfig.h glibintl.h glist.h \
+ gmacros.h gmem.h gmessages.h gprintf.h gprintfint.h gquark.h gslice.h \
+ gstrfuncs.h gthreadprivate.h gtypes.h
diff --git a/support/glib/fake.c b/support/glib/fake.c
new file mode 100644
index 00000000..7da37182
--- /dev/null
+++ b/support/glib/fake.c
@@ -0,0 +1,5 @@
+char *
+g_convert(char *in)
+{
+ return g_strdup(in);
+}
diff --git a/support/glib/fake.h b/support/glib/fake.h
new file mode 100644
index 00000000..6fc9d55f
--- /dev/null
+++ b/support/glib/fake.h
@@ -0,0 +1,6 @@
+#define g_return_if_fail
+#define GMutex void
+#define GPrivate void
+#define g_mutex_new() NULL
+#define g_mutex_lock(x)
+#define g_mutex_unlock(x)
diff --git a/NEWS b/support/glib/galias.h
index e69de29b..e69de29b 100644
--- a/NEWS
+++ b/support/glib/galias.h
diff --git a/support/glib/galiasdef.c b/support/glib/galiasdef.c
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/support/glib/galiasdef.c
diff --git a/support/glib/gatomic.c b/support/glib/gatomic.c
new file mode 100644
index 00000000..b75a8c5e
--- /dev/null
+++ b/support/glib/gatomic.c
@@ -0,0 +1,936 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * g_atomic_*: atomic operations.
+ * Copyright (C) 2003 Sebastian Wilhelmi
+ * Copyright (C) 2007 Nokia Corporation
+ *
+ * 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.
+ */
+
+#include "config.h"
+
+#if defined (G_ATOMIC_ARM)
+#include <sched.h>
+#endif
+
+#include "glib.h"
+#include "gthreadprivate.h"
+#include "galias.h"
+
+#if defined (__GNUC__)
+# if defined (G_ATOMIC_I486)
+/* Adapted from CVS version 1.10 of glibc's sysdeps/i386/i486/bits/atomic.h
+ */
+gint
+g_atomic_int_exchange_and_add (volatile gint *atomic,
+ gint val)
+{
+ gint result;
+
+ __asm__ __volatile__ ("lock; xaddl %0,%1"
+ : "=r" (result), "=m" (*atomic)
+ : "0" (val), "m" (*atomic));
+ return result;
+}
+
+void
+g_atomic_int_add (volatile gint *atomic,
+ gint val)
+{
+ __asm__ __volatile__ ("lock; addl %1,%0"
+ : "=m" (*atomic)
+ : "ir" (val), "m" (*atomic));
+}
+
+gboolean
+g_atomic_int_compare_and_exchange (volatile gint *atomic,
+ gint oldval,
+ gint newval)
+{
+ gint result;
+
+ __asm__ __volatile__ ("lock; cmpxchgl %2, %1"
+ : "=a" (result), "=m" (*atomic)
+ : "r" (newval), "m" (*atomic), "0" (oldval));
+
+ return result == oldval;
+}
+
+/* The same code as above, as on i386 gpointer is 32 bit as well.
+ * Duplicating the code here seems more natural than casting the
+ * arguments and calling the former function */
+
+gboolean
+g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic,
+ gpointer oldval,
+ gpointer newval)
+{
+ gpointer result;
+
+ __asm__ __volatile__ ("lock; cmpxchgl %2, %1"
+ : "=a" (result), "=m" (*atomic)
+ : "r" (newval), "m" (*atomic), "0" (oldval));
+
+ return result == oldval;
+}
+
+# elif defined (G_ATOMIC_SPARCV9)
+/* Adapted from CVS version 1.3 of glibc's sysdeps/sparc/sparc64/bits/atomic.h
+ */
+# define ATOMIC_INT_CMP_XCHG(atomic, oldval, newval) \
+ ({ \
+ gint __result; \
+ __asm__ __volatile__ ("cas [%4], %2, %0" \
+ : "=r" (__result), "=m" (*(atomic)) \
+ : "r" (oldval), "m" (*(atomic)), "r" (atomic),\
+ "0" (newval)); \
+ __result == oldval; \
+ })
+
+# if GLIB_SIZEOF_VOID_P == 4 /* 32-bit system */
+gboolean
+g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic,
+ gpointer oldval,
+ gpointer newval)
+{
+ gpointer result;
+ __asm__ __volatile__ ("cas [%4], %2, %0"
+ : "=r" (result), "=m" (*atomic)
+ : "r" (oldval), "m" (*atomic), "r" (atomic),
+ "0" (newval));
+ return result == oldval;
+}
+# elif GLIB_SIZEOF_VOID_P == 8 /* 64-bit system */
+gboolean
+g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic,
+ gpointer oldval,
+ gpointer newval)
+{
+ gpointer result;
+ gpointer *a = atomic;
+ __asm__ __volatile__ ("casx [%4], %2, %0"
+ : "=r" (result), "=m" (*a)
+ : "r" (oldval), "m" (*a), "r" (a),
+ "0" (newval));
+ return result == oldval;
+}
+# else /* What's that */
+# error "Your system has an unsupported pointer size"
+# endif /* GLIB_SIZEOF_VOID_P */
+# define G_ATOMIC_MEMORY_BARRIER \
+ __asm__ __volatile__ ("membar #LoadLoad | #LoadStore" \
+ " | #StoreLoad | #StoreStore" : : : "memory")
+
+# elif defined (G_ATOMIC_ALPHA)
+/* Adapted from CVS version 1.3 of glibc's sysdeps/alpha/bits/atomic.h
+ */
+# define ATOMIC_INT_CMP_XCHG(atomic, oldval, newval) \
+ ({ \
+ gint __result; \
+ gint __prev; \
+ __asm__ __volatile__ ( \
+ " mb\n" \
+ "1: ldl_l %0,%2\n" \
+ " cmpeq %0,%3,%1\n" \
+ " beq %1,2f\n" \
+ " mov %4,%1\n" \
+ " stl_c %1,%2\n" \
+ " beq %1,1b\n" \
+ " mb\n" \
+ "2:" \
+ : "=&r" (__prev), \
+ "=&r" (__result) \
+ : "m" (*(atomic)), \
+ "Ir" (oldval), \
+ "Ir" (newval) \
+ : "memory"); \
+ __result != 0; \
+ })
+# if GLIB_SIZEOF_VOID_P == 4 /* 32-bit system */
+gboolean
+g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic,
+ gpointer oldval,
+ gpointer newval)
+{
+ gint result;
+ gpointer prev;
+ __asm__ __volatile__ (
+ " mb\n"
+ "1: ldl_l %0,%2\n"
+ " cmpeq %0,%3,%1\n"
+ " beq %1,2f\n"
+ " mov %4,%1\n"
+ " stl_c %1,%2\n"
+ " beq %1,1b\n"
+ " mb\n"
+ "2:"
+ : "=&r" (prev),
+ "=&r" (result)
+ : "m" (*atomic),
+ "Ir" (oldval),
+ "Ir" (newval)
+ : "memory");
+ return result != 0;
+}
+# elif GLIB_SIZEOF_VOID_P == 8 /* 64-bit system */
+gboolean
+g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic,
+ gpointer oldval,
+ gpointer newval)
+{
+ gint result;
+ gpointer prev;
+ __asm__ __volatile__ (
+ " mb\n"
+ "1: ldq_l %0,%2\n"
+ " cmpeq %0,%3,%1\n"
+ " beq %1,2f\n"
+ " mov %4,%1\n"
+ " stq_c %1,%2\n"
+ " beq %1,1b\n"
+ " mb\n"
+ "2:"
+ : "=&r" (prev),
+ "=&r" (result)
+ : "m" (*atomic),
+ "Ir" (oldval),
+ "Ir" (newval)
+ : "memory");
+ return result != 0;
+}
+# else /* What's that */
+# error "Your system has an unsupported pointer size"
+# endif /* GLIB_SIZEOF_VOID_P */
+# define G_ATOMIC_MEMORY_BARRIER __asm__ ("mb" : : : "memory")
+# elif defined (G_ATOMIC_X86_64)
+/* Adapted from CVS version 1.9 of glibc's sysdeps/x86_64/bits/atomic.h
+ */
+gint
+g_atomic_int_exchange_and_add (volatile gint *atomic,
+ gint val)
+{
+ gint result;
+
+ __asm__ __volatile__ ("lock; xaddl %0,%1"
+ : "=r" (result), "=m" (*atomic)
+ : "0" (val), "m" (*atomic));
+ return result;
+}
+
+void
+g_atomic_int_add (volatile gint *atomic,
+ gint val)
+{
+ __asm__ __volatile__ ("lock; addl %1,%0"
+ : "=m" (*atomic)
+ : "ir" (val), "m" (*atomic));
+}
+
+gboolean
+g_atomic_int_compare_and_exchange (volatile gint *atomic,
+ gint oldval,
+ gint newval)
+{
+ gint result;
+
+ __asm__ __volatile__ ("lock; cmpxchgl %2, %1"
+ : "=a" (result), "=m" (*atomic)
+ : "r" (newval), "m" (*atomic), "0" (oldval));
+
+ return result == oldval;
+}
+
+gboolean
+g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic,
+ gpointer oldval,
+ gpointer newval)
+{
+ gpointer result;
+
+ __asm__ __volatile__ ("lock; cmpxchgq %q2, %1"
+ : "=a" (result), "=m" (*atomic)
+ : "r" (newval), "m" (*atomic), "0" (oldval));
+
+ return result == oldval;
+}
+
+# elif defined (G_ATOMIC_POWERPC)
+/* Adapted from CVS version 1.16 of glibc's sysdeps/powerpc/bits/atomic.h
+ * and CVS version 1.4 of glibc's sysdeps/powerpc/powerpc32/bits/atomic.h
+ * and CVS version 1.7 of glibc's sysdeps/powerpc/powerpc64/bits/atomic.h
+ */
+# ifdef __OPTIMIZE__
+/* Non-optimizing compile bails on the following two asm statements
+ * for reasons unknown to the author */
+gint
+g_atomic_int_exchange_and_add (volatile gint *atomic,
+ gint val)
+{
+ gint result, temp;
+#if ASM_NUMERIC_LABELS
+ __asm__ __volatile__ ("1: lwarx %0,0,%3\n"
+ " add %1,%0,%4\n"
+ " stwcx. %1,0,%3\n"
+ " bne- 1b"
+ : "=&b" (result), "=&r" (temp), "=m" (*atomic)
+ : "b" (atomic), "r" (val), "m" (*atomic)
+ : "cr0", "memory");
+#else
+ __asm__ __volatile__ (".Lieaa%=: lwarx %0,0,%3\n"
+ " add %1,%0,%4\n"
+ " stwcx. %1,0,%3\n"
+ " bne- .Lieaa%="
+ : "=&b" (result), "=&r" (temp), "=m" (*atomic)
+ : "b" (atomic), "r" (val), "m" (*atomic)
+ : "cr0", "memory");
+#endif
+ return result;
+}
+
+/* The same as above, to save a function call repeated here */
+void
+g_atomic_int_add (volatile gint *atomic,
+ gint val)
+{
+ gint result, temp;
+#if ASM_NUMERIC_LABELS
+ __asm__ __volatile__ ("1: lwarx %0,0,%3\n"
+ " add %1,%0,%4\n"
+ " stwcx. %1,0,%3\n"
+ " bne- 1b"
+ : "=&b" (result), "=&r" (temp), "=m" (*atomic)
+ : "b" (atomic), "r" (val), "m" (*atomic)
+ : "cr0", "memory");
+#else
+ __asm__ __volatile__ (".Lia%=: lwarx %0,0,%3\n"
+ " add %1,%0,%4\n"
+ " stwcx. %1,0,%3\n"
+ " bne- .Lia%="
+ : "=&b" (result), "=&r" (temp), "=m" (*atomic)
+ : "b" (atomic), "r" (val), "m" (*atomic)
+ : "cr0", "memory");
+#endif
+}
+# else /* !__OPTIMIZE__ */
+gint
+g_atomic_int_exchange_and_add (volatile gint *atomic,
+ gint val)
+{
+ gint result;
+ do
+ result = *atomic;
+ while (!g_atomic_int_compare_and_exchange (atomic, result, result + val));
+
+ return result;
+}
+
+void
+g_atomic_int_add (volatile gint *atomic,
+ gint val)
+{
+ gint result;
+ do
+ result = *atomic;
+ while (!g_atomic_int_compare_and_exchange (atomic, result, result + val));
+}
+# endif /* !__OPTIMIZE__ */
+
+# if GLIB_SIZEOF_VOID_P == 4 /* 32-bit system */
+gboolean
+g_atomic_int_compare_and_exchange (volatile gint *atomic,
+ gint oldval,
+ gint newval)
+{
+ gint result;
+#if ASM_NUMERIC_LABELS
+ __asm__ __volatile__ ("sync\n"
+ "1: lwarx %0,0,%1\n"
+ " subf. %0,%2,%0\n"
+ " bne 2f\n"
+ " stwcx. %3,0,%1\n"
+ " bne- 1b\n"
+ "2: isync"
+ : "=&r" (result)
+ : "b" (atomic), "r" (oldval), "r" (newval)
+ : "cr0", "memory");
+#else
+ __asm__ __volatile__ ("sync\n"
+ ".L1icae%=: lwarx %0,0,%1\n"
+ " subf. %0,%2,%0\n"
+ " bne .L2icae%=\n"
+ " stwcx. %3,0,%1\n"
+ " bne- .L1icae%=\n"
+ ".L2icae%=: isync"
+ : "=&r" (result)
+ : "b" (atomic), "r" (oldval), "r" (newval)
+ : "cr0", "memory");
+#endif
+ return result == 0;
+}
+
+gboolean
+g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic,
+ gpointer oldval,
+ gpointer newval)
+{
+ gpointer result;
+#if ASM_NUMERIC_LABELS
+ __asm__ __volatile__ ("sync\n"
+ "1: lwarx %0,0,%1\n"
+ " subf. %0,%2,%0\n"
+ " bne 2f\n"
+ " stwcx. %3,0,%1\n"
+ " bne- 1b\n"
+ "2: isync"
+ : "=&r" (result)
+ : "b" (atomic), "r" (oldval), "r" (newval)
+ : "cr0", "memory");
+#else
+ __asm__ __volatile__ ("sync\n"
+ ".L1pcae%=: lwarx %0,0,%1\n"
+ " subf. %0,%2,%0\n"
+ " bne .L2pcae%=\n"
+ " stwcx. %3,0,%1\n"
+ " bne- .L1pcae%=\n"
+ ".L2pcae%=: isync"
+ : "=&r" (result)
+ : "b" (atomic), "r" (oldval), "r" (newval)
+ : "cr0", "memory");
+#endif
+ return result == 0;
+}
+# elif GLIB_SIZEOF_VOID_P == 8 /* 64-bit system */
+gboolean
+g_atomic_int_compare_and_exchange (volatile gint *atomic,
+ gint oldval,
+ gint newval)
+{
+ gpointer result;
+#if ASM_NUMERIC_LABELS
+ __asm__ __volatile__ ("sync\n"
+ "1: lwarx %0,0,%1\n"
+ " extsw %0,%0\n"
+ " subf. %0,%2,%0\n"
+ " bne 2f\n"
+ " stwcx. %3,0,%1\n"
+ " bne- 1b\n"
+ "2: isync"
+ : "=&r" (result)
+ : "b" (atomic), "r" (oldval), "r" (newval)
+ : "cr0", "memory");
+#else
+ __asm__ __volatile__ ("sync\n"
+ ".L1icae%=: lwarx %0,0,%1\n"
+ " extsw %0,%0\n"
+ " subf. %0,%2,%0\n"
+ " bne .L2icae%=\n"
+ " stwcx. %3,0,%1\n"
+ " bne- .L1icae%=\n"
+ ".L2icae%=: isync"
+ : "=&r" (result)
+ : "b" (atomic), "r" (oldval), "r" (newval)
+ : "cr0", "memory");
+#endif
+ return result == 0;
+}
+
+gboolean
+g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic,
+ gpointer oldval,
+ gpointer newval)
+{
+ gpointer result;
+#if ASM_NUMERIC_LABELS
+ __asm__ __volatile__ ("sync\n"
+ "1: ldarx %0,0,%1\n"
+ " subf. %0,%2,%0\n"
+ " bne 2f\n"
+ " stdcx. %3,0,%1\n"
+ " bne- 1b\n"
+ "2: isync"
+ : "=&r" (result)
+ : "b" (atomic), "r" (oldval), "r" (newval)
+ : "cr0", "memory");
+#else
+ __asm__ __volatile__ ("sync\n"
+ ".L1pcae%=: ldarx %0,0,%1\n"
+ " subf. %0,%2,%0\n"
+ " bne .L2pcae%=\n"
+ " stdcx. %3,0,%1\n"
+ " bne- .L1pcae%=\n"
+ ".L2pcae%=: isync"
+ : "=&r" (result)
+ : "b" (atomic), "r" (oldval), "r" (newval)
+ : "cr0", "memory");
+#endif
+ return result == 0;
+}
+# else /* What's that */
+# error "Your system has an unsupported pointer size"
+# endif /* GLIB_SIZEOF_VOID_P */
+
+# define G_ATOMIC_MEMORY_BARRIER __asm__ ("sync" : : : "memory")
+
+# elif defined (G_ATOMIC_IA64)
+/* Adapted from CVS version 1.8 of glibc's sysdeps/ia64/bits/atomic.h
+ */
+gint
+g_atomic_int_exchange_and_add (volatile gint *atomic,
+ gint val)
+{
+ return __sync_fetch_and_add (atomic, val);
+}
+
+void
+g_atomic_int_add (volatile gint *atomic,
+ gint val)
+{
+ __sync_fetch_and_add (atomic, val);
+}
+
+gboolean
+g_atomic_int_compare_and_exchange (volatile gint *atomic,
+ gint oldval,
+ gint newval)
+{
+ return __sync_bool_compare_and_swap (atomic, oldval, newval);
+}
+
+gboolean
+g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic,
+ gpointer oldval,
+ gpointer newval)
+{
+ return __sync_bool_compare_and_swap ((long *)atomic,
+ (long)oldval, (long)newval);
+}
+
+# define G_ATOMIC_MEMORY_BARRIER __sync_synchronize ()
+# elif defined (G_ATOMIC_S390)
+/* Adapted from glibc's sysdeps/s390/bits/atomic.h
+ */
+# define ATOMIC_INT_CMP_XCHG(atomic, oldval, newval) \
+ ({ \
+ gint __result = oldval; \
+ __asm__ __volatile__ ("cs %0, %2, %1" \
+ : "+d" (__result), "=Q" (*(atomic)) \
+ : "d" (newval), "m" (*(atomic)) : "cc" ); \
+ __result == oldval; \
+ })
+
+# if GLIB_SIZEOF_VOID_P == 4 /* 32-bit system */
+gboolean
+g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic,
+ gpointer oldval,
+ gpointer newval)
+{
+ gpointer result = oldval;
+ __asm__ __volatile__ ("cs %0, %2, %1"
+ : "+d" (result), "=Q" (*(atomic))
+ : "d" (newval), "m" (*(atomic)) : "cc" );
+ return result == oldval;
+}
+# elif GLIB_SIZEOF_VOID_P == 8 /* 64-bit system */
+gboolean
+g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic,
+ gpointer oldval,
+ gpointer newval)
+{
+ gpointer result = oldval;
+ gpointer *a = atomic;
+ __asm__ __volatile__ ("csg %0, %2, %1"
+ : "+d" (result), "=Q" (*a)
+ : "d" ((long)(newval)), "m" (*a) : "cc" );
+ return result == oldval;
+}
+# else /* What's that */
+# error "Your system has an unsupported pointer size"
+# endif /* GLIB_SIZEOF_VOID_P */
+# elif defined (G_ATOMIC_ARM)
+static volatile int atomic_spin = 0;
+
+static int atomic_spin_trylock (void)
+{
+ int result;
+
+ asm volatile (
+ "swp %0, %1, [%2]\n"
+ : "=&r,&r" (result)
+ : "r,0" (1), "r,r" (&atomic_spin)
+ : "memory");
+ if (result == 0)
+ return 0;
+ else
+ return -1;
+}
+
+static void atomic_spin_lock (void)
+{
+ while (atomic_spin_trylock())
+ sched_yield();
+}
+
+static void atomic_spin_unlock (void)
+{
+ atomic_spin = 0;
+}
+
+gint
+g_atomic_int_exchange_and_add (volatile gint *atomic,
+ gint val)
+{
+ gint result;
+
+ atomic_spin_lock();
+ result = *atomic;
+ *atomic += val;
+ atomic_spin_unlock();
+
+ return result;
+}
+
+void
+g_atomic_int_add (volatile gint *atomic,
+ gint val)
+{
+ atomic_spin_lock();
+ *atomic += val;
+ atomic_spin_unlock();
+}
+
+gboolean
+g_atomic_int_compare_and_exchange (volatile gint *atomic,
+ gint oldval,
+ gint newval)
+{
+ gboolean result;
+
+ atomic_spin_lock();
+ if (*atomic == oldval)
+ {
+ result = TRUE;
+ *atomic = newval;
+ }
+ else
+ result = FALSE;
+ atomic_spin_unlock();
+
+ return result;
+}
+
+gboolean
+g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic,
+ gpointer oldval,
+ gpointer newval)
+{
+ gboolean result;
+
+ atomic_spin_lock();
+ if (*atomic == oldval)
+ {
+ result = TRUE;
+ *atomic = newval;
+ }
+ else
+ result = FALSE;
+ atomic_spin_unlock();
+
+ return result;
+}
+# else /* !G_ATOMIC_ARM */
+# define DEFINE_WITH_MUTEXES
+# endif /* G_ATOMIC_IA64 */
+#else /* !__GNUC__ */
+# ifdef G_PLATFORM_WIN32
+# define DEFINE_WITH_WIN32_INTERLOCKED
+# else
+# define DEFINE_WITH_MUTEXES
+# endif
+#endif /* __GNUC__ */
+
+#ifdef DEFINE_WITH_WIN32_INTERLOCKED
+# include <windows.h>
+/* Following indicates that InterlockedCompareExchangePointer is
+ * declared in winbase.h (included by windows.h) and needs to be
+ * commented out if not true. It is defined iff WINVER > 0x0400,
+ * which is usually correct but can be wrong if WINVER is set before
+ * windows.h is included.
+ */
+# if WINVER > 0x0400
+# define HAVE_INTERLOCKED_COMPARE_EXCHANGE_POINTER
+# endif
+
+gint32
+g_atomic_int_exchange_and_add (volatile gint32 *atomic,
+ gint32 val)
+{
+ return InterlockedExchangeAdd (atomic, val);
+}
+
+void
+g_atomic_int_add (volatile gint32 *atomic,
+ gint32 val)
+{
+ InterlockedExchangeAdd (atomic, val);
+}
+
+gboolean
+g_atomic_int_compare_and_exchange (volatile gint32 *atomic,
+ gint32 oldval,
+ gint32 newval)
+{
+#ifndef HAVE_INTERLOCKED_COMPARE_EXCHANGE_POINTER
+ return (guint32) InterlockedCompareExchange ((PVOID*)atomic,
+ (PVOID)newval,
+ (PVOID)oldval) == oldval;
+#else
+ return InterlockedCompareExchange (atomic,
+ newval,
+ oldval) == oldval;
+#endif
+}
+
+gboolean
+g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic,
+ gpointer oldval,
+ gpointer newval)
+{
+# ifdef HAVE_INTERLOCKED_COMPARE_EXCHANGE_POINTER
+ return InterlockedCompareExchangePointer (atomic, newval, oldval) == oldval;
+# else
+# if GLIB_SIZEOF_VOID_P != 4 /* no 32-bit system */
+# error "InterlockedCompareExchangePointer needed"
+# else
+ return InterlockedCompareExchange (atomic, newval, oldval) == oldval;
+# endif
+# endif
+}
+#endif /* DEFINE_WITH_WIN32_INTERLOCKED */
+
+#ifdef DEFINE_WITH_MUTEXES
+/* We have to use the slow, but safe locking method */
+static GMutex *g_atomic_mutex;
+
+gint
+g_atomic_int_exchange_and_add (volatile gint *atomic,
+ gint val)
+{
+ gint result;
+
+ g_mutex_lock (g_atomic_mutex);
+ result = *atomic;
+ *atomic += val;
+ g_mutex_unlock (g_atomic_mutex);
+
+ return result;
+}
+
+
+void
+g_atomic_int_add (volatile gint *atomic,
+ gint val)
+{
+ g_mutex_lock (g_atomic_mutex);
+ *atomic += val;
+ g_mutex_unlock (g_atomic_mutex);
+}
+
+gboolean
+g_atomic_int_compare_and_exchange (volatile gint *atomic,
+ gint oldval,
+ gint newval)
+{
+ gboolean result;
+
+ g_mutex_lock (g_atomic_mutex);
+ if (*atomic == oldval)
+ {
+ result = TRUE;
+ *atomic = newval;
+ }
+ else
+ result = FALSE;
+ g_mutex_unlock (g_atomic_mutex);
+
+ return result;
+}
+
+gboolean
+g_atomic_pointer_compare_and_exchange (volatile gpointer *atomic,
+ gpointer oldval,
+ gpointer newval)
+{
+ gboolean result;
+
+ g_mutex_lock (g_atomic_mutex);
+ if (*atomic == oldval)
+ {
+ result = TRUE;
+ *atomic = newval;
+ }
+ else
+ result = FALSE;
+ g_mutex_unlock (g_atomic_mutex);
+
+ return result;
+}
+
+#ifdef G_ATOMIC_OP_MEMORY_BARRIER_NEEDED
+gint
+g_atomic_int_get (volatile gint *atomic)
+{
+ gint result;
+
+ g_mutex_lock (g_atomic_mutex);
+ result = *atomic;
+ g_mutex_unlock (g_atomic_mutex);
+
+ return result;
+}
+
+void
+g_atomic_int_set (volatile gint *atomic,
+ gint newval)
+{
+ g_mutex_lock (g_atomic_mutex);
+ *atomic = newval;
+ g_mutex_unlock (g_atomic_mutex);
+}
+
+gpointer
+g_atomic_pointer_get (volatile gpointer *atomic)
+{
+ gpointer result;
+
+ g_mutex_lock (g_atomic_mutex);
+ result = *atomic;
+ g_mutex_unlock (g_atomic_mutex);
+
+ return result;
+}
+
+void
+g_atomic_pointer_set (volatile gpointer *atomic,
+ gpointer newval)
+{
+ g_mutex_lock (g_atomic_mutex);
+ *atomic = newval;
+ g_mutex_unlock (g_atomic_mutex);
+}
+#endif /* G_ATOMIC_OP_MEMORY_BARRIER_NEEDED */
+#elif defined (G_ATOMIC_OP_MEMORY_BARRIER_NEEDED)
+gint
+g_atomic_int_get (volatile gint *atomic)
+{
+ G_ATOMIC_MEMORY_BARRIER;
+ return *atomic;
+}
+
+void
+g_atomic_int_set (volatile gint *atomic,
+ gint newval)
+{
+ *atomic = newval;
+ G_ATOMIC_MEMORY_BARRIER;
+}
+
+gpointer
+g_atomic_pointer_get (volatile gpointer *atomic)
+{
+ G_ATOMIC_MEMORY_BARRIER;
+ return *atomic;
+}
+
+void
+g_atomic_pointer_set (volatile gpointer *atomic,
+ gpointer newval)
+{
+ *atomic = newval;
+ G_ATOMIC_MEMORY_BARRIER;
+}
+#endif /* DEFINE_WITH_MUTEXES || G_ATOMIC_OP_MEMORY_BARRIER_NEEDED */
+
+#ifdef ATOMIC_INT_CMP_XCHG
+gboolean
+g_atomic_int_compare_and_exchange (volatile gint *atomic,
+ gint oldval,
+ gint newval)
+{
+ return ATOMIC_INT_CMP_XCHG (atomic, oldval, newval);
+}
+
+gint
+g_atomic_int_exchange_and_add (volatile gint *atomic,
+ gint val)
+{
+ gint result;
+ do
+ result = *atomic;
+ while (!ATOMIC_INT_CMP_XCHG (atomic, result, result + val));
+
+ return result;
+}
+
+void
+g_atomic_int_add (volatile gint *atomic,
+ gint val)
+{
+ gint result;
+ do
+ result = *atomic;
+ while (!ATOMIC_INT_CMP_XCHG (atomic, result, result + val));
+}
+#endif /* ATOMIC_INT_CMP_XCHG */
+
+void
+_g_atomic_thread_init (void)
+{
+#ifdef DEFINE_WITH_MUTEXES
+ g_atomic_mutex = g_mutex_new ();
+#endif /* DEFINE_WITH_MUTEXES */
+}
+
+#ifndef G_ATOMIC_OP_MEMORY_BARRIER_NEEDED
+gint
+(g_atomic_int_get) (volatile gint *atomic)
+{
+ return g_atomic_int_get (atomic);
+}
+
+void
+(g_atomic_int_set) (volatile gint *atomic,
+ gint newval)
+{
+ g_atomic_int_set (atomic, newval);
+}
+
+gpointer
+(g_atomic_pointer_get) (volatile gpointer *atomic)
+{
+ return g_atomic_pointer_get (atomic);
+}
+
+void
+(g_atomic_pointer_set) (volatile gpointer *atomic,
+ gpointer newval)
+{
+ g_atomic_pointer_set (atomic, newval);
+}
+#endif /* G_ATOMIC_OP_MEMORY_BARRIER_NEEDED */
+
+#define __G_ATOMIC_C__
+#include "galiasdef.c"
diff --git a/support/glib/gerror.c b/support/glib/gerror.c
new file mode 100644
index 00000000..34d8c284
--- /dev/null
+++ b/support/glib/gerror.c
@@ -0,0 +1,381 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"
+
+#include "glib.h"
+#include "galias.h"
+
+
+static GError*
+g_error_new_valist (GQuark domain,
+ gint code,
+ const gchar *format,
+ va_list args)
+{
+ GError *error;
+
+ error = g_slice_new (GError);
+
+ error->domain = domain;
+ error->code = code;
+ error->message = g_strdup_vprintf (format, args);
+
+ return error;
+}
+
+#if NOT_NEEDED_FOR_NAVIT
+/**
+ * g_error_new:
+ * @domain: error domain
+ * @code: error code
+ * @format: printf()-style format for error message
+ * @Varargs: parameters for message format
+ *
+ * Creates a new #GError with the given @domain and @code,
+ * and a message formatted with @format.
+ *
+ * Return value: a new #GError
+ **/
+GError*
+g_error_new (GQuark domain,
+ gint code,
+ const gchar *format,
+ ...)
+{
+ GError* error;
+ va_list args;
+
+ g_return_val_if_fail (format != NULL, NULL);
+ g_return_val_if_fail (domain != 0, NULL);
+
+ va_start (args, format);
+ error = g_error_new_valist (domain, code, format, args);
+ va_end (args);
+
+ return error;
+}
+
+/**
+ * g_error_new_literal:
+ * @domain: error domain
+ * @code: error code
+ * @message: error message
+ *
+ * Creates a new #GError; unlike g_error_new(), @message is not
+ * a printf()-style format string. Use this
+ * function if @message contains text you don't have control over,
+ * that could include printf() escape sequences.
+ *
+ * Return value: a new #GError
+ **/
+GError*
+g_error_new_literal (GQuark domain,
+ gint code,
+ const gchar *message)
+{
+ GError* err;
+
+ g_return_val_if_fail (message != NULL, NULL);
+ g_return_val_if_fail (domain != 0, NULL);
+
+ err = g_slice_new (GError);
+
+ err->domain = domain;
+ err->code = code;
+ err->message = g_strdup (message);
+
+ return err;
+}
+
+/**
+ * g_error_free:
+ * @error: a #GError
+ *
+ * Frees a #GError and associated resources.
+ *
+ **/
+void
+g_error_free (GError *error)
+{
+ g_return_if_fail (error != NULL);
+
+ g_free (error->message);
+
+ g_slice_free (GError, error);
+}
+
+/**
+ * g_error_copy:
+ * @error: a #GError
+ *
+ * Makes a copy of @error.
+ *
+ * Return value: a new #GError
+ **/
+GError*
+g_error_copy (const GError *error)
+{
+ GError *copy;
+
+ g_return_val_if_fail (error != NULL, NULL);
+
+ copy = g_slice_new (GError);
+
+ *copy = *error;
+
+ copy->message = g_strdup (error->message);
+
+ return copy;
+}
+
+/**
+ * g_error_matches:
+ * @error: a #GError
+ * @domain: an error domain
+ * @code: an error code
+ *
+ * Returns %TRUE if @error matches @domain and @code, %FALSE
+ * otherwise.
+ *
+ * Return value: whether @error has @domain and @code
+ **/
+gboolean
+g_error_matches (const GError *error,
+ GQuark domain,
+ gint code)
+{
+ return error &&
+ error->domain == domain &&
+ error->code == code;
+}
+
+#define ERROR_OVERWRITTEN_WARNING "GError set over the top of a previous GError or uninitialized memory.\n" \
+ "This indicates a bug in someone's code. You must ensure an error is NULL before it's set.\n" \
+ "The overwriting error message was: %s"
+#endif /* NOT_NEEDED_FOR_NAVIT */
+
+/**
+ * g_set_error:
+ * @err: a return location for a #GError, or %NULL
+ * @domain: error domain
+ * @code: error code
+ * @format: printf()-style format
+ * @Varargs: args for @format
+ *
+ * Does nothing if @err is %NULL; if @err is non-%NULL, then *@err must
+ * be %NULL. A new #GError is created and assigned to *@err.
+ **/
+void
+g_set_error (GError **err,
+ GQuark domain,
+ gint code,
+ const gchar *format,
+ ...)
+{
+ GError *new;
+
+ va_list args;
+
+ if (err == NULL)
+ return;
+
+ va_start (args, format);
+ new = g_error_new_valist (domain, code, format, args);
+ va_end (args);
+
+ if (*err == NULL)
+ *err = new;
+#if NOT_NEEDED_FOR_NAVIT
+ else
+ g_warning (ERROR_OVERWRITTEN_WARNING, new->message);
+#endif /* NOT_NEEDED_FOR_NAVIT */
+}
+
+#if NOT_NEEDED_FOR_NAVIT
+/**
+ * g_set_error_literal:
+ * @err: a return location for a #GError, or %NULL
+ * @domain: error domain
+ * @code: error code
+ * @message: error message
+ *
+ * Does nothing if @err is %NULL; if @err is non-%NULL, then *@err must
+ * be %NULL. A new #GError is created and assigned to *@err.
+ * Unlike g_set_error(), @message is not a printf()-style format string.
+ * Use this function if @message contains text you don't have control over,
+ * that could include printf() escape sequences.
+ *
+ * Since: 2.18
+ **/
+void
+g_set_error_literal (GError **err,
+ GQuark domain,
+ gint code,
+ const gchar *message)
+{
+ GError *new;
+
+ if (err == NULL)
+ return;
+
+ new = g_error_new_literal (domain, code, message);
+ if (*err == NULL)
+ *err = new;
+ else
+ g_warning (ERROR_OVERWRITTEN_WARNING, new->message);
+}
+
+/**
+ * g_propagate_error:
+ * @dest: error return location
+ * @src: error to move into the return location
+ *
+ * If @dest is %NULL, free @src; otherwise, moves @src into *@dest.
+ * The error variable @dest points to must be %NULL.
+ **/
+void
+g_propagate_error (GError **dest,
+ GError *src)
+{
+ g_return_if_fail (src != NULL);
+
+ if (dest == NULL)
+ {
+ if (src)
+ g_error_free (src);
+ return;
+ }
+ else
+ {
+ if (*dest != NULL)
+ g_warning (ERROR_OVERWRITTEN_WARNING, src->message);
+ else
+ *dest = src;
+ }
+}
+
+/**
+ * g_clear_error:
+ * @err: a #GError return location
+ *
+ * If @err is %NULL, does nothing. If @err is non-%NULL,
+ * calls g_error_free() on *@err and sets *@err to %NULL.
+ **/
+void
+g_clear_error (GError **err)
+{
+ if (err && *err)
+ {
+ g_error_free (*err);
+ *err = NULL;
+ }
+}
+
+static void
+g_error_add_prefix (gchar **string,
+ const gchar *format,
+ va_list ap)
+{
+ gchar *oldstring;
+ gchar *prefix;
+
+ prefix = g_strdup_vprintf (format, ap);
+ oldstring = *string;
+ *string = g_strconcat (prefix, oldstring, NULL);
+ g_free (oldstring);
+ g_free (prefix);
+}
+
+/**
+ * g_prefix_error:
+ * @err: a return location for a #GError, or %NULL
+ * @format: printf()-style format string
+ * @...: arguments to @format
+ *
+ * Formats a string according to @format and
+ * prefix it to an existing error message. If
+ * @err is %NULL (ie: no error variable) then do
+ * nothing.
+ *
+ * If *@err is %NULL (ie: an error variable is
+ * present but there is no error condition) then
+ * also do nothing. Whether or not it makes
+ * sense to take advantage of this feature is up
+ * to you.
+ *
+ * Since: 2.16
+ **/
+void
+g_prefix_error (GError **err,
+ const gchar *format,
+ ...)
+{
+ if (err && *err)
+ {
+ va_list ap;
+
+ va_start (ap, format);
+ g_error_add_prefix (&(*err)->message, format, ap);
+ va_end (ap);
+ }
+}
+
+/**
+ * g_propagate_prefixed_error:
+ * @dest: error return location
+ * @src: error to move into the return location
+ * @format: printf()-style format string
+ * @...: arguments to @format
+ *
+ * If @dest is %NULL, free @src; otherwise,
+ * moves @src into *@dest. *@dest must be %NULL.
+ * After the move, add a prefix as with
+ * g_prefix_error().
+ *
+ * Since: 2.16
+ **/
+void
+g_propagate_prefixed_error (GError **dest,
+ GError *src,
+ const gchar *format,
+ ...)
+{
+ g_propagate_error (dest, src);
+
+ if (dest && *dest)
+ {
+ va_list ap;
+
+ va_start (ap, format);
+ g_error_add_prefix (&(*dest)->message, format, ap);
+ va_end (ap);
+ }
+}
+
+#endif /* NOT_NEEDED_FOR_NAVIT */
+#define __G_ERROR_C__
+#include "galiasdef.c"
diff --git a/support/glib/gerror.h b/support/glib/gerror.h
new file mode 100644
index 00000000..d3d42d59
--- /dev/null
+++ b/support/glib/gerror.h
@@ -0,0 +1,92 @@
+/* gerror.h - Error reporting system
+ *
+ * Copyright 2000 Red Hat, Inc.
+ *
+ * The Gnome 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.
+ *
+ * The Gnome 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 the Gnome Library; see the file COPYING.LIB. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#ifndef __G_ERROR_H__
+#define __G_ERROR_H__
+
+#include <glib/gquark.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GError GError;
+
+struct _GError
+{
+ GQuark domain;
+ gint code;
+ gchar *message;
+};
+
+GError* g_error_new (GQuark domain,
+ gint code,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (3, 4);
+
+GError* g_error_new_literal (GQuark domain,
+ gint code,
+ const gchar *message);
+
+void g_error_free (GError *error);
+GError* g_error_copy (const GError *error);
+
+gboolean g_error_matches (const GError *error,
+ GQuark domain,
+ gint code);
+
+/* if (err) *err = g_error_new(domain, code, format, ...), also has
+ * some sanity checks.
+ */
+void g_set_error (GError **err,
+ GQuark domain,
+ gint code,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (4, 5);
+
+void g_set_error_literal (GError **err,
+ GQuark domain,
+ gint code,
+ const gchar *message);
+
+/* if (dest) *dest = src; also has some sanity checks.
+ */
+void g_propagate_error (GError **dest,
+ GError *src);
+
+/* if (err && *err) { g_error_free(*err); *err = NULL; } */
+void g_clear_error (GError **err);
+
+/* if (err) prefix the formatted string to the ->message */
+void g_prefix_error (GError **err,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (2, 3);
+
+/* g_propagate_error then g_error_prefix on dest */
+void g_propagate_prefixed_error (GError **dest,
+ GError *src,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (3, 4);
+
+G_END_DECLS
+
+#endif /* __G_ERROR_H__ */
diff --git a/support/glib/ghash.c b/support/glib/ghash.c
new file mode 100644
index 00000000..e00b4c4c
--- /dev/null
+++ b/support/glib/ghash.c
@@ -0,0 +1,1202 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+/*
+ * MT safe
+ */
+
+#include "config.h"
+
+#include "glib.h"
+#include "galias.h"
+
+
+#define HASH_TABLE_MIN_SIZE 11
+#define HASH_TABLE_MAX_SIZE 13845163
+
+
+typedef struct _GHashNode GHashNode;
+
+struct _GHashNode
+{
+ gpointer key;
+ gpointer value;
+ GHashNode *next;
+ guint key_hash;
+};
+
+struct _GHashTable
+{
+ gint size;
+ gint nnodes;
+ GHashNode **nodes;
+ GHashFunc hash_func;
+ GEqualFunc key_equal_func;
+ volatile gint ref_count;
+#ifndef G_DISABLE_ASSERT
+ /*
+ * Tracks the structure of the hash table, not its contents: is only
+ * incremented when a node is added or removed (is not incremented
+ * when the key or data of a node is modified).
+ */
+ int version;
+#endif
+ GDestroyNotify key_destroy_func;
+ GDestroyNotify value_destroy_func;
+};
+
+typedef struct
+{
+ GHashTable *hash_table;
+ GHashNode *prev_node;
+ GHashNode *node;
+ int position;
+ gboolean pre_advanced;
+ int version;
+} RealIter;
+
+/*
+ * g_hash_table_lookup_node:
+ * @hash_table: our #GHashTable
+ * @key: the key to lookup against
+ * @hash_return: optional key hash return location
+ * Return value: a pointer to the described #GHashNode pointer
+ *
+ * Performs a lookup in the hash table. Virtually all hash operations
+ * will use this function internally.
+ *
+ * This function first computes the hash value of the key using the
+ * user's hash function.
+ *
+ * If an entry in the table matching @key is found then this function
+ * returns a pointer to the pointer to that entry in the table. In
+ * the case that the entry is at the head of a chain, this pointer
+ * will be an item in the nodes[] array. In the case that the entry
+ * is not at the head of a chain, this pointer will be the ->next
+ * pointer on the node that preceeds it.
+ *
+ * In the case that no matching entry exists in the table, a pointer
+ * to a %NULL pointer will be returned. To insert a item, this %NULL
+ * pointer should be updated to point to the new #GHashNode.
+ *
+ * If @hash_return is a pass-by-reference parameter. If it is
+ * non-%NULL then the computed hash value is returned. This is to
+ * save insertions from having to compute the hash record again for
+ * the new record.
+ */
+static inline GHashNode **
+g_hash_table_lookup_node (GHashTable *hash_table,
+ gconstpointer key,
+ guint *hash_return)
+{
+ GHashNode **node_ptr, *node;
+ guint hash_value;
+
+ hash_value = (* hash_table->hash_func) (key);
+ node_ptr = &hash_table->nodes[hash_value % hash_table->size];
+
+ if (hash_return)
+ *hash_return = hash_value;
+
+ /* Hash table lookup needs to be fast.
+ * We therefore remove the extra conditional of testing
+ * whether to call the key_equal_func or not from
+ * the inner loop.
+ *
+ * Additional optimisation: first check if our full hash
+ * values are equal so we can avoid calling the full-blown
+ * key equality function in most cases.
+ */
+ if (hash_table->key_equal_func)
+ {
+ while ((node = *node_ptr))
+ {
+ if (node->key_hash == hash_value &&
+ hash_table->key_equal_func (node->key, key))
+ break;
+
+ node_ptr = &(*node_ptr)->next;
+ }
+ }
+ else
+ {
+ while ((node = *node_ptr))
+ {
+ if (node->key == key)
+ break;
+
+ node_ptr = &(*node_ptr)->next;
+ }
+ }
+
+ return node_ptr;
+}
+
+/*
+ * g_hash_table_remove_node:
+ * @hash_table: our #GHashTable
+ * @node_ptr_ptr: a pointer to the return value from
+ * g_hash_table_lookup_node()
+ * @notify: %TRUE if the destroy notify handlers are to be called
+ *
+ * Removes a node from the hash table and updates the node count. The
+ * node is freed. No table resize is performed.
+ *
+ * If @notify is %TRUE then the destroy notify functions are called
+ * for the key and value of the hash node.
+ *
+ * @node_ptr_ptr is a pass-by-reference in/out parameter. When the
+ * function is called, it should point to the pointer to the node to
+ * remove. This level of indirection is required so that the pointer
+ * may be updated appropriately once the node has been removed.
+ *
+ * Before the function returns, the pointer at @node_ptr_ptr will be
+ * updated to point to the position in the table that contains the
+ * pointer to the "next" node in the chain. This makes this function
+ * convenient to use from functions that iterate over the entire
+ * table. If there is no further item in the chain then the
+ * #GHashNode pointer will be %NULL (ie: **node_ptr_ptr == %NULL).
+ *
+ * Since the pointer in the table to the removed node is replaced with
+ * either a pointer to the next node or a %NULL pointer as
+ * appropriate, the pointer at the end of @node_ptr_ptr will never be
+ * modified at all. Stay tuned. :)
+ */
+static void
+g_hash_table_remove_node (GHashTable *hash_table,
+ GHashNode ***node_ptr_ptr,
+ gboolean notify)
+{
+ GHashNode **node_ptr, *node;
+
+ node_ptr = *node_ptr_ptr;
+ node = *node_ptr;
+
+ *node_ptr = node->next;
+
+ if (notify && hash_table->key_destroy_func)
+ hash_table->key_destroy_func (node->key);
+
+ if (notify && hash_table->value_destroy_func)
+ hash_table->value_destroy_func (node->value);
+
+ g_slice_free (GHashNode, node);
+
+ hash_table->nnodes--;
+}
+
+/*
+ * g_hash_table_remove_all_nodes:
+ * @hash_table: our #GHashTable
+ * @notify: %TRUE if the destroy notify handlers are to be called
+ *
+ * Removes all nodes from the table. Since this may be a precursor to
+ * freeing the table entirely, no resize is performed.
+ *
+ * If @notify is %TRUE then the destroy notify functions are called
+ * for the key and value of the hash node.
+ */
+static void
+g_hash_table_remove_all_nodes (GHashTable *hash_table,
+ gboolean notify)
+{
+ GHashNode **node_ptr;
+ int i;
+
+ for (i = 0; i < hash_table->size; i++)
+ for (node_ptr = &hash_table->nodes[i]; *node_ptr != NULL;)
+ g_hash_table_remove_node (hash_table, &node_ptr, notify);
+
+ hash_table->nnodes = 0;
+}
+
+/*
+ * g_hash_table_resize:
+ * @hash_table: our #GHashTable
+ *
+ * Resizes the hash table to the optimal size based on the number of
+ * nodes currently held. If you call this function then a resize will
+ * occur, even if one does not need to occur. Use
+ * g_hash_table_maybe_resize() instead.
+ */
+static void
+g_hash_table_resize (GHashTable *hash_table)
+{
+ GHashNode **new_nodes;
+ GHashNode *node;
+ GHashNode *next;
+ guint hash_val;
+ gint new_size;
+ gint i;
+
+ new_size = g_spaced_primes_closest (hash_table->nnodes);
+ new_size = CLAMP (new_size, HASH_TABLE_MIN_SIZE, HASH_TABLE_MAX_SIZE);
+
+ new_nodes = g_new0 (GHashNode*, new_size);
+
+ for (i = 0; i < hash_table->size; i++)
+ for (node = hash_table->nodes[i]; node; node = next)
+ {
+ next = node->next;
+
+ hash_val = node->key_hash % new_size;
+
+ node->next = new_nodes[hash_val];
+ new_nodes[hash_val] = node;
+ }
+
+ g_free (hash_table->nodes);
+ hash_table->nodes = new_nodes;
+ hash_table->size = new_size;
+}
+
+/*
+ * g_hash_table_maybe_resize:
+ * @hash_table: our #GHashTable
+ *
+ * Resizes the hash table, if needed.
+ *
+ * Essentially, calls g_hash_table_resize() if the table has strayed
+ * too far from its ideal size for its number of nodes.
+ */
+static inline void
+g_hash_table_maybe_resize (GHashTable *hash_table)
+{
+ gint nnodes = hash_table->nnodes;
+ gint size = hash_table->size;
+
+ if ((size >= 3 * nnodes && size > HASH_TABLE_MIN_SIZE) ||
+ (3 * size <= nnodes && size < HASH_TABLE_MAX_SIZE))
+ g_hash_table_resize (hash_table);
+}
+
+/**
+ * g_hash_table_new:
+ * @hash_func: a function to create a hash value from a key.
+ * Hash values are used to determine where keys are stored within the
+ * #GHashTable data structure. The g_direct_hash(), g_int_hash() and
+ * g_str_hash() functions are provided for some common types of keys.
+ * If hash_func is %NULL, g_direct_hash() is used.
+ * @key_equal_func: a function to check two keys for equality. This is
+ * used when looking up keys in the #GHashTable. The g_direct_equal(),
+ * g_int_equal() and g_str_equal() functions are provided for the most
+ * common types of keys. If @key_equal_func is %NULL, keys are compared
+ * directly in a similar fashion to g_direct_equal(), but without the
+ * overhead of a function call.
+ *
+ * Creates a new #GHashTable with a reference count of 1.
+ *
+ * Return value: a new #GHashTable.
+ **/
+GHashTable*
+g_hash_table_new (GHashFunc hash_func,
+ GEqualFunc key_equal_func)
+{
+ return g_hash_table_new_full (hash_func, key_equal_func, NULL, NULL);
+}
+
+
+/**
+ * g_hash_table_new_full:
+ * @hash_func: a function to create a hash value from a key.
+ * @key_equal_func: a function to check two keys for equality.
+ * @key_destroy_func: a function to free the memory allocated for the key
+ * used when removing the entry from the #GHashTable or %NULL if you
+ * don't want to supply such a function.
+ * @value_destroy_func: a function to free the memory allocated for the
+ * value used when removing the entry from the #GHashTable or %NULL if
+ * you don't want to supply such a function.
+ *
+ * Creates a new #GHashTable like g_hash_table_new() with a reference count
+ * of 1 and allows to specify functions to free the memory allocated for the
+ * key and value that get called when removing the entry from the #GHashTable.
+ *
+ * Return value: a new #GHashTable.
+ **/
+GHashTable*
+g_hash_table_new_full (GHashFunc hash_func,
+ GEqualFunc key_equal_func,
+ GDestroyNotify key_destroy_func,
+ GDestroyNotify value_destroy_func)
+{
+ GHashTable *hash_table;
+
+ hash_table = g_slice_new (GHashTable);
+ hash_table->size = HASH_TABLE_MIN_SIZE;
+ hash_table->nnodes = 0;
+ hash_table->hash_func = hash_func ? hash_func : g_direct_hash;
+ hash_table->key_equal_func = key_equal_func;
+ hash_table->ref_count = 1;
+#ifndef G_DISABLE_ASSERT
+ hash_table->version = 0;
+#endif
+ hash_table->key_destroy_func = key_destroy_func;
+ hash_table->value_destroy_func = value_destroy_func;
+ hash_table->nodes = g_new0 (GHashNode*, hash_table->size);
+
+ return hash_table;
+}
+
+/**
+ * g_hash_table_iter_init:
+ * @iter: an uninitialized #GHashTableIter.
+ * @hash_table: a #GHashTable.
+ *
+ * Initializes a key/value pair iterator and associates it with
+ * @hash_table. Modifying the hash table after calling this function
+ * invalidates the returned iterator.
+ * |[
+ * GHashTableIter iter;
+ * gpointer key, value;
+ *
+ * g_hash_table_iter_init (&iter, hash_table);
+ * while (g_hash_table_iter_next (&iter, &key, &value))
+ * {
+ * /&ast; do something with key and value &ast;/
+ * }
+ * ]|
+ *
+ * Since: 2.16
+ **/
+void
+g_hash_table_iter_init (GHashTableIter *iter,
+ GHashTable *hash_table)
+{
+ RealIter *ri = (RealIter *) iter;
+
+ g_return_if_fail (iter != NULL);
+ g_return_if_fail (hash_table != NULL);
+
+ ri->hash_table = hash_table;
+ ri->prev_node = NULL;
+ ri->node = NULL;
+ ri->position = -1;
+ ri->pre_advanced = FALSE;
+#ifndef G_DISABLE_ASSERT
+ ri->version = hash_table->version;
+#endif
+}
+
+/**
+ * g_hash_table_iter_next:
+ * @iter: an initialized #GHashTableIter.
+ * @key: a location to store the key, or %NULL.
+ * @value: a location to store the value, or %NULL.
+ *
+ * Advances @iter and retrieves the key and/or value that are now
+ * pointed to as a result of this advancement. If %FALSE is returned,
+ * @key and @value are not set, and the iterator becomes invalid.
+ *
+ * Return value: %FALSE if the end of the #GHashTable has been reached.
+ *
+ * Since: 2.16
+ **/
+gboolean
+g_hash_table_iter_next (GHashTableIter *iter,
+ gpointer *key,
+ gpointer *value)
+{
+ RealIter *ri = (RealIter *) iter;
+
+ g_return_val_if_fail (iter != NULL, FALSE);
+#ifndef G_DISABLE_ASSERT
+ g_return_val_if_fail (ri->version == ri->hash_table->version, FALSE);
+#endif
+
+ if (ri->pre_advanced)
+ {
+ ri->pre_advanced = FALSE;
+
+ if (ri->node == NULL)
+ return FALSE;
+ }
+ else
+ {
+ if (ri->node != NULL)
+ {
+ ri->prev_node = ri->node;
+ ri->node = ri->node->next;
+ }
+
+ while (ri->node == NULL)
+ {
+ ri->position++;
+ if (ri->position >= ri->hash_table->size)
+ return FALSE;
+
+ ri->prev_node = NULL;
+ ri->node = ri->hash_table->nodes[ri->position];
+ }
+ }
+
+ if (key != NULL)
+ *key = ri->node->key;
+ if (value != NULL)
+ *value = ri->node->value;
+
+ return TRUE;
+}
+
+/**
+ * g_hash_table_iter_get_hash_table:
+ * @iter: an initialized #GHashTableIter.
+ *
+ * Returns the #GHashTable associated with @iter.
+ *
+ * Return value: the #GHashTable associated with @iter.
+ *
+ * Since: 2.16
+ **/
+GHashTable *
+g_hash_table_iter_get_hash_table (GHashTableIter *iter)
+{
+ g_return_val_if_fail (iter != NULL, NULL);
+
+ return ((RealIter *) iter)->hash_table;
+}
+
+static void
+iter_remove_or_steal (RealIter *ri, gboolean notify)
+{
+ GHashNode *prev;
+ GHashNode *node;
+ int position;
+
+ g_return_if_fail (ri != NULL);
+#ifndef G_DISABLE_ASSERT
+ g_return_if_fail (ri->version == ri->hash_table->version);
+#endif
+ g_return_if_fail (ri->node != NULL);
+
+ prev = ri->prev_node;
+ node = ri->node;
+ position = ri->position;
+
+ /* pre-advance the iterator since we will remove the node */
+
+ ri->node = ri->node->next;
+ /* ri->prev_node is still the correct previous node */
+
+ while (ri->node == NULL)
+ {
+ ri->position++;
+ if (ri->position >= ri->hash_table->size)
+ break;
+
+ ri->prev_node = NULL;
+ ri->node = ri->hash_table->nodes[ri->position];
+ }
+
+ ri->pre_advanced = TRUE;
+
+ /* remove the node */
+
+ if (prev != NULL)
+ prev->next = node->next;
+ else
+ ri->hash_table->nodes[position] = node->next;
+
+ if (notify)
+ {
+ if (ri->hash_table->key_destroy_func)
+ ri->hash_table->key_destroy_func(node->key);
+ if (ri->hash_table->value_destroy_func)
+ ri->hash_table->value_destroy_func(node->value);
+ }
+
+ g_slice_free (GHashNode, node);
+
+ ri->hash_table->nnodes--;
+
+#ifndef G_DISABLE_ASSERT
+ ri->version++;
+ ri->hash_table->version++;
+#endif
+}
+
+/**
+ * g_hash_table_iter_remove():
+ * @iter: an initialized #GHashTableIter.
+ *
+ * Removes the key/value pair currently pointed to by the iterator
+ * from its associated #GHashTable. Can only be called after
+ * g_hash_table_iter_next() returned %TRUE, and cannot be called more
+ * than once for the same key/value pair.
+ *
+ * If the #GHashTable was created using g_hash_table_new_full(), the
+ * key and value are freed using the supplied destroy functions, otherwise
+ * you have to make sure that any dynamically allocated values are freed
+ * yourself.
+ *
+ * Since: 2.16
+ **/
+void
+g_hash_table_iter_remove (GHashTableIter *iter)
+{
+ iter_remove_or_steal ((RealIter *) iter, TRUE);
+}
+
+/**
+ * g_hash_table_iter_steal():
+ * @iter: an initialized #GHashTableIter.
+ *
+ * Removes the key/value pair currently pointed to by the iterator
+ * from its associated #GHashTable, without calling the key and value
+ * destroy functions. Can only be called after
+ * g_hash_table_iter_next() returned %TRUE, and cannot be called more
+ * than once for the same key/value pair.
+ *
+ * Since: 2.16
+ **/
+void
+g_hash_table_iter_steal (GHashTableIter *iter)
+{
+ iter_remove_or_steal ((RealIter *) iter, FALSE);
+}
+
+
+/**
+ * g_hash_table_ref:
+ * @hash_table: a valid #GHashTable.
+ *
+ * Atomically increments the reference count of @hash_table by one.
+ * This function is MT-safe and may be called from any thread.
+ *
+ * Return value: the passed in #GHashTable.
+ *
+ * Since: 2.10
+ **/
+GHashTable*
+g_hash_table_ref (GHashTable *hash_table)
+{
+ g_return_val_if_fail (hash_table != NULL, NULL);
+ g_return_val_if_fail (hash_table->ref_count > 0, hash_table);
+
+ g_atomic_int_add (&hash_table->ref_count, 1);
+ return hash_table;
+}
+
+/**
+ * g_hash_table_unref:
+ * @hash_table: a valid #GHashTable.
+ *
+ * Atomically decrements the reference count of @hash_table by one.
+ * If the reference count drops to 0, all keys and values will be
+ * destroyed, and all memory allocated by the hash table is released.
+ * This function is MT-safe and may be called from any thread.
+ *
+ * Since: 2.10
+ **/
+void
+g_hash_table_unref (GHashTable *hash_table)
+{
+ g_return_if_fail (hash_table != NULL);
+ g_return_if_fail (hash_table->ref_count > 0);
+
+ if (g_atomic_int_exchange_and_add (&hash_table->ref_count, -1) - 1 == 0)
+ {
+ g_hash_table_remove_all_nodes (hash_table, TRUE);
+ g_free (hash_table->nodes);
+ g_slice_free (GHashTable, hash_table);
+ }
+}
+
+/**
+ * g_hash_table_destroy:
+ * @hash_table: a #GHashTable.
+ *
+ * Destroys all keys and values in the #GHashTable and decrements its
+ * reference count by 1. If keys and/or values are dynamically allocated,
+ * you should either free them first or create the #GHashTable with destroy
+ * notifiers using g_hash_table_new_full(). In the latter case the destroy
+ * functions you supplied will be called on all keys and values during the
+ * destruction phase.
+ **/
+void
+g_hash_table_destroy (GHashTable *hash_table)
+{
+ g_return_if_fail (hash_table != NULL);
+ g_return_if_fail (hash_table->ref_count > 0);
+
+ g_hash_table_remove_all (hash_table);
+ g_hash_table_unref (hash_table);
+}
+
+/**
+ * g_hash_table_lookup:
+ * @hash_table: a #GHashTable.
+ * @key: the key to look up.
+ *
+ * Looks up a key in a #GHashTable. Note that this function cannot
+ * distinguish between a key that is not present and one which is present
+ * and has the value %NULL. If you need this distinction, use
+ * g_hash_table_lookup_extended().
+ *
+ * Return value: the associated value, or %NULL if the key is not found.
+ **/
+gpointer
+g_hash_table_lookup (GHashTable *hash_table,
+ gconstpointer key)
+{
+ GHashNode *node;
+
+ g_return_val_if_fail (hash_table != NULL, NULL);
+
+ node = *g_hash_table_lookup_node (hash_table, key, NULL);
+
+ return node ? node->value : NULL;
+}
+
+/**
+ * g_hash_table_lookup_extended:
+ * @hash_table: a #GHashTable.
+ * @lookup_key: the key to look up.
+ * @orig_key: returns the original key.
+ * @value: returns the value associated with the key.
+ *
+ * Looks up a key in the #GHashTable, returning the original key and the
+ * associated value and a #gboolean which is %TRUE if the key was found. This
+ * is useful if you need to free the memory allocated for the original key,
+ * for example before calling g_hash_table_remove().
+ *
+ * Return value: %TRUE if the key was found in the #GHashTable.
+ **/
+gboolean
+g_hash_table_lookup_extended (GHashTable *hash_table,
+ gconstpointer lookup_key,
+ gpointer *orig_key,
+ gpointer *value)
+{
+ GHashNode *node;
+
+ g_return_val_if_fail (hash_table != NULL, FALSE);
+
+ node = *g_hash_table_lookup_node (hash_table, lookup_key, NULL);
+
+ if (node == NULL)
+ return FALSE;
+
+ if (orig_key)
+ *orig_key = node->key;
+
+ if (value)
+ *value = node->value;
+
+ return TRUE;
+}
+
+/*
+ * g_hash_table_insert_internal:
+ * @hash_table: our #GHashTable
+ * @key: the key to insert
+ * @value: the value to insert
+ * @keep_new_key: if %TRUE and this key already exists in the table
+ * then call the destroy notify function on the old key. If %FALSE
+ * then call the destroy notify function on the new key.
+ *
+ * Implements the common logic for the g_hash_table_insert() and
+ * g_hash_table_replace() functions.
+ *
+ * Do a lookup of @key. If it is found, replace it with the new
+ * @value (and perhaps the new @key). If it is not found, create a
+ * new node.
+ */
+static void
+g_hash_table_insert_internal (GHashTable *hash_table,
+ gpointer key,
+ gpointer value,
+ gboolean keep_new_key)
+{
+ GHashNode **node_ptr, *node;
+ guint key_hash;
+
+ g_return_if_fail (hash_table != NULL);
+ g_return_if_fail (hash_table->ref_count > 0);
+
+ node_ptr = g_hash_table_lookup_node (hash_table, key, &key_hash);
+
+ if ((node = *node_ptr))
+ {
+ if (keep_new_key)
+ {
+ if (hash_table->key_destroy_func)
+ hash_table->key_destroy_func (node->key);
+ node->key = key;
+ }
+ else
+ {
+ if (hash_table->key_destroy_func)
+ hash_table->key_destroy_func (key);
+ }
+
+ if (hash_table->value_destroy_func)
+ hash_table->value_destroy_func (node->value);
+
+ node->value = value;
+ }
+ else
+ {
+ node = g_slice_new (GHashNode);
+
+ node->key = key;
+ node->value = value;
+ node->key_hash = key_hash;
+ node->next = NULL;
+
+ *node_ptr = node;
+ hash_table->nnodes++;
+ g_hash_table_maybe_resize (hash_table);
+
+#ifndef G_DISABLE_ASSERT
+ hash_table->version++;
+#endif
+ }
+}
+
+/**
+ * g_hash_table_insert:
+ * @hash_table: a #GHashTable.
+ * @key: a key to insert.
+ * @value: the value to associate with the key.
+ *
+ * Inserts a new key and value into a #GHashTable.
+ *
+ * If the key already exists in the #GHashTable its current value is replaced
+ * with the new value. If you supplied a @value_destroy_func when creating the
+ * #GHashTable, the old value is freed using that function. If you supplied
+ * a @key_destroy_func when creating the #GHashTable, the passed key is freed
+ * using that function.
+ **/
+void
+g_hash_table_insert (GHashTable *hash_table,
+ gpointer key,
+ gpointer value)
+{
+ g_hash_table_insert_internal (hash_table, key, value, FALSE);
+}
+
+/**
+ * g_hash_table_replace:
+ * @hash_table: a #GHashTable.
+ * @key: a key to insert.
+ * @value: the value to associate with the key.
+ *
+ * Inserts a new key and value into a #GHashTable similar to
+ * g_hash_table_insert(). The difference is that if the key already exists
+ * in the #GHashTable, it gets replaced by the new key. If you supplied a
+ * @value_destroy_func when creating the #GHashTable, the old value is freed
+ * using that function. If you supplied a @key_destroy_func when creating the
+ * #GHashTable, the old key is freed using that function.
+ **/
+void
+g_hash_table_replace (GHashTable *hash_table,
+ gpointer key,
+ gpointer value)
+{
+ g_hash_table_insert_internal (hash_table, key, value, TRUE);
+}
+
+/*
+ * g_hash_table_remove_internal:
+ * @hash_table: our #GHashTable
+ * @key: the key to remove
+ * @notify: %TRUE if the destroy notify handlers are to be called
+ * Return value: %TRUE if a node was found and removed, else %FALSE
+ *
+ * Implements the common logic for the g_hash_table_remove() and
+ * g_hash_table_steal() functions.
+ *
+ * Do a lookup of @key and remove it if it is found, calling the
+ * destroy notify handlers only if @notify is %TRUE.
+ */
+static gboolean
+g_hash_table_remove_internal (GHashTable *hash_table,
+ gconstpointer key,
+ gboolean notify)
+{
+ GHashNode **node_ptr;
+
+ g_return_val_if_fail (hash_table != NULL, FALSE);
+
+ node_ptr = g_hash_table_lookup_node (hash_table, key, NULL);
+ if (*node_ptr == NULL)
+ return FALSE;
+
+ g_hash_table_remove_node (hash_table, &node_ptr, notify);
+ g_hash_table_maybe_resize (hash_table);
+
+#ifndef G_DISABLE_ASSERT
+ hash_table->version++;
+#endif
+
+ return TRUE;
+}
+
+/**
+ * g_hash_table_remove:
+ * @hash_table: a #GHashTable.
+ * @key: the key to remove.
+ *
+ * Removes a key and its associated value from a #GHashTable.
+ *
+ * If the #GHashTable was created using g_hash_table_new_full(), the
+ * key and value are freed using the supplied destroy functions, otherwise
+ * you have to make sure that any dynamically allocated values are freed
+ * yourself.
+ *
+ * Return value: %TRUE if the key was found and removed from the #GHashTable.
+ **/
+gboolean
+g_hash_table_remove (GHashTable *hash_table,
+ gconstpointer key)
+{
+ return g_hash_table_remove_internal (hash_table, key, TRUE);
+}
+
+/**
+ * g_hash_table_steal:
+ * @hash_table: a #GHashTable.
+ * @key: the key to remove.
+ *
+ * Removes a key and its associated value from a #GHashTable without
+ * calling the key and value destroy functions.
+ *
+ * Return value: %TRUE if the key was found and removed from the #GHashTable.
+ **/
+gboolean
+g_hash_table_steal (GHashTable *hash_table,
+ gconstpointer key)
+{
+ return g_hash_table_remove_internal (hash_table, key, FALSE);
+}
+
+/**
+ * g_hash_table_remove_all:
+ * @hash_table: a #GHashTable
+ *
+ * Removes all keys and their associated values from a #GHashTable.
+ *
+ * If the #GHashTable was created using g_hash_table_new_full(), the keys
+ * and values are freed using the supplied destroy functions, otherwise you
+ * have to make sure that any dynamically allocated values are freed
+ * yourself.
+ *
+ * Since: 2.12
+ **/
+void
+g_hash_table_remove_all (GHashTable *hash_table)
+{
+ g_return_if_fail (hash_table != NULL);
+
+#ifndef G_DISABLE_ASSERT
+ if (hash_table->nnodes != 0)
+ hash_table->version++;
+#endif
+
+ g_hash_table_remove_all_nodes (hash_table, TRUE);
+ g_hash_table_maybe_resize (hash_table);
+}
+
+/**
+ * g_hash_table_steal_all:
+ * @hash_table: a #GHashTable.
+ *
+ * Removes all keys and their associated values from a #GHashTable
+ * without calling the key and value destroy functions.
+ *
+ * Since: 2.12
+ **/
+void
+g_hash_table_steal_all (GHashTable *hash_table)
+{
+ g_return_if_fail (hash_table != NULL);
+
+#ifndef G_DISABLE_ASSERT
+ if (hash_table->nnodes != 0)
+ hash_table->version++;
+#endif
+
+ g_hash_table_remove_all_nodes (hash_table, FALSE);
+ g_hash_table_maybe_resize (hash_table);
+}
+
+/*
+ * g_hash_table_foreach_remove_or_steal:
+ * @hash_table: our #GHashTable
+ * @func: the user's callback function
+ * @user_data: data for @func
+ * @notify: %TRUE if the destroy notify handlers are to be called
+ *
+ * Implements the common logic for g_hash_table_foreach_remove() and
+ * g_hash_table_foreach_steal().
+ *
+ * Iterates over every node in the table, calling @func with the key
+ * and value of the node (and @user_data). If @func returns %TRUE the
+ * node is removed from the table.
+ *
+ * If @notify is true then the destroy notify handlers will be called
+ * for each removed node.
+ */
+static guint
+g_hash_table_foreach_remove_or_steal (GHashTable *hash_table,
+ GHRFunc func,
+ gpointer user_data,
+ gboolean notify)
+{
+ GHashNode *node, **node_ptr;
+ guint deleted = 0;
+ gint i;
+
+ for (i = 0; i < hash_table->size; i++)
+ for (node_ptr = &hash_table->nodes[i]; (node = *node_ptr) != NULL;)
+ if ((* func) (node->key, node->value, user_data))
+ {
+ g_hash_table_remove_node (hash_table, &node_ptr, notify);
+ deleted++;
+ }
+ else
+ node_ptr = &node->next;
+
+ g_hash_table_maybe_resize (hash_table);
+
+#ifndef G_DISABLE_ASSERT
+ if (deleted > 0)
+ hash_table->version++;
+#endif
+
+ return deleted;
+}
+
+/**
+ * g_hash_table_foreach_remove:
+ * @hash_table: a #GHashTable.
+ * @func: the function to call for each key/value pair.
+ * @user_data: user data to pass to the function.
+ *
+ * Calls the given function for each key/value pair in the #GHashTable.
+ * If the function returns %TRUE, then the key/value pair is removed from the
+ * #GHashTable. If you supplied key or value destroy functions when creating
+ * the #GHashTable, they are used to free the memory allocated for the removed
+ * keys and values.
+ *
+ * See #GHashTableIterator for an alternative way to loop over the
+ * key/value pairs in the hash table.
+ *
+ * Return value: the number of key/value pairs removed.
+ **/
+guint
+g_hash_table_foreach_remove (GHashTable *hash_table,
+ GHRFunc func,
+ gpointer user_data)
+{
+ g_return_val_if_fail (hash_table != NULL, 0);
+ g_return_val_if_fail (func != NULL, 0);
+
+ return g_hash_table_foreach_remove_or_steal (hash_table, func, user_data, TRUE);
+}
+
+/**
+ * g_hash_table_foreach_steal:
+ * @hash_table: a #GHashTable.
+ * @func: the function to call for each key/value pair.
+ * @user_data: user data to pass to the function.
+ *
+ * Calls the given function for each key/value pair in the #GHashTable.
+ * If the function returns %TRUE, then the key/value pair is removed from the
+ * #GHashTable, but no key or value destroy functions are called.
+ *
+ * See #GHashTableIterator for an alternative way to loop over the
+ * key/value pairs in the hash table.
+ *
+ * Return value: the number of key/value pairs removed.
+ **/
+guint
+g_hash_table_foreach_steal (GHashTable *hash_table,
+ GHRFunc func,
+ gpointer user_data)
+{
+ g_return_val_if_fail (hash_table != NULL, 0);
+ g_return_val_if_fail (func != NULL, 0);
+
+ return g_hash_table_foreach_remove_or_steal (hash_table, func, user_data, FALSE);
+}
+
+/**
+ * g_hash_table_foreach:
+ * @hash_table: a #GHashTable.
+ * @func: the function to call for each key/value pair.
+ * @user_data: user data to pass to the function.
+ *
+ * Calls the given function for each of the key/value pairs in the
+ * #GHashTable. The function is passed the key and value of each
+ * pair, and the given @user_data parameter. The hash table may not
+ * be modified while iterating over it (you can't add/remove
+ * items). To remove all items matching a predicate, use
+ * g_hash_table_foreach_remove().
+ *
+ * See g_hash_table_find() for performance caveats for linear
+ * order searches in contrast to g_hash_table_lookup().
+ **/
+void
+g_hash_table_foreach (GHashTable *hash_table,
+ GHFunc func,
+ gpointer user_data)
+{
+ GHashNode *node;
+ gint i;
+
+ g_return_if_fail (hash_table != NULL);
+ g_return_if_fail (func != NULL);
+
+ for (i = 0; i < hash_table->size; i++)
+ for (node = hash_table->nodes[i]; node; node = node->next)
+ (* func) (node->key, node->value, user_data);
+}
+
+/**
+ * g_hash_table_find:
+ * @hash_table: a #GHashTable.
+ * @predicate: function to test the key/value pairs for a certain property.
+ * @user_data: user data to pass to the function.
+ *
+ * Calls the given function for key/value pairs in the #GHashTable until
+ * @predicate returns %TRUE. The function is passed the key and value of
+ * each pair, and the given @user_data parameter. The hash table may not
+ * be modified while iterating over it (you can't add/remove items).
+ *
+ * Note, that hash tables are really only optimized for forward lookups,
+ * i.e. g_hash_table_lookup().
+ * So code that frequently issues g_hash_table_find() or
+ * g_hash_table_foreach() (e.g. in the order of once per every entry in a
+ * hash table) should probably be reworked to use additional or different
+ * data structures for reverse lookups (keep in mind that an O(n) find/foreach
+ * operation issued for all n values in a hash table ends up needing O(n*n)
+ * operations).
+ *
+ * Return value: The value of the first key/value pair is returned, for which
+ * func evaluates to %TRUE. If no pair with the requested property is found,
+ * %NULL is returned.
+ *
+ * Since: 2.4
+ **/
+gpointer
+g_hash_table_find (GHashTable *hash_table,
+ GHRFunc predicate,
+ gpointer user_data)
+{
+ GHashNode *node;
+ gint i;
+
+ g_return_val_if_fail (hash_table != NULL, NULL);
+ g_return_val_if_fail (predicate != NULL, NULL);
+
+ for (i = 0; i < hash_table->size; i++)
+ for (node = hash_table->nodes[i]; node; node = node->next)
+ if (predicate (node->key, node->value, user_data))
+ return node->value;
+ return NULL;
+}
+
+/**
+ * g_hash_table_size:
+ * @hash_table: a #GHashTable.
+ *
+ * Returns the number of elements contained in the #GHashTable.
+ *
+ * Return value: the number of key/value pairs in the #GHashTable.
+ **/
+guint
+g_hash_table_size (GHashTable *hash_table)
+{
+ g_return_val_if_fail (hash_table != NULL, 0);
+
+ return hash_table->nnodes;
+}
+
+/**
+ * g_hash_table_get_keys:
+ * @hash_table: a #GHashTable
+ *
+ * Retrieves every key inside @hash_table. The returned data is valid
+ * until @hash_table is modified.
+ *
+ * Return value: a #GList containing all the keys inside the hash
+ * table. The content of the list is owned by the hash table and
+ * should not be modified or freed. Use g_list_free() when done
+ * using the list.
+ *
+ * Since: 2.14
+ */
+GList *
+g_hash_table_get_keys (GHashTable *hash_table)
+{
+ GHashNode *node;
+ gint i;
+ GList *retval;
+
+ g_return_val_if_fail (hash_table != NULL, NULL);
+
+ retval = NULL;
+ for (i = 0; i < hash_table->size; i++)
+ for (node = hash_table->nodes[i]; node; node = node->next)
+ retval = g_list_prepend (retval, node->key);
+
+ return retval;
+}
+
+/**
+ * g_hash_table_get_values:
+ * @hash_table: a #GHashTable
+ *
+ * Retrieves every value inside @hash_table. The returned data is
+ * valid until @hash_table is modified.
+ *
+ * Return value: a #GList containing all the values inside the hash
+ * table. The content of the list is owned by the hash table and
+ * should not be modified or freed. Use g_list_free() when done
+ * using the list.
+ *
+ * Since: 2.14
+ */
+GList *
+g_hash_table_get_values (GHashTable *hash_table)
+{
+ GHashNode *node;
+ gint i;
+ GList *retval;
+
+ g_return_val_if_fail (hash_table != NULL, NULL);
+
+ retval = NULL;
+ for (i = 0; i < hash_table->size; i++)
+ for (node = hash_table->nodes[i]; node; node = node->next)
+ retval = g_list_prepend (retval, node->value);
+
+ return retval;
+}
+
+#define __G_HASH_C__
+#include "galiasdef.c"
diff --git a/support/glib/ghash.h b/support/glib/ghash.h
new file mode 100644
index 00000000..afdd0729
--- /dev/null
+++ b/support/glib/ghash.h
@@ -0,0 +1,145 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#ifndef __G_HASH_H__
+#define __G_HASH_H__
+
+#include <glib/gtypes.h>
+#include <glib/glist.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GHashTable GHashTable;
+
+typedef gboolean (*GHRFunc) (gpointer key,
+ gpointer value,
+ gpointer user_data);
+
+typedef struct _GHashTableIter GHashTableIter;
+
+struct _GHashTableIter
+{
+ /*< private >*/
+ gpointer dummy1;
+ gpointer dummy2;
+ gpointer dummy3;
+ int dummy4;
+ gboolean dummy5;
+ gpointer dummy6;
+};
+
+/* Hash tables
+ */
+GHashTable* g_hash_table_new (GHashFunc hash_func,
+ GEqualFunc key_equal_func);
+GHashTable* g_hash_table_new_full (GHashFunc hash_func,
+ GEqualFunc key_equal_func,
+ GDestroyNotify key_destroy_func,
+ GDestroyNotify value_destroy_func);
+void g_hash_table_destroy (GHashTable *hash_table);
+void g_hash_table_insert (GHashTable *hash_table,
+ gpointer key,
+ gpointer value);
+void g_hash_table_replace (GHashTable *hash_table,
+ gpointer key,
+ gpointer value);
+gboolean g_hash_table_remove (GHashTable *hash_table,
+ gconstpointer key);
+void g_hash_table_remove_all (GHashTable *hash_table);
+gboolean g_hash_table_steal (GHashTable *hash_table,
+ gconstpointer key);
+void g_hash_table_steal_all (GHashTable *hash_table);
+gpointer g_hash_table_lookup (GHashTable *hash_table,
+ gconstpointer key);
+gboolean g_hash_table_lookup_extended (GHashTable *hash_table,
+ gconstpointer lookup_key,
+ gpointer *orig_key,
+ gpointer *value);
+void g_hash_table_foreach (GHashTable *hash_table,
+ GHFunc func,
+ gpointer user_data);
+gpointer g_hash_table_find (GHashTable *hash_table,
+ GHRFunc predicate,
+ gpointer user_data);
+guint g_hash_table_foreach_remove (GHashTable *hash_table,
+ GHRFunc func,
+ gpointer user_data);
+guint g_hash_table_foreach_steal (GHashTable *hash_table,
+ GHRFunc func,
+ gpointer user_data);
+guint g_hash_table_size (GHashTable *hash_table);
+GList * g_hash_table_get_keys (GHashTable *hash_table);
+GList * g_hash_table_get_values (GHashTable *hash_table);
+
+void g_hash_table_iter_init (GHashTableIter *iter,
+ GHashTable *hash_table);
+gboolean g_hash_table_iter_next (GHashTableIter *iter,
+ gpointer *key,
+ gpointer *value);
+GHashTable* g_hash_table_iter_get_hash_table (GHashTableIter *iter);
+void g_hash_table_iter_remove (GHashTableIter *iter);
+void g_hash_table_iter_steal (GHashTableIter *iter);
+
+/* keeping hash tables alive */
+GHashTable* g_hash_table_ref (GHashTable *hash_table);
+void g_hash_table_unref (GHashTable *hash_table);
+
+#ifndef G_DISABLE_DEPRECATED
+
+/* The following two functions are deprecated and will be removed in
+ * the next major release. They do no good. */
+#define g_hash_table_freeze(hash_table) ((void)0)
+#define g_hash_table_thaw(hash_table) ((void)0)
+
+#endif /* G_DISABLE_DEPRECATED */
+
+/* Hash Functions
+ */
+gboolean g_str_equal (gconstpointer v1,
+ gconstpointer v2);
+guint g_str_hash (gconstpointer v);
+
+gboolean g_int_equal (gconstpointer v1,
+ gconstpointer v2);
+guint g_int_hash (gconstpointer v);
+
+/* This "hash" function will just return the key's address as an
+ * unsigned integer. Useful for hashing on plain addresses or
+ * simple integer values.
+ * Passing NULL into g_hash_table_new() as GHashFunc has the
+ * same effect as passing g_direct_hash().
+ */
+guint g_direct_hash (gconstpointer v) G_GNUC_CONST;
+gboolean g_direct_equal (gconstpointer v1,
+ gconstpointer v2) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __G_HASH_H__ */
diff --git a/support/glib/glib.h b/support/glib/glib.h
new file mode 100644
index 00000000..34901949
--- /dev/null
+++ b/support/glib/glib.h
@@ -0,0 +1,40 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_LIB_H__
+#define __G_LIB_H__
+
+#define __GLIB_H_INSIDE__
+#include <glib/fake.h>
+#include <glib/ghash.h>
+#include <glib/gerror.h>
+#include <glib/gmessages.h>
+#include <glib/gstrfuncs.h>
+#include <glib/gunicode.h>
+
+#undef __GLIB_H_INSIDE__
+
+#endif /* __G_LIB_H__ */
diff --git a/support/glib/glib_init.c b/support/glib/glib_init.c
new file mode 100644
index 00000000..32be387d
--- /dev/null
+++ b/support/glib/glib_init.c
@@ -0,0 +1,6 @@
+#include "plugin.h"
+
+void
+plugin_init(void)
+{
+}
diff --git a/support/glib/glibconfig.h b/support/glib/glibconfig.h
new file mode 100644
index 00000000..ac133487
--- /dev/null
+++ b/support/glib/glibconfig.h
@@ -0,0 +1,264 @@
+/* glibconfig.h.win32.in Merged from two versions generated by configure for gcc and MSVC. */
+/* glibconfig.h
+ *
+ * This is a generated file. Please modify 'configure.in'
+ */
+
+#ifndef __G_LIBCONFIG_H__
+#define __G_LIBCONFIG_H__
+
+#include <glib/gmacros.h>
+
+#include <limits.h>
+#include <float.h>
+#include "config.h"
+
+G_BEGIN_DECLS
+
+#define G_MINFLOAT FLT_MIN
+#define G_MAXFLOAT FLT_MAX
+#define G_MINDOUBLE DBL_MIN
+#define G_MAXDOUBLE DBL_MAX
+#define G_MINSHORT SHRT_MIN
+#define G_MAXSHORT SHRT_MAX
+#define G_MAXUSHORT USHRT_MAX
+#define G_MININT INT_MIN
+#define G_MAXINT INT_MAX
+#define G_MAXUINT UINT_MAX
+#define G_MINLONG LONG_MIN
+#define G_MAXLONG LONG_MAX
+#define G_MAXULONG ULONG_MAX
+
+typedef signed char gint8;
+typedef unsigned char guint8;
+typedef signed short gint16;
+typedef unsigned short guint16;
+#define G_GINT16_MODIFIER "h"
+#define G_GINT16_FORMAT "hi"
+#define G_GUINT16_FORMAT "hu"
+typedef signed int gint32;
+typedef unsigned int guint32;
+#define G_GINT32_MODIFIER ""
+#define G_GINT32_FORMAT "i"
+#define G_GUINT32_FORMAT "u"
+#define G_HAVE_GINT64 1 /* deprecated, always true */
+
+#ifndef _MSC_VER
+G_GNUC_EXTENSION typedef signed long long gint64;
+G_GNUC_EXTENSION typedef unsigned long long guint64;
+#else /* _MSC_VER */
+typedef signed __int64 gint64;
+typedef unsigned __int64 guint64;
+#endif /* _MSC_VER */
+
+#ifndef _MSC_VER
+#define G_GINT64_CONSTANT(val) (G_GNUC_EXTENSION (val##LL))
+#else /* _MSC_VER */
+#define G_GINT64_CONSTANT(val) (val##i64)
+#endif /* _MSC_VER */
+#ifndef _MSC_VER
+#define G_GUINT64_CONSTANT(val) (G_GNUC_EXTENSION (val##ULL))
+#else /* _MSC_VER */
+#define G_GUINT64_CONSTANT(val) (val##Ui64)
+#endif /* _MSC_VER */
+#define G_GINT64_MODIFIER "I64"
+#define G_GINT64_FORMAT "I64i"
+#define G_GUINT64_FORMAT "I64u"
+
+#if defined(_WIN64) || defined(_M_X64) || defined(_M_AMD64)
+
+#define GLIB_SIZEOF_VOID_P 8
+#define GLIB_SIZEOF_LONG 4
+#define GLIB_SIZEOF_SIZE_T 8
+
+typedef signed long long gssize;
+typedef unsigned long long gsize;
+#define G_GSIZE_MODIFIER "I64"
+#define G_GSSIZE_FORMAT "I64d"
+#define G_GSIZE_FORMAT "I64u"
+
+#define G_MAXSIZE G_MAXUINT64
+#define G_MINSSIZE G_MININT64
+#define G_MAXSSIZE G_MAXINT64
+
+#else
+
+#define GLIB_SIZEOF_VOID_P 4
+#define GLIB_SIZEOF_LONG 4
+#define GLIB_SIZEOF_SIZE_T 4
+
+typedef signed int gssize;
+typedef unsigned int gsize;
+#define G_GSIZE_MODIFIER ""
+#define G_GSSIZE_FORMAT "i"
+#define G_GSIZE_FORMAT "u"
+
+#define G_MAXSIZE G_MAXUINT
+#define G_MINSSIZE G_MININT
+#define G_MAXSSIZE G_MAXINT
+
+#endif
+
+typedef gint64 goffset;
+#define G_MINOFFSET G_MININT64
+#define G_MAXOFFSET G_MAXINT64
+
+#ifndef _WIN64
+
+#define GPOINTER_TO_INT(p) ((gint) (p))
+#define GPOINTER_TO_UINT(p) ((guint) (p))
+
+#define GINT_TO_POINTER(i) ((gpointer) (i))
+#define GUINT_TO_POINTER(u) ((gpointer) (u))
+
+typedef signed int gintptr;
+typedef unsigned int guintptr;
+
+#else
+
+#define GPOINTER_TO_INT(p) ((gint) (gint64) (p))
+#define GPOINTER_TO_UINT(p) ((guint) (guint64) (p))
+
+#define GINT_TO_POINTER(i) ((gpointer) (gint64) (i))
+#define GUINT_TO_POINTER(u) ((gpointer) (guint64) (u))
+
+#ifndef _MSC_VER
+typedef signed long long gintptr;
+typedef unsigned long long guintptr;
+#else
+typedef signed __int64 gintptr;
+typedef unsigned __int64 guintptr;
+#endif
+
+#endif
+
+#ifdef NeXT /* @#%@! NeXTStep */
+# define g_ATEXIT(proc) (!atexit (proc))
+#else
+# define g_ATEXIT(proc) (atexit (proc))
+#endif
+
+#define g_memmove(dest,src,len) G_STMT_START { memmove ((dest), (src), (len)); } G_STMT_END
+
+#define GLIB_MAJOR_VERSION 2
+#define GLIB_MINOR_VERSION 18
+#define GLIB_MICRO_VERSION 1
+
+#ifdef HAVE_API_WIN32_BASE
+#define G_OS_WIN32
+#define G_PLATFORM_WIN32
+#endif
+
+
+#ifndef _MSC_VER
+#define G_VA_COPY va_copy
+#endif /* not _MSC_VER */
+
+#ifdef __cplusplus
+#define G_HAVE_INLINE 1
+#else /* !__cplusplus */
+#ifndef _MSC_VER
+#define G_HAVE_INLINE 1
+#endif /* _MSC_VER */
+#define G_HAVE___INLINE 1
+#if !defined(_MSC_VER) && !defined(__DMC__)
+#define G_HAVE___INLINE__ 1
+#endif /* !_MSC_VER and !__DMC__ */
+#endif /* !__cplusplus */
+
+#define G_CAN_INLINE 1
+
+#ifndef _MSC_VER
+#define G_HAVE_ISO_VARARGS 1
+
+/* gcc-2.95.x supports both gnu style and ISO varargs, but if -ansi
+ * is passed ISO vararg support is turned off, and there is no work
+ * around to turn it on, so we unconditionally turn it off.
+ */
+#if __GNUC__ == 2 && __GNUC_MINOR__ == 95
+# undef G_HAVE_ISO_VARARGS
+#endif
+
+#define G_HAVE_GNUC_VARARGS 1
+#else /* _MSC_VER */
+/* varargs macros available since msvc8 (vs2005) */
+# if _MSC_VER >= 1400
+# define G_HAVE_ISO_VARARGS 1
+# endif
+#endif /* not _MSC_VER */
+#define G_HAVE_GROWING_STACK 0
+
+#define G_GNUC_INTERNAL
+
+#if NOT_NEEDED_FOR_NAVIT
+#define G_THREADS_ENABLED
+#define G_THREADS_IMPL_WIN32
+#endif /* NOT_NEEDED_FOR_NAVIT */
+typedef struct _GMutex* GStaticMutex;
+#define G_STATIC_MUTEX_INIT NULL
+#define g_static_mutex_get_mutex(mutex) \
+ (g_static_mutex_get_mutex_impl_shortcut (mutex))
+/* This represents a system thread as used by the implementation. An
+ * alien implementaion, as loaded by g_thread_init can only count on
+ * "sizeof (gpointer)" bytes to store their info. We however need more
+ * for some of our native implementations. */
+typedef union _GSystemThread GSystemThread;
+union _GSystemThread
+{
+#ifndef _WIN64
+ char data[4];
+#else
+ char data[8];
+#endif
+ double dummy_double;
+ void *dummy_pointer;
+ long dummy_long;
+};
+
+#define GINT16_TO_LE(val) ((gint16) (val))
+#define GUINT16_TO_LE(val) ((guint16) (val))
+#define GINT16_TO_BE(val) ((gint16) GUINT16_SWAP_LE_BE (val))
+#define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val))
+#define GINT32_TO_LE(val) ((gint32) (val))
+#define GUINT32_TO_LE(val) ((guint32) (val))
+#define GINT32_TO_BE(val) ((gint32) GUINT32_SWAP_LE_BE (val))
+#define GUINT32_TO_BE(val) (GUINT32_SWAP_LE_BE (val))
+#define GINT64_TO_LE(val) ((gint64) (val))
+#define GUINT64_TO_LE(val) ((guint64) (val))
+#define GINT64_TO_BE(val) ((gint64) GUINT64_SWAP_LE_BE (val))
+#define GUINT64_TO_BE(val) (GUINT64_SWAP_LE_BE (val))
+#define GLONG_TO_LE(val) ((glong) GINT32_TO_LE (val))
+#define GULONG_TO_LE(val) ((gulong) GUINT32_TO_LE (val))
+#define GLONG_TO_BE(val) ((glong) GINT32_TO_BE (val))
+#define GULONG_TO_BE(val) ((gulong) GUINT32_TO_BE (val))
+#define GINT_TO_LE(val) ((gint) GINT32_TO_LE (val))
+#define GUINT_TO_LE(val) ((guint) GUINT32_TO_LE (val))
+#define GINT_TO_BE(val) ((gint) GINT32_TO_BE (val))
+#define GUINT_TO_BE(val) ((guint) GUINT32_TO_BE (val))
+#define G_BYTE_ORDER G_LITTLE_ENDIAN
+
+#define GLIB_SYSDEF_POLLIN =1
+#define GLIB_SYSDEF_POLLOUT =4
+#define GLIB_SYSDEF_POLLPRI =2
+#define GLIB_SYSDEF_POLLHUP =16
+#define GLIB_SYSDEF_POLLERR =8
+#define GLIB_SYSDEF_POLLNVAL =32
+
+#define G_MODULE_SUFFIX "dll"
+
+#define HAVE_GOOD_PRINTF
+#define NO_SYS_SIGLIST_DECL
+#define GLIB_STATIC_COMPILATION
+#define G_DISABLE_CHECKS
+/* A GPid is an abstraction for a process "handle". It is *not* an
+ * abstraction for a process identifier in general. GPid is used in
+ * GLib only for descendant processes spawned with the g_spawn*
+ * functions. On POSIX there is no "process handle" concept as such,
+ * but on Windows a GPid is a handle to a process, a kind of pointer,
+ * not a process identifier.
+ */
+typedef void * GPid;
+
+G_END_DECLS
+
+#endif /* GLIBCONFIG_H */
diff --git a/support/glib/glibintl.h b/support/glib/glibintl.h
new file mode 100644
index 00000000..7899488a
--- /dev/null
+++ b/support/glib/glibintl.h
@@ -0,0 +1,39 @@
+#ifndef __GLIBINTL_H__
+#define __GLIBINTL_H__
+
+#if NOT_NEEDED_FOR_NAVIT
+#ifndef SIZEOF_CHAR
+#error "config.h must be included prior to glibintl.h"
+#endif
+#endif /* NOT_NEEDED_FOR_NAVIT */
+
+G_CONST_RETURN gchar *glib_gettext (const gchar *str);
+
+#ifdef ENABLE_NLS
+
+#include <libintl.h>
+#define _(String) glib_gettext(String)
+/* Split out this in the code, but keep it in the same domain for now */
+#define P_(String) glib_gettext(String)
+
+#ifdef gettext_noop
+#define N_(String) gettext_noop(String)
+#else
+#define N_(String) (String)
+#endif
+#else /* NLS is disabled */
+#define _(String) (String)
+#define N_(String) (String)
+#define P_(String) (String)
+#define textdomain(String) (String)
+#define gettext(String) (String)
+#define dgettext(Domain,String) (String)
+#define dcgettext(Domain,String,Type) (String)
+#define dngettext(Domain,String1,String2,N) ((N) == 1 ? (String1) : (String2))
+#define bindtextdomain(Domain,Directory) (Domain)
+#endif
+
+/* not really I18N-related, but also a string marker macro */
+#define I_(string) g_intern_static_string (string)
+
+#endif /* __GLIBINTL_H__ */
diff --git a/support/glib/glist.c b/support/glib/glist.c
new file mode 100644
index 00000000..b607abd6
--- /dev/null
+++ b/support/glib/glist.c
@@ -0,0 +1,999 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+/*
+ * MT safe
+ */
+
+#include "config.h"
+
+#include "glib.h"
+#include "galias.h"
+
+
+void g_list_push_allocator (gpointer dummy) { /* present for binary compat only */ }
+void g_list_pop_allocator (void) { /* present for binary compat only */ }
+
+#define _g_list_alloc() g_slice_new (GList)
+#define _g_list_alloc0() g_slice_new0 (GList)
+#define _g_list_free1(list) g_slice_free (GList, list)
+
+GList*
+g_list_alloc (void)
+{
+ return _g_list_alloc0 ();
+}
+
+/**
+ * g_list_free:
+ * @list: a #GList
+ *
+ * Frees all of the memory used by a #GList.
+ * The freed elements are returned to the slice allocator.
+ *
+ * <note><para>
+ * If list elements contain dynamically-allocated memory,
+ * they should be freed first.
+ * </para></note>
+ */
+void
+g_list_free (GList *list)
+{
+ g_slice_free_chain (GList, list, next);
+}
+
+/**
+ * g_list_free_1:
+ * @list: a #GList element
+ *
+ * Frees one #GList element.
+ * It is usually used after g_list_remove_link().
+ */
+void
+g_list_free_1 (GList *list)
+{
+ _g_list_free1 (list);
+}
+
+/**
+ * g_list_append:
+ * @list: a pointer to a #GList
+ * @data: the data for the new element
+ *
+ * Adds a new element on to the end of the list.
+ *
+ * <note><para>
+ * The return value is the new start of the list, which
+ * may have changed, so make sure you store the new value.
+ * </para></note>
+ *
+ * <note><para>
+ * Note that g_list_append() has to traverse the entire list
+ * to find the end, which is inefficient when adding multiple
+ * elements. A common idiom to avoid the inefficiency is to prepend
+ * the elements and reverse the list when all elements have been added.
+ * </para></note>
+ *
+ * |[
+ * /&ast; Notice that these are initialized to the empty list. &ast;/
+ * GList *list = NULL, *number_list = NULL;
+ *
+ * /&ast; This is a list of strings. &ast;/
+ * list = g_list_append (list, "first");
+ * list = g_list_append (list, "second");
+ *
+ * /&ast; This is a list of integers. &ast;/
+ * number_list = g_list_append (number_list, GINT_TO_POINTER (27));
+ * number_list = g_list_append (number_list, GINT_TO_POINTER (14));
+ * ]|
+ *
+ * Returns: the new start of the #GList
+ */
+GList*
+g_list_append (GList *list,
+ gpointer data)
+{
+ GList *new_list;
+ GList *last;
+
+ new_list = _g_list_alloc ();
+ new_list->data = data;
+ new_list->next = NULL;
+
+ if (list)
+ {
+ last = g_list_last (list);
+ /* g_assert (last != NULL); */
+ last->next = new_list;
+ new_list->prev = last;
+
+ return list;
+ }
+ else
+ {
+ new_list->prev = NULL;
+ return new_list;
+ }
+}
+
+/**
+ * g_list_prepend:
+ * @list: a pointer to a #GList
+ * @data: the data for the new element
+ *
+ * Adds a new element on to the start of the list.
+ *
+ * <note><para>
+ * The return value is the new start of the list, which
+ * may have changed, so make sure you store the new value.
+ * </para></note>
+ *
+ * |[
+ * /&ast; Notice that it is initialized to the empty list. &ast;/
+ * GList *list = NULL;
+ * list = g_list_prepend (list, "last");
+ * list = g_list_prepend (list, "first");
+ * ]|
+ *
+ * Returns: the new start of the #GList
+ */
+GList*
+g_list_prepend (GList *list,
+ gpointer data)
+{
+ GList *new_list;
+
+ new_list = _g_list_alloc ();
+ new_list->data = data;
+ new_list->next = list;
+
+ if (list)
+ {
+ new_list->prev = list->prev;
+ if (list->prev)
+ list->prev->next = new_list;
+ list->prev = new_list;
+ }
+ else
+ new_list->prev = NULL;
+
+ return new_list;
+}
+
+/**
+ * g_list_insert:
+ * @list: a pointer to a #GList
+ * @data: the data for the new element
+ * @position: the position to insert the element. If this is
+ * negative, or is larger than the number of elements in the
+ * list, the new element is added on to the end of the list.
+ *
+ * Inserts a new element into the list at the given position.
+ *
+ * Returns: the new start of the #GList
+ */
+GList*
+g_list_insert (GList *list,
+ gpointer data,
+ gint position)
+{
+ GList *new_list;
+ GList *tmp_list;
+
+ if (position < 0)
+ return g_list_append (list, data);
+ else if (position == 0)
+ return g_list_prepend (list, data);
+
+ tmp_list = g_list_nth (list, position);
+ if (!tmp_list)
+ return g_list_append (list, data);
+
+ new_list = _g_list_alloc ();
+ new_list->data = data;
+ new_list->prev = tmp_list->prev;
+ if (tmp_list->prev)
+ tmp_list->prev->next = new_list;
+ new_list->next = tmp_list;
+ tmp_list->prev = new_list;
+
+ if (tmp_list == list)
+ return new_list;
+ else
+ return list;
+}
+
+/**
+ * g_list_insert_before:
+ * @list: a pointer to a #GList
+ * @sibling: the list element before which the new element
+ * is inserted or %NULL to insert at the end of the list
+ * @data: the data for the new element
+ *
+ * Inserts a new element into the list before the given position.
+ *
+ * Returns: the new start of the #GList
+ */
+GList*
+g_list_insert_before (GList *list,
+ GList *sibling,
+ gpointer data)
+{
+ if (!list)
+ {
+ list = g_list_alloc ();
+ list->data = data;
+ g_return_val_if_fail (sibling == NULL, list);
+ return list;
+ }
+ else if (sibling)
+ {
+ GList *node;
+
+ node = _g_list_alloc ();
+ node->data = data;
+ node->prev = sibling->prev;
+ node->next = sibling;
+ sibling->prev = node;
+ if (node->prev)
+ {
+ node->prev->next = node;
+ return list;
+ }
+ else
+ {
+ g_return_val_if_fail (sibling == list, node);
+ return node;
+ }
+ }
+ else
+ {
+ GList *last;
+
+ last = list;
+ while (last->next)
+ last = last->next;
+
+ last->next = _g_list_alloc ();
+ last->next->data = data;
+ last->next->prev = last;
+ last->next->next = NULL;
+
+ return list;
+ }
+}
+
+/**
+ * g_list_concat:
+ * @list1: a #GList
+ * @list2: the #GList to add to the end of the first #GList
+ *
+ * Adds the second #GList onto the end of the first #GList.
+ * Note that the elements of the second #GList are not copied.
+ * They are used directly.
+ *
+ * Returns: the start of the new #GList
+ */
+GList *
+g_list_concat (GList *list1, GList *list2)
+{
+ GList *tmp_list;
+
+ if (list2)
+ {
+ tmp_list = g_list_last (list1);
+ if (tmp_list)
+ tmp_list->next = list2;
+ else
+ list1 = list2;
+ list2->prev = tmp_list;
+ }
+
+ return list1;
+}
+
+/**
+ * g_list_remove:
+ * @list: a #GList
+ * @data: the data of the element to remove
+ *
+ * Removes an element from a #GList.
+ * If two elements contain the same data, only the first is removed.
+ * If none of the elements contain the data, the #GList is unchanged.
+ *
+ * Returns: the new start of the #GList
+ */
+GList*
+g_list_remove (GList *list,
+ gconstpointer data)
+{
+ GList *tmp;
+
+ tmp = list;
+ while (tmp)
+ {
+ if (tmp->data != data)
+ tmp = tmp->next;
+ else
+ {
+ if (tmp->prev)
+ tmp->prev->next = tmp->next;
+ if (tmp->next)
+ tmp->next->prev = tmp->prev;
+
+ if (list == tmp)
+ list = list->next;
+
+ _g_list_free1 (tmp);
+
+ break;
+ }
+ }
+ return list;
+}
+
+/**
+ * g_list_remove_all:
+ * @list: a #GList
+ * @data: data to remove
+ *
+ * Removes all list nodes with data equal to @data.
+ * Returns the new head of the list. Contrast with
+ * g_list_remove() which removes only the first node
+ * matching the given data.
+ *
+ * Returns: new head of @list
+ */
+GList*
+g_list_remove_all (GList *list,
+ gconstpointer data)
+{
+ GList *tmp = list;
+
+ while (tmp)
+ {
+ if (tmp->data != data)
+ tmp = tmp->next;
+ else
+ {
+ GList *next = tmp->next;
+
+ if (tmp->prev)
+ tmp->prev->next = next;
+ else
+ list = next;
+ if (next)
+ next->prev = tmp->prev;
+
+ _g_list_free1 (tmp);
+ tmp = next;
+ }
+ }
+ return list;
+}
+
+static inline GList*
+_g_list_remove_link (GList *list,
+ GList *link)
+{
+ if (link)
+ {
+ if (link->prev)
+ link->prev->next = link->next;
+ if (link->next)
+ link->next->prev = link->prev;
+
+ if (link == list)
+ list = list->next;
+
+ link->next = NULL;
+ link->prev = NULL;
+ }
+
+ return list;
+}
+
+/**
+ * g_list_remove_link:
+ * @list: a #GList
+ * @llink: an element in the #GList
+ *
+ * Removes an element from a #GList, without freeing the element.
+ * The removed element's prev and next links are set to %NULL, so
+ * that it becomes a self-contained list with one element.
+ *
+ * Returns: the new start of the #GList, without the element
+ */
+GList*
+g_list_remove_link (GList *list,
+ GList *llink)
+{
+ return _g_list_remove_link (list, llink);
+}
+
+/**
+ * g_list_delete_link:
+ * @list: a #GList
+ * @link_: node to delete from @list
+ *
+ * Removes the node link_ from the list and frees it.
+ * Compare this to g_list_remove_link() which removes the node
+ * without freeing it.
+ *
+ * Returns: the new head of @list
+ */
+GList*
+g_list_delete_link (GList *list,
+ GList *link_)
+{
+ list = _g_list_remove_link (list, link_);
+ _g_list_free1 (link_);
+
+ return list;
+}
+
+/**
+ * g_list_copy:
+ * @list: a #GList
+ *
+ * Copies a #GList.
+ *
+ * <note><para>
+ * Note that this is a "shallow" copy. If the list elements
+ * consist of pointers to data, the pointers are copied but
+ * the actual data is not.
+ * </para></note>
+ *
+ * Returns: a copy of @list
+ */
+GList*
+g_list_copy (GList *list)
+{
+ GList *new_list = NULL;
+
+ if (list)
+ {
+ GList *last;
+
+ new_list = _g_list_alloc ();
+ new_list->data = list->data;
+ new_list->prev = NULL;
+ last = new_list;
+ list = list->next;
+ while (list)
+ {
+ last->next = _g_list_alloc ();
+ last->next->prev = last;
+ last = last->next;
+ last->data = list->data;
+ list = list->next;
+ }
+ last->next = NULL;
+ }
+
+ return new_list;
+}
+
+/**
+ * g_list_reverse:
+ * @list: a #GList
+ *
+ * Reverses a #GList.
+ * It simply switches the next and prev pointers of each element.
+ *
+ * Returns: the start of the reversed #GList
+ */
+GList*
+g_list_reverse (GList *list)
+{
+ GList *last;
+
+ last = NULL;
+ while (list)
+ {
+ last = list;
+ list = last->next;
+ last->next = last->prev;
+ last->prev = list;
+ }
+
+ return last;
+}
+
+/**
+ * g_list_nth:
+ * @list: a #GList
+ * @n: the position of the element, counting from 0
+ *
+ * Gets the element at the given position in a #GList.
+ *
+ * Returns: the element, or %NULL if the position is off
+ * the end of the #GList
+ */
+GList*
+g_list_nth (GList *list,
+ guint n)
+{
+ while ((n-- > 0) && list)
+ list = list->next;
+
+ return list;
+}
+
+/**
+ * g_list_nth_prev:
+ * @list: a #GList
+ * @n: the position of the element, counting from 0
+ *
+ * Gets the element @n places before @list.
+ *
+ * Returns: the element, or %NULL if the position is
+ * off the end of the #GList
+ */
+GList*
+g_list_nth_prev (GList *list,
+ guint n)
+{
+ while ((n-- > 0) && list)
+ list = list->prev;
+
+ return list;
+}
+
+/**
+ * g_list_nth_data:
+ * @list: a #GList
+ * @n: the position of the element
+ *
+ * Gets the data of the element at the given position.
+ *
+ * Returns: the element's data, or %NULL if the position
+ * is off the end of the #GList
+ */
+gpointer
+g_list_nth_data (GList *list,
+ guint n)
+{
+ while ((n-- > 0) && list)
+ list = list->next;
+
+ return list ? list->data : NULL;
+}
+
+/**
+ * g_list_find:
+ * @list: a #GList
+ * @data: the element data to find
+ *
+ * Finds the element in a #GList which
+ * contains the given data.
+ *
+ * Returns: the found #GList element,
+ * or %NULL if it is not found
+ */
+GList*
+g_list_find (GList *list,
+ gconstpointer data)
+{
+ while (list)
+ {
+ if (list->data == data)
+ break;
+ list = list->next;
+ }
+
+ return list;
+}
+
+/**
+ * g_list_find_custom:
+ * @list: a #GList
+ * @data: user data passed to the function
+ * @func: the function to call for each element.
+ * It should return 0 when the desired element is found
+ *
+ * Finds an element in a #GList, using a supplied function to
+ * find the desired element. It iterates over the list, calling
+ * the given function which should return 0 when the desired
+ * element is found. The function takes two #gconstpointer arguments,
+ * the #GList element's data as the first argument and the
+ * given user data.
+ *
+ * Returns: the found #GList element, or %NULL if it is not found
+ */
+GList*
+g_list_find_custom (GList *list,
+ gconstpointer data,
+ GCompareFunc func)
+{
+ g_return_val_if_fail (func != NULL, list);
+
+ while (list)
+ {
+ if (! func (list->data, data))
+ return list;
+ list = list->next;
+ }
+
+ return NULL;
+}
+
+
+/**
+ * g_list_position:
+ * @list: a #GList
+ * @llink: an element in the #GList
+ *
+ * Gets the position of the given element
+ * in the #GList (starting from 0).
+ *
+ * Returns: the position of the element in the #GList,
+ * or -1 if the element is not found
+ */
+gint
+g_list_position (GList *list,
+ GList *llink)
+{
+ gint i;
+
+ i = 0;
+ while (list)
+ {
+ if (list == llink)
+ return i;
+ i++;
+ list = list->next;
+ }
+
+ return -1;
+}
+
+/**
+ * g_list_index:
+ * @list: a #GList
+ * @data: the data to find
+ *
+ * Gets the position of the element containing
+ * the given data (starting from 0).
+ *
+ * Returns: the index of the element containing the data,
+ * or -1 if the data is not found
+ */
+gint
+g_list_index (GList *list,
+ gconstpointer data)
+{
+ gint i;
+
+ i = 0;
+ while (list)
+ {
+ if (list->data == data)
+ return i;
+ i++;
+ list = list->next;
+ }
+
+ return -1;
+}
+
+/**
+ * g_list_last:
+ * @list: a #GList
+ *
+ * Gets the last element in a #GList.
+ *
+ * Returns: the last element in the #GList,
+ * or %NULL if the #GList has no elements
+ */
+GList*
+g_list_last (GList *list)
+{
+ if (list)
+ {
+ while (list->next)
+ list = list->next;
+ }
+
+ return list;
+}
+
+/**
+ * g_list_first:
+ * @list: a #GList
+ *
+ * Gets the first element in a #GList.
+ *
+ * Returns: the first element in the #GList,
+ * or %NULL if the #GList has no elements
+ */
+GList*
+g_list_first (GList *list)
+{
+ if (list)
+ {
+ while (list->prev)
+ list = list->prev;
+ }
+
+ return list;
+}
+
+/**
+ * g_list_length:
+ * @list: a #GList
+ *
+ * Gets the number of elements in a #GList.
+ *
+ * <note><para>
+ * This function iterates over the whole list to
+ * count its elements.
+ * </para></note>
+ *
+ * Returns: the number of elements in the #GList
+ */
+guint
+g_list_length (GList *list)
+{
+ guint length;
+
+ length = 0;
+ while (list)
+ {
+ length++;
+ list = list->next;
+ }
+
+ return length;
+}
+
+/**
+ * g_list_foreach:
+ * @list: a #GList
+ * @func: the function to call with each element's data
+ * @user_data: user data to pass to the function
+ *
+ * Calls a function for each element of a #GList.
+ */
+void
+g_list_foreach (GList *list,
+ GFunc func,
+ gpointer user_data)
+{
+ while (list)
+ {
+ GList *next = list->next;
+ (*func) (list->data, user_data);
+ list = next;
+ }
+}
+
+static GList*
+g_list_insert_sorted_real (GList *list,
+ gpointer data,
+ GFunc func,
+ gpointer user_data)
+{
+ GList *tmp_list = list;
+ GList *new_list;
+ gint cmp;
+
+ g_return_val_if_fail (func != NULL, list);
+
+ if (!list)
+ {
+ new_list = _g_list_alloc0 ();
+ new_list->data = data;
+ return new_list;
+ }
+
+ cmp = ((GCompareDataFunc) func) (data, tmp_list->data, user_data);
+
+ while ((tmp_list->next) && (cmp > 0))
+ {
+ tmp_list = tmp_list->next;
+
+ cmp = ((GCompareDataFunc) func) (data, tmp_list->data, user_data);
+ }
+
+ new_list = _g_list_alloc0 ();
+ new_list->data = data;
+
+ if ((!tmp_list->next) && (cmp > 0))
+ {
+ tmp_list->next = new_list;
+ new_list->prev = tmp_list;
+ return list;
+ }
+
+ if (tmp_list->prev)
+ {
+ tmp_list->prev->next = new_list;
+ new_list->prev = tmp_list->prev;
+ }
+ new_list->next = tmp_list;
+ tmp_list->prev = new_list;
+
+ if (tmp_list == list)
+ return new_list;
+ else
+ return list;
+}
+
+/**
+ * g_list_insert_sorted:
+ * @list: a pointer to a #GList
+ * @data: the data for the new element
+ * @func: the function to compare elements in the list. It should
+ * return a number > 0 if the first parameter comes after the
+ * second parameter in the sort order.
+ *
+ * Inserts a new element into the list, using the given comparison
+ * function to determine its position.
+ *
+ * Returns: the new start of the #GList
+ */
+GList*
+g_list_insert_sorted (GList *list,
+ gpointer data,
+ GCompareFunc func)
+{
+ return g_list_insert_sorted_real (list, data, (GFunc) func, NULL);
+}
+
+/**
+ * g_list_insert_sorted_with_data:
+ * @list: a pointer to a #GList
+ * @data: the data for the new element
+ * @func: the function to compare elements in the list.
+ * It should return a number > 0 if the first parameter
+ * comes after the second parameter in the sort order.
+ * @user_data: user data to pass to comparison function.
+ *
+ * Inserts a new element into the list, using the given comparison
+ * function to determine its position.
+ *
+ * Returns: the new start of the #GList
+ *
+ * Since: 2.10
+ */
+GList*
+g_list_insert_sorted_with_data (GList *list,
+ gpointer data,
+ GCompareDataFunc func,
+ gpointer user_data)
+{
+ return g_list_insert_sorted_real (list, data, (GFunc) func, user_data);
+}
+
+static GList *
+g_list_sort_merge (GList *l1,
+ GList *l2,
+ GFunc compare_func,
+ gpointer user_data)
+{
+ GList list, *l, *lprev;
+ gint cmp;
+
+ l = &list;
+ lprev = NULL;
+
+ while (l1 && l2)
+ {
+ cmp = ((GCompareDataFunc) compare_func) (l1->data, l2->data, user_data);
+
+ if (cmp <= 0)
+ {
+ l->next = l1;
+ l1 = l1->next;
+ }
+ else
+ {
+ l->next = l2;
+ l2 = l2->next;
+ }
+ l = l->next;
+ l->prev = lprev;
+ lprev = l;
+ }
+ l->next = l1 ? l1 : l2;
+ l->next->prev = l;
+
+ return list.next;
+}
+
+static GList*
+g_list_sort_real (GList *list,
+ GFunc compare_func,
+ gpointer user_data)
+{
+ GList *l1, *l2;
+
+ if (!list)
+ return NULL;
+ if (!list->next)
+ return list;
+
+ l1 = list;
+ l2 = list->next;
+
+ while ((l2 = l2->next) != NULL)
+ {
+ if ((l2 = l2->next) == NULL)
+ break;
+ l1 = l1->next;
+ }
+ l2 = l1->next;
+ l1->next = NULL;
+
+ return g_list_sort_merge (g_list_sort_real (list, compare_func, user_data),
+ g_list_sort_real (l2, compare_func, user_data),
+ compare_func,
+ user_data);
+}
+
+/**
+ * g_list_sort:
+ * @list: a #GList
+ * @compare_func: the comparison function used to sort the #GList.
+ * This function is passed the data from 2 elements of the #GList
+ * and should return 0 if they are equal, a negative value if the
+ * first element comes before the second, or a positive value if
+ * the first element comes after the second.
+ *
+ * Sorts a #GList using the given comparison function.
+ *
+ * Returns: the start of the sorted #GList
+ */
+GList *
+g_list_sort (GList *list,
+ GCompareFunc compare_func)
+{
+ return g_list_sort_real (list, (GFunc) compare_func, NULL);
+
+}
+
+/**
+ * g_list_sort_with_data:
+ * @list: a #GList
+ * @compare_func: comparison function
+ * @user_data: user data to pass to comparison function
+ *
+ * Like g_list_sort(), but the comparison function accepts
+ * a user data argument.
+ *
+ * Returns: the new head of @list
+ */
+GList *
+g_list_sort_with_data (GList *list,
+ GCompareDataFunc compare_func,
+ gpointer user_data)
+{
+ return g_list_sort_real (list, (GFunc) compare_func, user_data);
+}
+
+#define __G_LIST_C__
+#include "galiasdef.c"
diff --git a/support/glib/glist.h b/support/glib/glist.h
new file mode 100644
index 00000000..e74ed96f
--- /dev/null
+++ b/support/glib/glist.h
@@ -0,0 +1,120 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#ifndef __G_LIST_H__
+#define __G_LIST_H__
+
+#include <glib/gmem.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GList GList;
+
+struct _GList
+{
+ gpointer data;
+ GList *next;
+ GList *prev;
+};
+
+/* Doubly linked lists
+ */
+GList* g_list_alloc (void) G_GNUC_WARN_UNUSED_RESULT;
+void g_list_free (GList *list);
+void g_list_free_1 (GList *list);
+#define g_list_free1 g_list_free_1
+GList* g_list_append (GList *list,
+ gpointer data) G_GNUC_WARN_UNUSED_RESULT;
+GList* g_list_prepend (GList *list,
+ gpointer data) G_GNUC_WARN_UNUSED_RESULT;
+GList* g_list_insert (GList *list,
+ gpointer data,
+ gint position) G_GNUC_WARN_UNUSED_RESULT;
+GList* g_list_insert_sorted (GList *list,
+ gpointer data,
+ GCompareFunc func) G_GNUC_WARN_UNUSED_RESULT;
+GList* g_list_insert_sorted_with_data (GList *list,
+ gpointer data,
+ GCompareDataFunc func,
+ gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
+GList* g_list_insert_before (GList *list,
+ GList *sibling,
+ gpointer data) G_GNUC_WARN_UNUSED_RESULT;
+GList* g_list_concat (GList *list1,
+ GList *list2) G_GNUC_WARN_UNUSED_RESULT;
+GList* g_list_remove (GList *list,
+ gconstpointer data) G_GNUC_WARN_UNUSED_RESULT;
+GList* g_list_remove_all (GList *list,
+ gconstpointer data) G_GNUC_WARN_UNUSED_RESULT;
+GList* g_list_remove_link (GList *list,
+ GList *llink) G_GNUC_WARN_UNUSED_RESULT;
+GList* g_list_delete_link (GList *list,
+ GList *link_) G_GNUC_WARN_UNUSED_RESULT;
+GList* g_list_reverse (GList *list) G_GNUC_WARN_UNUSED_RESULT;
+GList* g_list_copy (GList *list) G_GNUC_WARN_UNUSED_RESULT;
+GList* g_list_nth (GList *list,
+ guint n);
+GList* g_list_nth_prev (GList *list,
+ guint n);
+GList* g_list_find (GList *list,
+ gconstpointer data);
+GList* g_list_find_custom (GList *list,
+ gconstpointer data,
+ GCompareFunc func);
+gint g_list_position (GList *list,
+ GList *llink);
+gint g_list_index (GList *list,
+ gconstpointer data);
+GList* g_list_last (GList *list);
+GList* g_list_first (GList *list);
+guint g_list_length (GList *list);
+void g_list_foreach (GList *list,
+ GFunc func,
+ gpointer user_data);
+GList* g_list_sort (GList *list,
+ GCompareFunc compare_func) G_GNUC_WARN_UNUSED_RESULT;
+GList* g_list_sort_with_data (GList *list,
+ GCompareDataFunc compare_func,
+ gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
+gpointer g_list_nth_data (GList *list,
+ guint n);
+
+
+#define g_list_previous(list) ((list) ? (((GList *)(list))->prev) : NULL)
+#define g_list_next(list) ((list) ? (((GList *)(list))->next) : NULL)
+
+#ifndef G_DISABLE_DEPRECATED
+void g_list_push_allocator (gpointer allocator);
+void g_list_pop_allocator (void);
+#endif
+
+G_END_DECLS
+
+#endif /* __G_LIST_H__ */
diff --git a/support/glib/gmacros.h b/support/glib/gmacros.h
new file mode 100644
index 00000000..f87e932c
--- /dev/null
+++ b/support/glib/gmacros.h
@@ -0,0 +1,273 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+/* This file must not include any other glib header file and must thus
+ * not refer to variables from glibconfig.h
+ */
+
+#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#ifndef __G_MACROS_H__
+#define __G_MACROS_H__
+
+/* We include stddef.h to get the system's definition of NULL
+ */
+#include <stddef.h>
+
+/* Here we provide G_GNUC_EXTENSION as an alias for __extension__,
+ * where this is valid. This allows for warningless compilation of
+ * "long long" types even in the presence of '-ansi -pedantic'.
+ */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
+# define G_GNUC_EXTENSION __extension__
+#else
+# define G_GNUC_EXTENSION
+#endif
+
+/* Provide macros to feature the GCC function attribute.
+ */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+#define G_GNUC_PURE \
+ __attribute__((__pure__))
+#define G_GNUC_MALLOC \
+ __attribute__((__malloc__))
+#else
+#define G_GNUC_PURE
+#define G_GNUC_MALLOC
+#endif
+
+#if __GNUC__ >= 4
+#define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
+#else
+#define G_GNUC_NULL_TERMINATED
+#endif
+
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#define G_GNUC_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
+#define G_GNUC_ALLOC_SIZE2(x,y) __attribute__((__alloc_size__(x,y)))
+#else
+#define G_GNUC_ALLOC_SIZE(x)
+#define G_GNUC_ALLOC_SIZE2(x,y)
+#endif
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
+#define G_GNUC_PRINTF( format_idx, arg_idx ) \
+ __attribute__((__format__ (__printf__, format_idx, arg_idx)))
+#define G_GNUC_SCANF( format_idx, arg_idx ) \
+ __attribute__((__format__ (__scanf__, format_idx, arg_idx)))
+#define G_GNUC_FORMAT( arg_idx ) \
+ __attribute__((__format_arg__ (arg_idx)))
+#define G_GNUC_NORETURN \
+ __attribute__((__noreturn__))
+#define G_GNUC_CONST \
+ __attribute__((__const__))
+#define G_GNUC_UNUSED \
+ __attribute__((__unused__))
+#define G_GNUC_NO_INSTRUMENT \
+ __attribute__((__no_instrument_function__))
+#else /* !__GNUC__ */
+#define G_GNUC_PRINTF( format_idx, arg_idx )
+#define G_GNUC_SCANF( format_idx, arg_idx )
+#define G_GNUC_FORMAT( arg_idx )
+#define G_GNUC_NORETURN
+#define G_GNUC_CONST
+#define G_GNUC_UNUSED
+#define G_GNUC_NO_INSTRUMENT
+#endif /* !__GNUC__ */
+
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
+#define G_GNUC_DEPRECATED \
+ __attribute__((__deprecated__))
+#else
+#define G_GNUC_DEPRECATED
+#endif /* __GNUC__ */
+
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
+# define G_GNUC_MAY_ALIAS __attribute__((may_alias))
+#else
+# define G_GNUC_MAY_ALIAS
+#endif
+
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#define G_GNUC_WARN_UNUSED_RESULT \
+ __attribute__((warn_unused_result))
+#else
+#define G_GNUC_WARN_UNUSED_RESULT
+#endif /* __GNUC__ */
+
+#ifndef G_DISABLE_DEPRECATED
+/* Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with
+ * macros, so we can refer to them as strings unconditionally.
+ * usage not-recommended since gcc-3.0
+ */
+#if defined (__GNUC__) && (__GNUC__ < 3)
+#define G_GNUC_FUNCTION __FUNCTION__
+#define G_GNUC_PRETTY_FUNCTION __PRETTY_FUNCTION__
+#else /* !__GNUC__ */
+#define G_GNUC_FUNCTION ""
+#define G_GNUC_PRETTY_FUNCTION ""
+#endif /* !__GNUC__ */
+#endif /* !G_DISABLE_DEPRECATED */
+
+#define G_STRINGIFY(macro_or_string) G_STRINGIFY_ARG (macro_or_string)
+#define G_STRINGIFY_ARG(contents) #contents
+
+/* Provide a string identifying the current code position */
+#if defined(__GNUC__) && (__GNUC__ < 3) && !defined(__cplusplus)
+# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) ":" __PRETTY_FUNCTION__ "()"
+#else
+# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__)
+#endif
+
+/* Provide a string identifying the current function, non-concatenatable */
+#if defined (__GNUC__)
+# define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__))
+#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 19901L
+# define G_STRFUNC ((const char*) (__func__))
+#else
+# define G_STRFUNC ((const char*) ("???"))
+#endif
+
+/* Guard C code in headers, while including them from C++ */
+#ifdef __cplusplus
+# define G_BEGIN_DECLS extern "C" {
+# define G_END_DECLS }
+#else
+# define G_BEGIN_DECLS
+# define G_END_DECLS
+#endif
+
+/* Provide definitions for some commonly used macros.
+ * Some of them are only provided if they haven't already
+ * been defined. It is assumed that if they are already
+ * defined then the current definition is correct.
+ */
+#ifndef NULL
+# ifdef __cplusplus
+# define NULL (0L)
+# else /* !__cplusplus */
+# define NULL ((void*) 0)
+# endif /* !__cplusplus */
+#endif
+
+#ifndef FALSE
+#define FALSE (0)
+#endif
+
+#ifndef TRUE
+#define TRUE (!FALSE)
+#endif
+
+#undef MAX
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+
+#undef MIN
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+
+#undef ABS
+#define ABS(a) (((a) < 0) ? -(a) : (a))
+
+#undef CLAMP
+#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
+
+/* Count the number of elements in an array. The array must be defined
+ * as such; using this with a dynamically allocated array will give
+ * incorrect results.
+ */
+#define G_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0]))
+
+/* Macros by analogy to GINT_TO_POINTER, GPOINTER_TO_INT
+ */
+#define GPOINTER_TO_SIZE(p) ((gsize) (p))
+#define GSIZE_TO_POINTER(s) ((gpointer) (gsize) (s))
+
+/* Provide convenience macros for handling structure
+ * fields through their offsets.
+ */
+
+#if defined(__GNUC__) && __GNUC__ >= 4
+# define G_STRUCT_OFFSET(struct_type, member) \
+ ((glong) __builtin_offsetof (struct_type, member))
+#else
+# define G_STRUCT_OFFSET(struct_type, member) \
+ ((glong) ((guint8*) &((struct_type*) 0)->member))
+#endif
+
+#define G_STRUCT_MEMBER_P(struct_p, struct_offset) \
+ ((gpointer) ((guint8*) (struct_p) + (glong) (struct_offset)))
+#define G_STRUCT_MEMBER(member_type, struct_p, struct_offset) \
+ (*(member_type*) G_STRUCT_MEMBER_P ((struct_p), (struct_offset)))
+
+/* Provide simple macro statement wrappers:
+ * G_STMT_START { statements; } G_STMT_END;
+ * This can be used as a single statement, like:
+ * if (x) G_STMT_START { ... } G_STMT_END; else ...
+ * This intentionally does not use compiler extensions like GCC's '({...})' to
+ * avoid portability issue or side effects when compiled with different compilers.
+ */
+#if !(defined (G_STMT_START) && defined (G_STMT_END))
+# define G_STMT_START do
+# define G_STMT_END while (0)
+#endif
+
+/* Allow the app programmer to select whether or not return values
+ * (usually char*) are const or not. Don't try using this feature for
+ * functions with C++ linkage.
+ */
+#ifdef G_DISABLE_CONST_RETURNS
+#define G_CONST_RETURN
+#else
+#define G_CONST_RETURN const
+#endif
+
+/*
+ * The G_LIKELY and G_UNLIKELY macros let the programmer give hints to
+ * the compiler about the expected result of an expression. Some compilers
+ * can use this information for optimizations.
+ *
+ * The _G_BOOLEAN_EXPR macro is intended to trigger a gcc warning when
+ * putting assignments in g_return_if_fail ().
+ */
+#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
+#define _G_BOOLEAN_EXPR(expr) \
+ __extension__ ({ \
+ int _g_boolean_var_; \
+ if (expr) \
+ _g_boolean_var_ = 1; \
+ else \
+ _g_boolean_var_ = 0; \
+ _g_boolean_var_; \
+})
+#define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1))
+#define G_UNLIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 0))
+#else
+#define G_LIKELY(expr) (expr)
+#define G_UNLIKELY(expr) (expr)
+#endif
+
+#endif /* __G_MACROS_H__ */
diff --git a/support/glib/gmem.c b/support/glib/gmem.c
new file mode 100644
index 00000000..9cc091fd
--- /dev/null
+++ b/support/glib/gmem.c
@@ -0,0 +1,742 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+/*
+ * MT safe
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+
+#include "glib.h"
+#include "gthreadprivate.h"
+#include "galias.h"
+
+#define MEM_PROFILE_TABLE_SIZE 4096
+
+
+/* notes on macros:
+ * having G_DISABLE_CHECKS defined disables use of glib_mem_profiler_table and
+ * g_mem_profile().
+ * REALLOC_0_WORKS is defined if g_realloc (NULL, x) works.
+ * SANE_MALLOC_PROTOS is defined if the systems malloc() and friends functions
+ * match the corresponding GLib prototypes, keep configure.in and gmem.h in sync here.
+ * g_mem_gc_friendly is TRUE, freed memory should be 0-wiped.
+ */
+
+/* --- prototypes --- */
+static gboolean g_mem_initialized = FALSE;
+static void g_mem_init_nomessage (void);
+
+
+/* --- malloc wrappers --- */
+#ifndef REALLOC_0_WORKS
+static gpointer
+standard_realloc (gpointer mem,
+ gsize n_bytes)
+{
+ if (!mem)
+ return malloc (n_bytes);
+ else
+ return realloc (mem, n_bytes);
+}
+#endif /* !REALLOC_0_WORKS */
+
+#ifdef SANE_MALLOC_PROTOS
+# define standard_malloc malloc
+# ifdef REALLOC_0_WORKS
+# define standard_realloc realloc
+# endif /* REALLOC_0_WORKS */
+# define standard_free free
+# define standard_calloc calloc
+# define standard_try_malloc malloc
+# define standard_try_realloc realloc
+#else /* !SANE_MALLOC_PROTOS */
+static gpointer
+standard_malloc (gsize n_bytes)
+{
+ return malloc (n_bytes);
+}
+# ifdef REALLOC_0_WORKS
+static gpointer
+standard_realloc (gpointer mem,
+ gsize n_bytes)
+{
+ return realloc (mem, n_bytes);
+}
+# endif /* REALLOC_0_WORKS */
+static void
+standard_free (gpointer mem)
+{
+ free (mem);
+}
+static gpointer
+standard_calloc (gsize n_blocks,
+ gsize n_bytes)
+{
+ return calloc (n_blocks, n_bytes);
+}
+#define standard_try_malloc standard_malloc
+#define standard_try_realloc standard_realloc
+#endif /* !SANE_MALLOC_PROTOS */
+
+
+/* --- variables --- */
+static GMemVTable glib_mem_vtable = {
+ standard_malloc,
+ standard_realloc,
+ standard_free,
+ standard_calloc,
+ standard_try_malloc,
+ standard_try_realloc,
+};
+
+
+/* --- functions --- */
+gpointer
+g_malloc (gsize n_bytes)
+{
+ if (G_UNLIKELY (!g_mem_initialized))
+ g_mem_init_nomessage();
+ if (G_LIKELY (n_bytes))
+ {
+ gpointer mem;
+
+ mem = glib_mem_vtable.malloc (n_bytes);
+ if (mem)
+ return mem;
+
+#if NOT_NEEDED_FOR_NAVIT
+ g_error ("%s: failed to allocate %"G_GSIZE_FORMAT" bytes",
+ G_STRLOC, n_bytes);
+#endif /* NOT_NEEDED_FOR_NAVIT */
+ }
+
+ return NULL;
+}
+
+gpointer
+g_malloc0 (gsize n_bytes)
+{
+ if (G_UNLIKELY (!g_mem_initialized))
+ g_mem_init_nomessage();
+ if (G_LIKELY (n_bytes))
+ {
+ gpointer mem;
+
+ mem = glib_mem_vtable.calloc (1, n_bytes);
+ if (mem)
+ return mem;
+
+#if NOT_NEEDED_FOR_NAVIT
+ g_error ("%s: failed to allocate %"G_GSIZE_FORMAT" bytes",
+ G_STRLOC, n_bytes);
+#endif /* NOT_NEEDED_FOR_NAVIT */
+ }
+
+ return NULL;
+}
+
+gpointer
+g_realloc (gpointer mem,
+ gsize n_bytes)
+{
+ if (G_UNLIKELY (!g_mem_initialized))
+ g_mem_init_nomessage();
+ if (G_LIKELY (n_bytes))
+ {
+ mem = glib_mem_vtable.realloc (mem, n_bytes);
+ if (mem)
+ return mem;
+
+#if NOT_NEEDED_FOR_NAVIT
+ g_error ("%s: failed to allocate %"G_GSIZE_FORMAT" bytes",
+ G_STRLOC, n_bytes);
+#endif /* NOT_NEEDED_FOR_NAVIT */
+ }
+
+ if (mem)
+ glib_mem_vtable.free (mem);
+
+ return NULL;
+}
+
+void
+g_free (gpointer mem)
+{
+ if (G_UNLIKELY (!g_mem_initialized))
+ g_mem_init_nomessage();
+ if (G_LIKELY (mem))
+ glib_mem_vtable.free (mem);
+}
+
+gpointer
+g_try_malloc (gsize n_bytes)
+{
+ if (G_UNLIKELY (!g_mem_initialized))
+ g_mem_init_nomessage();
+ if (G_LIKELY (n_bytes))
+ return glib_mem_vtable.try_malloc (n_bytes);
+ else
+ return NULL;
+}
+
+gpointer
+g_try_malloc0 (gsize n_bytes)
+{
+ gpointer mem;
+
+ mem = g_try_malloc (n_bytes);
+
+ if (mem)
+ memset (mem, 0, n_bytes);
+
+ return mem;
+}
+
+gpointer
+g_try_realloc (gpointer mem,
+ gsize n_bytes)
+{
+ if (G_UNLIKELY (!g_mem_initialized))
+ g_mem_init_nomessage();
+ if (G_LIKELY (n_bytes))
+ return glib_mem_vtable.try_realloc (mem, n_bytes);
+
+ if (mem)
+ glib_mem_vtable.free (mem);
+
+ return NULL;
+}
+
+static gpointer
+fallback_calloc (gsize n_blocks,
+ gsize n_block_bytes)
+{
+ gsize l = n_blocks * n_block_bytes;
+ gpointer mem = glib_mem_vtable.malloc (l);
+
+ if (mem)
+ memset (mem, 0, l);
+
+ return mem;
+}
+
+static gboolean vtable_set = FALSE;
+
+/**
+ * g_mem_is_system_malloc
+ *
+ * Checks whether the allocator used by g_malloc() is the system's
+ * malloc implementation. If it returns %TRUE memory allocated with
+ * malloc() can be used interchangeable with memory allocated using g_malloc().
+ * This function is useful for avoiding an extra copy of allocated memory returned
+ * by a non-GLib-based API.
+ *
+ * A different allocator can be set using g_mem_set_vtable().
+ *
+ * Return value: if %TRUE, malloc() and g_malloc() can be mixed.
+ **/
+gboolean
+g_mem_is_system_malloc (void)
+{
+ return !vtable_set;
+}
+
+void
+g_mem_set_vtable (GMemVTable *vtable)
+{
+ if (!vtable_set)
+ {
+ if (vtable->malloc && vtable->realloc && vtable->free)
+ {
+ glib_mem_vtable.malloc = vtable->malloc;
+ glib_mem_vtable.realloc = vtable->realloc;
+ glib_mem_vtable.free = vtable->free;
+ glib_mem_vtable.calloc = vtable->calloc ? vtable->calloc : fallback_calloc;
+ glib_mem_vtable.try_malloc = vtable->try_malloc ? vtable->try_malloc : glib_mem_vtable.malloc;
+ glib_mem_vtable.try_realloc = vtable->try_realloc ? vtable->try_realloc : glib_mem_vtable.realloc;
+ vtable_set = TRUE;
+ }
+#if NOT_NEEDED_FOR_NAVIT
+ else
+ g_warning (G_STRLOC ": memory allocation vtable lacks one of malloc(), realloc() or free()");
+#endif /* NOT_NEEDED_FOR_NAVIT */
+ }
+#if NOT_NEEDED_FOR_NAVIT
+ else
+ g_warning (G_STRLOC ": memory allocation vtable can only be set once at startup");
+#endif /* NOT_NEEDED_FOR_NAVIT */
+}
+
+
+/* --- memory profiling and checking --- */
+#ifdef G_DISABLE_CHECKS
+GMemVTable *glib_mem_profiler_table = &glib_mem_vtable;
+void
+g_mem_profile (void)
+{
+}
+#else /* !G_DISABLE_CHECKS */
+typedef enum {
+ PROFILER_FREE = 0,
+ PROFILER_ALLOC = 1,
+ PROFILER_RELOC = 2,
+ PROFILER_ZINIT = 4
+} ProfilerJob;
+static guint *profile_data = NULL;
+static gsize profile_allocs = 0;
+static gsize profile_zinit = 0;
+static gsize profile_frees = 0;
+static GMutex *gmem_profile_mutex = NULL;
+#ifdef G_ENABLE_DEBUG
+static volatile gsize g_trap_free_size = 0;
+static volatile gsize g_trap_realloc_size = 0;
+static volatile gsize g_trap_malloc_size = 0;
+#endif /* G_ENABLE_DEBUG */
+
+#define PROFILE_TABLE(f1,f2,f3) ( ( ((f3) << 2) | ((f2) << 1) | (f1) ) * (MEM_PROFILE_TABLE_SIZE + 1))
+
+static void
+profiler_log (ProfilerJob job,
+ gsize n_bytes,
+ gboolean success)
+{
+ g_mutex_lock (gmem_profile_mutex);
+ if (!profile_data)
+ {
+ profile_data = standard_calloc ((MEM_PROFILE_TABLE_SIZE + 1) * 8,
+ sizeof (profile_data[0]));
+ if (!profile_data) /* memory system kiddin' me, eh? */
+ {
+ g_mutex_unlock (gmem_profile_mutex);
+ return;
+ }
+ }
+
+ if (n_bytes < MEM_PROFILE_TABLE_SIZE)
+ profile_data[n_bytes + PROFILE_TABLE ((job & PROFILER_ALLOC) != 0,
+ (job & PROFILER_RELOC) != 0,
+ success != 0)] += 1;
+ else
+ profile_data[MEM_PROFILE_TABLE_SIZE + PROFILE_TABLE ((job & PROFILER_ALLOC) != 0,
+ (job & PROFILER_RELOC) != 0,
+ success != 0)] += 1;
+ if (success)
+ {
+ if (job & PROFILER_ALLOC)
+ {
+ profile_allocs += n_bytes;
+ if (job & PROFILER_ZINIT)
+ profile_zinit += n_bytes;
+ }
+ else
+ profile_frees += n_bytes;
+ }
+ g_mutex_unlock (gmem_profile_mutex);
+}
+
+static void
+profile_print_locked (guint *local_data,
+ gboolean success)
+{
+ gboolean need_header = TRUE;
+ guint i;
+
+ for (i = 0; i <= MEM_PROFILE_TABLE_SIZE; i++)
+ {
+ glong t_malloc = local_data[i + PROFILE_TABLE (1, 0, success)];
+ glong t_realloc = local_data[i + PROFILE_TABLE (1, 1, success)];
+ glong t_free = local_data[i + PROFILE_TABLE (0, 0, success)];
+ glong t_refree = local_data[i + PROFILE_TABLE (0, 1, success)];
+
+ if (!t_malloc && !t_realloc && !t_free && !t_refree)
+ continue;
+ else if (need_header)
+ {
+ need_header = FALSE;
+ g_print (" blocks of | allocated | freed | allocated | freed | n_bytes \n");
+ g_print (" n_bytes | n_times by | n_times by | n_times by | n_times by | remaining \n");
+ g_print (" | malloc() | free() | realloc() | realloc() | \n");
+ g_print ("===========|============|============|============|============|===========\n");
+ }
+ if (i < MEM_PROFILE_TABLE_SIZE)
+ g_print ("%10u | %10ld | %10ld | %10ld | %10ld |%+11ld\n",
+ i, t_malloc, t_free, t_realloc, t_refree,
+ (t_malloc - t_free + t_realloc - t_refree) * i);
+ else if (i >= MEM_PROFILE_TABLE_SIZE)
+ g_print (" >%6u | %10ld | %10ld | %10ld | %10ld | ***\n",
+ i, t_malloc, t_free, t_realloc, t_refree);
+ }
+ if (need_header)
+ g_print (" --- none ---\n");
+}
+
+void
+g_mem_profile (void)
+{
+ guint local_data[(MEM_PROFILE_TABLE_SIZE + 1) * 8 * sizeof (profile_data[0])];
+ gsize local_allocs;
+ gsize local_zinit;
+ gsize local_frees;
+
+ if (G_UNLIKELY (!g_mem_initialized))
+ g_mem_init_nomessage();
+
+ g_mutex_lock (gmem_profile_mutex);
+
+ local_allocs = profile_allocs;
+ local_zinit = profile_zinit;
+ local_frees = profile_frees;
+
+ if (!profile_data)
+ {
+ g_mutex_unlock (gmem_profile_mutex);
+ return;
+ }
+
+ memcpy (local_data, profile_data,
+ (MEM_PROFILE_TABLE_SIZE + 1) * 8 * sizeof (profile_data[0]));
+
+ g_mutex_unlock (gmem_profile_mutex);
+
+ g_print ("GLib Memory statistics (successful operations):\n");
+ profile_print_locked (local_data, TRUE);
+ g_print ("GLib Memory statistics (failing operations):\n");
+ profile_print_locked (local_data, FALSE);
+ g_print ("Total bytes: allocated=%"G_GSIZE_FORMAT", "
+ "zero-initialized=%"G_GSIZE_FORMAT" (%.2f%%), "
+ "freed=%"G_GSIZE_FORMAT" (%.2f%%), "
+ "remaining=%"G_GSIZE_FORMAT"\n",
+ local_allocs,
+ local_zinit,
+ ((gdouble) local_zinit) / local_allocs * 100.0,
+ local_frees,
+ ((gdouble) local_frees) / local_allocs * 100.0,
+ local_allocs - local_frees);
+}
+
+static gpointer
+profiler_try_malloc (gsize n_bytes)
+{
+ gsize *p;
+
+#ifdef G_ENABLE_DEBUG
+ if (g_trap_malloc_size == n_bytes)
+ G_BREAKPOINT ();
+#endif /* G_ENABLE_DEBUG */
+
+ p = standard_malloc (sizeof (gsize) * 2 + n_bytes);
+
+ if (p)
+ {
+ p[0] = 0; /* free count */
+ p[1] = n_bytes; /* length */
+ profiler_log (PROFILER_ALLOC, n_bytes, TRUE);
+ p += 2;
+ }
+ else
+ profiler_log (PROFILER_ALLOC, n_bytes, FALSE);
+
+ return p;
+}
+
+static gpointer
+profiler_malloc (gsize n_bytes)
+{
+ gpointer mem = profiler_try_malloc (n_bytes);
+
+ if (!mem)
+ g_mem_profile ();
+
+ return mem;
+}
+
+static gpointer
+profiler_calloc (gsize n_blocks,
+ gsize n_block_bytes)
+{
+ gsize l = n_blocks * n_block_bytes;
+ gsize *p;
+
+#ifdef G_ENABLE_DEBUG
+ if (g_trap_malloc_size == l)
+ G_BREAKPOINT ();
+#endif /* G_ENABLE_DEBUG */
+
+ p = standard_calloc (1, sizeof (gsize) * 2 + l);
+
+ if (p)
+ {
+ p[0] = 0; /* free count */
+ p[1] = l; /* length */
+ profiler_log (PROFILER_ALLOC | PROFILER_ZINIT, l, TRUE);
+ p += 2;
+ }
+ else
+ {
+ profiler_log (PROFILER_ALLOC | PROFILER_ZINIT, l, FALSE);
+ g_mem_profile ();
+ }
+
+ return p;
+}
+
+static void
+profiler_free (gpointer mem)
+{
+ gsize *p = mem;
+
+ p -= 2;
+ if (p[0]) /* free count */
+ {
+ g_warning ("free(%p): memory has been freed %"G_GSIZE_FORMAT" times already",
+ p + 2, p[0]);
+ profiler_log (PROFILER_FREE,
+ p[1], /* length */
+ FALSE);
+ }
+ else
+ {
+#ifdef G_ENABLE_DEBUG
+ if (g_trap_free_size == p[1])
+ G_BREAKPOINT ();
+#endif /* G_ENABLE_DEBUG */
+
+ profiler_log (PROFILER_FREE,
+ p[1], /* length */
+ TRUE);
+ memset (p + 2, 0xaa, p[1]);
+
+ /* for all those that miss standard_free (p); in this place, yes,
+ * we do leak all memory when profiling, and that is intentional
+ * to catch double frees. patch submissions are futile.
+ */
+ }
+ p[0] += 1;
+}
+
+static gpointer
+profiler_try_realloc (gpointer mem,
+ gsize n_bytes)
+{
+ gsize *p = mem;
+
+ p -= 2;
+
+#ifdef G_ENABLE_DEBUG
+ if (g_trap_realloc_size == n_bytes)
+ G_BREAKPOINT ();
+#endif /* G_ENABLE_DEBUG */
+
+ if (mem && p[0]) /* free count */
+ {
+ g_warning ("realloc(%p, %"G_GSIZE_FORMAT"): "
+ "memory has been freed %"G_GSIZE_FORMAT" times already",
+ p + 2, (gsize) n_bytes, p[0]);
+ profiler_log (PROFILER_ALLOC | PROFILER_RELOC, n_bytes, FALSE);
+
+ return NULL;
+ }
+ else
+ {
+ p = standard_realloc (mem ? p : NULL, sizeof (gsize) * 2 + n_bytes);
+
+ if (p)
+ {
+ if (mem)
+ profiler_log (PROFILER_FREE | PROFILER_RELOC, p[1], TRUE);
+ p[0] = 0;
+ p[1] = n_bytes;
+ profiler_log (PROFILER_ALLOC | PROFILER_RELOC, p[1], TRUE);
+ p += 2;
+ }
+ else
+ profiler_log (PROFILER_ALLOC | PROFILER_RELOC, n_bytes, FALSE);
+
+ return p;
+ }
+}
+
+static gpointer
+profiler_realloc (gpointer mem,
+ gsize n_bytes)
+{
+ mem = profiler_try_realloc (mem, n_bytes);
+
+ if (!mem)
+ g_mem_profile ();
+
+ return mem;
+}
+
+static GMemVTable profiler_table = {
+ profiler_malloc,
+ profiler_realloc,
+ profiler_free,
+ profiler_calloc,
+ profiler_try_malloc,
+ profiler_try_realloc,
+};
+GMemVTable *glib_mem_profiler_table = &profiler_table;
+
+#endif /* !G_DISABLE_CHECKS */
+
+/* --- MemChunks --- */
+#ifndef G_ALLOC_AND_FREE
+typedef struct _GAllocator GAllocator;
+typedef struct _GMemChunk GMemChunk;
+#define G_ALLOC_ONLY 1
+#define G_ALLOC_AND_FREE 2
+#endif
+
+struct _GMemChunk {
+ guint alloc_size; /* the size of an atom */
+};
+
+GMemChunk*
+g_mem_chunk_new (const gchar *name,
+ gint atom_size,
+ gsize area_size,
+ gint type)
+{
+ GMemChunk *mem_chunk;
+ g_return_val_if_fail (atom_size > 0, NULL);
+
+ mem_chunk = g_slice_new (GMemChunk);
+ mem_chunk->alloc_size = atom_size;
+ return mem_chunk;
+}
+
+void
+g_mem_chunk_destroy (GMemChunk *mem_chunk)
+{
+ g_return_if_fail (mem_chunk != NULL);
+
+ g_slice_free (GMemChunk, mem_chunk);
+}
+
+gpointer
+g_mem_chunk_alloc (GMemChunk *mem_chunk)
+{
+ g_return_val_if_fail (mem_chunk != NULL, NULL);
+
+ return g_slice_alloc (mem_chunk->alloc_size);
+}
+
+gpointer
+g_mem_chunk_alloc0 (GMemChunk *mem_chunk)
+{
+ g_return_val_if_fail (mem_chunk != NULL, NULL);
+
+ return g_slice_alloc0 (mem_chunk->alloc_size);
+}
+
+void
+g_mem_chunk_free (GMemChunk *mem_chunk,
+ gpointer mem)
+{
+ g_return_if_fail (mem_chunk != NULL);
+
+ g_slice_free1 (mem_chunk->alloc_size, mem);
+}
+
+void g_mem_chunk_clean (GMemChunk *mem_chunk) {}
+void g_mem_chunk_reset (GMemChunk *mem_chunk) {}
+void g_mem_chunk_print (GMemChunk *mem_chunk) {}
+void g_mem_chunk_info (void) {}
+void g_blow_chunks (void) {}
+
+GAllocator*
+g_allocator_new (const gchar *name,
+ guint n_preallocs)
+{
+ static struct _GAllocator {
+ gchar *name;
+ guint16 n_preallocs;
+ guint is_unused : 1;
+ guint type : 4;
+ GAllocator *last;
+ GMemChunk *mem_chunk;
+ gpointer free_list;
+ } dummy = {
+ "GAllocator is deprecated", 1, TRUE, 0, NULL, NULL, NULL,
+ };
+ /* some (broken) GAllocator uses depend on non-NULL allocators */
+ return (void*) &dummy;
+}
+
+void
+g_allocator_free (GAllocator *allocator)
+{
+}
+
+#ifdef ENABLE_GC_FRIENDLY_DEFAULT
+gboolean g_mem_gc_friendly = TRUE;
+#else
+gboolean g_mem_gc_friendly = FALSE;
+#endif
+
+static void
+g_mem_init_nomessage (void)
+{
+#if NOT_NEEDED_FOR_NAVIT
+ gchar buffer[1024];
+ const gchar *val;
+ const GDebugKey keys[] = {
+ { "gc-friendly", 1 },
+ };
+ gint flags;
+ if (g_mem_initialized)
+ return;
+ /* don't use g_malloc/g_message here */
+ val = _g_getenv_nomalloc ("G_DEBUG", buffer);
+ flags = !val ? 0 : g_parse_debug_string (val, keys, G_N_ELEMENTS (keys));
+ if (flags & 1) /* gc-friendly */
+ {
+ g_mem_gc_friendly = TRUE;
+ }
+#endif /* NOT_NEEDED_FOR_NAVIT */
+ g_mem_initialized = TRUE;
+}
+
+void
+_g_mem_thread_init_noprivate_nomessage (void)
+{
+ /* we may only create mutexes here, locking/
+ * unlocking a mutex does not yet work.
+ */
+ g_mem_init_nomessage();
+#ifndef G_DISABLE_CHECKS
+ gmem_profile_mutex = g_mutex_new ();
+#endif
+}
+
+#define __G_MEM_C__
+#include "galiasdef.c"
diff --git a/support/glib/gmem.h b/support/glib/gmem.h
new file mode 100644
index 00000000..8cb050ee
--- /dev/null
+++ b/support/glib/gmem.h
@@ -0,0 +1,152 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#ifndef __G_MEM_H__
+#define __G_MEM_H__
+
+#include <glib/gslice.h>
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GMemVTable GMemVTable;
+
+
+#if GLIB_SIZEOF_VOID_P > GLIB_SIZEOF_LONG
+# define G_MEM_ALIGN GLIB_SIZEOF_VOID_P
+#else /* GLIB_SIZEOF_VOID_P <= GLIB_SIZEOF_LONG */
+# define G_MEM_ALIGN GLIB_SIZEOF_LONG
+#endif /* GLIB_SIZEOF_VOID_P <= GLIB_SIZEOF_LONG */
+
+
+/* Memory allocation functions
+ */
+gpointer g_malloc (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
+gpointer g_malloc0 (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
+gpointer g_realloc (gpointer mem,
+ gsize n_bytes) G_GNUC_WARN_UNUSED_RESULT;
+void g_free (gpointer mem);
+gpointer g_try_malloc (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
+gpointer g_try_malloc0 (gsize n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
+gpointer g_try_realloc (gpointer mem,
+ gsize n_bytes) G_GNUC_WARN_UNUSED_RESULT;
+
+
+/* Convenience memory allocators
+ */
+#define g_new(struct_type, n_structs) \
+ ((struct_type *) g_malloc (((gsize) sizeof (struct_type)) * ((gsize) (n_structs))))
+#define g_new0(struct_type, n_structs) \
+ ((struct_type *) g_malloc0 (((gsize) sizeof (struct_type)) * ((gsize) (n_structs))))
+#define g_renew(struct_type, mem, n_structs) \
+ ((struct_type *) g_realloc ((mem), ((gsize) sizeof (struct_type)) * ((gsize) (n_structs))))
+
+#define g_try_new(struct_type, n_structs) \
+ ((struct_type *) g_try_malloc (((gsize) sizeof (struct_type)) * ((gsize) (n_structs))))
+#define g_try_new0(struct_type, n_structs) \
+ ((struct_type *) g_try_malloc0 (((gsize) sizeof (struct_type)) * ((gsize) (n_structs))))
+#define g_try_renew(struct_type, mem, n_structs) \
+ ((struct_type *) g_try_realloc ((mem), ((gsize) sizeof (struct_type)) * ((gsize) (n_structs))))
+
+
+/* Memory allocation virtualization for debugging purposes
+ * g_mem_set_vtable() has to be the very first GLib function called
+ * if being used
+ */
+struct _GMemVTable
+{
+ gpointer (*malloc) (gsize n_bytes);
+ gpointer (*realloc) (gpointer mem,
+ gsize n_bytes);
+ void (*free) (gpointer mem);
+ /* optional; set to NULL if not used ! */
+ gpointer (*calloc) (gsize n_blocks,
+ gsize n_block_bytes);
+ gpointer (*try_malloc) (gsize n_bytes);
+ gpointer (*try_realloc) (gpointer mem,
+ gsize n_bytes);
+};
+void g_mem_set_vtable (GMemVTable *vtable);
+gboolean g_mem_is_system_malloc (void);
+
+GLIB_VAR gboolean g_mem_gc_friendly;
+
+/* Memory profiler and checker, has to be enabled via g_mem_set_vtable()
+ */
+GLIB_VAR GMemVTable *glib_mem_profiler_table;
+void g_mem_profile (void);
+
+
+/* deprecated memchunks and allocators */
+#if !defined (G_DISABLE_DEPRECATED) || defined (GTK_COMPILATION) || defined (GDK_COMPILATION)
+typedef struct _GAllocator GAllocator;
+typedef struct _GMemChunk GMemChunk;
+#define g_mem_chunk_create(type, pre_alloc, alloc_type) ( \
+ g_mem_chunk_new (#type " mem chunks (" #pre_alloc ")", \
+ sizeof (type), \
+ sizeof (type) * (pre_alloc), \
+ (alloc_type)) \
+)
+#define g_chunk_new(type, chunk) ( \
+ (type *) g_mem_chunk_alloc (chunk) \
+)
+#define g_chunk_new0(type, chunk) ( \
+ (type *) g_mem_chunk_alloc0 (chunk) \
+)
+#define g_chunk_free(mem, mem_chunk) G_STMT_START { \
+ g_mem_chunk_free ((mem_chunk), (mem)); \
+} G_STMT_END
+#define G_ALLOC_ONLY 1
+#define G_ALLOC_AND_FREE 2
+GMemChunk* g_mem_chunk_new (const gchar *name,
+ gint atom_size,
+ gsize area_size,
+ gint type);
+void g_mem_chunk_destroy (GMemChunk *mem_chunk);
+gpointer g_mem_chunk_alloc (GMemChunk *mem_chunk);
+gpointer g_mem_chunk_alloc0 (GMemChunk *mem_chunk);
+void g_mem_chunk_free (GMemChunk *mem_chunk,
+ gpointer mem);
+void g_mem_chunk_clean (GMemChunk *mem_chunk);
+void g_mem_chunk_reset (GMemChunk *mem_chunk);
+void g_mem_chunk_print (GMemChunk *mem_chunk);
+void g_mem_chunk_info (void);
+void g_blow_chunks (void);
+GAllocator*g_allocator_new (const gchar *name,
+ guint n_preallocs);
+void g_allocator_free (GAllocator *allocator);
+#define G_ALLOCATOR_LIST (1)
+#define G_ALLOCATOR_SLIST (2)
+#define G_ALLOCATOR_NODE (3)
+#endif /* G_DISABLE_DEPRECATED */
+
+G_END_DECLS
+
+#endif /* __G_MEM_H__ */
diff --git a/support/glib/gmessages.c b/support/glib/gmessages.c
new file mode 100644
index 00000000..548a412c
--- /dev/null
+++ b/support/glib/gmessages.c
@@ -0,0 +1,1126 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+/*
+ * MT safe
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <signal.h>
+#include <locale.h>
+#include <errno.h>
+
+#include "glib.h"
+#if NOT_NEEDED_FOR_NAVIT
+#include "gdebug.h"
+#endif /* NOT_NEEDED_FOR_NAVIT */
+#include "gprintfint.h"
+#include "gthreadprivate.h"
+#include "galias.h"
+#include "config.h"
+
+#if NOT_NEEDED_FOR_NAVIT
+#ifdef G_OS_WIN32
+#include <process.h> /* For getpid() */
+#include <io.h>
+# define STRICT /* Strict typing, please */
+# define _WIN32_WINDOWS 0x0401 /* to get IsDebuggerPresent */
+# include <windows.h>
+# undef STRICT
+#endif
+
+/* --- structures --- */
+typedef struct _GLogDomain GLogDomain;
+typedef struct _GLogHandler GLogHandler;
+struct _GLogDomain
+{
+ gchar *log_domain;
+ GLogLevelFlags fatal_mask;
+ GLogHandler *handlers;
+ GLogDomain *next;
+};
+struct _GLogHandler
+{
+ guint id;
+ GLogLevelFlags log_level;
+ GLogFunc log_func;
+ gpointer data;
+ GLogHandler *next;
+};
+
+
+/* --- variables --- */
+static GMutex *g_messages_lock = NULL;
+static GLogDomain *g_log_domains = NULL;
+static GLogLevelFlags g_log_always_fatal = G_LOG_FATAL_MASK;
+static GPrintFunc glib_print_func = NULL;
+static GPrintFunc glib_printerr_func = NULL;
+static GPrivate *g_log_depth = NULL;
+static GLogLevelFlags g_log_msg_prefix = G_LOG_LEVEL_ERROR | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_DEBUG;
+static GLogFunc default_log_func = g_log_default_handler;
+static gpointer default_log_data = NULL;
+
+/* --- functions --- */
+#ifdef G_OS_WIN32
+# define STRICT
+# include <windows.h>
+# undef STRICT
+static gboolean win32_keep_fatal_message = FALSE;
+
+/* This default message will usually be overwritten. */
+/* Yes, a fixed size buffer is bad. So sue me. But g_error() is never
+ * called with huge strings, is it?
+ */
+static gchar fatal_msg_buf[1000] = "Unspecified fatal error encountered, aborting.";
+static gchar *fatal_msg_ptr = fatal_msg_buf;
+
+#undef write
+static inline int
+dowrite (int fd,
+ const void *buf,
+ unsigned int len)
+{
+ if (win32_keep_fatal_message)
+ {
+ memcpy (fatal_msg_ptr, buf, len);
+ fatal_msg_ptr += len;
+ *fatal_msg_ptr = 0;
+ return len;
+ }
+
+ write (fd, buf, len);
+
+ return len;
+}
+#define write(fd, buf, len) dowrite(fd, buf, len)
+
+#endif
+
+static void
+write_string (int fd,
+ const gchar *string)
+{
+ write (fd, string, strlen (string));
+}
+
+static void
+g_messages_prefixed_init (void)
+{
+ static gboolean initialized = FALSE;
+
+ if (!initialized)
+ {
+ const gchar *val;
+
+ initialized = TRUE;
+ val = g_getenv ("G_MESSAGES_PREFIXED");
+
+ if (val)
+ {
+ const GDebugKey keys[] = {
+ { "error", G_LOG_LEVEL_ERROR },
+ { "critical", G_LOG_LEVEL_CRITICAL },
+ { "warning", G_LOG_LEVEL_WARNING },
+ { "message", G_LOG_LEVEL_MESSAGE },
+ { "info", G_LOG_LEVEL_INFO },
+ { "debug", G_LOG_LEVEL_DEBUG }
+ };
+
+ g_log_msg_prefix = g_parse_debug_string (val, keys, G_N_ELEMENTS (keys));
+ }
+ }
+}
+
+static GLogDomain*
+g_log_find_domain_L (const gchar *log_domain)
+{
+ register GLogDomain *domain;
+
+ domain = g_log_domains;
+ while (domain)
+ {
+ if (strcmp (domain->log_domain, log_domain) == 0)
+ return domain;
+ domain = domain->next;
+ }
+ return NULL;
+}
+
+static GLogDomain*
+g_log_domain_new_L (const gchar *log_domain)
+{
+ register GLogDomain *domain;
+
+ domain = g_new (GLogDomain, 1);
+ domain->log_domain = g_strdup (log_domain);
+ domain->fatal_mask = G_LOG_FATAL_MASK;
+ domain->handlers = NULL;
+
+ domain->next = g_log_domains;
+ g_log_domains = domain;
+
+ return domain;
+}
+
+static void
+g_log_domain_check_free_L (GLogDomain *domain)
+{
+ if (domain->fatal_mask == G_LOG_FATAL_MASK &&
+ domain->handlers == NULL)
+ {
+ register GLogDomain *last, *work;
+
+ last = NULL;
+
+ work = g_log_domains;
+ while (work)
+ {
+ if (work == domain)
+ {
+ if (last)
+ last->next = domain->next;
+ else
+ g_log_domains = domain->next;
+ g_free (domain->log_domain);
+ g_free (domain);
+ break;
+ }
+ last = work;
+ work = last->next;
+ }
+ }
+}
+
+static GLogFunc
+g_log_domain_get_handler_L (GLogDomain *domain,
+ GLogLevelFlags log_level,
+ gpointer *data)
+{
+ if (domain && log_level)
+ {
+ register GLogHandler *handler;
+
+ handler = domain->handlers;
+ while (handler)
+ {
+ if ((handler->log_level & log_level) == log_level)
+ {
+ *data = handler->data;
+ return handler->log_func;
+ }
+ handler = handler->next;
+ }
+ }
+
+ *data = default_log_data;
+ return default_log_func;
+}
+
+GLogLevelFlags
+g_log_set_always_fatal (GLogLevelFlags fatal_mask)
+{
+ GLogLevelFlags old_mask;
+
+ /* restrict the global mask to levels that are known to glib
+ * since this setting applies to all domains
+ */
+ fatal_mask &= (1 << G_LOG_LEVEL_USER_SHIFT) - 1;
+ /* force errors to be fatal */
+ fatal_mask |= G_LOG_LEVEL_ERROR;
+ /* remove bogus flag */
+ fatal_mask &= ~G_LOG_FLAG_FATAL;
+
+ g_mutex_lock (g_messages_lock);
+ old_mask = g_log_always_fatal;
+ g_log_always_fatal = fatal_mask;
+ g_mutex_unlock (g_messages_lock);
+
+ return old_mask;
+}
+
+GLogLevelFlags
+g_log_set_fatal_mask (const gchar *log_domain,
+ GLogLevelFlags fatal_mask)
+{
+ GLogLevelFlags old_flags;
+ register GLogDomain *domain;
+
+ if (!log_domain)
+ log_domain = "";
+
+ /* force errors to be fatal */
+ fatal_mask |= G_LOG_LEVEL_ERROR;
+ /* remove bogus flag */
+ fatal_mask &= ~G_LOG_FLAG_FATAL;
+
+ g_mutex_lock (g_messages_lock);
+
+ domain = g_log_find_domain_L (log_domain);
+ if (!domain)
+ domain = g_log_domain_new_L (log_domain);
+ old_flags = domain->fatal_mask;
+
+ domain->fatal_mask = fatal_mask;
+ g_log_domain_check_free_L (domain);
+
+ g_mutex_unlock (g_messages_lock);
+
+ return old_flags;
+}
+
+guint
+g_log_set_handler (const gchar *log_domain,
+ GLogLevelFlags log_levels,
+ GLogFunc log_func,
+ gpointer user_data)
+{
+ static guint handler_id = 0;
+ GLogDomain *domain;
+ GLogHandler *handler;
+
+ g_return_val_if_fail ((log_levels & G_LOG_LEVEL_MASK) != 0, 0);
+ g_return_val_if_fail (log_func != NULL, 0);
+
+ if (!log_domain)
+ log_domain = "";
+
+ handler = g_new (GLogHandler, 1);
+
+ g_mutex_lock (g_messages_lock);
+
+ domain = g_log_find_domain_L (log_domain);
+ if (!domain)
+ domain = g_log_domain_new_L (log_domain);
+
+ handler->id = ++handler_id;
+ handler->log_level = log_levels;
+ handler->log_func = log_func;
+ handler->data = user_data;
+ handler->next = domain->handlers;
+ domain->handlers = handler;
+
+ g_mutex_unlock (g_messages_lock);
+
+ return handler_id;
+}
+
+GLogFunc
+g_log_set_default_handler (GLogFunc log_func,
+ gpointer user_data)
+{
+ GLogFunc old_log_func;
+
+ g_mutex_lock (g_messages_lock);
+ old_log_func = default_log_func;
+ default_log_func = log_func;
+ default_log_data = user_data;
+ g_mutex_unlock (g_messages_lock);
+
+ return old_log_func;
+}
+
+void
+g_log_remove_handler (const gchar *log_domain,
+ guint handler_id)
+{
+ register GLogDomain *domain;
+
+ g_return_if_fail (handler_id > 0);
+
+ if (!log_domain)
+ log_domain = "";
+
+ g_mutex_lock (g_messages_lock);
+ domain = g_log_find_domain_L (log_domain);
+ if (domain)
+ {
+ GLogHandler *work, *last;
+
+ last = NULL;
+ work = domain->handlers;
+ while (work)
+ {
+ if (work->id == handler_id)
+ {
+ if (last)
+ last->next = work->next;
+ else
+ domain->handlers = work->next;
+ g_log_domain_check_free_L (domain);
+ g_mutex_unlock (g_messages_lock);
+ g_free (work);
+ return;
+ }
+ last = work;
+ work = last->next;
+ }
+ }
+ g_mutex_unlock (g_messages_lock);
+ g_warning ("%s: could not find handler with id `%d' for domain \"%s\"",
+ G_STRLOC, handler_id, log_domain);
+}
+
+void
+g_logv (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *format,
+ va_list args1)
+{
+ gboolean was_fatal = (log_level & G_LOG_FLAG_FATAL) != 0;
+ gboolean was_recursion = (log_level & G_LOG_FLAG_RECURSION) != 0;
+ gint i;
+
+ log_level &= G_LOG_LEVEL_MASK;
+ if (!log_level)
+ return;
+
+ for (i = g_bit_nth_msf (log_level, -1); i >= 0; i = g_bit_nth_msf (log_level, i))
+ {
+ register GLogLevelFlags test_level;
+
+ test_level = 1 << i;
+ if (log_level & test_level)
+ {
+ guint depth = GPOINTER_TO_UINT (g_private_get (g_log_depth));
+ GLogDomain *domain;
+ GLogFunc log_func;
+ GLogLevelFlags domain_fatal_mask;
+ gpointer data = NULL;
+
+ if (was_fatal)
+ test_level |= G_LOG_FLAG_FATAL;
+ if (was_recursion)
+ test_level |= G_LOG_FLAG_RECURSION;
+
+ /* check recursion and lookup handler */
+ g_mutex_lock (g_messages_lock);
+ domain = g_log_find_domain_L (log_domain ? log_domain : "");
+ if (depth)
+ test_level |= G_LOG_FLAG_RECURSION;
+ depth++;
+ domain_fatal_mask = domain ? domain->fatal_mask : G_LOG_FATAL_MASK;
+ if ((domain_fatal_mask | g_log_always_fatal) & test_level)
+ test_level |= G_LOG_FLAG_FATAL;
+ if (test_level & G_LOG_FLAG_RECURSION)
+ log_func = _g_log_fallback_handler;
+ else
+ log_func = g_log_domain_get_handler_L (domain, test_level, &data);
+ domain = NULL;
+ g_mutex_unlock (g_messages_lock);
+
+ g_private_set (g_log_depth, GUINT_TO_POINTER (depth));
+
+ /* had to defer debug initialization until we can keep track of recursion */
+ if (!(test_level & G_LOG_FLAG_RECURSION) && !_g_debug_initialized)
+ {
+ GLogLevelFlags orig_test_level = test_level;
+
+ _g_debug_init ();
+ if ((domain_fatal_mask | g_log_always_fatal) & test_level)
+ test_level |= G_LOG_FLAG_FATAL;
+ if (test_level != orig_test_level)
+ {
+ /* need a relookup, not nice, but not too bad either */
+ g_mutex_lock (g_messages_lock);
+ domain = g_log_find_domain_L (log_domain ? log_domain : "");
+ log_func = g_log_domain_get_handler_L (domain, test_level, &data);
+ domain = NULL;
+ g_mutex_unlock (g_messages_lock);
+ }
+ }
+
+ if (test_level & G_LOG_FLAG_RECURSION)
+ {
+ /* we use a stack buffer of fixed size, since we're likely
+ * in an out-of-memory situation
+ */
+ gchar buffer[1025];
+ gint size;
+ size = _g_vsnprintf (buffer, 1024, format, args1);
+
+ log_func (log_domain, test_level, buffer, data);
+ }
+ else
+ {
+ gchar *msg = g_strdup_vprintf (format, args1);
+
+ log_func (log_domain, test_level, msg, data);
+
+ g_free (msg);
+ }
+
+ if (test_level & G_LOG_FLAG_FATAL)
+ {
+#ifdef G_OS_WIN32
+ gchar *locale_msg = g_locale_from_utf8 (fatal_msg_buf, -1, NULL, NULL, NULL);
+
+ MessageBox (NULL, locale_msg, NULL,
+ MB_ICONERROR|MB_SETFOREGROUND);
+ if (IsDebuggerPresent () && !(test_level & G_LOG_FLAG_RECURSION))
+ G_BREAKPOINT ();
+ else
+ abort ();
+#else
+#if defined (G_ENABLE_DEBUG) && defined (SIGTRAP)
+ if (!(test_level & G_LOG_FLAG_RECURSION))
+ G_BREAKPOINT ();
+ else
+ abort ();
+#else /* !G_ENABLE_DEBUG || !SIGTRAP */
+ abort ();
+#endif /* !G_ENABLE_DEBUG || !SIGTRAP */
+#endif /* !G_OS_WIN32 */
+ }
+
+ depth--;
+ g_private_set (g_log_depth, GUINT_TO_POINTER (depth));
+ }
+ }
+}
+
+void
+g_log (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *format,
+ ...)
+{
+ va_list args;
+
+ va_start (args, format);
+ g_logv (log_domain, log_level, format, args);
+ va_end (args);
+}
+
+void
+g_return_if_fail_warning (const char *log_domain,
+ const char *pretty_function,
+ const char *expression)
+{
+ /*
+ * Omit the prefix used by the PLT-reduction
+ * technique used in GTK+.
+ */
+ if (g_str_has_prefix (pretty_function, "IA__"))
+ pretty_function += 4;
+ g_log (log_domain,
+ G_LOG_LEVEL_CRITICAL,
+ "%s: assertion `%s' failed",
+ pretty_function,
+ expression);
+}
+
+void
+g_warn_message (const char *domain,
+ const char *file,
+ int line,
+ const char *func,
+ const char *warnexpr)
+{
+ char *s, lstr[32];
+ g_snprintf (lstr, 32, "%d", line);
+ if (warnexpr)
+ s = g_strconcat ("(", file, ":", lstr, "):",
+ func, func[0] ? ":" : "",
+ " runtime check failed: (", warnexpr, ")", NULL);
+ else
+ s = g_strconcat ("(", file, ":", lstr, "):",
+ func, func[0] ? ":" : "",
+ " ", "code should not be reached", NULL);
+ g_log (domain, G_LOG_LEVEL_WARNING, "%s", s);
+ g_free (s);
+}
+
+void
+g_assert_warning (const char *log_domain,
+ const char *file,
+ const int line,
+ const char *pretty_function,
+ const char *expression)
+{
+ /*
+ * Omit the prefix used by the PLT-reduction
+ * technique used in GTK+.
+ */
+ if (g_str_has_prefix (pretty_function, "IA__"))
+ pretty_function += 4;
+ g_log (log_domain,
+ G_LOG_LEVEL_ERROR,
+ expression
+ ? "file %s: line %d (%s): assertion failed: (%s)"
+ : "file %s: line %d (%s): should not be reached",
+ file,
+ line,
+ pretty_function,
+ expression);
+ abort ();
+}
+
+#define CHAR_IS_SAFE(wc) (!((wc < 0x20 && wc != '\t' && wc != '\n' && wc != '\r') || \
+ (wc == 0x7f) || \
+ (wc >= 0x80 && wc < 0xa0)))
+
+static gchar*
+strdup_convert (const gchar *string,
+ const gchar *charset)
+{
+ if (!g_utf8_validate (string, -1, NULL))
+ {
+ GString *gstring = g_string_new ("[Invalid UTF-8] ");
+ guchar *p;
+
+ for (p = (guchar *)string; *p; p++)
+ {
+ if (CHAR_IS_SAFE(*p) &&
+ !(*p == '\r' && *(p + 1) != '\n') &&
+ *p < 0x80)
+ g_string_append_c (gstring, *p);
+ else
+ g_string_append_printf (gstring, "\\x%02x", (guint)(guchar)*p);
+ }
+
+ return g_string_free (gstring, FALSE);
+ }
+ else
+ {
+ GError *err = NULL;
+
+ gchar *result = g_convert_with_fallback (string, -1, charset, "UTF-8", "?", NULL, NULL, &err);
+ if (result)
+ return result;
+ else
+ {
+ /* Not thread-safe, but doesn't matter if we print the warning twice
+ */
+ static gboolean warned = FALSE;
+ if (!warned)
+ {
+ warned = TRUE;
+ _g_fprintf (stderr, "GLib: Cannot convert message: %s\n", err->message);
+ }
+ g_error_free (err);
+
+ return g_strdup (string);
+ }
+ }
+}
+
+/* For a radix of 8 we need at most 3 output bytes for 1 input
+ * byte. Additionally we might need up to 2 output bytes for the
+ * readix prefix and 1 byte for the trailing NULL.
+ */
+#define FORMAT_UNSIGNED_BUFSIZE ((GLIB_SIZEOF_LONG * 3) + 3)
+
+static void
+format_unsigned (gchar *buf,
+ gulong num,
+ guint radix)
+{
+ gulong tmp;
+ gchar c;
+ gint i, n;
+
+ /* we may not call _any_ GLib functions here (or macros like g_return_if_fail()) */
+
+ if (radix != 8 && radix != 10 && radix != 16)
+ {
+ *buf = '\000';
+ return;
+ }
+
+ if (!num)
+ {
+ *buf++ = '0';
+ *buf = '\000';
+ return;
+ }
+
+ if (radix == 16)
+ {
+ *buf++ = '0';
+ *buf++ = 'x';
+ }
+ else if (radix == 8)
+ {
+ *buf++ = '0';
+ }
+
+ n = 0;
+ tmp = num;
+ while (tmp)
+ {
+ tmp /= radix;
+ n++;
+ }
+
+ i = n;
+
+ /* Again we can't use g_assert; actually this check should _never_ fail. */
+ if (n > FORMAT_UNSIGNED_BUFSIZE - 3)
+ {
+ *buf = '\000';
+ return;
+ }
+
+ while (num)
+ {
+ i--;
+ c = (num % radix);
+ if (c < 10)
+ buf[i] = c + '0';
+ else
+ buf[i] = c + 'a' - 10;
+ num /= radix;
+ }
+
+ buf[n] = '\000';
+}
+
+/* string size big enough to hold level prefix */
+#define STRING_BUFFER_SIZE (FORMAT_UNSIGNED_BUFSIZE + 32)
+
+#define ALERT_LEVELS (G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING)
+
+static int
+mklevel_prefix (gchar level_prefix[STRING_BUFFER_SIZE],
+ GLogLevelFlags log_level)
+{
+ gboolean to_stdout = TRUE;
+
+ /* we may not call _any_ GLib functions here */
+
+ switch (log_level & G_LOG_LEVEL_MASK)
+ {
+ case G_LOG_LEVEL_ERROR:
+ strcpy (level_prefix, "ERROR");
+ to_stdout = FALSE;
+ break;
+ case G_LOG_LEVEL_CRITICAL:
+ strcpy (level_prefix, "CRITICAL");
+ to_stdout = FALSE;
+ break;
+ case G_LOG_LEVEL_WARNING:
+ strcpy (level_prefix, "WARNING");
+ to_stdout = FALSE;
+ break;
+ case G_LOG_LEVEL_MESSAGE:
+ strcpy (level_prefix, "Message");
+ to_stdout = FALSE;
+ break;
+ case G_LOG_LEVEL_INFO:
+ strcpy (level_prefix, "INFO");
+ break;
+ case G_LOG_LEVEL_DEBUG:
+ strcpy (level_prefix, "DEBUG");
+ break;
+ default:
+ if (log_level)
+ {
+ strcpy (level_prefix, "LOG-");
+ format_unsigned (level_prefix + 4, log_level & G_LOG_LEVEL_MASK, 16);
+ }
+ else
+ strcpy (level_prefix, "LOG");
+ break;
+ }
+ if (log_level & G_LOG_FLAG_RECURSION)
+ strcat (level_prefix, " (recursed)");
+ if (log_level & ALERT_LEVELS)
+ strcat (level_prefix, " **");
+
+#ifdef G_OS_WIN32
+ win32_keep_fatal_message = (log_level & G_LOG_FLAG_FATAL) != 0;
+#endif
+ return to_stdout ? 1 : 2;
+}
+
+void
+_g_log_fallback_handler (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer unused_data)
+{
+ gchar level_prefix[STRING_BUFFER_SIZE];
+#ifndef G_OS_WIN32
+ gchar pid_string[FORMAT_UNSIGNED_BUFSIZE];
+#endif
+ gboolean is_fatal = (log_level & G_LOG_FLAG_FATAL) != 0;
+ int fd;
+
+ /* we can not call _any_ GLib functions in this fallback handler,
+ * which is why we skip UTF-8 conversion, etc.
+ * since we either recursed or ran out of memory, we're in a pretty
+ * pathologic situation anyways, what we can do is giving the
+ * the process ID unconditionally however.
+ */
+
+ fd = mklevel_prefix (level_prefix, log_level);
+ if (!message)
+ message = "(NULL) message";
+
+#ifndef G_OS_WIN32
+ format_unsigned (pid_string, getpid (), 10);
+#endif
+
+ if (log_domain)
+ write_string (fd, "\n");
+ else
+ write_string (fd, "\n** ");
+
+#ifndef G_OS_WIN32
+ write_string (fd, "(process:");
+ write_string (fd, pid_string);
+ write_string (fd, "): ");
+#endif
+
+ if (log_domain)
+ {
+ write_string (fd, log_domain);
+ write_string (fd, "-");
+ }
+ write_string (fd, level_prefix);
+ write_string (fd, ": ");
+ write_string (fd, message);
+ if (is_fatal)
+ write_string (fd, "\naborting...\n");
+ else
+ write_string (fd, "\n");
+}
+
+static void
+escape_string (GString *string)
+{
+ const char *p = string->str;
+ gunichar wc;
+
+ while (p < string->str + string->len)
+ {
+ gboolean safe;
+
+ wc = g_utf8_get_char_validated (p, -1);
+ if (wc == (gunichar)-1 || wc == (gunichar)-2)
+ {
+ gchar *tmp;
+ guint pos;
+
+ pos = p - string->str;
+
+ /* Emit invalid UTF-8 as hex escapes
+ */
+ tmp = g_strdup_printf ("\\x%02x", (guint)(guchar)*p);
+ g_string_erase (string, pos, 1);
+ g_string_insert (string, pos, tmp);
+
+ p = string->str + (pos + 4); /* Skip over escape sequence */
+
+ g_free (tmp);
+ continue;
+ }
+ if (wc == '\r')
+ {
+ safe = *(p + 1) == '\n';
+ }
+ else
+ {
+ safe = CHAR_IS_SAFE (wc);
+ }
+
+ if (!safe)
+ {
+ gchar *tmp;
+ guint pos;
+
+ pos = p - string->str;
+
+ /* Largest char we escape is 0x0a, so we don't have to worry
+ * about 8-digit \Uxxxxyyyy
+ */
+ tmp = g_strdup_printf ("\\u%04x", wc);
+ g_string_erase (string, pos, g_utf8_next_char (p) - p);
+ g_string_insert (string, pos, tmp);
+ g_free (tmp);
+
+ p = string->str + (pos + 6); /* Skip over escape sequence */
+ }
+ else
+ p = g_utf8_next_char (p);
+ }
+}
+
+void
+g_log_default_handler (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer unused_data)
+{
+ gboolean is_fatal = (log_level & G_LOG_FLAG_FATAL) != 0;
+ gchar level_prefix[STRING_BUFFER_SIZE], *string;
+ GString *gstring;
+ int fd;
+
+ /* we can be called externally with recursion for whatever reason */
+ if (log_level & G_LOG_FLAG_RECURSION)
+ {
+ _g_log_fallback_handler (log_domain, log_level, message, unused_data);
+ return;
+ }
+
+ g_messages_prefixed_init ();
+
+ fd = mklevel_prefix (level_prefix, log_level);
+
+ gstring = g_string_new (NULL);
+ if (log_level & ALERT_LEVELS)
+ g_string_append (gstring, "\n");
+ if (!log_domain)
+ g_string_append (gstring, "** ");
+
+ if ((g_log_msg_prefix & log_level) == log_level)
+ {
+ const gchar *prg_name = g_get_prgname ();
+
+ if (!prg_name)
+ g_string_append_printf (gstring, "(process:%lu): ", (gulong)getpid ());
+ else
+ g_string_append_printf (gstring, "(%s:%lu): ", prg_name, (gulong)getpid ());
+ }
+
+ if (log_domain)
+ {
+ g_string_append (gstring, log_domain);
+ g_string_append_c (gstring, '-');
+ }
+ g_string_append (gstring, level_prefix);
+
+ g_string_append (gstring, ": ");
+ if (!message)
+ g_string_append (gstring, "(NULL) message");
+ else
+ {
+ GString *msg;
+ const gchar *charset;
+
+ msg = g_string_new (message);
+ escape_string (msg);
+
+ if (g_get_charset (&charset))
+ g_string_append (gstring, msg->str); /* charset is UTF-8 already */
+ else
+ {
+ string = strdup_convert (msg->str, charset);
+ g_string_append (gstring, string);
+ g_free (string);
+ }
+
+ g_string_free (msg, TRUE);
+ }
+ if (is_fatal)
+ g_string_append (gstring, "\naborting...\n");
+ else
+ g_string_append (gstring, "\n");
+
+ string = g_string_free (gstring, FALSE);
+
+ write_string (fd, string);
+ g_free (string);
+}
+
+GPrintFunc
+g_set_print_handler (GPrintFunc func)
+{
+ GPrintFunc old_print_func;
+
+ g_mutex_lock (g_messages_lock);
+ old_print_func = glib_print_func;
+ glib_print_func = func;
+ g_mutex_unlock (g_messages_lock);
+
+ return old_print_func;
+}
+
+void
+g_print (const gchar *format,
+ ...)
+{
+ va_list args;
+ gchar *string;
+ GPrintFunc local_glib_print_func;
+
+ g_return_if_fail (format != NULL);
+
+ va_start (args, format);
+ string = g_strdup_vprintf (format, args);
+ va_end (args);
+
+ g_mutex_lock (g_messages_lock);
+ local_glib_print_func = glib_print_func;
+ g_mutex_unlock (g_messages_lock);
+
+ if (local_glib_print_func)
+ local_glib_print_func (string);
+ else
+ {
+ const gchar *charset;
+
+ if (g_get_charset (&charset))
+ fputs (string, stdout); /* charset is UTF-8 already */
+ else
+ {
+ gchar *lstring = strdup_convert (string, charset);
+
+ fputs (lstring, stdout);
+ g_free (lstring);
+ }
+ fflush (stdout);
+ }
+ g_free (string);
+}
+
+GPrintFunc
+g_set_printerr_handler (GPrintFunc func)
+{
+ GPrintFunc old_printerr_func;
+
+ g_mutex_lock (g_messages_lock);
+ old_printerr_func = glib_printerr_func;
+ glib_printerr_func = func;
+ g_mutex_unlock (g_messages_lock);
+
+ return old_printerr_func;
+}
+
+void
+g_printerr (const gchar *format,
+ ...)
+{
+ va_list args;
+ gchar *string;
+ GPrintFunc local_glib_printerr_func;
+
+ g_return_if_fail (format != NULL);
+
+ va_start (args, format);
+ string = g_strdup_vprintf (format, args);
+ va_end (args);
+
+ g_mutex_lock (g_messages_lock);
+ local_glib_printerr_func = glib_printerr_func;
+ g_mutex_unlock (g_messages_lock);
+
+ if (local_glib_printerr_func)
+ local_glib_printerr_func (string);
+ else
+ {
+ const gchar *charset;
+
+ if (g_get_charset (&charset))
+ fputs (string, stderr); /* charset is UTF-8 already */
+ else
+ {
+ gchar *lstring = strdup_convert (string, charset);
+
+ fputs (lstring, stderr);
+ g_free (lstring);
+ }
+ fflush (stderr);
+ }
+ g_free (string);
+}
+
+#endif /* NOT_NEEDED_FOR_NAVIT */
+gsize
+g_printf_string_upper_bound (const gchar *format,
+ va_list args)
+{
+#ifdef HAVE_API_WIN32_BASE
+ gchar c[16384];
+ return _g_vsnprintf (c, 16384, format, args) + 1;
+#else
+ gchar c;
+ return _g_vsnprintf (&c, 1, format, args) + 1;
+#endif
+}
+
+#if NOT_NEEDED_FOR_NAVIT
+void
+_g_messages_thread_init_nomessage (void)
+{
+ g_messages_lock = g_mutex_new ();
+ g_log_depth = g_private_new (NULL);
+ g_messages_prefixed_init ();
+ _g_debug_init ();
+}
+
+gboolean _g_debug_initialized = FALSE;
+guint _g_debug_flags = 0;
+
+void
+_g_debug_init (void)
+{
+ const gchar *val;
+
+ _g_debug_initialized = TRUE;
+
+ val = g_getenv ("G_DEBUG");
+ if (val != NULL)
+ {
+ const GDebugKey keys[] = {
+ {"fatal_warnings", G_DEBUG_FATAL_WARNINGS},
+ {"fatal_criticals", G_DEBUG_FATAL_CRITICALS}
+ };
+
+ _g_debug_flags = g_parse_debug_string (val, keys, G_N_ELEMENTS (keys));
+ }
+
+ if (_g_debug_flags & G_DEBUG_FATAL_WARNINGS)
+ {
+ GLogLevelFlags fatal_mask;
+
+ fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
+ fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
+ g_log_set_always_fatal (fatal_mask);
+ }
+
+ if (_g_debug_flags & G_DEBUG_FATAL_CRITICALS)
+ {
+ GLogLevelFlags fatal_mask;
+
+ fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
+ fatal_mask |= G_LOG_LEVEL_CRITICAL;
+ g_log_set_always_fatal (fatal_mask);
+ }
+}
+#endif /* NOT_NEEDED_FOR_NAVIT */
+
+#define __G_MESSAGES_C__
+#include "galiasdef.c"
diff --git a/support/glib/gmessages.h b/support/glib/gmessages.h
new file mode 100644
index 00000000..af5a826f
--- /dev/null
+++ b/support/glib/gmessages.h
@@ -0,0 +1,341 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#ifndef __G_MESSAGES_H__
+#define __G_MESSAGES_H__
+
+#include <stdarg.h>
+#include <glib/gtypes.h>
+#include <glib/gmacros.h>
+
+/* Suppress warnings when GCC is in -pedantic mode and not -std=c99
+ */
+#if (__GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
+#pragma GCC system_header
+#endif
+
+G_BEGIN_DECLS
+
+/* calculate a string size, guaranteed to fit format + args.
+ */
+gsize g_printf_string_upper_bound (const gchar* format,
+ va_list args);
+
+/* Log level shift offset for user defined
+ * log levels (0-7 are used by GLib).
+ */
+#define G_LOG_LEVEL_USER_SHIFT (8)
+
+/* Glib log levels and flags.
+ */
+typedef enum
+{
+ /* log flags */
+ G_LOG_FLAG_RECURSION = 1 << 0,
+ G_LOG_FLAG_FATAL = 1 << 1,
+
+ /* GLib log levels */
+ G_LOG_LEVEL_ERROR = 1 << 2, /* always fatal */
+ G_LOG_LEVEL_CRITICAL = 1 << 3,
+ G_LOG_LEVEL_WARNING = 1 << 4,
+ G_LOG_LEVEL_MESSAGE = 1 << 5,
+ G_LOG_LEVEL_INFO = 1 << 6,
+ G_LOG_LEVEL_DEBUG = 1 << 7,
+
+ G_LOG_LEVEL_MASK = ~(G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL)
+} GLogLevelFlags;
+
+/* GLib log levels that are considered fatal by default */
+#define G_LOG_FATAL_MASK (G_LOG_FLAG_RECURSION | G_LOG_LEVEL_ERROR)
+
+typedef void (*GLogFunc) (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer user_data);
+
+/* Logging mechanism
+ */
+guint g_log_set_handler (const gchar *log_domain,
+ GLogLevelFlags log_levels,
+ GLogFunc log_func,
+ gpointer user_data);
+void g_log_remove_handler (const gchar *log_domain,
+ guint handler_id);
+void g_log_default_handler (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer unused_data);
+GLogFunc g_log_set_default_handler (GLogFunc log_func,
+ gpointer user_data);
+void g_log (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (3, 4);
+void g_logv (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *format,
+ va_list args);
+GLogLevelFlags g_log_set_fatal_mask (const gchar *log_domain,
+ GLogLevelFlags fatal_mask);
+GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask);
+
+/* internal */
+G_GNUC_INTERNAL void _g_log_fallback_handler (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer unused_data);
+
+/* Internal functions, used to implement the following macros */
+void g_return_if_fail_warning (const char *log_domain,
+ const char *pretty_function,
+ const char *expression);
+void g_warn_message (const char *domain,
+ const char *file,
+ int line,
+ const char *func,
+ const char *warnexpr);
+#ifndef G_DISABLE_DEPRECATED
+void g_assert_warning (const char *log_domain,
+ const char *file,
+ const int line,
+ const char *pretty_function,
+ const char *expression) G_GNUC_NORETURN;
+#endif /* !G_DISABLE_DEPRECATED */
+
+
+#ifndef G_LOG_DOMAIN
+#define G_LOG_DOMAIN ((gchar*) 0)
+#endif /* G_LOG_DOMAIN */
+#ifdef G_HAVE_ISO_VARARGS
+/* for(;;); so that GCC knows that control doesn't go past g_error() */
+#define g_error(...) G_STMT_START { \
+ g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_ERROR, \
+ __VA_ARGS__); \
+ for (;;); \
+ } G_STMT_END
+
+#define g_message(...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_MESSAGE, \
+ __VA_ARGS__)
+#define g_critical(...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_CRITICAL, \
+ __VA_ARGS__)
+#define g_warning(...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_WARNING, \
+ __VA_ARGS__)
+#define g_debug(...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_DEBUG, \
+ __VA_ARGS__)
+#elif defined(G_HAVE_GNUC_VARARGS)
+#define g_error(format...) G_STMT_START { \
+ g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_ERROR, \
+ format); \
+ for (;;); \
+ } G_STMT_END
+
+#define g_message(format...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_MESSAGE, \
+ format)
+#define g_critical(format...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_CRITICAL, \
+ format)
+#define g_warning(format...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_WARNING, \
+ format)
+#define g_debug(format...) g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_DEBUG, \
+ format)
+#else /* no varargs macros */
+static void
+g_error (const gchar *format,
+ ...)
+{
+ va_list args;
+ va_start (args, format);
+ g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
+ va_end (args);
+
+ for(;;);
+}
+static void
+g_message (const gchar *format,
+ ...)
+{
+ va_list args;
+ va_start (args, format);
+ g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, format, args);
+ va_end (args);
+}
+static void
+g_critical (const gchar *format,
+ ...)
+{
+ va_list args;
+ va_start (args, format);
+ g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, format, args);
+ va_end (args);
+}
+static void
+g_warning (const gchar *format,
+ ...)
+{
+ va_list args;
+ va_start (args, format);
+ g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, format, args);
+ va_end (args);
+}
+static void
+g_debug (const gchar *format,
+ ...)
+{
+ va_list args;
+ va_start (args, format);
+ g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format, args);
+ va_end (args);
+}
+#endif /* !__GNUC__ */
+
+typedef void (*GPrintFunc) (const gchar *string);
+void g_print (const gchar *format,
+ ...) G_GNUC_PRINTF (1, 2);
+GPrintFunc g_set_print_handler (GPrintFunc func);
+void g_printerr (const gchar *format,
+ ...) G_GNUC_PRINTF (1, 2);
+GPrintFunc g_set_printerr_handler (GPrintFunc func);
+
+
+/* Provide macros for graceful error handling.
+ * The "return" macros will return from the current function.
+ * Two different definitions are given for the macros in
+ * order to support gcc's __PRETTY_FUNCTION__ capability.
+ */
+
+#define g_warn_if_reached() do { g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, NULL); } while (0)
+#define g_warn_if_fail(expr) do { if G_LIKELY (expr) ; else \
+ g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, #expr); } while (0)
+
+#ifdef G_DISABLE_CHECKS
+
+#define g_return_if_fail(expr) G_STMT_START{ (void)0; }G_STMT_END
+#define g_return_val_if_fail(expr,val) G_STMT_START{ (void)0; }G_STMT_END
+#define g_return_if_reached() G_STMT_START{ return; }G_STMT_END
+#define g_return_val_if_reached(val) G_STMT_START{ return (val); }G_STMT_END
+
+#else /* !G_DISABLE_CHECKS */
+
+#ifdef __GNUC__
+
+#define g_return_if_fail(expr) G_STMT_START{ \
+ if G_LIKELY(expr) { } else \
+ { \
+ g_return_if_fail_warning (G_LOG_DOMAIN, \
+ __PRETTY_FUNCTION__, \
+ #expr); \
+ return; \
+ }; }G_STMT_END
+
+#define g_return_val_if_fail(expr,val) G_STMT_START{ \
+ if G_LIKELY(expr) { } else \
+ { \
+ g_return_if_fail_warning (G_LOG_DOMAIN, \
+ __PRETTY_FUNCTION__, \
+ #expr); \
+ return (val); \
+ }; }G_STMT_END
+
+#define g_return_if_reached() G_STMT_START{ \
+ g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_CRITICAL, \
+ "file %s: line %d (%s): should not be reached", \
+ __FILE__, \
+ __LINE__, \
+ __PRETTY_FUNCTION__); \
+ return; }G_STMT_END
+
+#define g_return_val_if_reached(val) G_STMT_START{ \
+ g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_CRITICAL, \
+ "file %s: line %d (%s): should not be reached", \
+ __FILE__, \
+ __LINE__, \
+ __PRETTY_FUNCTION__); \
+ return (val); }G_STMT_END
+
+#else /* !__GNUC__ */
+
+#define g_return_if_fail(expr) G_STMT_START{ \
+ if (expr) { } else \
+ { \
+ g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_CRITICAL, \
+ "file %s: line %d: assertion `%s' failed", \
+ __FILE__, \
+ __LINE__, \
+ #expr); \
+ return; \
+ }; }G_STMT_END
+
+#define g_return_val_if_fail(expr, val) G_STMT_START{ \
+ if (expr) { } else \
+ { \
+ g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_CRITICAL, \
+ "file %s: line %d: assertion `%s' failed", \
+ __FILE__, \
+ __LINE__, \
+ #expr); \
+ return (val); \
+ }; }G_STMT_END
+
+#define g_return_if_reached() G_STMT_START{ \
+ g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_CRITICAL, \
+ "file %s: line %d: should not be reached", \
+ __FILE__, \
+ __LINE__); \
+ return; }G_STMT_END
+
+#define g_return_val_if_reached(val) G_STMT_START{ \
+ g_log (G_LOG_DOMAIN, \
+ G_LOG_LEVEL_CRITICAL, \
+ "file %s: line %d: should not be reached", \
+ __FILE__, \
+ __LINE__); \
+ return (val); }G_STMT_END
+
+#endif /* !__GNUC__ */
+
+#endif /* !G_DISABLE_CHECKS */
+
+G_END_DECLS
+
+#endif /* __G_MESSAGES_H__ */
diff --git a/support/glib/gprimes.c b/support/glib/gprimes.c
new file mode 100644
index 00000000..7beca710
--- /dev/null
+++ b/support/glib/gprimes.c
@@ -0,0 +1,90 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+/*
+ * MT safe
+ */
+
+#include "config.h"
+
+#include "glib.h"
+#include "galias.h"
+
+
+static const guint g_primes[] =
+{
+ 11,
+ 19,
+ 37,
+ 73,
+ 109,
+ 163,
+ 251,
+ 367,
+ 557,
+ 823,
+ 1237,
+ 1861,
+ 2777,
+ 4177,
+ 6247,
+ 9371,
+ 14057,
+ 21089,
+ 31627,
+ 47431,
+ 71143,
+ 106721,
+ 160073,
+ 240101,
+ 360163,
+ 540217,
+ 810343,
+ 1215497,
+ 1823231,
+ 2734867,
+ 4102283,
+ 6153409,
+ 9230113,
+ 13845163,
+};
+
+static const guint g_nprimes = sizeof (g_primes) / sizeof (g_primes[0]);
+
+guint
+g_spaced_primes_closest (guint num)
+{
+ gint i;
+
+ for (i = 0; i < g_nprimes; i++)
+ if (g_primes[i] > num)
+ return g_primes[i];
+
+ return g_primes[g_nprimes - 1];
+}
+
+#define __G_PRIMES_C__
+#include "galiasdef.c"
diff --git a/support/glib/gprintf.c b/support/glib/gprintf.c
new file mode 100644
index 00000000..6cbb214d
--- /dev/null
+++ b/support/glib/gprintf.c
@@ -0,0 +1,342 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997, 2002 Peter Mattis, Red Hat, Inc.
+ *
+ * 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.
+ */
+
+#include "config.h"
+
+#define _GNU_SOURCE /* For vasprintf */
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "glib.h"
+#include "gprintf.h"
+#include "gprintfint.h"
+
+#include "galias.h"
+
+/**
+ * g_printf:
+ * @format: a standard printf() format string, but notice
+ * <link linkend="string-precision">string precision pitfalls</link>.
+ * @Varargs: the arguments to insert in the output.
+ *
+ * An implementation of the standard printf() function which supports
+ * positional parameters, as specified in the Single Unix Specification.
+ *
+ * Returns: the number of bytes printed.
+ *
+ * Since: 2.2
+ **/
+gint
+g_printf (gchar const *format,
+ ...)
+{
+ va_list args;
+ gint retval;
+
+ va_start (args, format);
+ retval = g_vprintf (format, args);
+ va_end (args);
+
+ return retval;
+}
+
+/**
+ * g_fprintf:
+ * @file: the stream to write to.
+ * @format: a standard printf() format string, but notice
+ * <link linkend="string-precision">string precision pitfalls</link>.
+ * @Varargs: the arguments to insert in the output.
+ *
+ * An implementation of the standard fprintf() function which supports
+ * positional parameters, as specified in the Single Unix Specification.
+ *
+ * Returns: the number of bytes printed.
+ *
+ * Since: 2.2
+ **/
+gint
+g_fprintf (FILE *file,
+ gchar const *format,
+ ...)
+{
+ va_list args;
+ gint retval;
+
+ va_start (args, format);
+ retval = g_vfprintf (file, format, args);
+ va_end (args);
+
+ return retval;
+}
+
+/**
+ * g_sprintf:
+ * @string: A pointer to a memory buffer to contain the resulting string. It
+ * is up to the caller to ensure that the allocated buffer is large
+ * enough to hold the formatted result
+ * @format: a standard printf() format string, but notice
+ * <link linkend="string-precision">string precision pitfalls</link>.
+ * @Varargs: the arguments to insert in the output.
+ *
+ * An implementation of the standard sprintf() function which supports
+ * positional parameters, as specified in the Single Unix Specification.
+ *
+ * Returns: the number of bytes printed.
+ *
+ * Since: 2.2
+ **/
+gint
+g_sprintf (gchar *string,
+ gchar const *format,
+ ...)
+{
+ va_list args;
+ gint retval;
+
+ va_start (args, format);
+ retval = g_vsprintf (string, format, args);
+ va_end (args);
+
+ return retval;
+}
+
+/**
+ * g_snprintf:
+ * @string: the buffer to hold the output.
+ * @n: the maximum number of bytes to produce (including the
+ * terminating nul character).
+ * @format: a standard printf() format string, but notice
+ * <link linkend="string-precision">string precision pitfalls</link>.
+ * @Varargs: the arguments to insert in the output.
+ *
+ * A safer form of the standard sprintf() function. The output is guaranteed
+ * to not exceed @n characters (including the terminating nul character), so
+ * it is easy to ensure that a buffer overflow cannot occur.
+ *
+ * See also g_strdup_printf().
+ *
+ * In versions of GLib prior to 1.2.3, this function may return -1 if the
+ * output was truncated, and the truncated string may not be nul-terminated.
+ * In versions prior to 1.3.12, this function returns the length of the output
+ * string.
+ *
+ * The return value of g_snprintf() conforms to the snprintf()
+ * function as standardized in ISO C99. Note that this is different from
+ * traditional snprintf(), which returns the length of the output string.
+ *
+ * The format string may contain positional parameters, as specified in
+ * the Single Unix Specification.
+ *
+ * Returns: the number of bytes which would be produced if the buffer
+ * was large enough.
+ **/
+gint
+g_snprintf (gchar *string,
+ gulong n,
+ gchar const *format,
+ ...)
+{
+ va_list args;
+ gint retval;
+
+ va_start (args, format);
+ retval = g_vsnprintf (string, n, format, args);
+ va_end (args);
+
+ return retval;
+}
+
+/**
+ * g_vprintf:
+ * @format: a standard printf() format string, but notice
+ * <link linkend="string-precision">string precision pitfalls</link>.
+ * @args: the list of arguments to insert in the output.
+ *
+ * An implementation of the standard vprintf() function which supports
+ * positional parameters, as specified in the Single Unix Specification.
+ *
+ * Returns: the number of bytes printed.
+ *
+ * Since: 2.2
+ **/
+gint
+g_vprintf (gchar const *format,
+ va_list args)
+{
+ g_return_val_if_fail (format != NULL, -1);
+
+ return _g_vprintf (format, args);
+}
+
+/**
+ * g_vfprintf:
+ * @file: the stream to write to.
+ * @format: a standard printf() format string, but notice
+ * <link linkend="string-precision">string precision pitfalls</link>.
+ * @args: the list of arguments to insert in the output.
+ *
+ * An implementation of the standard fprintf() function which supports
+ * positional parameters, as specified in the Single Unix Specification.
+ *
+ * Returns: the number of bytes printed.
+ *
+ * Since: 2.2
+ **/
+gint
+g_vfprintf (FILE *file,
+ gchar const *format,
+ va_list args)
+{
+ g_return_val_if_fail (format != NULL, -1);
+
+ return _g_vfprintf (file, format, args);
+}
+
+/**
+ * g_vsprintf:
+ * @string: the buffer to hold the output.
+ * @format: a standard printf() format string, but notice
+ * <link linkend="string-precision">string precision pitfalls</link>.
+ * @args: the list of arguments to insert in the output.
+ *
+ * An implementation of the standard vsprintf() function which supports
+ * positional parameters, as specified in the Single Unix Specification.
+ *
+ * Returns: the number of bytes printed.
+ *
+ * Since: 2.2
+ **/
+gint
+g_vsprintf (gchar *string,
+ gchar const *format,
+ va_list args)
+{
+ g_return_val_if_fail (string != NULL, -1);
+ g_return_val_if_fail (format != NULL, -1);
+
+ return _g_vsprintf (string, format, args);
+}
+
+/**
+ * g_vsnprintf:
+ * @string: the buffer to hold the output.
+ * @n: the maximum number of bytes to produce (including the
+ * terminating nul character).
+ * @format: a standard printf() format string, but notice
+ * <link linkend="string-precision">string precision pitfalls</link>.
+ * @args: the list of arguments to insert in the output.
+ *
+ * A safer form of the standard vsprintf() function. The output is guaranteed
+ * to not exceed @n characters (including the terminating nul character), so
+ * it is easy to ensure that a buffer overflow cannot occur.
+ *
+ * See also g_strdup_vprintf().
+ *
+ * In versions of GLib prior to 1.2.3, this function may return -1 if the
+ * output was truncated, and the truncated string may not be nul-terminated.
+ * In versions prior to 1.3.12, this function returns the length of the output
+ * string.
+ *
+ * The return value of g_vsnprintf() conforms to the vsnprintf() function
+ * as standardized in ISO C99. Note that this is different from traditional
+ * vsnprintf(), which returns the length of the output string.
+ *
+ * The format string may contain positional parameters, as specified in
+ * the Single Unix Specification.
+ *
+ * Returns: the number of bytes which would be produced if the buffer
+ * was large enough.
+ */
+gint
+g_vsnprintf (gchar *string,
+ gulong n,
+ gchar const *format,
+ va_list args)
+{
+ g_return_val_if_fail (n == 0 || string != NULL, -1);
+ g_return_val_if_fail (format != NULL, -1);
+
+ return _g_vsnprintf (string, n, format, args);
+}
+
+/**
+ * g_vasprintf:
+ * @string: the return location for the newly-allocated string.
+ * @format: a standard printf() format string, but notice
+ * <link linkend="string-precision">string precision pitfalls</link>.
+ * @args: the list of arguments to insert in the output.
+ *
+ * An implementation of the GNU vasprintf() function which supports
+ * positional parameters, as specified in the Single Unix Specification.
+ * This function is similar to g_vsprintf(), except that it allocates a
+ * string to hold the output, instead of putting the output in a buffer
+ * you allocate in advance.
+ *
+ * Returns: the number of bytes printed.
+ *
+ * Since: 2.4
+ **/
+gint
+g_vasprintf (gchar **string,
+ gchar const *format,
+ va_list args)
+{
+ gint len;
+ g_return_val_if_fail (string != NULL, -1);
+
+#if !defined(HAVE_GOOD_PRINTF)
+
+ len = _g_gnulib_vasprintf (string, format, args);
+ if (len < 0)
+ *string = NULL;
+
+#elif defined (HAVE_VASPRINTF)
+
+ len = vasprintf (string, format, args);
+ if (len < 0)
+ *string = NULL;
+ else if (!g_mem_is_system_malloc ())
+ {
+ /* vasprintf returns malloc-allocated memory */
+ gchar *string1 = g_strndup (*string, len);
+ free (*string);
+ *string = string1;
+ }
+
+#else
+
+ {
+ va_list args2;
+
+ G_VA_COPY (args2, args);
+
+ *string = g_new (gchar, g_printf_string_upper_bound (format, args));
+
+ len = _g_vsprintf (*string, format, args2);
+ va_end (args2);
+ }
+#endif
+
+ return len;
+}
+
+#define __G_PRINTF_C__
+#include "galiasdef.c"
diff --git a/support/glib/gprintf.h b/support/glib/gprintf.h
new file mode 100644
index 00000000..d96870fb
--- /dev/null
+++ b/support/glib/gprintf.h
@@ -0,0 +1,52 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997, 2002 Peter Mattis, Red Hat, Inc.
+ *
+ * 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.
+ */
+
+#ifndef __G_PRINTF_H__
+#define __G_PRINTF_H__
+
+#include <glib.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+G_BEGIN_DECLS
+
+gint g_printf (gchar const *format,
+ ...) G_GNUC_PRINTF (1, 2);
+gint g_fprintf (FILE *file,
+ gchar const *format,
+ ...) G_GNUC_PRINTF (2, 3);
+gint g_sprintf (gchar *string,
+ gchar const *format,
+ ...) G_GNUC_PRINTF (2, 3);
+
+gint g_vprintf (gchar const *format,
+ va_list args);
+gint g_vfprintf (FILE *file,
+ gchar const *format,
+ va_list args);
+gint g_vsprintf (gchar *string,
+ gchar const *format,
+ va_list args);
+gint g_vasprintf (gchar **string,
+ gchar const *format,
+ va_list args);
+
+G_END_DECLS
+
+#endif /* __G_PRINTF_H__ */
diff --git a/support/glib/gprintfint.h b/support/glib/gprintfint.h
new file mode 100644
index 00000000..0c975a1e
--- /dev/null
+++ b/support/glib/gprintfint.h
@@ -0,0 +1,59 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+
+/*
+ * Modified by the GLib Team and others 2002. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __G_PRINTFINT_H__
+#define __G_PRINTFINT_H__
+
+#ifdef HAVE_GOOD_PRINTF
+
+#define _g_printf printf
+#define _g_fprintf fprintf
+#define _g_sprintf sprintf
+#define _g_snprintf snprintf
+
+#define _g_vprintf vprintf
+#define _g_vfprintf vfprintf
+#define _g_vsprintf vsprintf
+#define _g_vsnprintf vsnprintf
+
+#else
+
+#include "gnulib/printf.h"
+
+#define _g_printf _g_gnulib_printf
+#define _g_fprintf _g_gnulib_fprintf
+#define _g_sprintf _g_gnulib_sprintf
+#define _g_snprintf _g_gnulib_snprintf
+
+#define _g_vprintf _g_gnulib_vprintf
+#define _g_vfprintf _g_gnulib_vfprintf
+#define _g_vsprintf _g_gnulib_vsprintf
+#define _g_vsnprintf _g_gnulib_vsnprintf
+
+#endif
+
+#endif /* __G_PRINTF_H__ */
+
diff --git a/support/glib/gquark.h b/support/glib/gquark.h
new file mode 100644
index 00000000..a0cbe2fd
--- /dev/null
+++ b/support/glib/gquark.h
@@ -0,0 +1,52 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#ifndef __G_QUARK_H__
+#define __G_QUARK_H__
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+typedef guint32 GQuark;
+
+/* Quarks (string<->id association)
+ */
+GQuark g_quark_try_string (const gchar *string);
+GQuark g_quark_from_static_string (const gchar *string);
+GQuark g_quark_from_string (const gchar *string);
+G_CONST_RETURN gchar* g_quark_to_string (GQuark quark) G_GNUC_CONST;
+
+G_CONST_RETURN gchar* g_intern_string (const gchar *string);
+G_CONST_RETURN gchar* g_intern_static_string (const gchar *string);
+
+G_END_DECLS
+
+#endif /* __G_QUARK_H__ */
diff --git a/support/glib/gslice.c b/support/glib/gslice.c
new file mode 100644
index 00000000..d61420d2
--- /dev/null
+++ b/support/glib/gslice.c
@@ -0,0 +1,1493 @@
+/* GLIB sliced memory - fast concurrent memory chunk allocator
+ * Copyright (C) 2005 Tim Janik
+ *
+ * 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.
+ */
+/* MT safe */
+
+#include "config.h"
+
+#if defined HAVE_POSIX_MEMALIGN && defined POSIX_MEMALIGN_WITH_COMPLIANT_ALLOCS
+# define HAVE_COMPLIANT_POSIX_MEMALIGN 1
+#endif
+
+#ifdef HAVE_COMPLIANT_POSIX_MEMALIGN
+#define _XOPEN_SOURCE 600 /* posix_memalign() */
+#endif
+#include <stdlib.h> /* posix_memalign() */
+#include <string.h>
+#include <errno.h>
+#include "gmem.h" /* gslice.h */
+#include "gthreadprivate.h"
+#include "glib.h"
+#include "galias.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h> /* sysconf() */
+#endif
+#ifdef G_OS_WIN32
+#include <windows.h>
+#include <process.h>
+#endif
+
+#include <stdio.h> /* fputs/fprintf */
+
+
+/* the GSlice allocator is split up into 4 layers, roughly modelled after the slab
+ * allocator and magazine extensions as outlined in:
+ * + [Bonwick94] Jeff Bonwick, The slab allocator: An object-caching kernel
+ * memory allocator. USENIX 1994, http://citeseer.ist.psu.edu/bonwick94slab.html
+ * + [Bonwick01] Bonwick and Jonathan Adams, Magazines and vmem: Extending the
+ * slab allocator to many cpu's and arbitrary resources.
+ * USENIX 2001, http://citeseer.ist.psu.edu/bonwick01magazines.html
+ * the layers are:
+ * - the thread magazines. for each (aligned) chunk size, a magazine (a list)
+ * of recently freed and soon to be allocated chunks is maintained per thread.
+ * this way, most alloc/free requests can be quickly satisfied from per-thread
+ * free lists which only require one g_private_get() call to retrive the
+ * thread handle.
+ * - the magazine cache. allocating and freeing chunks to/from threads only
+ * occours at magazine sizes from a global depot of magazines. the depot
+ * maintaines a 15 second working set of allocated magazines, so full
+ * magazines are not allocated and released too often.
+ * the chunk size dependent magazine sizes automatically adapt (within limits,
+ * see [3]) to lock contention to properly scale performance across a variety
+ * of SMP systems.
+ * - the slab allocator. this allocator allocates slabs (blocks of memory) close
+ * to the system page size or multiples thereof which have to be page aligned.
+ * the blocks are divided into smaller chunks which are used to satisfy
+ * allocations from the upper layers. the space provided by the reminder of
+ * the chunk size division is used for cache colorization (random distribution
+ * of chunk addresses) to improve processor cache utilization. multiple slabs
+ * with the same chunk size are kept in a partially sorted ring to allow O(1)
+ * freeing and allocation of chunks (as long as the allocation of an entirely
+ * new slab can be avoided).
+ * - the page allocator. on most modern systems, posix_memalign(3) or
+ * memalign(3) should be available, so this is used to allocate blocks with
+ * system page size based alignments and sizes or multiples thereof.
+ * if no memalign variant is provided, valloc() is used instead and
+ * block sizes are limited to the system page size (no multiples thereof).
+ * as a fallback, on system without even valloc(), a malloc(3)-based page
+ * allocator with alloc-only behaviour is used.
+ *
+ * NOTES:
+ * [1] some systems memalign(3) implementations may rely on boundary tagging for
+ * the handed out memory chunks. to avoid excessive page-wise fragmentation,
+ * we reserve 2 * sizeof (void*) per block size for the systems memalign(3),
+ * specified in NATIVE_MALLOC_PADDING.
+ * [2] using the slab allocator alone already provides for a fast and efficient
+ * allocator, it doesn't properly scale beyond single-threaded uses though.
+ * also, the slab allocator implements eager free(3)-ing, i.e. does not
+ * provide any form of caching or working set maintenance. so if used alone,
+ * it's vulnerable to trashing for sequences of balanced (alloc, free) pairs
+ * at certain thresholds.
+ * [3] magazine sizes are bound by an implementation specific minimum size and
+ * a chunk size specific maximum to limit magazine storage sizes to roughly
+ * 16KB.
+ * [4] allocating ca. 8 chunks per block/page keeps a good balance between
+ * external and internal fragmentation (<= 12.5%). [Bonwick94]
+ */
+#if NOT_NEEDED_FOR_NAVIT
+
+/* --- macros and constants --- */
+#define LARGEALIGNMENT (256)
+#define P2ALIGNMENT (2 * sizeof (gsize)) /* fits 2 pointers (assumed to be 2 * GLIB_SIZEOF_SIZE_T below) */
+#define ALIGN(size, base) ((base) * (gsize) (((size) + (base) - 1) / (base)))
+#define NATIVE_MALLOC_PADDING P2ALIGNMENT /* per-page padding left for native malloc(3) see [1] */
+#define SLAB_INFO_SIZE P2ALIGN (sizeof (SlabInfo) + NATIVE_MALLOC_PADDING)
+#define MAX_MAGAZINE_SIZE (256) /* see [3] and allocator_get_magazine_threshold() for this */
+#define MIN_MAGAZINE_SIZE (4)
+#define MAX_STAMP_COUNTER (7) /* distributes the load of gettimeofday() */
+#define MAX_SLAB_CHUNK_SIZE(al) (((al)->max_page_size - SLAB_INFO_SIZE) / 8) /* we want at last 8 chunks per page, see [4] */
+#define MAX_SLAB_INDEX(al) (SLAB_INDEX (al, MAX_SLAB_CHUNK_SIZE (al)) + 1)
+#define SLAB_INDEX(al, asize) ((asize) / P2ALIGNMENT - 1) /* asize must be P2ALIGNMENT aligned */
+#define SLAB_CHUNK_SIZE(al, ix) (((ix) + 1) * P2ALIGNMENT)
+#define SLAB_BPAGE_SIZE(al,csz) (8 * (csz) + SLAB_INFO_SIZE)
+
+/* optimized version of ALIGN (size, P2ALIGNMENT) */
+#if GLIB_SIZEOF_SIZE_T * 2 == 8 /* P2ALIGNMENT */
+#define P2ALIGN(size) (((size) + 0x7) & ~(gsize) 0x7)
+#elif GLIB_SIZEOF_SIZE_T * 2 == 16 /* P2ALIGNMENT */
+#define P2ALIGN(size) (((size) + 0xf) & ~(gsize) 0xf)
+#else
+#define P2ALIGN(size) ALIGN (size, P2ALIGNMENT)
+#endif
+
+/* special helpers to avoid gmessage.c dependency */
+static void mem_error (const char *format, ...) G_GNUC_PRINTF (1,2);
+#define mem_assert(cond) do { if (G_LIKELY (cond)) ; else mem_error ("assertion failed: %s", #cond); } while (0)
+
+/* --- structures --- */
+typedef struct _ChunkLink ChunkLink;
+typedef struct _SlabInfo SlabInfo;
+typedef struct _CachedMagazine CachedMagazine;
+struct _ChunkLink {
+ ChunkLink *next;
+ ChunkLink *data;
+};
+struct _SlabInfo {
+ ChunkLink *chunks;
+ guint n_allocated;
+ SlabInfo *next, *prev;
+};
+typedef struct {
+ ChunkLink *chunks;
+ gsize count; /* approximative chunks list length */
+} Magazine;
+typedef struct {
+ Magazine *magazine1; /* array of MAX_SLAB_INDEX (allocator) */
+ Magazine *magazine2; /* array of MAX_SLAB_INDEX (allocator) */
+} ThreadMemory;
+typedef struct {
+ gboolean always_malloc;
+ gboolean bypass_magazines;
+ gboolean debug_blocks;
+ gsize working_set_msecs;
+ guint color_increment;
+} SliceConfig;
+typedef struct {
+ /* const after initialization */
+ gsize min_page_size, max_page_size;
+ SliceConfig config;
+ gsize max_slab_chunk_size_for_magazine_cache;
+ /* magazine cache */
+ GMutex *magazine_mutex;
+ ChunkLink **magazines; /* array of MAX_SLAB_INDEX (allocator) */
+ guint *contention_counters; /* array of MAX_SLAB_INDEX (allocator) */
+ gint mutex_counter;
+ guint stamp_counter;
+ guint last_stamp;
+ /* slab allocator */
+ GMutex *slab_mutex;
+ SlabInfo **slab_stack; /* array of MAX_SLAB_INDEX (allocator) */
+ guint color_accu;
+} Allocator;
+
+/* --- g-slice prototypes --- */
+static gpointer slab_allocator_alloc_chunk (gsize chunk_size);
+static void slab_allocator_free_chunk (gsize chunk_size,
+ gpointer mem);
+static void private_thread_memory_cleanup (gpointer data);
+static gpointer allocator_memalign (gsize alignment,
+ gsize memsize);
+static void allocator_memfree (gsize memsize,
+ gpointer mem);
+static inline void magazine_cache_update_stamp (void);
+static inline gsize allocator_get_magazine_threshold (Allocator *allocator,
+ guint ix);
+
+/* --- g-slice memory checker --- */
+static void smc_notify_alloc (void *pointer,
+ size_t size);
+static int smc_notify_free (void *pointer,
+ size_t size);
+
+/* --- variables --- */
+static GPrivate *private_thread_memory = NULL;
+static gsize sys_page_size = 0;
+static Allocator allocator[1] = { { 0, }, };
+static SliceConfig slice_config = {
+ FALSE, /* always_malloc */
+ FALSE, /* bypass_magazines */
+ FALSE, /* debug_blocks */
+ 15 * 1000, /* working_set_msecs */
+ 1, /* color increment, alt: 0x7fffffff */
+};
+static GMutex *smc_tree_mutex = NULL; /* mutex for G_SLICE=debug-blocks */
+
+/* --- auxillary funcitons --- */
+void
+g_slice_set_config (GSliceConfig ckey,
+ gint64 value)
+{
+ g_return_if_fail (sys_page_size == 0);
+ switch (ckey)
+ {
+ case G_SLICE_CONFIG_ALWAYS_MALLOC:
+ slice_config.always_malloc = value != 0;
+ break;
+ case G_SLICE_CONFIG_BYPASS_MAGAZINES:
+ slice_config.bypass_magazines = value != 0;
+ break;
+ case G_SLICE_CONFIG_WORKING_SET_MSECS:
+ slice_config.working_set_msecs = value;
+ break;
+ case G_SLICE_CONFIG_COLOR_INCREMENT:
+ slice_config.color_increment = value;
+ default: ;
+ }
+}
+
+gint64
+g_slice_get_config (GSliceConfig ckey)
+{
+ switch (ckey)
+ {
+ case G_SLICE_CONFIG_ALWAYS_MALLOC:
+ return slice_config.always_malloc;
+ case G_SLICE_CONFIG_BYPASS_MAGAZINES:
+ return slice_config.bypass_magazines;
+ case G_SLICE_CONFIG_WORKING_SET_MSECS:
+ return slice_config.working_set_msecs;
+ case G_SLICE_CONFIG_CHUNK_SIZES:
+ return MAX_SLAB_INDEX (allocator);
+ case G_SLICE_CONFIG_COLOR_INCREMENT:
+ return slice_config.color_increment;
+ default:
+ return 0;
+ }
+}
+
+gint64*
+g_slice_get_config_state (GSliceConfig ckey,
+ gint64 address,
+ guint *n_values)
+{
+ guint i = 0;
+ g_return_val_if_fail (n_values != NULL, NULL);
+ *n_values = 0;
+ switch (ckey)
+ {
+ gint64 array[64];
+ case G_SLICE_CONFIG_CONTENTION_COUNTER:
+ array[i++] = SLAB_CHUNK_SIZE (allocator, address);
+ array[i++] = allocator->contention_counters[address];
+ array[i++] = allocator_get_magazine_threshold (allocator, address);
+ *n_values = i;
+ return g_memdup (array, sizeof (array[0]) * *n_values);
+ default:
+ return NULL;
+ }
+}
+
+static void
+slice_config_init (SliceConfig *config)
+{
+ /* don't use g_malloc/g_message here */
+ gchar buffer[1024];
+ const gchar *val = _g_getenv_nomalloc ("G_SLICE", buffer);
+ const GDebugKey keys[] = {
+ { "always-malloc", 1 << 0 },
+ { "debug-blocks", 1 << 1 },
+ };
+ gint flags = !val ? 0 : g_parse_debug_string (val, keys, G_N_ELEMENTS (keys));
+ *config = slice_config;
+ if (flags & (1 << 0)) /* always-malloc */
+ config->always_malloc = TRUE;
+ if (flags & (1 << 1)) /* debug-blocks */
+ config->debug_blocks = TRUE;
+}
+
+static void
+g_slice_init_nomessage (void)
+{
+ /* we may not use g_error() or friends here */
+ mem_assert (sys_page_size == 0);
+ mem_assert (MIN_MAGAZINE_SIZE >= 4);
+
+#ifdef G_OS_WIN32
+ {
+ SYSTEM_INFO system_info;
+ GetSystemInfo (&system_info);
+ sys_page_size = system_info.dwPageSize;
+ }
+#else
+ sys_page_size = sysconf (_SC_PAGESIZE); /* = sysconf (_SC_PAGE_SIZE); = getpagesize(); */
+#endif
+ mem_assert (sys_page_size >= 2 * LARGEALIGNMENT);
+ mem_assert ((sys_page_size & (sys_page_size - 1)) == 0);
+ slice_config_init (&allocator->config);
+ allocator->min_page_size = sys_page_size;
+#if HAVE_COMPLIANT_POSIX_MEMALIGN || HAVE_MEMALIGN
+ /* allow allocation of pages up to 8KB (with 8KB alignment).
+ * this is useful because many medium to large sized structures
+ * fit less than 8 times (see [4]) into 4KB pages.
+ * we allow very small page sizes here, to reduce wastage in
+ * threads if only small allocations are required (this does
+ * bear the risk of incresing allocation times and fragmentation
+ * though).
+ */
+ allocator->min_page_size = MAX (allocator->min_page_size, 4096);
+ allocator->max_page_size = MAX (allocator->min_page_size, 8192);
+ allocator->min_page_size = MIN (allocator->min_page_size, 128);
+#else
+ /* we can only align to system page size */
+ allocator->max_page_size = sys_page_size;
+#endif
+ allocator->magazine_mutex = NULL; /* _g_slice_thread_init_nomessage() */
+ allocator->magazines = g_new0 (ChunkLink*, MAX_SLAB_INDEX (allocator));
+ allocator->contention_counters = g_new0 (guint, MAX_SLAB_INDEX (allocator));
+ allocator->mutex_counter = 0;
+ allocator->stamp_counter = MAX_STAMP_COUNTER; /* force initial update */
+ allocator->last_stamp = 0;
+ allocator->slab_mutex = NULL; /* _g_slice_thread_init_nomessage() */
+ allocator->slab_stack = g_new0 (SlabInfo*, MAX_SLAB_INDEX (allocator));
+ allocator->color_accu = 0;
+ magazine_cache_update_stamp();
+ /* values cached for performance reasons */
+ allocator->max_slab_chunk_size_for_magazine_cache = MAX_SLAB_CHUNK_SIZE (allocator);
+ if (allocator->config.always_malloc || allocator->config.bypass_magazines)
+ allocator->max_slab_chunk_size_for_magazine_cache = 0; /* non-optimized cases */
+ /* at this point, g_mem_gc_friendly() should be initialized, this
+ * should have been accomplished by the above g_malloc/g_new calls
+ */
+}
+
+static inline guint
+allocator_categorize (gsize aligned_chunk_size)
+{
+ /* speed up the likely path */
+ if (G_LIKELY (aligned_chunk_size && aligned_chunk_size <= allocator->max_slab_chunk_size_for_magazine_cache))
+ return 1; /* use magazine cache */
+
+ /* the above will fail (max_slab_chunk_size_for_magazine_cache == 0) if the
+ * allocator is still uninitialized, or if we are not configured to use the
+ * magazine cache.
+ */
+ if (!sys_page_size)
+ g_slice_init_nomessage ();
+ if (!allocator->config.always_malloc &&
+ aligned_chunk_size &&
+ aligned_chunk_size <= MAX_SLAB_CHUNK_SIZE (allocator))
+ {
+ if (allocator->config.bypass_magazines)
+ return 2; /* use slab allocator, see [2] */
+ return 1; /* use magazine cache */
+ }
+ return 0; /* use malloc() */
+}
+
+void
+_g_slice_thread_init_nomessage (void)
+{
+ /* we may not use g_error() or friends here */
+ if (!sys_page_size)
+ g_slice_init_nomessage();
+ else
+ {
+ /* g_slice_init_nomessage() has been called already, probably due
+ * to a g_slice_alloc1() before g_thread_init().
+ */
+ }
+ private_thread_memory = g_private_new (private_thread_memory_cleanup);
+ allocator->magazine_mutex = g_mutex_new();
+ allocator->slab_mutex = g_mutex_new();
+ if (allocator->config.debug_blocks)
+ smc_tree_mutex = g_mutex_new();
+}
+
+static inline void
+g_mutex_lock_a (GMutex *mutex,
+ guint *contention_counter)
+{
+ gboolean contention = FALSE;
+ if (!g_mutex_trylock (mutex))
+ {
+ g_mutex_lock (mutex);
+ contention = TRUE;
+ }
+ if (contention)
+ {
+ allocator->mutex_counter++;
+ if (allocator->mutex_counter >= 1) /* quickly adapt to contention */
+ {
+ allocator->mutex_counter = 0;
+ *contention_counter = MIN (*contention_counter + 1, MAX_MAGAZINE_SIZE);
+ }
+ }
+ else /* !contention */
+ {
+ allocator->mutex_counter--;
+ if (allocator->mutex_counter < -11) /* moderately recover magazine sizes */
+ {
+ allocator->mutex_counter = 0;
+ *contention_counter = MAX (*contention_counter, 1) - 1;
+ }
+ }
+}
+
+static inline ThreadMemory*
+thread_memory_from_self (void)
+{
+ ThreadMemory *tmem = g_private_get (private_thread_memory);
+ if (G_UNLIKELY (!tmem))
+ {
+ static ThreadMemory *single_thread_memory = NULL; /* remember single-thread info for multi-threaded case */
+ if (single_thread_memory && g_thread_supported ())
+ {
+ g_mutex_lock (allocator->slab_mutex);
+ if (single_thread_memory)
+ {
+ /* GSlice has been used before g_thread_init(), and now
+ * we are running threaded. to cope with it, use the saved
+ * thread memory structure from when we weren't threaded.
+ */
+ tmem = single_thread_memory;
+ single_thread_memory = NULL; /* slab_mutex protected when multi-threaded */
+ }
+ g_mutex_unlock (allocator->slab_mutex);
+ }
+ if (!tmem)
+ {
+ const guint n_magazines = MAX_SLAB_INDEX (allocator);
+ tmem = g_malloc0 (sizeof (ThreadMemory) + sizeof (Magazine) * 2 * n_magazines);
+ tmem->magazine1 = (Magazine*) (tmem + 1);
+ tmem->magazine2 = &tmem->magazine1[n_magazines];
+ }
+ /* g_private_get/g_private_set works in the single-threaded xor the multi-
+ * threaded case. but not *across* g_thread_init(), after multi-thread
+ * initialization it returns NULL for previously set single-thread data.
+ */
+ g_private_set (private_thread_memory, tmem);
+ /* save single-thread thread memory structure, in case we need to
+ * pick it up again after multi-thread initialization happened.
+ */
+ if (!single_thread_memory && !g_thread_supported ())
+ single_thread_memory = tmem; /* no slab_mutex created yet */
+ }
+ return tmem;
+}
+
+static inline ChunkLink*
+magazine_chain_pop_head (ChunkLink **magazine_chunks)
+{
+ /* magazine chains are linked via ChunkLink->next.
+ * each ChunkLink->data of the toplevel chain may point to a subchain,
+ * linked via ChunkLink->next. ChunkLink->data of the subchains just
+ * contains uninitialized junk.
+ */
+ ChunkLink *chunk = (*magazine_chunks)->data;
+ if (G_UNLIKELY (chunk))
+ {
+ /* allocating from freed list */
+ (*magazine_chunks)->data = chunk->next;
+ }
+ else
+ {
+ chunk = *magazine_chunks;
+ *magazine_chunks = chunk->next;
+ }
+ return chunk;
+}
+
+#if 0 /* useful for debugging */
+static guint
+magazine_count (ChunkLink *head)
+{
+ guint count = 0;
+ if (!head)
+ return 0;
+ while (head)
+ {
+ ChunkLink *child = head->data;
+ count += 1;
+ for (child = head->data; child; child = child->next)
+ count += 1;
+ head = head->next;
+ }
+ return count;
+}
+#endif
+
+static inline gsize
+allocator_get_magazine_threshold (Allocator *allocator,
+ guint ix)
+{
+ /* the magazine size calculated here has a lower bound of MIN_MAGAZINE_SIZE,
+ * which is required by the implementation. also, for moderately sized chunks
+ * (say >= 64 bytes), magazine sizes shouldn't be much smaller then the number
+ * of chunks available per page/2 to avoid excessive traffic in the magazine
+ * cache for small to medium sized structures.
+ * the upper bound of the magazine size is effectively provided by
+ * MAX_MAGAZINE_SIZE. for larger chunks, this number is scaled down so that
+ * the content of a single magazine doesn't exceed ca. 16KB.
+ */
+ gsize chunk_size = SLAB_CHUNK_SIZE (allocator, ix);
+ guint threshold = MAX (MIN_MAGAZINE_SIZE, allocator->max_page_size / MAX (5 * chunk_size, 5 * 32));
+ guint contention_counter = allocator->contention_counters[ix];
+ if (G_UNLIKELY (contention_counter)) /* single CPU bias */
+ {
+ /* adapt contention counter thresholds to chunk sizes */
+ contention_counter = contention_counter * 64 / chunk_size;
+ threshold = MAX (threshold, contention_counter);
+ }
+ return threshold;
+}
+
+/* --- magazine cache --- */
+static inline void
+magazine_cache_update_stamp (void)
+{
+ if (allocator->stamp_counter >= MAX_STAMP_COUNTER)
+ {
+ GTimeVal tv;
+ g_get_current_time (&tv);
+ allocator->last_stamp = tv.tv_sec * 1000 + tv.tv_usec / 1000; /* milli seconds */
+ allocator->stamp_counter = 0;
+ }
+ else
+ allocator->stamp_counter++;
+}
+
+static inline ChunkLink*
+magazine_chain_prepare_fields (ChunkLink *magazine_chunks)
+{
+ ChunkLink *chunk1;
+ ChunkLink *chunk2;
+ ChunkLink *chunk3;
+ ChunkLink *chunk4;
+ /* checked upon initialization: mem_assert (MIN_MAGAZINE_SIZE >= 4); */
+ /* ensure a magazine with at least 4 unused data pointers */
+ chunk1 = magazine_chain_pop_head (&magazine_chunks);
+ chunk2 = magazine_chain_pop_head (&magazine_chunks);
+ chunk3 = magazine_chain_pop_head (&magazine_chunks);
+ chunk4 = magazine_chain_pop_head (&magazine_chunks);
+ chunk4->next = magazine_chunks;
+ chunk3->next = chunk4;
+ chunk2->next = chunk3;
+ chunk1->next = chunk2;
+ return chunk1;
+}
+
+/* access the first 3 fields of a specially prepared magazine chain */
+#define magazine_chain_prev(mc) ((mc)->data)
+#define magazine_chain_stamp(mc) ((mc)->next->data)
+#define magazine_chain_uint_stamp(mc) GPOINTER_TO_UINT ((mc)->next->data)
+#define magazine_chain_next(mc) ((mc)->next->next->data)
+#define magazine_chain_count(mc) ((mc)->next->next->next->data)
+
+static void
+magazine_cache_trim (Allocator *allocator,
+ guint ix,
+ guint stamp)
+{
+ /* g_mutex_lock (allocator->mutex); done by caller */
+ /* trim magazine cache from tail */
+ ChunkLink *current = magazine_chain_prev (allocator->magazines[ix]);
+ ChunkLink *trash = NULL;
+ while (ABS (stamp - magazine_chain_uint_stamp (current)) >= allocator->config.working_set_msecs)
+ {
+ /* unlink */
+ ChunkLink *prev = magazine_chain_prev (current);
+ ChunkLink *next = magazine_chain_next (current);
+ magazine_chain_next (prev) = next;
+ magazine_chain_prev (next) = prev;
+ /* clear special fields, put on trash stack */
+ magazine_chain_next (current) = NULL;
+ magazine_chain_count (current) = NULL;
+ magazine_chain_stamp (current) = NULL;
+ magazine_chain_prev (current) = trash;
+ trash = current;
+ /* fixup list head if required */
+ if (current == allocator->magazines[ix])
+ {
+ allocator->magazines[ix] = NULL;
+ break;
+ }
+ current = prev;
+ }
+ g_mutex_unlock (allocator->magazine_mutex);
+ /* free trash */
+ if (trash)
+ {
+ const gsize chunk_size = SLAB_CHUNK_SIZE (allocator, ix);
+ g_mutex_lock (allocator->slab_mutex);
+ while (trash)
+ {
+ current = trash;
+ trash = magazine_chain_prev (current);
+ magazine_chain_prev (current) = NULL; /* clear special field */
+ while (current)
+ {
+ ChunkLink *chunk = magazine_chain_pop_head (&current);
+ slab_allocator_free_chunk (chunk_size, chunk);
+ }
+ }
+ g_mutex_unlock (allocator->slab_mutex);
+ }
+}
+
+static void
+magazine_cache_push_magazine (guint ix,
+ ChunkLink *magazine_chunks,
+ gsize count) /* must be >= MIN_MAGAZINE_SIZE */
+{
+ ChunkLink *current = magazine_chain_prepare_fields (magazine_chunks);
+ ChunkLink *next, *prev;
+ g_mutex_lock (allocator->magazine_mutex);
+ /* add magazine at head */
+ next = allocator->magazines[ix];
+ if (next)
+ prev = magazine_chain_prev (next);
+ else
+ next = prev = current;
+ magazine_chain_next (prev) = current;
+ magazine_chain_prev (next) = current;
+ magazine_chain_prev (current) = prev;
+ magazine_chain_next (current) = next;
+ magazine_chain_count (current) = (gpointer) count;
+ /* stamp magazine */
+ magazine_cache_update_stamp();
+ magazine_chain_stamp (current) = GUINT_TO_POINTER (allocator->last_stamp);
+ allocator->magazines[ix] = current;
+ /* free old magazines beyond a certain threshold */
+ magazine_cache_trim (allocator, ix, allocator->last_stamp);
+ /* g_mutex_unlock (allocator->mutex); was done by magazine_cache_trim() */
+}
+
+static ChunkLink*
+magazine_cache_pop_magazine (guint ix,
+ gsize *countp)
+{
+ g_mutex_lock_a (allocator->magazine_mutex, &allocator->contention_counters[ix]);
+ if (!allocator->magazines[ix])
+ {
+ guint magazine_threshold = allocator_get_magazine_threshold (allocator, ix);
+ gsize i, chunk_size = SLAB_CHUNK_SIZE (allocator, ix);
+ ChunkLink *chunk, *head;
+ g_mutex_unlock (allocator->magazine_mutex);
+ g_mutex_lock (allocator->slab_mutex);
+ head = slab_allocator_alloc_chunk (chunk_size);
+ head->data = NULL;
+ chunk = head;
+ for (i = 1; i < magazine_threshold; i++)
+ {
+ chunk->next = slab_allocator_alloc_chunk (chunk_size);
+ chunk = chunk->next;
+ chunk->data = NULL;
+ }
+ chunk->next = NULL;
+ g_mutex_unlock (allocator->slab_mutex);
+ *countp = i;
+ return head;
+ }
+ else
+ {
+ ChunkLink *current = allocator->magazines[ix];
+ ChunkLink *prev = magazine_chain_prev (current);
+ ChunkLink *next = magazine_chain_next (current);
+ /* unlink */
+ magazine_chain_next (prev) = next;
+ magazine_chain_prev (next) = prev;
+ allocator->magazines[ix] = next == current ? NULL : next;
+ g_mutex_unlock (allocator->magazine_mutex);
+ /* clear special fields and hand out */
+ *countp = (gsize) magazine_chain_count (current);
+ magazine_chain_prev (current) = NULL;
+ magazine_chain_next (current) = NULL;
+ magazine_chain_count (current) = NULL;
+ magazine_chain_stamp (current) = NULL;
+ return current;
+ }
+}
+
+/* --- thread magazines --- */
+static void
+private_thread_memory_cleanup (gpointer data)
+{
+ ThreadMemory *tmem = data;
+ const guint n_magazines = MAX_SLAB_INDEX (allocator);
+ guint ix;
+ for (ix = 0; ix < n_magazines; ix++)
+ {
+ Magazine *mags[2];
+ guint j;
+ mags[0] = &tmem->magazine1[ix];
+ mags[1] = &tmem->magazine2[ix];
+ for (j = 0; j < 2; j++)
+ {
+ Magazine *mag = mags[j];
+ if (mag->count >= MIN_MAGAZINE_SIZE)
+ magazine_cache_push_magazine (ix, mag->chunks, mag->count);
+ else
+ {
+ const gsize chunk_size = SLAB_CHUNK_SIZE (allocator, ix);
+ g_mutex_lock (allocator->slab_mutex);
+ while (mag->chunks)
+ {
+ ChunkLink *chunk = magazine_chain_pop_head (&mag->chunks);
+ slab_allocator_free_chunk (chunk_size, chunk);
+ }
+ g_mutex_unlock (allocator->slab_mutex);
+ }
+ }
+ }
+ g_free (tmem);
+}
+
+static void
+thread_memory_magazine1_reload (ThreadMemory *tmem,
+ guint ix)
+{
+ Magazine *mag = &tmem->magazine1[ix];
+ mem_assert (mag->chunks == NULL); /* ensure that we may reset mag->count */
+ mag->count = 0;
+ mag->chunks = magazine_cache_pop_magazine (ix, &mag->count);
+}
+
+static void
+thread_memory_magazine2_unload (ThreadMemory *tmem,
+ guint ix)
+{
+ Magazine *mag = &tmem->magazine2[ix];
+ magazine_cache_push_magazine (ix, mag->chunks, mag->count);
+ mag->chunks = NULL;
+ mag->count = 0;
+}
+
+static inline void
+thread_memory_swap_magazines (ThreadMemory *tmem,
+ guint ix)
+{
+ Magazine xmag = tmem->magazine1[ix];
+ tmem->magazine1[ix] = tmem->magazine2[ix];
+ tmem->magazine2[ix] = xmag;
+}
+
+static inline gboolean
+thread_memory_magazine1_is_empty (ThreadMemory *tmem,
+ guint ix)
+{
+ return tmem->magazine1[ix].chunks == NULL;
+}
+
+static inline gboolean
+thread_memory_magazine2_is_full (ThreadMemory *tmem,
+ guint ix)
+{
+ return tmem->magazine2[ix].count >= allocator_get_magazine_threshold (allocator, ix);
+}
+
+static inline gpointer
+thread_memory_magazine1_alloc (ThreadMemory *tmem,
+ guint ix)
+{
+ Magazine *mag = &tmem->magazine1[ix];
+ ChunkLink *chunk = magazine_chain_pop_head (&mag->chunks);
+ if (G_LIKELY (mag->count > 0))
+ mag->count--;
+ return chunk;
+}
+
+static inline void
+thread_memory_magazine2_free (ThreadMemory *tmem,
+ guint ix,
+ gpointer mem)
+{
+ Magazine *mag = &tmem->magazine2[ix];
+ ChunkLink *chunk = mem;
+ chunk->data = NULL;
+ chunk->next = mag->chunks;
+ mag->chunks = chunk;
+ mag->count++;
+}
+
+#endif /* NOT_NEEDED_FOR_NAVIT */
+/* --- API functions --- */
+gpointer
+g_slice_alloc (gsize mem_size)
+{
+#if NOT_NEEDED_FOR_NAVIT
+ gsize chunk_size;
+ gpointer mem;
+ guint acat;
+ chunk_size = P2ALIGN (mem_size);
+ acat = allocator_categorize (chunk_size);
+ if (G_LIKELY (acat == 1)) /* allocate through magazine layer */
+ {
+ ThreadMemory *tmem = thread_memory_from_self();
+ guint ix = SLAB_INDEX (allocator, chunk_size);
+ if (G_UNLIKELY (thread_memory_magazine1_is_empty (tmem, ix)))
+ {
+ thread_memory_swap_magazines (tmem, ix);
+ if (G_UNLIKELY (thread_memory_magazine1_is_empty (tmem, ix)))
+ thread_memory_magazine1_reload (tmem, ix);
+ }
+ mem = thread_memory_magazine1_alloc (tmem, ix);
+ }
+ else if (acat == 2) /* allocate through slab allocator */
+ {
+ g_mutex_lock (allocator->slab_mutex);
+ mem = slab_allocator_alloc_chunk (chunk_size);
+ g_mutex_unlock (allocator->slab_mutex);
+ }
+ else /* delegate to system malloc */
+ mem = g_malloc (mem_size);
+ if (G_UNLIKELY (allocator->config.debug_blocks))
+ smc_notify_alloc (mem, mem_size);
+ return mem;
+#else /* NOT_NEEDED_FOR_NAVIT */
+ return g_malloc(mem_size);
+#endif /* NOT_NEEDED_FOR_NAVIT */
+}
+
+gpointer
+g_slice_alloc0 (gsize mem_size)
+{
+ gpointer mem = g_slice_alloc (mem_size);
+ if (mem)
+ memset (mem, 0, mem_size);
+ return mem;
+}
+
+gpointer
+g_slice_copy (gsize mem_size,
+ gconstpointer mem_block)
+{
+ gpointer mem = g_slice_alloc (mem_size);
+ if (mem)
+ memcpy (mem, mem_block, mem_size);
+ return mem;
+}
+
+void
+g_slice_free1 (gsize mem_size,
+ gpointer mem_block)
+{
+#if NOT_NEEDED_FOR_NAVIT
+ gsize chunk_size = P2ALIGN (mem_size);
+ guint acat = allocator_categorize (chunk_size);
+ if (G_UNLIKELY (!mem_block))
+ return;
+ if (G_UNLIKELY (allocator->config.debug_blocks) &&
+ !smc_notify_free (mem_block, mem_size))
+ abort();
+ if (G_LIKELY (acat == 1)) /* allocate through magazine layer */
+ {
+ ThreadMemory *tmem = thread_memory_from_self();
+ guint ix = SLAB_INDEX (allocator, chunk_size);
+ if (G_UNLIKELY (thread_memory_magazine2_is_full (tmem, ix)))
+ {
+ thread_memory_swap_magazines (tmem, ix);
+ if (G_UNLIKELY (thread_memory_magazine2_is_full (tmem, ix)))
+ thread_memory_magazine2_unload (tmem, ix);
+ }
+ if (G_UNLIKELY (g_mem_gc_friendly))
+ memset (mem_block, 0, chunk_size);
+ thread_memory_magazine2_free (tmem, ix, mem_block);
+ }
+ else if (acat == 2) /* allocate through slab allocator */
+ {
+ if (G_UNLIKELY (g_mem_gc_friendly))
+ memset (mem_block, 0, chunk_size);
+ g_mutex_lock (allocator->slab_mutex);
+ slab_allocator_free_chunk (chunk_size, mem_block);
+ g_mutex_unlock (allocator->slab_mutex);
+ }
+ else /* delegate to system malloc */
+ {
+ if (G_UNLIKELY (g_mem_gc_friendly))
+ memset (mem_block, 0, mem_size);
+ g_free (mem_block);
+ }
+#else /* NOT_NEEDED_FOR_NAVIT */
+ g_free(mem_block);
+#endif /* NOT_NEEDED_FOR_NAVIT */
+}
+
+void
+g_slice_free_chain_with_offset (gsize mem_size,
+ gpointer mem_chain,
+ gsize next_offset)
+{
+ gpointer slice = mem_chain;
+#if NOT_NEEDED_FOR_NAVIT
+ /* while the thread magazines and the magazine cache are implemented so that
+ * they can easily be extended to allow for free lists containing more free
+ * lists for the first level nodes, which would allow O(1) freeing in this
+ * function, the benefit of such an extension is questionable, because:
+ * - the magazine size counts will become mere lower bounds which confuses
+ * the code adapting to lock contention;
+ * - freeing a single node to the thread magazines is very fast, so this
+ * O(list_length) operation is multiplied by a fairly small factor;
+ * - memory usage histograms on larger applications seem to indicate that
+ * the amount of released multi node lists is negligible in comparison
+ * to single node releases.
+ * - the major performance bottle neck, namely g_private_get() or
+ * g_mutex_lock()/g_mutex_unlock() has already been moved out of the
+ * inner loop for freeing chained slices.
+ */
+ gsize chunk_size = P2ALIGN (mem_size);
+ guint acat = allocator_categorize (chunk_size);
+ if (G_LIKELY (acat == 1)) /* allocate through magazine layer */
+ {
+ ThreadMemory *tmem = thread_memory_from_self();
+ guint ix = SLAB_INDEX (allocator, chunk_size);
+ while (slice)
+ {
+ guint8 *current = slice;
+ slice = *(gpointer*) (current + next_offset);
+ if (G_UNLIKELY (allocator->config.debug_blocks) &&
+ !smc_notify_free (current, mem_size))
+ abort();
+ if (G_UNLIKELY (thread_memory_magazine2_is_full (tmem, ix)))
+ {
+ thread_memory_swap_magazines (tmem, ix);
+ if (G_UNLIKELY (thread_memory_magazine2_is_full (tmem, ix)))
+ thread_memory_magazine2_unload (tmem, ix);
+ }
+ if (G_UNLIKELY (g_mem_gc_friendly))
+ memset (current, 0, chunk_size);
+ thread_memory_magazine2_free (tmem, ix, current);
+ }
+ }
+ else if (acat == 2) /* allocate through slab allocator */
+ {
+ g_mutex_lock (allocator->slab_mutex);
+ while (slice)
+ {
+ guint8 *current = slice;
+ slice = *(gpointer*) (current + next_offset);
+ if (G_UNLIKELY (allocator->config.debug_blocks) &&
+ !smc_notify_free (current, mem_size))
+ abort();
+ if (G_UNLIKELY (g_mem_gc_friendly))
+ memset (current, 0, chunk_size);
+ slab_allocator_free_chunk (chunk_size, current);
+ }
+ g_mutex_unlock (allocator->slab_mutex);
+ }
+ else /* delegate to system malloc */
+#else /* NOT_NEEDED_FOR_NAVIT */
+ while (slice)
+ {
+ guint8 *current = slice;
+ slice = *(gpointer*) (current + next_offset);
+#if NOT_NEEDED_FOR_NAVIT
+ if (G_UNLIKELY (allocator->config.debug_blocks) &&
+ !smc_notify_free (current, mem_size))
+ abort();
+#endif /* NOT_NEEDED_FOR_NAVIT */
+ if (G_UNLIKELY (g_mem_gc_friendly))
+ memset (current, 0, mem_size);
+ g_free (current);
+ }
+#endif /* NOT_NEEDED_FOR_NAVIT */
+}
+
+#if NOT_NEEDED_FOR_NAVIT
+/* --- single page allocator --- */
+static void
+allocator_slab_stack_push (Allocator *allocator,
+ guint ix,
+ SlabInfo *sinfo)
+{
+ /* insert slab at slab ring head */
+ if (!allocator->slab_stack[ix])
+ {
+ sinfo->next = sinfo;
+ sinfo->prev = sinfo;
+ }
+ else
+ {
+ SlabInfo *next = allocator->slab_stack[ix], *prev = next->prev;
+ next->prev = sinfo;
+ prev->next = sinfo;
+ sinfo->next = next;
+ sinfo->prev = prev;
+ }
+ allocator->slab_stack[ix] = sinfo;
+}
+
+static gsize
+allocator_aligned_page_size (Allocator *allocator,
+ gsize n_bytes)
+{
+ gsize val = 1 << g_bit_storage (n_bytes - 1);
+ val = MAX (val, allocator->min_page_size);
+ return val;
+}
+
+static void
+allocator_add_slab (Allocator *allocator,
+ guint ix,
+ gsize chunk_size)
+{
+ ChunkLink *chunk;
+ SlabInfo *sinfo;
+ gsize addr, padding, n_chunks, color = 0;
+ gsize page_size = allocator_aligned_page_size (allocator, SLAB_BPAGE_SIZE (allocator, chunk_size));
+ /* allocate 1 page for the chunks and the slab */
+ gpointer aligned_memory = allocator_memalign (page_size, page_size - NATIVE_MALLOC_PADDING);
+ guint8 *mem = aligned_memory;
+ guint i;
+ if (!mem)
+ {
+ const gchar *syserr = "unknown error";
+#if HAVE_STRERROR
+ syserr = strerror (errno);
+#endif
+ mem_error ("failed to allocate %u bytes (alignment: %u): %s\n",
+ (guint) (page_size - NATIVE_MALLOC_PADDING), (guint) page_size, syserr);
+ }
+ /* mask page adress */
+ addr = ((gsize) mem / page_size) * page_size;
+ /* assert alignment */
+ mem_assert (aligned_memory == (gpointer) addr);
+ /* basic slab info setup */
+ sinfo = (SlabInfo*) (mem + page_size - SLAB_INFO_SIZE);
+ sinfo->n_allocated = 0;
+ sinfo->chunks = NULL;
+ /* figure cache colorization */
+ n_chunks = ((guint8*) sinfo - mem) / chunk_size;
+ padding = ((guint8*) sinfo - mem) - n_chunks * chunk_size;
+ if (padding)
+ {
+ color = (allocator->color_accu * P2ALIGNMENT) % padding;
+ allocator->color_accu += allocator->config.color_increment;
+ }
+ /* add chunks to free list */
+ chunk = (ChunkLink*) (mem + color);
+ sinfo->chunks = chunk;
+ for (i = 0; i < n_chunks - 1; i++)
+ {
+ chunk->next = (ChunkLink*) ((guint8*) chunk + chunk_size);
+ chunk = chunk->next;
+ }
+ chunk->next = NULL; /* last chunk */
+ /* add slab to slab ring */
+ allocator_slab_stack_push (allocator, ix, sinfo);
+}
+
+static gpointer
+slab_allocator_alloc_chunk (gsize chunk_size)
+{
+ ChunkLink *chunk;
+ guint ix = SLAB_INDEX (allocator, chunk_size);
+ /* ensure non-empty slab */
+ if (!allocator->slab_stack[ix] || !allocator->slab_stack[ix]->chunks)
+ allocator_add_slab (allocator, ix, chunk_size);
+ /* allocate chunk */
+ chunk = allocator->slab_stack[ix]->chunks;
+ allocator->slab_stack[ix]->chunks = chunk->next;
+ allocator->slab_stack[ix]->n_allocated++;
+ /* rotate empty slabs */
+ if (!allocator->slab_stack[ix]->chunks)
+ allocator->slab_stack[ix] = allocator->slab_stack[ix]->next;
+ return chunk;
+}
+
+static void
+slab_allocator_free_chunk (gsize chunk_size,
+ gpointer mem)
+{
+ ChunkLink *chunk;
+ gboolean was_empty;
+ guint ix = SLAB_INDEX (allocator, chunk_size);
+ gsize page_size = allocator_aligned_page_size (allocator, SLAB_BPAGE_SIZE (allocator, chunk_size));
+ gsize addr = ((gsize) mem / page_size) * page_size;
+ /* mask page adress */
+ guint8 *page = (guint8*) addr;
+ SlabInfo *sinfo = (SlabInfo*) (page + page_size - SLAB_INFO_SIZE);
+ /* assert valid chunk count */
+ mem_assert (sinfo->n_allocated > 0);
+ /* add chunk to free list */
+ was_empty = sinfo->chunks == NULL;
+ chunk = (ChunkLink*) mem;
+ chunk->next = sinfo->chunks;
+ sinfo->chunks = chunk;
+ sinfo->n_allocated--;
+ /* keep slab ring partially sorted, empty slabs at end */
+ if (was_empty)
+ {
+ /* unlink slab */
+ SlabInfo *next = sinfo->next, *prev = sinfo->prev;
+ next->prev = prev;
+ prev->next = next;
+ if (allocator->slab_stack[ix] == sinfo)
+ allocator->slab_stack[ix] = next == sinfo ? NULL : next;
+ /* insert slab at head */
+ allocator_slab_stack_push (allocator, ix, sinfo);
+ }
+ /* eagerly free complete unused slabs */
+ if (!sinfo->n_allocated)
+ {
+ /* unlink slab */
+ SlabInfo *next = sinfo->next, *prev = sinfo->prev;
+ next->prev = prev;
+ prev->next = next;
+ if (allocator->slab_stack[ix] == sinfo)
+ allocator->slab_stack[ix] = next == sinfo ? NULL : next;
+ /* free slab */
+ allocator_memfree (page_size, page);
+ }
+}
+
+/* --- memalign implementation --- */
+#ifdef HAVE_MALLOC_H
+#include <malloc.h> /* memalign() */
+#endif
+
+/* from config.h:
+ * define HAVE_POSIX_MEMALIGN 1 // if free(posix_memalign(3)) works, <stdlib.h>
+ * define HAVE_COMPLIANT_POSIX_MEMALIGN 1 // if free(posix_memalign(3)) works for sizes != 2^n, <stdlib.h>
+ * define HAVE_MEMALIGN 1 // if free(memalign(3)) works, <malloc.h>
+ * define HAVE_VALLOC 1 // if free(valloc(3)) works, <stdlib.h> or <malloc.h>
+ * if none is provided, we implement malloc(3)-based alloc-only page alignment
+ */
+
+#if !(HAVE_COMPLIANT_POSIX_MEMALIGN || HAVE_MEMALIGN || HAVE_VALLOC)
+static GTrashStack *compat_valloc_trash = NULL;
+#endif
+
+static gpointer
+allocator_memalign (gsize alignment,
+ gsize memsize)
+{
+ gpointer aligned_memory = NULL;
+ gint err = ENOMEM;
+#if HAVE_COMPLIANT_POSIX_MEMALIGN
+ err = posix_memalign (&aligned_memory, alignment, memsize);
+#elif HAVE_MEMALIGN
+ errno = 0;
+ aligned_memory = memalign (alignment, memsize);
+ err = errno;
+#elif HAVE_VALLOC
+ errno = 0;
+ aligned_memory = valloc (memsize);
+ err = errno;
+#else
+ /* simplistic non-freeing page allocator */
+ mem_assert (alignment == sys_page_size);
+ mem_assert (memsize <= sys_page_size);
+ if (!compat_valloc_trash)
+ {
+ const guint n_pages = 16;
+ guint8 *mem = malloc (n_pages * sys_page_size);
+ err = errno;
+ if (mem)
+ {
+ gint i = n_pages;
+ guint8 *amem = (guint8*) ALIGN ((gsize) mem, sys_page_size);
+ if (amem != mem)
+ i--; /* mem wasn't page aligned */
+ while (--i >= 0)
+ g_trash_stack_push (&compat_valloc_trash, amem + i * sys_page_size);
+ }
+ }
+ aligned_memory = g_trash_stack_pop (&compat_valloc_trash);
+#endif
+ if (!aligned_memory)
+ errno = err;
+ return aligned_memory;
+}
+
+static void
+allocator_memfree (gsize memsize,
+ gpointer mem)
+{
+#if HAVE_COMPLIANT_POSIX_MEMALIGN || HAVE_MEMALIGN || HAVE_VALLOC
+ free (mem);
+#else
+ mem_assert (memsize <= sys_page_size);
+ g_trash_stack_push (&compat_valloc_trash, mem);
+#endif
+}
+
+static void
+mem_error (const char *format,
+ ...)
+{
+ const char *pname;
+ va_list args;
+ /* at least, put out "MEMORY-ERROR", in case we segfault during the rest of the function */
+ fputs ("\n***MEMORY-ERROR***: ", stderr);
+ pname = g_get_prgname();
+ fprintf (stderr, "%s[%ld]: GSlice: ", pname ? pname : "", (long)getpid());
+ va_start (args, format);
+ vfprintf (stderr, format, args);
+ va_end (args);
+ fputs ("\n", stderr);
+ abort();
+ _exit (1);
+}
+
+/* --- g-slice memory checker tree --- */
+typedef size_t SmcKType; /* key type */
+typedef size_t SmcVType; /* value type */
+typedef struct {
+ SmcKType key;
+ SmcVType value;
+} SmcEntry;
+static void smc_tree_insert (SmcKType key,
+ SmcVType value);
+static gboolean smc_tree_lookup (SmcKType key,
+ SmcVType *value_p);
+static gboolean smc_tree_remove (SmcKType key);
+
+
+/* --- g-slice memory checker implementation --- */
+static void
+smc_notify_alloc (void *pointer,
+ size_t size)
+{
+ size_t adress = (size_t) pointer;
+ if (pointer)
+ smc_tree_insert (adress, size);
+}
+
+#if 0
+static void
+smc_notify_ignore (void *pointer)
+{
+ size_t adress = (size_t) pointer;
+ if (pointer)
+ smc_tree_remove (adress);
+}
+#endif
+
+static int
+smc_notify_free (void *pointer,
+ size_t size)
+{
+ size_t adress = (size_t) pointer;
+ SmcVType real_size;
+ gboolean found_one;
+
+ if (!pointer)
+ return 1; /* ignore */
+ found_one = smc_tree_lookup (adress, &real_size);
+ if (!found_one)
+ {
+ fprintf (stderr, "GSlice: MemChecker: attempt to release non-allocated block: %p size=%" G_GSIZE_FORMAT "\n", pointer, size);
+ return 0;
+ }
+ if (real_size != size && (real_size || size))
+ {
+ fprintf (stderr, "GSlice: MemChecker: attempt to release block with invalid size: %p size=%" G_GSIZE_FORMAT " invalid-size=%" G_GSIZE_FORMAT "\n", pointer, real_size, size);
+ return 0;
+ }
+ if (!smc_tree_remove (adress))
+ {
+ fprintf (stderr, "GSlice: MemChecker: attempt to release non-allocated block: %p size=%" G_GSIZE_FORMAT "\n", pointer, size);
+ return 0;
+ }
+ return 1; /* all fine */
+}
+
+/* --- g-slice memory checker tree implementation --- */
+#define SMC_TRUNK_COUNT (4093 /* 16381 */) /* prime, to distribute trunk collisions (big, allocated just once) */
+#define SMC_BRANCH_COUNT (511) /* prime, to distribute branch collisions */
+#define SMC_TRUNK_EXTENT (SMC_BRANCH_COUNT * 2039) /* key adress space per trunk, should distribute uniformly across BRANCH_COUNT */
+#define SMC_TRUNK_HASH(k) ((k / SMC_TRUNK_EXTENT) % SMC_TRUNK_COUNT) /* generate new trunk hash per megabyte (roughly) */
+#define SMC_BRANCH_HASH(k) (k % SMC_BRANCH_COUNT)
+
+typedef struct {
+ SmcEntry *entries;
+ unsigned int n_entries;
+} SmcBranch;
+
+static SmcBranch **smc_tree_root = NULL;
+
+static void
+smc_tree_abort (int errval)
+{
+ const char *syserr = "unknown error";
+#if HAVE_STRERROR
+ syserr = strerror (errval);
+#endif
+ mem_error ("MemChecker: failure in debugging tree: %s", syserr);
+}
+
+static inline SmcEntry*
+smc_tree_branch_grow_L (SmcBranch *branch,
+ unsigned int index)
+{
+ unsigned int old_size = branch->n_entries * sizeof (branch->entries[0]);
+ unsigned int new_size = old_size + sizeof (branch->entries[0]);
+ SmcEntry *entry;
+ mem_assert (index <= branch->n_entries);
+ branch->entries = (SmcEntry*) realloc (branch->entries, new_size);
+ if (!branch->entries)
+ smc_tree_abort (errno);
+ entry = branch->entries + index;
+ g_memmove (entry + 1, entry, (branch->n_entries - index) * sizeof (entry[0]));
+ branch->n_entries += 1;
+ return entry;
+}
+
+static inline SmcEntry*
+smc_tree_branch_lookup_nearest_L (SmcBranch *branch,
+ SmcKType key)
+{
+ unsigned int n_nodes = branch->n_entries, offs = 0;
+ SmcEntry *check = branch->entries;
+ int cmp = 0;
+ while (offs < n_nodes)
+ {
+ unsigned int i = (offs + n_nodes) >> 1;
+ check = branch->entries + i;
+ cmp = key < check->key ? -1 : key != check->key;
+ if (cmp == 0)
+ return check; /* return exact match */
+ else if (cmp < 0)
+ n_nodes = i;
+ else /* (cmp > 0) */
+ offs = i + 1;
+ }
+ /* check points at last mismatch, cmp > 0 indicates greater key */
+ return cmp > 0 ? check + 1 : check; /* return insertion position for inexact match */
+}
+
+static void
+smc_tree_insert (SmcKType key,
+ SmcVType value)
+{
+ unsigned int ix0, ix1;
+ SmcEntry *entry;
+
+ g_mutex_lock (smc_tree_mutex);
+ ix0 = SMC_TRUNK_HASH (key);
+ ix1 = SMC_BRANCH_HASH (key);
+ if (!smc_tree_root)
+ {
+ smc_tree_root = calloc (SMC_TRUNK_COUNT, sizeof (smc_tree_root[0]));
+ if (!smc_tree_root)
+ smc_tree_abort (errno);
+ }
+ if (!smc_tree_root[ix0])
+ {
+ smc_tree_root[ix0] = calloc (SMC_BRANCH_COUNT, sizeof (smc_tree_root[0][0]));
+ if (!smc_tree_root[ix0])
+ smc_tree_abort (errno);
+ }
+ entry = smc_tree_branch_lookup_nearest_L (&smc_tree_root[ix0][ix1], key);
+ if (!entry || /* need create */
+ entry >= smc_tree_root[ix0][ix1].entries + smc_tree_root[ix0][ix1].n_entries || /* need append */
+ entry->key != key) /* need insert */
+ entry = smc_tree_branch_grow_L (&smc_tree_root[ix0][ix1], entry - smc_tree_root[ix0][ix1].entries);
+ entry->key = key;
+ entry->value = value;
+ g_mutex_unlock (smc_tree_mutex);
+}
+
+static gboolean
+smc_tree_lookup (SmcKType key,
+ SmcVType *value_p)
+{
+ SmcEntry *entry = NULL;
+ unsigned int ix0 = SMC_TRUNK_HASH (key), ix1 = SMC_BRANCH_HASH (key);
+ gboolean found_one = FALSE;
+ *value_p = 0;
+ g_mutex_lock (smc_tree_mutex);
+ if (smc_tree_root && smc_tree_root[ix0])
+ {
+ entry = smc_tree_branch_lookup_nearest_L (&smc_tree_root[ix0][ix1], key);
+ if (entry &&
+ entry < smc_tree_root[ix0][ix1].entries + smc_tree_root[ix0][ix1].n_entries &&
+ entry->key == key)
+ {
+ found_one = TRUE;
+ *value_p = entry->value;
+ }
+ }
+ g_mutex_unlock (smc_tree_mutex);
+ return found_one;
+}
+
+static gboolean
+smc_tree_remove (SmcKType key)
+{
+ unsigned int ix0 = SMC_TRUNK_HASH (key), ix1 = SMC_BRANCH_HASH (key);
+ gboolean found_one = FALSE;
+ g_mutex_lock (smc_tree_mutex);
+ if (smc_tree_root && smc_tree_root[ix0])
+ {
+ SmcEntry *entry = smc_tree_branch_lookup_nearest_L (&smc_tree_root[ix0][ix1], key);
+ if (entry &&
+ entry < smc_tree_root[ix0][ix1].entries + smc_tree_root[ix0][ix1].n_entries &&
+ entry->key == key)
+ {
+ unsigned int i = entry - smc_tree_root[ix0][ix1].entries;
+ smc_tree_root[ix0][ix1].n_entries -= 1;
+ g_memmove (entry, entry + 1, (smc_tree_root[ix0][ix1].n_entries - i) * sizeof (entry[0]));
+ if (!smc_tree_root[ix0][ix1].n_entries)
+ {
+ /* avoid useless pressure on the memory system */
+ free (smc_tree_root[ix0][ix1].entries);
+ smc_tree_root[ix0][ix1].entries = NULL;
+ }
+ found_one = TRUE;
+ }
+ }
+ g_mutex_unlock (smc_tree_mutex);
+ return found_one;
+}
+
+#ifdef G_ENABLE_DEBUG
+void
+g_slice_debug_tree_statistics (void)
+{
+ g_mutex_lock (smc_tree_mutex);
+ if (smc_tree_root)
+ {
+ unsigned int i, j, t = 0, o = 0, b = 0, su = 0, ex = 0, en = 4294967295u;
+ double tf, bf;
+ for (i = 0; i < SMC_TRUNK_COUNT; i++)
+ if (smc_tree_root[i])
+ {
+ t++;
+ for (j = 0; j < SMC_BRANCH_COUNT; j++)
+ if (smc_tree_root[i][j].n_entries)
+ {
+ b++;
+ su += smc_tree_root[i][j].n_entries;
+ en = MIN (en, smc_tree_root[i][j].n_entries);
+ ex = MAX (ex, smc_tree_root[i][j].n_entries);
+ }
+ else if (smc_tree_root[i][j].entries)
+ o++; /* formerly used, now empty */
+ }
+ en = b ? en : 0;
+ tf = MAX (t, 1.0); /* max(1) to be a valid divisor */
+ bf = MAX (b, 1.0); /* max(1) to be a valid divisor */
+ fprintf (stderr, "GSlice: MemChecker: %u trunks, %u branches, %u old branches\n", t, b, o);
+ fprintf (stderr, "GSlice: MemChecker: %f branches per trunk, %.2f%% utilization\n",
+ b / tf,
+ 100.0 - (SMC_BRANCH_COUNT - b / tf) / (0.01 * SMC_BRANCH_COUNT));
+ fprintf (stderr, "GSlice: MemChecker: %f entries per branch, %u minimum, %u maximum\n",
+ su / bf, en, ex);
+ }
+ else
+ fprintf (stderr, "GSlice: MemChecker: root=NULL\n");
+ g_mutex_unlock (smc_tree_mutex);
+
+ /* sample statistics (beast + GSLice + 24h scripted core & GUI activity):
+ * PID %CPU %MEM VSZ RSS COMMAND
+ * 8887 30.3 45.8 456068 414856 beast-0.7.1 empty.bse
+ * $ cat /proc/8887/statm # total-program-size resident-set-size shared-pages text/code data/stack library dirty-pages
+ * 114017 103714 2354 344 0 108676 0
+ * $ cat /proc/8887/status
+ * Name: beast-0.7.1
+ * VmSize: 456068 kB
+ * VmLck: 0 kB
+ * VmRSS: 414856 kB
+ * VmData: 434620 kB
+ * VmStk: 84 kB
+ * VmExe: 1376 kB
+ * VmLib: 13036 kB
+ * VmPTE: 456 kB
+ * Threads: 3
+ * (gdb) print g_slice_debug_tree_statistics ()
+ * GSlice: MemChecker: 422 trunks, 213068 branches, 0 old branches
+ * GSlice: MemChecker: 504.900474 branches per trunk, 98.81% utilization
+ * GSlice: MemChecker: 4.965039 entries per branch, 1 minimum, 37 maximum
+ */
+}
+#endif /* G_ENABLE_DEBUG */
+
+#define __G_SLICE_C__
+#include "galiasdef.c"
+#endif /* NOT_NEEDED_FOR_NAVIT */
diff --git a/support/glib/gslice.h b/support/glib/gslice.h
new file mode 100644
index 00000000..f9cc6442
--- /dev/null
+++ b/support/glib/gslice.h
@@ -0,0 +1,90 @@
+/* GLIB sliced memory - fast threaded memory chunk allocator
+ * Copyright (C) 2005 Tim Janik
+ *
+ * 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.
+ */
+
+#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#ifndef __G_SLICE_H__
+#define __G_SLICE_H__
+
+#ifndef __G_MEM_H__
+#error Include <glib.h> instead of <gslice.h>
+#endif
+
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+/* slices - fast allocation/release of small memory blocks
+ */
+gpointer g_slice_alloc (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
+gpointer g_slice_alloc0 (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
+gpointer g_slice_copy (gsize block_size,
+ gconstpointer mem_block) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
+void g_slice_free1 (gsize block_size,
+ gpointer mem_block);
+void g_slice_free_chain_with_offset (gsize block_size,
+ gpointer mem_chain,
+ gsize next_offset);
+#define g_slice_new(type) ((type*) g_slice_alloc (sizeof (type)))
+#define g_slice_new0(type) ((type*) g_slice_alloc0 (sizeof (type)))
+/* MemoryBlockType *
+ * g_slice_dup (MemoryBlockType,
+ * MemoryBlockType *mem_block);
+ * g_slice_free (MemoryBlockType,
+ * MemoryBlockType *mem_block);
+ * g_slice_free_chain (MemoryBlockType,
+ * MemoryBlockType *first_chain_block,
+ * memory_block_next_field);
+ * pseudo prototypes for the macro
+ * definitions following below.
+ */
+
+/* we go through extra hoops to ensure type safety */
+#define g_slice_dup(type, mem) \
+ (1 ? (type*) g_slice_copy (sizeof (type), (mem)) \
+ : ((void) ((type*) 0 == (mem)), (type*) 0))
+#define g_slice_free(type, mem) do { \
+ if (1) g_slice_free1 (sizeof (type), (mem)); \
+ else (void) ((type*) 0 == (mem)); \
+} while (0)
+#define g_slice_free_chain(type, mem_chain, next) do { \
+ if (1) g_slice_free_chain_with_offset (sizeof (type), \
+ (mem_chain), G_STRUCT_OFFSET (type, next)); \
+ else (void) ((type*) 0 == (mem_chain)); \
+} while (0)
+
+
+/* --- internal debugging API --- */
+typedef enum {
+ G_SLICE_CONFIG_ALWAYS_MALLOC = 1,
+ G_SLICE_CONFIG_BYPASS_MAGAZINES,
+ G_SLICE_CONFIG_WORKING_SET_MSECS,
+ G_SLICE_CONFIG_COLOR_INCREMENT,
+ G_SLICE_CONFIG_CHUNK_SIZES,
+ G_SLICE_CONFIG_CONTENTION_COUNTER
+} GSliceConfig;
+void g_slice_set_config (GSliceConfig ckey, gint64 value);
+gint64 g_slice_get_config (GSliceConfig ckey);
+gint64* g_slice_get_config_state (GSliceConfig ckey, gint64 address, guint *n_values);
+
+G_END_DECLS
+
+#endif /* __G_SLICE_H__ */
diff --git a/support/glib/gstrfuncs.c b/support/glib/gstrfuncs.c
new file mode 100644
index 00000000..24be1f30
--- /dev/null
+++ b/support/glib/gstrfuncs.c
@@ -0,0 +1,3125 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+/*
+ * MT safe
+ */
+
+#include "config.h"
+
+#define _GNU_SOURCE /* For stpcpy */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <locale.h>
+#include <errno.h>
+#include <ctype.h> /* For tolower() */
+#if !defined (HAVE_STRSIGNAL) || !defined(NO_SYS_SIGLIST_DECL)
+#include <signal.h>
+#endif
+
+#include "glib.h"
+#include "gprintf.h"
+#include "gprintfint.h"
+#include "glibintl.h"
+
+#include "galias.h"
+
+#ifdef G_OS_WIN32
+#include <windows.h>
+#endif
+
+/* do not include <unistd.h> in this place since it
+ * interferes with g_strsignal() on some OSes
+ */
+
+static const guint16 ascii_table_data[256] = {
+ 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004,
+ 0x004, 0x104, 0x104, 0x004, 0x104, 0x104, 0x004, 0x004,
+ 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004,
+ 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004,
+ 0x140, 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x0d0,
+ 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x0d0,
+ 0x459, 0x459, 0x459, 0x459, 0x459, 0x459, 0x459, 0x459,
+ 0x459, 0x459, 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x0d0,
+ 0x0d0, 0x653, 0x653, 0x653, 0x653, 0x653, 0x653, 0x253,
+ 0x253, 0x253, 0x253, 0x253, 0x253, 0x253, 0x253, 0x253,
+ 0x253, 0x253, 0x253, 0x253, 0x253, 0x253, 0x253, 0x253,
+ 0x253, 0x253, 0x253, 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x0d0,
+ 0x0d0, 0x473, 0x473, 0x473, 0x473, 0x473, 0x473, 0x073,
+ 0x073, 0x073, 0x073, 0x073, 0x073, 0x073, 0x073, 0x073,
+ 0x073, 0x073, 0x073, 0x073, 0x073, 0x073, 0x073, 0x073,
+ 0x073, 0x073, 0x073, 0x0d0, 0x0d0, 0x0d0, 0x0d0, 0x004
+ /* the upper 128 are all zeroes */
+};
+
+const guint16 * const g_ascii_table = ascii_table_data;
+
+gchar*
+g_strdup (const gchar *str)
+{
+ gchar *new_str;
+ gsize length;
+
+ if (str)
+ {
+ length = strlen (str) + 1;
+ new_str = g_new (char, length);
+ memcpy (new_str, str, length);
+ }
+ else
+ new_str = NULL;
+
+ return new_str;
+}
+
+gpointer
+g_memdup (gconstpointer mem,
+ guint byte_size)
+{
+ gpointer new_mem;
+
+ if (mem)
+ {
+ new_mem = g_malloc (byte_size);
+ memcpy (new_mem, mem, byte_size);
+ }
+ else
+ new_mem = NULL;
+
+ return new_mem;
+}
+
+/**
+ * g_strndup:
+ * @str: the string to duplicate
+ * @n: the maximum number of bytes to copy from @str
+ *
+ * Duplicates the first @n bytes of a string, returning a newly-allocated
+ * buffer @n + 1 bytes long which will always be nul-terminated.
+ * If @str is less than @n bytes long the buffer is padded with nuls.
+ * If @str is %NULL it returns %NULL.
+ * The returned value should be freed when no longer needed.
+ *
+ * <note><para>
+ * To copy a number of characters from a UTF-8 encoded string, use
+ * g_utf8_strncpy() instead.
+ * </para></note>
+ *
+ * Returns: a newly-allocated buffer containing the first @n bytes
+ * of @str, nul-terminated
+ */
+gchar*
+g_strndup (const gchar *str,
+ gsize n)
+{
+ gchar *new_str;
+
+ if (str)
+ {
+ new_str = g_new (gchar, n + 1);
+ strncpy (new_str, str, n);
+ new_str[n] = '\0';
+ }
+ else
+ new_str = NULL;
+
+ return new_str;
+}
+
+/**
+ * g_strnfill:
+ * @length: the length of the new string
+ * @fill_char: the byte to fill the string with
+ *
+ * Creates a new string @length bytes long filled with @fill_char.
+ * The returned string should be freed when no longer needed.
+ *
+ * Returns: a newly-allocated string filled the @fill_char
+ */
+gchar*
+g_strnfill (gsize length,
+ gchar fill_char)
+{
+ gchar *str;
+
+ str = g_new (gchar, length + 1);
+ memset (str, (guchar)fill_char, length);
+ str[length] = '\0';
+
+ return str;
+}
+
+/**
+ * g_stpcpy:
+ * @dest: destination buffer.
+ * @src: source string.
+ *
+ * Copies a nul-terminated string into the dest buffer, include the
+ * trailing nul, and return a pointer to the trailing nul byte.
+ * This is useful for concatenating multiple strings together
+ * without having to repeatedly scan for the end.
+ *
+ * Return value: a pointer to trailing nul byte.
+ **/
+gchar *
+g_stpcpy (gchar *dest,
+ const gchar *src)
+{
+#ifdef HAVE_STPCPY
+ g_return_val_if_fail (dest != NULL, NULL);
+ g_return_val_if_fail (src != NULL, NULL);
+ return stpcpy (dest, src);
+#else
+ register gchar *d = dest;
+ register const gchar *s = src;
+
+ g_return_val_if_fail (dest != NULL, NULL);
+ g_return_val_if_fail (src != NULL, NULL);
+ do
+ *d++ = *s;
+ while (*s++ != '\0');
+
+ return d - 1;
+#endif
+}
+
+gchar*
+g_strdup_vprintf (const gchar *format,
+ va_list args)
+{
+ gchar *string = NULL;
+
+ g_vasprintf (&string, format, args);
+
+ return string;
+}
+
+gchar*
+g_strdup_printf (const gchar *format,
+ ...)
+{
+ gchar *buffer;
+ va_list args;
+
+ va_start (args, format);
+ buffer = g_strdup_vprintf (format, args);
+ va_end (args);
+
+ return buffer;
+}
+
+gchar*
+g_strconcat (const gchar *string1, ...)
+{
+ gsize l;
+ va_list args;
+ gchar *s;
+ gchar *concat;
+ gchar *ptr;
+
+ if (!string1)
+ return NULL;
+
+ l = 1 + strlen (string1);
+ va_start (args, string1);
+ s = va_arg (args, gchar*);
+ while (s)
+ {
+ l += strlen (s);
+ s = va_arg (args, gchar*);
+ }
+ va_end (args);
+
+ concat = g_new (gchar, l);
+ ptr = concat;
+
+ ptr = g_stpcpy (ptr, string1);
+ va_start (args, string1);
+ s = va_arg (args, gchar*);
+ while (s)
+ {
+ ptr = g_stpcpy (ptr, s);
+ s = va_arg (args, gchar*);
+ }
+ va_end (args);
+
+ return concat;
+}
+
+/**
+ * g_strtod:
+ * @nptr: the string to convert to a numeric value.
+ * @endptr: if non-%NULL, it returns the character after
+ * the last character used in the conversion.
+ *
+ * Converts a string to a #gdouble value.
+ * It calls the standard strtod() function to handle the conversion, but
+ * if the string is not completely converted it attempts the conversion
+ * again with g_ascii_strtod(), and returns the best match.
+ *
+ * This function should seldomly be used. The normal situation when reading
+ * numbers not for human consumption is to use g_ascii_strtod(). Only when
+ * you know that you must expect both locale formatted and C formatted numbers
+ * should you use this. Make sure that you don't pass strings such as comma
+ * separated lists of values, since the commas may be interpreted as a decimal
+ * point in some locales, causing unexpected results.
+ *
+ * Return value: the #gdouble value.
+ **/
+gdouble
+g_strtod (const gchar *nptr,
+ gchar **endptr)
+{
+ gchar *fail_pos_1;
+ gchar *fail_pos_2;
+ gdouble val_1;
+ gdouble val_2 = 0;
+
+ g_return_val_if_fail (nptr != NULL, 0);
+
+ fail_pos_1 = NULL;
+ fail_pos_2 = NULL;
+
+ val_1 = strtod (nptr, &fail_pos_1);
+
+ if (fail_pos_1 && fail_pos_1[0] != 0)
+ val_2 = g_ascii_strtod (nptr, &fail_pos_2);
+
+ if (!fail_pos_1 || fail_pos_1[0] == 0 || fail_pos_1 >= fail_pos_2)
+ {
+ if (endptr)
+ *endptr = fail_pos_1;
+ return val_1;
+ }
+ else
+ {
+ if (endptr)
+ *endptr = fail_pos_2;
+ return val_2;
+ }
+}
+
+/**
+ * g_ascii_strtod:
+ * @nptr: the string to convert to a numeric value.
+ * @endptr: if non-%NULL, it returns the character after
+ * the last character used in the conversion.
+ *
+ * Converts a string to a #gdouble value.
+ *
+ * This function behaves like the standard strtod() function
+ * does in the C locale. It does this without actually changing
+ * the current locale, since that would not be thread-safe.
+ * A limitation of the implementation is that this function
+ * will still accept localized versions of infinities and NANs.
+ *
+ * This function is typically used when reading configuration
+ * files or other non-user input that should be locale independent.
+ * To handle input from the user you should normally use the
+ * locale-sensitive system strtod() function.
+ *
+ * To convert from a #gdouble to a string in a locale-insensitive
+ * way, use g_ascii_dtostr().
+ *
+ * If the correct value would cause overflow, plus or minus %HUGE_VAL
+ * is returned (according to the sign of the value), and %ERANGE is
+ * stored in %errno. If the correct value would cause underflow,
+ * zero is returned and %ERANGE is stored in %errno.
+ *
+ * This function resets %errno before calling strtod() so that
+ * you can reliably detect overflow and underflow.
+ *
+ * Return value: the #gdouble value.
+ **/
+gdouble
+g_ascii_strtod (const gchar *nptr,
+ gchar **endptr)
+{
+ gchar *fail_pos;
+ gdouble val;
+ struct lconv *locale_data;
+ const char *decimal_point;
+ int decimal_point_len;
+ const char *p, *decimal_point_pos;
+ const char *end = NULL; /* Silence gcc */
+ int strtod_errno;
+
+ g_return_val_if_fail (nptr != NULL, 0);
+
+ fail_pos = NULL;
+
+ locale_data = localeconv ();
+ decimal_point = locale_data->decimal_point;
+ decimal_point_len = strlen (decimal_point);
+
+#if NOT_NEEDED_FOR_NAVIT
+ g_assert (decimal_point_len != 0);
+#endif /* NOT_NEEDED_FOR_NAVIT */
+
+ decimal_point_pos = NULL;
+ end = NULL;
+
+ if (decimal_point[0] != '.' ||
+ decimal_point[1] != 0)
+ {
+ p = nptr;
+ /* Skip leading space */
+ while (g_ascii_isspace (*p))
+ p++;
+
+ /* Skip leading optional sign */
+ if (*p == '+' || *p == '-')
+ p++;
+
+ if (p[0] == '0' &&
+ (p[1] == 'x' || p[1] == 'X'))
+ {
+ p += 2;
+ /* HEX - find the (optional) decimal point */
+
+ while (g_ascii_isxdigit (*p))
+ p++;
+
+ if (*p == '.')
+ decimal_point_pos = p++;
+
+ while (g_ascii_isxdigit (*p))
+ p++;
+
+ if (*p == 'p' || *p == 'P')
+ p++;
+ if (*p == '+' || *p == '-')
+ p++;
+ while (g_ascii_isdigit (*p))
+ p++;
+
+ end = p;
+ }
+ else if (g_ascii_isdigit (*p) || *p == '.')
+ {
+ while (g_ascii_isdigit (*p))
+ p++;
+
+ if (*p == '.')
+ decimal_point_pos = p++;
+
+ while (g_ascii_isdigit (*p))
+ p++;
+
+ if (*p == 'e' || *p == 'E')
+ p++;
+ if (*p == '+' || *p == '-')
+ p++;
+ while (g_ascii_isdigit (*p))
+ p++;
+
+ end = p;
+ }
+ /* For the other cases, we need not convert the decimal point */
+ }
+
+ if (decimal_point_pos)
+ {
+ char *copy, *c;
+
+ /* We need to convert the '.' to the locale specific decimal point */
+ copy = g_malloc (end - nptr + 1 + decimal_point_len);
+
+ c = copy;
+ memcpy (c, nptr, decimal_point_pos - nptr);
+ c += decimal_point_pos - nptr;
+ memcpy (c, decimal_point, decimal_point_len);
+ c += decimal_point_len;
+ memcpy (c, decimal_point_pos + 1, end - (decimal_point_pos + 1));
+ c += end - (decimal_point_pos + 1);
+ *c = 0;
+
+ errno = 0;
+ val = strtod (copy, &fail_pos);
+ strtod_errno = errno;
+
+ if (fail_pos)
+ {
+ if (fail_pos - copy > decimal_point_pos - nptr)
+ fail_pos = (char *)nptr + (fail_pos - copy) - (decimal_point_len - 1);
+ else
+ fail_pos = (char *)nptr + (fail_pos - copy);
+ }
+
+ g_free (copy);
+
+ }
+ else if (end)
+ {
+ char *copy;
+
+ copy = g_malloc (end - (char *)nptr + 1);
+ memcpy (copy, nptr, end - nptr);
+ *(copy + (end - (char *)nptr)) = 0;
+
+ errno = 0;
+ val = strtod (copy, &fail_pos);
+ strtod_errno = errno;
+
+ if (fail_pos)
+ {
+ fail_pos = (char *)nptr + (fail_pos - copy);
+ }
+
+ g_free (copy);
+ }
+ else
+ {
+ errno = 0;
+ val = strtod (nptr, &fail_pos);
+ strtod_errno = errno;
+ }
+
+ if (endptr)
+ *endptr = fail_pos;
+
+ errno = strtod_errno;
+
+ return val;
+}
+
+
+/**
+ * g_ascii_dtostr:
+ * @buffer: A buffer to place the resulting string in
+ * @buf_len: The length of the buffer.
+ * @d: The #gdouble to convert
+ *
+ * Converts a #gdouble to a string, using the '.' as
+ * decimal point.
+ *
+ * This functions generates enough precision that converting
+ * the string back using g_ascii_strtod() gives the same machine-number
+ * (on machines with IEEE compatible 64bit doubles). It is
+ * guaranteed that the size of the resulting string will never
+ * be larger than @G_ASCII_DTOSTR_BUF_SIZE bytes.
+ *
+ * Return value: The pointer to the buffer with the converted string.
+ **/
+gchar *
+g_ascii_dtostr (gchar *buffer,
+ gint buf_len,
+ gdouble d)
+{
+ return g_ascii_formatd (buffer, buf_len, "%.17g", d);
+}
+
+/**
+ * g_ascii_formatd:
+ * @buffer: A buffer to place the resulting string in
+ * @buf_len: The length of the buffer.
+ * @format: The printf()-style format to use for the
+ * code to use for converting.
+ * @d: The #gdouble to convert
+ *
+ * Converts a #gdouble to a string, using the '.' as
+ * decimal point. To format the number you pass in
+ * a printf()-style format string. Allowed conversion
+ * specifiers are 'e', 'E', 'f', 'F', 'g' and 'G'.
+ *
+ * If you just want to want to serialize the value into a
+ * string, use g_ascii_dtostr().
+ *
+ * Return value: The pointer to the buffer with the converted string.
+ **/
+gchar *
+g_ascii_formatd (gchar *buffer,
+ gint buf_len,
+ const gchar *format,
+ gdouble d)
+{
+ struct lconv *locale_data;
+ const char *decimal_point;
+ int decimal_point_len;
+ gchar *p;
+ int rest_len;
+ gchar format_char;
+
+ g_return_val_if_fail (buffer != NULL, NULL);
+ g_return_val_if_fail (format[0] == '%', NULL);
+ g_return_val_if_fail (strpbrk (format + 1, "'l%") == NULL, NULL);
+
+ format_char = format[strlen (format) - 1];
+
+ g_return_val_if_fail (format_char == 'e' || format_char == 'E' ||
+ format_char == 'f' || format_char == 'F' ||
+ format_char == 'g' || format_char == 'G',
+ NULL);
+
+ if (format[0] != '%')
+ return NULL;
+
+ if (strpbrk (format + 1, "'l%"))
+ return NULL;
+
+ if (!(format_char == 'e' || format_char == 'E' ||
+ format_char == 'f' || format_char == 'F' ||
+ format_char == 'g' || format_char == 'G'))
+ return NULL;
+
+
+ _g_snprintf (buffer, buf_len, format, d);
+
+ locale_data = localeconv ();
+ decimal_point = locale_data->decimal_point;
+ decimal_point_len = strlen (decimal_point);
+
+#if NOT_NEEDED_FOR_NAVIT
+ g_assert (decimal_point_len != 0);
+#endif /* NOT_NEEDED_FOR_NAVIT */
+
+ if (decimal_point[0] != '.' ||
+ decimal_point[1] != 0)
+ {
+ p = buffer;
+
+ while (g_ascii_isspace (*p))
+ p++;
+
+ if (*p == '+' || *p == '-')
+ p++;
+
+ while (isdigit ((guchar)*p))
+ p++;
+
+ if (strncmp (p, decimal_point, decimal_point_len) == 0)
+ {
+ *p = '.';
+ p++;
+ if (decimal_point_len > 1)
+ {
+ rest_len = strlen (p + (decimal_point_len-1));
+ memmove (p, p + (decimal_point_len-1), rest_len);
+ p[rest_len] = 0;
+ }
+ }
+ }
+
+ return buffer;
+}
+
+static guint64
+g_parse_long_long (const gchar *nptr,
+ const gchar **endptr,
+ guint base,
+ gboolean *negative)
+{
+ /* this code is based on on the strtol(3) code from GNU libc released under
+ * the GNU Lesser General Public License.
+ *
+ * Copyright (C) 1991,92,94,95,96,97,98,99,2000,01,02
+ * Free Software Foundation, Inc.
+ */
+#define ISSPACE(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || \
+ (c) == '\r' || (c) == '\t' || (c) == '\v')
+#define ISUPPER(c) ((c) >= 'A' && (c) <= 'Z')
+#define ISLOWER(c) ((c) >= 'a' && (c) <= 'z')
+#define ISALPHA(c) (ISUPPER (c) || ISLOWER (c))
+#define TOUPPER(c) (ISLOWER (c) ? (c) - 'a' + 'A' : (c))
+#define TOLOWER(c) (ISUPPER (c) ? (c) - 'A' + 'a' : (c))
+ gboolean overflow;
+ guint64 cutoff;
+ guint64 cutlim;
+ guint64 ui64;
+ const gchar *s, *save;
+ guchar c;
+
+ g_return_val_if_fail (nptr != NULL, 0);
+
+ *negative = FALSE;
+ if (base == 1 || base > 36)
+ {
+ errno = EINVAL;
+ if (endptr)
+ *endptr = nptr;
+ return 0;
+ }
+
+ save = s = nptr;
+
+ /* Skip white space. */
+ while (ISSPACE (*s))
+ ++s;
+
+ if (G_UNLIKELY (!*s))
+ goto noconv;
+
+ /* Check for a sign. */
+ if (*s == '-')
+ {
+ *negative = TRUE;
+ ++s;
+ }
+ else if (*s == '+')
+ ++s;
+
+ /* Recognize number prefix and if BASE is zero, figure it out ourselves. */
+ if (*s == '0')
+ {
+ if ((base == 0 || base == 16) && TOUPPER (s[1]) == 'X')
+ {
+ s += 2;
+ base = 16;
+ }
+ else if (base == 0)
+ base = 8;
+ }
+ else if (base == 0)
+ base = 10;
+
+ /* Save the pointer so we can check later if anything happened. */
+ save = s;
+ cutoff = G_MAXUINT64 / base;
+ cutlim = G_MAXUINT64 % base;
+
+ overflow = FALSE;
+ ui64 = 0;
+ c = *s;
+ for (; c; c = *++s)
+ {
+ if (c >= '0' && c <= '9')
+ c -= '0';
+ else if (ISALPHA (c))
+ c = TOUPPER (c) - 'A' + 10;
+ else
+ break;
+ if (c >= base)
+ break;
+ /* Check for overflow. */
+ if (ui64 > cutoff || (ui64 == cutoff && c > cutlim))
+ overflow = TRUE;
+ else
+ {
+ ui64 *= base;
+ ui64 += c;
+ }
+ }
+
+ /* Check if anything actually happened. */
+ if (s == save)
+ goto noconv;
+
+ /* Store in ENDPTR the address of one character
+ past the last character we converted. */
+ if (endptr)
+ *endptr = s;
+
+ if (G_UNLIKELY (overflow))
+ {
+ errno = ERANGE;
+ return G_MAXUINT64;
+ }
+
+ return ui64;
+
+ noconv:
+ /* We must handle a special case here: the base is 0 or 16 and the
+ first two characters are '0' and 'x', but the rest are no
+ hexadecimal digits. This is no error case. We return 0 and
+ ENDPTR points to the `x`. */
+ if (endptr)
+ {
+ if (save - nptr >= 2 && TOUPPER (save[-1]) == 'X'
+ && save[-2] == '0')
+ *endptr = &save[-1];
+ else
+ /* There was no number to convert. */
+ *endptr = nptr;
+ }
+ return 0;
+}
+
+/**
+ * g_ascii_strtoull:
+ * @nptr: the string to convert to a numeric value.
+ * @endptr: if non-%NULL, it returns the character after
+ * the last character used in the conversion.
+ * @base: to be used for the conversion, 2..36 or 0
+ *
+ * Converts a string to a #guint64 value.
+ * This function behaves like the standard strtoull() function
+ * does in the C locale. It does this without actually
+ * changing the current locale, since that would not be
+ * thread-safe.
+ *
+ * This function is typically used when reading configuration
+ * files or other non-user input that should be locale independent.
+ * To handle input from the user you should normally use the
+ * locale-sensitive system strtoull() function.
+ *
+ * If the correct value would cause overflow, %G_MAXUINT64
+ * is returned, and %ERANGE is stored in %errno. If the base is
+ * outside the valid range, zero is returned, and %EINVAL is stored
+ * in %errno. If the string conversion fails, zero is returned, and
+ * @endptr returns @nptr (if @endptr is non-%NULL).
+ *
+ * Return value: the #guint64 value or zero on error.
+ *
+ * Since: 2.2
+ **/
+guint64
+g_ascii_strtoull (const gchar *nptr,
+ gchar **endptr,
+ guint base)
+{
+ gboolean negative;
+ guint64 result;
+
+ result = g_parse_long_long (nptr, (const gchar **) endptr, base, &negative);
+
+ /* Return the result of the appropriate sign. */
+ return negative ? -result : result;
+}
+
+/**
+ * g_ascii_strtoll:
+ * @nptr: the string to convert to a numeric value.
+ * @endptr: if non-%NULL, it returns the character after
+ * the last character used in the conversion.
+ * @base: to be used for the conversion, 2..36 or 0
+ *
+ * Converts a string to a #gint64 value.
+ * This function behaves like the standard strtoll() function
+ * does in the C locale. It does this without actually
+ * changing the current locale, since that would not be
+ * thread-safe.
+ *
+ * This function is typically used when reading configuration
+ * files or other non-user input that should be locale independent.
+ * To handle input from the user you should normally use the
+ * locale-sensitive system strtoll() function.
+ *
+ * If the correct value would cause overflow, %G_MAXINT64 or %G_MININT64
+ * is returned, and %ERANGE is stored in %errno. If the base is
+ * outside the valid range, zero is returned, and %EINVAL is stored
+ * in %errno. If the string conversion fails, zero is returned, and
+ * @endptr returns @nptr (if @endptr is non-%NULL).
+ *
+ * Return value: the #gint64 value or zero on error.
+ *
+ * Since: 2.12
+ **/
+gint64
+g_ascii_strtoll (const gchar *nptr,
+ gchar **endptr,
+ guint base)
+{
+ gboolean negative;
+ guint64 result;
+
+ result = g_parse_long_long (nptr, (const gchar **) endptr, base, &negative);
+
+ if (negative && result > (guint64) G_MININT64)
+ {
+ errno = ERANGE;
+ return G_MININT64;
+ }
+ else if (!negative && result > (guint64) G_MAXINT64)
+ {
+ errno = ERANGE;
+ return G_MAXINT64;
+ }
+ else if (negative)
+ return - (gint64) result;
+ else
+ return (gint64) result;
+}
+
+#if NOT_NEEDED_FOR_NAVIT
+G_CONST_RETURN gchar*
+g_strerror (gint errnum)
+{
+ static GStaticPrivate msg_private = G_STATIC_PRIVATE_INIT;
+ char *msg;
+ int saved_errno = errno;
+
+#ifdef HAVE_STRERROR
+ const char *msg_locale;
+
+ msg_locale = strerror (errnum);
+ if (g_get_charset (NULL))
+ {
+ errno = saved_errno;
+ return msg_locale;
+ }
+ else
+ {
+ gchar *msg_utf8 = g_locale_to_utf8 (msg_locale, -1, NULL, NULL, NULL);
+ if (msg_utf8)
+ {
+ /* Stick in the quark table so that we can return a static result
+ */
+ GQuark msg_quark = g_quark_from_string (msg_utf8);
+ g_free (msg_utf8);
+
+ msg_utf8 = (gchar *) g_quark_to_string (msg_quark);
+ errno = saved_errno;
+ return msg_utf8;
+ }
+ }
+#elif NO_SYS_ERRLIST
+ switch (errnum)
+ {
+#ifdef E2BIG
+ case E2BIG: return "argument list too long";
+#endif
+#ifdef EACCES
+ case EACCES: return "permission denied";
+#endif
+#ifdef EADDRINUSE
+ case EADDRINUSE: return "address already in use";
+#endif
+#ifdef EADDRNOTAVAIL
+ case EADDRNOTAVAIL: return "can't assign requested address";
+#endif
+#ifdef EADV
+ case EADV: return "advertise error";
+#endif
+#ifdef EAFNOSUPPORT
+ case EAFNOSUPPORT: return "address family not supported by protocol family";
+#endif
+#ifdef EAGAIN
+ case EAGAIN: return "try again";
+#endif
+#ifdef EALIGN
+ case EALIGN: return "EALIGN";
+#endif
+#ifdef EALREADY
+ case EALREADY: return "operation already in progress";
+#endif
+#ifdef EBADE
+ case EBADE: return "bad exchange descriptor";
+#endif
+#ifdef EBADF
+ case EBADF: return "bad file number";
+#endif
+#ifdef EBADFD
+ case EBADFD: return "file descriptor in bad state";
+#endif
+#ifdef EBADMSG
+ case EBADMSG: return "not a data message";
+#endif
+#ifdef EBADR
+ case EBADR: return "bad request descriptor";
+#endif
+#ifdef EBADRPC
+ case EBADRPC: return "RPC structure is bad";
+#endif
+#ifdef EBADRQC
+ case EBADRQC: return "bad request code";
+#endif
+#ifdef EBADSLT
+ case EBADSLT: return "invalid slot";
+#endif
+#ifdef EBFONT
+ case EBFONT: return "bad font file format";
+#endif
+#ifdef EBUSY
+ case EBUSY: return "mount device busy";
+#endif
+#ifdef ECHILD
+ case ECHILD: return "no children";
+#endif
+#ifdef ECHRNG
+ case ECHRNG: return "channel number out of range";
+#endif
+#ifdef ECOMM
+ case ECOMM: return "communication error on send";
+#endif
+#ifdef ECONNABORTED
+ case ECONNABORTED: return "software caused connection abort";
+#endif
+#ifdef ECONNREFUSED
+ case ECONNREFUSED: return "connection refused";
+#endif
+#ifdef ECONNRESET
+ case ECONNRESET: return "connection reset by peer";
+#endif
+#if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK))
+ case EDEADLK: return "resource deadlock avoided";
+#endif
+#ifdef EDEADLOCK
+ case EDEADLOCK: return "resource deadlock avoided";
+#endif
+#ifdef EDESTADDRREQ
+ case EDESTADDRREQ: return "destination address required";
+#endif
+#ifdef EDIRTY
+ case EDIRTY: return "mounting a dirty fs w/o force";
+#endif
+#ifdef EDOM
+ case EDOM: return "math argument out of range";
+#endif
+#ifdef EDOTDOT
+ case EDOTDOT: return "cross mount point";
+#endif
+#ifdef EDQUOT
+ case EDQUOT: return "disk quota exceeded";
+#endif
+#ifdef EDUPPKG
+ case EDUPPKG: return "duplicate package name";
+#endif
+#ifdef EEXIST
+ case EEXIST: return "file already exists";
+#endif
+#ifdef EFAULT
+ case EFAULT: return "bad address in system call argument";
+#endif
+#ifdef EFBIG
+ case EFBIG: return "file too large";
+#endif
+#ifdef EHOSTDOWN
+ case EHOSTDOWN: return "host is down";
+#endif
+#ifdef EHOSTUNREACH
+ case EHOSTUNREACH: return "host is unreachable";
+#endif
+#ifdef EIDRM
+ case EIDRM: return "identifier removed";
+#endif
+#ifdef EINIT
+ case EINIT: return "initialization error";
+#endif
+#ifdef EINPROGRESS
+ case EINPROGRESS: return "operation now in progress";
+#endif
+#ifdef EINTR
+ case EINTR: return "interrupted system call";
+#endif
+#ifdef EINVAL
+ case EINVAL: return "invalid argument";
+#endif
+#ifdef EIO
+ case EIO: return "I/O error";
+#endif
+#ifdef EISCONN
+ case EISCONN: return "socket is already connected";
+#endif
+#ifdef EISDIR
+ case EISDIR: return "is a directory";
+#endif
+#ifdef EISNAME
+ case EISNAM: return "is a name file";
+#endif
+#ifdef ELBIN
+ case ELBIN: return "ELBIN";
+#endif
+#ifdef EL2HLT
+ case EL2HLT: return "level 2 halted";
+#endif
+#ifdef EL2NSYNC
+ case EL2NSYNC: return "level 2 not synchronized";
+#endif
+#ifdef EL3HLT
+ case EL3HLT: return "level 3 halted";
+#endif
+#ifdef EL3RST
+ case EL3RST: return "level 3 reset";
+#endif
+#ifdef ELIBACC
+ case ELIBACC: return "can not access a needed shared library";
+#endif
+#ifdef ELIBBAD
+ case ELIBBAD: return "accessing a corrupted shared library";
+#endif
+#ifdef ELIBEXEC
+ case ELIBEXEC: return "can not exec a shared library directly";
+#endif
+#ifdef ELIBMAX
+ case ELIBMAX: return "attempting to link in more shared libraries than system limit";
+#endif
+#ifdef ELIBSCN
+ case ELIBSCN: return ".lib section in a.out corrupted";
+#endif
+#ifdef ELNRNG
+ case ELNRNG: return "link number out of range";
+#endif
+#ifdef ELOOP
+ case ELOOP: return "too many levels of symbolic links";
+#endif
+#ifdef EMFILE
+ case EMFILE: return "too many open files";
+#endif
+#ifdef EMLINK
+ case EMLINK: return "too many links";
+#endif
+#ifdef EMSGSIZE
+ case EMSGSIZE: return "message too long";
+#endif
+#ifdef EMULTIHOP
+ case EMULTIHOP: return "multihop attempted";
+#endif
+#ifdef ENAMETOOLONG
+ case ENAMETOOLONG: return "file name too long";
+#endif
+#ifdef ENAVAIL
+ case ENAVAIL: return "not available";
+#endif
+#ifdef ENET
+ case ENET: return "ENET";
+#endif
+#ifdef ENETDOWN
+ case ENETDOWN: return "network is down";
+#endif
+#ifdef ENETRESET
+ case ENETRESET: return "network dropped connection on reset";
+#endif
+#ifdef ENETUNREACH
+ case ENETUNREACH: return "network is unreachable";
+#endif
+#ifdef ENFILE
+ case ENFILE: return "file table overflow";
+#endif
+#ifdef ENOANO
+ case ENOANO: return "anode table overflow";
+#endif
+#if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR))
+ case ENOBUFS: return "no buffer space available";
+#endif
+#ifdef ENOCSI
+ case ENOCSI: return "no CSI structure available";
+#endif
+#ifdef ENODATA
+ case ENODATA: return "no data available";
+#endif
+#ifdef ENODEV
+ case ENODEV: return "no such device";
+#endif
+#ifdef ENOENT
+ case ENOENT: return "no such file or directory";
+#endif
+#ifdef ENOEXEC
+ case ENOEXEC: return "exec format error";
+#endif
+#ifdef ENOLCK
+ case ENOLCK: return "no locks available";
+#endif
+#ifdef ENOLINK
+ case ENOLINK: return "link has be severed";
+#endif
+#ifdef ENOMEM
+ case ENOMEM: return "not enough memory";
+#endif
+#ifdef ENOMSG
+ case ENOMSG: return "no message of desired type";
+#endif
+#ifdef ENONET
+ case ENONET: return "machine is not on the network";
+#endif
+#ifdef ENOPKG
+ case ENOPKG: return "package not installed";
+#endif
+#ifdef ENOPROTOOPT
+ case ENOPROTOOPT: return "bad proocol option";
+#endif
+#ifdef ENOSPC
+ case ENOSPC: return "no space left on device";
+#endif
+#ifdef ENOSR
+ case ENOSR: return "out of stream resources";
+#endif
+#ifdef ENOSTR
+ case ENOSTR: return "not a stream device";
+#endif
+#ifdef ENOSYM
+ case ENOSYM: return "unresolved symbol name";
+#endif
+#ifdef ENOSYS
+ case ENOSYS: return "function not implemented";
+#endif
+#ifdef ENOTBLK
+ case ENOTBLK: return "block device required";
+#endif
+#ifdef ENOTCONN
+ case ENOTCONN: return "socket is not connected";
+#endif
+#ifdef ENOTDIR
+ case ENOTDIR: return "not a directory";
+#endif
+#ifdef ENOTEMPTY
+ case ENOTEMPTY: return "directory not empty";
+#endif
+#ifdef ENOTNAM
+ case ENOTNAM: return "not a name file";
+#endif
+#ifdef ENOTSOCK
+ case ENOTSOCK: return "socket operation on non-socket";
+#endif
+#ifdef ENOTTY
+ case ENOTTY: return "inappropriate device for ioctl";
+#endif
+#ifdef ENOTUNIQ
+ case ENOTUNIQ: return "name not unique on network";
+#endif
+#ifdef ENXIO
+ case ENXIO: return "no such device or address";
+#endif
+#ifdef EOPNOTSUPP
+ case EOPNOTSUPP: return "operation not supported on socket";
+#endif
+#ifdef EPERM
+ case EPERM: return "not owner";
+#endif
+#ifdef EPFNOSUPPORT
+ case EPFNOSUPPORT: return "protocol family not supported";
+#endif
+#ifdef EPIPE
+ case EPIPE: return "broken pipe";
+#endif
+#ifdef EPROCLIM
+ case EPROCLIM: return "too many processes";
+#endif
+#ifdef EPROCUNAVAIL
+ case EPROCUNAVAIL: return "bad procedure for program";
+#endif
+#ifdef EPROGMISMATCH
+ case EPROGMISMATCH: return "program version wrong";
+#endif
+#ifdef EPROGUNAVAIL
+ case EPROGUNAVAIL: return "RPC program not available";
+#endif
+#ifdef EPROTO
+ case EPROTO: return "protocol error";
+#endif
+#ifdef EPROTONOSUPPORT
+ case EPROTONOSUPPORT: return "protocol not suppored";
+#endif
+#ifdef EPROTOTYPE
+ case EPROTOTYPE: return "protocol wrong type for socket";
+#endif
+#ifdef ERANGE
+ case ERANGE: return "math result unrepresentable";
+#endif
+#if defined(EREFUSED) && (!defined(ECONNREFUSED) || (EREFUSED != ECONNREFUSED))
+ case EREFUSED: return "EREFUSED";
+#endif
+#ifdef EREMCHG
+ case EREMCHG: return "remote address changed";
+#endif
+#ifdef EREMDEV
+ case EREMDEV: return "remote device";
+#endif
+#ifdef EREMOTE
+ case EREMOTE: return "pathname hit remote file system";
+#endif
+#ifdef EREMOTEIO
+ case EREMOTEIO: return "remote i/o error";
+#endif
+#ifdef EREMOTERELEASE
+ case EREMOTERELEASE: return "EREMOTERELEASE";
+#endif
+#ifdef EROFS
+ case EROFS: return "read-only file system";
+#endif
+#ifdef ERPCMISMATCH
+ case ERPCMISMATCH: return "RPC version is wrong";
+#endif
+#ifdef ERREMOTE
+ case ERREMOTE: return "object is remote";
+#endif
+#ifdef ESHUTDOWN
+ case ESHUTDOWN: return "can't send afer socket shutdown";
+#endif
+#ifdef ESOCKTNOSUPPORT
+ case ESOCKTNOSUPPORT: return "socket type not supported";
+#endif
+#ifdef ESPIPE
+ case ESPIPE: return "invalid seek";
+#endif
+#ifdef ESRCH
+ case ESRCH: return "no such process";
+#endif
+#ifdef ESRMNT
+ case ESRMNT: return "srmount error";
+#endif
+#ifdef ESTALE
+ case ESTALE: return "stale remote file handle";
+#endif
+#ifdef ESUCCESS
+ case ESUCCESS: return "Error 0";
+#endif
+#ifdef ETIME
+ case ETIME: return "timer expired";
+#endif
+#ifdef ETIMEDOUT
+ case ETIMEDOUT: return "connection timed out";
+#endif
+#ifdef ETOOMANYREFS
+ case ETOOMANYREFS: return "too many references: can't splice";
+#endif
+#ifdef ETXTBSY
+ case ETXTBSY: return "text file or pseudo-device busy";
+#endif
+#ifdef EUCLEAN
+ case EUCLEAN: return "structure needs cleaning";
+#endif
+#ifdef EUNATCH
+ case EUNATCH: return "protocol driver not attached";
+#endif
+#ifdef EUSERS
+ case EUSERS: return "too many users";
+#endif
+#ifdef EVERSION
+ case EVERSION: return "version mismatch";
+#endif
+#if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN))
+ case EWOULDBLOCK: return "operation would block";
+#endif
+#ifdef EXDEV
+ case EXDEV: return "cross-domain link";
+#endif
+#ifdef EXFULL
+ case EXFULL: return "message tables full";
+#endif
+ }
+#else /* NO_SYS_ERRLIST */
+#if NOT_NEEDED_FOR_NAVIT
+ extern int sys_nerr;
+ extern char *sys_errlist[];
+
+ if ((errnum > 0) && (errnum <= sys_nerr))
+ return sys_errlist [errnum];
+#else /* NOT_NEEDED_FOR_NAVIT */
+ return NULL;
+#endif /* NOT_NEEDED_FOR_NAVIT */
+#endif /* NO_SYS_ERRLIST */
+
+ msg = g_static_private_get (&msg_private);
+ if (!msg)
+ {
+ msg = g_new (gchar, 64);
+ g_static_private_set (&msg_private, msg, g_free);
+ }
+
+ _g_sprintf (msg, "unknown error (%d)", errnum);
+
+ errno = saved_errno;
+ return msg;
+}
+
+G_CONST_RETURN gchar*
+g_strsignal (gint signum)
+{
+ static GStaticPrivate msg_private = G_STATIC_PRIVATE_INIT;
+ char *msg;
+
+#ifdef HAVE_STRSIGNAL
+ const char *msg_locale;
+
+#if defined(G_OS_BEOS) || defined(G_WITH_CYGWIN)
+extern const char *strsignal(int);
+#else
+ /* this is declared differently (const) in string.h on BeOS */
+ extern char *strsignal (int sig);
+#endif /* !G_OS_BEOS && !G_WITH_CYGWIN */
+ msg_locale = strsignal (signum);
+ if (g_get_charset (NULL))
+ return msg_locale;
+ else
+ {
+ gchar *msg_utf8 = g_locale_to_utf8 (msg_locale, -1, NULL, NULL, NULL);
+ if (msg_utf8)
+ {
+ /* Stick in the quark table so that we can return a static result
+ */
+ GQuark msg_quark = g_quark_from_string (msg_utf8);
+ g_free (msg_utf8);
+
+ return g_quark_to_string (msg_quark);
+ }
+ }
+#elif NO_SYS_SIGLIST
+ switch (signum)
+ {
+#ifdef SIGHUP
+ case SIGHUP: return "Hangup";
+#endif
+#ifdef SIGINT
+ case SIGINT: return "Interrupt";
+#endif
+#ifdef SIGQUIT
+ case SIGQUIT: return "Quit";
+#endif
+#ifdef SIGILL
+ case SIGILL: return "Illegal instruction";
+#endif
+#ifdef SIGTRAP
+ case SIGTRAP: return "Trace/breakpoint trap";
+#endif
+#ifdef SIGABRT
+ case SIGABRT: return "IOT trap/Abort";
+#endif
+#ifdef SIGBUS
+ case SIGBUS: return "Bus error";
+#endif
+#ifdef SIGFPE
+ case SIGFPE: return "Floating point exception";
+#endif
+#ifdef SIGKILL
+ case SIGKILL: return "Killed";
+#endif
+#ifdef SIGUSR1
+ case SIGUSR1: return "User defined signal 1";
+#endif
+#ifdef SIGSEGV
+ case SIGSEGV: return "Segmentation fault";
+#endif
+#ifdef SIGUSR2
+ case SIGUSR2: return "User defined signal 2";
+#endif
+#ifdef SIGPIPE
+ case SIGPIPE: return "Broken pipe";
+#endif
+#ifdef SIGALRM
+ case SIGALRM: return "Alarm clock";
+#endif
+#ifdef SIGTERM
+ case SIGTERM: return "Terminated";
+#endif
+#ifdef SIGSTKFLT
+ case SIGSTKFLT: return "Stack fault";
+#endif
+#ifdef SIGCHLD
+ case SIGCHLD: return "Child exited";
+#endif
+#ifdef SIGCONT
+ case SIGCONT: return "Continued";
+#endif
+#ifdef SIGSTOP
+ case SIGSTOP: return "Stopped (signal)";
+#endif
+#ifdef SIGTSTP
+ case SIGTSTP: return "Stopped";
+#endif
+#ifdef SIGTTIN
+ case SIGTTIN: return "Stopped (tty input)";
+#endif
+#ifdef SIGTTOU
+ case SIGTTOU: return "Stopped (tty output)";
+#endif
+#ifdef SIGURG
+ case SIGURG: return "Urgent condition";
+#endif
+#ifdef SIGXCPU
+ case SIGXCPU: return "CPU time limit exceeded";
+#endif
+#ifdef SIGXFSZ
+ case SIGXFSZ: return "File size limit exceeded";
+#endif
+#ifdef SIGVTALRM
+ case SIGVTALRM: return "Virtual time alarm";
+#endif
+#ifdef SIGPROF
+ case SIGPROF: return "Profile signal";
+#endif
+#ifdef SIGWINCH
+ case SIGWINCH: return "Window size changed";
+#endif
+#ifdef SIGIO
+ case SIGIO: return "Possible I/O";
+#endif
+#ifdef SIGPWR
+ case SIGPWR: return "Power failure";
+#endif
+#ifdef SIGUNUSED
+ case SIGUNUSED: return "Unused signal";
+#endif
+ }
+#else /* NO_SYS_SIGLIST */
+
+#if NOT_NEEDED_FOR_NAVIT
+#ifdef NO_SYS_SIGLIST_DECL
+ extern char *sys_siglist[]; /*(see Tue Jan 19 00:44:24 1999 in changelog)*/
+#endif
+
+ return (char*) /* this function should return const --josh */ sys_siglist [signum];
+#else /* NOT_NEEDED_FOR_NAVIT */
+ return NULL;
+#endif /* NOT_NEEDED_FOR_NAVIT */
+#endif /* NO_SYS_SIGLIST */
+
+ msg = g_static_private_get (&msg_private);
+ if (!msg)
+ {
+ msg = g_new (gchar, 64);
+ g_static_private_set (&msg_private, msg, g_free);
+ }
+
+ _g_sprintf (msg, "unknown signal (%d)", signum);
+
+ return msg;
+}
+#endif /* NOT_NEEDED_FOR_NAVIT */
+
+/* Functions g_strlcpy and g_strlcat were originally developed by
+ * Todd C. Miller <Todd.Miller@courtesan.com> to simplify writing secure code.
+ * See ftp://ftp.openbsd.org/pub/OpenBSD/src/lib/libc/string/strlcpy.3
+ * for more information.
+ */
+
+#ifdef HAVE_STRLCPY
+/* Use the native ones, if available; they might be implemented in assembly */
+gsize
+g_strlcpy (gchar *dest,
+ const gchar *src,
+ gsize dest_size)
+{
+ g_return_val_if_fail (dest != NULL, 0);
+ g_return_val_if_fail (src != NULL, 0);
+
+ return strlcpy (dest, src, dest_size);
+}
+
+gsize
+g_strlcat (gchar *dest,
+ const gchar *src,
+ gsize dest_size)
+{
+ g_return_val_if_fail (dest != NULL, 0);
+ g_return_val_if_fail (src != NULL, 0);
+
+ return strlcat (dest, src, dest_size);
+}
+
+#else /* ! HAVE_STRLCPY */
+/* g_strlcpy
+ *
+ * Copy string src to buffer dest (of buffer size dest_size). At most
+ * dest_size-1 characters will be copied. Always NUL terminates
+ * (unless dest_size == 0). This function does NOT allocate memory.
+ * Unlike strncpy, this function doesn't pad dest (so it's often faster).
+ * Returns size of attempted result, strlen(src),
+ * so if retval >= dest_size, truncation occurred.
+ */
+gsize
+g_strlcpy (gchar *dest,
+ const gchar *src,
+ gsize dest_size)
+{
+ register gchar *d = dest;
+ register const gchar *s = src;
+ register gsize n = dest_size;
+
+ g_return_val_if_fail (dest != NULL, 0);
+ g_return_val_if_fail (src != NULL, 0);
+
+ /* Copy as many bytes as will fit */
+ if (n != 0 && --n != 0)
+ do
+ {
+ register gchar c = *s++;
+
+ *d++ = c;
+ if (c == 0)
+ break;
+ }
+ while (--n != 0);
+
+ /* If not enough room in dest, add NUL and traverse rest of src */
+ if (n == 0)
+ {
+ if (dest_size != 0)
+ *d = 0;
+ while (*s++)
+ ;
+ }
+
+ return s - src - 1; /* count does not include NUL */
+}
+
+/* g_strlcat
+ *
+ * Appends string src to buffer dest (of buffer size dest_size).
+ * At most dest_size-1 characters will be copied.
+ * Unlike strncat, dest_size is the full size of dest, not the space left over.
+ * This function does NOT allocate memory.
+ * This always NUL terminates (unless siz == 0 or there were no NUL characters
+ * in the dest_size characters of dest to start with).
+ * Returns size of attempted result, which is
+ * MIN (dest_size, strlen (original dest)) + strlen (src),
+ * so if retval >= dest_size, truncation occurred.
+ */
+gsize
+g_strlcat (gchar *dest,
+ const gchar *src,
+ gsize dest_size)
+{
+ register gchar *d = dest;
+ register const gchar *s = src;
+ register gsize bytes_left = dest_size;
+ gsize dlength; /* Logically, MIN (strlen (d), dest_size) */
+
+ g_return_val_if_fail (dest != NULL, 0);
+ g_return_val_if_fail (src != NULL, 0);
+
+ /* Find the end of dst and adjust bytes left but don't go past end */
+ while (*d != 0 && bytes_left-- != 0)
+ d++;
+ dlength = d - dest;
+ bytes_left = dest_size - dlength;
+
+ if (bytes_left == 0)
+ return dlength + strlen (s);
+
+ while (*s != 0)
+ {
+ if (bytes_left != 1)
+ {
+ *d++ = *s;
+ bytes_left--;
+ }
+ s++;
+ }
+ *d = 0;
+
+ return dlength + (s - src); /* count does not include NUL */
+}
+#endif /* ! HAVE_STRLCPY */
+
+/**
+ * g_ascii_strdown:
+ * @str: a string.
+ * @len: length of @str in bytes, or -1 if @str is nul-terminated.
+ *
+ * Converts all upper case ASCII letters to lower case ASCII letters.
+ *
+ * Return value: a newly-allocated string, with all the upper case
+ * characters in @str converted to lower case, with
+ * semantics that exactly match g_ascii_tolower(). (Note
+ * that this is unlike the old g_strdown(), which modified
+ * the string in place.)
+ **/
+gchar*
+g_ascii_strdown (const gchar *str,
+ gssize len)
+{
+ gchar *result, *s;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ if (len < 0)
+ len = strlen (str);
+
+ result = g_strndup (str, len);
+ for (s = result; *s; s++)
+ *s = g_ascii_tolower (*s);
+
+ return result;
+}
+
+/**
+ * g_ascii_strup:
+ * @str: a string.
+ * @len: length of @str in bytes, or -1 if @str is nul-terminated.
+ *
+ * Converts all lower case ASCII letters to upper case ASCII letters.
+ *
+ * Return value: a newly allocated string, with all the lower case
+ * characters in @str converted to upper case, with
+ * semantics that exactly match g_ascii_toupper(). (Note
+ * that this is unlike the old g_strup(), which modified
+ * the string in place.)
+ **/
+gchar*
+g_ascii_strup (const gchar *str,
+ gssize len)
+{
+ gchar *result, *s;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ if (len < 0)
+ len = strlen (str);
+
+ result = g_strndup (str, len);
+ for (s = result; *s; s++)
+ *s = g_ascii_toupper (*s);
+
+ return result;
+}
+
+/**
+ * g_strdown:
+ * @string: the string to convert.
+ *
+ * Converts a string to lower case.
+ *
+ * Return value: the string
+ *
+ * Deprecated:2.2: This function is totally broken for the reasons discussed
+ * in the g_strncasecmp() docs - use g_ascii_strdown() or g_utf8_strdown()
+ * instead.
+ **/
+gchar*
+g_strdown (gchar *string)
+{
+ register guchar *s;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ s = (guchar *) string;
+
+ while (*s)
+ {
+ if (isupper (*s))
+ *s = tolower (*s);
+ s++;
+ }
+
+ return (gchar *) string;
+}
+
+/**
+ * g_strup:
+ * @string: the string to convert.
+ *
+ * Converts a string to upper case.
+ *
+ * Return value: the string
+ *
+ * Deprecated:2.2: This function is totally broken for the reasons discussed
+ * in the g_strncasecmp() docs - use g_ascii_strup() or g_utf8_strup() instead.
+ **/
+gchar*
+g_strup (gchar *string)
+{
+ register guchar *s;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ s = (guchar *) string;
+
+ while (*s)
+ {
+ if (islower (*s))
+ *s = toupper (*s);
+ s++;
+ }
+
+ return (gchar *) string;
+}
+
+gchar*
+g_strreverse (gchar *string)
+{
+ g_return_val_if_fail (string != NULL, NULL);
+
+ if (*string)
+ {
+ register gchar *h, *t;
+
+ h = string;
+ t = string + strlen (string) - 1;
+
+ while (h < t)
+ {
+ register gchar c;
+
+ c = *h;
+ *h = *t;
+ h++;
+ *t = c;
+ t--;
+ }
+ }
+
+ return string;
+}
+
+/**
+ * g_ascii_tolower:
+ * @c: any character.
+ *
+ * Convert a character to ASCII lower case.
+ *
+ * Unlike the standard C library tolower() function, this only
+ * recognizes standard ASCII letters and ignores the locale, returning
+ * all non-ASCII characters unchanged, even if they are lower case
+ * letters in a particular character set. Also unlike the standard
+ * library function, this takes and returns a char, not an int, so
+ * don't call it on %EOF but no need to worry about casting to #guchar
+ * before passing a possibly non-ASCII character in.
+ *
+ * Return value: the result of converting @c to lower case.
+ * If @c is not an ASCII upper case letter,
+ * @c is returned unchanged.
+ **/
+gchar
+g_ascii_tolower (gchar c)
+{
+ return g_ascii_isupper (c) ? c - 'A' + 'a' : c;
+}
+
+/**
+ * g_ascii_toupper:
+ * @c: any character.
+ *
+ * Convert a character to ASCII upper case.
+ *
+ * Unlike the standard C library toupper() function, this only
+ * recognizes standard ASCII letters and ignores the locale, returning
+ * all non-ASCII characters unchanged, even if they are upper case
+ * letters in a particular character set. Also unlike the standard
+ * library function, this takes and returns a char, not an int, so
+ * don't call it on %EOF but no need to worry about casting to #guchar
+ * before passing a possibly non-ASCII character in.
+ *
+ * Return value: the result of converting @c to upper case.
+ * If @c is not an ASCII lower case letter,
+ * @c is returned unchanged.
+ **/
+gchar
+g_ascii_toupper (gchar c)
+{
+ return g_ascii_islower (c) ? c - 'a' + 'A' : c;
+}
+
+/**
+ * g_ascii_digit_value:
+ * @c: an ASCII character.
+ *
+ * Determines the numeric value of a character as a decimal
+ * digit. Differs from g_unichar_digit_value() because it takes
+ * a char, so there's no worry about sign extension if characters
+ * are signed.
+ *
+ * Return value: If @c is a decimal digit (according to
+ * g_ascii_isdigit()), its numeric value. Otherwise, -1.
+ **/
+int
+g_ascii_digit_value (gchar c)
+{
+ if (g_ascii_isdigit (c))
+ return c - '0';
+ return -1;
+}
+
+/**
+ * g_ascii_xdigit_value:
+ * @c: an ASCII character.
+ *
+ * Determines the numeric value of a character as a hexidecimal
+ * digit. Differs from g_unichar_xdigit_value() because it takes
+ * a char, so there's no worry about sign extension if characters
+ * are signed.
+ *
+ * Return value: If @c is a hex digit (according to
+ * g_ascii_isxdigit()), its numeric value. Otherwise, -1.
+ **/
+int
+g_ascii_xdigit_value (gchar c)
+{
+ if (c >= 'A' && c <= 'F')
+ return c - 'A' + 10;
+ if (c >= 'a' && c <= 'f')
+ return c - 'a' + 10;
+ return g_ascii_digit_value (c);
+}
+
+/**
+ * g_ascii_strcasecmp:
+ * @s1: string to compare with @s2.
+ * @s2: string to compare with @s1.
+ *
+ * Compare two strings, ignoring the case of ASCII characters.
+ *
+ * Unlike the BSD strcasecmp() function, this only recognizes standard
+ * ASCII letters and ignores the locale, treating all non-ASCII
+ * bytes as if they are not letters.
+ *
+ * This function should be used only on strings that are known to be
+ * in encodings where the bytes corresponding to ASCII letters always
+ * represent themselves. This includes UTF-8 and the ISO-8859-*
+ * charsets, but not for instance double-byte encodings like the
+ * Windows Codepage 932, where the trailing bytes of double-byte
+ * characters include all ASCII letters. If you compare two CP932
+ * strings using this function, you will get false matches.
+ *
+ * Return value: 0 if the strings match, a negative value if @s1 &lt; @s2,
+ * or a positive value if @s1 &gt; @s2.
+ **/
+gint
+g_ascii_strcasecmp (const gchar *s1,
+ const gchar *s2)
+{
+ gint c1, c2;
+
+ g_return_val_if_fail (s1 != NULL, 0);
+ g_return_val_if_fail (s2 != NULL, 0);
+
+ while (*s1 && *s2)
+ {
+ c1 = (gint)(guchar) TOLOWER (*s1);
+ c2 = (gint)(guchar) TOLOWER (*s2);
+ if (c1 != c2)
+ return (c1 - c2);
+ s1++; s2++;
+ }
+
+ return (((gint)(guchar) *s1) - ((gint)(guchar) *s2));
+}
+
+/**
+ * g_ascii_strncasecmp:
+ * @s1: string to compare with @s2.
+ * @s2: string to compare with @s1.
+ * @n: number of characters to compare.
+ *
+ * Compare @s1 and @s2, ignoring the case of ASCII characters and any
+ * characters after the first @n in each string.
+ *
+ * Unlike the BSD strcasecmp() function, this only recognizes standard
+ * ASCII letters and ignores the locale, treating all non-ASCII
+ * characters as if they are not letters.
+ *
+ * The same warning as in g_ascii_strcasecmp() applies: Use this
+ * function only on strings known to be in encodings where bytes
+ * corresponding to ASCII letters always represent themselves.
+ *
+ * Return value: 0 if the strings match, a negative value if @s1 &lt; @s2,
+ * or a positive value if @s1 &gt; @s2.
+ **/
+gint
+g_ascii_strncasecmp (const gchar *s1,
+ const gchar *s2,
+ gsize n)
+{
+ gint c1, c2;
+
+ g_return_val_if_fail (s1 != NULL, 0);
+ g_return_val_if_fail (s2 != NULL, 0);
+
+ while (n && *s1 && *s2)
+ {
+ n -= 1;
+ c1 = (gint)(guchar) TOLOWER (*s1);
+ c2 = (gint)(guchar) TOLOWER (*s2);
+ if (c1 != c2)
+ return (c1 - c2);
+ s1++; s2++;
+ }
+
+ if (n)
+ return (((gint) (guchar) *s1) - ((gint) (guchar) *s2));
+ else
+ return 0;
+}
+
+/**
+ * g_strcasecmp:
+ * @s1: a string.
+ * @s2: a string to compare with @s1.
+ *
+ * A case-insensitive string comparison, corresponding to the standard
+ * strcasecmp() function on platforms which support it.
+ *
+ * Return value: 0 if the strings match, a negative value if @s1 &lt; @s2,
+ * or a positive value if @s1 &gt; @s2.
+ *
+ * Deprecated:2.2: See g_strncasecmp() for a discussion of why this function
+ * is deprecated and how to replace it.
+ **/
+gint
+g_strcasecmp (const gchar *s1,
+ const gchar *s2)
+{
+#ifdef HAVE_STRCASECMP
+ g_return_val_if_fail (s1 != NULL, 0);
+ g_return_val_if_fail (s2 != NULL, 0);
+
+ return strcasecmp (s1, s2);
+#else
+ gint c1, c2;
+
+ g_return_val_if_fail (s1 != NULL, 0);
+ g_return_val_if_fail (s2 != NULL, 0);
+
+ while (*s1 && *s2)
+ {
+ /* According to A. Cox, some platforms have islower's that
+ * don't work right on non-uppercase
+ */
+ c1 = isupper ((guchar)*s1) ? tolower ((guchar)*s1) : *s1;
+ c2 = isupper ((guchar)*s2) ? tolower ((guchar)*s2) : *s2;
+ if (c1 != c2)
+ return (c1 - c2);
+ s1++; s2++;
+ }
+
+ return (((gint)(guchar) *s1) - ((gint)(guchar) *s2));
+#endif
+}
+
+/**
+ * g_strncasecmp:
+ * @s1: a string.
+ * @s2: a string to compare with @s1.
+ * @n: the maximum number of characters to compare.
+ *
+ * A case-insensitive string comparison, corresponding to the standard
+ * strncasecmp() function on platforms which support it.
+ * It is similar to g_strcasecmp() except it only compares the first @n
+ * characters of the strings.
+ *
+ * Return value: 0 if the strings match, a negative value if @s1 &lt; @s2,
+ * or a positive value if @s1 &gt; @s2.
+ *
+ * Deprecated:2.2: The problem with g_strncasecmp() is that it does the
+ * comparison by calling toupper()/tolower(). These functions are
+ * locale-specific and operate on single bytes. However, it is impossible
+ * to handle things correctly from an I18N standpoint by operating on
+ * bytes, since characters may be multibyte. Thus g_strncasecmp() is
+ * broken if your string is guaranteed to be ASCII, since it's
+ * locale-sensitive, and it's broken if your string is localized, since
+ * it doesn't work on many encodings at all, including UTF-8, EUC-JP,
+ * etc.
+ *
+ * There are therefore two replacement functions: g_ascii_strncasecmp(),
+ * which only works on ASCII and is not locale-sensitive, and
+ * g_utf8_casefold(), which is good for case-insensitive sorting of UTF-8.
+ **/
+gint
+g_strncasecmp (const gchar *s1,
+ const gchar *s2,
+ guint n)
+{
+#ifdef HAVE_STRNCASECMP
+ return strncasecmp (s1, s2, n);
+#else
+ gint c1, c2;
+
+ g_return_val_if_fail (s1 != NULL, 0);
+ g_return_val_if_fail (s2 != NULL, 0);
+
+ while (n && *s1 && *s2)
+ {
+ n -= 1;
+ /* According to A. Cox, some platforms have islower's that
+ * don't work right on non-uppercase
+ */
+ c1 = isupper ((guchar)*s1) ? tolower ((guchar)*s1) : *s1;
+ c2 = isupper ((guchar)*s2) ? tolower ((guchar)*s2) : *s2;
+ if (c1 != c2)
+ return (c1 - c2);
+ s1++; s2++;
+ }
+
+ if (n)
+ return (((gint) (guchar) *s1) - ((gint) (guchar) *s2));
+ else
+ return 0;
+#endif
+}
+
+gchar*
+g_strdelimit (gchar *string,
+ const gchar *delimiters,
+ gchar new_delim)
+{
+ register gchar *c;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ if (!delimiters)
+ delimiters = G_STR_DELIMITERS;
+
+ for (c = string; *c; c++)
+ {
+ if (strchr (delimiters, *c))
+ *c = new_delim;
+ }
+
+ return string;
+}
+
+gchar*
+g_strcanon (gchar *string,
+ const gchar *valid_chars,
+ gchar substitutor)
+{
+ register gchar *c;
+
+ g_return_val_if_fail (string != NULL, NULL);
+ g_return_val_if_fail (valid_chars != NULL, NULL);
+
+ for (c = string; *c; c++)
+ {
+ if (!strchr (valid_chars, *c))
+ *c = substitutor;
+ }
+
+ return string;
+}
+
+gchar*
+g_strcompress (const gchar *source)
+{
+ const gchar *p = source, *octal;
+ gchar *dest = g_malloc (strlen (source) + 1);
+ gchar *q = dest;
+
+ while (*p)
+ {
+ if (*p == '\\')
+ {
+ p++;
+ switch (*p)
+ {
+ case '\0':
+#if NOT_NEEDED_FOR_NAVIT
+ g_warning ("g_strcompress: trailing \\");
+#endif /* NOT_NEEDED_FOR_NAVIT */
+ goto out;
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7':
+ *q = 0;
+ octal = p;
+ while ((p < octal + 3) && (*p >= '0') && (*p <= '7'))
+ {
+ *q = (*q * 8) + (*p - '0');
+ p++;
+ }
+ q++;
+ p--;
+ break;
+ case 'b':
+ *q++ = '\b';
+ break;
+ case 'f':
+ *q++ = '\f';
+ break;
+ case 'n':
+ *q++ = '\n';
+ break;
+ case 'r':
+ *q++ = '\r';
+ break;
+ case 't':
+ *q++ = '\t';
+ break;
+ default: /* Also handles \" and \\ */
+ *q++ = *p;
+ break;
+ }
+ }
+ else
+ *q++ = *p;
+ p++;
+ }
+out:
+ *q = 0;
+
+ return dest;
+}
+
+gchar *
+g_strescape (const gchar *source,
+ const gchar *exceptions)
+{
+ const guchar *p;
+ gchar *dest;
+ gchar *q;
+ guchar excmap[256];
+
+ g_return_val_if_fail (source != NULL, NULL);
+
+ p = (guchar *) source;
+ /* Each source byte needs maximally four destination chars (\777) */
+ q = dest = g_malloc (strlen (source) * 4 + 1);
+
+ memset (excmap, 0, 256);
+ if (exceptions)
+ {
+ guchar *e = (guchar *) exceptions;
+
+ while (*e)
+ {
+ excmap[*e] = 1;
+ e++;
+ }
+ }
+
+ while (*p)
+ {
+ if (excmap[*p])
+ *q++ = *p;
+ else
+ {
+ switch (*p)
+ {
+ case '\b':
+ *q++ = '\\';
+ *q++ = 'b';
+ break;
+ case '\f':
+ *q++ = '\\';
+ *q++ = 'f';
+ break;
+ case '\n':
+ *q++ = '\\';
+ *q++ = 'n';
+ break;
+ case '\r':
+ *q++ = '\\';
+ *q++ = 'r';
+ break;
+ case '\t':
+ *q++ = '\\';
+ *q++ = 't';
+ break;
+ case '\\':
+ *q++ = '\\';
+ *q++ = '\\';
+ break;
+ case '"':
+ *q++ = '\\';
+ *q++ = '"';
+ break;
+ default:
+ if ((*p < ' ') || (*p >= 0177))
+ {
+ *q++ = '\\';
+ *q++ = '0' + (((*p) >> 6) & 07);
+ *q++ = '0' + (((*p) >> 3) & 07);
+ *q++ = '0' + ((*p) & 07);
+ }
+ else
+ *q++ = *p;
+ break;
+ }
+ }
+ p++;
+ }
+ *q = 0;
+ return dest;
+}
+
+gchar*
+g_strchug (gchar *string)
+{
+ guchar *start;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ for (start = (guchar*) string; *start && g_ascii_isspace (*start); start++)
+ ;
+
+ g_memmove (string, start, strlen ((gchar *) start) + 1);
+
+ return string;
+}
+
+gchar*
+g_strchomp (gchar *string)
+{
+ gsize len;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ len = strlen (string);
+ while (len--)
+ {
+ if (g_ascii_isspace ((guchar) string[len]))
+ string[len] = '\0';
+ else
+ break;
+ }
+
+ return string;
+}
+
+#if NOT_NEEDED_FOR_NAVIT
+/**
+ * g_strsplit:
+ * @string: a string to split.
+ * @delimiter: a string which specifies the places at which to split the string.
+ * The delimiter is not included in any of the resulting strings, unless
+ * @max_tokens is reached.
+ * @max_tokens: the maximum number of pieces to split @string into. If this is
+ * less than 1, the string is split completely.
+ *
+ * Splits a string into a maximum of @max_tokens pieces, using the given
+ * @delimiter. If @max_tokens is reached, the remainder of @string is appended
+ * to the last token.
+ *
+ * As a special case, the result of splitting the empty string "" is an empty
+ * vector, not a vector containing a single string. The reason for this
+ * special case is that being able to represent a empty vector is typically
+ * more useful than consistent handling of empty elements. If you do need
+ * to represent empty elements, you'll need to check for the empty string
+ * before calling g_strsplit().
+ *
+ * Return value: a newly-allocated %NULL-terminated array of strings. Use
+ * g_strfreev() to free it.
+ **/
+gchar**
+g_strsplit (const gchar *string,
+ const gchar *delimiter,
+ gint max_tokens)
+{
+ GSList *string_list = NULL, *slist;
+ gchar **str_array, *s;
+ guint n = 0;
+ const gchar *remainder;
+
+ g_return_val_if_fail (string != NULL, NULL);
+ g_return_val_if_fail (delimiter != NULL, NULL);
+ g_return_val_if_fail (delimiter[0] != '\0', NULL);
+
+ if (max_tokens < 1)
+ max_tokens = G_MAXINT;
+
+ remainder = string;
+ s = strstr (remainder, delimiter);
+ if (s)
+ {
+ gsize delimiter_len = strlen (delimiter);
+
+ while (--max_tokens && s)
+ {
+ gsize len;
+
+ len = s - remainder;
+ string_list = g_slist_prepend (string_list,
+ g_strndup (remainder, len));
+ n++;
+ remainder = s + delimiter_len;
+ s = strstr (remainder, delimiter);
+ }
+ }
+ if (*string)
+ {
+ n++;
+ string_list = g_slist_prepend (string_list, g_strdup (remainder));
+ }
+
+ str_array = g_new (gchar*, n + 1);
+
+ str_array[n--] = NULL;
+ for (slist = string_list; slist; slist = slist->next)
+ str_array[n--] = slist->data;
+
+ g_slist_free (string_list);
+
+ return str_array;
+}
+
+/**
+ * g_strsplit_set:
+ * @string: The string to be tokenized
+ * @delimiters: A nul-terminated string containing bytes that are used
+ * to split the string.
+ * @max_tokens: The maximum number of tokens to split @string into.
+ * If this is less than 1, the string is split completely
+ *
+ * Splits @string into a number of tokens not containing any of the characters
+ * in @delimiter. A token is the (possibly empty) longest string that does not
+ * contain any of the characters in @delimiters. If @max_tokens is reached, the
+ * remainder is appended to the last token.
+ *
+ * For example the result of g_strsplit_set ("abc:def/ghi", ":/", -1) is a
+ * %NULL-terminated vector containing the three strings "abc", "def",
+ * and "ghi".
+ *
+ * The result if g_strsplit_set (":def/ghi:", ":/", -1) is a %NULL-terminated
+ * vector containing the four strings "", "def", "ghi", and "".
+ *
+ * As a special case, the result of splitting the empty string "" is an empty
+ * vector, not a vector containing a single string. The reason for this
+ * special case is that being able to represent a empty vector is typically
+ * more useful than consistent handling of empty elements. If you do need
+ * to represent empty elements, you'll need to check for the empty string
+ * before calling g_strsplit_set().
+ *
+ * Note that this function works on bytes not characters, so it can't be used
+ * to delimit UTF-8 strings for anything but ASCII characters.
+ *
+ * Return value: a newly-allocated %NULL-terminated array of strings. Use
+ * g_strfreev() to free it.
+ *
+ * Since: 2.4
+ **/
+gchar **
+g_strsplit_set (const gchar *string,
+ const gchar *delimiters,
+ gint max_tokens)
+{
+ gboolean delim_table[256];
+ GSList *tokens, *list;
+ gint n_tokens;
+ const gchar *s;
+ const gchar *current;
+ gchar *token;
+ gchar **result;
+
+ g_return_val_if_fail (string != NULL, NULL);
+ g_return_val_if_fail (delimiters != NULL, NULL);
+
+ if (max_tokens < 1)
+ max_tokens = G_MAXINT;
+
+ if (*string == '\0')
+ {
+ result = g_new (char *, 1);
+ result[0] = NULL;
+ return result;
+ }
+
+ memset (delim_table, FALSE, sizeof (delim_table));
+ for (s = delimiters; *s != '\0'; ++s)
+ delim_table[*(guchar *)s] = TRUE;
+
+ tokens = NULL;
+ n_tokens = 0;
+
+ s = current = string;
+ while (*s != '\0')
+ {
+ if (delim_table[*(guchar *)s] && n_tokens + 1 < max_tokens)
+ {
+ gchar *token;
+
+ token = g_strndup (current, s - current);
+ tokens = g_slist_prepend (tokens, token);
+ ++n_tokens;
+
+ current = s + 1;
+ }
+
+ ++s;
+ }
+
+ token = g_strndup (current, s - current);
+ tokens = g_slist_prepend (tokens, token);
+ ++n_tokens;
+
+ result = g_new (gchar *, n_tokens + 1);
+
+ result[n_tokens] = NULL;
+ for (list = tokens; list != NULL; list = list->next)
+ result[--n_tokens] = list->data;
+
+ g_slist_free (tokens);
+
+ return result;
+}
+#endif /* NOT_NEEDED_FOR_NAVIT */
+
+/**
+ * g_strfreev:
+ * @str_array: a %NULL-terminated array of strings to free.
+
+ * Frees a %NULL-terminated array of strings, and the array itself.
+ * If called on a %NULL value, g_strfreev() simply returns.
+ **/
+void
+g_strfreev (gchar **str_array)
+{
+ if (str_array)
+ {
+ int i;
+
+ for (i = 0; str_array[i] != NULL; i++)
+ g_free (str_array[i]);
+
+ g_free (str_array);
+ }
+}
+
+/**
+ * g_strdupv:
+ * @str_array: %NULL-terminated array of strings.
+ *
+ * Copies %NULL-terminated array of strings. The copy is a deep copy;
+ * the new array should be freed by first freeing each string, then
+ * the array itself. g_strfreev() does this for you. If called
+ * on a %NULL value, g_strdupv() simply returns %NULL.
+ *
+ * Return value: a new %NULL-terminated array of strings.
+ **/
+gchar**
+g_strdupv (gchar **str_array)
+{
+ if (str_array)
+ {
+ gint i;
+ gchar **retval;
+
+ i = 0;
+ while (str_array[i])
+ ++i;
+
+ retval = g_new (gchar*, i + 1);
+
+ i = 0;
+ while (str_array[i])
+ {
+ retval[i] = g_strdup (str_array[i]);
+ ++i;
+ }
+ retval[i] = NULL;
+
+ return retval;
+ }
+ else
+ return NULL;
+}
+
+gchar*
+g_strjoinv (const gchar *separator,
+ gchar **str_array)
+{
+ gchar *string;
+ gchar *ptr;
+
+ g_return_val_if_fail (str_array != NULL, NULL);
+
+ if (separator == NULL)
+ separator = "";
+
+ if (*str_array)
+ {
+ gint i;
+ gsize len;
+ gsize separator_len;
+
+ separator_len = strlen (separator);
+ /* First part, getting length */
+ len = 1 + strlen (str_array[0]);
+ for (i = 1; str_array[i] != NULL; i++)
+ len += strlen (str_array[i]);
+ len += separator_len * (i - 1);
+
+ /* Second part, building string */
+ string = g_new (gchar, len);
+ ptr = g_stpcpy (string, *str_array);
+ for (i = 1; str_array[i] != NULL; i++)
+ {
+ ptr = g_stpcpy (ptr, separator);
+ ptr = g_stpcpy (ptr, str_array[i]);
+ }
+ }
+ else
+ string = g_strdup ("");
+
+ return string;
+}
+
+gchar*
+g_strjoin (const gchar *separator,
+ ...)
+{
+ gchar *string, *s;
+ va_list args;
+ gsize len;
+ gsize separator_len;
+ gchar *ptr;
+
+ if (separator == NULL)
+ separator = "";
+
+ separator_len = strlen (separator);
+
+ va_start (args, separator);
+
+ s = va_arg (args, gchar*);
+
+ if (s)
+ {
+ /* First part, getting length */
+ len = 1 + strlen (s);
+
+ s = va_arg (args, gchar*);
+ while (s)
+ {
+ len += separator_len + strlen (s);
+ s = va_arg (args, gchar*);
+ }
+ va_end (args);
+
+ /* Second part, building string */
+ string = g_new (gchar, len);
+
+ va_start (args, separator);
+
+ s = va_arg (args, gchar*);
+ ptr = g_stpcpy (string, s);
+
+ s = va_arg (args, gchar*);
+ while (s)
+ {
+ ptr = g_stpcpy (ptr, separator);
+ ptr = g_stpcpy (ptr, s);
+ s = va_arg (args, gchar*);
+ }
+ }
+ else
+ string = g_strdup ("");
+
+ va_end (args);
+
+ return string;
+}
+
+#if NOT_NEEDED_FOR_NAVIT
+
+/**
+ * g_strstr_len:
+ * @haystack: a string.
+ * @haystack_len: the maximum length of @haystack. Note that -1 is
+ * a valid length, if @haystack is nul-terminated, meaning it will
+ * search through the whole string.
+ * @needle: the string to search for.
+ *
+ * Searches the string @haystack for the first occurrence
+ * of the string @needle, limiting the length of the search
+ * to @haystack_len.
+ *
+ * Return value: a pointer to the found occurrence, or
+ * %NULL if not found.
+ **/
+gchar *
+g_strstr_len (const gchar *haystack,
+ gssize haystack_len,
+ const gchar *needle)
+{
+ g_return_val_if_fail (haystack != NULL, NULL);
+ g_return_val_if_fail (needle != NULL, NULL);
+
+ if (haystack_len < 0)
+ return strstr (haystack, needle);
+ else
+ {
+ const gchar *p = haystack;
+ gsize needle_len = strlen (needle);
+ const gchar *end;
+ gsize i;
+
+ if (needle_len == 0)
+ return (gchar *)haystack;
+
+ if (haystack_len < needle_len)
+ return NULL;
+
+ end = haystack + haystack_len - needle_len;
+
+ while (p <= end && *p)
+ {
+ for (i = 0; i < needle_len; i++)
+ if (p[i] != needle[i])
+ goto next;
+
+ return (gchar *)p;
+
+ next:
+ p++;
+ }
+
+ return NULL;
+ }
+}
+#endif /* NOT_NEEDED_FOR_NAVIT */
+
+/**
+ * g_strrstr:
+ * @haystack: a nul-terminated string.
+ * @needle: the nul-terminated string to search for.
+ *
+ * Searches the string @haystack for the last occurrence
+ * of the string @needle.
+ *
+ * Return value: a pointer to the found occurrence, or
+ * %NULL if not found.
+ **/
+gchar *
+g_strrstr (const gchar *haystack,
+ const gchar *needle)
+{
+ gsize i;
+ gsize needle_len;
+ gsize haystack_len;
+ const gchar *p;
+
+ g_return_val_if_fail (haystack != NULL, NULL);
+ g_return_val_if_fail (needle != NULL, NULL);
+
+ needle_len = strlen (needle);
+ haystack_len = strlen (haystack);
+
+ if (needle_len == 0)
+ return (gchar *)haystack;
+
+ if (haystack_len < needle_len)
+ return NULL;
+
+ p = haystack + haystack_len - needle_len;
+
+ while (p >= haystack)
+ {
+ for (i = 0; i < needle_len; i++)
+ if (p[i] != needle[i])
+ goto next;
+
+ return (gchar *)p;
+
+ next:
+ p--;
+ }
+
+ return NULL;
+}
+
+#if NOT_NEEDED_FOR_NAVIT
+/**
+ * g_strrstr_len:
+ * @haystack: a nul-terminated string.
+ * @haystack_len: the maximum length of @haystack.
+ * @needle: the nul-terminated string to search for.
+ *
+ * Searches the string @haystack for the last occurrence
+ * of the string @needle, limiting the length of the search
+ * to @haystack_len.
+ *
+ * Return value: a pointer to the found occurrence, or
+ * %NULL if not found.
+ **/
+gchar *
+g_strrstr_len (const gchar *haystack,
+ gssize haystack_len,
+ const gchar *needle)
+{
+ g_return_val_if_fail (haystack != NULL, NULL);
+ g_return_val_if_fail (needle != NULL, NULL);
+
+ if (haystack_len < 0)
+ return g_strrstr (haystack, needle);
+ else
+ {
+ gsize needle_len = strlen (needle);
+ const gchar *haystack_max = haystack + haystack_len;
+ const gchar *p = haystack;
+ gsize i;
+
+ while (p < haystack_max && *p)
+ p++;
+
+ if (p < haystack + needle_len)
+ return NULL;
+
+ p -= needle_len;
+
+ while (p >= haystack)
+ {
+ for (i = 0; i < needle_len; i++)
+ if (p[i] != needle[i])
+ goto next;
+
+ return (gchar *)p;
+
+ next:
+ p--;
+ }
+
+ return NULL;
+ }
+}
+
+
+/**
+ * g_str_has_suffix:
+ * @str: a nul-terminated string.
+ * @suffix: the nul-terminated suffix to look for.
+ *
+ * Looks whether the string @str ends with @suffix.
+ *
+ * Return value: %TRUE if @str end with @suffix, %FALSE otherwise.
+ *
+ * Since: 2.2
+ **/
+gboolean
+g_str_has_suffix (const gchar *str,
+ const gchar *suffix)
+{
+ int str_len;
+ int suffix_len;
+
+ g_return_val_if_fail (str != NULL, FALSE);
+ g_return_val_if_fail (suffix != NULL, FALSE);
+
+ str_len = strlen (str);
+ suffix_len = strlen (suffix);
+
+ if (str_len < suffix_len)
+ return FALSE;
+
+ return strcmp (str + str_len - suffix_len, suffix) == 0;
+}
+
+/**
+ * g_str_has_prefix:
+ * @str: a nul-terminated string.
+ * @prefix: the nul-terminated prefix to look for.
+ *
+ * Looks whether the string @str begins with @prefix.
+ *
+ * Return value: %TRUE if @str begins with @prefix, %FALSE otherwise.
+ *
+ * Since: 2.2
+ **/
+gboolean
+g_str_has_prefix (const gchar *str,
+ const gchar *prefix)
+{
+ int str_len;
+ int prefix_len;
+
+ g_return_val_if_fail (str != NULL, FALSE);
+ g_return_val_if_fail (prefix != NULL, FALSE);
+
+ str_len = strlen (str);
+ prefix_len = strlen (prefix);
+
+ if (str_len < prefix_len)
+ return FALSE;
+
+ return strncmp (str, prefix, prefix_len) == 0;
+}
+
+
+/**
+ * g_strip_context:
+ * @msgid: a string
+ * @msgval: another string
+ *
+ * An auxiliary function for gettext() support (see Q_()).
+ *
+ * Return value: @msgval, unless @msgval is identical to @msgid and contains
+ * a '|' character, in which case a pointer to the substring of msgid after
+ * the first '|' character is returned.
+ *
+ * Since: 2.4
+ **/
+G_CONST_RETURN gchar *
+g_strip_context (const gchar *msgid,
+ const gchar *msgval)
+{
+ if (msgval == msgid)
+ {
+ const char *c = strchr (msgid, '|');
+ if (c != NULL)
+ return c + 1;
+ }
+
+ return msgval;
+}
+
+
+/**
+ * g_strv_length:
+ * @str_array: a %NULL-terminated array of strings.
+ *
+ * Returns the length of the given %NULL-terminated
+ * string array @str_array.
+ *
+ * Return value: length of @str_array.
+ *
+ * Since: 2.6
+ **/
+guint
+g_strv_length (gchar **str_array)
+{
+ guint i = 0;
+
+ g_return_val_if_fail (str_array != NULL, 0);
+
+ while (str_array[i])
+ ++i;
+
+ return i;
+}
+
+
+/**
+ * g_dpgettext:
+ * @domain: the translation domain to use, or %NULL to use
+ * the domain set with textdomain()
+ * @msgctxtid: a combined message context and message id, separated
+ * by a \004 character
+ * @msgidoffset: the offset of the message id in @msgctxid
+ *
+ * This function is a variant of g_dgettext() which supports
+ * a disambiguating message context. GNU gettext uses the
+ * '\004' character to separate the message context and
+ * message id in @msgctxtid.
+ * If 0 is passed as @msgidoffset, this function will fall back to
+ * trying to use the deprecated convention of using "|" as a separation
+ * character.
+ *
+ * This uses g_dgettext() internally. See that functions for differences
+ * with dgettext() proper.
+ *
+ * Applications should normally not use this function directly,
+ * but use the C_() macro for translations with context.
+ *
+ * Returns: The translated string
+ *
+ * Since: 2.16
+ */
+G_CONST_RETURN gchar *
+g_dpgettext (const gchar *domain,
+ const gchar *msgctxtid,
+ gsize msgidoffset)
+{
+ const gchar *translation;
+ gchar *sep;
+
+ translation = g_dgettext (domain, msgctxtid);
+
+ if (translation == msgctxtid)
+ {
+ if (msgidoffset > 0)
+ return msgctxtid + msgidoffset;
+
+ sep = strchr (msgctxtid, '|');
+
+ if (sep)
+ {
+ /* try with '\004' instead of '|', in case
+ * xgettext -kQ_:1g was used
+ */
+ gchar *tmp = g_alloca (strlen (msgctxtid) + 1);
+ strcpy (tmp, msgctxtid);
+ tmp[sep - msgctxtid] = '\004';
+
+ translation = g_dgettext (domain, tmp);
+
+ if (translation == tmp)
+ return sep + 1;
+ }
+ }
+
+ return translation;
+}
+
+/* This function is taken from gettext.h
+ * GNU gettext uses '\004' to separate context and msgid in .mo files.
+ */
+/**
+ * g_dpgettext2:
+ * @domain: the translation domain to use, or %NULL to use
+ * the domain set with textdomain()
+ * @context: the message context
+ * @msgid: the message
+ *
+ * This function is a variant of g_dgettext() which supports
+ * a disambiguating message context. GNU gettext uses the
+ * '\004' character to separate the message context and
+ * message id in @msgctxtid.
+ *
+ * This uses g_dgettext() internally. See that functions for differences
+ * with dgettext() proper.
+ *
+ * This function differs from C_() in that it is not a macro and
+ * thus you may use non-string-literals as context and msgid arguments.
+ *
+ * Returns: The translated string
+ *
+ * Since: 2.18
+ */
+G_CONST_RETURN char *
+g_dpgettext2 (const char *domain,
+ const char *msgctxt,
+ const char *msgid)
+{
+ size_t msgctxt_len = strlen (msgctxt) + 1;
+ size_t msgid_len = strlen (msgid) + 1;
+ const char *translation;
+ char* msg_ctxt_id;
+
+ msg_ctxt_id = g_alloca (msgctxt_len + msgid_len);
+
+ memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
+ msg_ctxt_id[msgctxt_len - 1] = '\004';
+ memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
+
+ translation = g_dgettext (domain, msg_ctxt_id);
+
+ if (translation == msg_ctxt_id)
+ {
+ /* try the old way of doing message contexts, too */
+ msg_ctxt_id[msgctxt_len - 1] = '|';
+ translation = g_dgettext (domain, msg_ctxt_id);
+
+ if (translation == msg_ctxt_id)
+ return msgid;
+ }
+
+ return translation;
+}
+
+static gboolean
+_g_dgettext_should_translate (void)
+{
+ static gsize translate = 0;
+ enum {
+ SHOULD_TRANSLATE = 1,
+ SHOULD_NOT_TRANSLATE = 2
+ };
+
+ if (G_UNLIKELY (g_once_init_enter (&translate)))
+ {
+ gboolean should_translate = TRUE;
+
+ const char *default_domain = textdomain (NULL);
+ const char *translator_comment = gettext ("");
+#ifndef G_OS_WIN32
+ const char *translate_locale = setlocale (LC_MESSAGES, NULL);
+#else
+ const char *translate_locale = g_win32_getlocale ();
+#endif
+ /* We should NOT translate only if all the following hold:
+ * - user has called textdomain() and set textdomain to non-default
+ * - default domain has no translations
+ * - locale does not start with "en_" and is not "C"
+ *
+ * Rationale:
+ * - If text domain is still the default domain, maybe user calls
+ * it later. Continue with old behavior of translating.
+ * - If locale starts with "en_", we can continue using the
+ * translations even if the app doesn't have translations for
+ * this locale. That is, en_UK and en_CA for example.
+ * - If locale is "C", maybe user calls setlocale(LC_ALL,"") later.
+ * Continue with old behavior of translating.
+ */
+ if (0 != strcmp (default_domain, "messages") &&
+ '\0' == *translator_comment &&
+ 0 != strncmp (translate_locale, "en_", 3) &&
+ 0 != strcmp (translate_locale, "C"))
+ should_translate = FALSE;
+
+ g_once_init_leave (&translate,
+ should_translate ?
+ SHOULD_TRANSLATE :
+ SHOULD_NOT_TRANSLATE);
+ }
+
+ return translate == SHOULD_TRANSLATE;
+}
+
+/**
+ * g_dgettext:
+ * @domain: the translation domain to use, or %NULL to use
+ * the domain set with textdomain()
+ * @msgid: message to translate
+ *
+ * This function is a wrapper of dgettext() which does not translate
+ * the message if the default domain as set with textdomain() has no
+ * translations for the current locale.
+ *
+ * The advantage of using this function over dgettext() proper is that
+ * libraries using this function (like GTK+) will not use translations
+ * if the application using the library does not have translations for
+ * the current locale. This results in a consistent English-only
+ * interface instead of one having partial translations. For this
+ * feature to work, the call to textdomain() and setlocale() should
+ * precede any g_dgettext() invocations. For GTK+, it means calling
+ * textdomain() before gtk_init or its variants.
+ *
+ * This function disables translations if and only if upon its first
+ * call all the following conditions hold:
+ * <itemizedlist>
+ * <listitem>@domain is not %NULL</listitem>
+ * <listitem>textdomain() has been called to set a default text domain</listitem>
+ * <listitem>there is no translations available for the default text domain
+ * and the current locale</listitem>
+ * <listitem>current locale is not "C" or any English locales (those
+ * starting with "en_")</listitem>
+ * </itemizedlist>
+ *
+ * Note that this behavior may not be desired for example if an application
+ * has its untranslated messages in a language other than English. In those
+ * cases the application should call textdomain() after initializing GTK+.
+ *
+ * Applications should normally not use this function directly,
+ * but use the _() macro for translations.
+ *
+ * Returns: The translated string
+ *
+ * Since: 2.18
+ */
+G_CONST_RETURN gchar *
+g_dgettext (const gchar *domain,
+ const gchar *msgid)
+{
+ if (domain && G_UNLIKELY (!_g_dgettext_should_translate ()))
+ return msgid;
+
+ return dgettext (domain, msgid);
+}
+
+/**
+ * g_dngettext:
+ * @domain: the translation domain to use, or %NULL to use
+ * the domain set with textdomain()
+ * @msgid: message to translate
+ * @msgid_plural: plural form of the message
+ * @n: the quantity for which translation is needed
+ *
+ * This function is a wrapper of dngettext() which does not translate
+ * the message if the default domain as set with textdomain() has no
+ * translations for the current locale.
+ *
+ * See g_dgettext() for details of how this differs from dngettext()
+ * proper.
+ *
+ * Returns: The translated string
+ *
+ * Since: 2.18
+ */
+G_CONST_RETURN gchar *
+g_dngettext (const gchar *domain,
+ const gchar *msgid,
+ const gchar *msgid_plural,
+ gulong n)
+{
+ if (domain && G_UNLIKELY (!_g_dgettext_should_translate ()))
+ return n == 1 ? msgid : msgid_plural;
+
+ return dngettext (domain, msgid, msgid_plural, n);
+}
+
+#endif /* NOT_NEEDED_FOR_NAVIT */
+
+#define __G_STRFUNCS_C__
+#include "galiasdef.c"
diff --git a/support/glib/gstrfuncs.h b/support/glib/gstrfuncs.h
new file mode 100644
index 00000000..ee291f80
--- /dev/null
+++ b/support/glib/gstrfuncs.h
@@ -0,0 +1,266 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#ifndef __G_STRFUNCS_H__
+#define __G_STRFUNCS_H__
+
+#include <stdarg.h>
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+/* Functions like the ones in <ctype.h> that are not affected by locale. */
+typedef enum {
+ G_ASCII_ALNUM = 1 << 0,
+ G_ASCII_ALPHA = 1 << 1,
+ G_ASCII_CNTRL = 1 << 2,
+ G_ASCII_DIGIT = 1 << 3,
+ G_ASCII_GRAPH = 1 << 4,
+ G_ASCII_LOWER = 1 << 5,
+ G_ASCII_PRINT = 1 << 6,
+ G_ASCII_PUNCT = 1 << 7,
+ G_ASCII_SPACE = 1 << 8,
+ G_ASCII_UPPER = 1 << 9,
+ G_ASCII_XDIGIT = 1 << 10
+} GAsciiType;
+
+GLIB_VAR const guint16 * const g_ascii_table;
+
+#define g_ascii_isalnum(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_ALNUM) != 0)
+
+#define g_ascii_isalpha(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_ALPHA) != 0)
+
+#define g_ascii_iscntrl(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_CNTRL) != 0)
+
+#define g_ascii_isdigit(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_DIGIT) != 0)
+
+#define g_ascii_isgraph(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_GRAPH) != 0)
+
+#define g_ascii_islower(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_LOWER) != 0)
+
+#define g_ascii_isprint(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_PRINT) != 0)
+
+#define g_ascii_ispunct(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_PUNCT) != 0)
+
+#define g_ascii_isspace(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_SPACE) != 0)
+
+#define g_ascii_isupper(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_UPPER) != 0)
+
+#define g_ascii_isxdigit(c) \
+ ((g_ascii_table[(guchar) (c)] & G_ASCII_XDIGIT) != 0)
+
+gchar g_ascii_tolower (gchar c) G_GNUC_CONST;
+gchar g_ascii_toupper (gchar c) G_GNUC_CONST;
+
+gint g_ascii_digit_value (gchar c) G_GNUC_CONST;
+gint g_ascii_xdigit_value (gchar c) G_GNUC_CONST;
+
+/* String utility functions that modify a string argument or
+ * return a constant string that must not be freed.
+ */
+#define G_STR_DELIMITERS "_-|> <."
+gchar* g_strdelimit (gchar *string,
+ const gchar *delimiters,
+ gchar new_delimiter);
+gchar* g_strcanon (gchar *string,
+ const gchar *valid_chars,
+ gchar substitutor);
+G_CONST_RETURN gchar* g_strerror (gint errnum) G_GNUC_CONST;
+G_CONST_RETURN gchar* g_strsignal (gint signum) G_GNUC_CONST;
+gchar* g_strreverse (gchar *string);
+gsize g_strlcpy (gchar *dest,
+ const gchar *src,
+ gsize dest_size);
+gsize g_strlcat (gchar *dest,
+ const gchar *src,
+ gsize dest_size);
+gchar * g_strstr_len (const gchar *haystack,
+ gssize haystack_len,
+ const gchar *needle);
+gchar * g_strrstr (const gchar *haystack,
+ const gchar *needle);
+gchar * g_strrstr_len (const gchar *haystack,
+ gssize haystack_len,
+ const gchar *needle);
+
+gboolean g_str_has_suffix (const gchar *str,
+ const gchar *suffix);
+gboolean g_str_has_prefix (const gchar *str,
+ const gchar *prefix);
+
+/* String to/from double conversion functions */
+
+gdouble g_strtod (const gchar *nptr,
+ gchar **endptr);
+gdouble g_ascii_strtod (const gchar *nptr,
+ gchar **endptr);
+guint64 g_ascii_strtoull (const gchar *nptr,
+ gchar **endptr,
+ guint base);
+gint64 g_ascii_strtoll (const gchar *nptr,
+ gchar **endptr,
+ guint base);
+/* 29 bytes should enough for all possible values that
+ * g_ascii_dtostr can produce.
+ * Then add 10 for good measure */
+#define G_ASCII_DTOSTR_BUF_SIZE (29 + 10)
+gchar * g_ascii_dtostr (gchar *buffer,
+ gint buf_len,
+ gdouble d);
+gchar * g_ascii_formatd (gchar *buffer,
+ gint buf_len,
+ const gchar *format,
+ gdouble d);
+
+/* removes leading spaces */
+gchar* g_strchug (gchar *string);
+/* removes trailing spaces */
+gchar* g_strchomp (gchar *string);
+/* removes leading & trailing spaces */
+#define g_strstrip( string ) g_strchomp (g_strchug (string))
+
+gint g_ascii_strcasecmp (const gchar *s1,
+ const gchar *s2);
+gint g_ascii_strncasecmp (const gchar *s1,
+ const gchar *s2,
+ gsize n);
+gchar* g_ascii_strdown (const gchar *str,
+ gssize len) G_GNUC_MALLOC;
+gchar* g_ascii_strup (const gchar *str,
+ gssize len) G_GNUC_MALLOC;
+
+#ifndef G_DISABLE_DEPRECATED
+
+/* The following four functions are deprecated and will be removed in
+ * the next major release. They use the locale-specific tolower and
+ * toupper, which is almost never the right thing.
+ */
+
+gint g_strcasecmp (const gchar *s1,
+ const gchar *s2);
+gint g_strncasecmp (const gchar *s1,
+ const gchar *s2,
+ guint n);
+gchar* g_strdown (gchar *string);
+gchar* g_strup (gchar *string);
+
+#endif /* G_DISABLE_DEPRECATED */
+
+/* String utility functions that return a newly allocated string which
+ * ought to be freed with g_free from the caller at some point.
+ */
+gchar* g_strdup (const gchar *str) G_GNUC_MALLOC;
+gchar* g_strdup_printf (const gchar *format,
+ ...) G_GNUC_PRINTF (1, 2) G_GNUC_MALLOC;
+gchar* g_strdup_vprintf (const gchar *format,
+ va_list args) G_GNUC_MALLOC;
+gchar* g_strndup (const gchar *str,
+ gsize n) G_GNUC_MALLOC;
+gchar* g_strnfill (gsize length,
+ gchar fill_char) G_GNUC_MALLOC;
+gchar* g_strconcat (const gchar *string1,
+ ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED;
+gchar* g_strjoin (const gchar *separator,
+ ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED;
+
+/* Make a copy of a string interpreting C string -style escape
+ * sequences. Inverse of g_strescape. The recognized sequences are \b
+ * \f \n \r \t \\ \" and the octal format.
+ */
+gchar* g_strcompress (const gchar *source) G_GNUC_MALLOC;
+
+/* Copy a string escaping nonprintable characters like in C strings.
+ * Inverse of g_strcompress. The exceptions parameter, if non-NULL, points
+ * to a string containing characters that are not to be escaped.
+ *
+ * Deprecated API: gchar* g_strescape (const gchar *source);
+ * Luckily this function wasn't used much, using NULL as second parameter
+ * provides mostly identical semantics.
+ */
+gchar* g_strescape (const gchar *source,
+ const gchar *exceptions) G_GNUC_MALLOC;
+
+gpointer g_memdup (gconstpointer mem,
+ guint byte_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(2);
+
+/* NULL terminated string arrays.
+ * g_strsplit(), g_strsplit_set() split up string into max_tokens tokens
+ * at delim and return a newly allocated string array.
+ * g_strjoinv() concatenates all of str_array's strings, sliding in an
+ * optional separator, the returned string is newly allocated.
+ * g_strfreev() frees the array itself and all of its strings.
+ * g_strdupv() copies a NULL-terminated array of strings
+ * g_strv_length() returns the length of a NULL-terminated array of strings
+ */
+gchar** g_strsplit (const gchar *string,
+ const gchar *delimiter,
+ gint max_tokens) G_GNUC_MALLOC;
+gchar ** g_strsplit_set (const gchar *string,
+ const gchar *delimiters,
+ gint max_tokens) G_GNUC_MALLOC;
+gchar* g_strjoinv (const gchar *separator,
+ gchar **str_array) G_GNUC_MALLOC;
+void g_strfreev (gchar **str_array);
+gchar** g_strdupv (gchar **str_array) G_GNUC_MALLOC;
+guint g_strv_length (gchar **str_array);
+
+gchar* g_stpcpy (gchar *dest,
+ const char *src);
+
+G_CONST_RETURN gchar *g_strip_context (const gchar *msgid,
+ const gchar *msgval) G_GNUC_FORMAT(1);
+
+G_CONST_RETURN gchar *g_dgettext (const gchar *domain,
+ const gchar *msgid) G_GNUC_FORMAT(2);
+
+G_CONST_RETURN gchar *g_dngettext (const gchar *domain,
+ const gchar *msgid,
+ const gchar *msgid_plural,
+ gulong n) G_GNUC_FORMAT(3);
+G_CONST_RETURN gchar *g_dpgettext (const gchar *domain,
+ const gchar *msgctxtid,
+ gsize msgidoffset) G_GNUC_FORMAT(2);
+G_CONST_RETURN gchar *g_dpgettext2 (const gchar *domain,
+ const gchar *context,
+ const gchar *msgid) G_GNUC_FORMAT(3);
+
+G_END_DECLS
+
+#endif /* __G_STRFUNCS_H__ */
diff --git a/support/glib/gstring.c b/support/glib/gstring.c
new file mode 100644
index 00000000..9a7bb6a9
--- /dev/null
+++ b/support/glib/gstring.c
@@ -0,0 +1,1488 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+/*
+ * MT safe
+ */
+
+#include "config.h"
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "glib.h"
+#include "gprintf.h"
+
+#include "galias.h"
+
+#if NOT_NEEDED_FOR_NAVIT
+struct _GStringChunk
+{
+ GHashTable *const_table;
+ GSList *storage_list;
+ gsize storage_next;
+ gsize this_size;
+ gsize default_size;
+};
+#endif /* NOT_NEEDED_FOR_NAVIT */
+
+/* Hash Functions.
+ */
+
+/**
+ * g_str_equal:
+ * @v1: a key
+ * @v2: a key to compare with @v1
+ *
+ * Compares two strings for byte-by-byte equality and returns %TRUE
+ * if they are equal. It can be passed to g_hash_table_new() as the
+ * @key_equal_func parameter, when using strings as keys in a #GHashTable.
+ *
+ * Returns: %TRUE if the two keys match
+ */
+gboolean
+g_str_equal (gconstpointer v1,
+ gconstpointer v2)
+{
+ const gchar *string1 = v1;
+ const gchar *string2 = v2;
+
+ return strcmp (string1, string2) == 0;
+}
+
+/**
+ * g_str_hash:
+ * @v: a string key
+ *
+ * Converts a string to a hash value.
+ * It can be passed to g_hash_table_new() as the @hash_func
+ * parameter, when using strings as keys in a #GHashTable.
+ *
+ * Returns: a hash value corresponding to the key
+ */
+guint
+g_str_hash (gconstpointer v)
+{
+ /* 31 bit hash function */
+ const signed char *p = v;
+ guint32 h = *p;
+
+ if (h)
+ for (p += 1; *p != '\0'; p++)
+ h = (h << 5) - h + *p;
+
+ return h;
+}
+
+#if NOT_NEEDED_FOR_NAVIT
+#define MY_MAXSIZE ((gsize)-1)
+
+static inline gsize
+nearest_power (gsize base, gsize num)
+{
+ if (num > MY_MAXSIZE / 2)
+ {
+ return MY_MAXSIZE;
+ }
+ else
+ {
+ gsize n = base;
+
+ while (n < num)
+ n <<= 1;
+
+ return n;
+ }
+}
+
+/* String Chunks.
+ */
+
+/**
+ * g_string_chunk_new:
+ * @size: the default size of the blocks of memory which are
+ * allocated to store the strings. If a particular string
+ * is larger than this default size, a larger block of
+ * memory will be allocated for it.
+ *
+ * Creates a new #GStringChunk.
+ *
+ * Returns: a new #GStringChunk
+ */
+GStringChunk*
+g_string_chunk_new (gsize size)
+{
+ GStringChunk *new_chunk = g_new (GStringChunk, 1);
+ gsize actual_size = 1;
+
+ actual_size = nearest_power (1, size);
+
+ new_chunk->const_table = NULL;
+ new_chunk->storage_list = NULL;
+ new_chunk->storage_next = actual_size;
+ new_chunk->default_size = actual_size;
+ new_chunk->this_size = actual_size;
+
+ return new_chunk;
+}
+
+/**
+ * g_string_chunk_free:
+ * @chunk: a #GStringChunk
+ *
+ * Frees all memory allocated by the #GStringChunk.
+ * After calling g_string_chunk_free() it is not safe to
+ * access any of the strings which were contained within it.
+ */
+void
+g_string_chunk_free (GStringChunk *chunk)
+{
+ GSList *tmp_list;
+
+ g_return_if_fail (chunk != NULL);
+
+ if (chunk->storage_list)
+ {
+ for (tmp_list = chunk->storage_list; tmp_list; tmp_list = tmp_list->next)
+ g_free (tmp_list->data);
+
+ g_slist_free (chunk->storage_list);
+ }
+
+ if (chunk->const_table)
+ g_hash_table_destroy (chunk->const_table);
+
+ g_free (chunk);
+}
+
+/**
+ * g_string_chunk_clear:
+ * @chunk: a #GStringChunk
+ *
+ * Frees all strings contained within the #GStringChunk.
+ * After calling g_string_chunk_clear() it is not safe to
+ * access any of the strings which were contained within it.
+ *
+ * Since: 2.14
+ */
+void
+g_string_chunk_clear (GStringChunk *chunk)
+{
+ GSList *tmp_list;
+
+ g_return_if_fail (chunk != NULL);
+
+ if (chunk->storage_list)
+ {
+ for (tmp_list = chunk->storage_list; tmp_list; tmp_list = tmp_list->next)
+ g_free (tmp_list->data);
+
+ g_slist_free (chunk->storage_list);
+
+ chunk->storage_list = NULL;
+ chunk->storage_next = chunk->default_size;
+ chunk->this_size = chunk->default_size;
+ }
+
+ if (chunk->const_table)
+ g_hash_table_remove_all (chunk->const_table);
+}
+
+/**
+ * g_string_chunk_insert:
+ * @chunk: a #GStringChunk
+ * @string: the string to add
+ *
+ * Adds a copy of @string to the #GStringChunk.
+ * It returns a pointer to the new copy of the string
+ * in the #GStringChunk. The characters in the string
+ * can be changed, if necessary, though you should not
+ * change anything after the end of the string.
+ *
+ * Unlike g_string_chunk_insert_const(), this function
+ * does not check for duplicates. Also strings added
+ * with g_string_chunk_insert() will not be searched
+ * by g_string_chunk_insert_const() when looking for
+ * duplicates.
+ *
+ * Returns: a pointer to the copy of @string within
+ * the #GStringChunk
+ */
+gchar*
+g_string_chunk_insert (GStringChunk *chunk,
+ const gchar *string)
+{
+ g_return_val_if_fail (chunk != NULL, NULL);
+
+ return g_string_chunk_insert_len (chunk, string, -1);
+}
+
+/**
+ * g_string_chunk_insert_const:
+ * @chunk: a #GStringChunk
+ * @string: the string to add
+ *
+ * Adds a copy of @string to the #GStringChunk, unless the same
+ * string has already been added to the #GStringChunk with
+ * g_string_chunk_insert_const().
+ *
+ * This function is useful if you need to copy a large number
+ * of strings but do not want to waste space storing duplicates.
+ * But you must remember that there may be several pointers to
+ * the same string, and so any changes made to the strings
+ * should be done very carefully.
+ *
+ * Note that g_string_chunk_insert_const() will not return a
+ * pointer to a string added with g_string_chunk_insert(), even
+ * if they do match.
+ *
+ * Returns: a pointer to the new or existing copy of @string
+ * within the #GStringChunk
+ */
+gchar*
+g_string_chunk_insert_const (GStringChunk *chunk,
+ const gchar *string)
+{
+ char* lookup;
+
+ g_return_val_if_fail (chunk != NULL, NULL);
+
+ if (!chunk->const_table)
+ chunk->const_table = g_hash_table_new (g_str_hash, g_str_equal);
+
+ lookup = (char*) g_hash_table_lookup (chunk->const_table, (gchar *)string);
+
+ if (!lookup)
+ {
+ lookup = g_string_chunk_insert (chunk, string);
+ g_hash_table_insert (chunk->const_table, lookup, lookup);
+ }
+
+ return lookup;
+}
+
+/**
+ * g_string_chunk_insert_len:
+ * @chunk: a #GStringChunk
+ * @string: bytes to insert
+ * @len: number of bytes of @string to insert, or -1 to insert a
+ * nul-terminated string
+ *
+ * Adds a copy of the first @len bytes of @string to the #GStringChunk.
+ * The copy is nul-terminated.
+ *
+ * Since this function does not stop at nul bytes, it is the caller's
+ * responsibility to ensure that @string has at least @len addressable
+ * bytes.
+ *
+ * The characters in the returned string can be changed, if necessary,
+ * though you should not change anything after the end of the string.
+ *
+ * Return value: a pointer to the copy of @string within the #GStringChunk
+ *
+ * Since: 2.4
+ **/
+gchar*
+g_string_chunk_insert_len (GStringChunk *chunk,
+ const gchar *string,
+ gssize len)
+{
+ gssize size;
+ gchar* pos;
+
+ g_return_val_if_fail (chunk != NULL, NULL);
+
+ if (len < 0)
+ size = strlen (string);
+ else
+ size = len;
+
+ if ((chunk->storage_next + size + 1) > chunk->this_size)
+ {
+ gsize new_size = nearest_power (chunk->default_size, size + 1);
+
+ chunk->storage_list = g_slist_prepend (chunk->storage_list,
+ g_new (gchar, new_size));
+
+ chunk->this_size = new_size;
+ chunk->storage_next = 0;
+ }
+
+ pos = ((gchar *) chunk->storage_list->data) + chunk->storage_next;
+
+ *(pos + size) = '\0';
+
+ strncpy (pos, string, size);
+ if (len > 0)
+ size = strlen (pos);
+
+ chunk->storage_next += size + 1;
+
+ return pos;
+}
+
+/* Strings.
+ */
+static void
+g_string_maybe_expand (GString* string,
+ gsize len)
+{
+ if (string->len + len >= string->allocated_len)
+ {
+ string->allocated_len = nearest_power (1, string->len + len + 1);
+ string->str = g_realloc (string->str, string->allocated_len);
+ }
+}
+
+/**
+ * g_string_sized_new:
+ * @dfl_size: the default size of the space allocated to
+ * hold the string
+ *
+ * Creates a new #GString, with enough space for @dfl_size
+ * bytes. This is useful if you are going to add a lot of
+ * text to the string and don't want it to be reallocated
+ * too often.
+ *
+ * Returns: the new #GString
+ */
+GString*
+g_string_sized_new (gsize dfl_size)
+{
+ GString *string = g_slice_new (GString);
+
+ string->allocated_len = 0;
+ string->len = 0;
+ string->str = NULL;
+
+ g_string_maybe_expand (string, MAX (dfl_size, 2));
+ string->str[0] = 0;
+
+ return string;
+}
+
+/**
+ * g_string_new:
+ * @init: the initial text to copy into the string
+ *
+ * Creates a new #GString, initialized with the given string.
+ *
+ * Returns: the new #GString
+ */
+GString*
+g_string_new (const gchar *init)
+{
+ GString *string;
+
+ if (init == NULL || *init == '\0')
+ string = g_string_sized_new (2);
+ else
+ {
+ gint len;
+
+ len = strlen (init);
+ string = g_string_sized_new (len + 2);
+
+ g_string_append_len (string, init, len);
+ }
+
+ return string;
+}
+
+/**
+ * g_string_new_len:
+ * @init: initial contents of the string
+ * @len: length of @init to use
+ *
+ * Creates a new #GString with @len bytes of the @init buffer.
+ * Because a length is provided, @init need not be nul-terminated,
+ * and can contain embedded nul bytes.
+ *
+ * Since this function does not stop at nul bytes, it is the caller's
+ * responsibility to ensure that @init has at least @len addressable
+ * bytes.
+ *
+ * Returns: a new #GString
+ */
+GString*
+g_string_new_len (const gchar *init,
+ gssize len)
+{
+ GString *string;
+
+ if (len < 0)
+ return g_string_new (init);
+ else
+ {
+ string = g_string_sized_new (len);
+
+ if (init)
+ g_string_append_len (string, init, len);
+
+ return string;
+ }
+}
+
+/**
+ * g_string_free:
+ * @string: a #GString
+ * @free_segment: if %TRUE the actual character data is freed as well
+ *
+ * Frees the memory allocated for the #GString.
+ * If @free_segment is %TRUE it also frees the character data.
+ *
+ * Returns: the character data of @string
+ * (i.e. %NULL if @free_segment is %TRUE)
+ */
+gchar*
+g_string_free (GString *string,
+ gboolean free_segment)
+{
+ gchar *segment;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ if (free_segment)
+ {
+ g_free (string->str);
+ segment = NULL;
+ }
+ else
+ segment = string->str;
+
+ g_slice_free (GString, string);
+
+ return segment;
+}
+
+/**
+ * g_string_equal:
+ * @v: a #GString
+ * @v2: another #GString
+ *
+ * Compares two strings for equality, returning %TRUE if they are equal.
+ * For use with #GHashTable.
+ *
+ * Returns: %TRUE if they strings are the same length and contain the
+ * same bytes
+ */
+gboolean
+g_string_equal (const GString *v,
+ const GString *v2)
+{
+ gchar *p, *q;
+ GString *string1 = (GString *) v;
+ GString *string2 = (GString *) v2;
+ gsize i = string1->len;
+
+ if (i != string2->len)
+ return FALSE;
+
+ p = string1->str;
+ q = string2->str;
+ while (i)
+ {
+ if (*p != *q)
+ return FALSE;
+ p++;
+ q++;
+ i--;
+ }
+ return TRUE;
+}
+
+/**
+ * g_string_hash:
+ * @str: a string to hash
+ *
+ * Creates a hash code for @str; for use with #GHashTable.
+ *
+ * Returns: hash code for @str
+ */
+/* 31 bit hash function */
+guint
+g_string_hash (const GString *str)
+{
+ const gchar *p = str->str;
+ gsize n = str->len;
+ guint h = 0;
+
+ while (n--)
+ {
+ h = (h << 5) - h + *p;
+ p++;
+ }
+
+ return h;
+}
+
+/**
+ * g_string_assign:
+ * @string: the destination #GString. Its current contents
+ * are destroyed.
+ * @rval: the string to copy into @string
+ *
+ * Copies the bytes from a string into a #GString,
+ * destroying any previous contents. It is rather like
+ * the standard strcpy() function, except that you do not
+ * have to worry about having enough space to copy the string.
+ *
+ * Returns: @string
+ */
+GString*
+g_string_assign (GString *string,
+ const gchar *rval)
+{
+ g_return_val_if_fail (string != NULL, NULL);
+ g_return_val_if_fail (rval != NULL, string);
+
+ /* Make sure assigning to itself doesn't corrupt the string. */
+ if (string->str != rval)
+ {
+ /* Assigning from substring should be ok since g_string_truncate
+ does not realloc. */
+ g_string_truncate (string, 0);
+ g_string_append (string, rval);
+ }
+
+ return string;
+}
+
+/**
+ * g_string_truncate:
+ * @string: a #GString
+ * @len: the new size of @string
+ *
+ * Cuts off the end of the GString, leaving the first @len bytes.
+ *
+ * Returns: @string
+ */
+GString*
+g_string_truncate (GString *string,
+ gsize len)
+{
+ g_return_val_if_fail (string != NULL, NULL);
+
+ string->len = MIN (len, string->len);
+ string->str[string->len] = 0;
+
+ return string;
+}
+
+/**
+ * g_string_set_size:
+ * @string: a #GString
+ * @len: the new length
+ *
+ * Sets the length of a #GString. If the length is less than
+ * the current length, the string will be truncated. If the
+ * length is greater than the current length, the contents
+ * of the newly added area are undefined. (However, as
+ * always, string->str[string->len] will be a nul byte.)
+ *
+ * Return value: @string
+ **/
+GString*
+g_string_set_size (GString *string,
+ gsize len)
+{
+ g_return_val_if_fail (string != NULL, NULL);
+
+ if (len >= string->allocated_len)
+ g_string_maybe_expand (string, len - string->len);
+
+ string->len = len;
+ string->str[len] = 0;
+
+ return string;
+}
+
+/**
+ * g_string_insert_len:
+ * @string: a #GString
+ * @pos: position in @string where insertion should
+ * happen, or -1 for at the end
+ * @val: bytes to insert
+ * @len: number of bytes of @val to insert
+ *
+ * Inserts @len bytes of @val into @string at @pos.
+ * Because @len is provided, @val may contain embedded
+ * nuls and need not be nul-terminated. If @pos is -1,
+ * bytes are inserted at the end of the string.
+ *
+ * Since this function does not stop at nul bytes, it is
+ * the caller's responsibility to ensure that @val has at
+ * least @len addressable bytes.
+ *
+ * Returns: @string
+ */
+GString*
+g_string_insert_len (GString *string,
+ gssize pos,
+ const gchar *val,
+ gssize len)
+{
+ g_return_val_if_fail (string != NULL, NULL);
+ g_return_val_if_fail (val != NULL, string);
+
+ if (len < 0)
+ len = strlen (val);
+
+ if (pos < 0)
+ pos = string->len;
+ else
+ g_return_val_if_fail (pos <= string->len, string);
+
+ /* Check whether val represents a substring of string. This test
+ probably violates chapter and verse of the C standards, since
+ ">=" and "<=" are only valid when val really is a substring.
+ In practice, it will work on modern archs. */
+ if (val >= string->str && val <= string->str + string->len)
+ {
+ gsize offset = val - string->str;
+ gsize precount = 0;
+
+ g_string_maybe_expand (string, len);
+ val = string->str + offset;
+ /* At this point, val is valid again. */
+
+ /* Open up space where we are going to insert. */
+ if (pos < string->len)
+ g_memmove (string->str + pos + len, string->str + pos, string->len - pos);
+
+ /* Move the source part before the gap, if any. */
+ if (offset < pos)
+ {
+ precount = MIN (len, pos - offset);
+ memcpy (string->str + pos, val, precount);
+ }
+
+ /* Move the source part after the gap, if any. */
+ if (len > precount)
+ memcpy (string->str + pos + precount,
+ val + /* Already moved: */ precount + /* Space opened up: */ len,
+ len - precount);
+ }
+ else
+ {
+ g_string_maybe_expand (string, len);
+
+ /* If we aren't appending at the end, move a hunk
+ * of the old string to the end, opening up space
+ */
+ if (pos < string->len)
+ g_memmove (string->str + pos + len, string->str + pos, string->len - pos);
+
+ /* insert the new string */
+ if (len == 1)
+ string->str[pos] = *val;
+ else
+ memcpy (string->str + pos, val, len);
+ }
+
+ string->len += len;
+
+ string->str[string->len] = 0;
+
+ return string;
+}
+
+#define SUB_DELIM_CHARS "!$&'()*+,;="
+
+static gboolean
+is_valid (char c, const char *reserved_chars_allowed)
+{
+ if (g_ascii_isalnum (c) ||
+ c == '-' ||
+ c == '.' ||
+ c == '_' ||
+ c == '~')
+ return TRUE;
+
+ if (reserved_chars_allowed &&
+ strchr (reserved_chars_allowed, c) != NULL)
+ return TRUE;
+
+ return FALSE;
+}
+
+static gboolean
+gunichar_ok (gunichar c)
+{
+ return
+ (c != (gunichar) -2) &&
+ (c != (gunichar) -1);
+}
+
+/**
+ * g_string_append_uri_escaped:
+ * @string: a #GString
+ * @unescaped: a string
+ * @reserved_chars_allowed: a string of reserved characters allowed to be used
+ * @allow_utf8: set %TRUE if the escaped string may include UTF8 characters
+ *
+ * Appends @unescaped to @string, escaped any characters that
+ * are reserved in URIs using URI-style escape sequences.
+ *
+ * Returns: @string
+ *
+ * Since: 2.16
+ **/
+GString *
+g_string_append_uri_escaped (GString *string,
+ const char *unescaped,
+ const char *reserved_chars_allowed,
+ gboolean allow_utf8)
+{
+ unsigned char c;
+ const char *end;
+ static const gchar hex[16] = "0123456789ABCDEF";
+
+ g_return_val_if_fail (string != NULL, NULL);
+ g_return_val_if_fail (unescaped != NULL, NULL);
+
+ end = unescaped + strlen (unescaped);
+
+ while ((c = *unescaped) != 0)
+ {
+ if (c >= 0x80 && allow_utf8 &&
+ gunichar_ok (g_utf8_get_char_validated (unescaped, end - unescaped)))
+ {
+ int len = g_utf8_skip [c];
+ g_string_append_len (string, unescaped, len);
+ unescaped += len;
+ }
+ else if (is_valid (c, reserved_chars_allowed))
+ {
+ g_string_append_c (string, c);
+ unescaped++;
+ }
+ else
+ {
+ g_string_append_c (string, '%');
+ g_string_append_c (string, hex[((guchar)c) >> 4]);
+ g_string_append_c (string, hex[((guchar)c) & 0xf]);
+ unescaped++;
+ }
+ }
+
+ return string;
+}
+
+/**
+ * g_string_append:
+ * @string: a #GString
+ * @val: the string to append onto the end of @string
+ *
+ * Adds a string onto the end of a #GString, expanding
+ * it if necessary.
+ *
+ * Returns: @string
+ */
+GString*
+g_string_append (GString *string,
+ const gchar *val)
+{
+ g_return_val_if_fail (string != NULL, NULL);
+ g_return_val_if_fail (val != NULL, string);
+
+ return g_string_insert_len (string, -1, val, -1);
+}
+
+/**
+ * g_string_append_len:
+ * @string: a #GString
+ * @val: bytes to append
+ * @len: number of bytes of @val to use
+ *
+ * Appends @len bytes of @val to @string. Because @len is
+ * provided, @val may contain embedded nuls and need not
+ * be nul-terminated.
+ *
+ * Since this function does not stop at nul bytes, it is
+ * the caller's responsibility to ensure that @val has at
+ * least @len addressable bytes.
+ *
+ * Returns: @string
+ */
+GString*
+g_string_append_len (GString *string,
+ const gchar *val,
+ gssize len)
+{
+ g_return_val_if_fail (string != NULL, NULL);
+ g_return_val_if_fail (val != NULL, string);
+
+ return g_string_insert_len (string, -1, val, len);
+}
+
+/**
+ * g_string_append_c:
+ * @string: a #GString
+ * @c: the byte to append onto the end of @string
+ *
+ * Adds a byte onto the end of a #GString, expanding
+ * it if necessary.
+ *
+ * Returns: @string
+ */
+#undef g_string_append_c
+GString*
+g_string_append_c (GString *string,
+ gchar c)
+{
+ g_return_val_if_fail (string != NULL, NULL);
+
+ return g_string_insert_c (string, -1, c);
+}
+
+/**
+ * g_string_append_unichar:
+ * @string: a #GString
+ * @wc: a Unicode character
+ *
+ * Converts a Unicode character into UTF-8, and appends it
+ * to the string.
+ *
+ * Return value: @string
+ **/
+GString*
+g_string_append_unichar (GString *string,
+ gunichar wc)
+{
+ g_return_val_if_fail (string != NULL, NULL);
+
+ return g_string_insert_unichar (string, -1, wc);
+}
+
+/**
+ * g_string_prepend:
+ * @string: a #GString
+ * @val: the string to prepend on the start of @string
+ *
+ * Adds a string on to the start of a #GString,
+ * expanding it if necessary.
+ *
+ * Returns: @string
+ */
+GString*
+g_string_prepend (GString *string,
+ const gchar *val)
+{
+ g_return_val_if_fail (string != NULL, NULL);
+ g_return_val_if_fail (val != NULL, string);
+
+ return g_string_insert_len (string, 0, val, -1);
+}
+
+/**
+ * g_string_prepend_len:
+ * @string: a #GString
+ * @val: bytes to prepend
+ * @len: number of bytes in @val to prepend
+ *
+ * Prepends @len bytes of @val to @string.
+ * Because @len is provided, @val may contain
+ * embedded nuls and need not be nul-terminated.
+ *
+ * Since this function does not stop at nul bytes,
+ * it is the caller's responsibility to ensure that
+ * @val has at least @len addressable bytes.
+ *
+ * Returns: @string
+ */
+GString*
+g_string_prepend_len (GString *string,
+ const gchar *val,
+ gssize len)
+{
+ g_return_val_if_fail (string != NULL, NULL);
+ g_return_val_if_fail (val != NULL, string);
+
+ return g_string_insert_len (string, 0, val, len);
+}
+
+/**
+ * g_string_prepend_c:
+ * @string: a #GString
+ * @c: the byte to prepend on the start of the #GString
+ *
+ * Adds a byte onto the start of a #GString,
+ * expanding it if necessary.
+ *
+ * Returns: @string
+ */
+GString*
+g_string_prepend_c (GString *string,
+ gchar c)
+{
+ g_return_val_if_fail (string != NULL, NULL);
+
+ return g_string_insert_c (string, 0, c);
+}
+
+/**
+ * g_string_prepend_unichar:
+ * @string: a #GString
+ * @wc: a Unicode character
+ *
+ * Converts a Unicode character into UTF-8, and prepends it
+ * to the string.
+ *
+ * Return value: @string
+ **/
+GString*
+g_string_prepend_unichar (GString *string,
+ gunichar wc)
+{
+ g_return_val_if_fail (string != NULL, NULL);
+
+ return g_string_insert_unichar (string, 0, wc);
+}
+
+/**
+ * g_string_insert:
+ * @string: a #GString
+ * @pos: the position to insert the copy of the string
+ * @val: the string to insert
+ *
+ * Inserts a copy of a string into a #GString,
+ * expanding it if necessary.
+ *
+ * Returns: @string
+ */
+GString*
+g_string_insert (GString *string,
+ gssize pos,
+ const gchar *val)
+{
+ g_return_val_if_fail (string != NULL, NULL);
+ g_return_val_if_fail (val != NULL, string);
+ if (pos >= 0)
+ g_return_val_if_fail (pos <= string->len, string);
+
+ return g_string_insert_len (string, pos, val, -1);
+}
+
+/**
+ * g_string_insert_c:
+ * @string: a #GString
+ * @pos: the position to insert the byte
+ * @c: the byte to insert
+ *
+ * Inserts a byte into a #GString, expanding it if necessary.
+ *
+ * Returns: @string
+ */
+GString*
+g_string_insert_c (GString *string,
+ gssize pos,
+ gchar c)
+{
+ g_return_val_if_fail (string != NULL, NULL);
+
+ g_string_maybe_expand (string, 1);
+
+ if (pos < 0)
+ pos = string->len;
+ else
+ g_return_val_if_fail (pos <= string->len, string);
+
+ /* If not just an append, move the old stuff */
+ if (pos < string->len)
+ g_memmove (string->str + pos + 1, string->str + pos, string->len - pos);
+
+ string->str[pos] = c;
+
+ string->len += 1;
+
+ string->str[string->len] = 0;
+
+ return string;
+}
+
+/**
+ * g_string_insert_unichar:
+ * @string: a #GString
+ * @pos: the position at which to insert character, or -1 to
+ * append at the end of the string
+ * @wc: a Unicode character
+ *
+ * Converts a Unicode character into UTF-8, and insert it
+ * into the string at the given position.
+ *
+ * Return value: @string
+ **/
+GString*
+g_string_insert_unichar (GString *string,
+ gssize pos,
+ gunichar wc)
+{
+ gint charlen, first, i;
+ gchar *dest;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ /* Code copied from g_unichar_to_utf() */
+ if (wc < 0x80)
+ {
+ first = 0;
+ charlen = 1;
+ }
+ else if (wc < 0x800)
+ {
+ first = 0xc0;
+ charlen = 2;
+ }
+ else if (wc < 0x10000)
+ {
+ first = 0xe0;
+ charlen = 3;
+ }
+ else if (wc < 0x200000)
+ {
+ first = 0xf0;
+ charlen = 4;
+ }
+ else if (wc < 0x4000000)
+ {
+ first = 0xf8;
+ charlen = 5;
+ }
+ else
+ {
+ first = 0xfc;
+ charlen = 6;
+ }
+ /* End of copied code */
+
+ g_string_maybe_expand (string, charlen);
+
+ if (pos < 0)
+ pos = string->len;
+ else
+ g_return_val_if_fail (pos <= string->len, string);
+
+ /* If not just an append, move the old stuff */
+ if (pos < string->len)
+ g_memmove (string->str + pos + charlen, string->str + pos, string->len - pos);
+
+ dest = string->str + pos;
+ /* Code copied from g_unichar_to_utf() */
+ for (i = charlen - 1; i > 0; --i)
+ {
+ dest[i] = (wc & 0x3f) | 0x80;
+ wc >>= 6;
+ }
+ dest[0] = wc | first;
+ /* End of copied code */
+
+ string->len += charlen;
+
+ string->str[string->len] = 0;
+
+ return string;
+}
+
+/**
+ * g_string_overwrite:
+ * @string: a #GString
+ * @pos: the position at which to start overwriting
+ * @val: the string that will overwrite the @string starting at @pos
+ *
+ * Overwrites part of a string, lengthening it if necessary.
+ *
+ * Return value: @string
+ *
+ * Since: 2.14
+ **/
+GString *
+g_string_overwrite (GString *string,
+ gsize pos,
+ const gchar *val)
+{
+ g_return_val_if_fail (val != NULL, string);
+ return g_string_overwrite_len (string, pos, val, strlen (val));
+}
+
+/**
+ * g_string_overwrite_len:
+ * @string: a #GString
+ * @pos: the position at which to start overwriting
+ * @val: the string that will overwrite the @string starting at @pos
+ * @len: the number of bytes to write from @val
+ *
+ * Overwrites part of a string, lengthening it if necessary.
+ * This function will work with embedded nuls.
+ *
+ * Return value: @string
+ *
+ * Since: 2.14
+ **/
+GString *
+g_string_overwrite_len (GString *string,
+ gsize pos,
+ const gchar *val,
+ gssize len)
+{
+ gsize end;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ if (!len)
+ return string;
+
+ g_return_val_if_fail (val != NULL, string);
+ g_return_val_if_fail (pos <= string->len, string);
+
+ if (len < 0)
+ len = strlen (val);
+
+ end = pos + len;
+
+ if (end > string->len)
+ g_string_maybe_expand (string, end - string->len);
+
+ memcpy (string->str + pos, val, len);
+
+ if (end > string->len)
+ {
+ string->str[end] = '\0';
+ string->len = end;
+ }
+
+ return string;
+}
+
+/**
+ * g_string_erase:
+ * @string: a #GString
+ * @pos: the position of the content to remove
+ * @len: the number of bytes to remove, or -1 to remove all
+ * following bytes
+ *
+ * Removes @len bytes from a #GString, starting at position @pos.
+ * The rest of the #GString is shifted down to fill the gap.
+ *
+ * Returns: @string
+ */
+GString*
+g_string_erase (GString *string,
+ gssize pos,
+ gssize len)
+{
+ g_return_val_if_fail (string != NULL, NULL);
+ g_return_val_if_fail (pos >= 0, string);
+ g_return_val_if_fail (pos <= string->len, string);
+
+ if (len < 0)
+ len = string->len - pos;
+ else
+ {
+ g_return_val_if_fail (pos + len <= string->len, string);
+
+ if (pos + len < string->len)
+ g_memmove (string->str + pos, string->str + pos + len, string->len - (pos + len));
+ }
+
+ string->len -= len;
+
+ string->str[string->len] = 0;
+
+ return string;
+}
+
+/**
+ * g_string_ascii_down:
+ * @string: a GString
+ *
+ * Converts all upper case ASCII letters to lower case ASCII letters.
+ *
+ * Return value: passed-in @string pointer, with all the upper case
+ * characters converted to lower case in place, with
+ * semantics that exactly match g_ascii_tolower().
+ **/
+GString*
+g_string_ascii_down (GString *string)
+{
+ gchar *s;
+ gint n;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ n = string->len;
+ s = string->str;
+
+ while (n)
+ {
+ *s = g_ascii_tolower (*s);
+ s++;
+ n--;
+ }
+
+ return string;
+}
+
+/**
+ * g_string_ascii_up:
+ * @string: a GString
+ *
+ * Converts all lower case ASCII letters to upper case ASCII letters.
+ *
+ * Return value: passed-in @string pointer, with all the lower case
+ * characters converted to upper case in place, with
+ * semantics that exactly match g_ascii_toupper().
+ **/
+GString*
+g_string_ascii_up (GString *string)
+{
+ gchar *s;
+ gint n;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ n = string->len;
+ s = string->str;
+
+ while (n)
+ {
+ *s = g_ascii_toupper (*s);
+ s++;
+ n--;
+ }
+
+ return string;
+}
+
+/**
+ * g_string_down:
+ * @string: a #GString
+ *
+ * Converts a #GString to lowercase.
+ *
+ * Returns: the #GString.
+ *
+ * Deprecated:2.2: This function uses the locale-specific
+ * tolower() function, which is almost never the right thing.
+ * Use g_string_ascii_down() or g_utf8_strdown() instead.
+ */
+GString*
+g_string_down (GString *string)
+{
+ guchar *s;
+ glong n;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ n = string->len;
+ s = (guchar *) string->str;
+
+ while (n)
+ {
+ if (isupper (*s))
+ *s = tolower (*s);
+ s++;
+ n--;
+ }
+
+ return string;
+}
+
+/**
+ * g_string_up:
+ * @string: a #GString
+ *
+ * Converts a #GString to uppercase.
+ *
+ * Return value: @string
+ *
+ * Deprecated:2.2: This function uses the locale-specific
+ * toupper() function, which is almost never the right thing.
+ * Use g_string_ascii_up() or g_utf8_strup() instead.
+ **/
+GString*
+g_string_up (GString *string)
+{
+ guchar *s;
+ glong n;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ n = string->len;
+ s = (guchar *) string->str;
+
+ while (n)
+ {
+ if (islower (*s))
+ *s = toupper (*s);
+ s++;
+ n--;
+ }
+
+ return string;
+}
+
+/**
+ * g_string_append_vprintf:
+ * @string: a #GString
+ * @format: the string format. See the printf() documentation
+ * @args: the list of arguments to insert in the output
+ *
+ * Appends a formatted string onto the end of a #GString.
+ * This function is similar to g_string_append_printf()
+ * except that the arguments to the format string are passed
+ * as a va_list.
+ *
+ * Since: 2.14
+ */
+void
+g_string_append_vprintf (GString *string,
+ const gchar *format,
+ va_list args)
+{
+ gchar *buf;
+ gint len;
+
+ g_return_if_fail (string != NULL);
+ g_return_if_fail (format != NULL);
+
+ len = g_vasprintf (&buf, format, args);
+
+ if (len >= 0)
+ {
+ g_string_maybe_expand (string, len);
+ memcpy (string->str + string->len, buf, len + 1);
+ string->len += len;
+ g_free (buf);
+ }
+}
+
+/**
+ * g_string_vprintf:
+ * @string: a #GString
+ * @format: the string format. See the printf() documentation
+ * @args: the parameters to insert into the format string
+ *
+ * Writes a formatted string into a #GString.
+ * This function is similar to g_string_printf() except that
+ * the arguments to the format string are passed as a va_list.
+ *
+ * Since: 2.14
+ */
+void
+g_string_vprintf (GString *string,
+ const gchar *format,
+ va_list args)
+{
+ g_string_truncate (string, 0);
+ g_string_append_vprintf (string, format, args);
+}
+
+/**
+ * g_string_sprintf:
+ * @string: a #GString
+ * @format: the string format. See the sprintf() documentation
+ * @Varargs: the parameters to insert into the format string
+ *
+ * Writes a formatted string into a #GString.
+ * This is similar to the standard sprintf() function,
+ * except that the #GString buffer automatically expands
+ * to contain the results. The previous contents of the
+ * #GString are destroyed.
+ *
+ * Deprecated: This function has been renamed to g_string_printf().
+ */
+
+/**
+ * g_string_printf:
+ * @string: a #GString
+ * @format: the string format. See the printf() documentation
+ * @Varargs: the parameters to insert into the format string
+ *
+ * Writes a formatted string into a #GString.
+ * This is similar to the standard sprintf() function,
+ * except that the #GString buffer automatically expands
+ * to contain the results. The previous contents of the
+ * #GString are destroyed.
+ */
+void
+g_string_printf (GString *string,
+ const gchar *format,
+ ...)
+{
+ va_list args;
+
+ g_string_truncate (string, 0);
+
+ va_start (args, format);
+ g_string_append_vprintf (string, format, args);
+ va_end (args);
+}
+
+/**
+ * g_string_sprintfa:
+ * @string: a #GString
+ * @format: the string format. See the sprintf() documentation
+ * @Varargs: the parameters to insert into the format string
+ *
+ * Appends a formatted string onto the end of a #GString.
+ * This function is similar to g_string_sprintf() except that
+ * the text is appended to the #GString.
+ *
+ * Deprecated: This function has been renamed to g_string_append_printf()
+ */
+
+/**
+ * g_string_append_printf:
+ * @string: a #GString
+ * @format: the string format. See the printf() documentation
+ * @Varargs: the parameters to insert into the format string
+ *
+ * Appends a formatted string onto the end of a #GString.
+ * This function is similar to g_string_printf() except
+ * that the text is appended to the #GString.
+ */
+void
+g_string_append_printf (GString *string,
+ const gchar *format,
+ ...)
+{
+ va_list args;
+
+ va_start (args, format);
+ g_string_append_vprintf (string, format, args);
+ va_end (args);
+}
+
+#endif /* NOT_NEEDED_FOR_NAVIT */
+#define __G_STRING_C__
+#include "galiasdef.c"
diff --git a/support/glib/gthreadprivate.h b/support/glib/gthreadprivate.h
new file mode 100644
index 00000000..c9b5fa50
--- /dev/null
+++ b/support/glib/gthreadprivate.h
@@ -0,0 +1,68 @@
+/* GLIB - Library of useful routines for C programming
+ *
+ * gthreadprivate.h - GLib internal thread system related declarations.
+ *
+ * Copyright (C) 2003 Sebastian Wilhelmi
+ *
+ * The Gnome 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.
+ *
+ * The Gnome 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 the Gnome Library; see the file COPYING.LIB. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __G_THREADPRIVATE_H__
+#define __G_THREADPRIVATE_H__
+
+G_BEGIN_DECLS
+
+/* System thread identifier comparision and assignment */
+#if GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P
+# define g_system_thread_equal_simple(thread1, thread2) \
+ ((thread1).dummy_pointer == (thread2).dummy_pointer)
+# define g_system_thread_assign(dest, src) \
+ ((dest).dummy_pointer = (src).dummy_pointer)
+#else /* GLIB_SIZEOF_SYSTEM_THREAD != SIZEOF_VOID_P */
+# define g_system_thread_equal_simple(thread1, thread2) \
+ (memcmp (&(thread1), &(thread2), GLIB_SIZEOF_SYSTEM_THREAD) == 0)
+# define g_system_thread_assign(dest, src) \
+ (memcpy (&(dest), &(src), GLIB_SIZEOF_SYSTEM_THREAD))
+#endif /* GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P */
+
+#define g_system_thread_equal(thread1, thread2) \
+ (g_thread_functions_for_glib_use.thread_equal ? \
+ g_thread_functions_for_glib_use.thread_equal (&(thread1), &(thread2)) :\
+ g_system_thread_equal_simple((thread1), (thread2)))
+
+/* Is called from gthread/gthread-impl.c */
+void g_thread_init_glib (void);
+
+/* base initializers, may only use g_mutex_new(), g_cond_new() */
+G_GNUC_INTERNAL void _g_mem_thread_init_noprivate_nomessage (void);
+/* initializers that may also use g_private_new() */
+G_GNUC_INTERNAL void _g_slice_thread_init_nomessage (void);
+G_GNUC_INTERNAL void _g_messages_thread_init_nomessage (void);
+
+/* full fledged initializers */
+G_GNUC_INTERNAL void _g_convert_thread_init (void);
+G_GNUC_INTERNAL void _g_rand_thread_init (void);
+G_GNUC_INTERNAL void _g_main_thread_init (void);
+G_GNUC_INTERNAL void _g_atomic_thread_init (void);
+G_GNUC_INTERNAL void _g_utils_thread_init (void);
+
+#ifdef G_OS_WIN32
+G_GNUC_INTERNAL void _g_win32_thread_init (void);
+#endif /* G_OS_WIN32 */
+
+G_END_DECLS
+
+#endif /* __G_THREADPRIVATE_H__ */
diff --git a/support/glib/gtypes.h b/support/glib/gtypes.h
new file mode 100644
index 00000000..3ac98fd4
--- /dev/null
+++ b/support/glib/gtypes.h
@@ -0,0 +1,432 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#ifndef __G_TYPES_H__
+#define __G_TYPES_H__
+
+#include <glibconfig.h>
+
+G_BEGIN_DECLS
+
+/* Provide type definitions for commonly used types.
+ * These are useful because a "gint8" can be adjusted
+ * to be 1 byte (8 bits) on all platforms. Similarly and
+ * more importantly, "gint32" can be adjusted to be
+ * 4 bytes (32 bits) on all platforms.
+ */
+
+typedef char gchar;
+typedef short gshort;
+typedef long glong;
+typedef int gint;
+typedef gint gboolean;
+
+typedef unsigned char guchar;
+typedef unsigned short gushort;
+typedef unsigned long gulong;
+typedef unsigned int guint;
+
+typedef float gfloat;
+typedef double gdouble;
+
+/* Define min and max constants for the fixed size numerical types */
+#define G_MININT8 ((gint8) 0x80)
+#define G_MAXINT8 ((gint8) 0x7f)
+#define G_MAXUINT8 ((guint8) 0xff)
+
+#define G_MININT16 ((gint16) 0x8000)
+#define G_MAXINT16 ((gint16) 0x7fff)
+#define G_MAXUINT16 ((guint16) 0xffff)
+
+#define G_MININT32 ((gint32) 0x80000000)
+#define G_MAXINT32 ((gint32) 0x7fffffff)
+#define G_MAXUINT32 ((guint32) 0xffffffff)
+
+#define G_MININT64 ((gint64) G_GINT64_CONSTANT(0x8000000000000000))
+#define G_MAXINT64 G_GINT64_CONSTANT(0x7fffffffffffffff)
+#define G_MAXUINT64 G_GINT64_CONSTANT(0xffffffffffffffffU)
+
+typedef void* gpointer;
+typedef const void *gconstpointer;
+
+typedef gint (*GCompareFunc) (gconstpointer a,
+ gconstpointer b);
+typedef gint (*GCompareDataFunc) (gconstpointer a,
+ gconstpointer b,
+ gpointer user_data);
+typedef gboolean (*GEqualFunc) (gconstpointer a,
+ gconstpointer b);
+typedef void (*GDestroyNotify) (gpointer data);
+typedef void (*GFunc) (gpointer data,
+ gpointer user_data);
+typedef guint (*GHashFunc) (gconstpointer key);
+typedef void (*GHFunc) (gpointer key,
+ gpointer value,
+ gpointer user_data);
+typedef void (*GFreeFunc) (gpointer data);
+typedef const gchar * (*GTranslateFunc) (const gchar *str,
+ gpointer data);
+
+
+/* Define some mathematical constants that aren't available
+ * symbolically in some strict ISO C implementations.
+ *
+ * Note that the large number of digits used in these definitions
+ * doesn't imply that GLib or current computers in general would be
+ * able to handle floating point numbers with an accuracy like this.
+ * It's mostly an exercise in futility and future proofing. For
+ * extended precision floating point support, look somewhere else
+ * than GLib.
+ */
+#define G_E 2.7182818284590452353602874713526624977572470937000
+#define G_LN2 0.69314718055994530941723212145817656807550013436026
+#define G_LN10 2.3025850929940456840179914546843642076011014886288
+#define G_PI 3.1415926535897932384626433832795028841971693993751
+#define G_PI_2 1.5707963267948966192313216916397514420985846996876
+#define G_PI_4 0.78539816339744830961566084581987572104929234984378
+#define G_SQRT2 1.4142135623730950488016887242096980785696718753769
+
+/* Portable endian checks and conversions
+ *
+ * glibconfig.h defines G_BYTE_ORDER which expands to one of
+ * the below macros.
+ */
+#define G_LITTLE_ENDIAN 1234
+#define G_BIG_ENDIAN 4321
+#define G_PDP_ENDIAN 3412 /* unused, need specific PDP check */
+
+
+/* Basic bit swapping functions
+ */
+#define GUINT16_SWAP_LE_BE_CONSTANT(val) ((guint16) ( \
+ (guint16) ((guint16) (val) >> 8) | \
+ (guint16) ((guint16) (val) << 8)))
+
+#define GUINT32_SWAP_LE_BE_CONSTANT(val) ((guint32) ( \
+ (((guint32) (val) & (guint32) 0x000000ffU) << 24) | \
+ (((guint32) (val) & (guint32) 0x0000ff00U) << 8) | \
+ (((guint32) (val) & (guint32) 0x00ff0000U) >> 8) | \
+ (((guint32) (val) & (guint32) 0xff000000U) >> 24)))
+
+#define GUINT64_SWAP_LE_BE_CONSTANT(val) ((guint64) ( \
+ (((guint64) (val) & \
+ (guint64) G_GINT64_CONSTANT (0x00000000000000ffU)) << 56) | \
+ (((guint64) (val) & \
+ (guint64) G_GINT64_CONSTANT (0x000000000000ff00U)) << 40) | \
+ (((guint64) (val) & \
+ (guint64) G_GINT64_CONSTANT (0x0000000000ff0000U)) << 24) | \
+ (((guint64) (val) & \
+ (guint64) G_GINT64_CONSTANT (0x00000000ff000000U)) << 8) | \
+ (((guint64) (val) & \
+ (guint64) G_GINT64_CONSTANT (0x000000ff00000000U)) >> 8) | \
+ (((guint64) (val) & \
+ (guint64) G_GINT64_CONSTANT (0x0000ff0000000000U)) >> 24) | \
+ (((guint64) (val) & \
+ (guint64) G_GINT64_CONSTANT (0x00ff000000000000U)) >> 40) | \
+ (((guint64) (val) & \
+ (guint64) G_GINT64_CONSTANT (0xff00000000000000U)) >> 56)))
+
+/* Arch specific stuff for speed
+ */
+#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__)
+# if defined (__i386__)
+# define GUINT16_SWAP_LE_BE_IA32(val) \
+ (__extension__ \
+ ({ register guint16 __v, __x = ((guint16) (val)); \
+ if (__builtin_constant_p (__x)) \
+ __v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \
+ else \
+ __asm__ ("rorw $8, %w0" \
+ : "=r" (__v) \
+ : "0" (__x) \
+ : "cc"); \
+ __v; }))
+# if !defined (__i486__) && !defined (__i586__) \
+ && !defined (__pentium__) && !defined (__i686__) \
+ && !defined (__pentiumpro__) && !defined (__pentium4__)
+# define GUINT32_SWAP_LE_BE_IA32(val) \
+ (__extension__ \
+ ({ register guint32 __v, __x = ((guint32) (val)); \
+ if (__builtin_constant_p (__x)) \
+ __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \
+ else \
+ __asm__ ("rorw $8, %w0\n\t" \
+ "rorl $16, %0\n\t" \
+ "rorw $8, %w0" \
+ : "=r" (__v) \
+ : "0" (__x) \
+ : "cc"); \
+ __v; }))
+# else /* 486 and higher has bswap */
+# define GUINT32_SWAP_LE_BE_IA32(val) \
+ (__extension__ \
+ ({ register guint32 __v, __x = ((guint32) (val)); \
+ if (__builtin_constant_p (__x)) \
+ __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \
+ else \
+ __asm__ ("bswap %0" \
+ : "=r" (__v) \
+ : "0" (__x)); \
+ __v; }))
+# endif /* processor specific 32-bit stuff */
+# define GUINT64_SWAP_LE_BE_IA32(val) \
+ (__extension__ \
+ ({ union { guint64 __ll; \
+ guint32 __l[2]; } __w, __r; \
+ __w.__ll = ((guint64) (val)); \
+ if (__builtin_constant_p (__w.__ll)) \
+ __r.__ll = GUINT64_SWAP_LE_BE_CONSTANT (__w.__ll); \
+ else \
+ { \
+ __r.__l[0] = GUINT32_SWAP_LE_BE (__w.__l[1]); \
+ __r.__l[1] = GUINT32_SWAP_LE_BE (__w.__l[0]); \
+ } \
+ __r.__ll; }))
+ /* Possibly just use the constant version and let gcc figure it out? */
+# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val))
+# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA32 (val))
+# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA32 (val))
+# elif defined (__ia64__)
+# define GUINT16_SWAP_LE_BE_IA64(val) \
+ (__extension__ \
+ ({ register guint16 __v, __x = ((guint16) (val)); \
+ if (__builtin_constant_p (__x)) \
+ __v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \
+ else \
+ __asm__ __volatile__ ("shl %0 = %1, 48 ;;" \
+ "mux1 %0 = %0, @rev ;;" \
+ : "=r" (__v) \
+ : "r" (__x)); \
+ __v; }))
+# define GUINT32_SWAP_LE_BE_IA64(val) \
+ (__extension__ \
+ ({ register guint32 __v, __x = ((guint32) (val)); \
+ if (__builtin_constant_p (__x)) \
+ __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \
+ else \
+ __asm__ __volatile__ ("shl %0 = %1, 32 ;;" \
+ "mux1 %0 = %0, @rev ;;" \
+ : "=r" (__v) \
+ : "r" (__x)); \
+ __v; }))
+# define GUINT64_SWAP_LE_BE_IA64(val) \
+ (__extension__ \
+ ({ register guint64 __v, __x = ((guint64) (val)); \
+ if (__builtin_constant_p (__x)) \
+ __v = GUINT64_SWAP_LE_BE_CONSTANT (__x); \
+ else \
+ __asm__ __volatile__ ("mux1 %0 = %1, @rev ;;" \
+ : "=r" (__v) \
+ : "r" (__x)); \
+ __v; }))
+# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA64 (val))
+# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA64 (val))
+# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA64 (val))
+# elif defined (__x86_64__)
+# define GUINT32_SWAP_LE_BE_X86_64(val) \
+ (__extension__ \
+ ({ register guint32 __v, __x = ((guint32) (val)); \
+ if (__builtin_constant_p (__x)) \
+ __v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \
+ else \
+ __asm__ ("bswapl %0" \
+ : "=r" (__v) \
+ : "0" (__x)); \
+ __v; }))
+# define GUINT64_SWAP_LE_BE_X86_64(val) \
+ (__extension__ \
+ ({ register guint64 __v, __x = ((guint64) (val)); \
+ if (__builtin_constant_p (__x)) \
+ __v = GUINT64_SWAP_LE_BE_CONSTANT (__x); \
+ else \
+ __asm__ ("bswapq %0" \
+ : "=r" (__v) \
+ : "0" (__x)); \
+ __v; }))
+ /* gcc seems to figure out optimal code for this on its own */
+# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val))
+# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_X86_64 (val))
+# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_X86_64 (val))
+# else /* generic gcc */
+# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val))
+# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val))
+# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT (val))
+# endif
+#else /* generic */
+# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val))
+# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val))
+# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT (val))
+#endif /* generic */
+
+#define GUINT16_SWAP_LE_PDP(val) ((guint16) (val))
+#define GUINT16_SWAP_BE_PDP(val) (GUINT16_SWAP_LE_BE (val))
+#define GUINT32_SWAP_LE_PDP(val) ((guint32) ( \
+ (((guint32) (val) & (guint32) 0x0000ffffU) << 16) | \
+ (((guint32) (val) & (guint32) 0xffff0000U) >> 16)))
+#define GUINT32_SWAP_BE_PDP(val) ((guint32) ( \
+ (((guint32) (val) & (guint32) 0x00ff00ffU) << 8) | \
+ (((guint32) (val) & (guint32) 0xff00ff00U) >> 8)))
+
+/* The G*_TO_?E() macros are defined in glibconfig.h.
+ * The transformation is symmetric, so the FROM just maps to the TO.
+ */
+#define GINT16_FROM_LE(val) (GINT16_TO_LE (val))
+#define GUINT16_FROM_LE(val) (GUINT16_TO_LE (val))
+#define GINT16_FROM_BE(val) (GINT16_TO_BE (val))
+#define GUINT16_FROM_BE(val) (GUINT16_TO_BE (val))
+#define GINT32_FROM_LE(val) (GINT32_TO_LE (val))
+#define GUINT32_FROM_LE(val) (GUINT32_TO_LE (val))
+#define GINT32_FROM_BE(val) (GINT32_TO_BE (val))
+#define GUINT32_FROM_BE(val) (GUINT32_TO_BE (val))
+
+#define GINT64_FROM_LE(val) (GINT64_TO_LE (val))
+#define GUINT64_FROM_LE(val) (GUINT64_TO_LE (val))
+#define GINT64_FROM_BE(val) (GINT64_TO_BE (val))
+#define GUINT64_FROM_BE(val) (GUINT64_TO_BE (val))
+
+#define GLONG_FROM_LE(val) (GLONG_TO_LE (val))
+#define GULONG_FROM_LE(val) (GULONG_TO_LE (val))
+#define GLONG_FROM_BE(val) (GLONG_TO_BE (val))
+#define GULONG_FROM_BE(val) (GULONG_TO_BE (val))
+
+#define GINT_FROM_LE(val) (GINT_TO_LE (val))
+#define GUINT_FROM_LE(val) (GUINT_TO_LE (val))
+#define GINT_FROM_BE(val) (GINT_TO_BE (val))
+#define GUINT_FROM_BE(val) (GUINT_TO_BE (val))
+
+
+/* Portable versions of host-network order stuff
+ */
+#define g_ntohl(val) (GUINT32_FROM_BE (val))
+#define g_ntohs(val) (GUINT16_FROM_BE (val))
+#define g_htonl(val) (GUINT32_TO_BE (val))
+#define g_htons(val) (GUINT16_TO_BE (val))
+
+/* IEEE Standard 754 Single Precision Storage Format (gfloat):
+ *
+ * 31 30 23 22 0
+ * +--------+---------------+---------------+
+ * | s 1bit | e[30:23] 8bit | f[22:0] 23bit |
+ * +--------+---------------+---------------+
+ * B0------------------->B1------->B2-->B3-->
+ *
+ * IEEE Standard 754 Double Precision Storage Format (gdouble):
+ *
+ * 63 62 52 51 32 31 0
+ * +--------+----------------+----------------+ +---------------+
+ * | s 1bit | e[62:52] 11bit | f[51:32] 20bit | | f[31:0] 32bit |
+ * +--------+----------------+----------------+ +---------------+
+ * B0--------------->B1---------->B2--->B3----> B4->B5->B6->B7->
+ */
+/* subtract from biased_exponent to form base2 exponent (normal numbers) */
+typedef union _GDoubleIEEE754 GDoubleIEEE754;
+typedef union _GFloatIEEE754 GFloatIEEE754;
+#define G_IEEE754_FLOAT_BIAS (127)
+#define G_IEEE754_DOUBLE_BIAS (1023)
+/* multiply with base2 exponent to get base10 exponent (normal numbers) */
+#define G_LOG_2_BASE_10 (0.30102999566398119521)
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+union _GFloatIEEE754
+{
+ gfloat v_float;
+ struct {
+ guint mantissa : 23;
+ guint biased_exponent : 8;
+ guint sign : 1;
+ } mpn;
+};
+union _GDoubleIEEE754
+{
+ gdouble v_double;
+ struct {
+ guint mantissa_low : 32;
+ guint mantissa_high : 20;
+ guint biased_exponent : 11;
+ guint sign : 1;
+ } mpn;
+};
+#elif G_BYTE_ORDER == G_BIG_ENDIAN
+union _GFloatIEEE754
+{
+ gfloat v_float;
+ struct {
+ guint sign : 1;
+ guint biased_exponent : 8;
+ guint mantissa : 23;
+ } mpn;
+};
+union _GDoubleIEEE754
+{
+ gdouble v_double;
+ struct {
+ guint sign : 1;
+ guint biased_exponent : 11;
+ guint mantissa_high : 20;
+ guint mantissa_low : 32;
+ } mpn;
+};
+#else /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */
+#error unknown ENDIAN type
+#endif /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */
+
+typedef struct _GTimeVal GTimeVal;
+
+struct _GTimeVal
+{
+ glong tv_sec;
+ glong tv_usec;
+};
+
+G_END_DECLS
+
+/* We prefix variable declarations so they can
+ * properly get exported in Windows DLLs.
+ */
+#ifndef GLIB_VAR
+# ifdef G_PLATFORM_WIN32
+# ifdef GLIB_STATIC_COMPILATION
+# define GLIB_VAR extern
+# else /* !GLIB_STATIC_COMPILATION */
+# ifdef GLIB_COMPILATION
+# ifdef DLL_EXPORT
+# define GLIB_VAR __declspec(dllexport)
+# else /* !DLL_EXPORT */
+# define GLIB_VAR extern
+# endif /* !DLL_EXPORT */
+# else /* !GLIB_COMPILATION */
+# define GLIB_VAR extern __declspec(dllimport)
+# endif /* !GLIB_COMPILATION */
+# endif /* !GLIB_STATIC_COMPILATION */
+# else /* !G_PLATFORM_WIN32 */
+# define GLIB_VAR extern
+# endif /* !G_PLATFORM_WIN32 */
+#endif /* GLIB_VAR */
+
+#endif /* __G_TYPES_H__ */
diff --git a/support/glib/gunicode.h b/support/glib/gunicode.h
new file mode 100644
index 00000000..78b259e4
--- /dev/null
+++ b/support/glib/gunicode.h
@@ -0,0 +1,404 @@
+/* gunicode.h - Unicode manipulation functions
+ *
+ * Copyright (C) 1999, 2000 Tom Tromey
+ * Copyright 2000, 2005 Red Hat, Inc.
+ *
+ * The Gnome 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.
+ *
+ * The Gnome 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 the Gnome Library; see the file COPYING.LIB. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#ifndef __G_UNICODE_H__
+#define __G_UNICODE_H__
+
+#include <glib/gerror.h>
+#include <glib/gtypes.h>
+
+G_BEGIN_DECLS
+
+typedef guint32 gunichar;
+typedef guint16 gunichar2;
+
+/* These are the possible character classifications.
+ * See http://www.unicode.org/Public/UNIDATA/UCD.html#General_Category_Values
+ */
+typedef enum
+{
+ G_UNICODE_CONTROL,
+ G_UNICODE_FORMAT,
+ G_UNICODE_UNASSIGNED,
+ G_UNICODE_PRIVATE_USE,
+ G_UNICODE_SURROGATE,
+ G_UNICODE_LOWERCASE_LETTER,
+ G_UNICODE_MODIFIER_LETTER,
+ G_UNICODE_OTHER_LETTER,
+ G_UNICODE_TITLECASE_LETTER,
+ G_UNICODE_UPPERCASE_LETTER,
+ G_UNICODE_COMBINING_MARK,
+ G_UNICODE_ENCLOSING_MARK,
+ G_UNICODE_NON_SPACING_MARK,
+ G_UNICODE_DECIMAL_NUMBER,
+ G_UNICODE_LETTER_NUMBER,
+ G_UNICODE_OTHER_NUMBER,
+ G_UNICODE_CONNECT_PUNCTUATION,
+ G_UNICODE_DASH_PUNCTUATION,
+ G_UNICODE_CLOSE_PUNCTUATION,
+ G_UNICODE_FINAL_PUNCTUATION,
+ G_UNICODE_INITIAL_PUNCTUATION,
+ G_UNICODE_OTHER_PUNCTUATION,
+ G_UNICODE_OPEN_PUNCTUATION,
+ G_UNICODE_CURRENCY_SYMBOL,
+ G_UNICODE_MODIFIER_SYMBOL,
+ G_UNICODE_MATH_SYMBOL,
+ G_UNICODE_OTHER_SYMBOL,
+ G_UNICODE_LINE_SEPARATOR,
+ G_UNICODE_PARAGRAPH_SEPARATOR,
+ G_UNICODE_SPACE_SEPARATOR
+} GUnicodeType;
+
+/* These are the possible line break classifications.
+ * Note that new types may be added in the future.
+ * Implementations may regard unknown values like G_UNICODE_BREAK_UNKNOWN
+ * See http://www.unicode.org/unicode/reports/tr14/
+ */
+typedef enum
+{
+ G_UNICODE_BREAK_MANDATORY,
+ G_UNICODE_BREAK_CARRIAGE_RETURN,
+ G_UNICODE_BREAK_LINE_FEED,
+ G_UNICODE_BREAK_COMBINING_MARK,
+ G_UNICODE_BREAK_SURROGATE,
+ G_UNICODE_BREAK_ZERO_WIDTH_SPACE,
+ G_UNICODE_BREAK_INSEPARABLE,
+ G_UNICODE_BREAK_NON_BREAKING_GLUE,
+ G_UNICODE_BREAK_CONTINGENT,
+ G_UNICODE_BREAK_SPACE,
+ G_UNICODE_BREAK_AFTER,
+ G_UNICODE_BREAK_BEFORE,
+ G_UNICODE_BREAK_BEFORE_AND_AFTER,
+ G_UNICODE_BREAK_HYPHEN,
+ G_UNICODE_BREAK_NON_STARTER,
+ G_UNICODE_BREAK_OPEN_PUNCTUATION,
+ G_UNICODE_BREAK_CLOSE_PUNCTUATION,
+ G_UNICODE_BREAK_QUOTATION,
+ G_UNICODE_BREAK_EXCLAMATION,
+ G_UNICODE_BREAK_IDEOGRAPHIC,
+ G_UNICODE_BREAK_NUMERIC,
+ G_UNICODE_BREAK_INFIX_SEPARATOR,
+ G_UNICODE_BREAK_SYMBOL,
+ G_UNICODE_BREAK_ALPHABETIC,
+ G_UNICODE_BREAK_PREFIX,
+ G_UNICODE_BREAK_POSTFIX,
+ G_UNICODE_BREAK_COMPLEX_CONTEXT,
+ G_UNICODE_BREAK_AMBIGUOUS,
+ G_UNICODE_BREAK_UNKNOWN,
+ G_UNICODE_BREAK_NEXT_LINE,
+ G_UNICODE_BREAK_WORD_JOINER,
+ G_UNICODE_BREAK_HANGUL_L_JAMO,
+ G_UNICODE_BREAK_HANGUL_V_JAMO,
+ G_UNICODE_BREAK_HANGUL_T_JAMO,
+ G_UNICODE_BREAK_HANGUL_LV_SYLLABLE,
+ G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE
+} GUnicodeBreakType;
+
+typedef enum
+{ /* ISO 15924 code */
+ G_UNICODE_SCRIPT_INVALID_CODE = -1,
+ G_UNICODE_SCRIPT_COMMON = 0, /* Zyyy */
+ G_UNICODE_SCRIPT_INHERITED, /* Qaai */
+ G_UNICODE_SCRIPT_ARABIC, /* Arab */
+ G_UNICODE_SCRIPT_ARMENIAN, /* Armn */
+ G_UNICODE_SCRIPT_BENGALI, /* Beng */
+ G_UNICODE_SCRIPT_BOPOMOFO, /* Bopo */
+ G_UNICODE_SCRIPT_CHEROKEE, /* Cher */
+ G_UNICODE_SCRIPT_COPTIC, /* Qaac */
+ G_UNICODE_SCRIPT_CYRILLIC, /* Cyrl (Cyrs) */
+ G_UNICODE_SCRIPT_DESERET, /* Dsrt */
+ G_UNICODE_SCRIPT_DEVANAGARI, /* Deva */
+ G_UNICODE_SCRIPT_ETHIOPIC, /* Ethi */
+ G_UNICODE_SCRIPT_GEORGIAN, /* Geor (Geon, Geoa) */
+ G_UNICODE_SCRIPT_GOTHIC, /* Goth */
+ G_UNICODE_SCRIPT_GREEK, /* Grek */
+ G_UNICODE_SCRIPT_GUJARATI, /* Gujr */
+ G_UNICODE_SCRIPT_GURMUKHI, /* Guru */
+ G_UNICODE_SCRIPT_HAN, /* Hani */
+ G_UNICODE_SCRIPT_HANGUL, /* Hang */
+ G_UNICODE_SCRIPT_HEBREW, /* Hebr */
+ G_UNICODE_SCRIPT_HIRAGANA, /* Hira */
+ G_UNICODE_SCRIPT_KANNADA, /* Knda */
+ G_UNICODE_SCRIPT_KATAKANA, /* Kana */
+ G_UNICODE_SCRIPT_KHMER, /* Khmr */
+ G_UNICODE_SCRIPT_LAO, /* Laoo */
+ G_UNICODE_SCRIPT_LATIN, /* Latn (Latf, Latg) */
+ G_UNICODE_SCRIPT_MALAYALAM, /* Mlym */
+ G_UNICODE_SCRIPT_MONGOLIAN, /* Mong */
+ G_UNICODE_SCRIPT_MYANMAR, /* Mymr */
+ G_UNICODE_SCRIPT_OGHAM, /* Ogam */
+ G_UNICODE_SCRIPT_OLD_ITALIC, /* Ital */
+ G_UNICODE_SCRIPT_ORIYA, /* Orya */
+ G_UNICODE_SCRIPT_RUNIC, /* Runr */
+ G_UNICODE_SCRIPT_SINHALA, /* Sinh */
+ G_UNICODE_SCRIPT_SYRIAC, /* Syrc (Syrj, Syrn, Syre) */
+ G_UNICODE_SCRIPT_TAMIL, /* Taml */
+ G_UNICODE_SCRIPT_TELUGU, /* Telu */
+ G_UNICODE_SCRIPT_THAANA, /* Thaa */
+ G_UNICODE_SCRIPT_THAI, /* Thai */
+ G_UNICODE_SCRIPT_TIBETAN, /* Tibt */
+ G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL, /* Cans */
+ G_UNICODE_SCRIPT_YI, /* Yiii */
+ G_UNICODE_SCRIPT_TAGALOG, /* Tglg */
+ G_UNICODE_SCRIPT_HANUNOO, /* Hano */
+ G_UNICODE_SCRIPT_BUHID, /* Buhd */
+ G_UNICODE_SCRIPT_TAGBANWA, /* Tagb */
+
+ /* Unicode-4.0 additions */
+ G_UNICODE_SCRIPT_BRAILLE, /* Brai */
+ G_UNICODE_SCRIPT_CYPRIOT, /* Cprt */
+ G_UNICODE_SCRIPT_LIMBU, /* Limb */
+ G_UNICODE_SCRIPT_OSMANYA, /* Osma */
+ G_UNICODE_SCRIPT_SHAVIAN, /* Shaw */
+ G_UNICODE_SCRIPT_LINEAR_B, /* Linb */
+ G_UNICODE_SCRIPT_TAI_LE, /* Tale */
+ G_UNICODE_SCRIPT_UGARITIC, /* Ugar */
+
+ /* Unicode-4.1 additions */
+ G_UNICODE_SCRIPT_NEW_TAI_LUE, /* Talu */
+ G_UNICODE_SCRIPT_BUGINESE, /* Bugi */
+ G_UNICODE_SCRIPT_GLAGOLITIC, /* Glag */
+ G_UNICODE_SCRIPT_TIFINAGH, /* Tfng */
+ G_UNICODE_SCRIPT_SYLOTI_NAGRI, /* Sylo */
+ G_UNICODE_SCRIPT_OLD_PERSIAN, /* Xpeo */
+ G_UNICODE_SCRIPT_KHAROSHTHI, /* Khar */
+
+ /* Unicode-5.0 additions */
+ G_UNICODE_SCRIPT_UNKNOWN, /* Zzzz */
+ G_UNICODE_SCRIPT_BALINESE, /* Bali */
+ G_UNICODE_SCRIPT_CUNEIFORM, /* Xsux */
+ G_UNICODE_SCRIPT_PHOENICIAN, /* Phnx */
+ G_UNICODE_SCRIPT_PHAGS_PA, /* Phag */
+ G_UNICODE_SCRIPT_NKO, /* Nkoo */
+
+ /* Unicode-5.1 additions */
+ G_UNICODE_SCRIPT_KAYAH_LI, /* Kali */
+ G_UNICODE_SCRIPT_LEPCHA, /* Lepc */
+ G_UNICODE_SCRIPT_REJANG, /* Rjng */
+ G_UNICODE_SCRIPT_SUNDANESE, /* Sund */
+ G_UNICODE_SCRIPT_SAURASHTRA, /* Saur */
+ G_UNICODE_SCRIPT_CHAM, /* Cham */
+ G_UNICODE_SCRIPT_OL_CHIKI, /* Olck */
+ G_UNICODE_SCRIPT_VAI, /* Vaii */
+ G_UNICODE_SCRIPT_CARIAN, /* Cari */
+ G_UNICODE_SCRIPT_LYCIAN, /* Lyci */
+ G_UNICODE_SCRIPT_LYDIAN /* Lydi */
+} GUnicodeScript;
+
+/* Returns TRUE if current locale uses UTF-8 charset. If CHARSET is
+ * not null, sets *CHARSET to the name of the current locale's
+ * charset. This value is statically allocated, and should be copied
+ * in case the locale's charset will be changed later using setlocale()
+ * or in some other way.
+ */
+gboolean g_get_charset (G_CONST_RETURN char **charset);
+
+/* These are all analogs of the <ctype.h> functions.
+ */
+gboolean g_unichar_isalnum (gunichar c) G_GNUC_CONST;
+gboolean g_unichar_isalpha (gunichar c) G_GNUC_CONST;
+gboolean g_unichar_iscntrl (gunichar c) G_GNUC_CONST;
+gboolean g_unichar_isdigit (gunichar c) G_GNUC_CONST;
+gboolean g_unichar_isgraph (gunichar c) G_GNUC_CONST;
+gboolean g_unichar_islower (gunichar c) G_GNUC_CONST;
+gboolean g_unichar_isprint (gunichar c) G_GNUC_CONST;
+gboolean g_unichar_ispunct (gunichar c) G_GNUC_CONST;
+gboolean g_unichar_isspace (gunichar c) G_GNUC_CONST;
+gboolean g_unichar_isupper (gunichar c) G_GNUC_CONST;
+gboolean g_unichar_isxdigit (gunichar c) G_GNUC_CONST;
+gboolean g_unichar_istitle (gunichar c) G_GNUC_CONST;
+gboolean g_unichar_isdefined (gunichar c) G_GNUC_CONST;
+gboolean g_unichar_iswide (gunichar c) G_GNUC_CONST;
+gboolean g_unichar_iswide_cjk(gunichar c) G_GNUC_CONST;
+gboolean g_unichar_iszerowidth(gunichar c) G_GNUC_CONST;
+gboolean g_unichar_ismark (gunichar c) G_GNUC_CONST;
+
+/* More <ctype.h> functions. These convert between the three cases.
+ * See the Unicode book to understand title case. */
+gunichar g_unichar_toupper (gunichar c) G_GNUC_CONST;
+gunichar g_unichar_tolower (gunichar c) G_GNUC_CONST;
+gunichar g_unichar_totitle (gunichar c) G_GNUC_CONST;
+
+/* If C is a digit (according to `g_unichar_isdigit'), then return its
+ numeric value. Otherwise return -1. */
+gint g_unichar_digit_value (gunichar c) G_GNUC_CONST;
+
+gint g_unichar_xdigit_value (gunichar c) G_GNUC_CONST;
+
+/* Return the Unicode character type of a given character. */
+GUnicodeType g_unichar_type (gunichar c) G_GNUC_CONST;
+
+/* Return the line break property for a given character */
+GUnicodeBreakType g_unichar_break_type (gunichar c) G_GNUC_CONST;
+
+/* Returns the combining class for a given character */
+gint g_unichar_combining_class (gunichar uc) G_GNUC_CONST;
+
+
+/* Compute canonical ordering of a string in-place. This rearranges
+ decomposed characters in the string according to their combining
+ classes. See the Unicode manual for more information. */
+void g_unicode_canonical_ordering (gunichar *string,
+ gsize len);
+
+/* Compute canonical decomposition of a character. Returns g_malloc()d
+ string of Unicode characters. RESULT_LEN is set to the resulting
+ length of the string. */
+gunichar *g_unicode_canonical_decomposition (gunichar ch,
+ gsize *result_len) G_GNUC_MALLOC;
+
+/* Array of skip-bytes-per-initial character.
+ */
+GLIB_VAR const gchar * const g_utf8_skip;
+
+#define g_utf8_next_char(p) (char *)((p) + g_utf8_skip[*(const guchar *)(p)])
+
+gunichar g_utf8_get_char (const gchar *p) G_GNUC_PURE;
+gunichar g_utf8_get_char_validated (const gchar *p,
+ gssize max_len) G_GNUC_PURE;
+
+gchar* g_utf8_offset_to_pointer (const gchar *str,
+ glong offset) G_GNUC_PURE;
+glong g_utf8_pointer_to_offset (const gchar *str,
+ const gchar *pos) G_GNUC_PURE;
+gchar* g_utf8_prev_char (const gchar *p) G_GNUC_PURE;
+gchar* g_utf8_find_next_char (const gchar *p,
+ const gchar *end) G_GNUC_PURE;
+gchar* g_utf8_find_prev_char (const gchar *str,
+ const gchar *p) G_GNUC_PURE;
+
+glong g_utf8_strlen (const gchar *p,
+ gssize max) G_GNUC_PURE;
+
+/* Copies n characters from src to dest */
+gchar* g_utf8_strncpy (gchar *dest,
+ const gchar *src,
+ gsize n);
+
+/* Find the UTF-8 character corresponding to ch, in string p. These
+ functions are equivalants to strchr and strrchr */
+gchar* g_utf8_strchr (const gchar *p,
+ gssize len,
+ gunichar c);
+gchar* g_utf8_strrchr (const gchar *p,
+ gssize len,
+ gunichar c);
+gchar* g_utf8_strreverse (const gchar *str,
+ gssize len);
+
+gunichar2 *g_utf8_to_utf16 (const gchar *str,
+ glong len,
+ glong *items_read,
+ glong *items_written,
+ GError **error) G_GNUC_MALLOC;
+gunichar * g_utf8_to_ucs4 (const gchar *str,
+ glong len,
+ glong *items_read,
+ glong *items_written,
+ GError **error) G_GNUC_MALLOC;
+gunichar * g_utf8_to_ucs4_fast (const gchar *str,
+ glong len,
+ glong *items_written) G_GNUC_MALLOC;
+gunichar * g_utf16_to_ucs4 (const gunichar2 *str,
+ glong len,
+ glong *items_read,
+ glong *items_written,
+ GError **error) G_GNUC_MALLOC;
+gchar* g_utf16_to_utf8 (const gunichar2 *str,
+ glong len,
+ glong *items_read,
+ glong *items_written,
+ GError **error) G_GNUC_MALLOC;
+gunichar2 *g_ucs4_to_utf16 (const gunichar *str,
+ glong len,
+ glong *items_read,
+ glong *items_written,
+ GError **error) G_GNUC_MALLOC;
+gchar* g_ucs4_to_utf8 (const gunichar *str,
+ glong len,
+ glong *items_read,
+ glong *items_written,
+ GError **error) G_GNUC_MALLOC;
+
+/* Convert a single character into UTF-8. outbuf must have at
+ * least 6 bytes of space. Returns the number of bytes in the
+ * result.
+ */
+gint g_unichar_to_utf8 (gunichar c,
+ gchar *outbuf);
+
+/* Validate a UTF8 string, return TRUE if valid, put pointer to
+ * first invalid char in **end
+ */
+
+gboolean g_utf8_validate (const gchar *str,
+ gssize max_len,
+ const gchar **end);
+
+/* Validate a Unicode character */
+gboolean g_unichar_validate (gunichar ch) G_GNUC_CONST;
+
+gchar *g_utf8_strup (const gchar *str,
+ gssize len) G_GNUC_MALLOC;
+gchar *g_utf8_strdown (const gchar *str,
+ gssize len) G_GNUC_MALLOC;
+gchar *g_utf8_casefold (const gchar *str,
+ gssize len) G_GNUC_MALLOC;
+
+typedef enum {
+ G_NORMALIZE_DEFAULT,
+ G_NORMALIZE_NFD = G_NORMALIZE_DEFAULT,
+ G_NORMALIZE_DEFAULT_COMPOSE,
+ G_NORMALIZE_NFC = G_NORMALIZE_DEFAULT_COMPOSE,
+ G_NORMALIZE_ALL,
+ G_NORMALIZE_NFKD = G_NORMALIZE_ALL,
+ G_NORMALIZE_ALL_COMPOSE,
+ G_NORMALIZE_NFKC = G_NORMALIZE_ALL_COMPOSE
+} GNormalizeMode;
+
+gchar *g_utf8_normalize (const gchar *str,
+ gssize len,
+ GNormalizeMode mode) G_GNUC_MALLOC;
+
+gint g_utf8_collate (const gchar *str1,
+ const gchar *str2) G_GNUC_PURE;
+gchar *g_utf8_collate_key (const gchar *str,
+ gssize len) G_GNUC_MALLOC;
+gchar *g_utf8_collate_key_for_filename (const gchar *str,
+ gssize len) G_GNUC_MALLOC;
+
+gboolean g_unichar_get_mirror_char (gunichar ch,
+ gunichar *mirrored_ch);
+
+GUnicodeScript g_unichar_get_script (gunichar ch) G_GNUC_CONST;
+
+
+/* private */
+
+gchar *_g_utf8_make_valid (const gchar *name);
+
+G_END_DECLS
+
+#endif /* __G_UNICODE_H__ */
diff --git a/support/glib/gutf8.c b/support/glib/gutf8.c
new file mode 100644
index 00000000..56163f80
--- /dev/null
+++ b/support/glib/gutf8.c
@@ -0,0 +1,1866 @@
+/* gutf8.c - Operations on UTF-8 strings.
+ *
+ * Copyright (C) 1999 Tom Tromey
+ * Copyright (C) 2000 Red Hat, Inc.
+ *
+ * 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.
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#ifdef HAVE_CODESET
+#include <langinfo.h>
+#endif
+#include <string.h>
+
+#include "glib.h"
+
+#ifdef G_PLATFORM_WIN32
+#include <stdio.h>
+#define STRICT
+#include <windows.h>
+#undef STRICT
+#endif
+
+#ifdef NOT_NEEDED_FOR_NAVIT
+#include "libcharset/libcharset.h"
+
+#include "glibintl.h"
+#include "galias.h"
+#endif
+
+#define UTF8_COMPUTE(Char, Mask, Len) \
+ if (Char < 128) \
+ { \
+ Len = 1; \
+ Mask = 0x7f; \
+ } \
+ else if ((Char & 0xe0) == 0xc0) \
+ { \
+ Len = 2; \
+ Mask = 0x1f; \
+ } \
+ else if ((Char & 0xf0) == 0xe0) \
+ { \
+ Len = 3; \
+ Mask = 0x0f; \
+ } \
+ else if ((Char & 0xf8) == 0xf0) \
+ { \
+ Len = 4; \
+ Mask = 0x07; \
+ } \
+ else if ((Char & 0xfc) == 0xf8) \
+ { \
+ Len = 5; \
+ Mask = 0x03; \
+ } \
+ else if ((Char & 0xfe) == 0xfc) \
+ { \
+ Len = 6; \
+ Mask = 0x01; \
+ } \
+ else \
+ Len = -1;
+
+#define UTF8_LENGTH(Char) \
+ ((Char) < 0x80 ? 1 : \
+ ((Char) < 0x800 ? 2 : \
+ ((Char) < 0x10000 ? 3 : \
+ ((Char) < 0x200000 ? 4 : \
+ ((Char) < 0x4000000 ? 5 : 6)))))
+
+
+#define UTF8_GET(Result, Chars, Count, Mask, Len) \
+ (Result) = (Chars)[0] & (Mask); \
+ for ((Count) = 1; (Count) < (Len); ++(Count)) \
+ { \
+ if (((Chars)[(Count)] & 0xc0) != 0x80) \
+ { \
+ (Result) = -1; \
+ break; \
+ } \
+ (Result) <<= 6; \
+ (Result) |= ((Chars)[(Count)] & 0x3f); \
+ }
+
+#define UNICODE_VALID(Char) \
+ ((Char) < 0x110000 && \
+ (((Char) & 0xFFFFF800) != 0xD800) && \
+ ((Char) < 0xFDD0 || (Char) > 0xFDEF) && \
+ ((Char) & 0xFFFE) != 0xFFFE)
+
+
+static const gchar utf8_skip_data[256] = {
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1
+};
+
+const gchar * const g_utf8_skip = utf8_skip_data;
+
+/**
+ * g_utf8_find_prev_char:
+ * @str: pointer to the beginning of a UTF-8 encoded string
+ * @p: pointer to some position within @str
+ *
+ * Given a position @p with a UTF-8 encoded string @str, find the start
+ * of the previous UTF-8 character starting before @p. Returns %NULL if no
+ * UTF-8 characters are present in @str before @p.
+ *
+ * @p does not have to be at the beginning of a UTF-8 character. No check
+ * is made to see if the character found is actually valid other than
+ * it starts with an appropriate byte.
+ *
+ * Return value: a pointer to the found character or %NULL.
+ **/
+gchar *
+g_utf8_find_prev_char (const char *str,
+ const char *p)
+{
+ for (--p; p >= str; --p)
+ {
+ if ((*p & 0xc0) != 0x80)
+ return (gchar *)p;
+ }
+ return NULL;
+}
+
+/**
+ * g_utf8_find_next_char:
+ * @p: a pointer to a position within a UTF-8 encoded string
+ * @end: a pointer to the byte following the end of the string,
+ * or %NULL to indicate that the string is nul-terminated.
+ *
+ * Finds the start of the next UTF-8 character in the string after @p.
+ *
+ * @p does not have to be at the beginning of a UTF-8 character. No check
+ * is made to see if the character found is actually valid other than
+ * it starts with an appropriate byte.
+ *
+ * Return value: a pointer to the found character or %NULL
+ **/
+gchar *
+g_utf8_find_next_char (const gchar *p,
+ const gchar *end)
+{
+ if (*p)
+ {
+ if (end)
+ for (++p; p < end && (*p & 0xc0) == 0x80; ++p)
+ ;
+ else
+ for (++p; (*p & 0xc0) == 0x80; ++p)
+ ;
+ }
+ return (p == end) ? NULL : (gchar *)p;
+}
+
+/**
+ * g_utf8_prev_char:
+ * @p: a pointer to a position within a UTF-8 encoded string
+ *
+ * Finds the previous UTF-8 character in the string before @p.
+ *
+ * @p does not have to be at the beginning of a UTF-8 character. No check
+ * is made to see if the character found is actually valid other than
+ * it starts with an appropriate byte. If @p might be the first
+ * character of the string, you must use g_utf8_find_prev_char() instead.
+ *
+ * Return value: a pointer to the found character.
+ **/
+gchar *
+g_utf8_prev_char (const gchar *p)
+{
+ while (TRUE)
+ {
+ p--;
+ if ((*p & 0xc0) != 0x80)
+ return (gchar *)p;
+ }
+}
+
+/**
+ * g_utf8_strlen:
+ * @p: pointer to the start of a UTF-8 encoded string.
+ * @max: the maximum number of bytes to examine. If @max
+ * is less than 0, then the string is assumed to be
+ * nul-terminated. If @max is 0, @p will not be examined and
+ * may be %NULL.
+ *
+ * Returns the length of the string in characters.
+ *
+ * Return value: the length of the string in characters
+ **/
+glong
+g_utf8_strlen (const gchar *p,
+ gssize max)
+{
+ glong len = 0;
+ const gchar *start = p;
+ g_return_val_if_fail (p != NULL || max == 0, 0);
+
+ if (max < 0)
+ {
+ while (*p)
+ {
+ p = g_utf8_next_char (p);
+ ++len;
+ }
+ }
+ else
+ {
+ if (max == 0 || !*p)
+ return 0;
+
+ p = g_utf8_next_char (p);
+
+ while (p - start < max && *p)
+ {
+ ++len;
+ p = g_utf8_next_char (p);
+ }
+
+ /* only do the last len increment if we got a complete
+ * char (don't count partial chars)
+ */
+ if (p - start <= max)
+ ++len;
+ }
+
+ return len;
+}
+
+/**
+ * g_utf8_get_char:
+ * @p: a pointer to Unicode character encoded as UTF-8
+ *
+ * Converts a sequence of bytes encoded as UTF-8 to a Unicode character.
+ * If @p does not point to a valid UTF-8 encoded character, results are
+ * undefined. If you are not sure that the bytes are complete
+ * valid Unicode characters, you should use g_utf8_get_char_validated()
+ * instead.
+ *
+ * Return value: the resulting character
+ **/
+gunichar
+g_utf8_get_char (const gchar *p)
+{
+ int i, mask = 0, len;
+ gunichar result;
+ unsigned char c = (unsigned char) *p;
+
+ UTF8_COMPUTE (c, mask, len);
+ if (len == -1)
+ return (gunichar)-1;
+ UTF8_GET (result, p, i, mask, len);
+
+ return result;
+}
+
+#ifdef NOT_NEEDED_FOR_NAVIT
+
+/**
+ * g_utf8_offset_to_pointer:
+ * @str: a UTF-8 encoded string
+ * @offset: a character offset within @str
+ *
+ * Converts from an integer character offset to a pointer to a position
+ * within the string.
+ *
+ * Since 2.10, this function allows to pass a negative @offset to
+ * step backwards. It is usually worth stepping backwards from the end
+ * instead of forwards if @offset is in the last fourth of the string,
+ * since moving forward is about 3 times faster than moving backward.
+ *
+ * Return value: the resulting pointer
+ **/
+gchar *
+g_utf8_offset_to_pointer (const gchar *str,
+ glong offset)
+{
+ const gchar *s = str;
+
+ if (offset > 0)
+ while (offset--)
+ s = g_utf8_next_char (s);
+ else
+ {
+ const char *s1;
+
+ /* This nice technique for fast backwards stepping
+ * through a UTF-8 string was dubbed "stutter stepping"
+ * by its inventor, Larry Ewing.
+ */
+ while (offset)
+ {
+ s1 = s;
+ s += offset;
+ while ((*s & 0xc0) == 0x80)
+ s--;
+
+ offset += g_utf8_pointer_to_offset (s, s1);
+ }
+ }
+
+ return (gchar *)s;
+}
+
+/**
+ * g_utf8_pointer_to_offset:
+ * @str: a UTF-8 encoded string
+ * @pos: a pointer to a position within @str
+ *
+ * Converts from a pointer to position within a string to a integer
+ * character offset.
+ *
+ * Since 2.10, this function allows @pos to be before @str, and returns
+ * a negative offset in this case.
+ *
+ * Return value: the resulting character offset
+ **/
+glong
+g_utf8_pointer_to_offset (const gchar *str,
+ const gchar *pos)
+{
+ const gchar *s = str;
+ glong offset = 0;
+
+ if (pos < str)
+ offset = - g_utf8_pointer_to_offset (pos, str);
+ else
+ while (s < pos)
+ {
+ s = g_utf8_next_char (s);
+ offset++;
+ }
+
+ return offset;
+}
+
+
+/**
+ * g_utf8_strncpy:
+ * @dest: buffer to fill with characters from @src
+ * @src: UTF-8 encoded string
+ * @n: character count
+ *
+ * Like the standard C strncpy() function, but
+ * copies a given number of characters instead of a given number of
+ * bytes. The @src string must be valid UTF-8 encoded text.
+ * (Use g_utf8_validate() on all text before trying to use UTF-8
+ * utility functions with it.)
+ *
+ * Return value: @dest
+ **/
+gchar *
+g_utf8_strncpy (gchar *dest,
+ const gchar *src,
+ gsize n)
+{
+ const gchar *s = src;
+ while (n && *s)
+ {
+ s = g_utf8_next_char(s);
+ n--;
+ }
+ strncpy(dest, src, s - src);
+ dest[s - src] = 0;
+ return dest;
+}
+
+G_LOCK_DEFINE_STATIC (aliases);
+
+static GHashTable *
+get_alias_hash (void)
+{
+ static GHashTable *alias_hash = NULL;
+ const char *aliases;
+
+ G_LOCK (aliases);
+
+ if (!alias_hash)
+ {
+ alias_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+ aliases = _g_locale_get_charset_aliases ();
+ while (*aliases != '\0')
+ {
+ const char *canonical;
+ const char *alias;
+ const char **alias_array;
+ int count = 0;
+
+ alias = aliases;
+ aliases += strlen (aliases) + 1;
+ canonical = aliases;
+ aliases += strlen (aliases) + 1;
+
+ alias_array = g_hash_table_lookup (alias_hash, canonical);
+ if (alias_array)
+ {
+ while (alias_array[count])
+ count++;
+ }
+
+ alias_array = g_renew (const char *, alias_array, count + 2);
+ alias_array[count] = alias;
+ alias_array[count + 1] = NULL;
+
+ g_hash_table_insert (alias_hash, (char *)canonical, alias_array);
+ }
+ }
+
+ G_UNLOCK (aliases);
+
+ return alias_hash;
+}
+
+/* As an abuse of the alias table, the following routines gets
+ * the charsets that are aliases for the canonical name.
+ */
+G_GNUC_INTERNAL const char **
+_g_charset_get_aliases (const char *canonical_name)
+{
+ GHashTable *alias_hash = get_alias_hash ();
+
+ return g_hash_table_lookup (alias_hash, canonical_name);
+}
+
+static gboolean
+g_utf8_get_charset_internal (const char *raw_data,
+ const char **a)
+{
+ const char *charset = getenv("CHARSET");
+
+ if (charset && *charset)
+ {
+ *a = charset;
+
+ if (charset && strstr (charset, "UTF-8"))
+ return TRUE;
+ else
+ return FALSE;
+ }
+
+ /* The libcharset code tries to be thread-safe without
+ * a lock, but has a memory leak and a missing memory
+ * barrier, so we lock for it
+ */
+ G_LOCK (aliases);
+ charset = _g_locale_charset_unalias (raw_data);
+ G_UNLOCK (aliases);
+
+ if (charset && *charset)
+ {
+ *a = charset;
+
+ if (charset && strstr (charset, "UTF-8"))
+ return TRUE;
+ else
+ return FALSE;
+ }
+
+ /* Assume this for compatibility at present. */
+ *a = "US-ASCII";
+
+ return FALSE;
+}
+
+typedef struct _GCharsetCache GCharsetCache;
+
+struct _GCharsetCache {
+ gboolean is_utf8;
+ gchar *raw;
+ gchar *charset;
+};
+
+static void
+charset_cache_free (gpointer data)
+{
+ GCharsetCache *cache = data;
+ g_free (cache->raw);
+ g_free (cache->charset);
+ g_free (cache);
+}
+
+/**
+ * g_get_charset:
+ * @charset: return location for character set name
+ *
+ * Obtains the character set for the <link linkend="setlocale">current
+ * locale</link>; you might use this character set as an argument to
+ * g_convert(), to convert from the current locale's encoding to some
+ * other encoding. (Frequently g_locale_to_utf8() and g_locale_from_utf8()
+ * are nice shortcuts, though.)
+ *
+ * On Windows the character set returned by this function is the
+ * so-called system default ANSI code-page. That is the character set
+ * used by the "narrow" versions of C library and Win32 functions that
+ * handle file names. It might be different from the character set
+ * used by the C library's current locale.
+ *
+ * The return value is %TRUE if the locale's encoding is UTF-8, in that
+ * case you can perhaps avoid calling g_convert().
+ *
+ * The string returned in @charset is not allocated, and should not be
+ * freed.
+ *
+ * Return value: %TRUE if the returned charset is UTF-8
+ **/
+gboolean
+g_get_charset (G_CONST_RETURN char **charset)
+{
+ static GStaticPrivate cache_private = G_STATIC_PRIVATE_INIT;
+ GCharsetCache *cache = g_static_private_get (&cache_private);
+ const gchar *raw;
+
+ if (!cache)
+ {
+ cache = g_new0 (GCharsetCache, 1);
+ g_static_private_set (&cache_private, cache, charset_cache_free);
+ }
+
+ raw = _g_locale_charset_raw ();
+
+ if (!(cache->raw && strcmp (cache->raw, raw) == 0))
+ {
+ const gchar *new_charset;
+
+ g_free (cache->raw);
+ g_free (cache->charset);
+ cache->raw = g_strdup (raw);
+ cache->is_utf8 = g_utf8_get_charset_internal (raw, &new_charset);
+ cache->charset = g_strdup (new_charset);
+ }
+
+ if (charset)
+ *charset = cache->charset;
+
+ return cache->is_utf8;
+}
+
+/* unicode_strchr */
+
+/**
+ * g_unichar_to_utf8:
+ * @c: a Unicode character code
+ * @outbuf: output buffer, must have at least 6 bytes of space.
+ * If %NULL, the length will be computed and returned
+ * and nothing will be written to @outbuf.
+ *
+ * Converts a single character to UTF-8.
+ *
+ * Return value: number of bytes written
+ **/
+int
+g_unichar_to_utf8 (gunichar c,
+ gchar *outbuf)
+{
+ /* If this gets modified, also update the copy in g_string_insert_unichar() */
+ guint len = 0;
+ int first;
+ int i;
+
+ if (c < 0x80)
+ {
+ first = 0;
+ len = 1;
+ }
+ else if (c < 0x800)
+ {
+ first = 0xc0;
+ len = 2;
+ }
+ else if (c < 0x10000)
+ {
+ first = 0xe0;
+ len = 3;
+ }
+ else if (c < 0x200000)
+ {
+ first = 0xf0;
+ len = 4;
+ }
+ else if (c < 0x4000000)
+ {
+ first = 0xf8;
+ len = 5;
+ }
+ else
+ {
+ first = 0xfc;
+ len = 6;
+ }
+
+ if (outbuf)
+ {
+ for (i = len - 1; i > 0; --i)
+ {
+ outbuf[i] = (c & 0x3f) | 0x80;
+ c >>= 6;
+ }
+ outbuf[0] = c | first;
+ }
+
+ return len;
+}
+
+/**
+ * g_utf8_strchr:
+ * @p: a nul-terminated UTF-8 encoded string
+ * @len: the maximum length of @p
+ * @c: a Unicode character
+ *
+ * Finds the leftmost occurrence of the given Unicode character
+ * in a UTF-8 encoded string, while limiting the search to @len bytes.
+ * If @len is -1, allow unbounded search.
+ *
+ * Return value: %NULL if the string does not contain the character,
+ * otherwise, a pointer to the start of the leftmost occurrence of
+ * the character in the string.
+ **/
+gchar *
+g_utf8_strchr (const char *p,
+ gssize len,
+ gunichar c)
+{
+ gchar ch[10];
+
+ gint charlen = g_unichar_to_utf8 (c, ch);
+ ch[charlen] = '\0';
+
+ return g_strstr_len (p, len, ch);
+}
+
+
+/**
+ * g_utf8_strrchr:
+ * @p: a nul-terminated UTF-8 encoded string
+ * @len: the maximum length of @p
+ * @c: a Unicode character
+ *
+ * Find the rightmost occurrence of the given Unicode character
+ * in a UTF-8 encoded string, while limiting the search to @len bytes.
+ * If @len is -1, allow unbounded search.
+ *
+ * Return value: %NULL if the string does not contain the character,
+ * otherwise, a pointer to the start of the rightmost occurrence of the
+ * character in the string.
+ **/
+gchar *
+g_utf8_strrchr (const char *p,
+ gssize len,
+ gunichar c)
+{
+ gchar ch[10];
+
+ gint charlen = g_unichar_to_utf8 (c, ch);
+ ch[charlen] = '\0';
+
+ return g_strrstr_len (p, len, ch);
+}
+
+
+/* Like g_utf8_get_char, but take a maximum length
+ * and return (gunichar)-2 on incomplete trailing character
+ */
+static inline gunichar
+g_utf8_get_char_extended (const gchar *p,
+ gssize max_len)
+{
+ guint i, len;
+ gunichar wc = (guchar) *p;
+
+ if (wc < 0x80)
+ {
+ return wc;
+ }
+ else if (wc < 0xc0)
+ {
+ return (gunichar)-1;
+ }
+ else if (wc < 0xe0)
+ {
+ len = 2;
+ wc &= 0x1f;
+ }
+ else if (wc < 0xf0)
+ {
+ len = 3;
+ wc &= 0x0f;
+ }
+ else if (wc < 0xf8)
+ {
+ len = 4;
+ wc &= 0x07;
+ }
+ else if (wc < 0xfc)
+ {
+ len = 5;
+ wc &= 0x03;
+ }
+ else if (wc < 0xfe)
+ {
+ len = 6;
+ wc &= 0x01;
+ }
+ else
+ {
+ return (gunichar)-1;
+ }
+
+ if (max_len >= 0 && len > max_len)
+ {
+ for (i = 1; i < max_len; i++)
+ {
+ if ((((guchar *)p)[i] & 0xc0) != 0x80)
+ return (gunichar)-1;
+ }
+ return (gunichar)-2;
+ }
+
+ for (i = 1; i < len; ++i)
+ {
+ gunichar ch = ((guchar *)p)[i];
+
+ if ((ch & 0xc0) != 0x80)
+ {
+ if (ch)
+ return (gunichar)-1;
+ else
+ return (gunichar)-2;
+ }
+
+ wc <<= 6;
+ wc |= (ch & 0x3f);
+ }
+
+ if (UTF8_LENGTH(wc) != len)
+ return (gunichar)-1;
+
+ return wc;
+}
+
+/**
+ * g_utf8_get_char_validated:
+ * @p: a pointer to Unicode character encoded as UTF-8
+ * @max_len: the maximum number of bytes to read, or -1, for no maximum or
+ * if @p is nul-terminated
+ *
+ * Convert a sequence of bytes encoded as UTF-8 to a Unicode character.
+ * This function checks for incomplete characters, for invalid characters
+ * such as characters that are out of the range of Unicode, and for
+ * overlong encodings of valid characters.
+ *
+ * Return value: the resulting character. If @p points to a partial
+ * sequence at the end of a string that could begin a valid
+ * character (or if @max_len is zero), returns (gunichar)-2;
+ * otherwise, if @p does not point to a valid UTF-8 encoded
+ * Unicode character, returns (gunichar)-1.
+ **/
+gunichar
+g_utf8_get_char_validated (const gchar *p,
+ gssize max_len)
+{
+ gunichar result;
+
+ if (max_len == 0)
+ return (gunichar)-2;
+
+ result = g_utf8_get_char_extended (p, max_len);
+
+ if (result & 0x80000000)
+ return result;
+ else if (!UNICODE_VALID (result))
+ return (gunichar)-1;
+ else
+ return result;
+}
+
+/**
+ * g_utf8_to_ucs4_fast:
+ * @str: a UTF-8 encoded string
+ * @len: the maximum length of @str to use, in bytes. If @len < 0,
+ * then the string is nul-terminated.
+ * @items_written: location to store the number of characters in the
+ * result, or %NULL.
+ *
+ * Convert a string from UTF-8 to a 32-bit fixed width
+ * representation as UCS-4, assuming valid UTF-8 input.
+ * This function is roughly twice as fast as g_utf8_to_ucs4()
+ * but does no error checking on the input.
+ *
+ * Return value: a pointer to a newly allocated UCS-4 string.
+ * This value must be freed with g_free().
+ **/
+gunichar *
+g_utf8_to_ucs4_fast (const gchar *str,
+ glong len,
+ glong *items_written)
+{
+ gint j, charlen;
+ gunichar *result;
+ gint n_chars, i;
+ const gchar *p;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ p = str;
+ n_chars = 0;
+ if (len < 0)
+ {
+ while (*p)
+ {
+ p = g_utf8_next_char (p);
+ ++n_chars;
+ }
+ }
+ else
+ {
+ while (p < str + len && *p)
+ {
+ p = g_utf8_next_char (p);
+ ++n_chars;
+ }
+ }
+
+ result = g_new (gunichar, n_chars + 1);
+
+ p = str;
+ for (i=0; i < n_chars; i++)
+ {
+ gunichar wc = ((unsigned char *)p)[0];
+
+ if (wc < 0x80)
+ {
+ result[i] = wc;
+ p++;
+ }
+ else
+ {
+ if (wc < 0xe0)
+ {
+ charlen = 2;
+ wc &= 0x1f;
+ }
+ else if (wc < 0xf0)
+ {
+ charlen = 3;
+ wc &= 0x0f;
+ }
+ else if (wc < 0xf8)
+ {
+ charlen = 4;
+ wc &= 0x07;
+ }
+ else if (wc < 0xfc)
+ {
+ charlen = 5;
+ wc &= 0x03;
+ }
+ else
+ {
+ charlen = 6;
+ wc &= 0x01;
+ }
+
+ for (j = 1; j < charlen; j++)
+ {
+ wc <<= 6;
+ wc |= ((unsigned char *)p)[j] & 0x3f;
+ }
+
+ result[i] = wc;
+ p += charlen;
+ }
+ }
+ result[i] = 0;
+
+ if (items_written)
+ *items_written = i;
+
+ return result;
+}
+
+/**
+ * g_utf8_to_ucs4:
+ * @str: a UTF-8 encoded string
+ * @len: the maximum length of @str to use, in bytes. If @len < 0,
+ * then the string is nul-terminated.
+ * @items_read: location to store number of bytes read, or %NULL.
+ * If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be
+ * returned in case @str contains a trailing partial
+ * character. If an error occurs then the index of the
+ * invalid input is stored here.
+ * @items_written: location to store number of characters written or %NULL.
+ * The value here stored does not include the trailing 0
+ * character.
+ * @error: location to store the error occuring, or %NULL to ignore
+ * errors. Any of the errors in #GConvertError other than
+ * %G_CONVERT_ERROR_NO_CONVERSION may occur.
+ *
+ * Convert a string from UTF-8 to a 32-bit fixed width
+ * representation as UCS-4. A trailing 0 will be added to the
+ * string after the converted text.
+ *
+ * Return value: a pointer to a newly allocated UCS-4 string.
+ * This value must be freed with g_free(). If an
+ * error occurs, %NULL will be returned and
+ * @error set.
+ **/
+gunichar *
+g_utf8_to_ucs4 (const gchar *str,
+ glong len,
+ glong *items_read,
+ glong *items_written,
+ GError **error)
+{
+ gunichar *result = NULL;
+ gint n_chars, i;
+ const gchar *in;
+
+ in = str;
+ n_chars = 0;
+ while ((len < 0 || str + len - in > 0) && *in)
+ {
+ gunichar wc = g_utf8_get_char_extended (in, len < 0 ? 6 : str + len - in);
+ if (wc & 0x80000000)
+ {
+ if (wc == (gunichar)-2)
+ {
+ if (items_read)
+ break;
+ else
+ g_set_error_literal (error, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
+ _("Partial character sequence at end of input"));
+ }
+ else
+ g_set_error_literal (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ _("Invalid byte sequence in conversion input"));
+
+ goto err_out;
+ }
+
+ n_chars++;
+
+ in = g_utf8_next_char (in);
+ }
+
+ result = g_new (gunichar, n_chars + 1);
+
+ in = str;
+ for (i=0; i < n_chars; i++)
+ {
+ result[i] = g_utf8_get_char (in);
+ in = g_utf8_next_char (in);
+ }
+ result[i] = 0;
+
+ if (items_written)
+ *items_written = n_chars;
+
+ err_out:
+ if (items_read)
+ *items_read = in - str;
+
+ return result;
+}
+
+/**
+ * g_ucs4_to_utf8:
+ * @str: a UCS-4 encoded string
+ * @len: the maximum length (number of characters) of @str to use.
+ * If @len < 0, then the string is nul-terminated.
+ * @items_read: location to store number of characters read, or %NULL.
+ * @items_written: location to store number of bytes written or %NULL.
+ * The value here stored does not include the trailing 0
+ * byte.
+ * @error: location to store the error occuring, or %NULL to ignore
+ * errors. Any of the errors in #GConvertError other than
+ * %G_CONVERT_ERROR_NO_CONVERSION may occur.
+ *
+ * Convert a string from a 32-bit fixed width representation as UCS-4.
+ * to UTF-8. The result will be terminated with a 0 byte.
+ *
+ * Return value: a pointer to a newly allocated UTF-8 string.
+ * This value must be freed with g_free(). If an
+ * error occurs, %NULL will be returned and
+ * @error set. In that case, @items_read will be
+ * set to the position of the first invalid input
+ * character.
+ **/
+gchar *
+g_ucs4_to_utf8 (const gunichar *str,
+ glong len,
+ glong *items_read,
+ glong *items_written,
+ GError **error)
+{
+ gint result_length;
+ gchar *result = NULL;
+ gchar *p;
+ gint i;
+
+ result_length = 0;
+ for (i = 0; len < 0 || i < len ; i++)
+ {
+ if (!str[i])
+ break;
+
+ if (str[i] >= 0x80000000)
+ {
+ g_set_error_literal (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ _("Character out of range for UTF-8"));
+ goto err_out;
+ }
+
+ result_length += UTF8_LENGTH (str[i]);
+ }
+
+ result = g_malloc (result_length + 1);
+ p = result;
+
+ i = 0;
+ while (p < result + result_length)
+ p += g_unichar_to_utf8 (str[i++], p);
+
+ *p = '\0';
+
+ if (items_written)
+ *items_written = p - result;
+
+ err_out:
+ if (items_read)
+ *items_read = i;
+
+ return result;
+}
+
+#define SURROGATE_VALUE(h,l) (((h) - 0xd800) * 0x400 + (l) - 0xdc00 + 0x10000)
+
+/**
+ * g_utf16_to_utf8:
+ * @str: a UTF-16 encoded string
+ * @len: the maximum length (number of <type>gunichar2</type>) of @str to use.
+ * If @len < 0, then the string is nul-terminated.
+ * @items_read: location to store number of words read, or %NULL.
+ * If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be
+ * returned in case @str contains a trailing partial
+ * character. If an error occurs then the index of the
+ * invalid input is stored here.
+ * @items_written: location to store number of bytes written, or %NULL.
+ * The value stored here does not include the trailing
+ * 0 byte.
+ * @error: location to store the error occuring, or %NULL to ignore
+ * errors. Any of the errors in #GConvertError other than
+ * %G_CONVERT_ERROR_NO_CONVERSION may occur.
+ *
+ * Convert a string from UTF-16 to UTF-8. The result will be
+ * terminated with a 0 byte.
+ *
+ * Note that the input is expected to be already in native endianness,
+ * an initial byte-order-mark character is not handled specially.
+ * g_convert() can be used to convert a byte buffer of UTF-16 data of
+ * ambiguous endianess.
+ *
+ * Return value: a pointer to a newly allocated UTF-8 string.
+ * This value must be freed with g_free(). If an
+ * error occurs, %NULL will be returned and
+ * @error set.
+ **/
+gchar *
+g_utf16_to_utf8 (const gunichar2 *str,
+ glong len,
+ glong *items_read,
+ glong *items_written,
+ GError **error)
+{
+ /* This function and g_utf16_to_ucs4 are almost exactly identical - The lines that differ
+ * are marked.
+ */
+ const gunichar2 *in;
+ gchar *out;
+ gchar *result = NULL;
+ gint n_bytes;
+ gunichar high_surrogate;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ n_bytes = 0;
+ in = str;
+ high_surrogate = 0;
+ while ((len < 0 || in - str < len) && *in)
+ {
+ gunichar2 c = *in;
+ gunichar wc;
+
+ if (c >= 0xdc00 && c < 0xe000) /* low surrogate */
+ {
+ if (high_surrogate)
+ {
+ wc = SURROGATE_VALUE (high_surrogate, c);
+ high_surrogate = 0;
+ }
+ else
+ {
+ g_set_error_literal (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ _("Invalid sequence in conversion input"));
+ goto err_out;
+ }
+ }
+ else
+ {
+ if (high_surrogate)
+ {
+ g_set_error_literal (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ _("Invalid sequence in conversion input"));
+ goto err_out;
+ }
+
+ if (c >= 0xd800 && c < 0xdc00) /* high surrogate */
+ {
+ high_surrogate = c;
+ goto next1;
+ }
+ else
+ wc = c;
+ }
+
+ /********** DIFFERENT for UTF8/UCS4 **********/
+ n_bytes += UTF8_LENGTH (wc);
+
+ next1:
+ in++;
+ }
+
+ if (high_surrogate && !items_read)
+ {
+ g_set_error_literal (error, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
+ _("Partial character sequence at end of input"));
+ goto err_out;
+ }
+
+ /* At this point, everything is valid, and we just need to convert
+ */
+ /********** DIFFERENT for UTF8/UCS4 **********/
+ result = g_malloc (n_bytes + 1);
+
+ high_surrogate = 0;
+ out = result;
+ in = str;
+ while (out < result + n_bytes)
+ {
+ gunichar2 c = *in;
+ gunichar wc;
+
+ if (c >= 0xdc00 && c < 0xe000) /* low surrogate */
+ {
+ wc = SURROGATE_VALUE (high_surrogate, c);
+ high_surrogate = 0;
+ }
+ else if (c >= 0xd800 && c < 0xdc00) /* high surrogate */
+ {
+ high_surrogate = c;
+ goto next2;
+ }
+ else
+ wc = c;
+
+ /********** DIFFERENT for UTF8/UCS4 **********/
+ out += g_unichar_to_utf8 (wc, out);
+
+ next2:
+ in++;
+ }
+
+ /********** DIFFERENT for UTF8/UCS4 **********/
+ *out = '\0';
+
+ if (items_written)
+ /********** DIFFERENT for UTF8/UCS4 **********/
+ *items_written = out - result;
+
+ err_out:
+ if (items_read)
+ *items_read = in - str;
+
+ return result;
+}
+
+/**
+ * g_utf16_to_ucs4:
+ * @str: a UTF-16 encoded string
+ * @len: the maximum length (number of <type>gunichar2</type>) of @str to use.
+ * If @len < 0, then the string is nul-terminated.
+ * @items_read: location to store number of words read, or %NULL.
+ * If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be
+ * returned in case @str contains a trailing partial
+ * character. If an error occurs then the index of the
+ * invalid input is stored here.
+ * @items_written: location to store number of characters written, or %NULL.
+ * The value stored here does not include the trailing
+ * 0 character.
+ * @error: location to store the error occuring, or %NULL to ignore
+ * errors. Any of the errors in #GConvertError other than
+ * %G_CONVERT_ERROR_NO_CONVERSION may occur.
+ *
+ * Convert a string from UTF-16 to UCS-4. The result will be
+ * nul-terminated.
+ *
+ * Return value: a pointer to a newly allocated UCS-4 string.
+ * This value must be freed with g_free(). If an
+ * error occurs, %NULL will be returned and
+ * @error set.
+ **/
+gunichar *
+g_utf16_to_ucs4 (const gunichar2 *str,
+ glong len,
+ glong *items_read,
+ glong *items_written,
+ GError **error)
+{
+ const gunichar2 *in;
+ gchar *out;
+ gchar *result = NULL;
+ gint n_bytes;
+ gunichar high_surrogate;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ n_bytes = 0;
+ in = str;
+ high_surrogate = 0;
+ while ((len < 0 || in - str < len) && *in)
+ {
+ gunichar2 c = *in;
+ gunichar wc;
+
+ if (c >= 0xdc00 && c < 0xe000) /* low surrogate */
+ {
+ if (high_surrogate)
+ {
+ wc = SURROGATE_VALUE (high_surrogate, c);
+ high_surrogate = 0;
+ }
+ else
+ {
+ g_set_error_literal (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ _("Invalid sequence in conversion input"));
+ goto err_out;
+ }
+ }
+ else
+ {
+ if (high_surrogate)
+ {
+ g_set_error_literal (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ _("Invalid sequence in conversion input"));
+ goto err_out;
+ }
+
+ if (c >= 0xd800 && c < 0xdc00) /* high surrogate */
+ {
+ high_surrogate = c;
+ goto next1;
+ }
+ else
+ wc = c;
+ }
+
+ /********** DIFFERENT for UTF8/UCS4 **********/
+ n_bytes += sizeof (gunichar);
+
+ next1:
+ in++;
+ }
+
+ if (high_surrogate && !items_read)
+ {
+ g_set_error_literal (error, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
+ _("Partial character sequence at end of input"));
+ goto err_out;
+ }
+
+ /* At this point, everything is valid, and we just need to convert
+ */
+ /********** DIFFERENT for UTF8/UCS4 **********/
+ result = g_malloc (n_bytes + 4);
+
+ high_surrogate = 0;
+ out = result;
+ in = str;
+ while (out < result + n_bytes)
+ {
+ gunichar2 c = *in;
+ gunichar wc;
+
+ if (c >= 0xdc00 && c < 0xe000) /* low surrogate */
+ {
+ wc = SURROGATE_VALUE (high_surrogate, c);
+ high_surrogate = 0;
+ }
+ else if (c >= 0xd800 && c < 0xdc00) /* high surrogate */
+ {
+ high_surrogate = c;
+ goto next2;
+ }
+ else
+ wc = c;
+
+ /********** DIFFERENT for UTF8/UCS4 **********/
+ *(gunichar *)out = wc;
+ out += sizeof (gunichar);
+
+ next2:
+ in++;
+ }
+
+ /********** DIFFERENT for UTF8/UCS4 **********/
+ *(gunichar *)out = 0;
+
+ if (items_written)
+ /********** DIFFERENT for UTF8/UCS4 **********/
+ *items_written = (out - result) / sizeof (gunichar);
+
+ err_out:
+ if (items_read)
+ *items_read = in - str;
+
+ return (gunichar *)result;
+}
+
+/**
+ * g_utf8_to_utf16:
+ * @str: a UTF-8 encoded string
+ * @len: the maximum length (number of characters) of @str to use.
+ * If @len < 0, then the string is nul-terminated.
+ * @items_read: location to store number of bytes read, or %NULL.
+ * If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be
+ * returned in case @str contains a trailing partial
+ * character. If an error occurs then the index of the
+ * invalid input is stored here.
+ * @items_written: location to store number of <type>gunichar2</type> written,
+ * or %NULL.
+ * The value stored here does not include the trailing 0.
+ * @error: location to store the error occuring, or %NULL to ignore
+ * errors. Any of the errors in #GConvertError other than
+ * %G_CONVERT_ERROR_NO_CONVERSION may occur.
+ *
+ * Convert a string from UTF-8 to UTF-16. A 0 character will be
+ * added to the result after the converted text.
+ *
+ * Return value: a pointer to a newly allocated UTF-16 string.
+ * This value must be freed with g_free(). If an
+ * error occurs, %NULL will be returned and
+ * @error set.
+ **/
+gunichar2 *
+g_utf8_to_utf16 (const gchar *str,
+ glong len,
+ glong *items_read,
+ glong *items_written,
+ GError **error)
+{
+ gunichar2 *result = NULL;
+ gint n16;
+ const gchar *in;
+ gint i;
+
+ g_return_val_if_fail (str != NULL, NULL);
+
+ in = str;
+ n16 = 0;
+ while ((len < 0 || str + len - in > 0) && *in)
+ {
+ gunichar wc = g_utf8_get_char_extended (in, len < 0 ? 6 : str + len - in);
+ if (wc & 0x80000000)
+ {
+ if (wc == (gunichar)-2)
+ {
+ if (items_read)
+ break;
+ else
+ g_set_error_literal (error, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
+ _("Partial character sequence at end of input"));
+ }
+ else
+ g_set_error_literal (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ _("Invalid byte sequence in conversion input"));
+
+ goto err_out;
+ }
+
+ if (wc < 0xd800)
+ n16 += 1;
+ else if (wc < 0xe000)
+ {
+ g_set_error_literal (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ _("Invalid sequence in conversion input"));
+
+ goto err_out;
+ }
+ else if (wc < 0x10000)
+ n16 += 1;
+ else if (wc < 0x110000)
+ n16 += 2;
+ else
+ {
+ g_set_error_literal (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ _("Character out of range for UTF-16"));
+
+ goto err_out;
+ }
+
+ in = g_utf8_next_char (in);
+ }
+
+ result = g_new (gunichar2, n16 + 1);
+
+ in = str;
+ for (i = 0; i < n16;)
+ {
+ gunichar wc = g_utf8_get_char (in);
+
+ if (wc < 0x10000)
+ {
+ result[i++] = wc;
+ }
+ else
+ {
+ result[i++] = (wc - 0x10000) / 0x400 + 0xd800;
+ result[i++] = (wc - 0x10000) % 0x400 + 0xdc00;
+ }
+
+ in = g_utf8_next_char (in);
+ }
+
+ result[i] = 0;
+
+ if (items_written)
+ *items_written = n16;
+
+ err_out:
+ if (items_read)
+ *items_read = in - str;
+
+ return result;
+}
+
+/**
+ * g_ucs4_to_utf16:
+ * @str: a UCS-4 encoded string
+ * @len: the maximum length (number of characters) of @str to use.
+ * If @len < 0, then the string is nul-terminated.
+ * @items_read: location to store number of bytes read, or %NULL.
+ * If an error occurs then the index of the invalid input
+ * is stored here.
+ * @items_written: location to store number of <type>gunichar2</type>
+ * written, or %NULL. The value stored here does not
+ * include the trailing 0.
+ * @error: location to store the error occuring, or %NULL to ignore
+ * errors. Any of the errors in #GConvertError other than
+ * %G_CONVERT_ERROR_NO_CONVERSION may occur.
+ *
+ * Convert a string from UCS-4 to UTF-16. A 0 character will be
+ * added to the result after the converted text.
+ *
+ * Return value: a pointer to a newly allocated UTF-16 string.
+ * This value must be freed with g_free(). If an
+ * error occurs, %NULL will be returned and
+ * @error set.
+ **/
+gunichar2 *
+g_ucs4_to_utf16 (const gunichar *str,
+ glong len,
+ glong *items_read,
+ glong *items_written,
+ GError **error)
+{
+ gunichar2 *result = NULL;
+ gint n16;
+ gint i, j;
+
+ n16 = 0;
+ i = 0;
+ while ((len < 0 || i < len) && str[i])
+ {
+ gunichar wc = str[i];
+
+ if (wc < 0xd800)
+ n16 += 1;
+ else if (wc < 0xe000)
+ {
+ g_set_error_literal (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ _("Invalid sequence in conversion input"));
+
+ goto err_out;
+ }
+ else if (wc < 0x10000)
+ n16 += 1;
+ else if (wc < 0x110000)
+ n16 += 2;
+ else
+ {
+ g_set_error_literal (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ _("Character out of range for UTF-16"));
+
+ goto err_out;
+ }
+
+ i++;
+ }
+
+ result = g_new (gunichar2, n16 + 1);
+
+ for (i = 0, j = 0; j < n16; i++)
+ {
+ gunichar wc = str[i];
+
+ if (wc < 0x10000)
+ {
+ result[j++] = wc;
+ }
+ else
+ {
+ result[j++] = (wc - 0x10000) / 0x400 + 0xd800;
+ result[j++] = (wc - 0x10000) % 0x400 + 0xdc00;
+ }
+ }
+ result[j] = 0;
+
+ if (items_written)
+ *items_written = n16;
+
+ err_out:
+ if (items_read)
+ *items_read = i;
+
+ return result;
+}
+
+#define CONTINUATION_CHAR \
+ G_STMT_START { \
+ if ((*(guchar *)p & 0xc0) != 0x80) /* 10xxxxxx */ \
+ goto error; \
+ val <<= 6; \
+ val |= (*(guchar *)p) & 0x3f; \
+ } G_STMT_END
+
+static const gchar *
+fast_validate (const char *str)
+
+{
+ gunichar val = 0;
+ gunichar min = 0;
+ const gchar *p;
+
+ for (p = str; *p; p++)
+ {
+ if (*(guchar *)p < 128)
+ /* done */;
+ else
+ {
+ const gchar *last;
+
+ last = p;
+ if ((*(guchar *)p & 0xe0) == 0xc0) /* 110xxxxx */
+ {
+ if (G_UNLIKELY ((*(guchar *)p & 0x1e) == 0))
+ goto error;
+ p++;
+ if (G_UNLIKELY ((*(guchar *)p & 0xc0) != 0x80)) /* 10xxxxxx */
+ goto error;
+ }
+ else
+ {
+ if ((*(guchar *)p & 0xf0) == 0xe0) /* 1110xxxx */
+ {
+ min = (1 << 11);
+ val = *(guchar *)p & 0x0f;
+ goto TWO_REMAINING;
+ }
+ else if ((*(guchar *)p & 0xf8) == 0xf0) /* 11110xxx */
+ {
+ min = (1 << 16);
+ val = *(guchar *)p & 0x07;
+ }
+ else
+ goto error;
+
+ p++;
+ CONTINUATION_CHAR;
+ TWO_REMAINING:
+ p++;
+ CONTINUATION_CHAR;
+ p++;
+ CONTINUATION_CHAR;
+
+ if (G_UNLIKELY (val < min))
+ goto error;
+
+ if (G_UNLIKELY (!UNICODE_VALID(val)))
+ goto error;
+ }
+
+ continue;
+
+ error:
+ return last;
+ }
+ }
+
+ return p;
+}
+
+static const gchar *
+fast_validate_len (const char *str,
+ gssize max_len)
+
+{
+ gunichar val = 0;
+ gunichar min = 0;
+ const gchar *p;
+
+ g_assert (max_len >= 0);
+
+ for (p = str; ((p - str) < max_len) && *p; p++)
+ {
+ if (*(guchar *)p < 128)
+ /* done */;
+ else
+ {
+ const gchar *last;
+
+ last = p;
+ if ((*(guchar *)p & 0xe0) == 0xc0) /* 110xxxxx */
+ {
+ if (G_UNLIKELY (max_len - (p - str) < 2))
+ goto error;
+
+ if (G_UNLIKELY ((*(guchar *)p & 0x1e) == 0))
+ goto error;
+ p++;
+ if (G_UNLIKELY ((*(guchar *)p & 0xc0) != 0x80)) /* 10xxxxxx */
+ goto error;
+ }
+ else
+ {
+ if ((*(guchar *)p & 0xf0) == 0xe0) /* 1110xxxx */
+ {
+ if (G_UNLIKELY (max_len - (p - str) < 3))
+ goto error;
+
+ min = (1 << 11);
+ val = *(guchar *)p & 0x0f;
+ goto TWO_REMAINING;
+ }
+ else if ((*(guchar *)p & 0xf8) == 0xf0) /* 11110xxx */
+ {
+ if (G_UNLIKELY (max_len - (p - str) < 4))
+ goto error;
+
+ min = (1 << 16);
+ val = *(guchar *)p & 0x07;
+ }
+ else
+ goto error;
+
+ p++;
+ CONTINUATION_CHAR;
+ TWO_REMAINING:
+ p++;
+ CONTINUATION_CHAR;
+ p++;
+ CONTINUATION_CHAR;
+
+ if (G_UNLIKELY (val < min))
+ goto error;
+ if (G_UNLIKELY (!UNICODE_VALID(val)))
+ goto error;
+ }
+
+ continue;
+
+ error:
+ return last;
+ }
+ }
+
+ return p;
+}
+
+/**
+ * g_utf8_validate:
+ * @str: a pointer to character data
+ * @max_len: max bytes to validate, or -1 to go until NUL
+ * @end: return location for end of valid data
+ *
+ * Validates UTF-8 encoded text. @str is the text to validate;
+ * if @str is nul-terminated, then @max_len can be -1, otherwise
+ * @max_len should be the number of bytes to validate.
+ * If @end is non-%NULL, then the end of the valid range
+ * will be stored there (i.e. the start of the first invalid
+ * character if some bytes were invalid, or the end of the text
+ * being validated otherwise).
+ *
+ * Note that g_utf8_validate() returns %FALSE if @max_len is
+ * positive and NUL is met before @max_len bytes have been read.
+ *
+ * Returns %TRUE if all of @str was valid. Many GLib and GTK+
+ * routines <emphasis>require</emphasis> valid UTF-8 as input;
+ * so data read from a file or the network should be checked
+ * with g_utf8_validate() before doing anything else with it.
+ *
+ * Return value: %TRUE if the text was valid UTF-8
+ **/
+gboolean
+g_utf8_validate (const char *str,
+ gssize max_len,
+ const gchar **end)
+
+{
+ const gchar *p;
+
+ if (max_len < 0)
+ p = fast_validate (str);
+ else
+ p = fast_validate_len (str, max_len);
+
+ if (end)
+ *end = p;
+
+ if ((max_len >= 0 && p != str + max_len) ||
+ (max_len < 0 && *p != '\0'))
+ return FALSE;
+ else
+ return TRUE;
+}
+
+/**
+ * g_unichar_validate:
+ * @ch: a Unicode character
+ *
+ * Checks whether @ch is a valid Unicode character. Some possible
+ * integer values of @ch will not be valid. 0 is considered a valid
+ * character, though it's normally a string terminator.
+ *
+ * Return value: %TRUE if @ch is a valid Unicode character
+ **/
+gboolean
+g_unichar_validate (gunichar ch)
+{
+ return UNICODE_VALID (ch);
+}
+
+/**
+ * g_utf8_strreverse:
+ * @str: a UTF-8 encoded string
+ * @len: the maximum length of @str to use, in bytes. If @len < 0,
+ * then the string is nul-terminated.
+ *
+ * Reverses a UTF-8 string. @str must be valid UTF-8 encoded text.
+ * (Use g_utf8_validate() on all text before trying to use UTF-8
+ * utility functions with it.)
+ *
+ * This function is intended for programmatic uses of reversed strings.
+ * It pays no attention to decomposed characters, combining marks, byte
+ * order marks, directional indicators (LRM, LRO, etc) and similar
+ * characters which might need special handling when reversing a string
+ * for display purposes.
+ *
+ * Note that unlike g_strreverse(), this function returns
+ * newly-allocated memory, which should be freed with g_free() when
+ * no longer needed.
+ *
+ * Returns: a newly-allocated string which is the reverse of @str.
+ *
+ * Since: 2.2
+ */
+gchar *
+g_utf8_strreverse (const gchar *str,
+ gssize len)
+{
+ gchar *r, *result;
+ const gchar *p;
+
+ if (len < 0)
+ len = strlen (str);
+
+ result = g_new (gchar, len + 1);
+ r = result + len;
+ p = str;
+ while (r > result)
+ {
+ gchar *m, skip = g_utf8_skip[*(guchar*) p];
+ r -= skip;
+ for (m = r; skip; skip--)
+ *m++ = *p++;
+ }
+ result[len] = 0;
+
+ return result;
+}
+
+
+gchar *
+_g_utf8_make_valid (const gchar *name)
+{
+ GString *string;
+ const gchar *remainder, *invalid;
+ gint remaining_bytes, valid_bytes;
+
+ string = NULL;
+ remainder = name;
+ remaining_bytes = strlen (name);
+
+ while (remaining_bytes != 0)
+ {
+ if (g_utf8_validate (remainder, remaining_bytes, &invalid))
+ break;
+ valid_bytes = invalid - remainder;
+
+ if (string == NULL)
+ string = g_string_sized_new (remaining_bytes);
+
+ g_string_append_len (string, remainder, valid_bytes);
+ /* append U+FFFD REPLACEMENT CHARACTER */
+ g_string_append (string, "\357\277\275");
+
+ remaining_bytes -= valid_bytes + 1;
+ remainder = invalid + 1;
+ }
+
+ if (string == NULL)
+ return g_strdup (name);
+
+ g_string_append (string, remainder);
+
+ g_assert (g_utf8_validate (string->str, -1, NULL));
+
+ return g_string_free (string, FALSE);
+}
+
+#endif
+
+#define __G_UTF8_C__
+#include "galiasdef.c"
diff --git a/support/glib/gutils.c b/support/glib/gutils.c
new file mode 100644
index 00000000..f88890cd
--- /dev/null
+++ b/support/glib/gutils.c
@@ -0,0 +1,3416 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1998 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+/*
+ * MT safe for the unix part, FIXME: make the win32 part MT safe as well.
+ */
+
+#include "config.h"
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <locale.h>
+#include <string.h>
+#include <ctype.h> /* For tolower() */
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+#include <sys/types.h>
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_CRT_EXTERNS_H
+#include <crt_externs.h> /* for _NSGetEnviron */
+#endif
+
+/* implement gutils's inline functions
+ */
+#define G_IMPLEMENT_INLINES 1
+#define __G_UTILS_C__
+#include "glib.h"
+#include "gprintfint.h"
+#include "gthreadprivate.h"
+#include "glibintl.h"
+#include "galias.h"
+
+#ifdef MAXPATHLEN
+#define G_PATH_LENGTH MAXPATHLEN
+#elif defined (PATH_MAX)
+#define G_PATH_LENGTH PATH_MAX
+#elif defined (_PC_PATH_MAX)
+#define G_PATH_LENGTH sysconf(_PC_PATH_MAX)
+#else
+#define G_PATH_LENGTH 2048
+#endif
+
+#ifdef G_PLATFORM_WIN32
+# define STRICT /* Strict typing, please */
+# include <windows.h>
+# undef STRICT
+# ifndef GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
+# define GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT 2
+# define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 4
+# endif
+# include <lmcons.h> /* For UNLEN */
+#endif /* G_PLATFORM_WIN32 */
+
+#ifdef G_OS_WIN32
+#if NOT_NEEDED_FOR_NAVIT
+# include <direct.h>
+#endif /* NOT_NEEDED_FOR_NAVIT */
+# include <shlobj.h>
+ /* older SDK (e.g. msvc 5.0) does not have these*/
+# ifndef CSIDL_MYMUSIC
+# define CSIDL_MYMUSIC 13
+# endif
+# ifndef CSIDL_MYVIDEO
+# define CSIDL_MYVIDEO 14
+# endif
+# ifndef CSIDL_INTERNET_CACHE
+# define CSIDL_INTERNET_CACHE 32
+# endif
+# ifndef CSIDL_COMMON_APPDATA
+# define CSIDL_COMMON_APPDATA 35
+# endif
+# ifndef CSIDL_MYPICTURES
+# define CSIDL_MYPICTURES 0x27
+# endif
+# ifndef CSIDL_COMMON_DOCUMENTS
+# define CSIDL_COMMON_DOCUMENTS 46
+# endif
+# ifndef CSIDL_PROFILE
+# define CSIDL_PROFILE 40
+# endif
+# include <process.h>
+#endif
+
+#ifdef HAVE_CARBON
+#include <CoreServices/CoreServices.h>
+#endif
+
+#ifdef HAVE_CODESET
+#include <langinfo.h>
+#endif
+
+#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+#include <libintl.h>
+#endif
+
+#if NOT_NEEDED_FOR_NAVIT
+const guint glib_major_version = GLIB_MAJOR_VERSION;
+const guint glib_minor_version = GLIB_MINOR_VERSION;
+const guint glib_micro_version = GLIB_MICRO_VERSION;
+const guint glib_interface_age = GLIB_INTERFACE_AGE;
+const guint glib_binary_age = GLIB_BINARY_AGE;
+
+#ifdef G_PLATFORM_WIN32
+
+static HMODULE glib_dll = NULL;
+
+#ifdef DLL_EXPORT
+
+BOOL WINAPI
+DllMain (HINSTANCE hinstDLL,
+ DWORD fdwReason,
+ LPVOID lpvReserved)
+{
+ if (fdwReason == DLL_PROCESS_ATTACH)
+ glib_dll = hinstDLL;
+
+ return TRUE;
+}
+
+#endif
+
+gchar *
+_glib_get_installation_directory (void)
+{
+#ifdef DLL_EXPORT
+ if (glib_dll == NULL)
+ return NULL;
+#endif
+ /* In a static build of GLib just use the application's .exe file's
+ * installation directory...
+ */
+ return g_win32_get_package_installation_directory_of_module (glib_dll);
+}
+
+#endif
+
+/**
+ * glib_check_version:
+ * @required_major: the required major version.
+ * @required_minor: the required minor version.
+ * @required_micro: the required micro version.
+ *
+ * Checks that the GLib library in use is compatible with the
+ * given version. Generally you would pass in the constants
+ * #GLIB_MAJOR_VERSION, #GLIB_MINOR_VERSION, #GLIB_MICRO_VERSION
+ * as the three arguments to this function; that produces
+ * a check that the library in use is compatible with
+ * the version of GLib the application or module was compiled
+ * against.
+ *
+ * Compatibility is defined by two things: first the version
+ * of the running library is newer than the version
+ * @required_major.required_minor.@required_micro. Second
+ * the running library must be binary compatible with the
+ * version @required_major.required_minor.@required_micro
+ * (same major version.)
+ *
+ * Return value: %NULL if the GLib library is compatible with the
+ * given version, or a string describing the version mismatch.
+ * The returned string is owned by GLib and must not be modified
+ * or freed.
+ *
+ * Since: 2.6
+ **/
+const gchar *
+glib_check_version (guint required_major,
+ guint required_minor,
+ guint required_micro)
+{
+ gint glib_effective_micro = 100 * GLIB_MINOR_VERSION + GLIB_MICRO_VERSION;
+ gint required_effective_micro = 100 * required_minor + required_micro;
+
+ if (required_major > GLIB_MAJOR_VERSION)
+ return "GLib version too old (major mismatch)";
+ if (required_major < GLIB_MAJOR_VERSION)
+ return "GLib version too new (major mismatch)";
+ if (required_effective_micro < glib_effective_micro - GLIB_BINARY_AGE)
+ return "GLib version too new (micro mismatch)";
+ if (required_effective_micro > glib_effective_micro)
+ return "GLib version too old (micro mismatch)";
+ return NULL;
+}
+
+#if !defined (HAVE_MEMMOVE) && !defined (HAVE_WORKING_BCOPY)
+/**
+ * g_memmove:
+ * @dest: the destination address to copy the bytes to.
+ * @src: the source address to copy the bytes from.
+ * @len: the number of bytes to copy.
+ *
+ * Copies a block of memory @len bytes long, from @src to @dest.
+ * The source and destination areas may overlap.
+ *
+ * In order to use this function, you must include
+ * <filename>string.h</filename> yourself, because this macro will
+ * typically simply resolve to memmove() and GLib does not include
+ * <filename>string.h</filename> for you.
+ */
+void
+g_memmove (gpointer dest,
+ gconstpointer src,
+ gulong len)
+{
+ gchar* destptr = dest;
+ const gchar* srcptr = src;
+ if (src + len < dest || dest + len < src)
+ {
+ bcopy (src, dest, len);
+ return;
+ }
+ else if (dest <= src)
+ {
+ while (len--)
+ *(destptr++) = *(srcptr++);
+ }
+ else
+ {
+ destptr += len;
+ srcptr += len;
+ while (len--)
+ *(--destptr) = *(--srcptr);
+ }
+}
+#endif /* !HAVE_MEMMOVE && !HAVE_WORKING_BCOPY */
+
+#ifdef G_OS_WIN32
+#undef g_atexit
+#endif
+
+/**
+ * g_atexit:
+ * @func: the function to call on normal program termination.
+ *
+ * Specifies a function to be called at normal program termination.
+ *
+ * Since GLib 2.8.2, on Windows g_atexit() actually is a preprocessor
+ * macro that maps to a call to the atexit() function in the C
+ * library. This means that in case the code that calls g_atexit(),
+ * i.e. atexit(), is in a DLL, the function will be called when the
+ * DLL is detached from the program. This typically makes more sense
+ * than that the function is called when the GLib DLL is detached,
+ * which happened earlier when g_atexit() was a function in the GLib
+ * DLL.
+ *
+ * The behaviour of atexit() in the context of dynamically loaded
+ * modules is not formally specified and varies wildly.
+ *
+ * On POSIX systems, calling g_atexit() (or atexit()) in a dynamically
+ * loaded module which is unloaded before the program terminates might
+ * well cause a crash at program exit.
+ *
+ * Some POSIX systems implement atexit() like Windows, and have each
+ * dynamically loaded module maintain an own atexit chain that is
+ * called when the module is unloaded.
+ *
+ * On other POSIX systems, before a dynamically loaded module is
+ * unloaded, the registered atexit functions (if any) residing in that
+ * module are called, regardless where the code that registered them
+ * resided. This is presumably the most robust approach.
+ *
+ * As can be seen from the above, for portability it's best to avoid
+ * calling g_atexit() (or atexit()) except in the main executable of a
+ * program.
+ */
+void
+g_atexit (GVoidFunc func)
+{
+ gint result;
+ const gchar *error = NULL;
+
+ /* keep this in sync with glib.h */
+
+#ifdef G_NATIVE_ATEXIT
+ result = ATEXIT (func);
+ if (result)
+ error = g_strerror (errno);
+#elif defined (HAVE_ATEXIT)
+# ifdef NeXT /* @#%@! NeXTStep */
+ result = !atexit ((void (*)(void)) func);
+ if (result)
+ error = g_strerror (errno);
+# else
+ result = atexit ((void (*)(void)) func);
+ if (result)
+ error = g_strerror (errno);
+# endif /* NeXT */
+#elif defined (HAVE_ON_EXIT)
+ result = on_exit ((void (*)(int, void *)) func, NULL);
+ if (result)
+ error = g_strerror (errno);
+#else
+ result = 0;
+ error = "no implementation";
+#endif /* G_NATIVE_ATEXIT */
+
+ if (error)
+ g_error ("Could not register atexit() function: %s", error);
+}
+
+/* Based on execvp() from GNU Libc.
+ * Some of this code is cut-and-pasted into gspawn.c
+ */
+
+static gchar*
+my_strchrnul (const gchar *str,
+ gchar c)
+{
+ gchar *p = (gchar*)str;
+ while (*p && (*p != c))
+ ++p;
+
+ return p;
+}
+
+#ifdef G_OS_WIN32
+
+static gchar *inner_find_program_in_path (const gchar *program);
+
+gchar*
+g_find_program_in_path (const gchar *program)
+{
+ const gchar *last_dot = strrchr (program, '.');
+
+ if (last_dot == NULL ||
+ strchr (last_dot, '\\') != NULL ||
+ strchr (last_dot, '/') != NULL)
+ {
+ const gint program_length = strlen (program);
+ gchar *pathext = g_build_path (";",
+ ".exe;.cmd;.bat;.com",
+ g_getenv ("PATHEXT"),
+ NULL);
+ gchar *p;
+ gchar *decorated_program;
+ gchar *retval;
+
+ p = pathext;
+ do
+ {
+ gchar *q = my_strchrnul (p, ';');
+
+ decorated_program = g_malloc (program_length + (q-p) + 1);
+ memcpy (decorated_program, program, program_length);
+ memcpy (decorated_program+program_length, p, q-p);
+ decorated_program [program_length + (q-p)] = '\0';
+
+ retval = inner_find_program_in_path (decorated_program);
+ g_free (decorated_program);
+
+ if (retval != NULL)
+ {
+ g_free (pathext);
+ return retval;
+ }
+ p = q;
+ } while (*p++ != '\0');
+ g_free (pathext);
+ return NULL;
+ }
+ else
+ return inner_find_program_in_path (program);
+}
+
+#endif
+
+/**
+ * g_find_program_in_path:
+ * @program: a program name in the GLib file name encoding
+ *
+ * Locates the first executable named @program in the user's path, in the
+ * same way that execvp() would locate it. Returns an allocated string
+ * with the absolute path name, or %NULL if the program is not found in
+ * the path. If @program is already an absolute path, returns a copy of
+ * @program if @program exists and is executable, and %NULL otherwise.
+ *
+ * On Windows, if @program does not have a file type suffix, tries
+ * with the suffixes .exe, .cmd, .bat and .com, and the suffixes in
+ * the <envar>PATHEXT</envar> environment variable.
+ *
+ * On Windows, it looks for the file in the same way as CreateProcess()
+ * would. This means first in the directory where the executing
+ * program was loaded from, then in the current directory, then in the
+ * Windows 32-bit system directory, then in the Windows directory, and
+ * finally in the directories in the <envar>PATH</envar> environment
+ * variable. If the program is found, the return value contains the
+ * full name including the type suffix.
+ *
+ * Return value: absolute path, or %NULL
+ **/
+#ifdef G_OS_WIN32
+static gchar *
+inner_find_program_in_path (const gchar *program)
+#else
+gchar*
+g_find_program_in_path (const gchar *program)
+#endif
+{
+ const gchar *path, *p;
+ gchar *name, *freeme;
+#ifdef G_OS_WIN32
+ const gchar *path_copy;
+ gchar *filename = NULL, *appdir = NULL;
+ gchar *sysdir = NULL, *windir = NULL;
+ int n;
+ wchar_t wfilename[MAXPATHLEN], wsysdir[MAXPATHLEN],
+ wwindir[MAXPATHLEN];
+#endif
+ gsize len;
+ gsize pathlen;
+
+ g_return_val_if_fail (program != NULL, NULL);
+
+ /* If it is an absolute path, or a relative path including subdirectories,
+ * don't look in PATH.
+ */
+ if (g_path_is_absolute (program)
+ || strchr (program, G_DIR_SEPARATOR) != NULL
+#ifdef G_OS_WIN32
+ || strchr (program, '/') != NULL
+#endif
+ )
+ {
+ if (g_file_test (program, G_FILE_TEST_IS_EXECUTABLE) &&
+ !g_file_test (program, G_FILE_TEST_IS_DIR))
+ return g_strdup (program);
+ else
+ return NULL;
+ }
+
+ path = g_getenv ("PATH");
+#if defined(G_OS_UNIX) || defined(G_OS_BEOS)
+ if (path == NULL)
+ {
+ /* There is no `PATH' in the environment. The default
+ * search path in GNU libc is the current directory followed by
+ * the path `confstr' returns for `_CS_PATH'.
+ */
+
+ /* In GLib we put . last, for security, and don't use the
+ * unportable confstr(); UNIX98 does not actually specify
+ * what to search if PATH is unset. POSIX may, dunno.
+ */
+
+ path = "/bin:/usr/bin:.";
+ }
+#else
+ n = GetModuleFileNameW (NULL, wfilename, MAXPATHLEN);
+ if (n > 0 && n < MAXPATHLEN)
+ filename = g_utf16_to_utf8 (wfilename, -1, NULL, NULL, NULL);
+
+ n = GetSystemDirectoryW (wsysdir, MAXPATHLEN);
+ if (n > 0 && n < MAXPATHLEN)
+ sysdir = g_utf16_to_utf8 (wsysdir, -1, NULL, NULL, NULL);
+
+ n = GetWindowsDirectoryW (wwindir, MAXPATHLEN);
+ if (n > 0 && n < MAXPATHLEN)
+ windir = g_utf16_to_utf8 (wwindir, -1, NULL, NULL, NULL);
+
+ if (filename)
+ {
+ appdir = g_path_get_dirname (filename);
+ g_free (filename);
+ }
+
+ path = g_strdup (path);
+
+ if (windir)
+ {
+ const gchar *tem = path;
+ path = g_strconcat (windir, ";", path, NULL);
+ g_free ((gchar *) tem);
+ g_free (windir);
+ }
+
+ if (sysdir)
+ {
+ const gchar *tem = path;
+ path = g_strconcat (sysdir, ";", path, NULL);
+ g_free ((gchar *) tem);
+ g_free (sysdir);
+ }
+
+ {
+ const gchar *tem = path;
+ path = g_strconcat (".;", path, NULL);
+ g_free ((gchar *) tem);
+ }
+
+ if (appdir)
+ {
+ const gchar *tem = path;
+ path = g_strconcat (appdir, ";", path, NULL);
+ g_free ((gchar *) tem);
+ g_free (appdir);
+ }
+
+ path_copy = path;
+#endif
+
+ len = strlen (program) + 1;
+ pathlen = strlen (path);
+ freeme = name = g_malloc (pathlen + len + 1);
+
+ /* Copy the file name at the top, including '\0' */
+ memcpy (name + pathlen + 1, program, len);
+ name = name + pathlen;
+ /* And add the slash before the filename */
+ *name = G_DIR_SEPARATOR;
+
+ p = path;
+ do
+ {
+ char *startp;
+
+ path = p;
+ p = my_strchrnul (path, G_SEARCHPATH_SEPARATOR);
+
+ if (p == path)
+ /* Two adjacent colons, or a colon at the beginning or the end
+ * of `PATH' means to search the current directory.
+ */
+ startp = name + 1;
+ else
+ startp = memcpy (name - (p - path), path, p - path);
+
+ if (g_file_test (startp, G_FILE_TEST_IS_EXECUTABLE) &&
+ !g_file_test (startp, G_FILE_TEST_IS_DIR))
+ {
+ gchar *ret;
+ ret = g_strdup (startp);
+ g_free (freeme);
+#ifdef G_OS_WIN32
+ g_free ((gchar *) path_copy);
+#endif
+ return ret;
+ }
+ }
+ while (*p++ != '\0');
+
+ g_free (freeme);
+#ifdef G_OS_WIN32
+ g_free ((gchar *) path_copy);
+#endif
+
+ return NULL;
+}
+
+static gboolean
+debug_key_matches (const gchar *key,
+ const gchar *token,
+ guint length)
+{
+ for (; length; length--, key++, token++)
+ {
+ char k = (*key == '_') ? '-' : tolower (*key );
+ char t = (*token == '_') ? '-' : tolower (*token);
+
+ if (k != t)
+ return FALSE;
+ }
+
+ return *key == '\0';
+}
+
+/**
+ * g_parse_debug_string:
+ * @string: a list of debug options separated by colons, spaces, or
+ * commas; or the string "all" to set all flags, or %NULL.
+ * @keys: pointer to an array of #GDebugKey which associate
+ * strings with bit flags.
+ * @nkeys: the number of #GDebugKey<!-- -->s in the array.
+ *
+ * Parses a string containing debugging options
+ * into a %guint containing bit flags. This is used
+ * within GDK and GTK+ to parse the debug options passed on the
+ * command line or through environment variables.
+ *
+ * Returns: the combined set of bit flags.
+ */
+guint
+g_parse_debug_string (const gchar *string,
+ const GDebugKey *keys,
+ guint nkeys)
+{
+ guint i;
+ guint result = 0;
+
+ if (string == NULL)
+ return 0;
+
+ /* this function is used by gmem.c/gslice.c initialization code,
+ * so introducing malloc dependencies here would require adaptions
+ * of those code portions.
+ */
+
+ if (!g_ascii_strcasecmp (string, "all"))
+ {
+ for (i=0; i<nkeys; i++)
+ result |= keys[i].value;
+ }
+ else
+ {
+ const gchar *p = string;
+ const gchar *q;
+
+ while (*p)
+ {
+ q = strpbrk (p, ":;, \t");
+ if (!q)
+ q = p + strlen(p);
+
+ for (i = 0; i < nkeys; i++)
+ if (debug_key_matches (keys[i].key, p, q - p))
+ result |= keys[i].value;
+
+ p = q;
+ if (*p)
+ p++;
+ }
+ }
+
+ return result;
+}
+
+/**
+ * g_basename:
+ * @file_name: the name of the file.
+ *
+ * Gets the name of the file without any leading directory components.
+ * It returns a pointer into the given file name string.
+ *
+ * Return value: the name of the file without any leading directory components.
+ *
+ * Deprecated:2.2: Use g_path_get_basename() instead, but notice that
+ * g_path_get_basename() allocates new memory for the returned string, unlike
+ * this function which returns a pointer into the argument.
+ **/
+G_CONST_RETURN gchar*
+g_basename (const gchar *file_name)
+{
+ register gchar *base;
+
+ g_return_val_if_fail (file_name != NULL, NULL);
+
+ base = strrchr (file_name, G_DIR_SEPARATOR);
+
+#ifdef G_OS_WIN32
+ {
+ gchar *q = strrchr (file_name, '/');
+ if (base == NULL || (q != NULL && q > base))
+ base = q;
+ }
+#endif
+
+ if (base)
+ return base + 1;
+
+#ifdef G_OS_WIN32
+ if (g_ascii_isalpha (file_name[0]) && file_name[1] == ':')
+ return (gchar*) file_name + 2;
+#endif /* G_OS_WIN32 */
+
+ return (gchar*) file_name;
+}
+
+/**
+ * g_path_get_basename:
+ * @file_name: the name of the file.
+ *
+ * Gets the last component of the filename. If @file_name ends with a
+ * directory separator it gets the component before the last slash. If
+ * @file_name consists only of directory separators (and on Windows,
+ * possibly a drive letter), a single separator is returned. If
+ * @file_name is empty, it gets ".".
+ *
+ * Return value: a newly allocated string containing the last component of
+ * the filename.
+ */
+gchar*
+g_path_get_basename (const gchar *file_name)
+{
+ register gssize base;
+ register gssize last_nonslash;
+ gsize len;
+ gchar *retval;
+
+ g_return_val_if_fail (file_name != NULL, NULL);
+
+ if (file_name[0] == '\0')
+ /* empty string */
+ return g_strdup (".");
+
+ last_nonslash = strlen (file_name) - 1;
+
+ while (last_nonslash >= 0 && G_IS_DIR_SEPARATOR (file_name [last_nonslash]))
+ last_nonslash--;
+
+ if (last_nonslash == -1)
+ /* string only containing slashes */
+ return g_strdup (G_DIR_SEPARATOR_S);
+
+#ifdef G_OS_WIN32
+ if (last_nonslash == 1 && g_ascii_isalpha (file_name[0]) && file_name[1] == ':')
+ /* string only containing slashes and a drive */
+ return g_strdup (G_DIR_SEPARATOR_S);
+#endif /* G_OS_WIN32 */
+
+ base = last_nonslash;
+
+ while (base >=0 && !G_IS_DIR_SEPARATOR (file_name [base]))
+ base--;
+
+#ifdef G_OS_WIN32
+ if (base == -1 && g_ascii_isalpha (file_name[0]) && file_name[1] == ':')
+ base = 1;
+#endif /* G_OS_WIN32 */
+
+ len = last_nonslash - base;
+ retval = g_malloc (len + 1);
+ memcpy (retval, file_name + base + 1, len);
+ retval [len] = '\0';
+ return retval;
+}
+
+/**
+ * g_path_is_absolute:
+ * @file_name: a file name.
+ *
+ * Returns %TRUE if the given @file_name is an absolute file name,
+ * i.e. it contains a full path from the root directory such as "/usr/local"
+ * on UNIX or "C:\windows" on Windows systems.
+ *
+ * Returns: %TRUE if @file_name is an absolute path.
+ */
+gboolean
+g_path_is_absolute (const gchar *file_name)
+{
+ g_return_val_if_fail (file_name != NULL, FALSE);
+
+ if (G_IS_DIR_SEPARATOR (file_name[0]))
+ return TRUE;
+
+#ifdef G_OS_WIN32
+ /* Recognize drive letter on native Windows */
+ if (g_ascii_isalpha (file_name[0]) &&
+ file_name[1] == ':' && G_IS_DIR_SEPARATOR (file_name[2]))
+ return TRUE;
+#endif /* G_OS_WIN32 */
+
+ return FALSE;
+}
+
+/**
+ * g_path_skip_root:
+ * @file_name: a file name.
+ *
+ * Returns a pointer into @file_name after the root component, i.e. after
+ * the "/" in UNIX or "C:\" under Windows. If @file_name is not an absolute
+ * path it returns %NULL.
+ *
+ * Returns: a pointer into @file_name after the root component.
+ */
+G_CONST_RETURN gchar*
+g_path_skip_root (const gchar *file_name)
+{
+ g_return_val_if_fail (file_name != NULL, NULL);
+
+#ifdef G_PLATFORM_WIN32
+ /* Skip \\server\share or //server/share */
+ if (G_IS_DIR_SEPARATOR (file_name[0]) &&
+ G_IS_DIR_SEPARATOR (file_name[1]) &&
+ file_name[2] &&
+ !G_IS_DIR_SEPARATOR (file_name[2]))
+ {
+ gchar *p;
+
+ p = strchr (file_name + 2, G_DIR_SEPARATOR);
+#ifdef G_OS_WIN32
+ {
+ gchar *q = strchr (file_name + 2, '/');
+ if (p == NULL || (q != NULL && q < p))
+ p = q;
+ }
+#endif
+ if (p &&
+ p > file_name + 2 &&
+ p[1])
+ {
+ file_name = p + 1;
+
+ while (file_name[0] && !G_IS_DIR_SEPARATOR (file_name[0]))
+ file_name++;
+
+ /* Possibly skip a backslash after the share name */
+ if (G_IS_DIR_SEPARATOR (file_name[0]))
+ file_name++;
+
+ return (gchar *)file_name;
+ }
+ }
+#endif
+
+ /* Skip initial slashes */
+ if (G_IS_DIR_SEPARATOR (file_name[0]))
+ {
+ while (G_IS_DIR_SEPARATOR (file_name[0]))
+ file_name++;
+ return (gchar *)file_name;
+ }
+
+#ifdef G_OS_WIN32
+ /* Skip X:\ */
+ if (g_ascii_isalpha (file_name[0]) && file_name[1] == ':' && G_IS_DIR_SEPARATOR (file_name[2]))
+ return (gchar *)file_name + 3;
+#endif
+
+ return NULL;
+}
+
+/**
+ * g_path_get_dirname:
+ * @file_name: the name of the file.
+ *
+ * Gets the directory components of a file name. If the file name has no
+ * directory components "." is returned. The returned string should be
+ * freed when no longer needed.
+ *
+ * Returns: the directory components of the file.
+ */
+gchar*
+g_path_get_dirname (const gchar *file_name)
+{
+ register gchar *base;
+ register gsize len;
+
+ g_return_val_if_fail (file_name != NULL, NULL);
+
+ base = strrchr (file_name, G_DIR_SEPARATOR);
+#ifdef G_OS_WIN32
+ {
+ gchar *q = strrchr (file_name, '/');
+ if (base == NULL || (q != NULL && q > base))
+ base = q;
+ }
+#endif
+ if (!base)
+ {
+#ifdef G_OS_WIN32
+ if (g_ascii_isalpha (file_name[0]) && file_name[1] == ':')
+ {
+ gchar drive_colon_dot[4];
+
+ drive_colon_dot[0] = file_name[0];
+ drive_colon_dot[1] = ':';
+ drive_colon_dot[2] = '.';
+ drive_colon_dot[3] = '\0';
+
+ return g_strdup (drive_colon_dot);
+ }
+#endif
+ return g_strdup (".");
+ }
+
+ while (base > file_name && G_IS_DIR_SEPARATOR (*base))
+ base--;
+
+#ifdef G_OS_WIN32
+ /* base points to the char before the last slash.
+ *
+ * In case file_name is the root of a drive (X:\) or a child of the
+ * root of a drive (X:\foo), include the slash.
+ *
+ * In case file_name is the root share of an UNC path
+ * (\\server\share), add a slash, returning \\server\share\ .
+ *
+ * In case file_name is a direct child of a share in an UNC path
+ * (\\server\share\foo), include the slash after the share name,
+ * returning \\server\share\ .
+ */
+ if (base == file_name + 1 && g_ascii_isalpha (file_name[0]) && file_name[1] == ':')
+ base++;
+ else if (G_IS_DIR_SEPARATOR (file_name[0]) &&
+ G_IS_DIR_SEPARATOR (file_name[1]) &&
+ file_name[2] &&
+ !G_IS_DIR_SEPARATOR (file_name[2]) &&
+ base >= file_name + 2)
+ {
+ const gchar *p = file_name + 2;
+ while (*p && !G_IS_DIR_SEPARATOR (*p))
+ p++;
+ if (p == base + 1)
+ {
+ len = (guint) strlen (file_name) + 1;
+ base = g_new (gchar, len + 1);
+ strcpy (base, file_name);
+ base[len-1] = G_DIR_SEPARATOR;
+ base[len] = 0;
+ return base;
+ }
+ if (G_IS_DIR_SEPARATOR (*p))
+ {
+ p++;
+ while (*p && !G_IS_DIR_SEPARATOR (*p))
+ p++;
+ if (p == base + 1)
+ base++;
+ }
+ }
+#endif
+
+ len = (guint) 1 + base - file_name;
+
+ base = g_new (gchar, len + 1);
+ g_memmove (base, file_name, len);
+ base[len] = 0;
+
+ return base;
+}
+
+/**
+ * g_get_current_dir:
+ *
+ * Gets the current directory.
+ * The returned string should be freed when no longer needed. The encoding
+ * of the returned string is system defined. On Windows, it is always UTF-8.
+ *
+ * Returns: the current directory.
+ */
+gchar*
+g_get_current_dir (void)
+{
+#ifdef G_OS_WIN32
+
+ gchar *dir = NULL;
+ wchar_t dummy[2], *wdir;
+ int len;
+
+ len = GetCurrentDirectoryW (2, dummy);
+ wdir = g_new (wchar_t, len);
+
+ if (GetCurrentDirectoryW (len, wdir) == len - 1)
+ dir = g_utf16_to_utf8 (wdir, -1, NULL, NULL, NULL);
+
+ g_free (wdir);
+
+ if (dir == NULL)
+ dir = g_strdup ("\\");
+
+ return dir;
+
+#else
+
+ gchar *buffer = NULL;
+ gchar *dir = NULL;
+ static gulong max_len = 0;
+
+ if (max_len == 0)
+ max_len = (G_PATH_LENGTH == -1) ? 2048 : G_PATH_LENGTH;
+
+ /* We don't use getcwd(3) on SUNOS, because, it does a popen("pwd")
+ * and, if that wasn't bad enough, hangs in doing so.
+ */
+#if (defined (sun) && !defined (__SVR4)) || !defined(HAVE_GETCWD)
+ buffer = g_new (gchar, max_len + 1);
+ *buffer = 0;
+ dir = getwd (buffer);
+#else /* !sun || !HAVE_GETCWD */
+ while (max_len < G_MAXULONG / 2)
+ {
+ g_free (buffer);
+ buffer = g_new (gchar, max_len + 1);
+ *buffer = 0;
+ dir = getcwd (buffer, max_len);
+
+ if (dir || errno != ERANGE)
+ break;
+
+ max_len *= 2;
+ }
+#endif /* !sun || !HAVE_GETCWD */
+
+ if (!dir || !*buffer)
+ {
+ /* hm, should we g_error() out here?
+ * this can happen if e.g. "./" has mode \0000
+ */
+ buffer[0] = G_DIR_SEPARATOR;
+ buffer[1] = 0;
+ }
+
+ dir = g_strdup (buffer);
+ g_free (buffer);
+
+ return dir;
+#endif /* !Win32 */
+}
+
+/**
+ * g_getenv:
+ * @variable: the environment variable to get, in the GLib file name encoding.
+ *
+ * Returns the value of an environment variable. The name and value
+ * are in the GLib file name encoding. On UNIX, this means the actual
+ * bytes which might or might not be in some consistent character set
+ * and encoding. On Windows, it is in UTF-8. On Windows, in case the
+ * environment variable's value contains references to other
+ * environment variables, they are expanded.
+ *
+ * Return value: the value of the environment variable, or %NULL if
+ * the environment variable is not found. The returned string may be
+ * overwritten by the next call to g_getenv(), g_setenv() or
+ * g_unsetenv().
+ **/
+G_CONST_RETURN gchar*
+g_getenv (const gchar *variable)
+{
+#ifndef G_OS_WIN32
+
+ g_return_val_if_fail (variable != NULL, NULL);
+
+ return getenv (variable);
+
+#else /* G_OS_WIN32 */
+
+ GQuark quark;
+ gchar *value;
+ wchar_t dummy[2], *wname, *wvalue;
+ int len;
+
+ g_return_val_if_fail (variable != NULL, NULL);
+ g_return_val_if_fail (g_utf8_validate (variable, -1, NULL), NULL);
+
+ /* On Windows NT, it is relatively typical that environment
+ * variables contain references to other environment variables. If
+ * so, use ExpandEnvironmentStrings(). (In an ideal world, such
+ * environment variables would be stored in the Registry as
+ * REG_EXPAND_SZ type values, and would then get automatically
+ * expanded before a program sees them. But there is broken software
+ * that stores environment variables as REG_SZ values even if they
+ * contain references to other environment variables.)
+ */
+
+ wname = g_utf8_to_utf16 (variable, -1, NULL, NULL, NULL);
+
+ len = GetEnvironmentVariableW (wname, dummy, 2);
+
+ if (len == 0)
+ {
+ g_free (wname);
+ return NULL;
+ }
+ else if (len == 1)
+ len = 2;
+
+ wvalue = g_new (wchar_t, len);
+
+ if (GetEnvironmentVariableW (wname, wvalue, len) != len - 1)
+ {
+ g_free (wname);
+ g_free (wvalue);
+ return NULL;
+ }
+
+ if (wcschr (wvalue, L'%') != NULL)
+ {
+ wchar_t *tem = wvalue;
+
+ len = ExpandEnvironmentStringsW (wvalue, dummy, 2);
+
+ if (len > 0)
+ {
+ wvalue = g_new (wchar_t, len);
+
+ if (ExpandEnvironmentStringsW (tem, wvalue, len) != len)
+ {
+ g_free (wvalue);
+ wvalue = tem;
+ }
+ else
+ g_free (tem);
+ }
+ }
+
+ value = g_utf16_to_utf8 (wvalue, -1, NULL, NULL, NULL);
+
+ g_free (wname);
+ g_free (wvalue);
+
+ quark = g_quark_from_string (value);
+ g_free (value);
+
+ return g_quark_to_string (quark);
+
+#endif /* G_OS_WIN32 */
+}
+
+/* _g_getenv_nomalloc
+ * this function does a getenv() without doing any kind of allocation
+ * through glib. it's suitable for chars <= 127 only (both, for the
+ * variable name and the contents) and for contents < 1024 chars in
+ * length. also, it aliases "" to a NULL return value.
+ **/
+const gchar*
+_g_getenv_nomalloc (const gchar *variable,
+ gchar buffer[1024])
+{
+ const gchar *retval = getenv (variable);
+ if (retval && retval[0])
+ {
+ gint l = strlen (retval);
+ if (l < 1024)
+ {
+ strncpy (buffer, retval, l);
+ buffer[l] = 0;
+ return buffer;
+ }
+ }
+ return NULL;
+}
+
+/**
+ * g_setenv:
+ * @variable: the environment variable to set, must not contain '='.
+ * @value: the value for to set the variable to.
+ * @overwrite: whether to change the variable if it already exists.
+ *
+ * Sets an environment variable. Both the variable's name and value
+ * should be in the GLib file name encoding. On UNIX, this means that
+ * they can be any sequence of bytes. On Windows, they should be in
+ * UTF-8.
+ *
+ * Note that on some systems, when variables are overwritten, the memory
+ * used for the previous variables and its value isn't reclaimed.
+ *
+ * Returns: %FALSE if the environment variable couldn't be set.
+ *
+ * Since: 2.4
+ */
+gboolean
+g_setenv (const gchar *variable,
+ const gchar *value,
+ gboolean overwrite)
+{
+#ifndef G_OS_WIN32
+
+ gint result;
+#ifndef HAVE_SETENV
+ gchar *string;
+#endif
+
+ g_return_val_if_fail (variable != NULL, FALSE);
+ g_return_val_if_fail (strchr (variable, '=') == NULL, FALSE);
+
+#ifdef HAVE_SETENV
+ result = setenv (variable, value, overwrite);
+#else
+ if (!overwrite && getenv (variable) != NULL)
+ return TRUE;
+
+ /* This results in a leak when you overwrite existing
+ * settings. It would be fairly easy to fix this by keeping
+ * our own parallel array or hash table.
+ */
+ string = g_strconcat (variable, "=", value, NULL);
+ result = putenv (string);
+#endif
+ return result == 0;
+
+#else /* G_OS_WIN32 */
+
+ gboolean retval;
+ wchar_t *wname, *wvalue, *wassignment;
+ gchar *tem;
+
+ g_return_val_if_fail (variable != NULL, FALSE);
+ g_return_val_if_fail (strchr (variable, '=') == NULL, FALSE);
+ g_return_val_if_fail (g_utf8_validate (variable, -1, NULL), FALSE);
+ g_return_val_if_fail (g_utf8_validate (value, -1, NULL), FALSE);
+
+ if (!overwrite && g_getenv (variable) != NULL)
+ return TRUE;
+
+ /* We want to (if possible) set both the environment variable copy
+ * kept by the C runtime and the one kept by the system.
+ *
+ * We can't use only the C runtime's putenv or _wputenv() as that
+ * won't work for arbitrary Unicode strings in a "non-Unicode" app
+ * (with main() and not wmain()). In a "main()" app the C runtime
+ * initializes the C runtime's environment table by converting the
+ * real (wide char) environment variables to system codepage, thus
+ * breaking those that aren't representable in the system codepage.
+ *
+ * As the C runtime's putenv() will also set the system copy, we do
+ * the putenv() first, then call SetEnvironmentValueW ourselves.
+ */
+
+ wname = g_utf8_to_utf16 (variable, -1, NULL, NULL, NULL);
+ wvalue = g_utf8_to_utf16 (value, -1, NULL, NULL, NULL);
+ tem = g_strconcat (variable, "=", value, NULL);
+ wassignment = g_utf8_to_utf16 (tem, -1, NULL, NULL, NULL);
+
+ g_free (tem);
+ _wputenv (wassignment);
+ g_free (wassignment);
+
+ retval = (SetEnvironmentVariableW (wname, wvalue) != 0);
+
+ g_free (wname);
+ g_free (wvalue);
+
+ return retval;
+
+#endif /* G_OS_WIN32 */
+}
+
+#ifdef HAVE__NSGETENVIRON
+#define environ (*_NSGetEnviron())
+#elif !defined(G_OS_WIN32)
+
+/* According to the Single Unix Specification, environ is not in
+ * any system header, although unistd.h often declares it.
+ */
+extern char **environ;
+#endif
+
+/**
+ * g_unsetenv:
+ * @variable: the environment variable to remove, must not contain '='.
+ *
+ * Removes an environment variable from the environment.
+ *
+ * Note that on some systems, when variables are overwritten, the memory
+ * used for the previous variables and its value isn't reclaimed.
+ * Furthermore, this function can't be guaranteed to operate in a
+ * threadsafe way.
+ *
+ * Since: 2.4
+ **/
+void
+g_unsetenv (const gchar *variable)
+{
+#ifndef G_OS_WIN32
+
+#ifdef HAVE_UNSETENV
+ g_return_if_fail (variable != NULL);
+ g_return_if_fail (strchr (variable, '=') == NULL);
+
+ unsetenv (variable);
+#else /* !HAVE_UNSETENV */
+ int len;
+ gchar **e, **f;
+
+ g_return_if_fail (variable != NULL);
+ g_return_if_fail (strchr (variable, '=') == NULL);
+
+ len = strlen (variable);
+
+ /* Mess directly with the environ array.
+ * This seems to be the only portable way to do this.
+ *
+ * Note that we remove *all* environment entries for
+ * the variable name, not just the first.
+ */
+ e = f = environ;
+ while (*e != NULL)
+ {
+ if (strncmp (*e, variable, len) != 0 || (*e)[len] != '=')
+ {
+ *f = *e;
+ f++;
+ }
+ e++;
+ }
+ *f = NULL;
+#endif /* !HAVE_UNSETENV */
+
+#else /* G_OS_WIN32 */
+
+ wchar_t *wname, *wassignment;
+ gchar *tem;
+
+ g_return_if_fail (variable != NULL);
+ g_return_if_fail (strchr (variable, '=') == NULL);
+ g_return_if_fail (g_utf8_validate (variable, -1, NULL));
+
+ wname = g_utf8_to_utf16 (variable, -1, NULL, NULL, NULL);
+ tem = g_strconcat (variable, "=", NULL);
+ wassignment = g_utf8_to_utf16 (tem, -1, NULL, NULL, NULL);
+
+ g_free (tem);
+ _wputenv (wassignment);
+ g_free (wassignment);
+
+ SetEnvironmentVariableW (wname, NULL);
+
+ g_free (wname);
+
+#endif /* G_OS_WIN32 */
+}
+
+/**
+ * g_listenv:
+ *
+ * Gets the names of all variables set in the environment.
+ *
+ * Returns: a %NULL-terminated list of strings which must be freed
+ * with g_strfreev().
+ *
+ * Programs that want to be portable to Windows should typically use
+ * this function and g_getenv() instead of using the environ array
+ * from the C library directly. On Windows, the strings in the environ
+ * array are in system codepage encoding, while in most of the typical
+ * use cases for environment variables in GLib-using programs you want
+ * the UTF-8 encoding that this function and g_getenv() provide.
+ *
+ * Since: 2.8
+ */
+gchar **
+g_listenv (void)
+{
+#ifndef G_OS_WIN32
+ gchar **result, *eq;
+ gint len, i, j;
+
+ len = g_strv_length (environ);
+ result = g_new0 (gchar *, len + 1);
+
+ j = 0;
+ for (i = 0; i < len; i++)
+ {
+ eq = strchr (environ[i], '=');
+ if (eq)
+ result[j++] = g_strndup (environ[i], eq - environ[i]);
+ }
+
+ result[j] = NULL;
+
+ return result;
+#else
+ gchar **result, *eq;
+ gint len = 0, j;
+ wchar_t *p, *q;
+
+ p = (wchar_t *) GetEnvironmentStringsW ();
+ if (p != NULL)
+ {
+ q = p;
+ while (*q)
+ {
+ q += wcslen (q) + 1;
+ len++;
+ }
+ }
+ result = g_new0 (gchar *, len + 1);
+
+ j = 0;
+ q = p;
+ while (*q)
+ {
+ result[j] = g_utf16_to_utf8 (q, -1, NULL, NULL, NULL);
+ if (result[j] != NULL)
+ {
+ eq = strchr (result[j], '=');
+ if (eq && eq > result[j])
+ {
+ *eq = '\0';
+ j++;
+ }
+ else
+ g_free (result[j]);
+ }
+ q += wcslen (q) + 1;
+ }
+ result[j] = NULL;
+ FreeEnvironmentStringsW (p);
+
+ return result;
+#endif
+}
+
+G_LOCK_DEFINE_STATIC (g_utils_global);
+
+static gchar *g_tmp_dir = NULL;
+static gchar *g_user_name = NULL;
+static gchar *g_real_name = NULL;
+static gchar *g_home_dir = NULL;
+static gchar *g_host_name = NULL;
+
+#ifdef G_OS_WIN32
+/* System codepage versions of the above, kept at file level so that they,
+ * too, are produced only once.
+ */
+static gchar *g_tmp_dir_cp = NULL;
+static gchar *g_user_name_cp = NULL;
+static gchar *g_real_name_cp = NULL;
+static gchar *g_home_dir_cp = NULL;
+#endif
+
+static gchar *g_user_data_dir = NULL;
+static gchar **g_system_data_dirs = NULL;
+static gchar *g_user_cache_dir = NULL;
+static gchar *g_user_config_dir = NULL;
+static gchar **g_system_config_dirs = NULL;
+
+static gchar **g_user_special_dirs = NULL;
+
+/* fifteen minutes of fame for everybody */
+#define G_USER_DIRS_EXPIRE 15 * 60
+
+#ifdef G_OS_WIN32
+
+static gchar *
+get_special_folder (int csidl)
+{
+ wchar_t path[MAX_PATH+1];
+ HRESULT hr;
+ LPITEMIDLIST pidl = NULL;
+ BOOL b;
+ gchar *retval = NULL;
+
+ hr = SHGetSpecialFolderLocation (NULL, csidl, &pidl);
+ if (hr == S_OK)
+ {
+ b = SHGetPathFromIDListW (pidl, path);
+ if (b)
+ retval = g_utf16_to_utf8 (path, -1, NULL, NULL, NULL);
+ CoTaskMemFree (pidl);
+ }
+ return retval;
+}
+
+static char *
+get_windows_directory_root (void)
+{
+ wchar_t wwindowsdir[MAX_PATH];
+
+ if (GetWindowsDirectoryW (wwindowsdir, G_N_ELEMENTS (wwindowsdir)))
+ {
+ /* Usually X:\Windows, but in terminal server environments
+ * might be an UNC path, AFAIK.
+ */
+ char *windowsdir = g_utf16_to_utf8 (wwindowsdir, -1, NULL, NULL, NULL);
+ char *p;
+
+ if (windowsdir == NULL)
+ return g_strdup ("C:\\");
+
+ p = (char *) g_path_skip_root (windowsdir);
+ if (G_IS_DIR_SEPARATOR (p[-1]) && p[-2] != ':')
+ p--;
+ *p = '\0';
+ return windowsdir;
+ }
+ else
+ return g_strdup ("C:\\");
+}
+
+#endif
+
+/* HOLDS: g_utils_global_lock */
+static void
+g_get_any_init_do (void)
+{
+ gchar hostname[100];
+
+ g_tmp_dir = g_strdup (g_getenv ("TMPDIR"));
+ if (!g_tmp_dir)
+ g_tmp_dir = g_strdup (g_getenv ("TMP"));
+ if (!g_tmp_dir)
+ g_tmp_dir = g_strdup (g_getenv ("TEMP"));
+
+#ifdef G_OS_WIN32
+ if (!g_tmp_dir)
+ g_tmp_dir = get_windows_directory_root ();
+#else
+#ifdef P_tmpdir
+ if (!g_tmp_dir)
+ {
+ gsize k;
+ g_tmp_dir = g_strdup (P_tmpdir);
+ k = strlen (g_tmp_dir);
+ if (k > 1 && G_IS_DIR_SEPARATOR (g_tmp_dir[k - 1]))
+ g_tmp_dir[k - 1] = '\0';
+ }
+#endif
+
+ if (!g_tmp_dir)
+ {
+ g_tmp_dir = g_strdup ("/tmp");
+ }
+#endif /* !G_OS_WIN32 */
+
+#ifdef G_OS_WIN32
+ /* We check $HOME first for Win32, though it is a last resort for Unix
+ * where we prefer the results of getpwuid().
+ */
+ g_home_dir = g_strdup (g_getenv ("HOME"));
+
+ /* Only believe HOME if it is an absolute path and exists */
+ if (g_home_dir)
+ {
+ if (!(g_path_is_absolute (g_home_dir) &&
+ g_file_test (g_home_dir, G_FILE_TEST_IS_DIR)))
+ {
+ g_free (g_home_dir);
+ g_home_dir = NULL;
+ }
+ }
+
+ /* In case HOME is Unix-style (it happens), convert it to
+ * Windows style.
+ */
+ if (g_home_dir)
+ {
+ gchar *p;
+ while ((p = strchr (g_home_dir, '/')) != NULL)
+ *p = '\\';
+ }
+
+ if (!g_home_dir)
+ {
+ /* USERPROFILE is probably the closest equivalent to $HOME? */
+ if (g_getenv ("USERPROFILE") != NULL)
+ g_home_dir = g_strdup (g_getenv ("USERPROFILE"));
+ }
+
+ if (!g_home_dir)
+ g_home_dir = get_special_folder (CSIDL_PROFILE);
+
+ if (!g_home_dir)
+ g_home_dir = get_windows_directory_root ();
+#endif /* G_OS_WIN32 */
+
+#ifdef HAVE_PWD_H
+ {
+ struct passwd *pw = NULL;
+ gpointer buffer = NULL;
+ gint error;
+ gchar *logname;
+
+# if defined (HAVE_POSIX_GETPWUID_R) || defined (HAVE_NONPOSIX_GETPWUID_R)
+ struct passwd pwd;
+# ifdef _SC_GETPW_R_SIZE_MAX
+ /* This reurns the maximum length */
+ glong bufsize = sysconf (_SC_GETPW_R_SIZE_MAX);
+
+ if (bufsize < 0)
+ bufsize = 64;
+# else /* _SC_GETPW_R_SIZE_MAX */
+ glong bufsize = 64;
+# endif /* _SC_GETPW_R_SIZE_MAX */
+
+ logname = (gchar *) g_getenv ("LOGNAME");
+
+ do
+ {
+ g_free (buffer);
+ /* we allocate 6 extra bytes to work around a bug in
+ * Mac OS < 10.3. See #156446
+ */
+ buffer = g_malloc (bufsize + 6);
+ errno = 0;
+
+# ifdef HAVE_POSIX_GETPWUID_R
+ if (logname) {
+ error = getpwnam_r (logname, &pwd, buffer, bufsize, &pw);
+ if (!pw || (pw->pw_uid != getuid ())) {
+ /* LOGNAME is lying, fall back to looking up the uid */
+ error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw);
+ }
+ } else {
+ error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw);
+ }
+ error = error < 0 ? errno : error;
+# else /* HAVE_NONPOSIX_GETPWUID_R */
+ /* HPUX 11 falls into the HAVE_POSIX_GETPWUID_R case */
+# if defined(_AIX) || defined(__hpux)
+ error = getpwuid_r (getuid (), &pwd, buffer, bufsize);
+ pw = error == 0 ? &pwd : NULL;
+# else /* !_AIX */
+ if (logname) {
+ pw = getpwnam_r (logname, &pwd, buffer, bufsize);
+ if (!pw || (pw->pw_uid != getuid ())) {
+ /* LOGNAME is lying, fall back to looking up the uid */
+ pw = getpwuid_r (getuid (), &pwd, buffer, bufsize);
+ }
+ } else {
+ pw = getpwuid_r (getuid (), &pwd, buffer, bufsize);
+ }
+ error = pw ? 0 : errno;
+# endif /* !_AIX */
+# endif /* HAVE_NONPOSIX_GETPWUID_R */
+
+ if (!pw)
+ {
+ /* we bail out prematurely if the user id can't be found
+ * (should be pretty rare case actually), or if the buffer
+ * should be sufficiently big and lookups are still not
+ * successfull.
+ */
+ if (error == 0 || error == ENOENT)
+ {
+ g_warning ("getpwuid_r(): failed due to unknown user id (%lu)",
+ (gulong) getuid ());
+ break;
+ }
+ if (bufsize > 32 * 1024)
+ {
+ g_warning ("getpwuid_r(): failed due to: %s.",
+ g_strerror (error));
+ break;
+ }
+
+ bufsize *= 2;
+ }
+ }
+ while (!pw);
+# endif /* HAVE_POSIX_GETPWUID_R || HAVE_NONPOSIX_GETPWUID_R */
+
+ if (!pw)
+ {
+ setpwent ();
+ pw = getpwuid (getuid ());
+ endpwent ();
+ }
+ if (pw)
+ {
+ g_user_name = g_strdup (pw->pw_name);
+
+ if (pw->pw_gecos && *pw->pw_gecos != '\0')
+ {
+ gchar **gecos_fields;
+ gchar **name_parts;
+
+ /* split the gecos field and substitute '&' */
+ gecos_fields = g_strsplit (pw->pw_gecos, ",", 0);
+ name_parts = g_strsplit (gecos_fields[0], "&", 0);
+ pw->pw_name[0] = g_ascii_toupper (pw->pw_name[0]);
+ g_real_name = g_strjoinv (pw->pw_name, name_parts);
+ g_strfreev (gecos_fields);
+ g_strfreev (name_parts);
+ }
+
+ if (!g_home_dir)
+ g_home_dir = g_strdup (pw->pw_dir);
+ }
+ g_free (buffer);
+ }
+
+#else /* !HAVE_PWD_H */
+
+#ifdef G_OS_WIN32
+ {
+ guint len = UNLEN+1;
+ wchar_t buffer[UNLEN+1];
+
+ if (GetUserNameW (buffer, (LPDWORD) &len))
+ {
+ g_user_name = g_utf16_to_utf8 (buffer, -1, NULL, NULL, NULL);
+ g_real_name = g_strdup (g_user_name);
+ }
+ }
+#endif /* G_OS_WIN32 */
+
+#endif /* !HAVE_PWD_H */
+
+#ifndef G_OS_WIN32
+ if (!g_home_dir)
+ g_home_dir = g_strdup (g_getenv ("HOME"));
+#endif
+
+#ifdef __EMX__
+ /* change '\\' in %HOME% to '/' */
+ g_strdelimit (g_home_dir, "\\",'/');
+#endif
+ if (!g_user_name)
+ g_user_name = g_strdup ("somebody");
+ if (!g_real_name)
+ g_real_name = g_strdup ("Unknown");
+
+ {
+#ifndef G_OS_WIN32
+ gboolean hostname_fail = (gethostname (hostname, sizeof (hostname)) == -1);
+#else
+ DWORD size = sizeof (hostname);
+ gboolean hostname_fail = (!GetComputerName (hostname, &size));
+#endif
+ g_host_name = g_strdup (hostname_fail ? "localhost" : hostname);
+ }
+
+#ifdef G_OS_WIN32
+ g_tmp_dir_cp = g_locale_from_utf8 (g_tmp_dir, -1, NULL, NULL, NULL);
+ g_user_name_cp = g_locale_from_utf8 (g_user_name, -1, NULL, NULL, NULL);
+ g_real_name_cp = g_locale_from_utf8 (g_real_name, -1, NULL, NULL, NULL);
+
+ if (!g_tmp_dir_cp)
+ g_tmp_dir_cp = g_strdup ("\\");
+ if (!g_user_name_cp)
+ g_user_name_cp = g_strdup ("somebody");
+ if (!g_real_name_cp)
+ g_real_name_cp = g_strdup ("Unknown");
+
+ /* home_dir might be NULL, unlike tmp_dir, user_name and
+ * real_name.
+ */
+ if (g_home_dir)
+ g_home_dir_cp = g_locale_from_utf8 (g_home_dir, -1, NULL, NULL, NULL);
+ else
+ g_home_dir_cp = NULL;
+#endif /* G_OS_WIN32 */
+}
+
+static inline void
+g_get_any_init (void)
+{
+ if (!g_tmp_dir)
+ g_get_any_init_do ();
+}
+
+static inline void
+g_get_any_init_locked (void)
+{
+ G_LOCK (g_utils_global);
+ g_get_any_init ();
+ G_UNLOCK (g_utils_global);
+}
+
+
+/**
+ * g_get_user_name:
+ *
+ * Gets the user name of the current user. The encoding of the returned
+ * string is system-defined. On UNIX, it might be the preferred file name
+ * encoding, or something else, and there is no guarantee that it is even
+ * consistent on a machine. On Windows, it is always UTF-8.
+ *
+ * Returns: the user name of the current user.
+ */
+G_CONST_RETURN gchar*
+g_get_user_name (void)
+{
+ g_get_any_init_locked ();
+ return g_user_name;
+}
+
+/**
+ * g_get_real_name:
+ *
+ * Gets the real name of the user. This usually comes from the user's entry
+ * in the <filename>passwd</filename> file. The encoding of the returned
+ * string is system-defined. (On Windows, it is, however, always UTF-8.)
+ * If the real user name cannot be determined, the string "Unknown" is
+ * returned.
+ *
+ * Returns: the user's real name.
+ */
+G_CONST_RETURN gchar*
+g_get_real_name (void)
+{
+ g_get_any_init_locked ();
+ return g_real_name;
+}
+
+/**
+ * g_get_home_dir:
+ *
+ * Gets the current user's home directory as defined in the
+ * password database.
+ *
+ * Note that in contrast to traditional UNIX tools, this function
+ * prefers <filename>passwd</filename> entries over the <envar>HOME</envar>
+ * environment variable.
+ *
+ * One of the reasons for this decision is that applications in many
+ * cases need special handling to deal with the case where
+ * <envar>HOME</envar> is
+ * <simplelist>
+ * <member>Not owned by the user</member>
+ * <member>Not writeable</member>
+ * <member>Not even readable</member>
+ * </simplelist>
+ * Since applications are in general <emphasis>not</emphasis> written
+ * to deal with these situations it was considered better to make
+ * g_get_home_dir() not pay attention to <envar>HOME</envar> and to
+ * return the real home directory for the user. If applications
+ * want to pay attention to <envar>HOME</envar>, they can do:
+ * |[
+ * const char *homedir = g_getenv ("HOME");
+ * if (!homedir)
+ * homedir = g_get_home_dir (<!-- -->);
+ * ]|
+ *
+ * Returns: the current user's home directory
+ */
+G_CONST_RETURN gchar*
+g_get_home_dir (void)
+{
+ g_get_any_init_locked ();
+ return g_home_dir;
+}
+
+/**
+ * g_get_tmp_dir:
+ *
+ * Gets the directory to use for temporary files. This is found from
+ * inspecting the environment variables <envar>TMPDIR</envar>,
+ * <envar>TMP</envar>, and <envar>TEMP</envar> in that order. If none
+ * of those are defined "/tmp" is returned on UNIX and "C:\" on Windows.
+ * The encoding of the returned string is system-defined. On Windows,
+ * it is always UTF-8. The return value is never %NULL.
+ *
+ * Returns: the directory to use for temporary files.
+ */
+G_CONST_RETURN gchar*
+g_get_tmp_dir (void)
+{
+ g_get_any_init_locked ();
+ return g_tmp_dir;
+}
+
+/**
+ * g_get_host_name:
+ *
+ * Return a name for the machine.
+ *
+ * The returned name is not necessarily a fully-qualified domain name,
+ * or even present in DNS or some other name service at all. It need
+ * not even be unique on your local network or site, but usually it
+ * is. Callers should not rely on the return value having any specific
+ * properties like uniqueness for security purposes. Even if the name
+ * of the machine is changed while an application is running, the
+ * return value from this function does not change. The returned
+ * string is owned by GLib and should not be modified or freed. If no
+ * name can be determined, a default fixed string "localhost" is
+ * returned.
+ *
+ * Returns: the host name of the machine.
+ *
+ * Since: 2.8
+ */
+const gchar *
+g_get_host_name (void)
+{
+ g_get_any_init_locked ();
+ return g_host_name;
+}
+
+G_LOCK_DEFINE_STATIC (g_prgname);
+static gchar *g_prgname = NULL;
+
+/**
+ * g_get_prgname:
+ *
+ * Gets the name of the program. This name should <emphasis>not</emphasis>
+ * be localized, contrast with g_get_application_name().
+ * (If you are using GDK or GTK+ the program name is set in gdk_init(),
+ * which is called by gtk_init(). The program name is found by taking
+ * the last component of <literal>argv[0]</literal>.)
+ *
+ * Returns: the name of the program. The returned string belongs
+ * to GLib and must not be modified or freed.
+ */
+gchar*
+g_get_prgname (void)
+{
+ gchar* retval;
+
+ G_LOCK (g_prgname);
+#ifdef G_OS_WIN32
+ if (g_prgname == NULL)
+ {
+ static gboolean beenhere = FALSE;
+
+ if (!beenhere)
+ {
+ gchar *utf8_buf = NULL;
+ wchar_t buf[MAX_PATH+1];
+
+ beenhere = TRUE;
+ if (GetModuleFileNameW (GetModuleHandle (NULL),
+ buf, G_N_ELEMENTS (buf)) > 0)
+ utf8_buf = g_utf16_to_utf8 (buf, -1, NULL, NULL, NULL);
+
+ if (utf8_buf)
+ {
+ g_prgname = g_path_get_basename (utf8_buf);
+ g_free (utf8_buf);
+ }
+ }
+ }
+#endif
+ retval = g_prgname;
+ G_UNLOCK (g_prgname);
+
+ return retval;
+}
+
+/**
+ * g_set_prgname:
+ * @prgname: the name of the program.
+ *
+ * Sets the name of the program. This name should <emphasis>not</emphasis>
+ * be localized, contrast with g_set_application_name(). Note that for
+ * thread-safety reasons this function can only be called once.
+ */
+void
+g_set_prgname (const gchar *prgname)
+{
+ G_LOCK (g_prgname);
+ g_free (g_prgname);
+ g_prgname = g_strdup (prgname);
+ G_UNLOCK (g_prgname);
+}
+
+G_LOCK_DEFINE_STATIC (g_application_name);
+static gchar *g_application_name = NULL;
+
+/**
+ * g_get_application_name:
+ *
+ * Gets a human-readable name for the application, as set by
+ * g_set_application_name(). This name should be localized if
+ * possible, and is intended for display to the user. Contrast with
+ * g_get_prgname(), which gets a non-localized name. If
+ * g_set_application_name() has not been called, returns the result of
+ * g_get_prgname() (which may be %NULL if g_set_prgname() has also not
+ * been called).
+ *
+ * Return value: human-readable application name. may return %NULL
+ *
+ * Since: 2.2
+ **/
+G_CONST_RETURN gchar*
+g_get_application_name (void)
+{
+ gchar* retval;
+
+ G_LOCK (g_application_name);
+ retval = g_application_name;
+ G_UNLOCK (g_application_name);
+
+ if (retval == NULL)
+ return g_get_prgname ();
+
+ return retval;
+}
+
+/**
+ * g_set_application_name:
+ * @application_name: localized name of the application
+ *
+ * Sets a human-readable name for the application. This name should be
+ * localized if possible, and is intended for display to the user.
+ * Contrast with g_set_prgname(), which sets a non-localized name.
+ * g_set_prgname() will be called automatically by gtk_init(),
+ * but g_set_application_name() will not.
+ *
+ * Note that for thread safety reasons, this function can only
+ * be called once.
+ *
+ * The application name will be used in contexts such as error messages,
+ * or when displaying an application's name in the task list.
+ *
+ * Since: 2.2
+ **/
+void
+g_set_application_name (const gchar *application_name)
+{
+ gboolean already_set = FALSE;
+
+ G_LOCK (g_application_name);
+ if (g_application_name)
+ already_set = TRUE;
+ else
+ g_application_name = g_strdup (application_name);
+ G_UNLOCK (g_application_name);
+
+ if (already_set)
+ g_warning ("g_set_application() name called multiple times");
+}
+
+/**
+ * g_get_user_data_dir:
+ *
+ * Returns a base directory in which to access application data such
+ * as icons that is customized for a particular user.
+ *
+ * On UNIX platforms this is determined using the mechanisms described in
+ * the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
+ * XDG Base Directory Specification</ulink>
+ *
+ * Return value: a string owned by GLib that must not be modified
+ * or freed.
+ * Since: 2.6
+ **/
+G_CONST_RETURN gchar*
+g_get_user_data_dir (void)
+{
+ gchar *data_dir;
+
+ G_LOCK (g_utils_global);
+
+ if (!g_user_data_dir)
+ {
+#ifdef G_OS_WIN32
+ data_dir = get_special_folder (CSIDL_PERSONAL);
+#else
+ data_dir = (gchar *) g_getenv ("XDG_DATA_HOME");
+
+ if (data_dir && data_dir[0])
+ data_dir = g_strdup (data_dir);
+#endif
+ if (!data_dir || !data_dir[0])
+ {
+ g_get_any_init ();
+
+ if (g_home_dir)
+ data_dir = g_build_filename (g_home_dir, ".local",
+ "share", NULL);
+ else
+ data_dir = g_build_filename (g_tmp_dir, g_user_name, ".local",
+ "share", NULL);
+ }
+
+ g_user_data_dir = data_dir;
+ }
+ else
+ data_dir = g_user_data_dir;
+
+ G_UNLOCK (g_utils_global);
+
+ return data_dir;
+}
+
+static void
+g_init_user_config_dir (void)
+{
+ gchar *config_dir;
+
+ if (!g_user_config_dir)
+ {
+#ifdef G_OS_WIN32
+ config_dir = get_special_folder (CSIDL_APPDATA);
+#else
+ config_dir = (gchar *) g_getenv ("XDG_CONFIG_HOME");
+
+ if (config_dir && config_dir[0])
+ config_dir = g_strdup (config_dir);
+#endif
+ if (!config_dir || !config_dir[0])
+ {
+ g_get_any_init ();
+
+ if (g_home_dir)
+ config_dir = g_build_filename (g_home_dir, ".config", NULL);
+ else
+ config_dir = g_build_filename (g_tmp_dir, g_user_name, ".config", NULL);
+ }
+
+ g_user_config_dir = config_dir;
+ }
+}
+
+/**
+ * g_get_user_config_dir:
+ *
+ * Returns a base directory in which to store user-specific application
+ * configuration information such as user preferences and settings.
+ *
+ * On UNIX platforms this is determined using the mechanisms described in
+ * the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
+ * XDG Base Directory Specification</ulink>
+ *
+ * Return value: a string owned by GLib that must not be modified
+ * or freed.
+ * Since: 2.6
+ **/
+G_CONST_RETURN gchar*
+g_get_user_config_dir (void)
+{
+ G_LOCK (g_utils_global);
+
+ g_init_user_config_dir ();
+
+ G_UNLOCK (g_utils_global);
+
+ return g_user_config_dir;
+}
+
+/**
+ * g_get_user_cache_dir:
+ *
+ * Returns a base directory in which to store non-essential, cached
+ * data specific to particular user.
+ *
+ * On UNIX platforms this is determined using the mechanisms described in
+ * the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
+ * XDG Base Directory Specification</ulink>
+ *
+ * Return value: a string owned by GLib that must not be modified
+ * or freed.
+ * Since: 2.6
+ **/
+G_CONST_RETURN gchar*
+g_get_user_cache_dir (void)
+{
+ gchar *cache_dir;
+
+ G_LOCK (g_utils_global);
+
+ if (!g_user_cache_dir)
+ {
+#ifdef G_OS_WIN32
+ cache_dir = get_special_folder (CSIDL_INTERNET_CACHE); /* XXX correct? */
+#else
+ cache_dir = (gchar *) g_getenv ("XDG_CACHE_HOME");
+
+ if (cache_dir && cache_dir[0])
+ cache_dir = g_strdup (cache_dir);
+#endif
+ if (!cache_dir || !cache_dir[0])
+ {
+ g_get_any_init ();
+
+ if (g_home_dir)
+ cache_dir = g_build_filename (g_home_dir, ".cache", NULL);
+ else
+ cache_dir = g_build_filename (g_tmp_dir, g_user_name, ".cache", NULL);
+ }
+ g_user_cache_dir = cache_dir;
+ }
+ else
+ cache_dir = g_user_cache_dir;
+
+ G_UNLOCK (g_utils_global);
+
+ return cache_dir;
+}
+
+#ifdef HAVE_CARBON
+
+static gchar *
+find_folder (OSType type)
+{
+ gchar *filename = NULL;
+ FSRef found;
+
+ if (FSFindFolder (kUserDomain, type, kDontCreateFolder, &found) == noErr)
+ {
+ CFURLRef url = CFURLCreateFromFSRef (kCFAllocatorSystemDefault, &found);
+
+ if (url)
+ {
+ CFStringRef path = CFURLCopyFileSystemPath (url, kCFURLPOSIXPathStyle);
+
+ if (path)
+ {
+ filename = g_strdup (CFStringGetCStringPtr (path, kCFStringEncodingUTF8));
+
+ if (! filename)
+ {
+ filename = g_new0 (gchar, CFStringGetLength (path) * 3 + 1);
+
+ CFStringGetCString (path, filename,
+ CFStringGetLength (path) * 3 + 1,
+ kCFStringEncodingUTF8);
+ }
+
+ CFRelease (path);
+ }
+
+ CFRelease (url);
+ }
+ }
+
+ return filename;
+}
+
+static void
+load_user_special_dirs (void)
+{
+ g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] = find_folder (kDesktopFolderType);
+ g_user_special_dirs[G_USER_DIRECTORY_DOCUMENTS] = find_folder (kDocumentsFolderType);
+ g_user_special_dirs[G_USER_DIRECTORY_DOWNLOAD] = find_folder (kDesktopFolderType); /* XXX correct ? */
+ g_user_special_dirs[G_USER_DIRECTORY_MUSIC] = find_folder (kMusicDocumentsFolderType);
+ g_user_special_dirs[G_USER_DIRECTORY_PICTURES] = find_folder (kPictureDocumentsFolderType);
+ g_user_special_dirs[G_USER_DIRECTORY_PUBLIC_SHARE] = NULL;
+ g_user_special_dirs[G_USER_DIRECTORY_TEMPLATES] = NULL;
+ g_user_special_dirs[G_USER_DIRECTORY_VIDEOS] = find_folder (kMovieDocumentsFolderType);
+}
+
+#endif /* HAVE_CARBON */
+
+#if defined(G_OS_WIN32)
+static void
+load_user_special_dirs (void)
+{
+ typedef HRESULT (WINAPI *t_SHGetKnownFolderPath) (const GUID *rfid,
+ DWORD dwFlags,
+ HANDLE hToken,
+ PWSTR *ppszPath);
+ t_SHGetKnownFolderPath p_SHGetKnownFolderPath;
+ static const GUID FOLDERID_Downloads =
+ { 0x374de290, 0x123f, 0x4565, { 0x91, 0x64, 0x39, 0xc4, 0x92, 0x5e, 0x46, 0x7b } };
+ static const GUID FOLDERID_Public =
+ { 0xDFDF76A2, 0xC82A, 0x4D63, { 0x90, 0x6A, 0x56, 0x44, 0xAC, 0x45, 0x73, 0x85 } };
+ wchar_t *wcp;
+
+ p_SHGetKnownFolderPath = (t_SHGetKnownFolderPath) GetProcAddress (LoadLibrary ("shell32.dll"),
+ "SHGetKnownFolderPath");
+
+ g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] = get_special_folder (CSIDL_DESKTOPDIRECTORY);
+ g_user_special_dirs[G_USER_DIRECTORY_DOCUMENTS] = get_special_folder (CSIDL_PERSONAL);
+
+ if (p_SHGetKnownFolderPath == NULL)
+ {
+ g_user_special_dirs[G_USER_DIRECTORY_DOWNLOAD] = get_special_folder (CSIDL_DESKTOPDIRECTORY);
+ }
+ else
+ {
+ wcp = NULL;
+ (*p_SHGetKnownFolderPath) (&FOLDERID_Downloads, 0, NULL, &wcp);
+ g_user_special_dirs[G_USER_DIRECTORY_DOWNLOAD] = g_utf16_to_utf8 (wcp, -1, NULL, NULL, NULL);
+ if (g_user_special_dirs[G_USER_DIRECTORY_DOWNLOAD] == NULL)
+ g_user_special_dirs[G_USER_DIRECTORY_DOWNLOAD] = get_special_folder (CSIDL_DESKTOPDIRECTORY);
+ CoTaskMemFree (wcp);
+ }
+
+ g_user_special_dirs[G_USER_DIRECTORY_MUSIC] = get_special_folder (CSIDL_MYMUSIC);
+ g_user_special_dirs[G_USER_DIRECTORY_PICTURES] = get_special_folder (CSIDL_MYPICTURES);
+
+ if (p_SHGetKnownFolderPath == NULL)
+ {
+ /* XXX */
+ g_user_special_dirs[G_USER_DIRECTORY_PUBLIC_SHARE] = get_special_folder (CSIDL_COMMON_DOCUMENTS);
+ }
+ else
+ {
+ wcp = NULL;
+ (*p_SHGetKnownFolderPath) (&FOLDERID_Public, 0, NULL, &wcp);
+ g_user_special_dirs[G_USER_DIRECTORY_PUBLIC_SHARE] = g_utf16_to_utf8 (wcp, -1, NULL, NULL, NULL);
+ if (g_user_special_dirs[G_USER_DIRECTORY_PUBLIC_SHARE] == NULL)
+ g_user_special_dirs[G_USER_DIRECTORY_PUBLIC_SHARE] = get_special_folder (CSIDL_COMMON_DOCUMENTS);
+ CoTaskMemFree (wcp);
+ }
+
+ g_user_special_dirs[G_USER_DIRECTORY_TEMPLATES] = get_special_folder (CSIDL_TEMPLATES);
+ g_user_special_dirs[G_USER_DIRECTORY_VIDEOS] = get_special_folder (CSIDL_MYVIDEO);
+}
+#endif /* G_OS_WIN32 */
+
+static void g_init_user_config_dir (void);
+
+#if defined(G_OS_UNIX) && !defined(HAVE_CARBON)
+
+/* adapted from xdg-user-dir-lookup.c
+ *
+ * Copyright (C) 2007 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+static void
+load_user_special_dirs (void)
+{
+ gchar *config_file;
+ gchar *data;
+ gchar **lines;
+ gint n_lines, i;
+
+ g_init_user_config_dir ();
+ config_file = g_build_filename (g_user_config_dir,
+ "user-dirs.dirs",
+ NULL);
+
+ if (!g_file_get_contents (config_file, &data, NULL, NULL))
+ {
+ g_free (config_file);
+ return;
+ }
+
+ lines = g_strsplit (data, "\n", -1);
+ n_lines = g_strv_length (lines);
+ g_free (data);
+
+ for (i = 0; i < n_lines; i++)
+ {
+ gchar *buffer = lines[i];
+ gchar *d, *p;
+ gint len;
+ gboolean is_relative = FALSE;
+ GUserDirectory directory;
+
+ /* Remove newline at end */
+ len = strlen (buffer);
+ if (len > 0 && buffer[len - 1] == '\n')
+ buffer[len - 1] = 0;
+
+ p = buffer;
+ while (*p == ' ' || *p == '\t')
+ p++;
+
+ if (strncmp (p, "XDG_DESKTOP_DIR", strlen ("XDG_DESKTOP_DIR")) == 0)
+ {
+ directory = G_USER_DIRECTORY_DESKTOP;
+ p += strlen ("XDG_DESKTOP_DIR");
+ }
+ else if (strncmp (p, "XDG_DOCUMENTS_DIR", strlen ("XDG_DOCUMENTS_DIR")) == 0)
+ {
+ directory = G_USER_DIRECTORY_DOCUMENTS;
+ p += strlen ("XDG_DOCUMENTS_DIR");
+ }
+ else if (strncmp (p, "XDG_DOWNLOAD_DIR", strlen ("XDG_DOWNLOAD_DIR")) == 0)
+ {
+ directory = G_USER_DIRECTORY_DOWNLOAD;
+ p += strlen ("XDG_DOWNLOAD_DIR");
+ }
+ else if (strncmp (p, "XDG_MUSIC_DIR", strlen ("XDG_MUSIC_DIR")) == 0)
+ {
+ directory = G_USER_DIRECTORY_MUSIC;
+ p += strlen ("XDG_MUSIC_DIR");
+ }
+ else if (strncmp (p, "XDG_PICTURES_DIR", strlen ("XDG_PICTURES_DIR")) == 0)
+ {
+ directory = G_USER_DIRECTORY_PICTURES;
+ p += strlen ("XDG_PICTURES_DIR");
+ }
+ else if (strncmp (p, "XDG_PUBLICSHARE_DIR", strlen ("XDG_PUBLICSHARE_DIR")) == 0)
+ {
+ directory = G_USER_DIRECTORY_PUBLIC_SHARE;
+ p += strlen ("XDG_PUBLICSHARE_DIR");
+ }
+ else if (strncmp (p, "XDG_TEMPLATES_DIR", strlen ("XDG_TEMPLATES_DIR")) == 0)
+ {
+ directory = G_USER_DIRECTORY_TEMPLATES;
+ p += strlen ("XDG_TEMPLATES_DIR");
+ }
+ else if (strncmp (p, "XDG_VIDEOS_DIR", strlen ("XDG_VIDEOS_DIR")) == 0)
+ {
+ directory = G_USER_DIRECTORY_VIDEOS;
+ p += strlen ("XDG_VIDEOS_DIR");
+ }
+ else
+ continue;
+
+ while (*p == ' ' || *p == '\t')
+ p++;
+
+ if (*p != '=')
+ continue;
+ p++;
+
+ while (*p == ' ' || *p == '\t')
+ p++;
+
+ if (*p != '"')
+ continue;
+ p++;
+
+ if (strncmp (p, "$HOME", 5) == 0)
+ {
+ p += 5;
+ is_relative = TRUE;
+ }
+ else if (*p != '/')
+ continue;
+
+ d = strrchr (p, '"');
+ if (!d)
+ continue;
+ *d = 0;
+
+ d = p;
+
+ /* remove trailing slashes */
+ len = strlen (d);
+ if (d[len - 1] == '/')
+ d[len - 1] = 0;
+
+ if (is_relative)
+ {
+ g_get_any_init ();
+ g_user_special_dirs[directory] = g_build_filename (g_home_dir, d, NULL);
+ }
+ else
+ g_user_special_dirs[directory] = g_strdup (d);
+ }
+
+ g_strfreev (lines);
+ g_free (config_file);
+}
+
+#endif /* G_OS_UNIX && !HAVE_CARBON */
+
+/**
+ * g_get_user_special_dir:
+ * @directory: the logical id of special directory
+ *
+ * Returns the full path of a special directory using its logical id.
+ *
+ * On Unix this is done using the XDG special user directories.
+ * For compatibility with existing practise, %G_USER_DIRECTORY_DESKTOP
+ * falls back to <filename>$HOME/Desktop</filename> when XDG special
+ * user directories have not been set up.
+ *
+ * Depending on the platform, the user might be able to change the path
+ * of the special directory without requiring the session to restart; GLib
+ * will not reflect any change once the special directories are loaded.
+ *
+ * Return value: the path to the specified special directory, or %NULL
+ * if the logical id was not found. The returned string is owned by
+ * GLib and should not be modified or freed.
+ *
+ * Since: 2.14
+ */
+G_CONST_RETURN gchar *
+g_get_user_special_dir (GUserDirectory directory)
+{
+ g_return_val_if_fail (directory >= G_USER_DIRECTORY_DESKTOP &&
+ directory < G_USER_N_DIRECTORIES, NULL);
+
+ G_LOCK (g_utils_global);
+
+ if (G_UNLIKELY (g_user_special_dirs == NULL))
+ {
+ g_user_special_dirs = g_new0 (gchar *, G_USER_N_DIRECTORIES);
+
+ load_user_special_dirs ();
+
+ /* Special-case desktop for historical compatibility */
+ if (g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] == NULL)
+ {
+ g_get_any_init ();
+
+ g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] =
+ g_build_filename (g_home_dir, "Desktop", NULL);
+ }
+ }
+
+ G_UNLOCK (g_utils_global);
+
+ return g_user_special_dirs[directory];
+}
+
+#ifdef G_OS_WIN32
+
+#undef g_get_system_data_dirs
+
+static HMODULE
+get_module_for_address (gconstpointer address)
+{
+ /* Holds the g_utils_global lock */
+
+ static gboolean beenhere = FALSE;
+ typedef BOOL (WINAPI *t_GetModuleHandleExA) (DWORD, LPCTSTR, HMODULE *);
+ static t_GetModuleHandleExA p_GetModuleHandleExA = NULL;
+ HMODULE hmodule = NULL;
+
+ if (!address)
+ return NULL;
+
+ if (!beenhere)
+ {
+ p_GetModuleHandleExA =
+ (t_GetModuleHandleExA) GetProcAddress (LoadLibrary ("kernel32.dll"),
+ "GetModuleHandleExA");
+ beenhere = TRUE;
+ }
+
+ if (p_GetModuleHandleExA == NULL ||
+ !(*p_GetModuleHandleExA) (GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT |
+ GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
+ address, &hmodule))
+ {
+ MEMORY_BASIC_INFORMATION mbi;
+ VirtualQuery (address, &mbi, sizeof (mbi));
+ hmodule = (HMODULE) mbi.AllocationBase;
+ }
+
+ return hmodule;
+}
+
+static gchar *
+get_module_share_dir (gconstpointer address)
+{
+ HMODULE hmodule;
+ gchar *filename;
+ gchar *retval;
+
+ hmodule = get_module_for_address (address);
+ if (hmodule == NULL)
+ return NULL;
+
+ filename = g_win32_get_package_installation_directory_of_module (hmodule);
+ retval = g_build_filename (filename, "share", NULL);
+ g_free (filename);
+
+ return retval;
+}
+
+G_CONST_RETURN gchar * G_CONST_RETURN *
+g_win32_get_system_data_dirs_for_module (gconstpointer address)
+{
+ GArray *data_dirs;
+ HMODULE hmodule;
+ static GHashTable *per_module_data_dirs = NULL;
+ gchar **retval;
+ gchar *p;
+ gchar *exe_root;
+
+ if (address)
+ {
+ G_LOCK (g_utils_global);
+ hmodule = get_module_for_address (address);
+ if (hmodule != NULL)
+ {
+ if (per_module_data_dirs == NULL)
+ per_module_data_dirs = g_hash_table_new (NULL, NULL);
+ else
+ {
+ retval = g_hash_table_lookup (per_module_data_dirs, hmodule);
+
+ if (retval != NULL)
+ {
+ G_UNLOCK (g_utils_global);
+ return (G_CONST_RETURN gchar * G_CONST_RETURN *) retval;
+ }
+ }
+ }
+ }
+
+ data_dirs = g_array_new (TRUE, TRUE, sizeof (char *));
+
+ /* Documents and Settings\All Users\Application Data */
+ p = get_special_folder (CSIDL_COMMON_APPDATA);
+ if (p)
+ g_array_append_val (data_dirs, p);
+
+ /* Documents and Settings\All Users\Documents */
+ p = get_special_folder (CSIDL_COMMON_DOCUMENTS);
+ if (p)
+ g_array_append_val (data_dirs, p);
+
+ /* Using the above subfolders of Documents and Settings perhaps
+ * makes sense from a Windows perspective.
+ *
+ * But looking at the actual use cases of this function in GTK+
+ * and GNOME software, what we really want is the "share"
+ * subdirectory of the installation directory for the package
+ * our caller is a part of.
+ *
+ * The address parameter, if non-NULL, points to a function in the
+ * calling module. Use that to determine that module's installation
+ * folder, and use its "share" subfolder.
+ *
+ * Additionally, also use the "share" subfolder of the installation
+ * locations of GLib and the .exe file being run.
+ *
+ * To guard against none of the above being what is really wanted,
+ * callers of this function should have Win32-specific code to look
+ * up their installation folder themselves, and handle a subfolder
+ * "share" of it in the same way as the folders returned from this
+ * function.
+ */
+
+ p = get_module_share_dir (address);
+ if (p)
+ g_array_append_val (data_dirs, p);
+
+ if (glib_dll != NULL)
+ {
+ gchar *glib_root = g_win32_get_package_installation_directory_of_module (glib_dll);
+ p = g_build_filename (glib_root, "share", NULL);
+ if (p)
+ g_array_append_val (data_dirs, p);
+ g_free (glib_root);
+ }
+
+ exe_root = g_win32_get_package_installation_directory_of_module (NULL);
+ p = g_build_filename (exe_root, "share", NULL);
+ if (p)
+ g_array_append_val (data_dirs, p);
+ g_free (exe_root);
+
+ retval = (gchar **) g_array_free (data_dirs, FALSE);
+
+ if (address)
+ {
+ if (hmodule != NULL)
+ g_hash_table_insert (per_module_data_dirs, hmodule, retval);
+ G_UNLOCK (g_utils_global);
+ }
+
+ return (G_CONST_RETURN gchar * G_CONST_RETURN *) retval;
+}
+
+#endif
+
+/**
+ * g_get_system_data_dirs:
+ *
+ * Returns an ordered list of base directories in which to access
+ * system-wide application data.
+ *
+ * On UNIX platforms this is determined using the mechanisms described in
+ * the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
+ * XDG Base Directory Specification</ulink>
+ *
+ * On Windows the first elements in the list are the Application Data
+ * and Documents folders for All Users. (These can be determined only
+ * on Windows 2000 or later and are not present in the list on other
+ * Windows versions.) See documentation for CSIDL_COMMON_APPDATA and
+ * CSIDL_COMMON_DOCUMENTS.
+ *
+ * Then follows the "share" subfolder in the installation folder for
+ * the package containing the DLL that calls this function, if it can
+ * be determined.
+ *
+ * Finally the list contains the "share" subfolder in the installation
+ * folder for GLib, and in the installation folder for the package the
+ * application's .exe file belongs to.
+ *
+ * The installation folders above are determined by looking up the
+ * folder where the module (DLL or EXE) in question is located. If the
+ * folder's name is "bin", its parent is used, otherwise the folder
+ * itself.
+ *
+ * Note that on Windows the returned list can vary depending on where
+ * this function is called.
+ *
+ * Return value: a %NULL-terminated array of strings owned by GLib that must
+ * not be modified or freed.
+ * Since: 2.6
+ **/
+G_CONST_RETURN gchar * G_CONST_RETURN *
+g_get_system_data_dirs (void)
+{
+ gchar **data_dir_vector;
+
+ G_LOCK (g_utils_global);
+
+ if (!g_system_data_dirs)
+ {
+#ifdef G_OS_WIN32
+ data_dir_vector = (gchar **) g_win32_get_system_data_dirs_for_module (NULL);
+#else
+ gchar *data_dirs = (gchar *) g_getenv ("XDG_DATA_DIRS");
+
+ if (!data_dirs || !data_dirs[0])
+ data_dirs = "/usr/local/share/:/usr/share/";
+
+ data_dir_vector = g_strsplit (data_dirs, G_SEARCHPATH_SEPARATOR_S, 0);
+#endif
+
+ g_system_data_dirs = data_dir_vector;
+ }
+ else
+ data_dir_vector = g_system_data_dirs;
+
+ G_UNLOCK (g_utils_global);
+
+ return (G_CONST_RETURN gchar * G_CONST_RETURN *) data_dir_vector;
+}
+
+/**
+ * g_get_system_config_dirs:
+ *
+ * Returns an ordered list of base directories in which to access
+ * system-wide configuration information.
+ *
+ * On UNIX platforms this is determined using the mechanisms described in
+ * the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
+ * XDG Base Directory Specification</ulink>
+ *
+ * Return value: a %NULL-terminated array of strings owned by GLib that must
+ * not be modified or freed.
+ * Since: 2.6
+ **/
+G_CONST_RETURN gchar * G_CONST_RETURN *
+g_get_system_config_dirs (void)
+{
+ gchar *conf_dirs, **conf_dir_vector;
+
+ G_LOCK (g_utils_global);
+
+ if (!g_system_config_dirs)
+ {
+#ifdef G_OS_WIN32
+ conf_dirs = get_special_folder (CSIDL_COMMON_APPDATA);
+ if (conf_dirs)
+ {
+ conf_dir_vector = g_strsplit (conf_dirs, G_SEARCHPATH_SEPARATOR_S, 0);
+ g_free (conf_dirs);
+ }
+ else
+ {
+ /* Return empty list */
+ conf_dir_vector = g_strsplit ("", G_SEARCHPATH_SEPARATOR_S, 0);
+ }
+#else
+ conf_dirs = (gchar *) g_getenv ("XDG_CONFIG_DIRS");
+
+ if (!conf_dirs || !conf_dirs[0])
+ conf_dirs = "/etc/xdg";
+
+ conf_dir_vector = g_strsplit (conf_dirs, G_SEARCHPATH_SEPARATOR_S, 0);
+#endif
+
+ g_system_config_dirs = conf_dir_vector;
+ }
+ else
+ conf_dir_vector = g_system_config_dirs;
+ G_UNLOCK (g_utils_global);
+
+ return (G_CONST_RETURN gchar * G_CONST_RETURN *) conf_dir_vector;
+}
+
+#ifndef G_OS_WIN32
+
+static GHashTable *alias_table = NULL;
+
+/* read an alias file for the locales */
+static void
+read_aliases (gchar *file)
+{
+ FILE *fp;
+ char buf[256];
+
+ if (!alias_table)
+ alias_table = g_hash_table_new (g_str_hash, g_str_equal);
+ fp = fopen (file,"r");
+ if (!fp)
+ return;
+ while (fgets (buf, 256, fp))
+ {
+ char *p, *q;
+
+ g_strstrip (buf);
+
+ /* Line is a comment */
+ if ((buf[0] == '#') || (buf[0] == '\0'))
+ continue;
+
+ /* Reads first column */
+ for (p = buf, q = NULL; *p; p++) {
+ if ((*p == '\t') || (*p == ' ') || (*p == ':')) {
+ *p = '\0';
+ q = p+1;
+ while ((*q == '\t') || (*q == ' ')) {
+ q++;
+ }
+ break;
+ }
+ }
+ /* The line only had one column */
+ if (!q || *q == '\0')
+ continue;
+
+ /* Read second column */
+ for (p = q; *p; p++) {
+ if ((*p == '\t') || (*p == ' ')) {
+ *p = '\0';
+ break;
+ }
+ }
+
+ /* Add to alias table if necessary */
+ if (!g_hash_table_lookup (alias_table, buf)) {
+ g_hash_table_insert (alias_table, g_strdup (buf), g_strdup (q));
+ }
+ }
+ fclose (fp);
+}
+
+#endif
+
+static char *
+unalias_lang (char *lang)
+{
+#ifndef G_OS_WIN32
+ char *p;
+ int i;
+
+ if (!alias_table)
+ read_aliases ("/usr/share/locale/locale.alias");
+
+ i = 0;
+ while ((p = g_hash_table_lookup (alias_table, lang)) && (strcmp (p, lang) != 0))
+ {
+ lang = p;
+ if (i++ == 30)
+ {
+ static gboolean said_before = FALSE;
+ if (!said_before)
+ g_warning ("Too many alias levels for a locale, "
+ "may indicate a loop");
+ said_before = TRUE;
+ return lang;
+ }
+ }
+#endif
+ return lang;
+}
+
+/* Mask for components of locale spec. The ordering here is from
+ * least significant to most significant
+ */
+enum
+{
+ COMPONENT_CODESET = 1 << 0,
+ COMPONENT_TERRITORY = 1 << 1,
+ COMPONENT_MODIFIER = 1 << 2
+};
+
+/* Break an X/Open style locale specification into components
+ */
+static guint
+explode_locale (const gchar *locale,
+ gchar **language,
+ gchar **territory,
+ gchar **codeset,
+ gchar **modifier)
+{
+ const gchar *uscore_pos;
+ const gchar *at_pos;
+ const gchar *dot_pos;
+
+ guint mask = 0;
+
+ uscore_pos = strchr (locale, '_');
+ dot_pos = strchr (uscore_pos ? uscore_pos : locale, '.');
+ at_pos = strchr (dot_pos ? dot_pos : (uscore_pos ? uscore_pos : locale), '@');
+
+ if (at_pos)
+ {
+ mask |= COMPONENT_MODIFIER;
+ *modifier = g_strdup (at_pos);
+ }
+ else
+ at_pos = locale + strlen (locale);
+
+ if (dot_pos)
+ {
+ mask |= COMPONENT_CODESET;
+ *codeset = g_strndup (dot_pos, at_pos - dot_pos);
+ }
+ else
+ dot_pos = at_pos;
+
+ if (uscore_pos)
+ {
+ mask |= COMPONENT_TERRITORY;
+ *territory = g_strndup (uscore_pos, dot_pos - uscore_pos);
+ }
+ else
+ uscore_pos = dot_pos;
+
+ *language = g_strndup (locale, uscore_pos - locale);
+
+ return mask;
+}
+
+/*
+ * Compute all interesting variants for a given locale name -
+ * by stripping off different components of the value.
+ *
+ * For simplicity, we assume that the locale is in
+ * X/Open format: language[_territory][.codeset][@modifier]
+ *
+ * TODO: Extend this to handle the CEN format (see the GNUlibc docs)
+ * as well. We could just copy the code from glibc wholesale
+ * but it is big, ugly, and complicated, so I'm reluctant
+ * to do so when this should handle 99% of the time...
+ */
+GSList *
+_g_compute_locale_variants (const gchar *locale)
+{
+ GSList *retval = NULL;
+
+ gchar *language = NULL;
+ gchar *territory = NULL;
+ gchar *codeset = NULL;
+ gchar *modifier = NULL;
+
+ guint mask;
+ guint i;
+
+ g_return_val_if_fail (locale != NULL, NULL);
+
+ mask = explode_locale (locale, &language, &territory, &codeset, &modifier);
+
+ /* Iterate through all possible combinations, from least attractive
+ * to most attractive.
+ */
+ for (i = 0; i <= mask; i++)
+ if ((i & ~mask) == 0)
+ {
+ gchar *val = g_strconcat (language,
+ (i & COMPONENT_TERRITORY) ? territory : "",
+ (i & COMPONENT_CODESET) ? codeset : "",
+ (i & COMPONENT_MODIFIER) ? modifier : "",
+ NULL);
+ retval = g_slist_prepend (retval, val);
+ }
+
+ g_free (language);
+ if (mask & COMPONENT_CODESET)
+ g_free (codeset);
+ if (mask & COMPONENT_TERRITORY)
+ g_free (territory);
+ if (mask & COMPONENT_MODIFIER)
+ g_free (modifier);
+
+ return retval;
+}
+
+/* The following is (partly) taken from the gettext package.
+ Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. */
+
+static const gchar *
+guess_category_value (const gchar *category_name)
+{
+ const gchar *retval;
+
+ /* The highest priority value is the `LANGUAGE' environment
+ variable. This is a GNU extension. */
+ retval = g_getenv ("LANGUAGE");
+ if ((retval != NULL) && (retval[0] != '\0'))
+ return retval;
+
+ /* `LANGUAGE' is not set. So we have to proceed with the POSIX
+ methods of looking to `LC_ALL', `LC_xxx', and `LANG'. On some
+ systems this can be done by the `setlocale' function itself. */
+
+ /* Setting of LC_ALL overwrites all other. */
+ retval = g_getenv ("LC_ALL");
+ if ((retval != NULL) && (retval[0] != '\0'))
+ return retval;
+
+ /* Next comes the name of the desired category. */
+ retval = g_getenv (category_name);
+ if ((retval != NULL) && (retval[0] != '\0'))
+ return retval;
+
+ /* Last possibility is the LANG environment variable. */
+ retval = g_getenv ("LANG");
+ if ((retval != NULL) && (retval[0] != '\0'))
+ return retval;
+
+#ifdef G_PLATFORM_WIN32
+ /* g_win32_getlocale() first checks for LC_ALL, LC_MESSAGES and
+ * LANG, which we already did above. Oh well. The main point of
+ * calling g_win32_getlocale() is to get the thread's locale as used
+ * by Windows and the Microsoft C runtime (in the "English_United
+ * States" format) translated into the Unixish format.
+ */
+ retval = g_win32_getlocale ();
+ if ((retval != NULL) && (retval[0] != '\0'))
+ return retval;
+#endif
+
+ return NULL;
+}
+
+typedef struct _GLanguageNamesCache GLanguageNamesCache;
+
+struct _GLanguageNamesCache {
+ gchar *languages;
+ gchar **language_names;
+};
+
+static void
+language_names_cache_free (gpointer data)
+{
+ GLanguageNamesCache *cache = data;
+ g_free (cache->languages);
+ g_strfreev (cache->language_names);
+ g_free (cache);
+}
+
+/**
+ * g_get_language_names:
+ *
+ * Computes a list of applicable locale names, which can be used to
+ * e.g. construct locale-dependent filenames or search paths. The returned
+ * list is sorted from most desirable to least desirable and always contains
+ * the default locale "C".
+ *
+ * For example, if LANGUAGE=de:en_US, then the returned list is
+ * "de", "en_US", "en", "C".
+ *
+ * This function consults the environment variables <envar>LANGUAGE</envar>,
+ * <envar>LC_ALL</envar>, <envar>LC_MESSAGES</envar> and <envar>LANG</envar>
+ * to find the list of locales specified by the user.
+ *
+ * Return value: a %NULL-terminated array of strings owned by GLib
+ * that must not be modified or freed.
+ *
+ * Since: 2.6
+ **/
+G_CONST_RETURN gchar * G_CONST_RETURN *
+g_get_language_names (void)
+{
+ static GStaticPrivate cache_private = G_STATIC_PRIVATE_INIT;
+ GLanguageNamesCache *cache = g_static_private_get (&cache_private);
+ const gchar *value;
+
+ if (!cache)
+ {
+ cache = g_new0 (GLanguageNamesCache, 1);
+ g_static_private_set (&cache_private, cache, language_names_cache_free);
+ }
+
+ value = guess_category_value ("LC_MESSAGES");
+ if (!value)
+ value = "C";
+
+ if (!(cache->languages && strcmp (cache->languages, value) == 0))
+ {
+ gchar **languages;
+ gchar **alist, **a;
+ GSList *list, *l;
+ gint i;
+
+ g_free (cache->languages);
+ g_strfreev (cache->language_names);
+ cache->languages = g_strdup (value);
+
+ alist = g_strsplit (value, ":", 0);
+ list = NULL;
+ for (a = alist; *a; a++)
+ {
+ gchar *b = unalias_lang (*a);
+ list = g_slist_concat (list, _g_compute_locale_variants (b));
+ }
+ g_strfreev (alist);
+ list = g_slist_append (list, g_strdup ("C"));
+
+ cache->language_names = languages = g_new (gchar *, g_slist_length (list) + 1);
+ for (l = list, i = 0; l; l = l->next, i++)
+ languages[i] = l->data;
+ languages[i] = NULL;
+
+ g_slist_free (list);
+ }
+
+ return (G_CONST_RETURN gchar * G_CONST_RETURN *) cache->language_names;
+}
+
+#endif /* NOT_NEEDED_FOR_NAVIT */
+/**
+ * g_direct_hash:
+ * @v: a #gpointer key
+ *
+ * Converts a gpointer to a hash value.
+ * It can be passed to g_hash_table_new() as the @hash_func parameter,
+ * when using pointers as keys in a #GHashTable.
+ *
+ * Returns: a hash value corresponding to the key.
+ */
+guint
+g_direct_hash (gconstpointer v)
+{
+ return GPOINTER_TO_UINT (v);
+}
+
+/**
+ * g_direct_equal:
+ * @v1: a key.
+ * @v2: a key to compare with @v1.
+ *
+ * Compares two #gpointer arguments and returns %TRUE if they are equal.
+ * It can be passed to g_hash_table_new() as the @key_equal_func
+ * parameter, when using pointers as keys in a #GHashTable.
+ *
+ * Returns: %TRUE if the two keys match.
+ */
+gboolean
+g_direct_equal (gconstpointer v1,
+ gconstpointer v2)
+{
+ return v1 == v2;
+}
+
+/**
+ * g_int_equal:
+ * @v1: a pointer to a #gint key.
+ * @v2: a pointer to a #gint key to compare with @v1.
+ *
+ * Compares the two #gint values being pointed to and returns
+ * %TRUE if they are equal.
+ * It can be passed to g_hash_table_new() as the @key_equal_func
+ * parameter, when using pointers to integers as keys in a #GHashTable.
+ *
+ * Returns: %TRUE if the two keys match.
+ */
+gboolean
+g_int_equal (gconstpointer v1,
+ gconstpointer v2)
+{
+ return *((const gint*) v1) == *((const gint*) v2);
+}
+
+/**
+ * g_int_hash:
+ * @v: a pointer to a #gint key
+ *
+ * Converts a pointer to a #gint to a hash value.
+ * It can be passed to g_hash_table_new() as the @hash_func parameter,
+ * when using pointers to integers values as keys in a #GHashTable.
+ *
+ * Returns: a hash value corresponding to the key.
+ */
+guint
+g_int_hash (gconstpointer v)
+{
+ return *(const gint*) v;
+}
+
+#if NOT_NEEDED_FOR_NAVIT
+/**
+ * g_nullify_pointer:
+ * @nullify_location: the memory address of the pointer.
+ *
+ * Set the pointer at the specified location to %NULL.
+ **/
+void
+g_nullify_pointer (gpointer *nullify_location)
+{
+ g_return_if_fail (nullify_location != NULL);
+
+ *nullify_location = NULL;
+}
+
+/**
+ * g_get_codeset:
+ *
+ * Get the codeset for the current locale.
+ *
+ * Return value: a newly allocated string containing the name
+ * of the codeset. This string must be freed with g_free().
+ **/
+gchar *
+g_get_codeset (void)
+{
+ const gchar *charset;
+
+ g_get_charset (&charset);
+
+ return g_strdup (charset);
+}
+
+/* This is called from g_thread_init(). It's used to
+ * initialize some static data in a threadsafe way.
+ */
+void
+_g_utils_thread_init (void)
+{
+ g_get_language_names ();
+}
+
+#ifdef G_OS_WIN32
+
+/**
+ * _glib_get_locale_dir:
+ *
+ * Return the path to the share\locale or lib\locale subfolder of the
+ * GLib installation folder. The path is in the system codepage. We
+ * have to use system codepage as bindtextdomain() doesn't have a
+ * UTF-8 interface.
+ */
+static gchar *
+_glib_get_locale_dir (void)
+{
+ gchar *install_dir = NULL, *locale_dir;
+ gchar *retval = NULL;
+
+ if (glib_dll != NULL)
+ install_dir = g_win32_get_package_installation_directory_of_module (glib_dll);
+
+ if (install_dir)
+ {
+ /*
+ * Append "/share/locale" or "/lib/locale" depending on whether
+ * autoconfigury detected GNU gettext or not.
+ */
+ const char *p = GLIB_LOCALE_DIR + strlen (GLIB_LOCALE_DIR);
+ while (*--p != '/')
+ ;
+ while (*--p != '/')
+ ;
+
+ locale_dir = g_build_filename (install_dir, p, NULL);
+
+ retval = g_win32_locale_filename_from_utf8 (locale_dir);
+
+ g_free (install_dir);
+ g_free (locale_dir);
+ }
+
+ if (retval)
+ return retval;
+ else
+ return g_strdup ("");
+}
+
+#undef GLIB_LOCALE_DIR
+
+#endif /* G_OS_WIN32 */
+
+/**
+ * glib_gettext:
+ * @str: The string to be translated
+ *
+ * Returns the translated string from the glib translations.
+ * This is an internal function and should only be used by
+ * the internals of glib (such as libgio).
+ *
+ * Returns: the transation of @str to the current locale
+ */
+G_CONST_RETURN gchar *
+glib_gettext (const gchar *str)
+{
+ static gboolean _glib_gettext_initialized = FALSE;
+
+ if (!_glib_gettext_initialized)
+ {
+#ifdef G_OS_WIN32
+ gchar *tmp = _glib_get_locale_dir ();
+ bindtextdomain (GETTEXT_PACKAGE, tmp);
+ g_free (tmp);
+#else
+ bindtextdomain (GETTEXT_PACKAGE, GLIB_LOCALE_DIR);
+#endif
+# ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+# endif
+ _glib_gettext_initialized = TRUE;
+ }
+
+ return g_dgettext (GETTEXT_PACKAGE, str);
+}
+
+#if defined (G_OS_WIN32) && !defined (_WIN64)
+
+/* Binary compatibility versions. Not for newly compiled code. */
+
+#undef g_find_program_in_path
+
+gchar*
+g_find_program_in_path (const gchar *program)
+{
+ gchar *utf8_program = g_locale_to_utf8 (program, -1, NULL, NULL, NULL);
+ gchar *utf8_retval = g_find_program_in_path_utf8 (utf8_program);
+ gchar *retval;
+
+ g_free (utf8_program);
+ if (utf8_retval == NULL)
+ return NULL;
+ retval = g_locale_from_utf8 (utf8_retval, -1, NULL, NULL, NULL);
+ g_free (utf8_retval);
+
+ return retval;
+}
+
+#undef g_get_current_dir
+
+gchar*
+g_get_current_dir (void)
+{
+ gchar *utf8_dir = g_get_current_dir_utf8 ();
+ gchar *dir = g_locale_from_utf8 (utf8_dir, -1, NULL, NULL, NULL);
+ g_free (utf8_dir);
+ return dir;
+}
+
+#undef g_getenv
+
+G_CONST_RETURN gchar*
+g_getenv (const gchar *variable)
+{
+ gchar *utf8_variable = g_locale_to_utf8 (variable, -1, NULL, NULL, NULL);
+ const gchar *utf8_value = g_getenv_utf8 (utf8_variable);
+ gchar *value;
+ GQuark quark;
+
+ g_free (utf8_variable);
+ if (!utf8_value)
+ return NULL;
+ value = g_locale_from_utf8 (utf8_value, -1, NULL, NULL, NULL);
+ quark = g_quark_from_string (value);
+ g_free (value);
+
+ return g_quark_to_string (quark);
+}
+
+#undef g_setenv
+
+gboolean
+g_setenv (const gchar *variable,
+ const gchar *value,
+ gboolean overwrite)
+{
+ gchar *utf8_variable = g_locale_to_utf8 (variable, -1, NULL, NULL, NULL);
+ gchar *utf8_value = g_locale_to_utf8 (value, -1, NULL, NULL, NULL);
+ gboolean retval = g_setenv_utf8 (utf8_variable, utf8_value, overwrite);
+
+ g_free (utf8_variable);
+ g_free (utf8_value);
+
+ return retval;
+}
+
+#undef g_unsetenv
+
+void
+g_unsetenv (const gchar *variable)
+{
+ gchar *utf8_variable = g_locale_to_utf8 (variable, -1, NULL, NULL, NULL);
+
+ g_unsetenv_utf8 (utf8_variable);
+
+ g_free (utf8_variable);
+}
+
+#undef g_get_user_name
+
+G_CONST_RETURN gchar*
+g_get_user_name (void)
+{
+ g_get_any_init_locked ();
+ return g_user_name_cp;
+}
+
+#undef g_get_real_name
+
+G_CONST_RETURN gchar*
+g_get_real_name (void)
+{
+ g_get_any_init_locked ();
+ return g_real_name_cp;
+}
+
+#undef g_get_home_dir
+
+G_CONST_RETURN gchar*
+g_get_home_dir (void)
+{
+ g_get_any_init_locked ();
+ return g_home_dir_cp;
+}
+
+#undef g_get_tmp_dir
+
+G_CONST_RETURN gchar*
+g_get_tmp_dir (void)
+{
+ g_get_any_init_locked ();
+ return g_tmp_dir_cp;
+}
+
+#endif
+#endif /* NOT_NEEDED_FOR_NAVIT */
+
+#define __G_UTILS_C__
+#include "galiasdef.c"
diff --git a/support/libc/Makefile.am b/support/libc/Makefile.am
new file mode 100644
index 00000000..fd98ea7a
--- /dev/null
+++ b/support/libc/Makefile.am
@@ -0,0 +1,4 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=support_libc
+noinst_LTLIBRARIES = libsupport_libc.la
+libsupport_libc_la_SOURCES = libc.c libc_init.c
diff --git a/support/libc/errno.h b/support/libc/errno.h
new file mode 100644
index 00000000..5ef0a7bd
--- /dev/null
+++ b/support/libc/errno.h
@@ -0,0 +1,4 @@
+extern int errno;
+#define ENOMEM 12
+#define EINVAL 22
+#define ERANGE 34
diff --git a/support/libc/libc.c b/support/libc/libc.c
new file mode 100644
index 00000000..9b5cfe73
--- /dev/null
+++ b/support/libc/libc.c
@@ -0,0 +1,158 @@
+#include "locale.h"
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+int errno;
+
+#define MAXENV 32
+static char *envnames[MAXENV];
+static char *envvars[MAXENV];
+
+static void cleanup_libc(void) __attribute__((destructor));
+static void cleanup_libc(void)
+{
+ int i;
+ for (i=0; i <MAXENV; i++) {
+ if (envnames[i])
+ free(envnames[i]);
+ if (envvars[i])
+ free(envvars[i]);
+ }
+}
+
+char *
+getenv(const char *name)
+{
+ int i;
+ for (i=0; i < MAXENV; i++) {
+ if (envnames[i] && !strcmp(envnames[i], name))
+ return envvars[i];
+ }
+ return NULL;
+}
+
+int
+setenv(const char *name, const char *value, int overwrite)
+{
+ int i;
+ char *val;
+ for (i=0; i < MAXENV; i++) {
+ if (envnames[i] && !strcmp(envnames[i], name)) {
+ if (overwrite) {
+ val = strdup(value);
+ if (!val)
+ return -1;
+ if (envvars[i])
+ free(envvars[i]);
+ envvars[i] = val;
+ }
+ return 0;
+ }
+ }
+ for (i=0; i < MAXENV; i++) {
+ if (!envnames[i]) {
+ envnames[i] = strdup(name);
+ envvars[i] = strdup(value);
+ if (!envnames[i] || !envvars[i]) {
+ if (envnames[i])
+ free(envnames[i]);
+ if (envvars[i])
+ free(envvars[i]);
+ envnames[i] = NULL;
+ envvars[i] = NULL;
+ return -1;
+ }
+ return 0;
+ }
+ }
+ return -1;
+}
+
+int unsetenv(const char *name)
+{
+ int i;
+ for (i=0; i < MAXENV; i++) {
+ if (envnames[i] && !strcmp(envnames[i], name)) {
+ free(envnames[i]);
+ envnames[i] = NULL;
+ if (envvars[i])
+ free(envvars[i]);
+ envvars[i] = NULL;
+ }
+ }
+ return 0;
+}
+
+char *
+getcwd(char *buf, int size)
+{
+ return "dummy";
+}
+
+char *
+getwd(char *buf)
+{
+ return "dummy";
+}
+
+char *strtok_r(char *str, const char *delim, char **saveptr)
+{
+ return strtok(str, delim);
+}
+
+void
+perror(const char *x)
+{
+}
+
+void
+raise(void)
+{
+}
+
+void *
+popen(void)
+{
+ return 0;
+}
+
+void
+pclose(void)
+{
+}
+
+void
+rewind(void)
+{
+}
+
+int
+GetThreadLocale(void)
+{
+ return 0;
+}
+
+int
+signal(void)
+{
+ return 0;
+}
+
+void
+setlocale(void)
+{
+ return 0;
+}
+
+static struct lconv localedata={"."};
+
+struct lconv *
+localeconv(void)
+{
+ return &localedata;
+}
+
+unsigned int
+alarm(unsigned int seconds)
+{
+}
diff --git a/support/libc/libc_init.c b/support/libc/libc_init.c
new file mode 100644
index 00000000..32be387d
--- /dev/null
+++ b/support/libc/libc_init.c
@@ -0,0 +1,6 @@
+#include "plugin.h"
+
+void
+plugin_init(void)
+{
+}
diff --git a/support/libc/locale.h b/support/libc/locale.h
new file mode 100644
index 00000000..fad4f95d
--- /dev/null
+++ b/support/libc/locale.h
@@ -0,0 +1,12 @@
+#ifndef _LOCALE_H
+#define _LOCALE_H 1
+#define SUBLANG_BENGALI_BANGLADESH 0x02
+#define SUBLANG_PUNJABI_PAKISTAN 0x02
+#define SUBLANG_ROMANIAN_MOLDOVA 0x02
+struct lconv {
+ char *decimal_point;
+};
+
+#define LC_ALL 1
+#define LC_NUMERIC 2
+#endif
diff --git a/support/libc/signal.h b/support/libc/signal.h
new file mode 100644
index 00000000..18b65399
--- /dev/null
+++ b/support/libc/signal.h
@@ -0,0 +1,2 @@
+#define SIGFPE 8
+#define SIGSEGV 11
diff --git a/support/win32/ConvertUTF.c b/support/win32/ConvertUTF.c
new file mode 100644
index 00000000..9b3deebd
--- /dev/null
+++ b/support/win32/ConvertUTF.c
@@ -0,0 +1,539 @@
+/*
+ * Copyright 2001-2004 Unicode, Inc.
+ *
+ * Disclaimer
+ *
+ * This source code is provided as is by Unicode, Inc. No claims are
+ * made as to fitness for any particular purpose. No warranties of any
+ * kind are expressed or implied. The recipient agrees to determine
+ * applicability of information provided. If this file has been
+ * purchased on magnetic or optical media from Unicode, Inc., the
+ * sole remedy for any claim will be exchange of defective media
+ * within 90 days of receipt.
+ *
+ * Limitations on Rights to Redistribute This Code
+ *
+ * Unicode, Inc. hereby grants the right to freely use the information
+ * supplied in this file in the creation of products supporting the
+ * Unicode Standard, and to make copies of this file in any form
+ * for internal or external distribution as long as this notice
+ * remains attached.
+ */
+
+/* ---------------------------------------------------------------------
+
+ Conversions between UTF32, UTF-16, and UTF-8. Source code file.
+ Author: Mark E. Davis, 1994.
+ Rev History: Rick McGowan, fixes & updates May 2001.
+ Sept 2001: fixed const & error conditions per
+ mods suggested by S. Parent & A. Lillich.
+ June 2002: Tim Dodd added detection and handling of incomplete
+ source sequences, enhanced error detection, added casts
+ to eliminate compiler warnings.
+ July 2003: slight mods to back out aggressive FFFE detection.
+ Jan 2004: updated switches in from-UTF8 conversions.
+ Oct 2004: updated to use UNI_MAX_LEGAL_UTF32 in UTF-32 conversions.
+
+ See the header file "ConvertUTF.h" for complete documentation.
+
+------------------------------------------------------------------------ */
+
+
+#include "ConvertUTF.h"
+#ifdef CVTUTF_DEBUG
+#include <stdio.h>
+#endif
+
+static const int halfShift = 10; /* used for shifting by 10 bits */
+
+static const UTF32 halfBase = 0x0010000UL;
+static const UTF32 halfMask = 0x3FFUL;
+
+#define UNI_SUR_HIGH_START (UTF32)0xD800
+#define UNI_SUR_HIGH_END (UTF32)0xDBFF
+#define UNI_SUR_LOW_START (UTF32)0xDC00
+#define UNI_SUR_LOW_END (UTF32)0xDFFF
+#define false 0
+#define true 1
+
+/* --------------------------------------------------------------------- */
+
+ConversionResult ConvertUTF32toUTF16 (
+ const UTF32** sourceStart, const UTF32* sourceEnd,
+ UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
+ ConversionResult result = conversionOK;
+ const UTF32* source = *sourceStart;
+ UTF16* target = *targetStart;
+ while (source < sourceEnd) {
+ UTF32 ch;
+ if (target >= targetEnd) {
+ result = targetExhausted; break;
+ }
+ ch = *source++;
+ if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
+ /* UTF-16 surrogate values are illegal in UTF-32; 0xffff or 0xfffe are both reserved values */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+ if (flags == strictConversion) {
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ *target++ = (UTF16)ch; /* normal case */
+ }
+ } else if (ch > UNI_MAX_LEGAL_UTF32) {
+ if (flags == strictConversion) {
+ result = sourceIllegal;
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ /* target is a character in range 0xFFFF - 0x10FFFF. */
+ if (target + 1 >= targetEnd) {
+ --source; /* Back up source pointer! */
+ result = targetExhausted; break;
+ }
+ ch -= halfBase;
+ *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
+ *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
+ }
+ }
+ *sourceStart = source;
+ *targetStart = target;
+ return result;
+}
+
+/* --------------------------------------------------------------------- */
+
+ConversionResult ConvertUTF16toUTF32 (
+ const UTF16** sourceStart, const UTF16* sourceEnd,
+ UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
+ ConversionResult result = conversionOK;
+ const UTF16* source = *sourceStart;
+ UTF32* target = *targetStart;
+ UTF32 ch, ch2;
+ while (source < sourceEnd) {
+ const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
+ ch = *source++;
+ /* If we have a surrogate pair, convert to UTF32 first. */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
+ /* If the 16 bits following the high surrogate are in the source buffer... */
+ if (source < sourceEnd) {
+ ch2 = *source;
+ /* If it's a low surrogate, convert to UTF32. */
+ if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
+ ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
+ + (ch2 - UNI_SUR_LOW_START) + halfBase;
+ ++source;
+ } else if (flags == strictConversion) { /* it's an unpaired high surrogate */
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ } else { /* We don't have the 16 bits following the high surrogate. */
+ --source; /* return to the high surrogate */
+ result = sourceExhausted;
+ break;
+ }
+ } else if (flags == strictConversion) {
+ /* UTF-16 surrogate values are illegal in UTF-32 */
+ if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ }
+ if (target >= targetEnd) {
+ source = oldSource; /* Back up source pointer! */
+ result = targetExhausted; break;
+ }
+ *target++ = ch;
+ }
+ *sourceStart = source;
+ *targetStart = target;
+#ifdef CVTUTF_DEBUG
+if (result == sourceIllegal) {
+ fprintf(stderr, "ConvertUTF16toUTF32 illegal seq 0x%04x,%04x\n", ch, ch2);
+ fflush(stderr);
+}
+#endif
+ return result;
+}
+
+/* --------------------------------------------------------------------- */
+
+/*
+ * Index into the table below with the first byte of a UTF-8 sequence to
+ * get the number of trailing bytes that are supposed to follow it.
+ * Note that *legal* UTF-8 values can't have 4 or 5-bytes. The table is
+ * left as-is for anyone who may want to do such conversion, which was
+ * allowed in earlier algorithms.
+ */
+static const char trailingBytesForUTF8[256] = {
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
+};
+
+/*
+ * Magic values subtracted from a buffer value during UTF8 conversion.
+ * This table contains as many values as there might be trailing bytes
+ * in a UTF-8 sequence.
+ */
+static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
+ 0x03C82080UL, 0xFA082080UL, 0x82082080UL };
+
+/*
+ * Once the bits are split out into bytes of UTF-8, this is a mask OR-ed
+ * into the first byte, depending on how many bytes follow. There are
+ * as many entries in this table as there are UTF-8 sequence types.
+ * (I.e., one byte sequence, two byte... etc.). Remember that sequencs
+ * for *legal* UTF-8 will be 4 or fewer bytes total.
+ */
+static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
+
+/* --------------------------------------------------------------------- */
+
+/* The interface converts a whole buffer to avoid function-call overhead.
+ * Constants have been gathered. Loops & conditionals have been removed as
+ * much as possible for efficiency, in favor of drop-through switches.
+ * (See "Note A" at the bottom of the file for equivalent code.)
+ * If your compiler supports it, the "isLegalUTF8" call can be turned
+ * into an inline function.
+ */
+
+/* --------------------------------------------------------------------- */
+
+ConversionResult ConvertUTF16toUTF8 (
+ const UTF16** sourceStart, const UTF16* sourceEnd,
+ UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
+ ConversionResult result = conversionOK;
+ const UTF16* source = *sourceStart;
+ UTF8* target = *targetStart;
+ while (source < sourceEnd) {
+ UTF32 ch;
+ unsigned short bytesToWrite = 0;
+ const UTF32 byteMask = 0xBF;
+ const UTF32 byteMark = 0x80;
+ const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
+ ch = *source++;
+ /* If we have a surrogate pair, convert to UTF32 first. */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
+ /* If the 16 bits following the high surrogate are in the source buffer... */
+ if (source < sourceEnd) {
+ UTF32 ch2 = *source;
+ /* If it's a low surrogate, convert to UTF32. */
+ if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
+ ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
+ + (ch2 - UNI_SUR_LOW_START) + halfBase;
+ ++source;
+ } else if (flags == strictConversion) { /* it's an unpaired high surrogate */
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ } else { /* We don't have the 16 bits following the high surrogate. */
+ --source; /* return to the high surrogate */
+ result = sourceExhausted;
+ break;
+ }
+ } else if (flags == strictConversion) {
+ /* UTF-16 surrogate values are illegal in UTF-32 */
+ if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ }
+ /* Figure out how many bytes the result will require */
+ if (ch < (UTF32)0x80) { bytesToWrite = 1;
+ } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
+ } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
+ } else if (ch < (UTF32)0x110000) { bytesToWrite = 4;
+ } else { bytesToWrite = 3;
+ ch = UNI_REPLACEMENT_CHAR;
+ }
+
+ target += bytesToWrite;
+ if (target > targetEnd) {
+ source = oldSource; /* Back up source pointer! */
+ target -= bytesToWrite; result = targetExhausted; break;
+ }
+ switch (bytesToWrite) { /* note: everything falls through. */
+ case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 1: *--target = (UTF8)(ch | firstByteMark[bytesToWrite]);
+ }
+ target += bytesToWrite;
+ }
+ *sourceStart = source;
+ *targetStart = target;
+ return result;
+}
+
+/* --------------------------------------------------------------------- */
+
+/*
+ * Utility routine to tell whether a sequence of bytes is legal UTF-8.
+ * This must be called with the length pre-determined by the first byte.
+ * If not calling this from ConvertUTF8to*, then the length can be set by:
+ * length = trailingBytesForUTF8[*source]+1;
+ * and the sequence is illegal right away if there aren't that many bytes
+ * available.
+ * If presented with a length > 4, this returns false. The Unicode
+ * definition of UTF-8 goes up to 4-byte sequences.
+ */
+
+static Boolean isLegalUTF8(const UTF8 *source, int length) {
+ UTF8 a;
+ const UTF8 *srcptr = source+length;
+ switch (length) {
+ default: return false;
+ /* Everything else falls through when "true"... */
+ case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
+ case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
+ case 2: if ((a = (*--srcptr)) > 0xBF) return false;
+
+ switch (*source) {
+ /* no fall-through in this inner switch */
+ case 0xE0: if (a < 0xA0) return false; break;
+ case 0xED: if (a > 0x9F) return false; break;
+ case 0xF0: if (a < 0x90) return false; break;
+ case 0xF4: if (a > 0x8F) return false; break;
+ default: if (a < 0x80) return false;
+ }
+
+ case 1: if (*source >= 0x80 && *source < 0xC2) return false;
+ }
+ if (*source > 0xF4) return false;
+ return true;
+}
+
+/* --------------------------------------------------------------------- */
+
+/*
+ * Exported function to return whether a UTF-8 sequence is legal or not.
+ * This is not used here; it's just exported.
+ */
+Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) {
+ int length = trailingBytesForUTF8[*source]+1;
+ if (source+length > sourceEnd) {
+ return false;
+ }
+ return isLegalUTF8(source, length);
+}
+
+/* --------------------------------------------------------------------- */
+
+ConversionResult ConvertUTF8toUTF16 (
+ const UTF8** sourceStart, const UTF8* sourceEnd,
+ UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
+ ConversionResult result = conversionOK;
+ const UTF8* source = *sourceStart;
+ UTF16* target = *targetStart;
+ while (source < sourceEnd) {
+ UTF32 ch = 0;
+ unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
+ if (source + extraBytesToRead >= sourceEnd) {
+ result = sourceExhausted; break;
+ }
+ /* Do this check whether lenient or strict */
+ if (! isLegalUTF8(source, extraBytesToRead+1)) {
+ result = sourceIllegal;
+ break;
+ }
+ /*
+ * The cases all fall through. See "Note A" below.
+ */
+ switch (extraBytesToRead) {
+ case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
+ case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
+ case 3: ch += *source++; ch <<= 6;
+ case 2: ch += *source++; ch <<= 6;
+ case 1: ch += *source++; ch <<= 6;
+ case 0: ch += *source++;
+ }
+ ch -= offsetsFromUTF8[extraBytesToRead];
+
+ if (target >= targetEnd) {
+ source -= (extraBytesToRead+1); /* Back up source pointer! */
+ result = targetExhausted; break;
+ }
+ if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
+ /* UTF-16 surrogate values are illegal in UTF-32 */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+ if (flags == strictConversion) {
+ source -= (extraBytesToRead+1); /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ *target++ = (UTF16)ch; /* normal case */
+ }
+ } else if (ch > UNI_MAX_UTF16) {
+ if (flags == strictConversion) {
+ result = sourceIllegal;
+ source -= (extraBytesToRead+1); /* return to the start */
+ break; /* Bail out; shouldn't continue */
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ /* target is a character in range 0xFFFF - 0x10FFFF. */
+ if (target + 1 >= targetEnd) {
+ source -= (extraBytesToRead+1); /* Back up source pointer! */
+ result = targetExhausted; break;
+ }
+ ch -= halfBase;
+ *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
+ *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
+ }
+ }
+ *sourceStart = source;
+ *targetStart = target;
+ return result;
+}
+
+/* --------------------------------------------------------------------- */
+
+ConversionResult ConvertUTF32toUTF8 (
+ const UTF32** sourceStart, const UTF32* sourceEnd,
+ UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
+ ConversionResult result = conversionOK;
+ const UTF32* source = *sourceStart;
+ UTF8* target = *targetStart;
+ while (source < sourceEnd) {
+ UTF32 ch;
+ unsigned short bytesToWrite = 0;
+ const UTF32 byteMask = 0xBF;
+ const UTF32 byteMark = 0x80;
+ ch = *source++;
+ if (flags == strictConversion ) {
+ /* UTF-16 surrogate values are illegal in UTF-32 */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ }
+ /*
+ * Figure out how many bytes the result will require. Turn any
+ * illegally large UTF32 things (> Plane 17) into replacement chars.
+ */
+ if (ch < (UTF32)0x80) { bytesToWrite = 1;
+ } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
+ } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
+ } else if (ch <= UNI_MAX_LEGAL_UTF32) { bytesToWrite = 4;
+ } else { bytesToWrite = 3;
+ ch = UNI_REPLACEMENT_CHAR;
+ result = sourceIllegal;
+ }
+
+ target += bytesToWrite;
+ if (target > targetEnd) {
+ --source; /* Back up source pointer! */
+ target -= bytesToWrite; result = targetExhausted; break;
+ }
+ switch (bytesToWrite) { /* note: everything falls through. */
+ case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 1: *--target = (UTF8) (ch | firstByteMark[bytesToWrite]);
+ }
+ target += bytesToWrite;
+ }
+ *sourceStart = source;
+ *targetStart = target;
+ return result;
+}
+
+/* --------------------------------------------------------------------- */
+
+ConversionResult ConvertUTF8toUTF32 (
+ const UTF8** sourceStart, const UTF8* sourceEnd,
+ UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
+ ConversionResult result = conversionOK;
+ const UTF8* source = *sourceStart;
+ UTF32* target = *targetStart;
+ while (source < sourceEnd) {
+ UTF32 ch = 0;
+ unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
+ if (source + extraBytesToRead >= sourceEnd) {
+ result = sourceExhausted; break;
+ }
+ /* Do this check whether lenient or strict */
+ if (! isLegalUTF8(source, extraBytesToRead+1)) {
+ result = sourceIllegal;
+ break;
+ }
+ /*
+ * The cases all fall through. See "Note A" below.
+ */
+ switch (extraBytesToRead) {
+ case 5: ch += *source++; ch <<= 6;
+ case 4: ch += *source++; ch <<= 6;
+ case 3: ch += *source++; ch <<= 6;
+ case 2: ch += *source++; ch <<= 6;
+ case 1: ch += *source++; ch <<= 6;
+ case 0: ch += *source++;
+ }
+ ch -= offsetsFromUTF8[extraBytesToRead];
+
+ if (target >= targetEnd) {
+ source -= (extraBytesToRead+1); /* Back up the source pointer! */
+ result = targetExhausted; break;
+ }
+ if (ch <= UNI_MAX_LEGAL_UTF32) {
+ /*
+ * UTF-16 surrogate values are illegal in UTF-32, and anything
+ * over Plane 17 (> 0x10FFFF) is illegal.
+ */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+ if (flags == strictConversion) {
+ source -= (extraBytesToRead+1); /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ *target++ = ch;
+ }
+ } else { /* i.e., ch > UNI_MAX_LEGAL_UTF32 */
+ result = sourceIllegal;
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ }
+ *sourceStart = source;
+ *targetStart = target;
+ return result;
+}
+
+/* ---------------------------------------------------------------------
+
+ Note A.
+ The fall-through switches in UTF-8 reading code save a
+ temp variable, some decrements & conditionals. The switches
+ are equivalent to the following loop:
+ {
+ int tmpBytesToRead = extraBytesToRead+1;
+ do {
+ ch += *source++;
+ --tmpBytesToRead;
+ if (tmpBytesToRead) ch <<= 6;
+ } while (tmpBytesToRead > 0);
+ }
+ In UTF-8 writing code, the switches on "bytesToWrite" are
+ similarly unrolled loops.
+
+ --------------------------------------------------------------------- */
diff --git a/support/win32/ConvertUTF.h b/support/win32/ConvertUTF.h
new file mode 100644
index 00000000..e2649153
--- /dev/null
+++ b/support/win32/ConvertUTF.h
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2001-2004 Unicode, Inc.
+ *
+ * Disclaimer
+ *
+ * This source code is provided as is by Unicode, Inc. No claims are
+ * made as to fitness for any particular purpose. No warranties of any
+ * kind are expressed or implied. The recipient agrees to determine
+ * applicability of information provided. If this file has been
+ * purchased on magnetic or optical media from Unicode, Inc., the
+ * sole remedy for any claim will be exchange of defective media
+ * within 90 days of receipt.
+ *
+ * Limitations on Rights to Redistribute This Code
+ *
+ * Unicode, Inc. hereby grants the right to freely use the information
+ * supplied in this file in the creation of products supporting the
+ * Unicode Standard, and to make copies of this file in any form
+ * for internal or external distribution as long as this notice
+ * remains attached.
+ */
+
+/* ---------------------------------------------------------------------
+
+ Conversions between UTF32, UTF-16, and UTF-8. Header file.
+
+ Several funtions are included here, forming a complete set of
+ conversions between the three formats. UTF-7 is not included
+ here, but is handled in a separate source file.
+
+ Each of these routines takes pointers to input buffers and output
+ buffers. The input buffers are const.
+
+ Each routine converts the text between *sourceStart and sourceEnd,
+ putting the result into the buffer between *targetStart and
+ targetEnd. Note: the end pointers are *after* the last item: e.g.
+ *(sourceEnd - 1) is the last item.
+
+ The return result indicates whether the conversion was successful,
+ and if not, whether the problem was in the source or target buffers.
+ (Only the first encountered problem is indicated.)
+
+ After the conversion, *sourceStart and *targetStart are both
+ updated to point to the end of last text successfully converted in
+ the respective buffers.
+
+ Input parameters:
+ sourceStart - pointer to a pointer to the source buffer.
+ The contents of this are modified on return so that
+ it points at the next thing to be converted.
+ targetStart - similarly, pointer to pointer to the target buffer.
+ sourceEnd, targetEnd - respectively pointers to the ends of the
+ two buffers, for overflow checking only.
+
+ These conversion functions take a ConversionFlags argument. When this
+ flag is set to strict, both irregular sequences and isolated surrogates
+ will cause an error. When the flag is set to lenient, both irregular
+ sequences and isolated surrogates are converted.
+
+ Whether the flag is strict or lenient, all illegal sequences will cause
+ an error return. This includes sequences such as: <F4 90 80 80>, <C0 80>,
+ or <A0> in UTF-8, and values above 0x10FFFF in UTF-32. Conformant code
+ must check for illegal sequences.
+
+ When the flag is set to lenient, characters over 0x10FFFF are converted
+ to the replacement character; otherwise (when the flag is set to strict)
+ they constitute an error.
+
+ Output parameters:
+ The value "sourceIllegal" is returned from some routines if the input
+ sequence is malformed. When "sourceIllegal" is returned, the source
+ value will point to the illegal value that caused the problem. E.g.,
+ in UTF-8 when a sequence is malformed, it points to the start of the
+ malformed sequence.
+
+ Author: Mark E. Davis, 1994.
+ Rev History: Rick McGowan, fixes & updates May 2001.
+ Fixes & updates, Sept 2001.
+
+------------------------------------------------------------------------ */
+
+/* ---------------------------------------------------------------------
+ The following 4 definitions are compiler-specific.
+ The C standard does not guarantee that wchar_t has at least
+ 16 bits, so wchar_t is no less portable than unsigned short!
+ All should be unsigned values to avoid sign extension during
+ bit mask & shift operations.
+------------------------------------------------------------------------ */
+
+typedef unsigned long UTF32; /* at least 32 bits */
+typedef unsigned short UTF16; /* at least 16 bits */
+typedef unsigned char UTF8; /* typically 8 bits */
+typedef unsigned char Boolean; /* 0 or 1 */
+
+/* Some fundamental constants */
+#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
+#define UNI_MAX_BMP (UTF32)0x0000FFFF
+#define UNI_MAX_UTF16 (UTF32)0x0010FFFF
+#define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF
+#define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF
+
+typedef enum {
+ conversionOK, /* conversion successful */
+ sourceExhausted, /* partial character in source, but hit end */
+ targetExhausted, /* insuff. room in target for conversion */
+ sourceIllegal /* source sequence is illegal/malformed */
+} ConversionResult;
+
+typedef enum {
+ strictConversion = 0,
+ lenientConversion
+} ConversionFlags;
+
+/* This is for C++ and does no harm in C */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ConversionResult ConvertUTF8toUTF16 (
+ const UTF8** sourceStart, const UTF8* sourceEnd,
+ UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
+
+ConversionResult ConvertUTF16toUTF8 (
+ const UTF16** sourceStart, const UTF16* sourceEnd,
+ UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
+
+ConversionResult ConvertUTF8toUTF32 (
+ const UTF8** sourceStart, const UTF8* sourceEnd,
+ UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
+
+ConversionResult ConvertUTF32toUTF8 (
+ const UTF32** sourceStart, const UTF32* sourceEnd,
+ UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
+
+ConversionResult ConvertUTF16toUTF32 (
+ const UTF16** sourceStart, const UTF16* sourceEnd,
+ UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
+
+ConversionResult ConvertUTF32toUTF16 (
+ const UTF32** sourceStart, const UTF32* sourceEnd,
+ UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
+
+Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd);
+
+#ifdef __cplusplus
+}
+#endif
+
+/* --------------------------------------------------------------------- */
diff --git a/support/win32/Makefile.am b/support/win32/Makefile.am
new file mode 100644
index 00000000..0b71ae19
--- /dev/null
+++ b/support/win32/Makefile.am
@@ -0,0 +1,4 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=support_win32
+noinst_LTLIBRARIES = libsupport_win32.la
+libsupport_win32_la_SOURCES = mmap.c win32_init.c sys/mman.h ConvertUTF.c ConvertUTF.h
diff --git a/support/win32/mmap.c b/support/win32/mmap.c
new file mode 100644
index 00000000..008ffa66
--- /dev/null
+++ b/support/win32/mmap.c
@@ -0,0 +1,43 @@
+#include <windows.h>
+#include "sys/mman.h"
+
+void * mmap_readonly_win32( const char* name, long* map_handle_ptr, long* map_file_ptr )
+{
+ void * mapped_ptr = NULL;
+#if defined(__CEGCC__)
+
+ wchar_t filename[MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, name, strlen(name), 0, 0)];
+ MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, name, strlen(name), filename, wcslen(filename)) ;
+
+ HANDLE hFile = CreateFile (filename, GENERIC_READ, FILE_SHARE_READ,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
+#else
+ HANDLE hFile = CreateFile (name, GENERIC_READ, FILE_SHARE_READ,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
+#endif
+ *map_file_ptr = (long)hFile;
+ *map_handle_ptr = 0;
+
+ if ( hFile != HFILE_ERROR )
+ {
+ HANDLE hMapping = CreateFileMapping( (HANDLE)hFile, NULL, PAGE_READONLY, 0, 0, NULL);
+ mapped_ptr = MapViewOfFile(hMapping, FILE_MAP_READ, 0 , 0, 0 );
+ *map_handle_ptr = (long)hMapping;
+ }
+
+ return mapped_ptr;
+}
+
+void mmap_unmap_win32( void* mem_ptr, long map_handle, long map_file )
+{
+ if ( mem_ptr != NULL )
+ {
+ UnmapViewOfFile( mem_ptr );
+ }
+ if ( map_handle != 0)
+ {
+ CloseHandle( (HANDLE)map_handle );
+ }
+ if ( map_file != 0 )
+ {
+ CloseHandle( (HANDLE)map_file );
+ }
+}
diff --git a/projs/CodeBlocks/Win32Extra/sys/mman.h b/support/win32/sys/mman.h
index 37e59b9e..37e59b9e 100644
--- a/projs/CodeBlocks/Win32Extra/sys/mman.h
+++ b/support/win32/sys/mman.h
diff --git a/support/win32/win32_init.c b/support/win32/win32_init.c
new file mode 100644
index 00000000..32be387d
--- /dev/null
+++ b/support/win32/win32_init.c
@@ -0,0 +1,6 @@
+#include "plugin.h"
+
+void
+plugin_init(void)
+{
+}
diff --git a/support/wordexp/Makefile.am b/support/wordexp/Makefile.am
new file mode 100644
index 00000000..44d5ad27
--- /dev/null
+++ b/support/wordexp/Makefile.am
@@ -0,0 +1,4 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=support_wordexp
+noinst_LTLIBRARIES = libsupport_wordexp.la
+libsupport_wordexp_la_SOURCES = wordexp.c wordexp_init.c wordexp.h glob.c glob.h
diff --git a/support/wordexp/glob.c b/support/wordexp/glob.c
new file mode 100644
index 00000000..3bb70de1
--- /dev/null
+++ b/support/wordexp/glob.c
@@ -0,0 +1,108 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/*
+ * @file glob.c
+ */
+
+#include <config.h>
+
+#ifndef HAVE_GLOB
+#if defined _WIN32 || defined _WIN32_WCE
+#include <windows.h>
+#include "glob.h"
+
+/*
+ * @brief searches for all the pathnames matching pattern according to the rules
+ * which is similar to the rules used by common shells.
+ * here: expanding of ´*´ and ´?´ only in filenames
+ * @param pattern: no tilde expansion or parameter substitution is done.
+ * @param flags: not supported here
+ * @param errfunc: not supported here
+ * @param pglob: struct with array containing the matched files/directories
+ * @return FALSE on error.
+ */
+int glob(const char *pattern, int flags,
+ int (*errfunc)(const char *epath, int eerrno),
+ glob_t *pglob)
+{
+ char *pathend,
+ *filename;
+ int pathlen;
+ HANDLE hFiles;
+#ifndef UNICODE
+ WIN32_FIND_DATA xFindData;
+ hFiles = FindFirstFile (pattern, &xFindData);
+#else
+ int len = strlen(pattern) * sizeof(wchar_t*);
+ wchar_t *pathname = malloc(len);
+ WIN32_FIND_DATAW xFindData;
+ mbstowcs (pathname, pattern, len);
+ hFiles = FindFirstFile (pathname, &xFindData);
+#endif
+
+ if(hFiles == INVALID_HANDLE_VALUE)
+ {
+ return 1;
+ }
+ /* store the path information */
+ if (NULL == (pathend = strrchr (pattern, '\\'))) /* windows */
+ if (NULL == (pathend = strrchr (pattern, '/'))) /* UNIX in windows is sometimes allowed also*/
+ pathend = (char *) pattern;
+ pathlen = pathend - pattern + 1;
+
+ /* glob */
+ pglob->gl_pathc = 0; /* number of founded files */
+ pglob->gl_offs = 0; /* not needed */
+ pglob->gl_pathv = malloc(sizeof(char*));
+
+ do
+ {
+ pglob->gl_pathc++;
+ pglob->gl_pathv = realloc (pglob->gl_pathv, pglob->gl_pathc * sizeof(char*));
+#ifndef UNICODE
+ filename = xFindData.cFileName;
+#else
+ len = wcslen(xFindData.cFileName) * sizeof(char*);
+ filename = malloc (len);
+ wcstombs (filename, xFindData.cFileName, len);
+#endif
+ pglob->gl_pathv[pglob->gl_pathc - 1] = malloc ((pathlen + strlen (filename) + 1) * sizeof(char*));
+ strncpy (pglob->gl_pathv[pglob->gl_pathc - 1], pattern, pathlen);
+ strcpy (pglob->gl_pathv[pglob->gl_pathc - 1] + pathlen, filename);
+ } while (FindNextFile (hFiles, &xFindData));
+
+ FindClose(hFiles);
+ return 0;
+}
+
+void globfree(glob_t *pglob)
+{
+ int i;
+
+ for (i=0; i < pglob->gl_pathc; i++)
+ {
+ free (pglob->gl_pathv[i]);
+ }
+ free (pglob->gl_pathv);
+ pglob->gl_pathc = 0;
+}
+
+#endif /* _WIN32 || _WIN32_WCE */
+#endif /* HAVE_GLOB */
diff --git a/support/wordexp/glob.h b/support/wordexp/glob.h
new file mode 100644
index 00000000..052b76f4
--- /dev/null
+++ b/support/wordexp/glob.h
@@ -0,0 +1,19 @@
+#ifndef _GLOB_H_
+#define _GLOB_H_
+
+#ifndef HAVE_GLOB
+#ifdef __MINGW32__
+
+typedef struct {
+ size_t gl_pathc;
+ char **gl_pathv;
+ size_t gl_offs;
+} glob_t;
+
+int glob(const char *pattern, int flags, int (*errfunc)(const char *epath, int eerrno), glob_t *pglob);
+void globfree(glob_t *pglob);
+
+#endif
+#endif
+
+#endif /* _GLOB_H_ */
diff --git a/support/wordexp/wordexp.c b/support/wordexp/wordexp.c
new file mode 100644
index 00000000..d4ad44a9
--- /dev/null
+++ b/support/wordexp/wordexp.c
@@ -0,0 +1,134 @@
+
+#include <config.h>
+
+#include <sys/types.h>
+#include <assert.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include "wordexp.h"
+#include "glob.h"
+
+
+static int
+is_valid_variable_char(char c, int pos)
+{
+ if ( (pos && c >= '0' && c <= '9') ||
+ c == '_' ||
+ (c >= 'a' && c <= 'z') ||
+ (c >= 'A' && c <= 'Z'))
+ return 1;
+ return 0;
+}
+
+/*
+ * @brief replace all names of $NAME ${NAME}
+ * with the corresponding environment variable
+ * @ param in: the string to be checked
+ * @ return the expanded string or a copy of the existing string
+ * must be free() by the calling function
+*/
+static char *
+expand_variables(const char *in)
+{
+ char *var,*pos,*ret=strdup(in);
+ char *val,*str;
+ pos=ret;
+ while ((var=strchr(pos, '$'))) {
+ char *name,*begin=var+1;
+ int npos=0,bpos=0,slen,elen;
+ *var='\0';
+ if (var[1] == '{') {
+ begin++;
+ while (begin[npos]) {
+ bpos=npos;
+ if (begin[npos++] == '}')
+ break;
+ }
+ } else {
+ while (is_valid_variable_char(begin[npos],npos))
+ npos++;
+ bpos=npos;
+ }
+ name=strdup(begin);
+ name[bpos]='\0';
+ val=getenv(name);
+ free(name);
+ if (! val)
+ val="";
+ slen=strlen(ret)+strlen(val);
+ elen=strlen(begin+npos);
+ str=malloc(slen+elen+1);
+ strcpy(str,ret);
+ strcat(str,val);
+ strcat(str,begin+npos);
+ free(ret);
+ ret=str;
+ pos=ret+slen;
+ }
+ return ret;
+}
+
+/*
+ * @brief minimal realization of wordexp according to IEEE standard
+ * shall perform word expansion as described in the Shell
+ * expansion of ´$NAME´ or ´${NAME}´
+ * expansion of ´*´ and ´?´
+ * @param words: pointer to a string containing one or more words to be expanded
+ * but here only one word supported
+ */
+int
+wordexp(const char *words, wordexp_t *we, int flags)
+{
+ int i;
+ int error;
+ char *words_expanded;
+ glob_t pglob;
+
+ assert(we != NULL);
+ assert(words != NULL);
+
+ /* expansion of ´$NAME´ or ´${NAME}´ */
+ words_expanded=expand_variables(words);
+
+ /* expansion of ´*´, ´?´ */
+ error=glob(words_expanded, 0, NULL, &pglob);
+ if (!error)
+ {
+ /* copy the content of struct of glob into struct of wordexp */
+ we->we_wordc = pglob.gl_pathc;
+ we->we_offs = pglob.gl_offs;
+ we->we_wordv = malloc(we->we_wordc * sizeof(char*));
+ for (i=0; i<we->we_wordc; i++)
+ {
+ we->we_wordv[i] = strdup(pglob.gl_pathv[i]);
+ }
+ globfree(&pglob);
+ free(words_expanded);
+ }
+ else
+ {
+ we->we_wordc = 1;
+ we->we_wordv = malloc(sizeof(char*));
+ we->we_wordv[0] = words_expanded;
+ }
+
+
+ return error;
+}
+
+
+void wordfree(wordexp_t *we)
+{
+ int i;
+
+ for (i=0; i < we->we_wordc; i++)
+ {
+ free (we->we_wordv[i]);
+ }
+
+ free (we->we_wordv);
+ we->we_wordc = 0;
+}
diff --git a/projs/CodeBlocks/Win32Extra/wordexp.h b/support/wordexp/wordexp.h
index ad18c785..ad18c785 100644
--- a/projs/CodeBlocks/Win32Extra/wordexp.h
+++ b/support/wordexp/wordexp.h
diff --git a/support/wordexp/wordexp_init.c b/support/wordexp/wordexp_init.c
new file mode 100644
index 00000000..32be387d
--- /dev/null
+++ b/support/wordexp/wordexp_init.c
@@ -0,0 +1,6 @@
+#include "plugin.h"
+
+void
+plugin_init(void)
+{
+}
diff --git a/support/zlib/Makefile.am b/support/zlib/Makefile.am
new file mode 100644
index 00000000..a49fe3ca
--- /dev/null
+++ b/support/zlib/Makefile.am
@@ -0,0 +1,4 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=support_zlib
+noinst_LTLIBRARIES = libsupport_zlib.la
+libsupport_zlib_la_SOURCES = adler32.c crc32.c crc32.h infback.c inffast.c inffast.h inffixed.h inflate.c inflate.h inftrees.c inftrees.h zconf.h zlib.h zutil.c zutil.h zlib_init.c
diff --git a/support/zlib/adler32.c b/support/zlib/adler32.c
new file mode 100644
index 00000000..007ba262
--- /dev/null
+++ b/support/zlib/adler32.c
@@ -0,0 +1,149 @@
+/* adler32.c -- compute the Adler-32 checksum of a data stream
+ * Copyright (C) 1995-2004 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id$ */
+
+#define ZLIB_INTERNAL
+#include "zlib.h"
+
+#define BASE 65521UL /* largest prime smaller than 65536 */
+#define NMAX 5552
+/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
+
+#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
+#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
+#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
+#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
+#define DO16(buf) DO8(buf,0); DO8(buf,8);
+
+/* use NO_DIVIDE if your processor does not do division in hardware */
+#ifdef NO_DIVIDE
+# define MOD(a) \
+ do { \
+ if (a >= (BASE << 16)) a -= (BASE << 16); \
+ if (a >= (BASE << 15)) a -= (BASE << 15); \
+ if (a >= (BASE << 14)) a -= (BASE << 14); \
+ if (a >= (BASE << 13)) a -= (BASE << 13); \
+ if (a >= (BASE << 12)) a -= (BASE << 12); \
+ if (a >= (BASE << 11)) a -= (BASE << 11); \
+ if (a >= (BASE << 10)) a -= (BASE << 10); \
+ if (a >= (BASE << 9)) a -= (BASE << 9); \
+ if (a >= (BASE << 8)) a -= (BASE << 8); \
+ if (a >= (BASE << 7)) a -= (BASE << 7); \
+ if (a >= (BASE << 6)) a -= (BASE << 6); \
+ if (a >= (BASE << 5)) a -= (BASE << 5); \
+ if (a >= (BASE << 4)) a -= (BASE << 4); \
+ if (a >= (BASE << 3)) a -= (BASE << 3); \
+ if (a >= (BASE << 2)) a -= (BASE << 2); \
+ if (a >= (BASE << 1)) a -= (BASE << 1); \
+ if (a >= BASE) a -= BASE; \
+ } while (0)
+# define MOD4(a) \
+ do { \
+ if (a >= (BASE << 4)) a -= (BASE << 4); \
+ if (a >= (BASE << 3)) a -= (BASE << 3); \
+ if (a >= (BASE << 2)) a -= (BASE << 2); \
+ if (a >= (BASE << 1)) a -= (BASE << 1); \
+ if (a >= BASE) a -= BASE; \
+ } while (0)
+#else
+# define MOD(a) a %= BASE
+# define MOD4(a) a %= BASE
+#endif
+
+/* ========================================================================= */
+uLong ZEXPORT adler32(adler, buf, len)
+ uLong adler;
+ const Bytef *buf;
+ uInt len;
+{
+ unsigned long sum2;
+ unsigned n;
+
+ /* split Adler-32 into component sums */
+ sum2 = (adler >> 16) & 0xffff;
+ adler &= 0xffff;
+
+ /* in case user likes doing a byte at a time, keep it fast */
+ if (len == 1) {
+ adler += buf[0];
+ if (adler >= BASE)
+ adler -= BASE;
+ sum2 += adler;
+ if (sum2 >= BASE)
+ sum2 -= BASE;
+ return adler | (sum2 << 16);
+ }
+
+ /* initial Adler-32 value (deferred check for len == 1 speed) */
+ if (buf == Z_NULL)
+ return 1L;
+
+ /* in case short lengths are provided, keep it somewhat fast */
+ if (len < 16) {
+ while (len--) {
+ adler += *buf++;
+ sum2 += adler;
+ }
+ if (adler >= BASE)
+ adler -= BASE;
+ MOD4(sum2); /* only added so many BASE's */
+ return adler | (sum2 << 16);
+ }
+
+ /* do length NMAX blocks -- requires just one modulo operation */
+ while (len >= NMAX) {
+ len -= NMAX;
+ n = NMAX / 16; /* NMAX is divisible by 16 */
+ do {
+ DO16(buf); /* 16 sums unrolled */
+ buf += 16;
+ } while (--n);
+ MOD(adler);
+ MOD(sum2);
+ }
+
+ /* do remaining bytes (less than NMAX, still just one modulo) */
+ if (len) { /* avoid modulos if none remaining */
+ while (len >= 16) {
+ len -= 16;
+ DO16(buf);
+ buf += 16;
+ }
+ while (len--) {
+ adler += *buf++;
+ sum2 += adler;
+ }
+ MOD(adler);
+ MOD(sum2);
+ }
+
+ /* return recombined sums */
+ return adler | (sum2 << 16);
+}
+
+/* ========================================================================= */
+uLong ZEXPORT adler32_combine(adler1, adler2, len2)
+ uLong adler1;
+ uLong adler2;
+ z_off_t len2;
+{
+ unsigned long sum1;
+ unsigned long sum2;
+ unsigned rem;
+
+ /* the derivation of this formula is left as an exercise for the reader */
+ rem = (unsigned)(len2 % BASE);
+ sum1 = adler1 & 0xffff;
+ sum2 = rem * sum1;
+ MOD(sum2);
+ sum1 += (adler2 & 0xffff) + BASE - 1;
+ sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
+ if (sum1 > BASE) sum1 -= BASE;
+ if (sum1 > BASE) sum1 -= BASE;
+ if (sum2 > (BASE << 1)) sum2 -= (BASE << 1);
+ if (sum2 > BASE) sum2 -= BASE;
+ return sum1 | (sum2 << 16);
+}
diff --git a/support/zlib/crc32.c b/support/zlib/crc32.c
new file mode 100644
index 00000000..f658a9ef
--- /dev/null
+++ b/support/zlib/crc32.c
@@ -0,0 +1,423 @@
+/* crc32.c -- compute the CRC-32 of a data stream
+ * Copyright (C) 1995-2005 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ *
+ * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
+ * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
+ * tables for updating the shift register in one step with three exclusive-ors
+ * instead of four steps with four exclusive-ors. This results in about a
+ * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
+ */
+
+/* @(#) $Id$ */
+
+/*
+ Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore
+ protection on the static variables used to control the first-use generation
+ of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should
+ first call get_crc_table() to initialize the tables before allowing more than
+ one thread to use crc32().
+ */
+
+#ifdef MAKECRCH
+# include <stdio.h>
+# ifndef DYNAMIC_CRC_TABLE
+# define DYNAMIC_CRC_TABLE
+# endif /* !DYNAMIC_CRC_TABLE */
+#endif /* MAKECRCH */
+
+#include "zutil.h" /* for STDC and FAR definitions */
+
+#define local static
+
+/* Find a four-byte integer type for crc32_little() and crc32_big(). */
+#ifndef NOBYFOUR
+# ifdef STDC /* need ANSI C limits.h to determine sizes */
+# include <limits.h>
+# define BYFOUR
+# if (UINT_MAX == 0xffffffffUL)
+ typedef unsigned int u4;
+# else
+# if (ULONG_MAX == 0xffffffffUL)
+ typedef unsigned long u4;
+# else
+# if (USHRT_MAX == 0xffffffffUL)
+ typedef unsigned short u4;
+# else
+# undef BYFOUR /* can't find a four-byte integer type! */
+# endif
+# endif
+# endif
+# endif /* STDC */
+#endif /* !NOBYFOUR */
+
+/* Definitions for doing the crc four data bytes at a time. */
+#ifdef BYFOUR
+# define REV(w) (((w)>>24)+(((w)>>8)&0xff00)+ \
+ (((w)&0xff00)<<8)+(((w)&0xff)<<24))
+ local unsigned long crc32_little OF((unsigned long,
+ const unsigned char FAR *, unsigned));
+ local unsigned long crc32_big OF((unsigned long,
+ const unsigned char FAR *, unsigned));
+# define TBLS 8
+#else
+# define TBLS 1
+#endif /* BYFOUR */
+
+/* Local functions for crc concatenation */
+local unsigned long gf2_matrix_times OF((unsigned long *mat,
+ unsigned long vec));
+local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
+
+#ifdef DYNAMIC_CRC_TABLE
+
+local volatile int crc_table_empty = 1;
+local unsigned long FAR crc_table[TBLS][256];
+local void make_crc_table OF((void));
+#ifdef MAKECRCH
+ local void write_table OF((FILE *, const unsigned long FAR *));
+#endif /* MAKECRCH */
+/*
+ Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
+ x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
+
+ Polynomials over GF(2) are represented in binary, one bit per coefficient,
+ with the lowest powers in the most significant bit. Then adding polynomials
+ is just exclusive-or, and multiplying a polynomial by x is a right shift by
+ one. If we call the above polynomial p, and represent a byte as the
+ polynomial q, also with the lowest power in the most significant bit (so the
+ byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
+ where a mod b means the remainder after dividing a by b.
+
+ This calculation is done using the shift-register method of multiplying and
+ taking the remainder. The register is initialized to zero, and for each
+ incoming bit, x^32 is added mod p to the register if the bit is a one (where
+ x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
+ x (which is shifting right by one and adding x^32 mod p if the bit shifted
+ out is a one). We start with the highest power (least significant bit) of
+ q and repeat for all eight bits of q.
+
+ The first table is simply the CRC of all possible eight bit values. This is
+ all the information needed to generate CRCs on data a byte at a time for all
+ combinations of CRC register values and incoming bytes. The remaining tables
+ allow for word-at-a-time CRC calculation for both big-endian and little-
+ endian machines, where a word is four bytes.
+*/
+local void make_crc_table()
+{
+ unsigned long c;
+ int n, k;
+ unsigned long poly; /* polynomial exclusive-or pattern */
+ /* terms of polynomial defining this crc (except x^32): */
+ static volatile int first = 1; /* flag to limit concurrent making */
+ static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
+
+ /* See if another task is already doing this (not thread-safe, but better
+ than nothing -- significantly reduces duration of vulnerability in
+ case the advice about DYNAMIC_CRC_TABLE is ignored) */
+ if (first) {
+ first = 0;
+
+ /* make exclusive-or pattern from polynomial (0xedb88320UL) */
+ poly = 0UL;
+ for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++)
+ poly |= 1UL << (31 - p[n]);
+
+ /* generate a crc for every 8-bit value */
+ for (n = 0; n < 256; n++) {
+ c = (unsigned long)n;
+ for (k = 0; k < 8; k++)
+ c = c & 1 ? poly ^ (c >> 1) : c >> 1;
+ crc_table[0][n] = c;
+ }
+
+#ifdef BYFOUR
+ /* generate crc for each value followed by one, two, and three zeros,
+ and then the byte reversal of those as well as the first table */
+ for (n = 0; n < 256; n++) {
+ c = crc_table[0][n];
+ crc_table[4][n] = REV(c);
+ for (k = 1; k < 4; k++) {
+ c = crc_table[0][c & 0xff] ^ (c >> 8);
+ crc_table[k][n] = c;
+ crc_table[k + 4][n] = REV(c);
+ }
+ }
+#endif /* BYFOUR */
+
+ crc_table_empty = 0;
+ }
+ else { /* not first */
+ /* wait for the other guy to finish (not efficient, but rare) */
+ while (crc_table_empty)
+ ;
+ }
+
+#ifdef MAKECRCH
+ /* write out CRC tables to crc32.h */
+ {
+ FILE *out;
+
+ out = fopen("crc32.h", "w");
+ if (out == NULL) return;
+ fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
+ fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
+ fprintf(out, "local const unsigned long FAR ");
+ fprintf(out, "crc_table[TBLS][256] =\n{\n {\n");
+ write_table(out, crc_table[0]);
+# ifdef BYFOUR
+ fprintf(out, "#ifdef BYFOUR\n");
+ for (k = 1; k < 8; k++) {
+ fprintf(out, " },\n {\n");
+ write_table(out, crc_table[k]);
+ }
+ fprintf(out, "#endif\n");
+# endif /* BYFOUR */
+ fprintf(out, " }\n};\n");
+ fclose(out);
+ }
+#endif /* MAKECRCH */
+}
+
+#ifdef MAKECRCH
+local void write_table(out, table)
+ FILE *out;
+ const unsigned long FAR *table;
+{
+ int n;
+
+ for (n = 0; n < 256; n++)
+ fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n],
+ n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
+}
+#endif /* MAKECRCH */
+
+#else /* !DYNAMIC_CRC_TABLE */
+/* ========================================================================
+ * Tables of CRC-32s of all single-byte values, made by make_crc_table().
+ */
+#include "crc32.h"
+#endif /* DYNAMIC_CRC_TABLE */
+
+/* =========================================================================
+ * This function can be used by asm versions of crc32()
+ */
+const unsigned long FAR * ZEXPORT get_crc_table()
+{
+#ifdef DYNAMIC_CRC_TABLE
+ if (crc_table_empty)
+ make_crc_table();
+#endif /* DYNAMIC_CRC_TABLE */
+ return (const unsigned long FAR *)crc_table;
+}
+
+/* ========================================================================= */
+#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8)
+#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
+
+/* ========================================================================= */
+unsigned long ZEXPORT crc32(crc, buf, len)
+ unsigned long crc;
+ const unsigned char FAR *buf;
+ unsigned len;
+{
+ if (buf == Z_NULL) return 0UL;
+
+#ifdef DYNAMIC_CRC_TABLE
+ if (crc_table_empty)
+ make_crc_table();
+#endif /* DYNAMIC_CRC_TABLE */
+
+#ifdef BYFOUR
+ if (sizeof(void *) == sizeof(ptrdiff_t)) {
+ u4 endian;
+
+ endian = 1;
+ if (*((unsigned char *)(&endian)))
+ return crc32_little(crc, buf, len);
+ else
+ return crc32_big(crc, buf, len);
+ }
+#endif /* BYFOUR */
+ crc = crc ^ 0xffffffffUL;
+ while (len >= 8) {
+ DO8;
+ len -= 8;
+ }
+ if (len) do {
+ DO1;
+ } while (--len);
+ return crc ^ 0xffffffffUL;
+}
+
+#ifdef BYFOUR
+
+/* ========================================================================= */
+#define DOLIT4 c ^= *buf4++; \
+ c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \
+ crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24]
+#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4
+
+/* ========================================================================= */
+local unsigned long crc32_little(crc, buf, len)
+ unsigned long crc;
+ const unsigned char FAR *buf;
+ unsigned len;
+{
+ register u4 c;
+ register const u4 FAR *buf4;
+
+ c = (u4)crc;
+ c = ~c;
+ while (len && ((ptrdiff_t)buf & 3)) {
+ c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
+ len--;
+ }
+
+ buf4 = (const u4 FAR *)(const void FAR *)buf;
+ while (len >= 32) {
+ DOLIT32;
+ len -= 32;
+ }
+ while (len >= 4) {
+ DOLIT4;
+ len -= 4;
+ }
+ buf = (const unsigned char FAR *)buf4;
+
+ if (len) do {
+ c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
+ } while (--len);
+ c = ~c;
+ return (unsigned long)c;
+}
+
+/* ========================================================================= */
+#define DOBIG4 c ^= *++buf4; \
+ c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \
+ crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]
+#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
+
+/* ========================================================================= */
+local unsigned long crc32_big(crc, buf, len)
+ unsigned long crc;
+ const unsigned char FAR *buf;
+ unsigned len;
+{
+ register u4 c;
+ register const u4 FAR *buf4;
+
+ c = REV((u4)crc);
+ c = ~c;
+ while (len && ((ptrdiff_t)buf & 3)) {
+ c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
+ len--;
+ }
+
+ buf4 = (const u4 FAR *)(const void FAR *)buf;
+ buf4--;
+ while (len >= 32) {
+ DOBIG32;
+ len -= 32;
+ }
+ while (len >= 4) {
+ DOBIG4;
+ len -= 4;
+ }
+ buf4++;
+ buf = (const unsigned char FAR *)buf4;
+
+ if (len) do {
+ c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
+ } while (--len);
+ c = ~c;
+ return (unsigned long)(REV(c));
+}
+
+#endif /* BYFOUR */
+
+#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */
+
+/* ========================================================================= */
+local unsigned long gf2_matrix_times(mat, vec)
+ unsigned long *mat;
+ unsigned long vec;
+{
+ unsigned long sum;
+
+ sum = 0;
+ while (vec) {
+ if (vec & 1)
+ sum ^= *mat;
+ vec >>= 1;
+ mat++;
+ }
+ return sum;
+}
+
+/* ========================================================================= */
+local void gf2_matrix_square(square, mat)
+ unsigned long *square;
+ unsigned long *mat;
+{
+ int n;
+
+ for (n = 0; n < GF2_DIM; n++)
+ square[n] = gf2_matrix_times(mat, mat[n]);
+}
+
+/* ========================================================================= */
+uLong ZEXPORT crc32_combine(crc1, crc2, len2)
+ uLong crc1;
+ uLong crc2;
+ z_off_t len2;
+{
+ int n;
+ unsigned long row;
+ unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */
+ unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */
+
+ /* degenerate case */
+ if (len2 == 0)
+ return crc1;
+
+ /* put operator for one zero bit in odd */
+ odd[0] = 0xedb88320L; /* CRC-32 polynomial */
+ row = 1;
+ for (n = 1; n < GF2_DIM; n++) {
+ odd[n] = row;
+ row <<= 1;
+ }
+
+ /* put operator for two zero bits in even */
+ gf2_matrix_square(even, odd);
+
+ /* put operator for four zero bits in odd */
+ gf2_matrix_square(odd, even);
+
+ /* apply len2 zeros to crc1 (first square will put the operator for one
+ zero byte, eight zero bits, in even) */
+ do {
+ /* apply zeros operator for this bit of len2 */
+ gf2_matrix_square(even, odd);
+ if (len2 & 1)
+ crc1 = gf2_matrix_times(even, crc1);
+ len2 >>= 1;
+
+ /* if no more bits set, then done */
+ if (len2 == 0)
+ break;
+
+ /* another iteration of the loop with odd and even swapped */
+ gf2_matrix_square(odd, even);
+ if (len2 & 1)
+ crc1 = gf2_matrix_times(odd, crc1);
+ len2 >>= 1;
+
+ /* if no more bits set, then done */
+ } while (len2 != 0);
+
+ /* return combined crc */
+ crc1 ^= crc2;
+ return crc1;
+}
diff --git a/support/zlib/crc32.h b/support/zlib/crc32.h
new file mode 100644
index 00000000..8053b611
--- /dev/null
+++ b/support/zlib/crc32.h
@@ -0,0 +1,441 @@
+/* crc32.h -- tables for rapid CRC calculation
+ * Generated automatically by crc32.c
+ */
+
+local const unsigned long FAR crc_table[TBLS][256] =
+{
+ {
+ 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
+ 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
+ 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
+ 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
+ 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
+ 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
+ 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
+ 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
+ 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,
+ 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,
+ 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,
+ 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,
+ 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,
+ 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,
+ 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,
+ 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,
+ 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,
+ 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,
+ 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,
+ 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,
+ 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,
+ 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,
+ 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,
+ 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,
+ 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,
+ 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,
+ 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,
+ 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,
+ 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,
+ 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,
+ 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,
+ 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,
+ 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,
+ 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,
+ 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,
+ 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,
+ 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,
+ 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,
+ 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,
+ 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,
+ 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,
+ 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,
+ 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,
+ 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,
+ 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,
+ 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,
+ 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,
+ 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
+ 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
+ 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
+ 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
+ 0x2d02ef8dUL
+#ifdef BYFOUR
+ },
+ {
+ 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL,
+ 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL,
+ 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL,
+ 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL,
+ 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL,
+ 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL,
+ 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL,
+ 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL,
+ 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL,
+ 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL,
+ 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL,
+ 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL,
+ 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL,
+ 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL,
+ 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL,
+ 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL,
+ 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL,
+ 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL,
+ 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL,
+ 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL,
+ 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL,
+ 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL,
+ 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL,
+ 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL,
+ 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL,
+ 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL,
+ 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL,
+ 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL,
+ 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL,
+ 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL,
+ 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL,
+ 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL,
+ 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL,
+ 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL,
+ 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL,
+ 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL,
+ 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL,
+ 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL,
+ 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL,
+ 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL,
+ 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL,
+ 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL,
+ 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL,
+ 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL,
+ 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL,
+ 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL,
+ 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL,
+ 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL,
+ 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL,
+ 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL,
+ 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL,
+ 0x9324fd72UL
+ },
+ {
+ 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL,
+ 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL,
+ 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL,
+ 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL,
+ 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL,
+ 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL,
+ 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL,
+ 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL,
+ 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL,
+ 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL,
+ 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL,
+ 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL,
+ 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL,
+ 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL,
+ 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL,
+ 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL,
+ 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL,
+ 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL,
+ 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL,
+ 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL,
+ 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL,
+ 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL,
+ 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL,
+ 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL,
+ 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL,
+ 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL,
+ 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL,
+ 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL,
+ 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL,
+ 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL,
+ 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL,
+ 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL,
+ 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL,
+ 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL,
+ 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL,
+ 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL,
+ 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL,
+ 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL,
+ 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL,
+ 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL,
+ 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL,
+ 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL,
+ 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL,
+ 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL,
+ 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL,
+ 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL,
+ 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL,
+ 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL,
+ 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL,
+ 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL,
+ 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL,
+ 0xbe9834edUL
+ },
+ {
+ 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL,
+ 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL,
+ 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL,
+ 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL,
+ 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL,
+ 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL,
+ 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL,
+ 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL,
+ 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL,
+ 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL,
+ 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL,
+ 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL,
+ 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL,
+ 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL,
+ 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL,
+ 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL,
+ 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL,
+ 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL,
+ 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL,
+ 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL,
+ 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL,
+ 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL,
+ 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL,
+ 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL,
+ 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL,
+ 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL,
+ 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL,
+ 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL,
+ 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL,
+ 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL,
+ 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL,
+ 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL,
+ 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL,
+ 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL,
+ 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL,
+ 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL,
+ 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL,
+ 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL,
+ 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL,
+ 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL,
+ 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL,
+ 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL,
+ 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL,
+ 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL,
+ 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL,
+ 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL,
+ 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL,
+ 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL,
+ 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL,
+ 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL,
+ 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL,
+ 0xde0506f1UL
+ },
+ {
+ 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL,
+ 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL,
+ 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL,
+ 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL,
+ 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL,
+ 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL,
+ 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL,
+ 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL,
+ 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL,
+ 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL,
+ 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL,
+ 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL,
+ 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL,
+ 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL,
+ 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL,
+ 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL,
+ 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL,
+ 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL,
+ 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL,
+ 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL,
+ 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL,
+ 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL,
+ 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL,
+ 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL,
+ 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL,
+ 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL,
+ 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL,
+ 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL,
+ 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL,
+ 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL,
+ 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL,
+ 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL,
+ 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL,
+ 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL,
+ 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL,
+ 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL,
+ 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL,
+ 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL,
+ 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL,
+ 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL,
+ 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL,
+ 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL,
+ 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL,
+ 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL,
+ 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL,
+ 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL,
+ 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL,
+ 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL,
+ 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL,
+ 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL,
+ 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL,
+ 0x8def022dUL
+ },
+ {
+ 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL,
+ 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL,
+ 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL,
+ 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL,
+ 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL,
+ 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL,
+ 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL,
+ 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL,
+ 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL,
+ 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL,
+ 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL,
+ 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL,
+ 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL,
+ 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL,
+ 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL,
+ 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL,
+ 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL,
+ 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL,
+ 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL,
+ 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL,
+ 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL,
+ 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL,
+ 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL,
+ 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL,
+ 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL,
+ 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL,
+ 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL,
+ 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL,
+ 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL,
+ 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL,
+ 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL,
+ 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL,
+ 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL,
+ 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL,
+ 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL,
+ 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL,
+ 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL,
+ 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL,
+ 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL,
+ 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL,
+ 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL,
+ 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL,
+ 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL,
+ 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL,
+ 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL,
+ 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL,
+ 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL,
+ 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL,
+ 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL,
+ 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL,
+ 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL,
+ 0x72fd2493UL
+ },
+ {
+ 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL,
+ 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL,
+ 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL,
+ 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL,
+ 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL,
+ 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL,
+ 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL,
+ 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL,
+ 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL,
+ 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL,
+ 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL,
+ 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL,
+ 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL,
+ 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL,
+ 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL,
+ 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL,
+ 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL,
+ 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL,
+ 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL,
+ 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL,
+ 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL,
+ 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL,
+ 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL,
+ 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL,
+ 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL,
+ 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL,
+ 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL,
+ 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL,
+ 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL,
+ 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL,
+ 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL,
+ 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL,
+ 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL,
+ 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL,
+ 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL,
+ 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL,
+ 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL,
+ 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL,
+ 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL,
+ 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL,
+ 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL,
+ 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL,
+ 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL,
+ 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL,
+ 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL,
+ 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL,
+ 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL,
+ 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL,
+ 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL,
+ 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL,
+ 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL,
+ 0xed3498beUL
+ },
+ {
+ 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL,
+ 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL,
+ 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL,
+ 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL,
+ 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL,
+ 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL,
+ 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL,
+ 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL,
+ 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL,
+ 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL,
+ 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL,
+ 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL,
+ 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL,
+ 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL,
+ 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL,
+ 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL,
+ 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL,
+ 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL,
+ 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL,
+ 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL,
+ 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL,
+ 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL,
+ 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL,
+ 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL,
+ 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL,
+ 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL,
+ 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL,
+ 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL,
+ 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL,
+ 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL,
+ 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL,
+ 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL,
+ 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL,
+ 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL,
+ 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL,
+ 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL,
+ 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL,
+ 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL,
+ 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL,
+ 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL,
+ 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL,
+ 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL,
+ 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL,
+ 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL,
+ 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL,
+ 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL,
+ 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL,
+ 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL,
+ 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL,
+ 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL,
+ 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL,
+ 0xf10605deUL
+#endif
+ }
+};
diff --git a/support/zlib/infback.c b/support/zlib/infback.c
new file mode 100644
index 00000000..455dbc9e
--- /dev/null
+++ b/support/zlib/infback.c
@@ -0,0 +1,623 @@
+/* infback.c -- inflate using a call-back interface
+ * Copyright (C) 1995-2005 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/*
+ This code is largely copied from inflate.c. Normally either infback.o or
+ inflate.o would be linked into an application--not both. The interface
+ with inffast.c is retained so that optimized assembler-coded versions of
+ inflate_fast() can be used with either inflate.c or infback.c.
+ */
+
+#include "zutil.h"
+#include "inftrees.h"
+#include "inflate.h"
+#include "inffast.h"
+
+/* function prototypes */
+local void fixedtables OF((struct inflate_state FAR *state));
+
+/*
+ strm provides memory allocation functions in zalloc and zfree, or
+ Z_NULL to use the library memory allocation functions.
+
+ windowBits is in the range 8..15, and window is a user-supplied
+ window and output buffer that is 2**windowBits bytes.
+ */
+int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
+z_streamp strm;
+int windowBits;
+unsigned char FAR *window;
+const char *version;
+int stream_size;
+{
+ struct inflate_state FAR *state;
+
+ if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
+ stream_size != (int)(sizeof(z_stream)))
+ return Z_VERSION_ERROR;
+ if (strm == Z_NULL || window == Z_NULL ||
+ windowBits < 8 || windowBits > 15)
+ return Z_STREAM_ERROR;
+ strm->msg = Z_NULL; /* in case we return an error */
+ if (strm->zalloc == (alloc_func)0) {
+ strm->zalloc = zcalloc;
+ strm->opaque = (voidpf)0;
+ }
+ if (strm->zfree == (free_func)0) strm->zfree = zcfree;
+ state = (struct inflate_state FAR *)ZALLOC(strm, 1,
+ sizeof(struct inflate_state));
+ if (state == Z_NULL) return Z_MEM_ERROR;
+ Tracev((stderr, "inflate: allocated\n"));
+ strm->state = (struct internal_state FAR *)state;
+ state->dmax = 32768U;
+ state->wbits = windowBits;
+ state->wsize = 1U << windowBits;
+ state->window = window;
+ state->write = 0;
+ state->whave = 0;
+ return Z_OK;
+}
+
+/*
+ Return state with length and distance decoding tables and index sizes set to
+ fixed code decoding. Normally this returns fixed tables from inffixed.h.
+ If BUILDFIXED is defined, then instead this routine builds the tables the
+ first time it's called, and returns those tables the first time and
+ thereafter. This reduces the size of the code by about 2K bytes, in
+ exchange for a little execution time. However, BUILDFIXED should not be
+ used for threaded applications, since the rewriting of the tables and virgin
+ may not be thread-safe.
+ */
+local void fixedtables(state)
+struct inflate_state FAR *state;
+{
+#ifdef BUILDFIXED
+ static int virgin = 1;
+ static code *lenfix, *distfix;
+ static code fixed[544];
+
+ /* build fixed huffman tables if first call (may not be thread safe) */
+ if (virgin) {
+ unsigned sym, bits;
+ static code *next;
+
+ /* literal/length table */
+ sym = 0;
+ while (sym < 144) state->lens[sym++] = 8;
+ while (sym < 256) state->lens[sym++] = 9;
+ while (sym < 280) state->lens[sym++] = 7;
+ while (sym < 288) state->lens[sym++] = 8;
+ next = fixed;
+ lenfix = next;
+ bits = 9;
+ inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
+
+ /* distance table */
+ sym = 0;
+ while (sym < 32) state->lens[sym++] = 5;
+ distfix = next;
+ bits = 5;
+ inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
+
+ /* do this just once */
+ virgin = 0;
+ }
+#else /* !BUILDFIXED */
+# include "inffixed.h"
+#endif /* BUILDFIXED */
+ state->lencode = lenfix;
+ state->lenbits = 9;
+ state->distcode = distfix;
+ state->distbits = 5;
+}
+
+/* Macros for inflateBack(): */
+
+/* Load returned state from inflate_fast() */
+#define LOAD() \
+ do { \
+ put = strm->next_out; \
+ left = strm->avail_out; \
+ next = strm->next_in; \
+ have = strm->avail_in; \
+ hold = state->hold; \
+ bits = state->bits; \
+ } while (0)
+
+/* Set state from registers for inflate_fast() */
+#define RESTORE() \
+ do { \
+ strm->next_out = put; \
+ strm->avail_out = left; \
+ strm->next_in = next; \
+ strm->avail_in = have; \
+ state->hold = hold; \
+ state->bits = bits; \
+ } while (0)
+
+/* Clear the input bit accumulator */
+#define INITBITS() \
+ do { \
+ hold = 0; \
+ bits = 0; \
+ } while (0)
+
+/* Assure that some input is available. If input is requested, but denied,
+ then return a Z_BUF_ERROR from inflateBack(). */
+#define PULL() \
+ do { \
+ if (have == 0) { \
+ have = in(in_desc, &next); \
+ if (have == 0) { \
+ next = Z_NULL; \
+ ret = Z_BUF_ERROR; \
+ goto inf_leave; \
+ } \
+ } \
+ } while (0)
+
+/* Get a byte of input into the bit accumulator, or return from inflateBack()
+ with an error if there is no input available. */
+#define PULLBYTE() \
+ do { \
+ PULL(); \
+ have--; \
+ hold += (unsigned long)(*next++) << bits; \
+ bits += 8; \
+ } while (0)
+
+/* Assure that there are at least n bits in the bit accumulator. If there is
+ not enough available input to do that, then return from inflateBack() with
+ an error. */
+#define NEEDBITS(n) \
+ do { \
+ while (bits < (unsigned)(n)) \
+ PULLBYTE(); \
+ } while (0)
+
+/* Return the low n bits of the bit accumulator (n < 16) */
+#define BITS(n) \
+ ((unsigned)hold & ((1U << (n)) - 1))
+
+/* Remove n bits from the bit accumulator */
+#define DROPBITS(n) \
+ do { \
+ hold >>= (n); \
+ bits -= (unsigned)(n); \
+ } while (0)
+
+/* Remove zero to seven bits as needed to go to a byte boundary */
+#define BYTEBITS() \
+ do { \
+ hold >>= bits & 7; \
+ bits -= bits & 7; \
+ } while (0)
+
+/* Assure that some output space is available, by writing out the window
+ if it's full. If the write fails, return from inflateBack() with a
+ Z_BUF_ERROR. */
+#define ROOM() \
+ do { \
+ if (left == 0) { \
+ put = state->window; \
+ left = state->wsize; \
+ state->whave = left; \
+ if (out(out_desc, put, left)) { \
+ ret = Z_BUF_ERROR; \
+ goto inf_leave; \
+ } \
+ } \
+ } while (0)
+
+/*
+ strm provides the memory allocation functions and window buffer on input,
+ and provides information on the unused input on return. For Z_DATA_ERROR
+ returns, strm will also provide an error message.
+
+ in() and out() are the call-back input and output functions. When
+ inflateBack() needs more input, it calls in(). When inflateBack() has
+ filled the window with output, or when it completes with data in the
+ window, it calls out() to write out the data. The application must not
+ change the provided input until in() is called again or inflateBack()
+ returns. The application must not change the window/output buffer until
+ inflateBack() returns.
+
+ in() and out() are called with a descriptor parameter provided in the
+ inflateBack() call. This parameter can be a structure that provides the
+ information required to do the read or write, as well as accumulated
+ information on the input and output such as totals and check values.
+
+ in() should return zero on failure. out() should return non-zero on
+ failure. If either in() or out() fails, than inflateBack() returns a
+ Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it
+ was in() or out() that caused in the error. Otherwise, inflateBack()
+ returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format
+ error, or Z_MEM_ERROR if it could not allocate memory for the state.
+ inflateBack() can also return Z_STREAM_ERROR if the input parameters
+ are not correct, i.e. strm is Z_NULL or the state was not initialized.
+ */
+int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc)
+z_streamp strm;
+in_func in;
+void FAR *in_desc;
+out_func out;
+void FAR *out_desc;
+{
+ struct inflate_state FAR *state;
+ unsigned char FAR *next; /* next input */
+ unsigned char FAR *put; /* next output */
+ unsigned have, left; /* available input and output */
+ unsigned long hold; /* bit buffer */
+ unsigned bits; /* bits in bit buffer */
+ unsigned copy; /* number of stored or match bytes to copy */
+ unsigned char FAR *from; /* where to copy match bytes from */
+ code this; /* current decoding table entry */
+ code last; /* parent table entry */
+ unsigned len; /* length to copy for repeats, bits to drop */
+ int ret; /* return code */
+ static const unsigned short order[19] = /* permutation of code lengths */
+ {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
+
+ /* Check that the strm exists and that the state was initialized */
+ if (strm == Z_NULL || strm->state == Z_NULL)
+ return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)strm->state;
+
+ /* Reset the state */
+ strm->msg = Z_NULL;
+ state->mode = TYPE;
+ state->last = 0;
+ state->whave = 0;
+ next = strm->next_in;
+ have = next != Z_NULL ? strm->avail_in : 0;
+ hold = 0;
+ bits = 0;
+ put = state->window;
+ left = state->wsize;
+
+ /* Inflate until end of block marked as last */
+ for (;;)
+ switch (state->mode) {
+ case TYPE:
+ /* determine and dispatch block type */
+ if (state->last) {
+ BYTEBITS();
+ state->mode = DONE;
+ break;
+ }
+ NEEDBITS(3);
+ state->last = BITS(1);
+ DROPBITS(1);
+ switch (BITS(2)) {
+ case 0: /* stored block */
+ Tracev((stderr, "inflate: stored block%s\n",
+ state->last ? " (last)" : ""));
+ state->mode = STORED;
+ break;
+ case 1: /* fixed block */
+ fixedtables(state);
+ Tracev((stderr, "inflate: fixed codes block%s\n",
+ state->last ? " (last)" : ""));
+ state->mode = LEN; /* decode codes */
+ break;
+ case 2: /* dynamic block */
+ Tracev((stderr, "inflate: dynamic codes block%s\n",
+ state->last ? " (last)" : ""));
+ state->mode = TABLE;
+ break;
+ case 3:
+ strm->msg = (char *)"invalid block type";
+ state->mode = BAD;
+ }
+ DROPBITS(2);
+ break;
+
+ case STORED:
+ /* get and verify stored block length */
+ BYTEBITS(); /* go to byte boundary */
+ NEEDBITS(32);
+ if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
+ strm->msg = (char *)"invalid stored block lengths";
+ state->mode = BAD;
+ break;
+ }
+ state->length = (unsigned)hold & 0xffff;
+ Tracev((stderr, "inflate: stored length %u\n",
+ state->length));
+ INITBITS();
+
+ /* copy stored block from input to output */
+ while (state->length != 0) {
+ copy = state->length;
+ PULL();
+ ROOM();
+ if (copy > have) copy = have;
+ if (copy > left) copy = left;
+ zmemcpy(put, next, copy);
+ have -= copy;
+ next += copy;
+ left -= copy;
+ put += copy;
+ state->length -= copy;
+ }
+ Tracev((stderr, "inflate: stored end\n"));
+ state->mode = TYPE;
+ break;
+
+ case TABLE:
+ /* get dynamic table entries descriptor */
+ NEEDBITS(14);
+ state->nlen = BITS(5) + 257;
+ DROPBITS(5);
+ state->ndist = BITS(5) + 1;
+ DROPBITS(5);
+ state->ncode = BITS(4) + 4;
+ DROPBITS(4);
+#ifndef PKZIP_BUG_WORKAROUND
+ if (state->nlen > 286 || state->ndist > 30) {
+ strm->msg = (char *)"too many length or distance symbols";
+ state->mode = BAD;
+ break;
+ }
+#endif
+ Tracev((stderr, "inflate: table sizes ok\n"));
+
+ /* get code length code lengths (not a typo) */
+ state->have = 0;
+ while (state->have < state->ncode) {
+ NEEDBITS(3);
+ state->lens[order[state->have++]] = (unsigned short)BITS(3);
+ DROPBITS(3);
+ }
+ while (state->have < 19)
+ state->lens[order[state->have++]] = 0;
+ state->next = state->codes;
+ state->lencode = (code const FAR *)(state->next);
+ state->lenbits = 7;
+ ret = inflate_table(CODES, state->lens, 19, &(state->next),
+ &(state->lenbits), state->work);
+ if (ret) {
+ strm->msg = (char *)"invalid code lengths set";
+ state->mode = BAD;
+ break;
+ }
+ Tracev((stderr, "inflate: code lengths ok\n"));
+
+ /* get length and distance code code lengths */
+ state->have = 0;
+ while (state->have < state->nlen + state->ndist) {
+ for (;;) {
+ this = state->lencode[BITS(state->lenbits)];
+ if ((unsigned)(this.bits) <= bits) break;
+ PULLBYTE();
+ }
+ if (this.val < 16) {
+ NEEDBITS(this.bits);
+ DROPBITS(this.bits);
+ state->lens[state->have++] = this.val;
+ }
+ else {
+ if (this.val == 16) {
+ NEEDBITS(this.bits + 2);
+ DROPBITS(this.bits);
+ if (state->have == 0) {
+ strm->msg = (char *)"invalid bit length repeat";
+ state->mode = BAD;
+ break;
+ }
+ len = (unsigned)(state->lens[state->have - 1]);
+ copy = 3 + BITS(2);
+ DROPBITS(2);
+ }
+ else if (this.val == 17) {
+ NEEDBITS(this.bits + 3);
+ DROPBITS(this.bits);
+ len = 0;
+ copy = 3 + BITS(3);
+ DROPBITS(3);
+ }
+ else {
+ NEEDBITS(this.bits + 7);
+ DROPBITS(this.bits);
+ len = 0;
+ copy = 11 + BITS(7);
+ DROPBITS(7);
+ }
+ if (state->have + copy > state->nlen + state->ndist) {
+ strm->msg = (char *)"invalid bit length repeat";
+ state->mode = BAD;
+ break;
+ }
+ while (copy--)
+ state->lens[state->have++] = (unsigned short)len;
+ }
+ }
+
+ /* handle error breaks in while */
+ if (state->mode == BAD) break;
+
+ /* build code tables */
+ state->next = state->codes;
+ state->lencode = (code const FAR *)(state->next);
+ state->lenbits = 9;
+ ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
+ &(state->lenbits), state->work);
+ if (ret) {
+ strm->msg = (char *)"invalid literal/lengths set";
+ state->mode = BAD;
+ break;
+ }
+ state->distcode = (code const FAR *)(state->next);
+ state->distbits = 6;
+ ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
+ &(state->next), &(state->distbits), state->work);
+ if (ret) {
+ strm->msg = (char *)"invalid distances set";
+ state->mode = BAD;
+ break;
+ }
+ Tracev((stderr, "inflate: codes ok\n"));
+ state->mode = LEN;
+
+ case LEN:
+ /* use inflate_fast() if we have enough input and output */
+ if (have >= 6 && left >= 258) {
+ RESTORE();
+ if (state->whave < state->wsize)
+ state->whave = state->wsize - left;
+ inflate_fast(strm, state->wsize);
+ LOAD();
+ break;
+ }
+
+ /* get a literal, length, or end-of-block code */
+ for (;;) {
+ this = state->lencode[BITS(state->lenbits)];
+ if ((unsigned)(this.bits) <= bits) break;
+ PULLBYTE();
+ }
+ if (this.op && (this.op & 0xf0) == 0) {
+ last = this;
+ for (;;) {
+ this = state->lencode[last.val +
+ (BITS(last.bits + last.op) >> last.bits)];
+ if ((unsigned)(last.bits + this.bits) <= bits) break;
+ PULLBYTE();
+ }
+ DROPBITS(last.bits);
+ }
+ DROPBITS(this.bits);
+ state->length = (unsigned)this.val;
+
+ /* process literal */
+ if (this.op == 0) {
+ Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
+ "inflate: literal '%c'\n" :
+ "inflate: literal 0x%02x\n", this.val));
+ ROOM();
+ *put++ = (unsigned char)(state->length);
+ left--;
+ state->mode = LEN;
+ break;
+ }
+
+ /* process end of block */
+ if (this.op & 32) {
+ Tracevv((stderr, "inflate: end of block\n"));
+ state->mode = TYPE;
+ break;
+ }
+
+ /* invalid code */
+ if (this.op & 64) {
+ strm->msg = (char *)"invalid literal/length code";
+ state->mode = BAD;
+ break;
+ }
+
+ /* length code -- get extra bits, if any */
+ state->extra = (unsigned)(this.op) & 15;
+ if (state->extra != 0) {
+ NEEDBITS(state->extra);
+ state->length += BITS(state->extra);
+ DROPBITS(state->extra);
+ }
+ Tracevv((stderr, "inflate: length %u\n", state->length));
+
+ /* get distance code */
+ for (;;) {
+ this = state->distcode[BITS(state->distbits)];
+ if ((unsigned)(this.bits) <= bits) break;
+ PULLBYTE();
+ }
+ if ((this.op & 0xf0) == 0) {
+ last = this;
+ for (;;) {
+ this = state->distcode[last.val +
+ (BITS(last.bits + last.op) >> last.bits)];
+ if ((unsigned)(last.bits + this.bits) <= bits) break;
+ PULLBYTE();
+ }
+ DROPBITS(last.bits);
+ }
+ DROPBITS(this.bits);
+ if (this.op & 64) {
+ strm->msg = (char *)"invalid distance code";
+ state->mode = BAD;
+ break;
+ }
+ state->offset = (unsigned)this.val;
+
+ /* get distance extra bits, if any */
+ state->extra = (unsigned)(this.op) & 15;
+ if (state->extra != 0) {
+ NEEDBITS(state->extra);
+ state->offset += BITS(state->extra);
+ DROPBITS(state->extra);
+ }
+ if (state->offset > state->wsize - (state->whave < state->wsize ?
+ left : 0)) {
+ strm->msg = (char *)"invalid distance too far back";
+ state->mode = BAD;
+ break;
+ }
+ Tracevv((stderr, "inflate: distance %u\n", state->offset));
+
+ /* copy match from window to output */
+ do {
+ ROOM();
+ copy = state->wsize - state->offset;
+ if (copy < left) {
+ from = put + copy;
+ copy = left - copy;
+ }
+ else {
+ from = put - state->offset;
+ copy = left;
+ }
+ if (copy > state->length) copy = state->length;
+ state->length -= copy;
+ left -= copy;
+ do {
+ *put++ = *from++;
+ } while (--copy);
+ } while (state->length != 0);
+ break;
+
+ case DONE:
+ /* inflate stream terminated properly -- write leftover output */
+ ret = Z_STREAM_END;
+ if (left < state->wsize) {
+ if (out(out_desc, state->window, state->wsize - left))
+ ret = Z_BUF_ERROR;
+ }
+ goto inf_leave;
+
+ case BAD:
+ ret = Z_DATA_ERROR;
+ goto inf_leave;
+
+ default: /* can't happen, but makes compilers happy */
+ ret = Z_STREAM_ERROR;
+ goto inf_leave;
+ }
+
+ /* Return unused input */
+ inf_leave:
+ strm->next_in = next;
+ strm->avail_in = have;
+ return ret;
+}
+
+int ZEXPORT inflateBackEnd(strm)
+z_streamp strm;
+{
+ if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
+ return Z_STREAM_ERROR;
+ ZFREE(strm, strm->state);
+ strm->state = Z_NULL;
+ Tracev((stderr, "inflate: end\n"));
+ return Z_OK;
+}
diff --git a/support/zlib/inffast.c b/support/zlib/inffast.c
new file mode 100644
index 00000000..bbee92ed
--- /dev/null
+++ b/support/zlib/inffast.c
@@ -0,0 +1,318 @@
+/* inffast.c -- fast decoding
+ * Copyright (C) 1995-2004 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+#include "zutil.h"
+#include "inftrees.h"
+#include "inflate.h"
+#include "inffast.h"
+
+#ifndef ASMINF
+
+/* Allow machine dependent optimization for post-increment or pre-increment.
+ Based on testing to date,
+ Pre-increment preferred for:
+ - PowerPC G3 (Adler)
+ - MIPS R5000 (Randers-Pehrson)
+ Post-increment preferred for:
+ - none
+ No measurable difference:
+ - Pentium III (Anderson)
+ - M68060 (Nikl)
+ */
+#ifdef POSTINC
+# define OFF 0
+# define PUP(a) *(a)++
+#else
+# define OFF 1
+# define PUP(a) *++(a)
+#endif
+
+/*
+ Decode literal, length, and distance codes and write out the resulting
+ literal and match bytes until either not enough input or output is
+ available, an end-of-block is encountered, or a data error is encountered.
+ When large enough input and output buffers are supplied to inflate(), for
+ example, a 16K input buffer and a 64K output buffer, more than 95% of the
+ inflate execution time is spent in this routine.
+
+ Entry assumptions:
+
+ state->mode == LEN
+ strm->avail_in >= 6
+ strm->avail_out >= 258
+ start >= strm->avail_out
+ state->bits < 8
+
+ On return, state->mode is one of:
+
+ LEN -- ran out of enough output space or enough available input
+ TYPE -- reached end of block code, inflate() to interpret next block
+ BAD -- error in block data
+
+ Notes:
+
+ - The maximum input bits used by a length/distance pair is 15 bits for the
+ length code, 5 bits for the length extra, 15 bits for the distance code,
+ and 13 bits for the distance extra. This totals 48 bits, or six bytes.
+ Therefore if strm->avail_in >= 6, then there is enough input to avoid
+ checking for available input while decoding.
+
+ - The maximum bytes that a single length/distance pair can output is 258
+ bytes, which is the maximum length that can be coded. inflate_fast()
+ requires strm->avail_out >= 258 for each loop to avoid checking for
+ output space.
+ */
+void inflate_fast(strm, start)
+z_streamp strm;
+unsigned start; /* inflate()'s starting value for strm->avail_out */
+{
+ struct inflate_state FAR *state;
+ unsigned char FAR *in; /* local strm->next_in */
+ unsigned char FAR *last; /* while in < last, enough input available */
+ unsigned char FAR *out; /* local strm->next_out */
+ unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
+ unsigned char FAR *end; /* while out < end, enough space available */
+#ifdef INFLATE_STRICT
+ unsigned dmax; /* maximum distance from zlib header */
+#endif
+ unsigned wsize; /* window size or zero if not using window */
+ unsigned whave; /* valid bytes in the window */
+ unsigned write; /* window write index */
+ unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */
+ unsigned long hold; /* local strm->hold */
+ unsigned bits; /* local strm->bits */
+ code const FAR *lcode; /* local strm->lencode */
+ code const FAR *dcode; /* local strm->distcode */
+ unsigned lmask; /* mask for first level of length codes */
+ unsigned dmask; /* mask for first level of distance codes */
+ code this; /* retrieved table entry */
+ unsigned op; /* code bits, operation, extra bits, or */
+ /* window position, window bytes to copy */
+ unsigned len; /* match length, unused bytes */
+ unsigned dist; /* match distance */
+ unsigned char FAR *from; /* where to copy match from */
+
+ /* copy state to local variables */
+ state = (struct inflate_state FAR *)strm->state;
+ in = strm->next_in - OFF;
+ last = in + (strm->avail_in - 5);
+ out = strm->next_out - OFF;
+ beg = out - (start - strm->avail_out);
+ end = out + (strm->avail_out - 257);
+#ifdef INFLATE_STRICT
+ dmax = state->dmax;
+#endif
+ wsize = state->wsize;
+ whave = state->whave;
+ write = state->write;
+ window = state->window;
+ hold = state->hold;
+ bits = state->bits;
+ lcode = state->lencode;
+ dcode = state->distcode;
+ lmask = (1U << state->lenbits) - 1;
+ dmask = (1U << state->distbits) - 1;
+
+ /* decode literals and length/distances until end-of-block or not enough
+ input data or output space */
+ do {
+ if (bits < 15) {
+ hold += (unsigned long)(PUP(in)) << bits;
+ bits += 8;
+ hold += (unsigned long)(PUP(in)) << bits;
+ bits += 8;
+ }
+ this = lcode[hold & lmask];
+ dolen:
+ op = (unsigned)(this.bits);
+ hold >>= op;
+ bits -= op;
+ op = (unsigned)(this.op);
+ if (op == 0) { /* literal */
+ Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
+ "inflate: literal '%c'\n" :
+ "inflate: literal 0x%02x\n", this.val));
+ PUP(out) = (unsigned char)(this.val);
+ }
+ else if (op & 16) { /* length base */
+ len = (unsigned)(this.val);
+ op &= 15; /* number of extra bits */
+ if (op) {
+ if (bits < op) {
+ hold += (unsigned long)(PUP(in)) << bits;
+ bits += 8;
+ }
+ len += (unsigned)hold & ((1U << op) - 1);
+ hold >>= op;
+ bits -= op;
+ }
+ Tracevv((stderr, "inflate: length %u\n", len));
+ if (bits < 15) {
+ hold += (unsigned long)(PUP(in)) << bits;
+ bits += 8;
+ hold += (unsigned long)(PUP(in)) << bits;
+ bits += 8;
+ }
+ this = dcode[hold & dmask];
+ dodist:
+ op = (unsigned)(this.bits);
+ hold >>= op;
+ bits -= op;
+ op = (unsigned)(this.op);
+ if (op & 16) { /* distance base */
+ dist = (unsigned)(this.val);
+ op &= 15; /* number of extra bits */
+ if (bits < op) {
+ hold += (unsigned long)(PUP(in)) << bits;
+ bits += 8;
+ if (bits < op) {
+ hold += (unsigned long)(PUP(in)) << bits;
+ bits += 8;
+ }
+ }
+ dist += (unsigned)hold & ((1U << op) - 1);
+#ifdef INFLATE_STRICT
+ if (dist > dmax) {
+ strm->msg = (char *)"invalid distance too far back";
+ state->mode = BAD;
+ break;
+ }
+#endif
+ hold >>= op;
+ bits -= op;
+ Tracevv((stderr, "inflate: distance %u\n", dist));
+ op = (unsigned)(out - beg); /* max distance in output */
+ if (dist > op) { /* see if copy from window */
+ op = dist - op; /* distance back in window */
+ if (op > whave) {
+ strm->msg = (char *)"invalid distance too far back";
+ state->mode = BAD;
+ break;
+ }
+ from = window - OFF;
+ if (write == 0) { /* very common case */
+ from += wsize - op;
+ if (op < len) { /* some from window */
+ len -= op;
+ do {
+ PUP(out) = PUP(from);
+ } while (--op);
+ from = out - dist; /* rest from output */
+ }
+ }
+ else if (write < op) { /* wrap around window */
+ from += wsize + write - op;
+ op -= write;
+ if (op < len) { /* some from end of window */
+ len -= op;
+ do {
+ PUP(out) = PUP(from);
+ } while (--op);
+ from = window - OFF;
+ if (write < len) { /* some from start of window */
+ op = write;
+ len -= op;
+ do {
+ PUP(out) = PUP(from);
+ } while (--op);
+ from = out - dist; /* rest from output */
+ }
+ }
+ }
+ else { /* contiguous in window */
+ from += write - op;
+ if (op < len) { /* some from window */
+ len -= op;
+ do {
+ PUP(out) = PUP(from);
+ } while (--op);
+ from = out - dist; /* rest from output */
+ }
+ }
+ while (len > 2) {
+ PUP(out) = PUP(from);
+ PUP(out) = PUP(from);
+ PUP(out) = PUP(from);
+ len -= 3;
+ }
+ if (len) {
+ PUP(out) = PUP(from);
+ if (len > 1)
+ PUP(out) = PUP(from);
+ }
+ }
+ else {
+ from = out - dist; /* copy direct from output */
+ do { /* minimum length is three */
+ PUP(out) = PUP(from);
+ PUP(out) = PUP(from);
+ PUP(out) = PUP(from);
+ len -= 3;
+ } while (len > 2);
+ if (len) {
+ PUP(out) = PUP(from);
+ if (len > 1)
+ PUP(out) = PUP(from);
+ }
+ }
+ }
+ else if ((op & 64) == 0) { /* 2nd level distance code */
+ this = dcode[this.val + (hold & ((1U << op) - 1))];
+ goto dodist;
+ }
+ else {
+ strm->msg = (char *)"invalid distance code";
+ state->mode = BAD;
+ break;
+ }
+ }
+ else if ((op & 64) == 0) { /* 2nd level length code */
+ this = lcode[this.val + (hold & ((1U << op) - 1))];
+ goto dolen;
+ }
+ else if (op & 32) { /* end-of-block */
+ Tracevv((stderr, "inflate: end of block\n"));
+ state->mode = TYPE;
+ break;
+ }
+ else {
+ strm->msg = (char *)"invalid literal/length code";
+ state->mode = BAD;
+ break;
+ }
+ } while (in < last && out < end);
+
+ /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
+ len = bits >> 3;
+ in -= len;
+ bits -= len << 3;
+ hold &= (1U << bits) - 1;
+
+ /* update state and return */
+ strm->next_in = in + OFF;
+ strm->next_out = out + OFF;
+ strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
+ strm->avail_out = (unsigned)(out < end ?
+ 257 + (end - out) : 257 - (out - end));
+ state->hold = hold;
+ state->bits = bits;
+ return;
+}
+
+/*
+ inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe):
+ - Using bit fields for code structure
+ - Different op definition to avoid & for extra bits (do & for table bits)
+ - Three separate decoding do-loops for direct, window, and write == 0
+ - Special case for distance > 1 copies to do overlapped load and store copy
+ - Explicit branch predictions (based on measured branch probabilities)
+ - Deferring match copy and interspersed it with decoding subsequent codes
+ - Swapping literal/length else
+ - Swapping window/direct else
+ - Larger unrolled copy loops (three is about right)
+ - Moving len -= 3 statement into middle of loop
+ */
+
+#endif /* !ASMINF */
diff --git a/support/zlib/inffast.h b/support/zlib/inffast.h
new file mode 100644
index 00000000..1e88d2d9
--- /dev/null
+++ b/support/zlib/inffast.h
@@ -0,0 +1,11 @@
+/* inffast.h -- header to use inffast.c
+ * Copyright (C) 1995-2003 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+void inflate_fast OF((z_streamp strm, unsigned start));
diff --git a/support/zlib/inffixed.h b/support/zlib/inffixed.h
new file mode 100644
index 00000000..75ed4b59
--- /dev/null
+++ b/support/zlib/inffixed.h
@@ -0,0 +1,94 @@
+ /* inffixed.h -- table for decoding fixed codes
+ * Generated automatically by makefixed().
+ */
+
+ /* WARNING: this file should *not* be used by applications. It
+ is part of the implementation of the compression library and
+ is subject to change. Applications should only use zlib.h.
+ */
+
+ static const code lenfix[512] = {
+ {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
+ {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
+ {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
+ {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
+ {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
+ {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
+ {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
+ {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
+ {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
+ {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
+ {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
+ {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
+ {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
+ {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
+ {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
+ {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
+ {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
+ {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
+ {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
+ {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
+ {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
+ {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
+ {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
+ {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
+ {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
+ {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
+ {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
+ {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
+ {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
+ {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
+ {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
+ {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
+ {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
+ {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
+ {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
+ {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
+ {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
+ {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
+ {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
+ {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
+ {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
+ {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
+ {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
+ {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
+ {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
+ {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
+ {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
+ {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
+ {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
+ {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
+ {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
+ {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
+ {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
+ {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
+ {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
+ {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
+ {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
+ {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
+ {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
+ {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
+ {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
+ {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
+ {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
+ {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
+ {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
+ {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
+ {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
+ {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
+ {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
+ {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
+ {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
+ {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
+ {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
+ {0,9,255}
+ };
+
+ static const code distfix[32] = {
+ {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
+ {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
+ {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
+ {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
+ {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
+ {22,5,193},{64,5,0}
+ };
diff --git a/support/zlib/inflate.c b/support/zlib/inflate.c
new file mode 100644
index 00000000..792fdee8
--- /dev/null
+++ b/support/zlib/inflate.c
@@ -0,0 +1,1368 @@
+/* inflate.c -- zlib decompression
+ * Copyright (C) 1995-2005 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/*
+ * Change history:
+ *
+ * 1.2.beta0 24 Nov 2002
+ * - First version -- complete rewrite of inflate to simplify code, avoid
+ * creation of window when not needed, minimize use of window when it is
+ * needed, make inffast.c even faster, implement gzip decoding, and to
+ * improve code readability and style over the previous zlib inflate code
+ *
+ * 1.2.beta1 25 Nov 2002
+ * - Use pointers for available input and output checking in inffast.c
+ * - Remove input and output counters in inffast.c
+ * - Change inffast.c entry and loop from avail_in >= 7 to >= 6
+ * - Remove unnecessary second byte pull from length extra in inffast.c
+ * - Unroll direct copy to three copies per loop in inffast.c
+ *
+ * 1.2.beta2 4 Dec 2002
+ * - Change external routine names to reduce potential conflicts
+ * - Correct filename to inffixed.h for fixed tables in inflate.c
+ * - Make hbuf[] unsigned char to match parameter type in inflate.c
+ * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset)
+ * to avoid negation problem on Alphas (64 bit) in inflate.c
+ *
+ * 1.2.beta3 22 Dec 2002
+ * - Add comments on state->bits assertion in inffast.c
+ * - Add comments on op field in inftrees.h
+ * - Fix bug in reuse of allocated window after inflateReset()
+ * - Remove bit fields--back to byte structure for speed
+ * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths
+ * - Change post-increments to pre-increments in inflate_fast(), PPC biased?
+ * - Add compile time option, POSTINC, to use post-increments instead (Intel?)
+ * - Make MATCH copy in inflate() much faster for when inflate_fast() not used
+ * - Use local copies of stream next and avail values, as well as local bit
+ * buffer and bit count in inflate()--for speed when inflate_fast() not used
+ *
+ * 1.2.beta4 1 Jan 2003
+ * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings
+ * - Move a comment on output buffer sizes from inffast.c to inflate.c
+ * - Add comments in inffast.c to introduce the inflate_fast() routine
+ * - Rearrange window copies in inflate_fast() for speed and simplification
+ * - Unroll last copy for window match in inflate_fast()
+ * - Use local copies of window variables in inflate_fast() for speed
+ * - Pull out common write == 0 case for speed in inflate_fast()
+ * - Make op and len in inflate_fast() unsigned for consistency
+ * - Add FAR to lcode and dcode declarations in inflate_fast()
+ * - Simplified bad distance check in inflate_fast()
+ * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new
+ * source file infback.c to provide a call-back interface to inflate for
+ * programs like gzip and unzip -- uses window as output buffer to avoid
+ * window copying
+ *
+ * 1.2.beta5 1 Jan 2003
+ * - Improved inflateBack() interface to allow the caller to provide initial
+ * input in strm.
+ * - Fixed stored blocks bug in inflateBack()
+ *
+ * 1.2.beta6 4 Jan 2003
+ * - Added comments in inffast.c on effectiveness of POSTINC
+ * - Typecasting all around to reduce compiler warnings
+ * - Changed loops from while (1) or do {} while (1) to for (;;), again to
+ * make compilers happy
+ * - Changed type of window in inflateBackInit() to unsigned char *
+ *
+ * 1.2.beta7 27 Jan 2003
+ * - Changed many types to unsigned or unsigned short to avoid warnings
+ * - Added inflateCopy() function
+ *
+ * 1.2.0 9 Mar 2003
+ * - Changed inflateBack() interface to provide separate opaque descriptors
+ * for the in() and out() functions
+ * - Changed inflateBack() argument and in_func typedef to swap the length
+ * and buffer address return values for the input function
+ * - Check next_in and next_out for Z_NULL on entry to inflate()
+ *
+ * The history for versions after 1.2.0 are in ChangeLog in zlib distribution.
+ */
+
+#include "zutil.h"
+#include "inftrees.h"
+#include "inflate.h"
+#include "inffast.h"
+
+#ifdef MAKEFIXED
+# ifndef BUILDFIXED
+# define BUILDFIXED
+# endif
+#endif
+
+/* function prototypes */
+local void fixedtables OF((struct inflate_state FAR *state));
+local int updatewindow OF((z_streamp strm, unsigned out));
+#ifdef BUILDFIXED
+ void makefixed OF((void));
+#endif
+local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf,
+ unsigned len));
+
+int ZEXPORT inflateReset(strm)
+z_streamp strm;
+{
+ struct inflate_state FAR *state;
+
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)strm->state;
+ strm->total_in = strm->total_out = state->total = 0;
+ strm->msg = Z_NULL;
+ strm->adler = 1; /* to support ill-conceived Java test suite */
+ state->mode = HEAD;
+ state->last = 0;
+ state->havedict = 0;
+ state->dmax = 32768U;
+ state->head = Z_NULL;
+ state->wsize = 0;
+ state->whave = 0;
+ state->write = 0;
+ state->hold = 0;
+ state->bits = 0;
+ state->lencode = state->distcode = state->next = state->codes;
+ Tracev((stderr, "inflate: reset\n"));
+ return Z_OK;
+}
+
+int ZEXPORT inflatePrime(strm, bits, value)
+z_streamp strm;
+int bits;
+int value;
+{
+ struct inflate_state FAR *state;
+
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)strm->state;
+ if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;
+ value &= (1L << bits) - 1;
+ state->hold += value << state->bits;
+ state->bits += bits;
+ return Z_OK;
+}
+
+int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
+z_streamp strm;
+int windowBits;
+const char *version;
+int stream_size;
+{
+ struct inflate_state FAR *state;
+
+ if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
+ stream_size != (int)(sizeof(z_stream)))
+ return Z_VERSION_ERROR;
+ if (strm == Z_NULL) return Z_STREAM_ERROR;
+ strm->msg = Z_NULL; /* in case we return an error */
+ if (strm->zalloc == (alloc_func)0) {
+ strm->zalloc = zcalloc;
+ strm->opaque = (voidpf)0;
+ }
+ if (strm->zfree == (free_func)0) strm->zfree = zcfree;
+ state = (struct inflate_state FAR *)
+ ZALLOC(strm, 1, sizeof(struct inflate_state));
+ if (state == Z_NULL) return Z_MEM_ERROR;
+ Tracev((stderr, "inflate: allocated\n"));
+ strm->state = (struct internal_state FAR *)state;
+ if (windowBits < 0) {
+ state->wrap = 0;
+ windowBits = -windowBits;
+ }
+ else {
+ state->wrap = (windowBits >> 4) + 1;
+#ifdef GUNZIP
+ if (windowBits < 48) windowBits &= 15;
+#endif
+ }
+ if (windowBits < 8 || windowBits > 15) {
+ ZFREE(strm, state);
+ strm->state = Z_NULL;
+ return Z_STREAM_ERROR;
+ }
+ state->wbits = (unsigned)windowBits;
+ state->window = Z_NULL;
+ return inflateReset(strm);
+}
+
+int ZEXPORT inflateInit_(strm, version, stream_size)
+z_streamp strm;
+const char *version;
+int stream_size;
+{
+ return inflateInit2_(strm, DEF_WBITS, version, stream_size);
+}
+
+/*
+ Return state with length and distance decoding tables and index sizes set to
+ fixed code decoding. Normally this returns fixed tables from inffixed.h.
+ If BUILDFIXED is defined, then instead this routine builds the tables the
+ first time it's called, and returns those tables the first time and
+ thereafter. This reduces the size of the code by about 2K bytes, in
+ exchange for a little execution time. However, BUILDFIXED should not be
+ used for threaded applications, since the rewriting of the tables and virgin
+ may not be thread-safe.
+ */
+local void fixedtables(state)
+struct inflate_state FAR *state;
+{
+#ifdef BUILDFIXED
+ static int virgin = 1;
+ static code *lenfix, *distfix;
+ static code fixed[544];
+
+ /* build fixed huffman tables if first call (may not be thread safe) */
+ if (virgin) {
+ unsigned sym, bits;
+ static code *next;
+
+ /* literal/length table */
+ sym = 0;
+ while (sym < 144) state->lens[sym++] = 8;
+ while (sym < 256) state->lens[sym++] = 9;
+ while (sym < 280) state->lens[sym++] = 7;
+ while (sym < 288) state->lens[sym++] = 8;
+ next = fixed;
+ lenfix = next;
+ bits = 9;
+ inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
+
+ /* distance table */
+ sym = 0;
+ while (sym < 32) state->lens[sym++] = 5;
+ distfix = next;
+ bits = 5;
+ inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
+
+ /* do this just once */
+ virgin = 0;
+ }
+#else /* !BUILDFIXED */
+# include "inffixed.h"
+#endif /* BUILDFIXED */
+ state->lencode = lenfix;
+ state->lenbits = 9;
+ state->distcode = distfix;
+ state->distbits = 5;
+}
+
+#ifdef MAKEFIXED
+#include <stdio.h>
+
+/*
+ Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also
+ defines BUILDFIXED, so the tables are built on the fly. makefixed() writes
+ those tables to stdout, which would be piped to inffixed.h. A small program
+ can simply call makefixed to do this:
+
+ void makefixed(void);
+
+ int main(void)
+ {
+ makefixed();
+ return 0;
+ }
+
+ Then that can be linked with zlib built with MAKEFIXED defined and run:
+
+ a.out > inffixed.h
+ */
+void makefixed()
+{
+ unsigned low, size;
+ struct inflate_state state;
+
+ fixedtables(&state);
+ puts(" /* inffixed.h -- table for decoding fixed codes");
+ puts(" * Generated automatically by makefixed().");
+ puts(" */");
+ puts("");
+ puts(" /* WARNING: this file should *not* be used by applications.");
+ puts(" It is part of the implementation of this library and is");
+ puts(" subject to change. Applications should only use zlib.h.");
+ puts(" */");
+ puts("");
+ size = 1U << 9;
+ printf(" static const code lenfix[%u] = {", size);
+ low = 0;
+ for (;;) {
+ if ((low % 7) == 0) printf("\n ");
+ printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits,
+ state.lencode[low].val);
+ if (++low == size) break;
+ putchar(',');
+ }
+ puts("\n };");
+ size = 1U << 5;
+ printf("\n static const code distfix[%u] = {", size);
+ low = 0;
+ for (;;) {
+ if ((low % 6) == 0) printf("\n ");
+ printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits,
+ state.distcode[low].val);
+ if (++low == size) break;
+ putchar(',');
+ }
+ puts("\n };");
+}
+#endif /* MAKEFIXED */
+
+/*
+ Update the window with the last wsize (normally 32K) bytes written before
+ returning. If window does not exist yet, create it. This is only called
+ when a window is already in use, or when output has been written during this
+ inflate call, but the end of the deflate stream has not been reached yet.
+ It is also called to create a window for dictionary data when a dictionary
+ is loaded.
+
+ Providing output buffers larger than 32K to inflate() should provide a speed
+ advantage, since only the last 32K of output is copied to the sliding window
+ upon return from inflate(), and since all distances after the first 32K of
+ output will fall in the output data, making match copies simpler and faster.
+ The advantage may be dependent on the size of the processor's data caches.
+ */
+local int updatewindow(strm, out)
+z_streamp strm;
+unsigned out;
+{
+ struct inflate_state FAR *state;
+ unsigned copy, dist;
+
+ state = (struct inflate_state FAR *)strm->state;
+
+ /* if it hasn't been done already, allocate space for the window */
+ if (state->window == Z_NULL) {
+ state->window = (unsigned char FAR *)
+ ZALLOC(strm, 1U << state->wbits,
+ sizeof(unsigned char));
+ if (state->window == Z_NULL) return 1;
+ }
+
+ /* if window not in use yet, initialize */
+ if (state->wsize == 0) {
+ state->wsize = 1U << state->wbits;
+ state->write = 0;
+ state->whave = 0;
+ }
+
+ /* copy state->wsize or less output bytes into the circular window */
+ copy = out - strm->avail_out;
+ if (copy >= state->wsize) {
+ zmemcpy(state->window, strm->next_out - state->wsize, state->wsize);
+ state->write = 0;
+ state->whave = state->wsize;
+ }
+ else {
+ dist = state->wsize - state->write;
+ if (dist > copy) dist = copy;
+ zmemcpy(state->window + state->write, strm->next_out - copy, dist);
+ copy -= dist;
+ if (copy) {
+ zmemcpy(state->window, strm->next_out - copy, copy);
+ state->write = copy;
+ state->whave = state->wsize;
+ }
+ else {
+ state->write += dist;
+ if (state->write == state->wsize) state->write = 0;
+ if (state->whave < state->wsize) state->whave += dist;
+ }
+ }
+ return 0;
+}
+
+/* Macros for inflate(): */
+
+/* check function to use adler32() for zlib or crc32() for gzip */
+#ifdef GUNZIP
+# define UPDATE(check, buf, len) \
+ (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
+#else
+# define UPDATE(check, buf, len) adler32(check, buf, len)
+#endif
+
+/* check macros for header crc */
+#ifdef GUNZIP
+# define CRC2(check, word) \
+ do { \
+ hbuf[0] = (unsigned char)(word); \
+ hbuf[1] = (unsigned char)((word) >> 8); \
+ check = crc32(check, hbuf, 2); \
+ } while (0)
+
+# define CRC4(check, word) \
+ do { \
+ hbuf[0] = (unsigned char)(word); \
+ hbuf[1] = (unsigned char)((word) >> 8); \
+ hbuf[2] = (unsigned char)((word) >> 16); \
+ hbuf[3] = (unsigned char)((word) >> 24); \
+ check = crc32(check, hbuf, 4); \
+ } while (0)
+#endif
+
+/* Load registers with state in inflate() for speed */
+#define LOAD() \
+ do { \
+ put = strm->next_out; \
+ left = strm->avail_out; \
+ next = strm->next_in; \
+ have = strm->avail_in; \
+ hold = state->hold; \
+ bits = state->bits; \
+ } while (0)
+
+/* Restore state from registers in inflate() */
+#define RESTORE() \
+ do { \
+ strm->next_out = put; \
+ strm->avail_out = left; \
+ strm->next_in = next; \
+ strm->avail_in = have; \
+ state->hold = hold; \
+ state->bits = bits; \
+ } while (0)
+
+/* Clear the input bit accumulator */
+#define INITBITS() \
+ do { \
+ hold = 0; \
+ bits = 0; \
+ } while (0)
+
+/* Get a byte of input into the bit accumulator, or return from inflate()
+ if there is no input available. */
+#define PULLBYTE() \
+ do { \
+ if (have == 0) goto inf_leave; \
+ have--; \
+ hold += (unsigned long)(*next++) << bits; \
+ bits += 8; \
+ } while (0)
+
+/* Assure that there are at least n bits in the bit accumulator. If there is
+ not enough available input to do that, then return from inflate(). */
+#define NEEDBITS(n) \
+ do { \
+ while (bits < (unsigned)(n)) \
+ PULLBYTE(); \
+ } while (0)
+
+/* Return the low n bits of the bit accumulator (n < 16) */
+#define BITS(n) \
+ ((unsigned)hold & ((1U << (n)) - 1))
+
+/* Remove n bits from the bit accumulator */
+#define DROPBITS(n) \
+ do { \
+ hold >>= (n); \
+ bits -= (unsigned)(n); \
+ } while (0)
+
+/* Remove zero to seven bits as needed to go to a byte boundary */
+#define BYTEBITS() \
+ do { \
+ hold >>= bits & 7; \
+ bits -= bits & 7; \
+ } while (0)
+
+/* Reverse the bytes in a 32-bit value */
+#define REVERSE(q) \
+ ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
+ (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
+
+/*
+ inflate() uses a state machine to process as much input data and generate as
+ much output data as possible before returning. The state machine is
+ structured roughly as follows:
+
+ for (;;) switch (state) {
+ ...
+ case STATEn:
+ if (not enough input data or output space to make progress)
+ return;
+ ... make progress ...
+ state = STATEm;
+ break;
+ ...
+ }
+
+ so when inflate() is called again, the same case is attempted again, and
+ if the appropriate resources are provided, the machine proceeds to the
+ next state. The NEEDBITS() macro is usually the way the state evaluates
+ whether it can proceed or should return. NEEDBITS() does the return if
+ the requested bits are not available. The typical use of the BITS macros
+ is:
+
+ NEEDBITS(n);
+ ... do something with BITS(n) ...
+ DROPBITS(n);
+
+ where NEEDBITS(n) either returns from inflate() if there isn't enough
+ input left to load n bits into the accumulator, or it continues. BITS(n)
+ gives the low n bits in the accumulator. When done, DROPBITS(n) drops
+ the low n bits off the accumulator. INITBITS() clears the accumulator
+ and sets the number of available bits to zero. BYTEBITS() discards just
+ enough bits to put the accumulator on a byte boundary. After BYTEBITS()
+ and a NEEDBITS(8), then BITS(8) would return the next byte in the stream.
+
+ NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return
+ if there is no input available. The decoding of variable length codes uses
+ PULLBYTE() directly in order to pull just enough bytes to decode the next
+ code, and no more.
+
+ Some states loop until they get enough input, making sure that enough
+ state information is maintained to continue the loop where it left off
+ if NEEDBITS() returns in the loop. For example, want, need, and keep
+ would all have to actually be part of the saved state in case NEEDBITS()
+ returns:
+
+ case STATEw:
+ while (want < need) {
+ NEEDBITS(n);
+ keep[want++] = BITS(n);
+ DROPBITS(n);
+ }
+ state = STATEx;
+ case STATEx:
+
+ As shown above, if the next state is also the next case, then the break
+ is omitted.
+
+ A state may also return if there is not enough output space available to
+ complete that state. Those states are copying stored data, writing a
+ literal byte, and copying a matching string.
+
+ When returning, a "goto inf_leave" is used to update the total counters,
+ update the check value, and determine whether any progress has been made
+ during that inflate() call in order to return the proper return code.
+ Progress is defined as a change in either strm->avail_in or strm->avail_out.
+ When there is a window, goto inf_leave will update the window with the last
+ output written. If a goto inf_leave occurs in the middle of decompression
+ and there is no window currently, goto inf_leave will create one and copy
+ output to the window for the next call of inflate().
+
+ In this implementation, the flush parameter of inflate() only affects the
+ return code (per zlib.h). inflate() always writes as much as possible to
+ strm->next_out, given the space available and the provided input--the effect
+ documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers
+ the allocation of and copying into a sliding window until necessary, which
+ provides the effect documented in zlib.h for Z_FINISH when the entire input
+ stream available. So the only thing the flush parameter actually does is:
+ when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it
+ will return Z_BUF_ERROR if it has not reached the end of the stream.
+ */
+
+int ZEXPORT inflate(strm, flush)
+z_streamp strm;
+int flush;
+{
+ struct inflate_state FAR *state;
+ unsigned char FAR *next; /* next input */
+ unsigned char FAR *put; /* next output */
+ unsigned have, left; /* available input and output */
+ unsigned long hold; /* bit buffer */
+ unsigned bits; /* bits in bit buffer */
+ unsigned in, out; /* save starting available input and output */
+ unsigned copy; /* number of stored or match bytes to copy */
+ unsigned char FAR *from; /* where to copy match bytes from */
+ code this; /* current decoding table entry */
+ code last; /* parent table entry */
+ unsigned len; /* length to copy for repeats, bits to drop */
+ int ret; /* return code */
+#ifdef GUNZIP
+ unsigned char hbuf[4]; /* buffer for gzip header crc calculation */
+#endif
+ static const unsigned short order[19] = /* permutation of code lengths */
+ {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
+
+ if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL ||
+ (strm->next_in == Z_NULL && strm->avail_in != 0))
+ return Z_STREAM_ERROR;
+
+ state = (struct inflate_state FAR *)strm->state;
+ if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */
+ LOAD();
+ in = have;
+ out = left;
+ ret = Z_OK;
+ for (;;)
+ switch (state->mode) {
+ case HEAD:
+ if (state->wrap == 0) {
+ state->mode = TYPEDO;
+ break;
+ }
+ NEEDBITS(16);
+#ifdef GUNZIP
+ if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */
+ state->check = crc32(0L, Z_NULL, 0);
+ CRC2(state->check, hold);
+ INITBITS();
+ state->mode = FLAGS;
+ break;
+ }
+ state->flags = 0; /* expect zlib header */
+ if (state->head != Z_NULL)
+ state->head->done = -1;
+ if (!(state->wrap & 1) || /* check if zlib header allowed */
+#else
+ if (
+#endif
+ ((BITS(8) << 8) + (hold >> 8)) % 31) {
+ strm->msg = (char *)"incorrect header check";
+ state->mode = BAD;
+ break;
+ }
+ if (BITS(4) != Z_DEFLATED) {
+ strm->msg = (char *)"unknown compression method";
+ state->mode = BAD;
+ break;
+ }
+ DROPBITS(4);
+ len = BITS(4) + 8;
+ if (len > state->wbits) {
+ strm->msg = (char *)"invalid window size";
+ state->mode = BAD;
+ break;
+ }
+ state->dmax = 1U << len;
+ Tracev((stderr, "inflate: zlib header ok\n"));
+ strm->adler = state->check = adler32(0L, Z_NULL, 0);
+ state->mode = hold & 0x200 ? DICTID : TYPE;
+ INITBITS();
+ break;
+#ifdef GUNZIP
+ case FLAGS:
+ NEEDBITS(16);
+ state->flags = (int)(hold);
+ if ((state->flags & 0xff) != Z_DEFLATED) {
+ strm->msg = (char *)"unknown compression method";
+ state->mode = BAD;
+ break;
+ }
+ if (state->flags & 0xe000) {
+ strm->msg = (char *)"unknown header flags set";
+ state->mode = BAD;
+ break;
+ }
+ if (state->head != Z_NULL)
+ state->head->text = (int)((hold >> 8) & 1);
+ if (state->flags & 0x0200) CRC2(state->check, hold);
+ INITBITS();
+ state->mode = TIME;
+ case TIME:
+ NEEDBITS(32);
+ if (state->head != Z_NULL)
+ state->head->time = hold;
+ if (state->flags & 0x0200) CRC4(state->check, hold);
+ INITBITS();
+ state->mode = OS;
+ case OS:
+ NEEDBITS(16);
+ if (state->head != Z_NULL) {
+ state->head->xflags = (int)(hold & 0xff);
+ state->head->os = (int)(hold >> 8);
+ }
+ if (state->flags & 0x0200) CRC2(state->check, hold);
+ INITBITS();
+ state->mode = EXLEN;
+ case EXLEN:
+ if (state->flags & 0x0400) {
+ NEEDBITS(16);
+ state->length = (unsigned)(hold);
+ if (state->head != Z_NULL)
+ state->head->extra_len = (unsigned)hold;
+ if (state->flags & 0x0200) CRC2(state->check, hold);
+ INITBITS();
+ }
+ else if (state->head != Z_NULL)
+ state->head->extra = Z_NULL;
+ state->mode = EXTRA;
+ case EXTRA:
+ if (state->flags & 0x0400) {
+ copy = state->length;
+ if (copy > have) copy = have;
+ if (copy) {
+ if (state->head != Z_NULL &&
+ state->head->extra != Z_NULL) {
+ len = state->head->extra_len - state->length;
+ zmemcpy(state->head->extra + len, next,
+ len + copy > state->head->extra_max ?
+ state->head->extra_max - len : copy);
+ }
+ if (state->flags & 0x0200)
+ state->check = crc32(state->check, next, copy);
+ have -= copy;
+ next += copy;
+ state->length -= copy;
+ }
+ if (state->length) goto inf_leave;
+ }
+ state->length = 0;
+ state->mode = NAME;
+ case NAME:
+ if (state->flags & 0x0800) {
+ if (have == 0) goto inf_leave;
+ copy = 0;
+ do {
+ len = (unsigned)(next[copy++]);
+ if (state->head != Z_NULL &&
+ state->head->name != Z_NULL &&
+ state->length < state->head->name_max)
+ state->head->name[state->length++] = len;
+ } while (len && copy < have);
+ if (state->flags & 0x0200)
+ state->check = crc32(state->check, next, copy);
+ have -= copy;
+ next += copy;
+ if (len) goto inf_leave;
+ }
+ else if (state->head != Z_NULL)
+ state->head->name = Z_NULL;
+ state->length = 0;
+ state->mode = COMMENT;
+ case COMMENT:
+ if (state->flags & 0x1000) {
+ if (have == 0) goto inf_leave;
+ copy = 0;
+ do {
+ len = (unsigned)(next[copy++]);
+ if (state->head != Z_NULL &&
+ state->head->comment != Z_NULL &&
+ state->length < state->head->comm_max)
+ state->head->comment[state->length++] = len;
+ } while (len && copy < have);
+ if (state->flags & 0x0200)
+ state->check = crc32(state->check, next, copy);
+ have -= copy;
+ next += copy;
+ if (len) goto inf_leave;
+ }
+ else if (state->head != Z_NULL)
+ state->head->comment = Z_NULL;
+ state->mode = HCRC;
+ case HCRC:
+ if (state->flags & 0x0200) {
+ NEEDBITS(16);
+ if (hold != (state->check & 0xffff)) {
+ strm->msg = (char *)"header crc mismatch";
+ state->mode = BAD;
+ break;
+ }
+ INITBITS();
+ }
+ if (state->head != Z_NULL) {
+ state->head->hcrc = (int)((state->flags >> 9) & 1);
+ state->head->done = 1;
+ }
+ strm->adler = state->check = crc32(0L, Z_NULL, 0);
+ state->mode = TYPE;
+ break;
+#endif
+ case DICTID:
+ NEEDBITS(32);
+ strm->adler = state->check = REVERSE(hold);
+ INITBITS();
+ state->mode = DICT;
+ case DICT:
+ if (state->havedict == 0) {
+ RESTORE();
+ return Z_NEED_DICT;
+ }
+ strm->adler = state->check = adler32(0L, Z_NULL, 0);
+ state->mode = TYPE;
+ case TYPE:
+ if (flush == Z_BLOCK) goto inf_leave;
+ case TYPEDO:
+ if (state->last) {
+ BYTEBITS();
+ state->mode = CHECK;
+ break;
+ }
+ NEEDBITS(3);
+ state->last = BITS(1);
+ DROPBITS(1);
+ switch (BITS(2)) {
+ case 0: /* stored block */
+ Tracev((stderr, "inflate: stored block%s\n",
+ state->last ? " (last)" : ""));
+ state->mode = STORED;
+ break;
+ case 1: /* fixed block */
+ fixedtables(state);
+ Tracev((stderr, "inflate: fixed codes block%s\n",
+ state->last ? " (last)" : ""));
+ state->mode = LEN; /* decode codes */
+ break;
+ case 2: /* dynamic block */
+ Tracev((stderr, "inflate: dynamic codes block%s\n",
+ state->last ? " (last)" : ""));
+ state->mode = TABLE;
+ break;
+ case 3:
+ strm->msg = (char *)"invalid block type";
+ state->mode = BAD;
+ }
+ DROPBITS(2);
+ break;
+ case STORED:
+ BYTEBITS(); /* go to byte boundary */
+ NEEDBITS(32);
+ if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
+ strm->msg = (char *)"invalid stored block lengths";
+ state->mode = BAD;
+ break;
+ }
+ state->length = (unsigned)hold & 0xffff;
+ Tracev((stderr, "inflate: stored length %u\n",
+ state->length));
+ INITBITS();
+ state->mode = COPY;
+ case COPY:
+ copy = state->length;
+ if (copy) {
+ if (copy > have) copy = have;
+ if (copy > left) copy = left;
+ if (copy == 0) goto inf_leave;
+ zmemcpy(put, next, copy);
+ have -= copy;
+ next += copy;
+ left -= copy;
+ put += copy;
+ state->length -= copy;
+ break;
+ }
+ Tracev((stderr, "inflate: stored end\n"));
+ state->mode = TYPE;
+ break;
+ case TABLE:
+ NEEDBITS(14);
+ state->nlen = BITS(5) + 257;
+ DROPBITS(5);
+ state->ndist = BITS(5) + 1;
+ DROPBITS(5);
+ state->ncode = BITS(4) + 4;
+ DROPBITS(4);
+#ifndef PKZIP_BUG_WORKAROUND
+ if (state->nlen > 286 || state->ndist > 30) {
+ strm->msg = (char *)"too many length or distance symbols";
+ state->mode = BAD;
+ break;
+ }
+#endif
+ Tracev((stderr, "inflate: table sizes ok\n"));
+ state->have = 0;
+ state->mode = LENLENS;
+ case LENLENS:
+ while (state->have < state->ncode) {
+ NEEDBITS(3);
+ state->lens[order[state->have++]] = (unsigned short)BITS(3);
+ DROPBITS(3);
+ }
+ while (state->have < 19)
+ state->lens[order[state->have++]] = 0;
+ state->next = state->codes;
+ state->lencode = (code const FAR *)(state->next);
+ state->lenbits = 7;
+ ret = inflate_table(CODES, state->lens, 19, &(state->next),
+ &(state->lenbits), state->work);
+ if (ret) {
+ strm->msg = (char *)"invalid code lengths set";
+ state->mode = BAD;
+ break;
+ }
+ Tracev((stderr, "inflate: code lengths ok\n"));
+ state->have = 0;
+ state->mode = CODELENS;
+ case CODELENS:
+ while (state->have < state->nlen + state->ndist) {
+ for (;;) {
+ this = state->lencode[BITS(state->lenbits)];
+ if ((unsigned)(this.bits) <= bits) break;
+ PULLBYTE();
+ }
+ if (this.val < 16) {
+ NEEDBITS(this.bits);
+ DROPBITS(this.bits);
+ state->lens[state->have++] = this.val;
+ }
+ else {
+ if (this.val == 16) {
+ NEEDBITS(this.bits + 2);
+ DROPBITS(this.bits);
+ if (state->have == 0) {
+ strm->msg = (char *)"invalid bit length repeat";
+ state->mode = BAD;
+ break;
+ }
+ len = state->lens[state->have - 1];
+ copy = 3 + BITS(2);
+ DROPBITS(2);
+ }
+ else if (this.val == 17) {
+ NEEDBITS(this.bits + 3);
+ DROPBITS(this.bits);
+ len = 0;
+ copy = 3 + BITS(3);
+ DROPBITS(3);
+ }
+ else {
+ NEEDBITS(this.bits + 7);
+ DROPBITS(this.bits);
+ len = 0;
+ copy = 11 + BITS(7);
+ DROPBITS(7);
+ }
+ if (state->have + copy > state->nlen + state->ndist) {
+ strm->msg = (char *)"invalid bit length repeat";
+ state->mode = BAD;
+ break;
+ }
+ while (copy--)
+ state->lens[state->have++] = (unsigned short)len;
+ }
+ }
+
+ /* handle error breaks in while */
+ if (state->mode == BAD) break;
+
+ /* build code tables */
+ state->next = state->codes;
+ state->lencode = (code const FAR *)(state->next);
+ state->lenbits = 9;
+ ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
+ &(state->lenbits), state->work);
+ if (ret) {
+ strm->msg = (char *)"invalid literal/lengths set";
+ state->mode = BAD;
+ break;
+ }
+ state->distcode = (code const FAR *)(state->next);
+ state->distbits = 6;
+ ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
+ &(state->next), &(state->distbits), state->work);
+ if (ret) {
+ strm->msg = (char *)"invalid distances set";
+ state->mode = BAD;
+ break;
+ }
+ Tracev((stderr, "inflate: codes ok\n"));
+ state->mode = LEN;
+ case LEN:
+ if (have >= 6 && left >= 258) {
+ RESTORE();
+ inflate_fast(strm, out);
+ LOAD();
+ break;
+ }
+ for (;;) {
+ this = state->lencode[BITS(state->lenbits)];
+ if ((unsigned)(this.bits) <= bits) break;
+ PULLBYTE();
+ }
+ if (this.op && (this.op & 0xf0) == 0) {
+ last = this;
+ for (;;) {
+ this = state->lencode[last.val +
+ (BITS(last.bits + last.op) >> last.bits)];
+ if ((unsigned)(last.bits + this.bits) <= bits) break;
+ PULLBYTE();
+ }
+ DROPBITS(last.bits);
+ }
+ DROPBITS(this.bits);
+ state->length = (unsigned)this.val;
+ if ((int)(this.op) == 0) {
+ Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
+ "inflate: literal '%c'\n" :
+ "inflate: literal 0x%02x\n", this.val));
+ state->mode = LIT;
+ break;
+ }
+ if (this.op & 32) {
+ Tracevv((stderr, "inflate: end of block\n"));
+ state->mode = TYPE;
+ break;
+ }
+ if (this.op & 64) {
+ strm->msg = (char *)"invalid literal/length code";
+ state->mode = BAD;
+ break;
+ }
+ state->extra = (unsigned)(this.op) & 15;
+ state->mode = LENEXT;
+ case LENEXT:
+ if (state->extra) {
+ NEEDBITS(state->extra);
+ state->length += BITS(state->extra);
+ DROPBITS(state->extra);
+ }
+ Tracevv((stderr, "inflate: length %u\n", state->length));
+ state->mode = DIST;
+ case DIST:
+ for (;;) {
+ this = state->distcode[BITS(state->distbits)];
+ if ((unsigned)(this.bits) <= bits) break;
+ PULLBYTE();
+ }
+ if ((this.op & 0xf0) == 0) {
+ last = this;
+ for (;;) {
+ this = state->distcode[last.val +
+ (BITS(last.bits + last.op) >> last.bits)];
+ if ((unsigned)(last.bits + this.bits) <= bits) break;
+ PULLBYTE();
+ }
+ DROPBITS(last.bits);
+ }
+ DROPBITS(this.bits);
+ if (this.op & 64) {
+ strm->msg = (char *)"invalid distance code";
+ state->mode = BAD;
+ break;
+ }
+ state->offset = (unsigned)this.val;
+ state->extra = (unsigned)(this.op) & 15;
+ state->mode = DISTEXT;
+ case DISTEXT:
+ if (state->extra) {
+ NEEDBITS(state->extra);
+ state->offset += BITS(state->extra);
+ DROPBITS(state->extra);
+ }
+#ifdef INFLATE_STRICT
+ if (state->offset > state->dmax) {
+ strm->msg = (char *)"invalid distance too far back";
+ state->mode = BAD;
+ break;
+ }
+#endif
+ if (state->offset > state->whave + out - left) {
+ strm->msg = (char *)"invalid distance too far back";
+ state->mode = BAD;
+ break;
+ }
+ Tracevv((stderr, "inflate: distance %u\n", state->offset));
+ state->mode = MATCH;
+ case MATCH:
+ if (left == 0) goto inf_leave;
+ copy = out - left;
+ if (state->offset > copy) { /* copy from window */
+ copy = state->offset - copy;
+ if (copy > state->write) {
+ copy -= state->write;
+ from = state->window + (state->wsize - copy);
+ }
+ else
+ from = state->window + (state->write - copy);
+ if (copy > state->length) copy = state->length;
+ }
+ else { /* copy from output */
+ from = put - state->offset;
+ copy = state->length;
+ }
+ if (copy > left) copy = left;
+ left -= copy;
+ state->length -= copy;
+ do {
+ *put++ = *from++;
+ } while (--copy);
+ if (state->length == 0) state->mode = LEN;
+ break;
+ case LIT:
+ if (left == 0) goto inf_leave;
+ *put++ = (unsigned char)(state->length);
+ left--;
+ state->mode = LEN;
+ break;
+ case CHECK:
+ if (state->wrap) {
+ NEEDBITS(32);
+ out -= left;
+ strm->total_out += out;
+ state->total += out;
+ if (out)
+ strm->adler = state->check =
+ UPDATE(state->check, put - out, out);
+ out = left;
+ if ((
+#ifdef GUNZIP
+ state->flags ? hold :
+#endif
+ REVERSE(hold)) != state->check) {
+ strm->msg = (char *)"incorrect data check";
+ state->mode = BAD;
+ break;
+ }
+ INITBITS();
+ Tracev((stderr, "inflate: check matches trailer\n"));
+ }
+#ifdef GUNZIP
+ state->mode = LENGTH;
+ case LENGTH:
+ if (state->wrap && state->flags) {
+ NEEDBITS(32);
+ if (hold != (state->total & 0xffffffffUL)) {
+ strm->msg = (char *)"incorrect length check";
+ state->mode = BAD;
+ break;
+ }
+ INITBITS();
+ Tracev((stderr, "inflate: length matches trailer\n"));
+ }
+#endif
+ state->mode = DONE;
+ case DONE:
+ ret = Z_STREAM_END;
+ goto inf_leave;
+ case BAD:
+ ret = Z_DATA_ERROR;
+ goto inf_leave;
+ case MEM:
+ return Z_MEM_ERROR;
+ case SYNC:
+ default:
+ return Z_STREAM_ERROR;
+ }
+
+ /*
+ Return from inflate(), updating the total counts and the check value.
+ If there was no progress during the inflate() call, return a buffer
+ error. Call updatewindow() to create and/or update the window state.
+ Note: a memory error from inflate() is non-recoverable.
+ */
+ inf_leave:
+ RESTORE();
+ if (state->wsize || (state->mode < CHECK && out != strm->avail_out))
+ if (updatewindow(strm, out)) {
+ state->mode = MEM;
+ return Z_MEM_ERROR;
+ }
+ in -= strm->avail_in;
+ out -= strm->avail_out;
+ strm->total_in += in;
+ strm->total_out += out;
+ state->total += out;
+ if (state->wrap && out)
+ strm->adler = state->check =
+ UPDATE(state->check, strm->next_out - out, out);
+ strm->data_type = state->bits + (state->last ? 64 : 0) +
+ (state->mode == TYPE ? 128 : 0);
+ if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
+ ret = Z_BUF_ERROR;
+ return ret;
+}
+
+int ZEXPORT inflateEnd(strm)
+z_streamp strm;
+{
+ struct inflate_state FAR *state;
+ if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
+ return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)strm->state;
+ if (state->window != Z_NULL) ZFREE(strm, state->window);
+ ZFREE(strm, strm->state);
+ strm->state = Z_NULL;
+ Tracev((stderr, "inflate: end\n"));
+ return Z_OK;
+}
+
+int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
+z_streamp strm;
+const Bytef *dictionary;
+uInt dictLength;
+{
+ struct inflate_state FAR *state;
+ unsigned long id;
+
+ /* check state */
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)strm->state;
+ if (state->wrap != 0 && state->mode != DICT)
+ return Z_STREAM_ERROR;
+
+ /* check for correct dictionary id */
+ if (state->mode == DICT) {
+ id = adler32(0L, Z_NULL, 0);
+ id = adler32(id, dictionary, dictLength);
+ if (id != state->check)
+ return Z_DATA_ERROR;
+ }
+
+ /* copy dictionary to window */
+ if (updatewindow(strm, strm->avail_out)) {
+ state->mode = MEM;
+ return Z_MEM_ERROR;
+ }
+ if (dictLength > state->wsize) {
+ zmemcpy(state->window, dictionary + dictLength - state->wsize,
+ state->wsize);
+ state->whave = state->wsize;
+ }
+ else {
+ zmemcpy(state->window + state->wsize - dictLength, dictionary,
+ dictLength);
+ state->whave = dictLength;
+ }
+ state->havedict = 1;
+ Tracev((stderr, "inflate: dictionary set\n"));
+ return Z_OK;
+}
+
+int ZEXPORT inflateGetHeader(strm, head)
+z_streamp strm;
+gz_headerp head;
+{
+ struct inflate_state FAR *state;
+
+ /* check state */
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)strm->state;
+ if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;
+
+ /* save header structure */
+ state->head = head;
+ head->done = 0;
+ return Z_OK;
+}
+
+/*
+ Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found
+ or when out of input. When called, *have is the number of pattern bytes
+ found in order so far, in 0..3. On return *have is updated to the new
+ state. If on return *have equals four, then the pattern was found and the
+ return value is how many bytes were read including the last byte of the
+ pattern. If *have is less than four, then the pattern has not been found
+ yet and the return value is len. In the latter case, syncsearch() can be
+ called again with more data and the *have state. *have is initialized to
+ zero for the first call.
+ */
+local unsigned syncsearch(have, buf, len)
+unsigned FAR *have;
+unsigned char FAR *buf;
+unsigned len;
+{
+ unsigned got;
+ unsigned next;
+
+ got = *have;
+ next = 0;
+ while (next < len && got < 4) {
+ if ((int)(buf[next]) == (got < 2 ? 0 : 0xff))
+ got++;
+ else if (buf[next])
+ got = 0;
+ else
+ got = 4 - got;
+ next++;
+ }
+ *have = got;
+ return next;
+}
+
+int ZEXPORT inflateSync(strm)
+z_streamp strm;
+{
+ unsigned len; /* number of bytes to look at or looked at */
+ unsigned long in, out; /* temporary to save total_in and total_out */
+ unsigned char buf[4]; /* to restore bit buffer to byte string */
+ struct inflate_state FAR *state;
+
+ /* check parameters */
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)strm->state;
+ if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;
+
+ /* if first time, start search in bit buffer */
+ if (state->mode != SYNC) {
+ state->mode = SYNC;
+ state->hold <<= state->bits & 7;
+ state->bits -= state->bits & 7;
+ len = 0;
+ while (state->bits >= 8) {
+ buf[len++] = (unsigned char)(state->hold);
+ state->hold >>= 8;
+ state->bits -= 8;
+ }
+ state->have = 0;
+ syncsearch(&(state->have), buf, len);
+ }
+
+ /* search available input */
+ len = syncsearch(&(state->have), strm->next_in, strm->avail_in);
+ strm->avail_in -= len;
+ strm->next_in += len;
+ strm->total_in += len;
+
+ /* return no joy or set up to restart inflate() on a new block */
+ if (state->have != 4) return Z_DATA_ERROR;
+ in = strm->total_in; out = strm->total_out;
+ inflateReset(strm);
+ strm->total_in = in; strm->total_out = out;
+ state->mode = TYPE;
+ return Z_OK;
+}
+
+/*
+ Returns true if inflate is currently at the end of a block generated by
+ Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
+ implementation to provide an additional safety check. PPP uses
+ Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored
+ block. When decompressing, PPP checks that at the end of input packet,
+ inflate is waiting for these length bytes.
+ */
+int ZEXPORT inflateSyncPoint(strm)
+z_streamp strm;
+{
+ struct inflate_state FAR *state;
+
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)strm->state;
+ return state->mode == STORED && state->bits == 0;
+}
+
+int ZEXPORT inflateCopy(dest, source)
+z_streamp dest;
+z_streamp source;
+{
+ struct inflate_state FAR *state;
+ struct inflate_state FAR *copy;
+ unsigned char FAR *window;
+ unsigned wsize;
+
+ /* check input */
+ if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL ||
+ source->zalloc == (alloc_func)0 || source->zfree == (free_func)0)
+ return Z_STREAM_ERROR;
+ state = (struct inflate_state FAR *)source->state;
+
+ /* allocate space */
+ copy = (struct inflate_state FAR *)
+ ZALLOC(source, 1, sizeof(struct inflate_state));
+ if (copy == Z_NULL) return Z_MEM_ERROR;
+ window = Z_NULL;
+ if (state->window != Z_NULL) {
+ window = (unsigned char FAR *)
+ ZALLOC(source, 1U << state->wbits, sizeof(unsigned char));
+ if (window == Z_NULL) {
+ ZFREE(source, copy);
+ return Z_MEM_ERROR;
+ }
+ }
+
+ /* copy state */
+ zmemcpy(dest, source, sizeof(z_stream));
+ zmemcpy(copy, state, sizeof(struct inflate_state));
+ if (state->lencode >= state->codes &&
+ state->lencode <= state->codes + ENOUGH - 1) {
+ copy->lencode = copy->codes + (state->lencode - state->codes);
+ copy->distcode = copy->codes + (state->distcode - state->codes);
+ }
+ copy->next = copy->codes + (state->next - state->codes);
+ if (window != Z_NULL) {
+ wsize = 1U << state->wbits;
+ zmemcpy(window, state->window, wsize);
+ }
+ copy->window = window;
+ dest->state = (struct internal_state FAR *)copy;
+ return Z_OK;
+}
diff --git a/support/zlib/inflate.h b/support/zlib/inflate.h
new file mode 100644
index 00000000..07bd3e78
--- /dev/null
+++ b/support/zlib/inflate.h
@@ -0,0 +1,115 @@
+/* inflate.h -- internal inflate state definition
+ * Copyright (C) 1995-2004 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+/* define NO_GZIP when compiling if you want to disable gzip header and
+ trailer decoding by inflate(). NO_GZIP would be used to avoid linking in
+ the crc code when it is not needed. For shared libraries, gzip decoding
+ should be left enabled. */
+#ifndef NO_GZIP
+# define GUNZIP
+#endif
+
+/* Possible inflate modes between inflate() calls */
+typedef enum {
+ HEAD, /* i: waiting for magic header */
+ FLAGS, /* i: waiting for method and flags (gzip) */
+ TIME, /* i: waiting for modification time (gzip) */
+ OS, /* i: waiting for extra flags and operating system (gzip) */
+ EXLEN, /* i: waiting for extra length (gzip) */
+ EXTRA, /* i: waiting for extra bytes (gzip) */
+ NAME, /* i: waiting for end of file name (gzip) */
+ COMMENT, /* i: waiting for end of comment (gzip) */
+ HCRC, /* i: waiting for header crc (gzip) */
+ DICTID, /* i: waiting for dictionary check value */
+ DICT, /* waiting for inflateSetDictionary() call */
+ TYPE, /* i: waiting for type bits, including last-flag bit */
+ TYPEDO, /* i: same, but skip check to exit inflate on new block */
+ STORED, /* i: waiting for stored size (length and complement) */
+ COPY, /* i/o: waiting for input or output to copy stored block */
+ TABLE, /* i: waiting for dynamic block table lengths */
+ LENLENS, /* i: waiting for code length code lengths */
+ CODELENS, /* i: waiting for length/lit and distance code lengths */
+ LEN, /* i: waiting for length/lit code */
+ LENEXT, /* i: waiting for length extra bits */
+ DIST, /* i: waiting for distance code */
+ DISTEXT, /* i: waiting for distance extra bits */
+ MATCH, /* o: waiting for output space to copy string */
+ LIT, /* o: waiting for output space to write literal */
+ CHECK, /* i: waiting for 32-bit check value */
+ LENGTH, /* i: waiting for 32-bit length (gzip) */
+ DONE, /* finished check, done -- remain here until reset */
+ BAD, /* got a data error -- remain here until reset */
+ MEM, /* got an inflate() memory error -- remain here until reset */
+ SYNC /* looking for synchronization bytes to restart inflate() */
+} inflate_mode;
+
+/*
+ State transitions between above modes -
+
+ (most modes can go to the BAD or MEM mode -- not shown for clarity)
+
+ Process header:
+ HEAD -> (gzip) or (zlib)
+ (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME
+ NAME -> COMMENT -> HCRC -> TYPE
+ (zlib) -> DICTID or TYPE
+ DICTID -> DICT -> TYPE
+ Read deflate blocks:
+ TYPE -> STORED or TABLE or LEN or CHECK
+ STORED -> COPY -> TYPE
+ TABLE -> LENLENS -> CODELENS -> LEN
+ Read deflate codes:
+ LEN -> LENEXT or LIT or TYPE
+ LENEXT -> DIST -> DISTEXT -> MATCH -> LEN
+ LIT -> LEN
+ Process trailer:
+ CHECK -> LENGTH -> DONE
+ */
+
+/* state maintained between inflate() calls. Approximately 7K bytes. */
+struct inflate_state {
+ inflate_mode mode; /* current inflate mode */
+ int last; /* true if processing last block */
+ int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
+ int havedict; /* true if dictionary provided */
+ int flags; /* gzip header method and flags (0 if zlib) */
+ unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
+ unsigned long check; /* protected copy of check value */
+ unsigned long total; /* protected copy of output count */
+ gz_headerp head; /* where to save gzip header information */
+ /* sliding window */
+ unsigned wbits; /* log base 2 of requested window size */
+ unsigned wsize; /* window size or zero if not using window */
+ unsigned whave; /* valid bytes in the window */
+ unsigned write; /* window write index */
+ unsigned char FAR *window; /* allocated sliding window, if needed */
+ /* bit accumulator */
+ unsigned long hold; /* input bit accumulator */
+ unsigned bits; /* number of bits in "in" */
+ /* for string and stored block copying */
+ unsigned length; /* literal or length of data to copy */
+ unsigned offset; /* distance back to copy string from */
+ /* for table and code decoding */
+ unsigned extra; /* extra bits needed */
+ /* fixed and dynamic code tables */
+ code const FAR *lencode; /* starting table for length/literal codes */
+ code const FAR *distcode; /* starting table for distance codes */
+ unsigned lenbits; /* index bits for lencode */
+ unsigned distbits; /* index bits for distcode */
+ /* dynamic table building */
+ unsigned ncode; /* number of code length code lengths */
+ unsigned nlen; /* number of length code lengths */
+ unsigned ndist; /* number of distance code lengths */
+ unsigned have; /* number of code lengths in lens[] */
+ code FAR *next; /* next available space in codes[] */
+ unsigned short lens[320]; /* temporary storage for code lengths */
+ unsigned short work[288]; /* work area for code table building */
+ code codes[ENOUGH]; /* space for code tables */
+};
diff --git a/support/zlib/inftrees.c b/support/zlib/inftrees.c
new file mode 100644
index 00000000..8a9c13ff
--- /dev/null
+++ b/support/zlib/inftrees.c
@@ -0,0 +1,329 @@
+/* inftrees.c -- generate Huffman trees for efficient decoding
+ * Copyright (C) 1995-2005 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+#include "zutil.h"
+#include "inftrees.h"
+
+#define MAXBITS 15
+
+const char inflate_copyright[] =
+ " inflate 1.2.3 Copyright 1995-2005 Mark Adler ";
+/*
+ If you use the zlib library in a product, an acknowledgment is welcome
+ in the documentation of your product. If for some reason you cannot
+ include such an acknowledgment, I would appreciate that you keep this
+ copyright string in the executable of your product.
+ */
+
+/*
+ Build a set of tables to decode the provided canonical Huffman code.
+ The code lengths are lens[0..codes-1]. The result starts at *table,
+ whose indices are 0..2^bits-1. work is a writable array of at least
+ lens shorts, which is used as a work area. type is the type of code
+ to be generated, CODES, LENS, or DISTS. On return, zero is success,
+ -1 is an invalid code, and +1 means that ENOUGH isn't enough. table
+ on return points to the next available entry's address. bits is the
+ requested root table index bits, and on return it is the actual root
+ table index bits. It will differ if the request is greater than the
+ longest code or if it is less than the shortest code.
+ */
+int inflate_table(type, lens, codes, table, bits, work)
+codetype type;
+unsigned short FAR *lens;
+unsigned codes;
+code FAR * FAR *table;
+unsigned FAR *bits;
+unsigned short FAR *work;
+{
+ unsigned len; /* a code's length in bits */
+ unsigned sym; /* index of code symbols */
+ unsigned min, max; /* minimum and maximum code lengths */
+ unsigned root; /* number of index bits for root table */
+ unsigned curr; /* number of index bits for current table */
+ unsigned drop; /* code bits to drop for sub-table */
+ int left; /* number of prefix codes available */
+ unsigned used; /* code entries in table used */
+ unsigned huff; /* Huffman code */
+ unsigned incr; /* for incrementing code, index */
+ unsigned fill; /* index for replicating entries */
+ unsigned low; /* low bits for current root entry */
+ unsigned mask; /* mask for low root bits */
+ code this; /* table entry for duplication */
+ code FAR *next; /* next available space in table */
+ const unsigned short FAR *base; /* base value table to use */
+ const unsigned short FAR *extra; /* extra bits table to use */
+ int end; /* use base and extra for symbol > end */
+ unsigned short count[MAXBITS+1]; /* number of codes of each length */
+ unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
+ static const unsigned short lbase[31] = { /* Length codes 257..285 base */
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
+ 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
+ static const unsigned short lext[31] = { /* Length codes 257..285 extra */
+ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
+ 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 201, 196};
+ static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
+ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
+ 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
+ 8193, 12289, 16385, 24577, 0, 0};
+ static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
+ 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
+ 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
+ 28, 28, 29, 29, 64, 64};
+
+ /*
+ Process a set of code lengths to create a canonical Huffman code. The
+ code lengths are lens[0..codes-1]. Each length corresponds to the
+ symbols 0..codes-1. The Huffman code is generated by first sorting the
+ symbols by length from short to long, and retaining the symbol order
+ for codes with equal lengths. Then the code starts with all zero bits
+ for the first code of the shortest length, and the codes are integer
+ increments for the same length, and zeros are appended as the length
+ increases. For the deflate format, these bits are stored backwards
+ from their more natural integer increment ordering, and so when the
+ decoding tables are built in the large loop below, the integer codes
+ are incremented backwards.
+
+ This routine assumes, but does not check, that all of the entries in
+ lens[] are in the range 0..MAXBITS. The caller must assure this.
+ 1..MAXBITS is interpreted as that code length. zero means that that
+ symbol does not occur in this code.
+
+ The codes are sorted by computing a count of codes for each length,
+ creating from that a table of starting indices for each length in the
+ sorted table, and then entering the symbols in order in the sorted
+ table. The sorted table is work[], with that space being provided by
+ the caller.
+
+ The length counts are used for other purposes as well, i.e. finding
+ the minimum and maximum length codes, determining if there are any
+ codes at all, checking for a valid set of lengths, and looking ahead
+ at length counts to determine sub-table sizes when building the
+ decoding tables.
+ */
+
+ /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
+ for (len = 0; len <= MAXBITS; len++)
+ count[len] = 0;
+ for (sym = 0; sym < codes; sym++)
+ count[lens[sym]]++;
+
+ /* bound code lengths, force root to be within code lengths */
+ root = *bits;
+ for (max = MAXBITS; max >= 1; max--)
+ if (count[max] != 0) break;
+ if (root > max) root = max;
+ if (max == 0) { /* no symbols to code at all */
+ this.op = (unsigned char)64; /* invalid code marker */
+ this.bits = (unsigned char)1;
+ this.val = (unsigned short)0;
+ *(*table)++ = this; /* make a table to force an error */
+ *(*table)++ = this;
+ *bits = 1;
+ return 0; /* no symbols, but wait for decoding to report error */
+ }
+ for (min = 1; min <= MAXBITS; min++)
+ if (count[min] != 0) break;
+ if (root < min) root = min;
+
+ /* check for an over-subscribed or incomplete set of lengths */
+ left = 1;
+ for (len = 1; len <= MAXBITS; len++) {
+ left <<= 1;
+ left -= count[len];
+ if (left < 0) return -1; /* over-subscribed */
+ }
+ if (left > 0 && (type == CODES || max != 1))
+ return -1; /* incomplete set */
+
+ /* generate offsets into symbol table for each length for sorting */
+ offs[1] = 0;
+ for (len = 1; len < MAXBITS; len++)
+ offs[len + 1] = offs[len] + count[len];
+
+ /* sort symbols by length, by symbol order within each length */
+ for (sym = 0; sym < codes; sym++)
+ if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
+
+ /*
+ Create and fill in decoding tables. In this loop, the table being
+ filled is at next and has curr index bits. The code being used is huff
+ with length len. That code is converted to an index by dropping drop
+ bits off of the bottom. For codes where len is less than drop + curr,
+ those top drop + curr - len bits are incremented through all values to
+ fill the table with replicated entries.
+
+ root is the number of index bits for the root table. When len exceeds
+ root, sub-tables are created pointed to by the root entry with an index
+ of the low root bits of huff. This is saved in low to check for when a
+ new sub-table should be started. drop is zero when the root table is
+ being filled, and drop is root when sub-tables are being filled.
+
+ When a new sub-table is needed, it is necessary to look ahead in the
+ code lengths to determine what size sub-table is needed. The length
+ counts are used for this, and so count[] is decremented as codes are
+ entered in the tables.
+
+ used keeps track of how many table entries have been allocated from the
+ provided *table space. It is checked when a LENS table is being made
+ against the space in *table, ENOUGH, minus the maximum space needed by
+ the worst case distance code, MAXD. This should never happen, but the
+ sufficiency of ENOUGH has not been proven exhaustively, hence the check.
+ This assumes that when type == LENS, bits == 9.
+
+ sym increments through all symbols, and the loop terminates when
+ all codes of length max, i.e. all codes, have been processed. This
+ routine permits incomplete codes, so another loop after this one fills
+ in the rest of the decoding tables with invalid code markers.
+ */
+
+ /* set up for code type */
+ switch (type) {
+ case CODES:
+ base = extra = work; /* dummy value--not used */
+ end = 19;
+ break;
+ case LENS:
+ base = lbase;
+ base -= 257;
+ extra = lext;
+ extra -= 257;
+ end = 256;
+ break;
+ default: /* DISTS */
+ base = dbase;
+ extra = dext;
+ end = -1;
+ }
+
+ /* initialize state for loop */
+ huff = 0; /* starting code */
+ sym = 0; /* starting code symbol */
+ len = min; /* starting code length */
+ next = *table; /* current table to fill in */
+ curr = root; /* current table index bits */
+ drop = 0; /* current bits to drop from code for index */
+ low = (unsigned)(-1); /* trigger new sub-table when len > root */
+ used = 1U << root; /* use root table entries */
+ mask = used - 1; /* mask for comparing low */
+
+ /* check available table space */
+ if (type == LENS && used >= ENOUGH - MAXD)
+ return 1;
+
+ /* process all codes and make table entries */
+ for (;;) {
+ /* create table entry */
+ this.bits = (unsigned char)(len - drop);
+ if ((int)(work[sym]) < end) {
+ this.op = (unsigned char)0;
+ this.val = work[sym];
+ }
+ else if ((int)(work[sym]) > end) {
+ this.op = (unsigned char)(extra[work[sym]]);
+ this.val = base[work[sym]];
+ }
+ else {
+ this.op = (unsigned char)(32 + 64); /* end of block */
+ this.val = 0;
+ }
+
+ /* replicate for those indices with low len bits equal to huff */
+ incr = 1U << (len - drop);
+ fill = 1U << curr;
+ min = fill; /* save offset to next table */
+ do {
+ fill -= incr;
+ next[(huff >> drop) + fill] = this;
+ } while (fill != 0);
+
+ /* backwards increment the len-bit code huff */
+ incr = 1U << (len - 1);
+ while (huff & incr)
+ incr >>= 1;
+ if (incr != 0) {
+ huff &= incr - 1;
+ huff += incr;
+ }
+ else
+ huff = 0;
+
+ /* go to next symbol, update count, len */
+ sym++;
+ if (--(count[len]) == 0) {
+ if (len == max) break;
+ len = lens[work[sym]];
+ }
+
+ /* create new sub-table if needed */
+ if (len > root && (huff & mask) != low) {
+ /* if first time, transition to sub-tables */
+ if (drop == 0)
+ drop = root;
+
+ /* increment past last table */
+ next += min; /* here min is 1 << curr */
+
+ /* determine length of next table */
+ curr = len - drop;
+ left = (int)(1 << curr);
+ while (curr + drop < max) {
+ left -= count[curr + drop];
+ if (left <= 0) break;
+ curr++;
+ left <<= 1;
+ }
+
+ /* check for enough space */
+ used += 1U << curr;
+ if (type == LENS && used >= ENOUGH - MAXD)
+ return 1;
+
+ /* point entry in root table to sub-table */
+ low = huff & mask;
+ (*table)[low].op = (unsigned char)curr;
+ (*table)[low].bits = (unsigned char)root;
+ (*table)[low].val = (unsigned short)(next - *table);
+ }
+ }
+
+ /*
+ Fill in rest of table for incomplete codes. This loop is similar to the
+ loop above in incrementing huff for table indices. It is assumed that
+ len is equal to curr + drop, so there is no loop needed to increment
+ through high index bits. When the current sub-table is filled, the loop
+ drops back to the root table to fill in any remaining entries there.
+ */
+ this.op = (unsigned char)64; /* invalid code marker */
+ this.bits = (unsigned char)(len - drop);
+ this.val = (unsigned short)0;
+ while (huff != 0) {
+ /* when done with sub-table, drop back to root table */
+ if (drop != 0 && (huff & mask) != low) {
+ drop = 0;
+ len = root;
+ next = *table;
+ this.bits = (unsigned char)len;
+ }
+
+ /* put invalid code marker in table */
+ next[huff >> drop] = this;
+
+ /* backwards increment the len-bit code huff */
+ incr = 1U << (len - 1);
+ while (huff & incr)
+ incr >>= 1;
+ if (incr != 0) {
+ huff &= incr - 1;
+ huff += incr;
+ }
+ else
+ huff = 0;
+ }
+
+ /* set return parameters */
+ *table += used;
+ *bits = root;
+ return 0;
+}
diff --git a/support/zlib/inftrees.h b/support/zlib/inftrees.h
new file mode 100644
index 00000000..b1104c87
--- /dev/null
+++ b/support/zlib/inftrees.h
@@ -0,0 +1,55 @@
+/* inftrees.h -- header to use inftrees.c
+ * Copyright (C) 1995-2005 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+/* Structure for decoding tables. Each entry provides either the
+ information needed to do the operation requested by the code that
+ indexed that table entry, or it provides a pointer to another
+ table that indexes more bits of the code. op indicates whether
+ the entry is a pointer to another table, a literal, a length or
+ distance, an end-of-block, or an invalid code. For a table
+ pointer, the low four bits of op is the number of index bits of
+ that table. For a length or distance, the low four bits of op
+ is the number of extra bits to get after the code. bits is
+ the number of bits in this code or part of the code to drop off
+ of the bit buffer. val is the actual byte to output in the case
+ of a literal, the base length or distance, or the offset from
+ the current table to the next table. Each entry is four bytes. */
+typedef struct {
+ unsigned char op; /* operation, extra bits, table bits */
+ unsigned char bits; /* bits in this part of the code */
+ unsigned short val; /* offset in table or code value */
+} code;
+
+/* op values as set by inflate_table():
+ 00000000 - literal
+ 0000tttt - table link, tttt != 0 is the number of table index bits
+ 0001eeee - length or distance, eeee is the number of extra bits
+ 01100000 - end of block
+ 01000000 - invalid code
+ */
+
+/* Maximum size of dynamic tree. The maximum found in a long but non-
+ exhaustive search was 1444 code structures (852 for length/literals
+ and 592 for distances, the latter actually the result of an
+ exhaustive search). The true maximum is not known, but the value
+ below is more than safe. */
+#define ENOUGH 2048
+#define MAXD 592
+
+/* Type of code to build for inftable() */
+typedef enum {
+ CODES,
+ LENS,
+ DISTS
+} codetype;
+
+extern int inflate_table OF((codetype type, unsigned short FAR *lens,
+ unsigned codes, code FAR * FAR *table,
+ unsigned FAR *bits, unsigned short FAR *work));
diff --git a/support/zlib/zconf.h b/support/zlib/zconf.h
new file mode 100644
index 00000000..03a9431c
--- /dev/null
+++ b/support/zlib/zconf.h
@@ -0,0 +1,332 @@
+/* zconf.h -- configuration of the zlib compression library
+ * Copyright (C) 1995-2005 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id$ */
+
+#ifndef ZCONF_H
+#define ZCONF_H
+
+/*
+ * If you *really* need a unique prefix for all types and library functions,
+ * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
+ */
+#ifdef Z_PREFIX
+# define deflateInit_ z_deflateInit_
+# define deflate z_deflate
+# define deflateEnd z_deflateEnd
+# define inflateInit_ z_inflateInit_
+# define inflate z_inflate
+# define inflateEnd z_inflateEnd
+# define deflateInit2_ z_deflateInit2_
+# define deflateSetDictionary z_deflateSetDictionary
+# define deflateCopy z_deflateCopy
+# define deflateReset z_deflateReset
+# define deflateParams z_deflateParams
+# define deflateBound z_deflateBound
+# define deflatePrime z_deflatePrime
+# define inflateInit2_ z_inflateInit2_
+# define inflateSetDictionary z_inflateSetDictionary
+# define inflateSync z_inflateSync
+# define inflateSyncPoint z_inflateSyncPoint
+# define inflateCopy z_inflateCopy
+# define inflateReset z_inflateReset
+# define inflateBack z_inflateBack
+# define inflateBackEnd z_inflateBackEnd
+# define compress z_compress
+# define compress2 z_compress2
+# define compressBound z_compressBound
+# define uncompress z_uncompress
+# define adler32 z_adler32
+# define crc32 z_crc32
+# define get_crc_table z_get_crc_table
+# define zError z_zError
+
+# define alloc_func z_alloc_func
+# define free_func z_free_func
+# define in_func z_in_func
+# define out_func z_out_func
+# define Byte z_Byte
+# define uInt z_uInt
+# define uLong z_uLong
+# define Bytef z_Bytef
+# define charf z_charf
+# define intf z_intf
+# define uIntf z_uIntf
+# define uLongf z_uLongf
+# define voidpf z_voidpf
+# define voidp z_voidp
+#endif
+
+#if defined(__MSDOS__) && !defined(MSDOS)
+# define MSDOS
+#endif
+#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
+# define OS2
+#endif
+#if defined(_WINDOWS) && !defined(WINDOWS)
+# define WINDOWS
+#endif
+#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
+# ifndef WIN32
+# define WIN32
+# endif
+#endif
+#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
+# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
+# ifndef SYS16BIT
+# define SYS16BIT
+# endif
+# endif
+#endif
+
+/*
+ * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
+ * than 64k bytes at a time (needed on systems with 16-bit int).
+ */
+#ifdef SYS16BIT
+# define MAXSEG_64K
+#endif
+#ifdef MSDOS
+# define UNALIGNED_OK
+#endif
+
+#ifdef __STDC_VERSION__
+# ifndef STDC
+# define STDC
+# endif
+# if __STDC_VERSION__ >= 199901L
+# ifndef STDC99
+# define STDC99
+# endif
+# endif
+#endif
+#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
+# define STDC
+#endif
+#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
+# define STDC
+#endif
+#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
+# define STDC
+#endif
+#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
+# define STDC
+#endif
+
+#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
+# define STDC
+#endif
+
+#ifndef STDC
+# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
+# define const /* note: need a more gentle solution here */
+# endif
+#endif
+
+/* Some Mac compilers merge all .h files incorrectly: */
+#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
+# define NO_DUMMY_DECL
+#endif
+
+/* Maximum value for memLevel in deflateInit2 */
+#ifndef MAX_MEM_LEVEL
+# ifdef MAXSEG_64K
+# define MAX_MEM_LEVEL 8
+# else
+# define MAX_MEM_LEVEL 9
+# endif
+#endif
+
+/* Maximum value for windowBits in deflateInit2 and inflateInit2.
+ * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
+ * created by gzip. (Files created by minigzip can still be extracted by
+ * gzip.)
+ */
+#ifndef MAX_WBITS
+# define MAX_WBITS 15 /* 32K LZ77 window */
+#endif
+
+/* The memory requirements for deflate are (in bytes):
+ (1 << (windowBits+2)) + (1 << (memLevel+9))
+ that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
+ plus a few kilobytes for small objects. For example, if you want to reduce
+ the default memory requirements from 256K to 128K, compile with
+ make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
+ Of course this will generally degrade compression (there's no free lunch).
+
+ The memory requirements for inflate are (in bytes) 1 << windowBits
+ that is, 32K for windowBits=15 (default value) plus a few kilobytes
+ for small objects.
+*/
+
+ /* Type declarations */
+
+#ifndef OF /* function prototypes */
+# ifdef STDC
+# define OF(args) args
+# else
+# define OF(args) ()
+# endif
+#endif
+
+/* The following definitions for FAR are needed only for MSDOS mixed
+ * model programming (small or medium model with some far allocations).
+ * This was tested only with MSC; for other MSDOS compilers you may have
+ * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
+ * just define FAR to be empty.
+ */
+#ifdef SYS16BIT
+# if defined(M_I86SM) || defined(M_I86MM)
+ /* MSC small or medium model */
+# define SMALL_MEDIUM
+# ifdef _MSC_VER
+# define FAR _far
+# else
+# define FAR far
+# endif
+# endif
+# if (defined(__SMALL__) || defined(__MEDIUM__))
+ /* Turbo C small or medium model */
+# define SMALL_MEDIUM
+# ifdef __BORLANDC__
+# define FAR _far
+# else
+# define FAR far
+# endif
+# endif
+#endif
+
+#if defined(WINDOWS) || defined(WIN32)
+ /* If building or using zlib as a DLL, define ZLIB_DLL.
+ * This is not mandatory, but it offers a little performance increase.
+ */
+# ifdef ZLIB_DLL
+# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
+# ifdef ZLIB_INTERNAL
+# define ZEXTERN extern __declspec(dllexport)
+# else
+# define ZEXTERN extern __declspec(dllimport)
+# endif
+# endif
+# endif /* ZLIB_DLL */
+ /* If building or using zlib with the WINAPI/WINAPIV calling convention,
+ * define ZLIB_WINAPI.
+ * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
+ */
+# ifdef ZLIB_WINAPI
+# ifdef FAR
+# undef FAR
+# endif
+# include <windows.h>
+ /* No need for _export, use ZLIB.DEF instead. */
+ /* For complete Windows compatibility, use WINAPI, not __stdcall. */
+# define ZEXPORT WINAPI
+# ifdef WIN32
+# define ZEXPORTVA WINAPIV
+# else
+# define ZEXPORTVA FAR CDECL
+# endif
+# endif
+#endif
+
+#if defined (__BEOS__)
+# ifdef ZLIB_DLL
+# ifdef ZLIB_INTERNAL
+# define ZEXPORT __declspec(dllexport)
+# define ZEXPORTVA __declspec(dllexport)
+# else
+# define ZEXPORT __declspec(dllimport)
+# define ZEXPORTVA __declspec(dllimport)
+# endif
+# endif
+#endif
+
+#ifndef ZEXTERN
+# define ZEXTERN extern
+#endif
+#ifndef ZEXPORT
+# define ZEXPORT
+#endif
+#ifndef ZEXPORTVA
+# define ZEXPORTVA
+#endif
+
+#ifndef FAR
+# define FAR
+#endif
+
+#if !defined(__MACTYPES__)
+typedef unsigned char Byte; /* 8 bits */
+#endif
+typedef unsigned int uInt; /* 16 bits or more */
+typedef unsigned long uLong; /* 32 bits or more */
+
+#ifdef SMALL_MEDIUM
+ /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
+# define Bytef Byte FAR
+#else
+ typedef Byte FAR Bytef;
+#endif
+typedef char FAR charf;
+typedef int FAR intf;
+typedef uInt FAR uIntf;
+typedef uLong FAR uLongf;
+
+#ifdef STDC
+ typedef void const *voidpc;
+ typedef void FAR *voidpf;
+ typedef void *voidp;
+#else
+ typedef Byte const *voidpc;
+ typedef Byte FAR *voidpf;
+ typedef Byte *voidp;
+#endif
+
+#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
+# include <sys/types.h> /* for off_t */
+# include <unistd.h> /* for SEEK_* and off_t */
+# ifdef VMS
+# include <unixio.h> /* for off_t */
+# endif
+# define z_off_t off_t
+#endif
+#ifndef SEEK_SET
+# define SEEK_SET 0 /* Seek from beginning of file. */
+# define SEEK_CUR 1 /* Seek from current position. */
+# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
+#endif
+#ifndef z_off_t
+# define z_off_t long
+#endif
+
+#if defined(__OS400__)
+# define NO_vsnprintf
+#endif
+
+#if defined(__MVS__)
+# define NO_vsnprintf
+# ifdef FAR
+# undef FAR
+# endif
+#endif
+
+/* MVS linker does not support external names larger than 8 bytes */
+#if defined(__MVS__)
+# pragma map(deflateInit_,"DEIN")
+# pragma map(deflateInit2_,"DEIN2")
+# pragma map(deflateEnd,"DEEND")
+# pragma map(deflateBound,"DEBND")
+# pragma map(inflateInit_,"ININ")
+# pragma map(inflateInit2_,"ININ2")
+# pragma map(inflateEnd,"INEND")
+# pragma map(inflateSync,"INSY")
+# pragma map(inflateSetDictionary,"INSEDI")
+# pragma map(compressBound,"CMBND")
+# pragma map(inflate_table,"INTABL")
+# pragma map(inflate_fast,"INFA")
+# pragma map(inflate_copyright,"INCOPY")
+#endif
+
+#endif /* ZCONF_H */
diff --git a/support/zlib/zlib.h b/support/zlib/zlib.h
new file mode 100644
index 00000000..02281792
--- /dev/null
+++ b/support/zlib/zlib.h
@@ -0,0 +1,1357 @@
+/* zlib.h -- interface of the 'zlib' general purpose compression library
+ version 1.2.3, July 18th, 2005
+
+ Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Jean-loup Gailly Mark Adler
+ jloup@gzip.org madler@alumni.caltech.edu
+
+
+ The data format used by the zlib library is described by RFCs (Request for
+ Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
+ (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
+*/
+
+#ifndef ZLIB_H
+#define ZLIB_H
+
+#include "zconf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ZLIB_VERSION "1.2.3"
+#define ZLIB_VERNUM 0x1230
+
+/*
+ The 'zlib' compression library provides in-memory compression and
+ decompression functions, including integrity checks of the uncompressed
+ data. This version of the library supports only one compression method
+ (deflation) but other algorithms will be added later and will have the same
+ stream interface.
+
+ Compression can be done in a single step if the buffers are large
+ enough (for example if an input file is mmap'ed), or can be done by
+ repeated calls of the compression function. In the latter case, the
+ application must provide more input and/or consume the output
+ (providing more output space) before each call.
+
+ The compressed data format used by default by the in-memory functions is
+ the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
+ around a deflate stream, which is itself documented in RFC 1951.
+
+ The library also supports reading and writing files in gzip (.gz) format
+ with an interface similar to that of stdio using the functions that start
+ with "gz". The gzip format is different from the zlib format. gzip is a
+ gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
+
+ This library can optionally read and write gzip streams in memory as well.
+
+ The zlib format was designed to be compact and fast for use in memory
+ and on communications channels. The gzip format was designed for single-
+ file compression on file systems, has a larger header than zlib to maintain
+ directory information, and uses a different, slower check method than zlib.
+
+ The library does not install any signal handler. The decoder checks
+ the consistency of the compressed data, so the library should never
+ crash even in case of corrupted input.
+*/
+
+typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
+typedef void (*free_func) OF((voidpf opaque, voidpf address));
+
+struct internal_state;
+
+typedef struct z_stream_s {
+ Bytef *next_in; /* next input byte */
+ uInt avail_in; /* number of bytes available at next_in */
+ uLong total_in; /* total nb of input bytes read so far */
+
+ Bytef *next_out; /* next output byte should be put there */
+ uInt avail_out; /* remaining free space at next_out */
+ uLong total_out; /* total nb of bytes output so far */
+
+ char *msg; /* last error message, NULL if no error */
+ struct internal_state FAR *state; /* not visible by applications */
+
+ alloc_func zalloc; /* used to allocate the internal state */
+ free_func zfree; /* used to free the internal state */
+ voidpf opaque; /* private data object passed to zalloc and zfree */
+
+ int data_type; /* best guess about the data type: binary or text */
+ uLong adler; /* adler32 value of the uncompressed data */
+ uLong reserved; /* reserved for future use */
+} z_stream;
+
+typedef z_stream FAR *z_streamp;
+
+/*
+ gzip header information passed to and from zlib routines. See RFC 1952
+ for more details on the meanings of these fields.
+*/
+typedef struct gz_header_s {
+ int text; /* true if compressed data believed to be text */
+ uLong time; /* modification time */
+ int xflags; /* extra flags (not used when writing a gzip file) */
+ int os; /* operating system */
+ Bytef *extra; /* pointer to extra field or Z_NULL if none */
+ uInt extra_len; /* extra field length (valid if extra != Z_NULL) */
+ uInt extra_max; /* space at extra (only when reading header) */
+ Bytef *name; /* pointer to zero-terminated file name or Z_NULL */
+ uInt name_max; /* space at name (only when reading header) */
+ Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */
+ uInt comm_max; /* space at comment (only when reading header) */
+ int hcrc; /* true if there was or will be a header crc */
+ int done; /* true when done reading gzip header (not used
+ when writing a gzip file) */
+} gz_header;
+
+typedef gz_header FAR *gz_headerp;
+
+/*
+ The application must update next_in and avail_in when avail_in has
+ dropped to zero. It must update next_out and avail_out when avail_out
+ has dropped to zero. The application must initialize zalloc, zfree and
+ opaque before calling the init function. All other fields are set by the
+ compression library and must not be updated by the application.
+
+ The opaque value provided by the application will be passed as the first
+ parameter for calls of zalloc and zfree. This can be useful for custom
+ memory management. The compression library attaches no meaning to the
+ opaque value.
+
+ zalloc must return Z_NULL if there is not enough memory for the object.
+ If zlib is used in a multi-threaded application, zalloc and zfree must be
+ thread safe.
+
+ On 16-bit systems, the functions zalloc and zfree must be able to allocate
+ exactly 65536 bytes, but will not be required to allocate more than this
+ if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
+ pointers returned by zalloc for objects of exactly 65536 bytes *must*
+ have their offset normalized to zero. The default allocation function
+ provided by this library ensures this (see zutil.c). To reduce memory
+ requirements and avoid any allocation of 64K objects, at the expense of
+ compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
+
+ The fields total_in and total_out can be used for statistics or
+ progress reports. After compression, total_in holds the total size of
+ the uncompressed data and may be saved for use in the decompressor
+ (particularly if the decompressor wants to decompress everything in
+ a single step).
+*/
+
+ /* constants */
+
+#define Z_NO_FLUSH 0
+#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
+#define Z_SYNC_FLUSH 2
+#define Z_FULL_FLUSH 3
+#define Z_FINISH 4
+#define Z_BLOCK 5
+/* Allowed flush values; see deflate() and inflate() below for details */
+
+#define Z_OK 0
+#define Z_STREAM_END 1
+#define Z_NEED_DICT 2
+#define Z_ERRNO (-1)
+#define Z_STREAM_ERROR (-2)
+#define Z_DATA_ERROR (-3)
+#define Z_MEM_ERROR (-4)
+#define Z_BUF_ERROR (-5)
+#define Z_VERSION_ERROR (-6)
+/* Return codes for the compression/decompression functions. Negative
+ * values are errors, positive values are used for special but normal events.
+ */
+
+#define Z_NO_COMPRESSION 0
+#define Z_BEST_SPEED 1
+#define Z_BEST_COMPRESSION 9
+#define Z_DEFAULT_COMPRESSION (-1)
+/* compression levels */
+
+#define Z_FILTERED 1
+#define Z_HUFFMAN_ONLY 2
+#define Z_RLE 3
+#define Z_FIXED 4
+#define Z_DEFAULT_STRATEGY 0
+/* compression strategy; see deflateInit2() below for details */
+
+#define Z_BINARY 0
+#define Z_TEXT 1
+#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */
+#define Z_UNKNOWN 2
+/* Possible values of the data_type field (though see inflate()) */
+
+#define Z_DEFLATED 8
+/* The deflate compression method (the only one supported in this version) */
+
+#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
+
+#define zlib_version zlibVersion()
+/* for compatibility with versions < 1.0.2 */
+
+ /* basic functions */
+
+ZEXTERN const char * ZEXPORT zlibVersion OF((void));
+/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
+ If the first character differs, the library code actually used is
+ not compatible with the zlib.h header file used by the application.
+ This check is automatically made by deflateInit and inflateInit.
+ */
+
+/*
+ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
+
+ Initializes the internal stream state for compression. The fields
+ zalloc, zfree and opaque must be initialized before by the caller.
+ If zalloc and zfree are set to Z_NULL, deflateInit updates them to
+ use default allocation functions.
+
+ The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
+ 1 gives best speed, 9 gives best compression, 0 gives no compression at
+ all (the input data is simply copied a block at a time).
+ Z_DEFAULT_COMPRESSION requests a default compromise between speed and
+ compression (currently equivalent to level 6).
+
+ deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_STREAM_ERROR if level is not a valid compression level,
+ Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
+ with the version assumed by the caller (ZLIB_VERSION).
+ msg is set to null if there is no error message. deflateInit does not
+ perform any compression: this will be done by deflate().
+*/
+
+
+ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
+/*
+ deflate compresses as much data as possible, and stops when the input
+ buffer becomes empty or the output buffer becomes full. It may introduce some
+ output latency (reading input without producing any output) except when
+ forced to flush.
+
+ The detailed semantics are as follows. deflate performs one or both of the
+ following actions:
+
+ - Compress more input starting at next_in and update next_in and avail_in
+ accordingly. If not all input can be processed (because there is not
+ enough room in the output buffer), next_in and avail_in are updated and
+ processing will resume at this point for the next call of deflate().
+
+ - Provide more output starting at next_out and update next_out and avail_out
+ accordingly. This action is forced if the parameter flush is non zero.
+ Forcing flush frequently degrades the compression ratio, so this parameter
+ should be set only when necessary (in interactive applications).
+ Some output may be provided even if flush is not set.
+
+ Before the call of deflate(), the application should ensure that at least
+ one of the actions is possible, by providing more input and/or consuming
+ more output, and updating avail_in or avail_out accordingly; avail_out
+ should never be zero before the call. The application can consume the
+ compressed output when it wants, for example when the output buffer is full
+ (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
+ and with zero avail_out, it must be called again after making room in the
+ output buffer because there might be more output pending.
+
+ Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
+ decide how much data to accumualte before producing output, in order to
+ maximize compression.
+
+ If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
+ flushed to the output buffer and the output is aligned on a byte boundary, so
+ that the decompressor can get all input data available so far. (In particular
+ avail_in is zero after the call if enough output space has been provided
+ before the call.) Flushing may degrade compression for some compression
+ algorithms and so it should be used only when necessary.
+
+ If flush is set to Z_FULL_FLUSH, all output is flushed as with
+ Z_SYNC_FLUSH, and the compression state is reset so that decompression can
+ restart from this point if previous compressed data has been damaged or if
+ random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
+ compression.
+
+ If deflate returns with avail_out == 0, this function must be called again
+ with the same value of the flush parameter and more output space (updated
+ avail_out), until the flush is complete (deflate returns with non-zero
+ avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
+ avail_out is greater than six to avoid repeated flush markers due to
+ avail_out == 0 on return.
+
+ If the parameter flush is set to Z_FINISH, pending input is processed,
+ pending output is flushed and deflate returns with Z_STREAM_END if there
+ was enough output space; if deflate returns with Z_OK, this function must be
+ called again with Z_FINISH and more output space (updated avail_out) but no
+ more input data, until it returns with Z_STREAM_END or an error. After
+ deflate has returned Z_STREAM_END, the only possible operations on the
+ stream are deflateReset or deflateEnd.
+
+ Z_FINISH can be used immediately after deflateInit if all the compression
+ is to be done in a single step. In this case, avail_out must be at least
+ the value returned by deflateBound (see below). If deflate does not return
+ Z_STREAM_END, then it must be called again as described above.
+
+ deflate() sets strm->adler to the adler32 checksum of all input read
+ so far (that is, total_in bytes).
+
+ deflate() may update strm->data_type if it can make a good guess about
+ the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered
+ binary. This field is only for information purposes and does not affect
+ the compression algorithm in any manner.
+
+ deflate() returns Z_OK if some progress has been made (more input
+ processed or more output produced), Z_STREAM_END if all input has been
+ consumed and all output has been produced (only when flush is set to
+ Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
+ if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
+ (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not
+ fatal, and deflate() can be called again with more input and more output
+ space to continue compressing.
+*/
+
+
+ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
+/*
+ All dynamically allocated data structures for this stream are freed.
+ This function discards any unprocessed input and does not flush any
+ pending output.
+
+ deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
+ stream state was inconsistent, Z_DATA_ERROR if the stream was freed
+ prematurely (some input or output was discarded). In the error case,
+ msg may be set but then points to a static string (which must not be
+ deallocated).
+*/
+
+
+/*
+ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
+
+ Initializes the internal stream state for decompression. The fields
+ next_in, avail_in, zalloc, zfree and opaque must be initialized before by
+ the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
+ value depends on the compression method), inflateInit determines the
+ compression method from the zlib header and allocates all data structures
+ accordingly; otherwise the allocation will be deferred to the first call of
+ inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to
+ use default allocation functions.
+
+ inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
+ version assumed by the caller. msg is set to null if there is no error
+ message. inflateInit does not perform any decompression apart from reading
+ the zlib header if present: this will be done by inflate(). (So next_in and
+ avail_in may be modified, but next_out and avail_out are unchanged.)
+*/
+
+
+ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
+/*
+ inflate decompresses as much data as possible, and stops when the input
+ buffer becomes empty or the output buffer becomes full. It may introduce
+ some output latency (reading input without producing any output) except when
+ forced to flush.
+
+ The detailed semantics are as follows. inflate performs one or both of the
+ following actions:
+
+ - Decompress more input starting at next_in and update next_in and avail_in
+ accordingly. If not all input can be processed (because there is not
+ enough room in the output buffer), next_in is updated and processing
+ will resume at this point for the next call of inflate().
+
+ - Provide more output starting at next_out and update next_out and avail_out
+ accordingly. inflate() provides as much output as possible, until there
+ is no more input data or no more space in the output buffer (see below
+ about the flush parameter).
+
+ Before the call of inflate(), the application should ensure that at least
+ one of the actions is possible, by providing more input and/or consuming
+ more output, and updating the next_* and avail_* values accordingly.
+ The application can consume the uncompressed output when it wants, for
+ example when the output buffer is full (avail_out == 0), or after each
+ call of inflate(). If inflate returns Z_OK and with zero avail_out, it
+ must be called again after making room in the output buffer because there
+ might be more output pending.
+
+ The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH,
+ Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much
+ output as possible to the output buffer. Z_BLOCK requests that inflate() stop
+ if and when it gets to the next deflate block boundary. When decoding the
+ zlib or gzip format, this will cause inflate() to return immediately after
+ the header and before the first block. When doing a raw inflate, inflate()
+ will go ahead and process the first block, and will return when it gets to
+ the end of that block, or when it runs out of data.
+
+ The Z_BLOCK option assists in appending to or combining deflate streams.
+ Also to assist in this, on return inflate() will set strm->data_type to the
+ number of unused bits in the last byte taken from strm->next_in, plus 64
+ if inflate() is currently decoding the last block in the deflate stream,
+ plus 128 if inflate() returned immediately after decoding an end-of-block
+ code or decoding the complete header up to just before the first byte of the
+ deflate stream. The end-of-block will not be indicated until all of the
+ uncompressed data from that block has been written to strm->next_out. The
+ number of unused bits may in general be greater than seven, except when
+ bit 7 of data_type is set, in which case the number of unused bits will be
+ less than eight.
+
+ inflate() should normally be called until it returns Z_STREAM_END or an
+ error. However if all decompression is to be performed in a single step
+ (a single call of inflate), the parameter flush should be set to
+ Z_FINISH. In this case all pending input is processed and all pending
+ output is flushed; avail_out must be large enough to hold all the
+ uncompressed data. (The size of the uncompressed data may have been saved
+ by the compressor for this purpose.) The next operation on this stream must
+ be inflateEnd to deallocate the decompression state. The use of Z_FINISH
+ is never required, but can be used to inform inflate that a faster approach
+ may be used for the single inflate() call.
+
+ In this implementation, inflate() always flushes as much output as
+ possible to the output buffer, and always uses the faster approach on the
+ first call. So the only effect of the flush parameter in this implementation
+ is on the return value of inflate(), as noted below, or when it returns early
+ because Z_BLOCK is used.
+
+ If a preset dictionary is needed after this call (see inflateSetDictionary
+ below), inflate sets strm->adler to the adler32 checksum of the dictionary
+ chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
+ strm->adler to the adler32 checksum of all output produced so far (that is,
+ total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
+ below. At the end of the stream, inflate() checks that its computed adler32
+ checksum is equal to that saved by the compressor and returns Z_STREAM_END
+ only if the checksum is correct.
+
+ inflate() will decompress and check either zlib-wrapped or gzip-wrapped
+ deflate data. The header type is detected automatically. Any information
+ contained in the gzip header is not retained, so applications that need that
+ information should instead use raw inflate, see inflateInit2() below, or
+ inflateBack() and perform their own processing of the gzip header and
+ trailer.
+
+ inflate() returns Z_OK if some progress has been made (more input processed
+ or more output produced), Z_STREAM_END if the end of the compressed data has
+ been reached and all uncompressed output has been produced, Z_NEED_DICT if a
+ preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
+ corrupted (input stream not conforming to the zlib format or incorrect check
+ value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
+ if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory,
+ Z_BUF_ERROR if no progress is possible or if there was not enough room in the
+ output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
+ inflate() can be called again with more input and more output space to
+ continue decompressing. If Z_DATA_ERROR is returned, the application may then
+ call inflateSync() to look for a good compression block if a partial recovery
+ of the data is desired.
+*/
+
+
+ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
+/*
+ All dynamically allocated data structures for this stream are freed.
+ This function discards any unprocessed input and does not flush any
+ pending output.
+
+ inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
+ was inconsistent. In the error case, msg may be set but then points to a
+ static string (which must not be deallocated).
+*/
+
+ /* Advanced functions */
+
+/*
+ The following functions are needed only in some special applications.
+*/
+
+/*
+ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
+ int level,
+ int method,
+ int windowBits,
+ int memLevel,
+ int strategy));
+
+ This is another version of deflateInit with more compression options. The
+ fields next_in, zalloc, zfree and opaque must be initialized before by
+ the caller.
+
+ The method parameter is the compression method. It must be Z_DEFLATED in
+ this version of the library.
+
+ The windowBits parameter is the base two logarithm of the window size
+ (the size of the history buffer). It should be in the range 8..15 for this
+ version of the library. Larger values of this parameter result in better
+ compression at the expense of memory usage. The default value is 15 if
+ deflateInit is used instead.
+
+ windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
+ determines the window size. deflate() will then generate raw deflate data
+ with no zlib header or trailer, and will not compute an adler32 check value.
+
+ windowBits can also be greater than 15 for optional gzip encoding. Add
+ 16 to windowBits to write a simple gzip header and trailer around the
+ compressed data instead of a zlib wrapper. The gzip header will have no
+ file name, no extra data, no comment, no modification time (set to zero),
+ no header crc, and the operating system will be set to 255 (unknown). If a
+ gzip stream is being written, strm->adler is a crc32 instead of an adler32.
+
+ The memLevel parameter specifies how much memory should be allocated
+ for the internal compression state. memLevel=1 uses minimum memory but
+ is slow and reduces compression ratio; memLevel=9 uses maximum memory
+ for optimal speed. The default value is 8. See zconf.h for total memory
+ usage as a function of windowBits and memLevel.
+
+ The strategy parameter is used to tune the compression algorithm. Use the
+ value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
+ filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
+ string match), or Z_RLE to limit match distances to one (run-length
+ encoding). Filtered data consists mostly of small values with a somewhat
+ random distribution. In this case, the compression algorithm is tuned to
+ compress them better. The effect of Z_FILTERED is to force more Huffman
+ coding and less string matching; it is somewhat intermediate between
+ Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as
+ Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy
+ parameter only affects the compression ratio but not the correctness of the
+ compressed output even if it is not set appropriately. Z_FIXED prevents the
+ use of dynamic Huffman codes, allowing for a simpler decoder for special
+ applications.
+
+ deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
+ method). msg is set to null if there is no error message. deflateInit2 does
+ not perform any compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
+ const Bytef *dictionary,
+ uInt dictLength));
+/*
+ Initializes the compression dictionary from the given byte sequence
+ without producing any compressed output. This function must be called
+ immediately after deflateInit, deflateInit2 or deflateReset, before any
+ call of deflate. The compressor and decompressor must use exactly the same
+ dictionary (see inflateSetDictionary).
+
+ The dictionary should consist of strings (byte sequences) that are likely
+ to be encountered later in the data to be compressed, with the most commonly
+ used strings preferably put towards the end of the dictionary. Using a
+ dictionary is most useful when the data to be compressed is short and can be
+ predicted with good accuracy; the data can then be compressed better than
+ with the default empty dictionary.
+
+ Depending on the size of the compression data structures selected by
+ deflateInit or deflateInit2, a part of the dictionary may in effect be
+ discarded, for example if the dictionary is larger than the window size in
+ deflate or deflate2. Thus the strings most likely to be useful should be
+ put at the end of the dictionary, not at the front. In addition, the
+ current implementation of deflate will use at most the window size minus
+ 262 bytes of the provided dictionary.
+
+ Upon return of this function, strm->adler is set to the adler32 value
+ of the dictionary; the decompressor may later use this value to determine
+ which dictionary has been used by the compressor. (The adler32 value
+ applies to the whole dictionary even if only a subset of the dictionary is
+ actually used by the compressor.) If a raw deflate was requested, then the
+ adler32 value is not computed and strm->adler is not set.
+
+ deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
+ parameter is invalid (such as NULL dictionary) or the stream state is
+ inconsistent (for example if deflate has already been called for this stream
+ or if the compression method is bsort). deflateSetDictionary does not
+ perform any compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
+ z_streamp source));
+/*
+ Sets the destination stream as a complete copy of the source stream.
+
+ This function can be useful when several compression strategies will be
+ tried, for example when there are several ways of pre-processing the input
+ data with a filter. The streams that will be discarded should then be freed
+ by calling deflateEnd. Note that deflateCopy duplicates the internal
+ compression state which can be quite large, so this strategy is slow and
+ can consume lots of memory.
+
+ deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+ (such as zalloc being NULL). msg is left unchanged in both source and
+ destination.
+*/
+
+ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
+/*
+ This function is equivalent to deflateEnd followed by deflateInit,
+ but does not free and reallocate all the internal compression state.
+ The stream will keep the same compression level and any other attributes
+ that may have been set by deflateInit2.
+
+ deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+ stream state was inconsistent (such as zalloc or state being NULL).
+*/
+
+ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
+ int level,
+ int strategy));
+/*
+ Dynamically update the compression level and compression strategy. The
+ interpretation of level and strategy is as in deflateInit2. This can be
+ used to switch between compression and straight copy of the input data, or
+ to switch to a different kind of input data requiring a different
+ strategy. If the compression level is changed, the input available so far
+ is compressed with the old level (and may be flushed); the new level will
+ take effect only at the next call of deflate().
+
+ Before the call of deflateParams, the stream state must be set as for
+ a call of deflate(), since the currently available input may have to
+ be compressed and flushed. In particular, strm->avail_out must be non-zero.
+
+ deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
+ stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
+ if strm->avail_out was zero.
+*/
+
+ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
+ int good_length,
+ int max_lazy,
+ int nice_length,
+ int max_chain));
+/*
+ Fine tune deflate's internal compression parameters. This should only be
+ used by someone who understands the algorithm used by zlib's deflate for
+ searching for the best matching string, and even then only by the most
+ fanatic optimizer trying to squeeze out the last compressed bit for their
+ specific input data. Read the deflate.c source code for the meaning of the
+ max_lazy, good_length, nice_length, and max_chain parameters.
+
+ deflateTune() can be called after deflateInit() or deflateInit2(), and
+ returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
+ */
+
+ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
+ uLong sourceLen));
+/*
+ deflateBound() returns an upper bound on the compressed size after
+ deflation of sourceLen bytes. It must be called after deflateInit()
+ or deflateInit2(). This would be used to allocate an output buffer
+ for deflation in a single pass, and so would be called before deflate().
+*/
+
+ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
+ int bits,
+ int value));
+/*
+ deflatePrime() inserts bits in the deflate output stream. The intent
+ is that this function is used to start off the deflate output with the
+ bits leftover from a previous deflate stream when appending to it. As such,
+ this function can only be used for raw deflate, and must be used before the
+ first deflate() call after a deflateInit2() or deflateReset(). bits must be
+ less than or equal to 16, and that many of the least significant bits of
+ value will be inserted in the output.
+
+ deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
+ stream state was inconsistent.
+*/
+
+ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
+ gz_headerp head));
+/*
+ deflateSetHeader() provides gzip header information for when a gzip
+ stream is requested by deflateInit2(). deflateSetHeader() may be called
+ after deflateInit2() or deflateReset() and before the first call of
+ deflate(). The text, time, os, extra field, name, and comment information
+ in the provided gz_header structure are written to the gzip header (xflag is
+ ignored -- the extra flags are set according to the compression level). The
+ caller must assure that, if not Z_NULL, name and comment are terminated with
+ a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
+ available there. If hcrc is true, a gzip header crc is included. Note that
+ the current versions of the command-line version of gzip (up through version
+ 1.3.x) do not support header crc's, and will report that it is a "multi-part
+ gzip file" and give up.
+
+ If deflateSetHeader is not used, the default gzip header has text false,
+ the time set to zero, and os set to 255, with no extra, name, or comment
+ fields. The gzip header is returned to the default state by deflateReset().
+
+ deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
+ stream state was inconsistent.
+*/
+
+/*
+ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
+ int windowBits));
+
+ This is another version of inflateInit with an extra parameter. The
+ fields next_in, avail_in, zalloc, zfree and opaque must be initialized
+ before by the caller.
+
+ The windowBits parameter is the base two logarithm of the maximum window
+ size (the size of the history buffer). It should be in the range 8..15 for
+ this version of the library. The default value is 15 if inflateInit is used
+ instead. windowBits must be greater than or equal to the windowBits value
+ provided to deflateInit2() while compressing, or it must be equal to 15 if
+ deflateInit2() was not used. If a compressed stream with a larger window
+ size is given as input, inflate() will return with the error code
+ Z_DATA_ERROR instead of trying to allocate a larger window.
+
+ windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
+ determines the window size. inflate() will then process raw deflate data,
+ not looking for a zlib or gzip header, not generating a check value, and not
+ looking for any check values for comparison at the end of the stream. This
+ is for use with other formats that use the deflate compressed data format
+ such as zip. Those formats provide their own check values. If a custom
+ format is developed using the raw deflate format for compressed data, it is
+ recommended that a check value such as an adler32 or a crc32 be applied to
+ the uncompressed data as is done in the zlib, gzip, and zip formats. For
+ most applications, the zlib format should be used as is. Note that comments
+ above on the use in deflateInit2() applies to the magnitude of windowBits.
+
+ windowBits can also be greater than 15 for optional gzip decoding. Add
+ 32 to windowBits to enable zlib and gzip decoding with automatic header
+ detection, or add 16 to decode only the gzip format (the zlib format will
+ return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is
+ a crc32 instead of an adler32.
+
+ inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg
+ is set to null if there is no error message. inflateInit2 does not perform
+ any decompression apart from reading the zlib header if present: this will
+ be done by inflate(). (So next_in and avail_in may be modified, but next_out
+ and avail_out are unchanged.)
+*/
+
+ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
+ const Bytef *dictionary,
+ uInt dictLength));
+/*
+ Initializes the decompression dictionary from the given uncompressed byte
+ sequence. This function must be called immediately after a call of inflate,
+ if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
+ can be determined from the adler32 value returned by that call of inflate.
+ The compressor and decompressor must use exactly the same dictionary (see
+ deflateSetDictionary). For raw inflate, this function can be called
+ immediately after inflateInit2() or inflateReset() and before any call of
+ inflate() to set the dictionary. The application must insure that the
+ dictionary that was used for compression is provided.
+
+ inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
+ parameter is invalid (such as NULL dictionary) or the stream state is
+ inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
+ expected one (incorrect adler32 value). inflateSetDictionary does not
+ perform any decompression: this will be done by subsequent calls of
+ inflate().
+*/
+
+ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
+/*
+ Skips invalid compressed data until a full flush point (see above the
+ description of deflate with Z_FULL_FLUSH) can be found, or until all
+ available input is skipped. No output is provided.
+
+ inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
+ if no more input was provided, Z_DATA_ERROR if no flush point has been found,
+ or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
+ case, the application may save the current current value of total_in which
+ indicates where valid compressed data was found. In the error case, the
+ application may repeatedly call inflateSync, providing more input each time,
+ until success or end of the input data.
+*/
+
+ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
+ z_streamp source));
+/*
+ Sets the destination stream as a complete copy of the source stream.
+
+ This function can be useful when randomly accessing a large stream. The
+ first pass through the stream can periodically record the inflate state,
+ allowing restarting inflate at those points when randomly accessing the
+ stream.
+
+ inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+ (such as zalloc being NULL). msg is left unchanged in both source and
+ destination.
+*/
+
+ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
+/*
+ This function is equivalent to inflateEnd followed by inflateInit,
+ but does not free and reallocate all the internal decompression state.
+ The stream will keep attributes that may have been set by inflateInit2.
+
+ inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+ stream state was inconsistent (such as zalloc or state being NULL).
+*/
+
+ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
+ int bits,
+ int value));
+/*
+ This function inserts bits in the inflate input stream. The intent is
+ that this function is used to start inflating at a bit position in the
+ middle of a byte. The provided bits will be used before any bytes are used
+ from next_in. This function should only be used with raw inflate, and
+ should be used before the first inflate() call after inflateInit2() or
+ inflateReset(). bits must be less than or equal to 16, and that many of the
+ least significant bits of value will be inserted in the input.
+
+ inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
+ stream state was inconsistent.
+*/
+
+ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
+ gz_headerp head));
+/*
+ inflateGetHeader() requests that gzip header information be stored in the
+ provided gz_header structure. inflateGetHeader() may be called after
+ inflateInit2() or inflateReset(), and before the first call of inflate().
+ As inflate() processes the gzip stream, head->done is zero until the header
+ is completed, at which time head->done is set to one. If a zlib stream is
+ being decoded, then head->done is set to -1 to indicate that there will be
+ no gzip header information forthcoming. Note that Z_BLOCK can be used to
+ force inflate() to return immediately after header processing is complete
+ and before any actual data is decompressed.
+
+ The text, time, xflags, and os fields are filled in with the gzip header
+ contents. hcrc is set to true if there is a header CRC. (The header CRC
+ was valid if done is set to one.) If extra is not Z_NULL, then extra_max
+ contains the maximum number of bytes to write to extra. Once done is true,
+ extra_len contains the actual extra field length, and extra contains the
+ extra field, or that field truncated if extra_max is less than extra_len.
+ If name is not Z_NULL, then up to name_max characters are written there,
+ terminated with a zero unless the length is greater than name_max. If
+ comment is not Z_NULL, then up to comm_max characters are written there,
+ terminated with a zero unless the length is greater than comm_max. When
+ any of extra, name, or comment are not Z_NULL and the respective field is
+ not present in the header, then that field is set to Z_NULL to signal its
+ absence. This allows the use of deflateSetHeader() with the returned
+ structure to duplicate the header. However if those fields are set to
+ allocated memory, then the application will need to save those pointers
+ elsewhere so that they can be eventually freed.
+
+ If inflateGetHeader is not used, then the header information is simply
+ discarded. The header is always checked for validity, including the header
+ CRC if present. inflateReset() will reset the process to discard the header
+ information. The application would need to call inflateGetHeader() again to
+ retrieve the header from the next gzip stream.
+
+ inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
+ stream state was inconsistent.
+*/
+
+/*
+ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
+ unsigned char FAR *window));
+
+ Initialize the internal stream state for decompression using inflateBack()
+ calls. The fields zalloc, zfree and opaque in strm must be initialized
+ before the call. If zalloc and zfree are Z_NULL, then the default library-
+ derived memory allocation routines are used. windowBits is the base two
+ logarithm of the window size, in the range 8..15. window is a caller
+ supplied buffer of that size. Except for special applications where it is
+ assured that deflate was used with small window sizes, windowBits must be 15
+ and a 32K byte window must be supplied to be able to decompress general
+ deflate streams.
+
+ See inflateBack() for the usage of these routines.
+
+ inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
+ the paramaters are invalid, Z_MEM_ERROR if the internal state could not
+ be allocated, or Z_VERSION_ERROR if the version of the library does not
+ match the version of the header file.
+*/
+
+typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
+typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
+
+ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
+ in_func in, void FAR *in_desc,
+ out_func out, void FAR *out_desc));
+/*
+ inflateBack() does a raw inflate with a single call using a call-back
+ interface for input and output. This is more efficient than inflate() for
+ file i/o applications in that it avoids copying between the output and the
+ sliding window by simply making the window itself the output buffer. This
+ function trusts the application to not change the output buffer passed by
+ the output function, at least until inflateBack() returns.
+
+ inflateBackInit() must be called first to allocate the internal state
+ and to initialize the state with the user-provided window buffer.
+ inflateBack() may then be used multiple times to inflate a complete, raw
+ deflate stream with each call. inflateBackEnd() is then called to free
+ the allocated state.
+
+ A raw deflate stream is one with no zlib or gzip header or trailer.
+ This routine would normally be used in a utility that reads zip or gzip
+ files and writes out uncompressed files. The utility would decode the
+ header and process the trailer on its own, hence this routine expects
+ only the raw deflate stream to decompress. This is different from the
+ normal behavior of inflate(), which expects either a zlib or gzip header and
+ trailer around the deflate stream.
+
+ inflateBack() uses two subroutines supplied by the caller that are then
+ called by inflateBack() for input and output. inflateBack() calls those
+ routines until it reads a complete deflate stream and writes out all of the
+ uncompressed data, or until it encounters an error. The function's
+ parameters and return types are defined above in the in_func and out_func
+ typedefs. inflateBack() will call in(in_desc, &buf) which should return the
+ number of bytes of provided input, and a pointer to that input in buf. If
+ there is no input available, in() must return zero--buf is ignored in that
+ case--and inflateBack() will return a buffer error. inflateBack() will call
+ out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out()
+ should return zero on success, or non-zero on failure. If out() returns
+ non-zero, inflateBack() will return with an error. Neither in() nor out()
+ are permitted to change the contents of the window provided to
+ inflateBackInit(), which is also the buffer that out() uses to write from.
+ The length written by out() will be at most the window size. Any non-zero
+ amount of input may be provided by in().
+
+ For convenience, inflateBack() can be provided input on the first call by
+ setting strm->next_in and strm->avail_in. If that input is exhausted, then
+ in() will be called. Therefore strm->next_in must be initialized before
+ calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called
+ immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in
+ must also be initialized, and then if strm->avail_in is not zero, input will
+ initially be taken from strm->next_in[0 .. strm->avail_in - 1].
+
+ The in_desc and out_desc parameters of inflateBack() is passed as the
+ first parameter of in() and out() respectively when they are called. These
+ descriptors can be optionally used to pass any information that the caller-
+ supplied in() and out() functions need to do their job.
+
+ On return, inflateBack() will set strm->next_in and strm->avail_in to
+ pass back any unused input that was provided by the last in() call. The
+ return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
+ if in() or out() returned an error, Z_DATA_ERROR if there was a format
+ error in the deflate stream (in which case strm->msg is set to indicate the
+ nature of the error), or Z_STREAM_ERROR if the stream was not properly
+ initialized. In the case of Z_BUF_ERROR, an input or output error can be
+ distinguished using strm->next_in which will be Z_NULL only if in() returned
+ an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to
+ out() returning non-zero. (in() will always be called before out(), so
+ strm->next_in is assured to be defined if out() returns non-zero.) Note
+ that inflateBack() cannot return Z_OK.
+*/
+
+ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
+/*
+ All memory allocated by inflateBackInit() is freed.
+
+ inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
+ state was inconsistent.
+*/
+
+ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
+/* Return flags indicating compile-time options.
+
+ Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
+ 1.0: size of uInt
+ 3.2: size of uLong
+ 5.4: size of voidpf (pointer)
+ 7.6: size of z_off_t
+
+ Compiler, assembler, and debug options:
+ 8: DEBUG
+ 9: ASMV or ASMINF -- use ASM code
+ 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
+ 11: 0 (reserved)
+
+ One-time table building (smaller code, but not thread-safe if true):
+ 12: BUILDFIXED -- build static block decoding tables when needed
+ 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
+ 14,15: 0 (reserved)
+
+ Library content (indicates missing functionality):
+ 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
+ deflate code when not needed)
+ 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
+ and decode gzip streams (to avoid linking crc code)
+ 18-19: 0 (reserved)
+
+ Operation variations (changes in library functionality):
+ 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
+ 21: FASTEST -- deflate algorithm with only one, lowest compression level
+ 22,23: 0 (reserved)
+
+ The sprintf variant used by gzprintf (zero is best):
+ 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
+ 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
+ 26: 0 = returns value, 1 = void -- 1 means inferred string length returned
+
+ Remainder:
+ 27-31: 0 (reserved)
+ */
+
+
+ /* utility functions */
+
+/*
+ The following utility functions are implemented on top of the
+ basic stream-oriented functions. To simplify the interface, some
+ default options are assumed (compression level and memory usage,
+ standard memory allocation functions). The source code of these
+ utility functions can easily be modified if you need special options.
+*/
+
+ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen));
+/*
+ Compresses the source buffer into the destination buffer. sourceLen is
+ the byte length of the source buffer. Upon entry, destLen is the total
+ size of the destination buffer, which must be at least the value returned
+ by compressBound(sourceLen). Upon exit, destLen is the actual size of the
+ compressed buffer.
+ This function can be used to compress a whole file at once if the
+ input file is mmap'ed.
+ compress returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_BUF_ERROR if there was not enough room in the output
+ buffer.
+*/
+
+ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen,
+ int level));
+/*
+ Compresses the source buffer into the destination buffer. The level
+ parameter has the same meaning as in deflateInit. sourceLen is the byte
+ length of the source buffer. Upon entry, destLen is the total size of the
+ destination buffer, which must be at least the value returned by
+ compressBound(sourceLen). Upon exit, destLen is the actual size of the
+ compressed buffer.
+
+ compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_BUF_ERROR if there was not enough room in the output buffer,
+ Z_STREAM_ERROR if the level parameter is invalid.
+*/
+
+ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
+/*
+ compressBound() returns an upper bound on the compressed size after
+ compress() or compress2() on sourceLen bytes. It would be used before
+ a compress() or compress2() call to allocate the destination buffer.
+*/
+
+ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen));
+/*
+ Decompresses the source buffer into the destination buffer. sourceLen is
+ the byte length of the source buffer. Upon entry, destLen is the total
+ size of the destination buffer, which must be large enough to hold the
+ entire uncompressed data. (The size of the uncompressed data must have
+ been saved previously by the compressor and transmitted to the decompressor
+ by some mechanism outside the scope of this compression library.)
+ Upon exit, destLen is the actual size of the compressed buffer.
+ This function can be used to decompress a whole file at once if the
+ input file is mmap'ed.
+
+ uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_BUF_ERROR if there was not enough room in the output
+ buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.
+*/
+
+
+typedef voidp gzFile;
+
+ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
+/*
+ Opens a gzip (.gz) file for reading or writing. The mode parameter
+ is as in fopen ("rb" or "wb") but can also include a compression level
+ ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
+ Huffman only compression as in "wb1h", or 'R' for run-length encoding
+ as in "wb1R". (See the description of deflateInit2 for more information
+ about the strategy parameter.)
+
+ gzopen can be used to read a file which is not in gzip format; in this
+ case gzread will directly read from the file without decompression.
+
+ gzopen returns NULL if the file could not be opened or if there was
+ insufficient memory to allocate the (de)compression state; errno
+ can be checked to distinguish the two cases (if errno is zero, the
+ zlib error is Z_MEM_ERROR). */
+
+ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
+/*
+ gzdopen() associates a gzFile with the file descriptor fd. File
+ descriptors are obtained from calls like open, dup, creat, pipe or
+ fileno (in the file has been previously opened with fopen).
+ The mode parameter is as in gzopen.
+ The next call of gzclose on the returned gzFile will also close the
+ file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
+ descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
+ gzdopen returns NULL if there was insufficient memory to allocate
+ the (de)compression state.
+*/
+
+ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
+/*
+ Dynamically update the compression level or strategy. See the description
+ of deflateInit2 for the meaning of these parameters.
+ gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
+ opened for writing.
+*/
+
+ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
+/*
+ Reads the given number of uncompressed bytes from the compressed file.
+ If the input file was not in gzip format, gzread copies the given number
+ of bytes into the buffer.
+ gzread returns the number of uncompressed bytes actually read (0 for
+ end of file, -1 for error). */
+
+ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
+ voidpc buf, unsigned len));
+/*
+ Writes the given number of uncompressed bytes into the compressed file.
+ gzwrite returns the number of uncompressed bytes actually written
+ (0 in case of error).
+*/
+
+ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
+/*
+ Converts, formats, and writes the args to the compressed file under
+ control of the format string, as in fprintf. gzprintf returns the number of
+ uncompressed bytes actually written (0 in case of error). The number of
+ uncompressed bytes written is limited to 4095. The caller should assure that
+ this limit is not exceeded. If it is exceeded, then gzprintf() will return
+ return an error (0) with nothing written. In this case, there may also be a
+ buffer overflow with unpredictable consequences, which is possible only if
+ zlib was compiled with the insecure functions sprintf() or vsprintf()
+ because the secure snprintf() or vsnprintf() functions were not available.
+*/
+
+ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
+/*
+ Writes the given null-terminated string to the compressed file, excluding
+ the terminating null character.
+ gzputs returns the number of characters written, or -1 in case of error.
+*/
+
+ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
+/*
+ Reads bytes from the compressed file until len-1 characters are read, or
+ a newline character is read and transferred to buf, or an end-of-file
+ condition is encountered. The string is then terminated with a null
+ character.
+ gzgets returns buf, or Z_NULL in case of error.
+*/
+
+ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
+/*
+ Writes c, converted to an unsigned char, into the compressed file.
+ gzputc returns the value that was written, or -1 in case of error.
+*/
+
+ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
+/*
+ Reads one byte from the compressed file. gzgetc returns this byte
+ or -1 in case of end of file or error.
+*/
+
+ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
+/*
+ Push one character back onto the stream to be read again later.
+ Only one character of push-back is allowed. gzungetc() returns the
+ character pushed, or -1 on failure. gzungetc() will fail if a
+ character has been pushed but not read yet, or if c is -1. The pushed
+ character will be discarded if the stream is repositioned with gzseek()
+ or gzrewind().
+*/
+
+ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
+/*
+ Flushes all pending output into the compressed file. The parameter
+ flush is as in the deflate() function. The return value is the zlib
+ error number (see function gzerror below). gzflush returns Z_OK if
+ the flush parameter is Z_FINISH and all output could be flushed.
+ gzflush should be called only when strictly necessary because it can
+ degrade compression.
+*/
+
+ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
+ z_off_t offset, int whence));
+/*
+ Sets the starting position for the next gzread or gzwrite on the
+ given compressed file. The offset represents a number of bytes in the
+ uncompressed data stream. The whence parameter is defined as in lseek(2);
+ the value SEEK_END is not supported.
+ If the file is opened for reading, this function is emulated but can be
+ extremely slow. If the file is opened for writing, only forward seeks are
+ supported; gzseek then compresses a sequence of zeroes up to the new
+ starting position.
+
+ gzseek returns the resulting offset location as measured in bytes from
+ the beginning of the uncompressed stream, or -1 in case of error, in
+ particular if the file is opened for writing and the new starting position
+ would be before the current position.
+*/
+
+ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
+/*
+ Rewinds the given file. This function is supported only for reading.
+
+ gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
+*/
+
+ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
+/*
+ Returns the starting position for the next gzread or gzwrite on the
+ given compressed file. This position represents a number of bytes in the
+ uncompressed data stream.
+
+ gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
+*/
+
+ZEXTERN int ZEXPORT gzeof OF((gzFile file));
+/*
+ Returns 1 when EOF has previously been detected reading the given
+ input stream, otherwise zero.
+*/
+
+ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
+/*
+ Returns 1 if file is being read directly without decompression, otherwise
+ zero.
+*/
+
+ZEXTERN int ZEXPORT gzclose OF((gzFile file));
+/*
+ Flushes all pending output if necessary, closes the compressed file
+ and deallocates all the (de)compression state. The return value is the zlib
+ error number (see function gzerror below).
+*/
+
+ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
+/*
+ Returns the error message for the last error which occurred on the
+ given compressed file. errnum is set to zlib error number. If an
+ error occurred in the file system and not in the compression library,
+ errnum is set to Z_ERRNO and the application may consult errno
+ to get the exact error code.
+*/
+
+ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
+/*
+ Clears the error and end-of-file flags for file. This is analogous to the
+ clearerr() function in stdio. This is useful for continuing to read a gzip
+ file that is being written concurrently.
+*/
+
+ /* checksum functions */
+
+/*
+ These functions are not related to compression but are exported
+ anyway because they might be useful in applications using the
+ compression library.
+*/
+
+ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
+/*
+ Update a running Adler-32 checksum with the bytes buf[0..len-1] and
+ return the updated checksum. If buf is NULL, this function returns
+ the required initial value for the checksum.
+ An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
+ much faster. Usage example:
+
+ uLong adler = adler32(0L, Z_NULL, 0);
+
+ while (read_buffer(buffer, length) != EOF) {
+ adler = adler32(adler, buffer, length);
+ }
+ if (adler != original_adler) error();
+*/
+
+ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
+ z_off_t len2));
+/*
+ Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
+ and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
+ each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
+ seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
+*/
+
+ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
+/*
+ Update a running CRC-32 with the bytes buf[0..len-1] and return the
+ updated CRC-32. If buf is NULL, this function returns the required initial
+ value for the for the crc. Pre- and post-conditioning (one's complement) is
+ performed within this function so it shouldn't be done by the application.
+ Usage example:
+
+ uLong crc = crc32(0L, Z_NULL, 0);
+
+ while (read_buffer(buffer, length) != EOF) {
+ crc = crc32(crc, buffer, length);
+ }
+ if (crc != original_crc) error();
+*/
+
+ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
+
+/*
+ Combine two CRC-32 check values into one. For two sequences of bytes,
+ seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
+ calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
+ check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
+ len2.
+*/
+
+
+ /* various hacks, don't look :) */
+
+/* deflateInit and inflateInit are macros to allow checking the zlib version
+ * and the compiler's view of z_stream:
+ */
+ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
+ const char *version, int stream_size));
+ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
+ const char *version, int stream_size));
+ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
+ int windowBits, int memLevel,
+ int strategy, const char *version,
+ int stream_size));
+ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
+ const char *version, int stream_size));
+ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
+ unsigned char FAR *window,
+ const char *version,
+ int stream_size));
+#define deflateInit(strm, level) \
+ deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit(strm) \
+ inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
+#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
+ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
+ (strategy), ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit2(strm, windowBits) \
+ inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
+#define inflateBackInit(strm, windowBits, window) \
+ inflateBackInit_((strm), (windowBits), (window), \
+ ZLIB_VERSION, sizeof(z_stream))
+
+
+#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
+ struct internal_state {int dummy;}; /* hack for buggy compilers */
+#endif
+
+ZEXTERN const char * ZEXPORT zError OF((int));
+ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
+ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZLIB_H */
diff --git a/support/zlib/zlib_init.c b/support/zlib/zlib_init.c
new file mode 100644
index 00000000..32be387d
--- /dev/null
+++ b/support/zlib/zlib_init.c
@@ -0,0 +1,6 @@
+#include "plugin.h"
+
+void
+plugin_init(void)
+{
+}
diff --git a/support/zlib/zutil.c b/support/zlib/zutil.c
new file mode 100644
index 00000000..d55f5948
--- /dev/null
+++ b/support/zlib/zutil.c
@@ -0,0 +1,318 @@
+/* zutil.c -- target dependent utility functions for the compression library
+ * Copyright (C) 1995-2005 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id$ */
+
+#include "zutil.h"
+
+#ifndef NO_DUMMY_DECL
+struct internal_state {int dummy;}; /* for buggy compilers */
+#endif
+
+const char * const z_errmsg[10] = {
+"need dictionary", /* Z_NEED_DICT 2 */
+"stream end", /* Z_STREAM_END 1 */
+"", /* Z_OK 0 */
+"file error", /* Z_ERRNO (-1) */
+"stream error", /* Z_STREAM_ERROR (-2) */
+"data error", /* Z_DATA_ERROR (-3) */
+"insufficient memory", /* Z_MEM_ERROR (-4) */
+"buffer error", /* Z_BUF_ERROR (-5) */
+"incompatible version",/* Z_VERSION_ERROR (-6) */
+""};
+
+
+const char * ZEXPORT zlibVersion()
+{
+ return ZLIB_VERSION;
+}
+
+uLong ZEXPORT zlibCompileFlags()
+{
+ uLong flags;
+
+ flags = 0;
+ switch (sizeof(uInt)) {
+ case 2: break;
+ case 4: flags += 1; break;
+ case 8: flags += 2; break;
+ default: flags += 3;
+ }
+ switch (sizeof(uLong)) {
+ case 2: break;
+ case 4: flags += 1 << 2; break;
+ case 8: flags += 2 << 2; break;
+ default: flags += 3 << 2;
+ }
+ switch (sizeof(voidpf)) {
+ case 2: break;
+ case 4: flags += 1 << 4; break;
+ case 8: flags += 2 << 4; break;
+ default: flags += 3 << 4;
+ }
+ switch (sizeof(z_off_t)) {
+ case 2: break;
+ case 4: flags += 1 << 6; break;
+ case 8: flags += 2 << 6; break;
+ default: flags += 3 << 6;
+ }
+#ifdef DEBUG
+ flags += 1 << 8;
+#endif
+#if defined(ASMV) || defined(ASMINF)
+ flags += 1 << 9;
+#endif
+#ifdef ZLIB_WINAPI
+ flags += 1 << 10;
+#endif
+#ifdef BUILDFIXED
+ flags += 1 << 12;
+#endif
+#ifdef DYNAMIC_CRC_TABLE
+ flags += 1 << 13;
+#endif
+#ifdef NO_GZCOMPRESS
+ flags += 1L << 16;
+#endif
+#ifdef NO_GZIP
+ flags += 1L << 17;
+#endif
+#ifdef PKZIP_BUG_WORKAROUND
+ flags += 1L << 20;
+#endif
+#ifdef FASTEST
+ flags += 1L << 21;
+#endif
+#ifdef STDC
+# ifdef NO_vsnprintf
+ flags += 1L << 25;
+# ifdef HAS_vsprintf_void
+ flags += 1L << 26;
+# endif
+# else
+# ifdef HAS_vsnprintf_void
+ flags += 1L << 26;
+# endif
+# endif
+#else
+ flags += 1L << 24;
+# ifdef NO_snprintf
+ flags += 1L << 25;
+# ifdef HAS_sprintf_void
+ flags += 1L << 26;
+# endif
+# else
+# ifdef HAS_snprintf_void
+ flags += 1L << 26;
+# endif
+# endif
+#endif
+ return flags;
+}
+
+#ifdef DEBUG
+
+# ifndef verbose
+# define verbose 0
+# endif
+int z_verbose = verbose;
+
+void z_error (m)
+ char *m;
+{
+ fprintf(stderr, "%s\n", m);
+ exit(1);
+}
+#endif
+
+/* exported to allow conversion of error code to string for compress() and
+ * uncompress()
+ */
+const char * ZEXPORT zError(err)
+ int err;
+{
+ return ERR_MSG(err);
+}
+
+#if defined(_WIN32_WCE)
+ /* The Microsoft C Run-Time Library for Windows CE doesn't have
+ * errno. We define it as a global variable to simplify porting.
+ * Its value is always 0 and should not be used.
+ */
+ int errno = 0;
+#endif
+
+#ifndef HAVE_MEMCPY
+
+void zmemcpy(dest, source, len)
+ Bytef* dest;
+ const Bytef* source;
+ uInt len;
+{
+ if (len == 0) return;
+ do {
+ *dest++ = *source++; /* ??? to be unrolled */
+ } while (--len != 0);
+}
+
+int zmemcmp(s1, s2, len)
+ const Bytef* s1;
+ const Bytef* s2;
+ uInt len;
+{
+ uInt j;
+
+ for (j = 0; j < len; j++) {
+ if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
+ }
+ return 0;
+}
+
+void zmemzero(dest, len)
+ Bytef* dest;
+ uInt len;
+{
+ if (len == 0) return;
+ do {
+ *dest++ = 0; /* ??? to be unrolled */
+ } while (--len != 0);
+}
+#endif
+
+
+#ifdef SYS16BIT
+
+#ifdef __TURBOC__
+/* Turbo C in 16-bit mode */
+
+# define MY_ZCALLOC
+
+/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
+ * and farmalloc(64K) returns a pointer with an offset of 8, so we
+ * must fix the pointer. Warning: the pointer must be put back to its
+ * original form in order to free it, use zcfree().
+ */
+
+#define MAX_PTR 10
+/* 10*64K = 640K */
+
+local int next_ptr = 0;
+
+typedef struct ptr_table_s {
+ voidpf org_ptr;
+ voidpf new_ptr;
+} ptr_table;
+
+local ptr_table table[MAX_PTR];
+/* This table is used to remember the original form of pointers
+ * to large buffers (64K). Such pointers are normalized with a zero offset.
+ * Since MSDOS is not a preemptive multitasking OS, this table is not
+ * protected from concurrent access. This hack doesn't work anyway on
+ * a protected system like OS/2. Use Microsoft C instead.
+ */
+
+voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
+{
+ voidpf buf = opaque; /* just to make some compilers happy */
+ ulg bsize = (ulg)items*size;
+
+ /* If we allocate less than 65520 bytes, we assume that farmalloc
+ * will return a usable pointer which doesn't have to be normalized.
+ */
+ if (bsize < 65520L) {
+ buf = farmalloc(bsize);
+ if (*(ush*)&buf != 0) return buf;
+ } else {
+ buf = farmalloc(bsize + 16L);
+ }
+ if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
+ table[next_ptr].org_ptr = buf;
+
+ /* Normalize the pointer to seg:0 */
+ *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
+ *(ush*)&buf = 0;
+ table[next_ptr++].new_ptr = buf;
+ return buf;
+}
+
+void zcfree (voidpf opaque, voidpf ptr)
+{
+ int n;
+ if (*(ush*)&ptr != 0) { /* object < 64K */
+ farfree(ptr);
+ return;
+ }
+ /* Find the original pointer */
+ for (n = 0; n < next_ptr; n++) {
+ if (ptr != table[n].new_ptr) continue;
+
+ farfree(table[n].org_ptr);
+ while (++n < next_ptr) {
+ table[n-1] = table[n];
+ }
+ next_ptr--;
+ return;
+ }
+ ptr = opaque; /* just to make some compilers happy */
+ Assert(0, "zcfree: ptr not found");
+}
+
+#endif /* __TURBOC__ */
+
+
+#ifdef M_I86
+/* Microsoft C in 16-bit mode */
+
+# define MY_ZCALLOC
+
+#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
+# define _halloc halloc
+# define _hfree hfree
+#endif
+
+voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
+{
+ if (opaque) opaque = 0; /* to make compiler happy */
+ return _halloc((long)items, size);
+}
+
+void zcfree (voidpf opaque, voidpf ptr)
+{
+ if (opaque) opaque = 0; /* to make compiler happy */
+ _hfree(ptr);
+}
+
+#endif /* M_I86 */
+
+#endif /* SYS16BIT */
+
+
+#ifndef MY_ZCALLOC /* Any system without a special alloc function */
+
+#ifndef STDC
+extern voidp malloc OF((uInt size));
+extern voidp calloc OF((uInt items, uInt size));
+extern void free OF((voidpf ptr));
+#endif
+
+voidpf zcalloc (opaque, items, size)
+ voidpf opaque;
+ unsigned items;
+ unsigned size;
+{
+ if (opaque) items += size - size; /* make compiler happy */
+ return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
+ (voidpf)calloc(items, size);
+}
+
+void zcfree (opaque, ptr)
+ voidpf opaque;
+ voidpf ptr;
+{
+ free(ptr);
+ if (opaque) return; /* make compiler happy */
+}
+
+#endif /* MY_ZCALLOC */
diff --git a/support/zlib/zutil.h b/support/zlib/zutil.h
new file mode 100644
index 00000000..6cca50b9
--- /dev/null
+++ b/support/zlib/zutil.h
@@ -0,0 +1,269 @@
+/* zutil.h -- internal interface and configuration of the compression library
+ * Copyright (C) 1995-2005 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+/* @(#) $Id$ */
+
+#ifndef ZUTIL_H
+#define ZUTIL_H
+
+#define ZLIB_INTERNAL
+#include "zlib.h"
+
+#ifdef STDC
+# ifndef _WIN32_WCE
+# include <stddef.h>
+# endif
+# include <string.h>
+# include <stdlib.h>
+#endif
+#ifdef NO_ERRNO_H
+# ifdef _WIN32_WCE
+ /* The Microsoft C Run-Time Library for Windows CE doesn't have
+ * errno. We define it as a global variable to simplify porting.
+ * Its value is always 0 and should not be used. We rename it to
+ * avoid conflict with other libraries that use the same workaround.
+ */
+# define errno z_errno
+# endif
+ extern int errno;
+#else
+# ifndef _WIN32_WCE
+# include <errno.h>
+# endif
+#endif
+
+#ifndef local
+# define local static
+#endif
+/* compile with -Dlocal if your debugger can't find static symbols */
+
+typedef unsigned char uch;
+typedef uch FAR uchf;
+typedef unsigned short ush;
+typedef ush FAR ushf;
+typedef unsigned long ulg;
+
+extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
+/* (size given to avoid silly warnings with Visual C++) */
+
+#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
+
+#define ERR_RETURN(strm,err) \
+ return (strm->msg = (char*)ERR_MSG(err), (err))
+/* To be used only when the state is known to be valid */
+
+ /* common constants */
+
+#ifndef DEF_WBITS
+# define DEF_WBITS MAX_WBITS
+#endif
+/* default windowBits for decompression. MAX_WBITS is for compression only */
+
+#if MAX_MEM_LEVEL >= 8
+# define DEF_MEM_LEVEL 8
+#else
+# define DEF_MEM_LEVEL MAX_MEM_LEVEL
+#endif
+/* default memLevel */
+
+#define STORED_BLOCK 0
+#define STATIC_TREES 1
+#define DYN_TREES 2
+/* The three kinds of block type */
+
+#define MIN_MATCH 3
+#define MAX_MATCH 258
+/* The minimum and maximum match lengths */
+
+#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
+
+ /* target dependencies */
+
+#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
+# define OS_CODE 0x00
+# if defined(__TURBOC__) || defined(__BORLANDC__)
+# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
+ /* Allow compilation with ANSI keywords only enabled */
+ void _Cdecl farfree( void *block );
+ void *_Cdecl farmalloc( unsigned long nbytes );
+# else
+# include <alloc.h>
+# endif
+# else /* MSC or DJGPP */
+# include <malloc.h>
+# endif
+#endif
+
+#ifdef AMIGA
+# define OS_CODE 0x01
+#endif
+
+#if defined(VAXC) || defined(VMS)
+# define OS_CODE 0x02
+# define F_OPEN(name, mode) \
+ fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
+#endif
+
+#if defined(ATARI) || defined(atarist)
+# define OS_CODE 0x05
+#endif
+
+#ifdef OS2
+# define OS_CODE 0x06
+# ifdef M_I86
+ #include <malloc.h>
+# endif
+#endif
+
+#if defined(MACOS) || defined(TARGET_OS_MAC)
+# define OS_CODE 0x07
+# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
+# include <unix.h> /* for fdopen */
+# else
+# ifndef fdopen
+# define fdopen(fd,mode) NULL /* No fdopen() */
+# endif
+# endif
+#endif
+
+#ifdef TOPS20
+# define OS_CODE 0x0a
+#endif
+
+#ifdef WIN32
+# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */
+# define OS_CODE 0x0b
+# endif
+#endif
+
+#ifdef __50SERIES /* Prime/PRIMOS */
+# define OS_CODE 0x0f
+#endif
+
+#if defined(_BEOS_) || defined(RISCOS)
+# define fdopen(fd,mode) NULL /* No fdopen() */
+#endif
+
+#if (defined(_MSC_VER) && (_MSC_VER > 600)) || defined(__MINGW32__)
+# if defined(_WIN32_WCE)
+# define fdopen(fd,mode) NULL /* No fdopen() */
+# ifndef _PTRDIFF_T_DEFINED
+ typedef int ptrdiff_t;
+# define _PTRDIFF_T_DEFINED
+# endif
+# else
+# define fdopen(fd,type) _fdopen(fd,type)
+# endif
+#endif
+
+ /* common defaults */
+
+#ifndef OS_CODE
+# define OS_CODE 0x03 /* assume Unix */
+#endif
+
+#ifndef F_OPEN
+# define F_OPEN(name, mode) fopen((name), (mode))
+#endif
+
+ /* functions */
+
+#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
+# ifndef HAVE_VSNPRINTF
+# define HAVE_VSNPRINTF
+# endif
+#endif
+#if defined(__CYGWIN__)
+# ifndef HAVE_VSNPRINTF
+# define HAVE_VSNPRINTF
+# endif
+#endif
+#ifndef HAVE_VSNPRINTF
+# ifdef MSDOS
+ /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
+ but for now we just assume it doesn't. */
+# define NO_vsnprintf
+# endif
+# ifdef __TURBOC__
+# define NO_vsnprintf
+# endif
+# ifdef WIN32
+ /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
+# if !defined(vsnprintf) && !defined(NO_vsnprintf)
+# define vsnprintf _vsnprintf
+# endif
+# endif
+# ifdef __SASC
+# define NO_vsnprintf
+# endif
+#endif
+#ifdef VMS
+# define NO_vsnprintf
+#endif
+
+#if defined(pyr)
+# define NO_MEMCPY
+#endif
+#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
+ /* Use our own functions for small and medium model with MSC <= 5.0.
+ * You may have to use the same strategy for Borland C (untested).
+ * The __SC__ check is for Symantec.
+ */
+# define NO_MEMCPY
+#endif
+#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
+# define HAVE_MEMCPY
+#endif
+#ifdef HAVE_MEMCPY
+# ifdef SMALL_MEDIUM /* MSDOS small or medium model */
+# define zmemcpy _fmemcpy
+# define zmemcmp _fmemcmp
+# define zmemzero(dest, len) _fmemset(dest, 0, len)
+# else
+# define zmemcpy memcpy
+# define zmemcmp memcmp
+# define zmemzero(dest, len) memset(dest, 0, len)
+# endif
+#else
+ extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
+ extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
+ extern void zmemzero OF((Bytef* dest, uInt len));
+#endif
+
+/* Diagnostic functions */
+#ifdef DEBUG
+# include <stdio.h>
+ extern int z_verbose;
+ extern void z_error OF((char *m));
+# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
+# define Trace(x) {if (z_verbose>=0) fprintf x ;}
+# define Tracev(x) {if (z_verbose>0) fprintf x ;}
+# define Tracevv(x) {if (z_verbose>1) fprintf x ;}
+# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
+# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
+#else
+# define Assert(cond,msg)
+# define Trace(x)
+# define Tracev(x)
+# define Tracevv(x)
+# define Tracec(c,x)
+# define Tracecv(c,x)
+#endif
+
+
+voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
+void zcfree OF((voidpf opaque, voidpf ptr));
+
+#define ZALLOC(strm, items, size) \
+ (*((strm)->zalloc))((strm)->opaque, (items), (size))
+#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
+#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
+
+#endif /* ZUTIL_H */
diff --git a/tools/asc2navit b/tools/asc2navit
new file mode 100755
index 00000000..dadef010
--- /dev/null
+++ b/tools/asc2navit
@@ -0,0 +1,135 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Getopt::Long qw(:config permute);
+use Data::Dumper;
+use Benchmark;
+
+sub show_help;
+sub preprocess_filelist;
+sub open_outputhandle;
+sub process_file;
+sub run;
+
+my $amenity = "point_unkn";
+my $write_osm = 0;
+my %files = ();
+my $filename = "onebigfile";
+my $poicount = 0;
+
+
+GetOptions ('a|amenity=s' => \$amenity,
+ 'x|write-osm!' => \$write_osm,
+ 'h|?|help!' => \&show_help,
+ 'O|output-file=s' => \$filename,
+ '<>' => \&preprocess_filelist);
+
+
+# when no file is given...
+show_help() if (keys %files == 0);
+
+# determine filename
+determine_filename();
+
+# open the pipe for the output...
+my $pipe = open_outputhandle();
+
+# ...feed the pipe...
+run();
+
+# ...and close it properly
+close $pipe;
+
+###############################################################################
+###############################################################################
+###############################################################################
+
+sub show_help {
+ print "parses one (or multiple) .asc-file(s) (mainly used by poiwarner) and\n";
+ print "merges the result into one navit binary mapfile. requires osm2navit (when -x is not set)\n";
+ print "usage: $0 [OPTION] OUT in1.asc [in2.asc [...]]\n";
+ print " creates one big file called onebigfile\n";
+ print "usage: $0 [OPTION] IN.asc\n";
+ print " creates a file called IN.asc.bin / .osm\n\n";
+ print " -h, --help shows this help\n";
+ print " -x, --write-osm write in osm's xml format instead of navit's\n";
+ print " -a, --amenity=NAME sets the amenity to NAME. default is point_unk\n";
+ print " you can use -a several times for different types of pois\n";
+ print " e.g.: $0 -a tec_common speedcamdb1 speedcamdb2 -a poi_biergarten boozestation1 boozestation2\n";
+ print " -O, --output-file=OUT write the output to OUT. default for multiple files ist onebigfile\n";
+ exit 0;
+}
+
+sub preprocess_filelist {
+ my ($filename) = @_;
+ push (@{$files{$amenity}}, @_);
+
+}
+
+sub open_outputhandle() {
+ # open the pipe to osm2navit...
+ if (!$write_osm) {
+ open $pipe, "| osm2navit $filename" or die $!;
+ } else {
+ # or a filehandle
+ open $pipe, ">$filename" or die $!;
+ }
+ return $pipe;
+}
+
+sub process_file {
+ my ($file) = @_;
+ my $filehandle;
+ print "$0 processing $file...\n";
+ open ($filehandle, "<$file") or next $!;
+ # for every line in the file...
+ while (<$filehandle>) {
+ # ...check if it's a valid record...
+ m/([0-9\.\-]*), ([0-9\.\-]*), "\[([0-9]*).*/ or next;
+ my ($lon, $lat, $id) = ($1, $2, $3);
+ # ...and write it into the handle then
+ print $pipe " <node id=\"-$id\" visible=\"true\" lon=\"$lon\" lat=\"$lat\">\n";
+ print $pipe " <tag k=\"name\" v=\"\" />\n";
+ print $pipe " <tag k=\"amenity\" v=\"$amenity\" />\n";
+ print $pipe " </node>\n";
+ $poicount++;
+ }
+}
+
+sub determine_filename {
+ my $filecount = 0;
+ foreach my $amenity (keys %files) {
+ $filecount += $#{$files{$amenity}} + 1;
+ }
+
+ # when it's only one file and no output file has been given...
+ if ($filecount == 1 && $filename eq "") {
+ my $onefile = $files{(keys %files)[0]}[0];
+ # ...generate a new one from the given filename
+ $filename = "$onefile.bin";
+ $filename = "$onefile.xml" if ($write_osm);
+ }
+
+ print "$0 writing output to $filename\n";
+}
+
+sub run {
+ # write osm header
+ print $pipe '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
+ print $pipe '<osm version="0.5">' . "\n";
+
+ # set the amenity and
+ my @amenities = keys %files;
+ while (my $amenity = shift @amenities) {
+ foreach my $file (@{$files{$amenity}}) {
+ process_file($file);
+ }
+ }
+
+ # close the osm file
+ print $pipe '</osm>';
+ # and show up some stats
+ print "$0 processed $poicount poi's\n";
+}
+
diff --git a/tools/cleanattr.sh b/tools/cleanattr.sh
new file mode 100755
index 00000000..dc2f0dc4
--- /dev/null
+++ b/tools/cleanattr.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+# This script scans the navit sources for attributes that
+# remained in attr_def.h but are no longer used.
+
+ATTRFILE=attr_def.h
+TMPDIR=/tmp
+
+if [ ! -f ./navit.c ] ; then
+ echo "Please execute this script from navit's source folder."
+ exit 1;
+fi
+
+TMPFILE=$TMPDIR/navit-cleanattr.tmp
+TMPFILE2=$TMPDIR/navit-cleanattr.tmp2
+
+if [ -f $TMPFILE ] ; then
+ echo "Temporary file $TMPFILE already exists."
+ echo "Please don't run this tool twice at the same time. If you are shure that no other instance of this tool is running, remove the file."
+ exit 1;
+fi
+
+touch $TMPFILE
+if [ $? -ne 0 ] ; then
+ echo "Could not write to temporary file $TEMPFILE."
+ echo "Please make shure you have write access to the temporary directory."
+ exit 1;
+fi
+
+
+ATTRLIST=`grep 'ATTR(.*)' $ATTRFILE | sed 's#^ATTR(##' | sed 's#).*##'`
+
+cp $ATTRFILE $TMPFILE
+
+for ATTRNAME in $ATTRLIST ; do
+ ATTR="attr_$ATTRNAME"
+
+ grep -rI $ATTR ./* > /dev/null
+
+ if [ $? -ne 0 ] ; then
+ echo "Unused attribute: $ATTR"
+ grep -v "ATTR($ATTRNAME)" $TMPFILE > $TMPFILE2
+ mv $TMPFILE2 $TMPFILE
+ fi
+done
+
+echo "==== Creating patch ===="
+diff -U 3 $ATTRFILE $TMPFILE
+
+rm $TMPFILE
diff --git a/navit/tools/gpx2navit_txt/AUTHORS b/tools/gpx2navit_txt/AUTHORS
index 06a46c26..06a46c26 100644
--- a/navit/tools/gpx2navit_txt/AUTHORS
+++ b/tools/gpx2navit_txt/AUTHORS
diff --git a/navit/tools/gpx2navit_txt/COPYING b/tools/gpx2navit_txt/COPYING
index 514d6c73..514d6c73 100644
--- a/navit/tools/gpx2navit_txt/COPYING
+++ b/tools/gpx2navit_txt/COPYING
diff --git a/navit/tools/gpx2navit_txt/ChangeLog b/tools/gpx2navit_txt/ChangeLog
index 431aa18b..431aa18b 100644
--- a/navit/tools/gpx2navit_txt/ChangeLog
+++ b/tools/gpx2navit_txt/ChangeLog
diff --git a/navit/tools/gpx2navit_txt/INSTALL b/tools/gpx2navit_txt/INSTALL
index b5dbb9e3..b5dbb9e3 100644
--- a/navit/tools/gpx2navit_txt/INSTALL
+++ b/tools/gpx2navit_txt/INSTALL
diff --git a/navit/tools/gpx2navit_txt/Makefile.am b/tools/gpx2navit_txt/Makefile.am
index 05f1ce1a..05f1ce1a 100644
--- a/navit/tools/gpx2navit_txt/Makefile.am
+++ b/tools/gpx2navit_txt/Makefile.am
diff --git a/navit/tools/gpx2navit_txt/NEWS b/tools/gpx2navit_txt/NEWS
index 7bd16732..7bd16732 100644
--- a/navit/tools/gpx2navit_txt/NEWS
+++ b/tools/gpx2navit_txt/NEWS
diff --git a/tools/gpx2navit_txt/README b/tools/gpx2navit_txt/README
new file mode 100644
index 00000000..ecb3f995
--- /dev/null
+++ b/tools/gpx2navit_txt/README
@@ -0,0 +1,122 @@
+==============
+gpx2navit_txt README
+==============
+bodenseepingu
+4/01/2008
+
+What's This
+===========
+ gpx2navit_txt is a converter from GPX file to Navit Text map format
+
+For gpx2navit_txt was the original code from gpx2shp used and modified.
+This is a output of Metro Manila Transit Map Project by JOCV (Japan
+Overseas Cooperation Volunteers) program of JICA (Japan International
+Cooperation Agency in 2004. It is provided you on GPL2.
+
+Compilation/Installation
+========================
+run ./autogen.sh && ./configure && make
+run make install if you want the binary to be installed in your system.
+run make uninstall to wipe everything related.
+
+How to Use
+==========
+- Basic
+ There are three types of data on GPX that are waypoint, trkpoint and
+route. gpx2navit_txt converts the data to navit file(s)
+Please try to convert a sample file "pinatest2.gpx" in this archive.
+
+ prompt> gpx2navit_txt pinatest2.gpx
+ prompt> ls
+ pinatest2.gpx (source gpx)
+ pinatest2_meta.txt (meta data may be there)
+
+ You can convert only a certain type of data like only waypoint or
+track point using option '-w' (waypoint), '-t' (trackpoint) or '-r'
+(route).
+
+ prompt> gpx2navit_txt -r pinatest2.gpx
+
+- Convert path data to points and etc
+ As default, track point and route data is converted as a arc data but
+you can convert it other ways using option '-p'(convert as point) and
+'-e' (as edge). The edge file has '_edg' in the filename and the point
+file has '_pnt' in the filename.
+
+ prompt> gpx2navit_txt -p -e pinatest2.gpx
+
+- Statistics
+ If you add '-s' option you can see a conversion summery.
+
+ prompt> gpx2navit_txt -s pinatest2.gpx
+ Track Points:
+ track count: 4
+ point count: 658
+ total length: 156565.627989
+ unconverted: 0( 0.00%)
+ Routes:
+ route count: 1
+ point count: 323
+ total length: 9258.618971
+ unconverted: 0( 0.00%)
+ Waypoints:
+ point count: 118
+
+- Noise reduction
+ gpx2navit_txt has several thresholds to reduct the noise path data. The
+value can set as '--min-points', '--min-length' and '--min-time'. Please
+try a example below.
+
+ prompt> gpx2navit_txt --min-points 6 -s pinatest2.gpx
+ gpx2navit_txt:../pinatest3.gpx:3962 track was not converted because of
+ less then 6 points. (<- this path is not converted because the path
+ has only 5 points)
+ Track Points:
+ track count: 3
+ point count: 653
+ total length: 156439.490642
+ unconverted: 1(25.00%)
+ Routes:
+ route count: 1
+ point count: 323
+ total length: 9258.618971
+ unconverted: 0( 0.00%)
+ Waypoints:
+ point count: 118
+
+
+- Length and time units
+ You can choose any length related units that are supported by proj4
+for attribute table using
+ '--length-unit' (for length column, default: m),
+ '--time-unit' (for time column, default: sec),
+ '--speed-length-unit' (for speed column, default: km),
+ '--speed-time-unit' (for speed column, default: hour) and
+ '--length-ellipsoid' (for length calculation, default: UGS84).
+ You can see the supported units by 'geod -lu' and 'geod -le' command.
+ Supported time unit are 'sec', 'min', 'hour' and 'day'.
+
+- Other futures
+ There are other futures in gpx2navit_txt. Please check the option list using
+
+ gpx2navit_txt --help
+
+Problem or Suggestion
+=====================
+Please let me know about your opinion in English by e-mail.
+ bodenseepingu at users.sourceforge.net
+ navit on sourceforge.net
+ http://gpx2shp.sourceforge.jp/ for original gpx2shp
+ todo for gpx2navit_txt
+
+Acknowledgments
+===============
+NEDA (National Economic and Development Authority) Region IV-B office
+ My generous counter part
+Yoshio Tanaka
+ My project leader gpx2shp
+Petter Reinholdtsen
+ Many support to develop this
+Frank Warmerdam and the team
+ shapelib and proj4
+bodenseepingu for modifications towards navit
diff --git a/navit/tools/gpx2navit_txt/TODO b/tools/gpx2navit_txt/TODO
index de50135f..de50135f 100644
--- a/navit/tools/gpx2navit_txt/TODO
+++ b/tools/gpx2navit_txt/TODO
diff --git a/autogen.sh b/tools/gpx2navit_txt/autogen.sh
index ba84850a..ba84850a 100755
--- a/autogen.sh
+++ b/tools/gpx2navit_txt/autogen.sh
diff --git a/navit/tools/gpx2navit_txt/config.guess b/tools/gpx2navit_txt/config.guess
index 82294713..82294713 100644
--- a/navit/tools/gpx2navit_txt/config.guess
+++ b/tools/gpx2navit_txt/config.guess
diff --git a/navit/tools/gpx2navit_txt/config.sub b/tools/gpx2navit_txt/config.sub
index 0f84ac2c..0f84ac2c 100644
--- a/navit/tools/gpx2navit_txt/config.sub
+++ b/tools/gpx2navit_txt/config.sub
diff --git a/navit/tools/gpx2navit_txt/configure.ac b/tools/gpx2navit_txt/configure.ac
index c3475322..c3475322 100644
--- a/navit/tools/gpx2navit_txt/configure.ac
+++ b/tools/gpx2navit_txt/configure.ac
diff --git a/navit/tools/gpx2navit_txt/depcomp b/tools/gpx2navit_txt/depcomp
index 807b991f..807b991f 100755
--- a/navit/tools/gpx2navit_txt/depcomp
+++ b/tools/gpx2navit_txt/depcomp
diff --git a/navit/tools/gpx2navit_txt/develop/structures.gif b/tools/gpx2navit_txt/develop/structures.gif
index ba0c18ab..ba0c18ab 100644
--- a/navit/tools/gpx2navit_txt/develop/structures.gif
+++ b/tools/gpx2navit_txt/develop/structures.gif
Binary files differ
diff --git a/navit/tools/gpx2navit_txt/install-sh b/tools/gpx2navit_txt/install-sh
index 11870f1b..11870f1b 100755
--- a/navit/tools/gpx2navit_txt/install-sh
+++ b/tools/gpx2navit_txt/install-sh
diff --git a/navit/tools/gpx2navit_txt/man/Makefile.am b/tools/gpx2navit_txt/man/Makefile.am
index 71f0f055..71f0f055 100644
--- a/navit/tools/gpx2navit_txt/man/Makefile.am
+++ b/tools/gpx2navit_txt/man/Makefile.am
diff --git a/navit/tools/gpx2navit_txt/man/gpx2navit_txt.1 b/tools/gpx2navit_txt/man/gpx2navit_txt.1
index 26edd281..26edd281 100644
--- a/navit/tools/gpx2navit_txt/man/gpx2navit_txt.1
+++ b/tools/gpx2navit_txt/man/gpx2navit_txt.1
diff --git a/navit/tools/gpx2navit_txt/missing b/tools/gpx2navit_txt/missing
index 6a37006e..6a37006e 100755
--- a/navit/tools/gpx2navit_txt/missing
+++ b/tools/gpx2navit_txt/missing
diff --git a/navit/tools/gpx2navit_txt/mkinstalldirs b/tools/gpx2navit_txt/mkinstalldirs
index 8ab885ec..8ab885ec 100755
--- a/navit/tools/gpx2navit_txt/mkinstalldirs
+++ b/tools/gpx2navit_txt/mkinstalldirs
diff --git a/navit/tools/gpx2navit_txt/pinatest2.gpx b/tools/gpx2navit_txt/pinatest2.gpx
index 3d99f406..3d99f406 100644
--- a/navit/tools/gpx2navit_txt/pinatest2.gpx
+++ b/tools/gpx2navit_txt/pinatest2.gpx
diff --git a/navit/tools/gpx2navit_txt/src/Makefile.am b/tools/gpx2navit_txt/src/Makefile.am
index 5cce6fa3..5cce6fa3 100644
--- a/navit/tools/gpx2navit_txt/src/Makefile.am
+++ b/tools/gpx2navit_txt/src/Makefile.am
diff --git a/navit/tools/gpx2navit_txt/src/config.h.in b/tools/gpx2navit_txt/src/config.h.in
index 724d6f65..724d6f65 100644
--- a/navit/tools/gpx2navit_txt/src/config.h.in
+++ b/tools/gpx2navit_txt/src/config.h.in
diff --git a/tools/gpx2navit_txt/src/elementControl.c b/tools/gpx2navit_txt/src/elementControl.c
new file mode 100644
index 00000000..924e1080
--- /dev/null
+++ b/tools/gpx2navit_txt/src/elementControl.c
@@ -0,0 +1,245 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "gpx2navit_txt.h"
+
+void startElementControl(parsedata * pdata, const char *element,
+ const char **attr);
+void endElementControl(parsedata * pdata, const char *element);
+
+/*
+ * This method controls tag start event.
+ * It corrects attributes.
+ */
+void
+startElementControl(parsedata * pdata, const char *element,
+ const char **attr)
+{
+ int i;
+ static int isFirstTrk = 1;
+ static int isFirstRte = 1;
+ static int isFirstPathpt = 1;
+ for (i = 0; attr[i]; i += 2) {
+ if (!strcmp(attr[i], "lon")) {
+ pdata->attr->lon = atof(attr[i + 1]);
+ }
+ if (!strcmp(attr[i], "lat")) {
+ pdata->attr->lat = atof(attr[i + 1]);
+ }
+ if (!strcmp(attr[i], "minlon")) {
+ pdata->attr->minlon = atof(attr[i + 1]);
+ }
+ if (!strcmp(attr[i], "minlat")) {
+ pdata->attr->minlat = atof(attr[i + 1]);
+ }
+ if (!strcmp(attr[i], "maxlon")) {
+ pdata->attr->maxlon = atof(attr[i + 1]);
+ }
+ if (!strcmp(attr[i], "maxlat")) {
+ pdata->attr->maxlat = atof(attr[i + 1]);
+ }
+ if (!strcmp(attr[i], "author")) {
+ strcpy(pdata->attr->author, attr[i + 1]);
+ }
+ }
+ if (pdata->prop->parseTrk) {
+ if (!strcmp(element, "trk")) {
+ if (isFirstTrk) {
+ isFirstTrk = 0;
+ }
+ }
+ if (!strcmp(element, "trkseg")) {
+ isFirstPathpt = 1;
+ }
+ if (!strcmp(element, "trkpt")) {
+ if (isFirstPathpt) {
+ initPathAttr(pdata->pattr, pdata->attr);
+ isFirstPathpt = 0;
+ }
+ }
+ }
+ if (pdata->prop->parseRte) {
+ if (!strcmp(element, "rte")) {
+ if (isFirstRte) {
+ isFirstRte = 0;
+ isFirstPathpt = 1;
+ }
+ }
+ if (!strcmp(element, "rtept")) {
+ if (isFirstPathpt) {
+ initPathAttr(pdata->pattr, pdata->attr);
+ isFirstPathpt = 0;
+ }
+ }
+ }
+}
+
+/**
+ * This method is kicked by tag end event.
+ * It corrects char elements when the element tag has some data,
+ * then start to convert when tag is top level tag like <wpt>.
+ */
+void endElementControl(parsedata * pdata, const char *element)
+{
+ static int isFirstWpt = 1;
+ static int isFirstTrkAsPoint = 1;
+ static int isFirstRteAsPoint = 1;
+ /* common elements */
+ if (!strcmp(element, "name")) {
+ strcpy(pdata->attr->name, pdata->databuf);
+ }
+ if (!strcmp(element, "cmt")) {
+ strcpy(pdata->attr->cmt, pdata->databuf);
+ }
+ if (!strcmp(element, "desc")) {
+ strcpy(pdata->attr->desc, pdata->databuf);
+ }
+ if (!strcmp(element, "src")) {
+ strcpy(pdata->attr->src, pdata->databuf);
+ }
+ if (!strcmp(element, "link")) {
+ strcpy(pdata->attr->link, pdata->databuf);
+ }
+ if (!strcmp(element, "type")) {
+ strcpy(pdata->attr->type, pdata->databuf);
+ }
+ /* waypoint and metadata elements */
+ if (!strcmp(element, "time")) {
+ strcpy(pdata->attr->time, pdata->databuf);
+ }
+ /* route and track point elements */
+ if (!strcmp(element, "number")) {
+ pdata->attr->number = atoi(pdata->databuf);
+ }
+ /* waypoint elements */
+ if (!strcmp(element, "ele")) {
+ pdata->attr->ele = atof(pdata->databuf);
+ }
+ if (!strcmp(element, "magvar")) {
+ pdata->attr->magvar = atof(pdata->databuf);
+ }
+ if (!strcmp(element, "geoidheight")) {
+ pdata->attr->geoidheight = atof(pdata->databuf);
+ }
+ if (!strcmp(element, "sym")) {
+ strcpy(pdata->attr->sym, pdata->databuf);
+ }
+ if (!strcmp(element, "fix")) {
+ strcpy(pdata->attr->fix, pdata->databuf);
+ }
+ if (!strcmp(element, "sat")) {
+ pdata->attr->sat = atoi(pdata->databuf);
+ }
+ if (!strcmp(element, "hdop")) {
+ pdata->attr->hdop = atof(pdata->databuf);
+ }
+ if (!strcmp(element, "vdop")) {
+ pdata->attr->vdop = atof(pdata->databuf);
+ }
+ if (!strcmp(element, "pdop")) {
+ pdata->attr->pdop = atof(pdata->databuf);
+ }
+ if (!strcmp(element, "ageofdgpsdata")) {
+ pdata->attr->ageofdgpsdata = atof(pdata->databuf);
+ }
+ /* metadata elements */
+ if (!strcmp(element, "author")) {
+ strcpy(pdata->attr->author, pdata->databuf);
+ }
+ if (!strcmp(element, "keywords")) {
+ strcpy(pdata->attr->keywords, pdata->databuf);
+ }
+ if (!strcmp(element, "copyright")) {
+ strcpy(pdata->attr->copyright, pdata->databuf);
+ }
+ if (!strcmp(element, "year")) {
+ pdata->attr->year = atoi(pdata->databuf);
+ }
+ if (!strcmp(element, "license")) {
+ strcpy(pdata->attr->license, pdata->databuf);
+ }
+ if (!strcmp(element, "bounds")) {
+ /* none */
+ }
+ /* top elements */
+ /* set waypoint data */
+ if (!strcmp(element, "wpt")) {
+ if (pdata->prop->parseWpt) {
+ if (isFirstWpt) {
+ isFirstWpt = 0;
+ }
+ //todo
+ if (DEBUG) {
+ fprintf(stderr,"\neectrl wpt %s %s",
+ pdata->attr->desc,pdata->attr->name);
+ }
+ setWpt(pdata);
+ wipeAttr(pdata->attr);
+ }
+ }
+ /* set trackpoint data */
+ if (!strcmp(element, "trkpt")) {
+ if (pdata->prop->parseTrk) {
+ setPathData(pdata->pattr, pdata->attr);
+ if (!pdata->prop->isFast)
+ setPathInterval(pdata);
+ }
+ /* set trackpoint data as point */
+ if (pdata->prop->isPoint) {
+ if (isFirstTrkAsPoint) {
+ isFirstTrkAsPoint = 0;
+ }
+ setWpt(pdata);
+ }
+ wipeAttr(pdata->attr);
+ }
+ /* write trackpoint */
+ if (!strcmp(element, "trkseg")) {
+ if (pdata->prop->parseTrk) {
+ setPath( pdata);
+ }
+ }
+ /* set route data */
+ if (!strcmp(element, "rtept")) {
+ if (pdata->prop->parseRte) {
+ setPathData(pdata->pattr, pdata->attr);
+ if (!pdata->prop->isFast)
+ setPathInterval(pdata);
+ }
+ /* set route data as point */
+ if (pdata->prop->isPoint) {
+ if (isFirstRteAsPoint) {
+ isFirstRteAsPoint = 0;
+ }
+ setWpt( pdata);
+ }
+ wipeAttr(pdata->attr);
+ }
+ /* write route */
+ if (!strcmp(element, "rte")) {
+ if (pdata->prop->parseRte) {
+ setPath( pdata);
+ }
+ }
+ if (!strcmp(element, "metadata")) {
+ setMetadata(pdata);
+ wipeAttr(pdata->attr);
+ }
+ pdata->bufptr = NULL; //reset bufptr now
+}
diff --git a/tools/gpx2navit_txt/src/emess.h b/tools/gpx2navit_txt/src/emess.h
new file mode 100644
index 00000000..7c0375bd
--- /dev/null
+++ b/tools/gpx2navit_txt/src/emess.h
@@ -0,0 +1,51 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/* Error message processing header file */
+#ifndef EMESS_H
+#define EMESS_H
+
+#ifndef lint
+/*static char EMESS_H_ID[] = "@(#)emess.h 4.1 93/03/08 GIE REL";*/
+#endif
+
+struct EMESS {
+ char *File_name, /* input file name */
+ *Prog_name; /* name of program */
+ int File_line; /* approximate line read
+ where error occured */
+};
+
+#ifdef EMESS_ROUTINE /* use type */
+/* for emess procedure */
+struct EMESS emess_dat = { (char *)0, (char *)0, 0 };
+
+#ifdef sun /* Archaic SunOs 4.1.1, etc. */
+extern char *sys_errlist[];
+#define strerror(n) (sys_errlist[n])
+#endif
+
+#else /* for for calling procedures */
+
+extern struct EMESS emess_dat;
+void emess(int, char *, ...);
+
+#endif /* use type */
+
+#endif /* end EMESS_H */
diff --git a/tools/gpx2navit_txt/src/errorcode.h b/tools/gpx2navit_txt/src/errorcode.h
new file mode 100644
index 00000000..f12d6cff
--- /dev/null
+++ b/tools/gpx2navit_txt/src/errorcode.h
@@ -0,0 +1,41 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef ERRORCODE_H
+#define ERRORCODE_H
+
+/* os level */
+#define ERR_OUTOFMEMORY 11
+#define ERR_CANNOTOPEN 12
+#define ERR_CREATEFILE 13
+#define ERR_READERROR 14
+#define ERR_FREEFAILED 15
+/* option */
+#define ERR_NOARGS 21
+#define ERR_WRONGOPTION 22
+#define ERR_OPTIONCONFRICT 23
+/* parser */
+#define ERR_ISNOTGPX 31
+#define ERR_PARSEERROR 32
+/* unit */
+#define ERR_ELLPSUNIT 41
+#define ERR_LENGTHUNIT 42
+#define ERR_TIMEUNIT 43
+
+#endif /* ERRORCODE_H */
diff --git a/tools/gpx2navit_txt/src/geod_for.c b/tools/gpx2navit_txt/src/geod_for.c
new file mode 100644
index 00000000..ebff3bcb
--- /dev/null
+++ b/tools/gpx2navit_txt/src/geod_for.c
@@ -0,0 +1,127 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef lint
+static const char SCCSID[] =
+ "@(#)geod_for.c 4.6 95/09/23 GIE REL";
+#endif
+# include "projects.h"
+# include "geodesic.h"
+# define MERI_TOL 1e-9
+static double th1, costh1, sinth1, sina12, cosa12, M, N, c1, c2, D, P, s1;
+static int merid, signS;
+void geod_pre(void)
+{
+ al12 = adjlon(al12); /* reduce to +- 0-PI */
+ signS = fabs(al12) > HALFPI ? 1 : 0;
+ th1 = ellipse ? atan(onef * tan(phi1)) : phi1;
+ costh1 = cos(th1);
+ sinth1 = sin(th1);
+ if ((merid = fabs(sina12 = sin(al12)) < MERI_TOL)) {
+ sina12 = 0.;
+ cosa12 = fabs(al12) < HALFPI ? 1. : -1.;
+ M = 0.;
+ } else {
+ cosa12 = cos(al12);
+ M = costh1 * sina12;
+ }
+ N = costh1 * cosa12;
+ if (ellipse) {
+ if (merid) {
+ c1 = 0.;
+ c2 = f4;
+ D = 1. - c2;
+ D *= D;
+ P = c2 / D;
+ } else {
+ c1 = geod_f * M;
+ c2 = f4 * (1. - M * M);
+ D = (1. - c2) * (1. - c2 - c1 * M);
+ P = (1. + .5 * c1 * M) * c2 / D;
+ }
+ }
+ if (merid)
+ s1 = HALFPI - th1;
+ else {
+ s1 = (fabs(M) >= 1.) ? 0. : acos(M);
+ s1 = sinth1 / sin(s1);
+ s1 = (fabs(s1) >= 1.) ? 0. : acos(s1);
+ }
+}
+void geod_for(void)
+{
+ double d, sind, u, V, X, ds, cosds, sinds, ss = 0, de;
+
+ if (ellipse) {
+ d = geod_S / (D * geod_a);
+ if (signS)
+ d = -d;
+ u = 2. * (s1 - d);
+ V = cos(u + d);
+ X = c2 * c2 * (sind = sin(d)) * cos(d) * (2. * V * V - 1.);
+ ds = d + X - 2. * P * V * (1. - 2. * P * cos(u)) * sind;
+ ss = s1 + s1 - ds;
+ } else {
+ ds = geod_S / geod_a;
+ if (signS)
+ ds = -ds;
+ }
+ cosds = cos(ds);
+ sinds = sin(ds);
+ if (signS)
+ sinds = -sinds;
+ al21 = N * cosds - sinth1 * sinds;
+ if (merid) {
+ phi2 = atan(tan(HALFPI + s1 - ds) / onef);
+ if (al21 > 0.) {
+ al21 = PI;
+ if (signS)
+ de = PI;
+ else {
+ phi2 = -phi2;
+ de = 0.;
+ }
+ } else {
+ al21 = 0.;
+ if (signS) {
+ phi2 = -phi2;
+ de = 0;
+ } else
+ de = PI;
+ }
+ } else {
+ al21 = atan(M / al21);
+ if (al21 > 0)
+ al21 += PI;
+ if (al12 < 0.)
+ al21 -= PI;
+ al21 = adjlon(al21);
+ phi2 = atan(-(sinth1 * cosds + N * sinds) * sin(al21) /
+ (ellipse ? onef * M : M));
+ de = atan2(sinds * sina12,
+ (costh1 * cosds - sinth1 * sinds * cosa12));
+ if (ellipse) {
+ if (signS)
+ de += c1 * ((1. - c2) * ds + c2 * sinds * cos(ss));
+ else
+ de -= c1 * ((1. - c2) * ds - c2 * sinds * cos(ss));
+ }
+ }
+ lam2 = adjlon(lam1 + de);
+}
diff --git a/tools/gpx2navit_txt/src/geod_inv.c b/tools/gpx2navit_txt/src/geod_inv.c
new file mode 100644
index 00000000..a5412825
--- /dev/null
+++ b/tools/gpx2navit_txt/src/geod_inv.c
@@ -0,0 +1,92 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef lint
+static const char SCCSID[] =
+ "@(#)geod_inv.c 4.5 95/09/23 GIE REL";
+#endif
+# include "projects.h"
+# include "geodesic.h"
+# define DTOL 1e-12
+void geod_inv(void)
+{
+ double th1,
+ th2,
+ thm,
+ dthm,
+ dlamm,
+ dlam,
+ sindlamm,
+ costhm,
+ sinthm,
+ cosdthm,
+ sindthm, L, E, cosd, d, X, Y, T, sind, tandlammp, u, v, D, A, B;
+
+ if (ellipse) {
+ th1 = atan(onef * tan(phi1));
+ th2 = atan(onef * tan(phi2));
+ } else {
+ th1 = phi1;
+ th2 = phi2;
+ }
+ thm = .5 * (th1 + th2);
+ dthm = .5 * (th2 - th1);
+ dlamm = .5 * (dlam = adjlon(lam2 - lam1));
+ if (fabs(dlam) < DTOL && fabs(dthm) < DTOL) {
+ al12 = al21 = geod_S = 0.;
+ return;
+ }
+ sindlamm = sin(dlamm);
+ costhm = cos(thm);
+ sinthm = sin(thm);
+ cosdthm = cos(dthm);
+ sindthm = sin(dthm);
+ L = sindthm * sindthm + (cosdthm * cosdthm - sinthm * sinthm)
+ * sindlamm * sindlamm;
+ d = acos(cosd = 1 - L - L);
+ if (ellipse) {
+ E = cosd + cosd;
+ sind = sin(d);
+ Y = sinthm * cosdthm;
+ Y *= (Y + Y) / (1. - L);
+ T = sindthm * costhm;
+ T *= (T + T) / L;
+ X = Y + T;
+ Y -= T;
+ T = d / sind;
+ D = 4. * T * T;
+ A = D * E;
+ B = D + D;
+ geod_S = geod_a * sind * (T - f4 * (T * X - Y) +
+ f64 * (X * (A + (T - .5 * (A - E)) * X) -
+ Y * (B + E * Y) + D * X * Y));
+ tandlammp = tan(.5 * (dlam - .25 * (Y + Y - E * (4. - X)) *
+ (f2 * T + f64 * (32. * T - (20. * T - A)
+ * X - (B +
+ 4.) * Y)) *
+ tan(dlam)));
+ } else {
+ geod_S = geod_a * d;
+ tandlammp = tan(dlamm);
+ }
+ u = atan2(sindthm, (tandlammp * costhm));
+ v = atan2(cosdthm, (tandlammp * sinthm));
+ al12 = adjlon(TWOPI + v - u);
+ al21 = adjlon(TWOPI - v - u);
+}
diff --git a/tools/gpx2navit_txt/src/geod_set.c b/tools/gpx2navit_txt/src/geod_set.c
new file mode 100644
index 00000000..4dc4b1d7
--- /dev/null
+++ b/tools/gpx2navit_txt/src/geod_set.c
@@ -0,0 +1,114 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef lint
+/*
+ * static const char SCCSID[]="@(#)geod_set.c 4.8 95/09/23 GIE REL";
+ */
+#endif
+
+#define _IN_GEOD_SET
+
+#include <string.h>
+#include "projects.h"
+#include "geodesic.h"
+#include "emess.h"
+void geod_set(int argc, char **argv)
+{
+ paralist *start = 0, *curr = NULL; /* added NULL */
+ double es;
+ char *name;
+ int i;
+
+/*
+ * put arguments into internal linked list
+ */
+ if (argc <= 0)
+ emess(1, "no arguments in initialization list");
+ for (i = 0; i < argc; ++i)
+ if (i)
+ curr = curr->next = pj_mkparam(argv[i]);
+ else
+ start = curr = pj_mkparam(argv[i]);
+/*
+ * set elliptical parameters
+ */
+ if (pj_ell_set(start, &geod_a, &es))
+ emess(1, "ellipse setup failure");
+/*
+ * set units
+ */
+ if ((name = pj_param(start, "sunits").s)) { /* added parentheses */
+ char *s;
+
+ for (i = 0; (s = pj_units[i].id) && strcmp(name, s); ++i);
+ if (!s)
+ emess(1, "%s unknown unit conversion id", name);
+ fr_meter = 1. / (to_meter = atof(pj_units[i].to_meter));
+ } else
+ to_meter = fr_meter = 1.;
+ if ((ellipse = es != 0.)) { /* added parentheses */
+ onef = sqrt(1. - es);
+ geod_f = 1 - onef;
+ f2 = geod_f / 2;
+ f4 = geod_f / 4;
+ f64 = geod_f * geod_f / 64;
+ } else {
+ onef = 1.;
+ geod_f = f2 = f4 = f64 = 0.;
+ }
+/*
+ * check if line or arc mode
+ */
+ if (pj_param(start, "tlat_1").i) {
+ double del_S;
+#undef f
+ phi1 = pj_param(start, "rlat_1").f;
+ lam1 = pj_param(start, "rlon_1").f;
+ if (pj_param(start, "tlat_2").i) {
+ phi2 = pj_param(start, "rlat_2").f;
+ lam2 = pj_param(start, "rlon_2").f;
+ geod_inv();
+ geod_pre();
+ } else if ((geod_S = pj_param(start, "dS").f)) { /* added
+ * parentheses
+ */
+ al12 = pj_param(start, "rA").f;
+ geod_pre();
+ geod_for();
+ } else
+ emess(1, "incomplete geodesic/arc info");
+ if ((n_alpha = pj_param(start, "in_A").i) > 0) {
+ if (!(del_alpha = pj_param(start, "rdel_A").f))
+ emess(1, "del azimuth == 0");
+ } else if ((del_S = fabs(pj_param(start, "ddel_S").f))) { /* added
+ * parentheses
+ */
+ n_S = geod_S / del_S + .5;
+ } else if ((n_S = pj_param(start, "in_S").i) <= 0)
+ emess(1, "no interval divisor selected");
+ }
+/*
+ * free up linked list
+ */
+ for (; start; start = curr) {
+ curr = start->next;
+ pj_dalloc(start);
+ }
+}
diff --git a/tools/gpx2navit_txt/src/geodesic.h b/tools/gpx2navit_txt/src/geodesic.h
new file mode 100644
index 00000000..5f818c37
--- /dev/null
+++ b/tools/gpx2navit_txt/src/geodesic.h
@@ -0,0 +1,70 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef lint
+/*static char GEODESIC_H_ID[] = "@(#)geodesic.h 4.3 95/08/19 GIE REL"; */
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _IN_GEOD_SET
+# define GEOD_EXTERN extern
+#else
+# define GEOD_EXTERN
+#endif
+
+GEOD_EXTERN struct geodesic {
+ double A;
+ double LAM1, PHI1, ALPHA12;
+ double LAM2, PHI2, ALPHA21;
+ double DIST;
+ double ONEF, FLAT, FLAT2, FLAT4, FLAT64;
+ int ELLIPSE;
+} GEODESIC;
+
+# define geod_a GEODESIC.A
+# define lam1 GEODESIC.LAM1
+# define phi1 GEODESIC.PHI1
+# define al12 GEODESIC.ALPHA12
+# define lam2 GEODESIC.LAM2
+# define phi2 GEODESIC.PHI2
+# define al21 GEODESIC.ALPHA21
+# define geod_S GEODESIC.DIST
+# define geod_f GEODESIC.FLAT
+# define onef GEODESIC.ONEF
+# define f2 GEODESIC.FLAT2
+# define f4 GEODESIC.FLAT4
+# define ff2 GEODESIC.FLAT4
+# define f64 GEODESIC.FLAT64
+# define ellipse GEODESIC.ELLIPSE
+
+
+GEOD_EXTERN int n_alpha, n_S;
+GEOD_EXTERN double to_meter, fr_meter, del_alpha;
+
+void geod_set(int, char **);
+void geod_for(void);
+void geod_pre(void);
+void geod_inv(void);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/tools/gpx2navit_txt/src/gpx2navit_txt.h b/tools/gpx2navit_txt/src/gpx2navit_txt.h
new file mode 100644
index 00000000..a19c436c
--- /dev/null
+++ b/tools/gpx2navit_txt/src/gpx2navit_txt.h
@@ -0,0 +1,292 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef GPX2SHP_H_INCLUDED
+#define GPX2SHP_H_INCLUDED
+
+#define PROG gpx2navit_txt
+#define FILENAMELENGTH 255 /* 255 is max length for dbf string column */
+#define COMMENTLENGTH 255 /* 255 is max length for dbf string column */
+#define NAMELENGTH 32
+#define TIMELENGTH 32
+#define TYPELENGTH 16
+#define BUFFSIZE 8192
+#define DATABUFSIZE 16
+#define failToWriteAttr(S, T) failToWriteAttrRep((S), (T),__FILE__, __LINE__ )
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <libgen.h>
+#include <getopt.h>
+#include <time.h>
+#include <assert.h>
+#include <expat.h>
+#include "errorcode.h"
+//#include "shapefil.h"
+
+
+#define DEBUG 0
+/**
+ * make xml parent and child list
+ */
+typedef struct parent {
+ char *name; /** element name */
+ struct parent *parentptr;
+ /** parent pointer */
+} parent;
+
+/**
+ * set attribute columns on/off
+ */
+typedef struct g2scolumns {
+/**
+ * each member corresponds to attribute column of attribute table
+ */
+ int name;
+ int cmt;
+ int desc;
+ int src;
+ int link;
+ int type;
+ int time;
+ int number;
+ int ele;
+ int magvar;
+ int geoidheight;
+ int sym;
+ int fix;
+ int sat;
+ int hdop;
+ int vdop;
+ int pdop;
+ int ageofdgpsdata;
+ int dgpsid;
+ int length;
+ int interval;
+ int speed;
+ int points;
+ int gpxline;
+} g2scolumns;
+
+/**
+ * store each path attribute values for trackpoint and route.
+ */
+typedef struct pathattr {
+ char name[NAMELENGTH];
+ char cmt[COMMENTLENGTH];
+ char desc[COMMENTLENGTH];
+ char src[COMMENTLENGTH];
+ char link[FILENAMELENGTH];
+ int number;
+ char type[TYPELENGTH];
+ double length;
+ double interval;
+ double speed;
+ /*
+ double *x;
+ double *y;
+ double *z;
+ */
+ double *point;
+ int count;
+} pathattr;
+
+/**
+ * store each point attribute values.
+ */
+typedef struct g2sattr {
+/**
+ * the structure cames from GPX1.1 format
+ */
+ double lon;
+ double lat;
+ double minlon;
+ double minlat;
+ double maxlon;
+ double maxlat;
+ char name[NAMELENGTH];
+ char cmt[COMMENTLENGTH];
+ char desc[COMMENTLENGTH];
+ char src[COMMENTLENGTH];
+ char link[FILENAMELENGTH];
+ char type[TYPELENGTH];
+ char time[TIMELENGTH];
+ int number;
+ double ele;
+ double magvar;
+ double geoidheight;
+ char sym[NAMELENGTH];
+ char fix[NAMELENGTH];
+ int sat;
+ double hdop;
+ double vdop;
+ double pdop;
+ double ageofdgpsdata;
+ int dgpsid;
+ char author[NAMELENGTH];
+ char keywords[NAMELENGTH];
+ char copyright[NAMELENGTH];
+ int year;
+ char license[NAMELENGTH];
+} g2sattr;
+
+/**
+ * statistics structure
+ */
+typedef struct g2sstats {
+ int trkpoints; /** track point total count */
+ int trkcount; /** track path total count */
+ double trklength; /** track total length */
+ int rtepoints; /** route point total count */
+ int rtecount; /** route path totol count */
+ double rtelength; /** route total length */
+ int wptpoints; /** way point total count */
+ int trkunconverted; /** unconverted track path count */
+ int rteunconverted; /** unconverted route path count */
+} g2sstats;
+
+/**
+ * cluster of all dbfhandles
+ */
+//typedef struct dbfhandles {
+// DBFHandle trk; /** for track */
+// DBFHandle wpt; /** for waypoint */
+// DBFHandle rte; /** for route */
+// DBFHandle trk_edg; /** for track each edge */
+// DBFHandle trk_pnt; /** for track each point */
+// DBFHandle rte_edg; /** for route each edge */
+// DBFHandle rte_pnt; /** for route each point */
+//} dbfhandles;
+
+/**
+ * cluster of all shphandles
+ */
+//typedef struct shphandles {
+// SHPHandle trk; /** for track */
+// SHPHandle wpt; /** for waypoint */
+// SHPHandle rte; /** for route */
+// SHPHandle trk_edg; /** for track each edge */
+// SHPHandle trk_pnt; /** for track each point */
+// SHPHandle rte_edg; /** for route each edge */
+// SHPHandle rte_pnt; /** for route each point */
+//} shphandles;
+
+/**
+ * propaties structure for gpx2navit_txt
+ */
+typedef struct g2sprop {
+ int parseWpt; /** convert waypoint data or not */
+ int parseTrk; /** convert track data or not */
+ int parseRte; /** convert route data or not */
+ int is3d; /** using 3D mode */
+ int isEdge; /** convert path data as each separated path */
+ int isPoint; /** convert path data as point */
+ int isFast; /** fast mode that skips path check */
+ int needsStats; /** shows statistics at last */
+ int minpoints; /** minimum points to convert as a path */
+ int minlength; /** minimum length to convert as a path */
+ int mintime; /** minimum time to convert as a path */
+ int verbose; /** verbose mode on/off */
+ char *sourcefile; /** source .gpx file */
+ char *output; /** output file base name */
+ char *ellipsoid; /** ellipsoid type to calculate length */
+ char *lengthUnit; /** length unit for attributes*/
+ double length2meter;/** meter value of lenght unit */
+ char *timeUnit; /** time unit for attributes */
+ double time2sec; /** value to convert time unit to second */
+ char *speedLengthUnit;
+ /** lenght unit to calculate speed*/
+ double speed2meter; /** meter value of speedLengthUnit */
+ char *speedTimeUnit;/** time unit to calculate speed */
+ int speed2sec; /** value to convert speedTimeUnit to seconde */
+ g2sstats *stats; /** convert statistics */
+ g2scolumns *cols; /** attribute table column switch */
+} g2sprop;
+
+/**
+ * userdata structure between expat methods
+ */
+typedef struct parsedata {
+ int depth; /** xml path depth */
+ char *databuf; /** character buffer in tags */
+ char *bufptr; /** pointer to databuf to add '\0' to databuf */
+ int failed; /** xml parse failed flag */
+ int failedid; /** xml parse failed id */
+ XML_Parser parser; /** xml parser itself*/
+ parent *parent; /** pointer to parent node */
+ parent *current; /** pointer to current node */
+ FILE *fp; /** File handle to write out data points*/
+// shphandles *shps; /** .shp file cluster that is used in this program */
+// dbfhandles *dbfs; /** .dbf file cluster that is used in this program */
+ g2sattr *attr; /** each point attributes */
+ pathattr *pattr; /** each path attributes */
+ g2sprop *prop; /** propaties for this program */
+} parsedata;
+
+/* utils.c */
+void checkEllpsUnit(char *unit);
+double checkLengthUnit(char *unit);
+int checkTimeUnit(char *unit);
+double getTimeInterval(char *_t, char *t);
+double getSpeed(double length, double ti, double to_meter, int to_sec);
+double getDistance(double _x, double _y, double x, double y);
+//void closeShpFiles(shphandles * shps);
+//void closeDbfFiles(dbfhandles * dbfs);
+void *myMallocRep(size_t size, const char *fileName, int line);
+
+/* misc.c */
+void failToWriteAttrRep(int iShape, int col, char *file, int line);
+void showStats(g2sprop * prop);
+void wipePathAttr(pathattr * pattr);
+pathattr *createPathAttr(void);
+void wipeAttr(g2sattr * attr);
+void setColsDefault(g2scolumns * cols);
+g2scolumns *createCols(void);
+g2sattr *createAttr(void);
+g2sprop *createProp(void);
+void closeProp(g2sprop * prop);
+//shphandles *createShps(void);
+//dbfhandles *createDbfs(void);
+parsedata *createParsedata(XML_Parser parser, g2sprop * prop);
+void closeParsedata(parsedata * pdata);
+
+/* parser.c */
+void parseMain(g2sprop * pr);
+
+/* elementControl.c */
+void startElementControl(parsedata * pdata, const char *element,
+ const char **attr);
+void endElementControl(parsedata * pdata, const char *element);
+
+/* setwpt.c */
+void setWpt( parsedata * pdata);
+
+/* setpath.c */
+void initPathAttr(pathattr * pattr, g2sattr * attr);
+void setPathInterval(parsedata *pdata);
+void setPathData(pathattr * parrt, g2sattr * attr);
+void setPath( parsedata * pdata);
+
+/* setmetadata.c */
+void setMetadata(parsedata * pdata);
+
+#endif
diff --git a/tools/gpx2navit_txt/src/main.c b/tools/gpx2navit_txt/src/main.c
new file mode 100644
index 00000000..834ce551
--- /dev/null
+++ b/tools/gpx2navit_txt/src/main.c
@@ -0,0 +1,408 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "gpx2navit_txt.h"
+#include "geodesic.h"
+
+void version(void);
+void usage(char **argv);
+void setDefault(g2sprop * prop);
+void setOptions(int argc, char **argv, g2sprop * prop);
+
+/**
+ * Shows a version
+ */
+void version(void)
+{
+ fprintf(stdout, "gpx2navit_txt 0.1\n");
+ fprintf(stdout, "\n");
+ fprintf(stdout, "by Toshihiro Hiraoka\n");
+ fprintf(stdout, " Petter Reinholdtsen\n");
+}
+
+/**
+ * Shows a usage message
+ */
+void usage(char **argv)
+{
+ fprintf(stdout, "Usage: %s gpxfile [options] [-o output basename]\n",
+ argv[0]);
+ fprintf(stdout,
+ "-o, --output Sets output basename. The default is (source file\n");
+ fprintf(stdout, " name) - (extention name)\n");
+ fprintf
+ (stdout,
+ "-w, --waypoints Converts only waypoints data from a gpx file.\n");
+ fprintf(stdout,
+ "-t, --trackpoints Converts only trackpoints data from a gpx file.\n");
+ fprintf(stdout,
+ "-r, --routes Converts only routes data from a gpx file.\n");
+ fprintf(stdout,
+ "-a, --all Converts all types of data from a gpx file.(default)\n");
+ fprintf(stdout,
+ "-e, --as-edge Makes a separated output by each edges.\n");
+ fprintf(stdout,
+ "-p, --as-point Makes a separated output by each points.\n");
+ fprintf(stdout,
+ "-s, --stats Shows simple statistics of the outputs.\n");
+ fprintf(stdout,
+ "-b, --basic-columns Stores only basic data as attribures to \n");
+ fprintf(stdout,
+ " reduce memory and storage usage.\n");
+ fprintf(stdout,
+ " (ele, name, cmt, type, time, fix, sym and number).\n");
+ fprintf(stdout,
+ "-L, --no-length Removes length column from a waypoint or trackpoint\n");
+ fprintf(stdout, " attribute table.\n");
+ fprintf
+ (stdout,
+ "-S, --no-speed Removes speed column from a waypoint or trackpoint\n");
+ fprintf(stdout, " attribute table.\n");
+ fprintf
+ (stdout,
+ "-T, --no-time Removes time column from an attribute table.\n");
+ fprintf(stdout,
+ "-g, --gpxline Adds line number of GPX file as attribures.\n");
+ fprintf
+ (stdout,
+ "-f, --fast Make it faster without any checks.\n");
+ fprintf(stdout,
+ "-3, --3d Converts data using 3d format. (It's not compatible\n");
+ fprintf(stdout, " for Arcview 3.x.)\n");
+ fprintf(stdout,
+ " --min-points Sets path minimum points to convert for noise reduction.\n");
+ fprintf(stdout, " Default is 2.\n");
+ fprintf(stdout,
+ " --min-length Sets path minimum length to convert for noise reduction.\n");
+ fprintf(stdout, " Default is 0.\n");
+ fprintf(stdout,
+ " --min-time Sets path minimum time period to convert for noise\n");
+ fprintf(stdout, " reduction.\n");
+ fprintf(stdout, " Default is 0.\n");
+ fprintf(stdout,
+ " --length-unit Sets length unit from m,km,feet,mi and etc.\n");
+ fprintf(stdout, " The default is m.\n");
+ fprintf(stdout,
+ " You can see the unit list from \"geod -lu\" command.\n");
+ fprintf
+ (stdout,
+ " --time-unit Sets time unit. The default is sec.\n");
+ fprintf(stdout,
+ " You can set from day, hour, min and sec.\n");
+ fprintf(stdout,
+ " --speed-length-unit Sets length unit for speed.\n");
+ fprintf(stdout, " The default is km.\n");
+ fprintf(stdout,
+ " You can see the unit list from \"geod -lu\" command.\n");
+ fprintf(stdout,
+ " --speed-time-unit Sets time unit for speed calulation. Default is hour.\n");
+ fprintf(stdout,
+ " You can set from day, hour, min and sec.\n");
+ fprintf(stdout,
+ " --length-ellipsoid Sets length ellipsoid like UGS84, clrk66. The default is\n");
+ fprintf(stdout, " UGS84.\n");
+ fprintf
+ (stdout,
+ " You can see the unit list from \"geod -le\" command.\n");
+ fprintf(stdout, "-v, --verbose Gives many messages.\n");
+ fprintf(stdout, " --version Shows version.\n");
+ fprintf(stdout, "-h, --help Shows this list.\n");
+}
+
+/**
+ * Sets default values to the properties when there is no user setting.
+ */
+void setDefault(g2sprop * prop)
+{
+ char *pargv[2];
+ int pargc = 2;
+ char *ellps;
+ /* if there are no options like -p,-w,-e, sets as -a */
+ if (!(prop->parseWpt | prop->parseTrk | prop->parseRte)) {
+ prop->parseWpt = 1;
+ prop->parseTrk = 1;
+ prop->parseRte = 1;
+ }
+ /* if there is no output setting, sets it as [sourcefile name] - ".gpx" */
+ if (prop->output == NULL) {
+ char *dot = strrchr(prop->sourcefile, '.');
+ prop->output =
+ (char *) malloc(sizeof(char) * strlen(prop->sourcefile) + 1);
+ if (0 == strcmp(dot, ".gpx")) {
+ int len = dot - prop->sourcefile;
+ strncpy(prop->output, prop->sourcefile, len);
+ prop->output[len] = 0;
+ } else {
+ fprintf(stderr,
+ "The source file doesn't have .gpx extension.\n");
+ exit(ERR_ISNOTGPX);
+ }
+ }
+ /* sets ellipsoid "WGS84" */
+ if (prop->ellipsoid == NULL) {
+ prop->ellipsoid = (char *) malloc(sizeof(char) * 7);
+ strcpy(prop->ellipsoid, "WGS84");
+ }
+ /* sets lengthUnit "m" */
+ if (prop->lengthUnit == NULL) {
+ prop->lengthUnit = (char *) malloc(sizeof(char) * 2);
+ strcpy(prop->lengthUnit, "m");
+ }
+ /* sets timeUnit "sec" */
+ if (prop->timeUnit == NULL) {
+ prop->timeUnit = (char *) malloc(sizeof(char) * 4);
+ strcpy(prop->timeUnit, "sec");
+ }
+ /* sets speedLengthUnit "km" */
+ if (prop->speedLengthUnit == NULL) {
+ prop->speedLengthUnit = (char *) malloc(sizeof(char) * 3);
+ strcpy(prop->speedLengthUnit, "km");
+ }
+ /* sets speedTimeUnit "hour" */
+ if (prop->speedTimeUnit == NULL) {
+ prop->speedTimeUnit = (char *) malloc(sizeof(char) * 5);
+ strcpy(prop->speedTimeUnit, "hour");
+ }
+ /* sets ellipsoid setting to geod* programs */
+ ellps = malloc(sizeof(char) * (strlen(prop->ellipsoid) + 8));
+ strcpy(ellps, "+ellps=");
+ strcat(ellps, prop->ellipsoid);
+ pargv[0] = ellps;
+ pargv[1] = prop->lengthUnit;
+ checkEllpsUnit(prop->ellipsoid);
+ prop->length2meter = checkLengthUnit(prop->lengthUnit);
+ prop->time2sec = checkTimeUnit(prop->timeUnit);
+ prop->speed2meter = checkLengthUnit(prop->speedLengthUnit);
+ prop->speed2sec = checkTimeUnit(prop->speedTimeUnit);
+ geod_set(pargc, pargv);
+ if (prop->verbose) {
+ printf("source filename:\t%s\n", prop->sourcefile);
+ printf("output file base name:\t%s\n", prop->output);
+ }
+ free(ellps);
+}
+
+/**
+ * Set options from command arguments
+ */
+void setOptions(int argc, char **argv, g2sprop * prop)
+{
+ int result;
+ /* option struct for getopt_long */
+ struct option const long_options[] = {
+ {"waypoints", no_argument, 0, 'w'},
+ {"trackpoints", no_argument, 0, 't'},
+ {"routes", no_argument, 0, 'r'},
+ {"output", required_argument, 0, 'o'},
+ {"as-edge", no_argument, 0, 'e'},
+ {"as-point", no_argument, 0, 'p'},
+ {"min-points", required_argument, 0, 'P'},
+ {"min-length", required_argument, 0, 'l'},
+ {"min-time", required_argument, 0, 'm'},
+ {"stats", no_argument, 0, 's'},
+ {"basic-columns", no_argument, 0, 'b'},
+ {"fast", no_argument, 0, 'f'},
+ {"length-unit", required_argument, 0, '4'},
+ {"time-unit", required_argument, 0, '8'},
+ {"length-ellipsoid", required_argument, 0, '7'},
+ {"speed-length-unit", required_argument, 0, '5'},
+ {"speed-time-unit", required_argument, 0, '6'},
+ {"no-speed", no_argument, 0, 'S'},
+ {"no-length", no_argument, 0, 'L'},
+ {"no-time", no_argument, 0, 'T'},
+ {"verbose", no_argument, 0, 'v'},
+ {"gpxline", no_argument, 0, 'g'},
+ {"all", no_argument, 0, 'a'},
+ {"version", no_argument, 0, 'V'},
+ {"help", no_argument, 0, '?'},
+ {0, no_argument, 0, '0'},
+ };
+ if (argc <= 1) {
+ fprintf(stderr, "There is no argument.\n");
+ usage(argv);
+ exit(ERR_NOARGS);
+ }
+ /* set option attributes */
+ while ((result =
+ getopt_long(argc, argv, "3wtrao:epfP:l:m:bS4:5:6:7:8:LTSsvg0",
+ long_options, NULL)) != -1) {
+ switch (result) {
+ case '3': /* 3d output */
+ prop->is3d = 1;
+ break;
+ case 'w': /* converts only waypoint */
+ prop->parseWpt = 1;
+ break;
+ case 't': /* converts only trackpoint */
+ prop->parseTrk = 1;
+ break;
+ case 'r': /* converts only route */
+ prop->parseRte = 1;
+ break;
+ case 'a': /* converts all */
+ prop->parseWpt = 1;
+ prop->parseTrk = 1;
+ prop->parseRte = 1;
+ break;
+ case 'o': /* sets basename of output file */
+ prop->output =
+ (char *) malloc(sizeof(char) * strlen(optarg) + 1);
+ strcpy(prop->output, optarg);
+ break;
+ case 'e': /* make output by each edges */
+ if (prop->isEdge) {
+ fprintf(stderr, "option -e cannot use with -f\n");
+ exit(ERR_OPTIONCONFRICT);
+ }
+ prop->isEdge = 1;
+ break;
+ case 'p': /* make output by each edges */
+ prop->isPoint = 1;
+ break;
+ case 'f': /* make it faster */
+ if (prop->isEdge) {
+ fprintf(stderr, "option -f cannot use with -e\n");
+ exit(ERR_OPTIONCONFRICT);
+ }
+ prop->isFast = 1;
+ prop->cols->desc = 0;
+ prop->cols->src = 0;
+ prop->cols->link = 0;
+ prop->cols->magvar = 0;
+ prop->cols->geoidheight = 0;
+ prop->cols->sat = 0;
+ prop->cols->hdop = 0;
+ prop->cols->vdop = 0;
+ prop->cols->pdop = 0;
+ prop->cols->ageofdgpsdata = 0;
+ prop->cols->dgpsid = 0;
+ prop->cols->length = 0;
+ prop->cols->interval = 0;
+ prop->cols->speed = 0;
+ break;
+ case 'P': /* sets minimun points as a path */
+ prop->minpoints = atoi(optarg);
+ break;
+ case 'l': /* sets minimun length as a path */
+ prop->minlength = atoi(optarg);
+ break;
+ case 'm': /* sets minimun time as a path */
+ prop->mintime = atoi(optarg);
+ break;
+ case 'b': /* use only some columns */
+ prop->cols->desc = 0;
+ prop->cols->src = 0;
+ prop->cols->link = 0;
+ prop->cols->magvar = 0;
+ prop->cols->geoidheight = 0;
+ prop->cols->sat = 0;
+ prop->cols->hdop = 0;
+ prop->cols->vdop = 0;
+ prop->cols->pdop = 0;
+ prop->cols->ageofdgpsdata = 0;
+ prop->cols->dgpsid = 0;
+ prop->cols->length = 0;
+ prop->cols->interval = 0;
+ prop->cols->speed = 0;
+ break;
+ case 'S': /* doesn't make speed column */
+ prop->cols->speed = 0;
+ break;
+ case '4': /* sets length unit */
+ prop->lengthUnit = malloc(sizeof(char) * (strlen(optarg) + 1));
+ strcpy(prop->lengthUnit, optarg);
+ break;
+ case '5': /* sets length unit for calculating speed */
+ prop->speedLengthUnit =
+ malloc(sizeof(char) * (strlen(optarg) + 1));
+ strcpy(prop->speedLengthUnit, optarg);
+ break;
+ case '6': /* sets time unit for calculating speed */
+ prop->speedTimeUnit =
+ malloc(sizeof(char) * (strlen(optarg) + 1));
+ strcpy(prop->speedTimeUnit, optarg);
+ break;
+ case '7': /* sets ellipsoid for calculating length */
+ prop->ellipsoid = malloc(sizeof(char) * (strlen(optarg) + 1));
+ strcpy(prop->ellipsoid, optarg);
+ break;
+ case '8': /* sets time unit */
+ prop->timeUnit = malloc(sizeof(char) * (strlen(optarg) + 1));
+ strcpy(prop->timeUnit, optarg);
+ break;
+ case 'L': /* doesn't make length column */
+ prop->cols->length = 0;
+ break;
+ case 'T': /* doesn't make time column */
+ prop->cols->interval = 0;
+ break;
+ case 's': /* shows source file stats */
+ prop->needsStats = 1;
+ break;
+ case 'v': /* verbose mode */
+ prop->verbose = 1;
+ break;
+ case 'V': /* shows version */
+ version();
+ exit(EXIT_SUCCESS);
+ break;
+ case 'g': /* adds gpx line number column */
+ prop->cols->gpxline = 1;
+ break;
+ case ':':
+ usage(argv);
+ exit(ERR_WRONGOPTION);
+ break;
+ case '0':
+ usage(argv);
+ exit(ERR_WRONGOPTION);
+ break;
+ default:
+ usage(argv);
+ exit(ERR_WRONGOPTION);
+ break;
+ }
+ }
+ /* gets a source file name */
+ if(argv[optind] == NULL) {
+ fprintf(stderr, "There is no gpxfile description.\n");
+ usage(argv);
+ exit(ERR_WRONGOPTION);
+ }
+ prop->sourcefile = malloc(sizeof(char) * (strlen(argv[optind]) + 1));
+ /** @note needs to change here to support
+ * a several files convertion */
+ strcpy(prop->sourcefile, argv[optind]);
+ setDefault(prop);
+}
+
+/**
+ * Main
+ */
+int main(int argc, char **argv)
+{
+ g2sprop *prop;
+ prop = createProp();
+ setOptions(argc, argv, prop);
+ parseMain(prop);
+ if (prop->needsStats)
+ showStats(prop);
+ closeProp(prop);
+ return (0);
+}
diff --git a/tools/gpx2navit_txt/src/misc.c b/tools/gpx2navit_txt/src/misc.c
new file mode 100644
index 00000000..fc272e8c
--- /dev/null
+++ b/tools/gpx2navit_txt/src/misc.c
@@ -0,0 +1,363 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "gpx2navit_txt.h"
+
+void failToWriteAttrRep(int iShape, int col, char *file, int line);
+void showStats(g2sprop * prop);
+void wipePathAttr(pathattr * pattr);
+pathattr *createPathAttr(void);
+void wipeAttr(g2sattr * attr);
+void setColsDefault(g2scolumns * cols);
+g2scolumns *createCols(void);
+g2sattr *createAttr(void);
+g2sprop *createProp(void);
+void closeProp(g2sprop * prop);
+//shphandles *createShps(void);
+//dbfhandles *createDbfs(void);
+parsedata *createParsedata(XML_Parser parser, g2sprop * prop);
+void closeParsedata(parsedata * pdata);
+
+/**
+ * message when fail to write attribute
+ */
+void failToWriteAttrRep(int iShape, int col, char *file, int line)
+{
+ printf("Fail to write a attribute at %s:%i. shapeid:%i col:%i\n", file,
+ line, iShape, col);
+}
+
+/**
+ * shows short statistics
+ */
+void showStats(g2sprop * prop)
+{
+ g2sstats *stats = prop->stats;
+ double ratio;
+ if (prop->needsStats) {
+ if (prop->parseTrk) {
+ if (stats->trkunconverted != 0) {
+ ratio =
+ (double) stats->trkunconverted / (stats->trkcount +
+ stats->
+ trkunconverted) *
+ 100;
+ } else {
+ ratio = 0;
+ }
+ printf("Track Points:\n");
+ printf("\ttrack count:\t%i\n", stats->trkcount);
+ printf("\tpoint count:\t%i\n", stats->trkpoints);
+ if (!prop->isFast) {
+ printf("\ttotal length:\t%f\n", stats->trklength);
+ printf("\tunconverted:\t%i(%5.2f%%)\n",
+ stats->trkunconverted, ratio);
+ }
+ }
+ if (prop->parseRte) {
+ if (stats->rteunconverted != 0) {
+ ratio =
+ (double) stats->rteunconverted / (stats->rtecount +
+ stats->
+ rteunconverted) *
+ 100;
+ } else {
+ ratio = 0;
+ }
+ printf("Routes:\n");
+ printf("\troute count:\t%i\n", stats->rtecount);
+ printf("\tpoint count:\t%i\n", stats->rtepoints);
+ if (!prop->isFast) {
+ printf("\ttotal length:\t%f\n", stats->rtelength);
+ printf("\tunconverted:\t%i(%5.2f%%)\n",
+ stats->rteunconverted, ratio);
+ }
+ }
+ if (prop->parseWpt) {
+ printf("Waypoints:\n");
+ printf("\tpoint count:\t%i\n", stats->wptpoints);
+ }
+ }
+}
+
+/**
+ * clears a path attribute structure
+ */
+void wipePathAttr(pathattr * pattr)
+{
+ pattr->name[0] = '\0';
+ pattr->cmt[0] = '\0';
+ pattr->desc[0] = '\0';
+ pattr->src[0] = '\0';
+ pattr->link[0] = '\0';
+ pattr->number = 0;
+ pattr->type[0] = '\0';
+ pattr->length = 0;
+ pattr->interval = 0;
+ pattr->speed = 0;
+ //pattr->point = NULL;
+ pattr->count = 0;
+}
+
+/**
+ * creates a new path attribute
+ */
+pathattr *createPathAttr(void)
+{
+ pathattr *pattr;
+ pattr = (pathattr *) malloc(sizeof(pathattr));
+ wipePathAttr(pattr);
+ return pattr;
+}
+
+/**
+ * clears a element attribute structure
+ */
+void wipeAttr(g2sattr * attr)
+{
+ attr->lon = 0;
+ attr->lat = 0;
+ attr->minlon = 0;
+ attr->minlat = 0;
+ attr->maxlon = 0;
+ attr->maxlat = 0;
+ attr->name[0] = '\0';
+ attr->cmt[0] = '\0';
+ attr->desc[0] = '\0';
+ attr->src[0] = '\0';
+ attr->link[0] = '\0';
+ attr->type[0] = '\0';
+ attr->time[0] = '\0';
+ attr->number = 0;
+ attr->ele = 0;
+ attr->magvar = 0;
+ attr->geoidheight = 0;
+ attr->sym[0] = '\0';
+ attr->fix[0] = '\0';
+ attr->sat = 0;
+ attr->hdop = 0;
+ attr->vdop = 0;
+ attr->pdop = 0;
+ attr->ageofdgpsdata = 0;
+ attr->dgpsid = 0;
+ attr->author[0] = '\0';
+ attr->keywords[0] = '\0';
+ attr->copyright[0] = '\0';
+ attr->year = 0;
+ attr->license[0] = '\0';
+ attr->minlat = 0;
+ attr->minlon = 0;
+ attr->maxlat = 0;
+ attr->maxlon = 0;
+}
+
+/**
+ * sets default values to a column properties.
+ */
+void setColsDefault(g2scolumns * cols)
+{
+ cols->name = 1;
+ cols->cmt = 1;
+ cols->desc = 1;
+ cols->src = 1;
+ cols->link = 1;
+ cols->type = 1;
+ cols->time = 1;
+ cols->number = 1;
+ cols->ele = 1;
+ cols->magvar = 1;
+ cols->geoidheight = 1;
+ cols->sym = 1;
+ cols->fix = 1;
+ cols->sat = 1;
+ cols->hdop = 1;
+ cols->vdop = 1;
+ cols->pdop = 1;
+ cols->ageofdgpsdata = 1;
+ cols->dgpsid = 1;
+ cols->length = 1;
+ cols->interval = 1;
+ cols->speed = 1;
+ cols->points = 1;
+ cols->gpxline = 0;
+}
+
+/**
+ * creates a column structure
+ */
+g2scolumns *createCols(void)
+{
+ g2scolumns *cols;
+ cols = (g2scolumns *) malloc(sizeof(g2scolumns));
+ setColsDefault(cols);
+ return cols;
+}
+
+/**
+ * creates a element attribute structure.
+ */
+g2sattr *createAttr(void)
+{
+ g2sattr *attr;
+ attr = (g2sattr *) malloc(sizeof(g2sattr));
+ wipeAttr(attr);
+ return attr;
+}
+
+/**
+ * creates a properties structure for gpx2shp
+ */
+g2sprop *createProp(void)
+{
+ g2sprop *prop;
+ g2sstats *stats;
+ g2scolumns *cols;
+ prop = malloc(sizeof(g2sprop));
+ stats = malloc(sizeof(g2sstats));
+ cols = createCols();
+ prop->stats = stats;
+ prop->parseWpt = 0;
+ prop->parseTrk = 0;
+ prop->parseRte = 0;
+ prop->minpoints = 2;
+ prop->minlength = 0;
+ prop->mintime = 0;
+ prop->is3d = 0;
+ prop->isEdge = 0;
+ prop->isPoint = 0;
+ prop->isFast = 0;
+ prop->needsStats = 0;
+ prop->verbose = 0;
+ prop->output = NULL;
+ prop->ellipsoid = NULL;
+ prop->lengthUnit = NULL;
+ prop->speedLengthUnit = NULL;
+ prop->speedTimeUnit = NULL;
+ prop->timeUnit = NULL;
+ prop->stats->trkcount = 0;
+ prop->stats->trkpoints = 0;
+ prop->stats->trklength = 0;
+ prop->stats->trkunconverted = 0;
+ prop->stats->rtecount = 0;
+ prop->stats->rtepoints = 0;
+ prop->stats->rtelength = 0;
+ prop->stats->rteunconverted = 0;
+ prop->stats->wptpoints = 0;
+ prop->cols = cols;
+ return prop;
+}
+
+/**
+ * close and free a propertires structure
+ */
+void closeProp(g2sprop * prop)
+{
+ free(prop->stats);
+ free(prop->sourcefile);
+ free(prop->ellipsoid);
+ free(prop->timeUnit);
+ free(prop->speedLengthUnit);
+ free(prop->speedTimeUnit);
+ free(prop->lengthUnit);
+ free(prop->output);
+ free(prop->cols);
+ free(prop);
+}
+
+/**
+ * creates a shapehandles structure
+ */
+//shphandles *createShps(void)
+//{
+// shphandles *shps;
+// shps = malloc(sizeof(shphandles));
+// shps->trk = NULL;
+// shps->wpt = NULL;
+// shps->rte = NULL;
+// shps->trk_edg = NULL;
+// shps->rte_edg = NULL;
+// shps->trk_pnt = NULL;
+// shps->rte_pnt = NULL;
+// return shps;
+//}
+
+/**
+ * creates a dbfhandles structure
+ */
+/* dbfhandles *createDbfs(void)
+{
+ dbfhandles *dbfs;
+ dbfs = malloc(sizeof(dbfhandles));
+ dbfs->trk = NULL;
+ dbfs->wpt = NULL;
+ dbfs->rte = NULL;
+ dbfs->trk_edg = NULL;
+ dbfs->rte_edg = NULL;
+ dbfs->trk_pnt = NULL;
+ dbfs->rte_pnt = NULL;
+ return dbfs;
+} */
+
+/**
+ * creates a parse structure
+ */
+parsedata *createParsedata(XML_Parser parser, g2sprop * prop)
+{
+ parsedata *pdata = (parsedata *) malloc(sizeof(parsedata));
+ pdata->fp = NULL;
+ //shphandles *shps = createShps();
+ //dbfhandles *dbfs = createDbfs();
+ pathattr *pattr = createPathAttr();
+ g2sattr *attr = createAttr();
+ parent *p = (parent *) malloc(sizeof(parent));
+ parent *c = (parent *) malloc(sizeof(parent));
+ p->name = NULL;
+ p->parentptr = NULL;
+ c->name = "root";
+ c->parentptr = p;
+ pdata->depth = 0;
+ pdata->databuf = malloc(sizeof(char) * DATABUFSIZE);
+ pdata->bufptr = NULL;
+ pdata->failed = 0;
+ pdata->failedid = 0;
+ pdata->parser = parser;
+ pdata->parent = p;
+ pdata->current = c;
+ //pdata->shps = shps;
+ //pdata->dbfs = dbfs;
+ pdata->prop = prop;
+ pdata->pattr = pattr;
+ pdata->attr = attr;
+ return pdata;
+}
+
+/*
+ * close and free resoures
+ */
+void closeParsedata(parsedata * pdata)
+{
+ //free(pdata->shps);
+ //free(pdata->dbfs);
+ free(pdata->parent);
+ free(pdata->current);
+ free(pdata->databuf);
+ free(pdata->attr);
+ free(pdata->pattr);
+ free(pdata);
+}
diff --git a/tools/gpx2navit_txt/src/parser.c b/tools/gpx2navit_txt/src/parser.c
new file mode 100644
index 00000000..dc62d71f
--- /dev/null
+++ b/tools/gpx2navit_txt/src/parser.c
@@ -0,0 +1,167 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "gpx2navit_txt.h"
+
+void charHandle(void *userdata, const XML_Char * data, int length);
+void startElement(void *userdata, const char *element, const char **attr);
+void endElement(void *userdata, const char *element);
+void parseMain(g2sprop * prop);
+
+/**
+ * a handler to parse charctor data on expat
+ */
+void charHandle(void *userdata, const XML_Char * data, int length)
+{
+ static int bufsize = DATABUFSIZE;
+ static int string_length = 0;
+ int new_length;
+ static int begin_copy = 0;
+ int i;
+ parsedata *pdata = (parsedata *) userdata;
+ if (pdata->bufptr == NULL) {
+ //start of buffer -->pdata->bufptr set to 0 at endelement
+ string_length = 0;
+ begin_copy = 0; //begin to copy after first space
+ pdata->bufptr= pdata->databuf;
+ }
+ new_length = string_length + length + 1; //additonal 0
+ if (bufsize < new_length) {
+ pdata->databuf =
+ realloc(pdata->databuf, new_length);
+ bufsize = new_length;
+ //because of realloc the pointer may have changed
+ pdata->bufptr = pdata->databuf + string_length;
+ }
+ // because expat calls this routine several times on special chars
+ // we need to do following
+ // --concat strings until reset (bufptr set to NULL)
+ // --filter out blank chars at begin of string
+ for (i=0; i<length;i++) {
+ if (begin_copy || !isspace(data[i])) {
+ *pdata->bufptr = data[i];
+ pdata->bufptr++;
+ string_length ++;
+ begin_copy = 1;
+ if (DEBUG) fprintf(stderr,"%c",data[i]);
+ }
+ }
+ *pdata->bufptr = '\0';
+}
+
+/**
+ * a handler when a element starts
+ */
+void startElement(void *userdata, const char *element, const char **attr)
+{
+ parsedata *pdata = (parsedata *) userdata;
+ pdata->parent = pdata->current;
+ pdata->current = malloc(sizeof(parent));
+ pdata->current->name = malloc(sizeof(char) * (strlen(element) + 1));
+ strcpy(pdata->current->name, element);
+ pdata->current->parentptr = pdata->parent;
+ startElementControl(pdata, element, attr);
+ if (pdata->prop->verbose) {
+ int i;
+ for (i = 0; i < pdata->depth; i++)
+ printf(" ");
+ printf("<%s>: ", element);
+ for (i = 0; attr[i]; i += 2) {
+ printf(" %s='%s'", attr[i], attr[i + 1]);
+ }
+ printf("\n");
+ }
+ pdata->depth++;
+}
+
+/**
+ * a handler when a element ends
+ */
+void endElement(void *userdata, const char *element)
+{
+ parsedata *pdata = (parsedata *) userdata;
+ endElementControl(pdata, element);
+ pdata->depth--;
+ if (pdata->prop->verbose) {
+ int i;
+ for (i = 0; i < pdata->depth; i++)
+ printf(" ");
+ printf("</%s>:%s\n ", element,pdata->parent->name);
+ }
+ free(pdata->current->name);
+ free(pdata->current);
+ pdata->current = pdata->parent;
+ pdata->parent = pdata->parent->parentptr;
+}
+
+void parseMain(g2sprop * prop)
+{
+ FILE *fp;
+ char buff[BUFFSIZE];
+ XML_Parser parser;
+ parsedata *pdata;
+ fp = fopen(prop->sourcefile, "r");
+ if (fp == NULL) {
+ fprintf(stderr, "Cannot open gpx file: %s\n", prop->sourcefile);
+ exit(ERR_CANNOTOPEN);
+ }
+ parser = XML_ParserCreate(NULL);
+ if (!parser) {
+ fprintf(stderr, "Couldn't allocate memory for parser\n");
+ exit(ERR_OUTOFMEMORY);
+ }
+ pdata = createParsedata(parser, prop);
+
+ char *output_wpt =
+ (char *) malloc(sizeof(char) * (strlen(pdata->prop->output) + 9));
+ strcpy(output_wpt, pdata->prop->output);
+ strcat(output_wpt, "_nav.txt");
+ pdata->fp = fopen(output_wpt,"w");
+ if (pdata->fp == NULL)
+ {
+ //todo
+ fprintf(stderr,"Failure opening File %s for writing",output_wpt);
+ exit(1);
+ }
+ free(output_wpt);
+ XML_SetUserData(parser, pdata);
+ XML_SetElementHandler(parser, startElement, endElement);
+ XML_SetCharacterDataHandler(parser, charHandle);
+ for (;;) {
+ int done;
+ int len;
+ fgets(buff, BUFFSIZE, fp);
+ len = (int) strlen(buff);
+ if (ferror(fp)) {
+ fprintf(stderr, "Read error file: %s\n", prop->sourcefile);
+ exit(ERR_READERROR);
+ }
+ done = feof(fp);
+ if (done)
+ break;
+ if (!XML_Parse(parser, buff, len, done)) {
+ fprintf(stderr, "Parse error at line %d:\n%s\n",
+ XML_GetCurrentLineNumber(parser),
+ XML_ErrorString(XML_GetErrorCode(parser)));
+ exit(ERR_PARSEERROR);
+ }
+ }
+ fclose(pdata->fp); //close out file
+ closeParsedata(pdata);
+}
diff --git a/tools/gpx2navit_txt/src/setmeta.c b/tools/gpx2navit_txt/src/setmeta.c
new file mode 100644
index 00000000..86a22f70
--- /dev/null
+++ b/tools/gpx2navit_txt/src/setmeta.c
@@ -0,0 +1,73 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "gpx2navit_txt.h"
+
+/**
+ * store gpx metadata into text file
+ */
+void setMetadata(parsedata * pdata)
+{
+ g2sprop *prop = pdata->prop;
+ g2sattr *attr = pdata->attr;
+ FILE *metafile;
+ char *output = malloc(sizeof(char) * (strlen(prop->output) + 10));
+ strcpy(output, prop->output);
+ strcat(output, "_meta.txt");
+ metafile = fopen(output, "w");
+ if (metafile == NULL) {
+ fprintf(stderr, "Cannot create file: %s\n", output);
+ exit(ERR_CREATEFILE);
+ }
+ if (attr->name) {
+ fprintf(metafile, "name\t%s\n", attr->name);
+ }
+ if (attr->desc) {
+ fprintf(metafile, "description\t%s\n", attr->desc);
+ }
+ if (attr->author) {
+ fprintf(metafile, "author\t%s\n", attr->author);
+ }
+ if (attr->copyright) {
+ fprintf(metafile, "copyright\t%s\n", attr->copyright);
+ }
+ if (attr->link) {
+ fprintf(metafile, "link\t%s\n", attr->link);
+ }
+ if (attr->time) {
+ fprintf(metafile, "time\t%s\n", attr->time);
+ }
+ if (attr->keywords) {
+ fprintf(metafile, "keywords\t%s\n", attr->keywords);
+ }
+ if (attr->minlat) {
+ fprintf(metafile, "min latitude\t%f\n", attr->minlat);
+ }
+ if (attr->minlon) {
+ fprintf(metafile, "min longitude\t%f\n", attr->minlon);
+ }
+ if (attr->maxlat) {
+ fprintf(metafile, "max latitude\t%f\n", attr->maxlat);
+ }
+ if (attr->maxlon) {
+ fprintf(metafile, "max longitude\t%f\n", attr->maxlon);
+ }
+ fclose(metafile);
+ free(output);
+}
diff --git a/tools/gpx2navit_txt/src/setpath.c b/tools/gpx2navit_txt/src/setpath.c
new file mode 100644
index 00000000..6b4d1555
--- /dev/null
+++ b/tools/gpx2navit_txt/src/setpath.c
@@ -0,0 +1,260 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "gpx2navit_txt.h"
+
+void initPathAttr(pathattr * pattr, g2sattr * attr);
+void setEdge(parsedata * pdata, double _x, double _y, double _z,
+ double length, double interval, double speed);
+void setPathInterval(parsedata * pdata);
+void setPathData(pathattr * pattr, g2sattr * attr);
+void countUnconverted(parsedata * pdata);
+void countPath(parsedata * pdata);
+int checkPath(parsedata * pdata);
+void setPath( parsedata * pdata);
+
+
+
+/**
+ * initialize a path attribute
+ */
+void initPathAttr(pathattr * pattr, g2sattr * attr)
+{
+ strcpy(pattr->name, attr->name);
+ strcpy(pattr->cmt, attr->cmt);
+ strcpy(pattr->desc, attr->desc);
+ strcpy(pattr->src, attr->src);
+ strcpy(pattr->link, attr->link);
+ pattr->number = attr->number;
+ strcpy(pattr->type, attr->type);
+ pattr->length = 0;
+ pattr->interval = 0;
+ pattr->speed = 0;
+ pattr->count = 0;
+ pattr->point = NULL;
+}
+
+
+/**
+ * set edge data and store it
+ */
+void setEdge(parsedata * pdata, double _x, double _y, double _z,
+ double length, double interval, double speed)
+{
+ pathattr *pattr = pdata->pattr;
+ static int isFirstTrkAsEdge = 1;
+ static int isFirstRteAsEdge = 1;
+ double x[2], y[2], z[2];
+ double _length, _interval, _speed;
+ if (!strcmp(pdata->current->name, "trkpt")) {
+ if (isFirstTrkAsEdge) {
+ isFirstTrkAsEdge = 0;
+ }
+ } else {
+ if (isFirstRteAsEdge) {
+ isFirstRteAsEdge = 0;
+ }
+ }
+ _length = pattr->length;
+ _interval = pattr->interval;
+ _speed = pattr->speed;
+ pattr->length = length;
+ pattr->interval = interval;
+ pattr->speed = speed;
+ x[0] = _x;
+ y[0] = _y;
+ z[0] = _z;
+ x[1] = pdata->attr->lon;
+ y[1] = pdata->attr->lat;
+ z[1] = pdata->attr->ele;
+ if (pdata->prop->is3d) {
+ } else {
+ }
+ pattr->length = _length;
+ pattr->interval = _interval;
+ pattr->speed = _speed;
+}
+
+/**
+ * sets interval data between two track points
+ */
+void setPathInterval(parsedata * pdata)
+{
+ pathattr *pattr = pdata->pattr;
+ g2sattr *attr = pdata->attr;
+ g2sprop *prop = pdata->prop;
+ static char _t[TIMELENGTH];
+ double intvl = 0;
+ static double _x, _y, _z;
+ double leng = 0;
+ double spd;
+ if (pattr->count == 1) {
+ strcpy(_t, attr->time);
+ } else {
+ /* time interval */
+ intvl = getTimeInterval(_t, attr->time);
+ pattr->interval = pattr->interval + intvl;
+ strcpy(_t, attr->time);
+ /* length interval */
+ leng = getDistance(_x, _y, attr->lon, attr->lat);
+ pattr->length = pattr->length + leng;
+ /* interval speed */
+ spd = getSpeed(leng, intvl, prop->speed2meter, prop->speed2sec);
+ /* sets edge data */
+ if (prop->isEdge) {
+ setEdge(pdata, _x, _y, _z, leng, intvl, spd);
+ }
+ }
+ _x = attr->lon;
+ _y = attr->lat;
+ _z = attr->ele;
+}
+
+/**
+ * sets each track point data in array.
+ */
+void setPathData(pathattr * pattr, g2sattr * attr)
+{
+ const int reallocsize = 100;
+ if (pattr->count == 0) {
+ pattr->point = malloc(sizeof(double) * 3 * reallocsize);
+ }
+ if ((pattr->count % reallocsize) == 0) {
+ pattr->point = realloc(pattr->point,
+ sizeof(double) * 3 * (pattr->count +
+ reallocsize));
+ }
+ pattr->point[pattr->count * 3] = attr->lon;
+ pattr->point[pattr->count * 3 + 1] = attr->lat;
+ pattr->point[pattr->count * 3 + 2] = attr->ele;
+ pattr->count++;
+}
+
+/**
+ * counts paths that wasn't converted
+ */
+void countUnconverted(parsedata * pdata)
+{
+ g2sstats *stats = pdata->prop->stats;
+ if (!strcmp(pdata->current->name, "trkseg"))
+ stats->trkunconverted++;
+ else
+ stats->rteunconverted++;
+}
+
+/**
+ * counts paths
+ */
+void countPath(parsedata * pdata)
+{
+ g2sstats *stats = pdata->prop->stats;
+ pathattr *pattr = pdata->pattr;
+ if (!strcmp(pdata->current->name, "trkseg")) {
+ stats->trkcount++;
+ stats->trklength += pattr->length;
+ stats->trkpoints += pattr->count;
+ } else {
+ stats->rtecount++;
+ stats->rtelength += pattr->length;
+ stats->rtepoints += pattr->count;
+ }
+}
+
+int checkPath(parsedata * pdata)
+{
+ pathattr *pattr = pdata->pattr;
+ g2sprop *prop = pdata->prop;
+ /* check point count. */
+ if (pattr->count < prop->minpoints) {
+ fprintf
+ (stderr,
+ "gpx2navit_txt:%s:%i track was not converted because of less then %d points. \n",
+ prop->sourcefile, XML_GetCurrentLineNumber(pdata->parser),
+ prop->minpoints);
+ countUnconverted(pdata);
+ return 0;
+ /* check path length */
+ } else if (pattr->length < prop->minlength * prop->length2meter) {
+ fprintf
+ (stderr,
+ "gpx2navit_txt:%s:%i track was not converted because it is shorter than %dm.\n",
+ prop->sourcefile, XML_GetCurrentLineNumber(pdata->parser),
+ prop->minlength);
+ countUnconverted(pdata);
+ return 0;
+ /* check path time */
+ } else if (pattr->interval < prop->mintime * prop->time2sec) {
+ fprintf
+ (stderr,
+ "gpx2navit_txt:%s:%i track was not converted because it is shorter than %d sed.\n",
+ prop->sourcefile, XML_GetCurrentLineNumber(pdata->parser),
+ prop->mintime);
+ countUnconverted(pdata);
+ return 0;
+ /* check path speed */
+ } else if (pattr->speed == .0) {
+ fprintf
+ (stderr,
+ "gpx2navit_txt:%s:%i track was not converted because no move recorded.\n",
+ prop->sourcefile, XML_GetCurrentLineNumber(pdata->parser));
+ countUnconverted(pdata);
+ return 0;
+ }
+ return 1;
+}
+
+/**
+ * saves path data into files.
+ */
+void setPath( parsedata * pdata)
+{
+ pathattr *pattr = pdata->pattr;
+ g2sprop *prop = pdata->prop;
+ int isOk = 0;
+ pattr->speed =
+ getSpeed(pattr->length, pattr->interval, prop->speed2meter,
+ prop->speed2sec);
+ if (prop->isFast) {
+ isOk = 1;
+ } else {
+ isOk = checkPath(pdata);
+ }
+ if (isOk) {
+ double x[pattr->count];
+ double y[pattr->count];
+ double z[pattr->count];
+ int i;
+ fprintf(pdata->fp,"type=track label=\"%s\" desc=\"%s\" type=\"%s\"\ length=\"%5.3f\" count=\"%5d\"\n"
+ ,pdata->pattr->name,pdata->pattr->desc,
+ pdata->pattr->type,pdata->pattr->length,
+ pdata->pattr->count);
+
+ for (i = 0; i < pattr->count; i++) {
+ x[i] = pattr->point[i * 3];
+ y[i] = pattr->point[i * 3 + 1];
+ z[i] = pattr->point[i * 3 + 2];
+ fprintf(pdata->fp,"%3.6f %4.6f\n",x[i],y[i]);
+ }
+ if (pdata->prop->is3d) {
+ } else {
+ }
+ countPath(pdata);
+ }
+ free(pattr->point);
+}
diff --git a/tools/gpx2navit_txt/src/setwpt.c b/tools/gpx2navit_txt/src/setwpt.c
new file mode 100644
index 00000000..3fc04f71
--- /dev/null
+++ b/tools/gpx2navit_txt/src/setwpt.c
@@ -0,0 +1,71 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "gpx2navit_txt.h"
+
+void setWpt(parsedata * pdata);
+
+/**
+ * save point objects in *_wpt or *_pnt file
+ */
+void setWpt( parsedata * pdata)
+{
+ double x[1], y[1], z[1];
+ x[0] = pdata->attr->lon;
+ y[0] = pdata->attr->lat;
+ z[0] = pdata->attr->ele;
+ if (pdata->prop->is3d) {
+ //nothing at the moment
+ } else {
+ //do not know if i will change something here
+ }
+ // Write attributes to file first line waypoint-info, second line coords
+ char poi_type[20]="poi_attraction";
+ if (!strcmp(pdata->attr->type,"Geocache|Traditional Cache"))
+ strcpy(poi_type,"poi_gc_tradi");
+ if (!strcmp(pdata->attr->type,"Geocache|Multi-cache"))
+ strcpy(poi_type,"poi_gc_multi");
+ if (!strcmp(pdata->attr->type,"Geocache|Unknown Cache"))
+ strcpy(poi_type,"poi_gc_mystery");
+ if (!strcmp(pdata->attr->type,"Geocache|Event Cache"))
+ strcpy(poi_type,"poi_gc_event");
+ if (!strcmp(pdata->attr->type,"Geocache")) //for OC
+ strcpy(poi_type,"poi_gc_tradi");
+ if (!strcmp(pdata->attr->type,"Waypoint|Parking Area"))
+ strcpy(poi_type,"poi_car_parking");
+ if (!strcmp(pdata->attr->type,"Waypoint|Question to Answer"))
+ strcpy(poi_type,"poi_gc_question");
+ if (!strcmp(pdata->attr->type,"Waypoint|Reference Point"))
+ strcpy(poi_type,"poi_gc_reference");
+ if (!strcmp(pdata->attr->type,"Waypoint|Stages of a Multicache"))
+ strcpy(poi_type,"poi_gc_stages");
+
+ //generate the file
+ fprintf(pdata->fp,"type=%s label=\"%s\" description=\"%s\" gc_type=\"%s\"\n",
+ poi_type,pdata->attr->name,pdata->attr->desc,pdata->attr->type);
+ fprintf(pdata->fp,"%3.6f %4.6f\n",x[0],y[0]);
+
+ //writeWptAttribute(hDBF, pdata, iShape);
+ if (!strcmp(pdata->current->name, "wpt")) {
+ pdata->prop->stats->wptpoints++;
+ }
+ return;
+}
+
+
diff --git a/tools/gpx2navit_txt/src/utils.c b/tools/gpx2navit_txt/src/utils.c
new file mode 100644
index 00000000..4a215fd9
--- /dev/null
+++ b/tools/gpx2navit_txt/src/utils.c
@@ -0,0 +1,218 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "gpx2navit_txt.h"
+#include "projects.h"
+#include "geodesic.h"
+
+double getDistanceCore(char *p1, char *l1, char *p2, char *l2);
+void checkEllpsUnit(char *unit);
+double checkLengthUnit(char *unit);
+int checkTimeUnit(char *unit);
+double getTimeInterval(char *_t, char *t);
+double getSpeed(double length, double ti, double to_meter, int to_sec);
+double getDistance(double _x, double _y, double x, double y);
+// todo void closeShpFiles(shphandles * shps);
+// todo void closeDbfFiles(dbfhandles * dbfs);
+void *myMallocRep(size_t size, const char *fileName, int line);
+
+void checkEllpsUnit(char *unit)
+{
+/*
+ * checks ellipse unit can be used by proj4
+ */
+ int isOK = 0;
+ struct PJ_ELLPS *el; /* project.h of proj4 */
+ for (el = pj_ellps; el->id; ++el) {
+ if (!strcmp(el->id, unit)) {
+ isOK = 1;
+ }
+ }
+ if (!isOK) {
+ fputs
+ ("The ellipse argument is not correct or supported by libproj\n",
+ stderr);
+ fputs("You can choose the argument from a list below.\n\n",
+ stderr);
+ for (el = pj_ellps; el->id; el++) {
+ printf("%10s\t%s\n", el->id, el->name);
+ }
+ exit(ERR_ELLPSUNIT);
+ }
+}
+
+double checkLengthUnit(char *unit)
+{
+/*
+ * checks length unit can be used by proj4
+ * then returns unit value to meter
+ */
+ int isOK = 0;
+ double to_meter = 0;
+ struct PJ_UNITS *ut; /* project.h of proj4 */
+ for (ut = pj_units; ut->id; ut++) {
+ if (!strcmp(ut->id, unit)) {
+ isOK = 1;
+ to_meter = atof(ut->to_meter);
+ }
+ }
+ if (!isOK) {
+ fputs
+ ("The length unit argument is not correct or supported by libproj.\n",
+ stderr);
+ fputs("You can choose the argument from a list below.\n\n",
+ stderr);
+ for (ut = pj_units; ut->id; ut++) {
+ printf("%s\t%s\n", ut->id, ut->name);
+ }
+ exit(ERR_LENGTHUNIT);
+ }
+ return to_meter;
+}
+
+int checkTimeUnit(char *unit)
+{
+ char *u[8] = { "sec", "s", "min", "m", "hour", "h", "day", "d" };
+ int p[8] = { 1, 1, 60, 60, 3600, 3600, 86400, 86400 };
+ int i, to_sec = 0;
+ for (i = 0; i < 8; i++) {
+ if (!strcmp(u[i], unit)) {
+ to_sec = p[i];
+ }
+ }
+ if (!to_sec) {
+ fputs("The time unit argument is not correct.\n", stderr);
+ fputs("You can choose the argument from sec, min, hour or day.\n",
+ stderr);
+ exit(ERR_TIMEUNIT);
+ }
+ return to_sec;
+}
+
+double getTimeInterval(char *_t, char *t)
+{
+/*
+ * Returns a time interval between _t and t.
+ * The arguments should be "YYYY-MM-DDThh:mm:ssZ" (xml schema
+ * datetime format without time zone) format.
+ */
+ double ti;
+ struct tm _tt;
+ struct tm tt;
+ time_t _tmt, tmt;
+ memset(&_tt, 0, sizeof(_tt));
+ memset(&tt, 0, sizeof(tt));
+ sscanf(_t, "%d-%d-%dT%d:%d:%dZ", &_tt.tm_year, &_tt.tm_mon,
+ &_tt.tm_mday, &_tt.tm_hour, &_tt.tm_min, &_tt.tm_sec);
+ _tt.tm_year -= 1900;
+ _tt.tm_mon -= 1;
+ sscanf(t, "%d-%d-%dT%d:%d:%d", &tt.tm_year, &tt.tm_mon, &tt.tm_mday,
+ &tt.tm_hour, &tt.tm_min, &tt.tm_sec);
+ tt.tm_year -= 1900;
+ tt.tm_mon -= 1;
+ _tmt = mktime(&_tt);
+ tmt = mktime(&tt);
+ ti = difftime(tmt, _tmt);
+ return ti;
+}
+
+double getSpeed(double length, double ti, double to_meter, int to_sec)
+{
+/*
+ * Culculates speed from length and time.
+ */
+ double speed;
+ if (!length || !ti)
+ speed = 0;
+ else
+ speed = (length / to_meter) / (ti / to_sec);
+ return speed;
+}
+
+double getDistanceCore(char *p1, char *l1, char *p2, char *l2)
+{
+ /*
+ * Culculates a geodesic length between two points
+ * using geod_*.c
+ */
+ phi1 = dmstor(p1, &p1);
+ lam1 = dmstor(l1, &l1);
+ phi2 = dmstor(p2, &p2);
+ lam2 = dmstor(l2, &l2);
+ geod_inv();
+ return geod_S;
+}
+
+double getDistance(double _x, double _y, double x, double y)
+{
+ /*
+ * Culculates a geodesic length between two points
+ */
+ double length;
+ char p1[17], l1[17], p2[17], l2[17];
+ sprintf(p1, "%f", _x);
+ sprintf(l1, "%f", _y);
+ sprintf(p2, "%f", x);
+ sprintf(l2, "%f", y);
+ length = getDistanceCore(p1, l1, p2, l2);
+ return length;
+}
+
+//todo void closeShpFiles(shphandles * shps)
+//{
+ /*
+ * Closes all SHP files if they opened
+ */
+// if (shps->wpt)
+// SHPClose(shps->wpt);
+// if (shps->trk)
+// SHPClose(shps->trk);
+// if (shps->trk_edg)
+// SHPClose(shps->trk_edg);
+// if (shps->trk_pnt)
+// SHPClose(shps->trk_pnt);
+// if (shps->rte)
+// SHPClose(shps->rte);
+// if (shps->rte_edg)
+// SHPClose(shps->rte_edg);
+// if (shps->rte_pnt)
+// SHPClose(shps->rte_pnt);
+//}
+
+//todo void closeDbfFiles(dbfhandles * dbfs)
+//{
+ /*
+ * Closes all DBF files if they opened
+ */
+// if (dbfs->wpt)
+// DBFClose(dbfs->wpt);
+// if (dbfs->trk)
+// DBFClose(dbfs->trk);
+// if (dbfs->trk_edg)
+// DBFClose(dbfs->trk_edg);
+// if (dbfs->trk_pnt)
+// DBFClose(dbfs->trk_pnt);
+// if (dbfs->rte)
+// DBFClose(dbfs->rte);
+// if (dbfs->rte_edg)
+// DBFClose(dbfs->rte_edg);
+// if (dbfs->rte_pnt)
+// DBFClose(dbfs->rte_pnt);
+//}
+
diff --git a/tools/latlon2bookmark/Makefile b/tools/latlon2bookmark/Makefile
new file mode 100644
index 00000000..f62cc0bc
--- /dev/null
+++ b/tools/latlon2bookmark/Makefile
@@ -0,0 +1,5 @@
+all:
+ gcc -l m -o latlon2bookmark latlon2bookmark.c
+
+clean:
+ rm -f latlon2bookmark
diff --git a/tools/latlon2bookmark/latlon2bookmark.c b/tools/latlon2bookmark/latlon2bookmark.c
new file mode 100644
index 00000000..9f0eff79
--- /dev/null
+++ b/tools/latlon2bookmark/latlon2bookmark.c
@@ -0,0 +1,140 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2009 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/**
+ * this program is free software, please use it as you like.
+ * i am not a programmer, so please have this code reviewed
+ * to make sure it has nog bugs or ill side efects.
+ * use at your own risk
+ * compile it with: gcc -l m -o latlon2bookmark latlon2bookmark.c
+ * Credits for this work goes to edje in #navit
+**/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+
+int main( int argc, char **argv )
+{
+ char description[256];
+ char lngsign[10];
+ char latsign[10];
+ float lat;
+ float lng;
+ long intlat;
+ long intlng;
+ int i;
+ int n;
+
+ if ( argc < 4 )
+ {
+ printf("\n");
+ printf("This program converts a lat/lon coordinates pair\n");
+ printf("into a bookmark you can use with navit.\n");
+ printf("This program expects 3 arguments in the following order:\n");
+ printf("Lat, Lon and a description\n");
+ printf("and will print a bookmark.\n");
+ printf("for example: latlon2bookmark 51.980344 4.358005 this is my house \n");
+ printf("\n");
+ return 1;
+ }
+
+ lat=atof(argv[1]);
+ lng=atof(argv[2]);
+
+ /* concatenate all parts of the description string */
+ strcpy(description, argv[3]);
+ n=0;
+ for (i=4; i < argc; i++)
+ {
+ /* add spaces between the parts of the description */
+ if ( i < argc )
+ {
+ strcat(description, " ");
+ }
+ strcat(description, argv[i]);
+ n=n+1;
+ }
+
+ if ( lat < -90 )
+ {
+ printf("\n");
+ printf("The first argument must be the lattitude\n");
+ printf("and can't be smaller then -90 (southpole)\n");
+ printf("\n");
+ return 2;
+ }
+
+ if ( lat > 90 )
+ {
+ printf("\n");
+ printf("The first argument must be the lattitude\n");
+ printf("and can't be bigger then 90 (northpole)\n");
+ printf("\n");
+ return 3;
+ }
+
+ if ( lng < -180 )
+ {
+ printf("\n");
+ printf("The second argument must be the longitude\n");
+ printf("and can't be smaller then -180 (oposite the 0 meridian)\n");
+ printf("\n");
+ return 4;
+ }
+
+ if ( lng > 180 )
+ {
+ printf("\n");
+ printf("The first argument must be the longitude\n");
+ printf("and can't be bigger then 180 (oposite the 0 meridian)\n");
+ printf("\n");
+ return 5;
+ }
+
+ /* convert the longitude to an integer */
+ intlng=lng*6371000.0*M_PI/180;
+
+ /* aparently if inlng < 0 , inlng needs to be inverted and a - sign used in the output */
+ strcpy(lngsign, "0x");
+ if ( intlng < 0)
+ {
+ intlng=(intlng ^ 0xffffffff);
+ strcpy(lngsign, "-0x");
+ }
+
+ /* and the same for the latitude */
+ intlat=log(tan(M_PI_4+lat*M_PI/360))*6371000.0;
+
+ /* aparently if inlat < 0 , inlat needs to be inverted and a - sign used in the output */
+ strcpy(latsign, "0x");
+ if ( intlat < 0)
+ {
+ intlat=(intlat ^ 0xffffffff);
+ strcpy(latsign, "-0x");
+ }
+
+ /* print the bookmark */
+ fprintf(stderr,"\n");
+ fprintf(stdout,"mg:%s%x %s%x type=bookmark label=\"%s\"\n",lngsign,intlng,latsign,intlat,description);
+ fprintf(stderr,"\n");
+
+ return 0;
+}
diff --git a/track.c b/track.c
new file mode 100644
index 00000000..e48abd17
--- /dev/null
+++ b/track.c
@@ -0,0 +1,1006 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include <time.h>
+#include <math.h>
+#include "item.h"
+#include "attr.h"
+#include "track.h"
+#include "debug.h"
+#include "transform.h"
+#include "coord.h"
+#include "route.h"
+#include "projection.h"
+#include "map.h"
+#include "mapset.h"
+#include "plugin.h"
+#include "vehicleprofile.h"
+#include "vehicle.h"
+#include "util.h"
+
+struct tracking_line
+{
+ struct street_data *street;
+ struct tracking_line *next;
+ int angle[0];
+};
+
+
+/**
+ * @brief Conatins a list of previous speeds
+ *
+ * This structure is used to hold a list of previously reported
+ * speeds. This data is used by the CDF.
+ */
+struct cdf_speed {
+ struct cdf_speed *next;
+ int speed;
+ time_t time;
+};
+
+/**
+ * @brief Contains data for the CDF
+ *
+ * This structure holds all data needed by the
+ * cumulative displacement filter.
+ */
+struct cdf_data {
+ int extrapolating;
+ int available;
+ int first_pos;
+ int poscount;
+ int hist_size;
+ struct cdf_speed *speed_hist;
+ struct pcoord *pos_hist;
+ int *dir_hist;
+ double last_dist;
+ struct pcoord last_out;
+ int last_dir;
+};
+
+struct tracking {
+ struct mapset *ms;
+ struct route *rt;
+ struct map *map;
+ struct vehicle *vehicle;
+ struct vehicleprofile *vehicleprofile;
+ struct coord last_updated;
+ struct tracking_line *lines;
+ struct tracking_line *curr_line;
+ int pos;
+ struct coord curr[2], curr_in, curr_out;
+ int curr_angle;
+ struct coord last[2], last_in, last_out;
+ struct cdf_data cdf;
+ struct attr *attr;
+ int valid;
+ int time;
+ double direction;
+ double speed;
+ int coord_geo_valid;
+ struct coord_geo coord_geo;
+ enum projection pro;
+ int street_direction;
+};
+
+
+int angle_factor=10;
+int connected_pref=10;
+int nostop_pref=10;
+int offroad_limit_pref=5000;
+int route_pref=300;
+
+
+static void
+tracking_init_cdf(struct cdf_data *cdf, int hist_size)
+{
+ cdf->extrapolating = 0;
+ cdf->available = 0;
+ cdf->poscount = 0;
+ cdf->last_dist = 0;
+ cdf->hist_size = hist_size;
+
+ cdf->pos_hist = g_new0(struct pcoord, hist_size);
+ cdf->dir_hist = g_new0(int, hist_size);
+}
+
+// Variables for finetuning the CDF
+
+// Minimum average speed
+#define CDF_MINAVG 1.f
+// Maximum average speed
+#define CDF_MAXAVG 6.f // only ~ 20 km/h
+ // We need a low value here because otherwise we would extrapolate whenever we are not accelerating
+
+// Mininum distance (square of it..), below which we ignore gps updates
+#define CDF_MINDIST 49 // 7 meters, I guess this value has to be changed for pedestrians.
+
+#if 0
+static void
+tracking_process_cdf(struct cdf_data *cdf, struct pcoord *pin, struct pcoord *pout, int dirin, int *dirout, int cur_speed, time_t fixtime)
+{
+ struct cdf_speed *speed,*sc,*sl;
+ double speed_avg;
+ int speed_num,i;
+
+ if (cdf->hist_size == 0) {
+ dbg(1,"No CDF.\n");
+ *pout = *pin;
+ *dirout = dirin;
+ return;
+ }
+
+ speed = g_new0(struct cdf_speed, 1);
+ speed->speed = cur_speed;
+ speed->time = fixtime;
+
+ speed->next = cdf->speed_hist;
+ cdf->speed_hist = speed;
+
+ sc = speed;
+ sl = NULL;
+ speed_num = 0;
+ speed_avg = 0;
+ while (sc && ((fixtime - speed->time) < 4)) { // FIXME static maxtime
+ speed_num++;
+ speed_avg += sc->speed;
+ sl = sc;
+ sc = sc->next;
+ }
+
+ speed_avg /= (double)speed_num;
+
+ if (sl) {
+ sl->next = NULL;
+ }
+
+ while (sc) {
+ sl = sc->next;
+ g_free(sc);
+ sc = sl;
+ }
+
+ if (speed_avg < CDF_MINAVG) {
+ speed_avg = CDF_MINAVG;
+ } else if (speed_avg > CDF_MAXAVG) {
+ speed_avg = CDF_MAXAVG;
+ }
+
+
+ if (cur_speed >= speed_avg) {
+ if (cdf->extrapolating) {
+ cdf->poscount = 0;
+ cdf->extrapolating = 0;
+ }
+
+ cdf->first_pos--;
+ if (cdf->first_pos < 0) {
+ cdf->first_pos = cdf->hist_size - 1;
+ }
+
+ if (cdf->poscount < cdf->hist_size) {
+ cdf->poscount++;
+ }
+
+ cdf->pos_hist[cdf->first_pos] = *pin;
+ cdf->dir_hist[cdf->first_pos] = dirin;
+
+ *pout = *pin;
+ *dirout = dirin;
+ } else if (cdf->poscount > 0) {
+
+ double mx,my; // Average position's x and y values
+ double sx,sy; // Support vector
+ double dx,dy; // Difference between average and current position
+ double len; // Length of support vector
+ double dist;
+
+ mx = my = 0;
+ sx = sy = 0;
+
+ for (i = 0; i < cdf->poscount; i++) {
+ mx += (double)cdf->pos_hist[((cdf->first_pos + i) % cdf->hist_size)].x / cdf->poscount;
+ my += (double)cdf->pos_hist[((cdf->first_pos + i) % cdf->hist_size)].y / cdf->poscount;
+
+
+ if (i != 0) {
+ sx += cdf->pos_hist[((cdf->first_pos + i) % cdf->hist_size)].x - cdf->pos_hist[((cdf->first_pos + i - 1) % cdf->hist_size)].x;
+ sy += cdf->pos_hist[((cdf->first_pos + i) % cdf->hist_size)].y - cdf->pos_hist[((cdf->first_pos + i - 1) % cdf->hist_size)].y;
+ }
+
+ }
+
+ if (cdf->poscount > 1) {
+ // Normalize the support vector
+ len = sqrt(sx * sx + sy * sy);
+ sx /= len;
+ sy /= len;
+
+ // Calculate the new direction
+ *dirout = (int)rint(atan(sx / sy) / M_PI * 180 + 180);
+ } else {
+ // If we only have one position, we can't use differences of positions, but we have to use the reported
+ // direction of that position
+ sx = sin((double)cdf->dir_hist[cdf->first_pos] / 180 * M_PI);
+ sy = cos((double)cdf->dir_hist[cdf->first_pos] / 180 * M_PI);
+ *dirout = cdf->dir_hist[cdf->first_pos];
+ }
+
+
+ dx = pin->x - mx;
+ dy = pin->y - my;
+ dist = dx * sx + dy * sy;
+
+ if (cdf->extrapolating && (dist < cdf->last_dist)) {
+ dist = cdf->last_dist;
+ }
+
+ cdf->last_dist = dist;
+ cdf->extrapolating = 1;
+
+ pout->x = (int)rint(mx + sx * dist);
+ pout->y = (int)rint(my + sy * dist);
+ pout->pro = pin->pro;
+
+ } else {
+ // We should extrapolate, but don't have an old position available
+ *pout = *pin;
+ *dirout = dirin;
+ }
+
+ if (cdf->available) {
+ int dx,dy;
+
+ dx = pout->x - cdf->last_out.x;
+ dy = pout->y - cdf->last_out.y;
+
+ if ((dx*dx + dy*dy) < CDF_MINDIST) {
+ *pout = cdf->last_out;
+ *dirout = cdf->last_dir;
+ }
+ }
+
+ cdf->last_out = *pout;
+ cdf->last_dir = *dirout;
+
+ cdf->available = 1;
+}
+#endif
+
+int
+tracking_get_angle(struct tracking *tr)
+{
+ return tr->curr_angle;
+}
+
+struct coord *
+tracking_get_pos(struct tracking *tr)
+{
+ return &tr->curr_out;
+}
+
+int
+tracking_get_street_direction(struct tracking *tr)
+{
+ return tr->street_direction;
+}
+
+int
+tracking_get_segment_pos(struct tracking *tr)
+{
+ return tr->pos;
+}
+
+struct street_data *
+tracking_get_street_data(struct tracking *tr)
+{
+ if (tr->curr_line)
+ return tr->curr_line->street;
+ return NULL;
+}
+
+int
+tracking_get_attr(struct tracking *_this, enum attr_type type, struct attr *attr, struct attr_iter *attr_iter)
+{
+ struct item *item;
+ struct map_rect *mr;
+ int result=0;
+ dbg(1,"enter %s\n",attr_to_name(type));
+ if (_this->attr) {
+ attr_free(_this->attr);
+ _this->attr=NULL;
+ }
+ switch (type) {
+ case attr_position_valid:
+ attr->u.num=_this->valid;
+ return 1;
+ case attr_position_direction:
+ attr->u.numd=&_this->direction;
+ return 1;
+ case attr_position_speed:
+ attr->u.numd=&_this->speed;
+ return 1;
+ case attr_position_coord_geo:
+ if (!_this->coord_geo_valid) {
+ struct coord c;
+ c.x=_this->curr_out.x;
+ c.y=_this->curr_out.y;
+ transform_to_geo(_this->pro, &c, &_this->coord_geo);
+ _this->coord_geo_valid=1;
+ }
+ attr->u.coord_geo=&_this->coord_geo;
+ return 1;
+ default:
+ if (! _this->curr_line || ! _this->curr_line->street)
+ return 0;
+ item=&_this->curr_line->street->item;
+ mr=map_rect_new(item->map,NULL);
+ item=map_rect_get_item_byid(mr, item->id_hi, item->id_lo);
+ if (item_attr_get(item, type, attr)) {
+ _this->attr=attr_dup(attr);
+ *attr=*_this->attr;
+ result=1;
+ }
+ map_rect_destroy(mr);
+ return result;
+ }
+}
+
+struct item *
+tracking_get_current_item(struct tracking *_this)
+{
+ if (! _this->curr_line || ! _this->curr_line->street)
+ return NULL;
+ return &_this->curr_line->street->item;
+}
+
+int *
+tracking_get_current_flags(struct tracking *_this)
+{
+ if (! _this->curr_line || ! _this->curr_line->street)
+ return NULL;
+ return &_this->curr_line->street->flags;
+}
+
+static void
+tracking_get_angles(struct tracking_line *tl)
+{
+ int i;
+ struct street_data *sd=tl->street;
+ for (i = 0 ; i < sd->count-1 ; i++)
+ tl->angle[i]=transform_get_angle_delta(&sd->c[i], &sd->c[i+1], 0);
+}
+
+static int
+street_data_within_selection(struct street_data *sd, struct map_selection *sel)
+{
+ struct coord_rect r;
+ struct map_selection *curr;
+ int i;
+
+ if (!sel)
+ return 1;
+ r.lu=sd->c[0];
+ r.rl=sd->c[0];
+ for (i = 1 ; i < sd->count ; i++) {
+ if (r.lu.x > sd->c[i].x)
+ r.lu.x=sd->c[i].x;
+ if (r.rl.x < sd->c[i].x)
+ r.rl.x=sd->c[i].x;
+ if (r.rl.y > sd->c[i].y)
+ r.rl.y=sd->c[i].y;
+ if (r.lu.y < sd->c[i].y)
+ r.lu.y=sd->c[i].y;
+ }
+ curr=sel;
+ while (curr) {
+ struct coord_rect *sr=&curr->u.c_rect;
+ if (r.lu.x <= sr->rl.x && r.rl.x >= sr->lu.x &&
+ r.lu.y >= sr->rl.y && r.rl.y <= sr->lu.y)
+ return 1;
+ curr=curr->next;
+ }
+ return 0;
+}
+
+
+static void
+tracking_doupdate_lines(struct tracking *tr, struct coord *pc, enum projection pro)
+{
+ int max_dist=1000;
+ struct map_selection *sel;
+ struct mapset_handle *h;
+ struct map *m;
+ struct map_rect *mr;
+ struct item *item;
+ struct street_data *street;
+ struct tracking_line *tl;
+ struct coord_geo g;
+ struct coord cc;
+
+ dbg(1,"enter\n");
+ h=mapset_open(tr->ms);
+ while ((m=mapset_next(h,1))) {
+ cc.x = pc->x;
+ cc.y = pc->y;
+ if (map_projection(m) != pro) {
+ transform_to_geo(pro, &cc, &g);
+ transform_from_geo(map_projection(m), &g, &cc);
+ }
+ sel = route_rect(18, &cc, &cc, 0, max_dist);
+ mr=map_rect_new(m, sel);
+ if (!mr)
+ continue;
+ while ((item=map_rect_get_item(mr))) {
+ if (item_get_default_flags(item->type)) {
+ street=street_get_data(item);
+ if (street_data_within_selection(street, sel)) {
+ tl=g_malloc(sizeof(struct tracking_line)+(street->count-1)*sizeof(int));
+ tl->street=street;
+ tracking_get_angles(tl);
+ tl->next=tr->lines;
+ tr->lines=tl;
+ } else
+ street_data_free(street);
+ }
+ }
+ map_selection_destroy(sel);
+ map_rect_destroy(mr);
+ }
+ mapset_close(h);
+ dbg(1, "exit\n");
+}
+
+
+static void
+tracking_free_lines(struct tracking *tr)
+{
+ struct tracking_line *tl=tr->lines,*next;
+ dbg(1,"enter(tr=%p)\n", tr);
+
+ while (tl) {
+ next=tl->next;
+ street_data_free(tl->street);
+ g_free(tl);
+ tl=next;
+ }
+ tr->lines=NULL;
+ tr->curr_line = NULL;
+}
+
+static int
+tracking_angle_diff(int a1, int a2, int full)
+{
+ int ret=(a1-a2)%full;
+ if (ret > full/2)
+ ret-=full;
+ if (ret < -full/2)
+ ret+=full;
+ return ret;
+}
+
+static int
+tracking_angle_abs_diff(int a1, int a2, int full)
+{
+ int ret=tracking_angle_diff(a1, a2, full);
+ if (ret < 0)
+ ret=-ret;
+ return ret;
+}
+
+static int
+tracking_angle_delta(struct tracking *tr, int vehicle_angle, int street_angle, int flags)
+{
+ int full=180,ret=360,fwd,rev;
+ struct vehicleprofile *profile=tr->vehicleprofile;
+ fwd=((flags & profile->flags_forward_mask) == profile->flags);
+ rev=((flags & profile->flags_reverse_mask) == profile->flags);
+ if (fwd || rev) {
+ if (!fwd || !rev) {
+ full=360;
+ if (rev)
+ street_angle=(street_angle+180)%360;
+ }
+ ret=tracking_angle_abs_diff(vehicle_angle, street_angle, full);
+ }
+ return ret*ret;
+}
+
+static int
+tracking_is_connected(struct coord *c1, struct coord *c2)
+{
+ if (c1[0].x == c2[0].x && c1[0].y == c2[0].y)
+ return 0;
+ if (c1[0].x == c2[1].x && c1[0].y == c2[1].y)
+ return 0;
+ if (c1[1].x == c2[0].x && c1[1].y == c2[0].y)
+ return 0;
+ if (c1[1].x == c2[1].x && c1[1].y == c2[1].y)
+ return 0;
+ return connected_pref;
+}
+
+static int
+tracking_is_no_stop(struct coord *c1, struct coord *c2)
+{
+ if (c1->x == c2->x && c1->y == c2->y)
+ return nostop_pref;
+ return 0;
+}
+
+static int
+tracking_is_on_route(struct route *rt, struct item *item)
+{
+ if (! rt)
+ return 0;
+ if (route_contains(rt, item))
+ return 0;
+ return route_pref;
+}
+
+static int
+tracking_value(struct tracking *tr, struct tracking_line *t, int offset, struct coord *lpnt, int min, int flags)
+{
+ int value=0;
+ struct street_data *sd=t->street;
+ dbg(2, "%d: (0x%x,0x%x)-(0x%x,0x%x)\n", offset, sd->c[offset].x, sd->c[offset].y, sd->c[offset+1].x, sd->c[offset+1].y);
+ if (flags & 1) {
+ struct coord c1, c2, cp;
+ c1.x = sd->c[offset].x;
+ c1.y = sd->c[offset].y;
+ c2.x = sd->c[offset+1].x;
+ c2.y = sd->c[offset+1].y;
+ cp.x = tr->curr_in.x;
+ cp.y = tr->curr_in.y;
+ value+=transform_distance_line_sq(&c1, &c2, &cp, lpnt);
+ }
+ if (value >= min)
+ return value;
+ if (flags & 2)
+ value += tracking_angle_delta(tr, tr->curr_angle, t->angle[offset], sd->flags)*angle_factor>>4;
+ if (value >= min)
+ return value;
+ if (flags & 4)
+ value += tracking_is_connected(tr->last, &sd->c[offset]);
+ if (flags & 8)
+ value += tracking_is_no_stop(lpnt, &tr->last_out);
+ if (value >= min)
+ return value;
+ if (flags & 16)
+ value += tracking_is_on_route(tr->rt, &sd->item);
+ return value;
+}
+
+
+void
+tracking_update(struct tracking *tr, struct vehicle *v, struct vehicleprofile *vehicleprofile, enum projection pro)
+{
+ struct tracking_line *t;
+ int i,value,min,time;
+ struct coord lpnt;
+ struct coord cin;
+ struct attr valid,speed_attr,direction_attr,coord_geo,lag,time_attr;
+ double speed, direction;
+ if (v)
+ tr->vehicle=v;
+ if (vehicleprofile)
+ tr->vehicleprofile=vehicleprofile;
+
+ if (! tr->vehicle)
+ return;
+ if (!vehicle_get_attr(tr->vehicle, attr_position_valid, &valid, NULL))
+ valid.u.num=attr_position_valid_valid;
+ if (valid.u.num == attr_position_valid_invalid) {
+ tr->valid=valid.u.num;
+ return;
+ }
+ if (!vehicle_get_attr(tr->vehicle, attr_position_speed, &speed_attr, NULL) ||
+ !vehicle_get_attr(tr->vehicle, attr_position_direction, &direction_attr, NULL) ||
+ !vehicle_get_attr(tr->vehicle, attr_position_coord_geo, &coord_geo, NULL) ||
+ !vehicle_get_attr(tr->vehicle, attr_position_time_iso8601, &time_attr, NULL)) {
+ dbg(0,"failed to get position data\n");
+ return;
+ }
+ time=iso8601_to_secs(time_attr.u.str);
+ speed=*speed_attr.u.numd;
+ direction=*direction_attr.u.numd;
+ tr->valid=attr_position_valid_valid;
+ transform_from_geo(pro, coord_geo.u.coord_geo, &tr->curr_in);
+ if ((speed < 3 && transform_distance(pro, &tr->last_in, &tr->curr_in) < 10 )) {
+ dbg(1,"static speed %f coord 0x%x,0x%x vs 0x%x,0x%x\n",speed,tr->last_in.x,tr->last_in.y, tr->curr_in.x, tr->curr_in.y);
+ tr->valid=attr_position_valid_static;
+ tr->speed=0;
+ return;
+ }
+ if (vehicle_get_attr(tr->vehicle, attr_lag, &lag, NULL) && lag.u.num > 0) {
+ double espeed;
+ int edirection;
+ if (time-tr->time == 1) {
+ dbg(1,"extrapolating speed from %f and %f (%f)\n",tr->speed, speed, speed-tr->speed);
+ espeed=speed+(speed-tr->speed)*lag.u.num/10;
+ dbg(1,"extrapolating angle from %f and %f (%d)\n",tr->direction, direction, tracking_angle_diff(direction,tr->direction,360));
+ edirection=direction+tracking_angle_diff(direction,tr->direction,360)*lag.u.num/10;
+ } else {
+ dbg(1,"no speed and direction extrapolation\n");
+ espeed=speed;
+ edirection=direction;
+ }
+ dbg(1,"lag %d speed %f direction %d\n",lag.u.num,espeed,edirection);
+ dbg(1,"old 0x%x,0x%x\n",tr->curr_in.x, tr->curr_in.y);
+ transform_project(pro, &tr->curr_in, espeed*lag.u.num/36, edirection, &tr->curr_in);
+ dbg(1,"new 0x%x,0x%x\n",tr->curr_in.x, tr->curr_in.y);
+ }
+ tr->time=time;
+ tr->pro=pro;
+#if 0
+
+ tracking_process_cdf(&tr->cdf, pc, &pcf, angle, &anglef, speed, fixtime);
+#endif
+ tr->curr_angle=tr->direction=direction;
+ tr->speed=speed;
+ tr->last_in=tr->curr_in;
+ tr->last_out=tr->curr_out;
+ tr->last[0]=tr->curr[0];
+ tr->last[1]=tr->curr[1];
+ if (!tr->lines || transform_distance(pro, &tr->last_updated, &tr->curr_in) > 500) {
+ dbg(1, "update\n");
+ tracking_free_lines(tr);
+ tracking_doupdate_lines(tr, &tr->curr_in, pro);
+ tr->last_updated=tr->curr_in;
+ dbg(1,"update end\n");
+ }
+
+ t=tr->lines;
+ tr->curr_line=NULL;
+ min=INT_MAX/2;
+ while (t) {
+ struct street_data *sd=t->street;
+ for (i = 0; i < sd->count-1 ; i++) {
+ value=tracking_value(tr,t,i,&lpnt,min,-1);
+ if (value < min) {
+ int angle_delta=tracking_angle_abs_diff(tr->curr_angle, t->angle[i], 360);
+ tr->curr_line=t;
+ tr->pos=i;
+ tr->curr[0]=sd->c[i];
+ tr->curr[1]=sd->c[i+1];
+ dbg(1,"lpnt.x=0x%x,lpnt.y=0x%x pos=%d %d+%d+%d+%d=%d\n", lpnt.x, lpnt.y, i,
+ transform_distance_line_sq(&sd->c[i], &sd->c[i+1], &cin, &lpnt),
+ tracking_angle_delta(tr, tr->curr_angle, t->angle[i], 0)*angle_factor,
+ tracking_is_connected(tr->last, &sd->c[i]) ? connected_pref : 0,
+ lpnt.x == tr->last_out.x && lpnt.y == tr->last_out.y ? nostop_pref : 0,
+ value
+ );
+ tr->curr_out.x=lpnt.x;
+ tr->curr_out.y=lpnt.y;
+ tr->coord_geo_valid=0;
+ if (angle_delta < 70)
+ tr->street_direction=1;
+ else if (angle_delta > 110)
+ tr->street_direction=-1;
+ else
+ tr->street_direction=0;
+ min=value;
+ }
+ }
+ t=t->next;
+ }
+ dbg(1,"tr->curr_line=%p min=%d\n", tr->curr_line, min);
+ if (!tr->curr_line || min > offroad_limit_pref) {
+ tr->curr_out=tr->curr_in;
+ tr->coord_geo_valid=0;
+ }
+ dbg(1,"found 0x%x,0x%x\n", tr->curr_out.x, tr->curr_out.y);
+}
+
+struct tracking *
+tracking_new(struct attr *parent, struct attr **attrs)
+{
+ struct tracking *this=g_new0(struct tracking, 1);
+ struct attr hist_size;
+
+ if (! attr_generic_get_attr(attrs, NULL, attr_cdf_histsize, &hist_size, NULL)) {
+ hist_size.u.num = 0;
+ }
+
+ tracking_init_cdf(&this->cdf, hist_size.u.num);
+
+ return this;
+}
+
+void
+tracking_set_mapset(struct tracking *this, struct mapset *ms)
+{
+ this->ms=ms;
+}
+
+void
+tracking_set_route(struct tracking *this, struct route *rt)
+{
+ this->rt=rt;
+}
+
+void
+tracking_destroy(struct tracking *tr)
+{
+ tracking_free_lines(tr);
+ g_free(tr);
+}
+
+struct map *
+tracking_get_map(struct tracking *this_)
+{
+ if (! this_->map)
+ this_->map=map_new(NULL, (struct attr*[]){
+ &(struct attr){attr_type,{"tracking"}},
+ &(struct attr){attr_trackingo,.u.tracking=this_},
+ &(struct attr){attr_data,{""}},
+ &(struct attr){attr_description,{"Tracking"}},
+ NULL});
+ return this_->map;
+}
+
+
+struct map_priv {
+ struct tracking *tracking;
+};
+
+struct map_rect_priv {
+ struct tracking *tracking;
+ struct item item;
+ struct tracking_line *curr,*next;
+ int coord;
+ enum attr_type attr_next;
+ int ccount;
+ int debug_idx;
+ char *str;
+};
+
+static int
+tracking_map_item_coord_get(void *priv_data, struct coord *c, int count)
+{
+ struct map_rect_priv *this=priv_data;
+ enum projection pro;
+ int ret=0;
+ dbg(1,"enter\n");
+ while (this->ccount < 2 && count > 0) {
+ pro = map_projection(this->curr->street->item.map);
+ if (projection_mg != pro) {
+ transform_from_to(&this->curr->street->c[this->ccount+this->coord],
+ pro,
+ c ,projection_mg);
+ } else
+ *c=this->curr->street->c[this->ccount+this->coord];
+ dbg(1,"coord %d 0x%x,0x%x\n",this->ccount,c->x,c->y);
+ this->ccount++;
+ ret++;
+ c++;
+ count--;
+ }
+ return ret;
+}
+
+static int
+tracking_map_item_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr)
+{
+ struct map_rect_priv *this_=priv_data;
+ attr->type=attr_type;
+ struct coord lpnt,*c;
+ struct tracking *tr=this_->tracking;
+ int value;
+
+ if (this_->str) {
+ g_free(this_->str);
+ this_->str=NULL;
+ }
+
+ switch(attr_type) {
+ case attr_debug:
+ switch(this_->debug_idx) {
+ case 0:
+ this_->debug_idx++;
+ this_->str=attr->u.str=g_strdup_printf("overall: %d",tracking_value(tr, this_->curr, this_->coord, &lpnt, INT_MAX/2, -1));
+ return 1;
+ case 1:
+ this_->debug_idx++;
+ c=&this_->curr->street->c[this_->coord];
+ value=tracking_value(tr, this_->curr, this_->coord, &lpnt, INT_MAX/2, 1);
+ this_->str=attr->u.str=g_strdup_printf("distance: (0x%x,0x%x) from (0x%x,0x%x)-(0x%x,0x%x) at (0x%x,0x%x) %d",
+ tr->curr_in.x, tr->curr_in.y,
+ c[0].x, c[0].y, c[1].x, c[1].y,
+ lpnt.x, lpnt.y, value);
+ return 1;
+ case 2:
+ this_->debug_idx++;
+ this_->str=attr->u.str=g_strdup_printf("angle: %d to %d (flags %d) %d",
+ tr->curr_angle, this_->curr->angle[this_->coord], this_->curr->street->flags & 3,
+ tracking_value(tr, this_->curr, this_->coord, &lpnt, INT_MAX/2, 2));
+ return 1;
+ case 3:
+ this_->debug_idx++;
+ this_->str=attr->u.str=g_strdup_printf("connected: %d", tracking_value(tr, this_->curr, this_->coord, &lpnt, INT_MAX/2, 4));
+ return 1;
+ case 4:
+ this_->debug_idx++;
+ this_->str=attr->u.str=g_strdup_printf("no_stop: %d", tracking_value(tr, this_->curr, this_->coord, &lpnt, INT_MAX/2, 8));
+ return 1;
+ case 5:
+ this_->debug_idx++;
+ this_->str=attr->u.str=g_strdup_printf("route: %d", tracking_value(tr, this_->curr, this_->coord, &lpnt, INT_MAX/2, 16));
+ return 1;
+ case 6:
+ this_->debug_idx++;
+ this_->str=attr->u.str=g_strdup_printf("line %p", this_->curr);
+ return 1;
+ default:
+ this_->attr_next=attr_none;
+ return 0;
+ }
+ case attr_any:
+ while (this_->attr_next != attr_none) {
+ if (tracking_map_item_attr_get(priv_data, this_->attr_next, attr))
+ return 1;
+ }
+ return 0;
+ default:
+ attr->type=attr_none;
+ return 0;
+ }
+}
+
+static struct item_methods tracking_map_item_methods = {
+ NULL,
+ tracking_map_item_coord_get,
+ NULL,
+ tracking_map_item_attr_get,
+};
+
+
+static void
+tracking_map_destroy(struct map_priv *priv)
+{
+ g_free(priv);
+}
+
+static void
+tracking_map_rect_init(struct map_rect_priv *priv)
+{
+ priv->next=priv->tracking->lines;
+ priv->curr=NULL;
+ priv->coord=0;
+ priv->item.id_lo=0;
+ priv->item.id_hi=0;
+}
+
+static struct map_rect_priv *
+tracking_map_rect_new(struct map_priv *priv, struct map_selection *sel)
+{
+ struct tracking *tracking=priv->tracking;
+ struct map_rect_priv *ret=g_new0(struct map_rect_priv, 1);
+ ret->tracking=tracking;
+ tracking_map_rect_init(ret);
+ ret->item.meth=&tracking_map_item_methods;
+ ret->item.priv_data=ret;
+ ret->item.type=type_tracking_100;
+ return ret;
+}
+
+static void
+tracking_map_rect_destroy(struct map_rect_priv *priv)
+{
+ g_free(priv);
+}
+
+static struct item *
+tracking_map_get_item(struct map_rect_priv *priv)
+{
+ struct item *ret=&priv->item;
+ int value;
+ struct coord lpnt;
+
+ if (!priv->next)
+ return NULL;
+ if (! priv->curr || priv->coord + 2 >= priv->curr->street->count) {
+ priv->curr=priv->next;
+ priv->next=priv->curr->next;
+ priv->coord=0;
+ priv->item.id_lo=0;
+ priv->item.id_hi++;
+ } else {
+ priv->coord++;
+ priv->item.id_lo++;
+ }
+ value=tracking_value(priv->tracking, priv->curr, priv->coord, &lpnt, INT_MAX/2, -1);
+ if (value < 64)
+ priv->item.type=type_tracking_100;
+ else if (value < 128)
+ priv->item.type=type_tracking_90;
+ else if (value < 256)
+ priv->item.type=type_tracking_80;
+ else if (value < 512)
+ priv->item.type=type_tracking_70;
+ else if (value < 1024)
+ priv->item.type=type_tracking_60;
+ else if (value < 2048)
+ priv->item.type=type_tracking_50;
+ else if (value < 4096)
+ priv->item.type=type_tracking_40;
+ else if (value < 8192)
+ priv->item.type=type_tracking_30;
+ else if (value < 16384)
+ priv->item.type=type_tracking_20;
+ else if (value < 32768)
+ priv->item.type=type_tracking_10;
+ else
+ priv->item.type=type_tracking_0;
+ dbg(1,"item %d %d points\n", priv->coord, priv->curr->street->count);
+ priv->ccount=0;
+ priv->attr_next=attr_debug;
+ priv->debug_idx=0;
+ return ret;
+}
+
+static struct item *
+tracking_map_get_item_byid(struct map_rect_priv *priv, int id_hi, int id_lo)
+{
+ struct item *ret;
+ tracking_map_rect_init(priv);
+ while ((ret=tracking_map_get_item(priv))) {
+ if (ret->id_hi == id_hi && ret->id_lo == id_lo)
+ return ret;
+ }
+ return NULL;
+}
+
+static struct map_methods tracking_map_meth = {
+ projection_mg,
+ "utf-8",
+ tracking_map_destroy,
+ tracking_map_rect_new,
+ tracking_map_rect_destroy,
+ tracking_map_get_item,
+ tracking_map_get_item_byid,
+ NULL,
+ NULL,
+ NULL,
+};
+
+static struct map_priv *
+tracking_map_new(struct map_methods *meth, struct attr **attrs)
+{
+ struct map_priv *ret;
+ struct attr *tracking_attr;
+
+ tracking_attr=attr_search(attrs, NULL, attr_trackingo);
+ if (! tracking_attr)
+ return NULL;
+ ret=g_new0(struct map_priv, 1);
+ *meth=tracking_map_meth;
+ ret->tracking=tracking_attr->u.tracking;
+
+ return ret;
+}
+
+
+void
+tracking_init(void)
+{
+ plugin_register_map_type("tracking", tracking_map_new);
+}
diff --git a/track.h b/track.h
new file mode 100644
index 00000000..8a8e085e
--- /dev/null
+++ b/track.h
@@ -0,0 +1,60 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_TRACK_H
+#define NAVIT_TRACK_H
+#include <time.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+/* prototypes */
+enum attr_type;
+enum projection;
+struct attr;
+struct attr_iter;
+struct coord;
+struct item;
+struct map;
+struct mapset;
+struct route;
+struct street_data;
+struct tracking;
+struct vehicle;
+struct vehicleprofile;
+int tracking_get_angle(struct tracking *tr);
+struct coord *tracking_get_pos(struct tracking *tr);
+int tracking_get_street_direction(struct tracking *tr);
+int tracking_get_segment_pos(struct tracking *tr);
+struct street_data *tracking_get_street_data(struct tracking *tr);
+int tracking_get_attr(struct tracking *_this, enum attr_type type, struct attr *attr, struct attr_iter *attr_iter);
+struct item *tracking_get_current_item(struct tracking *_this);
+int *tracking_get_current_flags(struct tracking *_this);
+void tracking_update(struct tracking *tr, struct vehicle *v, struct vehicleprofile *vehicleprofile, enum projection pro);
+struct tracking *tracking_new(struct attr *parent, struct attr **attrs);
+void tracking_set_mapset(struct tracking *this, struct mapset *ms);
+void tracking_set_route(struct tracking *this, struct route *rt);
+void tracking_destroy(struct tracking *tr);
+struct map *tracking_get_map(struct tracking *this_);
+void tracking_init(void);
+/* end of prototypes */
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/transform.c b/transform.c
new file mode 100644
index 00000000..a5e9cd10
--- /dev/null
+++ b/transform.c
@@ -0,0 +1,1287 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <math.h>
+#include <limits.h>
+#include <glib.h>
+#include <string.h>
+#include "config.h"
+#include "coord.h"
+#include "debug.h"
+#include "item.h"
+#include "map.h"
+#include "transform.h"
+#include "projection.h"
+#include "point.h"
+
+#define POST_SHIFT 8
+
+struct transformation {
+ int yaw; /* Rotation angle */
+ int pitch;
+ int ddd;
+ int m00,m01,m10,m11; /* 2d transformation matrix */
+ int xyscale;
+ int m20,m21; /* additional 3d parameters */
+#ifdef ENABLE_ROLL
+ int roll;
+ int m02,m12,m22;
+ int hog;
+ navit_float im02,im12,im20,im21,im22;
+#endif
+ navit_float im00,im01,im10,im11; /* inverse 2d transformation matrix */
+ struct map_selection *map_sel;
+ struct map_selection *screen_sel;
+ struct point screen_center;
+ int screen_dist;
+ int offx,offy,offz;
+ struct coord map_center; /* Center of source rectangle */
+ enum projection pro;
+ navit_float scale; /* Scale factor */
+ int scale_shift;
+ int order;
+ int order_base;
+};
+
+
+
+static void
+transform_setup_matrix(struct transformation *t)
+{
+ navit_float det;
+ navit_float fac;
+ navit_float yawc=navit_cos(-M_PI*t->yaw/180);
+ navit_float yaws=navit_sin(-M_PI*t->yaw/180);
+ navit_float pitchc=navit_cos(-M_PI*t->pitch/180);
+ navit_float pitchs=navit_sin(-M_PI*t->pitch/180);
+#ifdef ENABLE_ROLL
+ navit_float rollc=navit_cos(M_PI*t->roll/180);
+ navit_float rolls=navit_sin(M_PI*t->roll/180);
+#endif
+
+ int scale=t->scale;
+ int order_dir=-1;
+
+ dbg(1,"yaw=%d pitch=%d center=0x%x,0x%x\n", t->yaw, t->pitch, t->map_center.x, t->map_center.y);
+ t->scale_shift=0;
+ t->order=t->order_base;
+ if (t->scale >= 1) {
+ scale=t->scale;
+ } else {
+ scale=1.0/t->scale;
+ order_dir=1;
+ }
+ while (scale > 1) {
+ if (order_dir < 0)
+ t->scale_shift++;
+ t->order+=order_dir;
+ scale >>= 1;
+ }
+ fac=(1 << POST_SHIFT) * (1 << t->scale_shift) / t->scale;
+ dbg(1,"scale_shift=%d order=%d scale=%f fac=%f\n", t->scale_shift, t->order,t->scale,fac);
+
+#ifdef ENABLE_ROLL
+ t->m00=rollc*yawc*fac;
+ t->m01=rollc*yaws*fac;
+ t->m02=-rolls*fac;
+ t->m10=(pitchs*rolls*yawc-pitchc*yaws)*(-fac);
+ t->m11=(pitchs*rolls*yaws+pitchc*yawc)*(-fac);
+ t->m12=pitchs*rollc*(-fac);
+ t->m20=(pitchc*rolls*yawc+pitchs*yaws)*fac;
+ t->m21=(pitchc*rolls*yaws-pitchs*yawc)*fac;
+ t->m22=pitchc*rollc*fac;
+#else
+ t->m00=yawc*fac;
+ t->m01=yaws*fac;
+ t->m10=(-pitchc*yaws)*(-fac);
+ t->m11=pitchc*yawc*(-fac);
+ t->m20=pitchs*yaws*fac;
+ t->m21=(-pitchs*yawc)*fac;
+#endif
+ t->offz=0;
+ t->xyscale=1;
+ t->ddd=0;
+ t->offx=t->screen_center.x;
+ t->offy=t->screen_center.y;
+ if (t->pitch) {
+ t->ddd=1;
+ t->offz=t->screen_dist;
+ t->xyscale=t->offz;
+ }
+#ifdef ENABLE_ROLL
+ det=(navit_float)t->m00*(navit_float)t->m11*(navit_float)t->m22+
+ (navit_float)t->m01*(navit_float)t->m12*(navit_float)t->m20+
+ (navit_float)t->m02*(navit_float)t->m10*(navit_float)t->m21-
+ (navit_float)t->m02*(navit_float)t->m11*(navit_float)t->m20-
+ (navit_float)t->m01*(navit_float)t->m10*(navit_float)t->m22-
+ (navit_float)t->m00*(navit_float)t->m12*(navit_float)t->m21;
+
+ t->im00=(t->m11*t->m22-t->m12*t->m21)/det;
+ t->im01=(t->m02*t->m21-t->m01*t->m22)/det;
+ t->im02=(t->m01*t->m12-t->m02*t->m11)/det;
+ t->im10=(t->m12*t->m20-t->m10*t->m22)/det;
+ t->im11=(t->m00*t->m22-t->m02*t->m20)/det;
+ t->im12=(t->m02*t->m10-t->m00*t->m12)/det;
+ t->im20=(t->m10*t->m21-t->m11*t->m20)/det;
+ t->im21=(t->m01*t->m20-t->m00*t->m21)/det;
+ t->im22=(t->m00*t->m11-t->m01*t->m10)/det;
+#else
+ det=((navit_float)t->m00*(navit_float)t->m11-(navit_float)t->m01*(navit_float)t->m10);
+ t->im00=t->m11/det;
+ t->im01=-t->m01/det;
+ t->im10=-t->m10/det;
+ t->im11=t->m00/det;
+#endif
+}
+
+struct transformation *
+transform_new(void)
+{
+ struct transformation *this_;
+
+ this_=g_new0(struct transformation, 1);
+ this_->screen_dist=100;
+ this_->order_base=14;
+#if 0
+ this_->pitch=20;
+#endif
+#if 0
+ this_->roll=30;
+ this_->hog=1000;
+#endif
+ transform_setup_matrix(this_);
+ return this_;
+}
+
+#ifdef ENABLE_ROLL
+
+int
+transform_get_hog(struct transformation *this_)
+{
+ return this_->hog;
+}
+
+void
+transform_set_hog(struct transformation *this_, int hog)
+{
+ this_->hog=hog;
+}
+
+#else
+
+int
+transform_get_hog(struct transformation *this_)
+{
+ return 0;
+}
+
+void
+transform_set_hog(struct transformation *this_, int hog)
+{
+ dbg(0,"not supported\n");
+}
+
+#endif
+
+int
+transformation_get_order_base(struct transformation *this_)
+{
+ return this_->order_base;
+}
+
+void
+transform_set_order_base(struct transformation *this_, int order_base)
+{
+ this_->order_base=order_base;
+}
+
+
+struct transformation *
+transform_dup(struct transformation *t)
+{
+ struct transformation *ret=g_new0(struct transformation, 1);
+ *ret=*t;
+ return ret;
+}
+
+static const navit_float gar2geo_units = 360.0/(1<<24);
+static const navit_float geo2gar_units = 1/(360.0/(1<<24));
+
+void
+transform_to_geo(enum projection pro, struct coord *c, struct coord_geo *g)
+{
+ int x,y,northern,zone;
+ switch (pro) {
+ case projection_mg:
+ g->lng=c->x/6371000.0/M_PI*180;
+ g->lat=navit_atan(exp(c->y/6371000.0))/M_PI*360-90;
+ break;
+ case projection_garmin:
+ g->lng=c->x*gar2geo_units;
+ g->lat=c->y*gar2geo_units;
+ break;
+ case projection_utm:
+ x=c->x;
+ y=c->y;
+ northern=y >= 0;
+ if (!northern) {
+ y+=10000000;
+ }
+ zone=(x/1000000);
+ x=x%1000000;
+ transform_utm_to_geo(x, y, zone, northern, g);
+ break;
+ default:
+ break;
+ }
+}
+
+void
+transform_from_geo(enum projection pro, struct coord_geo *g, struct coord *c)
+{
+ switch (pro) {
+ case projection_mg:
+ c->x=g->lng*6371000.0*M_PI/180;
+ c->y=log(navit_tan(M_PI_4+g->lat*M_PI/360))*6371000.0;
+ break;
+ case projection_garmin:
+ c->x=g->lng*geo2gar_units;
+ c->y=g->lat*geo2gar_units;
+ break;
+ default:
+ break;
+ }
+}
+
+void
+transform_from_to(struct coord *cfrom, enum projection from, struct coord *cto, enum projection to)
+{
+ struct coord_geo g;
+ transform_to_geo(from, cfrom, &g);
+ transform_from_geo(to, &g, cto);
+}
+
+void
+transform_geo_to_cart(struct coord_geo *geo, navit_float a, navit_float b, struct coord_geo_cart *cart)
+{
+ navit_float n,ee=1-b*b/(a*a);
+ n = a/sqrtf(1-ee*navit_sin(geo->lat)*navit_sin(geo->lat));
+ cart->x=n*navit_cos(geo->lat)*navit_cos(geo->lng);
+ cart->y=n*navit_cos(geo->lat)*navit_sin(geo->lng);
+ cart->z=n*(1-ee)*navit_sin(geo->lat);
+}
+
+void
+transform_cart_to_geo(struct coord_geo_cart *cart, navit_float a, navit_float b, struct coord_geo *geo)
+{
+ navit_float lat,lati,n,ee=1-b*b/(a*a), lng = navit_tan(cart->y/cart->x);
+
+ lat = navit_tan(cart->z / navit_sqrt((cart->x * cart->x) + (cart->y * cart->y)));
+ do
+ {
+ lati = lat;
+
+ n = a / navit_sqrt(1-ee*navit_sin(lat)*navit_sin(lat));
+ lat = navit_atan((cart->z + ee * n * navit_sin(lat)) / navit_sqrt(cart->x * cart->x + cart->y * cart->y));
+ }
+ while (fabs(lat - lati) >= 0.000000000000001);
+
+ geo->lng=lng/M_PI*180;
+ geo->lat=lat/M_PI*180;
+}
+
+
+void
+transform_utm_to_geo(const double UTMEasting, const double UTMNorthing, int ZoneNumber, int NorthernHemisphere, struct coord_geo *geo)
+{
+//converts UTM coords to lat/long. Equations from USGS Bulletin 1532
+//East Longitudes are positive, West longitudes are negative.
+//North latitudes are positive, South latitudes are negative
+//Lat and Long are in decimal degrees.
+ //Written by Chuck Gantz- chuck.gantz@globalstar.com
+
+ double Lat, Long;
+ double k0 = 0.99960000000000004;
+ double a = 6378137;
+ double eccSquared = 0.0066943799999999998;
+ double eccPrimeSquared;
+ double e1 = (1-sqrt(1-eccSquared))/(1+sqrt(1-eccSquared));
+ double N1, T1, C1, R1, D, M;
+ double LongOrigin;
+ double mu, phi1, phi1Rad;
+ double x, y;
+ double rad2deg = 180/M_PI;
+
+ x = UTMEasting - 500000.0; //remove 500,000 meter offset for longitude
+ y = UTMNorthing;
+
+ if (!NorthernHemisphere) {
+ y -= 10000000.0;//remove 10,000,000 meter offset used for southern hemisphere
+ }
+
+ LongOrigin = (ZoneNumber - 1)*6 - 180 + 3; //+3 puts origin in middle of zone
+
+ eccPrimeSquared = (eccSquared)/(1-eccSquared);
+
+ M = y / k0;
+ mu = M/(a*(1-eccSquared/4-3*eccSquared*eccSquared/64-5*eccSquared*eccSquared*eccSquared/256));
+ phi1Rad = mu + (3*e1/2-27*e1*e1*e1/32)*sin(2*mu)
+ + (21*e1*e1/16-55*e1*e1*e1*e1/32)*sin(4*mu)
+ +(151*e1*e1*e1/96)*sin(6*mu);
+ phi1 = phi1Rad*rad2deg;
+
+ N1 = a/sqrt(1-eccSquared*sin(phi1Rad)*sin(phi1Rad));
+ T1 = tan(phi1Rad)*tan(phi1Rad);
+ C1 = eccPrimeSquared*cos(phi1Rad)*cos(phi1Rad);
+ R1 = a*(1-eccSquared)/pow(1-eccSquared*sin(phi1Rad)*sin(phi1Rad), 1.5);
+ D = x/(N1*k0);
+
+ Lat = phi1Rad - (N1*tan(phi1Rad)/R1)*(D*D/2-(5+3*T1+10*C1-4*C1*C1-9*eccPrimeSquared)*D*D*D*D/24
+ +(61+90*T1+298*C1+45*T1*T1-252*eccPrimeSquared-3*C1*C1)*D*D*D*D*D*D/720);
+ Lat = Lat * rad2deg;
+
+ Long = (D-(1+2*T1+C1)*D*D*D/6+(5-2*C1+28*T1-3*C1*C1+8*eccPrimeSquared+24*T1*T1)
+ *D*D*D*D*D/120)/cos(phi1Rad);
+ Long = LongOrigin + Long * rad2deg;
+
+ geo->lat=Lat;
+ geo->lng=Long;
+}
+
+void
+transform_datum(struct coord_geo *from, enum map_datum from_datum, struct coord_geo *to, enum map_datum to_datum)
+{
+}
+
+int
+transform(struct transformation *t, enum projection pro, struct coord *c, struct point *p, int count, int unique, int width, int *width_return)
+{
+ struct coord c1;
+ int xcn, ycn;
+ struct coord_geo g;
+ int xc, yc, zc=0, xco=0, yco=0, zco=0;
+ int xm,ym,zct;
+ int zlimit=1000;
+ int visible, visibleo=-1;
+ int i,j = 0;
+ dbg(1,"count=%d\n", count);
+ for (i=0; i < count; i++) {
+ if (pro == t->pro) {
+ xc=c[i].x;
+ yc=c[i].y;
+ } else {
+ transform_to_geo(pro, &c[i], &g);
+ transform_from_geo(t->pro, &g, &c1);
+ xc=c1.x;
+ yc=c1.y;
+ }
+ xm=xc;
+ ym=yc;
+// dbg(2,"0x%x, 0x%x - 0x%x,0x%x contains 0x%x,0x%x\n", t->r.lu.x, t->r.lu.y, t->r.rl.x, t->r.rl.y, c->x, c->y);
+// ret=coord_rect_contains(&t->r, c);
+ xc-=t->map_center.x;
+ yc-=t->map_center.y;
+ xc >>= t->scale_shift;
+ yc >>= t->scale_shift;
+#ifdef ENABLE_ROLL
+ xcn=xc*t->m00+yc*t->m01+t->hog*t->m02;
+ ycn=xc*t->m10+yc*t->m11+t->hog*t->m12;
+#else
+ xcn=xc*t->m00+yc*t->m01;
+ ycn=xc*t->m10+yc*t->m11;
+#endif
+
+ if (t->ddd) {
+#ifdef ENABLE_ROLL
+ zc=(xc*t->m20+yc*t->m21+t->hog*t->m22);
+#else
+ zc=(xc*t->m20+yc*t->m21);
+#endif
+ zct=zc;
+ zc+=t->offz << POST_SHIFT;
+ dbg(1,"zc=%d\n", zc);
+ dbg(1,"zc(%d)=xc(%d)*m20(%d)+yc(%d)*m21(%d)\n", (xc*t->m20+yc*t->m21), xc, t->m20, yc, t->m21);
+ /* visibility */
+ visible=(zc < zlimit ? 0:1);
+ dbg(1,"visible=%d old %d\n", visible, visibleo);
+ if (visible != visibleo && visibleo != -1) {
+ dbg(1,"clipping (%d,%d,%d)-(%d,%d,%d) (%d,%d,%d)\n", xcn, ycn, zc, xco, yco, zco, xco-xcn, yco-ycn, zco-zc);
+ if (zco != zc) {
+ xcn=xcn+(long long)(xco-xcn)*(zlimit-zc)/(zco-zc);
+ ycn=ycn+(long long)(yco-ycn)*(zlimit-zc)/(zco-zc);
+ }
+ dbg(1,"result (%d,%d,%d) * %d / %d\n", xcn,ycn,zc,zlimit-zc,zco-zc);
+ zc=zlimit;
+ xco=xcn;
+ yco=ycn;
+ zco=zc;
+ if (visible)
+ i--;
+ visibleo=visible;
+ } else {
+ xco=xcn;
+ yco=ycn;
+ zco=zc;
+ visibleo=visible;
+ if (! visible)
+ continue;
+ }
+ dbg(1,"zc=%d\n", zc);
+ dbg(1,"xcn %d ycn %d\n", xcn, ycn);
+ dbg(1,"%d,%d %d\n",xc,yc,zc);
+#if 0
+ dbg(0,"%d/%d=%d %d/%d=%d\n",xcn,xc,xcn/xc,ycn,yc,ycn/yc);
+#endif
+#if 1
+ xc=(long long)xcn*t->xyscale/zc;
+ yc=(long long)ycn*t->xyscale/zc;
+#else
+ xc=xcn/(1000+zc);
+ yc=ycn/(1000+zc);
+#endif
+ dbg(1,"%d,%d %d\n",xc,yc,zc);
+ } else {
+ xc=xcn;
+ yc=ycn;
+ xc>>=POST_SHIFT;
+ yc>>=POST_SHIFT;
+ }
+ xc+=t->offx;
+ yc+=t->offy;
+ dbg(1,"xc=%d yc=%d\n", xc, yc);
+ if (j == 0 || !unique || p[j-1].x != xc || p[j-1].y != yc) {
+ p[j].x=xc;
+ p[j].y=yc;
+ if (width_return) {
+ if (t->ddd)
+ width_return[j]=width*(t->offz << POST_SHIFT)/zc;
+ else
+ width_return[j]=width;
+ }
+ j++;
+ }
+ }
+ return j;
+}
+
+void
+transform_reverse(struct transformation *t, struct point *p, struct coord *c)
+{
+ double zc,xc,yc,xcn,ycn,q;
+ double offz=t->offz << POST_SHIFT;
+ xc=p->x - t->offx;
+ yc=p->y - t->offy;
+ if (t->ddd) {
+ xc/=t->xyscale;
+ yc/=t->xyscale;
+ double f00=xc*t->im00*t->m20;
+ double f01=yc*t->im01*t->m20;
+ double f10=xc*t->im10*t->m21;
+ double f11=yc*t->im11*t->m21;
+#ifdef ENABLE_ROLL
+ q=(1-f00-f01-t->im02*t->m20-f10-f11-t->im12*t->m21);
+ if (q < 0)
+ q=0.15;
+ zc=(offz*((f00+f01+f10+f11))+t->hog*t->m22)/q;
+#else
+ q=(1-f00-f01-f10-f11);
+ if (q < 0)
+ q=0.15;
+ zc=offz*(f00+f01+f10+f11)/q;
+#endif
+ xcn=xc*(zc+offz);
+ ycn=yc*(zc+offz);
+#ifdef ENABLE_ROLL
+ xc=xcn*t->im00+ycn*t->im01+zc*t->im02;
+ yc=xcn*t->im10+ycn*t->im11+zc*t->im12;
+#else
+ xc=xcn*t->im00+ycn*t->im01;
+ yc=xcn*t->im10+ycn*t->im11;
+#endif
+
+ } else {
+ xcn=xc;
+ ycn=yc;
+ xc=(xcn*t->im00+ycn*t->im01)*(1 << POST_SHIFT);
+ yc=(xcn*t->im10+ycn*t->im11)*(1 << POST_SHIFT);
+ }
+ c->x=xc*(1 << t->scale_shift)+t->map_center.x;
+ c->y=yc*(1 << t->scale_shift)+t->map_center.y;
+}
+
+enum projection
+transform_get_projection(struct transformation *this_)
+{
+ return this_->pro;
+}
+
+void
+transform_set_projection(struct transformation *this_, enum projection pro)
+{
+ this_->pro=pro;
+}
+
+static int
+min4(int v1,int v2, int v3, int v4)
+{
+ int res=v1;
+ if (v2 < res)
+ res=v2;
+ if (v3 < res)
+ res=v3;
+ if (v4 < res)
+ res=v4;
+ return res;
+}
+
+static int
+max4(int v1,int v2, int v3, int v4)
+{
+ int res=v1;
+ if (v2 > res)
+ res=v2;
+ if (v3 > res)
+ res=v3;
+ if (v4 > res)
+ res=v4;
+ return res;
+}
+
+struct map_selection *
+transform_get_selection(struct transformation *this_, enum projection pro, int order)
+{
+
+ struct map_selection *ret,*curri,*curro;
+ struct coord_geo g;
+
+ ret=map_selection_dup(this_->map_sel);
+ curri=this_->map_sel;
+ curro=ret;
+ while (curri) {
+ if (this_->pro != pro) {
+ transform_to_geo(this_->pro, &curri->u.c_rect.lu, &g);
+ transform_from_geo(pro, &g, &curro->u.c_rect.lu);
+ dbg(1,"%f,%f", g.lat, g.lng);
+ transform_to_geo(this_->pro, &curri->u.c_rect.rl, &g);
+ transform_from_geo(pro, &g, &curro->u.c_rect.rl);
+ dbg(1,": - %f,%f\n", g.lat, g.lng);
+ }
+ dbg(1,"transform rect for %d is %d,%d - %d,%d\n", pro, curro->u.c_rect.lu.x, curro->u.c_rect.lu.y, curro->u.c_rect.rl.x, curro->u.c_rect.rl.y);
+ curro->order+=order;
+ curro->range=item_range_all;
+ curri=curri->next;
+ curro=curro->next;
+ }
+ return ret;
+}
+
+struct coord *
+transform_center(struct transformation *this_)
+{
+ return &this_->map_center;
+}
+
+struct coord *
+transform_get_center(struct transformation *this_)
+{
+ return &this_->map_center;
+}
+
+void
+transform_set_center(struct transformation *this_, struct coord *c)
+{
+ this_->map_center=*c;
+}
+
+
+void
+transform_set_yaw(struct transformation *t,int yaw)
+{
+ t->yaw=yaw;
+ transform_setup_matrix(t);
+}
+
+int
+transform_get_yaw(struct transformation *this_)
+{
+ return this_->yaw;
+}
+
+void
+transform_set_pitch(struct transformation *this_,int pitch)
+{
+ this_->pitch=pitch;
+ transform_setup_matrix(this_);
+}
+int
+transform_get_pitch(struct transformation *this_)
+{
+ return this_->pitch;
+}
+
+#ifdef ENABLE_ROLL
+void
+transform_set_roll(struct transformation *this_,int roll)
+{
+ this_->roll=roll;
+ transform_setup_matrix(this_);
+}
+
+int
+transform_get_roll(struct transformation *this_)
+{
+ return this_->roll;
+}
+
+#else
+
+void
+transform_set_roll(struct transformation *this_,int roll)
+{
+ dbg(0,"not supported\n");
+}
+
+int
+transform_get_roll(struct transformation *this_)
+{
+ return 0;
+}
+
+#endif
+
+void
+transform_set_distance(struct transformation *this_,int distance)
+{
+ this_->screen_dist=distance;
+ transform_setup_matrix(this_);
+}
+
+int
+transform_get_distance(struct transformation *this_)
+{
+ return this_->screen_dist;
+}
+
+void
+transform_set_screen_selection(struct transformation *t, struct map_selection *sel)
+{
+ map_selection_destroy(t->screen_sel);
+ t->screen_sel=map_selection_dup(sel);
+ if (sel) {
+ t->screen_center.x=(sel->u.p_rect.rl.x-sel->u.p_rect.lu.x)/2;
+ t->screen_center.y=(sel->u.p_rect.rl.y-sel->u.p_rect.lu.y)/2;
+ transform_setup_matrix(t);
+ }
+}
+
+void
+transform_set_screen_center(struct transformation *t, struct point *p)
+{
+ t->screen_center=*p;
+}
+
+#if 0
+void
+transform_set_size(struct transformation *t, int width, int height)
+{
+ t->width=width;
+ t->height=height;
+}
+#endif
+
+void
+transform_get_size(struct transformation *t, int *width, int *height)
+{
+ struct point_rect *r;
+ if (t->screen_sel) {
+ r=&t->screen_sel->u.p_rect;
+ *width=r->rl.x-r->lu.x;
+ *height=r->rl.y-r->lu.y;
+ }
+}
+
+void
+transform_setup(struct transformation *t, struct pcoord *c, int scale, int yaw)
+{
+ t->pro=c->pro;
+ t->map_center.x=c->x;
+ t->map_center.y=c->y;
+ t->scale=scale/16.0;
+ transform_set_yaw(t, yaw);
+}
+
+#if 0
+
+void
+transform_setup_source_rect_limit(struct transformation *t, struct coord *center, int limit)
+{
+ t->center=*center;
+ t->scale=1;
+ t->angle=0;
+ t->r.lu.x=center->x-limit;
+ t->r.rl.x=center->x+limit;
+ t->r.rl.y=center->y-limit;
+ t->r.lu.y=center->y+limit;
+}
+#endif
+
+void
+transform_setup_source_rect(struct transformation *t)
+{
+ int i;
+ struct coord screen[4];
+ struct point screen_pnt[4];
+ struct point_rect *pr;
+ struct map_selection *ms,*msm,*next,**msm_last;
+ ms=t->map_sel;
+ while (ms) {
+ next=ms->next;
+ g_free(ms);
+ ms=next;
+ }
+ t->map_sel=NULL;
+ msm_last=&t->map_sel;
+ ms=t->screen_sel;
+ while (ms) {
+ msm=g_new0(struct map_selection, 1);
+ *msm=*ms;
+ pr=&ms->u.p_rect;
+ screen_pnt[0].x=pr->lu.x;
+ screen_pnt[0].y=pr->lu.y;
+ screen_pnt[1].x=pr->rl.x;
+ screen_pnt[1].y=pr->lu.y;
+ screen_pnt[2].x=pr->lu.x;
+ screen_pnt[2].y=pr->rl.y;
+ screen_pnt[3].x=pr->rl.x;
+ screen_pnt[3].y=pr->rl.y;
+ for (i = 0 ; i < 4 ; i++) {
+ transform_reverse(t, &screen_pnt[i], &screen[i]);
+ dbg(1,"map(%d) %d,%d=0x%x,0x%x\n", i,screen_pnt[i].x, screen_pnt[i].y, screen[i].x, screen[i].y);
+ }
+ msm->u.c_rect.lu.x=min4(screen[0].x,screen[1].x,screen[2].x,screen[3].x);
+ msm->u.c_rect.rl.x=max4(screen[0].x,screen[1].x,screen[2].x,screen[3].x);
+ msm->u.c_rect.rl.y=min4(screen[0].y,screen[1].y,screen[2].y,screen[3].y);
+ msm->u.c_rect.lu.y=max4(screen[0].y,screen[1].y,screen[2].y,screen[3].y);
+ dbg(1,"%dx%d\n", msm->u.c_rect.rl.x-msm->u.c_rect.lu.x,
+ msm->u.c_rect.lu.y-msm->u.c_rect.rl.y);
+ *msm_last=msm;
+ msm_last=&msm->next;
+ ms=ms->next;
+ }
+}
+
+long
+transform_get_scale(struct transformation *t)
+{
+ return (int)(t->scale*16);
+}
+
+void
+transform_set_scale(struct transformation *t, long scale)
+{
+ t->scale=scale/16.0;
+ transform_setup_matrix(t);
+}
+
+
+int
+transform_get_order(struct transformation *t)
+{
+ dbg(1,"order %d\n", t->order);
+ return t->order;
+}
+
+
+
+#define TWOPI (M_PI*2)
+#define GC2RAD(c) ((c) * TWOPI/(1<<24))
+#define minf(a,b) ((a) < (b) ? (a) : (b))
+
+static double
+transform_distance_garmin(struct coord *c1, struct coord *c2)
+{
+#ifdef USE_HALVESINE
+ static const int earth_radius = 6371*1000; //m change accordingly
+// static const int earth_radius = 3960; //miles
+
+//Point 1 cords
+ navit_float lat1 = GC2RAD(c1->y);
+ navit_float long1 = GC2RAD(c1->x);
+
+//Point 2 cords
+ navit_float lat2 = GC2RAD(c2->y);
+ navit_float long2 = GC2RAD(c2->x);
+
+//Haversine Formula
+ navit_float dlong = long2-long1;
+ navit_float dlat = lat2-lat1;
+
+ navit_float sinlat = navit_sin(dlat/2);
+ navit_float sinlong = navit_sin(dlong/2);
+
+ navit_float a=(sinlat*sinlat)+navit_cos(lat1)*navit_cos(lat2)*(sinlong*sinlong);
+ navit_float c=2*navit_asin(minf(1,navit_sqrt(a)));
+#ifdef AVOID_FLOAT
+ return round(earth_radius*c);
+#else
+ return earth_radius*c;
+#endif
+#else
+#define GMETER 2.3887499999999999
+ navit_float dx,dy;
+ dx=c1->x-c2->x;
+ dy=c1->y-c2->y;
+ return navit_sqrt(dx*dx+dy*dy)*GMETER;
+#undef GMETER
+#endif
+}
+
+double
+transform_scale(int y)
+{
+ struct coord c;
+ struct coord_geo g;
+ c.x=0;
+ c.y=y;
+ transform_to_geo(projection_mg, &c, &g);
+ return 1/navit_cos(g.lat/180*M_PI);
+}
+
+#ifdef AVOID_FLOAT
+static int
+tab_sqrt[]={14142,13379,12806,12364,12018,11741,11517,11333,11180,11051,10943,10850,10770,10701,10640,10587,10540,10499,10462,10429,10400,10373,10349,10327,10307,10289,10273,10257,10243,10231,10219,10208};
+
+static int tab_int_step = 0x20000;
+static int tab_int_scale[]={10000,10002,10008,10019,10033,10052,10076,10103,10135,10171,10212,10257,10306,10359,10417,10479,10546,10617,10693,10773,10858,10947,11041,11140,11243,11352,11465,11582,11705,11833,11965,12103,12246,12394,12547,12706,12870,13039,13214,13395,13581,13773,13971,14174,14384,14600,14822,15050,15285,15526,15774,16028,16289,16557,16832,17114,17404,17700,18005,18316,18636,18964,19299,19643,19995,20355,20724,21102,21489,21885,22290,22705,23129,23563,24007,24461,24926,25401,25886,26383,26891};
+
+int transform_int_scale(int y)
+{
+ int a=tab_int_step,i,size = sizeof(tab_int_scale)/sizeof(int);
+ if (y < 0)
+ y=-y;
+ i=y/tab_int_step;
+ if (i < size-1)
+ return tab_int_scale[i]+((tab_int_scale[i+1]-tab_int_scale[i])*(y-i*tab_int_step))/tab_int_step;
+ return tab_int_scale[size-1];
+}
+#endif
+
+double
+transform_distance(enum projection pro, struct coord *c1, struct coord *c2)
+{
+ if (pro == projection_mg) {
+#ifndef AVOID_FLOAT
+ double dx,dy,scale=transform_scale((c1->y+c2->y)/2);
+ dx=c1->x-c2->x;
+ dy=c1->y-c2->y;
+ return sqrt(dx*dx+dy*dy)/scale;
+#else
+ int dx,dy,f,scale=transform_int_scale((c1->y+c2->y)/2);
+ dx=c1->x-c2->x;
+ dy=c1->y-c2->y;
+ if (dx < 0)
+ dx=-dx;
+ if (dy < 0)
+ dy=-dy;
+ while (dx > 20000 || dy > 20000) {
+ dx/=10;
+ dy/=10;
+ scale/=10;
+ }
+ if (! dy)
+ return dx*10000/scale;
+ if (! dx)
+ return dy*10000/scale;
+ if (dx > dy) {
+ f=dx*8/dy-8;
+ if (f >= 32)
+ return dx*10000/scale;
+ return dx*tab_sqrt[f]/scale;
+ } else {
+ f=dy*8/dx-8;
+ if (f >= 32)
+ return dy*10000/scale;
+ return dy*tab_sqrt[f]/scale;
+ }
+#endif
+ } else if (pro == projection_garmin) {
+ return transform_distance_garmin(c1, c2);
+ } else {
+ dbg(0,"Unknown projection: %d\n", pro);
+ return 0;
+ }
+}
+
+void
+transform_project(enum projection pro, struct coord *c, int distance, int angle, struct coord *res)
+{
+ double scale;
+ switch (pro) {
+ case projection_mg:
+ scale=transform_scale(c->y);
+ res->x=c->x+distance*sin(angle*M_PI/180)*scale;
+ res->y=c->y+distance*cos(angle*M_PI/180)*scale;
+ break;
+ default:
+ dbg(0,"Unsupported projection: %d\n", pro);
+ return;
+ }
+
+}
+
+
+double
+transform_polyline_length(enum projection pro, struct coord *c, int count)
+{
+ double ret=0;
+ int i;
+
+ for (i = 0 ; i < count-1 ; i++)
+ ret+=transform_distance(pro, &c[i], &c[i+1]);
+ return ret;
+}
+
+int
+transform_distance_sq(struct coord *c1, struct coord *c2)
+{
+ int dx=c1->x-c2->x;
+ int dy=c1->y-c2->y;
+
+ if (dx > 32767 || dy > 32767 || dx < -32767 || dy < -32767)
+ return INT_MAX;
+ else
+ return dx*dx+dy*dy;
+}
+
+int
+transform_distance_sq_pc(struct pcoord *c1, struct pcoord *c2)
+{
+ struct coord p1,p2;
+ p1.x = c1->x; p1.y = c1->y;
+ p2.x = c2->x; p2.y = c2->y;
+ return transform_distance_sq(&p1, &p2);
+}
+
+int
+transform_distance_line_sq(struct coord *l0, struct coord *l1, struct coord *ref, struct coord *lpnt)
+{
+ int vx,vy,wx,wy;
+ int c1,c2;
+ int climit=1000000;
+ struct coord l;
+
+ vx=l1->x-l0->x;
+ vy=l1->y-l0->y;
+ wx=ref->x-l0->x;
+ wy=ref->y-l0->y;
+
+ c1=vx*wx+vy*wy;
+ if ( c1 <= 0 ) {
+ if (lpnt)
+ *lpnt=*l0;
+ return transform_distance_sq(l0, ref);
+ }
+ c2=vx*vx+vy*vy;
+ if ( c2 <= c1 ) {
+ if (lpnt)
+ *lpnt=*l1;
+ return transform_distance_sq(l1, ref);
+ }
+ while (c1 > climit || c2 > climit) {
+ c1/=256;
+ c2/=256;
+ }
+ l.x=l0->x+vx*c1/c2;
+ l.y=l0->y+vy*c1/c2;
+ if (lpnt)
+ *lpnt=l;
+ return transform_distance_sq(&l, ref);
+}
+
+int
+transform_distance_polyline_sq(struct coord *c, int count, struct coord *ref, struct coord *lpnt, int *pos)
+{
+ int i,dist,distn;
+ struct coord lp;
+ if (count < 2)
+ return INT_MAX;
+ if (pos)
+ *pos=0;
+ dist=transform_distance_line_sq(&c[0], &c[1], ref, lpnt);
+ for (i=2 ; i < count ; i++) {
+ distn=transform_distance_line_sq(&c[i-1], &c[i], ref, &lp);
+ if (distn < dist) {
+ dist=distn;
+ if (lpnt)
+ *lpnt=lp;
+ if (pos)
+ *pos=i-1;
+ }
+ }
+ return dist;
+}
+
+
+void
+transform_print_deg(double deg)
+{
+ printf("%2.0f:%2.0f:%2.4f", floor(deg), fmod(deg*60,60), fmod(deg*3600,60));
+}
+
+#ifdef AVOID_FLOAT
+static int tab_atan[]={0,262,524,787,1051,1317,1584,1853,2126,2401,2679,2962,3249,3541,3839,4142,4452,4770,5095,5430,5774,6128,6494,6873,7265,7673,8098,8541,9004,9490,10000,10538};
+
+static int
+atan2_int_lookup(int val)
+{
+ int len=sizeof(tab_atan)/sizeof(int);
+ int i=len/2;
+ int p=i-1;
+ for (;;) {
+ i>>=1;
+ if (val < tab_atan[p])
+ p-=i;
+ else
+ if (val < tab_atan[p+1])
+ return p+(p>>1);
+ else
+ p+=i;
+ }
+}
+
+static int
+atan2_int(int dx, int dy)
+{
+ int f,mul=1,add=0,ret;
+ if (! dx) {
+ return dy < 0 ? 180 : 0;
+ }
+ if (! dy) {
+ return dx < 0 ? -90 : 90;
+ }
+ if (dx < 0) {
+ dx=-dx;
+ mul=-1;
+ }
+ if (dy < 0) {
+ dy=-dy;
+ add=180*mul;
+ mul*=-1;
+ }
+ while (dx > 20000 || dy > 20000) {
+ dx/=10;
+ dy/=10;
+ }
+ if (dx > dy) {
+ ret=90-atan2_int_lookup(dy*10000/dx);
+ } else {
+ ret=atan2_int_lookup(dx*10000/dy);
+ }
+ return ret*mul+add;
+}
+#endif
+
+int
+transform_get_angle_delta(struct coord *c1, struct coord *c2, int dir)
+{
+ int dx=c2->x-c1->x;
+ int dy=c2->y-c1->y;
+#ifndef AVOID_FLOAT
+ double angle;
+ angle=atan2(dx,dy);
+ angle*=180/M_PI;
+#else
+ int angle;
+ angle=atan2_int(dx,dy);
+#endif
+ if (dir == -1)
+ angle=angle-180;
+ if (angle < 0)
+ angle+=360;
+ return angle;
+}
+
+int
+transform_within_border(struct transformation *this_, struct point *p, int border)
+{
+ struct map_selection *ms=this_->screen_sel;
+ while (ms) {
+ struct point_rect *r=&ms->u.p_rect;
+ if (p->x >= r->lu.x+border && p->x <= r->rl.x-border &&
+ p->y >= r->lu.y+border && p->y <= r->rl.y-border)
+ return 1;
+ ms=ms->next;
+ }
+ return 0;
+}
+
+int
+transform_within_dist_point(struct coord *ref, struct coord *c, int dist)
+{
+ if (c->x-dist > ref->x)
+ return 0;
+ if (c->x+dist < ref->x)
+ return 0;
+ if (c->y-dist > ref->y)
+ return 0;
+ if (c->y+dist < ref->y)
+ return 0;
+ if ((c->x-ref->x)*(c->x-ref->x) + (c->y-ref->y)*(c->y-ref->y) <= dist*dist)
+ return 1;
+ return 0;
+}
+
+int
+transform_within_dist_line(struct coord *ref, struct coord *c0, struct coord *c1, int dist)
+{
+ int vx,vy,wx,wy;
+ int n1,n2;
+ struct coord lc;
+
+ if (c0->x < c1->x) {
+ if (c0->x-dist > ref->x)
+ return 0;
+ if (c1->x+dist < ref->x)
+ return 0;
+ } else {
+ if (c1->x-dist > ref->x)
+ return 0;
+ if (c0->x+dist < ref->x)
+ return 0;
+ }
+ if (c0->y < c1->y) {
+ if (c0->y-dist > ref->y)
+ return 0;
+ if (c1->y+dist < ref->y)
+ return 0;
+ } else {
+ if (c1->y-dist > ref->y)
+ return 0;
+ if (c0->y+dist < ref->y)
+ return 0;
+ }
+ vx=c1->x-c0->x;
+ vy=c1->y-c0->y;
+ wx=ref->x-c0->x;
+ wy=ref->y-c0->y;
+
+ n1=vx*wx+vy*wy;
+ if ( n1 <= 0 )
+ return transform_within_dist_point(ref, c0, dist);
+ n2=vx*vx+vy*vy;
+ if ( n2 <= n1 )
+ return transform_within_dist_point(ref, c1, dist);
+
+ lc.x=c0->x+vx*n1/n2;
+ lc.y=c0->y+vy*n1/n2;
+ return transform_within_dist_point(ref, &lc, dist);
+}
+
+int
+transform_within_dist_polyline(struct coord *ref, struct coord *c, int count, int close, int dist)
+{
+ int i;
+ for (i = 0 ; i < count-1 ; i++) {
+ if (transform_within_dist_line(ref,c+i,c+i+1,dist)) {
+ return 1;
+ }
+ }
+ if (close)
+ return (transform_within_dist_line(ref,c,c+count-1,dist));
+ return 0;
+}
+
+int
+transform_within_dist_polygon(struct coord *ref, struct coord *c, int count, int dist)
+{
+ int i, j, ci = 0;
+ for (i = 0, j = count-1; i < count; j = i++) {
+ if ((((c[i].y <= ref->y) && ( ref->y < c[j].y )) ||
+ ((c[j].y <= ref->y) && ( ref->y < c[i].y))) &&
+ (ref->x < (c[j].x - c[i].x) * (ref->y - c[i].y) / (c[j].y - c[i].y) + c[i].x))
+ ci = !ci;
+ }
+ if (! ci) {
+ if (dist)
+ return transform_within_dist_polyline(ref, c, count, dist, 1);
+ else
+ return 0;
+ }
+ return 1;
+}
+
+int
+transform_within_dist_item(struct coord *ref, enum item_type type, struct coord *c, int count, int dist)
+{
+ if (type < type_line)
+ return transform_within_dist_point(ref, c, dist);
+ if (type < type_area)
+ return transform_within_dist_polyline(ref, c, count, 0, dist);
+ return transform_within_dist_polygon(ref, c, count, dist);
+}
+
+void
+transform_destroy(struct transformation *t)
+{
+ g_free(t);
+}
+
+
+/*
+Note: there are many mathematically equivalent ways to express these formulas. As usual, not all of them are computationally equivalent.
+
+L = latitude in radians (positive north)
+Lo = longitude in radians (positive east)
+E = easting (meters)
+N = northing (meters)
+
+For the sphere
+
+E = r Lo
+N = r ln [ tan (pi/4 + L/2) ]
+
+where
+
+r = radius of the sphere (meters)
+ln() is the natural logarithm
+
+For the ellipsoid
+
+E = a Lo
+N = a * ln ( tan (pi/4 + L/2) * ( (1 - e * sin (L)) / (1 + e * sin (L))) ** (e/2) )
+
+
+ e
+ -
+ pi L 1 - e sin(L) 2
+ = a ln( tan( ---- + ---) (--------------) )
+ 4 2 1 + e sin(L)
+
+
+where
+
+a = the length of the semi-major axis of the ellipsoid (meters)
+e = the first eccentricity of the ellipsoid
+
+
+*/
+
+
diff --git a/transform.h b/transform.h
new file mode 100644
index 00000000..ee617d72
--- /dev/null
+++ b/transform.h
@@ -0,0 +1,98 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_TRANSFORM_H
+#define NAVIT_TRANSFORM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "coord.h"
+
+/* prototypes */
+enum item_type;
+enum map_datum;
+enum projection;
+struct coord;
+struct coord_geo;
+struct coord_geo_cart;
+struct map_selection;
+struct pcoord;
+struct point;
+struct transformation;
+struct transformation *transform_new(void);
+int transform_get_hog(struct transformation *this_);
+void transform_set_hog(struct transformation *this_, int hog);
+int transformation_get_order_base(struct transformation *this_);
+void transform_set_order_base(struct transformation *this_, int order_base);
+struct transformation *transform_dup(struct transformation *t);
+void transform_to_geo(enum projection pro, struct coord *c, struct coord_geo *g);
+void transform_from_geo(enum projection pro, struct coord_geo *g, struct coord *c);
+void transform_from_to(struct coord *cfrom, enum projection from, struct coord *cto, enum projection to);
+void transform_geo_to_cart(struct coord_geo *geo, navit_float a, navit_float b, struct coord_geo_cart *cart);
+void transform_cart_to_geo(struct coord_geo_cart *cart, navit_float a, navit_float b, struct coord_geo *geo);
+void transform_utm_to_geo(const double UTMEasting, const double UTMNorthing, int ZoneNumber, int NorthernHemisphere, struct coord_geo *geo);
+void transform_datum(struct coord_geo *from, enum map_datum from_datum, struct coord_geo *to, enum map_datum to_datum);
+int transform(struct transformation *t, enum projection pro, struct coord *c, struct point *p, int count, int unique, int width, int *width_return);
+void transform_reverse(struct transformation *t, struct point *p, struct coord *c);
+enum projection transform_get_projection(struct transformation *this_);
+void transform_set_projection(struct transformation *this_, enum projection pro);
+struct map_selection *transform_get_selection(struct transformation *this_, enum projection pro, int order);
+struct coord *transform_center(struct transformation *this_);
+struct coord *transform_get_center(struct transformation *this_);
+void transform_set_center(struct transformation *this_, struct coord *c);
+void transform_set_yaw(struct transformation *t, int yaw);
+int transform_get_yaw(struct transformation *this_);
+void transform_set_pitch(struct transformation *this_, int pitch);
+int transform_get_pitch(struct transformation *this_);
+void transform_set_roll(struct transformation *this_, int roll);
+int transform_get_roll(struct transformation *this_);
+void transform_set_distance(struct transformation *this_, int distance);
+int transform_get_distance(struct transformation *this_);
+void transform_set_screen_selection(struct transformation *t, struct map_selection *sel);
+void transform_set_screen_center(struct transformation *t, struct point *p);
+void transform_get_size(struct transformation *t, int *width, int *height);
+void transform_setup(struct transformation *t, struct pcoord *c, int scale, int yaw);
+void transform_setup_source_rect(struct transformation *t);
+long transform_get_scale(struct transformation *t);
+void transform_set_scale(struct transformation *t, long scale);
+int transform_get_order(struct transformation *t);
+double transform_scale(int y);
+double transform_distance(enum projection pro, struct coord *c1, struct coord *c2);
+void transform_project(enum projection pro, struct coord *c, int distance, int angle, struct coord *res);
+double transform_polyline_length(enum projection pro, struct coord *c, int count);
+int transform_distance_sq(struct coord *c1, struct coord *c2);
+int transform_distance_sq_pc(struct pcoord *c1, struct pcoord *c2);
+int transform_distance_line_sq(struct coord *l0, struct coord *l1, struct coord *ref, struct coord *lpnt);
+int transform_distance_polyline_sq(struct coord *c, int count, struct coord *ref, struct coord *lpnt, int *pos);
+void transform_print_deg(double deg);
+int transform_get_angle_delta(struct coord *c1, struct coord *c2, int dir);
+int transform_within_border(struct transformation *this_, struct point *p, int border);
+int transform_within_dist_point(struct coord *ref, struct coord *c, int dist);
+int transform_within_dist_line(struct coord *ref, struct coord *c0, struct coord *c1, int dist);
+int transform_within_dist_polyline(struct coord *ref, struct coord *c, int count, int close, int dist);
+int transform_within_dist_polygon(struct coord *ref, struct coord *c, int count, int dist);
+int transform_within_dist_item(struct coord *ref, enum item_type type, struct coord *c, int count, int dist);
+void transform_destroy(struct transformation *t);
+/* end of prototypes */
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/types.h b/types.h
new file mode 100644
index 00000000..60d297f3
--- /dev/null
+++ b/types.h
@@ -0,0 +1,31 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_TYPES_H
+#define NAVIT_TYPES_H
+#include <stdint.h>
+
+typedef int8_t s8;
+typedef uint8_t u8;
+typedef int16_t s16;
+typedef uint16_t u16;
+typedef int32_t s32;
+typedef uint32_t u32;
+
+#endif
diff --git a/util.c b/util.c
new file mode 100644
index 00000000..7116d61c
--- /dev/null
+++ b/util.c
@@ -0,0 +1,314 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include "util.h"
+
+void
+strtoupper(char *dest, const char *src)
+{
+ while (*src)
+ *dest++=toupper(*src++);
+ *dest='\0';
+}
+
+void
+strtolower(char *dest, const char *src)
+{
+ while (*src)
+ *dest++=tolower(*src++);
+ *dest='\0';
+}
+
+
+static void
+hash_callback(gpointer key, gpointer value, gpointer user_data)
+{
+ GList **l=user_data;
+ *l=g_list_prepend(*l, value);
+}
+
+GList *
+g_hash_to_list(GHashTable *h)
+{
+ GList *ret=NULL;
+ g_hash_table_foreach(h, hash_callback, &ret);
+
+ return ret;
+}
+
+static void
+hash_callback_key(gpointer key, gpointer value, gpointer user_data)
+{
+ GList **l=user_data;
+ *l=g_list_prepend(*l, key);
+}
+
+GList *
+g_hash_to_list_keys(GHashTable *h)
+{
+ GList *ret=NULL;
+ g_hash_table_foreach(h, hash_callback_key, &ret);
+
+ return ret;
+}
+
+gchar *
+g_strconcat_printf(gchar *buffer, gchar *fmt, ...)
+{
+ gchar *str,*ret;
+ va_list ap;
+
+ va_start(ap, fmt);
+ str=g_strdup_vprintf(fmt, ap);
+ va_end(ap);
+ if (! buffer)
+ return str;
+ ret=g_strconcat(buffer, str, NULL);
+ g_free(buffer);
+ g_free(str);
+ return ret;
+}
+
+#ifndef HAVE_GLIB
+int g_utf8_strlen_force_link(gchar *buffer, int max);
+int
+g_utf8_strlen_force_link(gchar *buffer, int max)
+{
+ return g_utf8_strlen(buffer, max);
+}
+#endif
+
+#if defined(_WIN32) || defined(__CEGCC__)
+#include <windows.h>
+#endif
+
+#if defined(_WIN32) || defined(__CEGCC__) || defined (__APPLE__)
+#include <stdio.h>
+char *stristr(const char *String, const char *Pattern)
+{
+ char *pptr, *sptr, *start;
+
+ for (start = (char *)String; *start != (int)NULL; start++)
+ {
+ /* find start of pattern in string */
+ for ( ; ((*start!=(int)NULL) && (toupper(*start) != toupper(*Pattern))); start++)
+ ;
+ if ((int)NULL == *start)
+ return NULL;
+
+ pptr = (char *)Pattern;
+ sptr = (char *)start;
+
+ while (toupper(*sptr) == toupper(*pptr))
+ {
+ sptr++;
+ pptr++;
+
+ /* if end of pattern then pattern was found */
+
+ if ((int)NULL == *pptr)
+ return (start);
+ }
+ }
+ return NULL;
+}
+
+#ifndef SIZE_MAX
+# define SIZE_MAX ((size_t) -1)
+#endif
+#ifndef SSIZE_MAX
+# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
+#endif
+#if !HAVE_FLOCKFILE
+# undef flockfile
+# define flockfile(x) ((void) 0)
+#endif
+#if !HAVE_FUNLOCKFILE
+# undef funlockfile
+# define funlockfile(x) ((void) 0)
+#endif
+
+/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */
+#ifndef EOVERFLOW
+# define EOVERFLOW E2BIG
+#endif
+
+/* Read up to (and including) a DELIMITER from FP into *LINEPTR (and
+ NUL-terminate it). *LINEPTR is a pointer returned from malloc (or
+ NULL), pointing to *N characters of space. It is realloc'ed as
+ necessary. Returns the number of characters read (not including
+ the null terminator), or -1 on error or EOF. */
+
+int
+getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
+{
+ int result;
+ size_t cur_len = 0;
+
+ if (lineptr == NULL || n == NULL || fp == NULL)
+ {
+ return -1;
+ }
+
+ flockfile (fp);
+
+ if (*lineptr == NULL || *n == 0)
+ {
+ *n = 120;
+ *lineptr = (char *) realloc (*lineptr, *n);
+ if (*lineptr == NULL)
+ {
+ result = -1;
+ goto unlock_return;
+ }
+ }
+
+ for (;;)
+ {
+ int i;
+
+ i = getc (fp);
+ if (i == EOF)
+ {
+ result = -1;
+ break;
+ }
+
+ /* Make enough space for len+1 (for final NUL) bytes. */
+ if (cur_len + 1 >= *n)
+ {
+ size_t needed_max =
+ SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
+ size_t needed = 2 * *n + 1; /* Be generous. */
+ char *new_lineptr;
+
+ if (needed_max < needed)
+ needed = needed_max;
+ if (cur_len + 1 >= needed)
+ {
+ result = -1;
+ goto unlock_return;
+ }
+
+ new_lineptr = (char *) realloc (*lineptr, needed);
+ if (new_lineptr == NULL)
+ {
+ result = -1;
+ goto unlock_return;
+ }
+
+ *lineptr = new_lineptr;
+ *n = needed;
+ }
+
+ (*lineptr)[cur_len] = i;
+ cur_len++;
+
+ if (i == delimiter)
+ break;
+ }
+ (*lineptr)[cur_len] = '\0';
+ result = cur_len ? cur_len : result;
+
+ unlock_return:
+ funlockfile (fp); /* doesn't set errno */
+
+ return result;
+}
+
+int
+getline (char **lineptr, size_t *n, FILE *stream)
+{
+ return getdelim (lineptr, n, '\n', stream);
+}
+
+#if defined(_UNICODE)
+wchar_t* newSysString(const char *toconvert)
+{
+ int newstrlen = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, toconvert, -1, 0, 0);
+ wchar_t *newstring = g_new(wchar_t,newstrlen);
+ MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, toconvert, -1, newstring, newstrlen) ;
+ return newstring;
+}
+#else
+char * newSysString(const char *toconvert)
+{
+ return g_strdup(toconvert);
+}
+#endif
+#endif
+
+unsigned int
+iso8601_to_secs(char *iso8601)
+{
+ int a,b,d,val[6],i=0;
+ char *start=iso8601,*pos=iso8601;
+ while (*pos && i < 6) {
+ if (*pos < '0' || *pos > '9') {
+ val[i++]=atoi(start);
+ pos++;
+ start=pos;
+ }
+ pos++;
+ }
+
+ a=val[0]/100;
+ b=2-a+a/4;
+
+ if (val[1] < 2) {
+ val[0]--;
+ val[1]+=12;
+ }
+
+ d=1461*(val[0]+4716)/4+306001*(val[1]+1)/10000+val[2]+b-2442112;
+
+ return ((d*24+val[3])*60+val[4])*60+val[5];
+}
+
+char *
+current_to_iso8601(void)
+{
+ char buffer[32];
+ char *timep=NULL;
+#ifdef HAVE_GLIB
+ GTimeVal time;
+ g_get_current_time(&time);
+ timep = g_time_val_to_iso8601(&time);
+#else
+#ifdef HAVE_API_WIN32_BASE
+ SYSTEMTIME ST;
+ GetSystemTime(&ST);
+ timep=g_strdup_printf("%d-%02d-%02dT%02d:%02d:%02dZ",ST.wYear,ST.wMonth,ST.wDay,ST.wHour,ST.wMinute,ST.wSecond);
+#else
+ time_t tnow;
+ struct tm *tm;
+ tnow = time(0);
+ tm = gmtime(&tnow);
+ if (tm) {
+ strftime(buffer, sizeof(buffer), "%Y-%m-%dT%TZ", tm);
+ timep=g_strdup(buffer);
+ }
+#endif
+#endif
+ return timep;
+}
diff --git a/util.h b/util.h
new file mode 100644
index 00000000..b578e282
--- /dev/null
+++ b/util.h
@@ -0,0 +1,40 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_types_H
+#define NAVIT_types_H
+
+#include <ctype.h>
+
+void strtoupper(char *dest, const char *src);
+void strtolower(char *dest, const char *src);
+GList * g_hash_to_list(GHashTable *h);
+GList * g_hash_to_list_keys(GHashTable *h);
+gchar * g_strconcat_printf(gchar *buffer, gchar *fmt, ...);
+#if defined(_WIN32) || defined(__CEGCC__) || defined (__APPLE__)
+#if defined(_UNICODE)
+wchar_t* newSysString(const char *toconvert);
+#else
+char * newSysString(const char *toconvert);
+#endif
+#endif
+unsigned int iso8601_to_secs(char *iso8601);
+char * current_to_iso8601(void);
+#endif
+
diff --git a/vehicle.c b/vehicle.c
new file mode 100644
index 00000000..38c80a56
--- /dev/null
+++ b/vehicle.c
@@ -0,0 +1,245 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+#include <time.h>
+#include "config.h"
+#include "debug.h"
+#include "coord.h"
+#include "item.h"
+#include "log.h"
+#include "callback.h"
+#include "plugin.h"
+#include "vehicle.h"
+#include "util.h"
+
+struct vehicle {
+ struct vehicle_priv *priv;
+ struct vehicle_methods meth;
+ struct callback_list *cbl;
+ struct log *nmea_log, *gpx_log;
+ struct attr **attrs;
+};
+
+static void
+vehicle_log_nmea(struct vehicle *this_, struct log *log)
+{
+ struct attr pos_attr;
+ if (!this_->meth.position_attr_get)
+ return;
+ if (!this_->meth.position_attr_get(this_->priv, attr_position_nmea, &pos_attr))
+ return;
+ log_write(log, pos_attr.u.str, strlen(pos_attr.u.str));
+}
+
+static void
+vehicle_log_gpx(struct vehicle *this_, struct log *log)
+{
+ struct attr pos_attr;
+ struct attr time_attr;
+ struct attr *profile_attr;
+ char *timep;
+ int free=0;
+
+ if (!this_->meth.position_attr_get)
+ return;
+ if (!this_->meth.position_attr_get(this_->priv, attr_position_coord_geo, &pos_attr))
+ return;
+ if (!this_->meth.position_attr_get(this_->priv, attr_position_time_iso8601, &time_attr)) {
+ timep = current_to_iso8601();
+ free=1;
+ } else {
+ timep = time_attr.u.str;
+ }
+
+ // get the profile name attribute
+ profile_attr = attr_search(this_->attrs, NULL, attr_profilename);
+
+ log_printf(log,
+ "<trkpt lat=\"%f\" lon=\"%f\">\n"
+ "\t<time>%s</time>\n"
+ "\t<extensions><navit:profilename>%s</navit:profilename></extensions>\n"
+ "</trkpt>\n",
+ pos_attr.u.coord_geo->lat,
+ pos_attr.u.coord_geo->lng,
+ timep,
+ profile_attr->u.str
+ );
+
+ if (free)
+ g_free(timep);
+}
+
+static void
+vehicle_log_textfile(struct vehicle *this_, struct log *log)
+{
+ struct attr pos_attr;
+ char buffer[256];
+ if (!this_->meth.position_attr_get)
+ return;
+ if (!this_->meth.position_attr_get(this_->priv, attr_position_coord_geo, &pos_attr))
+ return;
+ sprintf(buffer,"%f %f type=trackpoint\n", pos_attr.u.coord_geo->lng, pos_attr.u.coord_geo->lat);
+ log_write(log, buffer, strlen(buffer));
+}
+
+static int
+vehicle_add_log(struct vehicle *this_, struct log *log)
+{
+ struct callback *cb;
+ struct attr type_attr;
+ if (!log_get_attr(log, attr_type, &type_attr, NULL))
+ return 1;
+
+ if (!strcmp(type_attr.u.str, "nmea")) {
+ cb=callback_new_2(callback_cast(vehicle_log_nmea), this_, log);
+ } else if (!strcmp(type_attr.u.str, "gpx")) {
+ char *header = "<?xml version='1.0' encoding='UTF-8'?>\n"
+ "<gpx version='1.1' creator='Navit http://navit.sourceforge.net'\n"
+ " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'\n"
+ " xmlns:navit='http://www.navit-project.org/schema/navit'\n"
+ " xmlns='http://www.topografix.com/GPX/1/1'\n"
+ " xsi:schemaLocation='http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd'>\n"
+ "<trk>\n"
+ "<trkseg>\n";
+ char *trailer = "</trkseg>\n</trk>\n</gpx>\n";
+ log_set_header(log, header, strlen(header));
+ log_set_trailer(log, trailer, strlen(trailer));
+ cb=callback_new_2(callback_cast(vehicle_log_gpx), this_, log);
+ } else if (!strcmp(type_attr.u.str, "textfile")) {
+ char *header = "type=track\n";
+ log_set_header(log, header, strlen(header));
+ cb=callback_new_2(callback_cast(vehicle_log_textfile), this_, log);
+ } else
+ return 1;
+ callback_list_add(this_->cbl, cb);
+ return 0;
+}
+
+struct vehicle *
+vehicle_new(struct attr *parent, struct attr **attrs)
+{
+ struct vehicle *this_;
+ struct attr *source;
+ struct vehicle_priv *(*vehicletype_new) (struct vehicle_methods *
+ meth,
+ struct callback_list *
+ cbl,
+ struct attr ** attrs);
+ char *type, *colon;
+
+ dbg(1, "enter\n");
+ source = attr_search(attrs, NULL, attr_source);
+ if (!source) {
+ dbg(0, "no source\n");
+ return NULL;
+ }
+
+ type = g_strdup(source->u.str);
+ colon = strchr(type, ':');
+ if (colon)
+ *colon = '\0';
+ dbg(1, "source='%s' type='%s'\n", source->u.str, type);
+
+ vehicletype_new = plugin_get_vehicle_type(type);
+ if (!vehicletype_new) {
+ dbg(0, "invalid type '%s'\n", type);
+ return NULL;
+ }
+ this_ = g_new0(struct vehicle, 1);
+ this_->cbl = callback_list_new();
+ this_->priv = vehicletype_new(&this_->meth, this_->cbl, attrs);
+ if (!this_->priv) {
+ dbg(0, "vehicletype_new failed\n");
+ callback_list_destroy(this_->cbl);
+ g_free(this_);
+ return NULL;
+ }
+ this_->attrs=attr_list_dup(attrs);
+ dbg(1, "leave\n");
+
+ return this_;
+}
+
+int
+vehicle_get_attr(struct vehicle *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
+{
+ int ret;
+ if (this_->meth.position_attr_get) {
+ ret=this_->meth.position_attr_get(this_->priv, type, attr);
+ if (ret)
+ return ret;
+ }
+ return attr_generic_get_attr(this_->attrs, NULL, type, attr, iter);
+}
+
+int
+vehicle_set_attr(struct vehicle *this_, struct attr *attr,
+ struct attr **attrs)
+{
+ int ret=1;
+ if (this_->meth.set_attr)
+ ret=this_->meth.set_attr(this_->priv, attr, attrs);
+ if (ret == 1 && attr->type != attr_navit)
+ this_->attrs=attr_generic_set_attr(this_->attrs, attr);
+ return ret != 0;
+}
+
+int
+vehicle_add_attr(struct vehicle *this_, struct attr *attr)
+{
+ int ret=1;
+ switch (attr->type) {
+ case attr_callback:
+ callback_list_add(this_->cbl, attr->u.callback);
+ break;
+ case attr_log:
+ ret=vehicle_add_log(this_, attr->u.log);
+ break;
+ default:
+ break;
+ }
+ if (ret)
+ this_->attrs=attr_generic_add_attr(this_->attrs, attr);
+ return ret;
+}
+
+int
+vehicle_remove_attr(struct vehicle *this_, struct attr *attr)
+{
+ switch (attr->type) {
+ case attr_callback:
+ callback_list_remove(this_->cbl, attr->u.callback);
+ break;
+ default:
+ return 0;
+ }
+ return 1;
+}
+
+void
+vehicle_destroy(struct vehicle *this_)
+{
+ this_->meth.destroy(this_->priv);
+ callback_list_destroy(this_->cbl);
+ attr_list_free(this_->attrs);
+ g_free(this_);
+}
diff --git a/vehicle.h b/vehicle.h
new file mode 100644
index 00000000..455e2d60
--- /dev/null
+++ b/vehicle.h
@@ -0,0 +1,51 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_VEHICLE_H
+#define NAVIT_VEHICLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+struct vehicle;
+struct vehicle_priv;
+enum attr_type;
+struct attr;
+
+struct vehicle_methods {
+ void (*destroy)(struct vehicle_priv *priv);
+ int (*position_attr_get)(struct vehicle_priv *priv, enum attr_type type, struct attr *attr);
+ int (*set_attr)(struct vehicle_priv *priv, struct attr *attr, struct attr **attrs);
+
+};
+
+/* prototypes */
+struct vehicle *vehicle_new(struct attr *parent, struct attr **attrs);
+int vehicle_get_attr(struct vehicle *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
+int vehicle_set_attr(struct vehicle *this_, struct attr *attr, struct attr **attrs);
+int vehicle_add_attr(struct vehicle *this_, struct attr *attr);
+int vehicle_remove_attr(struct vehicle *this_, struct attr *attr);
+void vehicle_destroy(struct vehicle *this_);
+/* end of prototypes */
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/vehicle/Makefile.am b/vehicle/Makefile.am
new file mode 100644
index 00000000..08a9da9d
--- /dev/null
+++ b/vehicle/Makefile.am
@@ -0,0 +1,16 @@
+SUBDIRS=
+if VEHICLE_DEMO
+ SUBDIRS += demo
+endif
+if VEHICLE_FILE
+ SUBDIRS += file
+endif
+if VEHICLE_GPSD
+ SUBDIRS += gpsd
+endif
+if VEHICLE_GYPSY
+ SUBDIRS += gypsy
+endif
+if VEHICLE_WINCE
+ SUBDIRS += wince
+endif
diff --git a/vehicle/demo/Makefile.am b/vehicle/demo/Makefile.am
new file mode 100644
index 00000000..608e9d0b
--- /dev/null
+++ b/vehicle/demo/Makefile.am
@@ -0,0 +1,5 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=vehicle_demo
+modulevehicle_LTLIBRARIES = libvehicle_demo.la
+libvehicle_demo_la_SOURCES = vehicle_demo.c
+libvehicle_demo_la_LDFLAGS = -module -avoid-version
diff --git a/vehicle/demo/vehicle_demo.c b/vehicle/demo/vehicle_demo.c
new file mode 100644
index 00000000..ebc72d6a
--- /dev/null
+++ b/vehicle/demo/vehicle_demo.c
@@ -0,0 +1,206 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "config.h"
+#include "debug.h"
+#include "coord.h"
+#include "item.h"
+#include "navit.h"
+#include "map.h"
+#include "route.h"
+#include "callback.h"
+#include "transform.h"
+#include "plugin.h"
+#include "vehicle.h"
+#include "event.h"
+#include "util.h"
+
+struct vehicle_priv {
+ int interval;
+ int position_set;
+ struct callback_list *cbl;
+ struct navit *navit;
+ struct coord_geo geo;
+ struct coord last;
+ double config_speed;
+ double speed;
+ double direction;
+ struct callback *timer_callback;
+ struct event_timeout *timer;
+ char *timep;
+
+};
+
+static void
+vehicle_demo_destroy(struct vehicle_priv *priv)
+{
+ g_free(priv);
+}
+
+static int
+vehicle_demo_position_attr_get(struct vehicle_priv *priv,
+ enum attr_type type, struct attr *attr)
+{
+ switch (type) {
+ case attr_position_speed:
+ attr->u.numd = &priv->speed;
+ break;
+ case attr_position_direction:
+ attr->u.numd = &priv->direction;
+ break;
+ case attr_position_coord_geo:
+ attr->u.coord_geo = &priv->geo;
+ break;
+ case attr_position_time_iso8601:
+ g_free(priv->timep);
+ priv->timep=current_to_iso8601();
+ attr->u.str=priv->timep;
+ break;
+ default:
+ return 0;
+ }
+ attr->type = type;
+ return 1;
+}
+
+static int
+vehicle_demo_set_attr(struct vehicle_priv *priv, struct attr *attr,
+ struct attr **attrs)
+{
+ if (attr->type == attr_navit)
+ priv->navit = attr->u.navit;
+ return 1;
+}
+
+struct vehicle_methods vehicle_demo_methods = {
+ vehicle_demo_destroy,
+ vehicle_demo_position_attr_get,
+ vehicle_demo_set_attr,
+};
+
+static void
+vehicle_demo_timer(struct vehicle_priv *priv)
+{
+ struct coord c, c2, pos, ci;
+ int slen, len, dx, dy;
+ struct route *route=NULL;
+ struct map *route_map=NULL;
+ struct map_rect *mr=NULL;
+ struct item *item=NULL;
+
+ len = (priv->config_speed * priv->interval / 1000)/ 3.6;
+ dbg(1, "###### Entering simulation loop\n");
+ if (priv->navit)
+ route=navit_get_route(priv->navit);
+ if (route)
+ route_map=route_get_map(route);
+ if (route_map)
+ mr=map_rect_new(route_map, NULL);
+ if (mr)
+ item=map_rect_get_item(mr);
+ if (item && item->type == type_route_start)
+ item=map_rect_get_item(mr);
+ if (item && item_coord_get(item, &pos, 1)) {
+ priv->position_set=0;
+ dbg(1, "current pos=0x%x,0x%x\n", pos.x, pos.y);
+ dbg(1, "last pos=0x%x,0x%x\n", priv->last.x, priv->last.y);
+ if (priv->last.x == pos.x && priv->last.y == pos.y) {
+ dbg(1, "endless loop\n");
+ }
+ priv->last = pos;
+ while (item && priv->config_speed) {
+ if (!item_coord_get(item, &c, 1)) {
+ item=map_rect_get_item(mr);
+ continue;
+ }
+ dbg(1, "next pos=0x%x,0x%x\n", c.x, c.y);
+ slen = transform_distance(projection_mg, &pos, &c);
+ dbg(1, "len=%d slen=%d\n", len, slen);
+ if (slen < len) {
+ len -= slen;
+ pos = c;
+ } else {
+ if (item_coord_get(item, &c2, 1) || map_rect_get_item(mr)) {
+ dx = c.x - pos.x;
+ dy = c.y - pos.y;
+ ci.x = pos.x + dx * len / slen;
+ ci.y = pos.y + dy * len / slen;
+ priv->direction =
+ transform_get_angle_delta(&pos, &c, 0);
+ priv->speed=priv->config_speed;
+ } else {
+ ci.x = pos.x;
+ ci.y = pos.y;
+ priv->speed=0;
+ dbg(0,"destination reached\n");
+ }
+ dbg(1, "ci=0x%x,0x%x\n", ci.x, ci.y);
+ transform_to_geo(projection_mg, &ci,
+ &priv->geo);
+ callback_list_call_0(priv->cbl);
+ break;
+ }
+ }
+ } else {
+ if (priv->position_set)
+ callback_list_call_0(priv->cbl);
+ }
+ if (mr)
+ map_rect_destroy(mr);
+}
+
+
+
+static struct vehicle_priv *
+vehicle_demo_new(struct vehicle_methods
+ *meth, struct callback_list
+ *cbl, struct attr **attrs)
+{
+ struct vehicle_priv *ret;
+ struct attr *interval,*speed,*position_coord_geo;
+
+ dbg(1, "enter\n");
+ ret = g_new0(struct vehicle_priv, 1);
+ ret->cbl = cbl;
+ ret->interval=1000;
+ ret->config_speed=40;
+ if ((speed=attr_search(attrs, NULL, attr_speed))) {
+ ret->config_speed=speed->u.num;
+ }
+ if ((interval=attr_search(attrs, NULL, attr_interval)))
+ ret->interval=interval->u.num;
+ if ((position_coord_geo=attr_search(attrs, NULL, attr_position_coord_geo))) {
+ ret->geo=*(position_coord_geo->u.coord_geo);
+ ret->position_set=1;
+ dbg(0,"position_set %f %f\n", ret->geo.lat, ret->geo.lng);
+ }
+ *meth = vehicle_demo_methods;
+ ret->timer_callback=callback_new_1(callback_cast(vehicle_demo_timer), ret);
+ ret->timer=event_add_timeout(ret->interval, 1, ret->timer_callback);
+ return ret;
+}
+
+void
+plugin_init(void)
+{
+ dbg(1, "enter\n");
+ plugin_register_vehicle_type("demo", vehicle_demo_new);
+}
diff --git a/vehicle/file/Makefile.am b/vehicle/file/Makefile.am
new file mode 100644
index 00000000..a5518696
--- /dev/null
+++ b/vehicle/file/Makefile.am
@@ -0,0 +1,9 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit
+modulevehicle_LTLIBRARIES = libvehicle_file.la libvehicle_pipe.la
+libvehicle_file_la_CFLAGS=-DMODULE=vehicle_file
+libvehicle_file_la_SOURCES = vehicle_file.c
+libvehicle_file_la_LDFLAGS = -module -avoid-version
+libvehicle_pipe_la_CFLAGS=-DMODULE=vehicle_pipe
+libvehicle_pipe_la_SOURCES = vehicle_pipe.c
+libvehicle_pipe_la_LDFLAGS = -module -avoid-version
diff --git a/vehicle/file/vehicle_file.c b/vehicle/file/vehicle_file.c
new file mode 100644
index 00000000..88c5af2e
--- /dev/null
+++ b/vehicle/file/vehicle_file.c
@@ -0,0 +1,763 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <glib.h>
+#include <sys/stat.h>
+#ifdef _WIN32
+ #include <serial_io.h>
+#else
+#include <termios.h>
+#endif
+#include <math.h>
+#include "config.h"
+#include "debug.h"
+#include "callback.h"
+#include "plugin.h"
+#include "coord.h"
+#include "item.h"
+#include "event.h"
+#include "vehicle.h"
+
+static void vehicle_file_disable_watch(struct vehicle_priv *priv);
+static void vehicle_file_enable_watch(struct vehicle_priv *priv);
+static int vehicle_file_parse(struct vehicle_priv *priv, char *buffer);
+static int vehicle_file_open(struct vehicle_priv *priv);
+static void vehicle_file_close(struct vehicle_priv *priv);
+
+
+enum file_type {
+ file_type_pipe = 1, file_type_device, file_type_file
+};
+
+static int buffer_size = 1024;
+
+struct gps_sat {
+ int prn;
+ int elevation;
+ int azimuth;
+ int snr;
+};
+
+
+struct vehicle_priv {
+ char *source;
+ enum file_type file_type;
+ struct callback_list *cbl;
+ int fd;
+ FILE *file;
+ struct callback *cb,*cbt;
+ struct event_watch *watch;
+ char *buffer;
+ int buffer_pos;
+ char *nmea_data;
+ char *nmea_data_buf;
+
+ struct coord_geo geo;
+ double speed;
+ double direction;
+ double height;
+ double hdop;
+ double vdop;
+ char fixtime[20];
+ int fixyear;
+ int fixmonth;
+ int fixday;
+ int status;
+ int sats_used;
+ int sats_visible;
+ int sats_signal;
+ int time;
+ int on_eof;
+#ifdef _WIN32
+ int no_data_count;
+#endif
+ speed_t baudrate;
+ struct attr ** attrs;
+ char fixiso8601[128];
+ int checksum_ignore;
+ int magnetic_direction;
+ int current_count;
+ struct gps_sat current[24];
+ int next_count;
+ struct gps_sat next[24];
+ struct item sat_item;
+ int valid;
+};
+
+#ifdef _WIN32
+static int vehicle_win32_serial_track(struct vehicle_priv *priv)
+{
+
+ static char buffer[2048] = {0,};
+ static int current_index = 0;
+ const int chunk_size = 1024;
+ int rc = 0;
+
+ if ( priv->no_data_count > 5 )
+ {
+ vehicle_file_close( priv );
+ priv->no_data_count = 0;
+ }
+
+ if ( priv->fd <= 0 )
+ {
+ vehicle_file_open( priv );
+ }
+
+ if ( current_index >= ( sizeof( buffer ) - chunk_size ) )
+ {
+ // discard
+ current_index = 0;
+ memset( buffer, 0 , sizeof( buffer ) );
+ }
+
+ int dwBytes = serial_io_read( priv->fd, &buffer[ current_index ], chunk_size );
+ if ( dwBytes > 0 )
+ {
+ current_index += dwBytes;
+
+ char* return_pos = NULL;
+ while ( ( return_pos = strchr( buffer, '\n' ) ) != NULL )
+ {
+ char return_buffer[1024];
+ int bytes_to_copy = return_pos - buffer + 1;
+ memcpy( return_buffer, buffer, bytes_to_copy );
+ return_buffer[ bytes_to_copy + 1 ] = '\0';
+
+ // printf( "received %d : '%s' bytes to copy\n", bytes_to_copy, return_buffer );
+ rc += vehicle_file_parse( priv, return_buffer );
+
+ current_index -= bytes_to_copy;
+ memmove( buffer, &buffer[ bytes_to_copy ] , sizeof( buffer ) - bytes_to_copy );
+ }
+ if (rc) {
+ callback_list_call_0(priv->cbl);
+ if (rc > 1)
+ dbg(0, "Can not keep with gps data delay is %d seconds\n",
+ rc - 1);
+ }
+
+
+ }
+ else
+ {
+ priv->no_data_count++;
+ }
+ return 1;
+}
+#endif
+
+static int
+vehicle_file_open(struct vehicle_priv *priv)
+{
+#ifdef _WIN32
+ dbg(1, "enter vehicle_file_open, priv->source='%s'\n", priv->source);
+
+ if ( priv->source )
+ {
+ char* raw_setting_str = g_strdup( priv->source );
+
+ char* strport = strchr(raw_setting_str, ':' );
+ char* strsettings = strchr(raw_setting_str, ' ' );
+
+ if ( strport && strsettings )
+ {
+ strport++;
+ *strsettings = '\0';
+ strsettings++;
+
+ dbg(1, "calling serial_io_init('%s', '%s')\n", strport, strsettings );
+ priv->fd=serial_io_init( strport, strsettings );
+ }
+ g_free( raw_setting_str );
+ }
+#else
+ char *name;
+ struct stat st;
+ struct termios tio;
+
+ name = priv->source + 5;
+ if (!strncmp(priv->source, "file:", 5)) {
+ priv->fd = open(name, O_RDONLY | O_NDELAY);
+ if (priv->fd < 0)
+ return 0;
+ stat(name, &st);
+ if (S_ISREG(st.st_mode)) {
+ priv->file_type = file_type_file;
+ } else {
+ tcgetattr(priv->fd, &tio);
+ cfmakeraw(&tio);
+ cfsetispeed(&tio, priv->baudrate);
+ cfsetospeed(&tio, priv->baudrate);
+ tio.c_cc[VMIN] = 0;
+ tio.c_cc[VTIME] = 200;
+ tcsetattr(priv->fd, TCSANOW, &tio);
+ priv->file_type = file_type_device;
+ }
+ } else {
+ priv->file = popen(name, "r");
+ if (!priv->file)
+ return 0;
+ priv->fd = fileno(priv->file);
+ priv->file_type = file_type_pipe;
+ }
+#endif
+ return 1;
+}
+
+static void
+vehicle_file_close(struct vehicle_priv *priv)
+{
+#ifdef _WIN32
+ serial_io_shutdown( priv->fd );
+#else
+ vehicle_file_disable_watch(priv);
+ if (priv->file)
+ pclose(priv->file);
+ else if (priv->fd >= 0)
+ close(priv->fd);
+#endif
+ priv->file = NULL;
+ priv->fd = -1;
+}
+
+static int
+vehicle_file_enable_watch_timer(struct vehicle_priv *priv)
+{
+ dbg(1, "enter\n");
+ vehicle_file_enable_watch(priv);
+
+ return FALSE;
+}
+
+
+static int
+vehicle_file_parse(struct vehicle_priv *priv, char *buffer)
+{
+ char *nmea_data_buf, *p, *item[32];
+ double lat, lng;
+ int i, j, bcsum;
+ int len = strlen(buffer);
+ unsigned char csum = 0;
+ int valid=0;
+ int ret = 0;
+
+ dbg(1, "buffer='%s'\n", buffer);
+ for (;;) {
+ if (len < 4) {
+ dbg(0, "'%s' too short\n", buffer);
+ return ret;
+ }
+ if (buffer[len - 1] == '\r' || buffer[len - 1] == '\n')
+ buffer[--len] = '\0';
+ else
+ break;
+ }
+ if (buffer[0] != '$') {
+ dbg(0, "no leading $ in '%s'\n", buffer);
+ return ret;
+ }
+ if (buffer[len - 3] != '*') {
+ dbg(0, "no *XX in '%s'\n", buffer);
+ return ret;
+ }
+ for (i = 1; i < len - 3; i++) {
+ csum ^= (unsigned char) (buffer[i]);
+ }
+ if (!sscanf(buffer + len - 2, "%x", &bcsum) && priv->checksum_ignore != 2) {
+ dbg(0, "no checksum in '%s'\n", buffer);
+ return ret;
+ }
+ if (bcsum != csum && priv->checksum_ignore == 0) {
+ dbg(0, "wrong checksum in '%s'\n", buffer);
+ return ret;
+ }
+
+ if (!priv->nmea_data_buf || strlen(priv->nmea_data_buf) < 65536) {
+ nmea_data_buf=g_strconcat(priv->nmea_data_buf ? priv->nmea_data_buf : "", buffer, "\n", NULL);
+ g_free(priv->nmea_data_buf);
+ priv->nmea_data_buf=nmea_data_buf;
+ } else {
+ dbg(0, "nmea buffer overflow, discarding '%s'\n", buffer);
+ }
+ i = 0;
+ p = buffer;
+ while (i < 31) {
+ item[i++] = p;
+ while (*p && *p != ',')
+ p++;
+ if (!*p)
+ break;
+ *p++ = '\0';
+ }
+
+ if (!strncmp(buffer, "$GPGGA", 6)) {
+ /* 1 1111
+ 0 1 2 3 4 5 6 7 8 9 0 1234
+ $GPGGA,184424.505,4924.2811,N,01107.8846,E,1,05,2.5,408.6,M,,,,0000*0C
+ UTC of Fix[1],Latitude[2],N/S[3],Longitude[4],E/W[5],Quality(0=inv,1=gps,2=dgps)[6],Satelites used[7],
+ HDOP[8],Altitude[9],"M"[10],height of geoid[11], "M"[12], time since dgps update[13], dgps ref station [14]
+ */
+ if (*item[2] && *item[3] && *item[4] && *item[5]) {
+ lat = g_ascii_strtod(item[2], NULL);
+ priv->geo.lat = floor(lat / 100);
+ lat -= priv->geo.lat * 100;
+ priv->geo.lat += lat / 60;
+
+ if (!strcasecmp(item[3],"S"))
+ priv->geo.lat=-priv->geo.lat;
+
+ lng = g_ascii_strtod(item[4], NULL);
+ priv->geo.lng = floor(lng / 100);
+ lng -= priv->geo.lng * 100;
+ priv->geo.lng += lng / 60;
+
+ if (!strcasecmp(item[5],"W"))
+ priv->geo.lng=-priv->geo.lng;
+ priv->valid=attr_position_valid_valid;
+ } else
+ priv->valid=attr_position_valid_invalid;
+ if (*item[6])
+ sscanf(item[6], "%d", &priv->status);
+ if (*item[7])
+ sscanf(item[7], "%d", &priv->sats_used);
+ if (*item[8])
+ sscanf(item[8], "%lf", &priv->hdop);
+ if (*item[1])
+ strcpy(priv->fixtime, item[1]);
+ if (*item[9])
+ sscanf(item[9], "%lf", &priv->height);
+
+ g_free(priv->nmea_data);
+ priv->nmea_data=priv->nmea_data_buf;
+ priv->nmea_data_buf=NULL;
+#ifndef _WIN32
+ if (priv->file_type == file_type_file) {
+ if (priv->watch) {
+ vehicle_file_disable_watch(priv);
+ event_add_timeout(priv->time, 0, priv->cbt);
+ }
+ }
+#endif
+ }
+ if (!strncmp(buffer, "$GPVTG", 6)) {
+ /* 0 1 2 34 5 6 7 8
+ $GPVTG,143.58,T,,M,0.26,N,0.5,K*6A
+ Course Over Ground Degrees True[1],"T"[2],Course Over Ground Degrees Magnetic[3],"M"[4],
+ Speed in Knots[5],"N"[6],"Speed in KM/H"[7],"K"[8]
+ */
+ if (item[1] && item[7])
+ valid = 1;
+ if (i >= 10 && (*item[9] == 'A' || *item[9] == 'D'))
+ valid = 1;
+ if (valid) {
+ priv->direction = g_ascii_strtod( item[1], NULL );
+ priv->speed = g_ascii_strtod( item[7], NULL );
+ }
+ }
+ if (!strncmp(buffer, "$GPRMC", 6)) {
+ /* 1 1
+ 0 1 2 3 4 5 6 7 8 9 0 1
+ $GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A
+ Time[1],Active/Void[2],lat[3],N/S[4],long[5],W/E[6],speed in knots[7],track angle[8],date[9],
+ magnetic variation[10],magnetic variation direction[11]
+ */
+ if (*item[2] == 'A')
+ valid = 1;
+ if (i >= 13 && (*item[12] == 'A' || *item[12] == 'D'))
+ valid = 1;
+ if (valid) {
+ priv->direction = g_ascii_strtod( item[8], NULL );
+ priv->speed = g_ascii_strtod( item[7], NULL );
+ priv->speed *= 1.852;
+ sscanf(item[9], "%02d%02d%02d",
+ &priv->fixday,
+ &priv->fixmonth,
+ &priv->fixyear);
+ priv->fixyear += 2000;
+ }
+ ret = 1;
+ }
+ if (!strncmp(buffer, "$GPGSV", 6) && i >= 4) {
+ /*
+ 0 GSV Satellites in view
+ 1 2 Number of sentences for full data
+ 2 1 sentence 1 of 2
+ 3 08 Number of satellites in view
+
+ 4 01 Satellite PRN number
+ 5 40 Elevation, degrees
+ 6 083 Azimuth, degrees
+ 7 46 SNR - higher is better
+ for up to 4 satellites per sentence
+ *75 the checksum data, always begins with *
+ */
+ if (item[3]) {
+ sscanf(item[3], "%d", &priv->sats_visible);
+ }
+ j=4;
+ while (j+4 <= i && priv->current_count < 24) {
+ struct gps_sat *sat=&priv->next[priv->next_count++];
+ sat->prn=atoi(item[j]);
+ sat->elevation=atoi(item[j+1]);
+ sat->azimuth=atoi(item[j+2]);
+ sat->snr=atoi(item[j+3]);
+ j+=4;
+ }
+ if (!strcmp(item[1], item[2])) {
+ priv->sats_signal=0;
+ for (i = 0 ; i < priv->next_count ; i++) {
+ priv->current[i]=priv->next[i];
+ if (priv->current[i].snr)
+ priv->sats_signal++;
+ }
+ priv->current_count=priv->next_count;
+ priv->next_count=0;
+ }
+ }
+ if (!strncmp(buffer, "$GPZDA", 6)) {
+ /*
+ 0 1 2 3 4 5 6
+ $GPZDA,hhmmss.ss,dd,mm,yyyy,xx,yy*CC
+ hhmmss HrMinSec(UTC)
+ dd,mm,yyy Day,Month,Year
+ xx local zone hours -13..13
+ yy local zone minutes 0..59
+ */
+ if (item[1] && item[2] && item[3] && item[4]) {
+ // priv->fixtime = atof(item[1]);
+ strcpy(priv->fixtime, item[1]);
+ priv->fixday = atoi(item[2]);
+ priv->fixmonth = atoi(item[3]);
+ priv->fixyear = atoi(item[4]);
+ }
+ }
+ if (!strncmp(buffer, "$IISMD", 6)) {
+ /*
+ 0 1 2 3 4
+ $IISMD,dir,press,height,temp*CC"
+ dir Direction (0-359)
+ press Pressure (hpa, i.e. 1032)
+ height Barometric height above ground (meter)
+ temp Temperature (Degree Celsius)
+ */
+ if (item[1]) {
+ priv->magnetic_direction = g_ascii_strtod( item[1], NULL );
+ dbg(1,"magnetic %d\n", priv->magnetic_direction);
+ }
+ }
+ return ret;
+}
+
+#ifndef _WIN32
+static void
+vehicle_file_io(struct vehicle_priv *priv)
+{
+ int size, rc = 0;
+ char *str, *tok;
+
+ dbg(1, "enter\n");
+ size = read(priv->fd, priv->buffer + priv->buffer_pos, buffer_size - priv->buffer_pos - 1);
+ if (size <= 0) {
+ switch (priv->on_eof) {
+ case 0:
+ vehicle_file_close(priv);
+ vehicle_file_open(priv);
+ break;
+ case 1:
+ vehicle_file_disable_watch(priv);
+ break;
+ case 2:
+ exit(0);
+ break;
+ }
+ return;
+ }
+ priv->buffer_pos += size;
+ priv->buffer[priv->buffer_pos] = '\0';
+ dbg(1, "size=%d pos=%d buffer='%s'\n", size,
+ priv->buffer_pos, priv->buffer);
+ str = priv->buffer;
+ while ((tok = strchr(str, '\n'))) {
+ *tok++ = '\0';
+ dbg(1, "line='%s'\n", str);
+ rc +=vehicle_file_parse(priv, str);
+ str = tok;
+ }
+
+ if (str != priv->buffer) {
+ size = priv->buffer + priv->buffer_pos - str;
+ memmove(priv->buffer, str, size + 1);
+ priv->buffer_pos = size;
+ dbg(1, "now pos=%d buffer='%s'\n",
+ priv->buffer_pos, priv->buffer);
+ } else if (priv->buffer_pos == buffer_size - 1) {
+ dbg(0,
+ "Overflow. Most likely wrong baud rate or no nmea protocol\n");
+ priv->buffer_pos = 0;
+ }
+ if (rc)
+ callback_list_call_0(priv->cbl);
+}
+#endif
+
+static void
+vehicle_file_enable_watch(struct vehicle_priv *priv)
+{
+#ifdef _WIN32
+ g_timeout_add(500, vehicle_win32_serial_track, priv);
+#else
+ if (! priv->watch)
+ priv->watch = event_add_watch((void *)priv->fd, event_watch_cond_read, priv->cb);
+#endif
+}
+
+static void
+vehicle_file_disable_watch(struct vehicle_priv *priv)
+{
+#ifndef _WIN32
+ if (priv->watch)
+ event_remove_watch(priv->watch);
+ priv->watch = NULL;
+#endif
+}
+
+
+static void
+vehicle_file_destroy(struct vehicle_priv *priv)
+{
+ vehicle_file_close(priv);
+ callback_destroy(priv->cb);
+ callback_destroy(priv->cbt);
+ if (priv->source)
+ g_free(priv->source);
+ if (priv->buffer)
+ g_free(priv->buffer);
+ g_free(priv);
+}
+
+static int
+vehicle_file_position_attr_get(struct vehicle_priv *priv,
+ enum attr_type type, struct attr *attr)
+{
+ switch (type) {
+ case attr_position_fix_type:
+ attr->u.num = priv->status;
+ break;
+ case attr_position_height:
+ attr->u.numd = &priv->height;
+ break;
+ case attr_position_speed:
+ attr->u.numd = &priv->speed;
+ break;
+ case attr_position_direction:
+ attr->u.numd = &priv->direction;
+ break;
+ case attr_position_magnetic_direction:
+ attr->u.num = priv->magnetic_direction;
+ break;
+ case attr_position_hdop:
+ attr->u.numd = &priv->hdop;
+ break;
+ case attr_position_qual:
+ attr->u.num = priv->sats_visible;
+ break;
+ case attr_position_sats_signal:
+ attr->u.num = priv->sats_signal;
+ break;
+ case attr_position_sats_used:
+ attr->u.num = priv->sats_used;
+ break;
+ case attr_position_coord_geo:
+ attr->u.coord_geo = &priv->geo;
+ break;
+ case attr_position_nmea:
+ attr->u.str=priv->nmea_data;
+ if (! attr->u.str)
+ return 0;
+ break;
+ case attr_position_time_iso8601:
+ if (!priv->fixyear || !priv->fixtime[0])
+ return 0;
+ sprintf(priv->fixiso8601, "%04d-%02d-%02dT%.2s:%.2s:%sZ",
+ priv->fixyear, priv->fixmonth, priv->fixday,
+ priv->fixtime, (priv->fixtime+2), (priv->fixtime+4));
+ attr->u.str=priv->fixiso8601;
+ break;
+ case attr_position_sat_item:
+ dbg(0,"at here\n");
+ priv->sat_item.id_lo++;
+ if (priv->sat_item.id_lo > priv->current_count) {
+ priv->sat_item.id_lo=0;
+ return 0;
+ }
+ attr->u.item=&priv->sat_item;
+ break;
+ case attr_position_valid:
+ attr->u.num=priv->valid;
+ break;
+ default:
+ return 0;
+ }
+ if (type != attr_position_sat_item)
+ priv->sat_item.id_lo=0;
+ attr->type = type;
+ return 1;
+}
+
+static int
+vehicle_file_sat_attr_get(void *priv_data, enum attr_type type, struct attr *attr)
+{
+ struct vehicle_priv *priv=priv_data;
+ if (priv->sat_item.id_lo < 1)
+ return 0;
+ if (priv->sat_item.id_lo > priv->current_count)
+ return 0;
+ struct gps_sat *sat=&priv->current[priv->sat_item.id_lo-1];
+ switch (type) {
+ case attr_sat_prn:
+ attr->u.num=sat->prn;
+ break;
+ case attr_sat_elevation:
+ attr->u.num=sat->elevation;
+ break;
+ case attr_sat_azimuth:
+ attr->u.num=sat->azimuth;
+ break;
+ case attr_sat_snr:
+ attr->u.num=sat->snr;
+ break;
+ default:
+ return 0;
+ }
+ attr->type = type;
+ return 1;
+}
+
+static struct item_methods vehicle_file_sat_methods = {
+ NULL,
+ NULL,
+ NULL,
+ vehicle_file_sat_attr_get,
+};
+
+static struct vehicle_methods vehicle_file_methods = {
+ vehicle_file_destroy,
+ vehicle_file_position_attr_get,
+};
+
+static struct vehicle_priv *
+vehicle_file_new_file(struct vehicle_methods
+ *meth, struct callback_list
+ *cbl, struct attr **attrs)
+{
+ struct vehicle_priv *ret;
+ struct attr *source;
+ struct attr *time;
+ struct attr *on_eof;
+ struct attr *baudrate;
+ struct attr *checksum_ignore;
+
+ dbg(1, "enter\n");
+ source = attr_search(attrs, NULL, attr_source);
+ if(source == NULL){
+ dbg(0,"Missing source attribute");
+ return NULL;
+ }
+ ret = g_new0(struct vehicle_priv, 1);
+ ret->fd = -1;
+ ret->cbl = cbl;
+ ret->source = g_strdup(source->u.str);
+ ret->buffer = g_malloc(buffer_size);
+ ret->time=1000;
+ ret->baudrate=B4800;
+ time = attr_search(attrs, NULL, attr_time);
+ if (time)
+ ret->time=time->u.num;
+ baudrate = attr_search(attrs, NULL, attr_baudrate);
+ if (baudrate) {
+ switch (baudrate->u.num) {
+ case 4800:
+ ret->baudrate=B4800;
+ break;
+ case 9600:
+ ret->baudrate=B9600;
+ break;
+ case 19200:
+ ret->baudrate=B19200;
+ break;
+#ifdef B38400
+ case 38400:
+ ret->baudrate=B38400;
+ break;
+#endif
+#ifdef B57600
+ case 57600:
+ ret->baudrate=B57600;
+ break;
+#endif
+#ifdef B115200
+ case 115200:
+ ret->baudrate=B115200;
+ break;
+#endif
+ }
+ }
+ checksum_ignore = attr_search(attrs, NULL, attr_checksum_ignore);
+ if (checksum_ignore)
+ ret->checksum_ignore=checksum_ignore->u.num;
+ ret->attrs = attrs;
+ on_eof = attr_search(attrs, NULL, attr_on_eof);
+ if (on_eof && !strcasecmp(on_eof->u.str, "stop"))
+ ret->on_eof=1;
+ if (on_eof && !strcasecmp(on_eof->u.str, "exit"))
+ ret->on_eof=2;
+ dbg(0,"on_eof=%d\n", ret->on_eof);
+ *meth = vehicle_file_methods;
+ ret->cb=callback_new_1(callback_cast(vehicle_file_io), ret);
+ ret->cbt=callback_new_1(callback_cast(vehicle_file_enable_watch_timer), ret);
+ ret->sat_item.type=type_position_sat;
+ ret->sat_item.id_hi=ret->sat_item.id_lo=0;
+ ret->sat_item.priv_data=ret;
+ ret->sat_item.meth=&vehicle_file_sat_methods;
+ if (vehicle_file_open(ret)) {
+ vehicle_file_enable_watch(ret);
+ return ret;
+ }
+
+#ifdef _WIN32
+ ret->no_data_count = 0;
+#endif
+ dbg(0, "Failed to open '%s'\n", ret->source);
+ vehicle_file_destroy(ret);
+ return NULL;
+}
+
+void
+plugin_init(void)
+{
+ dbg(1, "enter\n");
+ plugin_register_vehicle_type("file", vehicle_file_new_file);
+ plugin_register_vehicle_type("pipe", vehicle_file_new_file);
+}
diff --git a/vehicle/file/vehicle_pipe.c b/vehicle/file/vehicle_pipe.c
new file mode 100644
index 00000000..0750edef
--- /dev/null
+++ b/vehicle/file/vehicle_pipe.c
@@ -0,0 +1,27 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "plugin.h"
+
+void
+plugin_init(void)
+{
+ plugin_get_vehicle_type("file");
+}
diff --git a/vehicle/gpsd/Makefile.am b/vehicle/gpsd/Makefile.am
new file mode 100644
index 00000000..1c47ccc5
--- /dev/null
+++ b/vehicle/gpsd/Makefile.am
@@ -0,0 +1,6 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ @GPSBT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=vehicle_gpsd
+modulevehicle_LTLIBRARIES = libvehicle_gpsd.la
+libvehicle_gpsd_la_SOURCES = vehicle_gpsd.c
+libvehicle_gpsd_la_LIBADD = @GPSD_LIBS@ @GPSBT_LIBS@
+libvehicle_gpsd_la_LDFLAGS = -module -avoid-version
diff --git a/vehicle/gpsd/vehicle_gpsd.c b/vehicle/gpsd/vehicle_gpsd.c
new file mode 100644
index 00000000..88a50a41
--- /dev/null
+++ b/vehicle/gpsd/vehicle_gpsd.c
@@ -0,0 +1,387 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <config.h>
+#include <gps.h>
+#include <string.h>
+#include <glib.h>
+#include <math.h>
+#ifdef HAVE_GPSBT
+#include <gpsbt.h>
+#include <errno.h>
+#endif
+#include "debug.h"
+#include "callback.h"
+#include "plugin.h"
+#include "coord.h"
+#include "item.h"
+#include "vehicle.h"
+#include "event.h"
+
+static struct vehicle_priv {
+ char *source;
+ char *gpsd_query;
+ struct callback_list *cbl;
+ struct callback *cb;
+ struct event_watch *evwatch;
+ guint retry_interval;
+ struct gps_data_t *gps;
+ struct coord_geo geo;
+ double speed;
+ double direction;
+ double height;
+ double hdop;
+ int status;
+ int fix_type;
+ time_t fix_time;
+ int sats;
+ int sats_signal;
+ int sats_used;
+ char *nmea_data;
+ char *nmea_data_buf;
+ guint retry_timer;
+ struct attr ** attrs;
+ char fixiso8601[128];
+#ifdef HAVE_GPSBT
+ gpsbt_t context;
+#endif
+} *vehicle_last;
+
+#define DEFAULT_RETRY_INTERVAL 10 // seconds
+#define MIN_RETRY_INTERVAL 1 // seconds
+
+static void vehicle_gpsd_io(struct vehicle_priv *priv);
+
+static void
+vehicle_gpsd_callback(struct gps_data_t *data, char *buf, size_t len,
+ int level)
+{
+ char *pos,*nmea_data_buf;
+ int i=0,sats_signal=0;
+
+ struct vehicle_priv *priv = vehicle_last;
+ if( len > 0 && buf[0] == '$' ) {
+ char buffer[len+2];
+ buffer[len+1]='\0';
+ memcpy(buffer, buf, len);
+ pos=strchr(buffer,'\n');
+ if (pos) {
+ *++pos='\0';
+ if (!priv->nmea_data_buf || strlen(priv->nmea_data_buf) < 65536) {
+ nmea_data_buf=g_strconcat(priv->nmea_data_buf ? priv->nmea_data_buf : "", buffer, NULL);
+ g_free(priv->nmea_data_buf);
+ priv->nmea_data_buf=nmea_data_buf;
+ } else {
+ dbg(0, "nmea buffer overflow, discarding '%s'\n", buffer);
+ }
+ }
+ }
+ dbg(1,"data->set=0x%x\n", data->set);
+ if (data->set & SPEED_SET) {
+ priv->speed = data->fix.speed * 3.6;
+ if(!isnan(data->fix.speed))
+ callback_list_call_attr_0(priv->cbl, attr_position_speed);
+ data->set &= ~SPEED_SET;
+ }
+ if (data->set & TRACK_SET) {
+ priv->direction = data->fix.track;
+ data->set &= ~TRACK_SET;
+ }
+ if (data->set & ALTITUDE_SET) {
+ priv->height = data->fix.altitude;
+ data->set &= ~ALTITUDE_SET;
+ }
+ if (data->set & SATELLITE_SET) {
+ if(data->satellites > 0) {
+ sats_signal=0;
+ for( i=0;i<data->satellites;i++) {
+ if (data->ss[i] > 0)
+ sats_signal++;
+ }
+ }
+ if (priv->sats_used != data->satellites_used || priv->sats != data->satellites || priv->sats_signal != sats_signal ) {
+ priv->sats_used = data->satellites_used;
+ priv->sats = data->satellites;
+ priv->sats_signal = sats_signal;
+ callback_list_call_attr_0(priv->cbl, attr_position_sats);
+ }
+ data->set &= ~SATELLITE_SET;
+ }
+ if (data->set & STATUS_SET) {
+ priv->status = data->status;
+ data->set &= ~STATUS_SET;
+ }
+ if (data->set & MODE_SET) {
+ priv->fix_type = data->fix.mode - 1;
+ data->set &= ~MODE_SET;
+ }
+ if (data->set & TIME_SET) {
+ priv->fix_time = data->fix.time;
+ data->set &= ~TIME_SET;
+ }
+ if (data->set & PDOP_SET) {
+ dbg(1, "pdop : %g\n", data->pdop);
+ priv->hdop = data->hdop;
+ data->set &= ~PDOP_SET;
+ }
+ if (data->set & LATLON_SET) {
+ priv->geo.lat = data->fix.latitude;
+ priv->geo.lng = data->fix.longitude;
+ dbg(1,"lat=%f lng=%f\n", priv->geo.lat, priv->geo.lng);
+ g_free(priv->nmea_data);
+ priv->nmea_data=priv->nmea_data_buf;
+ priv->nmea_data_buf=NULL;
+ data->set &= ~LATLON_SET;
+ }
+ // If data->fix.speed is NAN, then the drawing gets jumpy.
+ if (! isnan(data->fix.speed) && priv->fix_type > 0) {
+ callback_list_call_0(priv->cbl);
+ }
+ dbg(2,"speed ok\n");
+}
+
+/**
+ * Attempt to open the gps device.
+ * Return FALSE if retry not required
+ * Return TRUE to try again
+ */
+static gboolean
+vehicle_gpsd_try_open(gpointer *data)
+{
+ struct vehicle_priv *priv = (struct vehicle_priv *)data;
+ char *source = g_strdup(priv->source);
+ char *colon = index(source + 7, ':');
+ if (colon) {
+ *colon = '\0';
+ priv->gps = gps_open(source + 7, colon + 1);
+ } else
+ priv->gps = gps_open(source + 7, NULL);
+ g_free(source);
+
+ if (!priv->gps){
+ dbg(0,"gps_open failed for '%s'. Retrying in %d seconds. Have you started gpsd?\n", priv->source, priv->retry_interval);
+ return TRUE;
+ }
+ gps_query(priv->gps, priv->gpsd_query);
+ gps_set_raw_hook(priv->gps, vehicle_gpsd_callback);
+ priv->cb = callback_new_1(callback_cast(vehicle_gpsd_io), priv);
+ priv->evwatch = event_add_watch((void *)priv->gps->gps_fd, event_watch_cond_read, priv->cb);
+ if (!priv->gps->gps_fd) {
+ dbg(0,"Warning: gps_fd is 0, most likely you have used a gps.h incompatible to libgps");
+ }
+ dbg(0,"Connected to gpsd fd=%d evwatch=%p\n", priv->gps->gps_fd, priv->evwatch);
+ return FALSE;
+}
+
+/**
+ * Open a connection to gpsd. Will re-try the connection if it fails
+ */
+static void
+vehicle_gpsd_open(struct vehicle_priv *priv)
+{
+#ifdef HAVE_GPSBT
+ char errstr[256] = "";
+ /* We need to start gpsd (via gpsbt) first. */
+ errno = 0;
+ memset(&priv->context, 0, sizeof(gpsbt_t));
+ if(gpsbt_start(NULL, 0, 0, 0, errstr, sizeof(errstr),
+ 0, &priv->context) < 0) {
+ dbg(0,"Error connecting to GPS with gpsbt: (%d) %s (%s)\n",
+ errno, strerror(errno), errstr);
+ }
+ sleep(1); /* give gpsd time to start */
+ dbg(1,"gpsbt_start: completed\n");
+#endif
+ priv->retry_timer=0;
+ if (vehicle_gpsd_try_open((gpointer *)priv)) {
+ priv->retry_timer = g_timeout_add(priv->retry_interval*1000, (GSourceFunc)vehicle_gpsd_try_open, (gpointer *)priv);
+ }
+}
+
+static void
+vehicle_gpsd_close(struct vehicle_priv *priv)
+{
+#ifdef HAVE_GPSBT
+ int err;
+#endif
+
+ if (priv->retry_timer) {
+ g_source_remove(priv->retry_timer);
+ priv->retry_timer=0;
+ }
+ if (priv->evwatch) {
+ event_remove_watch(priv->evwatch);
+ priv->evwatch = NULL;
+ }
+ if (priv->cb) {
+ callback_destroy(priv->cb);
+ priv->cb = NULL;
+ }
+ if (priv->gps) {
+ gps_close(priv->gps);
+ priv->gps = NULL;
+ }
+#ifdef HAVE_GPSBT
+ err = gpsbt_stop(&priv->context);
+ if (err < 0) {
+ dbg(0,"Error %d while gpsbt_stop", err);
+ }
+ dbg(1,"gpsbt_stop: completed, (%d)",err);
+#endif
+}
+
+static void
+vehicle_gpsd_io(struct vehicle_priv *priv)
+{
+ dbg(1, "enter\n");
+ if (priv->gps) {
+ vehicle_last = priv;
+ if (gps_poll(priv->gps)) {
+ g_warning("gps_poll failed\n");
+ vehicle_gpsd_close(priv);
+ vehicle_gpsd_open(priv);
+ }
+ }
+}
+
+static void
+vehicle_gpsd_destroy(struct vehicle_priv *priv)
+{
+ vehicle_gpsd_close(priv);
+ if (priv->source)
+ g_free(priv->source);
+ if (priv->gpsd_query)
+ g_free(priv->gpsd_query);
+ g_free(priv);
+}
+
+static int
+vehicle_gpsd_position_attr_get(struct vehicle_priv *priv,
+ enum attr_type type, struct attr *attr)
+{
+ struct attr * active=NULL;
+ switch (type) {
+ case attr_position_fix_type:
+ attr->u.num = priv->fix_type;
+ break;
+ case attr_position_height:
+ attr->u.numd = &priv->height;
+ break;
+ case attr_position_speed:
+ attr->u.numd = &priv->speed;
+ break;
+ case attr_position_direction:
+ attr->u.numd = &priv->direction;
+ break;
+ case attr_position_hdop:
+ attr->u.numd = &priv->hdop;
+ break;
+ case attr_position_qual:
+ attr->u.num = priv->sats;
+ break;
+ case attr_position_sats_signal:
+ attr->u.num = priv->sats_signal;
+ break;
+ case attr_position_sats_used:
+ attr->u.num = priv->sats_used;
+ break;
+ case attr_position_coord_geo:
+ attr->u.coord_geo = &priv->geo;
+ break;
+ case attr_position_nmea:
+ attr->u.str=priv->nmea_data;
+ if (! attr->u.str)
+ return 0;
+ break;
+ case attr_position_time_iso8601:
+ {
+ struct tm tm;
+ if (!priv->fix_time)
+ return 0;
+ if (gmtime_r(&priv->fix_time, &tm)) {
+ strftime(priv->fixiso8601, sizeof(priv->fixiso8601),
+ "%Y-%m-%dT%TZ", &tm);
+ attr->u.str=priv->fixiso8601;
+ } else
+ return 0;
+ }
+ break;
+ case attr_active:
+ active = attr_search(priv->attrs,NULL,attr_active);
+ if(active != NULL) {
+ attr->u.num=active->u.num;
+ return 1;
+ } else
+ return 0;
+ break;
+ default:
+ return 0;
+ }
+ attr->type = type;
+ return 1;
+}
+
+struct vehicle_methods vehicle_gpsd_methods = {
+ vehicle_gpsd_destroy,
+ vehicle_gpsd_position_attr_get,
+};
+
+static struct vehicle_priv *
+vehicle_gpsd_new_gpsd(struct vehicle_methods
+ *meth, struct callback_list
+ *cbl, struct attr **attrs)
+{
+ struct vehicle_priv *ret;
+ struct attr *source, *query, *retry_int;
+
+ dbg(1, "enter\n");
+ source = attr_search(attrs, NULL, attr_source);
+ ret = g_new0(struct vehicle_priv, 1);
+ ret->source = g_strdup(source->u.str);
+ query = attr_search(attrs, NULL, attr_gpsd_query);
+ if (query) {
+ ret->gpsd_query = g_strconcat(query->u.str, "\n", NULL);
+ } else {
+ ret->gpsd_query = g_strdup("w+x\n");
+ }
+ dbg(1,"Format string for gpsd_query: %s\n",ret->gpsd_query);
+ retry_int = attr_search(attrs, NULL, attr_retry_interval);
+ if (retry_int) {
+ ret->retry_interval = retry_int->u.num;
+ if (ret->retry_interval < MIN_RETRY_INTERVAL) {
+ dbg(0, "Retry interval %d too small, setting to %d\n", ret->retry_interval, MIN_RETRY_INTERVAL);
+ ret->retry_interval = MIN_RETRY_INTERVAL;
+ }
+ } else {
+ dbg(1, "Retry interval not defined, setting to %d\n", DEFAULT_RETRY_INTERVAL);
+ ret->retry_interval = DEFAULT_RETRY_INTERVAL;
+ }
+ ret->cbl = cbl;
+ *meth = vehicle_gpsd_methods;
+ ret->attrs = attrs;
+ vehicle_gpsd_open(ret);
+ return ret;
+}
+
+void
+plugin_init(void)
+{
+ dbg(1, "enter\n");
+ plugin_register_vehicle_type("gpsd", vehicle_gpsd_new_gpsd);
+}
diff --git a/vehicle/gypsy/Makefile.am b/vehicle/gypsy/Makefile.am
new file mode 100644
index 00000000..ed6aba4a
--- /dev/null
+++ b/vehicle/gypsy/Makefile.am
@@ -0,0 +1,6 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=vehicle_gypsy
+modulevehicle_LTLIBRARIES = libvehicle_gypsy.la
+libvehicle_gypsy_la_SOURCES = vehicle_gypsy.c
+libvehicle_gypsy_la_LIBADD = @GYPSY_LIBS@
+libvehicle_gypsy_la_LDFLAGS = -module -avoid-version
diff --git a/vehicle/gypsy/vehicle_gypsy.c b/vehicle/gypsy/vehicle_gypsy.c
new file mode 100644
index 00000000..a1967c69
--- /dev/null
+++ b/vehicle/gypsy/vehicle_gypsy.c
@@ -0,0 +1,465 @@
+/** @file vehicle_gypsy.c
+ * @brief gypsy uses dbus signals
+ *
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * @Author Tim Niemeyer <reddog@mastersword.de>
+ * @date 2008-2009
+ */
+
+#include <config.h>
+#include <gypsy/gypsy-device.h>
+#include <gypsy/gypsy-control.h>
+#include <gypsy/gypsy-course.h>
+#include <gypsy/gypsy-position.h>
+#include <gypsy/gypsy-satellite.h>
+#include <string.h>
+#include <glib.h>
+#include <math.h>
+#include "debug.h"
+#include "callback.h"
+#include "plugin.h"
+#include "coord.h"
+#include "item.h"
+#include "vehicle.h"
+
+static struct vehicle_priv {
+ char *source;
+ GypsyControl *control;
+ GypsyPosition *position;
+ GypsyDevice *device;
+ GypsyCourse *course;
+ GypsySatellite *satellite;
+ char *path;
+ struct callback_list *cbl;
+ guint retry_interval;
+ struct coord_geo geo;
+ double speed;
+ double direction;
+ double height;
+ int fix_type;
+ time_t fix_time;
+ char fixiso8601[128];
+ int sats;
+ int sats_used;
+ guint retry_timer;
+ struct attr ** attrs;
+ int have_cords;
+} *vehicle_last;
+
+#define DEFAULT_RETRY_INTERVAL 10 // seconds
+#define MIN_RETRY_INTERVAL 1 // seconds
+
+/**
+ * @brief When the fixstatus has changed, this function get called
+ *
+ * fixstatus can be one of this:
+ * GYPSY_DEVICE_FIX_STATUS_INVALID = 0
+ * GYPSY_DEVICE_FIX_STATUS_NONE = 1
+ * GYPSY_DEVICE_FIX_STATUS_2D = 2
+ * GYPSY_DEVICE_FIX_STATUS_3D = 3
+ *
+ * Anytime this functions get called, we have to call the global
+ * callback.
+ *
+ * @param device The GypsyDevice
+ * @param fixstatus The fisstatus 0, 1, 2 or 3
+ * @param userdata
+ * @returns nothing
+ */
+static void
+vehicle_gypsy_fixstatus_changed(GypsyDevice *device,
+ gint fixstatus,
+ gpointer userdata)
+{
+ struct vehicle_priv *priv = vehicle_last;
+
+ if (fixstatus==GYPSY_DEVICE_FIX_STATUS_3D)
+ priv->fix_type = 3;
+ else if (fixstatus==GYPSY_DEVICE_FIX_STATUS_2D)
+ priv->fix_type = 1;
+ else
+ priv->fix_type = 0;
+
+ callback_list_call_0(priv->cbl);
+}
+
+/**
+ * @brief When the position has changed, this function get called
+ *
+ * The fields_set can hold:
+ * GYPSY_POSITION_FIELDS_NONE = 1 << 0,
+ * GYPSY_POSITION_FIELDS_LATITUDE = 1 << 1,
+ * GYPSY_POSITION_FIELDS_LONGITUDE = 1 << 2,
+ * GYPSY_POSITION_FIELDS_ALTITUDE = 1 << 3
+ *
+ * If we get any new information, we have to call the global
+ * callback.
+ *
+ * @param position The GypsyPosition
+ * @param fields_set Bitmask indicating what field was set
+ * @param timestamp the time since Unix Epoch
+ * @param latitude
+ * @param longitude
+ * @param altitude
+ * @param userdata
+ * @returns nothing
+ */
+static void
+vehicle_gypsy_position_changed(GypsyPosition *position,
+ GypsyPositionFields fields_set, int timestamp,
+ double latitude, double longitude, double altitude,
+ gpointer userdata)
+{
+ struct vehicle_priv *priv = vehicle_last;
+ int cb = FALSE;
+
+ if (timestamp > 0)
+ priv->fix_time = timestamp;
+
+ if (fields_set & GYPSY_POSITION_FIELDS_LATITUDE)
+ {
+ cb = TRUE;
+ priv->geo.lat = latitude;
+ }
+ if (fields_set & GYPSY_POSITION_FIELDS_LONGITUDE)
+ {
+ cb = TRUE;
+ priv->geo.lng = longitude;
+ }
+ if (fields_set & GYPSY_POSITION_FIELDS_ALTITUDE)
+ {
+ cb = TRUE;
+ priv->height = altitude;
+ }
+
+ if (cb)
+ {
+ priv->have_cords = 1;
+ callback_list_call_0(priv->cbl);
+ }
+}
+
+/**
+ * @brief Everytime any Sat-Details are changed, this function get called
+ *
+ * Going through all Sats, counting those wich are in use.
+ *
+ * Anytime this functions get called, we have to call the global
+ * callback.
+ *
+ * @param satellite The GypsySatellite
+ * @param satellites An GPtrArray wich hold information of all sats
+ * @param userdata
+ * @returns nothing
+ */
+static void
+vehicle_gypsy_satellite_changed(GypsySatellite *satellite,
+ GPtrArray *satellites,
+ gpointer userdata)
+{
+ struct vehicle_priv *priv = vehicle_last;
+
+ int i, sats, used=0;
+
+ sats = satellites->len;
+ for (i = 0; i < sats; i++) {
+ GypsySatelliteDetails *details = satellites->pdata[i];
+ if (details->in_use)
+ used++;
+ }
+
+ priv->sats_used = used;
+ priv->sats = sats;
+
+ callback_list_call_0(priv->cbl);
+}
+
+/**
+ * @brief When the course or speed has changed, this function get called
+ *
+ * Only speed and direction are used!
+ *
+ * If we get any new information, we have to call the global
+ * callback.
+ *
+ * @param course The GypsyCourse
+ * @param fields Bitmask indicating what field was set
+ * @param timestamp the time since Unix Epoch
+ * @param speed
+ * @param direction
+ * @param climb
+ * @param userdata
+ * @returns nothing
+ */
+static void
+vehicle_gypsy_course_changed (GypsyCourse *course,
+ GypsyCourseFields fields,
+ int timestamp,
+ double speed,
+ double direction,
+ double climb,
+ gpointer userdata)
+{
+ struct vehicle_priv *priv = vehicle_last;
+ int cb = FALSE;
+
+ if (fields & GYPSY_COURSE_FIELDS_SPEED)
+ {
+ priv->speed = speed;
+ cb = TRUE;
+ }
+ if (fields & GYPSY_COURSE_FIELDS_DIRECTION)
+ {
+ priv->direction = direction;
+ cb = TRUE;
+ }
+
+ if (cb)
+ callback_list_call_0(priv->cbl);
+}
+
+/**
+ * @brief Attempt to open the gypsy device.
+ *
+ * Tells gypsy wich functions to call when anything occours.
+ *
+ * @param data
+ * @returns TRUE to try again; FALSE if retry not required
+ */
+static gboolean
+vehicle_gypsy_try_open(gpointer *data)
+{
+ struct vehicle_priv *priv = (struct vehicle_priv *)data;
+ char *source = g_strdup(priv->source);
+
+ GError *error = NULL;
+
+ g_type_init();
+ priv->control = gypsy_control_get_default();
+ priv->path = gypsy_control_create(priv->control, source+8, &error);
+ if (priv->path == NULL) {
+ g_warning ("Error creating gypsy conrtol path for %s: %s", source+8, error->message);
+ return TRUE;
+ }
+
+ priv->position = gypsy_position_new(priv->path);
+ g_signal_connect(priv->position, "position-changed", G_CALLBACK (vehicle_gypsy_position_changed), NULL);
+
+ priv->satellite = gypsy_satellite_new(priv->path);
+ g_signal_connect(priv->satellite, "satellites-changed", G_CALLBACK (vehicle_gypsy_satellite_changed), NULL);
+
+ priv->course = gypsy_course_new(priv->path);
+ g_signal_connect(priv->course, "course-changed", G_CALLBACK (vehicle_gypsy_course_changed), NULL);
+
+ priv->device = gypsy_device_new(priv->path);
+ g_signal_connect(priv->device, "fix-status-changed", G_CALLBACK (vehicle_gypsy_fixstatus_changed), NULL);
+
+ gypsy_device_start(priv->device, &error);
+ if (error != NULL) {
+ g_warning ("Error starting gypsy for %s: %s", source+8, error->message);
+ return TRUE;
+ }
+
+ vehicle_last = priv;
+ dbg(0,"gypsy connected to %d\n", source+8);
+ g_free(source);
+ return FALSE;
+}
+
+/**
+ * @brief Open a connection to gypsy. Will re-try the connection if it fails
+ *
+ * @param priv
+ * @returns nothing
+ */
+static void
+vehicle_gypsy_open(struct vehicle_priv *priv)
+{
+ priv->retry_timer=0;
+ if (vehicle_gypsy_try_open((gpointer *)priv)) {
+ priv->retry_timer = g_timeout_add(priv->retry_interval*1000, (GSourceFunc)vehicle_gypsy_try_open, (gpointer *)priv);
+ }
+}
+
+/**
+ * @brief Stop retry timer; Free alloced memory
+ *
+ * @param priv
+ * @returns nothing
+ */
+static void
+vehicle_gypsy_close(struct vehicle_priv *priv)
+{
+ if (priv->retry_timer) {
+ g_source_remove(priv->retry_timer);
+ priv->retry_timer=0;
+ }
+ if (priv->path)
+ g_free(priv->path);
+
+ if (priv->position)
+ g_free(priv->position);
+
+ if (priv->satellite)
+ g_free(priv->satellite);
+
+ if (priv->course)
+ g_free(priv->course);
+
+ if (priv->device)
+ g_free(priv->device);
+
+ if (priv->control)
+ g_object_unref(G_OBJECT (priv->control));
+}
+
+/**
+ * @brief Free the gypsy_vehicle
+ *
+ * @param priv
+ * @returns nothing
+ */
+static void
+vehicle_gypsy_destroy(struct vehicle_priv *priv)
+{
+ vehicle_gypsy_close(priv);
+ if (priv->source)
+ g_free(priv->source);
+ g_free(priv);
+}
+
+/**
+ * @brief Provide the outside with information
+ *
+ * @param priv
+ * @param type TODO: What can this be?
+ * @param attr
+ * @returns true/false
+ */
+static int
+vehicle_gypsy_position_attr_get(struct vehicle_priv *priv,
+ enum attr_type type, struct attr *attr)
+{
+ struct attr * active=NULL;
+ switch (type) {
+ case attr_position_fix_type:
+ attr->u.num = priv->fix_type;
+ break;
+ case attr_position_height:
+ attr->u.numd = &priv->height;
+ break;
+ case attr_position_speed:
+ attr->u.numd = &priv->speed;
+ break;
+ case attr_position_direction:
+ attr->u.numd = &priv->direction;
+ break;
+ case attr_position_qual:
+ attr->u.num = priv->sats;
+ break;
+ case attr_position_sats_used:
+ attr->u.num = priv->sats_used;
+ break;
+ case attr_position_coord_geo:
+ attr->u.coord_geo = &priv->geo;
+ if (!priv->have_cords)
+ return 0;
+ break;
+ case attr_position_time_iso8601:
+ {
+ struct tm tm;
+ if (!priv->fix_time)
+ return 0;
+ if (gmtime_r(&priv->fix_time, &tm)) {
+ strftime(priv->fixiso8601, sizeof(priv->fixiso8601),
+ "%Y-%m-%dT%TZ", &tm);
+ attr->u.str=priv->fixiso8601;
+ } else
+ return 0;
+ }
+ case attr_active:
+ active = attr_search(priv->attrs,NULL,attr_active);
+ if(active != NULL && active->u.num == 1)
+ return 1;
+ else
+ return 0;
+ break;
+
+ default:
+ return 0;
+ }
+ attr->type = type;
+ return 1;
+}
+
+struct vehicle_methods vehicle_gypsy_methods = {
+ vehicle_gypsy_destroy,
+ vehicle_gypsy_position_attr_get,
+};
+
+/**
+ * @brief Create gypsy_vehicle
+ *
+ * @param meth
+ * @param cbl
+ * @param attrs
+ * @returns vehicle_priv
+ */
+static struct vehicle_priv *
+vehicle_gypsy_new_gypsy(struct vehicle_methods *meth,
+ struct callback_list *cbl,
+ struct attr **attrs)
+{
+ struct vehicle_priv *ret;
+ struct attr *source, *retry_int;
+
+ dbg(1, "enter\n");
+ source = attr_search(attrs, NULL, attr_source);
+ ret = g_new0(struct vehicle_priv, 1);
+ ret->have_cords = 0;
+ ret->source = g_strdup(source->u.str);
+ ret->attrs = attrs;
+ retry_int = attr_search(attrs, NULL, attr_retry_interval);
+ if (retry_int) {
+ ret->retry_interval = retry_int->u.num;
+ if (ret->retry_interval < MIN_RETRY_INTERVAL) {
+ dbg(0, "Retry interval %d too small, setting to %d\n", ret->retry_interval, MIN_RETRY_INTERVAL);
+ ret->retry_interval = MIN_RETRY_INTERVAL;
+ }
+ } else {
+ dbg(0, "Retry interval not defined, setting to %d\n", DEFAULT_RETRY_INTERVAL);
+ ret->retry_interval = DEFAULT_RETRY_INTERVAL;
+ }
+ ret->cbl = cbl;
+ *meth = vehicle_gypsy_methods;
+ vehicle_gypsy_open(ret);
+ return ret;
+}
+
+/**
+ * @brief register vehicle_gypsy
+ *
+ * @returns nothing
+ */
+void
+plugin_init(void)
+{
+ dbg(1, "enter\n");
+ plugin_register_vehicle_type("gypsy", vehicle_gypsy_new_gypsy);
+}
diff --git a/vehicle/wince/Makefile.am b/vehicle/wince/Makefile.am
new file mode 100644
index 00000000..df96e0b6
--- /dev/null
+++ b/vehicle/wince/Makefile.am
@@ -0,0 +1,5 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/navit -DMODULE=vehicle_wince
+modulevehicle_LTLIBRARIES = libvehicle_wince.la
+libvehicle_wince_la_SOURCES = vehicle_wince.c
+libvehicle_wince_la_LDFLAGS = -module -avoid-version
diff --git a/vehicle/wince/vehicle_wince.c b/vehicle/wince/vehicle_wince.c
new file mode 100644
index 00000000..2b835448
--- /dev/null
+++ b/vehicle/wince/vehicle_wince.c
@@ -0,0 +1,614 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <math.h>
+#include "config.h"
+#include "debug.h"
+#include "callback.h"
+#include "plugin.h"
+#include "coord.h"
+#include "item.h"
+#include "vehicle.h"
+#include "event.h"
+#include <windows.h>
+#include <windowsx.h>
+#include <io.h>
+#include <winioctl.h>
+#include <winbase.h>
+#include "support/win32/ConvertUTF.h"
+
+#define SwitchToThread() Sleep(0)
+
+static void vehicle_wince_disable_watch(struct vehicle_priv *priv);
+static void vehicle_wince_enable_watch(struct vehicle_priv *priv);
+static int vehicle_wince_parse(struct vehicle_priv *priv, char *buffer);
+static int vehicle_wince_open(struct vehicle_priv *priv);
+static void vehicle_wince_close(struct vehicle_priv *priv);
+
+static int buffer_size = 256;
+
+struct vehicle_priv {
+ char *source;
+ struct callback_list *cbl;
+ int is_running;
+ int thread_up;
+ int fd;
+ HANDLE m_hGPSDevice; // Handle to the device
+ HANDLE m_hGPSThread; // Handle to the thread
+ DWORD m_dwGPSThread; // Thread id
+ HANDLE m_hEventPosition; // Handle to the position event
+ HANDLE m_hEventState; // Handle to the state event
+ HANDLE m_hEventStop; // Handle to the stop event
+ DWORD m_dwError; // Last error code
+
+ char *buffer;
+ int buffer_pos;
+ char *nmea_data;
+ char *nmea_data_buf;
+
+ struct coord_geo geo;
+ double speed;
+ double direction;
+ double height;
+ double hdop;
+ double vdop;
+ char fixtime[20];
+ int fixyear;
+ int fixmonth;
+ int fixday;
+ int status;
+ int sats_used;
+ int sats_visible;
+ int time;
+ int on_eof;
+ int no_data_count;
+ int baudrate;
+ struct attr ** attrs;
+ char fixiso8601[128];
+ int checksum_ignore;
+};
+
+static DWORD WINAPI wince_port_reader_thread (LPVOID lParam)
+{
+ struct vehicle_priv *pvt = lParam;
+ COMMTIMEOUTS commTiming;
+ BOOL status;
+ static char buffer[10*82*4] = {0,};
+ static int current_index = 0;
+ const int chunk_size = 3*82;
+ char* return_pos;
+ DWORD dwBytes;
+ char return_buffer[1024];
+ int havedata;
+ HANDLE hGPS;
+ // Com ports above 9 should be prefixed - $device/COM123
+ wchar_t portname[64];
+ mbstowcs(portname, pvt->source, strlen(pvt->source)+1);
+ dbg(0, "GPS Port:[%s]\n", pvt->source);
+ pvt->thread_up = 1;
+reconnect_port:
+ /* GPD0 is the control port for the GPS driver */
+ hGPS = CreateFile(L"GPD0:", GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
+ if (hGPS != INVALID_HANDLE_VALUE) {
+#ifndef IOCTL_SERVICE_REFRESH
+#define IOCTL_SERVICE_REFRESH 0x4100000C
+#endif
+ DeviceIoControl(hGPS,IOCTL_SERVICE_REFRESH,0,0,0,0,0,0);
+#ifndef IOCTL_SERVICE_START
+#define IOCTL_SERVICE_START 0x41000004
+#endif
+ DeviceIoControl(hGPS,IOCTL_SERVICE_START,0,0,0,0,0,0);
+ CloseHandle(hGPS);
+ }
+
+ while (pvt->is_running &&
+ (pvt->m_hGPSDevice = CreateFile(portname,
+ GENERIC_READ, 0,
+ NULL, OPEN_EXISTING, 0, 0)) == INVALID_HANDLE_VALUE) {
+ Sleep(1000);
+ dbg(0, "Waiting to connect to %s\n", pvt->source);
+ }
+ GetCommTimeouts (pvt->m_hGPSDevice, &commTiming);
+ commTiming.ReadIntervalTimeout = 20;
+ commTiming.ReadTotalTimeoutMultiplier = 0;
+ commTiming.ReadTotalTimeoutConstant = 200;
+
+ commTiming.WriteTotalTimeoutMultiplier=5;
+ commTiming.WriteTotalTimeoutConstant=5;
+ SetCommTimeouts (pvt->m_hGPSDevice, &commTiming);
+
+ if (pvt->baudrate) {
+ DCB portState;
+ if (!GetCommState(pvt->m_hGPSDevice, &portState)) {
+ MessageBox (NULL, TEXT ("GetCommState Error"), TEXT (""),
+ MB_APPLMODAL|MB_OK);
+ pvt->thread_up = 0;
+ return(1);
+ }
+ portState.BaudRate = pvt->baudrate;
+ if (!SetCommState(pvt->m_hGPSDevice, &portState)) {
+ MessageBox (NULL, TEXT ("SetCommState Error"), TEXT (""),
+ MB_APPLMODAL|MB_OK);
+ pvt->thread_up = 0;
+ return(1);
+ }
+ }
+ while (pvt->is_running) {
+ havedata = 0;
+ if (current_index + chunk_size >= sizeof(buffer)) {
+ // reset buffer
+ dbg(0, "GPS buffer reset\n");
+ current_index = 0;
+ memset(buffer, 0, sizeof(buffer));
+ }
+ status = ReadFile(pvt->m_hGPSDevice,
+ &buffer[current_index], chunk_size,
+ &dwBytes, NULL);
+ if (!status) {
+ CloseHandle(pvt->m_hGPSDevice);
+ pvt->m_hGPSDevice = NULL;
+ goto reconnect_port;
+ }
+ if (dwBytes > 0) {
+ int pos;
+ int consumed;
+ return_pos = NULL;
+ current_index += dwBytes;
+ buffer[current_index+1] = '\0';
+ //dbg(0, "buffer[%s]\n", buffer);
+ while (buffer[0]) {
+ pos = strcspn(buffer, "\r\n");
+ if (pos >= sizeof(return_buffer)) {
+ current_index = 0;
+ break;
+ }
+ if (pos) {
+ if (!buffer[pos])
+ break;
+ memcpy(return_buffer, buffer, pos);
+ return_buffer[pos] = '\0';
+ // dbg(0, "received %d : '%s' bytes to copy\n", bytes_to_copy, return_buffer );
+ havedata += vehicle_wince_parse(pvt, return_buffer);
+ }
+ consumed = pos + strspn(buffer+pos, "\r\n");
+ current_index -= consumed;
+ memmove(buffer,&buffer[consumed] ,
+ sizeof(buffer) - consumed);
+ buffer[current_index] = '\0';
+ }
+ if (havedata) {
+ // post a message so we can callback from
+ // the ui thread
+ event_call_callback(pvt->cbl);
+ }
+ } else {
+ pvt->no_data_count++;
+ }
+ }
+ CloseHandle(pvt->m_hGPSDevice);
+ pvt->m_hGPSDevice = NULL;
+ pvt->thread_up = 0;
+ return 0;
+}
+
+
+static int
+vehicle_wince_open(struct vehicle_priv *priv)
+{
+ dbg(1, "enter vehicle_wince_open, priv->source='%s'\n", priv->source);
+
+ if (priv->source ) {
+ char* raw_setting_str = g_strdup( priv->source );
+ char* strport = strchr(raw_setting_str, ':' );
+ char* strsettings = strchr(raw_setting_str, ' ' );
+
+ if (raw_setting_str && strport&&strsettings ) {
+ strport++;
+ *strsettings = '\0';
+ strsettings++;
+
+ dbg(0, "serial('%s', '%s')\n", strport, strsettings );
+ }
+ if (raw_setting_str)
+ g_free( raw_setting_str );
+ }
+ return 1;
+}
+
+static void
+vehicle_wince_close(struct vehicle_priv *priv)
+{
+ vehicle_wince_disable_watch(priv);
+}
+
+static int
+vehicle_wince_parse(struct vehicle_priv *priv, char *buffer)
+{
+ char *nmea_data_buf, *p, *item[16];
+ double lat, lng;
+ int i, bcsum;
+ int len;
+ unsigned char csum = 0;
+ int ret = 0;
+ int valid = 0;
+
+ len = strlen(buffer);
+ //dbg(0, "buffer='%s'\n", buffer);
+ for (;;) {
+ if (len < 4) {
+ dbg(0, "'%s' too short\n", buffer);
+ return ret;
+ }
+ if (buffer[len - 1] == '\r' || buffer[len - 1] == '\n')
+ buffer[--len] = '\0';
+ else
+ break;
+ }
+ if (buffer[0] != '$') {
+ dbg(0, "no leading $ in '%s'\n", buffer);
+ return ret;
+ }
+ if (buffer[len - 3] != '*') {
+ dbg(0, "no *XX in '%s'\n", buffer);
+ return ret;
+ }
+ for (i = 1; i < len - 3; i++) {
+ csum ^= (unsigned char) (buffer[i]);
+ }
+ if (!sscanf(buffer + len - 2, "%x", &bcsum)&& priv->checksum_ignore != 2) {
+ dbg(0, "no checksum in '%s'\n", buffer);
+ return ret;
+ }
+ if (bcsum != csum && priv->checksum_ignore == 0) {
+ dbg(0, "wrong checksum in '%s' %x vs %x\n", buffer, bcsum, csum);
+ return ret;
+ }
+// RMC, RMB, VTG, and GLL in nmea 2.3 have status
+// A=autonomous, D=differential, E=Estimated, N=not valid, S=Simulator.
+// Only A and D are valid
+ if (!priv->nmea_data_buf || strlen(priv->nmea_data_buf) < 65536) {
+ nmea_data_buf=g_strconcat(priv->nmea_data_buf ? priv->nmea_data_buf : "", buffer, "\n", NULL);
+ g_free(priv->nmea_data_buf);
+ priv->nmea_data_buf=nmea_data_buf;
+ } else {
+ dbg(0, "nmea buffer overflow, discarding '%s'\n", buffer);
+ }
+ i = 0;
+ p = buffer;
+ while (i < 16) {
+ item[i++] = p;
+ while (*p && *p != ',')
+ p++;
+ if (!*p)
+ break;
+ *p++ = '\0';
+ }
+ if (0) {
+ int j = 0;
+ for (j=0; j < i; j++)
+ dbg(0,"[%d] = %s\n", j, item[j]);
+ }
+
+ if (!strncmp(buffer, "$GPGGA", 6)) {
+ /* 1 1111
+ 0 1 2 3 4 5 6 7 8 9 0 1234
+ $GPGGA,184424.505,4924.2811,N,01107.8846,E,1,05,2.5,408.6,M,,,,0000*0C
+ UTC of Fix[1],Latitude[2],N/S[3],Longitude[4],E/W[5],Quality(0=inv,1=gps,2=dgps)[6],Satelites used[7],
+ HDOP[8],Altitude[9],"M"[10],height of geoid[11], "M"[12], time since dgps update[13], dgps ref station [14]
+ */
+ lat = strtod(item[2], NULL);
+ priv->geo.lat = floor(lat / 100);
+ lat -= priv->geo.lat * 100;
+ priv->geo.lat += lat / 60;
+
+ if (!strcasecmp(item[3],"S"))
+ priv->geo.lat=-priv->geo.lat;
+
+ lng = strtod(item[4], NULL);
+ priv->geo.lng = floor(lng / 100);
+ lng -= priv->geo.lng * 100;
+ priv->geo.lng += lng / 60;
+
+ if (!strcasecmp(item[5],"W"))
+ priv->geo.lng=-priv->geo.lng;
+
+ sscanf(item[6], "%d", &priv->status);
+ sscanf(item[7], "%d", &priv->sats_used);
+ sscanf(item[8], "%lf", &priv->hdop);
+ strcpy(priv->fixtime, item[1]);
+ sscanf(item[9], "%lf", &priv->height);
+ g_free(priv->nmea_data);
+ priv->nmea_data=priv->nmea_data_buf;
+ priv->nmea_data_buf=NULL;
+
+ // callback_list_call_0(priv->cbl);
+ return 1;
+ }
+ if (!strncmp(buffer, "$GPVTG", 6)) {
+
+ /* 0 1 2 34 5 6 7 8
+ $GPVTG,143.58,T,,M,0.26,N,0.5,K*6A
+ Course Over Ground Degrees True[1],"T"[2],Course Over Ground Degrees Magnetic[3],"M"[4],
+ Speed in Knots[5],"N"[6],"Speed in KM/H"[7],"K"[8]
+ */
+ if (item[1] && item[7])
+ valid = 1;
+ if (i == 9 && (*item[9] == 'A' || *item[9] == 'D'))
+ valid = 1;
+ if (valid) {
+ priv->direction = g_ascii_strtod( item[1], NULL );
+ priv->speed = g_ascii_strtod( item[7], NULL );
+ }
+ }
+ if (!strncmp(buffer, "$GPRMC", 6)) {
+ /* 1 1
+ 0 1 2 3 4 5 6 7 8 9 0 1
+ $GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A
+ Time[1],Active/Void[2],lat[3],N/S[4],long[5],W/E[6],speed in knots[7],track angle[8],date[9],
+ magnetic variation[10],magnetic variation direction[11]
+ */
+ if (*item[2] == 'A')
+ valid = 1;
+ if (i == 12 && (*item[12] == 'A' || *item[12] == 'D'))
+ valid = 1;
+ if (valid) {
+ priv->direction = g_ascii_strtod( item[8], NULL );
+ priv->speed = g_ascii_strtod( item[7], NULL );
+ priv->speed *= 1.852;
+ sscanf(item[9], "%02d%02d%02d",
+ &priv->fixday,
+ &priv->fixmonth,
+ &priv->fixyear);
+ priv->fixyear += 2000;
+ }
+ }
+ if (!strncmp(buffer, "$GPGSA", 6)) {
+ /*
+ GSA Satellite status
+ A Auto selection of 2D or 3D fix (M = manual)
+ 3 3D fix - values include: 1 = no fix
+ 2 = 2D fix
+ 3 = 3D fix
+ 04,05... PRNs of satellites used for fix (space for 12)
+ 2.5 PDOP (dilution of precision)
+ 1.3 Horizontal dilution of precision (HDOP)
+ 2.1 Vertical dilution of precision (VDOP)
+ *39 the checksum data, always begins with *
+ */
+ }
+ if (!strncmp(buffer, "$GPGSV", 6)) {
+ /*
+ 0 GSV Satellites in view
+ 1 2 Number of sentences for full data
+ 2 1 sentence 1 of 2
+ 3 08 Number of satellites in view
+
+ 4 01 Satellite PRN number
+ 5 40 Elevation, degrees
+ 6 083 Azimuth, degrees
+ 7 46 SNR - higher is better
+ for up to 4 satellites per sentence
+ *75 the checksum data, always begins with *
+ */
+ if (item[3]) {
+ sscanf(item[3], "%d", &priv->sats_visible);
+ }
+ }
+ if (!strncmp(buffer, "$GPZDA", 6)) {
+ /*
+ 0 1 2 3 4 5 6
+ $GPZDA,hhmmss.ss,dd,mm,yyyy,xx,yy*CC
+ hhmmss HrMinSec(UTC)
+ dd,mm,yyy Day,Month,Year
+ xx local zone hours -13..13
+ yy local zone minutes 0..59
+ */
+ if (item[1] && item[2] && item[3] && item[4]) {
+ // priv->fixtime = atof(item[1]);
+ strcpy(priv->fixtime, item[1]);
+ priv->fixday = atoi(item[2]);
+ priv->fixmonth = atoi(item[3]);
+ priv->fixyear = atoi(item[4]);
+ }
+ }
+ return ret;
+}
+
+static void
+vehicle_wince_enable_watch(struct vehicle_priv *priv)
+{
+ vehicle_wince_disable_watch(priv);
+ priv->is_running = 1;
+ priv->m_hGPSThread = CreateThread(NULL, 0, wince_port_reader_thread,
+ priv, 0, &priv->m_dwGPSThread);
+ if (!priv->m_hGPSThread) {
+ priv->is_running = 0;
+ // error creating thread
+ MessageBox (NULL, TEXT ("Can not create GPS reader thread"), TEXT (""),
+ MB_APPLMODAL|MB_OK);
+ }
+}
+
+static void
+vehicle_wince_disable_watch(struct vehicle_priv *priv)
+{
+ int wait = 5000;
+ priv->is_running = 0;
+// DWORD res;
+// res = WaitForSingleObject(priv->m_hGPSThread, 2000);
+//
+ while (wait-- > 0 && priv->thread_up) {
+ SwitchToThread();
+ }
+ if (priv->m_hGPSThread) {
+ // Terminate reader, sorry
+ TerminateThread(priv->m_hGPSThread, -1);
+ }
+}
+
+
+static void
+vehicle_wince_destroy(struct vehicle_priv *priv)
+{
+ vehicle_wince_close(priv);
+ if (priv->source)
+ g_free(priv->source);
+ if (priv->buffer)
+ g_free(priv->buffer);
+ g_free(priv);
+}
+
+static int
+vehicle_wince_position_attr_get(struct vehicle_priv *priv,
+ enum attr_type type, struct attr *attr)
+{
+ struct attr * active=NULL;
+ int check_status = 0;
+
+ switch (type) {
+ case attr_position_fix_type:
+ attr->u.num = priv->status;
+ break;
+ case attr_position_height:
+ check_status = 1;
+ attr->u.numd = &priv->height;
+ break;
+ case attr_position_speed:
+ check_status = 1;
+ attr->u.numd = &priv->speed;
+ break;
+ case attr_position_direction:
+ check_status = 1;
+ attr->u.numd = &priv->direction;
+ break;
+ case attr_position_hdop:
+ attr->u.numd = &priv->hdop;
+ break;
+ case attr_position_qual:
+ attr->u.num = priv->sats_visible;
+ break;
+ case attr_position_sats_used:
+ attr->u.num = priv->sats_used;
+ break;
+ case attr_position_coord_geo:
+ check_status = 1;
+ attr->u.coord_geo = &priv->geo;
+ break;
+ case attr_position_nmea:
+ attr->u.str=priv->nmea_data;
+ if (!attr->u.str)
+ return 0;
+ break;
+ case attr_position_time_iso8601:
+ if (!priv->fixyear || !priv->fixtime[0])
+ return 0;
+ sprintf(priv->fixiso8601, "%04d-%02d-%02dT%sZ",
+ priv->fixyear, priv->fixmonth, priv->fixday,
+ priv->fixtime);
+ attr->u.str=priv->fixiso8601;
+ break;
+ case attr_active:
+ if (active != NULL && active->u.num == 1)
+ return 1;
+ else
+ return 0;
+ break;
+ default:
+ return 0;
+ }
+ attr->type = type;
+ if (check_status && 0 == priv->status)
+ return 0;
+ return 1;
+}
+
+struct vehicle_methods vehicle_wince_methods = {
+ vehicle_wince_destroy,
+ vehicle_wince_position_attr_get,
+};
+
+static struct vehicle_priv *
+vehicle_wince_new(struct vehicle_methods
+ *meth, struct callback_list
+ *cbl, struct attr **attrs)
+{
+ struct vehicle_priv *ret;
+ struct attr *source;
+ struct attr *time;
+ struct attr *on_eof;
+ struct attr *baudrate;
+ struct attr *checksum_ignore;
+ char *cp;
+
+ dbg(1, "enter\n");
+ source = attr_search(attrs, NULL, attr_source);
+ ret = g_new0(struct vehicle_priv, 1);
+ ret->fd = -1;
+ ret->cbl = cbl;
+ cp = strchr(source->u.str,':');
+ if (cp)
+ cp++;
+ else
+ cp = source->u.str;
+ ret->source = g_strdup(cp);
+ ret->buffer = g_malloc(buffer_size);
+ ret->time=1000;
+ ret->baudrate=0; // do not change the rate if not configured
+ // ret->fixtime = 0.0f;
+ time = attr_search(attrs, NULL, attr_time);
+ if (time)
+ ret->time=time->u.num;
+ baudrate = attr_search(attrs, NULL, attr_baudrate);
+ if (baudrate) {
+ ret->baudrate = baudrate->u.num;
+ }
+ ret->attrs = attrs;
+ checksum_ignore = attr_search(attrs, NULL, attr_checksum_ignore);
+ if (checksum_ignore)
+ ret->checksum_ignore=checksum_ignore->u.num;
+ on_eof = attr_search(attrs, NULL, attr_on_eof);
+ if (on_eof && !strcasecmp(on_eof->u.str, "stop"))
+ ret->on_eof=1;
+ if (on_eof && !strcasecmp(on_eof->u.str, "exit"))
+ ret->on_eof=2;
+ dbg(0,"on_eof=%d\n", ret->on_eof);
+ *meth = vehicle_wince_methods;
+ if (vehicle_wince_open(ret)) {
+ vehicle_wince_enable_watch(ret);
+ return ret;
+ }
+ ret->no_data_count = 0;
+ dbg(0, "Failed to open '%s'\n", ret->source);
+ vehicle_wince_destroy(ret);
+ return NULL;
+}
+
+void
+plugin_init(void)
+{
+ dbg(1, "enter\n");
+ plugin_register_vehicle_type("wince", vehicle_wince_new);
+}
diff --git a/vehicleprofile.c b/vehicleprofile.c
new file mode 100644
index 00000000..e887200a
--- /dev/null
+++ b/vehicleprofile.c
@@ -0,0 +1,127 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+#include "debug.h"
+#include "item.h"
+#include "roadprofile.h"
+#include "vehicleprofile.h"
+
+static void
+vehicleprofile_set_attr_do(struct vehicleprofile *this_, struct attr *attr)
+{
+ dbg(1,"%s:%d\n", attr_to_name(attr->type), attr->u.num);
+ switch (attr->type) {
+ case attr_flags:
+ this_->flags=attr->u.num;
+ break;
+ case attr_flags_forward_mask:
+ this_->flags_forward_mask=attr->u.num;
+ break;
+ case attr_flags_reverse_mask:
+ this_->flags_reverse_mask=attr->u.num;
+ break;
+ case attr_maxspeed_handling:
+ this_->maxspeed_handling=attr->u.num;
+ break;
+ case attr_route_mode:
+ this_->mode=attr->u.num;
+ break;
+ case attr_name:
+ if(this_->name)
+ g_free(this_->name);
+ /* previously used strdupn not available on win32 */
+ this_->name = g_strdup(attr->u.str);
+ break;
+ default:
+ break;
+ }
+}
+
+struct vehicleprofile *
+vehicleprofile_new(struct attr *parent, struct attr **attrs)
+{
+ struct vehicleprofile *this_;
+ struct attr **attr, *type_attr;
+ if (! (type_attr=attr_search(attrs, NULL, attr_name))) {
+ return NULL;
+ }
+ this_=g_new0(struct vehicleprofile, 1);
+ this_->attrs=attr_list_dup(attrs);
+ this_->roadprofile_hash=g_hash_table_new(NULL, NULL);
+ for (attr=attrs;*attr; attr++)
+ vehicleprofile_set_attr_do(this_, *attr);
+ return this_;
+}
+
+int
+vehicleprofile_get_attr(struct vehicleprofile *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
+{
+ return attr_generic_get_attr(this_->attrs, NULL, type, attr, iter);
+}
+
+int
+vehicleprofile_set_attr(struct vehicleprofile *this_, struct attr *attr)
+{
+ vehicleprofile_set_attr_do(this_, attr);
+ this_->attrs=attr_generic_set_attr(this_->attrs, attr);
+ return 1;
+}
+
+int
+vehicleprofile_add_attr(struct vehicleprofile *this_, struct attr *attr)
+{
+ this_->attrs=attr_generic_add_attr(this_->attrs, attr);
+ struct attr item_types_attr;
+ switch (attr->type) {
+ case attr_roadprofile:
+ if (roadprofile_get_attr(attr->u.roadprofile, attr_item_types, &item_types_attr, NULL)) {
+ enum item_type *types=item_types_attr.u.item_types;
+ while (*types != type_none) {
+ g_hash_table_insert(this_->roadprofile_hash, (void *)(long)(*types), attr->u.roadprofile);
+ types++;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ return 1;
+}
+
+int
+vehicleprofile_remove_attr(struct vehicleprofile *this_, struct attr *attr)
+{
+ this_->attrs=attr_generic_remove_attr(this_->attrs, attr);
+ return 1;
+}
+
+struct roadprofile *
+vehicleprofile_get_roadprofile(struct vehicleprofile *this_, enum item_type type)
+{
+ return g_hash_table_lookup(this_->roadprofile_hash, (void *)(long)type);
+}
+
+char *
+vehicleprofile_get_name(struct vehicleprofile *this_)
+{
+ return this_->name;
+}
diff --git a/vehicleprofile.h b/vehicleprofile.h
new file mode 100644
index 00000000..47ce832f
--- /dev/null
+++ b/vehicleprofile.h
@@ -0,0 +1,41 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+struct vehicleprofile {
+ int mode; /**< 0 = Auto, 1 = On-Road, 2 = Off-Road */
+ int flags_forward_mask; /**< Flags mask for moving in positive direction */
+ int flags_reverse_mask; /**< Flags mask for moving in reverse direction */
+ int flags; /**< Required flags to move through a segment */
+ int maxspeed_handling; /**< 0 = Always, 1 = Only if lower, 2 = Never */
+ int static_speed; /**< Maximum speed of vehicle to consider it stationary */
+ int static_distance; /**< Maximum distance of previous position of vehicle to consider it stationary */
+ char *name; // the vehicle profile name
+ struct attr **attrs;
+ GHashTable *roadprofile_hash;
+};
+
+struct vehicleprofile * vehicleprofile_new(struct attr *parent, struct attr **attrs);
+int vehicleprofile_get_attr(struct vehicleprofile *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter);
+int vehicleprofile_set_attr(struct vehicleprofile *this_, struct attr *attr);
+int vehicleprofile_add_attr(struct vehicleprofile *this_, struct attr *attr);
+int vehicleprofile_remove_attr(struct vehicleprofile *this_, struct attr *attr);
+struct roadprofile * vehicleprofile_get_roadprofile(struct vehicleprofile *this_, enum item_type type);
+
+//! Returns the vehicle profile's name.
+char * vehicleprofile_get_name(struct vehicleprofile *this_);
diff --git a/window.h b/window.h
new file mode 100644
index 00000000..b2e2acb7
--- /dev/null
+++ b/window.h
@@ -0,0 +1,24 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2009 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+struct window {
+ void *priv;
+ int (*fullscreen)(struct window *win, int on);
+ void (*disable_suspend)(struct window *win);
+};
diff --git a/xmlconfig.c b/xmlconfig.c
new file mode 100644
index 00000000..331cb668
--- /dev/null
+++ b/xmlconfig.c
@@ -0,0 +1,922 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/* see http://library.gnome.org/devel/glib/stable/glib-Simple-XML-Subset-Parser.html
+ * for details on how the xml file parser works.
+ */
+
+#include <glib.h>
+#include <glib/gprintf.h>
+#include <string.h>
+#include "debug.h"
+#include "config.h"
+#include "file.h"
+#include "coord.h"
+#include "layout.h"
+#include "mapset.h"
+#include "projection.h"
+#include "map.h"
+#include "navigation.h"
+#include "navit.h"
+#include "plugin.h"
+#include "route.h"
+#include "speech.h"
+#include "track.h"
+#include "vehicle.h"
+#include "point.h"
+#include "graphics.h"
+#include "gui.h"
+#include "osd.h"
+#include "log.h"
+#include "cursor.h"
+#include "announcement.h"
+#include "vehicleprofile.h"
+#include "roadprofile.h"
+#include "xmlconfig.h"
+
+#ifdef HAVE_GLIB
+#define ATTR_DISTANCE 1
+#else
+#include "ezxml.h"
+#define ATTR_DISTANCE 2
+#define G_MARKUP_ERROR 0
+#define G_MARKUP_ERROR_INVALID_CONTENT 0
+#define G_MARKUP_ERROR_PARSE 0
+#define G_MARKUP_ERROR_UNKNOWN_ELEMENT 0
+typedef void * GMarkupParseContext;
+#endif
+
+struct xistate {
+ struct xistate *parent;
+ struct xistate *child;
+ const gchar *element;
+ const gchar **attribute_names;
+ const gchar **attribute_values;
+};
+
+struct xmldocument {
+ const gchar *href;
+ const gchar *xpointer;
+ gpointer user_data;
+ struct xistate *first;
+ struct xistate *last;
+ int active;
+ int level;
+};
+
+
+struct xmlstate {
+ const gchar **attribute_names;
+ const gchar **attribute_values;
+ struct xmlstate *parent;
+ struct attr element_attr;
+ const gchar *element;
+ xmlerror **error;
+ struct element_func *func;
+ struct object_func *object_func;
+ struct xmldocument *document;
+};
+
+
+struct attr_fixme {
+ char *element;
+ char **attr_fixme;
+};
+
+static struct attr ** convert_to_attrs(struct xmlstate *state, struct attr_fixme *fixme)
+{
+ const gchar **attribute_name=state->attribute_names;
+ const gchar **attribute_value=state->attribute_values;
+ const gchar *name;
+ int count=0;
+ struct attr **ret;
+ static int fixme_count;
+
+ while (*attribute_name) {
+ count++;
+ attribute_name++;
+ }
+ ret=g_new(struct attr *, count+1);
+ attribute_name=state->attribute_names;
+ count=0;
+ while (*attribute_name) {
+ name=*attribute_name;
+ if (fixme) {
+ char **attr_fixme=fixme->attr_fixme;
+ while (attr_fixme[0]) {
+ if (! strcmp(name, attr_fixme[0])) {
+ name=attr_fixme[1];
+ if (fixme_count++ < 10)
+ dbg(0,"Please change attribute '%s' to '%s' in <%s />\n", attr_fixme[0], attr_fixme[1], fixme->element);
+ break;
+ }
+ attr_fixme+=2;
+ }
+ }
+ ret[count]=attr_new_from_text(name,*attribute_value);
+ if (ret[count])
+ count++;
+ else if (strcmp(*attribute_name,"enabled"))
+ dbg(0,"failed to create attribute '%s' with value '%s'\n", *attribute_name,*attribute_value);
+ attribute_name++;
+ attribute_value++;
+ }
+ ret[count]=NULL;
+ dbg(1,"ret=%p\n", ret);
+ return ret;
+}
+
+
+static const char * find_attribute(struct xmlstate *state, const char *attribute, int required)
+{
+ const gchar **attribute_name=state->attribute_names;
+ const gchar **attribute_value=state->attribute_values;
+ while(*attribute_name) {
+ if(! g_ascii_strcasecmp(attribute,*attribute_name))
+ return *attribute_value;
+ attribute_name++;
+ attribute_value++;
+ }
+ if (required)
+ g_set_error(state->error,G_MARKUP_ERROR,G_MARKUP_ERROR_INVALID_CONTENT, "element '%s' is missing attribute '%s'", state->element, attribute);
+ return NULL;
+}
+
+static int
+find_boolean(struct xmlstate *state, const char *attribute, int deflt, int required)
+{
+ const char *value;
+
+ value=find_attribute(state, attribute, required);
+ if (! value)
+ return deflt;
+ if (g_ascii_strcasecmp(value,"no") && g_ascii_strcasecmp(value,"0") && g_ascii_strcasecmp(value,"false"))
+ return 1;
+ return 0;
+}
+
+/**
+ * * Convert a string number to int
+ * *
+ * * @param val the string value to convert
+ * * @returns int value of converted string
+ * */
+static int
+convert_number(const char *val)
+{
+ if (val)
+ return g_ascii_strtoull(val,NULL,0);
+ else
+ return 0;
+}
+
+static int
+xmlconfig_config(struct xmlstate *state)
+{
+ state->element_attr.u.data = (void *)1;
+ return 1;
+}
+
+static int
+xmlconfig_announce(struct xmlstate *state)
+{
+ const char *type,*value;
+ char key[32];
+ int level[3];
+ int i;
+ enum item_type itype;
+ char *tok, *type_str, *str;
+
+ type=find_attribute(state, "type", 1);
+ if (! type)
+ return 0;
+ for (i = 0 ; i < 3 ; i++) {
+ sprintf(key,"level%d", i);
+ value=find_attribute(state, key, 0);
+ if (value)
+ level[i]=convert_number(value);
+ else
+ level[i]=-1;
+ }
+ type_str=g_strdup(type);
+ str=type_str;
+ while ((tok=strtok(str, ","))) {
+ itype=item_from_name(tok);
+ navigation_set_announce(state->parent->element_attr.u.data, itype, level);
+ str=NULL;
+ }
+ g_free(type_str);
+ return 1;
+}
+/**
+ * * Define the elements in our config
+ * *
+ * */
+
+#define NEW(x) (void *(*)(struct attr *, struct attr **))(x)
+#define GET(x) (int (*)(void *, enum attr_type type, struct attr *attr, struct attr_iter *iter))(x)
+#define ITERN(x) (struct attr_iter * (*)(void *))(x)
+#define ITERD(x) (void (*)(struct attr_iter *iter))(x)
+#define SET(x) (int (*)(void *, struct attr *attr))(x)
+#define ADD(x) (int (*)(void *, struct attr *attr))(x)
+#define REMOVE(x) (int (*)(void *, struct attr *attr))(x)
+#define INIT(x) (int (*)(void *))(x)
+#define DESTROY(x) (void (*)(void *))(x)
+
+static struct object_func object_funcs[] = {
+ { attr_announcement,NEW(announcement_new), GET(announcement_get_attr), NULL, NULL, SET(announcement_set_attr), ADD(announcement_add_attr) },
+ { attr_arrows, NEW(arrows_new)},
+ { attr_circle, NEW(circle_new), NULL, NULL, NULL, NULL, ADD(element_add_attr)},
+ { attr_coord, NEW(coord_new_from_attrs)},
+ { attr_cursor, NEW(cursor_new), NULL, NULL, NULL, NULL, ADD(cursor_add_attr)},
+ { attr_debug, NEW(debug_new)},
+ { attr_graphics, NEW(graphics_new)},
+ { attr_gui, NEW(gui_new), GET(gui_get_attr)},
+ { attr_icon, NEW(icon_new), NULL, NULL, NULL, NULL, ADD(element_add_attr)},
+ { attr_image, NEW(image_new)},
+ { attr_itemgra, NEW(itemgra_new), NULL, NULL, NULL, NULL, ADD(itemgra_add_attr)},
+ { attr_layer, NEW(layer_new), NULL, NULL, NULL, NULL, ADD(layer_add_attr)},
+ { attr_layout, NEW(layout_new), NULL, NULL, NULL, NULL, ADD(layout_add_attr)},
+ { attr_log, NEW(log_new)},
+ { attr_map, NEW(map_new)},
+ { attr_mapset, NEW(mapset_new), NULL, NULL, NULL, NULL, ADD(mapset_add_attr)},
+ { attr_navigation, NEW(navigation_new), GET(navigation_get_attr)},
+ { attr_navit, NEW(navit_new), GET(navit_get_attr), ITERN(navit_attr_iter_new), ITERD(navit_attr_iter_destroy), SET(navit_set_attr), ADD(navit_add_attr), REMOVE(navit_remove_attr), INIT(navit_init), DESTROY(navit_destroy)},
+ { attr_osd, NEW(osd_new)},
+ { attr_plugins, NEW(plugins_new), NULL, NULL, NULL, NULL, NULL, NULL, INIT(plugins_init)},
+ { attr_plugin, NEW(plugin_new)},
+ { attr_polygon, NEW(polygon_new), NULL, NULL, NULL, NULL, ADD(element_add_attr)},
+ { attr_polyline, NEW(polyline_new), NULL, NULL, NULL, NULL, ADD(element_add_attr)},
+ { attr_roadprofile,NEW(roadprofile_new), GET(roadprofile_get_attr), NULL, NULL, SET(roadprofile_set_attr), ADD(roadprofile_add_attr) },
+ { attr_route, NEW(route_new), GET(route_get_attr)},
+ { attr_speech, NEW(speech_new), GET(speech_get_attr), NULL, NULL, SET(speech_set_attr)},
+ { attr_text, NEW(text_new)},
+ { attr_tracking, NEW(tracking_new)},
+ { attr_vehicle, NEW(vehicle_new), GET(vehicle_get_attr), NULL, NULL, NULL, ADD(vehicle_add_attr) },
+ { attr_vehicleprofile, NEW(vehicleprofile_new), GET(vehicleprofile_get_attr), NULL, NULL, SET(vehicleprofile_set_attr), ADD(vehicleprofile_add_attr) },
+};
+
+struct object_func *
+object_func_lookup(enum attr_type type)
+{
+ int i;
+ for (i = 0 ; i < sizeof(object_funcs)/sizeof(struct object_func); i++) {
+ if (object_funcs[i].type == type)
+ return &object_funcs[i];
+ }
+ return NULL;
+}
+
+struct element_func {
+ char *name;
+ char *parent;
+ int (*func)(struct xmlstate *state);
+ enum attr_type type;
+} elements[] = {
+ { "config", NULL, xmlconfig_config},
+ { "announce", "navigation", xmlconfig_announce},
+ { "speech", "navit", NULL, attr_speech},
+ { "tracking", "navit", NULL, attr_tracking},
+ { "route", "navit", NULL, attr_route},
+ { "mapset", "navit", NULL, attr_mapset},
+ { "map", "mapset", NULL, attr_map},
+ { "debug", "config", NULL, attr_debug},
+ { "osd", "navit", NULL, attr_osd},
+ { "navigation", "navit", NULL, attr_navigation},
+ { "navit", "config", NULL, attr_navit},
+ { "graphics", "navit", NULL, attr_graphics},
+ { "gui", "navit", NULL, attr_gui},
+ { "layout", "navit", NULL, attr_layout},
+ { "layer", "layout", NULL, attr_layer},
+ { "itemgra", "layer", NULL, attr_itemgra},
+ { "circle", "itemgra", NULL, attr_circle},
+ { "coord", "circle", NULL, attr_coord},
+ { "icon", "itemgra", NULL, attr_icon},
+ { "coord", "icon", NULL, attr_coord},
+ { "image", "itemgra", NULL, attr_image},
+ { "text", "itemgra", NULL, attr_text},
+ { "polygon", "itemgra", NULL, attr_polygon},
+ { "coord", "polygon", NULL, attr_coord},
+ { "polyline", "itemgra", NULL, attr_polyline},
+ { "coord", "polyline", NULL, attr_coord},
+ { "arrows", "itemgra", NULL, attr_arrows},
+ { "vehicle", "navit", NULL, attr_vehicle},
+ { "vehicleprofile", "navit", NULL, attr_vehicleprofile},
+ { "roadprofile", "vehicleprofile", NULL, attr_roadprofile},
+ { "announcement", "roadprofile", NULL, attr_announcement},
+ { "cursor", "vehicle", NULL, attr_cursor},
+ { "itemgra", "cursor", NULL, attr_itemgra},
+ { "log", "vehicle", NULL, attr_log},
+ { "log", "navit", NULL, attr_log},
+ { "plugins", "config", NULL, attr_plugins},
+ { "plugin", "plugins", NULL, attr_plugin},
+ {},
+};
+
+
+static char *attr_fixme_itemgra[]={
+ "type","item_types",
+ NULL,NULL,
+};
+
+static char *attr_fixme_text[]={
+ "label_size","text_size",
+ NULL,NULL,
+};
+
+static char *attr_fixme_circle[]={
+ "label_size","text_size",
+ NULL,NULL,
+};
+
+static struct attr_fixme attr_fixmes[]={
+ {"item",attr_fixme_itemgra},
+ {"itemgra",attr_fixme_itemgra},
+ {"text",attr_fixme_text},
+ {"label",attr_fixme_text},
+ {"circle",attr_fixme_circle},
+ {NULL,NULL},
+};
+
+
+static char *element_fixmes[]={
+ "item","itemgra",
+ "label","text",
+ NULL,NULL,
+};
+/**
+ * * Parse the opening tag of a config element
+ * *
+ * * @param context document parse context
+ * * @param element_name the current tag name
+ * * @param attribute_names ptr to return the set of attribute names
+ * * @param attribute_values ptr return the set of attribute values
+ * * @param user_data ptr to xmlstate structure
+ * * @param error ptr return error context
+ * * @returns nothing
+ * */
+
+static void
+start_element(GMarkupParseContext *context,
+ const gchar *element_name,
+ const gchar **attribute_names,
+ const gchar **attribute_values,
+ gpointer user_data,
+ xmlerror **error)
+{
+ struct xmlstate *new=NULL, **parent = user_data;
+ struct element_func *e=elements,*func=NULL;
+ struct attr_fixme *attr_fixme=attr_fixmes;
+ char **element_fixme=element_fixmes;
+ int found=0;
+ static int fixme_count;
+ const char *parent_name=NULL;
+ char *s,*sep="",*possible_parents;
+ dbg(2,"name='%s' parent='%s'\n", element_name, *parent ? (*parent)->element:NULL);
+
+ /* determine if we have to fix any attributes */
+ while (attr_fixme[0].element) {
+ if (!strcmp(element_name,attr_fixme[0].element))
+ break;
+ attr_fixme++;
+ }
+ if (!attr_fixme[0].element)
+ attr_fixme=NULL;
+
+ /* tell user to fix deprecated element names */
+ while (element_fixme[0]) {
+ if (!strcmp(element_name,element_fixme[0])) {
+ element_name=element_fixme[1];
+ if (fixme_count++ < 10)
+ dbg(0,"Please change <%s /> to <%s /> in config file\n", element_fixme[0], element_fixme[1]);
+ }
+ element_fixme+=2;
+ }
+ /* validate that this element is valid
+ * and that the element has a valid parent */
+ possible_parents=g_strdup("");
+ if (*parent)
+ parent_name=(*parent)->element;
+ while (e->name) {
+ if (!g_ascii_strcasecmp(element_name, e->name)) {
+ found=1;
+ s=g_strconcat(possible_parents,sep,e->parent,NULL);
+ g_free(possible_parents);
+ possible_parents=s;
+ sep=",";
+ if ((parent_name && e->parent && !g_ascii_strcasecmp(parent_name, e->parent)) ||
+ (!parent_name && !e->parent))
+ func=e;
+ }
+ e++;
+ }
+ if (! found) {
+ g_set_error(error,G_MARKUP_ERROR,G_MARKUP_ERROR_UNKNOWN_ELEMENT,
+ "Unknown element '%s'", element_name);
+ g_free(possible_parents);
+ return;
+ }
+ if (! func) {
+ g_set_error(error,G_MARKUP_ERROR,G_MARKUP_ERROR_INVALID_CONTENT,
+ "Element '%s' within unexpected context '%s'. Expected '%s'%s",
+ element_name, parent_name, possible_parents, ! strcmp(possible_parents, "config") ? "\nPlease add <config> </config> tags at the beginning/end of your navit.xml": "");
+ g_free(possible_parents);
+ return;
+ }
+ g_free(possible_parents);
+
+ new=g_new(struct xmlstate, 1);
+ new->attribute_names=attribute_names;
+ new->attribute_values=attribute_values;
+ new->parent=*parent;
+ new->element_attr.u.data=NULL;
+ new->element=element_name;
+ new->error=error;
+ new->func=func;
+ new->object_func=NULL;
+ *parent=new;
+ if (!find_boolean(new, "enabled", 1, 0))
+ return;
+ if (new->parent && !new->parent->element_attr.u.data)
+ return;
+ if (func->func) {
+ if (!func->func(new)) {
+ return;
+ }
+ } else {
+ struct attr **attrs;
+
+ new->object_func=object_func_lookup(func->type);
+ if (! new->object_func)
+ return;
+ attrs=convert_to_attrs(new,attr_fixme);
+ new->element_attr.type=attr_none;
+ new->element_attr.u.data = new->object_func->new(&new->parent->element_attr, attrs);
+ if (! new->element_attr.u.data)
+ return;
+ new->element_attr.type=attr_from_name(element_name);
+ if (new->element_attr.type == attr_none)
+ dbg(0,"failed to create object of type '%s'\n", element_name);
+ if (new->parent->object_func && new->parent->object_func->add_attr)
+ new->parent->object_func->add_attr(new->parent->element_attr.u.data, &new->element_attr);
+ }
+ return;
+}
+
+
+/* Called for close tags </foo> */
+static void
+end_element (GMarkupParseContext *context,
+ const gchar *element_name,
+ gpointer user_data,
+ xmlerror **error)
+{
+ struct xmlstate *curr, **state = user_data;
+
+ dbg(2,"name='%s'\n", element_name);
+ curr=*state;
+ if (curr->object_func && curr->object_func->init)
+ curr->object_func->init(curr->element_attr.u.data);
+ *state=curr->parent;
+ g_free(curr);
+}
+
+static gboolean parse_file(struct xmldocument *document, xmlerror **error);
+
+static void
+xinclude(GMarkupParseContext *context, const gchar **attribute_names, const gchar **attribute_values, struct xmldocument *doc_old, xmlerror **error)
+{
+ struct xmldocument doc_new;
+ struct file_wordexp *we;
+ int i,count;
+ const char *href=NULL;
+ char **we_files;
+
+ if (doc_old->level >= 16) {
+ g_set_error(error,G_MARKUP_ERROR,G_MARKUP_ERROR_INVALID_CONTENT, "xi:include recursion too deep");
+ return;
+ }
+ memset(&doc_new, 0, sizeof(doc_new));
+ i=0;
+ while (attribute_names[i]) {
+ if(!g_ascii_strcasecmp("href", attribute_names[i])) {
+ if (!href)
+ href=attribute_values[i];
+ else {
+ g_set_error(error,G_MARKUP_ERROR,G_MARKUP_ERROR_INVALID_CONTENT, "xi:include has more than one href");
+ return;
+ }
+ } else if(!g_ascii_strcasecmp("xpointer", attribute_names[i])) {
+ if (!doc_new.xpointer)
+ doc_new.xpointer=attribute_values[i];
+ else {
+ g_set_error(error,G_MARKUP_ERROR,G_MARKUP_ERROR_INVALID_CONTENT, "xi:include has more than one xpointer");
+ return;
+ }
+ } else {
+ g_set_error(error,G_MARKUP_ERROR,G_MARKUP_ERROR_INVALID_CONTENT, "xi:include has invalid attributes");
+ return;
+ }
+ i++;
+ }
+ if (!doc_new.xpointer && !href) {
+ g_set_error(error,G_MARKUP_ERROR,G_MARKUP_ERROR_INVALID_CONTENT, "xi:include has neither href nor xpointer");
+ return;
+ }
+ doc_new.level=doc_old->level+1;
+ doc_new.user_data=doc_old->user_data;
+ if (! href) {
+ dbg(1,"no href, using '%s'\n", doc_old->href);
+ doc_new.href=doc_old->href;
+ parse_file(&doc_new, error);
+ } else {
+ dbg(1,"expanding '%s'\n", href);
+ we=file_wordexp_new(href);
+ we_files=file_wordexp_get_array(we);
+ count=file_wordexp_get_count(we);
+ dbg(1,"%d results\n", count);
+ if (count != 1 || file_exists(we_files[0])) {
+ for (i = 0 ; i < count ; i++) {
+ dbg(1,"result[%d]='%s'\n", i, we_files[i]);
+ doc_new.href=we_files[i];
+ parse_file(&doc_new, error);
+ }
+ }
+ file_wordexp_destroy(we);
+
+ }
+
+}
+static int
+strncmp_len(const char *s1, int s1len, const char *s2)
+{
+ int ret;
+#if 0
+ char c[s1len+1];
+ strncpy(c, s1, s1len);
+ c[s1len]='\0';
+ dbg(0,"'%s' vs '%s'\n", c, s2);
+#endif
+
+ ret=strncmp(s1, s2, s1len);
+ if (ret)
+ return ret;
+ return strlen(s2)-s1len;
+}
+
+static int
+xpointer_value(const char *test, int len, struct xistate *elem, const char **out, int out_len)
+{
+ int i,ret=0;
+ if (len <= 0 || out_len <= 0) {
+ return 0;
+ }
+ if (!(strncmp_len(test,len,"name(.)"))) {
+ out[0]=elem->element;
+ return 1;
+ }
+ if (test[0] == '@') {
+ i=0;
+ while (elem->attribute_names[i] && out_len > 0) {
+ if (!strncmp_len(test+1,len-1,elem->attribute_names[i])) {
+ out[ret++]=elem->attribute_values[i];
+ out_len--;
+ }
+ i++;
+ }
+ return ret;
+ }
+ return 0;
+}
+
+static int
+xpointer_test(const char *test, int len, struct xistate *elem)
+{
+ int eq,i,count,vlen,cond_req=1,cond=0;
+ char c;
+ const char *tmp[16];
+#if 0
+ char test2[len+1];
+
+ strncpy(test2, test, len);
+ test2[len]='\0';
+ dbg(0,"%s\n", test2);
+#endif
+ if (!len)
+ return 0;
+ c=test[len-1];
+ if (c != '\'' && c != '"')
+ return 0;
+ eq=strcspn(test, "=");
+ if (eq >= len || test[eq+1] != c)
+ return 0;
+ vlen=eq;
+ if (eq > 0 && test[eq-1] == '!') {
+ cond_req=0;
+ vlen--;
+ }
+ count=xpointer_value(test,vlen,elem,tmp,16);
+ for (i = 0 ; i < count ; i++) {
+ if (!strncmp_len(test+eq+2,len-eq-3, tmp[i]))
+ cond=1;
+ }
+ if (cond == cond_req)
+ return 1;
+ return 0;
+}
+
+static int
+xpointer_element_match(const char *xpointer, int len, struct xistate *elem)
+{
+ int start,tlen,tlen2;
+#if 0
+ char test2[len+1];
+
+ strncpy(test2, xpointer, len);
+ test2[len]='\0';
+ dbg(0,"%s\n", test2);
+#endif
+ start=strcspn(xpointer, "[");
+ if (start > len)
+ start=len;
+ if (strncmp_len(xpointer, start, elem->element) && (start != 1 || xpointer[0] != '*'))
+ return 0;
+ if (start == len)
+ return 1;
+ if (xpointer[len-1] != ']')
+ return 0;
+ tlen=len-start-2;
+ for (;;) {
+ start++;
+ tlen2=strcspn(xpointer+start,"]");
+ if (start + tlen2 > len)
+ return 1;
+ if (!xpointer_test(xpointer+start, tlen2, elem))
+ return 0;
+ start+=tlen2+1;
+ }
+}
+
+static int
+xpointer_xpointer_match(const char *xpointer, int len, struct xistate *first)
+{
+ const char *c;
+ int s;
+ dbg(2,"%s\n", xpointer);
+ if (xpointer[0] != '/')
+ return 0;
+ c=xpointer+1;
+ len--;
+ do {
+ s=strcspn(c, "/");
+ if (s > len)
+ s=len;
+ if (! xpointer_element_match(c, s, first))
+ return 0;
+ first=first->child;
+ c+=s+1;
+ len-=s+1;
+ } while (len > 0 && first);
+ if (len > 0)
+ return 0;
+ return 1;
+}
+
+static int
+xpointer_match(const char *xpointer, struct xistate *first)
+{
+ char *prefix="xpointer(";
+ int len;
+ if (! xpointer)
+ return 1;
+ len=strlen(xpointer);
+ if (strncmp(xpointer,prefix,strlen(prefix)))
+ return 0;
+ if (xpointer[len-1] != ')')
+ return 0;
+ return xpointer_xpointer_match(xpointer+strlen(prefix), len-strlen(prefix)-1, first);
+
+}
+
+static void
+xi_start_element(GMarkupParseContext *context,
+ const gchar *element_name,
+ const gchar **attribute_names,
+ const gchar **attribute_values,
+ gpointer user_data,
+ xmlerror **error)
+{
+ struct xmldocument *doc=user_data;
+ struct xistate *xistate;
+ int i,count=0;
+ while (attribute_names[count++*ATTR_DISTANCE]);
+ xistate=g_new0(struct xistate, 1);
+ xistate->element=element_name;
+ xistate->attribute_names=g_new0(const char *, count);
+ xistate->attribute_values=g_new0(const char *, count);
+ for (i = 0 ; i < count ; i++) {
+ if (attribute_names[i*ATTR_DISTANCE] && attribute_values[i*ATTR_DISTANCE]) {
+ xistate->attribute_names[i]=g_strdup(attribute_names[i*ATTR_DISTANCE]);
+ xistate->attribute_values[i]=g_strdup(attribute_values[i*ATTR_DISTANCE]);
+ }
+ }
+ xistate->parent=doc->last;
+
+ if (doc->last) {
+ doc->last->child=xistate;
+ } else
+ doc->first=xistate;
+ doc->last=xistate;
+ if (doc->active > 0 || xpointer_match(doc->xpointer, doc->first)) {
+ if(!g_ascii_strcasecmp("xi:include", element_name)) {
+ xinclude(context, xistate->attribute_names, xistate->attribute_values, doc, error);
+ return;
+ }
+ start_element(context, element_name, xistate->attribute_names, xistate->attribute_values, doc->user_data, error);
+ doc->active++;
+ }
+
+}
+/**
+ * * Reached closing tag of a config element
+ * *
+ * * @param context
+ * * @param element name
+ * * @param user_data ptr to xmldocument
+ * * @param error ptr to struct for error information
+ * * @returns nothing
+ * */
+
+static void
+xi_end_element (GMarkupParseContext *context,
+ const gchar *element_name,
+ gpointer user_data,
+ xmlerror **error)
+{
+ struct xmldocument *doc=user_data;
+ struct xistate *xistate=doc->last;
+ int i=0;
+ doc->last=doc->last->parent;
+ if (! doc->last)
+ doc->first=NULL;
+ else
+ doc->last->child=NULL;
+ if (doc->active > 0) {
+ if(!g_ascii_strcasecmp("xi:include", element_name)) {
+ return;
+ }
+ end_element(context, element_name, doc->user_data, error);
+ doc->active--;
+ }
+ while (xistate->attribute_names[i]) {
+ g_free((char *)(xistate->attribute_names[i]));
+ g_free((char *)(xistate->attribute_values[i]));
+ i++;
+ }
+ g_free(xistate->attribute_names);
+ g_free(xistate->attribute_values);
+ g_free(xistate);
+}
+
+/* Called for character data */
+/* text is not nul-terminated */
+static void
+xi_text (GMarkupParseContext *context,
+ const gchar *text,
+ gsize text_len,
+ gpointer user_data,
+ xmlerror **error)
+{
+}
+
+
+#ifdef HAVE_GLIB
+
+static const GMarkupParser parser = {
+ xi_start_element,
+ xi_end_element,
+ xi_text,
+ NULL,
+ NULL
+};
+/**
+ * * Parse the contents of the configuration file
+ * *
+ * * @param document struct holding info about the config file
+ * * @param error info on any errors detected
+ * * @returns boolean TRUE or FALSE
+ * */
+
+static gboolean
+parse_file(struct xmldocument *document, xmlerror **error)
+{
+ GMarkupParseContext *context;
+ gchar *contents, *message;
+ gsize len;
+ gint line, chr;
+ gboolean result;
+
+ dbg(1,"enter filename='%s'\n", document->href);
+ context = g_markup_parse_context_new (&parser, 0, document, NULL);
+
+ if (!g_file_get_contents (document->href, &contents, &len, error)) {
+ g_markup_parse_context_free (context);
+ return FALSE;
+ }
+ document->active=document->xpointer ? 0:1;
+ document->first=NULL;
+ document->last=NULL;
+ result = g_markup_parse_context_parse (context, contents, len, error);
+ if (!result && error && *error) {
+ g_markup_parse_context_get_position(context, &line, &chr);
+ message=g_strdup_printf("%s at line %d, char %d\n", (*error)->message, line, chr);
+ g_free((*error)->message);
+ (*error)->message=message;
+ }
+ g_markup_parse_context_free (context);
+ g_free (contents);
+ dbg(1,"return %d\n", result);
+
+ return result;
+}
+#else
+static void
+parse_node(struct xmldocument *document, ezxml_t node)
+{
+ while (node) {
+ xi_start_element(NULL,node->name, node->attr, node->attr+1, document, NULL);
+ if (node->txt)
+ xi_text(NULL,node->txt,strlen(node->txt),document,NULL);
+ if (node->child)
+ parse_node(document, node->child);
+ xi_end_element (NULL,node->name,document,NULL);
+ node=node->ordered;
+ }
+}
+
+static gboolean
+parse_file(struct xmldocument *document, xmlerror **error)
+{
+ int fd;
+ ezxml_t root;
+ /* BUG workaround: ezxml parse file leaves negative fds unclosed */
+ fd = open(document->href, O_RDONLY, 0);
+ if (fd == -1)
+ return FALSE;
+ root = ezxml_parse_fd(fd);
+ close(fd);
+ if (!root)
+ return FALSE;
+ document->active=document->xpointer ? 0:1;
+ document->first=NULL;
+ document->last=NULL;
+
+ parse_node(document, root);
+
+ return TRUE;
+}
+#endif
+
+/**
+ * * Load and parse the master config file
+ * *
+ * * @param filename FQFN of the file
+ * * @param error ptr to error details, if any
+ * * @returns boolean TRUE or FALSE (if error detected)
+ * */
+
+gboolean config_load(const char *filename, xmlerror **error)
+{
+ struct xmldocument document;
+ struct xmlstate *curr=NULL;
+ gboolean result;
+
+ dbg(1,"enter filename='%s'\n", filename);
+ memset(&document, 0, sizeof(document));
+ document.href=filename;
+ document.user_data=&curr;
+ result=parse_file(&document, error);
+ if (result && curr) {
+ g_set_error(error,G_MARKUP_ERROR,G_MARKUP_ERROR_PARSE, "element '%s' not closed", curr->element);
+ result=FALSE;
+ }
+ dbg(1,"return %d\n", result);
+ return result;
+}
+
diff --git a/xmlconfig.h b/xmlconfig.h
new file mode 100644
index 00000000..0e5e4931
--- /dev/null
+++ b/xmlconfig.h
@@ -0,0 +1,42 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef NAVIT_XMLCONFIG_H
+#define NAVIT_XMLCONFIG_H
+
+struct object_func {
+ enum attr_type type;
+ void *(*new)(struct attr *parent, struct attr **attrs);
+ int (*get_attr)(void *, enum attr_type type, struct attr *attr, struct attr_iter *iter);
+ struct attr_iter *(*iter_new)(void *);
+ void (*iter_destroy)(struct attr_iter *);
+ int (*set_attr)(void *, struct attr *attr);
+ int (*add_attr)(void *, struct attr *attr);
+ int (*remove_attr)(void *, struct attr *attr);
+ int (*init)(void *);
+ void (*destroy)(void *);
+};
+
+typedef GError xmlerror;
+struct container;
+gboolean config_load(const char *filename, xmlerror **error);
+struct object_func *object_func_lookup(enum attr_type type);
+
+#endif
+
diff --git a/xpm/Makefile.am b/xpm/Makefile.am
new file mode 100644
index 00000000..7521ee46
--- /dev/null
+++ b/xpm/Makefile.am
@@ -0,0 +1,221 @@
+include $(top_srcdir)/Makefile.inc
+
+xpm_DATA = bench.xpm
+xpm_DATA += biergarten.xpm
+xpm_DATA += boundary_stone.xpm
+xpm_DATA += bus_halt.xpm
+xpm_DATA += cafe.xpm
+xpm_DATA += camping.xpm
+xpm_DATA += car_dealer.xpm
+xpm_DATA += castle.xpm
+xpm_DATA += ruins.xpm
+xpm_DATA += cemetery.xpm
+xpm_DATA += cursor.xpm
+xpm_DATA += dumping-station.xpm
+xpm_DATA += fountain.xpm
+xpm_DATA += flag_bk_tr.xpm flag_bk_wh.xpm flag_bl_wh.xpm flag_wh_bk.xpm
+xpm_DATA += golf.xpm
+xpm_DATA += gc_tradi.xpm
+xpm_DATA += gc_multi.xpm
+xpm_DATA += gc_mystery.xpm
+xpm_DATA += gc_event.xpm
+xpm_DATA += gc_reference.xpm
+xpm_DATA += gc_webcam.xpm
+xpm_DATA += gc_question.xpm
+xpm_DATA += gc_stages.xpm
+xpm_DATA += heliport.xpm
+xpm_DATA += highway_exit.xpm
+xpm_DATA += hunting_stand.xpm
+xpm_DATA += hotel.xpm
+xpm_DATA += information.xpm
+xpm_DATA += justice.xpm
+xpm_DATA += level_crossing.xpm
+xpm_DATA += library.xpm
+xpm_DATA += mini_roundabout.xpm
+xpm_DATA += memorial.xpm
+xpm_DATA += military.xpm
+xpm_DATA += museum.xpm
+xpm_DATA += nav_left_1.xpm nav_left_2.xpm
+xpm_DATA += nav_right_1.xpm nav_right_2.xpm
+xpm_DATA += nav_straight.xpm nav_straight_32.xpm
+xpm_DATA += nav_left_1_32.xpm nav_left_2_32.xpm
+xpm_DATA += nav_right_1_32.xpm nav_right_2_32.xpm
+xpm_DATA += parking.xpm
+xpm_DATA += pharmacy.xpm
+xpm_DATA += picnic.xpm
+xpm_DATA += potable_water.xpm
+xpm_DATA += restaurant.xpm
+xpm_DATA += restroom.xpm
+xpm_DATA += shelter.xpm
+xpm_DATA += skiing.xpm
+xpm_DATA += sport.xpm
+xpm_DATA += swimming.xpm
+xpm_DATA += telephone.xpm
+xpm_DATA += theater.xpm
+xpm_DATA += toilets.xpm
+xpm_DATA += tower.xpm
+xpm_DATA += townhall.xpm
+xpm_DATA += trailerpark.xpm
+xpm_DATA += unknown.xpm
+xpm_DATA += wifi.xpm
+xpm_DATA += viewpoint.xpm
+xpm_DATA += zoo.xpm
+xpm_DATA += zoom_in.xpm
+xpm_DATA += zoom_out.xpm
+xpm_DATA += toggle_fullscreen.xpm
+xpm_DATA += menu.xpm
+xpm_DATA += school.xpm
+xpm_DATA += public_office.xpm
+
+svgs = gui_actions.svg
+svgs += gui_active.svg
+svgs += gui_bookmark.svg
+svgs += gui_display.svg
+svgs += gui_help.svg
+svgs += gui_home.svg
+svgs += gui_inactive.svg
+svgs += gui_map.svg
+svgs += gui_maps.svg
+svgs += gui_rules.svg
+svgs += gui_settings.svg
+svgs += gui_sound.svg
+svgs += gui_sound_off.svg
+svgs += gui_tools.svg
+svgs += gui_fullscreen.svg
+svgs += gui_leave_fullscreen.svg
+svgs += gui_quit.svg gui_stop.svg
+svgs += gui_town.svg
+svgs += gui_vehicle.svg
+svgs += gui_zoom_in.svg
+svgs += gui_zoom_out.svg
+svgs += zoom_in.svg
+svgs += zoom_out.svg
+svgs += tec_common.svg
+svgs += gui_select_street.svg
+svgs += gui_select_town.svg
+svgs += gui_select_country.svg
+svgs += gui_arrow_left.svg
+svgs += gui_arrow_right.svg
+svgs += gui_arrow_up.svg
+svgs += gui_arrow_down.svg
+svgs += gui_menu.svg
+svgs += gui_strength_0.svg
+svgs += gui_strength_1.svg
+svgs += gui_strength_2.svg
+svgs += gui_strength_3.svg
+svgs += gui_strength_4.svg
+svgs += gui_strength_5.svg
+svgs += gui_minus.svg
+svgs += gui_plus.svg
+svgs += gui_log.svg
+
+svgs += airport.svg
+svgs += attraction.svg
+svgs += bank.svg
+svgs += bar.svg
+svgs += boat_ramp.svg
+svgs += bus.svg
+svgs += cinema.svg
+svgs += exit.svg
+svgs += fastfood.svg
+svgs += firebrigade.svg
+svgs += fuel.svg
+svgs += hospital.svg
+svgs += peak.svg
+svgs += police.svg
+svgs += post.svg
+svgs += shopping.svg
+svgs += traffic_signals.svg
+svgs += church.svg
+
+nav_svgs = nav_left_1_bk.svg nav_left_1_wh.svg nav_left_2_bk.svg nav_left_2_wh.svg nav_left_3_bk.svg nav_left_3_wh.svg
+nav_svgs += nav_right_1_bk.svg nav_right_1_wh.svg nav_right_2_bk.svg nav_right_2_wh.svg nav_right_3_bk.svg nav_right_3_wh.svg
+nav_svgs += nav_roundabout_l1_bk.svg nav_roundabout_l1_wh.svg nav_roundabout_l2_bk.svg nav_roundabout_l2_wh.svg
+nav_svgs += nav_roundabout_l3_bk.svg nav_roundabout_l3_wh.svg nav_roundabout_l4_bk.svg nav_roundabout_l4_wh.svg
+nav_svgs += nav_roundabout_l5_bk.svg nav_roundabout_l5_wh.svg nav_roundabout_l6_bk.svg nav_roundabout_l6_wh.svg
+nav_svgs += nav_roundabout_l7_bk.svg nav_roundabout_l7_wh.svg nav_roundabout_l8_bk.svg nav_roundabout_l8_wh.svg
+nav_svgs += nav_roundabout_r1_bk.svg nav_roundabout_r1_wh.svg nav_roundabout_r2_bk.svg nav_roundabout_r2_wh.svg
+nav_svgs += nav_roundabout_r3_bk.svg nav_roundabout_r3_wh.svg nav_roundabout_r4_bk.svg nav_roundabout_r4_wh.svg
+nav_svgs += nav_roundabout_r5_bk.svg nav_roundabout_r5_wh.svg nav_roundabout_r6_bk.svg nav_roundabout_r6_wh.svg
+nav_svgs += nav_roundabout_r7_bk.svg nav_roundabout_r7_wh.svg nav_roundabout_r8_bk.svg nav_roundabout_r8_wh.svg
+nav_svgs += nav_straight_bk.svg nav_straight_wh.svg nav_turnaround_left_bk.svg nav_turnaround_left_wh.svg
+nav_svgs += nav_turnaround_right_bk.svg nav_turnaround_right_wh.svg nav_destination_bk.svg nav_destination_wh.svg
+
+flag_svgs = country_.svgz country_AD.svgz country_AE.svgz country_AF.svgz country_AG.svgz country_AI.svgz country_AL.svgz country_AM.svgz
+flag_svgs += country_AN.svgz country_AO.svgz country_AQ.svgz country_AR.svgz country_AS.svgz country_AT.svgz country_AU.svgz country_AW.svgz
+flag_svgs += country_AX.svgz country_AZ.svgz country_BA.svgz country_BB.svgz country_BD.svgz country_BE.svgz country_BF.svgz
+flag_svgs += country_BG.svgz country_BH.svgz country_BI.svgz country_BJ.svgz country_BL.svgz country_BM.svgz country_BN.svgz
+flag_svgs += country_BO.svgz country_BR.svgz country_BS.svgz country_BT.svgz country_BV.svgz country_BW.svgz country_BY.svgz
+flag_svgs += country_BZ.svgz country_CA.svgz country_CC.svgz country_CD.svgz country_CF.svgz country_CG.svgz country_CH.svgz
+flag_svgs += country_CI.svgz country_CK.svgz country_CL.svgz country_CM.svgz country_CN.svgz country_CO.svgz country_CR.svgz
+flag_svgs += country_CU.svgz country_CV.svgz country_CX.svgz country_CY.svgz country_CZ.svgz country_DE.svgz country_DJ.svgz
+flag_svgs += country_DK.svgz country_DM.svgz country_DO.svgz country_DZ.svgz country_EC.svgz country_EE.svgz country_EG.svgz
+flag_svgs += country_EH.svgz country_ER.svgz country_ES.svgz country_ET.svgz country_FI.svgz country_FJ.svgz country_FK.svgz
+flag_svgs += country_FM.svgz country_FO.svgz country_FR.svgz country_GA.svgz country_GB.svgz country_GD.svgz country_GE.svgz
+flag_svgs += country_GF.svgz country_GG.svgz country_GH.svgz country_GI.svgz country_GL.svgz country_GM.svgz country_GN.svgz
+flag_svgs += country_GP.svgz country_GQ.svgz country_GR.svgz country_GS.svgz country_GT.svgz country_GU.svgz country_GW.svgz
+flag_svgs += country_GY.svgz country_HK.svgz country_HM.svgz country_HN.svgz country_HR.svgz country_HT.svgz country_HU.svgz
+flag_svgs += country_ID.svgz country_IE.svgz country_IL.svgz country_IM.svgz country_IN.svgz country_IO.svgz country_IQ.svgz
+flag_svgs += country_IR.svgz country_IS.svgz country_IT.svgz country_JE.svgz country_JM.svgz country_JO.svgz country_JP.svgz
+flag_svgs += country_KE.svgz country_KG.svgz country_KH.svgz country_KI.svgz country_KM.svgz country_KN.svgz country_KP.svgz
+flag_svgs += country_KR.svgz country_KW.svgz country_KY.svgz country_KZ.svgz country_LA.svgz country_LB.svgz country_LC.svgz
+flag_svgs += country_LI.svgz country_LK.svgz country_LR.svgz country_LS.svgz country_LT.svgz country_LU.svgz country_LV.svgz
+flag_svgs += country_LY.svgz country_MA.svgz country_MC.svgz country_MD.svgz country_ME.svgz country_MF.svgz country_MG.svgz
+flag_svgs += country_MH.svgz country_MK.svgz country_ML.svgz country_MM.svgz country_MN.svgz country_MO.svgz country_MP.svgz
+flag_svgs += country_MQ.svgz country_MR.svgz country_MS.svgz country_MT.svgz country_MU.svgz country_MV.svgz country_MW.svgz
+flag_svgs += country_MX.svgz country_MY.svgz country_MZ.svgz country_NA.svgz country_NC.svgz country_NE.svgz country_NF.svgz
+flag_svgs += country_NG.svgz country_NI.svgz country_NL.svgz country_NO.svgz country_NP.svgz country_NR.svgz country_NU.svgz
+flag_svgs += country_NZ.svgz country_OM.svgz country_PA.svgz country_PE.svgz country_PF.svgz country_PG.svgz country_PH.svgz
+flag_svgs += country_PK.svgz country_PL.svgz country_PM.svgz country_PN.svgz country_PR.svgz country_PS.svgz country_PT.svgz
+flag_svgs += country_PW.svgz country_PY.svgz country_QA.svgz country_RE.svgz country_RO.svgz country_RS.svgz country_RU.svgz
+flag_svgs += country_RW.svgz country_SA.svgz country_SB.svgz country_SC.svgz country_SD.svgz country_SE.svgz country_SG.svgz
+flag_svgs += country_SH.svgz country_SI.svgz country_SJ.svgz country_SK.svgz country_SL.svgz country_SM.svgz country_SN.svgz
+flag_svgs += country_SO.svgz country_SR.svgz country_ST.svgz country_SV.svgz country_SY.svgz country_SZ.svgz country_TC.svgz
+flag_svgs += country_TD.svgz country_TF.svgz country_TG.svgz country_TH.svgz country_TJ.svgz country_TK.svgz country_TL.svgz
+flag_svgs += country_TM.svgz country_TN.svgz country_TO.svgz country_TR.svgz country_TT.svgz country_TV.svgz country_TW.svgz
+flag_svgs += country_TZ.svgz country_UA.svgz country_UG.svgz country_UM.svgz country_US.svgz country_UY.svgz country_UZ.svgz
+flag_svgs += country_VA.svgz country_VC.svgz country_VE.svgz country_VG.svgz country_VI.svgz country_VN.svgz country_VU.svgz
+flag_svgs += country_WF.svgz country_WS.svgz country_YE.svgz country_YT.svgz country_ZA.svgz country_ZM.svgz country_ZW.svgz
+
+if USE_SVG
+ xpm_DATA += $(svgs) $(nav_svgs) $(flag_svgs)
+endif
+
+if USE_SVG2PNG
+%.png:$(srcdir)/*.svgz
+ SRCDIR=$(srcdir) $(srcdir)/navit_svg2png "@SVG2PNG@" "$@"
+%.png:$(srcdir)/*.svg
+ SRCDIR=$(srcdir) $(srcdir)/navit_svg2png "@SVG2PNG@" "$@"
+pngs = $(addsuffix .png,$(basename $(svgs)))
+xsize=$(word 1,$(subst x, ,$(scale)))
+ysize=$(word $(words $(scale)),$(subst x, ,$(scale)))
+comma=,
+if USE_SVG2PNG_SCALES
+pngs += $(foreach scale, $(subst $(comma), ,@SVG2PNG_SCALES@), $(addsuffix _$(xsize)_$(ysize).png,$(basename $(svgs))))
+endif
+if USE_SVG2PNG_SCALES_FLAG
+pngs += $(foreach scale, $(subst $(comma), ,@SVG2PNG_SCALES_FLAG@), $(addsuffix _$(xsize)_$(ysize).png,$(basename $(flag_svgs))))
+endif
+if USE_SVG2PNG_SCALES_NAV
+pngs += $(foreach scale, $(subst $(comma), ,@SVG2PNG_SCALES_NAV@), $(addsuffix _$(xsize)_$(ysize).png,$(basename $(nav_svgs))))
+endif
+xpm_DATA += $(pngs)
+endif
+
+DESKTOPFILEdir=$(datadir)/applications
+DESKTOPFILE_DATA = desktop_icons/navit.desktop
+
+ICON128dir=$(datadir)/icons/hicolor/128x128/apps
+ICON128_DATA = desktop_icons/128x128/navit.png
+
+ICON22dir=$(datadir)/icons/hicolor/22x22/apps
+ICON22_DATA = desktop_icons/22x22/navit.png
+
+EXTRA_DIST = $(xpm_DATA) $(DESKTOPFILE_DATA) $(ICON128_DATA) $(ICON22_DATA) navit_svg2png
+#burgerking.ico:
+# wget http://www.burgerking.de/favicon.ico -O burgerking.ico
+
+if USE_SVG2PNG
+distclean-local:
+ rm -f $(pngs)
+endif
diff --git a/xpm/airport.svg b/xpm/airport.svg
new file mode 100644
index 00000000..c21edce7
--- /dev/null
+++ b/xpm/airport.svg
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="airport.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/projets/navit/icons/png/airport.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3181">
+ <stop
+ id="stop3183"
+ offset="0"
+ style="stop-color:#ffffff;stop-opacity:0;" />
+ <stop
+ id="stop3185"
+ offset="1"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3169">
+ <stop
+ style="stop-color:#d2d2d2;stop-opacity:1;"
+ offset="0"
+ id="stop3171" />
+ <stop
+ style="stop-color:#656565;stop-opacity:1;"
+ offset="1"
+ id="stop3173" />
+ </linearGradient>
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#0083f4"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="15.839192"
+ inkscape:cx="5.4622369"
+ inkscape:cy="14.72009"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:window-width="1024"
+ inkscape:window-height="699"
+ inkscape:window-x="0"
+ inkscape:window-y="25">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2380"
+ visible="true"
+ enabled="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ style="fill:#0083f4;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;stroke-dasharray:none"
+ d="M 10.90625 1.0625 C 10.2601 1.0859246 9.6526591 1.7005043 9.0625 2.84375 L 9.0625 6.9375 L 1 11.78125 L 1 14.4375 L 9.0625 12.8125 L 9.0625 17.75 L 5.78125 19.71875 L 5.78125 21.09375 L 10.96875 20.0625 L 16.125 21.09375 L 16.125 19.71875 L 12.9375 17.8125 L 12.9375 12.8125 L 21 14.4375 L 21 11.78125 L 12.9375 6.9375 L 12.9375 2.84375 C 12.228331 1.6068057 11.5524 1.0390754 10.90625 1.0625 z "
+ id="rect3173" />
+ <path
+ style="fill:#215430;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M -25.973036,9.4879786 L -15.973037,3.4879785 L -5.973038,9.4879786 L -5.973038,12.16655 L -15.973037,10.16655 L -25.973036,12.16655 L -25.973036,9.4879786 z"
+ id="path2390"
+ sodipodi:nodetypes="ccccccc" />
+ <path
+ style="fill:#215430;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M -21.182288,17.443887 L -16.01768,14.345121 L -10.853072,17.443887 L -10.853072,18.827264 L -16.01768,17.794342 L -21.182288,18.827264 L -21.182288,17.443887 z"
+ id="path2392"
+ sodipodi:nodetypes="ccccccc" />
+ <path
+ style="fill:#215430;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M -17.915001,0.56833497 C -16.734683,-1.7181565 -15.44941,-1.9055536 -14.031073,0.56833497 L -14.031073,17.755835 L -17.915001,17.755835 L -17.915001,0.56833497 z"
+ id="path2394"
+ sodipodi:nodetypes="ccccc" />
+ </g>
+</svg>
diff --git a/xpm/airport.xpm b/xpm/airport.xpm
new file mode 100644
index 00000000..e6e33a84
--- /dev/null
+++ b/xpm/airport.xpm
@@ -0,0 +1,63 @@
+/* XPM */
+static char *dummy[]={
+"16 16 44 1",
+". c None",
+"m c #000000",
+"b c #010101",
+"z c #020202",
+"e c #030303",
+"c c #040404",
+"h c #050505",
+"d c #060606",
+"w c #090909",
+"t c #0a0a0a",
+"q c #0b0b0b",
+"x c #0c0c0c",
+"v c #0d0d0d",
+"J c #111111",
+"n c #151515",
+"K c #181818",
+"a c #191919",
+"I c #333333",
+"C c #363636",
+"i c #545454",
+"g c #5d5d5d",
+"r c #606060",
+"H c #666666",
+"D c #6a6a6a",
+"l c #6c6c6c",
+"j c #707070",
+"E c #737373",
+"y c #747474",
+"B c #797979",
+"p c #7c7c7c",
+"u c #858585",
+"M c #878787",
+"G c #888888",
+"P c #8a8a8a",
+"s c #8b8b8b",
+"O c #909090",
+"L c #949494",
+"# c #a0a0a0",
+"F c #a2a2a2",
+"f c #a3a3a3",
+"A c #a4a4a4",
+"o c #a5a5a5",
+"k c #a7a7a7",
+"N c #a8a8a8",
+".......##.......",
+".......aa.......",
+".......bb.......",
+".......cd.......",
+".......ee.......",
+".......ce.......",
+".....fghhij.....",
+"...klhmmmmcno...",
+"..pmmmmmmmmmqr..",
+"stmmmmcmeccmmmnu",
+"vmwxyf.zz.ABahmC",
+"DEF....dm....GyH",
+".......cc.......",
+".....oIbbJA.....",
+".....Kmeemm.....",
+".....LMkNOP....."};
diff --git a/xpm/attraction.svg b/xpm/attraction.svg
new file mode 100644
index 00000000..86ed5a4a
--- /dev/null
+++ b/xpm/attraction.svg
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="attraction.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/projets/navit/icons/png/attraction.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3151">
+ <stop
+ style="stop-color:#6cff81;stop-opacity:1;"
+ offset="0"
+ id="stop3153" />
+ <stop
+ style="stop-color:#109026;stop-opacity:1;"
+ offset="1"
+ id="stop3155" />
+ </linearGradient>
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3151"
+ id="linearGradient3157"
+ x1="5.8379931"
+ y1="5.0950255"
+ x2="11.171147"
+ y2="8.0432262"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#f4ca00"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="16"
+ inkscape:cx="18.158254"
+ inkscape:cy="11.17505"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:window-width="943"
+ inkscape:window-height="682"
+ inkscape:window-x="-4"
+ inkscape:window-y="24">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2380"
+ visible="true"
+ enabled="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ sodipodi:type="star"
+ style="opacity:1;fill:url(#linearGradient3157);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.69094230999999995;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path2383"
+ sodipodi:sides="5"
+ sodipodi:cx="8.3928576"
+ sodipodi:cy="8.2321424"
+ sodipodi:r1="6.8401251"
+ sodipodi:r2="3.4200625"
+ sodipodi:arg1="0.94295973"
+ sodipodi:arg2="1.5712783"
+ inkscape:flatsided="false"
+ inkscape:rounded="0"
+ inkscape:randomized="0"
+ d="M 12.410715,13.767857 L 8.3912092,11.652205 L 4.3696665,13.763982 L 5.1396758,9.2874321 L 1.8885314,6.1152927 L 6.383929,5.4642852 L 8.396154,1.3920182 L 10.404453,5.4662229 L 14.899221,6.1215629 L 11.645021,9.2905675 L 12.410715,13.767857 z"
+ transform="matrix(1.4115471,0,0,1.4839561,-0.8483516,-0.2482945)" />
+ </g>
+</svg>
diff --git a/xpm/attraction.xpm b/xpm/attraction.xpm
new file mode 100644
index 00000000..90234c7e
--- /dev/null
+++ b/xpm/attraction.xpm
@@ -0,0 +1,22 @@
+/* XPM */
+static char *dummy[]={
+"16 16 3 1",
+". c None",
+"a c #2c2c2c",
+"# c #484848",
+"................",
+".......#a.......",
+".......##.......",
+".......##.......",
+".......##.......",
+"......####......",
+"###############.",
+"..############..",
+"...##########...",
+"....########....",
+".....######.....",
+"....########....",
+"....###.####....",
+"....##....##....",
+"...##......#....",
+"...#........#..."};
diff --git a/xpm/bank.svg b/xpm/bank.svg
new file mode 100644
index 00000000..a08a4d96
--- /dev/null
+++ b/xpm/bank.svg
@@ -0,0 +1,193 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="bank.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/projets/navit/icons/png/bank.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3173">
+ <stop
+ style="stop-color:#33b400;stop-opacity:1;"
+ offset="0"
+ id="stop3175" />
+ <stop
+ style="stop-color:#93cb00;stop-opacity:1;"
+ offset="1"
+ id="stop3177" />
+ </linearGradient>
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ <inkscape:perspective
+ id="perspective2390"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3173"
+ id="linearGradient3179"
+ x1="1.0178572"
+ y1="6.2410717"
+ x2="8.7142859"
+ y2="6.2410717"
+ gradientUnits="userSpaceOnUse"
+ spreadMethod="reflect" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3173"
+ id="linearGradient3182"
+ gradientUnits="userSpaceOnUse"
+ spreadMethod="reflect"
+ x1="1.0178572"
+ y1="6.2410717"
+ x2="8.7142859"
+ y2="6.2410717"
+ gradientTransform="matrix(1.0605835,0,0,1.0620282,-0.5527848,0.1776314)" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#22a638"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="1"
+ inkscape:pageshadow="2"
+ inkscape:zoom="11.2"
+ inkscape:cx="10.796387"
+ inkscape:cy="15.570919"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:window-width="943"
+ inkscape:window-height="682"
+ inkscape:window-x="0"
+ inkscape:window-y="25">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2380"
+ visible="true"
+ enabled="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="opacity:1;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.98289597;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect2382"
+ width="21.056721"
+ height="21.056721"
+ x="0.48869637"
+ y="0.4886966" />
+ <path
+ style="fill:url(#linearGradient3182);fill-opacity:1;fill-rule:evenodd;stroke:#0d4300;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 2.193369,8.2755965 C 4.6236295,5.398295 7.8351628,5.6503419 11,5.7153499 C 13.825482,6.0742653 16.729468,5.5684517 19.806631,3.1551033 L 19.806631,10.456547 C 17.082066,12.683193 14.226857,14.059491 11,13.016794 C 8.0644563,12.535247 5.1289127,13.033062 2.193369,15.577041 L 2.193369,8.2755965 z"
+ id="rect3171"
+ sodipodi:nodetypes="ccccccc" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#b4a300;fill-opacity:1;fill-rule:evenodd;stroke:#433800;stroke-width:1.32791519;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3186"
+ sodipodi:cx="4.375"
+ sodipodi:cy="12"
+ sodipodi:rx="3.125"
+ sodipodi:ry="3.125"
+ d="M 7.5,12 A 3.125,3.125 0 1 1 1.25,12 A 3.125,3.125 0 1 1 7.5,12 z"
+ transform="matrix(1,0,0,0.5670996,10.910714,7.6190477)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#b4a300;fill-opacity:1;fill-rule:evenodd;stroke:#433800;stroke-width:1.32791519;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path2395"
+ sodipodi:cx="4.375"
+ sodipodi:cy="12"
+ sodipodi:rx="3.125"
+ sodipodi:ry="3.125"
+ d="M 7.5,12 A 3.125,3.125 0 1 1 1.25,12 A 3.125,3.125 0 1 1 7.5,12 z"
+ transform="matrix(1,0,0,0.5670996,2.5,10.654762)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#b4a300;fill-opacity:1;fill-rule:evenodd;stroke:#433800;stroke-width:1.32791519;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3184"
+ sodipodi:cx="4.375"
+ sodipodi:cy="12"
+ sodipodi:rx="3.125"
+ sodipodi:ry="3.125"
+ d="M 7.5,12 A 3.125,3.125 0 1 1 1.25,12 A 3.125,3.125 0 1 1 7.5,12 z"
+ transform="matrix(1,0,0,0.5670996,12.410714,11.011905)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#b4a300;fill-opacity:1;fill-rule:evenodd;stroke:#433800;stroke-width:1.32791519;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3169"
+ sodipodi:cx="4.375"
+ sodipodi:cy="12"
+ sodipodi:rx="3.125"
+ sodipodi:ry="3.125"
+ d="M 7.5,12 A 3.125,3.125 0 1 1 1.25,12 A 3.125,3.125 0 1 1 7.5,12 z"
+ transform="matrix(1,0,0,0.5670996,8.5,10.654762)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#b4a300;fill-opacity:1;fill-rule:evenodd;stroke:#433800;stroke-width:1.32791519;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3167"
+ sodipodi:cx="4.375"
+ sodipodi:cy="12"
+ sodipodi:rx="3.125"
+ sodipodi:ry="3.125"
+ d="M 7.5,12 A 3.125,3.125 0 1 1 1.25,12 A 3.125,3.125 0 1 1 7.5,12 z"
+ transform="matrix(1,0,0,0.5670996,6.5,9.5205628)" />
+ <text
+ xml:space="preserve"
+ style="font-size:7.2734828px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="8.6464329"
+ y="11.712525"
+ id="text2394"><tspan
+ sodipodi:role="line"
+ id="tspan2396"
+ x="8.6464329"
+ y="11.712525">$</tspan></text>
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#b4a300;fill-opacity:1;fill-rule:evenodd;stroke:#433800;stroke-width:1.32791519;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3188"
+ sodipodi:cx="4.375"
+ sodipodi:cy="12"
+ sodipodi:rx="3.125"
+ sodipodi:ry="3.125"
+ d="M 7.5,12 A 3.125,3.125 0 1 1 1.25,12 A 3.125,3.125 0 1 1 7.5,12 z"
+ transform="matrix(1,0,0,0.5670996,6.1428569,7.1948048)" />
+ </g>
+</svg>
diff --git a/navit/xpm/bank.xpm b/xpm/bank.xpm
index cb21ffdb..cb21ffdb 100644
--- a/navit/xpm/bank.xpm
+++ b/xpm/bank.xpm
diff --git a/xpm/bar.svg b/xpm/bar.svg
new file mode 100644
index 00000000..44c6083d
--- /dev/null
+++ b/xpm/bar.svg
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="bar.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/navit/icons/png/bar.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#f4ca00"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="16"
+ inkscape:cx="18.00973"
+ inkscape:cy="10.084813"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:window-width="943"
+ inkscape:window-height="682"
+ inkscape:window-x="-4"
+ inkscape:window-y="24"
+ showguides="true"
+ inkscape:guide-bbox="true"
+ inkscape:snap-global="false">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2380"
+ visible="true"
+ enabled="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#e5ff39;fill-opacity:1;fill-rule:evenodd;stroke:#aaaf00;stroke-width:0.74631548;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3157"
+ sodipodi:cx="6.3639612"
+ sodipodi:cy="0.9739809"
+ sodipodi:rx="2.9168155"
+ sodipodi:ry="2.9168155"
+ d="M 9.2807767,0.9739809 A 2.9168155,2.9168155 0 1 1 3.4471457,0.9739809 A 2.9168155,2.9168155 0 1 1 9.2807767,0.9739809 z"
+ transform="matrix(1.3416456,0,0,1.3381885,2.0831091,3.1319181)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#e5ff39;fill-opacity:1;fill-rule:evenodd;stroke:#aaaf00;stroke-width:0.74631548;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3155"
+ sodipodi:cx="6.3639612"
+ sodipodi:cy="0.9739809"
+ sodipodi:rx="2.9168155"
+ sodipodi:ry="2.9168155"
+ d="M 9.2807767,0.9739809 A 2.9168155,2.9168155 0 1 1 3.4471457,0.9739809 A 2.9168155,2.9168155 0 1 1 9.2807767,0.9739809 z"
+ transform="matrix(1.3416456,0,0,1.3381885,-1.5337588,4.3147209)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#e5ff39;fill-opacity:1;fill-rule:evenodd;stroke:#aaaf00;stroke-width:0.74631548;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3159"
+ sodipodi:cx="6.3639612"
+ sodipodi:cy="0.9739809"
+ sodipodi:rx="2.9168155"
+ sodipodi:ry="2.9168155"
+ d="M 9.2807767,0.9739809 A 2.9168155,2.9168155 0 1 1 3.4471457,0.9739809 A 2.9168155,2.9168155 0 1 1 9.2807767,0.9739809 z"
+ transform="matrix(1.3416456,0,0,1.3381885,4.8698763,4.7287019)" />
+ <path
+ style="fill:#b9d500;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 2.5802671,4.5048738 L 16.055717,4.6231541 L 16.277778,20.502853 L 2.5953769,20.561993 L 2.5802671,4.5048738 z"
+ id="rect2381"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 16.059205,7.3933677 C 20.204787,7.4385313 20.4421,15.229925 16.237084,15.295003"
+ id="path3158"
+ sodipodi:nodetypes="cc" />
+ <path
+ style="opacity:0.3;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 5.586164,7.0643331 L 5.586164,17.827838"
+ id="path3161"
+ sodipodi:nodetypes="cc" />
+ <path
+ style="opacity:0.3;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 7.6444553,7.0643331 L 7.6444553,17.827838"
+ id="path3163"
+ sodipodi:nodetypes="cc" />
+ <path
+ style="opacity:0.3;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 9.515246,7.0643331 L 9.515246,17.827838"
+ id="path3165"
+ sodipodi:nodetypes="cc" />
+ <path
+ style="opacity:0.3;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 11.515246,7.0643331 L 11.515246,17.827838"
+ id="path3160"
+ sodipodi:nodetypes="cc" />
+ <path
+ style="opacity:0.3;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 13.515246,7.0643331 L 13.515246,17.827838"
+ id="path3162"
+ sodipodi:nodetypes="cc" />
+ </g>
+</svg>
diff --git a/xpm/bar.xpm b/xpm/bar.xpm
new file mode 100644
index 00000000..d0516545
--- /dev/null
+++ b/xpm/bar.xpm
@@ -0,0 +1,21 @@
+/* XPM */
+static char *dummy[]={
+"16 16 2 1",
+". c None",
+"# c #000000",
+"................",
+"................",
+"...#########....",
+"....########....",
+".....#....#.....",
+"......#..#......",
+".......##.......",
+".......##.......",
+".......##.......",
+".......##.......",
+".......##.......",
+".......##.......",
+"......####......",
+".....######.....",
+"................",
+"................"};
diff --git a/xpm/bench.xpm b/xpm/bench.xpm
new file mode 100644
index 00000000..5a9007f4
--- /dev/null
+++ b/xpm/bench.xpm
@@ -0,0 +1,21 @@
+/* XPM */
+static char *dummy[]={
+"16 16 2 1",
+". c None",
+"# c #000000",
+"................",
+"................",
+"................",
+"................",
+"................",
+"................",
+".##############.",
+"...#........#...",
+"...#........#...",
+"...#........#...",
+"................",
+"................",
+"................",
+"................",
+"................",
+"................"};
diff --git a/xpm/biergarten.xpm b/xpm/biergarten.xpm
new file mode 100644
index 00000000..91d2e491
--- /dev/null
+++ b/xpm/biergarten.xpm
@@ -0,0 +1,111 @@
+/* XPM */
+static char *dummy[]={
+"16 16 92 2",
+"Qt c None",
+"#p c #745f2b",
+"#q c #775713",
+"#h c #776741",
+"#i c #785309",
+"#a c #7d653c",
+"#o c #7f795f",
+"#b c #804d02",
+"#r c #805f10",
+".3 c #806238",
+"#j c #815401",
+".V c #846031",
+".U c #868884",
+"#s c #876d1c",
+".4 c #884e02",
+".N c #885f2a",
+"#t c #897a3c",
+"#c c #8a5400",
+"#k c #8a5f01",
+"#z c #8f876b",
+".F c #916825",
+".W c #925101",
+".M c #92928d",
+".5 c #935600",
+"#l c #947207",
+"#d c #956300",
+"#m c #957b18",
+".# c #95948f",
+".w c #967327",
+"#w c #998a6d",
+".E c #999790",
+".O c #9a5700",
+"#y c #9b8d6b",
+".u c #9c9b93",
+"#x c #9d8d69",
+".X c #9e5c00",
+".6 c #9f6701",
+"#e c #9f7406",
+"#g c #9f8d52",
+"#v c #9f9a8a",
+"#u c #9f9b7e",
+"#n c #a19663",
+".2 c #a2a3a0",
+".n c #a3915f",
+"#f c #a47f15",
+".v c #a5a5a1",
+".P c #a66200",
+".G c #a66400",
+".g c #a6a49b",
+".D c #a8a6a0",
+".Y c #a96d00",
+".7 c #aa7604",
+".9 c #ab975c",
+".x c #af7404",
+".8 c #b08515",
+".Q c #b26f00",
+"#. c #b3b3ac",
+".H c #b46f00",
+".Z c #b57d07",
+".1 c #b7a062",
+".y c #ba7e05",
+".T c #baa059",
+".f c #babab6",
+".0 c #bb8916",
+".R c #bf8205",
+".L c #bfa457",
+"## c #bfc0be",
+".I c #c07b00",
+".a c #c0beba",
+".S c #c18c0f",
+".C c #c1aa60",
+".t c #c1b382",
+".m c #c2c1b8",
+".o c #c5a660",
+".e c #c5c4c0",
+".z c #c68a08",
+".J c #c98c08",
+".K c #c9930d",
+".c c #cdcbc7",
+".d c #ceccc9",
+".b c #cfcdca",
+".p c #d0b067",
+".A c #d39e22",
+".B c #d4a72f",
+".q c #d6b86c",
+".r c #dec077",
+".s c #dec37a",
+".h c #e1dcd4",
+".j c #e8e2d8",
+".i c #e9e4db",
+".l c #ece7df",
+".k c #ede7df",
+"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt",
+"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt",
+"QtQtQtQt.#.a.b.c.d.e.fQtQtQtQtQt",
+"QtQtQtQt.g.h.i.j.k.l.mQtQtQtQtQt",
+"QtQtQtQt.n.o.p.q.r.s.t.u.vQtQtQt",
+"QtQtQtQt.w.x.y.z.A.B.CQt.D.EQtQt",
+"QtQtQtQt.F.G.H.I.J.K.LQtQt.MQtQt",
+"QtQtQtQt.N.O.P.Q.R.S.TQtQt.UQtQt",
+"QtQtQtQt.V.W.X.Y.Z.0.1QtQt.2QtQt",
+"QtQtQtQt.3.4.5.6.7.8.9#.##QtQtQt",
+"QtQtQtQt#a#b#c#d#e#f#gQtQtQtQtQt",
+"QtQtQtQt#h#i#j#k#l#m#nQtQtQtQtQt",
+"QtQtQtQt#o#p#q#r#s#t#uQtQtQtQtQt",
+"QtQtQtQtQt#v#w#x#y#zQtQtQtQtQtQt",
+"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt",
+"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt"};
diff --git a/xpm/boat_ramp.svg b/xpm/boat_ramp.svg
new file mode 100644
index 00000000..1ccc88b7
--- /dev/null
+++ b/xpm/boat_ramp.svg
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="boat_ramp.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/navit/icons/png/boat_ramp.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#f4ca00"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="22.627417"
+ inkscape:cx="15.902761"
+ inkscape:cy="9.2438685"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:window-width="943"
+ inkscape:window-height="682"
+ inkscape:window-x="38"
+ inkscape:window-y="24"
+ showguides="true"
+ inkscape:guide-bbox="true"
+ inkscape:snap-global="false">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2380"
+ visible="true"
+ enabled="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ style="fill:#3d6b98;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 0.65911209,15.560037 L 20.545958,15.515843 L 19.597655,21.589701 L 3.4774734,21.545507 L 0.65911209,15.560037 z"
+ id="rect2381"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ style="fill:#9fbcd9;fill-opacity:1;fill-rule:evenodd;stroke:#4d618c;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 6.4053422,0.51263443 L 10.619456,0.51263443 L 10.57834,13.451186 L 0.54037468,13.49538 L 6.4053422,0.51263443 z"
+ id="path3154"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ style="fill:#9fbcd9;fill-opacity:1;fill-rule:evenodd;stroke:#4d618c;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;stroke-dasharray:none"
+ d="M 15.547394,3.454693 L 12.467784,3.4104988 L 12.491839,13.416625 L 20.557566,13.416625 L 15.547394,3.454693 z"
+ id="path3156"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 11.545578,0.0090946102 L 11.545578,15.053346"
+ id="path3158"
+ sodipodi:nodetypes="cc" />
+ </g>
+</svg>
diff --git a/navit/xpm/boat_ramp.xpm b/xpm/boat_ramp.xpm
index b4b17b76..b4b17b76 100644
--- a/navit/xpm/boat_ramp.xpm
+++ b/xpm/boat_ramp.xpm
diff --git a/xpm/boundary_stone.xpm b/xpm/boundary_stone.xpm
new file mode 100644
index 00000000..2c8b3979
--- /dev/null
+++ b/xpm/boundary_stone.xpm
@@ -0,0 +1,39 @@
+/* XPM */
+static char *dummy[]={
+"32 32 4 1",
+". c None",
+"b c #797979",
+"a c #7e7e7e",
+"# c #999999",
+"................................",
+"................................",
+"................................",
+"................................",
+"................................",
+"................................",
+"................................",
+"................................",
+"................................",
+"................................",
+"..............##................",
+".............###a...............",
+".............###b...............",
+".............###b...............",
+".............###b...............",
+".............###b...............",
+".............###b...............",
+".............###b...............",
+"................................",
+"................................",
+"................................",
+"................................",
+"................................",
+"................................",
+"................................",
+"................................",
+"................................",
+"................................",
+"................................",
+"................................",
+"................................",
+"................................"};
diff --git a/xpm/bus.svg b/xpm/bus.svg
new file mode 100644
index 00000000..8ef93e64
--- /dev/null
+++ b/xpm/bus.svg
@@ -0,0 +1,198 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="bus.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/navit/icons/png/bus.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3181">
+ <stop
+ id="stop3183"
+ offset="0"
+ style="stop-color:#ffffff;stop-opacity:0;" />
+ <stop
+ id="stop3185"
+ offset="1"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3169">
+ <stop
+ style="stop-color:#d2d2d2;stop-opacity:1;"
+ offset="0"
+ id="stop3171" />
+ <stop
+ style="stop-color:#656565;stop-opacity:1;"
+ offset="1"
+ id="stop3173" />
+ </linearGradient>
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3169"
+ id="linearGradient3175"
+ x1="13.119969"
+ y1="12.919525"
+ x2="13.280306"
+ y2="4.8899608"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3181"
+ id="linearGradient3179"
+ gradientUnits="userSpaceOnUse"
+ x1="13.069741"
+ y1="8.9047422"
+ x2="13.129622"
+ y2="-6.9136248"
+ gradientTransform="matrix(0.8888038,0,0,0.8888038,1.2344919,0.9901737)" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#0083f4"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="22.4"
+ inkscape:cx="10.658503"
+ inkscape:cy="11.00096"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:window-width="1024"
+ inkscape:window-height="699"
+ inkscape:window-x="0"
+ inkscape:window-y="25">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2380"
+ visible="true"
+ enabled="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect3159"
+ width="3.0357144"
+ height="5.3571458"
+ x="3.0357141"
+ y="15.669642"
+ rx="1"
+ ry="1" />
+ <rect
+ style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect3163"
+ width="3.0357144"
+ height="5.3571458"
+ x="16.107141"
+ y="15.758928"
+ rx="1"
+ ry="1" />
+ <path
+ style="fill:#516280;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 1.1964286,1.0625 C 7.0673776,0.17836005 14.927626,-0.024420878 21.035716,1.1071428 L 21.07143,11.084821 L 21.07143,19.062499 L 1.1160715,19.062499 L 1.1160715,11.084821 L 1.1964286,1.0625 z"
+ id="rect2386"
+ sodipodi:nodetypes="ccccccc" />
+ <rect
+ style="opacity:1;fill:#babd00;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect3165"
+ width="17.723225"
+ height="3.2500007"
+ x="2.3035712"
+ y="2"
+ rx="1"
+ ry="0.95535707" />
+ <path
+ style="fill:url(#linearGradient3175);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 2.155573,3 L 20,3.0446429 L 19.826461,12.919525 L 2.0485408,12.919525 L 2.155573,3 z"
+ id="path3167"
+ sodipodi:nodetypes="ccccc" />
+ <rect
+ style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.50000000000000000;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect3187"
+ width="2.9017856"
+ height="1.8749995"
+ x="2.0535715"
+ y="15.035714" />
+ <rect
+ style="opacity:0.5;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.50000000000000000;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect3415"
+ width="2.9017856"
+ height="1.8749995"
+ x="15.125"
+ y="15" />
+ <rect
+ style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect3413"
+ width="2.9017856"
+ height="1.8749995"
+ x="17.125"
+ y="15" />
+ <rect
+ style="opacity:0.5;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect3417"
+ width="2.9017856"
+ height="1.8749995"
+ x="3.9642856"
+ y="15" />
+ <path
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 14.373479,8.5271747 L 15.676062,8.5271747 C 16.372813,8.5271747 16.933736,9.0630558 16.933736,9.7287019 L 16.933736,11.884714 L 16.953387,13.002022 L 13.138263,13.016058 L 13.115805,11.884714 L 13.115805,9.7287019 C 13.115805,9.0630558 13.676728,8.5271747 14.373479,8.5271747 z"
+ id="rect3419"
+ sodipodi:nodetypes="ccccccccc" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3421"
+ sodipodi:cx="17.901785"
+ sodipodi:cy="6.1071429"
+ sodipodi:rx="1.1071428"
+ sodipodi:ry="1.1071428"
+ d="M 19.008928,6.1071429 A 1.1071428,1.1071428 0 1 1 16.794642,6.1071429 A 1.1071428,1.1071428 0 1 1 19.008928,6.1071429 z"
+ transform="matrix(1.2576734,0,0,1.2576734,-7.4785958,-0.6807912)" />
+ <path
+ style="fill:url(#linearGradient3179);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 4.0927349,3.5854032 L 18.121763,3.5060325 C 18.795114,5.9461485 18.919421,10.138186 18.856325,12.473096 L 3.3329939,12.473096 C 3.335812,10.305907 3.3579912,6.2753972 4.0927349,3.5854032 z"
+ id="path3177"
+ sodipodi:nodetypes="ccccc" />
+ </g>
+</svg>
diff --git a/xpm/bus.xpm b/xpm/bus.xpm
new file mode 100644
index 00000000..de1c10ea
--- /dev/null
+++ b/xpm/bus.xpm
@@ -0,0 +1,21 @@
+/* XPM */
+static char *dummy[]={
+"16 16 2 1",
+". c None",
+"# c #000000",
+"................",
+"....########....",
+"...###....###...",
+"...###########..",
+"..##........##..",
+"..##........##..",
+"..##.........#..",
+"..##.........#..",
+"..############..",
+"..############..",
+"..##.#######.#..",
+"..############..",
+"..############..",
+"..############..",
+"...##......##...",
+"................"};
diff --git a/xpm/bus_halt.xpm b/xpm/bus_halt.xpm
new file mode 100644
index 00000000..ed7c75e5
--- /dev/null
+++ b/xpm/bus_halt.xpm
@@ -0,0 +1,51 @@
+/* XPM */
+static char *dummy[]={
+"16 16 32 1",
+". c None",
+"f c #009933",
+"e c #019933",
+"h c #149d33",
+"i c #1a9e33",
+"k c #1b9e33",
+"r c #1c9e33",
+"A c #2ca133",
+"v c #2fa233",
+"y c #40a533",
+"D c #49a733",
+"j c #4ea833",
+"d c #53a933",
+"z c #57aa33",
+"B c #68ad33",
+"b c #7cb133",
+"u c #83b333",
+"C c #8fb533",
+"m c #9bb833",
+"a c #9cb833",
+"q c #a0b933",
+"g c #b4bd33",
+"x c #b7bd33",
+"t c #bbbe33",
+"# c #c7c033",
+"l c #d3c333",
+"c c #d4c333",
+"s c #e4c633",
+"w c #ecc833",
+"p c #f1c933",
+"n c #f7ca33",
+"o c #ffcc33",
+".....#abba#.....",
+"...cdeffffedc...",
+"..ghffijjkffhg..",
+".lhfkmnoopqkfhl.",
+".dfrsftoouvwrfd.",
+"#efxnftoouvoxfe#",
+"afionftoouvooifa",
+"bfjonfyzzAvoojfb",
+"bfjonfBCCDvoojfb",
+"afionftoouvooifa",
+"#efxnftoouvoxfe#",
+".dfrsftoouvwrfd.",
+".lhfkmnoopqkfhl.",
+"..ghffijjkffhg..",
+"...cdeffffedc...",
+".....#abba#....."};
diff --git a/xpm/cafe.xpm b/xpm/cafe.xpm
new file mode 100644
index 00000000..df360120
--- /dev/null
+++ b/xpm/cafe.xpm
@@ -0,0 +1,21 @@
+/* XPM */
+static char *dummy[]={
+"16 16 2 1",
+". c None",
+"# c #000000",
+"................",
+"................",
+"................",
+"................",
+"..#############.",
+"..###########..#",
+"..#############.",
+"...##########...",
+"....#######.....",
+".....#####......",
+"###############.",
+"..############..",
+"................",
+"................",
+"................",
+"................"};
diff --git a/xpm/camping.xpm b/xpm/camping.xpm
new file mode 100644
index 00000000..5b9ebf1f
--- /dev/null
+++ b/xpm/camping.xpm
@@ -0,0 +1,22 @@
+/* XPM */
+static char *dummy[]={
+"16 16 3 1",
+". c None",
+"a c #000000",
+"# c #ffffff",
+".##############.",
+"################",
+"#######aa#######",
+"#######aa#######",
+"#######aa#######",
+"######aaaa######",
+"######aaaa######",
+"#####aaaaaa#####",
+"#####aaaaaa#####",
+"####aaaaaaaa####",
+"####aaa##aaa####",
+"###aaaa##aaaa###",
+"###aaa####aaa###",
+"##aaaaaaaaaaaa##",
+"##aaaaaaaaaaaa##",
+".##############."};
diff --git a/xpm/car_dealer.xpm b/xpm/car_dealer.xpm
new file mode 100644
index 00000000..2705e839
--- /dev/null
+++ b/xpm/car_dealer.xpm
@@ -0,0 +1,23 @@
+/* XPM */
+static char *dummy[]={
+"16 16 4 1",
+". c None",
+"a c #000000",
+"# c #7f7f7f",
+"b c #bfbfbf",
+"................",
+"................",
+"................",
+"......#aa#......",
+"....baaaaaab....",
+".......aa.......",
+"....baaaaaab....",
+"......#aa#......",
+".......aa.......",
+".......aa.......",
+".......aa.......",
+".......aa.......",
+".......aa.......",
+"................",
+"................",
+"................"};
diff --git a/xpm/castle.xpm b/xpm/castle.xpm
new file mode 100644
index 00000000..e311e830
--- /dev/null
+++ b/xpm/castle.xpm
@@ -0,0 +1,22 @@
+/* XPM */
+static char *dummy[]={
+"16 16 3 1",
+"# c None",
+". c #000000",
+"a c #010101",
+".#.#.######.#.#.",
+".....######.....",
+".....######.....",
+"#...########...#",
+"#...#.a..a.#...#",
+"#..............#",
+"#..............#",
+"#..#........#..#",
+"#.###......###.#",
+"#.###......###.#",
+"#......##......#",
+"#.....a##a.....#",
+"#.....####.....#",
+"#.....####.....#",
+"#.....####.....#",
+"################"};
diff --git a/xpm/cemetery.xpm b/xpm/cemetery.xpm
new file mode 100644
index 00000000..5722e8f3
--- /dev/null
+++ b/xpm/cemetery.xpm
@@ -0,0 +1,27 @@
+/* XPM */
+static char * cemetery_xpm[] = {
+"14 16 8 1",
+" c None",
+". c #8E8E8E",
+"+ c #8D8D8D",
+"@ c #404040",
+"# c #8E8D8E",
+"$ c #8C8C8C",
+"% c #8F8F8F",
+"& c #898989",
+" ",
+" ",
+" ",
+" .++. ",
+" .++++++ ",
+" +.++++++. ",
+" ++++++++. ",
+" .+@@+++++ ",
+" .+++@@+++ ",
+" #+@@++++. ",
+" #.++@@+++ ",
+" .+++++++ ",
+" $%.... ",
+" $%.& ",
+" ",
+" "};
diff --git a/xpm/church.svg b/xpm/church.svg
new file mode 100644
index 00000000..12441b19
--- /dev/null
+++ b/xpm/church.svg
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="worship.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/projets/navit/icons/png/worship.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3164">
+ <stop
+ style="stop-color:#58f071;stop-opacity:1;"
+ offset="0"
+ id="stop3166" />
+ <stop
+ style="stop-color:#22a638;stop-opacity:1;"
+ offset="1"
+ id="stop3168" />
+ </linearGradient>
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3164"
+ id="linearGradient3170"
+ x1="5.4863591"
+ y1="10.53991"
+ x2="7.5346413"
+ y2="16.638706"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3164"
+ id="linearGradient3177"
+ x1="9.8994942"
+ y1="4.6095934"
+ x2="12.065009"
+ y2="4.6095934"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3164"
+ id="linearGradient3179"
+ x1="7.1152611"
+ y1="3.0407002"
+ x2="15.070212"
+ y2="3.0407002"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3164"
+ id="linearGradient3182"
+ gradientUnits="userSpaceOnUse"
+ x1="7.1152611"
+ y1="3.0407002"
+ x2="15.070212"
+ y2="3.0407002"
+ gradientTransform="translate(-0.2209709,0.5745242)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3164"
+ id="linearGradient3184"
+ gradientUnits="userSpaceOnUse"
+ x1="5.4863591"
+ y1="10.53991"
+ x2="7.5346413"
+ y2="16.638706" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#f4ca00"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="5.6568545"
+ inkscape:cx="9.3432727"
+ inkscape:cy="-0.19430913"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:window-width="943"
+ inkscape:window-height="682"
+ inkscape:window-x="69"
+ inkscape:window-y="34">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2380"
+ visible="true"
+ enabled="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ style="fill:url(#linearGradient3184);fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;stroke-dasharray:none"
+ d="M 9.5053617,0.55713834 L 9.5053617,2.5495558 L 6.90625,2.5495558 L 6.90625,5.5 L 9.5053617,5.5 L 9.5053617,7.75 L 1.59375,11.59375 L 1.5625,20.5625 L 8.625,20.5625 C 8.6691942,15.149816 9.1446642,15 11.0625,15 C 12.981054,15 13.481692,14.914551 13.46875,20.46875 L 20.5625,20.5 L 20.5625,11.46875 L 12.59375,7.78125 L 12.59375,5.5 L 15.46875,5.5 L 15.46875,2.5495558 L 12.59375,2.5495558 L 12.59375,0.55713834 L 9.5053617,0.55713834 z"
+ id="rect2381"
+ sodipodi:nodetypes="cccccccccscccccccccc" />
+ <path
+ style="fill:#56769c;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M -25.921034,11.106694 L -16.96875,7.0625 L -7.928078,11.106694 L -7.928078,21.044194 L -14.959597,21 C -14.946655,15.4458 -15.018946,15 -16.9375,15 C -18.855336,15 -18.971431,15.587316 -19.015625,21 L -25.858534,21.044194 L -25.921034,11.106694 z"
+ id="path2383"
+ sodipodi:nodetypes="ccccczccc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#56769c;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M -17,-0.0625 L -17,8.8998106"
+ id="path2385"
+ sodipodi:nodetypes="cc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#56769c;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M -12.916593,2.9722718 L -21.039214,3"
+ id="path2387"
+ sodipodi:nodetypes="cc" />
+ </g>
+</svg>
diff --git a/xpm/church.xpm b/xpm/church.xpm
new file mode 100644
index 00000000..912e6927
--- /dev/null
+++ b/xpm/church.xpm
@@ -0,0 +1,23 @@
+/* XPM */
+static char *dummy[]={
+"16 16 4 1",
+". c None",
+"b c #000000",
+"# c #2f2f2f",
+"a c #b1b1b1",
+".......##.......",
+".......##.......",
+".......##.......",
+"....###aa###....",
+"....###aa###....",
+".......##.......",
+".......##.......",
+".......##.......",
+"....bbbbbbbb....",
+"....bbbbbbbb....",
+"....bbbbbbbb....",
+"....bbbbbbbb....",
+"....bbbbbbbb....",
+"....bbbbbbbb....",
+"....bbbbbbbb....",
+"....bbbbbbbb...."};
diff --git a/xpm/cinema.svg b/xpm/cinema.svg
new file mode 100644
index 00000000..dbfa6b60
--- /dev/null
+++ b/xpm/cinema.svg
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="cinema.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/projets/navit/icons/png/cinema.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3156">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop3158" />
+ <stop
+ id="stop3166"
+ offset="0.41698599"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ <stop
+ id="stop3164"
+ offset="0.41698599"
+ style="stop-color:#000000;stop-opacity:1;" />
+ <stop
+ style="stop-color:#3d3d3d;stop-opacity:1;"
+ offset="1"
+ id="stop3160" />
+ </linearGradient>
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3156"
+ id="linearGradient3162"
+ x1="0.875"
+ y1="3.59375"
+ x2="2.0625"
+ y2="4.65625"
+ gradientUnits="userSpaceOnUse"
+ spreadMethod="reflect" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#22a638"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="16"
+ inkscape:cx="10.642241"
+ inkscape:cy="12.077112"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:window-width="943"
+ inkscape:window-height="682"
+ inkscape:window-x="-4"
+ inkscape:window-y="24">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2380"
+ visible="true"
+ enabled="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ style="fill:#5a5a5a;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 1.4375,6.5625 L 19.625,7.6875 L 19.625,19.6875 L 3.3125,20.5625 L 1.4375,6.5625 z"
+ id="rect2381"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ style="fill:url(#linearGradient3162);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 1.5,3.5625 L 19.6875,1.5625 L 19.8125,4.5 L 1.375,5.625 L 1.5,3.5625 z"
+ id="path3154"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 4.331029,9.2720779 L 17,9.8907964"
+ id="path3168" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 5.1265242,13.537243 L 16.955806,13.581436"
+ id="path3170"
+ sodipodi:nodetypes="cc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 5.7010484,18.023379 L 17.027728,17.581437"
+ id="path3172"
+ sodipodi:nodetypes="cc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.45597485"
+ d="M 12.52167,13.831883 L 12.521671,17.441048"
+ id="path3174"
+ sodipodi:nodetypes="cc" />
+ </g>
+</svg>
diff --git a/navit/xpm/cinema.xpm b/xpm/cinema.xpm
index f926d155..f926d155 100644
--- a/navit/xpm/cinema.xpm
+++ b/xpm/cinema.xpm
diff --git a/xpm/country_.svgz b/xpm/country_.svgz
new file mode 100644
index 00000000..b58b6949
--- /dev/null
+++ b/xpm/country_.svgz
Binary files differ
diff --git a/xpm/country_AD.svgz b/xpm/country_AD.svgz
new file mode 100644
index 00000000..38eaf0b9
--- /dev/null
+++ b/xpm/country_AD.svgz
Binary files differ
diff --git a/xpm/country_AE.svgz b/xpm/country_AE.svgz
new file mode 100644
index 00000000..67dcd1e9
--- /dev/null
+++ b/xpm/country_AE.svgz
Binary files differ
diff --git a/xpm/country_AF.svgz b/xpm/country_AF.svgz
new file mode 100644
index 00000000..7dab2fc2
--- /dev/null
+++ b/xpm/country_AF.svgz
Binary files differ
diff --git a/xpm/country_AG.svgz b/xpm/country_AG.svgz
new file mode 100644
index 00000000..f0d9e58e
--- /dev/null
+++ b/xpm/country_AG.svgz
Binary files differ
diff --git a/xpm/country_AI.svgz b/xpm/country_AI.svgz
new file mode 100644
index 00000000..595d72df
--- /dev/null
+++ b/xpm/country_AI.svgz
Binary files differ
diff --git a/xpm/country_AL.svgz b/xpm/country_AL.svgz
new file mode 100644
index 00000000..5d2ab91e
--- /dev/null
+++ b/xpm/country_AL.svgz
Binary files differ
diff --git a/xpm/country_AM.svgz b/xpm/country_AM.svgz
new file mode 100644
index 00000000..72d031ea
--- /dev/null
+++ b/xpm/country_AM.svgz
Binary files differ
diff --git a/xpm/country_AN.svgz b/xpm/country_AN.svgz
new file mode 100644
index 00000000..e40e324e
--- /dev/null
+++ b/xpm/country_AN.svgz
Binary files differ
diff --git a/xpm/country_AO.svgz b/xpm/country_AO.svgz
new file mode 100644
index 00000000..5e8d94ed
--- /dev/null
+++ b/xpm/country_AO.svgz
Binary files differ
diff --git a/xpm/country_AQ.svgz b/xpm/country_AQ.svgz
new file mode 100644
index 00000000..cf1308c5
--- /dev/null
+++ b/xpm/country_AQ.svgz
Binary files differ
diff --git a/xpm/country_AR.svgz b/xpm/country_AR.svgz
new file mode 100644
index 00000000..59f4b107
--- /dev/null
+++ b/xpm/country_AR.svgz
Binary files differ
diff --git a/xpm/country_AS.svgz b/xpm/country_AS.svgz
new file mode 100644
index 00000000..3c4d0eff
--- /dev/null
+++ b/xpm/country_AS.svgz
Binary files differ
diff --git a/xpm/country_AT.svgz b/xpm/country_AT.svgz
new file mode 100644
index 00000000..76d3c70b
--- /dev/null
+++ b/xpm/country_AT.svgz
Binary files differ
diff --git a/xpm/country_AU.svgz b/xpm/country_AU.svgz
new file mode 100644
index 00000000..84a3882d
--- /dev/null
+++ b/xpm/country_AU.svgz
Binary files differ
diff --git a/xpm/country_AW.svgz b/xpm/country_AW.svgz
new file mode 100644
index 00000000..3a095057
--- /dev/null
+++ b/xpm/country_AW.svgz
Binary files differ
diff --git a/xpm/country_AX.svgz b/xpm/country_AX.svgz
new file mode 100644
index 00000000..c56d47c9
--- /dev/null
+++ b/xpm/country_AX.svgz
Binary files differ
diff --git a/xpm/country_AZ.svgz b/xpm/country_AZ.svgz
new file mode 100644
index 00000000..a1a6bb26
--- /dev/null
+++ b/xpm/country_AZ.svgz
Binary files differ
diff --git a/xpm/country_BA.svgz b/xpm/country_BA.svgz
new file mode 100644
index 00000000..dd5c66b3
--- /dev/null
+++ b/xpm/country_BA.svgz
Binary files differ
diff --git a/xpm/country_BB.svgz b/xpm/country_BB.svgz
new file mode 100644
index 00000000..82cf29ca
--- /dev/null
+++ b/xpm/country_BB.svgz
Binary files differ
diff --git a/xpm/country_BD.svgz b/xpm/country_BD.svgz
new file mode 100644
index 00000000..9bf453dc
--- /dev/null
+++ b/xpm/country_BD.svgz
Binary files differ
diff --git a/xpm/country_BE.svgz b/xpm/country_BE.svgz
new file mode 100644
index 00000000..be47fcbc
--- /dev/null
+++ b/xpm/country_BE.svgz
Binary files differ
diff --git a/xpm/country_BF.svgz b/xpm/country_BF.svgz
new file mode 100644
index 00000000..35a22563
--- /dev/null
+++ b/xpm/country_BF.svgz
Binary files differ
diff --git a/xpm/country_BG.svgz b/xpm/country_BG.svgz
new file mode 100644
index 00000000..3d4d0f83
--- /dev/null
+++ b/xpm/country_BG.svgz
Binary files differ
diff --git a/xpm/country_BH.svgz b/xpm/country_BH.svgz
new file mode 100644
index 00000000..5b0cce66
--- /dev/null
+++ b/xpm/country_BH.svgz
Binary files differ
diff --git a/xpm/country_BI.svgz b/xpm/country_BI.svgz
new file mode 100644
index 00000000..7750db3c
--- /dev/null
+++ b/xpm/country_BI.svgz
Binary files differ
diff --git a/xpm/country_BJ.svgz b/xpm/country_BJ.svgz
new file mode 100644
index 00000000..86bcd5d3
--- /dev/null
+++ b/xpm/country_BJ.svgz
Binary files differ
diff --git a/xpm/country_BL.svgz b/xpm/country_BL.svgz
new file mode 100644
index 00000000..46b7fff9
--- /dev/null
+++ b/xpm/country_BL.svgz
Binary files differ
diff --git a/xpm/country_BM.svgz b/xpm/country_BM.svgz
new file mode 100644
index 00000000..13451a77
--- /dev/null
+++ b/xpm/country_BM.svgz
Binary files differ
diff --git a/xpm/country_BN.svgz b/xpm/country_BN.svgz
new file mode 100644
index 00000000..f5de30fc
--- /dev/null
+++ b/xpm/country_BN.svgz
Binary files differ
diff --git a/xpm/country_BO.svgz b/xpm/country_BO.svgz
new file mode 100644
index 00000000..2a814f56
--- /dev/null
+++ b/xpm/country_BO.svgz
Binary files differ
diff --git a/xpm/country_BR.svgz b/xpm/country_BR.svgz
new file mode 100644
index 00000000..5bc65e3b
--- /dev/null
+++ b/xpm/country_BR.svgz
Binary files differ
diff --git a/xpm/country_BS.svgz b/xpm/country_BS.svgz
new file mode 100644
index 00000000..dbb64ce7
--- /dev/null
+++ b/xpm/country_BS.svgz
Binary files differ
diff --git a/xpm/country_BT.svgz b/xpm/country_BT.svgz
new file mode 100644
index 00000000..9e6ad96e
--- /dev/null
+++ b/xpm/country_BT.svgz
Binary files differ
diff --git a/xpm/country_BV.svgz b/xpm/country_BV.svgz
new file mode 100644
index 00000000..f990449f
--- /dev/null
+++ b/xpm/country_BV.svgz
Binary files differ
diff --git a/xpm/country_BW.svgz b/xpm/country_BW.svgz
new file mode 100644
index 00000000..5c686505
--- /dev/null
+++ b/xpm/country_BW.svgz
Binary files differ
diff --git a/xpm/country_BY.svgz b/xpm/country_BY.svgz
new file mode 100644
index 00000000..bf279e70
--- /dev/null
+++ b/xpm/country_BY.svgz
Binary files differ
diff --git a/xpm/country_BZ.svgz b/xpm/country_BZ.svgz
new file mode 100644
index 00000000..34fe28f1
--- /dev/null
+++ b/xpm/country_BZ.svgz
Binary files differ
diff --git a/xpm/country_CA.svgz b/xpm/country_CA.svgz
new file mode 100644
index 00000000..92587f9f
--- /dev/null
+++ b/xpm/country_CA.svgz
Binary files differ
diff --git a/xpm/country_CC.svgz b/xpm/country_CC.svgz
new file mode 100644
index 00000000..ec8e914a
--- /dev/null
+++ b/xpm/country_CC.svgz
Binary files differ
diff --git a/xpm/country_CD.svgz b/xpm/country_CD.svgz
new file mode 100644
index 00000000..70ffe5e5
--- /dev/null
+++ b/xpm/country_CD.svgz
Binary files differ
diff --git a/xpm/country_CF.svgz b/xpm/country_CF.svgz
new file mode 100644
index 00000000..eb794a0a
--- /dev/null
+++ b/xpm/country_CF.svgz
Binary files differ
diff --git a/xpm/country_CG.svgz b/xpm/country_CG.svgz
new file mode 100644
index 00000000..da2ba773
--- /dev/null
+++ b/xpm/country_CG.svgz
Binary files differ
diff --git a/xpm/country_CH.svgz b/xpm/country_CH.svgz
new file mode 100644
index 00000000..c27e6441
--- /dev/null
+++ b/xpm/country_CH.svgz
Binary files differ
diff --git a/xpm/country_CI.svgz b/xpm/country_CI.svgz
new file mode 100644
index 00000000..d58271fd
--- /dev/null
+++ b/xpm/country_CI.svgz
Binary files differ
diff --git a/xpm/country_CK.svgz b/xpm/country_CK.svgz
new file mode 100644
index 00000000..254e25a1
--- /dev/null
+++ b/xpm/country_CK.svgz
Binary files differ
diff --git a/xpm/country_CL.svgz b/xpm/country_CL.svgz
new file mode 100644
index 00000000..e0436f10
--- /dev/null
+++ b/xpm/country_CL.svgz
Binary files differ
diff --git a/xpm/country_CM.svgz b/xpm/country_CM.svgz
new file mode 100644
index 00000000..76a7798c
--- /dev/null
+++ b/xpm/country_CM.svgz
Binary files differ
diff --git a/xpm/country_CN.svgz b/xpm/country_CN.svgz
new file mode 100644
index 00000000..10319b60
--- /dev/null
+++ b/xpm/country_CN.svgz
Binary files differ
diff --git a/xpm/country_CO.svgz b/xpm/country_CO.svgz
new file mode 100644
index 00000000..4294d1df
--- /dev/null
+++ b/xpm/country_CO.svgz
Binary files differ
diff --git a/xpm/country_CR.svgz b/xpm/country_CR.svgz
new file mode 100644
index 00000000..877f779c
--- /dev/null
+++ b/xpm/country_CR.svgz
Binary files differ
diff --git a/xpm/country_CU.svgz b/xpm/country_CU.svgz
new file mode 100644
index 00000000..fde7996a
--- /dev/null
+++ b/xpm/country_CU.svgz
Binary files differ
diff --git a/xpm/country_CV.svgz b/xpm/country_CV.svgz
new file mode 100644
index 00000000..2080d1f6
--- /dev/null
+++ b/xpm/country_CV.svgz
Binary files differ
diff --git a/xpm/country_CX.svgz b/xpm/country_CX.svgz
new file mode 100644
index 00000000..1ad1ea80
--- /dev/null
+++ b/xpm/country_CX.svgz
Binary files differ
diff --git a/xpm/country_CY.svgz b/xpm/country_CY.svgz
new file mode 100644
index 00000000..59073bbe
--- /dev/null
+++ b/xpm/country_CY.svgz
Binary files differ
diff --git a/xpm/country_CZ.svgz b/xpm/country_CZ.svgz
new file mode 100644
index 00000000..89398403
--- /dev/null
+++ b/xpm/country_CZ.svgz
Binary files differ
diff --git a/xpm/country_DE.svgz b/xpm/country_DE.svgz
new file mode 100644
index 00000000..107982c3
--- /dev/null
+++ b/xpm/country_DE.svgz
Binary files differ
diff --git a/xpm/country_DJ.svgz b/xpm/country_DJ.svgz
new file mode 100644
index 00000000..6d2e4907
--- /dev/null
+++ b/xpm/country_DJ.svgz
Binary files differ
diff --git a/xpm/country_DK.svgz b/xpm/country_DK.svgz
new file mode 100644
index 00000000..f9d51c74
--- /dev/null
+++ b/xpm/country_DK.svgz
Binary files differ
diff --git a/xpm/country_DM.svgz b/xpm/country_DM.svgz
new file mode 100644
index 00000000..ff8215f4
--- /dev/null
+++ b/xpm/country_DM.svgz
Binary files differ
diff --git a/xpm/country_DO.svgz b/xpm/country_DO.svgz
new file mode 100644
index 00000000..a16fba7d
--- /dev/null
+++ b/xpm/country_DO.svgz
Binary files differ
diff --git a/xpm/country_DZ.svgz b/xpm/country_DZ.svgz
new file mode 100644
index 00000000..e17f46fd
--- /dev/null
+++ b/xpm/country_DZ.svgz
Binary files differ
diff --git a/xpm/country_EC.svgz b/xpm/country_EC.svgz
new file mode 100644
index 00000000..fb2f4f0e
--- /dev/null
+++ b/xpm/country_EC.svgz
Binary files differ
diff --git a/xpm/country_EE.svgz b/xpm/country_EE.svgz
new file mode 100644
index 00000000..dcf6b912
--- /dev/null
+++ b/xpm/country_EE.svgz
Binary files differ
diff --git a/xpm/country_EG.svgz b/xpm/country_EG.svgz
new file mode 100644
index 00000000..317ce47b
--- /dev/null
+++ b/xpm/country_EG.svgz
Binary files differ
diff --git a/xpm/country_EH.svgz b/xpm/country_EH.svgz
new file mode 100644
index 00000000..b08f9229
--- /dev/null
+++ b/xpm/country_EH.svgz
Binary files differ
diff --git a/xpm/country_ER.svgz b/xpm/country_ER.svgz
new file mode 100644
index 00000000..d00a4c6a
--- /dev/null
+++ b/xpm/country_ER.svgz
Binary files differ
diff --git a/xpm/country_ES.svgz b/xpm/country_ES.svgz
new file mode 100644
index 00000000..f0abc567
--- /dev/null
+++ b/xpm/country_ES.svgz
Binary files differ
diff --git a/xpm/country_ET.svgz b/xpm/country_ET.svgz
new file mode 100644
index 00000000..2e660450
--- /dev/null
+++ b/xpm/country_ET.svgz
Binary files differ
diff --git a/xpm/country_FI.svgz b/xpm/country_FI.svgz
new file mode 100644
index 00000000..85927b63
--- /dev/null
+++ b/xpm/country_FI.svgz
Binary files differ
diff --git a/xpm/country_FJ.svgz b/xpm/country_FJ.svgz
new file mode 100644
index 00000000..4085c59d
--- /dev/null
+++ b/xpm/country_FJ.svgz
Binary files differ
diff --git a/xpm/country_FK.svgz b/xpm/country_FK.svgz
new file mode 100644
index 00000000..b2ff812e
--- /dev/null
+++ b/xpm/country_FK.svgz
Binary files differ
diff --git a/xpm/country_FM.svgz b/xpm/country_FM.svgz
new file mode 100644
index 00000000..32361a5b
--- /dev/null
+++ b/xpm/country_FM.svgz
Binary files differ
diff --git a/xpm/country_FO.svgz b/xpm/country_FO.svgz
new file mode 100644
index 00000000..92bed0f6
--- /dev/null
+++ b/xpm/country_FO.svgz
Binary files differ
diff --git a/xpm/country_FR.svgz b/xpm/country_FR.svgz
new file mode 100644
index 00000000..58c9e0fc
--- /dev/null
+++ b/xpm/country_FR.svgz
Binary files differ
diff --git a/xpm/country_GA.svgz b/xpm/country_GA.svgz
new file mode 100644
index 00000000..0bf22f64
--- /dev/null
+++ b/xpm/country_GA.svgz
Binary files differ
diff --git a/xpm/country_GB.svgz b/xpm/country_GB.svgz
new file mode 100644
index 00000000..07500c71
--- /dev/null
+++ b/xpm/country_GB.svgz
Binary files differ
diff --git a/xpm/country_GD.svgz b/xpm/country_GD.svgz
new file mode 100644
index 00000000..5ee64135
--- /dev/null
+++ b/xpm/country_GD.svgz
Binary files differ
diff --git a/xpm/country_GE.svgz b/xpm/country_GE.svgz
new file mode 100644
index 00000000..54a8e8bf
--- /dev/null
+++ b/xpm/country_GE.svgz
Binary files differ
diff --git a/xpm/country_GF.svgz b/xpm/country_GF.svgz
new file mode 100644
index 00000000..4ac873b4
--- /dev/null
+++ b/xpm/country_GF.svgz
Binary files differ
diff --git a/xpm/country_GG.svgz b/xpm/country_GG.svgz
new file mode 100644
index 00000000..e565c168
--- /dev/null
+++ b/xpm/country_GG.svgz
Binary files differ
diff --git a/xpm/country_GH.svgz b/xpm/country_GH.svgz
new file mode 100644
index 00000000..ae8a2374
--- /dev/null
+++ b/xpm/country_GH.svgz
Binary files differ
diff --git a/xpm/country_GI.svgz b/xpm/country_GI.svgz
new file mode 100644
index 00000000..0446a7e1
--- /dev/null
+++ b/xpm/country_GI.svgz
Binary files differ
diff --git a/xpm/country_GL.svgz b/xpm/country_GL.svgz
new file mode 100644
index 00000000..efc40350
--- /dev/null
+++ b/xpm/country_GL.svgz
Binary files differ
diff --git a/xpm/country_GM.svgz b/xpm/country_GM.svgz
new file mode 100644
index 00000000..a9334e79
--- /dev/null
+++ b/xpm/country_GM.svgz
Binary files differ
diff --git a/xpm/country_GN.svgz b/xpm/country_GN.svgz
new file mode 100644
index 00000000..1b63e41c
--- /dev/null
+++ b/xpm/country_GN.svgz
Binary files differ
diff --git a/xpm/country_GP.svgz b/xpm/country_GP.svgz
new file mode 100644
index 00000000..904de5ae
--- /dev/null
+++ b/xpm/country_GP.svgz
Binary files differ
diff --git a/xpm/country_GQ.svgz b/xpm/country_GQ.svgz
new file mode 100644
index 00000000..afc2be67
--- /dev/null
+++ b/xpm/country_GQ.svgz
Binary files differ
diff --git a/xpm/country_GR.svgz b/xpm/country_GR.svgz
new file mode 100644
index 00000000..40cde738
--- /dev/null
+++ b/xpm/country_GR.svgz
Binary files differ
diff --git a/xpm/country_GS.svgz b/xpm/country_GS.svgz
new file mode 100644
index 00000000..2f824fde
--- /dev/null
+++ b/xpm/country_GS.svgz
Binary files differ
diff --git a/xpm/country_GT.svgz b/xpm/country_GT.svgz
new file mode 100644
index 00000000..2a060b6b
--- /dev/null
+++ b/xpm/country_GT.svgz
Binary files differ
diff --git a/xpm/country_GU.svgz b/xpm/country_GU.svgz
new file mode 100644
index 00000000..51012929
--- /dev/null
+++ b/xpm/country_GU.svgz
Binary files differ
diff --git a/xpm/country_GW.svgz b/xpm/country_GW.svgz
new file mode 100644
index 00000000..dc6aea01
--- /dev/null
+++ b/xpm/country_GW.svgz
Binary files differ
diff --git a/xpm/country_GY.svgz b/xpm/country_GY.svgz
new file mode 100644
index 00000000..5925c884
--- /dev/null
+++ b/xpm/country_GY.svgz
Binary files differ
diff --git a/xpm/country_HK.svgz b/xpm/country_HK.svgz
new file mode 100644
index 00000000..4e73944b
--- /dev/null
+++ b/xpm/country_HK.svgz
Binary files differ
diff --git a/xpm/country_HM.svgz b/xpm/country_HM.svgz
new file mode 100644
index 00000000..36a363f8
--- /dev/null
+++ b/xpm/country_HM.svgz
Binary files differ
diff --git a/xpm/country_HN.svgz b/xpm/country_HN.svgz
new file mode 100644
index 00000000..19baf8a2
--- /dev/null
+++ b/xpm/country_HN.svgz
Binary files differ
diff --git a/xpm/country_HR.svgz b/xpm/country_HR.svgz
new file mode 100644
index 00000000..b16673a1
--- /dev/null
+++ b/xpm/country_HR.svgz
Binary files differ
diff --git a/xpm/country_HT.svgz b/xpm/country_HT.svgz
new file mode 100644
index 00000000..c5ff2e40
--- /dev/null
+++ b/xpm/country_HT.svgz
Binary files differ
diff --git a/xpm/country_HU.svgz b/xpm/country_HU.svgz
new file mode 100644
index 00000000..138e5e6e
--- /dev/null
+++ b/xpm/country_HU.svgz
Binary files differ
diff --git a/xpm/country_ID.svgz b/xpm/country_ID.svgz
new file mode 100644
index 00000000..bebdbe9c
--- /dev/null
+++ b/xpm/country_ID.svgz
Binary files differ
diff --git a/xpm/country_IE.svgz b/xpm/country_IE.svgz
new file mode 100644
index 00000000..5a0782e6
--- /dev/null
+++ b/xpm/country_IE.svgz
Binary files differ
diff --git a/xpm/country_IL.svgz b/xpm/country_IL.svgz
new file mode 100644
index 00000000..0de8f541
--- /dev/null
+++ b/xpm/country_IL.svgz
Binary files differ
diff --git a/xpm/country_IM.svgz b/xpm/country_IM.svgz
new file mode 100644
index 00000000..63cfd31a
--- /dev/null
+++ b/xpm/country_IM.svgz
Binary files differ
diff --git a/xpm/country_IN.svgz b/xpm/country_IN.svgz
new file mode 100644
index 00000000..d207dcde
--- /dev/null
+++ b/xpm/country_IN.svgz
Binary files differ
diff --git a/xpm/country_IO.svgz b/xpm/country_IO.svgz
new file mode 100644
index 00000000..c2e20767
--- /dev/null
+++ b/xpm/country_IO.svgz
Binary files differ
diff --git a/xpm/country_IQ.svgz b/xpm/country_IQ.svgz
new file mode 100644
index 00000000..2045a877
--- /dev/null
+++ b/xpm/country_IQ.svgz
Binary files differ
diff --git a/xpm/country_IR.svgz b/xpm/country_IR.svgz
new file mode 100644
index 00000000..fbf6ef0a
--- /dev/null
+++ b/xpm/country_IR.svgz
Binary files differ
diff --git a/xpm/country_IS.svgz b/xpm/country_IS.svgz
new file mode 100644
index 00000000..64943434
--- /dev/null
+++ b/xpm/country_IS.svgz
Binary files differ
diff --git a/xpm/country_IT.svgz b/xpm/country_IT.svgz
new file mode 100644
index 00000000..7b2490ea
--- /dev/null
+++ b/xpm/country_IT.svgz
Binary files differ
diff --git a/xpm/country_JE.svgz b/xpm/country_JE.svgz
new file mode 100644
index 00000000..a61eb2e4
--- /dev/null
+++ b/xpm/country_JE.svgz
Binary files differ
diff --git a/xpm/country_JM.svgz b/xpm/country_JM.svgz
new file mode 100644
index 00000000..97d89506
--- /dev/null
+++ b/xpm/country_JM.svgz
Binary files differ
diff --git a/xpm/country_JO.svgz b/xpm/country_JO.svgz
new file mode 100644
index 00000000..515bf8a7
--- /dev/null
+++ b/xpm/country_JO.svgz
Binary files differ
diff --git a/xpm/country_JP.svgz b/xpm/country_JP.svgz
new file mode 100644
index 00000000..89688854
--- /dev/null
+++ b/xpm/country_JP.svgz
Binary files differ
diff --git a/xpm/country_KE.svgz b/xpm/country_KE.svgz
new file mode 100644
index 00000000..94894b8a
--- /dev/null
+++ b/xpm/country_KE.svgz
Binary files differ
diff --git a/xpm/country_KG.svgz b/xpm/country_KG.svgz
new file mode 100644
index 00000000..adb3a370
--- /dev/null
+++ b/xpm/country_KG.svgz
Binary files differ
diff --git a/xpm/country_KH.svgz b/xpm/country_KH.svgz
new file mode 100644
index 00000000..1da2ccb0
--- /dev/null
+++ b/xpm/country_KH.svgz
Binary files differ
diff --git a/xpm/country_KI.svgz b/xpm/country_KI.svgz
new file mode 100644
index 00000000..2c6775e5
--- /dev/null
+++ b/xpm/country_KI.svgz
Binary files differ
diff --git a/xpm/country_KM.svgz b/xpm/country_KM.svgz
new file mode 100644
index 00000000..5cb2b84a
--- /dev/null
+++ b/xpm/country_KM.svgz
Binary files differ
diff --git a/xpm/country_KN.svgz b/xpm/country_KN.svgz
new file mode 100644
index 00000000..9c5150bf
--- /dev/null
+++ b/xpm/country_KN.svgz
Binary files differ
diff --git a/xpm/country_KP.svgz b/xpm/country_KP.svgz
new file mode 100644
index 00000000..f45c8e80
--- /dev/null
+++ b/xpm/country_KP.svgz
Binary files differ
diff --git a/xpm/country_KR.svgz b/xpm/country_KR.svgz
new file mode 100644
index 00000000..61b6112c
--- /dev/null
+++ b/xpm/country_KR.svgz
Binary files differ
diff --git a/xpm/country_KW.svgz b/xpm/country_KW.svgz
new file mode 100644
index 00000000..439d148a
--- /dev/null
+++ b/xpm/country_KW.svgz
Binary files differ
diff --git a/xpm/country_KY.svgz b/xpm/country_KY.svgz
new file mode 100644
index 00000000..f209210b
--- /dev/null
+++ b/xpm/country_KY.svgz
Binary files differ
diff --git a/xpm/country_KZ.svgz b/xpm/country_KZ.svgz
new file mode 100644
index 00000000..78a1f442
--- /dev/null
+++ b/xpm/country_KZ.svgz
Binary files differ
diff --git a/xpm/country_LA.svgz b/xpm/country_LA.svgz
new file mode 100644
index 00000000..9ce9d6c1
--- /dev/null
+++ b/xpm/country_LA.svgz
Binary files differ
diff --git a/xpm/country_LB.svgz b/xpm/country_LB.svgz
new file mode 100644
index 00000000..387f5e68
--- /dev/null
+++ b/xpm/country_LB.svgz
Binary files differ
diff --git a/xpm/country_LC.svgz b/xpm/country_LC.svgz
new file mode 100644
index 00000000..7bcacff5
--- /dev/null
+++ b/xpm/country_LC.svgz
Binary files differ
diff --git a/xpm/country_LI.svgz b/xpm/country_LI.svgz
new file mode 100644
index 00000000..6019f9a0
--- /dev/null
+++ b/xpm/country_LI.svgz
Binary files differ
diff --git a/xpm/country_LK.svgz b/xpm/country_LK.svgz
new file mode 100644
index 00000000..02a31a6a
--- /dev/null
+++ b/xpm/country_LK.svgz
Binary files differ
diff --git a/xpm/country_LR.svgz b/xpm/country_LR.svgz
new file mode 100644
index 00000000..57a3391a
--- /dev/null
+++ b/xpm/country_LR.svgz
Binary files differ
diff --git a/xpm/country_LS.svgz b/xpm/country_LS.svgz
new file mode 100644
index 00000000..d6e19de4
--- /dev/null
+++ b/xpm/country_LS.svgz
Binary files differ
diff --git a/xpm/country_LT.svgz b/xpm/country_LT.svgz
new file mode 100644
index 00000000..07b5472b
--- /dev/null
+++ b/xpm/country_LT.svgz
Binary files differ
diff --git a/xpm/country_LU.svgz b/xpm/country_LU.svgz
new file mode 100644
index 00000000..c60b1348
--- /dev/null
+++ b/xpm/country_LU.svgz
Binary files differ
diff --git a/xpm/country_LV.svgz b/xpm/country_LV.svgz
new file mode 100644
index 00000000..aa4fdc39
--- /dev/null
+++ b/xpm/country_LV.svgz
Binary files differ
diff --git a/xpm/country_LY.svgz b/xpm/country_LY.svgz
new file mode 100644
index 00000000..d453d8bd
--- /dev/null
+++ b/xpm/country_LY.svgz
Binary files differ
diff --git a/xpm/country_MA.svgz b/xpm/country_MA.svgz
new file mode 100644
index 00000000..794f083b
--- /dev/null
+++ b/xpm/country_MA.svgz
Binary files differ
diff --git a/xpm/country_MC.svgz b/xpm/country_MC.svgz
new file mode 100644
index 00000000..1ed62dd5
--- /dev/null
+++ b/xpm/country_MC.svgz
Binary files differ
diff --git a/xpm/country_MD.svgz b/xpm/country_MD.svgz
new file mode 100644
index 00000000..17675e93
--- /dev/null
+++ b/xpm/country_MD.svgz
Binary files differ
diff --git a/xpm/country_ME.svgz b/xpm/country_ME.svgz
new file mode 100644
index 00000000..ddb9acb4
--- /dev/null
+++ b/xpm/country_ME.svgz
Binary files differ
diff --git a/xpm/country_MF.svgz b/xpm/country_MF.svgz
new file mode 100644
index 00000000..657a49fe
--- /dev/null
+++ b/xpm/country_MF.svgz
Binary files differ
diff --git a/xpm/country_MG.svgz b/xpm/country_MG.svgz
new file mode 100644
index 00000000..5d4dbcb4
--- /dev/null
+++ b/xpm/country_MG.svgz
Binary files differ
diff --git a/xpm/country_MH.svgz b/xpm/country_MH.svgz
new file mode 100644
index 00000000..b9bc96f7
--- /dev/null
+++ b/xpm/country_MH.svgz
Binary files differ
diff --git a/xpm/country_MK.svgz b/xpm/country_MK.svgz
new file mode 100644
index 00000000..3e77a4f8
--- /dev/null
+++ b/xpm/country_MK.svgz
Binary files differ
diff --git a/xpm/country_ML.svgz b/xpm/country_ML.svgz
new file mode 100644
index 00000000..86f21071
--- /dev/null
+++ b/xpm/country_ML.svgz
Binary files differ
diff --git a/xpm/country_MM.svgz b/xpm/country_MM.svgz
new file mode 100644
index 00000000..71fc2390
--- /dev/null
+++ b/xpm/country_MM.svgz
Binary files differ
diff --git a/xpm/country_MN.svgz b/xpm/country_MN.svgz
new file mode 100644
index 00000000..b292c536
--- /dev/null
+++ b/xpm/country_MN.svgz
Binary files differ
diff --git a/xpm/country_MO.svgz b/xpm/country_MO.svgz
new file mode 100644
index 00000000..ffa69646
--- /dev/null
+++ b/xpm/country_MO.svgz
Binary files differ
diff --git a/xpm/country_MP.svgz b/xpm/country_MP.svgz
new file mode 100644
index 00000000..67574ca9
--- /dev/null
+++ b/xpm/country_MP.svgz
Binary files differ
diff --git a/xpm/country_MQ.svgz b/xpm/country_MQ.svgz
new file mode 100644
index 00000000..d4f6fd92
--- /dev/null
+++ b/xpm/country_MQ.svgz
Binary files differ
diff --git a/xpm/country_MR.svgz b/xpm/country_MR.svgz
new file mode 100644
index 00000000..d8835913
--- /dev/null
+++ b/xpm/country_MR.svgz
Binary files differ
diff --git a/xpm/country_MS.svgz b/xpm/country_MS.svgz
new file mode 100644
index 00000000..84035565
--- /dev/null
+++ b/xpm/country_MS.svgz
Binary files differ
diff --git a/xpm/country_MT.svgz b/xpm/country_MT.svgz
new file mode 100644
index 00000000..7737ee80
--- /dev/null
+++ b/xpm/country_MT.svgz
Binary files differ
diff --git a/xpm/country_MU.svgz b/xpm/country_MU.svgz
new file mode 100644
index 00000000..346c67ce
--- /dev/null
+++ b/xpm/country_MU.svgz
Binary files differ
diff --git a/xpm/country_MV.svgz b/xpm/country_MV.svgz
new file mode 100644
index 00000000..3f1cb872
--- /dev/null
+++ b/xpm/country_MV.svgz
Binary files differ
diff --git a/xpm/country_MW.svgz b/xpm/country_MW.svgz
new file mode 100644
index 00000000..7f63bff7
--- /dev/null
+++ b/xpm/country_MW.svgz
Binary files differ
diff --git a/xpm/country_MX.svgz b/xpm/country_MX.svgz
new file mode 100644
index 00000000..63dff365
--- /dev/null
+++ b/xpm/country_MX.svgz
Binary files differ
diff --git a/xpm/country_MY.svgz b/xpm/country_MY.svgz
new file mode 100644
index 00000000..188aa84f
--- /dev/null
+++ b/xpm/country_MY.svgz
Binary files differ
diff --git a/xpm/country_MZ.svgz b/xpm/country_MZ.svgz
new file mode 100644
index 00000000..1cc6a5dc
--- /dev/null
+++ b/xpm/country_MZ.svgz
Binary files differ
diff --git a/xpm/country_NA.svgz b/xpm/country_NA.svgz
new file mode 100644
index 00000000..45a2ce37
--- /dev/null
+++ b/xpm/country_NA.svgz
Binary files differ
diff --git a/xpm/country_NC.svgz b/xpm/country_NC.svgz
new file mode 100644
index 00000000..5de7938e
--- /dev/null
+++ b/xpm/country_NC.svgz
Binary files differ
diff --git a/xpm/country_NE.svgz b/xpm/country_NE.svgz
new file mode 100644
index 00000000..e4aa72cf
--- /dev/null
+++ b/xpm/country_NE.svgz
Binary files differ
diff --git a/xpm/country_NF.svgz b/xpm/country_NF.svgz
new file mode 100644
index 00000000..bffd6b7f
--- /dev/null
+++ b/xpm/country_NF.svgz
Binary files differ
diff --git a/xpm/country_NG.svgz b/xpm/country_NG.svgz
new file mode 100644
index 00000000..b476d20c
--- /dev/null
+++ b/xpm/country_NG.svgz
Binary files differ
diff --git a/xpm/country_NI.svgz b/xpm/country_NI.svgz
new file mode 100644
index 00000000..9b7758ea
--- /dev/null
+++ b/xpm/country_NI.svgz
Binary files differ
diff --git a/xpm/country_NL.svgz b/xpm/country_NL.svgz
new file mode 100644
index 00000000..cefb48d9
--- /dev/null
+++ b/xpm/country_NL.svgz
Binary files differ
diff --git a/xpm/country_NO.svgz b/xpm/country_NO.svgz
new file mode 100644
index 00000000..878b214c
--- /dev/null
+++ b/xpm/country_NO.svgz
Binary files differ
diff --git a/xpm/country_NP.svgz b/xpm/country_NP.svgz
new file mode 100644
index 00000000..a511b5bf
--- /dev/null
+++ b/xpm/country_NP.svgz
Binary files differ
diff --git a/xpm/country_NR.svgz b/xpm/country_NR.svgz
new file mode 100644
index 00000000..2d5fe618
--- /dev/null
+++ b/xpm/country_NR.svgz
Binary files differ
diff --git a/xpm/country_NU.svgz b/xpm/country_NU.svgz
new file mode 100644
index 00000000..92aad165
--- /dev/null
+++ b/xpm/country_NU.svgz
Binary files differ
diff --git a/xpm/country_NZ.svgz b/xpm/country_NZ.svgz
new file mode 100644
index 00000000..e00fdc9b
--- /dev/null
+++ b/xpm/country_NZ.svgz
Binary files differ
diff --git a/xpm/country_OM.svgz b/xpm/country_OM.svgz
new file mode 100644
index 00000000..e5834978
--- /dev/null
+++ b/xpm/country_OM.svgz
Binary files differ
diff --git a/xpm/country_PA.svgz b/xpm/country_PA.svgz
new file mode 100644
index 00000000..7e543454
--- /dev/null
+++ b/xpm/country_PA.svgz
Binary files differ
diff --git a/xpm/country_PE.svgz b/xpm/country_PE.svgz
new file mode 100644
index 00000000..0420e087
--- /dev/null
+++ b/xpm/country_PE.svgz
Binary files differ
diff --git a/xpm/country_PF.svgz b/xpm/country_PF.svgz
new file mode 100644
index 00000000..1172c8e3
--- /dev/null
+++ b/xpm/country_PF.svgz
Binary files differ
diff --git a/xpm/country_PG.svgz b/xpm/country_PG.svgz
new file mode 100644
index 00000000..fc65f1d1
--- /dev/null
+++ b/xpm/country_PG.svgz
Binary files differ
diff --git a/xpm/country_PH.svgz b/xpm/country_PH.svgz
new file mode 100644
index 00000000..e84a2479
--- /dev/null
+++ b/xpm/country_PH.svgz
Binary files differ
diff --git a/xpm/country_PK.svgz b/xpm/country_PK.svgz
new file mode 100644
index 00000000..824b5624
--- /dev/null
+++ b/xpm/country_PK.svgz
Binary files differ
diff --git a/xpm/country_PL.svgz b/xpm/country_PL.svgz
new file mode 100644
index 00000000..73310535
--- /dev/null
+++ b/xpm/country_PL.svgz
Binary files differ
diff --git a/xpm/country_PM.svgz b/xpm/country_PM.svgz
new file mode 100644
index 00000000..56acb3dd
--- /dev/null
+++ b/xpm/country_PM.svgz
Binary files differ
diff --git a/xpm/country_PN.svgz b/xpm/country_PN.svgz
new file mode 100644
index 00000000..9a0404c7
--- /dev/null
+++ b/xpm/country_PN.svgz
Binary files differ
diff --git a/xpm/country_PR.svgz b/xpm/country_PR.svgz
new file mode 100644
index 00000000..75217bbe
--- /dev/null
+++ b/xpm/country_PR.svgz
Binary files differ
diff --git a/xpm/country_PS.svgz b/xpm/country_PS.svgz
new file mode 100644
index 00000000..2c5c54c8
--- /dev/null
+++ b/xpm/country_PS.svgz
Binary files differ
diff --git a/xpm/country_PT.svgz b/xpm/country_PT.svgz
new file mode 100644
index 00000000..f0de8001
--- /dev/null
+++ b/xpm/country_PT.svgz
Binary files differ
diff --git a/xpm/country_PW.svgz b/xpm/country_PW.svgz
new file mode 100644
index 00000000..54d644d4
--- /dev/null
+++ b/xpm/country_PW.svgz
Binary files differ
diff --git a/xpm/country_PY.svgz b/xpm/country_PY.svgz
new file mode 100644
index 00000000..67ff330d
--- /dev/null
+++ b/xpm/country_PY.svgz
Binary files differ
diff --git a/xpm/country_QA.svgz b/xpm/country_QA.svgz
new file mode 100644
index 00000000..1f221bf1
--- /dev/null
+++ b/xpm/country_QA.svgz
Binary files differ
diff --git a/xpm/country_RE.svgz b/xpm/country_RE.svgz
new file mode 100644
index 00000000..81d06626
--- /dev/null
+++ b/xpm/country_RE.svgz
Binary files differ
diff --git a/xpm/country_RO.svgz b/xpm/country_RO.svgz
new file mode 100644
index 00000000..cc69d366
--- /dev/null
+++ b/xpm/country_RO.svgz
Binary files differ
diff --git a/xpm/country_RS.svgz b/xpm/country_RS.svgz
new file mode 100644
index 00000000..447cb2c6
--- /dev/null
+++ b/xpm/country_RS.svgz
Binary files differ
diff --git a/xpm/country_RU.svgz b/xpm/country_RU.svgz
new file mode 100644
index 00000000..56dce176
--- /dev/null
+++ b/xpm/country_RU.svgz
Binary files differ
diff --git a/xpm/country_RW.svgz b/xpm/country_RW.svgz
new file mode 100644
index 00000000..f92e743e
--- /dev/null
+++ b/xpm/country_RW.svgz
Binary files differ
diff --git a/xpm/country_SA.svgz b/xpm/country_SA.svgz
new file mode 100644
index 00000000..48f28842
--- /dev/null
+++ b/xpm/country_SA.svgz
Binary files differ
diff --git a/xpm/country_SB.svgz b/xpm/country_SB.svgz
new file mode 100644
index 00000000..6343e43c
--- /dev/null
+++ b/xpm/country_SB.svgz
Binary files differ
diff --git a/xpm/country_SC.svgz b/xpm/country_SC.svgz
new file mode 100644
index 00000000..db51e381
--- /dev/null
+++ b/xpm/country_SC.svgz
Binary files differ
diff --git a/xpm/country_SD.svgz b/xpm/country_SD.svgz
new file mode 100644
index 00000000..e1f09125
--- /dev/null
+++ b/xpm/country_SD.svgz
Binary files differ
diff --git a/xpm/country_SE.svgz b/xpm/country_SE.svgz
new file mode 100644
index 00000000..17db1c0b
--- /dev/null
+++ b/xpm/country_SE.svgz
Binary files differ
diff --git a/xpm/country_SG.svgz b/xpm/country_SG.svgz
new file mode 100644
index 00000000..75fd3840
--- /dev/null
+++ b/xpm/country_SG.svgz
Binary files differ
diff --git a/xpm/country_SH.svgz b/xpm/country_SH.svgz
new file mode 100644
index 00000000..b3a7f5b8
--- /dev/null
+++ b/xpm/country_SH.svgz
Binary files differ
diff --git a/xpm/country_SI.svgz b/xpm/country_SI.svgz
new file mode 100644
index 00000000..21837fd5
--- /dev/null
+++ b/xpm/country_SI.svgz
Binary files differ
diff --git a/xpm/country_SJ.svgz b/xpm/country_SJ.svgz
new file mode 100644
index 00000000..8971ba30
--- /dev/null
+++ b/xpm/country_SJ.svgz
Binary files differ
diff --git a/xpm/country_SK.svgz b/xpm/country_SK.svgz
new file mode 100644
index 00000000..e3d5fc0e
--- /dev/null
+++ b/xpm/country_SK.svgz
Binary files differ
diff --git a/xpm/country_SL.svgz b/xpm/country_SL.svgz
new file mode 100644
index 00000000..2c53b5e2
--- /dev/null
+++ b/xpm/country_SL.svgz
Binary files differ
diff --git a/xpm/country_SM.svgz b/xpm/country_SM.svgz
new file mode 100644
index 00000000..b1f0ec02
--- /dev/null
+++ b/xpm/country_SM.svgz
Binary files differ
diff --git a/xpm/country_SN.svgz b/xpm/country_SN.svgz
new file mode 100644
index 00000000..dfcbd74b
--- /dev/null
+++ b/xpm/country_SN.svgz
Binary files differ
diff --git a/xpm/country_SO.svgz b/xpm/country_SO.svgz
new file mode 100644
index 00000000..006f0cfa
--- /dev/null
+++ b/xpm/country_SO.svgz
Binary files differ
diff --git a/xpm/country_SR.svgz b/xpm/country_SR.svgz
new file mode 100644
index 00000000..87bf4209
--- /dev/null
+++ b/xpm/country_SR.svgz
Binary files differ
diff --git a/xpm/country_ST.svgz b/xpm/country_ST.svgz
new file mode 100644
index 00000000..ba51d11d
--- /dev/null
+++ b/xpm/country_ST.svgz
Binary files differ
diff --git a/xpm/country_SV.svgz b/xpm/country_SV.svgz
new file mode 100644
index 00000000..bc69d5a7
--- /dev/null
+++ b/xpm/country_SV.svgz
Binary files differ
diff --git a/xpm/country_SY.svgz b/xpm/country_SY.svgz
new file mode 100644
index 00000000..27d46fab
--- /dev/null
+++ b/xpm/country_SY.svgz
Binary files differ
diff --git a/xpm/country_SZ.svgz b/xpm/country_SZ.svgz
new file mode 100644
index 00000000..13c33353
--- /dev/null
+++ b/xpm/country_SZ.svgz
Binary files differ
diff --git a/xpm/country_TC.svgz b/xpm/country_TC.svgz
new file mode 100644
index 00000000..3f5daad2
--- /dev/null
+++ b/xpm/country_TC.svgz
Binary files differ
diff --git a/xpm/country_TD.svgz b/xpm/country_TD.svgz
new file mode 100644
index 00000000..823cc66e
--- /dev/null
+++ b/xpm/country_TD.svgz
Binary files differ
diff --git a/xpm/country_TF.svgz b/xpm/country_TF.svgz
new file mode 100644
index 00000000..8da92cfb
--- /dev/null
+++ b/xpm/country_TF.svgz
Binary files differ
diff --git a/xpm/country_TG.svgz b/xpm/country_TG.svgz
new file mode 100644
index 00000000..5a5c0166
--- /dev/null
+++ b/xpm/country_TG.svgz
Binary files differ
diff --git a/xpm/country_TH.svgz b/xpm/country_TH.svgz
new file mode 100644
index 00000000..a180af88
--- /dev/null
+++ b/xpm/country_TH.svgz
Binary files differ
diff --git a/xpm/country_TJ.svgz b/xpm/country_TJ.svgz
new file mode 100644
index 00000000..17a5a8f1
--- /dev/null
+++ b/xpm/country_TJ.svgz
Binary files differ
diff --git a/xpm/country_TK.svgz b/xpm/country_TK.svgz
new file mode 100644
index 00000000..8db772e7
--- /dev/null
+++ b/xpm/country_TK.svgz
Binary files differ
diff --git a/xpm/country_TL.svgz b/xpm/country_TL.svgz
new file mode 100644
index 00000000..69d36776
--- /dev/null
+++ b/xpm/country_TL.svgz
Binary files differ
diff --git a/xpm/country_TM.svgz b/xpm/country_TM.svgz
new file mode 100644
index 00000000..29dfc16c
--- /dev/null
+++ b/xpm/country_TM.svgz
Binary files differ
diff --git a/xpm/country_TN.svgz b/xpm/country_TN.svgz
new file mode 100644
index 00000000..d5c9bf69
--- /dev/null
+++ b/xpm/country_TN.svgz
Binary files differ
diff --git a/xpm/country_TO.svgz b/xpm/country_TO.svgz
new file mode 100644
index 00000000..283affa5
--- /dev/null
+++ b/xpm/country_TO.svgz
Binary files differ
diff --git a/xpm/country_TR.svgz b/xpm/country_TR.svgz
new file mode 100644
index 00000000..d1ec1cbc
--- /dev/null
+++ b/xpm/country_TR.svgz
Binary files differ
diff --git a/xpm/country_TT.svgz b/xpm/country_TT.svgz
new file mode 100644
index 00000000..960a8ebb
--- /dev/null
+++ b/xpm/country_TT.svgz
Binary files differ
diff --git a/xpm/country_TV.svgz b/xpm/country_TV.svgz
new file mode 100644
index 00000000..6b8ed6ab
--- /dev/null
+++ b/xpm/country_TV.svgz
Binary files differ
diff --git a/xpm/country_TW.svgz b/xpm/country_TW.svgz
new file mode 100644
index 00000000..e1fce942
--- /dev/null
+++ b/xpm/country_TW.svgz
Binary files differ
diff --git a/xpm/country_TZ.svgz b/xpm/country_TZ.svgz
new file mode 100644
index 00000000..9615d4f0
--- /dev/null
+++ b/xpm/country_TZ.svgz
Binary files differ
diff --git a/xpm/country_UA.svgz b/xpm/country_UA.svgz
new file mode 100644
index 00000000..8f527bb3
--- /dev/null
+++ b/xpm/country_UA.svgz
Binary files differ
diff --git a/xpm/country_UG.svgz b/xpm/country_UG.svgz
new file mode 100644
index 00000000..0f376c95
--- /dev/null
+++ b/xpm/country_UG.svgz
Binary files differ
diff --git a/xpm/country_UM.svgz b/xpm/country_UM.svgz
new file mode 100644
index 00000000..28ec4a71
--- /dev/null
+++ b/xpm/country_UM.svgz
Binary files differ
diff --git a/xpm/country_US.svgz b/xpm/country_US.svgz
new file mode 100644
index 00000000..11f82327
--- /dev/null
+++ b/xpm/country_US.svgz
Binary files differ
diff --git a/xpm/country_UY.svgz b/xpm/country_UY.svgz
new file mode 100644
index 00000000..ee677f67
--- /dev/null
+++ b/xpm/country_UY.svgz
Binary files differ
diff --git a/xpm/country_UZ.svgz b/xpm/country_UZ.svgz
new file mode 100644
index 00000000..69e781b4
--- /dev/null
+++ b/xpm/country_UZ.svgz
Binary files differ
diff --git a/xpm/country_VA.svgz b/xpm/country_VA.svgz
new file mode 100644
index 00000000..dc9ba926
--- /dev/null
+++ b/xpm/country_VA.svgz
Binary files differ
diff --git a/xpm/country_VC.svgz b/xpm/country_VC.svgz
new file mode 100644
index 00000000..b5c94b0d
--- /dev/null
+++ b/xpm/country_VC.svgz
Binary files differ
diff --git a/xpm/country_VE.svgz b/xpm/country_VE.svgz
new file mode 100644
index 00000000..19b77201
--- /dev/null
+++ b/xpm/country_VE.svgz
Binary files differ
diff --git a/xpm/country_VG.svgz b/xpm/country_VG.svgz
new file mode 100644
index 00000000..cb9b78cf
--- /dev/null
+++ b/xpm/country_VG.svgz
Binary files differ
diff --git a/xpm/country_VI.svgz b/xpm/country_VI.svgz
new file mode 100644
index 00000000..0ae17cf3
--- /dev/null
+++ b/xpm/country_VI.svgz
Binary files differ
diff --git a/xpm/country_VN.svgz b/xpm/country_VN.svgz
new file mode 100644
index 00000000..9b6490d5
--- /dev/null
+++ b/xpm/country_VN.svgz
Binary files differ
diff --git a/xpm/country_VU.svgz b/xpm/country_VU.svgz
new file mode 100644
index 00000000..a5c02df5
--- /dev/null
+++ b/xpm/country_VU.svgz
Binary files differ
diff --git a/xpm/country_WF.svgz b/xpm/country_WF.svgz
new file mode 100644
index 00000000..5a0558f3
--- /dev/null
+++ b/xpm/country_WF.svgz
Binary files differ
diff --git a/xpm/country_WS.svgz b/xpm/country_WS.svgz
new file mode 100644
index 00000000..6f8c24f7
--- /dev/null
+++ b/xpm/country_WS.svgz
Binary files differ
diff --git a/xpm/country_YE.svgz b/xpm/country_YE.svgz
new file mode 100644
index 00000000..97be6f64
--- /dev/null
+++ b/xpm/country_YE.svgz
Binary files differ
diff --git a/xpm/country_YT.svgz b/xpm/country_YT.svgz
new file mode 100644
index 00000000..dcfe4c3f
--- /dev/null
+++ b/xpm/country_YT.svgz
Binary files differ
diff --git a/xpm/country_ZA.svgz b/xpm/country_ZA.svgz
new file mode 100644
index 00000000..dd0ddbde
--- /dev/null
+++ b/xpm/country_ZA.svgz
Binary files differ
diff --git a/xpm/country_ZM.svgz b/xpm/country_ZM.svgz
new file mode 100644
index 00000000..cdebdcdf
--- /dev/null
+++ b/xpm/country_ZM.svgz
Binary files differ
diff --git a/xpm/country_ZW.svgz b/xpm/country_ZW.svgz
new file mode 100644
index 00000000..9ff43bb1
--- /dev/null
+++ b/xpm/country_ZW.svgz
Binary files differ
diff --git a/xpm/cursor.png b/xpm/cursor.png
new file mode 100644
index 00000000..ebac5d5c
--- /dev/null
+++ b/xpm/cursor.png
Binary files differ
diff --git a/xpm/cursor.svg b/xpm/cursor.svg
new file mode 100644
index 00000000..3f905c1b
--- /dev/null
+++ b/xpm/cursor.svg
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="cursor.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3164">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop3166" />
+ <stop
+ id="stop3172"
+ offset="0.34999999"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop3168" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5113">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop5115" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop5117" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5113"
+ id="linearGradient5315"
+ x1="17.498823"
+ y1="10.445395"
+ x2="34.744495"
+ y2="40.231434"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.004639,0,0,1,-25.573398,-16.186506)" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5105">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop5107" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5109" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5105"
+ id="radialGradient4354"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.282946,0,13.64644)"
+ cx="11.25"
+ cy="19.03125"
+ fx="11.25"
+ fy="19.03125"
+ r="8.0625" />
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ <inkscape:perspective
+ id="perspective2390"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5113"
+ id="linearGradient3227"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.004639,0,0,1,-25.573398,-16.186506)"
+ x1="17.498823"
+ y1="10.445395"
+ x2="34.744495"
+ y2="40.231434" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5113"
+ id="linearGradient3230"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.2681342,-0.1548073,0.1540925,0.2668961,0.3757766,7.7972572)"
+ x1="17.498823"
+ y1="10.445395"
+ x2="34.744495"
+ y2="40.231434" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3164"
+ id="linearGradient3170"
+ x1="10.895593"
+ y1="3.1353614"
+ x2="10.895593"
+ y2="20.189789"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="7.919596"
+ inkscape:cx="-15.465375"
+ inkscape:cy="15.361975"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer3"
+ showgrid="false"
+ inkscape:window-width="1500"
+ inkscape:window-height="1027"
+ inkscape:window-x="299"
+ inkscape:window-y="94" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ style="opacity:0.29878049" />
+ <g
+ inkscape:groupmode="layer"
+ id="layer2"
+ inkscape:label="vrai"
+ style="display:inline" />
+ <g
+ inkscape:groupmode="layer"
+ id="layer3"
+ inkscape:label="arrow">
+ <g
+ id="g3175">
+ <path
+ transform="matrix(1.2159091,0,0,1.2159091,6.4403409,7.2111404)"
+ d="M 11.607143,3.1160715 A 7.8571429,7.8571429 0 1 1 -4.1071429,3.1160715 A 7.8571429,7.8571429 0 1 1 11.607143,3.1160715 z"
+ sodipodi:ry="7.8571429"
+ sodipodi:rx="7.8571429"
+ sodipodi:cy="3.1160715"
+ sodipodi:cx="3.75"
+ id="path2397"
+ style="display:inline;opacity:1;fill:#005698;fill-opacity:1;stroke:#000000;stroke-width:1.64485980000000009;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ sodipodi:type="arc" />
+ <path
+ sodipodi:nodetypes="cccccccc"
+ id="path4348"
+ d="M 4.6287275,10.38658 L 11.016008,3.0326109 L 17.371272,10.386581 L 13.195833,10.386581 L 13.195833,20.18947 L 8.8562186,20.18947 L 8.8562192,10.386581 L 4.6287275,10.38658 z"
+ style="fill:url(#linearGradient3170);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ </g>
+</svg>
diff --git a/xpm/cursor.xml b/xpm/cursor.xml
new file mode 100644
index 00000000..3afede12
--- /dev/null
+++ b/xpm/cursor.xml
@@ -0,0 +1,20 @@
+<cursor w="48" h="48">
+ <itemgra speed_range="-2"><icon src="cursor_still.svg" w="48" h="48"/></itemgra>
+ <itemgra speed_range="3-" angle_range="0-11"><icon src="cursor.svg" w="48" h="48"/></itemgra>
+ <itemgra speed_range="3-" angle_range="12-34"><icon src="cursor225.svg" w="48" h="48"/></itemgra>
+ <itemgra speed_range="3-" angle_range="35-56"><icon src="cursor450.svg" w="48" h="48"/></itemgra>
+ <itemgra speed_range="3-" angle_range="57-75"><icon src="cursor675.svg" w="48" h="48"/></itemgra>
+ <itemgra speed_range="3-" angle_range="76-98"><icon src="cursor.svg" rotation="90" w="48" h="48"/></itemgra>
+ <itemgra speed_range="3-" angle_range="99-120"><icon src="cursor225.svg" rotation="90" w="48" h="48"/></itemgra>
+ <itemgra speed_range="3-" angle_range="121-143"><icon src="cursor450.svg" rotation="90" w="48" h="48"/></itemgra>
+ <itemgra speed_range="3-" angle_range="144-165"><icon src="cursor675.svg" rotation="90" w="48" h="48"/></itemgra>
+ <itemgra speed_range="3-" angle_range="166-188"><icon src="cursor.svg" rotation="180" w="48" h="48"/></itemgra>
+ <itemgra speed_range="3-" angle_range="189-210"><icon src="cursor225.svg" rotation="180" w="48" h="48"/></itemgra>
+ <itemgra speed_range="3-" angle_range="211-233"><icon src="cursor450.svg" rotation="180" w="48" h="48"/></itemgra>
+ <itemgra speed_range="3-" angle_range="234-255"><icon src="cursor675.svg" rotation="180" w="48" h="48"/></itemgra>
+ <itemgra speed_range="3-" angle_range="256-278"><icon src="cursor.svg" rotation="270" w="48" h="48"/></itemgra>
+ <itemgra speed_range="3-" angle_range="279-300"><icon src="cursor225.svg" rotation="270" w="48" h="48"/></itemgra>
+ <itemgra speed_range="3-" angle_range="301-323"><icon src="cursor450.svg" rotation="270" w="48" h="48"/></itemgra>
+ <itemgra speed_range="3-" angle_range="324-345"><icon src="cursor675.svg" rotation="270" w="48" h="48"/></itemgra>
+ <itemgra speed_range="3-" angle_range="346-360"><icon src="cursor.svg" w="48" h="48"/></itemgra>
+</cursor>
diff --git a/navit/xpm/cursor.xpm b/xpm/cursor.xpm
index efa2690b..efa2690b 100644
--- a/navit/xpm/cursor.xpm
+++ b/xpm/cursor.xpm
diff --git a/xpm/cursor225.png b/xpm/cursor225.png
new file mode 100644
index 00000000..6e49c46d
--- /dev/null
+++ b/xpm/cursor225.png
Binary files differ
diff --git a/xpm/cursor225.svg b/xpm/cursor225.svg
new file mode 100644
index 00000000..5033ff2c
--- /dev/null
+++ b/xpm/cursor225.svg
@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="cursor225.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/Bureau/cursor_675.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3164">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop3166" />
+ <stop
+ id="stop3172"
+ offset="0.34999999"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop3168" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5113">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop5115" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop5117" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5113"
+ id="linearGradient5315"
+ x1="17.498823"
+ y1="10.445395"
+ x2="34.744495"
+ y2="40.231434"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.004639,0,0,1,-25.573398,-16.186506)" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5105">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop5107" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5109" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5105"
+ id="radialGradient4354"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.282946,0,13.64644)"
+ cx="11.25"
+ cy="19.03125"
+ fx="11.25"
+ fy="19.03125"
+ r="8.0625" />
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ <inkscape:perspective
+ id="perspective2390"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5113"
+ id="linearGradient3227"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.004639,0,0,1,-25.573398,-16.186506)"
+ x1="17.498823"
+ y1="10.445395"
+ x2="34.744495"
+ y2="40.231434" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5113"
+ id="linearGradient3230"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.2681342,-0.1548073,0.1540925,0.2668961,0.3757766,7.7972572)"
+ x1="17.498823"
+ y1="10.445395"
+ x2="34.744495"
+ y2="40.231434" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3164"
+ id="linearGradient3170"
+ x1="10.895593"
+ y1="3.1353614"
+ x2="10.895593"
+ y2="20.189789"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3164"
+ id="linearGradient3211"
+ gradientUnits="userSpaceOnUse"
+ x1="10.895593"
+ y1="3.1353614"
+ x2="10.895593"
+ y2="20.189789" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="7.919596"
+ inkscape:cx="-3.663056"
+ inkscape:cy="14.298316"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer3"
+ showgrid="false"
+ inkscape:window-width="1500"
+ inkscape:window-height="1027"
+ inkscape:window-x="211"
+ inkscape:window-y="85" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ style="opacity:0.29878049" />
+ <g
+ inkscape:groupmode="layer"
+ id="layer2"
+ inkscape:label="vrai"
+ style="display:inline" />
+ <g
+ inkscape:groupmode="layer"
+ id="layer3"
+ inkscape:label="arrow">
+ <g
+ id="g3175"
+ transform="matrix(0.9238769,0.3826898,-0.3826898,0.9238769,5.0469413,-3.3722334)">
+ <path
+ transform="matrix(1.2159091,0,0,1.2159091,6.4403409,7.2111404)"
+ d="M 11.607143,3.1160715 A 7.8571429,7.8571429 0 1 1 -4.1071429,3.1160715 A 7.8571429,7.8571429 0 1 1 11.607143,3.1160715 z"
+ sodipodi:ry="7.8571429"
+ sodipodi:rx="7.8571429"
+ sodipodi:cy="3.1160715"
+ sodipodi:cx="3.75"
+ id="path2397"
+ style="opacity:1;fill:#005698;fill-opacity:1;stroke:#000000;stroke-width:1.64485979;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline"
+ sodipodi:type="arc" />
+ <path
+ sodipodi:nodetypes="cccccccc"
+ id="path4348"
+ d="M 4.6287275,10.38658 L 11.016008,3.0326109 L 17.371272,10.386581 L 13.195833,10.386581 L 13.195833,20.18947 L 8.8562186,20.18947 L 8.8562192,10.386581 L 4.6287275,10.38658 z"
+ style="fill:url(#linearGradient3211);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ </g>
+</svg>
diff --git a/xpm/cursor450.png b/xpm/cursor450.png
new file mode 100644
index 00000000..353c4ddf
--- /dev/null
+++ b/xpm/cursor450.png
Binary files differ
diff --git a/xpm/cursor450.svg b/xpm/cursor450.svg
new file mode 100644
index 00000000..d3a7a469
--- /dev/null
+++ b/xpm/cursor450.svg
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="cursor450.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/Bureau/cursor_225.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3164">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop3166" />
+ <stop
+ id="stop3172"
+ offset="0.34999999"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop3168" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5113">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop5115" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop5117" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5113"
+ id="linearGradient5315"
+ x1="17.498823"
+ y1="10.445395"
+ x2="34.744495"
+ y2="40.231434"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.004639,0,0,1,-25.573398,-16.186506)" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5105">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop5107" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5109" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5105"
+ id="radialGradient4354"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.282946,0,13.64644)"
+ cx="11.25"
+ cy="19.03125"
+ fx="11.25"
+ fy="19.03125"
+ r="8.0625" />
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ <inkscape:perspective
+ id="perspective2390"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5113"
+ id="linearGradient3227"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.004639,0,0,1,-25.573398,-16.186506)"
+ x1="17.498823"
+ y1="10.445395"
+ x2="34.744495"
+ y2="40.231434" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5113"
+ id="linearGradient3230"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.2681342,-0.1548073,0.1540925,0.2668961,0.3757766,7.7972572)"
+ x1="17.498823"
+ y1="10.445395"
+ x2="34.744495"
+ y2="40.231434" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3164"
+ id="linearGradient3170"
+ x1="10.895593"
+ y1="3.1353614"
+ x2="10.895593"
+ y2="20.189789"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="7.919596"
+ inkscape:cx="-3.663056"
+ inkscape:cy="14.298316"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer3"
+ showgrid="false"
+ inkscape:window-width="1500"
+ inkscape:window-height="1027"
+ inkscape:window-x="211"
+ inkscape:window-y="85" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ style="opacity:0.29878049" />
+ <g
+ inkscape:groupmode="layer"
+ id="layer2"
+ inkscape:label="vrai"
+ style="display:inline" />
+ <g
+ inkscape:groupmode="layer"
+ id="layer3"
+ inkscape:label="arrow">
+ <g
+ id="g3175"
+ transform="matrix(0.7071068,0.7071068,-0.7071068,0.7071068,11,-4.5563492)">
+ <path
+ transform="matrix(1.2159091,0,0,1.2159091,6.4403409,7.2111404)"
+ d="M 11.607143,3.1160715 A 7.8571429,7.8571429 0 1 1 -4.1071429,3.1160715 A 7.8571429,7.8571429 0 1 1 11.607143,3.1160715 z"
+ sodipodi:ry="7.8571429"
+ sodipodi:rx="7.8571429"
+ sodipodi:cy="3.1160715"
+ sodipodi:cx="3.75"
+ id="path2397"
+ style="opacity:1;fill:#005698;fill-opacity:1;stroke:#000000;stroke-width:1.64485979;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline"
+ sodipodi:type="arc" />
+ <path
+ sodipodi:nodetypes="cccccccc"
+ id="path4348"
+ d="M 4.6287275,10.38658 L 11.016008,3.0326109 L 17.371272,10.386581 L 13.195833,10.386581 L 13.195833,20.18947 L 8.8562186,20.18947 L 8.8562192,10.386581 L 4.6287275,10.38658 z"
+ style="fill:url(#linearGradient3170);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ </g>
+</svg>
diff --git a/xpm/cursor675.png b/xpm/cursor675.png
new file mode 100644
index 00000000..53a33582
--- /dev/null
+++ b/xpm/cursor675.png
Binary files differ
diff --git a/xpm/cursor675.svg b/xpm/cursor675.svg
new file mode 100644
index 00000000..36957816
--- /dev/null
+++ b/xpm/cursor675.svg
@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="cursor675.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/Bureau/cursor_675.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3164">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop3166" />
+ <stop
+ id="stop3172"
+ offset="0.34999999"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop3168" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5113">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop5115" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop5117" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5113"
+ id="linearGradient5315"
+ x1="17.498823"
+ y1="10.445395"
+ x2="34.744495"
+ y2="40.231434"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.004639,0,0,1,-25.573398,-16.186506)" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5105">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop5107" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5109" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5105"
+ id="radialGradient4354"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.282946,0,13.64644)"
+ cx="11.25"
+ cy="19.03125"
+ fx="11.25"
+ fy="19.03125"
+ r="8.0625" />
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ <inkscape:perspective
+ id="perspective2390"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5113"
+ id="linearGradient3227"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.004639,0,0,1,-25.573398,-16.186506)"
+ x1="17.498823"
+ y1="10.445395"
+ x2="34.744495"
+ y2="40.231434" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5113"
+ id="linearGradient3230"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.2681342,-0.1548073,0.1540925,0.2668961,0.3757766,7.7972572)"
+ x1="17.498823"
+ y1="10.445395"
+ x2="34.744495"
+ y2="40.231434" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3164"
+ id="linearGradient3170"
+ x1="10.895593"
+ y1="3.1353614"
+ x2="10.895593"
+ y2="20.189789"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3164"
+ id="linearGradient3187"
+ gradientUnits="userSpaceOnUse"
+ x1="10.895593"
+ y1="3.1353614"
+ x2="10.895593"
+ y2="20.189789" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="7.919596"
+ inkscape:cx="-15.465375"
+ inkscape:cy="15.361975"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer3"
+ showgrid="false"
+ inkscape:window-width="1500"
+ inkscape:window-height="1027"
+ inkscape:window-x="211"
+ inkscape:window-y="85" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ style="opacity:0.29878049" />
+ <g
+ inkscape:groupmode="layer"
+ id="layer2"
+ inkscape:label="vrai"
+ style="display:inline" />
+ <g
+ inkscape:groupmode="layer"
+ id="layer3"
+ inkscape:label="arrow">
+ <g
+ id="g3175"
+ transform="matrix(0.3826805,0.9238807,-0.9238807,0.3826805,16.953203,-3.3721738)">
+ <path
+ transform="matrix(1.2159091,0,0,1.2159091,6.4403409,7.2111404)"
+ d="M 11.607143,3.1160715 A 7.8571429,7.8571429 0 1 1 -4.1071429,3.1160715 A 7.8571429,7.8571429 0 1 1 11.607143,3.1160715 z"
+ sodipodi:ry="7.8571429"
+ sodipodi:rx="7.8571429"
+ sodipodi:cy="3.1160715"
+ sodipodi:cx="3.75"
+ id="path2397"
+ style="opacity:1;fill:#005698;fill-opacity:1;stroke:#000000;stroke-width:1.64485979;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline"
+ sodipodi:type="arc" />
+ <path
+ sodipodi:nodetypes="cccccccc"
+ id="path4348"
+ d="M 4.6287275,10.38658 L 11.016008,3.0326109 L 17.371272,10.386581 L 13.195833,10.386581 L 13.195833,20.18947 L 8.8562186,20.18947 L 8.8562192,10.386581 L 4.6287275,10.38658 z"
+ style="fill:url(#linearGradient3187);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ </g>
+</svg>
diff --git a/xpm/cursor_still.png b/xpm/cursor_still.png
new file mode 100644
index 00000000..f9ea8dff
--- /dev/null
+++ b/xpm/cursor_still.png
Binary files differ
diff --git a/xpm/cursor_still.svg b/xpm/cursor_still.svg
new file mode 100644
index 00000000..80ec5d22
--- /dev/null
+++ b/xpm/cursor_still.svg
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="cursor_still.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/projets/navit/icons/cursor/cursor_still.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3164">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop3166" />
+ <stop
+ id="stop3172"
+ offset="0.34999999"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop3168" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5113">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop5115" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop5117" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5113"
+ id="linearGradient5315"
+ x1="17.498823"
+ y1="10.445395"
+ x2="34.744495"
+ y2="40.231434"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.004639,0,0,1,-25.573398,-16.186506)" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5105">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop5107" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5109" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5105"
+ id="radialGradient4354"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.282946,0,13.64644)"
+ cx="11.25"
+ cy="19.03125"
+ fx="11.25"
+ fy="19.03125"
+ r="8.0625" />
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ <inkscape:perspective
+ id="perspective2390"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5113"
+ id="linearGradient3227"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.004639,0,0,1,-25.573398,-16.186506)"
+ x1="17.498823"
+ y1="10.445395"
+ x2="34.744495"
+ y2="40.231434" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5113"
+ id="linearGradient3230"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.2681342,-0.1548073,0.1540925,0.2668961,0.3757766,7.7972572)"
+ x1="17.498823"
+ y1="10.445395"
+ x2="34.744495"
+ y2="40.231434" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3164"
+ id="linearGradient2401"
+ gradientUnits="userSpaceOnUse"
+ x1="10.895593"
+ y1="3.1353614"
+ x2="10.895593"
+ y2="20.189789" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="7.919596"
+ inkscape:cx="-26.127951"
+ inkscape:cy="9.4283537"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer5"
+ showgrid="false"
+ inkscape:window-width="1500"
+ inkscape:window-height="1027"
+ inkscape:window-x="299"
+ inkscape:window-y="94" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ style="opacity:0.29878049" />
+ <g
+ inkscape:groupmode="layer"
+ id="layer2"
+ inkscape:label="vrai"
+ style="display:inline" />
+ <g
+ inkscape:groupmode="layer"
+ id="layer3"
+ inkscape:label="arrow"
+ style="display:inline"
+ sodipodi:insensitive="true">
+ <path
+ sodipodi:type="arc"
+ style="fill:#005698;fill-opacity:1;stroke:#000000;stroke-width:1.64485979;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline"
+ id="path2397"
+ sodipodi:cx="3.75"
+ sodipodi:cy="3.1160715"
+ sodipodi:rx="7.8571429"
+ sodipodi:ry="7.8571429"
+ d="M 11.607143,3.1160715 A 7.8571429,7.8571429 0 1 1 -4.1071429,3.1160715 A 7.8571429,7.8571429 0 1 1 11.607143,3.1160715 z"
+ transform="matrix(1.2159091,0,0,1.2159091,6.4403409,7.2111404)" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer5"
+ inkscape:label="point">
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path2404"
+ sodipodi:cx="8.4600277"
+ sodipodi:cy="7.8578644"
+ sodipodi:rx="3.5355339"
+ sodipodi:ry="3.5355339"
+ d="M 11.995562,7.8578644 A 3.5355339,3.5355339 0 1 1 4.9244938,7.8578644 A 3.5355339,3.5355339 0 1 1 11.995562,7.8578644 z"
+ transform="matrix(1.0714286,0,0,1.0714286,1.9356846,2.5808596)" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer4"
+ inkscape:label="?"
+ sodipodi:insensitive="true"
+ style="display:none">
+ <text
+ xml:space="preserve"
+ style="font-size:20px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans Bold"
+ x="5.0087891"
+ y="17.982422"
+ id="text3176"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan3178"
+ x="5.0087891"
+ y="17.982422">?</tspan></text>
+ </g>
+</svg>
diff --git a/xpm/desktop_icons/128x128/navit.png b/xpm/desktop_icons/128x128/navit.png
new file mode 100644
index 00000000..710fb7c3
--- /dev/null
+++ b/xpm/desktop_icons/128x128/navit.png
Binary files differ
diff --git a/xpm/desktop_icons/22x22/navit.png b/xpm/desktop_icons/22x22/navit.png
new file mode 100644
index 00000000..3c412db1
--- /dev/null
+++ b/xpm/desktop_icons/22x22/navit.png
Binary files differ
diff --git a/xpm/desktop_icons/navit.desktop b/xpm/desktop_icons/navit.desktop
new file mode 100644
index 00000000..ff66f8ae
--- /dev/null
+++ b/xpm/desktop_icons/navit.desktop
@@ -0,0 +1,16 @@
+[Desktop Entry]
+Version=1.0
+Name=Navit
+Name[de]=Navit
+Name[fr]=Navit
+Comment=The open source vector based navigation program with routing engine
+Comment[de]=Ein vektorbasiertes Navigationsprogramm
+Comment[fr]=Le logiciel opensource de navigation vectorielle
+Exec=navit
+Icon=navit
+StartupNotify=true
+Terminal=false
+Type=Application
+Categories=GTK;Utility;Geography;
+GenericName=Navit
+GenericName[de]=Navit
diff --git a/navit/xpm/dumping-station.xpm b/xpm/dumping-station.xpm
index c58d1424..c58d1424 100644
--- a/navit/xpm/dumping-station.xpm
+++ b/xpm/dumping-station.xpm
diff --git a/xpm/exit.svg b/xpm/exit.svg
new file mode 100644
index 00000000..8fd6d863
--- /dev/null
+++ b/xpm/exit.svg
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="exit.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/projets/navit/icons/png/exit.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="TriangleOutS"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutS"
+ style="overflow:visible">
+ <path
+ id="path3310"
+ d="M 5.77,0 L -2.88,5 L -2.88,-5 L 5.77,0 z"
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
+ transform="scale(0.2,0.2)" />
+ </marker>
+ <marker
+ inkscape:stockid="Tail"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Tail"
+ style="overflow:visible">
+ <g
+ id="g3197"
+ transform="scale(-1.2,-1.2)">
+ <path
+ id="path3199"
+ d="M -3.8048674,-3.9585227 L 0.54352094,0"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.80000001;stroke-linecap:round;marker-start:none;marker-end:none" />
+ <path
+ id="path3201"
+ d="M -1.2866832,-3.9585227 L 3.0617053,0"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.80000001;stroke-linecap:round;marker-start:none;marker-end:none" />
+ <path
+ id="path3203"
+ d="M 1.3053582,-3.9585227 L 5.6537466,0"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.80000001;stroke-linecap:round;marker-start:none;marker-end:none" />
+ <path
+ id="path3205"
+ d="M -3.8048674,4.1775838 L 0.54352094,0.21974226"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.80000001;stroke-linecap:round;marker-start:none;marker-end:none" />
+ <path
+ id="path3207"
+ d="M -1.2866832,4.1775838 L 3.0617053,0.21974226"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.80000001;stroke-linecap:round;marker-start:none;marker-end:none" />
+ <path
+ id="path3209"
+ d="M 1.3053582,4.1775838 L 5.6537466,0.21974226"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.80000001;stroke-linecap:round;marker-start:none;marker-end:none" />
+ </g>
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Send"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow1Send"
+ style="overflow:visible">
+ <path
+ id="path3176"
+ d="M 0,0 L 5,-5 L -12.5,0 L 5,5 L 0,0 z"
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
+ transform="matrix(-0.2,0,0,-0.2,-1.2,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Lend"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow1Lend"
+ style="overflow:visible">
+ <path
+ id="path3164"
+ d="M 0,0 L 5,-5 L -12.5,0 L 5,5 L 0,0 z"
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
+ transform="matrix(-0.8,0,0,-0.8,-10,0)" />
+ </marker>
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#0083f4"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="1"
+ inkscape:pageshadow="2"
+ inkscape:zoom="15.839192"
+ inkscape:cx="9.0421129"
+ inkscape:cy="7.8731905"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:window-width="943"
+ inkscape:window-height="682"
+ inkscape:window-x="-5"
+ inkscape:window-y="24">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2380"
+ visible="true"
+ enabled="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ style="opacity:0.80000000000000004;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#TriangleOutS);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 8.573647,21.264649 C 8.573647,21.264649 6.5031479,11.06486 16.162607,6.1851002"
+ id="path3156"
+ sodipodi:nodetypes="cc" />
+ <path
+ style="fill:#3f3f3f;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 3.0843991,0.26423648 L 10,0.35295939 L 10,21.88409 L 3.0843991,21.795367 L 3.0843991,0.26423648 z"
+ id="rect2383"
+ sodipodi:nodetypes="ccccc" />
+ <rect
+ style="opacity:1;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.98289597;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect2382"
+ width="21.141155"
+ height="21.141155"
+ x="0.49144804"
+ y="0.49144825" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#fdff03;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:2.00000002, 2.00000002;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 6.4586472,1.9742322 L 6.4586472,21.227102"
+ id="path5565" />
+ </g>
+</svg>
diff --git a/navit/xpm/exit.xpm b/xpm/exit.xpm
index 81491a0f..81491a0f 100644
--- a/navit/xpm/exit.xpm
+++ b/xpm/exit.xpm
diff --git a/xpm/fastfood.svg b/xpm/fastfood.svg
new file mode 100644
index 00000000..a10bc4bb
--- /dev/null
+++ b/xpm/fastfood.svg
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="fastfood.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/projets/navit/icons/png/fastfood.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3179">
+ <stop
+ style="stop-color:#b45d00;stop-opacity:1;"
+ offset="0"
+ id="stop3181" />
+ <stop
+ style="stop-color:#502900;stop-opacity:1;"
+ offset="1"
+ id="stop3183" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3163">
+ <stop
+ style="stop-color:#ffe639;stop-opacity:1;"
+ offset="0"
+ id="stop3165" />
+ <stop
+ style="stop-color:#cd7f00;stop-opacity:1;"
+ offset="1"
+ id="stop3167" />
+ </linearGradient>
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3163"
+ id="linearGradient3169"
+ x1="1.2863814"
+ y1="7.4118396"
+ x2="20.524135"
+ y2="7.4118396"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3163"
+ id="linearGradient3177"
+ x1="1.8652222"
+ y1="17.49683"
+ x2="19.974939"
+ y2="17.49683"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3179"
+ id="linearGradient3185"
+ x1="2.9744897"
+ y1="13.444727"
+ x2="19.051228"
+ y2="13.444727"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#f4ca00"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="16"
+ inkscape:cx="10.16782"
+ inkscape:cy="11.973272"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:window-width="943"
+ inkscape:window-height="682"
+ inkscape:window-x="-4"
+ inkscape:window-y="24"
+ showguides="true"
+ inkscape:guide-bbox="true"
+ inkscape:snap-global="false">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2380"
+ visible="true"
+ enabled="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="opacity:1;fill:url(#linearGradient3177);fill-opacity:1.0;fill-rule:evenodd;stroke:#947c38;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect2388"
+ width="17.109716"
+ height="4.0315895"
+ x="2.3652222"
+ y="15.481035" />
+ <rect
+ style="opacity:1;fill:url(#linearGradient3185);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect3160"
+ width="16.076738"
+ height="3.1512756"
+ x="2.9744897"
+ y="11.869089" />
+ <path
+ style="fill:url(#linearGradient3169);fill-opacity:1;fill-rule:evenodd;stroke:#947c38;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 2.367162,5.5740819 C 7.6734217,2.8017603 13.343139,2.5027573 19.508128,5.5740819 C 20.309525,7.8309316 20.072627,9.698134 19.508128,11.442397 L 2.367162,11.442397 C 1.7828457,9.551264 1.4233243,7.6351346 2.367162,5.5740819 z"
+ id="rect3162"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#4bb216;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 12.116824,13.468571 L 17.787518,13.404084"
+ id="path3167"
+ sodipodi:nodetypes="cc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#4bb216;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 13.569035,13.515262 L 13.569035,15.987082"
+ id="path3169"
+ sodipodi:nodetypes="cc" />
+ <g
+ id="g2388"
+ transform="translate(-0.84375,-0.75)">
+ <path
+ sodipodi:nodetypes="cc"
+ id="path3165"
+ d="M 5.2691033,13.237358 L 10.939798,13.172871"
+ style="fill:none;fill-rule:evenodd;stroke:#4bb216;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ sodipodi:nodetypes="cc"
+ id="path3171"
+ d="M 8.4382877,13.240339 L 8.4070377,15.743408"
+ style="fill:none;fill-rule:evenodd;stroke:#4bb216;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ </g>
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#68480a;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path2420"
+ sodipodi:cx="0"
+ sodipodi:cy="12.1875"
+ sodipodi:rx="0.9375"
+ sodipodi:ry="0.9375"
+ d="M 0.9375,12.1875 A 0.9375,0.9375 0 1 1 -0.9375,12.1875 A 0.9375,0.9375 0 1 1 0.9375,12.1875 z"
+ transform="translate(5.0625,-3.28125)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#68480a;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3192"
+ sodipodi:cx="0"
+ sodipodi:cy="12.1875"
+ sodipodi:rx="0.9375"
+ sodipodi:ry="0.9375"
+ d="M 0.9375,12.1875 A 0.9375,0.9375 0 1 1 -0.9375,12.1875 A 0.9375,0.9375 0 1 1 0.9375,12.1875 z"
+ transform="translate(9.125,-5.25)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#68480a;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3194"
+ sodipodi:cx="0"
+ sodipodi:cy="12.1875"
+ sodipodi:rx="0.9375"
+ sodipodi:ry="0.9375"
+ d="M 0.9375,12.1875 A 0.9375,0.9375 0 1 1 -0.9375,12.1875 A 0.9375,0.9375 0 1 1 0.9375,12.1875 z"
+ transform="translate(13.09375,-3.28125)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#68480a;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3196"
+ sodipodi:cx="0"
+ sodipodi:cy="12.1875"
+ sodipodi:rx="0.9375"
+ sodipodi:ry="0.9375"
+ d="M 0.9375,12.1875 A 0.9375,0.9375 0 1 1 -0.9375,12.1875 A 0.9375,0.9375 0 1 1 0.9375,12.1875 z"
+ transform="translate(16.09375,-4.09375)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#68480a;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3198"
+ sodipodi:cx="0"
+ sodipodi:cy="12.1875"
+ sodipodi:rx="0.9375"
+ sodipodi:ry="0.9375"
+ d="M 0.9375,12.1875 A 0.9375,0.9375 0 1 1 -0.9375,12.1875 A 0.9375,0.9375 0 1 1 0.9375,12.1875 z"
+ transform="translate(13.15625,-6.15625)" />
+ </g>
+</svg>
diff --git a/navit/xpm/fastfood.xpm b/xpm/fastfood.xpm
index 033e6c9d..033e6c9d 100644
--- a/navit/xpm/fastfood.xpm
+++ b/xpm/fastfood.xpm
diff --git a/xpm/firebrigade.svg b/xpm/firebrigade.svg
new file mode 100644
index 00000000..93fd91aa
--- /dev/null
+++ b/xpm/firebrigade.svg
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="firebrigade.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/projets/navit/icons/png/firebrigade.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3153">
+ <stop
+ style="stop-color:#e20000;stop-opacity:1;"
+ offset="0"
+ id="stop3155" />
+ <stop
+ style="stop-color:#e20000;stop-opacity:0;"
+ offset="1"
+ id="stop3157" />
+ </linearGradient>
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3153"
+ id="linearGradient3159"
+ x1="11.552056"
+ y1="20.566092"
+ x2="11.552056"
+ y2="-2.348809"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#f4ca00"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="1"
+ inkscape:pageshadow="2"
+ inkscape:zoom="11.2"
+ inkscape:cx="14.068915"
+ inkscape:cy="13.61603"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:window-width="943"
+ inkscape:window-height="682"
+ inkscape:window-x="-4"
+ inkscape:window-y="24">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2380"
+ visible="true"
+ enabled="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ id="path3157"
+ style="fill:url(#linearGradient3159);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:24.80315017999999938;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 18.025271,14.578301 C 18.025271,17.882841 15.343326,20.564785 12.038786,20.564785 C 8.7342469,20.564785 6.0523019,17.882841 6.0523019,14.578301 C 6.0523019,11.27376 9.9229438,7.7482342 11.799328,1.7911694 C 12.956702,6.5973338 18.025271,11.27376 18.025271,14.578301 z M 13.443087,14.980042 C 13.443087,17.578337 11.334326,19.687097 8.7360317,19.687097 C 6.1377367,19.687097 4.0289759,17.578337 4.0289759,14.980042 C 4.0289759,12.381746 7.0723859,9.6096933 8.5477499,4.9257695 C 9.4577708,8.7047629 13.443087,12.381746 13.443087,14.980042 z" />
+ <rect
+ style="opacity:1;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.98289609;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect2382"
+ width="21.088533"
+ height="21.088533"
+ x="0.49144801"
+ y="0.49144825" />
+ <path
+ style="fill:#e1e23e;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:24.80315018;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 15.494816,15.311309 C 15.494816,17.468201 13.744296,19.218721 11.587404,19.218721 C 9.4305121,19.218721 7.6799911,17.468201 7.6799911,15.311309 C 7.6799911,13.154416 10.206382,10.853284 11.431108,6.9650742 C 12.186533,10.102086 15.494816,13.154416 15.494816,15.311309 z"
+ id="path2385"
+ sodipodi:nodetypes="csscc" />
+ </g>
+</svg>
diff --git a/navit/xpm/firebrigade.xpm b/xpm/firebrigade.xpm
index 482f86c6..482f86c6 100644
--- a/navit/xpm/firebrigade.xpm
+++ b/xpm/firebrigade.xpm
diff --git a/navit/xpm/flag_bk_tr.xpm b/xpm/flag_bk_tr.xpm
index a115ecd3..a115ecd3 100644
--- a/navit/xpm/flag_bk_tr.xpm
+++ b/xpm/flag_bk_tr.xpm
diff --git a/navit/xpm/flag_bk_wh.xpm b/xpm/flag_bk_wh.xpm
index 6b87fa8d..6b87fa8d 100644
--- a/navit/xpm/flag_bk_wh.xpm
+++ b/xpm/flag_bk_wh.xpm
diff --git a/navit/xpm/flag_bl_wh.xpm b/xpm/flag_bl_wh.xpm
index 7fa9856f..7fa9856f 100644
--- a/navit/xpm/flag_bl_wh.xpm
+++ b/xpm/flag_bl_wh.xpm
diff --git a/navit/xpm/flag_wh_bk.xpm b/xpm/flag_wh_bk.xpm
index 4564f8ff..4564f8ff 100644
--- a/navit/xpm/flag_wh_bk.xpm
+++ b/xpm/flag_wh_bk.xpm
diff --git a/xpm/fountain.xpm b/xpm/fountain.xpm
new file mode 100644
index 00000000..38d5653d
--- /dev/null
+++ b/xpm/fountain.xpm
@@ -0,0 +1,22 @@
+/* XPM */
+static char *dummy[]={
+"16 16 3 1",
+". c None",
+"a c #000000",
+"# c #808080",
+"................",
+"................",
+"................",
+"........#.......",
+"....a...a...a...",
+".....#..#..#....",
+"......#.a.#.....",
+"......a.#.a.....",
+".......#a#......",
+".......a#a......",
+"........a.......",
+"........#.......",
+"........a.......",
+"................",
+"................",
+"................"};
diff --git a/xpm/fuel.svg b/xpm/fuel.svg
new file mode 100644
index 00000000..f653454d
--- /dev/null
+++ b/xpm/fuel.svg
@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="fuel.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/projets/navit/icons/png/fuel.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3172">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop3174" />
+ <stop
+ id="stop3184"
+ offset="0.98979592"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop3176" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3179">
+ <stop
+ style="stop-color:#e5a80d;stop-opacity:1;"
+ offset="0"
+ id="stop3181" />
+ <stop
+ style="stop-color:#a11708;stop-opacity:1;"
+ offset="1"
+ id="stop3183" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3171">
+ <stop
+ style="stop-color:#7f7f7f;stop-opacity:1;"
+ offset="0"
+ id="stop3173" />
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="1"
+ id="stop3175" />
+ </linearGradient>
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ <inkscape:perspective
+ id="perspective2394"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3171"
+ id="linearGradient3177"
+ x1="8.4442434"
+ y1="3.2490435"
+ x2="9.3754778"
+ y2="7"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(3.1567267e-2,-0.1329269)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3179"
+ id="linearGradient3185"
+ x1="6.9290147"
+ y1="9.9886541"
+ x2="9.8439093"
+ y2="17.43853"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3172"
+ id="radialGradient3180"
+ cx="11.616755"
+ cy="10.509515"
+ fx="11.616755"
+ fy="10.509515"
+ r="10.038391"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#4eadff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="1"
+ inkscape:pageshadow="2"
+ inkscape:zoom="15.839192"
+ inkscape:cx="14.505912"
+ inkscape:cy="10.559476"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:window-width="1022"
+ inkscape:window-height="682"
+ inkscape:window-x="4"
+ inkscape:window-y="60">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2380"
+ visible="true"
+ enabled="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="opacity:1;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.98289591;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect2382"
+ width="21.191694"
+ height="21.186056"
+ x="0.38812447"
+ y="0.38821825"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90" />
+ <g
+ id="g3162"
+ transform="matrix(0.4728684,0,0,0.4727426,-10.754663,5.4085291)">
+ <g
+ transform="translate(-16.071429,-0.3571429)"
+ id="g2383">
+ <path
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:24.80315018;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 12.262964,10.421364 C 12.262964,12.774521 10.353156,14.684328 8,14.684328 C 5.6468437,14.684328 3.7370358,12.774521 3.7370358,10.421364 C 3.7370358,8.0682074 6.4933125,5.5576867 7.8294819,1.3156722 C 8.653646,4.7381328 12.262964,8.0682074 12.262964,10.421364 z"
+ id="path3157"
+ sodipodi:nodetypes="csscc" />
+ <path
+ style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:24.80315018;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 11,10.267678 C 11,12.167782 9.4578876,13.709894 7.557785,13.709894 C 5.6576821,13.709894 8.9137943,13.304204 8.9137943,11.4041 C 8.9137943,9.503997 8.0458126,9.7496704 9.3772672,7.5239276 C 10.042755,8.5196945 10.810596,8.9989207 11,10.267678 z"
+ id="path2382"
+ sodipodi:nodetypes="csscc" />
+ </g>
+ </g>
+ <path
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 28.61162,8.2823375 L 33.233596,6.6308363 L 37.896949,14.689771 L 33.062506,18.452094 L 28.61162,8.2823375 z"
+ id="rect2387"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 25.718614,2.538311 L 36,2.4123473 L 39.830319,7.9547562 C 39.830319,7.9547562 41.795878,11.607708 40.913896,14.252949 C 40.031914,16.898189 44.230666,19.885739 44.230666,19.885739"
+ id="path3159"
+ sodipodi:nodetypes="cccsc" />
+ <rect
+ style="opacity:1;fill:url(#linearGradient3185);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect2400"
+ width="8.0496521"
+ height="16.951622"
+ x="4.5141191"
+ y="2.5229964" />
+ <rect
+ style="opacity:1;fill:url(#linearGradient3177);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect3172"
+ width="5.0507622"
+ height="5.0191951"
+ x="5.9662132"
+ y="4" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 12.690042,8.4633565 C 12.690042,8.4633565 14.457808,7.9209989 14.363106,13.382136 C 14.304244,16.796151 15.641514,18.432909 16.983189,18.464467 C 18.325236,18.496033 19.603273,17.26491 19.63484,15.244605 C 19.666418,13.22356 18.719389,13.539972 18.719389,11.519667 C 18.719389,9.4991155 19.508571,8.4225807 18.119611,5.7112903 C 16.730651,3 15.278557,2.4282946 15.278557,2.4282946 C 15.278557,2.4282946 18.37215,3.9907915 19.445437,5.9006939"
+ id="path3174"
+ sodipodi:nodetypes="cszzzscc" />
+ </g>
+</svg>
diff --git a/navit/xpm/fuel.xpm b/xpm/fuel.xpm
index 7b9f5f84..7b9f5f84 100644
--- a/navit/xpm/fuel.xpm
+++ b/xpm/fuel.xpm
diff --git a/navit/xpm/gc_event.xpm b/xpm/gc_event.xpm
index cdcb2daa..cdcb2daa 100644
--- a/navit/xpm/gc_event.xpm
+++ b/xpm/gc_event.xpm
diff --git a/navit/xpm/gc_multi.xpm b/xpm/gc_multi.xpm
index e81a8c47..e81a8c47 100644
--- a/navit/xpm/gc_multi.xpm
+++ b/xpm/gc_multi.xpm
diff --git a/navit/xpm/gc_mystery.xpm b/xpm/gc_mystery.xpm
index 7857292a..7857292a 100644
--- a/navit/xpm/gc_mystery.xpm
+++ b/xpm/gc_mystery.xpm
diff --git a/navit/xpm/gc_question.xpm b/xpm/gc_question.xpm
index 14186d50..14186d50 100644
--- a/navit/xpm/gc_question.xpm
+++ b/xpm/gc_question.xpm
diff --git a/navit/xpm/gc_reference.xpm b/xpm/gc_reference.xpm
index 8f559a3b..8f559a3b 100644
--- a/navit/xpm/gc_reference.xpm
+++ b/xpm/gc_reference.xpm
diff --git a/navit/xpm/gc_stages.xpm b/xpm/gc_stages.xpm
index a9b14e93..a9b14e93 100644
--- a/navit/xpm/gc_stages.xpm
+++ b/xpm/gc_stages.xpm
diff --git a/navit/xpm/gc_tradi.xpm b/xpm/gc_tradi.xpm
index ee4ced7a..ee4ced7a 100644
--- a/navit/xpm/gc_tradi.xpm
+++ b/xpm/gc_tradi.xpm
diff --git a/navit/xpm/gc_webcam.xpm b/xpm/gc_webcam.xpm
index 3f7441d5..3f7441d5 100644
--- a/navit/xpm/gc_webcam.xpm
+++ b/xpm/gc_webcam.xpm
diff --git a/xpm/golf.xpm b/xpm/golf.xpm
new file mode 100644
index 00000000..f514b44b
--- /dev/null
+++ b/xpm/golf.xpm
@@ -0,0 +1,40 @@
+/* XPM */
+static char *dummy[]={
+"16 16 21 1",
+". c None",
+"# c #000000",
+"h c #010101",
+"p c #020202",
+"c c #040404",
+"k c #080808",
+"r c #0a0a0a",
+"f c #161616",
+"i c #1e1e1e",
+"a c #232323",
+"b c #323232",
+"o c #515151",
+"n c #525252",
+"g c #535353",
+"m c #5d5d5d",
+"s c #626262",
+"l c #676767",
+"j c #f7f7f8",
+"q c #fdfdfd",
+"e c #fefefe",
+"d c #ffffff",
+"................",
+"....########a...",
+"......bcdef#g...",
+"......##d#h#....",
+"........#ij#....",
+".......##k#.....",
+"......l###......",
+"......m##n......",
+"......m##n......",
+"......n##n......",
+"......o##n......",
+"......k##n......",
+".....p#q#n......",
+"....#re.#n......",
+"........#s......",
+"................"};
diff --git a/xpm/gui_actions.svg b/xpm/gui_actions.svg
new file mode 100644
index 00000000..9fc4b4d1
--- /dev/null
+++ b/xpm/gui_actions.svg
@@ -0,0 +1,591 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48px"
+ height="48px"
+ id="svg4289"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="/home/lapo/Icone/cvs/gnome-icon-theme/scalable/categories"
+ sodipodi:docname="applications-games.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4291">
+ <linearGradient
+ id="linearGradient3035">
+ <stop
+ style="stop-color:#babdb6;stop-opacity:1"
+ offset="0"
+ id="stop3037" />
+ <stop
+ style="stop-color:white;stop-opacity:1"
+ offset="1"
+ id="stop3039" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3023">
+ <stop
+ style="stop-color:#f9afaf;stop-opacity:1"
+ offset="0"
+ id="stop3025" />
+ <stop
+ style="stop-color:#ef2929;stop-opacity:1;"
+ offset="1"
+ id="stop3027" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3009">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop3011" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop3013" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2953">
+ <stop
+ id="stop2955"
+ offset="0"
+ style="stop-color:#d3d7cf;stop-opacity:1" />
+ <stop
+ style="stop-color:#eeeeec;stop-opacity:1;"
+ offset="0.41379312"
+ id="stop2957" />
+ <stop
+ id="stop2959"
+ offset="1"
+ style="stop-color:#babdb6;stop-opacity:1" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2947"
+ inkscape:collect="always">
+ <stop
+ id="stop2949"
+ offset="0"
+ style="stop-color:white;stop-opacity:1;" />
+ <stop
+ id="stop2951"
+ offset="1"
+ style="stop-color:white;stop-opacity:0.47104248" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2941">
+ <stop
+ style="stop-color:white;stop-opacity:1"
+ offset="0"
+ id="stop2943" />
+ <stop
+ style="stop-color:#eeeeec;stop-opacity:1"
+ offset="1"
+ id="stop2945" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2933">
+ <stop
+ style="stop-color:#babdb6;stop-opacity:1"
+ offset="0"
+ id="stop2935" />
+ <stop
+ style="stop-color:#d3d7cf;stop-opacity:1"
+ offset="1"
+ id="stop2937" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2918">
+ <stop
+ id="stop2920"
+ offset="0"
+ style="stop-color:black" />
+ <stop
+ id="stop2922"
+ offset="1"
+ style="stop-color:black;stop-opacity:0" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2861">
+ <stop
+ style="stop-color:#c00;stop-opacity:1;"
+ offset="0"
+ id="stop2863" />
+ <stop
+ id="stop2869"
+ offset="0.22988506"
+ style="stop-color:#ef2929;stop-opacity:1;" />
+ <stop
+ style="stop-color:#c00;stop-opacity:1"
+ offset="1"
+ id="stop2865" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2848">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop2850" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop2852" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5024">
+ <stop
+ style="stop-color:#555753"
+ offset="0"
+ id="stop5026" />
+ <stop
+ style="stop-color:#555753;stop-opacity:0;"
+ offset="1"
+ id="stop5028" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5565">
+ <stop
+ style="stop-color:#f24e4e;stop-opacity:1"
+ offset="0"
+ id="stop5567" />
+ <stop
+ style="stop-color:#c10000;stop-opacity:1"
+ offset="1"
+ id="stop5569" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5540">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop5542" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5544" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient6719"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5060">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop5062" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5064" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient6717"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <linearGradient
+ id="linearGradient5048">
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="0"
+ id="stop5050" />
+ <stop
+ id="stop5056"
+ offset="0.5"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5052" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5048"
+ id="linearGradient6715"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
+ x1="302.85715"
+ y1="366.64789"
+ x2="302.85715"
+ y2="609.50507" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5024"
+ id="linearGradient8128"
+ gradientUnits="userSpaceOnUse"
+ x1="10.788347"
+ y1="13.257416"
+ x2="9.6597872"
+ y2="7.0036697"
+ gradientTransform="translate(0.357548,3.418157)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2941"
+ id="linearGradient8145"
+ x1="-0.30985892"
+ y1="26.600447"
+ x2="19.211418"
+ y2="38.36433"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.997033,8.000011,-2.918415)" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5540"
+ id="radialGradient2881"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.952381,0,0,0.490991,1.435937,14.25112)"
+ cx="30.154839"
+ cy="27.98991"
+ fx="30.154839"
+ fy="27.98991"
+ r="3.7123106" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2918"
+ id="linearGradient2916"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(0.357548,4.418157)"
+ x1="11.163347"
+ y1="17.507416"
+ x2="10.534787"
+ y2="9.6911697" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2933"
+ id="linearGradient2939"
+ x1="41.409943"
+ y1="45.25996"
+ x2="12.285978"
+ y2="37.5"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2848"
+ id="linearGradient2979"
+ gradientUnits="userSpaceOnUse"
+ x1="29.74268"
+ y1="7.5623312"
+ x2="29.74268"
+ y2="5.6997418" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5565"
+ id="linearGradient2982"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.333335,0,0,1.218181,-10.50002,-1.20001)"
+ x1="29.999987"
+ y1="7.9000344"
+ x2="29.999987"
+ y2="10.433436" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2947"
+ id="linearGradient2985"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.199995,0,0,1.090909,-6.49985,0.499987)"
+ x1="27.970291"
+ y1="7.8657598"
+ x2="30.000015"
+ y2="32.19165" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2953"
+ id="linearGradient2988"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.142855,0,0,1.083333,-5.928468,0.624995)"
+ x1="27.857143"
+ y1="17.714287"
+ x2="34.071434"
+ y2="17.714285" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3009"
+ id="linearGradient3015"
+ x1="11.75"
+ y1="33.0625"
+ x2="12.5"
+ y2="43.125"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2861"
+ id="linearGradient3020"
+ gradientUnits="userSpaceOnUse"
+ x1="14.218551"
+ y1="27.734375"
+ x2="19.72377"
+ y2="27.734375" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3023"
+ id="radialGradient3029"
+ cx="17.96875"
+ cy="28.031252"
+ fx="17.96875"
+ fy="28.031252"
+ r="3"
+ gradientTransform="matrix(1.54223,0,0,0.514076,-9.743189,12.93355)"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3035"
+ id="radialGradient3041"
+ cx="17.236843"
+ cy="27.869041"
+ fx="17.236843"
+ fy="27.869041"
+ r="3"
+ gradientTransform="matrix(1.125173,0,0,0.375057,-2.15759,16.83718)"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666"
+ borderopacity="1"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1"
+ inkscape:cx="38.624382"
+ inkscape:cy="17.830833"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:window-width="1036"
+ inkscape:window-height="624"
+ inkscape:window-x="26"
+ inkscape:window-y="225"
+ showguides="true"
+ inkscape:guide-bbox="true"
+ inkscape:showpageshadow="false"
+ gridspacingx="0.5px"
+ gridspacingy="0.5px"
+ gridempspacing="2"
+ inkscape:grid-points="true" />
+ <metadata
+ id="metadata4294">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
+ <dc:title>Games category</dc:title>
+ <dc:date>August 2006</dc:date>
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Andreas Nilsson</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:source>http://www.gnome.org</dc:source>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>games</rdf:li>
+ <rdf:li>entertainment</rdf:li>
+ <rdf:li>fun</rdf:li>
+ <rdf:li>joystick</rdf:li>
+ <rdf:li>controller</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ <dc:contributor>
+ <cc:Agent>
+ <dc:title>Jakub Steiner
+Lapo Calamandrei</dc:title>
+ </cc:Agent>
+ </dc:contributor>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/SourceCode" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <g
+ id="g3952"
+ transform="matrix(1.842671e-2,0,0,3.233675e-2,40.38938,32.87305)"
+ style="opacity:0.5;display:inline">
+ <rect
+ y="-150.69685"
+ x="-1559.2523"
+ height="478.35718"
+ width="1339.6335"
+ id="rect3954"
+ style="opacity:0.40206185;color:black;fill:url(#linearGradient6715);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="path3956"
+ d="M -219.61876,-150.68038 C -219.61876,-150.68038 -219.61876,327.65041 -219.61876,327.65041 C -76.744594,328.55086 125.78146,220.48075 125.78138,88.454235 C 125.78138,-43.572302 -33.655436,-150.68036 -219.61876,-150.68038 z "
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient6717);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient6719);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M -1559.2523,-150.68038 C -1559.2523,-150.68038 -1559.2523,327.65041 -1559.2523,327.65041 C -1702.1265,328.55086 -1904.6525,220.48075 -1904.6525,88.454235 C -1904.6525,-43.572302 -1745.2157,-150.68036 -1559.2523,-150.68038 z "
+ id="path3958"
+ sodipodi:nodetypes="cccc" />
+ </g>
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:url(#linearGradient2916);stroke-width:1px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;opacity:0.1"
+ d="M 21.357548,25.851145 C 25.413543,16.46711 7.283475,23.287862 5.5,19.250898 C 3.9996713,15.854847 21.276649,16.264088 12.369033,9.5"
+ id="path2912"
+ sodipodi:nodetypes="csc" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:url(#linearGradient8128);stroke-width:1px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
+ d="M 21.357548,24.851145 C 25.413543,15.46711 7.2834752,22.287862 5.5,18.250898 C 3.9996713,14.854847 21.276649,15.264088 12.369033,8.5"
+ id="path8126"
+ sodipodi:nodetypes="csc" />
+ <path
+ style="fill:url(#linearGradient8145);fill-opacity:1;fill-rule:evenodd;stroke:#888a85;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1"
+ d="M 13.34375,23.5 C 12.336524,23.502808 11.903738,23.952055 11.625,24.65625 L 7.53125,35 L 7.5,38.96875 C 7.5,39.810299 8.1897011,40.5 9.03125,40.5 L 38.96875,40.5 C 39.810299,40.5 40.5,39.810297 40.5,38.96875 L 40.5,35 L 36.375,24.625 C 36.103729,23.944107 35.338391,23.499996 34.5,23.5 L 13.34375,23.5 z "
+ id="path8137"
+ sodipodi:nodetypes="ccccccccccc" />
+ <rect
+ style="opacity:1;fill:url(#linearGradient2939);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect5213"
+ width="31.979832"
+ height="5"
+ x="8"
+ y="35"
+ rx="0.98345506"
+ ry="0.98345506" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:url(#radialGradient3041);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="path3031"
+ sodipodi:cx="17"
+ sodipodi:cy="27"
+ sodipodi:rx="3"
+ sodipodi:ry="1"
+ d="M 20 27 A 3 1 0 1 1 14,27 A 3 1 0 1 1 20 27 z"
+ transform="matrix(1.666667,0,0,2.48437,-11.33333,-38.59362)" />
+ <path
+ sodipodi:type="inkscape:offset"
+ inkscape:radius="-1"
+ inkscape:original="M 13.34375 23.5 C 12.336524 23.502808 11.903738 23.952055 11.625 24.65625 L 7.53125 35 L 7.5 38.96875 C 7.5 39.810299 8.1897011 40.5 9.03125 40.5 L 38.96875 40.5 C 39.810299 40.5 40.5 39.810297 40.5 38.96875 L 40.5 35 L 36.375 24.625 C 36.103729 23.944107 35.338391 23.499996 34.5 23.5 L 13.34375 23.5 z "
+ style="fill:none;fill-opacity:1.0;fill-rule:evenodd;stroke:url(#linearGradient3015);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1"
+ id="path3007"
+ d="M 13.34375,24.5 C 12.988411,24.500991 12.882848,24.572505 12.8125,24.625 C 12.742152,24.677495 12.663468,24.776169 12.5625,25.03125 L 8.53125,35.21875 L 8.5,38.96875 C 8.5,39.263925 8.7360754,39.5 9.03125,39.5 L 38.96875,39.5 C 39.263923,39.5 39.5,39.263921 39.5,38.96875 L 39.5,35.21875 L 35.4375,25 C 35.350246,24.780991 34.985243,24.499998 34.5,24.5 L 13.34375,24.5 z " />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:white;stroke-width:0.99999964px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 8.6236514,35.5 L 39.46527,35.5"
+ id="path5223"
+ sodipodi:nodetypes="cc" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.4;fill:url(#radialGradient2881);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path5538"
+ sodipodi:cx="30.279322"
+ sodipodi:cy="27.99898"
+ sodipodi:rx="3.7123106"
+ sodipodi:ry="2.0708127"
+ d="M 33.991632 27.99898 A 3.7123106 2.0708127 0 1 1 26.567011,27.99898 A 3.7123106 2.0708127 0 1 1 33.991632 27.99898 z"
+ transform="matrix(1.809853,0,0,2.278696,-24.95737,-34.76991)" />
+ <rect
+ style="fill:url(#linearGradient2988);fill-opacity:1;stroke:#888a85;stroke-width:0.99999952;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4311"
+ width="7.9999919"
+ height="25.999989"
+ x="25.500023"
+ y="5.4999924"
+ rx="3.4541733"
+ ry="3.0224063" />
+ <path
+ style="fill:white;fill-opacity:1;stroke:none;stroke-width:0.99999952;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:1;opacity:0.8"
+ d="M 28.96875,6 C 27.284933,6 26,7.1578409 26,8.53125 L 26,11.5 C 26,12.873409 27.284932,14.03125 28.96875,14.03125 L 30.03125,14.03125 C 31.715067,14.03125 33,12.873407 33,11.5 L 33,8.53125 C 33,7.1578412 31.715067,6 30.03125,6 L 28.96875,6 z "
+ id="path2965"
+ sodipodi:nodetypes="ccccccccc" />
+ <rect
+ style="fill:none;fill-opacity:1;stroke:url(#linearGradient2985);stroke-width:0.99999923;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect5211"
+ width="5.9999743"
+ height="23.999992"
+ x="26.500031"
+ y="6.4999852"
+ rx="2.4831805"
+ ry="2.0693247" />
+ <rect
+ style="fill:url(#linearGradient2982);fill-opacity:1;stroke:#a40000;stroke-width:0.99999815;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4315"
+ width="3.9999886"
+ height="7.0000048"
+ x="27.500011"
+ y="5.4999952"
+ rx="1.5023848"
+ ry="1.5023848" />
+ <rect
+ ry="0.94451648"
+ rx="0.94451648"
+ y="6"
+ x="28"
+ height="2"
+ width="3"
+ id="rect1925"
+ style="opacity:0.61800764;fill:url(#linearGradient2979);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.7;fill:white;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path4316"
+ sodipodi:cx="30.178572"
+ sodipodi:cy="7.125"
+ sodipodi:rx="0.8214286"
+ sodipodi:ry="0.6964286"
+ d="M 31 7.125 A 0.8214286 0.6964286 0 1 1 29.357143,7.125 A 0.8214286 0.6964286 0 1 1 31 7.125 z"
+ transform="matrix(0.608687,0,0,0.717948,10.1307,2.368148)" />
+ <path
+ style="fill:url(#linearGradient3020);fill-opacity:1;stroke:#a40000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 17,25.5 C 15.062439,25.5 13.5,26.171996 13.5,27 L 13.5,28 C 13.5,28.828004 15.062439,29.5 17,29.5 C 18.937561,29.5 20.53125,28.828003 20.53125,28 L 20.53125,27 C 20.53125,26.171996 18.93756,25.5 17,25.5 z "
+ id="path4313"
+ sodipodi:nodetypes="csssssc" />
+ <path
+ sodipodi:type="arc"
+ style="fill:url(#radialGradient3029);fill-opacity:1.0;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="path2871"
+ sodipodi:cx="17"
+ sodipodi:cy="27"
+ sodipodi:rx="3"
+ sodipodi:ry="1"
+ d="M 20 27 A 3 1 0 1 1 14,27 A 3 1 0 1 1 20 27 z" />
+ </g>
+</svg>
diff --git a/xpm/gui_active.svg b/xpm/gui_active.svg
new file mode 100644
index 00000000..390c2e11
--- /dev/null
+++ b/xpm/gui_active.svg
@@ -0,0 +1,237 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48px"
+ height="48px"
+ id="svg3165"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="/tmp"
+ sodipodi:docname="gui_active.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3167">
+ <linearGradient
+ id="linearGradient5237">
+ <stop
+ id="stop5239"
+ offset="0"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0.5"
+ id="stop5247" />
+ <stop
+ id="stop5241"
+ offset="1"
+ style="stop-color:#9c9c9c;stop-opacity:1" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5237"
+ id="radialGradient5990"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.5301205,0,0,1.6745294,-12.159639,-11.709817)"
+ cx="22.9375"
+ cy="16.305218"
+ fx="22.9375"
+ fy="16.305218"
+ r="15.5625" />
+ <linearGradient
+ id="linearGradient5300"
+ inkscape:collect="always">
+ <stop
+ id="stop5302"
+ offset="0"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ <stop
+ id="stop5304"
+ offset="1"
+ style="stop-color:#ffffff;stop-opacity:0;" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5300"
+ id="radialGradient5988"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.2469896,0,0,2.2469896,-37.128341,-8.8439229)"
+ cx="29.77438"
+ cy="7.0922189"
+ fx="29.77438"
+ fy="7.0922189"
+ r="25.380436" />
+ <linearGradient
+ id="linearGradient5226">
+ <stop
+ id="stop5811"
+ offset="0"
+ style="stop-color:#63b512;stop-opacity:1;" />
+ <stop
+ style="stop-color:#58a30e;stop-opacity:1;"
+ offset="0.16030352"
+ id="stop5245" />
+ <stop
+ style="stop-color:#366b04;stop-opacity:1"
+ offset="0.66008514"
+ id="stop5814" />
+ <stop
+ id="stop5231"
+ offset="1"
+ style="stop-color:#87ea25;stop-opacity:1" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5226"
+ id="radialGradient5986"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.5354369,0,0,1.5485894,-15.737913,-10.36738)"
+ cx="29.392656"
+ cy="18.898249"
+ fx="29.392656"
+ fy="18.898249"
+ r="29.699959" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5224"
+ id="radialGradient5984"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.29375,0,18.848047)"
+ cx="14.5"
+ cy="26.6875"
+ fx="14.5"
+ fy="26.6875"
+ r="10" />
+ <filter
+ height="1.6682318"
+ y="-0.33411592"
+ width="1.1962931"
+ x="-0.09814655"
+ id="filter5296"
+ inkscape:collect="always">
+ <feGaussianBlur
+ id="feGaussianBlur5298"
+ stdDeviation="0.81788793"
+ inkscape:collect="always" />
+ </filter>
+ <linearGradient
+ id="linearGradient5224"
+ inkscape:collect="always">
+ <stop
+ id="stop5226"
+ offset="0"
+ style="stop-color:#000000;stop-opacity:1;" />
+ <stop
+ id="stop5228"
+ offset="1"
+ style="stop-color:#000000;stop-opacity:0;" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5224"
+ id="radialGradient5982"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.29375,0,18.848047)"
+ cx="14.5"
+ cy="26.6875"
+ fx="14.5"
+ fy="26.6875"
+ r="10" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="7"
+ inkscape:cx="24"
+ inkscape:cy="24"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:window-width="800"
+ inkscape:window-height="649"
+ inkscape:window-x="472"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata3170">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <g
+ style="display:inline"
+ id="g5964"
+ transform="translate(0.8558594,-0.614906)">
+ <path
+ transform="matrix(2.1570145,0,0,2.155398,-7.8468552,-16.33814)"
+ d="M 24.5 26.6875 A 10 2.9375 0 1 1 4.5,26.6875 A 10 2.9375 0 1 1 24.5 26.6875 z"
+ sodipodi:ry="2.9375"
+ sodipodi:rx="10"
+ sodipodi:cy="26.6875"
+ sodipodi:cx="14.5"
+ id="path5966"
+ style="opacity:0.53012049;fill:url(#radialGradient5982);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;filter:url(#filter5296);enable-background:accumulate"
+ sodipodi:type="arc" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.80120479;fill:url(#radialGradient5984);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;filter:url(#filter5296);enable-background:accumulate"
+ id="path5968"
+ sodipodi:cx="14.5"
+ sodipodi:cy="26.6875"
+ sodipodi:rx="10"
+ sodipodi:ry="2.9375"
+ d="M 24.5 26.6875 A 10 2.9375 0 1 1 4.5,26.6875 A 10 2.9375 0 1 1 24.5 26.6875 z"
+ transform="matrix(1.3478975,0,0,1.3468874,3.8853414,6.4889877)" />
+ <path
+ transform="matrix(0.7238447,0,0,0.7274883,2.1828126,2.3568607)"
+ d="M 58.403591 29.207693 A 29.010935 29.010935 0 1 1 0.3817215,29.207693 A 29.010935 29.010935 0 1 1 58.403591 29.207693 z"
+ sodipodi:ry="29.010935"
+ sodipodi:rx="29.010935"
+ sodipodi:cy="29.207693"
+ sodipodi:cx="29.392656"
+ id="path5970"
+ style="fill:url(#radialGradient5986);fill-opacity:1;fill-rule:evenodd;stroke:#316203;stroke-width:1.37804782;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ sodipodi:type="arc" />
+ <path
+ transform="matrix(0.8254302,0,0,0.8252681,-1.1457884,-1.4441229)"
+ d="M 53.950159 30.352861 A 24.175779 24.175779 0 1 1 5.5986004,30.352861 A 24.175779 24.175779 0 1 1 53.950159 30.352861 z"
+ sodipodi:ry="24.175779"
+ sodipodi:rx="24.175779"
+ sodipodi:cy="30.352861"
+ sodipodi:cx="29.77438"
+ id="path5972"
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#radialGradient5988);stroke-width:1.21160841;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ sodipodi:type="arc" />
+ <path
+ sodipodi:nodetypes="ccccccc"
+ id="path5974"
+ d="M 12.875,24.625 L 25.375,36.625 L 44,20.625 C 43.253602,16.729371 41.57038,13.679873 39.8125,11.0625 L 25.125,23.75 L 20.375,18.5 L 12.875,24.625 z "
+ style="opacity:1;fill:url(#radialGradient5990);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="cc"
+ id="path5976"
+ d="M 40.21875,10.8125 C 41.930961,13.346411 43.59334,15.979986 44.40625,20.3125"
+ style="opacity:1;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#549910;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ </g>
+ </g>
+</svg>
diff --git a/xpm/gui_arrow_down.svg b/xpm/gui_arrow_down.svg
new file mode 100644
index 00000000..b748705b
--- /dev/null
+++ b/xpm/gui_arrow_down.svg
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="64px"
+ height="64px"
+ id="svg2175"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="/home/martin/map/sf/navit-test/navit/xpm"
+ sodipodi:docname="gui_arrow_down.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs2177" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="9.5760562"
+ inkscape:cx="32"
+ inkscape:cy="32"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:document-units="px"
+ inkscape:grid-bbox="true"
+ showguides="true"
+ inkscape:object-bbox="true"
+ inkscape:object-points="true"
+ inkscape:object-nodes="true"
+ objecttolerance="10000"
+ inkscape:grid-points="true"
+ gridtolerance="10000"
+ inkscape:guide-points="true"
+ guidetolerance="10000"
+ gridempspacing="8"
+ inkscape:window-width="1280"
+ inkscape:window-height="954"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata2180">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <path
+ style="fill:#c0c0c0;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 60.541944,1.500495 L 32.063785,32.499997 L 3.4580555,1.5 L 60.541944,1.500495 z "
+ id="path2185"
+ sodipodi:nodetypes="cccc" />
+ </g>
+</svg>
diff --git a/xpm/gui_arrow_left.svg b/xpm/gui_arrow_left.svg
new file mode 100644
index 00000000..4060c6ff
--- /dev/null
+++ b/xpm/gui_arrow_left.svg
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="64px"
+ height="64px"
+ id="svg2175"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="/tmp"
+ sodipodi:docname="gui_arrow_left.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs2177" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="9.5760562"
+ inkscape:cx="32"
+ inkscape:cy="32"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:document-units="px"
+ inkscape:grid-bbox="true"
+ showguides="true"
+ inkscape:object-bbox="true"
+ inkscape:object-points="true"
+ inkscape:object-nodes="true"
+ objecttolerance="10000"
+ inkscape:grid-points="true"
+ gridtolerance="10000"
+ inkscape:guide-points="true"
+ guidetolerance="10000"
+ gridempspacing="8"
+ inkscape:window-width="1280"
+ inkscape:window-height="954"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata2180">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <path
+ style="fill:#c0c0c0;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 61.499502,3.4161112 L 30.5,31.89427 L 61.499997,60.5 L 61.499502,3.4161112 z "
+ id="path2185"
+ sodipodi:nodetypes="cccc" />
+ </g>
+</svg>
diff --git a/xpm/gui_arrow_right.svg b/xpm/gui_arrow_right.svg
new file mode 100644
index 00000000..d7e0d966
--- /dev/null
+++ b/xpm/gui_arrow_right.svg
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="64px"
+ height="64px"
+ id="svg2175"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="/tmp"
+ sodipodi:docname="gui_arrow_right.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs2177" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="9.5760562"
+ inkscape:cx="32"
+ inkscape:cy="32"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:document-units="px"
+ inkscape:grid-bbox="true"
+ showguides="true"
+ inkscape:object-bbox="true"
+ inkscape:object-points="true"
+ inkscape:object-nodes="true"
+ objecttolerance="10000"
+ inkscape:grid-points="true"
+ gridtolerance="10000"
+ inkscape:guide-points="true"
+ guidetolerance="10000"
+ gridempspacing="8"
+ inkscape:window-width="1280"
+ inkscape:window-height="954"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata2180">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <path
+ style="fill:#c0c0c0;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
+ d="M 2.000498,3.5218412 L 33,32 L 2.0000035,60.60573 L 2.000498,3.5218412 z "
+ id="path2185"
+ sodipodi:nodetypes="cccc" />
+ </g>
+</svg>
diff --git a/xpm/gui_arrow_up.svg b/xpm/gui_arrow_up.svg
new file mode 100644
index 00000000..7ce21b35
--- /dev/null
+++ b/xpm/gui_arrow_up.svg
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="64px"
+ height="64px"
+ id="svg2175"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="/home/martin/map/sf/navit-test/navit/xpm"
+ sodipodi:docname="gui_arrow_up.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs2177" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="9.5760562"
+ inkscape:cx="32"
+ inkscape:cy="32"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:document-units="px"
+ inkscape:grid-bbox="true"
+ showguides="true"
+ inkscape:object-bbox="true"
+ inkscape:object-points="true"
+ inkscape:object-nodes="true"
+ objecttolerance="10000"
+ inkscape:grid-points="true"
+ gridtolerance="10000"
+ inkscape:guide-points="true"
+ guidetolerance="10000"
+ gridempspacing="8"
+ inkscape:window-width="1280"
+ inkscape:window-height="954"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata2180">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <path
+ style="fill:#c0c0c0;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 60.541944,62.499505 L 32.063785,31.500003 L 3.4580555,62.5 L 60.541944,62.499505 z "
+ id="path2185"
+ sodipodi:nodetypes="cccc" />
+ </g>
+</svg>
diff --git a/xpm/gui_bookmark.svg b/xpm/gui_bookmark.svg
new file mode 100644
index 00000000..4d32f31f
--- /dev/null
+++ b/xpm/gui_bookmark.svg
@@ -0,0 +1,470 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ inkscape:export-ydpi="90"
+ inkscape:export-xdpi="90"
+ inkscape:export-filename="/home/andreas/project/gnome-icon-theme/scalable/actions/bookmark-new.png"
+ sodipodi:docname="gui_bookmark.svg"
+ sodipodi:docbase="/home/martin/map/sf/navit-guiint2/navit/xpm"
+ inkscape:version="0.45.1"
+ sodipodi:version="0.32"
+ id="svg249"
+ height="48"
+ width="48"
+ version="1.0"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3">
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2833">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop2835" />
+ <stop
+ style="stop-color:white;stop-opacity:0.56273764"
+ offset="1"
+ id="stop2837" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3702">
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="0"
+ id="stop3704" />
+ <stop
+ id="stop3710"
+ offset="0.5"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop3706" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3702"
+ id="linearGradient2098"
+ gradientUnits="userSpaceOnUse"
+ x1="25.058096"
+ y1="47.027729"
+ x2="25.058096"
+ y2="39.999443" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3688"
+ id="radialGradient2096"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.003784,0,0,1.4,-20.01187,-104.4)"
+ cx="4.9929786"
+ cy="43.5"
+ fx="4.9929786"
+ fy="43.5"
+ r="2.5" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3688">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop3690" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop3692" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3688"
+ id="radialGradient2094"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.003784,0,0,1.4,27.98813,-17.4)"
+ cx="4.9929786"
+ cy="43.5"
+ fx="4.9929786"
+ fy="43.5"
+ r="2.5" />
+ <linearGradient
+ id="linearGradient5345">
+ <stop
+ style="stop-color:#e5c184;stop-opacity:1;"
+ offset="0"
+ id="stop5347" />
+ <stop
+ id="stop1936"
+ offset="0.42469135"
+ style="stop-color:#d9a752;stop-opacity:1;" />
+ <stop
+ id="stop7129"
+ offset="0.9041152"
+ style="stop-color:#d9a752;stop-opacity:1;" />
+ <stop
+ style="stop-color:#e5c184;stop-opacity:1"
+ offset="1"
+ id="stop5349" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2378">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop2380" />
+ <stop
+ id="stop4146"
+ offset="0.25"
+ style="stop-color:#fefede;stop-opacity:0.91836733;" />
+ <stop
+ id="stop2386"
+ offset="0.5"
+ style="stop-color:#f5f328;stop-opacity:1;" />
+ <stop
+ style="stop-color:#f5f32d;stop-opacity:0.12234043;"
+ offset="1"
+ id="stop2382" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient4790">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop4792" />
+ <stop
+ style="stop-color:#000000;stop-opacity:0;"
+ offset="1"
+ id="stop4794" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2251">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop2253" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop2255" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2251"
+ id="linearGradient8166"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(-3.277938e-2,-0.999463,0.999463,-3.277938e-2,-0.709646,45.06274)"
+ x1="33.396004"
+ y1="36.921333"
+ x2="34.170048"
+ y2="38.070381" />
+ <linearGradient
+ id="linearGradient15662">
+ <stop
+ id="stop15664"
+ offset="0.0000000"
+ style="stop-color:#ffffff;stop-opacity:1.0000000;" />
+ <stop
+ id="stop15666"
+ offset="1.0000000"
+ style="stop-color:#f8f8f8;stop-opacity:1.0000000;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient269">
+ <stop
+ id="stop270"
+ offset="0.0000000"
+ style="stop-color:#a3a3a3;stop-opacity:1.0000000;" />
+ <stop
+ id="stop271"
+ offset="1"
+ style="stop-color:#8a8a8a;stop-opacity:1;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient259">
+ <stop
+ id="stop260"
+ offset="0.0000000"
+ style="stop-color:#fafafa;stop-opacity:1.0000000;" />
+ <stop
+ id="stop261"
+ offset="1.0000000"
+ style="stop-color:#bbbbbb;stop-opacity:1.0000000;" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient269"
+ id="radialGradient15656"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.9717435,0,0,1.0360674,3.2383519,0.5060885)"
+ cx="8.824419"
+ cy="3.7561285"
+ fx="8.824419"
+ fy="3.7561285"
+ r="37.751713" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient259"
+ id="radialGradient15658"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.9639356,0,0,1.0444591,-0.127221,-0.1424244)"
+ cx="33.966679"
+ cy="35.736916"
+ fx="33.966679"
+ fy="35.736916"
+ r="86.70845" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient15662"
+ id="radialGradient15668"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.9731786,0,0,1.034993,3.1656505,0.5540137)"
+ cx="8.1435566"
+ cy="7.2678967"
+ fx="8.1435566"
+ fy="7.2678967"
+ r="38.158695" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient269"
+ id="radialGradient5350"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.331735,0,0,0.3585438,20.10526,9.5269319)"
+ cx="31.863327"
+ cy="2.3667307"
+ fx="31.863327"
+ fy="2.3667307"
+ r="37.751713" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient259"
+ id="radialGradient5352"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.148355,1.022578e-2,-1.104438e-2,0.1645276,25.06011,12.804777)"
+ cx="30.653816"
+ cy="14.9373"
+ fx="30.653816"
+ fy="14.9373"
+ r="86.70845" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4790"
+ id="radialGradient4796"
+ cx="37.030354"
+ cy="12.98915"
+ fx="37.030354"
+ fy="12.98915"
+ r="4.2929163"
+ gradientTransform="matrix(1.744653,2.313551e-22,-1.663e-22,1.283833,-26.58256,-3.478359)"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2378"
+ id="radialGradient3271"
+ cx="38.658855"
+ cy="9.3411446"
+ fx="38.658855"
+ fy="9.3411446"
+ r="8.341651"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5345"
+ id="linearGradient5351"
+ x1="17.948223"
+ y1="17.797228"
+ x2="17.948223"
+ y2="4.361907"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.9309477,0,0,1,0.6917802,-4.41941e-2)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2833"
+ id="linearGradient2839"
+ x1="13.46875"
+ y1="3.0304594"
+ x2="13.46875"
+ y2="5.5014644"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ inkscape:window-y="0"
+ inkscape:window-x="0"
+ inkscape:window-height="954"
+ inkscape:window-width="1280"
+ inkscape:document-units="px"
+ inkscape:grid-bbox="true"
+ showgrid="false"
+ inkscape:current-layer="layer5"
+ inkscape:cy="24"
+ inkscape:cx="24"
+ inkscape:zoom="15.416667"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ borderopacity="0.3254902"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ inkscape:showpageshadow="false"
+ showborder="true" />
+ <metadata
+ id="metadata4">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>New Bookmark</dc:title>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>text</rdf:li>
+ <rdf:li>plaintext</rdf:li>
+ <rdf:li>regular</rdf:li>
+ <rdf:li>document</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Andreas Nilsson</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:source>http://www.gnome.org</dc:source>
+ <dc:contributor>
+ <cc:Agent>
+ <dc:title>Luca Ferretti
+Jakub Steiner
+Lapo Calamandrei</dc:title>
+ </cc:Agent>
+ </dc:contributor>
+ <dc:date>December 2006</dc:date>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/SourceCode" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:groupmode="layer"
+ id="layer6"
+ inkscape:label="Shadow">
+ <g
+ id="g2043"
+ inkscape:label="Shadow"
+ transform="matrix(1,0,0,0.555556,-1.8e-5,19.888883)">
+ <g
+ style="display:inline"
+ id="g2036"
+ inkscape:label="Shadow">
+ <g
+ id="g3712"
+ style="opacity:0.4"
+ transform="matrix(1.052632,0,0,1.285713,-1.263158,-13.42854)">
+ <rect
+ y="40"
+ x="38"
+ height="7"
+ width="5"
+ id="rect2801"
+ style="opacity:1;fill:url(#radialGradient2094);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(-1,-1)"
+ y="-47"
+ x="-10"
+ height="7"
+ width="5"
+ id="rect3696"
+ style="opacity:1;fill:url(#radialGradient2096);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ y="40"
+ x="10"
+ height="7.0000005"
+ width="28"
+ id="rect3700"
+ style="opacity:1;fill:url(#linearGradient2098);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+ </g>
+ </g>
+ </g>
+ <g
+ style="display:inline"
+ inkscape:groupmode="layer"
+ inkscape:label="Base"
+ id="layer1">
+ <path
+ style="color:#000000;fill:url(#radialGradient15658);fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient15656);stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible"
+ d="M 7.6531674,3.5156747 L 31.184222,3.4999998 C 31.184222,3.4999998 41.5,13.07421 41.5,13.712818 L 41.5,43.414218 C 41.5,44.052825 40.985687,44.566938 40.346833,44.566938 L 7.6531674,44.566938 C 7.0143129,44.566938 6.5000004,44.052825 6.5000004,43.414218 L 6.5000004,4.6683954 C 6.5000004,4.0297882 7.0143129,3.5156747 7.6531674,3.5156747 z "
+ id="rect15391"
+ sodipodi:nodetypes="ccccccccc" />
+ <path
+ style="color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient15668);stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible"
+ d="M 7.6498034,4.4999998 L 32.652226,4.4999998 C 32.652226,4.4999998 40.441938,12.538716 40.441938,12.621467 L 40.441938,43.380959 C 40.441938,43.46371 40.375127,43.53033 40.292135,43.53033 L 7.6498034,43.53033 C 7.5668121,43.53033 7.4999997,43.46371 7.4999997,43.380959 L 7.4999997,4.6493697 C 7.4999997,4.5666188 7.5668121,4.4999998 7.6498034,4.4999998 z "
+ id="rect15660"
+ sodipodi:nodetypes="ccccccccc" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer5"
+ inkscape:label="Text"
+ style="display:inline">
+ <path
+ inkscape:r_cy="true"
+ inkscape:r_cx="true"
+ style="opacity:0.35714285;color:#000000;fill:url(#radialGradient4796);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.00000024;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 40.985189,13.861445 C 40.256827,12.514817 34.882221,10.130934 32.084635,9.3314083 C 32.254143,10.904354 31.961856,15.649439 31.961856,15.649439 C 34.024356,14.274439 40.204485,13.699331 40.985189,13.861445 z "
+ id="path5348"
+ sodipodi:nodetypes="cccc" />
+ <path
+ style="opacity:1;color:#000000;fill:url(#radialGradient5352);fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient5350);stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible"
+ d="M 41.410559,13.739267 C 41.423724,12.305276 35.058025,3.3960606 31.175441,3.500918 C 32.148479,3.7370164 32.925796,9.7511015 31.536076,12.601062 C 34.286076,12.601062 40.446694,11.856343 41.410559,13.739267 z "
+ id="path2210"
+ sodipodi:nodetypes="cccc"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="path2247"
+ d="M 39.121563,11.586207 C 38.393201,10.239579 34.963027,6.5166576 33.040441,5.2796316 C 33.279381,6.7054805 33.577496,8.9620596 32.961856,11.524439 C 32.961856,11.524439 38.340859,11.424093 39.121563,11.586207 z "
+ style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient8166);stroke-width:1.00000024;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <path
+ style="fill:#2e3436;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;display:inline;opacity:0.15"
+ d="M 8.518214,2.986098 L 22,2.986098 L 22,23.928002 L 16.515644,17.234797 L 10.96121,24 L 10.96121,3.9419039 C 10.96121,3.404299 9.435316,2.986098 8.518214,2.986098 z "
+ id="path7273"
+ sodipodi:nodetypes="ccccccc" />
+ <path
+ style="fill:url(#linearGradient5351);fill-opacity:1;fill-rule:evenodd;stroke:#8f5902;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1"
+ d="M 10.018213,2.5 L 21.422873,2.5 C 22.994417,2.5 23.499999,3.0073903 23.499999,4.470952 L 23.499999,23.441904 L 18.015643,16.748699 L 12.461209,23.513902 L 12.508084,4.4558059 C 12.508084,2.8706328 10.935315,2.5 10.018213,2.5 z "
+ id="path4386"
+ sodipodi:nodetypes="cccccccc" />
+ <path
+ sodipodi:type="inkscape:offset"
+ inkscape:radius="-1.03125"
+ inkscape:original="M 10.03125 2.5 C 10.948352 2.5 12.5 2.883577 12.5 4.46875 L 12.46875 23.5 L 18.03125 16.75 L 23.5 23.4375 L 23.5 4.46875 C 23.5 3.0051883 23.009044 2.5 21.4375 2.5 L 10.03125 2.5 z "
+ style="fill:none;fill-opacity:1.0;fill-rule:evenodd;stroke:url(#linearGradient2839);stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline;opacity:0.6"
+ id="path1934"
+ d="M 13.25,3.53125 C 13.362221,3.8338001 13.53125,4.1151264 13.53125,4.46875 L 13.5,20.625 L 17.25,16.09375 C 17.445904,15.855316 17.738283,15.717133 18.046875,15.717133 C 18.355467,15.717133 18.647846,15.855316 18.84375,16.09375 L 22.46875,20.53125 L 22.46875,4.46875 C 22.46875,3.8522811 22.365083,3.7081684 22.34375,3.6875 C 22.322417,3.6668316 22.11277,3.53125 21.4375,3.53125 L 13.25,3.53125 z " />
+ </g>
+</svg>
diff --git a/xpm/gui_display.svg b/xpm/gui_display.svg
new file mode 100644
index 00000000..0e89c868
--- /dev/null
+++ b/xpm/gui_display.svg
@@ -0,0 +1,1752 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48px"
+ height="48px"
+ id="svg3304"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="/home/lapo/Icone/cvs/gnome-icon-theme/scalable/devices"
+ sodipodi:docname="computer.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3306">
+ <linearGradient
+ id="linearGradient4196">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop4198" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop4200" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3907">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop3909" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop3911" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3899">
+ <stop
+ style="stop-color:#eeeeec"
+ offset="0"
+ id="stop3901" />
+ <stop
+ style="stop-color:#d3d7cf"
+ offset="1"
+ id="stop3903" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5233">
+ <stop
+ style="stop-color:#729fcf;stop-opacity:1;"
+ offset="0"
+ id="stop5235" />
+ <stop
+ style="stop-color:#326194;stop-opacity:1;"
+ offset="1"
+ id="stop5237" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5225">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop5227" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5229" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5137">
+ <stop
+ style="stop-color:#eeeeec;stop-opacity:1;"
+ offset="0"
+ id="stop5139" />
+ <stop
+ style="stop-color:#e6e6e3;stop-opacity:1;"
+ offset="1"
+ id="stop5141" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient6240">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop6242" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop6244" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient11400">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop11402" />
+ <stop
+ style="stop-color:#000000;stop-opacity:0;"
+ offset="1"
+ id="stop11404" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient6240"
+ id="linearGradient6246"
+ x1="20.156862"
+ y1="5.0996137"
+ x2="20.156862"
+ y2="26.039215"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-2.35294e-2,-3.039216)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5137"
+ id="linearGradient5147"
+ gradientUnits="userSpaceOnUse"
+ x1="17.247635"
+ y1="6.3760414"
+ x2="39.904388"
+ y2="38.876041"
+ gradientTransform="matrix(0.999303,0,0,0.998527,3.061255e-3,-2.971316)" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5233"
+ id="radialGradient5239"
+ cx="24.006104"
+ cy="32.997028"
+ fx="24.006104"
+ fy="32.997028"
+ r="19.00016"
+ gradientTransform="matrix(1.232634,1.948681e-23,-1.1422e-23,0.778392,-5.590582,-0.847446)"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5137"
+ id="linearGradient2308"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.992781,-6.075869e-16,-2.718035)"
+ x1="31.743324"
+ y1="37.842293"
+ x2="31.86105"
+ y2="43.82579" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient11400"
+ id="linearGradient2310"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.004187,0,0,1,-0.12454,-3.011765)"
+ x1="23.154902"
+ y1="34.572548"
+ x2="23.529411"
+ y2="40.219608" />
+ <linearGradient
+ id="linearGradient1558"
+ inkscape:collect="always">
+ <stop
+ id="stop1560"
+ offset="0"
+ style="stop-color:#babdb6" />
+ <stop
+ id="stop1562"
+ offset="1"
+ style="stop-color:#eeeeec" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3028"
+ inkscape:collect="always">
+ <stop
+ id="stop3030"
+ offset="0"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ id="stop3032"
+ offset="1"
+ style="stop-color:black;stop-opacity:0;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3042">
+ <stop
+ id="stop3044"
+ offset="0"
+ style="stop-color:black;stop-opacity:0;" />
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0.5"
+ id="stop3050" />
+ <stop
+ id="stop3046"
+ offset="1"
+ style="stop-color:black;stop-opacity:0;" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient2433"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3028"
+ id="radialGradient2517"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,-0.750002,1.333334,0,-40.28573,35.00001)"
+ cx="2.9999995"
+ cy="33.214287"
+ fx="2.9999995"
+ fy="33.214287"
+ r="3" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3028"
+ id="radialGradient2519"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,-0.750002,1.333334,0,-88.28573,-30.49999)"
+ cx="2.9999995"
+ cy="33.214287"
+ fx="2.9999995"
+ fy="33.214287"
+ r="3" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3042"
+ id="linearGradient2521"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.888889,0,3.833333)"
+ x1="37.03125"
+ y1="35.062885"
+ x2="37.03125"
+ y2="29.995127" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient1558"
+ id="linearGradient3320"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.833169,-48,19.08245)"
+ x1="16.396038"
+ y1="19.659277"
+ x2="16.396038"
+ y2="32.448051" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3322"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3324"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3326"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3328"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3330"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3332"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3334"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3336"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3338"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3340"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3342"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3344"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3346"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3348"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3350"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3352"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3354"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3356"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3358"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3360"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3362"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3364"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3366"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3368"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3370"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3372"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3374"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3376"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3378"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3380"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3382"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3384"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3386"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3388"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3390"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3392"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3394"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3396"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3398"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3400"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3402"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3404"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3406"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3408"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3410"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3412"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3414"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3416"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3418"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3420"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3422"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3424"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3426"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3428"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3430"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3432"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3434"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3436"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3438"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3907"
+ id="radialGradient3440"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.382603,3.581398e-5,0,0.171503,-6.729684,34.0972)"
+ cx="20.913568"
+ cy="47.045319"
+ fx="20.913568"
+ fy="47.045319"
+ r="19.5" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3899"
+ id="linearGradient3442"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.753044,-48,12.25251)"
+ x1="26.5"
+ y1="43.249905"
+ x2="26.5"
+ y2="35.75" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5225"
+ id="radialGradient4337"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.24763,0,32.1168)"
+ cx="23.9375"
+ cy="42.6875"
+ fx="23.9375"
+ fy="42.6875"
+ r="23.75956" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4196"
+ id="linearGradient4343"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(24,0)"
+ x1="37.484837"
+ y1="38.267769"
+ x2="37.295498"
+ y2="33.637787" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#849193"
+ borderopacity="1"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1"
+ inkscape:cx="27.438293"
+ inkscape:cy="9.3263876"
+ inkscape:current-layer="layer2"
+ showgrid="false"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:showpageshadow="false"
+ showborder="false"
+ inkscape:window-width="1247"
+ inkscape:window-height="718"
+ inkscape:window-x="23"
+ inkscape:window-y="256"
+ showguides="true"
+ inkscape:guide-bbox="true"
+ inkscape:grid-points="false"
+ stroke="#babdb6"
+ fill="#888a85"
+ gridspacingx="0.5px"
+ gridspacingy="0.5px"
+ gridempspacing="2"
+ borderlayer="top" />
+ <metadata
+ id="metadata3309">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>Computer</dc:title>
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Lapo Calamandrei</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
+ <dc:subject>
+ <rdf:Bag />
+ </dc:subject>
+ <dc:contributor>
+ <cc:Agent>
+ <dc:title>Jakub Steiner
+Luca Ferretti &lt;elle.uca@libero.it&gt;</dc:title>
+ </cc:Agent>
+ </dc:contributor>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/SourceCode" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ style="display:inline">
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.2;fill:url(#radialGradient4337);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="path1379"
+ sodipodi:cx="23.9375"
+ sodipodi:cy="42.6875"
+ sodipodi:rx="23.75956"
+ sodipodi:ry="5.8835783"
+ d="M 47.69706 42.6875 A 23.75956 5.8835783 0 1 1 0.17794037,42.6875 A 23.75956 5.8835783 0 1 1 47.69706 42.6875 z"
+ transform="matrix(0.968245,0,0,0.863797,1.447631,-0.747418)" />
+ <g
+ id="g4339"
+ transform="translate(-25,0)">
+ <path
+ style="opacity:0.20786516;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient4343);stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline"
+ d="M 66.13085,41.787912 C 57.847275,31.229854 73.566661,39.498791 71.897463,35.839689 C 70.26171,32.253903 51.343195,36.513864 53.3325,30.513864"
+ id="use4184"
+ sodipodi:nodetypes="czz" />
+ <path
+ sodipodi:nodetypes="czz"
+ id="path4172"
+ d="M 65.675044,41.213388 C 57.656634,30.125 72.913568,39.404152 71.161327,35 C 69.172021,30 52.551603,36.027728 53.480248,30.116116"
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#729fcf;stroke-width:1.00000012;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline" />
+ </g>
+ <g
+ id="g2302"
+ transform="matrix(0.811017,0,0,0.811017,4.536063,4.144784)">
+ <path
+ style="opacity:1;color:#000000;fill:url(#linearGradient2308);fill-opacity:1;fill-rule:evenodd;stroke:#888a85;stroke-width:1.23301888;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 14.375479,32.558794 C 14.375479,32.558794 15.592355,37.45777 10.51915,37.50376 C 8.0888743,37.525507 8.5866723,41.509781 8.5866723,41.509781 L 39.433139,41.478634 C 39.433139,41.478634 39.851577,37.611393 37.410922,37.566053 C 32.423455,37.474579 33.600393,32.496503 33.600393,32.496503 L 14.375479,32.558794 z "
+ id="path1359"
+ sodipodi:nodetypes="csccscc" />
+ <path
+ style="opacity:0.5;fill:url(#linearGradient2310);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 13.926195,33.027451 C 14.010206,35.2 13.641655,35.938894 12.285731,36.702682 L 36,38 C 35.047008,36.831372 33.660837,35.066666 34.038883,33.011765 L 13.926195,33.027451 z "
+ id="path1367"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ sodipodi:nodetypes="cc"
+ id="path1393"
+ d="M 10.436202,38.661601 C 17.000465,38.66357 37.562637,38.661601 37.562637,38.661601"
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#8d8d8f;stroke-width:1.23301923px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:0.43902438" />
+ <path
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.23301911px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 9.647928,39.660187 C 16.354621,39.662156 38.367789,39.660187 38.367789,39.660187"
+ id="path1395"
+ sodipodi:nodetypes="cc" />
+ </g>
+ <rect
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="rect4784"
+ width="48"
+ height="48"
+ x="0"
+ y="-2.84375" />
+ <path
+ style="fill:url(#linearGradient5147);fill-opacity:1;fill-rule:evenodd;stroke:#888a85;stroke-width:1.00000036;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1"
+ d="M 4.8882799,0.5019965 L 42.990539,0.5019965 C 45.014246,0.5019965 46.489076,1.9275484 46.489076,4.122797 L 46.500019,29.288034 C 46.500019,30.977609 45.97204,31.5 44.466781,31.5 L 3.5326624,31.481093 C 2.3542134,31.452343 1.5154744,30.987161 1.4996519,29.464764 L 1.5148181,3.935329 C 1.5148181,2.1641154 3.0531529,0.5019965 4.8882799,0.5019965 z "
+ id="rect5040"
+ sodipodi:nodetypes="ccccccccc" />
+ <rect
+ style="fill:url(#radialGradient5239);fill-opacity:1;fill-rule:evenodd;stroke:#204a87;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="rect9208"
+ width="37"
+ height="23"
+ x="5.5"
+ y="4.5" />
+ <path
+ style="opacity:0.75;fill:url(#linearGradient6246);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 6,4.9921565 L 6,23 C 22.444445,21.645751 28.598693,12.887581 41.968627,11.972548 L 41.968628,4.960784 L 6,4.9921565 z "
+ id="path4073"
+ sodipodi:nodetypes="ccccc" />
+ <rect
+ y="-2.84375"
+ x="0"
+ height="48"
+ width="48"
+ id="rect1355"
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <rect
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="rect1377"
+ width="48"
+ height="48"
+ x="0"
+ y="-2.84375" />
+ <path
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:0.99999958;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1"
+ d="M 4.9838392,1.4949272 C 3.6843517,1.4949272 2.5000007,2.776446 2.5000007,4.0314374 L 2.5,29.355478 C 2.5062246,29.952637 2.6447546,30.13805 2.7794318,30.252536 C 2.9141091,30.367022 3.1986228,30.457361 3.6798233,30.469067 L 44.352677,30.5 C 44.999641,30.5 45.204119,30.400004 45.284116,30.314402 C 45.364115,30.228799 45.501452,29.917765 45.501452,29.169879 L 45.501453,4.2170357 C 45.501453,2.4282144 44.497201,1.4949272 42.893423,1.4949272 L 4.9838392,1.4949272 z "
+ id="path1387"
+ sodipodi:nodetypes="cccsccscccc" />
+ <g
+ style="opacity:0.4"
+ id="g3052"
+ transform="translate(0,13)">
+ <rect
+ style="opacity:1;fill:url(#radialGradient2517);fill-opacity:1;stroke:none;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect3026"
+ width="4"
+ height="4.5"
+ x="0"
+ y="30.5" />
+ <rect
+ style="opacity:1;fill:url(#radialGradient2519);fill-opacity:1;stroke:none;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline"
+ id="rect3036"
+ width="4"
+ height="4.5"
+ x="-48"
+ y="-35"
+ transform="scale(-1,-1)" />
+ <rect
+ style="opacity:1;fill:url(#linearGradient2521);fill-opacity:1;stroke:none;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect3040"
+ width="40"
+ height="4.5"
+ x="4"
+ y="30.5" />
+ </g>
+ <g
+ id="g3316"
+ transform="translate(48,0)">
+ <path
+ style="fill:url(#linearGradient3442);fill-opacity:1;stroke:#888a85;stroke-width:1.00000417;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1"
+ d="M -42.6875,40.49166 C -43.655386,40.49166 -44.535263,40.777008 -45.125,41.738889 L -46.9375,44.656935 C -47.746153,45.711656 -47.093885,46.516012 -44.34375,46.516012 L -3.90625,46.516012 C -1.156115,46.516012 -0.503847,45.711656 -1.3125,44.656935 L -3.125,41.738889 C -3.714737,40.777008 -4.594614,40.49166 -5.5625,40.49166 L -42.6875,40.49166 z "
+ id="rect2024"
+ sodipodi:nodetypes="ccccccccc" />
+ <path
+ transform="matrix(1,0,0,0.666668,-48,15.83327)"
+ sodipodi:type="inkscape:offset"
+ inkscape:radius="-1"
+ inkscape:original="M 5.3125 37.5 C 4.344614 37.5 3.4647369 37.878926 2.875 39.15625 L 1.0625 43.03125 C 0.253847 44.43186 0.90611493 45.5 3.65625 45.5 L 44.09375 45.5 C 46.843885 45.5 47.496153 44.43186 46.6875 43.03125 L 44.875 39.15625 C 44.285263 37.878926 43.405386 37.5 42.4375 37.5 L 5.3125 37.5 z "
+ style="fill:none;fill-opacity:0.46875;stroke:white;stroke-width:1.22474873;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;display:inline"
+ id="path2920"
+ d="M 5.3125,38.5 C 4.6056131,38.5 4.2438621,38.560518 3.78125,39.5625 C 3.7814128,39.572916 3.7814128,39.583334 3.78125,39.59375 L 1.96875,43.46875 C 1.9590645,43.489941 1.9486415,43.510787 1.9375,43.53125 C 1.7919626,43.783325 1.7523439,43.95868 1.75,44.03125 C 1.7476561,44.10382 1.7146856,44.086521 1.75,44.125 C 1.8206288,44.201958 2.4106476,44.5 3.65625,44.5 L 44.09375,44.5 C 45.339352,44.5 45.929371,44.201958 46,44.125 C 46.035314,44.086521 46.002344,44.10382 46,44.03125 C 45.997656,43.95868 45.958037,43.783325 45.8125,43.53125 C 45.801358,43.510787 45.790935,43.489941 45.78125,43.46875 L 43.96875,39.59375 C 43.968587,39.583334 43.968587,39.572916 43.96875,39.5625 C 43.506138,38.560518 43.144387,38.5 42.4375,38.5 L 5.3125,38.5 z " />
+ </g>
+ <g
+ transform="translate(-102,13.18088)"
+ inkscape:label="Shadow"
+ id="g2299" />
+ <g
+ id="g2301"
+ inkscape:label="Shadow"
+ transform="translate(-102,28.24691)" />
+ <g
+ id="g2303"
+ inkscape:label="Lavoro"
+ style="display:inline"
+ transform="translate(-102,28.24691)" />
+ <g
+ id="g3252"
+ transform="translate(48,0)">
+ <path
+ style="color:black;fill:url(#linearGradient3320);fill-opacity:1;fill-rule:nonzero;stroke:#babdb6;stroke-width:0.99999923;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M -41.565234,39.500963 C -41.56828,39.504039 -41.562458,39.524556 -41.565234,39.526968 C -41.579903,39.531053 -41.615454,39.547177 -41.630468,39.552976 C -41.635478,39.555099 -41.658085,39.550659 -41.663085,39.552976 C -41.668058,39.555484 -41.690771,39.576279 -41.695701,39.578981 C -41.705443,39.584774 -41.718912,39.598413 -41.728318,39.604986 C -41.732914,39.608469 -41.756464,39.627314 -41.760935,39.630993 C -41.765266,39.634868 -41.789378,39.652925 -41.793552,39.656999 C -41.858423,39.732002 -41.926738,39.862395 -42.021871,40.02108 L -44.249421,43.973975 C -44.249421,43.978919 -44.249649,43.995024 -44.249421,43.999979 C -44.248968,44.004941 -44.250095,44.021024 -44.249421,44.025984 C -44.24853,44.030944 -44.250526,44.047041 -44.249421,44.051992 C -44.246792,44.061863 -44.220251,44.094213 -44.216804,44.104002 C -44.214881,44.10887 -44.218922,44.125172 -44.216804,44.13001 C -44.209875,44.144401 -44.192776,44.16805 -44.184187,44.182019 C -44.175067,44.195821 -44.162219,44.220827 -44.15157,44.234032 C -44.147858,44.238357 -44.122824,44.255791 -44.118953,44.260037 C -44.114927,44.264198 -44.090514,44.281974 -44.086336,44.286045 C -44.060382,44.309896 -44.019306,44.344229 -43.988486,44.36406 C -43.983227,44.367239 -43.961247,44.387022 -43.955869,44.390067 C -43.939371,44.397973 -43.908512,44.408905 -43.890635,44.416072 C -43.770407,44.46009 -43.611352,44.49409 -43.466615,44.49409 L -20.351972,44.49409 L -20.449823,39.500969 L -41.239065,39.500963 C -41.307579,39.500963 -41.382827,39.499026 -41.434766,39.500963 C -41.446919,39.50102 -41.486797,39.501474 -41.5,39.500963 C -41.504027,39.500988 -41.528959,39.500749 -41.532617,39.500963 C -41.535441,39.50334 -41.562188,39.497888 -41.565234,39.500963 z M -18.525425,39.500969 L -18.427575,41.165344 L -12.784849,41.165344 L -13.045784,39.500969 L -18.525425,39.500969 z M -11.08877,39.500969 L -9.91456,44.49409 L -4.695855,44.49409 C -4.551119,44.49409 -4.392063,44.46009 -4.271835,44.416072 C -4.253958,44.408905 -4.2231,44.397973 -4.206602,44.390067 C -4.201225,44.387022 -4.179245,44.367239 -4.173985,44.36406 C -4.143164,44.344229 -4.102088,44.309896 -4.076134,44.286045 C -4.071956,44.281974 -4.047542,44.264198 -4.043518,44.260037 C -4.039646,44.255791 -4.014612,44.238357 -4.0109,44.234032 C -4.000252,44.220827 -3.987404,44.195821 -3.978283,44.182019 C -3.969694,44.16805 -3.952595,44.144401 -3.945666,44.13001 C -3.943549,44.125172 -3.947589,44.10887 -3.945666,44.104002 C -3.942219,44.094213 -3.915679,44.061863 -3.913049,44.051992 C -3.911945,44.047041 -3.913941,44.030944 -3.913049,44.025984 C -3.912376,44.021024 -3.913503,44.004941 -3.913049,43.999979 C -3.91282,43.995024 -3.913049,43.978919 -3.913049,43.973975 L -5.739064,40.02108 C -5.834197,39.862396 -5.902512,39.732002 -5.967383,39.656999 C -5.971557,39.652925 -5.99567,39.634868 -6,39.630993 C -6.004471,39.627314 -6.028021,39.608469 -6.032617,39.604986 C -6.042024,39.598413 -6.055493,39.584774 -6.065234,39.578981 C -6.070163,39.576279 -6.092877,39.555484 -6.09785,39.552976 C -6.102851,39.550659 -6.125458,39.555099 -6.130467,39.552976 C -6.145481,39.547177 -6.181031,39.531053 -6.195701,39.526968 C -6.211818,39.523869 -6.237268,39.506412 -6.260936,39.500963 C -6.272811,39.498467 -6.315289,39.502376 -6.326169,39.500963 C -6.378109,39.499026 -6.453356,39.500963 -6.52187,39.500963 L -11.08877,39.500969 z M -17.220748,42.829716 L -18.264489,44.49409 L -12.262978,44.49409 L -13.567655,42.829716 L -17.220748,42.829716 z "
+ id="path2308"
+ sodipodi:nodetypes="csssssssccssssssssssssccccssscccccccccssssssssssssccsssssssssccccccc" />
+ <g
+ id="g2310"
+ style="fill:url(#radialGradient2433);fill-opacity:1"
+ transform="translate(-48,-5.89e-3)">
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="39"
+ x="7"
+ height="1"
+ width="1"
+ id="rect2312"
+ style="opacity:1;color:black;fill:url(#radialGradient3322);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="39"
+ x="9"
+ height="1"
+ width="1"
+ id="rect2314"
+ style="opacity:1;color:black;fill:url(#radialGradient3324);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="39"
+ x="11"
+ height="1"
+ width="1"
+ id="rect2316"
+ style="opacity:1;color:black;fill:url(#radialGradient3326);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="39"
+ x="13"
+ height="1"
+ width="1"
+ id="rect2318"
+ style="opacity:1;color:black;fill:url(#radialGradient3328);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="39"
+ x="15"
+ height="1"
+ width="1"
+ id="rect2320"
+ style="opacity:1;color:black;fill:url(#radialGradient3330);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="39"
+ x="17"
+ height="1"
+ width="1"
+ id="rect2322"
+ style="opacity:1;color:black;fill:url(#radialGradient3332);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="39"
+ x="19"
+ height="1"
+ width="1"
+ id="rect2324"
+ style="opacity:1;color:black;fill:url(#radialGradient3334);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="39"
+ x="21"
+ height="1"
+ width="1"
+ id="rect2326"
+ style="opacity:1;color:black;fill:url(#radialGradient3336);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="40"
+ x="6"
+ height="1"
+ width="1"
+ id="rect2328"
+ style="opacity:1;color:black;fill:url(#radialGradient3338);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="40"
+ x="8"
+ height="1"
+ width="1"
+ id="rect2330"
+ style="opacity:1;color:black;fill:url(#radialGradient3340);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="40"
+ x="10"
+ height="1"
+ width="1"
+ id="rect2332"
+ style="opacity:1;color:black;fill:url(#radialGradient3342);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="40"
+ x="12"
+ height="1"
+ width="1"
+ id="rect2334"
+ style="opacity:1;color:black;fill:url(#radialGradient3344);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="40"
+ x="14"
+ height="1"
+ width="1"
+ id="rect2336"
+ style="opacity:1;color:black;fill:url(#radialGradient3346);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="40"
+ x="16"
+ height="1"
+ width="1"
+ id="rect2338"
+ style="opacity:1;color:black;fill:url(#radialGradient3348);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="40"
+ x="18"
+ height="1"
+ width="1"
+ id="rect2341"
+ style="opacity:1;color:black;fill:url(#radialGradient3350);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="40"
+ x="20"
+ height="1"
+ width="1"
+ id="rect2343"
+ style="opacity:1;color:black;fill:url(#radialGradient3352);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="41"
+ x="7"
+ height="1"
+ width="1"
+ id="rect2345"
+ style="opacity:1;color:black;fill:url(#radialGradient3354);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="41"
+ x="9"
+ height="1"
+ width="1"
+ id="rect2347"
+ style="opacity:1;color:black;fill:url(#radialGradient3356);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="41"
+ x="11"
+ height="1"
+ width="1"
+ id="rect2349"
+ style="opacity:1;color:black;fill:url(#radialGradient3358);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="41"
+ x="13"
+ height="1"
+ width="1"
+ id="rect2351"
+ style="opacity:1;color:black;fill:url(#radialGradient3360);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="41"
+ x="15"
+ height="1"
+ width="1"
+ id="rect2353"
+ style="opacity:1;color:black;fill:url(#radialGradient3362);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="41"
+ x="17"
+ height="1"
+ width="1"
+ id="rect2355"
+ style="opacity:1;color:black;fill:url(#radialGradient3364);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="41"
+ x="19"
+ height="1"
+ width="1"
+ id="rect2357"
+ style="opacity:1;color:black;fill:url(#radialGradient3366);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="41"
+ x="21"
+ height="1"
+ width="1"
+ id="rect2359"
+ style="opacity:1;color:black;fill:url(#radialGradient3368);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="42"
+ x="6"
+ height="1"
+ width="1"
+ id="rect2361"
+ style="opacity:1;color:black;fill:url(#radialGradient3370);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="42"
+ x="8"
+ height="1"
+ width="1"
+ id="rect2363"
+ style="opacity:1;color:black;fill:url(#radialGradient3372);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="42"
+ x="10"
+ height="1"
+ width="1"
+ id="rect2365"
+ style="opacity:1;color:black;fill:url(#radialGradient3374);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="42"
+ x="12"
+ height="1"
+ width="1"
+ id="rect2367"
+ style="opacity:1;color:black;fill:url(#radialGradient3376);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="42"
+ x="14"
+ height="1"
+ width="1"
+ id="rect2369"
+ style="opacity:1;color:black;fill:url(#radialGradient3378);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="42"
+ x="16"
+ height="1"
+ width="1"
+ id="rect2371"
+ style="opacity:1;color:black;fill:url(#radialGradient3380);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="42"
+ x="18"
+ height="1"
+ width="1"
+ id="rect2373"
+ style="opacity:1;color:black;fill:url(#radialGradient3382);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="42"
+ x="20"
+ height="1"
+ width="1"
+ id="rect2375"
+ style="opacity:1;color:black;fill:url(#radialGradient3384);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="43"
+ x="5"
+ height="1"
+ width="1"
+ id="rect2377"
+ style="opacity:1;color:black;fill:url(#radialGradient3386);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="43"
+ x="7"
+ height="1"
+ width="1"
+ id="rect2379"
+ style="opacity:1;color:black;fill:url(#radialGradient3388);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="42"
+ x="22"
+ height="1"
+ width="1"
+ id="rect2381"
+ style="opacity:1;color:black;fill:url(#radialGradient3390);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="41"
+ x="23"
+ height="1"
+ width="1"
+ id="rect2383"
+ style="opacity:1;color:black;fill:url(#radialGradient3392);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="40"
+ x="22"
+ height="1"
+ width="1"
+ id="rect2385"
+ style="opacity:1;color:black;fill:url(#radialGradient3394);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="39"
+ x="23"
+ height="1"
+ width="1"
+ id="rect2387"
+ style="opacity:1;color:black;fill:url(#radialGradient3396);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="40"
+ x="24"
+ height="1"
+ width="1"
+ id="rect2389"
+ style="opacity:1;color:black;fill:url(#radialGradient3398);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="39"
+ x="25"
+ height="1"
+ width="1"
+ id="rect2391"
+ style="opacity:1;color:black;fill:url(#radialGradient3400);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="40"
+ x="26"
+ height="1"
+ width="1"
+ id="rect2393"
+ style="opacity:1;color:black;fill:url(#radialGradient3402);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="41"
+ x="25"
+ height="1"
+ width="1"
+ id="rect2395"
+ style="opacity:1;color:black;fill:url(#radialGradient3404);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="42"
+ x="24"
+ height="1"
+ width="1"
+ id="rect2397"
+ style="opacity:1;color:black;fill:url(#radialGradient3406);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="42"
+ x="26"
+ height="1"
+ width="1"
+ id="rect2399"
+ style="opacity:1;color:black;fill:url(#radialGradient3408);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="43"
+ x="25"
+ height="1"
+ width="1"
+ id="rect2401"
+ style="opacity:1;color:black;fill:url(#radialGradient3410);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="43"
+ x="23"
+ height="1"
+ width="1"
+ id="rect2403"
+ style="opacity:1;color:black;fill:url(#radialGradient3412);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="43"
+ x="31"
+ height="1"
+ width="1"
+ id="rect2405"
+ style="opacity:1;color:black;fill:url(#radialGradient3414);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="43"
+ x="33"
+ height="1"
+ width="1"
+ id="rect2407"
+ style="opacity:1;color:black;fill:url(#radialGradient3416);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="39"
+ x="31"
+ height="1"
+ width="1"
+ id="rect2409"
+ style="opacity:1;color:black;fill:url(#radialGradient3418);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="39"
+ x="33"
+ height="1"
+ width="1"
+ id="rect2411"
+ style="opacity:1;color:black;fill:url(#radialGradient3420);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="39"
+ x="37"
+ height="1"
+ width="1"
+ id="rect2413"
+ style="opacity:1;color:black;fill:url(#radialGradient3422);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="40"
+ x="38"
+ height="1"
+ width="1"
+ id="rect2415"
+ style="opacity:1;color:black;fill:url(#radialGradient3424);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="39"
+ x="39"
+ height="1"
+ width="1"
+ id="rect2417"
+ style="opacity:1;color:black;fill:url(#radialGradient3426);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="41"
+ x="41"
+ height="1"
+ width="1"
+ id="rect2419"
+ style="opacity:1;color:black;fill:url(#radialGradient3428);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="41"
+ x="39"
+ height="1"
+ width="1"
+ id="rect2421"
+ style="opacity:1;color:black;fill:url(#radialGradient3430);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="42"
+ x="38"
+ height="1"
+ width="1"
+ id="rect2423"
+ style="opacity:1;color:black;fill:url(#radialGradient3432);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="42"
+ x="40"
+ height="1"
+ width="1"
+ id="rect2425"
+ style="opacity:1;color:black;fill:url(#radialGradient3434);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="43"
+ x="41"
+ height="1"
+ width="1"
+ id="rect2427"
+ style="opacity:1;color:black;fill:url(#radialGradient3436);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="40"
+ x="40"
+ height="1"
+ width="1"
+ id="rect2429"
+ style="opacity:1;color:black;fill:url(#radialGradient3438);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ ry="0.26516503"
+ rx="0.26516503"
+ y="43"
+ x="43"
+ height="1"
+ width="1"
+ id="rect2431"
+ style="opacity:1;color:black;fill:url(#radialGradient3440);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ </g>
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer3"
+ inkscape:label="tastiera"
+ style="display:inline">
+ <g
+ id="g3270"
+ inkscape:label="Shadow"
+ transform="translate(-54,0.18088)" />
+ <g
+ transform="translate(-54,15.24691)"
+ inkscape:label="Shadow"
+ id="g2611" />
+ <g
+ transform="translate(-54,15.24691)"
+ style="display:inline"
+ inkscape:label="Lavoro"
+ id="g2613" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer2"
+ inkscape:label="tasti"
+ style="display:inline" />
+</svg>
diff --git a/xpm/gui_fullscreen.svg b/xpm/gui_fullscreen.svg
new file mode 100644
index 00000000..1c025cc5
--- /dev/null
+++ b/xpm/gui_fullscreen.svg
@@ -0,0 +1,261 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.0"
+ x="0.0000000"
+ y="0.0000000"
+ width="48"
+ height="48"
+ id="svg11300"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docname="view-fullscreen.svg"
+ sodipodi:docbase="/home/lapo/Icone/cvs/gnome-icon-theme/scalable/actions"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <metadata
+ id="metadata66">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>View Fullscreen</dc:title>
+ <dc:contributor>
+ <cc:Agent>
+ <dc:title />
+ </cc:Agent>
+ </dc:contributor>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
+ <dc:source>http://jimmac.musichall.cz</dc:source>
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>window</rdf:li>
+ <rdf:li>maximize</rdf:li>
+ <rdf:li>fullscreen</rdf:li>
+ <rdf:li>view</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/SourceCode" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <sodipodi:namedview
+ inkscape:window-height="889"
+ inkscape:window-width="924"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ borderopacity="0.31764706"
+ bordercolor="#666"
+ pagecolor="#ffffff"
+ id="base"
+ inkscape:zoom="8"
+ inkscape:cx="28.306834"
+ inkscape:cy="19.389137"
+ inkscape:window-x="2702"
+ inkscape:window-y="227"
+ inkscape:current-layer="svg11300"
+ showgrid="false"
+ inkscape:showpageshadow="false" />
+ <defs
+ id="defs3">
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient5031"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5060">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop5062" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5064" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient5029"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <linearGradient
+ id="linearGradient5048">
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="0"
+ id="stop5050" />
+ <stop
+ id="stop5056"
+ offset="0.5"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5052" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5048"
+ id="linearGradient5027"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
+ x1="302.85715"
+ y1="366.64789"
+ x2="302.85715"
+ y2="609.50507" />
+ <linearGradient
+ id="linearGradient4816">
+ <stop
+ style="stop-color:#204a87;stop-opacity:1.0000000"
+ offset="0.0000000"
+ id="stop4818" />
+ <stop
+ style="stop-color:#204a87;stop-opacity:0.0000000"
+ offset="1.0000000"
+ id="stop4820" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3832">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1.0000000"
+ offset="0.0000000"
+ id="stop3834" />
+ <stop
+ style="stop-color:#e0e0e0;stop-opacity:1.0000000"
+ offset="1.0000000"
+ id="stop3836" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4816"
+ id="linearGradient2264"
+ gradientUnits="userSpaceOnUse"
+ x1="13.050564"
+ y1="11.353518"
+ x2="13.050564"
+ y2="5.6173568"
+ gradientTransform="matrix(1.325819,0,0,1.19936,6.909366,6.044522)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3832"
+ id="linearGradient2267"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.367592,0,0,1.259127,5.978246,4.437132)"
+ x1="17.880680"
+ y1="11.072588"
+ x2="17.880680"
+ y2="21.767578" />
+ </defs>
+ <g
+ style="display:inline;opacity:0.58730159"
+ id="g5022"
+ transform="matrix(1.50523e-2,0,0,1.307315e-2,37.96,33.20429)">
+ <rect
+ y="-150.69685"
+ x="-1559.2523"
+ height="478.35718"
+ width="1339.6335"
+ id="rect4173"
+ style="opacity:0.40206185;color:black;fill:url(#linearGradient5027);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="path5058"
+ d="M -219.61876,-150.68038 C -219.61876,-150.68038 -219.61876,327.65041 -219.61876,327.65041 C -76.744594,328.55086 125.78146,220.48075 125.78138,88.454235 C 125.78138,-43.572302 -33.655436,-150.68036 -219.61876,-150.68038 z "
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient5029);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient5031);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M -1559.2523,-150.68038 C -1559.2523,-150.68038 -1559.2523,327.65041 -1559.2523,327.65041 C -1702.1265,328.55086 -1904.6525,220.48075 -1904.6525,88.454235 C -1904.6525,-43.572302 -1745.2157,-150.68036 -1559.2523,-150.68038 z "
+ id="path5018"
+ sodipodi:nodetypes="cccc" />
+ </g>
+ <rect
+ width="22.000008"
+ height="19.999989"
+ rx="0.54073501"
+ ry="0.53949153"
+ x="13.5"
+ y="14.5"
+ style="color:black;fill:url(#linearGradient2267);fill-opacity:1;fill-rule:evenodd;stroke:#8d8d8d;stroke-width:1.00000095;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect3818" />
+ <rect
+ width="19"
+ height="3"
+ rx="0.10055112"
+ ry="0.095258936"
+ x="15"
+ y="16"
+ style="color:black;fill:url(#linearGradient2264);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect3820" />
+ <rect
+ width="20.000011"
+ height="18.000002"
+ rx="0.188051"
+ ry="0.16447251"
+ x="14.499997"
+ y="15.499995"
+ style="color:black;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:white;stroke-width:1.00000143;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.47878789;visibility:visible;display:inline;overflow:visible"
+ id="rect4962" />
+ <path
+ style="opacity:1;color:black;fill:#729fcf;fill-opacity:1;fill-rule:evenodd;stroke:#204a87;stroke-width:1.00000012;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 39.499995,21.222229 L 39.499995,28.77779 L 45.062494,25.00001 L 39.499995,21.222229 z "
+ id="path2886"
+ sodipodi:nodetypes="cccc" />
+ <path
+ id="path2888"
+ d="M 9.4999999,21.222229 L 9.4999999,28.77779 L 3.9375009,25.00001 L 9.4999999,21.222229 z "
+ style="opacity:1;color:black;fill:#729fcf;fill-opacity:1;fill-rule:evenodd;stroke:#204a87;stroke-width:1.00000012;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:nodetypes="cccc" />
+ <path
+ id="path2890"
+ d="M 28.277779,38.5 L 20.722218,38.5 L 24.499998,44.062499 L 28.277779,38.5 z "
+ style="opacity:1;color:black;fill:#729fcf;fill-opacity:1;fill-rule:evenodd;stroke:#204a87;stroke-width:1.00000012;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:nodetypes="cccc" />
+ <path
+ style="opacity:1;color:black;fill:#729fcf;fill-opacity:1;fill-rule:evenodd;stroke:#204a87;stroke-width:1.00000012;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 28.277779,10.5 L 20.722218,10.5 L 24.499998,4.9375014 L 28.277779,10.5 z "
+ id="path2892"
+ sodipodi:nodetypes="cccc" />
+</svg>
diff --git a/xpm/gui_help.svg b/xpm/gui_help.svg
new file mode 100644
index 00000000..06dfed2e
--- /dev/null
+++ b/xpm/gui_help.svg
@@ -0,0 +1,398 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48"
+ height="48"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ version="1.0"
+ sodipodi:docbase="/home/lapo/Icone/cvs/gnome-icon-theme/scalable/apps"
+ sodipodi:docname="help-browser.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3839">
+ <stop
+ style="stop-color:#eeeeec;stop-opacity:1;"
+ offset="0"
+ id="stop3841" />
+ <stop
+ id="stop2893"
+ offset="0.5"
+ style="stop-color:#eeeeec;stop-opacity:1;" />
+ <stop
+ id="stop2891"
+ offset="0.78313255"
+ style="stop-color:white;stop-opacity:1;" />
+ <stop
+ style="stop-color:#d3d7cf;stop-opacity:1"
+ offset="1"
+ id="stop3843" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3831">
+ <stop
+ style="stop-color:#ef2929;stop-opacity:1;"
+ offset="0"
+ id="stop3833" />
+ <stop
+ style="stop-color:#ef2929;stop-opacity:0;"
+ offset="1"
+ id="stop3835" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3823">
+ <stop
+ style="stop-color:#ef2929;stop-opacity:1;"
+ offset="0"
+ id="stop3825" />
+ <stop
+ style="stop-color:#ef2929;stop-opacity:0;"
+ offset="1"
+ id="stop3827" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3815">
+ <stop
+ style="stop-color:#ef2929;stop-opacity:1;"
+ offset="0"
+ id="stop3817" />
+ <stop
+ style="stop-color:#ef2929;stop-opacity:0;"
+ offset="1"
+ id="stop3819" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3807">
+ <stop
+ style="stop-color:#ef2929;stop-opacity:1;"
+ offset="0"
+ id="stop3809" />
+ <stop
+ style="stop-color:#ef2929;stop-opacity:0;"
+ offset="1"
+ id="stop3811" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3783">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop3785" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop3787" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3743">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop3745" />
+ <stop
+ style="stop-color:white;stop-opacity:0.3392857;"
+ offset="1"
+ id="stop3747" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3735">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop3737" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop3739" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3783"
+ id="radialGradient1950"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.625,0,6.375)"
+ cx="8"
+ cy="17"
+ fx="8"
+ fy="17"
+ r="8" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3823"
+ id="linearGradient1973"
+ gradientUnits="userSpaceOnUse"
+ x1="15.821683"
+ y1="15.989761"
+ x2="14.372151"
+ y2="14.54023"
+ gradientTransform="matrix(2,0,0,2.073159,2,0.390502)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3815"
+ id="linearGradient1976"
+ gradientUnits="userSpaceOnUse"
+ x1="15.291184"
+ y1="6.4436507"
+ x2="17.416643"
+ y2="4.3181915"
+ gradientTransform="matrix(2,0,0,2.073159,2,0.390502)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3831"
+ id="linearGradient1979"
+ gradientUnits="userSpaceOnUse"
+ x1="6.4302521"
+ y1="15.967495"
+ x2="8.122447"
+ y2="14.2753"
+ gradientTransform="matrix(2,0,0,2.073159,2,0.390502)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3807"
+ id="linearGradient1982"
+ gradientUnits="userSpaceOnUse"
+ x1="6.055223"
+ y1="6.3116894"
+ x2="4.4831853"
+ y2="4.7396517"
+ gradientTransform="matrix(2,0,0,2.073159,2,0.390502)" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3743"
+ id="radialGradient1997"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.723968,0,0,2.633434,-13.5604,-4.83122)"
+ cx="7.5927024"
+ cy="3.1548533"
+ fx="7.5927024"
+ fy="3.1548533"
+ r="8.4622421" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3735"
+ id="radialGradient1999"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.21022,0,0,2.138888,-12.1022,-18.82138)"
+ cx="10.863756"
+ cy="16.148972"
+ fx="10.863756"
+ fy="16.148972"
+ r="8.7143736" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3839"
+ id="radialGradient2889"
+ cx="24"
+ cy="22.136841"
+ fx="24"
+ fy="22.136841"
+ r="19.5"
+ gradientTransform="matrix(1,0,0,1.035642,0,-0.826715)"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#afafaf"
+ borderopacity="1"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1"
+ inkscape:cx="37.814217"
+ inkscape:cy="7.9212512"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ width="48px"
+ height="48px"
+ gridspacingx="0.5px"
+ gridspacingy="0.5px"
+ inkscape:showpageshadow="false"
+ borderlayer="true"
+ gridempspacing="2"
+ inkscape:window-width="1051"
+ inkscape:window-height="797"
+ inkscape:window-x="210"
+ inkscape:window-y="25"
+ showgrid="false"
+ showborder="false"
+ inkscape:grid-points="true"
+ showguides="true"
+ inkscape:guide-bbox="true" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Lapo Calamandrei</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/SourceCode" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Livello 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ transform="matrix(3,0,0,2.764211,2,0.736029)"
+ style="fill:none;fill-opacity:1;stroke:#edd400;stroke-width:1.04177764;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:1.20000057;stroke-opacity:1;stroke-dasharray:none"
+ d="M 5,3.25 C 5,4.492 3.4313649,6.6029241 3,5.5 C 2.1703291,3.3786773 0.93342283,5.2887429 0.3484685,4.0315399 C -0.22935565,2.7896614 2.4934373,2.7209744 2.7599621,1.5582428 C 3.1438483,-0.11648562 5,2.008 5,3.25 z "
+ id="path4685"
+ sodipodi:nodetypes="cszsc" />
+ <path
+ transform="matrix(3,0,0,2.764211,28,0.736029)"
+ style="fill:none;fill-opacity:1;stroke:#edd400;stroke-width:1.04177764;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:1.20000057;stroke-opacity:1;stroke-dasharray:none"
+ d="M 5.1324347,3.7530602 C 6.5408877,4.6221586 4.104,5.5 3,5.5 C 1.896,5.5 1,4.492 1,3.25 C 1,2.008 2.5979486,0.9217573 3.6290649,1.6827245 C 4.6449011,2.432415 3.7071849,2.8735972 5.1324347,3.7530602 z "
+ id="path4687"
+ sodipodi:nodetypes="csszz" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.5;fill:url(#radialGradient1950);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ id="path3773"
+ sodipodi:cx="8"
+ sodipodi:cy="17"
+ sodipodi:rx="8"
+ sodipodi:ry="5"
+ d="M 16 17 A 8 5 0 1 1 0,17 A 8 5 0 1 1 16 17 z"
+ transform="matrix(3.002717,0,0,1.306102,-2.173913e-2,16.33263)" />
+ <path
+ transform="matrix(3,0,0,2.764211,2,27.6871)"
+ style="fill:none;fill-opacity:1;stroke:#edd400;stroke-width:1.04177764;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:1.20000057;stroke-opacity:1;stroke-dasharray:none"
+ d="M 5,3.25 C 3.8003631,3.6635328 3.655238,6.4417811 2.708796,5.6734303 C 1.7079235,4.8608912 2.890837,3.4082738 1.3249579,3.638696 C -0.23373408,3.8680605 0.81467683,1.5284674 3,1 C 4.0775742,0.73941485 5,2.008 5,3.25 z "
+ id="path4689"
+ sodipodi:nodetypes="czzsc" />
+ <path
+ transform="matrix(3,0,0,2.764211,28,27.6871)"
+ style="fill:none;fill-opacity:1;stroke:#edd400;stroke-width:1.04177764;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:1.20000057;stroke-opacity:1;stroke-dasharray:none"
+ d="M 4.9106118,3.4503621 C 3.213324,3.9676214 4.4687559,5.5062573 3.2630712,5.6808834 C 2.1050538,5.8486056 1.6264165,4.3705129 1.4714045,3.25 C 1.3172976,2.1360296 2.1622013,0.2197078 3,1 C 3.7209838,1.6714955 6.6199357,2.9294347 4.9106118,3.4503621 z "
+ id="path4691"
+ sodipodi:nodetypes="czzsz" />
+ <path
+ transform="matrix(3,0,0,2.764211,2,0.736029)"
+ style="fill:none;fill-opacity:1;stroke:white;stroke-width:0.34725916;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ d="M 5,3.25 C 5,4.492 3.4313649,6.6029241 3,5.5 C 2.1703291,3.3786773 0.93342283,5.2887429 0.3484685,4.0315399 C -0.22935565,2.7896614 2.4934373,2.7209744 2.7599621,1.5582428 C 3.1438483,-0.11648562 5,2.008 5,3.25 z "
+ id="path3751"
+ sodipodi:nodetypes="cszsc" />
+ <path
+ transform="matrix(3,0,0,2.764211,28,0.736029)"
+ style="fill:none;fill-opacity:1;stroke:white;stroke-width:0.34725916;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ d="M 5.1324347,3.7530602 C 6.5408877,4.6221586 4.104,5.5 3,5.5 C 1.896,5.5 1,4.492 1,3.25 C 1,2.008 2.5979486,0.9217573 3.6290649,1.6827245 C 4.6449011,2.432415 3.7071849,2.8735972 5.1324347,3.7530602 z "
+ id="path3753"
+ sodipodi:nodetypes="csszz" />
+ <path
+ transform="matrix(3,0,0,2.764211,2,27.6871)"
+ style="fill:none;fill-opacity:1;stroke:white;stroke-width:0.34725916;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ d="M 5,3.25 C 3.8003631,3.6635328 3.655238,6.4417811 2.708796,5.6734303 C 1.7079235,4.8608912 2.890837,3.4082738 1.3249579,3.638696 C -0.23373408,3.8680605 0.81467683,1.5284674 3,1 C 4.0775742,0.73941485 5,2.008 5,3.25 z "
+ id="path3755"
+ sodipodi:nodetypes="czzsc" />
+ <path
+ transform="matrix(3,0,0,2.764211,28,27.6871)"
+ style="fill:none;fill-opacity:1;stroke:white;stroke-width:0.34725916;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ d="M 4.9106118,3.4503621 C 3.213324,3.9676214 4.4687559,5.5062573 3.2630712,5.6808834 C 2.1050538,5.8486056 1.6264165,4.3705129 1.4714045,3.25 C 1.3172976,2.1360296 2.1622013,0.2197078 3,1 C 3.7209838,1.6714955 6.6199357,2.9294347 4.9106118,3.4503621 z "
+ id="path3757"
+ sodipodi:nodetypes="czzsz" />
+ <path
+ style="fill:url(#radialGradient2889);fill-opacity:1.0;stroke:#888a85;stroke-width:1.00000012;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ d="M 24,3.5002405 C 13.512009,3.5002405 5,12.323604 5,23.195251 C 5,34.066899 13.512009,42.890262 24,42.890262 C 34.48799,42.890262 43,34.066899 43,23.195251 C 43,12.323604 34.48799,3.5002405 24,3.5002405 z M 24,13.866036 C 28.967992,13.866035 33,18.045532 33,23.195251 C 33,28.34497 28.967992,32.524467 24,32.524467 C 19.032008,32.524467 15,28.34497 15,23.195251 C 15,18.045532 19.032008,13.866036 24,13.866036 z "
+ id="path1871" />
+ <path
+ style="fill:url(#linearGradient1982);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 16.375,5.1846822 C 12.031516,7.1681393 8.5384652,10.788965 6.625,15.291332 C 10.619567,15.244087 13.21478,17.295875 15.75,19.43765 C 16.655903,17.312499 18.324842,15.582511 20.375,14.64347 C 19.653901,11.053231 18.398365,7.8447314 16.375,5.1846822 z "
+ id="path2764"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ style="fill:url(#linearGradient1979);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ d="M 15.75,26.952852 C 12.708333,27.729884 9.6666667,27.935454 6.625,31.09917 C 8.5384652,35.601536 12.031516,39.222362 16.375,41.20582 C 16.917398,37.525601 17.956195,34.176314 20.375,31.747032 C 18.324842,30.80799 16.655903,29.078003 15.75,26.952852 z "
+ id="path2772"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ style="fill:url(#linearGradient1976);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 31.625,5.1846822 C 29.676221,7.7221655 28.016661,10.548869 27.625,14.64347 C 29.675158,15.582511 31.344096,17.312499 32.25,19.43765 C 35.429475,16.815267 38.508941,15.092969 41.375,15.291332 C 39.461534,10.788965 35.968484,7.1681393 31.625,5.1846822 z "
+ id="path2795"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ style="fill:url(#linearGradient1973);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 32.25,26.952852 C 31.344096,29.078003 29.675158,30.80799 27.625,31.747032 C 29.646436,34.211859 30.85863,37.485927 31.625,41.20582 C 35.968484,39.222362 39.461534,35.601536 41.375,31.09917 C 39.211413,28.663368 35.980663,27.508162 32.25,26.952852 z "
+ id="path2797"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#a40000;stroke-width:1.00000012px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 15.75,19.43765 C 16.655904,17.312499 18.324842,15.582511 20.375,14.64347 M 16.375,5.1846822 C 12.031516,7.1681393 8.538466,10.788965 6.625,15.291332"
+ id="path3706"
+ sodipodi:nodetypes="cccc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#a40000;stroke-width:1.00000012px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 41.375,15.291332 C 39.461534,10.788965 35.968484,7.1681393 31.625,5.1846822 M 27.625,14.64347 C 29.675158,15.582511 31.344096,17.312499 32.25,19.43765"
+ id="path3708"
+ sodipodi:nodetypes="cccc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#a40000;stroke-width:1.00000012px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 32.25,26.952852 C 31.344096,29.078003 29.675158,30.80799 27.625,31.747032 M 31.625,41.20582 C 35.968484,39.222362 39.461534,35.601536 41.375,31.09917"
+ id="path3710"
+ sodipodi:nodetypes="cccc" />
+ <path
+ style="fill:none;fill-opacity:1;stroke:#a40000;stroke-width:1.00000012;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ d="M 20.375,31.747032 C 18.324842,30.80799 16.655903,29.078003 15.75,26.952852 M 6.625,31.09917 C 8.5384652,35.601536 12.031516,39.222362 16.375,41.20582"
+ id="path3712"
+ sodipodi:nodetypes="cccc" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.4;fill:none;fill-opacity:1;stroke:url(#radialGradient1997);stroke-width:0.42869788;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ id="path3722"
+ sodipodi:cx="10"
+ sodipodi:cy="10.28125"
+ sodipodi:rx="8"
+ sodipodi:ry="7.71875"
+ d="M 18 10.28125 A 8 7.71875 0 1 1 2,10.28125 A 8 7.71875 0 1 1 18 10.28125 z"
+ transform="matrix(2.246534,0,0,2.422058,1.53466,-1.706524)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.8;fill:none;fill-opacity:1;stroke:url(#radialGradient1999);stroke-width:0.77645928;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ id="path3724"
+ sodipodi:cx="10"
+ sodipodi:cy="10.28125"
+ sodipodi:rx="8"
+ sodipodi:ry="7.71875"
+ d="M 18 10.28125 A 8 7.71875 0 1 1 2,10.28125 A 8 7.71875 0 1 1 18 10.28125 z"
+ transform="matrix(1.242433,0,0,1.335027,11.57567,9.469519)" />
+ </g>
+</svg>
diff --git a/xpm/gui_home.svg b/xpm/gui_home.svg
new file mode 100644
index 00000000..79db440d
--- /dev/null
+++ b/xpm/gui_home.svg
@@ -0,0 +1,248 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48px"
+ height="48px"
+ id="svg1328"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="/home/lapo/Icone/cvs/gnome-icon-theme/scalable/actions"
+ sodipodi:docname="go-home.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <sodipodi:namedview
+ inkscape:cy="21.40117"
+ inkscape:cx="103.96977"
+ inkscape:zoom="1"
+ inkscape:window-height="912"
+ inkscape:window-width="1011"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="0.31764706"
+ bordercolor="#666"
+ pagecolor="#ffffff"
+ id="base"
+ inkscape:showpageshadow="false"
+ showgrid="false"
+ inkscape:window-x="592"
+ inkscape:window-y="70"
+ inkscape:current-layer="layer1" />
+ <defs
+ id="defs1330">
+ <linearGradient
+ id="linearGradient2804">
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="0"
+ id="stop2806" />
+ <stop
+ id="stop2812"
+ offset="0.5"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop2808" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2781">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop2783" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop2785" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2782">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop2784" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop2786" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5106">
+ <stop
+ style="stop-color:#729fcf;stop-opacity:1;"
+ offset="0"
+ id="stop5108" />
+ <stop
+ style="stop-color:#386ea6;stop-opacity:1;"
+ offset="1"
+ id="stop5110" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5106"
+ id="linearGradient2780"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(3.137165,0,0,3.184122,-1.606682,-4.861064)"
+ x1="8.1771841"
+ y1="5.8576875"
+ x2="8.1771841"
+ y2="15.676654" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2782"
+ id="linearGradient2788"
+ x1="26.0625"
+ y1="23.265625"
+ x2="29.03125"
+ y2="55.265625"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2781"
+ id="radialGradient2827"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2,0,0,0.8,-13,-79.2)"
+ cx="1"
+ cy="44"
+ fx="1"
+ fy="44"
+ r="5" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2781"
+ id="radialGradient2829"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2,0,0,0.8,36,8.8)"
+ cx="1"
+ cy="44"
+ fx="1"
+ fy="44"
+ r="5" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2804"
+ id="linearGradient2831"
+ gradientUnits="userSpaceOnUse"
+ x1="21.875"
+ y1="48.000977"
+ x2="21.875"
+ y2="40" />
+ </defs>
+ <sodipodi:namedview
+ id="namedview21"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="9.8994949"
+ inkscape:cx="24"
+ inkscape:cy="24"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:window-width="736"
+ inkscape:window-height="851"
+ inkscape:window-x="214"
+ inkscape:window-y="28" />
+ <metadata
+ id="metadata1333">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>Go Home</dc:title>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>go</rdf:li>
+ <rdf:li>seek</rdf:li>
+ <rdf:li>home</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Rodney Dawes</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:contributor>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:contributor>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/SourceCode" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <g
+ id="g2822"
+ style="opacity:0.3"
+ transform="matrix(1,0,0,1.037397,0,-1.648602)">
+ <rect
+ transform="scale(-1,-1)"
+ y="-48"
+ x="-11"
+ height="8"
+ width="10"
+ id="rect1892"
+ style="opacity:1;color:black;fill:url(#radialGradient2827);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ y="40"
+ x="38"
+ height="8"
+ width="10"
+ id="rect2789"
+ style="opacity:1;color:black;fill:url(#radialGradient2829);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ y="40"
+ x="11"
+ height="8"
+ width="27"
+ id="rect2793"
+ style="opacity:1;color:black;fill:url(#linearGradient2831);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ <path
+ style="opacity:1;color:black;fill:url(#linearGradient2780);fill-opacity:1;fill-rule:nonzero;stroke:#204a87;stroke-width:1.00000024;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 24.046494,1.5071795 L 1.2179878,25.575587 L 6.4862366,25.575587 L 6.5487366,44.555315 L 42.546511,44.492815 L 42.399171,25.469161 L 46.875,25.513087 L 37.54055,15.684423 L 37.549608,3.5326741 L 30.505837,3.5235471 L 30.537459,8.1869639 L 24.046494,1.5071795 z "
+ id="rect5117"
+ sodipodi:nodetypes="cccccccccccc" />
+ <path
+ style="opacity:0.41237111;color:black;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient2788);stroke-width:1.00000024;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible"
+ d="M 24.03125,3.03125 L 3.6875,24.5 L 6.5,24.5 C 6.7820332,24.499212 7.0527421,24.610901 7.2521704,24.81033 C 7.4515988,25.009758 7.5632875,25.280467 7.5625,25.5625 L 7.625,43.5 L 41.46875,43.4375 L 41.34375,25.46875 C 41.342962,25.186717 41.454651,24.916008 41.65408,24.71658 C 41.853508,24.517151 42.124217,24.405462 42.40625,24.40625 L 44.375,24.40625 L 36.75,16.40625 C 36.569219,16.210548 36.468801,15.953923 36.46875,15.6875 L 36.5,4.59375 L 31.5625,4.59375 L 31.59375,8.1875 C 31.595602,8.617841 31.336979,9.0065543 30.939333,9.1710975 C 30.541687,9.3356406 30.084018,9.2433239 29.78125,8.9375 L 24.03125,3.03125 z "
+ id="path2778" />
+ </g>
+</svg>
diff --git a/xpm/gui_inactive.svg b/xpm/gui_inactive.svg
new file mode 100644
index 00000000..61e2dcb8
--- /dev/null
+++ b/xpm/gui_inactive.svg
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48px"
+ height="48px"
+ id="svg3220"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="/tmp"
+ sodipodi:docname="gui_inactive.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3222">
+ <linearGradient
+ y2="40.064526"
+ x2="27.044603"
+ y1="19.939341"
+ x1="17.838388"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient7010"
+ xlink:href="#linearGradient7000"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient7000"
+ inkscape:collect="always">
+ <stop
+ id="stop7002"
+ offset="0"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ <stop
+ id="stop7004"
+ offset="1"
+ style="stop-color:#ffffff;stop-opacity:0;" />
+ </linearGradient>
+ <linearGradient
+ gradientUnits="userSpaceOnUse"
+ y2="61.80806"
+ x2="39.418972"
+ y1="19.939341"
+ x1="17.838388"
+ id="linearGradient7006"
+ xlink:href="#linearGradient7000"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient2790">
+ <stop
+ id="stop2792"
+ offset="0"
+ style="stop-color:white;stop-opacity:1;" />
+ <stop
+ style="stop-color:#d3d7cf;stop-opacity:1;"
+ offset="0.8108108"
+ id="stop2798" />
+ <stop
+ id="stop2794"
+ offset="1"
+ style="stop-color:#959e8b;stop-opacity:1;" />
+ </linearGradient>
+ <linearGradient
+ gradientTransform="matrix(1.7588235,0,0,1.7588235,6.032353,6.0323539)"
+ gradientUnits="userSpaceOnUse"
+ y2="30.038462"
+ x2="19.255854"
+ y1="0.068979882"
+ x1="4.3764215"
+ id="linearGradient6945"
+ xlink:href="#linearGradient2790"
+ inkscape:collect="always" />
+ <radialGradient
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.5,0,9.75)"
+ r="3"
+ fy="19.5"
+ fx="-2"
+ cy="19.5"
+ cx="-2"
+ id="radialGradient6972"
+ xlink:href="#linearGradient6964"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient6964"
+ inkscape:collect="always">
+ <stop
+ id="stop5939"
+ offset="0"
+ style="stop-color:#000000;stop-opacity:1;" />
+ <stop
+ id="stop6968"
+ offset="1"
+ style="stop-color:#000000;stop-opacity:0;" />
+ </linearGradient>
+ <radialGradient
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.5,0,9.75)"
+ r="3"
+ fy="19.5"
+ fx="-2"
+ cy="19.5"
+ cx="-2"
+ id="radialGradient6970"
+ xlink:href="#linearGradient6964"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient6958">
+ <stop
+ id="stop6960"
+ offset="0"
+ style="stop-color:#729fcf;stop-opacity:1;" />
+ <stop
+ style="stop-color:#729fcf;stop-opacity:1;"
+ offset="0.60000002"
+ id="stop6966" />
+ <stop
+ id="stop6962"
+ offset="1"
+ style="stop-color:#729fcf;stop-opacity:0;" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient6958"
+ id="radialGradient5962"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.8087117,0,0,3.5234273,-57.039447,-57.368542)"
+ cx="70.53125"
+ cy="22.734375"
+ fx="70.53125"
+ fy="22.734375"
+ r="3.5975378" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="7"
+ inkscape:cx="24"
+ inkscape:cy="24"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:window-width="800"
+ inkscape:window-height="649"
+ inkscape:window-x="472"
+ inkscape:window-y="296" />
+ <metadata
+ id="metadata3225">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <g
+ style="display:inline"
+ inkscape:label="Layer 1"
+ id="g5953"
+ transform="translate(-0.6553298,-1.376604)">
+ <g
+ transform="matrix(1.8719362,0,0,1.5205944,5.0000002,10.484903)"
+ style="opacity:0.7238806"
+ id="g6978">
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.14179107;fill:url(#radialGradient5962);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path6974"
+ sodipodi:cx="-2"
+ sodipodi:cy="19.5"
+ sodipodi:rx="3"
+ sodipodi:ry="1.5"
+ d="M 1 19.5 A 3 1.5 0 1 1 -5,19.5 A 3 1.5 0 1 1 1 19.5 z"
+ transform="matrix(2.0312501,0,0,1.2946278,14.455805,-7.7591062)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.2;fill:url(#radialGradient6970);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path6960"
+ sodipodi:cx="-2"
+ sodipodi:cy="19.5"
+ sodipodi:rx="3"
+ sodipodi:ry="1.5"
+ d="M 1 19.5 A 3 1.5 0 1 1 -5,19.5 A 3 1.5 0 1 1 1 19.5 z"
+ transform="matrix(1.6666667,0,0,1.2946278,8.3333333,-6.6568542)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.2;fill:url(#radialGradient6972);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path6962"
+ sodipodi:cx="-2"
+ sodipodi:cy="19.5"
+ sodipodi:rx="3"
+ sodipodi:ry="1.5"
+ d="M 1 19.5 A 3 1.5 0 1 1 -5,19.5 A 3 1.5 0 1 1 1 19.5 z"
+ transform="matrix(1.6666667,0,0,1.2946278,19.333333,-6.6568542)" />
+ </g>
+ <path
+ id="path6930"
+ d="M 14.82647,9.5500008 L 9.55,14.826471 L 19.22353,24.5 L 9.55,34.17353 L 14.82647,39.45 L 24.500002,29.776471 L 34.17352,39.45 L 39.45,34.17353 L 29.77647,24.5 L 39.45,14.826471 L 34.17352,9.5500008 L 24.500002,19.22353 L 14.82647,9.5500008 z "
+ style="fill:url(#linearGradient6945);fill-opacity:1;fill-rule:evenodd;stroke:#6f716b;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ transform="translate(0,1)"
+ d="M 14.8125,10.0625 L 11.0625,13.8125 L 19.96875,22.75 C 20.169915,22.947709 20.283223,23.217943 20.283223,23.5 C 20.283223,23.782057 20.169915,24.052291 19.96875,24.25 L 11.0625,33.1875 L 14.8125,36.9375 L 23.75,28.03125 C 23.947709,27.830085 24.217943,27.716777 24.5,27.716777 C 24.782057,27.716777 25.052291,27.830085 25.25,28.03125 L 34.1875,36.9375 L 37.9375,33.1875 L 29.03125,24.25 C 28.830085,24.052291 28.716777,23.782057 28.716777,23.5 C 28.716777,23.217943 28.830085,22.947709 29.03125,22.75 L 37.9375,13.8125 L 34.1875,10.0625 L 25.25,18.96875 C 25.052291,19.169915 24.782057,19.283223 24.5,19.283223 C 24.217943,19.283223 23.947709,19.169915 23.75,18.96875 L 14.8125,10.0625 z "
+ id="path6996"
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient7006);stroke-width:1.10000002;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ inkscape:original="M 14.8125 8.5625 L 9.5625 13.8125 L 19.21875 23.5 L 9.5625 33.1875 L 14.8125 38.4375 L 24.5 28.78125 L 34.1875 38.4375 L 39.4375 33.1875 L 29.78125 23.5 L 39.4375 13.8125 L 34.1875 8.5625 L 24.5 18.21875 L 14.8125 8.5625 z "
+ inkscape:radius="-1.0514843"
+ sodipodi:type="inkscape:offset" />
+ <path
+ transform="translate(0,1)"
+ d="M 14.8125,10.0625 L 11.0625,13.8125 L 19.96875,22.75 C 20.169915,22.947709 20.283223,23.217943 20.283223,23.5 C 20.283223,23.782057 20.169915,24.052291 19.96875,24.25 L 11.0625,33.1875 L 14.8125,36.9375 L 23.75,28.03125 C 23.947709,27.830085 24.217943,27.716777 24.5,27.716777 C 24.782057,27.716777 25.052291,27.830085 25.25,28.03125 L 34.1875,36.9375 L 37.9375,33.1875 L 29.03125,24.25 C 28.830085,24.052291 28.716777,23.782057 28.716777,23.5 C 28.716777,23.217943 28.830085,22.947709 29.03125,22.75 L 37.9375,13.8125 L 34.1875,10.0625 L 25.25,18.96875 C 25.052291,19.169915 24.782057,19.283223 24.5,19.283223 C 24.217943,19.283223 23.947709,19.169915 23.75,18.96875 L 14.8125,10.0625 z "
+ id="path7008"
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient7010);stroke-width:1.10000002;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ inkscape:original="M 14.8125 8.5625 L 9.5625 13.8125 L 19.21875 23.5 L 9.5625 33.1875 L 14.8125 38.4375 L 24.5 28.78125 L 34.1875 38.4375 L 39.4375 33.1875 L 29.78125 23.5 L 39.4375 13.8125 L 34.1875 8.5625 L 24.5 18.21875 L 14.8125 8.5625 z "
+ inkscape:radius="-1.0514843"
+ sodipodi:type="inkscape:offset" />
+ </g>
+ </g>
+</svg>
diff --git a/xpm/gui_leave_fullscreen.svg b/xpm/gui_leave_fullscreen.svg
new file mode 100644
index 00000000..d1d351b9
--- /dev/null
+++ b/xpm/gui_leave_fullscreen.svg
@@ -0,0 +1,422 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.0"
+ x="0.0000000"
+ y="0.0000000"
+ width="48"
+ height="48"
+ id="svg11300"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docname="view-restore.svg"
+ sodipodi:docbase="/home/lapo/Icone/cvs/gnome-icon-theme/scalable/actions"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <metadata
+ id="metadata66">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>Restore View</dc:title>
+ <dc:contributor>
+ <cc:Agent>
+ <dc:title />
+ </cc:Agent>
+ </dc:contributor>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
+ <dc:source>http://jimmac.musichall.cz</dc:source>
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>window</rdf:li>
+ <rdf:li>fullscreen</rdf:li>
+ <rdf:li>view. restore</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/SourceCode" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <sodipodi:namedview
+ inkscape:window-height="889"
+ inkscape:window-width="924"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ borderopacity="0.31764706"
+ bordercolor="#666"
+ pagecolor="#ffffff"
+ id="base"
+ inkscape:zoom="8"
+ inkscape:cx="21.684252"
+ inkscape:cy="19.196453"
+ inkscape:window-x="2237"
+ inkscape:window-y="144"
+ inkscape:current-layer="svg11300"
+ showgrid="true"
+ inkscape:showpageshadow="false" />
+ <defs
+ id="defs3">
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2905">
+ <stop
+ style="stop-color:#729fcf;stop-opacity:1;"
+ offset="0"
+ id="stop2907" />
+ <stop
+ style="stop-color:#729fcf;stop-opacity:0;"
+ offset="1"
+ id="stop2909" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2897">
+ <stop
+ style="stop-color:#204a87;stop-opacity:1;"
+ offset="0"
+ id="stop2899" />
+ <stop
+ style="stop-color:#204a87;stop-opacity:0;"
+ offset="1"
+ id="stop2901" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2889">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop2891" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop2893" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient5031"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5060">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop5062" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5064" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient5029"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <linearGradient
+ id="linearGradient5048">
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="0"
+ id="stop5050" />
+ <stop
+ id="stop5056"
+ offset="0.5"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5052" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5048"
+ id="linearGradient5027"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
+ x1="302.85715"
+ y1="366.64789"
+ x2="302.85715"
+ y2="609.50507" />
+ <linearGradient
+ id="linearGradient4816">
+ <stop
+ style="stop-color:#204a87;stop-opacity:1.0000000"
+ offset="0.0000000"
+ id="stop4818" />
+ <stop
+ style="stop-color:#204a87;stop-opacity:0.0000000"
+ offset="1.0000000"
+ id="stop4820" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3832">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1.0000000"
+ offset="0.0000000"
+ id="stop3834" />
+ <stop
+ style="stop-color:#e0e0e0;stop-opacity:1.0000000"
+ offset="1.0000000"
+ id="stop3836" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4816"
+ id="linearGradient2264"
+ gradientUnits="userSpaceOnUse"
+ x1="13.050564"
+ y1="11.353518"
+ x2="13.050564"
+ y2="5.6173568"
+ gradientTransform="matrix(1.116479,0,0,1.28466,-1.813167,16.33649)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3832"
+ id="linearGradient2267"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.181102,0,0,1.133215,-2.996059,16.44342)"
+ x1="17.880680"
+ y1="11.072588"
+ x2="17.880680"
+ y2="21.767578" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5048"
+ id="linearGradient1983"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
+ x1="302.85715"
+ y1="366.64789"
+ x2="302.85715"
+ y2="609.50507" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient1985"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient1987"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3832"
+ id="linearGradient1989"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.181102,0,0,1.133215,7.003941,8.44342)"
+ x1="17.880680"
+ y1="11.072588"
+ x2="17.880680"
+ y2="21.767578" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4816"
+ id="linearGradient1991"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.116479,0,0,1.28466,8.186833,8.33649)"
+ x1="13.050564"
+ y1="11.353518"
+ x2="13.050564"
+ y2="5.6173568" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2889"
+ id="linearGradient2895"
+ x1="24.75"
+ y1="13.984375"
+ x2="41.96875"
+ y2="13.984375"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2897"
+ id="linearGradient2903"
+ x1="35.100983"
+ y1="12.375624"
+ x2="43.349266"
+ y2="4.4381237"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2905"
+ id="linearGradient2911"
+ x1="35.100983"
+ y1="12.375624"
+ x2="43.349266"
+ y2="4.4381237"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <g
+ id="g1993"
+ style="opacity:0.6">
+ <g
+ style="opacity:0.58730164;display:inline"
+ id="g1969"
+ transform="matrix(1.32174e-2,0,0,1.145603e-2,35.17455,34.53806)">
+ <rect
+ y="-150.69685"
+ x="-1559.2523"
+ height="478.35718"
+ width="1339.6335"
+ id="rect1971"
+ style="opacity:0.40206185;color:black;fill:url(#linearGradient1983);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="path1973"
+ d="M -219.61876,-150.68038 C -219.61876,-150.68038 -219.61876,327.65041 -219.61876,327.65041 C -76.744594,328.55086 125.78146,220.48075 125.78138,88.454235 C 125.78138,-43.572302 -33.655436,-150.68036 -219.61876,-150.68038 z "
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient1985);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient1987);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M -1559.2523,-150.68038 C -1559.2523,-150.68038 -1559.2523,327.65041 -1559.2523,327.65041 C -1702.1265,328.55086 -1904.6525,220.48075 -1904.6525,88.454235 C -1904.6525,-43.572302 -1745.2157,-150.68036 -1559.2523,-150.68038 z "
+ id="path1975"
+ sodipodi:nodetypes="cccc" />
+ </g>
+ <rect
+ width="18.999998"
+ height="18.000006"
+ rx="0.46699828"
+ ry="0.48554277"
+ x="13.500001"
+ y="17.5"
+ style="color:black;fill:url(#linearGradient1989);fill-opacity:1;fill-rule:evenodd;stroke:#8d8d8d;stroke-width:1.00000119;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect1977" />
+ <rect
+ width="16"
+ height="3.2133625"
+ rx="0.084674627"
+ ry="0.10203383"
+ x="15"
+ y="19"
+ style="color:black;fill:url(#linearGradient1991);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect1979" />
+ <rect
+ width="16.999989"
+ height="15.99999"
+ rx="0.15984313"
+ ry="0.14619765"
+ x="14.500002"
+ y="18.499994"
+ style="color:black;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:white;stroke-width:1.00000167;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.47878789;visibility:visible;display:inline;overflow:visible"
+ id="rect1981" />
+ </g>
+ <g
+ style="opacity:0.58730164;display:inline"
+ id="g5022"
+ transform="matrix(1.32174e-2,0,0,1.145603e-2,25.17455,42.53806)">
+ <rect
+ y="-150.69685"
+ x="-1559.2523"
+ height="478.35718"
+ width="1339.6335"
+ id="rect4173"
+ style="opacity:0.40206185;color:black;fill:url(#linearGradient5027);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="path5058"
+ d="M -219.61876,-150.68038 C -219.61876,-150.68038 -219.61876,327.65041 -219.61876,327.65041 C -76.744594,328.55086 125.78146,220.48075 125.78138,88.454235 C 125.78138,-43.572302 -33.655436,-150.68036 -219.61876,-150.68038 z "
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient5029);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient5031);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M -1559.2523,-150.68038 C -1559.2523,-150.68038 -1559.2523,327.65041 -1559.2523,327.65041 C -1702.1265,328.55086 -1904.6525,220.48075 -1904.6525,88.454235 C -1904.6525,-43.572302 -1745.2157,-150.68036 -1559.2523,-150.68038 z "
+ id="path5018"
+ sodipodi:nodetypes="cccc" />
+ </g>
+ <rect
+ width="18.999998"
+ height="18.000006"
+ rx="0.46699828"
+ ry="0.48554277"
+ x="3.5000007"
+ y="25.5"
+ style="color:black;fill:url(#linearGradient2267);fill-opacity:1;fill-rule:evenodd;stroke:#8d8d8d;stroke-width:1.00000119;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect3818" />
+ <rect
+ width="16"
+ height="3.2133625"
+ rx="0.084674627"
+ ry="0.10203383"
+ x="5"
+ y="27"
+ style="color:black;fill:url(#linearGradient2264);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect3820" />
+ <rect
+ width="16.999989"
+ height="15.99999"
+ rx="0.15984313"
+ ry="0.14619765"
+ x="4.5000014"
+ y="26.499994"
+ style="color:black;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:white;stroke-width:1.00000167;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.47878789;visibility:visible;display:inline;overflow:visible"
+ id="rect4962" />
+ <path
+ id="path2890"
+ d="M 35.983085,20.557267 L 32.986379,17.741128 L 47.536767,1.0012484 L 29.463656,14.208861 L 26.28779,11.024392 L 24.100981,22.5 L 35.983085,20.557267 z "
+ style="opacity:1;color:black;fill:url(#linearGradient2911);fill-opacity:1.0;fill-rule:evenodd;stroke:url(#linearGradient2903);stroke-width:0.99999994;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:nodetypes="ccccccc" />
+ <path
+ sodipodi:type="inkscape:offset"
+ inkscape:radius="-0.92676479"
+ inkscape:original="M 47.53125 1 L 29.46875 14.21875 L 26.28125 11.03125 L 24.09375 22.5 L 35.96875 20.5625 L 33 17.75 L 47.53125 1 z "
+ xlink:href="#path2890"
+ style="opacity:0.40703518;color:black;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient2895);stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path2887"
+ inkscape:href="#path2890"
+ d="M 41.46875,6.59375 L 30.03125,14.96875 C 29.659036,15.247768 29.137662,15.207663 28.8125,14.875 L 26.875,12.9375 L 25.25,21.375 L 33.96875,19.96875 L 32.375,18.4375 C 32.014256,18.09614 31.986693,17.5311 32.3125,17.15625 L 41.46875,6.59375 z " />
+</svg>
diff --git a/xpm/gui_log.svg b/xpm/gui_log.svg
new file mode 100644
index 00000000..33a1ac9e
--- /dev/null
+++ b/xpm/gui_log.svg
@@ -0,0 +1,352 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48px"
+ height="48px"
+ id="svg5490"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="/home/andreas/project/gnome-icon-theme/scalable/actions"
+ sodipodi:docname="format-justify-left.svg"
+ inkscape:export-filename="/home/andreas/project/gnome-icon-theme/scalable/actions/format-justify-fill.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs5492">
+ <linearGradient
+ y2="10.982666"
+ x2="5.4959755"
+ y1="37.668934"
+ x1="37.926636"
+ gradientTransform="matrix(0.982804,0,0,1.3,-40.71647,-6.281051)"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient2457"
+ xlink:href="#linearGradient6732"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient2378">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop2380" />
+ <stop
+ id="stop4146"
+ offset="0.25"
+ style="stop-color:#fefede;stop-opacity:0.91836733;" />
+ <stop
+ id="stop2386"
+ offset="0.5"
+ style="stop-color:#f5f328;stop-opacity:1;" />
+ <stop
+ style="stop-color:#f5f32d;stop-opacity:0.12234043;"
+ offset="1"
+ id="stop2382" />
+ </linearGradient>
+ <linearGradient
+ y2="39.999443"
+ x2="25.058096"
+ y1="47.027729"
+ x1="25.058096"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient2098"
+ xlink:href="#linearGradient3702"
+ inkscape:collect="always" />
+ <radialGradient
+ r="2.5"
+ fy="43.5"
+ fx="4.9929786"
+ cy="43.5"
+ cx="4.9929786"
+ gradientTransform="matrix(2.003784,0,0,1.4,-20.01187,-104.4)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient2096"
+ xlink:href="#linearGradient3688"
+ inkscape:collect="always" />
+ <radialGradient
+ r="2.5"
+ fy="43.5"
+ fx="4.9929786"
+ cy="43.5"
+ cx="4.9929786"
+ gradientTransform="matrix(2.003784,0,0,1.4,27.98813,-17.4)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient2094"
+ xlink:href="#linearGradient3688"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient3688"
+ inkscape:collect="always">
+ <stop
+ id="stop3690"
+ offset="0"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ id="stop3692"
+ offset="1"
+ style="stop-color:black;stop-opacity:0;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3702">
+ <stop
+ id="stop3704"
+ offset="0"
+ style="stop-color:black;stop-opacity:0;" />
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0.5"
+ id="stop3710" />
+ <stop
+ id="stop3706"
+ offset="1"
+ style="stop-color:black;stop-opacity:0;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient6732">
+ <stop
+ id="stop6734"
+ offset="0"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ <stop
+ id="stop6736"
+ offset="1"
+ style="stop-color:#dddddd;stop-opacity:1;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient4585">
+ <stop
+ id="stop4587"
+ offset="0"
+ style="stop-color:#9e9e9e;stop-opacity:1;" />
+ <stop
+ id="stop4589"
+ offset="1"
+ style="stop-color:#dddddd;stop-opacity:0;" />
+ </linearGradient>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="14"
+ inkscape:cx="27.606432"
+ inkscape:cy="27.154804"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:window-width="1674"
+ inkscape:window-height="970"
+ inkscape:window-x="0"
+ inkscape:window-y="25" />
+ <metadata
+ id="metadata5495">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>Justify fill</dc:title>
+ <dc:date>October 2006</dc:date>
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Andreas Nilsson</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:source>http://www.gnome.org</dc:source>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>justify</rdf:li>
+ <rdf:li>format</rdf:li>
+ <rdf:li>align</rdf:li>
+ <rdf:li>left</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/SourceCode" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <g
+ id="g5646"
+ transform="translate(41.34165,-0.918943)">
+ <g
+ inkscape:label="Shadow"
+ id="layer6"
+ transform="matrix(1.1,0,0,1,-43.74165,5.918957)">
+ <g
+ transform="matrix(1,0,0,0.555556,-4.549998e-7,13.88887)"
+ inkscape:label="Shadow"
+ id="g2043">
+ <g
+ inkscape:label="Shadow"
+ id="g2036"
+ style="display:inline">
+ <g
+ transform="matrix(1.052632,0,0,1.285713,-1.263158,-13.42854)"
+ style="opacity:0.4"
+ id="g3712">
+ <rect
+ style="opacity:1;fill:url(#radialGradient2094);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect2801"
+ width="5"
+ height="7"
+ x="38"
+ y="40" />
+ <rect
+ style="opacity:1;fill:url(#radialGradient2096);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect3696"
+ width="5"
+ height="7"
+ x="-10"
+ y="-47"
+ transform="scale(-1,-1)" />
+ <rect
+ style="opacity:1;fill:url(#linearGradient2098);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect3700"
+ width="28"
+ height="7.0000005"
+ x="10"
+ y="40" />
+ </g>
+ </g>
+ </g>
+ <g
+ transform="translate(50.6887,6.21499)"
+ style="display:inline"
+ inkscape:label="pixmap"
+ id="g2285" />
+ <g
+ id="g891"
+ transform="matrix(0.186703,0,0,0.186703,29.5814,63.83798)" />
+ </g>
+ <g
+ id="g5657"
+ inkscape:label="Base"
+ style="display:inline" />
+ <g
+ style="display:inline"
+ inkscape:label="Text"
+ id="layer5">
+ <rect
+ inkscape:r_cy="true"
+ inkscape:r_cx="true"
+ ry="1.4314268"
+ rx="1.4314268"
+ y="5.4189425"
+ x="-36.785221"
+ height="39"
+ width="38.943569"
+ id="rect2373"
+ style="color:black;fill:url(#linearGradient2457);fill-opacity:1;fill-rule:evenodd;stroke:#939393;stroke-width:1.00000012;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <rect
+ style="color:black;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:white;stroke-width:0.99999958;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect2423"
+ width="36.999981"
+ height="37.000008"
+ x="-35.841633"
+ y="6.4189281"
+ rx="0.5728178"
+ ry="0.5728178"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ </g>
+ </g>
+ <rect
+ style="opacity:0.4;color:black;fill:black;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect6916"
+ width="16"
+ height="0.99999905"
+ x="10"
+ y="11.000001"
+ rx="0"
+ ry="0"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <rect
+ style="opacity:0.4;color:black;fill:black;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect6919"
+ width="28"
+ height="0.99999809"
+ x="10"
+ y="16.000002"
+ rx="0"
+ ry="0"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <rect
+ style="opacity:0.4;color:black;fill:black;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect6921"
+ width="24"
+ height="0.99999809"
+ x="10"
+ y="21.000002"
+ rx="0"
+ ry="0"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <rect
+ style="opacity:0.4;color:black;fill:black;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect6925"
+ width="13"
+ height="0.99999809"
+ x="10"
+ y="26.000002"
+ rx="0"
+ ry="0"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <rect
+ style="opacity:0.4;color:black;fill:black;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect6927"
+ width="21"
+ height="0.99999809"
+ x="10"
+ y="31.000002"
+ rx="0"
+ ry="0"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ <rect
+ style="opacity:0.4;color:black;fill:black;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect6933"
+ width="12"
+ height="1.0187454"
+ x="10"
+ y="35.981255"
+ rx="0"
+ ry="0"
+ inkscape:r_cx="true"
+ inkscape:r_cy="true" />
+ </g>
+</svg>
diff --git a/xpm/gui_map.svg b/xpm/gui_map.svg
new file mode 100644
index 00000000..efdc2662
--- /dev/null
+++ b/xpm/gui_map.svg
@@ -0,0 +1,1015 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ inkscape:export-ydpi="90.000000"
+ inkscape:export-xdpi="90.000000"
+ inkscape:export-filename="/home/jimmac/Desktop/wi-fi.png"
+ width="48px"
+ height="48px"
+ id="svg11300"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="/home/lapo/Icone/cvs/gnome-icon-theme/scalable/categories"
+ sodipodi:docname="applications-internet.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3">
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient4873">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop4875" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop4877" />
+ </linearGradient>
+ <radialGradient
+ r="10.625"
+ fy="4.625"
+ fx="62.625"
+ cy="4.625"
+ cx="62.625"
+ gradientTransform="matrix(1,0,0,0.341176,1.298961e-14,3.047059)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient9169"
+ xlink:href="#linearGradient8838"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient8838"
+ inkscape:collect="always">
+ <stop
+ id="stop8840"
+ offset="0"
+ style="stop-color:#000000;stop-opacity:1;" />
+ <stop
+ id="stop8842"
+ offset="1"
+ style="stop-color:#000000;stop-opacity:0;" />
+ </linearGradient>
+ <radialGradient
+ r="9.7552835"
+ fy="-8.7256308"
+ fx="62.200352"
+ cy="-8.7256308"
+ cx="62.200352"
+ gradientTransform="matrix(1.122354,-2.185101e-15,2.185149e-15,1.122379,-7.610472,1.067717)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient9171"
+ xlink:href="#linearGradient8647"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient8647">
+ <stop
+ id="stop8649"
+ offset="0"
+ style="stop-color:#8fb1dc;stop-opacity:1;" />
+ <stop
+ id="stop8651"
+ offset="1"
+ style="stop-color:#3465a4;stop-opacity:1;" />
+ </linearGradient>
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,1.662905e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8748"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient8740"
+ inkscape:collect="always">
+ <stop
+ id="stop8742"
+ offset="0"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ <stop
+ id="stop8744"
+ offset="1"
+ style="stop-color:#ffffff;stop-opacity:0;" />
+ </linearGradient>
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,1.662905e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8750"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,-1.618775e-13,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8752"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,-6.799488e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient9173"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,1.662905e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8756"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,1.662905e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8758"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,-1.906811e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8760"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,-1.960516e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient9175"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,1.662905e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8764"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,-1.965096e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8766"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,-2.68581e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient9177"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,1.662905e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8770"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,1.662905e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8772"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,-1.618775e-13,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8774"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,-6.799488e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient9179"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,1.662905e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8778"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,1.662905e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8780"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,-2.257223e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8782"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,-2.79498e-14,0.79739)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient9181"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,1.662905e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8786"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,-8.035238e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8788"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,-4.638683e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient9183"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,1.662905e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8792"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,1.662905e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8794"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,1.662905e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8796"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,1.662905e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8798"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,1.662905e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8800"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,1.662905e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8802"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,1.662905e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8804"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,1.662905e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8806"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,1.662905e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8808"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,1.662905e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8810"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="8.61745"
+ fy="18.944481"
+ fx="24.652485"
+ cy="18.94449"
+ cx="24.652573"
+ gradientTransform="matrix(7.657394e-2,2.760516,-1.969551,5.463895e-2,60.09901,-55.47179)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient9185"
+ xlink:href="#linearGradient8924"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient8924">
+ <stop
+ style="stop-color:#cee14b"
+ offset="0"
+ id="stop8926" />
+ <stop
+ style="stop-color:#9db029"
+ offset="1"
+ id="stop8928" />
+ </linearGradient>
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,-4.23828e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8812"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="8.61745"
+ fy="18.944481"
+ fx="24.652485"
+ cy="18.94449"
+ cx="24.652573"
+ gradientTransform="matrix(6.822876e-2,2.459669,-1.754905,4.868429e-2,55.12882,-46.82188)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient9187"
+ xlink:href="#linearGradient8924"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(0.891018,0,0,0.828854,1.579517,2.39052)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient9189"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="4.13475"
+ fy="14.542329"
+ fx="25.135332"
+ cy="14.542349"
+ cx="25.135374"
+ gradientTransform="matrix(0.159592,5.753335,-0.8072,2.23703e-2,32.87305,-131.6974)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient9191"
+ xlink:href="#linearGradient8930"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient8930">
+ <stop
+ style="stop-color:#cee14b"
+ offset="0"
+ id="stop8932" />
+ <stop
+ style="stop-color:#9db029"
+ offset="1"
+ id="stop8934" />
+ </linearGradient>
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,-5.087595e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8816"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="4.13475"
+ fy="14.542329"
+ fx="25.135332"
+ cy="14.542349"
+ cx="25.135374"
+ gradientTransform="matrix(0.159592,5.753335,-0.8072,2.23703e-2,32.87305,-130.867)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient9193"
+ xlink:href="#linearGradient8930"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,-3.093343e-14,0.589884)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient9195"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="2.97195"
+ fy="17.573889"
+ fx="24.478539"
+ cy="17.573915"
+ cx="24.478569"
+ gradientTransform="matrix(0.222034,8.004376,-0.597156,1.656095e-2,29.5454,-182.3268)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient9197"
+ xlink:href="#linearGradient8912"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient8912">
+ <stop
+ id="stop8914"
+ offset="0"
+ style="stop-color:#cee14b" />
+ <stop
+ id="stop8916"
+ offset="1"
+ style="stop-color:#9db029" />
+ </linearGradient>
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,-1.223188e-13,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8820"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="2.97195"
+ fy="17.573889"
+ fx="24.478539"
+ cy="17.573915"
+ cx="24.478569"
+ gradientTransform="matrix(0.222034,8.004376,-0.597156,1.656095e-2,29.85665,-181.6002)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient9199"
+ xlink:href="#linearGradient8912"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,0.311259,0.486131)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient9201"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="9.82225"
+ fy="17.257843"
+ fx="25.968998"
+ cy="17.257854"
+ cx="25.969097"
+ gradientTransform="matrix(6.718136e-2,2.42191,-1.629357,4.51789e-2,52.36869,-50.34012)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient9203"
+ xlink:href="#linearGradient8918"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient8918">
+ <stop
+ style="stop-color:#cee14b"
+ offset="0"
+ id="stop8920" />
+ <stop
+ style="stop-color:#9db029"
+ offset="1"
+ id="stop8922" />
+ </linearGradient>
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(1,0,0,0.930233,-3.15581e-14,-0.240141)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient8824"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <radialGradient
+ r="9.82225"
+ fy="17.257843"
+ fx="25.968998"
+ cy="17.257854"
+ cx="25.969097"
+ gradientTransform="matrix(6.168149e-2,2.223638,-1.495968,4.148028e-2,50.51125,-44.50839)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient9205"
+ xlink:href="#linearGradient8918"
+ inkscape:collect="always" />
+ <radialGradient
+ r="10.081216"
+ fy="-3.4420195"
+ fx="62.225393"
+ cy="-3.4420195"
+ cx="62.225393"
+ gradientTransform="matrix(0.918134,0,0,0.854079,2.429764,1.490099)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient9207"
+ xlink:href="#linearGradient8740"
+ inkscape:collect="always" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4873"
+ id="linearGradient4879"
+ x1="63.397362"
+ y1="-9.3832779"
+ x2="68.910904"
+ y2="16.839214"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ stroke="#555753"
+ fill="#eeeeec"
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="0.25490196"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="2"
+ inkscape:cx="16.217641"
+ inkscape:cy="22.472776"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:showpageshadow="false"
+ inkscape:window-width="822"
+ inkscape:window-height="549"
+ inkscape:window-x="234"
+ inkscape:window-y="201" />
+ <metadata
+ id="metadata4">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:source>http://jimmac.musichall.cz</dc:source>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
+ <dc:title>Web Browser</dc:title>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/SourceCode" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <g
+ inkscape:label="Layer 1"
+ id="g3020"
+ transform="matrix(1.673435,0,0,1.673435,-3.189256,-2.668541)">
+ <g
+ transform="matrix(1.284706,0,0,1.284706,-63.89629,19.96894)"
+ id="g8936"
+ style="display:inline">
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.56043958;color:#000000;fill:url(#radialGradient9169);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.99999988;stroke-linecap:butt;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path8836"
+ sodipodi:cx="62.625"
+ sodipodi:cy="4.625"
+ sodipodi:rx="10.625"
+ sodipodi:ry="3.625"
+ d="M 73.25 4.625 A 10.625 3.625 0 1 1 52,4.625 A 10.625 3.625 0 1 1 73.25 4.625 z"
+ transform="matrix(1,0,0,1.192473,-0.590821,-2.378705)" />
+ <path
+ style="fill:url(#radialGradient9171);fill-opacity:1;fill-rule:nonzero;stroke:#204a87;stroke-width:0.46514398;stroke-miterlimit:4;stroke-dasharray:none"
+ d="M 71.455637,-3.5111605 C 71.455637,1.6006722 67.3116,5.7446615 62.20047,5.7446615 C 57.088872,5.7446615 52.94507,1.6006253 52.94507,-3.5111605 C 52.94507,-8.6227588 57.088872,-12.766327 62.20047,-12.766327 C 67.3116,-12.766327 71.455637,-8.6227588 71.455637,-3.5111605 L 71.455637,-3.5111605 z "
+ id="path6495" />
+ <path
+ id="path8655"
+ d="M 70.945908,-3.5111451 C 70.945908,1.3191267 67.030126,5.234864 62.200518,5.234864 C 57.370468,5.234864 53.454907,1.3190823 53.454907,-3.5111451 C 53.454907,-8.3411954 57.370468,-12.256535 62.200518,-12.256535 C 67.030126,-12.256535 70.945908,-8.3411954 70.945908,-3.5111451 L 70.945908,-3.5111451 z "
+ style="opacity:0.52747253;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient4879);stroke-width:0.46514425;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <image
+ style="opacity:0.75;fill:#ffffff;fill-rule:nonzero;stroke:url(#radialGradient8748);stroke-miterlimit:4"
+ width="10.784556"
+ height="16.411282"
+ href="62169F0D.png"
+ id="image6522"
+ x="61.522053"
+ y="-11.413214" />
+ <image
+ style="opacity:0.75;fill:#ffffff;fill-rule:nonzero;stroke:url(#radialGradient8750);stroke-miterlimit:4"
+ width="2.3444688"
+ height="2.3444688"
+ href="62169F0E.png"
+ id="image6530"
+ x="61.990948"
+ y="-10.94432" />
+ <g
+ transform="matrix(0.468894,0,0,0.468894,50.39042,-14.57365)"
+ style="fill:#9db029;fill-rule:nonzero;stroke:url(#radialGradient8752);stroke-miterlimit:4"
+ id="g6532">
+ <path
+ d="M 26.0703,9.2363 L 25.9971,9.7295 L 26.5069,10.0586 L 27.378,9.4829 L 26.9425,8.9892 L 26.3605,9.3188 L 26.0705,9.2363"
+ id="path6534"
+ style="fill:#9db029;stroke:url(#radialGradient9173)" />
+ </g>
+ <image
+ style="opacity:0.75;fill:#ffffff;fill-rule:nonzero;stroke:url(#radialGradient8756);stroke-miterlimit:4"
+ width="5.6267252"
+ height="4.6889377"
+ href="62169F0F.png"
+ id="image6538"
+ x="58.708691"
+ y="-12.819895" />
+ <image
+ style="opacity:0.75;fill:#ffffff;fill-rule:nonzero;stroke:url(#radialGradient8758);stroke-miterlimit:4"
+ width="2.3444688"
+ height="2.3444688"
+ href="62169F10.png"
+ id="image6546"
+ x="62.928734"
+ y="-9.5376387" />
+ <g
+ transform="matrix(0.468894,0,0,0.468894,49.7717,-14.57365)"
+ style="fill:#9db029;fill-rule:nonzero;stroke:url(#radialGradient8760);stroke-miterlimit:4"
+ id="g6548">
+ <path
+ d="M 28.833,12.7749 L 28.542,12.0337 L 28.0322,12.1987 L 28.1787,13.103 L 28.833,12.7749"
+ id="path6550"
+ style="fill:#9db029;stroke:url(#radialGradient9175)" />
+ </g>
+ <image
+ style="opacity:0.75;fill:#ffffff;fill-rule:nonzero;stroke:url(#radialGradient8764);stroke-miterlimit:4"
+ width="2.3444688"
+ height="3.2822564"
+ href="62169F11.png"
+ id="image6554"
+ x="63.397629"
+ y="-10.006532" />
+ <g
+ transform="matrix(0.468894,0,0,0.468894,49.94848,-14.57365)"
+ style="fill:#9db029;fill-rule:nonzero;stroke:url(#radialGradient8766);stroke-miterlimit:4"
+ id="g6556">
+ <path
+ d="M 29.123,12.6089 L 28.9775,13.5972 L 29.7773,13.4322 L 30.3584,12.857 L 29.8496,12.3629 C 29.6787,11.9078 29.4824,11.483 29.2685,11.0465 L 28.833,11.0465 L 28.833,11.5397 L 29.123,11.8688 L 29.123,12.609"
+ id="path6558"
+ style="fill:#9db029;stroke:url(#radialGradient9177)" />
+ </g>
+ <image
+ style="opacity:0.75;fill:#ffffff;fill-rule:nonzero;stroke:url(#radialGradient8770);stroke-miterlimit:4"
+ width="9.8467684"
+ height="17.34907"
+ href="62169F12.png"
+ id="image6562"
+ x="52.144176"
+ y="-11.413214" />
+ <image
+ style="opacity:0.75;fill:#ffffff;fill-rule:nonzero;stroke:url(#radialGradient8772);stroke-miterlimit:4"
+ width="2.3444688"
+ height="2.3444688"
+ href="62169F13.png"
+ id="image6570"
+ x="57.770901"
+ y="-10.94432" />
+ <g
+ transform="matrix(0.468894,0,0,0.468894,50.39042,-14.57365)"
+ style="fill:#9db029;fill-rule:nonzero;stroke:url(#radialGradient8774);stroke-miterlimit:4"
+ id="g6572">
+ <path
+ d="M 16.7656,9.5649 L 17.4922,10.0586 L 18.0742,10.0586 L 18.0742,9.4829 L 17.3476,9.1538 L 16.7656,9.5649"
+ id="path6574"
+ style="fill:#9db029;stroke:url(#radialGradient9179)" />
+ </g>
+ <image
+ style="opacity:0.75;fill:#ffffff;fill-rule:nonzero;stroke:url(#radialGradient8778);stroke-miterlimit:4"
+ width="4.2200437"
+ height="3.2822564"
+ href="62169F14.png"
+ id="image6578"
+ x="56.36422"
+ y="-11.882107" />
+ <image
+ style="opacity:0.75;fill:#ffffff;fill-rule:nonzero;stroke:url(#radialGradient8780);stroke-miterlimit:4"
+ width="3.7511499"
+ height="2.8133626"
+ href="2D44FCEC.png"
+ id="image6606"
+ x="57.30201"
+ y="-12.819895" />
+ <g
+ transform="matrix(0.468894,0,0,0.468894,50.96494,-14.52946)"
+ style="fill:#9db029;fill-rule:nonzero;stroke:url(#radialGradient8782);stroke-miterlimit:4"
+ id="g6608">
+ <path
+ d="M 17.4922,7.887132 L 17.856,7.558532 L 18.5831,7.393932 C 19.0811,7.151732 19.5811,6.988632 20.1095,6.817732 L 19.8195,6.324032 L 18.881,6.458832 L 18.4376,6.900732 L 17.7066,7.006732 L 17.0567,7.311932 L 16.7408,7.464732 L 16.5479,7.723032 L 17.4922,7.887132"
+ id="path6610"
+ style="fill:#9db029;stroke:url(#radialGradient9181)" />
+ </g>
+ <image
+ style="opacity:0.75;fill:#ffffff;fill-rule:nonzero;stroke:url(#radialGradient8786);stroke-miterlimit:4"
+ width="2.3444688"
+ height="2.3444688"
+ href="2D44FCED.png"
+ id="image6614"
+ x="58.239796"
+ y="-8.5998507" />
+ <g
+ transform="matrix(0.468894,0,0,0.468894,50.56718,-14.30851)"
+ style="fill:#9db029;fill-rule:nonzero;stroke:url(#radialGradient8788);stroke-miterlimit:4"
+ id="g6616">
+ <path
+ d="M 18.7285,14.6665 L 19.165,14.0083 L 18.5102,13.5151 L 18.7285,14.6665"
+ id="path6618"
+ style="fill:#9db029;stroke:url(#radialGradient9183)" />
+ </g>
+ <image
+ style="opacity:0.15750002;fill:#ffffff;fill-rule:nonzero;stroke:url(#radialGradient8792);stroke-miterlimit:4"
+ width="10.784556"
+ height="16.411282"
+ href="2D44FCEE.png"
+ id="image6624"
+ x="61.522053"
+ y="-11.413214" />
+ <image
+ style="opacity:0.15750002;fill:#ffffff;fill-rule:nonzero;stroke:url(#radialGradient8794);stroke-miterlimit:4"
+ width="2.3444688"
+ height="2.3444688"
+ href="2D44FCEF.png"
+ id="image6632"
+ x="61.990948"
+ y="-10.94432" />
+ <image
+ style="opacity:0.15750002;fill:#ffffff;fill-rule:nonzero;stroke:url(#radialGradient8796);stroke-miterlimit:4"
+ width="5.6267252"
+ height="4.6889377"
+ href="2D44FCF0.png"
+ id="image6640"
+ x="58.708691"
+ y="-12.819895" />
+ <image
+ style="opacity:0.15750002;fill:#ffffff;fill-rule:nonzero;stroke:url(#radialGradient8798);stroke-miterlimit:4"
+ width="2.3444688"
+ height="2.3444688"
+ href="2D44FCF1.png"
+ id="image6648"
+ x="62.928734"
+ y="-9.5376387" />
+ <image
+ style="opacity:0.15750002;fill:#ffffff;fill-rule:nonzero;stroke:url(#radialGradient8800);stroke-miterlimit:4"
+ width="2.3444688"
+ height="3.2822564"
+ href="2D44FCF2.png"
+ id="image6656"
+ x="63.397629"
+ y="-10.006532" />
+ <image
+ style="opacity:0.15750002;fill:#ffffff;fill-rule:nonzero;stroke:url(#radialGradient8802);stroke-miterlimit:4"
+ width="9.8467684"
+ height="17.34907"
+ href="2D44FCF3.png"
+ id="image6664"
+ x="52.144176"
+ y="-11.413214" />
+ <image
+ style="opacity:0.15750002;fill:#ffffff;fill-rule:nonzero;stroke:url(#radialGradient8804);stroke-miterlimit:4"
+ width="2.3444688"
+ height="2.3444688"
+ href="2D44FCF4.png"
+ id="image6672"
+ x="57.770901"
+ y="-10.94432" />
+ <image
+ style="opacity:0.15750002;fill:#ffffff;fill-rule:nonzero;stroke:url(#radialGradient8806);stroke-miterlimit:4"
+ width="4.2200437"
+ height="3.2822564"
+ href="2D44FCF5.png"
+ id="image6680"
+ x="56.36422"
+ y="-11.882107" />
+ <image
+ style="opacity:0.15750002;fill:#ffffff;fill-rule:nonzero;stroke:url(#radialGradient8808);stroke-miterlimit:4"
+ width="3.7511499"
+ height="2.8133626"
+ href="2D44FD11.png"
+ id="image6708"
+ x="57.30201"
+ y="-12.819895" />
+ <image
+ style="opacity:0.15750002;fill:#ffffff;fill-rule:nonzero;stroke:url(#radialGradient8810);stroke-miterlimit:4"
+ width="2.3444688"
+ height="2.3444688"
+ href="2D44FD12.png"
+ id="image6716"
+ x="58.239796"
+ y="-8.5998507" />
+ <g
+ transform="matrix(0.468894,0,0,0.468894,50.74397,-14.61784)"
+ style="fill:url(#radialGradient9185);fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient8812);stroke-miterlimit:4"
+ id="g6564">
+ <path
+ d="M 17.943241,27.768799 L 17.424668,26.742079 L 16.453191,26.522353 L 15.935064,25.130138 L 14.639881,25.276354 L 13.539117,24.470606 L 12.372685,25.496524 L 12.372685,25.658333 C 12.019842,25.55649 11.586095,25.54259 11.271922,25.349417 L 11.012635,24.616733 L 11.012635,23.810095 L 10.235579,23.883158 C 10.300445,23.369754 10.364776,22.85724 10.430088,22.343925 L 9.9762924,22.343925 L 9.523388,22.930393 L 9.0695925,23.149672 L 8.4217333,22.784177 L 8.3568672,21.977538 L 8.4865103,21.097836 L 9.4584328,20.365152 L 10.23549,20.365152 L 10.364687,19.9249 L 11.336164,20.144179 L 12.0488,21.024772 L 12.178443,19.557711 L 13.409207,18.531793 L 13.862557,17.431921 L 14.769256,17.065623 L 15.287383,16.332939 L 16.452924,16.111966 L 17.036363,15.233155 C 16.45337,15.233155 15.870376,15.233155 15.287383,15.233155 L 16.388503,14.719751 L 17.165115,14.719751 L 18.26668,14.352562 L 18.396323,13.914003 L 18.007394,13.546815 L 17.554044,13.399797 L 17.683687,12.960347 L 17.35998,12.300815 L 16.582478,12.593158 L 16.712121,12.007136 L 15.805421,11.493731 L 15.093231,12.739285 L 15.157651,13.179537 L 14.445461,13.473662 L 13.991665,14.426428 L 13.797601,13.546726 L 12.566838,13.033321 L 12.372329,12.37379 L 13.991665,11.420133 L 14.704301,10.760601 L 14.769167,9.9544084 L 14.380684,9.7342382 L 13.862557,9.6607292 L 13.53885,10.467367 C 13.53885,10.467367 12.9972,10.573488 12.857934,10.607881 C 11.079373,12.246819 7.4857189,15.784785 6.650835,22.463945 C 6.6838918,22.618804 7.2560145,23.516772 7.2560145,23.516772 L 8.6160643,24.322519 L 9.9761142,24.689708 L 10.559553,25.423194 L 11.465807,26.082725 L 11.983934,26.009662 L 12.372418,26.184569 L 12.372418,26.302896 L 11.854647,27.695557 L 11.465718,28.282025 L 11.595361,28.57615 L 11.271654,29.674241 L 12.437641,31.800833 L 13.603181,32.827553 L 14.121754,33.560237 L 14.056531,35.100362 L 14.445461,35.979173 L 14.056531,37.665514 C 14.056531,37.665514 14.026058,37.655089 14.075688,37.823848 C 14.125763,37.992695 16.150958,39.116893 16.27971,39.021198 C 16.408017,38.92372 16.517701,38.83845 16.517701,38.83845 L 16.388503,38.472954 L 16.906274,37.95955 L 17.100783,37.446145 L 17.943063,37.15202 L 18.590476,35.538832 L 18.396413,35.100273 L 18.848871,34.440741 L 19.820794,34.219769 L 20.339366,33.046833 L 20.209723,31.581554 L 20.98678,30.481681 L 21.116423,29.381808 C 20.053082,28.854504 18.998473,28.311518 17.943063,27.76862"
+ id="path6566"
+ style="fill:url(#radialGradient9187);fill-opacity:1;stroke:url(#radialGradient9189)" />
+ </g>
+ <g
+ transform="matrix(0.468894,0,0,0.468894,50.523,-14.44107)"
+ style="fill:url(#radialGradient9191);fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient8816);stroke-miterlimit:4"
+ id="g6540">
+ <path
+ d="M 26.8701,6.6933256 L 24.9795,5.9526256 L 22.7998,6.1992256 L 20.1094,6.9394256 L 19.6006,7.4335256 L 21.2725,8.5849256 L 21.2725,9.2431256 L 20.6182,9.9013256 L 21.4912,11.630324 L 22.0713,11.300224 L 22.7998,10.148825 C 23.9228,9.8016256 24.9297,9.4081256 25.9971,8.9144256 L 26.8701,6.6932256"
+ id="path6542"
+ style="fill:url(#radialGradient9193);fill-opacity:1;stroke:url(#radialGradient9195)" />
+ </g>
+ <g
+ transform="matrix(0.468894,0,0,0.468894,50.83236,-14.75043)"
+ style="fill:url(#radialGradient9197);fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient8820);stroke-miterlimit:4"
+ id="g6580">
+ <path
+ d="M 15.187259,9.6334723 L 14.823459,10.538271 L 15.550559,10.538271 L 15.914359,9.7154723 C 16.227859,9.4937723 16.539859,9.2706723 16.859159,9.0572723 L 17.586259,9.3043723 C 18.070659,9.6334723 18.555059,9.9625723 19.039859,10.291172 L 19.767359,9.6334723 L 18.967059,9.3043723 L 18.603259,8.5636723 L 17.222359,8.3990723 L 17.149559,7.9874723 L 16.495259,8.1524723 L 16.204859,8.7282723 L 15.841059,7.9875723 L 15.696059,8.3166723 L 15.768859,9.1394723 L 15.187259,9.6334723"
+ id="path6582"
+ style="fill:url(#radialGradient9199);fill-opacity:1;stroke:url(#radialGradient9201)" />
+ </g>
+ <g
+ transform="matrix(0.468894,0,0,0.468894,50.12526,-14.48526)"
+ style="fill:url(#radialGradient9203);fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient8824);stroke-miterlimit:4"
+ id="g6626">
+ <path
+ d="M 42.893123,20.729176 C 42.893123,20.97037 42.893123,20.729176 42.893123,20.729176 L 42.392832,21.295848 C 42.086175,20.934471 41.741875,20.630568 41.392249,20.313169 L 40.624781,20.4261 L 39.923602,19.633475 L 39.923602,20.614409 L 40.524337,21.068977 L 40.924185,21.521801 L 41.458539,20.917485 C 41.593045,21.169421 41.725716,21.421357 41.859304,21.673293 L 41.859304,22.428275 L 41.257651,23.107877 L 40.156625,23.863685 L 39.322775,24.69579 L 38.788421,24.089638 L 39.055598,23.410035 L 38.522071,22.80572 L 37.621014,20.87975 L 36.853546,20.011838 L 36.652658,20.237791 L 36.953898,21.333492 L 37.52057,21.975451 C 37.844212,22.909744 38.164366,23.802721 38.58937,24.69579 C 39.248406,24.69579 39.869708,24.625828 40.524245,24.54338 L 40.524245,25.072409 L 39.723541,27.036481 L 38.989217,27.86675 L 38.388482,29.152504 C 38.388482,29.857264 38.388482,30.562024 38.388482,31.266692 L 38.58937,32.098797 L 38.255812,32.475415 L 37.52057,32.929065 L 36.753102,33.571024 L 37.3879,34.288362 L 36.519988,35.045089 L 36.686721,35.534638 L 35.384807,37.008702 L 34.517813,37.008702 L 33.783489,37.462352 L 33.315425,37.462352 L 33.315425,36.858036 L 33.116373,35.647568 C 32.858102,34.889006 32.589181,34.13586 32.315668,33.382715 C 32.315668,32.826785 32.348813,32.276272 32.382049,31.720433 L 32.716526,30.965452 L 32.248461,30.05806 L 32.282524,28.811785 L 31.647726,28.094447 L 31.965125,27.056129 L 31.448674,26.470176 L 30.5467,26.470176 L 30.246378,26.130375 L 29.345321,26.697506 L 28.978619,26.28104 L 28.143851,26.998746 C 27.577179,26.356327 27.009588,25.714368 26.44209,25.072409 L 25.774974,23.485414 L 26.375709,22.579859 L 26.042151,22.202414 L 26.775556,20.463835 C 27.378127,19.714271 28.007508,18.995188 28.644142,18.273443 L 29.779231,17.971285 L 31.047083,17.820619 L 31.914995,18.04749 L 33.14961,19.292847 L 33.583611,18.80238 L 34.183428,18.727093 L 35.318517,19.104538 L 36.18643,19.104538 L 36.787165,18.575509 L 37.054342,18.198064 L 36.452688,17.820619 L 35.451188,17.745332 C 35.173269,17.359808 34.914998,16.954543 34.58502,16.611988 L 34.250544,16.762653 L 34.116955,17.745332 L 33.51622,17.065729 L 33.38355,16.309003 L 32.716434,15.781811 L 32.448339,15.781811 L 33.116281,16.536792 L 32.849104,17.216395 L 32.315577,17.367061 L 32.649135,16.687458 L 32.047481,16.386218 L 31.514872,15.781903 L 30.512453,16.007855 L 30.379783,16.309095 L 29.779048,16.687458 L 29.44549,17.518645 L 28.61164,17.933733 L 28.24402,17.518645 L 27.844172,17.518645 L 27.844172,16.158521 L 28.712084,15.704871 L 29.3792,15.704871 L 29.244694,15.176761 L 28.712084,14.647732 L 29.612315,14.458504 L 30.112606,13.89275 L 30.512453,13.212229 L 31.247695,13.212229 L 31.046807,12.684119 L 31.514872,12.381961 L 31.514872,12.986276 L 32.515454,13.212229 L 33.516037,12.381961 L 33.583244,12.003598 L 34.450238,11.399741 C 34.13642,11.438762 33.822602,11.467407 33.515945,11.550866 L 33.515945,10.870437 L 33.849503,10.114996 L 33.515945,10.114996 L 32.782907,10.794599 L 32.582019,11.172503 L 32.782907,11.701991 L 32.448431,12.607546 L 31.914903,12.305388 L 31.448674,11.777278 L 30.713433,12.305388 L 30.446256,11.097216 L 31.714107,10.266488 L 31.714107,9.8128376 L 32.515638,9.284268 L 33.783489,8.981651 L 34.651401,9.284268 L 36.252719,9.5864259 L 35.852871,10.03925 L 34.984959,10.03925 L 35.852871,10.945724 L 36.519988,10.190742 L 36.72262,9.8585606 C 36.72262,9.8585606 39.281551,12.15206 40.743955,14.660861 C 42.206359,17.170489 42.893123,20.128441 42.893123,20.729176 z "
+ id="path6628"
+ style="fill:url(#radialGradient9205);fill-opacity:1;stroke:url(#radialGradient9207)" />
+ </g>
+ </g>
+ </g>
+ </g>
+</svg>
diff --git a/xpm/gui_maps.svg b/xpm/gui_maps.svg
new file mode 100644
index 00000000..92f15f91
--- /dev/null
+++ b/xpm/gui_maps.svg
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" id="svg2488" sodipodi:version="0.32" inkscape:version="0.46" width="128" height="128" version="1.0" sodipodi:docname="Map_icon.svg" inkscape:export-xdpi="180" inkscape:export-ydpi="180" inkscape:output_extension="org.inkscape.output.svg.inkscape" inkscape:export-filename="D:\tmp\Map_icon.png">
+ <metadata id="metadata2493">
+ <rdf:RDF>
+ <cc:Work rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
+ <dc:title>Map</dc:title>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>Map</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ <cc:license rdf:resource="http://creativecommons.org/licenses/by-sa/2.0/"/>
+ </cc:Work>
+ <cc:License rdf:about="http://creativecommons.org/licenses/by-sa/2.0/">
+ <cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
+ <cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/>
+ <cc:requires rdf:resource="http://web.resource.org/cc/Notice"/>
+ <cc:requires rdf:resource="http://web.resource.org/cc/Attribution"/>
+ <cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
+ <cc:requires rdf:resource="http://web.resource.org/cc/ShareAlike"/>
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <defs id="defs2491">
+ <linearGradient id="linearGradient3801">
+ <stop style="stop-color: rgb(0, 130, 0); stop-opacity: 1;" offset="0" id="stop3803"/>
+ <stop style="stop-color: rgb(0, 130, 0); stop-opacity: 0;" offset="1" id="stop3805"/>
+ </linearGradient>
+ <linearGradient id="linearGradient3793">
+ <stop style="stop-color: rgb(0, 130, 0); stop-opacity: 1;" offset="0" id="stop3795"/>
+ <stop style="stop-color: rgb(0, 130, 0); stop-opacity: 0;" offset="1" id="stop3797"/>
+ </linearGradient>
+ <inkscape:perspective sodipodi:type="inkscape:persp3d" inkscape:vp_x="0 : 24 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_z="48 : 24 : 1" inkscape:persp3d-origin="24 : 16 : 1" id="perspective45"/>
+ <linearGradient id="linearGradient4198">
+ <stop style="stop-color: rgb(255, 255, 255); stop-opacity: 1;" offset="0" id="stop4200"/>
+ <stop style="stop-color: rgb(255, 255, 255); stop-opacity: 0.57265;" offset="1" id="stop4202"/>
+ </linearGradient>
+ <linearGradient id="linearGradient4181">
+ <stop style="stop-color: rgb(204, 0, 0); stop-opacity: 1;" offset="0" id="stop4183"/>
+ <stop style="stop-color: rgb(247, 15, 15); stop-opacity: 1;" offset="1" id="stop4185"/>
+ </linearGradient>
+ <linearGradient id="linearGradient5048">
+ <stop style="stop-color: black; stop-opacity: 0;" offset="0" id="stop5050"/>
+ <stop id="stop5056" offset="0.5" style="stop-color: black; stop-opacity: 1;"/>
+ <stop style="stop-color: black; stop-opacity: 0;" offset="1" id="stop5052"/>
+ </linearGradient>
+ <linearGradient id="linearGradient3289">
+ <stop style="stop-color: rgb(255, 255, 142); stop-opacity: 1;" offset="0" id="stop3291"/>
+ <stop style="stop-color: rgb(255, 255, 255); stop-opacity: 0.533898;" offset="1" id="stop3293"/>
+ </linearGradient>
+ <linearGradient id="linearGradient7336">
+ <stop id="stop7338" offset="0" style="stop-color: rgb(236, 192, 92); stop-opacity: 1;"/>
+ <stop style="stop-color: rgb(215, 183, 86); stop-opacity: 1;" offset="0.19283746" id="stop7340"/>
+ <stop id="stop4206" offset="0.63636363" style="stop-color: rgb(226, 203, 144); stop-opacity: 1;"/>
+ <stop id="stop7342" offset="1" style="stop-color: rgb(242, 235, 160); stop-opacity: 1;"/>
+ </linearGradient>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient4181" id="linearGradient4187" x1="30.229904" y1="33.538868" x2="16.130783" y2="13.761145" gradientUnits="userSpaceOnUse"/>
+ <linearGradient id="aigrd1" gradientUnits="userSpaceOnUse" x1="12.4873" y1="3.7319" x2="31.081301" y2="36.032799">
+ <stop offset="0" style="stop-color: rgb(210, 210, 210); stroke-dasharray: none; stroke-miterlimit: 4; stroke-width: 1.21667;" id="stop16177"/>
+ <stop offset="1" style="stop-color: rgb(237, 237, 237); stroke-dasharray: none; stroke-miterlimit: 4; stroke-width: 1.21667;" id="stop16179"/>
+ </linearGradient>
+ <linearGradient id="linearGradient3300">
+ <stop id="stop3557" offset="0" style="stop-color: rgb(242, 242, 242); stop-opacity: 1;"/>
+ <stop id="stop3559" offset="1" style="stop-color: rgb(208, 208, 208); stop-opacity: 1;"/>
+ </linearGradient>
+ <linearGradient id="linearGradient3563">
+ <stop id="stop3565" offset="0" style="stop-color: rgb(255, 255, 255); stop-opacity: 1;"/>
+ <stop id="stop3567" offset="1" style="stop-color: rgb(147, 147, 147); stop-opacity: 1;"/>
+ </linearGradient>
+ <inkscape:perspective id="perspective3294" inkscape:persp3d-origin="24 : 16 : 1" inkscape:vp_z="48 : 24 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 24 : 1" sodipodi:type="inkscape:persp3d"/>
+ <linearGradient gradientTransform="matrix(0.354101, 0, 0, 0.354101, 1.63868, -0.0836492)" y2="35.569" x2="64.387703" y1="65.124001" x1="64.387703" gradientUnits="userSpaceOnUse" id="XMLID_39_">
+ <stop id="stop336" style="stop-color: rgb(255, 255, 255);" offset="0"/>
+ <stop id="stop338" style="stop-color: rgb(255, 98, 0);" offset="0.8539"/>
+ <stop id="stop340" style="stop-color: rgb(242, 93, 0);" offset="1"/>
+ <midPointStop id="midPointStop335" style="stop-color:#FFFFFF" offset="0"/>
+ <midPointStop id="midPointStop337" style="stop-color:#FFFFFF" offset="0.5"/>
+ <midPointStop id="midPointStop339" style="stop-color:#FF6200" offset="0.8539"/>
+ <midPointStop id="midPointStop341" style="stop-color:#FF6200" offset="0.5"/>
+ <midPointStop id="midPointStop343" style="stop-color:#F25D00" offset="1"/>
+ </linearGradient>
+ <linearGradient gradientTransform="matrix(0.314683, 0, 0, 0.314683, 4.12826, 3.74287)" y2="59.7995" x2="48.046001" y1="117.5205" x1="80.223602" gradientUnits="userSpaceOnUse" id="XMLID_2_">
+ <stop id="stop17" style="stop-color: rgb(204, 204, 204);" offset="0"/>
+ <stop id="stop19" style="stop-color: rgb(255, 255, 255);" offset="0.9831"/>
+ <midPointStop id="midPointStop48" style="stop-color:#CCCCCC" offset="0"/>
+ <midPointStop id="midPointStop50" style="stop-color:#CCCCCC" offset="0.5"/>
+ <midPointStop id="midPointStop52" style="stop-color:#FFFFFF" offset="0.9831"/>
+ </linearGradient>
+ <linearGradient id="linearGradient2299" inkscape:collect="always">
+ <stop id="stop2301" offset="0" style="stop-color: rgb(255, 255, 255); stop-opacity: 1;"/>
+ <stop id="stop2303" offset="1" style="stop-color: rgb(255, 255, 255); stop-opacity: 0;"/>
+ </linearGradient>
+ <linearGradient id="linearGradient2307">
+ <stop id="stop2309" offset="0" style="stop-color: rgb(237, 212, 0); stop-opacity: 1;"/>
+ <stop id="stop2311" offset="1" style="stop-color: rgb(153, 136, 0); stop-opacity: 1;"/>
+ </linearGradient>
+ <linearGradient id="linearGradient2329">
+ <stop id="stop2331" offset="0" style="stop-color: rgb(0, 0, 0); stop-opacity: 0.185567;"/>
+ <stop id="stop2333" offset="1" style="stop-color: rgb(255, 255, 255); stop-opacity: 1;"/>
+ </linearGradient>
+ <linearGradient id="linearGradient2341">
+ <stop style="stop-color: rgb(0, 0, 0); stop-opacity: 1;" offset="0" id="stop2343"/>
+ <stop style="stop-color: rgb(0, 0, 0); stop-opacity: 0;" offset="1" id="stop2345"/>
+ </linearGradient>
+ <linearGradient id="linearGradient2378" inkscape:collect="always">
+ <stop id="stop2380" offset="0" style="stop-color: rgb(87, 87, 87); stop-opacity: 1;"/>
+ <stop id="stop2382" offset="1" style="stop-color: rgb(87, 87, 87); stop-opacity: 0;"/>
+ </linearGradient>
+ <linearGradient id="linearGradient2406">
+ <stop id="stop2408" offset="0" style="stop-color: rgb(124, 126, 121); stop-opacity: 1;"/>
+ <stop style="stop-color: rgb(132, 134, 129); stop-opacity: 1;" offset="0.1724138" id="stop2414"/>
+ <stop id="stop2410" offset="1" style="stop-color: rgb(137, 140, 134); stop-opacity: 1;"/>
+ </linearGradient>
+ <inkscape:perspective id="perspective3625" inkscape:persp3d-origin="24 : 16 : 1" inkscape:vp_z="48 : 24 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 24 : 1" sodipodi:type="inkscape:persp3d"/>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient3289" id="linearGradient4034" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-0.00603462, -0.958809, 1.29051, -0.00448353, -19.5963, 45.1767)" x1="36.880539" y1="20.811714" x2="23.073864" y2="43.531128"/>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient7336" id="linearGradient4037" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-0.00268541, -0.958817, 1.29052, -0.00199517, -19.6938, 45.1029)" x1="11.002116" y1="29.756582" x2="46.998974" y2="29.756582"/>
+ <linearGradient inkscape:collect="always" xlink:href="#XMLID_2_" id="linearGradient4111" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.0393106, 0, 0, 0.0194718, 25.0392, 27.618)" x1="52.006104" y1="166.1331" x2="14.049017" y2="-42.218513"/>
+ <radialGradient inkscape:collect="always" xlink:href="#linearGradient2378" id="radialGradient4113" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.131291, 0, 0, 0.156352, 22.5903, 25.9721)" cx="24.195112" cy="10.577631" fx="24.195112" fy="10.577631" r="15.242914"/>
+ <linearGradient inkscape:collect="always" xlink:href="#XMLID_39_" id="linearGradient4115" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.041315, 0, 0, 0.041315, 23.1323, 25.8042)" x1="64.387703" y1="65.124001" x2="64.387703" y2="35.569"/>
+ <radialGradient inkscape:collect="always" xlink:href="#linearGradient2299" id="radialGradient4117" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.47838, 0, 0, 0.490192, 19.9757, 16.6503)" cx="7.5326638" cy="24.202574" fx="7.5326638" fy="24.202574" r="8.2452126"/>
+ <radialGradient inkscape:collect="always" xlink:href="#linearGradient2341" id="radialGradient4119" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.47838, 0, 0, -0.490192, 22.3346, 38.1062)" cx="11.68129" cy="19.554111" fx="11.68129" fy="19.554111" r="8.2452126"/>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient7336" id="linearGradient4160" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-0.00268541, -0.958817, 1.29052, -0.00199517, -19.6938, 45.1029)" x1="11.002116" y1="29.756582" x2="46.998974" y2="29.756582"/>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient3289" id="linearGradient4162" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-0.00603462, -0.958809, 1.29051, -0.00448353, -19.5963, 45.1767)" x1="36.880539" y1="20.811714" x2="23.073864" y2="43.531128"/>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient3289" id="linearGradient4174" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-0.00603462, -0.958809, 1.29051, -0.00448353, -19.5963, 45.1767)" x1="36.880539" y1="20.811714" x2="23.073864" y2="43.531128"/>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient7336" id="linearGradient4177" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-0.00268541, -0.958817, 1.29052, -0.00199517, -19.6938, 45.1029)" x1="11.002116" y1="29.756582" x2="46.998974" y2="29.756582"/>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient3289" id="linearGradient2483" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-0.0200831, -3.4544, 4.2948, -0.0161533, -63.1931, 164.667)" x1="36.880539" y1="20.811714" x2="23.073864" y2="43.531128"/>
+ <linearGradient inkscape:collect="always" xlink:href="#linearGradient7336" id="linearGradient2486" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-0.00893698, -3.45443, 4.29483, -0.0071882, -63.5175, 164.401)" x1="11.002116" y1="29.756582" x2="46.998974" y2="29.756582"/>
+ </defs>
+ <sodipodi:namedview inkscape:window-height="712" inkscape:window-width="1024" inkscape:pageshadow="2" inkscape:pageopacity="0" borderopacity="1.0" bordercolor="#666666" pagecolor="#000000" id="base" showgrid="true" showborder="true" showguides="true" inkscape:guide-bbox="true" inkscape:zoom="3.9609375" inkscape:cx="64" inkscape:cy="71.783949" inkscape:window-x="0" inkscape:window-y="22" inkscape:current-layer="svg2488" fill="#ef2929"/>
+ <path style="overflow: visible; marker: none; fill: url(#linearGradient2486) rgb(0, 0, 0); fill-opacity: 1; fill-rule: evenodd; stroke: rgb(197, 136, 57); stroke-width: 6.92533; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1; visibility: visible; display: block;" d="M 14.371222,124.53727 C -13.802223,92.864546 22.493553,35.947417 14.058456,3.6431714 L 121.86863,3.4627322 C 134.85599,34.562392 94.756334,88.493443 122.18139,124.35683 L 14.371222,124.53727 z" id="path6459" sodipodi:nodetypes="ccccc"/>
+ <path style="overflow: visible; marker: none; opacity: 0.629213; fill: none; fill-opacity: 1; fill-rule: evenodd; stroke: url(#linearGradient2483) rgb(0, 0, 0); stroke-width: 2.99577; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; stroke-dashoffset: 0pt; stroke-opacity: 1; visibility: visible; display: block;" d="M 16.464545,122.16589 C -8.297272,94.702188 24.327224,38.068599 17.938402,6.3046728 L 119.26131,5.9398387 C 129.65242,29.778267 94.639066,85.722539 117.02096,121.57178 L 16.464545,122.16589 z" id="path16506" sodipodi:nodetypes="ccccc"/>
+ <path style="fill: none; fill-opacity: 1; fill-rule: evenodd; stroke: rgb(0, 112, 198); stroke-width: 9.43779; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" d="M 26.108938,114.58331 C 32.39054,91.76958 32.740531,87.011272 43.11024,75.512092 C 52.314785,65.304985 81.596844,63.896358 90.619066,53.182112 C 99.64129,42.467865 100.32448,32.745999 102.06063,12.143419" id="path3216" sodipodi:nodetypes="cszz"/>
+ <g id="g3551" transform="matrix(1.58513, -0.4171, 0.385284, 1.71603, 8.86323, 8.19939)">
+ <path d="M 11.318692,9.2240568 C 16.641997,14.693047 22.769247,19.123651 29.210664,22.931105 L 27.441568,24.159843 C 21.101863,20.04489 15.052508,15.498993 9.1840818,10.652117 L 11.318692,9.2240568 z" id="path2565" style="overflow: visible; marker: none; opacity: 1; fill: rgb(204, 0, 0); fill-opacity: 1; fill-rule: nonzero; stroke: rgb(204, 0, 0); stroke-width: 2.58923; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1; visibility: visible; display: inline;"/>
+ <path d="M 26.73892,8.9210568 C 21.867631,15.95255 15.247359,21.081199 7.9065151,25.28163 L 10.087564,23.520856 C 8.7241111,24.379297 25.574485,11.804168 23.852075,10.207903 L 26.73892,8.9210568 z" id="path2575" style="overflow: visible; marker: none; opacity: 1; fill: rgb(204, 0, 0); fill-opacity: 1; fill-rule: nonzero; stroke: rgb(204, 0, 0); stroke-width: 2.58923; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1; visibility: visible; display: inline;"/>
+ </g>
+ <path style="fill: none; fill-rule: evenodd; stroke: rgb(0, 0, 0); stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: 8, 24; stroke-dashoffset: 0pt; stroke-opacity: 1;" d="M 92.338877,110.63836 L 75.194847,101.56113 L 66.496075,89.594069 L 55.376529,77.059108 L 50.115356,62.896879 L 48.728338,47.484451 L 48.728338,47.484451" id="path2473"/>
+</svg> \ No newline at end of file
diff --git a/xpm/gui_menu.svg b/xpm/gui_menu.svg
new file mode 100644
index 00000000..e81d59f1
--- /dev/null
+++ b/xpm/gui_menu.svg
@@ -0,0 +1,658 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="72"
+ height="48"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ version="1.0"
+ sodipodi:docbase="/tmp"
+ sodipodi:docname="gui_menu.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4">
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5753">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop5755" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop5757" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5745">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop5747" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop5749" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient6010">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop6012" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop6014" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5978">
+ <stop
+ id="stop5980"
+ offset="0"
+ style="stop-color:#f5f5f5;stop-opacity:1;" />
+ <stop
+ id="stop5982"
+ offset="1"
+ style="stop-color:#c7c7c7;stop-opacity:1;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5966">
+ <stop
+ style="stop-color:#e3e3e3;stop-opacity:1;"
+ offset="0"
+ id="stop5968" />
+ <stop
+ id="stop5970"
+ offset="0.5"
+ style="stop-color:#b2b2b2;stop-opacity:1;" />
+ <stop
+ style="stop-color:#d6d6d6;stop-opacity:1;"
+ offset="1"
+ id="stop5972" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5897">
+ <stop
+ style="stop-color:#cecece;stop-opacity:1;"
+ offset="0"
+ id="stop5899" />
+ <stop
+ style="stop-color:#a0a0a0;stop-opacity:1;"
+ offset="1"
+ id="stop5901" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5887">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop5889" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop5891" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5707">
+ <stop
+ id="stop5709"
+ offset="0"
+ style="stop-color:#e8e8e8;stop-opacity:1;" />
+ <stop
+ id="stop5711"
+ offset="1"
+ style="stop-color:#717171;stop-opacity:0;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5693">
+ <stop
+ style="stop-color:#c9c9c9;stop-opacity:1;"
+ offset="0"
+ id="stop5695" />
+ <stop
+ id="stop5701"
+ offset="0.32142857"
+ style="stop-color:#939393;stop-opacity:1;" />
+ <stop
+ style="stop-color:#d1d1d1;stop-opacity:1;"
+ offset="0.75"
+ id="stop5703" />
+ <stop
+ style="stop-color:#b2b2b2;stop-opacity:1;"
+ offset="1"
+ id="stop5697" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5641">
+ <stop
+ id="stop5643"
+ offset="0"
+ style="stop-color:#b5b5b5;stop-opacity:1;" />
+ <stop
+ style="stop-color:#868686;stop-opacity:1;"
+ offset="0.5"
+ id="stop5647" />
+ <stop
+ id="stop5645"
+ offset="1"
+ style="stop-color:#c7c7c7;stop-opacity:1;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5615">
+ <stop
+ style="stop-color:#717171;stop-opacity:1;"
+ offset="0"
+ id="stop5617" />
+ <stop
+ style="stop-color:#cccccc;stop-opacity:1;"
+ offset="1"
+ id="stop5619" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5597">
+ <stop
+ style="stop-color:#717171;stop-opacity:1;"
+ offset="0"
+ id="stop5599" />
+ <stop
+ style="stop-color:#717171;stop-opacity:0;"
+ offset="1"
+ id="stop5601" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5589">
+ <stop
+ id="stop5591"
+ offset="0"
+ style="stop-color:#eddee1;stop-opacity:1;" />
+ <stop
+ id="stop5593"
+ offset="1"
+ style="stop-color:#cb9ea7;stop-opacity:1;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5579">
+ <stop
+ style="stop-color:#eddee1;stop-opacity:1;"
+ offset="0"
+ id="stop5581" />
+ <stop
+ style="stop-color:#cb9ea7;stop-opacity:1;"
+ offset="1"
+ id="stop5583" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient6010"
+ id="linearGradient6016"
+ x1="155.34375"
+ y1="125.76562"
+ x2="239.15625"
+ y2="168.76562"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.201008,0,0,0.2009534,-1.0020767,-1.4840892)" />
+ <filter
+ inkscape:collect="always"
+ x="-0.12703244"
+ width="1.2540649"
+ y="-0.16318549"
+ height="1.326371"
+ id="filter5735">
+ <feGaussianBlur
+ inkscape:collect="always"
+ stdDeviation="12.915397"
+ id="feGaussianBlur5737" />
+ </filter>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5641"
+ id="linearGradient2288"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.201008,0,0,0.2009534,-1.0020767,-1.4840892)"
+ x1="57.21373"
+ y1="179.57538"
+ x2="93.290894"
+ y2="177.23959" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5966"
+ id="linearGradient2290"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.201008,0,0,0.2009534,-1.0020767,-1.4840892)"
+ x1="38.890877"
+ y1="145.8279"
+ x2="59.220192"
+ y2="145.88857" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5641"
+ id="linearGradient2292"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.201008,0,0,0.2009534,-1.0020767,-1.4840892)"
+ x1="80.96373"
+ y1="195.32538"
+ x2="108.54089"
+ y2="195.73959" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5641"
+ id="linearGradient2294"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.201008,0,0,0.2009534,-1.0020767,-1.4840892)"
+ x1="199.5"
+ y1="114.25"
+ x2="228.25"
+ y2="113" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5641"
+ id="linearGradient2296"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.201008,0,0,0.2009534,-1.0020767,-1.4840892)"
+ x1="192"
+ y1="146.25"
+ x2="225.75"
+ y2="145.25" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5615"
+ id="linearGradient2298"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.201008,0,0,0.2009534,-1.0020767,-1.4840892)"
+ x1="184"
+ y1="166"
+ x2="215.5"
+ y2="170.25" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5641"
+ id="linearGradient2300"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.201008,0,0,0.2009534,-1.0020767,-1.4840892)"
+ x1="192"
+ y1="146.25"
+ x2="225.75"
+ y2="145.25" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5641"
+ id="linearGradient2302"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.201008,0,0,0.2009534,-1.0020767,-1.4840892)"
+ x1="116.834"
+ y1="194.83527"
+ x2="145.664"
+ y2="194.83527" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5579"
+ id="linearGradient2304"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.201008,0,0,0.2009534,-1.0020767,-6.708875)"
+ x1="134.34375"
+ y1="71.5"
+ x2="171.65625"
+ y2="212.5" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5641"
+ id="linearGradient2306"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.201008,0,0,0.2009534,-1.0020767,-1.4840892)"
+ x1="153.25"
+ y1="202.75"
+ x2="184.25"
+ y2="201.75" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5597"
+ id="radialGradient2308"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.1380877,4.5466235e-2,-2.3832001e-2,7.2342035e-2,20.583764,16.399916)"
+ cx="-88.308083"
+ cy="73.568199"
+ fx="-88.308083"
+ fy="73.568199"
+ r="101.65625" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5597"
+ id="radialGradient2310"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.1440197,5.9303781e-2,-2.901487e-2,7.0424578e-2,22.769405,4.308221)"
+ cx="147.50781"
+ cy="165.91266"
+ fx="147.50781"
+ fy="165.91266"
+ r="101.65625" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5615"
+ id="linearGradient2312"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.201008,0,0,0.2009534,-1.0020767,-1.4840892)"
+ x1="172.42566"
+ y1="202.57323"
+ x2="152.25"
+ y2="202.57323" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5615"
+ id="linearGradient2314"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.201008,0,0,0.2009534,-1.0020767,-1.4840892)"
+ x1="201"
+ y1="189"
+ x2="145"
+ y2="212.5" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5615"
+ id="linearGradient2316"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.201008,0,0,0.2009534,-1.0020767,-1.4840892)"
+ x1="228.5"
+ y1="149.5"
+ x2="141"
+ y2="202.5" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5693"
+ id="linearGradient2318"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.1989978,0,0,0.2009534,-0.6201615,-1.4840892)"
+ x1="65"
+ y1="95"
+ x2="190"
+ y2="95" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5707"
+ id="radialGradient2320"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.2830276,-0.2829508,0.1470958,0.1470559,4.4824059,24.347715)"
+ cx="69.515442"
+ cy="48.968105"
+ fx="69.515442"
+ fy="48.968105"
+ r="101.65625" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5887"
+ id="linearGradient2322"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.201008,0,0,0.2009534,-1.0020767,-1.6850421)"
+ x1="147.25"
+ y1="195.625"
+ x2="148.75"
+ y2="218.875" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5897"
+ id="linearGradient2324"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.201008,0,0,0.2009534,-1.0020767,-1.4840892)"
+ x1="115"
+ y1="205.75"
+ x2="124.5"
+ y2="206" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5978"
+ id="linearGradient2326"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.201008,0,0,0.2009534,-1.0020767,-1.4840892)"
+ x1="63.213203"
+ y1="180.75673"
+ x2="83.841362"
+ y2="193.125" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5978"
+ id="linearGradient2328"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.201008,0,0,0.2009534,-1.0020767,-1.4840892)"
+ x1="42"
+ y1="172.625"
+ x2="55.910641"
+ y2="172.625" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5753"
+ id="linearGradient2330"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.0122267,0,0,1.0123098,-0.3023276,-0.2600212)"
+ x1="31.071491"
+ y1="36.879368"
+ x2="30.94672"
+ y2="11.32831" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5745"
+ id="linearGradient2332"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.0437257,0,0,1.0442057,-1.0812013,-0.9337631)"
+ x1="26.934336"
+ y1="5.5277748"
+ x2="26.934338"
+ y2="28.598352" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#000000"
+ bordercolor="#d6d6d6"
+ borderopacity="1"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.49803922"
+ inkscape:pageshadow="2"
+ inkscape:zoom="5"
+ inkscape:cx="48.839764"
+ inkscape:cy="52.011071"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ width="72px"
+ height="48px"
+ inkscape:showpageshadow="false"
+ borderlayer="true"
+ inkscape:window-width="938"
+ inkscape:window-height="894"
+ inkscape:window-x="333"
+ inkscape:window-y="50"
+ showgrid="false" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>System Applications</dc:title>
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:source>http://jimmac.musichall.cz</dc:source>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>system</rdf:li>
+ <rdf:li>applications</rdf:li>
+ <rdf:li>category</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/SourceCode" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2258"
+ transform="translate(11.28125,0)">
+ <path
+ transform="matrix(0.201008,0,0,0.2009534,-1.0020767,-1.4840892)"
+ style="opacity:1;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.30000001;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible;filter:url(#filter5735);enable-background:accumulate"
+ d="M 136.21875,61.34375 C 133.04768,66.942039 132.03863,75.798453 124.09375,76.089734 C 116.13482,76.381531 114.09566,67.607316 110.25,62.268416 C 105.60995,62.902732 101.08947,63.790852 96.6875,64.896413 C 96.492107,71.016647 99.963446,79.506145 92.75,82.148728 C 85.535056,84.791861 79.337504,77.294317 73.15625,73.510404 C 69.220627,75.469125 65.480634,77.65891 61.9375,80.007397 C 64.779063,85.711954 72.103334,92.508989 66.75,97.089379 C 61.389764,101.67567 52.003171,96.63263 44.4375,94.972381 C 41.768272,97.936096 39.325534,101.02655 37.1875,104.2677 C 42.602989,108.70808 52.797413,112.8025 50.09375,118.64869 C 47.395676,124.48279 36.211903,122.62479 28.40625,123.34502 C 27.414668,126.84828 26.719006,130.44088 26.34375,134.10034 C 33.533341,136.56954 44.907172,137.35526 45.28125,143.54166 C 45.655989,149.73901 34.387722,151.32683 27.53125,154.32132 C 28.34587,157.93437 29.486436,161.45431 30.90625,164.88197 C 38.766148,165.03412 49.668768,162.3311 53.0625,167.94797 C 56.456938,173.566 46.828232,178.39183 41.96875,183.20496 C 44.484233,186.26949 47.296461,189.1817 50.3125,191.94061 C 57.638565,189.72799 66.367644,184.02483 72.25,188.19328 C 78.13994,192.36712 71.663421,199.67614 69.53125,205.56726 C 73.337395,207.6457 77.306309,209.54778 81.46875,211.21259 C 87.17129,206.99574 92.429542,199.05768 99.9375,201.16294 C 107.42994,203.26383 105.0438,211.97226 105.96875,218.05025 C 110.4678,218.82236 115.08159,219.36405 119.78125,219.65625 C 122.95232,214.05796 123.96137,205.20154 131.90625,204.91027 C 139.86518,204.61847 141.90434,213.39269 145.75,218.73158 C 150.39005,218.09727 154.91053,217.20914 159.3125,216.10359 C 159.50789,209.98335 156.03655,201.49385 163.25,198.85127 C 170.46494,196.20814 176.6625,203.70569 182.84375,207.4896 C 186.77937,205.53088 190.51937,203.34109 194.0625,200.9926 C 191.22094,195.28805 183.89667,188.49101 189.25,183.91062 C 194.61024,179.32433 203.99683,184.36737 211.5625,186.02762 C 214.23173,183.0639 216.67447,179.97345 218.8125,176.7323 C 213.39701,172.29192 203.20258,168.1975 205.90625,162.35131 C 208.60432,156.5172 219.7881,158.37521 227.59375,157.65498 C 228.58533,154.15173 229.28099,150.55912 229.65625,146.89966 C 222.46666,144.43046 211.09282,143.64474 210.71875,137.45834 C 210.34401,131.26099 221.61228,129.67317 228.46875,126.67868 C 227.65413,123.06564 226.51356,119.54569 225.09375,116.11803 C 217.23385,115.96588 206.33123,118.66889 202.9375,113.05203 C 199.54306,107.434 209.17177,102.60818 214.03125,97.795045 C 211.51577,94.73051 208.70354,91.818305 205.6875,89.059387 C 198.36144,91.272016 189.63236,96.975174 183.75,92.806717 C 177.86006,88.632884 184.33658,81.323865 186.46875,75.432735 C 182.6626,73.354298 178.69369,71.452222 174.53125,69.787408 C 168.82871,74.004264 163.57046,81.942314 156.0625,79.837064 C 148.57006,77.736166 150.9562,69.027744 150.03125,62.949748 C 145.5322,62.177637 140.91841,61.635949 136.21875,61.34375 z M 128,92.222717 C 162.224,92.222717 190,113.85094 190,140.5 C 190,167.14906 162.224,188.77728 128,188.77728 C 93.775999,188.77728 66,167.14906 66,140.5 C 65.999999,113.85094 93.776,92.222717 128,92.222717 z "
+ id="path5735" />
+ <path
+ sodipodi:nodetypes="csccsccscccccccccccsccsccsccsccsccccccccccsssssccsccsccccsccccsccsccccscccccsccscccccscc"
+ id="path5670"
+ d="M 26.375,5.21875 C 25.73759,6.343745 25.534485,8.128966 23.9375,8.1875 C 22.337692,8.246138 21.929258,6.47912 21.15625,5.40625 C 20.223563,5.533718 19.322331,5.715333 18.4375,5.9375 C 18.398224,7.167381 19.10621,8.875215 17.65625,9.40625 C 16.205988,9.937397 14.929981,8.41664 13.6875,7.65625 C 12.896407,8.049861 11.614277,8.96875 11.614277,8.96875 C 11.614277,8.96875 11.787532,12.93658 11.787532,12.93658 C 11.787532,12.93658 9.4582597,12.302384 7.9375,11.96875 C 7.4009639,12.564318 6.8985115,13.192432 6.46875,13.84375 C 6.46875,13.84375 6.8607549,17.53125 6.8607549,17.53125 C 6.8607549,17.53125 5.6272844,17.603692 4.71875,17.6875 C 4.5194336,18.391491 4.3566791,19.108369 4.28125,19.84375 C 4.28125,19.84375 4.4580267,24.443782 4.4580267,24.443782 C 4.4580267,24.443782 4.53125,29.125 4.53125,29.125 C 4.6949949,29.851056 4.933356,30.561201 5.21875,31.25 C 7.971227,30.561737 7.2697646,31.34467 7.2697646,31.34467 C 7.2697646,31.34467 7.4375,34.9375 7.4375,34.9375 C 7.9431319,35.553327 8.5187523,36.133088 9.125,36.6875 C 10.597596,36.242868 12.348849,35.099836 13.53125,35.9375 C 14.715175,36.776247 13.397333,38.253661 12.96875,39.4375 C 13.733816,39.85517 14.538316,40.22795 15.375,40.5625 C 16.521255,39.715109 17.584591,38.108191 19.09375,38.53125 C 20.599792,38.953431 20.126577,40.716106 20.3125,41.9375 C 21.216843,42.092656 22.117831,42.19128 23.0625,42.25 C 23.699911,41.125003 23.903016,39.339783 25.5,39.28125 C 27.099808,39.222613 27.508242,40.989631 28.28125,42.0625 C 29.213938,41.935034 30.146419,41.753413 31.03125,41.53125 C 31.070525,40.301368 30.362539,38.593536 31.8125,38.0625 C 33.262759,37.531355 34.507519,39.052111 35.75,39.8125 C 36.541092,39.418889 37.287803,38.971937 38,38.5 C 38,38.5 37.826745,35.239277 37.826745,35.239277 C 38.904196,34.317647 40.01049,35.166367 41.53125,35.5 C 42.067785,34.90443 42.538989,34.276321 42.96875,33.625 C 42.96875,33.625 42.857075,30.104473 42.857075,30.104473 C 42.857075,30.104473 44.75,29.78125 44.75,29.78125 C 44.949314,29.077261 45.080819,28.36038 45.15625,27.625 C 45.15625,27.625 45.15625,22.40625 45.15625,22.40625 C 44.966713,22.341173 44.742837,22.306651 44.53125,22.25 C 44.439225,21.981788 44.800831,21.523527 44.691942,21.260723 C 44.691942,21.260723 44.9375,18.34375 44.9375,18.34375 C 44.773755,17.617698 44.535394,16.90755 44.25,16.21875 C 43.065073,16.195819 41.54071,16.512346 40.5625,16.1875 C 40.539209,16.179766 40.522654,16.164705 40.5,16.15625 C 40.446537,16.106258 40.397879,16.049501 40.34375,16 C 40.314345,16.008878 40.279623,16.021834 40.25,16.03125 C 40.0712,15.926893 39.890884,15.775152 39.78125,15.59375 C 39.098942,14.464787 41.054456,13.498466 42.03125,12.53125 C 41.525617,11.915421 40.949998,11.335664 40.34375,10.78125 C 38.871155,11.225885 37.119901,12.368915 35.9375,11.53125 C 34.753576,10.692504 36.040167,9.246342 36.46875,8.0625 C 35.703681,7.644832 34.930434,7.2408 34.09375,6.90625 C 32.947495,7.753642 31.88416,9.360558 30.375,8.9375 C 28.86896,8.515317 29.342172,6.752644 29.15625,5.53125 C 28.251905,5.376092 27.319669,5.277468 26.375,5.21875 z M 24.71875,11.40625 C 25.127782,11.40625 25.538533,11.438721 25.9375,11.46875 C 25.54784,12.41684 25.097354,13.363738 23.9375,13.40625 C 22.815918,13.447359 22.268278,12.602879 21.78125,11.71875 C 22.729581,11.538815 23.699585,11.40625 24.71875,11.40625 z M 29.25,12.09375 C 30.416416,12.449187 31.503984,12.933901 32.46875,13.53125 C 31.843022,14.028025 31.173814,14.380178 30.375,14.15625 C 29.375125,13.87596 29.275244,13.001323 29.25,12.09375 z M 18.53125,12.71875 C 18.590003,13.541446 18.539908,14.301368 17.65625,14.625 C 16.9991,14.865676 16.373142,14.680866 15.78125,14.34375 C 16.588185,13.697804 17.520929,13.170542 18.53125,12.71875 z M 24.71875,16.65625 C 30.437165,16.656251 35.253882,19.660533 36.71875,23.75 C 35.242085,27.825344 30.424266,30.8125 24.71875,30.8125 C 19.012302,30.812501 14.194565,27.826366 12.71875,23.75 C 14.182531,19.659237 18.999153,16.65625 24.71875,16.65625 z M 32.34375,32.75 C 32.795108,32.729015 33.235344,32.888689 33.65625,33.125 C 32.850047,33.770373 31.915498,34.298414 30.90625,34.75 C 30.849544,33.932852 30.934006,33.16549 31.8125,32.84375 C 31.993782,32.777357 32.168465,32.75815 32.34375,32.75 z M 18.53125,33.25 C 18.706821,33.245215 18.905105,33.259618 19.09375,33.3125 C 20.093627,33.592791 20.193507,34.467427 20.21875,35.375 C 19.035882,35.016424 17.944541,34.544398 16.96875,33.9375 C 17.451437,33.551783 17.95703,33.265651 18.53125,33.25 z M 25.5,34.0625 C 26.630484,34.021064 27.166117,34.889682 27.65625,35.78125 C 26.718915,35.956772 25.724956,36.0625 24.71875,36.0625 C 24.310238,36.0625 23.929723,36.029954 23.53125,36 C 23.92091,35.051909 24.340147,34.10501 25.5,34.0625 z "
+ style="opacity:1;color:#000000;fill:#717171;fill-opacity:1;fill-rule:nonzero;stroke:#888a85;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible;enable-background:accumulate" />
+ <path
+ style="opacity:1;color:#000000;fill:#717171;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.30000001;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible;enable-background:accumulate"
+ d="M 26.378971,10.441236 C 25.741561,11.566231 25.538734,13.345956 23.941749,13.40449 C 22.341942,13.463128 21.932055,11.69992 21.159047,10.62705 C 20.226359,10.754518 19.317708,10.932989 18.432877,11.155155 C 18.393601,12.385036 19.091368,14.09103 17.641408,14.622065 C 16.191147,15.153211 14.945391,13.646556 13.70291,12.886165 C 12.911817,13.279777 12.16005,13.719822 11.447851,14.191757 C 12.019028,15.338108 13.491265,16.703993 12.415202,17.62444 C 11.337753,18.546069 9.4509726,17.532654 7.9302129,17.199021 C 7.3936769,17.794589 6.9026671,18.415626 6.4729056,19.066946 C 7.5614617,19.959255 9.6106216,20.782042 9.0671638,21.956854 C 8.5248301,23.129236 6.2768026,22.755864 4.7078051,22.900598 C 4.5084888,23.60459 4.3686553,24.326534 4.2932262,25.061915 C 5.7383909,25.558109 8.0246208,25.716001 8.0998131,26.959179 C 8.1751387,28.204558 5.9101281,28.523636 4.5319226,29.125388 C 4.6956677,29.851443 4.9249309,30.558787 5.2103249,31.247586 C 6.7902265,31.278162 8.9817395,30.73498 9.6639061,31.863709 C 10.346215,32.992671 8.410769,33.962437 7.4339747,34.929652 C 7.9396066,35.54548 8.5048865,36.130698 9.1111342,36.68511 C 10.583731,36.240476 12.338345,35.094408 13.520746,35.932072 C 14.704671,36.770819 13.402838,38.239591 12.974255,39.42343 C 13.739321,39.841101 14.537104,40.223329 15.373788,40.557879 C 16.520043,39.710489 17.576993,38.115309 19.086152,38.538368 C 20.592193,38.960549 20.112559,40.710536 20.298482,41.93193 C 21.202826,42.087087 22.130234,42.195941 23.074903,42.254661 C 23.712314,41.129665 23.915141,39.349939 25.512125,39.291406 C 27.111933,39.232768 27.521819,40.995976 28.294827,42.068845 C 29.227515,41.941378 30.136167,41.762905 31.020998,41.540742 C 31.060273,40.310859 30.362506,38.604866 31.812467,38.07383 C 33.262727,37.542685 34.508484,39.049342 35.750965,39.809731 C 36.542057,39.41612 37.293826,38.976075 38.006023,38.504138 C 37.434847,37.357789 35.962611,35.991901 37.038672,35.071457 C 38.116124,34.149827 40.002902,35.163242 41.523662,35.496875 C 42.060198,34.901306 42.551208,34.28027 42.980969,33.628949 C 41.892413,32.73664 39.843252,31.913853 40.38671,30.739041 C 40.929044,29.566658 43.177072,29.940031 44.74607,29.795298 C 44.945385,29.091309 45.085218,28.369361 45.160649,27.633981 C 43.715484,27.137787 41.429252,26.979894 41.354061,25.736716 C 41.278735,24.491338 43.543747,24.172261 44.921952,23.570507 C 44.758206,22.844455 44.528944,22.13711 44.24355,21.44831 C 42.663647,21.417735 40.472135,21.960913 39.789968,20.832186 C 39.107659,19.703225 41.043106,18.73346 42.0199,17.766244 C 41.514268,17.150417 40.948988,16.5652 40.34274,16.010786 C 38.870144,16.45542 37.11553,17.601489 35.933129,16.763824 C 34.749204,15.925078 36.051037,14.456306 36.47962,13.272464 C 35.714553,12.854796 34.916771,12.472567 34.080087,12.138017 C 32.933831,12.985408 31.876882,14.580585 30.367722,14.157528 C 28.861682,13.735347 29.341315,11.98536 29.155393,10.763966 C 28.251049,10.608808 27.32364,10.499954 26.378971,10.441236 z M 24.726937,16.646468 C 31.606233,16.646468 37.189428,20.992731 37.189428,26.347948 C 37.189428,31.703166 31.606233,36.049428 24.726937,36.049428 C 17.847642,36.049428 12.264446,31.703166 12.264446,26.347948 C 12.264446,20.992731 17.847642,16.646468 24.726937,16.646468 z "
+ id="path5609" />
+ <path
+ sodipodi:nodetypes="cccsccc"
+ id="path5986"
+ d="M 9.0985718,31.321543 L 9.1488238,36.697044 L 11.309658,35.842993 C 11.309658,35.842993 13.068478,35.34061 13.922762,35.94347 C 14.493105,36.345956 14.676541,29.864631 14.676541,29.864631 L 11.058399,29.914869 L 9.0985718,31.321543 z "
+ style="opacity:1;color:#000000;fill:url(#linearGradient2288);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="ccccc"
+ id="path5964"
+ d="M 5.1096883,25.874784 L 5.2518226,31.274412 L 10.190981,30.99022 L 10.901651,25.555068 L 5.1096883,25.874784 z "
+ style="opacity:1;color:#000000;fill:url(#linearGradient2290);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="ccccccsc"
+ id="path5731"
+ d="M 20.272091,41.885642 L 20.569294,36.582182 L 20.815502,32.55327 L 17.546419,31.913841 L 15.272274,35.395179 L 15.343341,40.581663 C 15.870987,40.280234 17.627676,38.192712 19.323095,38.646874 C 20.399307,38.935166 20.272091,41.885642 20.272091,41.885642 z "
+ style="opacity:1;color:#000000;fill:url(#linearGradient2292);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ id="path5721"
+ d="M 44.877981,18.360053 L 44.777477,23.132695 L 39.099004,22.630312 L 39.501019,20.218871 L 44.877981,18.360053 z "
+ style="opacity:1;color:#000000;fill:url(#linearGradient2294);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="ccccc"
+ id="path5715"
+ d="M 44.727225,24.539368 L 44.727225,29.764155 L 39.551272,30.115823 L 39.048752,24.790559 L 44.727225,24.539368 z "
+ style="opacity:1;color:#000000;fill:url(#linearGradient2296);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="csccc"
+ id="path5633"
+ d="M 41.511099,35.541563 C 41.511099,35.541563 38.294972,34.335843 37.390437,34.73775 C 36.4859,35.139656 36.586404,30.065585 36.586404,30.065585 C 38.441521,28.818115 39.89552,29.976693 41.511099,30.166062 L 41.511099,35.541563 z "
+ style="opacity:1;color:#000000;fill:url(#linearGradient2298);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="cccccccccccccsccccccccccccccc"
+ id="path5725"
+ d="M 41.712106,17.807431 L 41.913115,12.532406 L 36.385397,12.884074 L 36.435649,8.111433 L 34.124058,6.9559512 L 31.611458,11.075495 L 29.802387,9.9200127 L 29.199364,5.6497548 L 26.435505,5.298086 L 25.581221,9.3673909 L 20.204259,9.8697742 L 18.495692,5.9511845 L 18.495692,10.472634 C 18.495692,10.472634 16.234353,10.673588 16.033345,10.62335 C 15.832337,10.573111 11.611171,8.9654844 11.611171,8.9654844 L 11.761926,13.587411 L 7.6412638,13.085028 L 6.5357209,13.838603 L 6.9879886,18.008385 L 9.0483198,18.812198 L 4.3246335,19.816964 L 4.2743814,25.09199 L 10.254657,23.827243 L 11.209155,16.651949 L 14.827297,14.039556 L 20.656527,10.673588 L 31.510954,11.778831 L 38.847744,17.907908 L 41.712106,17.807431 z "
+ style="opacity:1;color:#000000;fill:url(#linearGradient2300);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="ccccccsc"
+ id="path5727"
+ d="M 28.227289,42.032046 L 28.277541,36.602991 L 26.429798,33.050603 L 23.871385,33.263747 L 23.089647,37.100326 L 23.048017,42.387285 C 23.048017,42.387285 24.072393,39.252566 25.576994,39.302805 C 27.281652,39.359722 27.754205,41.529663 28.227289,42.032046 z "
+ style="opacity:1;color:#000000;fill:url(#linearGradient2302);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ id="path4582"
+ d="M 26.378971,5.2164488 C 25.741561,6.3414435 25.538734,8.1211695 23.941749,8.1797037 C 22.341942,8.2383413 21.932055,6.4751334 21.159047,5.4022634 C 20.226359,5.5297314 19.317708,5.7082019 18.432877,5.9303684 C 18.393601,7.1602497 19.091368,8.8662429 17.641408,9.3972782 C 16.191147,9.9284253 14.945391,8.4217687 13.70291,7.6613784 C 12.911817,8.0549898 12.16005,8.4950349 11.447851,8.9669712 C 12.019028,10.113321 13.491265,11.479208 12.415202,12.399652 C 11.337753,13.321283 9.4509726,12.307868 7.9302129,11.974234 C 7.3936769,12.569802 6.9026671,13.190841 6.4729056,13.842159 C 7.5614617,14.734469 9.6106216,15.557256 9.0671638,16.732067 C 8.5248301,17.90445 6.2768026,17.531078 4.7078051,17.675811 C 4.5084888,18.379803 4.3686553,19.101747 4.2932262,19.837128 C 5.7383909,20.333322 8.0246208,20.491216 8.0998131,21.734393 C 8.1751387,22.979771 5.9101281,23.298849 4.5319226,23.900602 C 4.6956677,24.626656 4.9249309,25.334 5.2103249,26.0228 C 6.7902265,26.053375 8.9817395,25.510194 9.6639061,26.638923 C 10.346215,27.767884 8.410769,28.737651 7.4339747,29.704865 C 7.9396066,30.320693 8.5048865,30.905911 9.1111342,31.460323 C 10.583731,31.01569 12.338345,29.869622 13.520746,30.707285 C 14.704671,31.546032 13.402838,33.014804 12.974255,34.198644 C 13.739321,34.616314 14.537104,34.998543 15.373788,35.333093 C 16.520043,34.485702 17.576993,32.890523 19.086152,33.313581 C 20.592193,33.735762 20.112559,35.485751 20.298482,36.707143 C 21.202826,36.8623 22.130234,36.971155 23.074903,37.029874 C 23.712314,35.904878 23.915141,34.125151 25.512125,34.066619 C 27.111933,34.007982 27.521819,35.771191 28.294827,36.844058 C 29.227515,36.716591 30.136167,36.538119 31.020998,36.315955 C 31.060273,35.086072 30.362506,33.380079 31.812467,32.849044 C 33.262727,32.317898 34.508484,33.824555 35.750965,34.584945 C 36.542057,34.191333 37.293826,33.751288 38.006023,33.279352 C 37.434847,32.133003 35.962611,30.767114 37.038672,29.84667 C 38.116124,28.92504 40.002902,29.938455 41.523662,30.272088 C 42.060198,29.676519 42.551208,29.055483 42.980969,28.404163 C 41.892413,27.511854 39.843252,26.689066 40.38671,25.514255 C 40.929044,24.341871 43.177072,24.715244 44.74607,24.570511 C 44.945385,23.866522 45.085218,23.144575 45.160649,22.409194 C 43.715484,21.913 41.429252,21.755107 41.354061,20.51193 C 41.278735,19.266551 43.543747,18.947473 44.921952,18.34572 C 44.758206,17.619668 44.528944,16.912323 44.24355,16.223523 C 42.663647,16.192948 40.472135,16.736127 39.789968,15.607401 C 39.107659,14.478438 41.043106,13.508674 42.0199,12.541458 C 41.514268,11.925629 40.948988,11.340413 40.34274,10.785999 C 38.870144,11.230634 37.11553,12.376702 35.933129,11.539037 C 34.749204,10.700291 36.051037,9.2315192 36.47962,8.0476771 C 35.714553,7.6300087 34.916771,7.2477797 34.080087,6.9132301 C 32.933831,7.7606214 31.876882,9.3557993 30.367722,8.9327418 C 28.861682,8.5105593 29.341315,6.7605726 29.155393,5.5391791 C 28.251049,5.3840213 27.32364,5.2751668 26.378971,5.2164488 z M 24.726937,11.42168 C 31.606233,11.42168 37.189428,15.767944 37.189428,21.123161 C 37.189428,26.478379 31.606233,30.824641 24.726937,30.824641 C 17.847642,30.824641 12.264446,26.478379 12.264446,21.123161 C 12.264446,15.767944 17.847642,11.42168 24.726937,11.42168 z "
+ style="opacity:1;color:#000000;fill:url(#linearGradient2304);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.30000001;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible;enable-background:accumulate" />
+ <path
+ id="path5637"
+ d="M 35.681869,39.912298 L 35.681869,34.386082 C 35.681869,34.386082 32.968262,32.075117 31.862718,32.627739 C 30.757175,33.180361 30.556167,34.73775 30.556167,34.73775 L 30.958183,41.570163 C 30.958183,41.570163 30.405411,38.35491 31.963222,38.05348 C 33.521034,37.75205 35.681869,39.912298 35.681869,39.912298 z "
+ style="opacity:1;color:#000000;fill:url(#linearGradient2306);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ style="opacity:1;color:#000000;fill:url(#radialGradient2308);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.30000001;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible;enable-background:accumulate"
+ d="M 26.378971,5.2164488 C 25.741561,6.3414435 25.538734,8.1211695 23.941749,8.1797037 C 22.341942,8.2383413 21.932055,6.4751334 21.159047,5.4022634 C 20.226359,5.5297314 19.317708,5.7082019 18.432877,5.9303684 C 18.393601,7.1602497 19.091368,8.8662429 17.641408,9.3972782 C 16.191147,9.9284253 14.945391,8.4217687 13.70291,7.6613784 C 12.911817,8.0549898 12.16005,8.4950349 11.447851,8.9669712 C 12.019028,10.113321 13.491265,11.479208 12.415202,12.399652 C 11.337753,13.321283 9.4509726,12.307868 7.9302129,11.974234 C 7.3936769,12.569802 6.9026671,13.190841 6.4729056,13.842159 C 7.5614617,14.734469 9.6106216,15.557256 9.0671638,16.732067 C 8.5248301,17.90445 6.2768026,17.531078 4.7078051,17.675811 C 4.5084888,18.379803 4.3686553,19.101747 4.2932262,19.837128 C 5.7383909,20.333322 8.0246208,20.491216 8.0998131,21.734393 C 8.1751387,22.979771 5.9101281,23.298849 4.5319226,23.900602 C 4.6956677,24.626656 4.9249309,25.334 5.2103249,26.0228 C 6.7902265,26.053375 8.9817395,25.510194 9.6639061,26.638923 C 10.346215,27.767884 8.410769,28.737651 7.4339747,29.704865 C 7.9396066,30.320693 8.5048865,30.905911 9.1111342,31.460323 C 10.583731,31.01569 12.338345,29.869622 13.520746,30.707285 C 14.704671,31.546032 13.402838,33.014804 12.974255,34.198644 C 13.739321,34.616314 14.537104,34.998543 15.373788,35.333093 C 16.520043,34.485702 17.576993,32.890523 19.086152,33.313581 C 20.592193,33.735762 20.112559,35.485751 20.298482,36.707143 C 21.202826,36.8623 22.130234,36.971155 23.074903,37.029874 C 23.712314,35.904878 23.915141,34.125151 25.512125,34.066619 C 27.111933,34.007982 27.521819,35.771191 28.294827,36.844058 C 29.227515,36.716591 30.136167,36.538119 31.020998,36.315955 C 31.060273,35.086072 30.362506,33.380079 31.812467,32.849044 C 33.262727,32.317898 34.508484,33.824555 35.750965,34.584945 C 36.542057,34.191333 37.293826,33.751288 38.006023,33.279352 C 37.434847,32.133003 35.962611,30.767114 37.038672,29.84667 C 38.116124,28.92504 40.002902,29.938455 41.523662,30.272088 C 42.060198,29.676519 42.551208,29.055483 42.980969,28.404163 C 41.892413,27.511854 39.843252,26.689066 40.38671,25.514255 C 40.929044,24.341871 43.177072,24.715244 44.74607,24.570511 C 44.945385,23.866522 45.085218,23.144575 45.160649,22.409194 C 43.715484,21.913 41.429252,21.755107 41.354061,20.51193 C 41.278735,19.266551 43.543747,18.947473 44.921952,18.34572 C 44.758206,17.619668 44.528944,16.912323 44.24355,16.223523 C 42.663647,16.192948 40.472135,16.736127 39.789968,15.607401 C 39.107659,14.478438 41.043106,13.508674 42.0199,12.541458 C 41.514268,11.925629 40.948988,11.340413 40.34274,10.785999 C 38.870144,11.230634 37.11553,12.376702 35.933129,11.539037 C 34.749204,10.700291 36.051037,9.2315192 36.47962,8.0476771 C 35.714553,7.6300087 34.916771,7.2477797 34.080087,6.9132301 C 32.933831,7.7606214 31.876882,9.3557993 30.367722,8.9327418 C 28.861682,8.5105593 29.341315,6.7605726 29.155393,5.5391791 C 28.251049,5.3840213 27.32364,5.2751668 26.378971,5.2164488 z M 24.726937,11.42168 C 31.606233,11.42168 37.189428,15.767944 37.189428,21.123161 C 37.189428,26.478379 31.606233,30.824641 24.726937,30.824641 C 17.847642,30.824641 12.264446,26.478379 12.264446,21.123161 C 12.264446,15.767944 17.847642,11.42168 24.726937,11.42168 z "
+ id="path5587" />
+ <path
+ id="path5605"
+ d="M 26.378971,5.2164488 C 25.741561,6.3414435 25.538734,8.1211695 23.941749,8.1797037 C 22.341942,8.2383413 21.932055,6.4751334 21.159047,5.4022634 C 20.226359,5.5297314 19.317708,5.7082019 18.432877,5.9303684 C 18.393601,7.1602497 19.091368,8.8662429 17.641408,9.3972782 C 16.191147,9.9284253 14.945391,8.4217687 13.70291,7.6613784 C 12.911817,8.0549898 12.16005,8.4950349 11.447851,8.9669712 C 12.019028,10.113321 13.491265,11.479208 12.415202,12.399652 C 11.337753,13.321283 9.4509726,12.307868 7.9302129,11.974234 C 7.3936769,12.569802 6.9026671,13.190841 6.4729056,13.842159 C 7.5614617,14.734469 9.6106216,15.557256 9.0671638,16.732067 C 8.5248301,17.90445 6.2768026,17.531078 4.7078051,17.675811 C 4.5084888,18.379803 4.3686553,19.101747 4.2932262,19.837128 C 5.7383909,20.333322 8.0246208,20.491216 8.0998131,21.734393 C 8.1751387,22.979771 5.9101281,23.298849 4.5319226,23.900602 C 4.6956677,24.626656 4.9249309,25.334 5.2103249,26.0228 C 6.7902265,26.053375 8.9817395,25.510194 9.6639061,26.638923 C 10.346215,27.767884 8.410769,28.737651 7.4339747,29.704865 C 7.9396066,30.320693 8.5048865,30.905911 9.1111342,31.460323 C 10.583731,31.01569 12.338345,29.869622 13.520746,30.707285 C 14.704671,31.546032 13.402838,33.014804 12.974255,34.198644 C 13.739321,34.616314 14.537104,34.998543 15.373788,35.333093 C 16.520043,34.485702 17.576993,32.890523 19.086152,33.313581 C 20.592193,33.735762 20.112559,35.485751 20.298482,36.707143 C 21.202826,36.8623 22.130234,36.971155 23.074903,37.029874 C 23.712314,35.904878 23.915141,34.125151 25.512125,34.066619 C 27.111933,34.007982 27.521819,35.771191 28.294827,36.844058 C 29.227515,36.716591 30.136167,36.538119 31.020998,36.315955 C 31.060273,35.086072 30.362506,33.380079 31.812467,32.849044 C 33.262727,32.317898 34.508484,33.824555 35.750965,34.584945 C 36.542057,34.191333 37.293826,33.751288 38.006023,33.279352 C 37.434847,32.133003 35.962611,30.767114 37.038672,29.84667 C 38.116124,28.92504 40.002902,29.938455 41.523662,30.272088 C 42.060198,29.676519 42.551208,29.055483 42.980969,28.404163 C 41.892413,27.511854 39.843252,26.689066 40.38671,25.514255 C 40.929044,24.341871 43.177072,24.715244 44.74607,24.570511 C 44.945385,23.866522 45.085218,23.144575 45.160649,22.409194 C 43.715484,21.913 41.429252,21.755107 41.354061,20.51193 C 41.278735,19.266551 43.543747,18.947473 44.921952,18.34572 C 44.758206,17.619668 44.528944,16.912323 44.24355,16.223523 C 42.663647,16.192948 40.472135,16.736127 39.789968,15.607401 C 39.107659,14.478438 41.043106,13.508674 42.0199,12.541458 C 41.514268,11.925629 40.948988,11.340413 40.34274,10.785999 C 38.870144,11.230634 37.11553,12.376702 35.933129,11.539037 C 34.749204,10.700291 36.051037,9.2315192 36.47962,8.0476771 C 35.714553,7.6300087 34.916771,7.2477797 34.080087,6.9132301 C 32.933831,7.7606214 31.876882,9.3557993 30.367722,8.9327418 C 28.861682,8.5105593 29.341315,6.7605726 29.155393,5.5391791 C 28.251049,5.3840213 27.32364,5.2751668 26.378971,5.2164488 z M 24.726937,11.42168 C 31.606233,11.42168 37.189428,15.767944 37.189428,21.123161 C 37.189428,26.478379 31.606233,30.824641 24.726937,30.824641 C 17.847642,30.824641 12.264446,26.478379 12.264446,21.123161 C 12.264446,15.767944 17.847642,11.42168 24.726937,11.42168 z "
+ style="opacity:1;color:#000000;fill:url(#radialGradient2310);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.30000001;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible;enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="ccccc"
+ id="path5613"
+ d="M 28.244575,36.84776 L 28.194324,42.173024 L 31.008435,41.570163 L 30.982569,36.27433 L 28.244575,36.84776 z "
+ style="fill:url(#linearGradient2312);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ sodipodi:nodetypes="ccccc"
+ id="path5623"
+ d="M 35.681869,34.386082 L 35.732121,39.962536 L 38.093964,38.405148 L 37.892957,33.381315 L 35.681869,34.386082 z "
+ style="opacity:1;color:#000000;fill:url(#linearGradient2314);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="ccccc"
+ id="path5629"
+ d="M 41.511099,30.266538 L 41.511099,35.692278 L 42.968407,33.582268 L 43.018659,28.558434 L 41.511099,30.266538 z "
+ style="opacity:1;color:#000000;fill:url(#linearGradient2316);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="cscscsc"
+ id="path5688"
+ d="M 24.752063,11.376925 C 17.886638,11.376925 12.264447,15.687775 12.264446,21.123161 C 12.264446,22.027708 12.473533,23.003819 12.762444,23.836031 C 14.209585,19.667513 19.02917,16.601711 24.752063,16.601711 C 30.474956,16.601711 35.294541,19.667513 36.741683,23.836031 C 37.030594,23.003819 37.189428,22.027708 37.189428,21.123161 C 37.189428,15.687775 31.617488,11.376925 24.752063,11.376925 z "
+ style="opacity:1;color:#000000;fill:url(#linearGradient2318);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ style="opacity:1;color:#000000;fill:url(#radialGradient2320);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.30000001;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible;enable-background:accumulate"
+ d="M 26.378971,5.2164488 C 25.741561,6.3414435 25.538734,8.1211695 23.941749,8.1797037 C 22.341942,8.2383413 21.932055,6.4751334 21.159047,5.4022634 C 20.226359,5.5297314 19.317708,5.7082019 18.432877,5.9303684 C 18.393601,7.1602497 19.091368,8.8662429 17.641408,9.3972782 C 16.191147,9.9284253 14.945391,8.4217687 13.70291,7.6613784 C 12.911817,8.0549898 12.16005,8.4950349 11.447851,8.9669712 C 12.019028,10.113321 13.491265,11.479208 12.415202,12.399652 C 11.337753,13.321283 9.4509726,12.307868 7.9302129,11.974234 C 7.3936769,12.569802 6.9026671,13.190841 6.4729056,13.842159 C 7.5614617,14.734469 9.6106216,15.557256 9.0671638,16.732067 C 8.5248301,17.90445 6.2768026,17.531078 4.7078051,17.675811 C 4.5084888,18.379803 4.3686553,19.101747 4.2932262,19.837128 C 5.7383909,20.333322 8.0246208,20.491216 8.0998131,21.734393 C 8.1751387,22.979771 5.9101281,23.298849 4.5319226,23.900602 C 4.6956677,24.626656 4.9249309,25.334 5.2103249,26.0228 C 6.7902265,26.053375 8.9817395,25.510194 9.6639061,26.638923 C 10.346215,27.767884 8.410769,28.737651 7.4339747,29.704865 C 7.9396066,30.320693 8.5048865,30.905911 9.1111342,31.460323 C 10.583731,31.01569 12.338345,29.869622 13.520746,30.707285 C 14.704671,31.546032 13.402838,33.014804 12.974255,34.198644 C 13.739321,34.616314 14.537104,34.998543 15.373788,35.333093 C 16.520043,34.485702 17.576993,32.890523 19.086152,33.313581 C 20.592193,33.735762 20.112559,35.485751 20.298482,36.707143 C 21.202826,36.8623 22.130234,36.971155 23.074903,37.029874 C 23.712314,35.904878 23.915141,34.125151 25.512125,34.066619 C 27.111933,34.007982 27.521819,35.771191 28.294827,36.844058 C 29.227515,36.716591 30.136167,36.538119 31.020998,36.315955 C 31.060273,35.086072 30.362506,33.380079 31.812467,32.849044 C 33.262727,32.317898 34.508484,33.824555 35.750965,34.584945 C 36.542057,34.191333 37.293826,33.751288 38.006023,33.279352 C 37.434847,32.133003 35.962611,30.767114 37.038672,29.84667 C 38.116124,28.92504 40.002902,29.938455 41.523662,30.272088 C 42.060198,29.676519 42.551208,29.055483 42.980969,28.404163 C 41.892413,27.511854 39.843252,26.689066 40.38671,25.514255 C 40.929044,24.341871 43.177072,24.715244 44.74607,24.570511 C 44.945385,23.866522 45.085218,23.144575 45.160649,22.409194 C 43.715484,21.913 41.429252,21.755107 41.354061,20.51193 C 41.278735,19.266551 43.543747,18.947473 44.921952,18.34572 C 44.758206,17.619668 44.528944,16.912323 44.24355,16.223523 C 42.663647,16.192948 40.472135,16.736127 39.789968,15.607401 C 39.107659,14.478438 41.043106,13.508674 42.0199,12.541458 C 41.514268,11.925629 40.948988,11.340413 40.34274,10.785999 C 38.870144,11.230634 37.11553,12.376702 35.933129,11.539037 C 34.749204,10.700291 36.051037,9.2315192 36.47962,8.0476771 C 35.714553,7.6300087 34.916771,7.2477797 34.080087,6.9132301 C 32.933831,7.7606214 31.876882,9.3557993 30.367722,8.9327418 C 28.861682,8.5105593 29.341315,6.7605726 29.155393,5.5391791 C 28.251049,5.3840213 27.32364,5.2751668 26.378971,5.2164488 z M 24.726937,11.42168 C 31.606233,11.42168 37.189428,15.767944 37.189428,21.123161 C 37.189428,26.478379 31.606233,30.824641 24.726937,30.824641 C 17.847642,30.824641 12.264446,26.478379 12.264446,21.123161 C 12.264446,15.767944 17.847642,11.42168 24.726937,11.42168 z "
+ id="path5705" />
+ <path
+ id="path5719"
+ d="M 45.179494,22.479597 L 45.179494,27.654144 L 44.727225,29.814393 L 44.727225,24.589606 L 45.179494,22.479597 z "
+ style="opacity:1;color:#000000;fill:#6f6f6f;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="cccccc"
+ id="path5857"
+ d="M 28.118946,36.496091 L 28.269702,36.671926 L 28.420459,36.596567 L 28.330971,41.846938 L 28.194324,41.97207 L 28.118946,36.496091 z "
+ style="opacity:0.36571428;color:#000000;fill:url(#linearGradient2322);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="ccccc"
+ id="path5895"
+ d="M 20.279637,36.722164 C 21.192143,36.848572 22.117288,36.999944 23.093748,36.998475 L 23.068622,42.2735 C 22.186014,42.194945 21.229124,42.092366 20.279637,41.946951 L 20.279637,36.722164 z "
+ style="opacity:1;color:#000000;fill:url(#linearGradient2324);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ id="path5958"
+ d="M 15.329817,35.240133 L 15.329817,40.515158 L 12.86747,39.359677 L 13.018226,34.13489 L 15.329817,35.240133 z "
+ style="opacity:1;color:#000000;fill:url(#linearGradient2326);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="ccccc"
+ id="path5960"
+ d="M 9.0985718,31.42202 L 9.1488238,36.646806 C 8.596052,36.346852 7.9930282,35.772471 7.4402563,34.938704 L 7.4402563,29.713917 C 7.9930282,30.397269 8.5458,31.005405 9.0985718,31.42202 z "
+ style="opacity:1;color:#000000;fill:url(#linearGradient2328);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="ccccc"
+ id="path5962"
+ d="M 5.229169,31.271305 L 5.1537912,25.870684 C 4.9527831,25.388138 4.7266492,24.710761 4.5256418,23.961627 L 4.5256418,29.161295 C 4.6620922,30.091743 4.9601976,30.738313 5.229169,31.271305 z "
+ style="opacity:1;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ id="path5743"
+ d="M 26.399171,5.020641 C 25.753968,6.1594842 25.548661,7.9611182 23.93215,8.0203729 C 22.312783,8.0797324 21.897884,6.2948197 21.115425,5.2087429 C 20.171333,5.33778 19.251572,5.5184475 18.355923,5.7433488 C 18.316167,6.9883697 19.022465,8.7153633 17.554776,9.2529355 C 16.086783,9.7906211 14.825797,8.2654177 13.568124,7.4956672 C 12.767358,7.8941238 12.0064,8.3395858 11.285493,8.8173315 C 11.863653,9.9777929 13.353892,11.360493 12.264672,12.292268 C 11.174049,13.225244 9.2641992,12.199355 7.7248457,11.861613 C 7.1817496,12.464513 6.6847364,13.093197 6.2497202,13.752532 C 7.3515859,14.655827 9.4258007,15.488742 8.8756977,16.678014 C 8.3267331,17.864829 6.0512196,17.48686 4.4630385,17.633376 C 4.2612851,18.346034 4.1197419,19.076864 4.0433906,19.821297 C 5.5062249,20.3236 7.8204079,20.483438 7.8965195,21.741917 C 7.9727661,23.002626 5.6800619,23.325632 4.2850055,23.934793 C 4.4507526,24.669784 4.682819,25.385835 4.9717024,26.083114 C 6.570921,26.114066 8.789229,25.564198 9.4797361,26.706821 C 10.170388,27.84968 8.2112774,28.831384 7.22254,29.810504 C 7.7343542,30.433913 8.3065457,31.026335 8.9202057,31.587572 C 10.410808,31.137465 12.186874,29.977289 13.383732,30.825264 C 14.582133,31.674336 13.264383,33.161188 12.83056,34.359601 C 13.60498,34.782412 14.412517,35.169346 15.259431,35.508014 C 16.419701,34.650193 17.489574,33.035378 19.017185,33.463643 C 20.54164,33.891022 20.056141,35.662552 20.244338,36.898979 C 21.159739,37.056046 22.098486,37.166241 23.054706,37.225683 C 23.69991,36.086838 23.905216,34.285203 25.521727,34.22595 C 27.141095,34.166592 27.555993,35.951506 28.338452,37.037579 C 29.282543,36.908543 30.202305,36.727874 31.097955,36.502975 C 31.13771,35.257953 30.431412,33.53096 31.899101,32.993388 C 33.367093,32.455703 34.628082,33.980907 35.885754,34.750657 C 36.686518,34.3522 37.447479,33.906739 38.168384,33.428993 C 37.590224,32.268533 36.099988,30.88583 37.189205,29.954055 C 38.279831,29.02108 40.189678,30.04697 41.729032,30.38471 C 42.272129,29.78181 42.769141,29.153129 43.204157,28.493791 C 42.102292,27.590498 40.028076,26.757582 40.578178,25.568309 C 41.127144,24.381494 43.402657,24.759462 44.990839,24.612948 C 45.192591,23.900293 45.334134,23.169459 45.410488,22.425025 C 43.947653,21.922724 41.633467,21.762887 41.557357,20.504406 C 41.48111,19.243697 43.773815,18.920691 45.168872,18.311531 C 45.003124,17.576541 44.771059,16.860489 44.482175,16.16321 C 42.882955,16.132259 40.664648,16.682125 39.974141,15.539503 C 39.283489,14.396644 41.2426,13.414941 42.231337,12.435819 C 41.719523,11.81241 41.147332,11.21999 40.533671,10.658752 C 39.04307,11.108859 37.267003,12.269035 36.070145,11.421059 C 34.871745,10.571988 36.189495,9.085136 36.623318,7.8867211 C 35.848897,7.4639113 35.04136,7.0769771 34.194446,6.7383093 C 33.034176,7.5961319 31.964303,9.210946 30.436692,8.7826808 C 28.912238,8.3553013 29.397735,6.5837727 29.20954,5.347344 C 28.294139,5.1902763 27.355391,5.0800818 26.399171,5.020641 z "
+ style="opacity:0.83428572;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient2330);stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible;enable-background:accumulate" />
+ <path
+ id="path5739"
+ d="M 24.726937,10.99282 C 31.907035,10.99282 37.734358,15.531213 37.734358,21.123161 C 37.734358,26.71511 31.907035,31.253501 24.726937,31.253501 C 17.54684,31.253501 11.719516,26.71511 11.719516,21.123161 C 11.719516,15.531213 17.54684,10.99282 24.726937,10.99282 z "
+ style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient2332);stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible;enable-background:accumulate" />
+ </g>
+ </g>
+</svg>
diff --git a/xpm/gui_minus.svg b/xpm/gui_minus.svg
new file mode 100644
index 00000000..3dd1c968
--- /dev/null
+++ b/xpm/gui_minus.svg
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="96"
+ height="64"
+ id="svg2175"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="/tmp"
+ sodipodi:docname="gui_minus.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ version="1.0">
+ <defs
+ id="defs2177" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#000000"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.49803922"
+ inkscape:pageshadow="2"
+ inkscape:zoom="9.5760562"
+ inkscape:cx="32"
+ inkscape:cy="32"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:document-units="px"
+ inkscape:grid-bbox="true"
+ showguides="true"
+ inkscape:object-bbox="true"
+ inkscape:object-points="true"
+ inkscape:object-nodes="true"
+ objecttolerance="10000"
+ inkscape:grid-points="true"
+ gridtolerance="10000"
+ inkscape:guide-points="true"
+ guidetolerance="10000"
+ gridempspacing="8"
+ inkscape:window-width="1280"
+ inkscape:window-height="954"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ width="96px"
+ height="64px" />
+ <metadata
+ id="metadata2180">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <g
+ id="g2159"
+ transform="translate(16,0)">
+ <path
+ sodipodi:nodetypes="cc"
+ inkscape:transform-center-y="6"
+ inkscape:transform-center-x="-6"
+ id="path3128"
+ d="M 5.9999997,32 L 58,32"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:12;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ id="path2176"
+ d="M 8,32 L 56,32"
+ style="fill:none;fill-rule:evenodd;stroke:#c0c0c0;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+ </g>
+</svg>
diff --git a/xpm/gui_plus.svg b/xpm/gui_plus.svg
new file mode 100644
index 00000000..59747fa6
--- /dev/null
+++ b/xpm/gui_plus.svg
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="96"
+ height="64"
+ id="svg2175"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="/tmp"
+ sodipodi:docname="gui_plus.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ version="1.0">
+ <defs
+ id="defs2177" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#000000"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.49803922"
+ inkscape:pageshadow="2"
+ inkscape:zoom="9.5760562"
+ inkscape:cx="46.311646"
+ inkscape:cy="30.677839"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:document-units="px"
+ inkscape:grid-bbox="true"
+ showguides="true"
+ inkscape:object-bbox="true"
+ inkscape:object-points="true"
+ inkscape:object-nodes="true"
+ objecttolerance="10000"
+ inkscape:grid-points="true"
+ gridtolerance="10000"
+ inkscape:guide-points="true"
+ guidetolerance="10000"
+ gridempspacing="8"
+ inkscape:window-width="1280"
+ inkscape:window-height="954"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ width="96px"
+ height="64px" />
+ <metadata
+ id="metadata2180">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <g
+ id="g2161"
+ transform="translate(16,0)">
+ <path
+ sodipodi:nodetypes="cc"
+ inkscape:transform-center-y="-6"
+ inkscape:transform-center-x="-6"
+ id="path4099"
+ d="M 32,58 L 32,6"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:12;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ sodipodi:nodetypes="cc"
+ inkscape:transform-center-y="6"
+ inkscape:transform-center-x="-6"
+ id="path3128"
+ d="M 5.9999997,32 L 58,32"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:12;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ id="path2176"
+ d="M 8,32 L 56,32"
+ style="fill:none;fill-rule:evenodd;stroke:#c0c0c0;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ id="path4101"
+ d="M 32,56 L 32,8"
+ style="fill:none;fill-rule:evenodd;stroke:#c0c0c0;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+ </g>
+</svg>
diff --git a/xpm/gui_quit.svg b/xpm/gui_quit.svg
new file mode 100644
index 00000000..c15b62b4
--- /dev/null
+++ b/xpm/gui_quit.svg
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<!-- Created with Sodipodi ("http://www.sodipodi.com/") -->
+<svg
+ width="48px"
+ height="48px"
+ viewBox="0 0 256 256"
+ overflow="visible"
+ enable-background="new 0 0 256 256"
+ xml:space="preserve"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xml="http://www.w3.org/XML/1998/namespace"
+ xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ id="svg548" sodipodi:version="0.32"
+ sodipodi:docname="/home/cschalle/gnome-themes-extras/Nuvola/icons/scalable/stock/stock_quit.svg" sodipodi:docbase="/home/cschalle/gnome-themes-extras/Nuvola/icons/scalable/stock">
+ <defs id="defs600"/>
+ <sodipodi:namedview id="base"/>
+ <g id="Layer_1" stroke="#000000">
+ <path fill="none" stroke="none" d="M256,256H0V0h256V256z" id="path550"/>
+ </g>
+ <g id="Layer_2" stroke="#000000">
+ <path opacity="0.2" stroke="none" d="M11.285,130.645C11.285,198.111,66.174,253,133.643,253C201.11,253,256,198.111,256,130.645 C256,63.175,201.11,8.286,133.643,8.286C66.174,8.286,11.285,63.175,11.285,130.645z" id="path552"/>
+ <g display="none" id="g553">
+ <path display="inline" opacity="0.2" stroke="none" d="M133.429,53.076l8.095,6.894l83.157,70.817l-96.107,81.847 c0,0,0-30.299,0-34.207c-4.186-1.066-77.223-19.684-77.223-19.684v-56.355c0,0,73.011-18.221,77.223-19.272 c0-3.926,0-34.175,0-34.175L133.429,53.076z" id="path554"/>
+ <path display="inline" fill="#0066CC" stroke="none" d="M222.918,123.788L121.725,37.611v4.33c0,0,0,29.768,0,32.613 c-2.913,0.727-77.221,19.272-77.221,19.272v59.473c0,0,74.325,18.943,77.221,19.682c0,2.832,0,36.984,0,36.984L222.918,123.788z" id="path555"/>
+ <linearGradient id="XMLID_1_" gradientUnits="userSpaceOnUse" x1="54.3604" y1="123.7881" x2="207.7148" y2="123.7881">
+ <stop offset="0" style="stop-color: rgb(51, 153, 255);" id="stop557"/>
+ <stop offset="1" style="stop-color: rgb(153, 204, 255);" id="stop558"/>
+ <a:midPointStop offset="0" style="stop-color:#3399FF" id="midPointStop559"/>
+ <a:midPointStop offset="0.5" style="stop-color:#3399FF" id="midPointStop560"/>
+ <a:midPointStop offset="1" style="stop-color:#99CCFF" id="midPointStop561"/>
+ </linearGradient>
+ <path display="inline" fill="url(#XMLID_1_)" stroke="none" d="M54.36,101.525l77.223-19.273v-23.3l38.065,32.418l38.066,32.417 l-38.066,32.417l-38.065,32.418V165.32L54.36,145.639V101.525z" id="path562"/>
+ <linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="173.751" y1="88.6768" x2="158.657" y2="103.7712">
+ <stop offset="0" style="stop-color: rgb(255, 255, 255);" id="stop564"/>
+ <stop offset="0.2111" style="stop-color: rgb(251, 253, 255);" id="stop565"/>
+ <stop offset="0.4061" style="stop-color: rgb(240, 248, 255);" id="stop566"/>
+ <stop offset="0.5949" style="stop-color: rgb(221, 238, 255);" id="stop567"/>
+ <stop offset="0.7797" style="stop-color: rgb(195, 225, 255);" id="stop568"/>
+ <stop offset="0.9601" style="stop-color: rgb(162, 208, 255);" id="stop569"/>
+ <stop offset="1" style="stop-color: rgb(153, 204, 255);" id="stop570"/>
+ <a:midPointStop offset="0" style="stop-color:#FFFFFF" id="midPointStop571"/>
+ <a:midPointStop offset="0.7232" style="stop-color:#FFFFFF" id="midPointStop572"/>
+ <a:midPointStop offset="1" style="stop-color:#99CCFF" id="midPointStop573"/>
+ </linearGradient>
+ <path display="inline" opacity="0.7" fill="url(#XMLID_2_)" stroke="none" d="M133.546,69.178c0-1.388,0-2.702,0-3.847 c7.393,6.296,33.21,28.283,33.21,28.283s30.868,26.287,35.433,30.174c-1.435,1.222-8.027,6.836-16.618,14.152 C175.345,107.764,156.768,83.264,133.546,69.178z" id="path574"/>
+ </g>
+ <path fill="#660000" stroke="none" d="M6.449,125.798c0,67.467,54.889,122.356,122.357,122.356 c67.468,0,122.357-54.889,122.357-122.356c0-67.469-54.89-122.358-122.357-122.358C61.338,3.44,6.449,58.33,6.449,125.798z" id="path575"/>
+ <path fill="#660000" stroke="none" d="M128.807,5.44C62.441,5.44,8.449,59.433,8.449,125.798 c0,66.364,53.992,120.356,120.357,120.356s120.357-53.992,120.357-120.356C249.164,59.433,195.172,5.44,128.807,5.44z" id="path576"/>
+ <radialGradient id="XMLID_3_" cx="50.5859" cy="55.0098" r="259.5079" fx="50.5859" fy="55.0098" gradientUnits="userSpaceOnUse">
+ <stop offset="0.0056" style="stop-color: rgb(255, 153, 153);" id="stop578"/>
+ <stop offset="0.5843" style="stop-color: rgb(255, 0, 0);" id="stop579"/>
+ <stop offset="1" style="stop-color: rgb(153, 0, 0);" id="stop580"/>
+ <a:midPointStop offset="0.0056" style="stop-color:#FF9999" id="midPointStop581"/>
+ <a:midPointStop offset="0.5" style="stop-color:#FF9999" id="midPointStop582"/>
+ <a:midPointStop offset="0.5843" style="stop-color:#FF0000" id="midPointStop583"/>
+ <a:midPointStop offset="0.5" style="stop-color:#FF0000" id="midPointStop584"/>
+ <a:midPointStop offset="1" style="stop-color:#990000" id="midPointStop585"/>
+ </radialGradient>
+ <path fill="url(#XMLID_3_)" stroke="none" d="M14.449,125.798c0,63.157,51.199,114.356,114.357,114.356 s114.357-51.199,114.357-114.356c0-63.158-51.199-114.358-114.357-114.358S14.449,62.64,14.449,125.798z" id="path586"/>
+ <path opacity="0.5" fill="#FFFFFF" stroke="none" d="M17.449,129.813c0-63.158,51.199-114.358,114.357-114.358 c36.628,0,69.23,17.222,90.16,44.007c-20.735-29.068-54.733-48.022-93.16-48.022c-63.158,0-114.357,51.2-114.357,114.358 c0,26.53,9.037,50.946,24.196,70.348C25.301,177.439,17.449,154.543,17.449,129.813z" id="path587"/>
+ <linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="127.5151" y1="12.998" x2="127.5151" y2="101.9984">
+ <stop offset="0.0056" style="stop-color: rgb(255, 255, 255);" id="stop589"/>
+ <stop offset="1" style="stop-color: rgb(255, 86, 86);" id="stop590"/>
+ <a:midPointStop offset="0.0056" style="stop-color:#FFFFFF" id="midPointStop591"/>
+ <a:midPointStop offset="0.5" style="stop-color:#FFFFFF" id="midPointStop592"/>
+ <a:midPointStop offset="1" style="stop-color:#FF5656" id="midPointStop593"/>
+ </linearGradient>
+ <path fill="url(#XMLID_4_)" stroke="none" d="M35.672,71.752C57.685,81.768,88.603,88,122.847,88 c39.413,0,74.42-8.256,96.512-21.033c-18.02-31.361-51.86-52.527-90.552-52.527C88.179,14.44,52.903,37.779,35.672,71.752z" id="path594"/>
+ <path fill="#660000" stroke="none" d="M161.307,41.489v33.488c16.736,10.741,27.857,29.5,27.857,50.821 c0,33.281-27.076,60.356-60.357,60.356s-60.357-27.075-60.357-60.356c0-21.32,11.122-40.08,27.857-50.821V41.489 c-33.812,13.079-57.857,45.937-57.857,84.309c0,49.823,40.534,90.356,90.357,90.356s90.357-40.533,90.357-90.356 C219.164,87.426,195.119,54.568,161.307,41.489z" id="path595"/>
+ <path fill="#FFFFFF" stroke="none" d="M164.307,45.986v27.361c16.799,11.406,27.857,30.661,27.857,52.451 c0,34.935-28.422,63.356-63.357,63.356s-63.357-28.421-63.357-63.356c0-21.791,11.059-41.045,27.857-52.451V45.986 c-30.527,13.632-51.857,44.277-51.857,79.813c0,48.168,39.188,87.356,87.357,87.356s87.357-39.188,87.357-87.356 C216.164,90.263,194.834,59.618,164.307,45.986z" id="path596"/>
+ <path fill="#660000" stroke="none" d="M112.307,33c-1.657,0-3,1.246-3,2.783v122.435c0,1.537,1.343,2.782,3,2.782h33 c1.657,0,3-1.245,3-2.782V35.783c0-1.537-1.343-2.783-3-2.783H112.307z" id="path597"/>
+ <path fill="#FFFFFF" stroke="none" d="M145.307,158.218h-33V35.783h33V158.218z" id="path598"/>
+ </g>
+</svg>
diff --git a/xpm/gui_rules.svg b/xpm/gui_rules.svg
new file mode 100644
index 00000000..133dc77f
--- /dev/null
+++ b/xpm/gui_rules.svg
@@ -0,0 +1,562 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48"
+ height="48"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ version="1.0"
+ sodipodi:docbase="/home/lapo/Icone/cvs/gnome-icon-theme/scalable/actions"
+ sodipodi:docname="system-run.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4">
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3198">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop3200" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop3202" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3071">
+ <stop
+ style="stop-color:#eeeeec;stop-opacity:1;"
+ offset="0"
+ id="stop3073" />
+ <stop
+ style="stop-color:#eeeeec;stop-opacity:0;"
+ offset="1"
+ id="stop3075" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3065">
+ <stop
+ style="stop-color:#eeeeec;stop-opacity:1;"
+ offset="0"
+ id="stop3067" />
+ <stop
+ style="stop-color:#eeeeec;stop-opacity:0;"
+ offset="1"
+ id="stop3069" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3025">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop3027" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop3029" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2892">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop2894" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop2896" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2881">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop2883" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop2885" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2859">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop2861" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop2863" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2911">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop2913" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop2915" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2903">
+ <stop
+ style="stop-color:#888a85;stop-opacity:1"
+ offset="0"
+ id="stop2905" />
+ <stop
+ style="stop-color:#d3d7cf;stop-opacity:1"
+ offset="1"
+ id="stop2907" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2895">
+ <stop
+ style="stop-color:#d3d7cf;stop-opacity:1;"
+ offset="0"
+ id="stop2897" />
+ <stop
+ style="stop-color:#888a85;stop-opacity:1"
+ offset="1"
+ id="stop2899" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2903"
+ id="linearGradient3112"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.965926,-0.258819,0.258819,0.965926,7.28156,0.755642)"
+ x1="22.96538"
+ y1="35.310566"
+ x2="12.641191"
+ y2="11.423575" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2911"
+ id="linearGradient3114"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.965926,-0.258819,0.258819,0.965926,7.28156,0.755642)"
+ x1="17.413136"
+ y1="7.8708334"
+ x2="17.027729"
+ y2="52.50489" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2881"
+ id="radialGradient3116"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.977466,-0.261911,0.261911,0.977466,-2.444375,8.389657)"
+ cx="31"
+ cy="12"
+ fx="31"
+ fy="12"
+ r="11.125" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2895"
+ id="linearGradient3118"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.909106,-0.243594,0.243594,0.909106,8.676761,1.417073)"
+ x1="21.788134"
+ y1="21.876961"
+ x2="10.211396"
+ y2="3.4232786" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2859"
+ id="linearGradient3120"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.965926,-0.258819,0.258819,0.965926,-4.11682,6.729656)"
+ x1="16.487501"
+ y1="13.970829"
+ x2="32.566654"
+ y2="30.758347" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2892"
+ id="linearGradient3122"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.965926,-0.258819,0.258819,0.965926,-4.116824,6.729647)"
+ x1="28.357094"
+ y1="22.794661"
+ x2="17.732124"
+ y2="5.1875181" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2903"
+ id="linearGradient3124"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.965926,-0.258819,0.258819,0.965926,7.28156,0.755642)"
+ x1="22.96538"
+ y1="35.310566"
+ x2="12.641191"
+ y2="11.423575" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2911"
+ id="linearGradient3126"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.965926,-0.258819,0.258819,0.965926,7.28156,0.755642)"
+ x1="17.413136"
+ y1="7.8708334"
+ x2="17.027729"
+ y2="52.50489" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2881"
+ id="radialGradient3128"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.977466,-0.261911,0.261911,0.977466,-2.444375,8.389657)"
+ cx="31"
+ cy="12"
+ fx="31"
+ fy="12"
+ r="11.125" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2895"
+ id="linearGradient3130"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.909106,-0.243594,0.243594,0.909106,8.676761,1.417073)"
+ x1="21.788134"
+ y1="21.876961"
+ x2="10.211396"
+ y2="3.4232786" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2859"
+ id="linearGradient3132"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.965926,-0.258819,0.258819,0.965926,-4.11682,6.729656)"
+ x1="16.487501"
+ y1="13.970829"
+ x2="32.566654"
+ y2="30.758347" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2892"
+ id="linearGradient3134"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.965926,-0.258819,0.258819,0.965926,-4.116824,6.729647)"
+ x1="28.357094"
+ y1="22.794661"
+ x2="17.732124"
+ y2="5.1875181" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2892"
+ id="linearGradient3171"
+ gradientUnits="userSpaceOnUse"
+ x1="14.375"
+ y1="31.0625"
+ x2="30.4375"
+ y2="44.0625" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3071"
+ id="linearGradient3177"
+ gradientUnits="userSpaceOnUse"
+ x1="20.806717"
+ y1="36.825302"
+ x2="17.449335"
+ y2="30.900536" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3065"
+ id="linearGradient3179"
+ gradientUnits="userSpaceOnUse"
+ x1="17.659994"
+ y1="36.680489"
+ x2="23.031794"
+ y2="31.111195" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2903"
+ id="linearGradient3184"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-3,1)"
+ x1="16.793787"
+ y1="30.675884"
+ x2="22.052893"
+ y2="37.128235" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3025"
+ id="radialGradient3187"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.996403,-26,1.1241)"
+ cx="42.5"
+ cy="34.5"
+ fx="42.5"
+ fy="34.5"
+ r="8.6875" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2895"
+ id="linearGradient3191"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-3,1)"
+ x1="14.495688"
+ y1="29.88039"
+ x2="26.737476"
+ y2="42.564117" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3198"
+ id="radialGradient3204"
+ cx="15.3125"
+ cy="34.65625"
+ fx="15.3125"
+ fy="34.65625"
+ r="9.5"
+ gradientTransform="matrix(1,0,0,1.003289,0,-0.114001)"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3198"
+ id="radialGradient3208"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,1.003289,0,-0.114001)"
+ cx="15.3125"
+ cy="34.65625"
+ fx="15.3125"
+ fy="34.65625"
+ r="9.5" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1"
+ inkscape:cx="31.777116"
+ inkscape:cy="6.2374543"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ gridempspacing="2"
+ gridspacingx="0.5px"
+ gridspacingy="0.5px"
+ inkscape:window-width="1051"
+ inkscape:window-height="738"
+ inkscape:window-x="263"
+ inkscape:window-y="212"
+ inkscape:showpageshadow="false"
+ width="48px"
+ height="48px"
+ gridtolerance="10000"
+ inkscape:grid-points="false"
+ inkscape:grid-bbox="true"
+ showborder="false"
+ borderlayer="true"
+ inkscape:guide-bbox="false"
+ inkscape:object-paths="false" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Lapo Calamandrei</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:title>System Run</dc:title>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>run</rdf:li>
+ <rdf:li>launch</rdf:li>
+ <rdf:li>exec</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/SourceCode" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Livello 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.49019608;fill:url(#radialGradient3204);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path3110"
+ sodipodi:cx="15.3125"
+ sodipodi:cy="34.65625"
+ sodipodi:rx="9.5"
+ sodipodi:ry="9.53125"
+ d="M 24.8125 34.65625 A 9.5 9.53125 0 1 1 5.8125,34.65625 A 9.5 9.53125 0 1 1 24.8125 34.65625 z"
+ transform="matrix(1.388157,0,0,0.498361,-4.756162,25.47868)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.24705882;fill:url(#radialGradient3208);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path3206"
+ sodipodi:cx="15.3125"
+ sodipodi:cy="34.65625"
+ sodipodi:rx="9.5"
+ sodipodi:ry="9.53125"
+ d="M 24.8125 34.65625 A 9.5 9.53125 0 1 1 5.8125,34.65625 A 9.5 9.53125 0 1 1 24.8125 34.65625 z"
+ transform="matrix(1.473683,0,0,0.655738,10.43425,15.52458)" />
+ <g
+ id="g2904"
+ transform="matrix(0.965926,0.258819,-0.258819,0.965926,6.16213,8.3855)">
+ <path
+ id="path2779"
+ d="M 31,0.5 C 30.438064,0.50000002 29.8842,0.547001 29.34375,0.625 L 29.125,3.71875 C 28.16536,3.9344947 27.275486,4.3022815 26.46875,4.8125 L 24.125,2.78125 C 22.999999,3.5000009 22.5,4 21.78125,5.125 L 23.8125,7.46875 C 23.302281,8.2754859 22.934495,9.1653595 22.71875,10.125 L 19.625,10.34375 C 19.547,10.8842 19.5,11.438062 19.5,12 C 19.499999,12.561939 19.547001,13.115801 19.625,13.65625 L 22.71875,13.875 C 22.934495,14.834641 23.302281,15.724514 23.8125,16.53125 L 21.78125,18.875 C 22.5,19.999999 23,20.5 24.125,21.21875 L 26.46875,19.1875 C 27.275486,19.697719 28.165359,20.065505 29.125,20.28125 L 29.34375,23.375 C 29.8842,23.452999 30.438063,23.5 31,23.5 C 31.561936,23.5 32.115801,23.452999 32.65625,23.375 L 32.875,20.28125 C 33.834641,20.065505 34.724514,19.697719 35.53125,19.1875 L 37.875,21.21875 C 39.000002,20.499999 39.5,20 40.21875,18.875 L 38.1875,16.53125 C 38.697719,15.724514 39.065505,14.834641 39.28125,13.875 L 42.375,13.65625 C 42.452999,13.115801 42.499999,12.561939 42.5,12 C 42.5,11.438063 42.452999,10.884199 42.375,10.34375 L 39.28125,10.125 C 39.065505,9.1653595 38.697719,8.2754859 38.1875,7.46875 L 40.21875,5.125 C 39.569261,4.0173152 39,3.5 37.875,2.78125 L 35.53125,4.8125 C 34.724514,4.3022815 33.834641,3.9344947 32.875,3.71875 L 32.65625,0.625 C 32.1158,0.54700102 31.561938,0.5 31,0.5 z M 31,9.5 C 32.380001,9.5000003 33.499999,10.619998 33.5,12 C 33.500001,13.380003 32.380003,14.5 31,14.5 C 29.619998,14.5 28.5,13.380003 28.5,12 C 28.5,10.619998 29.619998,9.5 31,9.5 z "
+ style="fill:url(#linearGradient3112);fill-opacity:1;stroke:#2e3436;stroke-width:1.00543582;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ id="path2819"
+ d="M 31.000007,1.437503 C 30.739934,1.437503 30.477873,1.47946 30.218757,1.500003 L 30.000007,4.562504 C 28.682977,4.737208 27.478296,5.264549 26.468755,6.031255 L 24.156255,4.062504 C 23.765212,4.40014 23.400139,4.765213 23.062504,5.156255 L 25.031255,7.468756 C 24.264549,8.478295 23.737207,9.682977 23.562504,11.000006 L 20.500004,11.218757 C 20.47946,11.477873 20.437504,11.739933 20.437504,12.000007 C 20.437504,12.26008 20.47946,12.52214 20.500003,12.781257 L 23.562504,13.000007 C 23.737208,14.317036 24.264549,15.521718 25.031255,16.531258 L 23.062504,18.843759 C 23.400139,19.234801 23.765212,19.599874 24.156255,19.937509 L 26.468756,17.968758 C 27.478295,18.735464 28.682977,19.262806 30.000006,19.437509 L 30.218757,22.50001 C 30.477873,22.520554 30.739934,22.56251 31.000007,22.56251 C 31.260079,22.56251 31.522141,22.520554 31.781257,22.50001 L 32.000007,19.437509 C 33.317036,19.262805 34.521718,18.735464 35.531258,17.968758 L 37.843759,19.937509 C 38.234802,19.599874 38.599874,19.234801 38.937509,18.843758 L 36.968758,16.531258 C 37.735464,15.521718 38.262806,14.317036 38.437509,13.000007 L 41.50001,12.781257 C 41.520554,12.522141 41.56251,12.26008 41.56251,12.000006 C 41.562511,11.739934 41.520554,11.477873 41.50001,11.218757 L 38.437509,11.000007 C 38.262806,9.682977 37.735464,8.478296 36.968758,7.468755 L 38.937509,5.156254 C 38.599875,4.765213 38.234802,4.400139 37.843759,4.062504 L 35.531258,6.031255 C 34.521719,5.264549 33.317037,4.737207 32.000008,4.562504 L 31.781257,1.500003 C 31.522141,1.47946 31.26008,1.437504 31.000007,1.437503 z "
+ style="fill:none;fill-opacity:1;stroke:url(#linearGradient3114);stroke-width:1.13333356;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ id="path2875"
+ d="M 31,0.875 C 30.67898,0.87500002 30.416025,0.91938231 30.1875,0.9375 L 29.6875,0.96875 L 29.65625,1.46875 L 29.46875,4.125 C 28.408658,4.3340559 27.427074,4.7655265 26.5625,5.34375 L 24.15625,3.3125 L 22.3125,5.15625 L 24.34375,7.5625 C 23.765526,8.427073 23.334055,9.408658 23.125,10.46875 L 20.46875,10.65625 L 19.96875,10.6875 L 19.9375,11.1875 C 19.919381,11.416028 19.875,11.678982 19.875,12 C 19.875,12.321017 19.919382,12.583973 19.9375,12.8125 L 19.96875,13.3125 L 20.46875,13.34375 L 23.125,13.53125 C 23.334056,14.591342 23.765526,15.572926 24.34375,16.4375 L 22.625,18.46875 L 22.3125,18.84375 L 22.625,19.21875 C 22.98067,19.630679 23.369319,20.01933 23.78125,20.375 L 24.15625,20.6875 L 24.53125,20.375 L 26.5625,18.65625 C 27.427073,19.234474 28.408658,19.665945 29.46875,19.875 L 29.65625,22.53125 L 29.6875,23.03125 L 30.1875,23.0625 C 30.416028,23.080619 30.678982,23.125 31,23.125 C 31.321018,23.125001 31.583973,23.080619 31.8125,23.0625 L 32.3125,23.03125 L 32.34375,22.53125 L 32.53125,19.875 C 33.591341,19.665944 34.572926,19.234474 35.4375,18.65625 L 37.46875,20.375 L 37.84375,20.6875 L 38.21875,20.375 C 38.630683,20.019329 39.01933,19.63068 39.375,19.21875 L 39.6875,18.84375 L 39.375,18.46875 L 37.65625,16.4375 C 38.234474,15.572927 38.665945,14.591342 38.875,13.53125 L 41.53125,13.34375 L 42.03125,13.3125 L 42.0625,12.8125 C 42.080617,12.583975 42.125,12.321018 42.125,12 C 42.124999,11.678985 42.080619,11.416028 42.0625,11.1875 L 42.03125,10.6875 L 41.53125,10.65625 L 38.875,10.46875 C 38.665945,9.4086575 38.234474,8.4270738 37.65625,7.5625 L 39.375,5.53125 L 39.6875,5.15625 L 39.375,4.78125 C 39.019332,4.3693213 38.630681,3.9806704 38.21875,3.625 L 37.84375,3.3125 L 37.46875,3.625 L 35.4375,5.34375 C 34.572927,4.7655263 33.591342,4.3340554 32.53125,4.125 L 32.34375,1.46875 L 32.3125,0.96875 L 31.8125,0.9375 C 31.583973,0.91938221 31.321016,0.87500123 31,0.875 z M 31,8.5 C 32.932001,8.4999976 34.499998,10.067999 34.5,12 C 34.500002,13.932002 32.932001,15.499998 31,15.5 C 29.067998,15.500002 27.500002,13.932001 27.5,12 C 27.499999,10.067998 29.067999,8.5000022 31,8.5 z "
+ style="opacity:0.8;fill:url(#radialGradient3116);fill-opacity:1;stroke:none;stroke-width:1.13333356;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ id="path2867"
+ d="M 31,4 C 26.584003,4 23,7.584 23,12 C 23,16.416001 26.584001,20.000001 31,20 C 35.415999,20 39,16.416001 39,12 C 38.999999,7.584 35.416,4 31,4 z M 31,9 C 32.655999,8.9999982 33.999998,10.344006 34,12 C 34.000002,13.655994 32.655999,14.999998 31,15 C 29.344,15.000002 28.000002,13.655994 28,12 C 27.999999,10.344006 29.344001,9.0000019 31,9 z "
+ style="fill:url(#linearGradient3118);fill-opacity:1;stroke:none;stroke-width:1.00000024;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ transform="matrix(0.882353,-1.02643e-6,1.02643e-6,0.882353,10.26469,-4.764686)"
+ d="M 32 19 A 8.5 8.5 0 1 1 15,19 A 8.5 8.5 0 1 1 32 19 z"
+ sodipodi:ry="8.5"
+ sodipodi:rx="8.5"
+ sodipodi:cy="19"
+ sodipodi:cx="23.5"
+ id="path2849"
+ style="fill:none;fill-opacity:1;stroke:url(#linearGradient3120);stroke-width:1.13333321;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ sodipodi:type="arc" />
+ <path
+ transform="matrix(0.411765,-4.790003e-7,4.790003e-7,0.411765,21.32353,4.17647)"
+ d="M 32 19 A 8.5 8.5 0 1 1 15,19 A 8.5 8.5 0 1 1 32 19 z"
+ sodipodi:ry="8.5"
+ sodipodi:rx="8.5"
+ sodipodi:cy="19"
+ sodipodi:cx="23.5"
+ id="path2835"
+ style="fill:none;fill-opacity:1;stroke:url(#linearGradient3122);stroke-width:2.42857122;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ sodipodi:type="arc" />
+ </g>
+ <g
+ id="g2924"
+ transform="matrix(0.965926,0.258819,-0.258819,0.965926,-6.83787,-6.6145)">
+ <path
+ id="path2926"
+ d="M 31,0.5 C 30.438064,0.50000002 29.8842,0.547001 29.34375,0.625 L 29.125,3.71875 C 28.16536,3.9344947 27.275486,4.3022815 26.46875,4.8125 L 24.125,2.78125 C 22.999999,3.5000009 22.5,4 21.78125,5.125 L 23.8125,7.46875 C 23.302281,8.2754859 22.934495,9.1653595 22.71875,10.125 L 19.625,10.34375 C 19.547,10.8842 19.5,11.438062 19.5,12 C 19.499999,12.561939 19.547001,13.115801 19.625,13.65625 L 22.71875,13.875 C 22.934495,14.834641 23.302281,15.724514 23.8125,16.53125 L 21.78125,18.875 C 22.5,19.999999 23,20.5 24.125,21.21875 L 26.46875,19.1875 C 27.275486,19.697719 28.165359,20.065505 29.125,20.28125 L 29.34375,23.375 C 29.8842,23.452999 30.438063,23.5 31,23.5 C 31.561936,23.5 32.115801,23.452999 32.65625,23.375 L 32.875,20.28125 C 33.834641,20.065505 34.724514,19.697719 35.53125,19.1875 L 37.875,21.21875 C 39.000002,20.499999 39.5,20 40.21875,18.875 L 38.1875,16.53125 C 38.697719,15.724514 39.065505,14.834641 39.28125,13.875 L 42.375,13.65625 C 42.452999,13.115801 42.499999,12.561939 42.5,12 C 42.5,11.438063 42.452999,10.884199 42.375,10.34375 L 39.28125,10.125 C 39.065505,9.1653595 38.697719,8.2754859 38.1875,7.46875 L 40.21875,5.125 C 39.569261,4.0173152 39,3.5 37.875,2.78125 L 35.53125,4.8125 C 34.724514,4.3022815 33.834641,3.9344947 32.875,3.71875 L 32.65625,0.625 C 32.1158,0.54700102 31.561938,0.5 31,0.5 z M 31,9.5 C 32.380001,9.5000003 33.499999,10.619998 33.5,12 C 33.500001,13.380003 32.380003,14.5 31,14.5 C 29.619998,14.5 28.5,13.380003 28.5,12 C 28.5,10.619998 29.619998,9.5 31,9.5 z "
+ style="fill:url(#linearGradient3124);fill-opacity:1;stroke:#2e3436;stroke-width:1.00543582;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ id="path2928"
+ d="M 31.000007,1.437503 C 30.739934,1.437503 30.477873,1.47946 30.218757,1.500003 L 30.000007,4.562504 C 28.682977,4.737208 27.478296,5.264549 26.468755,6.031255 L 24.156255,4.062504 C 23.765212,4.40014 23.400139,4.765213 23.062504,5.156255 L 25.031255,7.468756 C 24.264549,8.478295 23.737207,9.682977 23.562504,11.000006 L 20.500004,11.218757 C 20.47946,11.477873 20.437504,11.739933 20.437504,12.000007 C 20.437504,12.26008 20.47946,12.52214 20.500003,12.781257 L 23.562504,13.000007 C 23.737208,14.317036 24.264549,15.521718 25.031255,16.531258 L 23.062504,18.843759 C 23.400139,19.234801 23.765212,19.599874 24.156255,19.937509 L 26.468756,17.968758 C 27.478295,18.735464 28.682977,19.262806 30.000006,19.437509 L 30.218757,22.50001 C 30.477873,22.520554 30.739934,22.56251 31.000007,22.56251 C 31.260079,22.56251 31.522141,22.520554 31.781257,22.50001 L 32.000007,19.437509 C 33.317036,19.262805 34.521718,18.735464 35.531258,17.968758 L 37.843759,19.937509 C 38.234802,19.599874 38.599874,19.234801 38.937509,18.843758 L 36.968758,16.531258 C 37.735464,15.521718 38.262806,14.317036 38.437509,13.000007 L 41.50001,12.781257 C 41.520554,12.522141 41.56251,12.26008 41.56251,12.000006 C 41.562511,11.739934 41.520554,11.477873 41.50001,11.218757 L 38.437509,11.000007 C 38.262806,9.682977 37.735464,8.478296 36.968758,7.468755 L 38.937509,5.156254 C 38.599875,4.765213 38.234802,4.400139 37.843759,4.062504 L 35.531258,6.031255 C 34.521719,5.264549 33.317037,4.737207 32.000008,4.562504 L 31.781257,1.500003 C 31.522141,1.47946 31.26008,1.437504 31.000007,1.437503 z "
+ style="fill:none;fill-opacity:1;stroke:url(#linearGradient3126);stroke-width:1.13333356;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ id="path2930"
+ d="M 31,0.875 C 30.67898,0.87500002 30.416025,0.91938231 30.1875,0.9375 L 29.6875,0.96875 L 29.65625,1.46875 L 29.46875,4.125 C 28.408658,4.3340559 27.427074,4.7655265 26.5625,5.34375 L 24.15625,3.3125 L 22.3125,5.15625 L 24.34375,7.5625 C 23.765526,8.427073 23.334055,9.408658 23.125,10.46875 L 20.46875,10.65625 L 19.96875,10.6875 L 19.9375,11.1875 C 19.919381,11.416028 19.875,11.678982 19.875,12 C 19.875,12.321017 19.919382,12.583973 19.9375,12.8125 L 19.96875,13.3125 L 20.46875,13.34375 L 23.125,13.53125 C 23.334056,14.591342 23.765526,15.572926 24.34375,16.4375 L 22.625,18.46875 L 22.3125,18.84375 L 22.625,19.21875 C 22.98067,19.630679 23.369319,20.01933 23.78125,20.375 L 24.15625,20.6875 L 24.53125,20.375 L 26.5625,18.65625 C 27.427073,19.234474 28.408658,19.665945 29.46875,19.875 L 29.65625,22.53125 L 29.6875,23.03125 L 30.1875,23.0625 C 30.416028,23.080619 30.678982,23.125 31,23.125 C 31.321018,23.125001 31.583973,23.080619 31.8125,23.0625 L 32.3125,23.03125 L 32.34375,22.53125 L 32.53125,19.875 C 33.591341,19.665944 34.572926,19.234474 35.4375,18.65625 L 37.46875,20.375 L 37.84375,20.6875 L 38.21875,20.375 C 38.630683,20.019329 39.01933,19.63068 39.375,19.21875 L 39.6875,18.84375 L 39.375,18.46875 L 37.65625,16.4375 C 38.234474,15.572927 38.665945,14.591342 38.875,13.53125 L 41.53125,13.34375 L 42.03125,13.3125 L 42.0625,12.8125 C 42.080617,12.583975 42.125,12.321018 42.125,12 C 42.124999,11.678985 42.080619,11.416028 42.0625,11.1875 L 42.03125,10.6875 L 41.53125,10.65625 L 38.875,10.46875 C 38.665945,9.4086575 38.234474,8.4270738 37.65625,7.5625 L 39.375,5.53125 L 39.6875,5.15625 L 39.375,4.78125 C 39.019332,4.3693213 38.630681,3.9806704 38.21875,3.625 L 37.84375,3.3125 L 37.46875,3.625 L 35.4375,5.34375 C 34.572927,4.7655263 33.591342,4.3340554 32.53125,4.125 L 32.34375,1.46875 L 32.3125,0.96875 L 31.8125,0.9375 C 31.583973,0.91938221 31.321016,0.87500123 31,0.875 z M 31,8.5 C 32.932001,8.4999976 34.499998,10.067999 34.5,12 C 34.500002,13.932002 32.932001,15.499998 31,15.5 C 29.067998,15.500002 27.500002,13.932001 27.5,12 C 27.499999,10.067998 29.067999,8.5000022 31,8.5 z "
+ style="opacity:0.8;fill:url(#radialGradient3128);fill-opacity:1;stroke:none;stroke-width:1.13333356;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ id="path2932"
+ d="M 31,4 C 26.584003,4 23,7.584 23,12 C 23,16.416001 26.584001,20.000001 31,20 C 35.415999,20 39,16.416001 39,12 C 38.999999,7.584 35.416,4 31,4 z M 31,9 C 32.655999,8.9999982 33.999998,10.344006 34,12 C 34.000002,13.655994 32.655999,14.999998 31,15 C 29.344,15.000002 28.000002,13.655994 28,12 C 27.999999,10.344006 29.344001,9.0000019 31,9 z "
+ style="fill:url(#linearGradient3130);fill-opacity:1;stroke:none;stroke-width:1.00000024;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ transform="matrix(0.882353,-1.02643e-6,1.02643e-6,0.882353,10.26469,-4.764686)"
+ d="M 32 19 A 8.5 8.5 0 1 1 15,19 A 8.5 8.5 0 1 1 32 19 z"
+ sodipodi:ry="8.5"
+ sodipodi:rx="8.5"
+ sodipodi:cy="19"
+ sodipodi:cx="23.5"
+ id="path2934"
+ style="fill:none;fill-opacity:1;stroke:url(#linearGradient3132);stroke-width:1.13333321;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ sodipodi:type="arc" />
+ <path
+ transform="matrix(0.411765,-4.790003e-7,4.790003e-7,0.411765,21.32353,4.17647)"
+ d="M 32 19 A 8.5 8.5 0 1 1 15,19 A 8.5 8.5 0 1 1 32 19 z"
+ sodipodi:ry="8.5"
+ sodipodi:rx="8.5"
+ sodipodi:cy="19"
+ sodipodi:cx="23.5"
+ id="path2936"
+ style="fill:none;fill-opacity:1;stroke:url(#linearGradient3134);stroke-width:2.42857122;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ sodipodi:type="arc" />
+ </g>
+ <path
+ style="fill:url(#linearGradient3191);fill-opacity:1;stroke:#2e3436;stroke-width:1.00000012;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 16.15625,26.5 C 15.667854,26.518775 15.184245,26.593793 14.71875,26.6875 L 14.6875,26.6875 C 14.33804,26.75907 13.989707,26.857915 13.65625,26.96875 C 13.173912,27.12907 12.723532,27.3266 12.28125,27.5625 L 12.9375,30.6875 C 12.461256,31.040214 12.013429,31.452683 11.65625,31.9375 L 8.5625,31.3125 C 8.3061026,31.796885 8.0717231,32.280857 7.90625,32.8125 C 7.676383,33.551032 7.5309966,34.349931 7.5,35.15625 L 10.5625,36.1875 C 10.632137,36.779968 10.764473,37.368191 11,37.90625 L 8.875,40.28125 C 9.1526891,40.722567 9.4647247,41.145896 9.8125,41.53125 L 10.4375,42.125 C 10.825721,42.480401 11.241422,42.810104 11.6875,43.09375 L 14.0625,40.96875 C 14.347986,41.096023 14.626055,41.197799 14.9375,41.28125 C 15.232216,41.360219 15.549433,41.435451 15.84375,41.46875 L 16.84375,44.5 C 17.332146,44.481225 17.815755,44.406207 18.28125,44.3125 L 18.3125,44.3125 C 18.66196,44.24093 19.010293,44.142085 19.34375,44.03125 C 19.826088,43.87093 20.276468,43.6734 20.71875,43.4375 L 20.0625,40.3125 C 20.538744,39.959787 20.986571,39.547317 21.34375,39.0625 L 24.4375,39.6875 C 24.693897,39.203115 24.928277,38.719143 25.09375,38.1875 C 25.323617,37.448968 25.469003,36.650069 25.5,35.84375 L 22.4375,34.8125 C 22.367863,34.220032 22.235527,33.631809 22,33.09375 L 24.125,30.71875 C 23.847311,30.277433 23.535275,29.854104 23.1875,29.46875 L 22.5625,28.875 C 22.174279,28.519599 21.758578,28.189896 21.3125,27.90625 L 18.9375,30.03125 C 18.652013,29.903977 18.373945,29.802201 18.0625,29.71875 C 17.767784,29.639781 17.450567,29.564549 17.15625,29.53125 L 16.15625,26.5 z M 16.28125,33.5 C 16.394759,33.487329 16.508957,33.493053 16.625,33.5 C 16.75762,33.507939 16.897952,33.526783 17.03125,33.5625 C 18.097631,33.848233 18.723237,34.964866 18.4375,36.03125 C 18.151764,37.097638 17.035131,37.723235 15.96875,37.4375 C 14.902369,37.151767 14.276764,36.035135 14.5625,34.96875 C 14.781268,34.1523 15.486686,33.588694 16.28125,33.5 z "
+ id="path2978" />
+ <path
+ sodipodi:type="inkscape:offset"
+ inkscape:radius="-0.96878749"
+ inkscape:original="M 19.09375 25.3125 L 15.25 26.34375 L 16.28125 31.28125 L 11.3125 30.25 L 10.28125 34.09375 L 15.09375 35.6875 L 11.75 39.4375 L 14.53125 42.25 L 18.3125 38.875 L 19.90625 43.6875 L 23.75 42.65625 L 22.71875 37.71875 L 27.6875 38.75 L 28.71875 34.90625 L 23.90625 33.3125 L 27.25 29.5625 L 24.46875 26.75 L 20.6875 30.125 L 19.09375 25.3125 z "
+ style="fill:none;fill-opacity:1;stroke:url(#linearGradient3171);stroke-width:1.00000012;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path2995"
+ d="M 18.46875,26.46875 L 16.375,27.0625 L 17.21875,31.09375 C 17.274871,31.40599 17.174576,31.725926 16.950251,31.950251 C 16.725926,32.174576 16.40599,32.274871 16.09375,32.21875 L 12.03125,31.375 L 11.4375,33.46875 L 15.40625,34.78125 C 15.71319,34.886951 15.946796,35.139347 16.028484,35.453532 C 16.110172,35.767716 16.029085,36.101932 15.8125,36.34375 L 13.09375,39.40625 L 14.5625,40.90625 L 17.65625,38.15625 C 17.898068,37.939665 18.232284,37.858578 18.546468,37.940266 C 18.860653,38.021954 19.113049,38.25556 19.21875,38.5625 L 20.53125,42.53125 L 22.625,41.9375 L 21.78125,37.90625 C 21.725129,37.59401 21.825424,37.274074 22.049749,37.049749 C 22.274074,36.825424 22.59401,36.725129 22.90625,36.78125 L 26.96875,37.625 L 27.5625,35.53125 L 23.59375,34.21875 C 23.28681,34.113049 23.053204,33.860653 22.971516,33.546468 C 22.889828,33.232284 22.970915,32.898068 23.1875,32.65625 L 25.90625,29.59375 L 24.4375,28.09375 L 21.34375,30.84375 C 21.101932,31.060335 20.767716,31.141422 20.453532,31.059734 C 20.139347,30.978046 19.886951,30.74444 19.78125,30.4375 L 18.46875,26.46875 z "
+ transform="translate(-3,1)" />
+ <path
+ style="opacity:0.9372549;fill:url(#radialGradient3187);fill-opacity:1;stroke:none;stroke-width:1.00000012;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 15.78125,26.84375 L 12.78125,27.71875 L 13.71875,32.1875 C 13.746003,32.339128 13.702685,32.484815 13.59375,32.59375 C 13.484816,32.702685 13.339128,32.746003 13.1875,32.71875 L 8.6875,31.78125 L 7.8125,34.78125 L 12.25,36.25 C 12.3991,36.301346 12.491569,36.441131 12.53125,36.59375 C 12.57093,36.746367 12.542708,36.882535 12.4375,37 L 9.40625,40.4375 L 11.53125,42.59375 L 15,39.53125 C 15.117466,39.426041 15.253631,39.397819 15.40625,39.4375 C 15.558869,39.477181 15.698654,39.56965 15.75,39.71875 L 17.21875,44.15625 L 20.21875,43.28125 L 19.28125,38.8125 C 19.253997,38.660872 19.297315,38.515185 19.40625,38.40625 C 19.515185,38.297315 19.660874,38.253997 19.8125,38.28125 L 24.3125,39.21875 L 25.1875,36.21875 L 20.75,34.75 C 20.6009,34.698654 20.508431,34.558869 20.46875,34.40625 C 20.42907,34.253633 20.457292,34.117465 20.5625,34 L 23.59375,30.5625 L 21.46875,28.40625 L 18,31.46875 C 17.882534,31.573959 17.746369,31.602181 17.59375,31.5625 C 17.441131,31.522819 17.301346,31.43035 17.25,31.28125 L 15.78125,26.84375 z M 16.5,32.5 C 18.155998,32.499999 19.5,33.844 19.5,35.5 C 19.500001,37.156001 18.155998,38.5 16.5,38.5 C 14.844002,38.500001 13.5,37.156 13.5,35.5 C 13.5,33.844001 14.844002,32.5 16.5,32.5 z "
+ id="path2999" />
+ <path
+ style="fill:url(#linearGradient3184);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 16.5,30 C 13.464,30 11,32.464002 11,35.5 C 11,38.536 13.464,40.999998 16.5,41 C 19.536,41 22,38.536002 22,35.5 C 22,32.464 19.536,30 16.5,30 z M 16.5,33 C 17.879997,33 18.999999,34.120001 19,35.5 C 19,36.879998 17.879998,38.000001 16.5,38 C 15.120003,38 14.000001,36.879998 14,35.5 C 14,34.120002 15.120003,33.000001 16.5,33 z "
+ id="path3002" />
+ <path
+ sodipodi:type="arc"
+ style="fill:none;fill-opacity:1;stroke:url(#linearGradient3177);stroke-width:1.05329549;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path3033"
+ sodipodi:cx="19.555922"
+ sodipodi:cy="34.587067"
+ sodipodi:rx="3.1598835"
+ sodipodi:ry="3.1598835"
+ d="M 22.715805 34.587067 A 3.1598835 3.1598835 0 1 1 16.396038,34.587067 A 3.1598835 3.1598835 0 1 1 22.715805 34.587067 z"
+ transform="matrix(0.949401,0,0,0.949402,-2.066417,2.662986)" />
+ <path
+ sodipodi:type="arc"
+ style="fill:none;fill-opacity:1;stroke:url(#linearGradient3179);stroke-width:0.63197702;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path3037"
+ sodipodi:cx="19.555922"
+ sodipodi:cy="34.587067"
+ sodipodi:rx="3.1598835"
+ sodipodi:ry="3.1598835"
+ d="M 22.715805 34.587067 A 3.1598835 3.1598835 0 1 1 16.396038,34.587067 A 3.1598835 3.1598835 0 1 1 22.715805 34.587067 z"
+ transform="matrix(1.582334,0,0,-1.582339,-14.44401,90.22847)" />
+ </g>
+</svg>
diff --git a/xpm/gui_select_country.svg b/xpm/gui_select_country.svg
new file mode 100644
index 00000000..61e2dcb8
--- /dev/null
+++ b/xpm/gui_select_country.svg
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48px"
+ height="48px"
+ id="svg3220"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="/tmp"
+ sodipodi:docname="gui_inactive.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3222">
+ <linearGradient
+ y2="40.064526"
+ x2="27.044603"
+ y1="19.939341"
+ x1="17.838388"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient7010"
+ xlink:href="#linearGradient7000"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient7000"
+ inkscape:collect="always">
+ <stop
+ id="stop7002"
+ offset="0"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ <stop
+ id="stop7004"
+ offset="1"
+ style="stop-color:#ffffff;stop-opacity:0;" />
+ </linearGradient>
+ <linearGradient
+ gradientUnits="userSpaceOnUse"
+ y2="61.80806"
+ x2="39.418972"
+ y1="19.939341"
+ x1="17.838388"
+ id="linearGradient7006"
+ xlink:href="#linearGradient7000"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient2790">
+ <stop
+ id="stop2792"
+ offset="0"
+ style="stop-color:white;stop-opacity:1;" />
+ <stop
+ style="stop-color:#d3d7cf;stop-opacity:1;"
+ offset="0.8108108"
+ id="stop2798" />
+ <stop
+ id="stop2794"
+ offset="1"
+ style="stop-color:#959e8b;stop-opacity:1;" />
+ </linearGradient>
+ <linearGradient
+ gradientTransform="matrix(1.7588235,0,0,1.7588235,6.032353,6.0323539)"
+ gradientUnits="userSpaceOnUse"
+ y2="30.038462"
+ x2="19.255854"
+ y1="0.068979882"
+ x1="4.3764215"
+ id="linearGradient6945"
+ xlink:href="#linearGradient2790"
+ inkscape:collect="always" />
+ <radialGradient
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.5,0,9.75)"
+ r="3"
+ fy="19.5"
+ fx="-2"
+ cy="19.5"
+ cx="-2"
+ id="radialGradient6972"
+ xlink:href="#linearGradient6964"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient6964"
+ inkscape:collect="always">
+ <stop
+ id="stop5939"
+ offset="0"
+ style="stop-color:#000000;stop-opacity:1;" />
+ <stop
+ id="stop6968"
+ offset="1"
+ style="stop-color:#000000;stop-opacity:0;" />
+ </linearGradient>
+ <radialGradient
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.5,0,9.75)"
+ r="3"
+ fy="19.5"
+ fx="-2"
+ cy="19.5"
+ cx="-2"
+ id="radialGradient6970"
+ xlink:href="#linearGradient6964"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient6958">
+ <stop
+ id="stop6960"
+ offset="0"
+ style="stop-color:#729fcf;stop-opacity:1;" />
+ <stop
+ style="stop-color:#729fcf;stop-opacity:1;"
+ offset="0.60000002"
+ id="stop6966" />
+ <stop
+ id="stop6962"
+ offset="1"
+ style="stop-color:#729fcf;stop-opacity:0;" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient6958"
+ id="radialGradient5962"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.8087117,0,0,3.5234273,-57.039447,-57.368542)"
+ cx="70.53125"
+ cy="22.734375"
+ fx="70.53125"
+ fy="22.734375"
+ r="3.5975378" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="7"
+ inkscape:cx="24"
+ inkscape:cy="24"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:window-width="800"
+ inkscape:window-height="649"
+ inkscape:window-x="472"
+ inkscape:window-y="296" />
+ <metadata
+ id="metadata3225">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <g
+ style="display:inline"
+ inkscape:label="Layer 1"
+ id="g5953"
+ transform="translate(-0.6553298,-1.376604)">
+ <g
+ transform="matrix(1.8719362,0,0,1.5205944,5.0000002,10.484903)"
+ style="opacity:0.7238806"
+ id="g6978">
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.14179107;fill:url(#radialGradient5962);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path6974"
+ sodipodi:cx="-2"
+ sodipodi:cy="19.5"
+ sodipodi:rx="3"
+ sodipodi:ry="1.5"
+ d="M 1 19.5 A 3 1.5 0 1 1 -5,19.5 A 3 1.5 0 1 1 1 19.5 z"
+ transform="matrix(2.0312501,0,0,1.2946278,14.455805,-7.7591062)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.2;fill:url(#radialGradient6970);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path6960"
+ sodipodi:cx="-2"
+ sodipodi:cy="19.5"
+ sodipodi:rx="3"
+ sodipodi:ry="1.5"
+ d="M 1 19.5 A 3 1.5 0 1 1 -5,19.5 A 3 1.5 0 1 1 1 19.5 z"
+ transform="matrix(1.6666667,0,0,1.2946278,8.3333333,-6.6568542)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.2;fill:url(#radialGradient6972);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path6962"
+ sodipodi:cx="-2"
+ sodipodi:cy="19.5"
+ sodipodi:rx="3"
+ sodipodi:ry="1.5"
+ d="M 1 19.5 A 3 1.5 0 1 1 -5,19.5 A 3 1.5 0 1 1 1 19.5 z"
+ transform="matrix(1.6666667,0,0,1.2946278,19.333333,-6.6568542)" />
+ </g>
+ <path
+ id="path6930"
+ d="M 14.82647,9.5500008 L 9.55,14.826471 L 19.22353,24.5 L 9.55,34.17353 L 14.82647,39.45 L 24.500002,29.776471 L 34.17352,39.45 L 39.45,34.17353 L 29.77647,24.5 L 39.45,14.826471 L 34.17352,9.5500008 L 24.500002,19.22353 L 14.82647,9.5500008 z "
+ style="fill:url(#linearGradient6945);fill-opacity:1;fill-rule:evenodd;stroke:#6f716b;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ transform="translate(0,1)"
+ d="M 14.8125,10.0625 L 11.0625,13.8125 L 19.96875,22.75 C 20.169915,22.947709 20.283223,23.217943 20.283223,23.5 C 20.283223,23.782057 20.169915,24.052291 19.96875,24.25 L 11.0625,33.1875 L 14.8125,36.9375 L 23.75,28.03125 C 23.947709,27.830085 24.217943,27.716777 24.5,27.716777 C 24.782057,27.716777 25.052291,27.830085 25.25,28.03125 L 34.1875,36.9375 L 37.9375,33.1875 L 29.03125,24.25 C 28.830085,24.052291 28.716777,23.782057 28.716777,23.5 C 28.716777,23.217943 28.830085,22.947709 29.03125,22.75 L 37.9375,13.8125 L 34.1875,10.0625 L 25.25,18.96875 C 25.052291,19.169915 24.782057,19.283223 24.5,19.283223 C 24.217943,19.283223 23.947709,19.169915 23.75,18.96875 L 14.8125,10.0625 z "
+ id="path6996"
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient7006);stroke-width:1.10000002;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ inkscape:original="M 14.8125 8.5625 L 9.5625 13.8125 L 19.21875 23.5 L 9.5625 33.1875 L 14.8125 38.4375 L 24.5 28.78125 L 34.1875 38.4375 L 39.4375 33.1875 L 29.78125 23.5 L 39.4375 13.8125 L 34.1875 8.5625 L 24.5 18.21875 L 14.8125 8.5625 z "
+ inkscape:radius="-1.0514843"
+ sodipodi:type="inkscape:offset" />
+ <path
+ transform="translate(0,1)"
+ d="M 14.8125,10.0625 L 11.0625,13.8125 L 19.96875,22.75 C 20.169915,22.947709 20.283223,23.217943 20.283223,23.5 C 20.283223,23.782057 20.169915,24.052291 19.96875,24.25 L 11.0625,33.1875 L 14.8125,36.9375 L 23.75,28.03125 C 23.947709,27.830085 24.217943,27.716777 24.5,27.716777 C 24.782057,27.716777 25.052291,27.830085 25.25,28.03125 L 34.1875,36.9375 L 37.9375,33.1875 L 29.03125,24.25 C 28.830085,24.052291 28.716777,23.782057 28.716777,23.5 C 28.716777,23.217943 28.830085,22.947709 29.03125,22.75 L 37.9375,13.8125 L 34.1875,10.0625 L 25.25,18.96875 C 25.052291,19.169915 24.782057,19.283223 24.5,19.283223 C 24.217943,19.283223 23.947709,19.169915 23.75,18.96875 L 14.8125,10.0625 z "
+ id="path7008"
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient7010);stroke-width:1.10000002;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ inkscape:original="M 14.8125 8.5625 L 9.5625 13.8125 L 19.21875 23.5 L 9.5625 33.1875 L 14.8125 38.4375 L 24.5 28.78125 L 34.1875 38.4375 L 39.4375 33.1875 L 29.78125 23.5 L 39.4375 13.8125 L 34.1875 8.5625 L 24.5 18.21875 L 14.8125 8.5625 z "
+ inkscape:radius="-1.0514843"
+ sodipodi:type="inkscape:offset" />
+ </g>
+ </g>
+</svg>
diff --git a/xpm/gui_select_street.svg b/xpm/gui_select_street.svg
new file mode 100644
index 00000000..390c2e11
--- /dev/null
+++ b/xpm/gui_select_street.svg
@@ -0,0 +1,237 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48px"
+ height="48px"
+ id="svg3165"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="/tmp"
+ sodipodi:docname="gui_active.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3167">
+ <linearGradient
+ id="linearGradient5237">
+ <stop
+ id="stop5239"
+ offset="0"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0.5"
+ id="stop5247" />
+ <stop
+ id="stop5241"
+ offset="1"
+ style="stop-color:#9c9c9c;stop-opacity:1" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5237"
+ id="radialGradient5990"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.5301205,0,0,1.6745294,-12.159639,-11.709817)"
+ cx="22.9375"
+ cy="16.305218"
+ fx="22.9375"
+ fy="16.305218"
+ r="15.5625" />
+ <linearGradient
+ id="linearGradient5300"
+ inkscape:collect="always">
+ <stop
+ id="stop5302"
+ offset="0"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ <stop
+ id="stop5304"
+ offset="1"
+ style="stop-color:#ffffff;stop-opacity:0;" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5300"
+ id="radialGradient5988"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.2469896,0,0,2.2469896,-37.128341,-8.8439229)"
+ cx="29.77438"
+ cy="7.0922189"
+ fx="29.77438"
+ fy="7.0922189"
+ r="25.380436" />
+ <linearGradient
+ id="linearGradient5226">
+ <stop
+ id="stop5811"
+ offset="0"
+ style="stop-color:#63b512;stop-opacity:1;" />
+ <stop
+ style="stop-color:#58a30e;stop-opacity:1;"
+ offset="0.16030352"
+ id="stop5245" />
+ <stop
+ style="stop-color:#366b04;stop-opacity:1"
+ offset="0.66008514"
+ id="stop5814" />
+ <stop
+ id="stop5231"
+ offset="1"
+ style="stop-color:#87ea25;stop-opacity:1" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5226"
+ id="radialGradient5986"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.5354369,0,0,1.5485894,-15.737913,-10.36738)"
+ cx="29.392656"
+ cy="18.898249"
+ fx="29.392656"
+ fy="18.898249"
+ r="29.699959" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5224"
+ id="radialGradient5984"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.29375,0,18.848047)"
+ cx="14.5"
+ cy="26.6875"
+ fx="14.5"
+ fy="26.6875"
+ r="10" />
+ <filter
+ height="1.6682318"
+ y="-0.33411592"
+ width="1.1962931"
+ x="-0.09814655"
+ id="filter5296"
+ inkscape:collect="always">
+ <feGaussianBlur
+ id="feGaussianBlur5298"
+ stdDeviation="0.81788793"
+ inkscape:collect="always" />
+ </filter>
+ <linearGradient
+ id="linearGradient5224"
+ inkscape:collect="always">
+ <stop
+ id="stop5226"
+ offset="0"
+ style="stop-color:#000000;stop-opacity:1;" />
+ <stop
+ id="stop5228"
+ offset="1"
+ style="stop-color:#000000;stop-opacity:0;" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5224"
+ id="radialGradient5982"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.29375,0,18.848047)"
+ cx="14.5"
+ cy="26.6875"
+ fx="14.5"
+ fy="26.6875"
+ r="10" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="7"
+ inkscape:cx="24"
+ inkscape:cy="24"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:window-width="800"
+ inkscape:window-height="649"
+ inkscape:window-x="472"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata3170">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <g
+ style="display:inline"
+ id="g5964"
+ transform="translate(0.8558594,-0.614906)">
+ <path
+ transform="matrix(2.1570145,0,0,2.155398,-7.8468552,-16.33814)"
+ d="M 24.5 26.6875 A 10 2.9375 0 1 1 4.5,26.6875 A 10 2.9375 0 1 1 24.5 26.6875 z"
+ sodipodi:ry="2.9375"
+ sodipodi:rx="10"
+ sodipodi:cy="26.6875"
+ sodipodi:cx="14.5"
+ id="path5966"
+ style="opacity:0.53012049;fill:url(#radialGradient5982);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;filter:url(#filter5296);enable-background:accumulate"
+ sodipodi:type="arc" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.80120479;fill:url(#radialGradient5984);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;filter:url(#filter5296);enable-background:accumulate"
+ id="path5968"
+ sodipodi:cx="14.5"
+ sodipodi:cy="26.6875"
+ sodipodi:rx="10"
+ sodipodi:ry="2.9375"
+ d="M 24.5 26.6875 A 10 2.9375 0 1 1 4.5,26.6875 A 10 2.9375 0 1 1 24.5 26.6875 z"
+ transform="matrix(1.3478975,0,0,1.3468874,3.8853414,6.4889877)" />
+ <path
+ transform="matrix(0.7238447,0,0,0.7274883,2.1828126,2.3568607)"
+ d="M 58.403591 29.207693 A 29.010935 29.010935 0 1 1 0.3817215,29.207693 A 29.010935 29.010935 0 1 1 58.403591 29.207693 z"
+ sodipodi:ry="29.010935"
+ sodipodi:rx="29.010935"
+ sodipodi:cy="29.207693"
+ sodipodi:cx="29.392656"
+ id="path5970"
+ style="fill:url(#radialGradient5986);fill-opacity:1;fill-rule:evenodd;stroke:#316203;stroke-width:1.37804782;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ sodipodi:type="arc" />
+ <path
+ transform="matrix(0.8254302,0,0,0.8252681,-1.1457884,-1.4441229)"
+ d="M 53.950159 30.352861 A 24.175779 24.175779 0 1 1 5.5986004,30.352861 A 24.175779 24.175779 0 1 1 53.950159 30.352861 z"
+ sodipodi:ry="24.175779"
+ sodipodi:rx="24.175779"
+ sodipodi:cy="30.352861"
+ sodipodi:cx="29.77438"
+ id="path5972"
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#radialGradient5988);stroke-width:1.21160841;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ sodipodi:type="arc" />
+ <path
+ sodipodi:nodetypes="ccccccc"
+ id="path5974"
+ d="M 12.875,24.625 L 25.375,36.625 L 44,20.625 C 43.253602,16.729371 41.57038,13.679873 39.8125,11.0625 L 25.125,23.75 L 20.375,18.5 L 12.875,24.625 z "
+ style="opacity:1;fill:url(#radialGradient5990);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="cc"
+ id="path5976"
+ d="M 40.21875,10.8125 C 41.930961,13.346411 43.59334,15.979986 44.40625,20.3125"
+ style="opacity:1;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#549910;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ </g>
+ </g>
+</svg>
diff --git a/xpm/gui_select_town.svg b/xpm/gui_select_town.svg
new file mode 100644
index 00000000..61e2dcb8
--- /dev/null
+++ b/xpm/gui_select_town.svg
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48px"
+ height="48px"
+ id="svg3220"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="/tmp"
+ sodipodi:docname="gui_inactive.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3222">
+ <linearGradient
+ y2="40.064526"
+ x2="27.044603"
+ y1="19.939341"
+ x1="17.838388"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient7010"
+ xlink:href="#linearGradient7000"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient7000"
+ inkscape:collect="always">
+ <stop
+ id="stop7002"
+ offset="0"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ <stop
+ id="stop7004"
+ offset="1"
+ style="stop-color:#ffffff;stop-opacity:0;" />
+ </linearGradient>
+ <linearGradient
+ gradientUnits="userSpaceOnUse"
+ y2="61.80806"
+ x2="39.418972"
+ y1="19.939341"
+ x1="17.838388"
+ id="linearGradient7006"
+ xlink:href="#linearGradient7000"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient2790">
+ <stop
+ id="stop2792"
+ offset="0"
+ style="stop-color:white;stop-opacity:1;" />
+ <stop
+ style="stop-color:#d3d7cf;stop-opacity:1;"
+ offset="0.8108108"
+ id="stop2798" />
+ <stop
+ id="stop2794"
+ offset="1"
+ style="stop-color:#959e8b;stop-opacity:1;" />
+ </linearGradient>
+ <linearGradient
+ gradientTransform="matrix(1.7588235,0,0,1.7588235,6.032353,6.0323539)"
+ gradientUnits="userSpaceOnUse"
+ y2="30.038462"
+ x2="19.255854"
+ y1="0.068979882"
+ x1="4.3764215"
+ id="linearGradient6945"
+ xlink:href="#linearGradient2790"
+ inkscape:collect="always" />
+ <radialGradient
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.5,0,9.75)"
+ r="3"
+ fy="19.5"
+ fx="-2"
+ cy="19.5"
+ cx="-2"
+ id="radialGradient6972"
+ xlink:href="#linearGradient6964"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient6964"
+ inkscape:collect="always">
+ <stop
+ id="stop5939"
+ offset="0"
+ style="stop-color:#000000;stop-opacity:1;" />
+ <stop
+ id="stop6968"
+ offset="1"
+ style="stop-color:#000000;stop-opacity:0;" />
+ </linearGradient>
+ <radialGradient
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.5,0,9.75)"
+ r="3"
+ fy="19.5"
+ fx="-2"
+ cy="19.5"
+ cx="-2"
+ id="radialGradient6970"
+ xlink:href="#linearGradient6964"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient6958">
+ <stop
+ id="stop6960"
+ offset="0"
+ style="stop-color:#729fcf;stop-opacity:1;" />
+ <stop
+ style="stop-color:#729fcf;stop-opacity:1;"
+ offset="0.60000002"
+ id="stop6966" />
+ <stop
+ id="stop6962"
+ offset="1"
+ style="stop-color:#729fcf;stop-opacity:0;" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient6958"
+ id="radialGradient5962"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.8087117,0,0,3.5234273,-57.039447,-57.368542)"
+ cx="70.53125"
+ cy="22.734375"
+ fx="70.53125"
+ fy="22.734375"
+ r="3.5975378" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="7"
+ inkscape:cx="24"
+ inkscape:cy="24"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:window-width="800"
+ inkscape:window-height="649"
+ inkscape:window-x="472"
+ inkscape:window-y="296" />
+ <metadata
+ id="metadata3225">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <g
+ style="display:inline"
+ inkscape:label="Layer 1"
+ id="g5953"
+ transform="translate(-0.6553298,-1.376604)">
+ <g
+ transform="matrix(1.8719362,0,0,1.5205944,5.0000002,10.484903)"
+ style="opacity:0.7238806"
+ id="g6978">
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.14179107;fill:url(#radialGradient5962);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path6974"
+ sodipodi:cx="-2"
+ sodipodi:cy="19.5"
+ sodipodi:rx="3"
+ sodipodi:ry="1.5"
+ d="M 1 19.5 A 3 1.5 0 1 1 -5,19.5 A 3 1.5 0 1 1 1 19.5 z"
+ transform="matrix(2.0312501,0,0,1.2946278,14.455805,-7.7591062)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.2;fill:url(#radialGradient6970);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path6960"
+ sodipodi:cx="-2"
+ sodipodi:cy="19.5"
+ sodipodi:rx="3"
+ sodipodi:ry="1.5"
+ d="M 1 19.5 A 3 1.5 0 1 1 -5,19.5 A 3 1.5 0 1 1 1 19.5 z"
+ transform="matrix(1.6666667,0,0,1.2946278,8.3333333,-6.6568542)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.2;fill:url(#radialGradient6972);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path6962"
+ sodipodi:cx="-2"
+ sodipodi:cy="19.5"
+ sodipodi:rx="3"
+ sodipodi:ry="1.5"
+ d="M 1 19.5 A 3 1.5 0 1 1 -5,19.5 A 3 1.5 0 1 1 1 19.5 z"
+ transform="matrix(1.6666667,0,0,1.2946278,19.333333,-6.6568542)" />
+ </g>
+ <path
+ id="path6930"
+ d="M 14.82647,9.5500008 L 9.55,14.826471 L 19.22353,24.5 L 9.55,34.17353 L 14.82647,39.45 L 24.500002,29.776471 L 34.17352,39.45 L 39.45,34.17353 L 29.77647,24.5 L 39.45,14.826471 L 34.17352,9.5500008 L 24.500002,19.22353 L 14.82647,9.5500008 z "
+ style="fill:url(#linearGradient6945);fill-opacity:1;fill-rule:evenodd;stroke:#6f716b;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ transform="translate(0,1)"
+ d="M 14.8125,10.0625 L 11.0625,13.8125 L 19.96875,22.75 C 20.169915,22.947709 20.283223,23.217943 20.283223,23.5 C 20.283223,23.782057 20.169915,24.052291 19.96875,24.25 L 11.0625,33.1875 L 14.8125,36.9375 L 23.75,28.03125 C 23.947709,27.830085 24.217943,27.716777 24.5,27.716777 C 24.782057,27.716777 25.052291,27.830085 25.25,28.03125 L 34.1875,36.9375 L 37.9375,33.1875 L 29.03125,24.25 C 28.830085,24.052291 28.716777,23.782057 28.716777,23.5 C 28.716777,23.217943 28.830085,22.947709 29.03125,22.75 L 37.9375,13.8125 L 34.1875,10.0625 L 25.25,18.96875 C 25.052291,19.169915 24.782057,19.283223 24.5,19.283223 C 24.217943,19.283223 23.947709,19.169915 23.75,18.96875 L 14.8125,10.0625 z "
+ id="path6996"
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient7006);stroke-width:1.10000002;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ inkscape:original="M 14.8125 8.5625 L 9.5625 13.8125 L 19.21875 23.5 L 9.5625 33.1875 L 14.8125 38.4375 L 24.5 28.78125 L 34.1875 38.4375 L 39.4375 33.1875 L 29.78125 23.5 L 39.4375 13.8125 L 34.1875 8.5625 L 24.5 18.21875 L 14.8125 8.5625 z "
+ inkscape:radius="-1.0514843"
+ sodipodi:type="inkscape:offset" />
+ <path
+ transform="translate(0,1)"
+ d="M 14.8125,10.0625 L 11.0625,13.8125 L 19.96875,22.75 C 20.169915,22.947709 20.283223,23.217943 20.283223,23.5 C 20.283223,23.782057 20.169915,24.052291 19.96875,24.25 L 11.0625,33.1875 L 14.8125,36.9375 L 23.75,28.03125 C 23.947709,27.830085 24.217943,27.716777 24.5,27.716777 C 24.782057,27.716777 25.052291,27.830085 25.25,28.03125 L 34.1875,36.9375 L 37.9375,33.1875 L 29.03125,24.25 C 28.830085,24.052291 28.716777,23.782057 28.716777,23.5 C 28.716777,23.217943 28.830085,22.947709 29.03125,22.75 L 37.9375,13.8125 L 34.1875,10.0625 L 25.25,18.96875 C 25.052291,19.169915 24.782057,19.283223 24.5,19.283223 C 24.217943,19.283223 23.947709,19.169915 23.75,18.96875 L 14.8125,10.0625 z "
+ id="path7008"
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient7010);stroke-width:1.10000002;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ inkscape:original="M 14.8125 8.5625 L 9.5625 13.8125 L 19.21875 23.5 L 9.5625 33.1875 L 14.8125 38.4375 L 24.5 28.78125 L 34.1875 38.4375 L 39.4375 33.1875 L 29.78125 23.5 L 39.4375 13.8125 L 34.1875 8.5625 L 24.5 18.21875 L 14.8125 8.5625 z "
+ inkscape:radius="-1.0514843"
+ sodipodi:type="inkscape:offset" />
+ </g>
+ </g>
+</svg>
diff --git a/xpm/gui_settings.svg b/xpm/gui_settings.svg
new file mode 100644
index 00000000..86bec771
--- /dev/null
+++ b/xpm/gui_settings.svg
@@ -0,0 +1,408 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48"
+ height="48"
+ id="svg7854"
+ sodipodi:version="0.32"
+ inkscape:version="0.45+devel"
+ version="1.0"
+ sodipodi:docbase="/home/jimmac/src/cvs/gnome/gnome-icon-theme/scalable/categories"
+ sodipodi:docname="preferences-desktop.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs7856">
+ <linearGradient
+ id="linearGradient24230">
+ <stop
+ id="stop24232"
+ offset="0"
+ style="stop-color:#677579;stop-opacity:1;" />
+ <stop
+ id="stop24234"
+ offset="1"
+ style="stop-color:#333333;stop-opacity:1;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5048">
+ <stop
+ id="stop5050"
+ offset="0"
+ style="stop-color:black;stop-opacity:0;" />
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0.5"
+ id="stop5056" />
+ <stop
+ id="stop5052"
+ offset="1"
+ style="stop-color:black;stop-opacity:0;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient4228">
+ <stop
+ style="stop-color:#d9d9d9;stop-opacity:1;"
+ offset="0"
+ id="stop4230" />
+ <stop
+ style="stop-color:#c7c7c7;stop-opacity:1;"
+ offset="1"
+ id="stop4232" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient4244">
+ <stop
+ style="stop-color:#f0f0f0;stop-opacity:1;"
+ offset="0"
+ id="stop4246" />
+ <stop
+ style="stop-color:#e0e0e0;stop-opacity:1;"
+ offset="1"
+ id="stop4248" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5060"
+ inkscape:collect="always">
+ <stop
+ id="stop5062"
+ offset="0"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ id="stop5064"
+ offset="1"
+ style="stop-color:black;stop-opacity:0;" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4228"
+ id="linearGradient6613"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.0039034,0,0,1,-0.2863699,4.084439)"
+ x1="7.6046205"
+ y1="28.481176"
+ x2="36.183067"
+ y2="40.943935" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4244"
+ id="radialGradient6615"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.2901853,0.7884154,-0.7129611,1.1796023,-2.6322372,-1.0775827)"
+ cx="15.571491"
+ cy="2.9585190"
+ fx="15.571491"
+ fy="2.9585190"
+ r="20.935817" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient24230"
+ id="linearGradient6626"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(-1,0,0,0.587604,48.51835,9.808271)"
+ x1="12.51301"
+ y1="30.585787"
+ x2="12.51301"
+ y2="16.885592" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient24230"
+ id="linearGradient6628"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.587604,-1.140279,9.808271)"
+ x1="12.51301"
+ y1="30.585787"
+ x2="12.51301"
+ y2="16.885592" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient24230"
+ id="linearGradient6635"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(10.999998,-3.9739816)"
+ x1="12.51301"
+ y1="30.585787"
+ x2="12.51301"
+ y2="23.635592" />
+ <filter
+ inkscape:collect="always"
+ x="-0.071073672"
+ width="1.1421473"
+ y="-0.26144958"
+ height="1.5228992"
+ id="filter7681">
+ <feGaussianBlur
+ inkscape:collect="always"
+ stdDeviation="0.45753676"
+ id="feGaussianBlur7683" />
+ </filter>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5048"
+ id="linearGradient7734"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(6.702375e-2,0,0,4.7279468e-2,0.3013351,14.32798)"
+ x1="302.85715"
+ y1="366.64789"
+ x2="302.85715"
+ y2="609.50507" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient7736"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(6.702375e-2,0,0,4.7279468e-2,0.3145254,14.32798)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient7738"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(-6.702375e-2,0,0,4.7279468e-2,48.736751,14.32798)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#e0e0e0"
+ borderopacity="1"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1"
+ inkscape:cx="73.809708"
+ inkscape:cy="24.712172"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ width="48px"
+ height="48px"
+ inkscape:showpageshadow="false"
+ inkscape:window-width="872"
+ inkscape:window-height="627"
+ inkscape:window-x="651"
+ inkscape:window-y="308"
+ showgrid="false" />
+ <metadata
+ id="metadata7859">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:source>http://jimmac.musichall.cz</dc:source>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
+ <dc:title>Desktop Preferences</dc:title>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>preferences</rdf:li>
+ <rdf:li>desktop</rdf:li>
+ <rdf:li>user</rdf:li>
+ <rdf:li>settings</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/SourceCode" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g7729"
+ transform="translate(-0.75,0)">
+ <rect
+ y="31.662897"
+ x="8.3441849"
+ height="11.482157"
+ width="32.362896"
+ id="rect6591"
+ style="opacity:0.85294118;color:#000000;fill:url(#linearGradient7734);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="path6593"
+ d="M 40.707082,31.663293 C 40.707082,31.663293 40.707082,43.144816 40.707082,43.144816 C 44.158639,43.16643 49.051268,40.572389 49.051266,37.403316 C 49.051266,34.234241 45.199588,31.663293 40.707082,31.663293 z"
+ style="opacity:0.85294118;color:#000000;fill:url(#radialGradient7736);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ style="opacity:0.85294118;color:#000000;fill:url(#radialGradient7738);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 8.3441856,31.663293 C 8.3441856,31.663293 8.3441856,43.144816 8.3441856,43.144816 C 4.8926276,43.16643 2.6449977e-09,40.572389 2.6449977e-09,37.403316 C 2.6449977e-09,34.234241 3.8516777,31.663293 8.3441856,31.663293 z"
+ id="path6595"
+ sodipodi:nodetypes="cccc" />
+ </g>
+ <path
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#888a85;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 9.022859,9 C 8.3954775,9 7.9876803,9.293946 7.7367287,9.854703 C 7.7367277,9.854703 3.2509523,29.876846 3.2509523,29.876846 C 3.2509523,29.876846 2.9999999,30.55712 2.9999999,31.681213 C 2.9999999,31.681213 2.9999999,37.404507 2.9999999,37.404507 C 2.9999999,38.50117 3.6602911,39.050598 4.6625603,39.050596 L 43.371985,39.050596 C 44.360589,39.050596 44.971807,38.323095 44.971807,37.182918 L 44.971807,31.459624 C 44.971807,31.459624 45.078174,30.679202 44.877699,30.13009 L 40.140971,10.012982 C 39.955742,9.494432 39.501639,9.012061 39.011684,9 L 9.022859,9 z"
+ id="path6597"
+ sodipodi:nodetypes="cccsccccccccc" />
+ <path
+ style="fill:url(#linearGradient6613);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.02044296px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 3,31.081252 L 3.7675865,30.389037 L 41.524078,30.451537 L 45,30.768835 L 45,37.207367 C 45,38.332936 44.390613,39.050698 43.401915,39.050698 L 4.6683257,39.050698 C 3.6659643,39.050698 3,38.508647 3,37.426034 L 3,31.081252 z"
+ id="path6599"
+ sodipodi:nodetypes="ccccccccc" />
+ <path
+ style="fill:url(#radialGradient6615);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 3.2892931,29.978281 C 2.5728183,31.455151 3.2886763,32.391701 4.3281833,32.391701 C 4.3281833,32.391701 43.447745,32.391701 43.447745,32.391701 C 44.570223,32.367686 45.29864,31.3711 44.880695,30.230429 L 40.151956,10.008597 C 39.966867,9.492291 39.495187,9.012007 39.005596,9 L 9.056921,9 C 8.4300044,9 8.0180309,9.306182 7.7672655,9.864512 C 7.7672655,9.864512 3.2892931,29.978281 3.2892931,29.978281 z"
+ id="path6601"
+ sodipodi:nodetypes="csccccccs" />
+ <path
+ style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 44.85227,29.713128 C 44.916294,30.963102 44.435003,32.028968 43.519731,32.056878 C 43.519731,32.056878 5.1004819,32.056877 5.1004819,32.056878 C 3.8010855,32.056878 3.2180205,31.731931 3,31.188822 C 3.0924845,32.133154 3.8323278,32.838128 5.1004819,32.838128 C 5.1004819,32.838127 43.519731,32.838128 43.519731,32.838128 C 44.604221,32.805057 45.286355,31.414104 44.882555,29.843337 L 44.85227,29.713128 z"
+ id="path6603"
+ sodipodi:nodetypes="cccccccc" />
+ <path
+ style="color:#000000;fill:url(#linearGradient6628);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 10.981036,11.962093 L 16.007055,11.962093 L 14.592842,29.183918 L 8.1526087,29.183918 L 10.981036,11.962093 z"
+ id="rect6619"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ sodipodi:nodetypes="ccccc"
+ id="path6624"
+ d="M 36.397035,11.962093 L 31.371016,11.962093 L 32.785229,29.183918 L 39.225462,29.183918 L 36.397035,11.962093 z"
+ style="color:#000000;fill:url(#linearGradient6626);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ style="color:#000000;fill:url(#linearGradient6635);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 21,12.02602 L 26.026019,12.02602 L 26.963519,29 L 20.0625,29 L 21,12.02602 z"
+ id="rect6630"
+ sodipodi:nodetypes="ccccc" />
+ <g
+ id="g7685"
+ transform="translate(-1,-2)">
+ <rect
+ transform="matrix(1.0873786,0,0,1.0873786,-2.1462379,-2.6541262)"
+ ry="1.75"
+ rx="1.75"
+ y="28.625"
+ x="18.125"
+ height="3.5"
+ width="12.875"
+ id="rect7619"
+ style="opacity:0.36470588;color:#000000;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;filter:url(#filter7681);enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="cccccccc"
+ id="path7612"
+ d="M 28.0625,23 L 20.5,23.09375 L 20.125,23.71875 L 18.875,30.9375 L 18.90625,31 L 30.0625,31 L 28.65625,24.75 L 28.0625,23 z"
+ style="opacity:1;color:#000000;fill:#babdb6;fill-opacity:1;fill-rule:evenodd;stroke:#555753;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="ccccc"
+ id="path6637"
+ d="M 18.915106,30.985244 L 30.052038,30.985244 L 28.637825,24.930641 L 20.152543,25.01903 L 18.915106,30.985244 z"
+ style="opacity:1;color:#000000;fill:#babdb6;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="ccccc"
+ id="path7608"
+ d="M 20.513864,23.088388 L 20.071737,25.024391 L 28.624881,25.042697 L 28.0633,22.986098 L 20.513864,23.088388 z"
+ style="opacity:1;color:#000000;fill:#eeeeec;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="cccccccc"
+ id="path7610"
+ d="M 20.461903,23.11868 L 20.135768,23.716759 L 18.870912,30.941049 L 19.939155,26.005165 L 28.895407,26.010527 L 28.687381,24.99092 L 20.178432,24.967253 L 20.461903,23.11868 z"
+ style="opacity:1;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ </g>
+ <g
+ id="g7692"
+ transform="matrix(0.9642857,0,0,0.9642857,-10.391072,-11.813167)">
+ <rect
+ style="opacity:0.36470588;color:#000000;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;filter:url(#filter7681);enable-background:accumulate"
+ id="rect7694"
+ width="12.875"
+ height="3.5"
+ x="18.125"
+ y="28.625"
+ rx="1.75"
+ ry="1.75"
+ transform="matrix(1.0873786,0,0,1.0873786,-2.1462379,-2.6541262)" />
+ <path
+ style="opacity:1;color:#000000;fill:#babdb6;fill-opacity:1;fill-rule:evenodd;stroke:#555753;stroke-width:1.03703701px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 28.0625,23.1875 L 20.5,23.09375 L 20.125,23.71875 L 18.875,30.9375 L 18.90625,31 L 30.0625,31 L 28.65625,24.75 L 28.0625,23.1875 z"
+ id="path7696"
+ sodipodi:nodetypes="cccccccc" />
+ <path
+ style="opacity:1;color:#000000;fill:#babdb6;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 18.915106,30.985244 L 30.052038,30.985244 L 28.637825,24.930641 L 20.152543,25.01903 L 18.915106,30.985244 z"
+ id="path7698"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ style="opacity:1;color:#000000;fill:#eeeeec;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 20.513864,23.088388 L 20.071737,25.024391 L 28.624881,25.042697 L 28.0633,23.173598 L 20.513864,23.088388 z"
+ id="path7700"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ style="opacity:1;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 20.461903,23.11868 L 20.135768,23.716759 L 18.870912,30.941049 L 19.939155,26.005165 L 28.895407,26.010527 L 28.687381,24.99092 L 20.178432,24.967253 L 20.461903,23.11868 z"
+ id="path7702"
+ sodipodi:nodetypes="cccccccc" />
+ </g>
+ <g
+ transform="translate(11.25,-4.9375)"
+ id="g7704">
+ <rect
+ transform="matrix(1.0873786,0,0,1.0873786,-2.1462379,-2.6541262)"
+ ry="1.75"
+ rx="1.75"
+ y="28.625"
+ x="18.125"
+ height="3.5"
+ width="12.875"
+ id="rect7706"
+ style="opacity:0.36470588;color:#000000;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;filter:url(#filter7681);enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="cccccccc"
+ id="path7708"
+ d="M 28.0625,23 L 20.5,23.09375 L 20.125,23.71875 L 18.875,30.9375 L 18.90625,31 L 30.0625,31 L 28.65625,24.75 L 28.0625,23 z"
+ style="opacity:1;color:#000000;fill:#babdb6;fill-opacity:1;fill-rule:evenodd;stroke:#555753;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="ccccc"
+ id="path7710"
+ d="M 18.915106,30.985244 L 30.052038,30.985244 L 28.637825,24.930641 L 20.152543,25.01903 L 18.915106,30.985244 z"
+ style="opacity:1;color:#000000;fill:#babdb6;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="ccccc"
+ id="path7712"
+ d="M 20.513864,23.088388 L 20.071737,25.024391 L 28.624881,25.042697 L 28.0633,22.986098 L 20.513864,23.088388 z"
+ style="opacity:1;color:#000000;fill:#eeeeec;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ sodipodi:nodetypes="cccccccc"
+ id="path7714"
+ d="M 20.461903,23.11868 L 20.135768,23.716759 L 18.870912,30.941049 L 19.939155,26.005165 L 28.895407,26.010527 L 28.687381,24.99092 L 20.178432,24.967253 L 20.461903,23.11868 z"
+ style="opacity:1;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ </g>
+ </g>
+</svg>
diff --git a/xpm/gui_sound.svg b/xpm/gui_sound.svg
new file mode 100644
index 00000000..16fb4a87
--- /dev/null
+++ b/xpm/gui_sound.svg
@@ -0,0 +1,798 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48"
+ height="48"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ version="1.0"
+ sodipodi:docbase="/home/lapo/Icone/cvs/gnome-icon-theme/scalable/status"
+ sodipodi:docname="audio-volume-high.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient21662">
+ <stop
+ id="stop21664"
+ offset="0"
+ style="stop-color:#3465a4;stop-opacity:0;" />
+ <stop
+ style="stop-color:#3465a4;stop-opacity:0;"
+ offset="0.81927711"
+ id="stop21666" />
+ <stop
+ id="stop21668"
+ offset="1"
+ style="stop-color:#3465a4;stop-opacity:1" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient21644">
+ <stop
+ id="stop21646"
+ offset="0"
+ style="stop-color:#3465a4;stop-opacity:0;" />
+ <stop
+ style="stop-color:#3465a4;stop-opacity:0;"
+ offset="0.73493975"
+ id="stop21648" />
+ <stop
+ id="stop21650"
+ offset="1"
+ style="stop-color:#3465a4;stop-opacity:1" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient21622">
+ <stop
+ style="stop-color:#3465a4;stop-opacity:0;"
+ offset="0"
+ id="stop21624" />
+ <stop
+ id="stop21630"
+ offset="0.85542166"
+ style="stop-color:#3465a4;stop-opacity:0;" />
+ <stop
+ style="stop-color:#3465a4;stop-opacity:1"
+ offset="1"
+ id="stop21626" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient21608">
+ <stop
+ style="stop-color:#888a85;stop-opacity:1"
+ offset="0"
+ id="stop21610" />
+ <stop
+ style="stop-color:#2e3436;stop-opacity:1"
+ offset="1"
+ id="stop21612" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient21598">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop21600" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop21602" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient21582">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop21584" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop21586" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient21572">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop21574" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop21576" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient17123">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop17125" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop17127" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient15341">
+ <stop
+ style="stop-color:#888a85;stop-opacity:1"
+ offset="0"
+ id="stop15343" />
+ <stop
+ style="stop-color:#555753;stop-opacity:1"
+ offset="1"
+ id="stop15345" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient13551">
+ <stop
+ id="stop13553"
+ offset="0"
+ style="stop-color:#d3d7cf;stop-opacity:1" />
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0.25301206"
+ id="stop13555" />
+ <stop
+ id="stop13557"
+ offset="1"
+ style="stop-color:#888a85;stop-opacity:1" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient13535">
+ <stop
+ style="stop-color:#babdb6;stop-opacity:1"
+ offset="0"
+ id="stop13537" />
+ <stop
+ style="stop-color:#2e3436;stop-opacity:1"
+ offset="1"
+ id="stop13539" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient10872">
+ <stop
+ id="stop10874"
+ offset="0"
+ style="stop-color:#888a85;stop-opacity:1" />
+ <stop
+ style="stop-color:#9e9e92;stop-opacity:1;"
+ offset="0.25301206"
+ id="stop10876" />
+ <stop
+ id="stop10878"
+ offset="1"
+ style="stop-color:#555753;stop-opacity:1" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient9086">
+ <stop
+ id="stop9088"
+ offset="0"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ id="stop9090"
+ offset="1"
+ style="stop-color:black;stop-opacity:0;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient7280">
+ <stop
+ style="stop-color:#babdb6;stop-opacity:1"
+ offset="0"
+ id="stop7282" />
+ <stop
+ style="stop-color:#2e3436;stop-opacity:1"
+ offset="1"
+ id="stop7284" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient6387">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop6389" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop6391" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient6379">
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="0"
+ id="stop6381" />
+ <stop
+ id="stop21606"
+ offset="0.5"
+ style="stop-color:white;stop-opacity:1;" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop6383" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient6371">
+ <stop
+ style="stop-color:#888a85;stop-opacity:1"
+ offset="0"
+ id="stop6373" />
+ <stop
+ style="stop-color:#d3d7cf;stop-opacity:1;"
+ offset="1"
+ id="stop6375" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3698">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop3700" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop3702" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3688">
+ <stop
+ style="stop-color:#babdb6;stop-opacity:1"
+ offset="0"
+ id="stop3690" />
+ <stop
+ style="stop-color:#2e3436;stop-opacity:1"
+ offset="1"
+ id="stop3692" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2793">
+ <stop
+ style="stop-color:#babdb6;stop-opacity:1;"
+ offset="0"
+ id="stop2795" />
+ <stop
+ id="stop2801"
+ offset="0.25301206"
+ style="stop-color:#eeeeec;stop-opacity:1;" />
+ <stop
+ style="stop-color:#555753;stop-opacity:1"
+ offset="1"
+ id="stop2797" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2793"
+ id="linearGradient2799"
+ x1="7.5625"
+ y1="16.499838"
+ x2="7.5625"
+ y2="29.625288"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3688"
+ id="linearGradient3694"
+ x1="4.5961943"
+ y1="14.456622"
+ x2="4.5961943"
+ y2="30.313524"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient6371"
+ id="linearGradient6377"
+ x1="14.241117"
+ y1="26.996773"
+ x2="15.125"
+ y2="20.976084"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient6379"
+ id="linearGradient6385"
+ x1="20.226221"
+ y1="20.33363"
+ x2="11.4375"
+ y2="21.75"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient6387"
+ id="linearGradient6393"
+ x1="17.25"
+ y1="18.81151"
+ x2="16.1875"
+ y2="32.629498"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-28,0)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient7280"
+ id="linearGradient7286"
+ x1="11.875"
+ y1="20.375"
+ x2="13.125"
+ y2="34.13559"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient9086"
+ id="radialGradient8199"
+ cx="7.1396246"
+ cy="22.5"
+ fx="7.1396246"
+ fy="22.5"
+ r="6"
+ gradientTransform="matrix(1.914836,-0.506192,0.654838,2.477012,-48.62381,-29.61876)"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient10872"
+ id="linearGradient10870"
+ x1="3.8890872"
+ y1="18.937069"
+ x2="3.8890872"
+ y2="25.947107"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient13535"
+ id="linearGradient13541"
+ x1="21.875"
+ y1="9.6335878"
+ x2="20.5"
+ y2="41.744865"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient13551"
+ id="linearGradient13549"
+ x1="20.125"
+ y1="8.875"
+ x2="20.125"
+ y2="33.8829"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient15341"
+ id="radialGradient15347"
+ cx="22.624176"
+ cy="20.880224"
+ fx="22.624176"
+ fy="20.880224"
+ r="3.3177083"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient17123"
+ id="radialGradient17129"
+ cx="11.402097"
+ cy="36.863068"
+ fx="11.402097"
+ fy="36.863068"
+ r="10.69499"
+ gradientTransform="matrix(1,0,0,0.330579,0,24.67693)"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient21572"
+ id="radialGradient21578"
+ cx="7.001297"
+ cy="22.470087"
+ fx="7.001297"
+ fy="22.470087"
+ r="6.4940691"
+ gradientTransform="matrix(1.433087,-0.596698,0.798238,1.917124,-20.96864,-16.43019)"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient21598"
+ id="linearGradient21604"
+ x1="12.25"
+ y1="19.75"
+ x2="10.875"
+ y2="33.125"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient21608"
+ id="linearGradient21614"
+ x1="23.272787"
+ y1="18.525478"
+ x2="23.272787"
+ y2="22.811184"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient21622"
+ id="radialGradient21684"
+ gradientUnits="userSpaceOnUse"
+ cx="20.84375"
+ cy="21.84375"
+ fx="20.84375"
+ fy="21.84375"
+ r="2.9063251" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient21662"
+ id="radialGradient21686"
+ gradientUnits="userSpaceOnUse"
+ cx="20.84375"
+ cy="21.84375"
+ fx="20.84375"
+ fy="21.84375"
+ r="2.9063251" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient21644"
+ id="radialGradient21688"
+ gradientUnits="userSpaceOnUse"
+ cx="20.84375"
+ cy="21.84375"
+ fx="20.84375"
+ fy="21.84375"
+ r="2.9063251" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient21622"
+ id="radialGradient26140"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(8.054163,0,0,8.054163,-110.8381,-158.8113)"
+ cx="20.532286"
+ cy="22.513134"
+ fx="20.532286"
+ fy="22.513134"
+ r="2.9063251" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient21644"
+ id="radialGradient28811"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(3.494347,0,0,3.494347,-19.16478,-56.13942)"
+ cx="20.512293"
+ cy="22.506662"
+ fx="20.512293"
+ fy="22.506662"
+ r="2.9063251" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient21662"
+ id="radialGradient28813"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(5.531533,0,0,5.531533,-56.05226,-101.9897)"
+ cx="20.534391"
+ cy="22.506662"
+ fx="20.534391"
+ fy="22.506662"
+ r="2.9063251" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3698"
+ id="radialGradient2001"
+ cx="6.1016178"
+ cy="20.352701"
+ fx="6.1016178"
+ fy="20.352701"
+ r="2.5000024"
+ gradientTransform="matrix(0.774994,6.9459,-1.923675,0.21464,39.98579,-31.37473)"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient21582"
+ id="linearGradient2009"
+ x1="21.875"
+ y1="26.625"
+ x2="18.187626"
+ y2="26"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1"
+ inkscape:cx="18.527167"
+ inkscape:cy="21.280884"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ width="48px"
+ height="48px"
+ inkscape:showpageshadow="false"
+ borderlayer="true"
+ showgrid="false"
+ gridspacingx="0.5px"
+ gridspacingy="0.5px"
+ gridempspacing="2"
+ inkscape:window-width="1051"
+ inkscape:window-height="727"
+ inkscape:window-x="153"
+ inkscape:window-y="198"
+ inkscape:guide-points="false"
+ inkscape:grid-points="true"
+ showguides="false"
+ inkscape:guide-bbox="true"
+ showborder="false"
+ inkscape:grid-bbox="false">
+ <sodipodi:guide
+ orientation="vertical"
+ position="20.5"
+ id="guide21670" />
+ <sodipodi:guide
+ orientation="horizontal"
+ position="25.5"
+ id="guide21672" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Lapo Calamandrei</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
+ <dc:title>Audio Volume High</dc:title>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/SourceCode" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:groupmode="layer"
+ id="layer3"
+ inkscape:label="constr"
+ style="display:none">
+ <path
+ style="opacity:0.83011588;fill:url(#radialGradient8199);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
+ d="M -8.21875,10.5 L -20.21875,22.5 L -8.21875,34.5 L -8.21875,10.5 z "
+ id="path7288"
+ sodipodi:nodetypes="cccc" />
+ <path
+ style="opacity:0.76833975;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient6393);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
+ d="M -7,10.5 L -19,22.5 L -7,34.5 L -7,10.5 z "
+ id="path2791"
+ sodipodi:nodetypes="cccc" />
+ <path
+ sodipodi:type="inkscape:offset"
+ inkscape:radius="0.50000006"
+ inkscape:original="M 19.5 9.5 C 18 15 12 14 7.5 22.5 C 12 31 18 30 19.5 35.5 L 19.5 9.5 z "
+ style="opacity:0.63320462;fill:#fce94f;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
+ id="path21580"
+ d="M 19.375,9 C 19.200644,9.0530225 19.06894,9.1967002 19.03125,9.375 C 18.327802,11.954311 16.604417,12.961638 14.34375,14.46875 C 12.083083,15.975862 9.3592888,17.942871 7.0625,22.28125 C 6.9953198,22.419346 6.9953198,22.580654 7.0625,22.71875 C 9.3592888,27.057129 12.083083,29.024138 14.34375,30.53125 C 16.604417,32.038362 18.327802,33.045689 19.03125,35.625 C 19.110592,35.845992 19.333006,35.982016 19.565879,35.951968 C 19.798752,35.92192 19.979353,35.733894 20,35.5 L 20,9.5 C 20.005,9.3425939 19.935556,9.1920293 19.812581,9.0936489 C 19.689605,8.9952685 19.527469,8.9605689 19.375,9 z "
+ transform="translate(-42,0)" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
+ d="M -47.5,22.5 L -20,-8 L -20,56 L -47.5,22.5 z "
+ id="path21676" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:url(#radialGradient21684);fill-opacity:1;stroke:#204a87;stroke-width:0.12515022;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1;display:inline"
+ id="path21678"
+ sodipodi:cx="20.84375"
+ sodipodi:cy="21.84375"
+ sodipodi:rx="2.84375"
+ sodipodi:ry="2.84375"
+ d="M 23.6875 21.84375 A 2.84375 2.84375 0 1 1 18,21.84375 A 2.84375 2.84375 0 1 1 23.6875 21.84375 z"
+ transform="matrix(7.990397,0,0,7.990397,-220.7725,-152.0403)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:url(#radialGradient21686);fill-opacity:1;stroke:#204a87;stroke-width:0.18086948;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1;display:inline"
+ id="path21680"
+ sodipodi:cx="20.84375"
+ sodipodi:cy="21.84375"
+ sodipodi:rx="2.84375"
+ sodipodi:ry="2.84375"
+ d="M 23.6875 21.84375 A 2.84375 2.84375 0 1 1 18,21.84375 A 2.84375 2.84375 0 1 1 23.6875 21.84375 z"
+ transform="matrix(5.528848,0,0,5.528848,-169.4646,-98.27085)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:url(#radialGradient21688);fill-opacity:1;stroke:#204a87;stroke-width:0.29248634;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1;display:inline"
+ id="path21682"
+ sodipodi:cx="20.84375"
+ sodipodi:cy="21.84375"
+ sodipodi:rx="2.84375"
+ sodipodi:ry="2.84375"
+ d="M 23.6875 21.84375 A 2.84375 2.84375 0 1 1 18,21.84375 A 2.84375 2.84375 0 1 1 23.6875 21.84375 z"
+ transform="matrix(3.418962,0,0,3.418962,-125.4867,-52.18304)" />
+ </g>
+ <g
+ inkscape:label="Livello 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ style="display:inline">
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:url(#radialGradient15347);fill-opacity:1;stroke:url(#linearGradient21614);stroke-width:0.94791663;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ id="path13559"
+ sodipodi:cx="20.84375"
+ sodipodi:cy="21.84375"
+ sodipodi:rx="2.84375"
+ sodipodi:ry="2.84375"
+ d="M 23.6875 21.84375 A 2.84375 2.84375 0 1 1 18,21.84375 A 2.84375 2.84375 0 1 1 23.6875 21.84375 z"
+ transform="matrix(1.054945,0,0,1.054945,-1.48901,-0.543956)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.2;fill:url(#radialGradient17129);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ id="path16236"
+ sodipodi:cx="11.402097"
+ sodipodi:cy="36.863068"
+ sodipodi:rx="10.69499"
+ sodipodi:ry="3.5355339"
+ d="M 22.097087 36.863068 A 10.69499 3.5355339 0 1 1 0.70710659,36.863068 A 10.69499 3.5355339 0 1 1 22.097087 36.863068 z"
+ transform="matrix(1.45582,0,0,2.078338,-1.697314,-43.43834)" />
+ <path
+ style="fill:url(#linearGradient6377);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient7286);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 19.5,9.5 C 18,15 12,14 7.5,22.5 C 12,31 18,30 19.5,35.5 L 19.5,9.5 z "
+ id="path1887"
+ sodipodi:nodetypes="cccc" />
+ <rect
+ style="opacity:1;fill:url(#linearGradient10870);fill-opacity:1;stroke:#555753;stroke-width:0.99999893;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1;display:inline"
+ id="rect1898"
+ width="6.3333392"
+ height="8.0000706"
+ x="2.4999988"
+ y="18.499939"
+ rx="2.375"
+ ry="2.375" />
+ <path
+ sodipodi:type="inkscape:offset"
+ inkscape:radius="0.50000006"
+ inkscape:original="M 19.5 9.5 C 18 15 12 14 7.5 22.5 C 12 31 18 30 19.5 35.5 L 19.5 9.5 z "
+ style="opacity:0.50193045;fill:url(#radialGradient21578);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
+ id="path20685"
+ d="M 19.375,9 C 19.200644,9.0530225 19.06894,9.1967002 19.03125,9.375 C 18.327802,11.954311 16.604417,12.961638 14.34375,14.46875 C 12.083083,15.975862 9.3592888,17.942871 7.0625,22.28125 C 6.9953198,22.419346 6.9953198,22.580654 7.0625,22.71875 C 9.3592888,27.057129 12.083083,29.024138 14.34375,30.53125 C 16.604417,32.038362 18.327802,33.045689 19.03125,35.625 C 19.110592,35.845992 19.333006,35.982016 19.565879,35.951968 C 19.798752,35.92192 19.979353,35.733894 20,35.5 L 20,9.5 C 20.005,9.3425939 19.935556,9.1920293 19.812581,9.0936489 C 19.689605,8.9952685 19.527469,8.9605689 19.375,9 z " />
+ <path
+ style="opacity:0.63320462;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient21604);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
+ d="M 18.5625,12.96875 C 17.576953,14.016322 16.385251,14.836916 15.15625,15.65625 C 13.018871,17.081169 10.717564,18.770623 8.625,22.5 C 10.717564,26.229377 13.018871,27.918831 15.15625,29.34375 C 16.385251,30.163084 17.576953,30.983678 18.5625,32.03125 L 20.5,34 L 20.5,11 L 18.5625,12.96875 z "
+ id="path21595"
+ sodipodi:nodetypes="cscscccc" />
+ <path
+ style="opacity:0.7335907;fill:url(#linearGradient6385);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
+ d="M 21,14.375 C 17.125,15.769678 12.8125,18.570921 9,22.5 C 13.049341,21.373913 17.236937,20.539527 21,20.75 L 21,14.375 z "
+ id="path5476"
+ sodipodi:nodetypes="cccc" />
+ <path
+ style="opacity:0.36679538;fill:url(#linearGradient2009);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
+ d="M 19.375,9 C 19.200644,9.0530225 19.06894,9.1967002 19.03125,9.375 C 18.455919,11.48455 17.175782,12.547561 15.5,13.6875 L 15.5,31.3125 C 17.175782,32.452439 18.455919,33.51545 19.03125,35.625 C 19.110592,35.845992 19.329627,35.967548 19.5625,35.9375 C 19.795372,35.907451 19.979353,35.733894 20,35.5 L 20,9.5 C 20.005,9.3425939 19.935475,9.1921304 19.8125,9.09375 C 19.689525,8.9953696 19.527469,8.9605689 19.375,9 z "
+ id="path19794" />
+ <rect
+ style="opacity:1;fill:url(#linearGradient2799);fill-opacity:1;stroke:url(#linearGradient3694);stroke-width:0.99999881;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ id="rect1881"
+ width="6"
+ height="15.999965"
+ x="4.4999995"
+ y="14.499997"
+ rx="1"
+ ry="1" />
+ <rect
+ style="opacity:1;fill:url(#linearGradient13549);fill-opacity:1;stroke:url(#linearGradient13541);stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ id="rect1889"
+ width="2"
+ height="29.999969"
+ x="19.5"
+ y="7.500001"
+ rx="1"
+ ry="1" />
+ <rect
+ style="opacity:0.60617761;fill:none;fill-opacity:1.0;stroke:url(#radialGradient2001);stroke-width:0.99999917;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1;display:inline"
+ id="rect1902"
+ width="4.0000057"
+ height="14.000035"
+ x="5.4999981"
+ y="15.499966"
+ rx="0"
+ ry="0" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:white;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ id="path15349"
+ sodipodi:cx="20.5"
+ sodipodi:cy="13.5"
+ sodipodi:rx="1"
+ sodipodi:ry="1"
+ d="M 21.5 13.5 A 1 1 0 1 1 19.5,13.5 A 1 1 0 1 1 21.5 13.5 z" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#babdb6;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ id="path18901"
+ sodipodi:cx="3.75"
+ sodipodi:cy="20.75"
+ sodipodi:rx="0.75"
+ sodipodi:ry="0.75"
+ d="M 4.5 20.75 A 0.75 0.75 0 1 1 3,20.75 A 0.75 0.75 0 1 1 4.5 20.75 z"
+ transform="translate(-0.46875,-0.34375)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:white;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1;display:inline"
+ id="path2001"
+ sodipodi:cx="20.5"
+ sodipodi:cy="13.5"
+ sodipodi:rx="1"
+ sodipodi:ry="1"
+ d="M 21.5 13.5 A 1 1 0 1 1 19.5,13.5 A 1 1 0 1 1 21.5 13.5 z"
+ transform="translate(-15,6.3125)" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer2"
+ inkscape:label="waves">
+ <g
+ style="display:inline"
+ id="g26136"
+ transform="translate(-34,0)">
+ <path
+ id="path21616"
+ d="M 69.84375,5.5 L 54.5,22.5 L 69.03125,40.1875 C 74.190803,36.02097 77.499999,29.643289 77.5,22.5 C 77.5,15.734684 74.540259,9.6637676 69.84375,5.5 z "
+ style="opacity:1;fill:url(#radialGradient26140);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1;display:inline" />
+ <path
+ sodipodi:nodetypes="csc"
+ id="path25249"
+ d="M 69.03125,40.1875 C 74.190803,36.02097 77.499999,29.643289 77.5,22.5 C 77.5,15.734684 74.540259,9.6637676 69.84375,5.5"
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#204a87;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1;display:inline" />
+ </g>
+ <g
+ style="display:inline"
+ id="g27916"
+ transform="translate(-37,0)">
+ <path
+ id="path26142"
+ d="M 68.15625,10.6875 L 57.5,22.5 L 67.5625,34.78125 C 71.176369,31.899733 73.499999,27.47788 73.5,22.5 C 73.5,17.793936 71.43603,13.569699 68.15625,10.6875 z "
+ style="opacity:1;fill:url(#radialGradient28813);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1;display:inline" />
+ <path
+ sodipodi:nodetypes="csc"
+ id="path21632"
+ d="M 67.5625,34.78125 C 71.176369,31.899733 73.499999,27.47788 73.5,22.5 C 73.5,17.793936 71.43603,13.569699 68.15625,10.6875"
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#204a87;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1;display:inline" />
+ </g>
+ <g
+ style="display:inline"
+ id="g28807"
+ transform="translate(-32,0)">
+ <path
+ id="path21640"
+ d="M 59.125,15.15625 L 52.5,22.5 L 58.78125,30.15625 C 61.050824,28.375887 62.5,25.606103 62.5,22.5 C 62.5,19.560794 61.188424,16.939552 59.125,15.15625 z "
+ style="opacity:1;fill:url(#radialGradient28811);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1;display:inline" />
+ <path
+ sodipodi:nodetypes="csc"
+ id="path27920"
+ d="M 58.78125,30.15625 C 61.050824,28.375887 62.5,25.606103 62.5,22.5 C 62.5,19.560794 61.188424,16.939552 59.125,15.15625"
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#204a87;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1;display:inline" />
+ </g>
+ </g>
+</svg>
diff --git a/xpm/gui_sound_32.xpm b/xpm/gui_sound_32.xpm
new file mode 100644
index 00000000..a348492a
--- /dev/null
+++ b/xpm/gui_sound_32.xpm
@@ -0,0 +1,204 @@
+/* XPM */
+static char *gui_sound______[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 166 2",
+" c black",
+". c gray1",
+"X c #070707",
+"o c #03070C",
+"O c #050C15",
+"+ c #050C16",
+"@ c #141413",
+"# c #141514",
+"$ c #161615",
+"% c #141616",
+"& c #161716",
+"* c #171716",
+"= c #161818",
+"- c #171919",
+"; c #181818",
+": c #191919",
+"> c #191A19",
+", c #191B1B",
+"< c #1C1C1B",
+"1 c #1C1D1C",
+"2 c #1F201F",
+"3 c #222321",
+"4 c #232424",
+"5 c #232525",
+"6 c #242626",
+"7 c #252727",
+"8 c #272726",
+"9 c #282827",
+"0 c #272B2C",
+"q c #292A29",
+"w c #2D2E2D",
+"e c #2A2F30",
+"r c #2B2F30",
+"t c #303231",
+"y c #333533",
+"u c #343635",
+"i c #343636",
+"p c #373737",
+"a c #383A38",
+"s c #383A39",
+"d c #3B3C3A",
+"f c #393D3C",
+"g c #3C3E3D",
+"h c #3F3F3F",
+"j c #193A69",
+"k c #1B3F73",
+"l c gray25",
+"z c #404241",
+"x c #454544",
+"c c #444744",
+"v c #464645",
+"b c #454948",
+"n c #4A4B4A",
+"m c #4A4E4D",
+"M c #4E504F",
+"N c #50514E",
+"B c #4C5050",
+"V c #505452",
+"C c #555957",
+"Z c #575A56",
+"A c #595B56",
+"S c #585B5A",
+"D c #5C5D59",
+"F c #5D5E5B",
+"G c #5B5F5D",
+"H c gray36",
+"J c #5F605B",
+"K c #636561",
+"L c #606462",
+"P c #656564",
+"I c #656764",
+"U c #656866",
+"Y c #686A67",
+"T c #676A69",
+"R c #6B6D68",
+"E c #6E6F6D",
+"W c gray43",
+"Q c #737571",
+"! c #747874",
+"~ c #767A78",
+"^ c #7A7B7A",
+"/ c #787C7A",
+"( c #7B7E7A",
+") c #7D7E7D",
+"_ c #7E7F7C",
+"` c #7D807B",
+"' c #7F817A",
+"] c #7F807E",
+"[ c #204A87",
+"{ c #838683",
+"} c #868686",
+"| c #898D89",
+" . c #8C8E8B",
+".. c #8F938F",
+"X. c #91938A",
+"o. c #90918F",
+"O. c #949793",
+"+. c #959793",
+"@. c #959695",
+"#. c #969795",
+"$. c #959894",
+"%. c gray61",
+"&. c #9D9F9C",
+"*. c #9DA099",
+"=. c #A1A1A0",
+"-. c #A2A5A1",
+";. c #A5A8A5",
+":. c #A9ACA8",
+">. c #ADAEAB",
+",. c #AEB0AD",
+"<. c #B0B2AE",
+"1. c gray69",
+"2. c #B1B3B0",
+"3. c #B4B5B5",
+"4. c #B7B8B5",
+"5. c #BABDB6",
+"6. c #BBBEB7",
+"7. c #B9B9B8",
+"8. c #B9BAB9",
+"9. c #B9BABA",
+"0. c gray73",
+"q. c #BCBCBC",
+"w. c #BDC0B9",
+"e. c #BEC1BC",
+"r. c #BFC0BE",
+"t. c #BFC1BE",
+"y. c #C1C5BE",
+"u. c #C2C4BF",
+"i. c #C4C5C2",
+"p. c #C5C5C4",
+"a. c #C6C6C6",
+"s. c #C6C7C6",
+"d. c #C8C9C7",
+"f. c #CBCFC7",
+"g. c #CACBCA",
+"h. c #CDCFCD",
+"j. c #D0D1CF",
+"k. c #D1D3CE",
+"l. c #D1D4CD",
+"z. c #D1D2D1",
+"x. c #D2D2D1",
+"c. c #D3D5D1",
+"v. c #D5D6D5",
+"b. c #D9DAD8",
+"n. c #D9DAD9",
+"m. c #DCDCDA",
+"M. c #DDDEDD",
+"N. c #DFE0DD",
+"B. c #DFE1DE",
+"V. c #E0E1DF",
+"C. c #E1E2E0",
+"Z. c #E1E3E0",
+"A. c #E4E5E3",
+"S. c #E5E6E3",
+"D. c #E5E6E4",
+"F. c #E5E6E5",
+"G. c #E6E7E5",
+"H. c #E7E8E7",
+"J. c #E9E9E7",
+"K. c #EAEBEA",
+"L. c #ECEDEA",
+"P. c #EDEDEB",
+"I. c #EEEFED",
+"U. c #F0F0EF",
+"Y. c #FAFBFA",
+"T. c None",
+/* pixels */
+"T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.",
+"T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.",
+"T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.",
+"T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.",
+"T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.[ T.T.T.T.T.T.T.",
+"T.T.T.T.T.T.T.T.T.T.T.T.T.y.w.T.T.T.T.T.T.T.T.T.T.[ T.T.T.T.T.T.",
+"T.T.T.T.T.T.T.T.T.T.T.T.' f.w.T.T.T.T.T.T.T.T.T.T.T.[ T.T.T.T.T.",
+"T.T.T.T.T.T.T.T.T.T.T.T.I l.6.T.T.T.T.T.T.[ T.T.T.T.T.T.T.T.T.T.",
+"T.T.T.T.T.T.T.T.T.T.T.n y.K.i.T.T.T.T.T.T.T.T.T.T.T.T.[ T.T.T.T.",
+"T.T.T.5.5.5.5.T.T.T.I 0.D I.q.T.T.T.T.T.T.T.[ T.T.T.T.T.T.T.T.T.",
+"T.T.T.C.A.S.V.T.N %.=.d ) M.<.T.T.T.[ T.T.T.T.[ T.T.T.T.[ T.T.T.",
+"T.T.T.A.5.5.V.Y 0.E } 7.O.n.:.T.T.T.T.[ T.T.T.[ T.T.T.T.[ T.T.T.",
+"T.T.Q U.c.k.F.2.v ^ q.a.#.x.-.T.T.T.T.[ T.T.T.T.T.T.T.T.[ T.T.T.",
+"T.K *.Y.P.J.K.E v ) <.x.#.d.$.T.T.T.T.T.T.T.T.T.[ T.T.T.T.T.T.T.",
+"T.J X.H.m.m.F.a 8 w q 4 x y...U T.T.T.T.[ T.T.T.[ T.T.T.T.T.T.T.",
+"T.D ' V.i.i.M.y $ : < 1 z 3.| m T.T.T.T.[ T.T.T.[ T.T.T.T.T.T.T.",
+"T.A R n.>.>.v.B $ $ : 1 g ,.~ T.T.T.T.T.T.T.T.T.T.T.T.T.[ T.T.T.",
+"T.T.Z x.+.+.h.T 8 # - : a ;./ T.T.T.T.[ T.T.T.T.T.T.T.T.[ T.T.T.",
+"T.T.T.g.) ' a.i H i @ $ i *.L T.T.T.[ T.T.T.[ T.T.T.T.[ T.T.T.",
+"T. $ 0.a.a.3.- 8 l v = t #.J + k T.T.T.T.[ T.T.T.T.[ T.T.T.",
+" 0 r r 0 . : 4 g t .S + o T.T.[ T.T.T.T.T.T.T.T.T.",
+" X , a { B T.T.T.T.T.T.T.[ T.T.T.T.",
+" . 5 ( m j [ T.T.T.T.T.T.T.T.T.T.",
+" 7 ! b T.T.T.T.T.T.[ T.T.T.T.T.",
+"T. $ S f T.T.T.T.T.T.[ T.T.T.T.T.T.",
+"T.T. - . T.T.T.T.T.T.T.[ T.T.T.T.T.T.T.",
+"T.T.T.T.T. T.T.T.T.T.T.T.T.T.[ T.T.T.T.T.T.T.T.",
+"T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.",
+"T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.",
+"T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.",
+"T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.",
+"T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T.T."
+};
diff --git a/xpm/gui_sound_off.svg b/xpm/gui_sound_off.svg
new file mode 100644
index 00000000..d85e1f8b
--- /dev/null
+++ b/xpm/gui_sound_off.svg
@@ -0,0 +1,771 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48"
+ height="48"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docbase="/home/lapo/Icone/cvs/gnome-icon-theme/scalable/status"
+ sodipodi:docname="gui_sound_off.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 24 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="48 : 24 : 1"
+ inkscape:persp3d-origin="24 : 16 : 1"
+ id="perspective131" />
+ <linearGradient
+ id="linearGradient21662">
+ <stop
+ id="stop21664"
+ offset="0"
+ style="stop-color:#3465a4;stop-opacity:0;" />
+ <stop
+ style="stop-color:#3465a4;stop-opacity:0;"
+ offset="0.81927711"
+ id="stop21666" />
+ <stop
+ id="stop21668"
+ offset="1"
+ style="stop-color:#3465a4;stop-opacity:1" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient21644">
+ <stop
+ id="stop21646"
+ offset="0"
+ style="stop-color:#3465a4;stop-opacity:0;" />
+ <stop
+ style="stop-color:#3465a4;stop-opacity:0;"
+ offset="0.73493975"
+ id="stop21648" />
+ <stop
+ id="stop21650"
+ offset="1"
+ style="stop-color:#3465a4;stop-opacity:1" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient21622">
+ <stop
+ style="stop-color:#3465a4;stop-opacity:0;"
+ offset="0"
+ id="stop21624" />
+ <stop
+ id="stop21630"
+ offset="0.85542166"
+ style="stop-color:#3465a4;stop-opacity:0;" />
+ <stop
+ style="stop-color:#3465a4;stop-opacity:1"
+ offset="1"
+ id="stop21626" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient21608">
+ <stop
+ style="stop-color:#888a85;stop-opacity:1"
+ offset="0"
+ id="stop21610" />
+ <stop
+ style="stop-color:#2e3436;stop-opacity:1"
+ offset="1"
+ id="stop21612" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient21598">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop21600" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop21602" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient21582">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop21584" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop21586" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient21572">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop21574" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop21576" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient17123">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop17125" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop17127" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient15341">
+ <stop
+ style="stop-color:#888a85;stop-opacity:1"
+ offset="0"
+ id="stop15343" />
+ <stop
+ style="stop-color:#555753;stop-opacity:1"
+ offset="1"
+ id="stop15345" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient13551">
+ <stop
+ id="stop13553"
+ offset="0"
+ style="stop-color:#d3d7cf;stop-opacity:1" />
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0.25301206"
+ id="stop13555" />
+ <stop
+ id="stop13557"
+ offset="1"
+ style="stop-color:#888a85;stop-opacity:1" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient13535">
+ <stop
+ style="stop-color:#babdb6;stop-opacity:1"
+ offset="0"
+ id="stop13537" />
+ <stop
+ style="stop-color:#2e3436;stop-opacity:1"
+ offset="1"
+ id="stop13539" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient10872">
+ <stop
+ id="stop10874"
+ offset="0"
+ style="stop-color:#888a85;stop-opacity:1" />
+ <stop
+ style="stop-color:#9e9e92;stop-opacity:1;"
+ offset="0.25301206"
+ id="stop10876" />
+ <stop
+ id="stop10878"
+ offset="1"
+ style="stop-color:#555753;stop-opacity:1" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient9086">
+ <stop
+ id="stop9088"
+ offset="0"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ id="stop9090"
+ offset="1"
+ style="stop-color:black;stop-opacity:0;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient7280">
+ <stop
+ style="stop-color:#babdb6;stop-opacity:1"
+ offset="0"
+ id="stop7282" />
+ <stop
+ style="stop-color:#2e3436;stop-opacity:1"
+ offset="1"
+ id="stop7284" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient6387">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop6389" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop6391" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient6379">
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="0"
+ id="stop6381" />
+ <stop
+ id="stop21606"
+ offset="0.5"
+ style="stop-color:white;stop-opacity:1;" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop6383" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient6371">
+ <stop
+ style="stop-color:#888a85;stop-opacity:1"
+ offset="0"
+ id="stop6373" />
+ <stop
+ style="stop-color:#d3d7cf;stop-opacity:1;"
+ offset="1"
+ id="stop6375" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3698">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop3700" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop3702" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3688">
+ <stop
+ style="stop-color:#babdb6;stop-opacity:1"
+ offset="0"
+ id="stop3690" />
+ <stop
+ style="stop-color:#2e3436;stop-opacity:1"
+ offset="1"
+ id="stop3692" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2793">
+ <stop
+ style="stop-color:#babdb6;stop-opacity:1;"
+ offset="0"
+ id="stop2795" />
+ <stop
+ id="stop2801"
+ offset="0.25301206"
+ style="stop-color:#eeeeec;stop-opacity:1;" />
+ <stop
+ style="stop-color:#555753;stop-opacity:1"
+ offset="1"
+ id="stop2797" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2793"
+ id="linearGradient2799"
+ x1="7.5625"
+ y1="16.499838"
+ x2="7.5625"
+ y2="29.625288"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3688"
+ id="linearGradient3694"
+ x1="4.5961943"
+ y1="14.456622"
+ x2="4.5961943"
+ y2="30.313524"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient6371"
+ id="linearGradient6377"
+ x1="14.241117"
+ y1="26.996773"
+ x2="15.125"
+ y2="20.976084"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient6379"
+ id="linearGradient6385"
+ x1="20.226221"
+ y1="20.33363"
+ x2="11.4375"
+ y2="21.75"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient6387"
+ id="linearGradient6393"
+ x1="17.25"
+ y1="18.81151"
+ x2="16.1875"
+ y2="32.629498"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-28,0)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient7280"
+ id="linearGradient7286"
+ x1="11.875"
+ y1="20.375"
+ x2="13.125"
+ y2="34.13559"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient9086"
+ id="radialGradient8199"
+ cx="7.1396246"
+ cy="22.5"
+ fx="7.1396246"
+ fy="22.5"
+ r="6"
+ gradientTransform="matrix(1.914836,-0.506192,0.654838,2.477012,-48.62381,-29.61876)"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient10872"
+ id="linearGradient10870"
+ x1="3.8890872"
+ y1="18.937069"
+ x2="3.8890872"
+ y2="25.947107"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient13535"
+ id="linearGradient13541"
+ x1="21.875"
+ y1="9.6335878"
+ x2="20.5"
+ y2="41.744865"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient13551"
+ id="linearGradient13549"
+ x1="20.125"
+ y1="8.875"
+ x2="20.125"
+ y2="33.8829"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient15341"
+ id="radialGradient15347"
+ cx="22.624176"
+ cy="20.880224"
+ fx="22.624176"
+ fy="20.880224"
+ r="3.3177083"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient17123"
+ id="radialGradient17129"
+ cx="11.402097"
+ cy="36.863068"
+ fx="11.402097"
+ fy="36.863068"
+ r="10.69499"
+ gradientTransform="matrix(1,0,0,0.330579,0,24.67693)"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient21572"
+ id="radialGradient21578"
+ cx="7.001297"
+ cy="22.470087"
+ fx="7.001297"
+ fy="22.470087"
+ r="6.4940691"
+ gradientTransform="matrix(1.433087,-0.596698,0.798238,1.917124,-20.96864,-16.43019)"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient21598"
+ id="linearGradient21604"
+ x1="12.25"
+ y1="19.75"
+ x2="10.875"
+ y2="33.125"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient21608"
+ id="linearGradient21614"
+ x1="23.272787"
+ y1="18.525478"
+ x2="23.272787"
+ y2="22.811184"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient21622"
+ id="radialGradient21684"
+ gradientUnits="userSpaceOnUse"
+ cx="20.84375"
+ cy="21.84375"
+ fx="20.84375"
+ fy="21.84375"
+ r="2.9063251" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient21662"
+ id="radialGradient21686"
+ gradientUnits="userSpaceOnUse"
+ cx="20.84375"
+ cy="21.84375"
+ fx="20.84375"
+ fy="21.84375"
+ r="2.9063251" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient21644"
+ id="radialGradient21688"
+ gradientUnits="userSpaceOnUse"
+ cx="20.84375"
+ cy="21.84375"
+ fx="20.84375"
+ fy="21.84375"
+ r="2.9063251" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient21622"
+ id="radialGradient26140"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(8.054163,0,0,8.054163,-110.8381,-158.8113)"
+ cx="20.532286"
+ cy="22.513134"
+ fx="20.532286"
+ fy="22.513134"
+ r="2.9063251" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient21644"
+ id="radialGradient28811"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(3.494347,0,0,3.494347,-19.16478,-56.13942)"
+ cx="20.512293"
+ cy="22.506662"
+ fx="20.512293"
+ fy="22.506662"
+ r="2.9063251" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient21662"
+ id="radialGradient28813"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(5.531533,0,0,5.531533,-56.05226,-101.9897)"
+ cx="20.534391"
+ cy="22.506662"
+ fx="20.534391"
+ fy="22.506662"
+ r="2.9063251" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3698"
+ id="radialGradient2001"
+ cx="6.1016178"
+ cy="20.352701"
+ fx="6.1016178"
+ fy="20.352701"
+ r="2.5000024"
+ gradientTransform="matrix(0.774994,6.9459,-1.923675,0.21464,39.98579,-31.37473)"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient21582"
+ id="linearGradient2009"
+ x1="21.875"
+ y1="26.625"
+ x2="18.187626"
+ y2="26"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="10.055556"
+ inkscape:cx="28.5"
+ inkscape:cy="25"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer2"
+ width="48px"
+ height="48px"
+ inkscape:showpageshadow="false"
+ borderlayer="true"
+ showgrid="false"
+ inkscape:window-width="1018"
+ inkscape:window-height="727"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:guide-points="false"
+ inkscape:grid-points="true"
+ showguides="false"
+ inkscape:guide-bbox="true"
+ showborder="false"
+ inkscape:grid-bbox="false">
+ <sodipodi:guide
+ orientation="vertical"
+ position="20.5"
+ id="guide21670" />
+ <sodipodi:guide
+ orientation="horizontal"
+ position="25.5"
+ id="guide21672" />
+ <inkscape:grid
+ id="GridFromPre046Settings"
+ type="xygrid"
+ originx="0px"
+ originy="0px"
+ spacingx="0.5px"
+ spacingy="0.5px"
+ color="#0000ff"
+ empcolor="#0000ff"
+ opacity="0.2"
+ empopacity="0.4"
+ empspacing="2" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Lapo Calamandrei</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
+ <dc:title>Audio Volume High</dc:title>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/SourceCode" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:groupmode="layer"
+ id="layer3"
+ inkscape:label="constr"
+ style="display:none">
+ <path
+ style="opacity:0.83011588;fill:url(#radialGradient8199);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
+ d="M -8.21875,10.5 L -20.21875,22.5 L -8.21875,34.5 L -8.21875,10.5 z "
+ id="path7288"
+ sodipodi:nodetypes="cccc" />
+ <path
+ style="opacity:0.76833975;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient6393);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
+ d="M -7,10.5 L -19,22.5 L -7,34.5 L -7,10.5 z "
+ id="path2791"
+ sodipodi:nodetypes="cccc" />
+ <path
+ sodipodi:type="inkscape:offset"
+ inkscape:radius="0.50000006"
+ inkscape:original="M 19.5 9.5 C 18 15 12 14 7.5 22.5 C 12 31 18 30 19.5 35.5 L 19.5 9.5 z "
+ style="opacity:0.63320462;fill:#fce94f;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
+ id="path21580"
+ d="M 19.375,9 C 19.200644,9.0530225 19.06894,9.1967002 19.03125,9.375 C 18.327802,11.954311 16.604417,12.961638 14.34375,14.46875 C 12.083083,15.975862 9.3592888,17.942871 7.0625,22.28125 C 6.9953198,22.419346 6.9953198,22.580654 7.0625,22.71875 C 9.3592888,27.057129 12.083083,29.024138 14.34375,30.53125 C 16.604417,32.038362 18.327802,33.045689 19.03125,35.625 C 19.110592,35.845992 19.333006,35.982016 19.565879,35.951968 C 19.798752,35.92192 19.979353,35.733894 20,35.5 L 20,9.5 C 20.005,9.3425939 19.935556,9.1920293 19.812581,9.0936489 C 19.689605,8.9952685 19.527469,8.9605689 19.375,9 z "
+ transform="translate(-42,0)" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
+ d="M -47.5,22.5 L -20,-8 L -20,56 L -47.5,22.5 z "
+ id="path21676" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:url(#radialGradient21684);fill-opacity:1;stroke:#204a87;stroke-width:0.12515022;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1;display:inline"
+ id="path21678"
+ sodipodi:cx="20.84375"
+ sodipodi:cy="21.84375"
+ sodipodi:rx="2.84375"
+ sodipodi:ry="2.84375"
+ d="M 23.6875 21.84375 A 2.84375 2.84375 0 1 1 18,21.84375 A 2.84375 2.84375 0 1 1 23.6875 21.84375 z"
+ transform="matrix(7.990397,0,0,7.990397,-220.7725,-152.0403)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:url(#radialGradient21686);fill-opacity:1;stroke:#204a87;stroke-width:0.18086948;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1;display:inline"
+ id="path21680"
+ sodipodi:cx="20.84375"
+ sodipodi:cy="21.84375"
+ sodipodi:rx="2.84375"
+ sodipodi:ry="2.84375"
+ d="M 23.6875 21.84375 A 2.84375 2.84375 0 1 1 18,21.84375 A 2.84375 2.84375 0 1 1 23.6875 21.84375 z"
+ transform="matrix(5.528848,0,0,5.528848,-169.4646,-98.27085)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:url(#radialGradient21688);fill-opacity:1;stroke:#204a87;stroke-width:0.29248634;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1;display:inline"
+ id="path21682"
+ sodipodi:cx="20.84375"
+ sodipodi:cy="21.84375"
+ sodipodi:rx="2.84375"
+ sodipodi:ry="2.84375"
+ d="M 23.6875 21.84375 A 2.84375 2.84375 0 1 1 18,21.84375 A 2.84375 2.84375 0 1 1 23.6875 21.84375 z"
+ transform="matrix(3.418962,0,0,3.418962,-125.4867,-52.18304)" />
+ </g>
+ <g
+ inkscape:label="Livello 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ style="display:inline">
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:url(#radialGradient15347);fill-opacity:1;stroke:url(#linearGradient21614);stroke-width:0.94791663;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ id="path13559"
+ sodipodi:cx="20.84375"
+ sodipodi:cy="21.84375"
+ sodipodi:rx="2.84375"
+ sodipodi:ry="2.84375"
+ d="M 23.6875 21.84375 A 2.84375 2.84375 0 1 1 18,21.84375 A 2.84375 2.84375 0 1 1 23.6875 21.84375 z"
+ transform="matrix(1.054945,0,0,1.054945,-1.48901,-0.543956)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.2;fill:url(#radialGradient17129);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ id="path16236"
+ sodipodi:cx="11.402097"
+ sodipodi:cy="36.863068"
+ sodipodi:rx="10.69499"
+ sodipodi:ry="3.5355339"
+ d="M 22.097087 36.863068 A 10.69499 3.5355339 0 1 1 0.70710659,36.863068 A 10.69499 3.5355339 0 1 1 22.097087 36.863068 z"
+ transform="matrix(1.45582,0,0,2.078338,-1.697314,-43.43834)" />
+ <path
+ style="fill:url(#linearGradient6377);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient7286);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 19.5,9.5 C 18,15 12,14 7.5,22.5 C 12,31 18,30 19.5,35.5 L 19.5,9.5 z "
+ id="path1887"
+ sodipodi:nodetypes="cccc" />
+ <rect
+ style="opacity:1;fill:url(#linearGradient10870);fill-opacity:1;stroke:#555753;stroke-width:0.99999893;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1;display:inline"
+ id="rect1898"
+ width="6.3333392"
+ height="8.0000706"
+ x="2.4999988"
+ y="18.499939"
+ rx="2.375"
+ ry="2.375" />
+ <path
+ sodipodi:type="inkscape:offset"
+ inkscape:radius="0.50000006"
+ inkscape:original="M 19.5 9.5 C 18 15 12 14 7.5 22.5 C 12 31 18 30 19.5 35.5 L 19.5 9.5 z "
+ style="opacity:0.50193045;fill:url(#radialGradient21578);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
+ id="path20685"
+ d="M 19.375,9 C 19.200644,9.0530225 19.06894,9.1967002 19.03125,9.375 C 18.327802,11.954311 16.604417,12.961638 14.34375,14.46875 C 12.083083,15.975862 9.3592888,17.942871 7.0625,22.28125 C 6.9953198,22.419346 6.9953198,22.580654 7.0625,22.71875 C 9.3592888,27.057129 12.083083,29.024138 14.34375,30.53125 C 16.604417,32.038362 18.327802,33.045689 19.03125,35.625 C 19.110592,35.845992 19.333006,35.982016 19.565879,35.951968 C 19.798752,35.92192 19.979353,35.733894 20,35.5 L 20,9.5 C 20.005,9.3425939 19.935556,9.1920293 19.812581,9.0936489 C 19.689605,8.9952685 19.527469,8.9605689 19.375,9 z " />
+ <path
+ style="opacity:0.63320462;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient21604);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
+ d="M 18.5625,12.96875 C 17.576953,14.016322 16.385251,14.836916 15.15625,15.65625 C 13.018871,17.081169 10.717564,18.770623 8.625,22.5 C 10.717564,26.229377 13.018871,27.918831 15.15625,29.34375 C 16.385251,30.163084 17.576953,30.983678 18.5625,32.03125 L 20.5,34 L 20.5,11 L 18.5625,12.96875 z "
+ id="path21595"
+ sodipodi:nodetypes="cscscccc" />
+ <path
+ style="opacity:0.7335907;fill:url(#linearGradient6385);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
+ d="M 21,14.375 C 17.125,15.769678 12.8125,18.570921 9,22.5 C 13.049341,21.373913 17.236937,20.539527 21,20.75 L 21,14.375 z "
+ id="path5476"
+ sodipodi:nodetypes="cccc" />
+ <path
+ style="opacity:0.36679538;fill:url(#linearGradient2009);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
+ d="M 19.375,9 C 19.200644,9.0530225 19.06894,9.1967002 19.03125,9.375 C 18.455919,11.48455 17.175782,12.547561 15.5,13.6875 L 15.5,31.3125 C 17.175782,32.452439 18.455919,33.51545 19.03125,35.625 C 19.110592,35.845992 19.329627,35.967548 19.5625,35.9375 C 19.795372,35.907451 19.979353,35.733894 20,35.5 L 20,9.5 C 20.005,9.3425939 19.935475,9.1921304 19.8125,9.09375 C 19.689525,8.9953696 19.527469,8.9605689 19.375,9 z "
+ id="path19794" />
+ <rect
+ style="opacity:1;fill:url(#linearGradient2799);fill-opacity:1;stroke:url(#linearGradient3694);stroke-width:0.99999881;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ id="rect1881"
+ width="6"
+ height="15.999965"
+ x="4.4999995"
+ y="14.499997"
+ rx="1"
+ ry="1" />
+ <rect
+ style="opacity:1;fill:url(#linearGradient13549);fill-opacity:1;stroke:url(#linearGradient13541);stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ id="rect1889"
+ width="2"
+ height="29.999969"
+ x="19.5"
+ y="7.500001"
+ rx="1"
+ ry="1" />
+ <rect
+ style="opacity:0.60617761;fill:none;fill-opacity:1.0;stroke:url(#radialGradient2001);stroke-width:0.99999917;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1;display:inline"
+ id="rect1902"
+ width="4.0000057"
+ height="14.000035"
+ x="5.4999981"
+ y="15.499966"
+ rx="0"
+ ry="0" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:white;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ id="path15349"
+ sodipodi:cx="20.5"
+ sodipodi:cy="13.5"
+ sodipodi:rx="1"
+ sodipodi:ry="1"
+ d="M 21.5 13.5 A 1 1 0 1 1 19.5,13.5 A 1 1 0 1 1 21.5 13.5 z" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#babdb6;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1"
+ id="path18901"
+ sodipodi:cx="3.75"
+ sodipodi:cy="20.75"
+ sodipodi:rx="0.75"
+ sodipodi:ry="0.75"
+ d="M 4.5 20.75 A 0.75 0.75 0 1 1 3,20.75 A 0.75 0.75 0 1 1 4.5 20.75 z"
+ transform="translate(-0.46875,-0.34375)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:white;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.20000057;stroke-opacity:1;display:inline"
+ id="path2001"
+ sodipodi:cx="20.5"
+ sodipodi:cy="13.5"
+ sodipodi:rx="1"
+ sodipodi:ry="1"
+ d="M 21.5 13.5 A 1 1 0 1 1 19.5,13.5 A 1 1 0 1 1 21.5 13.5 z"
+ transform="translate(-15,6.3125)" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer2"
+ inkscape:label="waves" />
+</svg>
diff --git a/xpm/gui_sound_off_32.xpm b/xpm/gui_sound_off_32.xpm
new file mode 100644
index 00000000..32b5b8ea
--- /dev/null
+++ b/xpm/gui_sound_off_32.xpm
@@ -0,0 +1,198 @@
+/* XPM */
+static char *gui_sound_off______[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 160 2",
+" c black",
+". c gray1",
+"X c #070707",
+"o c #141413",
+"O c #141514",
+"+ c #161615",
+"@ c #141616",
+"# c #161716",
+"$ c #171716",
+"% c #161818",
+"& c #171919",
+"* c #181818",
+"= c #191919",
+"- c #191A19",
+"; c #191B1B",
+": c #1C1C1B",
+"> c #1C1D1C",
+", c #1F201F",
+"< c #222321",
+"1 c #232424",
+"2 c #232525",
+"3 c #242626",
+"4 c #252727",
+"5 c #272726",
+"6 c #282827",
+"7 c #272B2C",
+"8 c #292A29",
+"9 c #2D2E2D",
+"0 c #2A2F30",
+"q c #2B2F30",
+"w c #303231",
+"e c #333533",
+"r c #343635",
+"t c #343636",
+"y c #373737",
+"u c #383A38",
+"i c #383A39",
+"p c #3B3C3A",
+"a c #393D3C",
+"s c #3C3E3D",
+"d c #3F3F3F",
+"f c gray25",
+"g c #404241",
+"h c #454544",
+"j c #444744",
+"k c #464645",
+"l c #454948",
+"z c #4A4B4A",
+"x c #4A4E4D",
+"c c #4E504F",
+"v c #50514E",
+"b c #4C5050",
+"n c #505452",
+"m c #555957",
+"M c #575A56",
+"N c #595B56",
+"B c #585B5A",
+"V c #5C5D59",
+"C c #5D5E5B",
+"Z c #5B5F5D",
+"A c gray36",
+"S c #5F605B",
+"D c #636561",
+"F c #606462",
+"G c #656564",
+"H c #656764",
+"J c #656866",
+"K c #686A67",
+"L c #676A69",
+"P c #6B6D68",
+"I c #6E6F6D",
+"U c gray43",
+"Y c #737571",
+"T c #747874",
+"R c #767A78",
+"E c #7A7B7A",
+"W c #787C7A",
+"Q c #7B7E7A",
+"! c #7D7E7D",
+"~ c #7E7F7C",
+"^ c #7D807B",
+"/ c #7F817A",
+"( c #7F807E",
+") c #838683",
+"_ c #868686",
+"` c #898D89",
+"' c #8C8E8B",
+"] c #8F938F",
+"[ c #91938A",
+"{ c #90918F",
+"} c #949793",
+"| c #959793",
+" . c #959695",
+".. c #969795",
+"X. c #959894",
+"o. c gray61",
+"O. c #9D9F9C",
+"+. c #9DA099",
+"@. c #A1A1A0",
+"#. c #A2A5A1",
+"$. c #A5A8A5",
+"%. c #A9ACA8",
+"&. c #ADAEAB",
+"*. c #AEB0AD",
+"=. c #B0B2AE",
+"-. c gray69",
+";. c #B1B3B0",
+":. c #B4B5B5",
+">. c #B7B8B5",
+",. c #BABDB6",
+"<. c #BBBEB7",
+"1. c #B9B9B8",
+"2. c #B9BAB9",
+"3. c #B9BABA",
+"4. c gray73",
+"5. c #BCBCBC",
+"6. c #BDC0B9",
+"7. c #BEC1BC",
+"8. c #BFC0BE",
+"9. c #BFC1BE",
+"0. c #C1C5BE",
+"q. c #C2C4BF",
+"w. c #C4C5C2",
+"e. c #C5C5C4",
+"r. c #C6C6C6",
+"t. c #C6C7C6",
+"y. c #C8C9C7",
+"u. c #CBCFC7",
+"i. c #CACBCA",
+"p. c #CDCFCD",
+"a. c #D0D1CF",
+"s. c #D1D3CE",
+"d. c #D1D4CD",
+"f. c #D1D2D1",
+"g. c #D2D2D1",
+"h. c #D3D5D1",
+"j. c #D5D6D5",
+"k. c #D9DAD8",
+"l. c #D9DAD9",
+"z. c #DCDCDA",
+"x. c #DDDEDD",
+"c. c #DFE0DD",
+"v. c #DFE1DE",
+"b. c #E0E1DF",
+"n. c #E1E2E0",
+"m. c #E1E3E0",
+"M. c #E4E5E3",
+"N. c #E5E6E3",
+"B. c #E5E6E4",
+"V. c #E5E6E5",
+"C. c #E6E7E5",
+"Z. c #E7E8E7",
+"A. c #E9E9E7",
+"S. c #EAEBEA",
+"D. c #ECEDEA",
+"F. c #EDEDEB",
+"G. c #EEEFED",
+"H. c #F0F0EF",
+"J. c #FAFBFA",
+"K. c None",
+/* pixels */
+"K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.K.K.K.K.K.K.K.K.K.K.K.K.0.6.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.K.K.K.K.K.K.K.K.K.K.K./ u.6.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.K.K.K.K.K.K.K.K.K.K.K.H d.<.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.K.K.K.K.K.K.K.K.K.K.z 0.S.w.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.K.K.,.,.,.,.K.K.K.H 4.V G.5.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.K.K.n.M.N.b.K.v o.@.p ! x.=.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.K.K.M.,.,.b.K 4.I _ 1.} l.%.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.K.Y H.h.s.V.;.k E 5.r...g.#.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.D +.J.F.A.S.I k ! =.g...y.X.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.S [ Z.z.z.V.u 5 9 8 1 h 0.] J K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.V / b.w.w.x.e + = : > g :.` x K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.N P l.&.&.j.x + + = > s *.R K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.K.M g.| X.p.L 5 O & = u $.W K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.K.K.i.! / r.y A y O + t +.F K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K. O 4.r.r.:.& 5 s k % w ..S K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+" . 7 0 0 7 . = 1 f w ' B K.K.K.K.K.K.K.K.K.K.K.K.",
+" X ; u ) b K.K.K.K.K.K.K.K.K.K.K.K.",
+" . 2 Q x K.K.K.K.K.K.K.K.K.K.K.K.",
+" 4 T l K.K.K.K.K.K.K.K.K.K.K.K.",
+"K. + B a K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.K. & . K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.K.K.K.K. K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.",
+"K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K."
+};
diff --git a/xpm/gui_stop.svg b/xpm/gui_stop.svg
new file mode 100644
index 00000000..51aa9c6a
--- /dev/null
+++ b/xpm/gui_stop.svg
@@ -0,0 +1,214 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48"
+ height="48"
+ id="svg4908"
+ sodipodi:version="0.32"
+ inkscape:version="0.44+devel"
+ sodipodi:docbase="/home/andreas/project/gnome-icon-theme/scalable/actions"
+ sodipodi:docname="process-stop.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/andreas/project/gnome-icon-theme/scalable/actions/process-stop.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ version="1.0"
+ sodipodi:modified="true">
+ <defs
+ id="defs4910">
+ <radialGradient
+ gradientTransform="matrix(1.349881,0,0,1.349881,-3.498814,-1.810859)"
+ gradientUnits="userSpaceOnUse"
+ r="9.7183542"
+ fy="4.9892726"
+ fx="9.6893959"
+ cy="4.9892726"
+ cx="9.6893959"
+ id="radialGradient5177"
+ xlink:href="#linearGradient5171"
+ inkscape:collect="always" />
+ <radialGradient
+ gradientTransform="matrix(2.417917,0,0,2.417917,-14.17917,-4.903184)"
+ gradientUnits="userSpaceOnUse"
+ r="9.7785711"
+ fy="3.458019"
+ fx="10"
+ cy="3.458019"
+ cx="10"
+ id="radialGradient5157"
+ xlink:href="#linearGradient5151"
+ inkscape:collect="always" />
+ <radialGradient
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.928125,0,0,0.3143011,0.7718789,12.358015)"
+ r="9.0598059"
+ fy="18.022524"
+ fx="10.739184"
+ cy="18.022524"
+ cx="10.739184"
+ id="radialGradient5145"
+ xlink:href="#linearGradient5139"
+ inkscape:collect="always" />
+ <linearGradient
+ id="linearGradient5139"
+ inkscape:collect="always">
+ <stop
+ id="stop5141"
+ offset="0"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ id="stop5143"
+ offset="1"
+ style="stop-color:black;stop-opacity:0;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5151"
+ inkscape:collect="always">
+ <stop
+ id="stop5153"
+ offset="0"
+ style="stop-color:white;stop-opacity:1;" />
+ <stop
+ id="stop5155"
+ offset="1"
+ style="stop-color:white;stop-opacity:0;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5171">
+ <stop
+ id="stop5173"
+ offset="0"
+ style="stop-color:#fe3a00;stop-opacity:1" />
+ <stop
+ id="stop5175"
+ offset="1"
+ style="stop-color:#c00;stop-opacity:1;" />
+ </linearGradient>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="5.6568542"
+ inkscape:cx="35.649059"
+ inkscape:cy="26.052211"
+ inkscape:current-layer="g7001"
+ showgrid="false"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ showguides="true"
+ inkscape:guide-bbox="true"
+ inkscape:window-width="1674"
+ inkscape:window-height="970"
+ inkscape:window-x="0"
+ inkscape:window-y="25"
+ width="48px"
+ height="48px" />
+ <metadata
+ id="metadata4913">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>Stop Process</dc:title>
+ <dc:date>December 2006</dc:date>
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:contributor>
+ <cc:Agent>
+ <dc:title>Andreas Nilsson</dc:title>
+ </cc:Agent>
+ </dc:contributor>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>stop</rdf:li>
+ <rdf:li>halt</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/SourceCode" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <g
+ inkscape:label="Layer 1"
+ id="g7001"
+ transform="matrix(1.4566048,0,0,1.4455352,0.4112881,1.2324709)">
+ <path
+ transform="matrix(1.5155468,0,0,1.2299034,-8.1425489e-2,4.9987359)"
+ d="M 19.79899 18.022524 A 9.0598059 3.0935922 0 1 1 1.6793785,18.022524 A 9.0598059 3.0935922 0 1 1 19.79899 18.022524 z"
+ sodipodi:ry="3.0935922"
+ sodipodi:rx="9.0598059"
+ sodipodi:cy="18.022524"
+ sodipodi:cx="10.739184"
+ id="path5137"
+ style="opacity:1;color:#000000;fill:url(#radialGradient5145);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc" />
+ <path
+ transform="matrix(1.4472753,0,0,1.4583582,1.7215589,1.7135444)"
+ d="M 19.25 9.625 A 9.25 9.25 0 1 1 0.75,9.625 A 9.25 9.25 0 1 1 19.25 9.625 z"
+ sodipodi:ry="9.25"
+ sodipodi:rx="9.25"
+ sodipodi:cy="9.625"
+ sodipodi:cx="10"
+ id="path4262"
+ style="opacity:1;color:#000000;fill:url(#radialGradient5177);fill-opacity:1;fill-rule:nonzero;stroke:#a40000;stroke-width:0.47435912;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.35393258;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient5157);stroke-width:0.49999994;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path5149"
+ sodipodi:cx="10"
+ sodipodi:cy="9.625"
+ sodipodi:rx="9.25"
+ sodipodi:ry="9.25"
+ d="M 19.25 9.625 A 9.25 9.25 0 1 1 0.75,9.625 A 9.25 9.25 0 1 1 19.25 9.625 z"
+ transform="matrix(1.373056,0,0,1.3835706,2.4637512,2.4333749)" />
+ <path
+ sodipodi:nodetypes="cc"
+ id="path5159"
+ d="M 11.045351,10.561853 L 21.343271,20.938632"
+ style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:2.06745481;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:2.06745505;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 21.343273,10.526816 L 11.015248,20.938631"
+ id="path5161"
+ sodipodi:nodetypes="cc" />
+ </g>
+ </g>
+</svg>
diff --git a/xpm/gui_strength_0.svg b/xpm/gui_strength_0.svg
new file mode 100644
index 00000000..09e8fee0
--- /dev/null
+++ b/xpm/gui_strength_0.svg
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="64px"
+ height="64px"
+ id="svg2175"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="/home/martin/map/geom"
+ sodipodi:docname="roadgps0.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs2177" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#000000"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="1"
+ inkscape:pageshadow="2"
+ inkscape:zoom="9.5760562"
+ inkscape:cx="32"
+ inkscape:cy="32"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:document-units="px"
+ inkscape:grid-bbox="true"
+ showguides="true"
+ inkscape:object-bbox="true"
+ inkscape:object-points="true"
+ inkscape:object-nodes="true"
+ objecttolerance="10000"
+ inkscape:grid-points="true"
+ gridtolerance="10000"
+ inkscape:guide-points="true"
+ guidetolerance="10000"
+ gridempspacing="8"
+ inkscape:window-width="1280"
+ inkscape:window-height="954"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata2180">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <rect
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect3153"
+ width="8"
+ height="8"
+ x="5"
+ y="49" />
+ <rect
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect5103"
+ width="8"
+ height="18"
+ x="17"
+ y="39" />
+ <rect
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect5105"
+ width="8"
+ height="28"
+ x="29"
+ y="29" />
+ <rect
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect5107"
+ width="8"
+ height="38"
+ x="41"
+ y="19" />
+ <rect
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect5109"
+ width="8"
+ height="48"
+ x="53"
+ y="9" />
+ </g>
+</svg>
diff --git a/xpm/gui_strength_1.svg b/xpm/gui_strength_1.svg
new file mode 100644
index 00000000..3646ebe9
--- /dev/null
+++ b/xpm/gui_strength_1.svg
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="64px"
+ height="64px"
+ id="svg2175"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="/home/martin/map/geom"
+ sodipodi:docname="roadgps1.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs2177" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#000000"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="1"
+ inkscape:pageshadow="2"
+ inkscape:zoom="9.5760562"
+ inkscape:cx="32"
+ inkscape:cy="32"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:document-units="px"
+ inkscape:grid-bbox="true"
+ showguides="true"
+ inkscape:object-bbox="true"
+ inkscape:object-points="true"
+ inkscape:object-nodes="true"
+ objecttolerance="10000"
+ inkscape:grid-points="true"
+ gridtolerance="10000"
+ inkscape:guide-points="true"
+ guidetolerance="10000"
+ gridempspacing="8"
+ inkscape:window-width="1280"
+ inkscape:window-height="954"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata2180">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <rect
+ style="fill:#ff0000;stroke:#ff0000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect3153"
+ width="8"
+ height="8"
+ x="5"
+ y="49" />
+ <rect
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect5103"
+ width="8"
+ height="18"
+ x="17"
+ y="39" />
+ <rect
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect5105"
+ width="8"
+ height="28"
+ x="29"
+ y="29" />
+ <rect
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect5107"
+ width="8"
+ height="38"
+ x="41"
+ y="19" />
+ <rect
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect5109"
+ width="8"
+ height="48"
+ x="53"
+ y="9" />
+ </g>
+</svg>
diff --git a/xpm/gui_strength_2.svg b/xpm/gui_strength_2.svg
new file mode 100644
index 00000000..196f046a
--- /dev/null
+++ b/xpm/gui_strength_2.svg
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="64px"
+ height="64px"
+ id="svg2175"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="/home/martin/map/geom"
+ sodipodi:docname="roadgps2.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs2177" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#000000"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="1"
+ inkscape:pageshadow="2"
+ inkscape:zoom="9.5760562"
+ inkscape:cx="32"
+ inkscape:cy="32"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:document-units="px"
+ inkscape:grid-bbox="true"
+ showguides="true"
+ inkscape:object-bbox="true"
+ inkscape:object-points="true"
+ inkscape:object-nodes="true"
+ objecttolerance="10000"
+ inkscape:grid-points="true"
+ gridtolerance="10000"
+ inkscape:guide-points="true"
+ guidetolerance="10000"
+ gridempspacing="8"
+ inkscape:window-width="1280"
+ inkscape:window-height="954"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata2180">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <rect
+ style="fill:#ffff00;stroke:#ffff00;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect3153"
+ width="8"
+ height="8"
+ x="5"
+ y="49" />
+ <rect
+ style="fill:#ffff00;stroke:#ffff00;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect5103"
+ width="8"
+ height="18"
+ x="17"
+ y="39" />
+ <rect
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect5105"
+ width="8"
+ height="28"
+ x="29"
+ y="29" />
+ <rect
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect5107"
+ width="8"
+ height="38"
+ x="41"
+ y="19" />
+ <rect
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect5109"
+ width="8"
+ height="48"
+ x="53"
+ y="9" />
+ </g>
+</svg>
diff --git a/xpm/gui_strength_3.svg b/xpm/gui_strength_3.svg
new file mode 100644
index 00000000..7a6b4522
--- /dev/null
+++ b/xpm/gui_strength_3.svg
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="64px"
+ height="64px"
+ id="svg2175"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="/home/martin/map/geom"
+ sodipodi:docname="roadgps3.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs2177" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#000000"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="1"
+ inkscape:pageshadow="2"
+ inkscape:zoom="9.5760562"
+ inkscape:cx="32"
+ inkscape:cy="32"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:document-units="px"
+ inkscape:grid-bbox="true"
+ showguides="true"
+ inkscape:object-bbox="true"
+ inkscape:object-points="true"
+ inkscape:object-nodes="true"
+ objecttolerance="10000"
+ inkscape:grid-points="true"
+ gridtolerance="10000"
+ inkscape:guide-points="true"
+ guidetolerance="10000"
+ gridempspacing="8"
+ inkscape:window-width="1280"
+ inkscape:window-height="954"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata2180">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <rect
+ style="fill:#ffff00;stroke:#ffff00;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect3153"
+ width="8"
+ height="8"
+ x="5"
+ y="49" />
+ <rect
+ style="fill:#ffff00;stroke:#ffff00;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect5103"
+ width="8"
+ height="18"
+ x="17"
+ y="39" />
+ <rect
+ style="fill:#ffff00;stroke:#ffff00;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect5105"
+ width="8"
+ height="28"
+ x="29"
+ y="29" />
+ <rect
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect5107"
+ width="8"
+ height="38"
+ x="41"
+ y="19" />
+ <rect
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect5109"
+ width="8"
+ height="48"
+ x="53"
+ y="9" />
+ </g>
+</svg>
diff --git a/xpm/gui_strength_4.svg b/xpm/gui_strength_4.svg
new file mode 100644
index 00000000..482d4f23
--- /dev/null
+++ b/xpm/gui_strength_4.svg
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="64px"
+ height="64px"
+ id="svg2175"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="/home/martin/map/geom"
+ sodipodi:docname="roadgps4.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs2177" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#000000"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="1"
+ inkscape:pageshadow="2"
+ inkscape:zoom="9.5760562"
+ inkscape:cx="32"
+ inkscape:cy="32"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:document-units="px"
+ inkscape:grid-bbox="true"
+ showguides="true"
+ inkscape:object-bbox="true"
+ inkscape:object-points="true"
+ inkscape:object-nodes="true"
+ objecttolerance="10000"
+ inkscape:grid-points="true"
+ gridtolerance="10000"
+ inkscape:guide-points="true"
+ guidetolerance="10000"
+ gridempspacing="8"
+ inkscape:window-width="1280"
+ inkscape:window-height="954"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata2180">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <rect
+ style="fill:#00ff00;stroke:#00ff00;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect3153"
+ width="8"
+ height="8"
+ x="5"
+ y="49" />
+ <rect
+ style="fill:#00ff00;stroke:#00ff00;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect5103"
+ width="8"
+ height="18"
+ x="17"
+ y="39" />
+ <rect
+ style="fill:#00ff00;stroke:#00ff00;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect5105"
+ width="8"
+ height="28"
+ x="29"
+ y="29" />
+ <rect
+ style="fill:#00ff00;stroke:#00ff00;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect5107"
+ width="8"
+ height="38"
+ x="41"
+ y="19" />
+ <rect
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect5109"
+ width="8"
+ height="48"
+ x="53"
+ y="9" />
+ </g>
+ </svg>
diff --git a/xpm/gui_strength_5.svg b/xpm/gui_strength_5.svg
new file mode 100644
index 00000000..0e779b27
--- /dev/null
+++ b/xpm/gui_strength_5.svg
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="64px"
+ height="64px"
+ id="svg2175"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="/home/martin/map/geom"
+ sodipodi:docname="roadgps5.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs2177" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#000000"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="1"
+ inkscape:pageshadow="2"
+ inkscape:zoom="9.5760562"
+ inkscape:cx="32"
+ inkscape:cy="32"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:document-units="px"
+ inkscape:grid-bbox="true"
+ showguides="true"
+ inkscape:object-bbox="true"
+ inkscape:object-points="true"
+ inkscape:object-nodes="true"
+ objecttolerance="10000"
+ inkscape:grid-points="true"
+ gridtolerance="10000"
+ inkscape:guide-points="true"
+ guidetolerance="10000"
+ gridempspacing="8"
+ inkscape:window-width="1280"
+ inkscape:window-height="954"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata2180">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <rect
+ style="fill:#00ff00;stroke:#00ff00;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect3153"
+ width="8"
+ height="8"
+ x="5"
+ y="49" />
+ <rect
+ style="fill:#00ff00;stroke:#00ff00;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect5103"
+ width="8"
+ height="18"
+ x="17"
+ y="39" />
+ <rect
+ style="fill:#00ff00;stroke:#00ff00;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect5105"
+ width="8"
+ height="28"
+ x="29"
+ y="29" />
+ <rect
+ style="fill:#00ff00;stroke:#00ff00;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect5107"
+ width="8"
+ height="38"
+ x="41"
+ y="19" />
+ <rect
+ style="fill:#00ff00;stroke:#00ff00;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect5109"
+ width="8"
+ height="48"
+ x="53"
+ y="9" />
+ </g>
+</svg>
diff --git a/xpm/gui_tools.svg b/xpm/gui_tools.svg
new file mode 100644
index 00000000..067fbc1f
--- /dev/null
+++ b/xpm/gui_tools.svg
@@ -0,0 +1,364 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48px"
+ height="48px"
+ id="svg4289"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="/home/lapo/Icone/cvs/gnome-icon-theme/scalable/categories"
+ sodipodi:docname="preferences-system.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4291">
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2834">
+ <stop
+ style="stop-color:white;stop-opacity:1;"
+ offset="0"
+ id="stop2836" />
+ <stop
+ style="stop-color:white;stop-opacity:0;"
+ offset="1"
+ id="stop2838" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2808">
+ <stop
+ id="stop2810"
+ offset="0"
+ style="stop-color:white;stop-opacity:1;" />
+ <stop
+ id="stop2812"
+ offset="1"
+ style="stop-color:white;stop-opacity:0.2937853" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2796">
+ <stop
+ style="stop-color:#d6d6d1;stop-opacity:1;"
+ offset="0"
+ id="stop2798" />
+ <stop
+ style="stop-color:#a2a298;stop-opacity:1;"
+ offset="1"
+ id="stop2800" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient6221">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop6223" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop6225" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient5280"
+ inkscape:collect="always">
+ <stop
+ id="stop5282"
+ offset="0"
+ style="stop-color:#0c1d35;stop-opacity:1" />
+ <stop
+ id="stop5284"
+ offset="1"
+ style="stop-color:#898989;stop-opacity:1" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5220">
+ <stop
+ style="stop-color:#0c1d35;stop-opacity:1"
+ offset="0"
+ id="stop5222" />
+ <stop
+ style="stop-color:white;stop-opacity:0.2937853"
+ offset="1"
+ id="stop5224" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5210">
+ <stop
+ style="stop-color:#729fcf;stop-opacity:1"
+ offset="0"
+ id="stop5212" />
+ <stop
+ style="stop-color:#295ead;stop-opacity:1"
+ offset="1"
+ id="stop5214" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5280"
+ id="linearGradient5310"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,1.125,10.18406,-6.709383)"
+ x1="-7.1332517"
+ y1="37.776779"
+ x2="-7.93502"
+ y2="45.846867" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5210"
+ id="linearGradient5325"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(41.96397,-27.37022)"
+ x1="-10.69499"
+ y1="41.105709"
+ x2="-5.479228"
+ y2="41.017323" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5220"
+ id="linearGradient5327"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.579842,0,0,0.676482,38.80719,-11.92056)"
+ x1="-8.9375"
+ y1="40.375"
+ x2="-7"
+ y2="40.375" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient6221"
+ id="radialGradient6227"
+ cx="21.96048"
+ cy="34.498356"
+ fx="21.96048"
+ fy="34.498356"
+ r="12.727922"
+ gradientTransform="matrix(0.982963,0,0,0.508943,0.37414,16.84139)"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient6221"
+ id="radialGradient4326"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.982963,0,0,0.508943,0.37414,16.84139)"
+ cx="21.96048"
+ cy="34.498356"
+ fx="21.96048"
+ fy="34.498356"
+ r="12.727922" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2796"
+ id="linearGradient2802"
+ x1="29.432758"
+ y1="18.474344"
+ x2="27.225063"
+ y2="20.911844"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2808"
+ id="linearGradient2806"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.579842,0,0,0.676482,34.96935,-13.25847)"
+ x1="-6.9787297"
+ y1="37.126617"
+ x2="-9.9043236"
+ y2="36.848248" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2834"
+ id="linearGradient2840"
+ x1="37.624947"
+ y1="13.160365"
+ x2="39.844299"
+ y2="9.9728651"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666"
+ borderopacity="0.31372549"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1"
+ inkscape:cx="34.554937"
+ inkscape:cy="36.942262"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ inkscape:window-width="897"
+ inkscape:window-height="968"
+ inkscape:window-x="88"
+ inkscape:window-y="104"
+ inkscape:showpageshadow="false" />
+ <metadata
+ id="metadata4294">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>System Preferences</dc:title>
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Andreas Nilsson</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>category</rdf:li>
+ <rdf:li>system</rdf:li>
+ <rdf:li>preferences</rdf:li>
+ <rdf:li>settings</rdf:li>
+ <rdf:li>control center</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ <dc:contributor>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:contributor>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/SourceCode" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.2160804;fill:url(#radialGradient4326);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path4324"
+ sodipodi:cx="21.743534"
+ sodipodi:cy="34.299805"
+ sodipodi:rx="12.727922"
+ sodipodi:ry="6.3639612"
+ d="M 34.471457 34.299805 A 12.727922 6.3639612 0 1 1 9.0156116,34.299805 A 12.727922 6.3639612 0 1 1 34.471457 34.299805 z"
+ transform="matrix(0.824957,0,0,0.549971,18.3303,22.17163)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.55778894;fill:url(#radialGradient6227);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path5331"
+ sodipodi:cx="21.743534"
+ sodipodi:cy="34.299805"
+ sodipodi:rx="12.727922"
+ sodipodi:ry="6.3639612"
+ d="M 34.471457 34.299805 A 12.727922 6.3639612 0 1 1 9.0156116,34.299805 A 12.727922 6.3639612 0 1 1 34.471457 34.299805 z"
+ transform="matrix(0.824957,0,0,0.549971,-5.437469,22.6361)" />
+ <g
+ id="g5318"
+ transform="matrix(1.006671,0,0,1,0.966642,0.716205)">
+ <rect
+ transform="matrix(0.707107,0.707107,-0.707107,0.707107,0,0)"
+ ry="3.6244409"
+ rx="4.9605856"
+ y="5.3018064"
+ x="28.463966"
+ height="17.827978"
+ width="10.95432"
+ id="rect5288"
+ style="opacity:1;fill:url(#linearGradient5325);fill-opacity:1;stroke:#204a87;stroke-width:0.99668151;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="matrix(0.707461,0.706752,-0.707461,0.706752,0,0)"
+ ry="2.5654778"
+ rx="4.0144925"
+ y="6.3485308"
+ x="29.362755"
+ height="15.767583"
+ width="9.1483574"
+ id="rect5292"
+ style="opacity:0.4;fill:none;fill-opacity:1;stroke:white;stroke-width:0.99668235;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ sodipodi:nodetypes="ccccccccc"
+ id="path5286"
+ d="M 37.273948,6.6954072 L 34.044844,10.451912 L 33.539768,12.358575 L 18.755652,27.293572 C 17.762279,28.418572 19.635256,30.414892 20.876973,29.414892 L 35.657931,14.508306 L 37.277332,14.303118 L 41.276759,10.745488 C 41.276759,10.745488 37.273948,6.6954072 37.273948,6.6954072 z "
+ style="opacity:1;fill:url(#linearGradient2802);fill-opacity:1;stroke:#888a85;stroke-width:0.99668127;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ style="opacity:0.28804345;fill:url(#linearGradient2806);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect2804"
+ width="1.4153432"
+ height="10.57757"
+ x="29.170921"
+ y="8.3889437"
+ rx="0.66390902"
+ ry="1.5982778"
+ transform="matrix(0.707796,0.706417,-0.707796,0.706417,0,0)" />
+ <rect
+ transform="matrix(0.707796,0.706417,-0.707796,0.706417,0,0)"
+ ry="1.5982751"
+ rx="1.5982752"
+ y="9.7268591"
+ x="33.00877"
+ height="10.823715"
+ width="2.3193674"
+ id="rect5290"
+ style="opacity:0.28804345;fill:url(#linearGradient5327);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+ <g
+ id="g5312"
+ transform="matrix(1.005587,0,0,1.004813,-0.22864,1.985055)">
+ <path
+ sodipodi:nodetypes="ccccccccccccccccc"
+ id="path5302"
+ d="M 8.1359163,8.5385328 C 6.1926724,10.556239 6.212511,13.730389 8.2022073,15.720086 L 10.853858,18.371737 C 12.662831,20.18071 15.266488,20.553624 17.273387,19.111664 L 36.298766,38.160939 C 37.185095,39.047268 38.594421,39.047268 39.480747,38.160939 L 41.248513,36.393173 C 42.134842,35.506844 42.134843,34.097521 41.248513,33.211192 L 22.200387,14.184664 C 23.642347,12.177766 23.269433,9.5741078 21.46046,7.7651348 L 18.808809,5.1134838 C 16.819113,3.1237878 13.644963,3.1039478 11.627256,5.0471928 L 16.952654,10.328397 L 16.952654,12.449717 L 15.53844,13.863931 L 13.41712,13.863931 C 11.666497,12.081602 9.8444463,10.356837 8.1359163,8.5385328 z "
+ style="opacity:1;fill:#e9e7e5;fill-opacity:1;stroke:#7f7f7f;stroke-width:0.99482751;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ transform="matrix(0.516124,-0.516124,0.516132,0.516132,32.85599,-14.52061)"
+ d="M -41.454134 52.817165 A 1.3700194 1.3700194 0 1 1 -44.194173,52.817165 A 1.3700194 1.3700194 0 1 1 -41.454134 52.817165 z"
+ sodipodi:ry="1.3700194"
+ sodipodi:rx="1.3700194"
+ sodipodi:cy="52.817165"
+ sodipodi:cx="-42.824154"
+ id="path5304"
+ style="opacity:1;fill:#7f7f7f;fill-opacity:1;stroke:none;stroke-width:0.9133417;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ sodipodi:type="arc" />
+ <path
+ sodipodi:nodetypes="ccccccccccccccccc"
+ id="path5306"
+ d="M 8.2877553,10.137849 L 13.047585,14.897679 L 15.889852,14.840343 L 17.991565,12.738629 L 17.923902,9.8963618 L 13.224155,5.1966148 C 14.243323,4.2166598 16.73124,4.3929568 17.312908,4.9755018 L 21.506505,9.1690978 C 22.60496,10.267553 21.890914,12.991009 20.864369,14.214463 L 40.752454,34.228099 C 41.143198,34.626166 41.002693,35.367983 40.705936,35.703549 L 38.647115,37.63737 C 38.338478,38.011363 37.467341,38.072856 37.252454,37.728099 L 17.426869,17.776964 C 16.381369,18.822464 13.395216,19.391546 12.363765,18.370713 L 8.1407313,14.147679 C 7.189739,13.43607 7.4887473,10.849459 8.2877553,10.137849 z "
+ style="opacity:0.7;fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:white;stroke-width:0.99482703px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <rect
+ transform="matrix(0.707107,-0.707107,0.707107,0.707107,0,0)"
+ ry="1.74103"
+ rx="1.74103"
+ y="27.180147"
+ x="0.18405671"
+ height="21.956871"
+ width="4.0000019"
+ id="rect5308"
+ style="opacity:0.18478262;fill:url(#linearGradient5310);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+ <path
+ style="opacity:1;color:black;fill:url(#linearGradient2840);fill-opacity:1.0;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 38.935067,8.2252435 L 41.7193,11.053671 L 37.69763,13.970486 L 36.062446,12.556273 L 38.935067,8.2252435 z "
+ id="path2832" />
+ </g>
+</svg>
diff --git a/xpm/gui_town.svg b/xpm/gui_town.svg
new file mode 100644
index 00000000..ed842651
--- /dev/null
+++ b/xpm/gui_town.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.0" width="180" height="200" id="svg2006">
+ <defs id="defs2008"/>
+ <g transform="translate(-262.487, -353.979)" id="layer1">
+ <g transform="matrix(9, 0, 0, 9, -2287.46, -1926.28)" style="opacity: 1;" id="g1978">
+ <g transform="translate(0.0668287, 0.000457222)" id="g2084">
+ <rect width="17.999981" height="17.999981" x="284.26093" y="255.07872" style="opacity: 1; fill: rgb(195, 215, 235); fill-opacity: 1; stroke: none; stroke-width: 2; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; stroke-dasharray: none; stroke-opacity: 1;" id="rect5453"/>
+ <path d="M 290.63841,259.35139 L 295.05402,256.20842 L 298.46279,257.68362 L 300.17752,260.56527 L 300.67227,268.08928 L 297.80771,270.24944 L 290.67064,268.80589 L 285.84987,264.26648 L 286.41339,260.48177 L 290.63841,259.35139 z " style="opacity: 1; fill: gray; fill-opacity: 1; fill-rule: evenodd; stroke: none; stroke-width: 1px; stroke-linecap: butt; stroke-linejoin: miter; stroke-opacity: 1;" id="path5463"/>
+ <path d="M 289.53125,253.4375 C 289.53515,257.64346 291.65509,260.23937 292.59375,263.16328 C 293.1102,264.772 293.41458,265.85533 293.25,267.22578 C 293.08542,268.59623 292.41574,270.43919 290.5,273.25703 L 293.8125,275.50703 C 295.93452,272.38578 296.95037,269.96061 297.21875,267.72578 C 297.48713,265.49095 296.94611,263.62619 296.40625,261.94453 C 295.23231,258.2877 293.53379,256.1759 293.53125,253.4375 L 289.53125,253.4375 z " style="opacity: 1; fill: rgb(32, 74, 135); fill-opacity: 1; fill-rule: evenodd; stroke: none; stroke-width: 4; stroke-linecap: butt; stroke-linejoin: round; stroke-miterlimit: 4; stroke-opacity: 1;" id="path5455"/>
+ </g>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/xpm/gui_vehicle.svg b/xpm/gui_vehicle.svg
new file mode 100644
index 00000000..ae7f3d5a
--- /dev/null
+++ b/xpm/gui_vehicle.svg
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="310"
+ height="260"
+ id="svg2307"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docbase="/home/phsi/Desktop/clIPART"
+ sodipodi:docname="gui_vehicle.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs2309">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 130 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="310 : 130 : 1"
+ inkscape:persp3d-origin="155 : 86.666667 : 1"
+ id="perspective8" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.69326923"
+ inkscape:cx="240.61188"
+ inkscape:cy="154.13128"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1022"
+ inkscape:window-height="748"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ width="310px"
+ height="260px"
+ showgrid="false" />
+ <metadata
+ id="metadata2312">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(2.44179, -204.566)"
+ style="fill: rgb(0, 0, 0); fill-opacity: 1; stroke: none;">
+ <path
+ id="path9347"
+ style="fill:#808080;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.22296999999999989;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1"
+ d="M -53.582954,-415.35856 C -67.309015,-415.84417 -79.137232,-411.40275 -86.431515,-395.45159 L -112.76807,-329.50717 C -131.95714,-324.21675 -140.31066,-310.27864 -140.75323,-298.84302 L -140.75323,-212.49705 L -115.44706,-212.49705 L -115.44706,-183.44029 C -116.67339,-155.74786 -71.290042,-154.67757 -70.275134,-183.7288 L -69.739335,-212.24976 L 94.421043,-212.24976 L 94.956841,-183.7288 C 95.971739,-154.67759 141.39631,-155.74786 140.16998,-183.44029 L 140.16998,-212.49705 L 165.43493,-212.49705 L 165.43493,-298.84302 C 164.99236,-310.27864 156.63886,-324.21677 137.44977,-329.50717 L 111.11322,-395.45159 C 103.81894,-411.40272 91.990714,-415.84414 78.264661,-415.35856 L -53.582954,-415.35856 z M -50.57424,-392.48409 C -49.426163,-392.49037 -48.215854,-392.45144 -46.988512,-392.40166 L 72.082372,-392.03072 C 82.980293,-392.28497 87.602258,-392.03039 92.236634,-381.7269 L 111.19565,-330.61998 L -86.30787,-330.86727 L -67.554927,-380.61409 C -64.630656,-390.57231 -58.610776,-392.44013 -50.57424,-392.48409 z M -92.036791,-305.02531 C -80.233147,-305.02529 -70.646071,-295.47944 -70.646071,-283.6758 C -70.646071,-271.87217 -80.233147,-262.28508 -92.036791,-262.28508 C -103.84043,-262.28508 -113.42751,-271.87216 -113.42751,-283.6758 C -113.42751,-295.47946 -103.84043,-305.02531 -92.036791,-305.02531 z M 117.91374,-305.02531 C 129.71738,-305.02533 139.26324,-295.47944 139.26324,-283.6758 C 139.26324,-271.87216 129.71738,-262.28508 117.91374,-262.28508 C 106.1101,-262.28507 96.523021,-271.87216 96.523021,-283.6758 C 96.523021,-295.47944 106.1101,-305.02531 117.91374,-305.02531 z M 103.2216,-333.14394 L 103.2216,-333.14394 z M 103.2216,-333.14394 C 103.11577,-333.93673 102.96963,-334.55679 102.80176,-335.21316 C 101.69663,-339.53416 100.2179,-342.16153 97.043938,-345.3793 C 93.958208,-348.50762 90.488134,-350.42644 86.42796,-351.28706 C 82.4419,-352.13197 45.472822,-352.13422 41.474993,-351.28706 C 33.885682,-349.67886 27.380491,-343.34759 25.371094,-335.633 C 25.286417,-335.3079 25.200722,-334.40363 25.131185,-333.2339 L 103.2216,-333.14394 z M 64.176391,-389.01277 C 58.091423,-389.00227 52.013792,-385.83757 48.882186,-379.47638 C 47.628229,-376.92924 47.532697,-376.52293 47.532697,-372.24912 C 47.532697,-368.02543 47.619523,-367.53023 48.822209,-364.99187 C 50.995125,-360.40581 54.081354,-357.67937 59.048334,-355.90531 C 60.598733,-355.35157 62.040853,-355.17797 64.86613,-355.27555 C 68.233081,-355.39187 68.925861,-355.58211 71.703539,-356.95492 C 75.281118,-358.72306 77.90719,-361.35074 79.680517,-364.96188 C 80.736152,-367.11156 80.820083,-367.68829 80.820085,-372.0392 C 80.820081,-376.56329 80.765213,-376.87662 79.470596,-379.50637 C 76.3443,-385.85678 70.261355,-389.02327 64.176391,-389.01277 z "
+ transform="matrix(0.97979, 0, 0, 0.987795, 140.467, 619.89)" />
+ </g>
+</svg>
diff --git a/xpm/gui_zoom_in.svg b/xpm/gui_zoom_in.svg
new file mode 100644
index 00000000..bb7f76ad
--- /dev/null
+++ b/xpm/gui_zoom_in.svg
@@ -0,0 +1,554 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ inkscape:export-ydpi="240.00000"
+ inkscape:export-xdpi="240.00000"
+ inkscape:export-filename="/home/jimmac/gfx/novell/pdes/trunk/docs/BIGmime-text.png"
+ sodipodi:docname="zoom-in.svg"
+ sodipodi:docbase="/home/lapo/Icone/cvs/gnome-icon-theme/scalable/actions"
+ inkscape:version="0.44"
+ sodipodi:version="0.32"
+ id="svg249"
+ height="48px"
+ width="48px"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3">
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient23434">
+ <stop
+ style="stop-color:#2e3436"
+ offset="0"
+ id="stop23436" />
+ <stop
+ style="stop-color:#555753"
+ offset="1"
+ id="stop23438" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient19914">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop19916" />
+ <stop
+ style="stop-color:#000000;stop-opacity:0;"
+ offset="1"
+ id="stop19918" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient19900">
+ <stop
+ style="stop-color:#888a85"
+ offset="0"
+ id="stop19902" />
+ <stop
+ style="stop-color:#d3d7cf"
+ offset="1"
+ id="stop19904" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient15493">
+ <stop
+ style="stop-color:#eeeeec;stop-opacity:1;"
+ offset="0"
+ id="stop15495" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="1"
+ id="stop15497" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient11102">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop11104" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop11106" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient4952">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop4954" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop4956" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient4931">
+ <stop
+ style="stop-color:#babdb6;stop-opacity:1;"
+ offset="0"
+ id="stop4933" />
+ <stop
+ style="stop-color:#888a85"
+ offset="1"
+ id="stop4935" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient4919">
+ <stop
+ style="stop-color:#429eff;stop-opacity:1;"
+ offset="0"
+ id="stop4921" />
+ <stop
+ style="stop-color:#0044a7;stop-opacity:1;"
+ offset="1"
+ id="stop4923" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2980">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop2982" />
+ <stop
+ style="stop-color:#000000;stop-opacity:0;"
+ offset="1"
+ id="stop2984" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2609"
+ inkscape:collect="always">
+ <stop
+ id="stop2611"
+ offset="0"
+ style="stop-color:#ffffff;stop-opacity:1" />
+ <stop
+ id="stop2613"
+ offset="1"
+ style="stop-color:#eeeeec" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2617">
+ <stop
+ id="stop2619"
+ offset="0"
+ style="stop-color:#fbfbfa;stop-opacity:1;" />
+ <stop
+ id="stop2621"
+ offset="1"
+ style="stop-color:#d3d7cf" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2690"
+ inkscape:collect="always">
+ <stop
+ id="stop2692"
+ offset="0"
+ style="stop-color:#2e3436" />
+ <stop
+ id="stop2694"
+ offset="1"
+ style="stop-color:#555753" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2698">
+ <stop
+ id="stop2700"
+ offset="0"
+ style="stop-color:#555753" />
+ <stop
+ style="stop-color:#a3a5a2;stop-opacity:1;"
+ offset="0.70238096"
+ id="stop2706" />
+ <stop
+ id="stop2702"
+ offset="1"
+ style="stop-color:#888a85" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2609"
+ id="radialGradient1409"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(-3.294293e-16,1.143443,-1.247217,-1.248581e-6,41.735,-54.25682)"
+ cx="45.094624"
+ cy="-2.6936908"
+ fx="45.094624"
+ fy="-2.6936908"
+ r="10.498367" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2617"
+ id="radialGradient1411"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(4.928248e-11,-1.686609,1.66336,-1.770202e-15,41.65431,111.7396)"
+ cx="59.787472"
+ cy="10.901535"
+ fx="59.787472"
+ fy="10.901535"
+ r="10.55559" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2698"
+ id="linearGradient1421"
+ gradientUnits="userSpaceOnUse"
+ x1="81.332451"
+ y1="55.106758"
+ x2="82.919647"
+ y2="53.511261" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2690"
+ id="linearGradient1423"
+ gradientUnits="userSpaceOnUse"
+ x1="81.096306"
+ y1="57.148193"
+ x2="83.629295"
+ y2="54.615208" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4919"
+ id="radialGradient4925"
+ cx="17.062258"
+ cy="28.851427"
+ fx="17.062258"
+ fy="28.851427"
+ r="13.5"
+ gradientTransform="matrix(1.459545,-9.027299e-15,-5.118666e-17,1.345339,-7.403138,-10.82184)"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4931"
+ id="linearGradient4937"
+ x1="54.1129"
+ y1="12.846775"
+ x2="50.079948"
+ y2="-3.8813655"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4952"
+ id="radialGradient4960"
+ cx="16.829521"
+ cy="24.743624"
+ fx="16.829521"
+ fy="24.743624"
+ r="16.924615"
+ gradientTransform="matrix(2.231289,-0.597872,0.530253,1.979013,-30.74857,-16.49764)"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient11102"
+ id="radialGradient11108"
+ cx="8.0402098"
+ cy="9.5280285"
+ fx="8.0402098"
+ fy="9.5280285"
+ r="9.8125"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.946826,-1.897043e-16,1.897043e-16,0.946826,0.469351,0.499261)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient15493"
+ id="linearGradient17263"
+ gradientUnits="userSpaceOnUse"
+ x1="19"
+ y1="14.875"
+ x2="19.65625"
+ y2="29"
+ gradientTransform="translate(2,-1)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient19900"
+ id="linearGradient19906"
+ x1="40.25"
+ y1="41"
+ x2="43.0625"
+ y2="38.434578"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-1,0)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient19914"
+ id="linearGradient19920"
+ x1="33.985317"
+ y1="32.045906"
+ x2="37.211494"
+ y2="35.272079"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-1,0)" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2980"
+ id="radialGradient23426"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.34,1.362626e-15,19.89607)"
+ cx="28.284271"
+ cy="30.145554"
+ fx="28.284271"
+ fy="30.145554"
+ r="13.258252" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2980"
+ id="radialGradient23432"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,-4.196543e-16,-3.619011e-17,0.34,1.860387e-15,19.89607)"
+ cx="28.284271"
+ cy="30.145554"
+ fx="28.284271"
+ fy="30.145554"
+ r="13.258252" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient23434"
+ id="linearGradient23440"
+ x1="55.878288"
+ y1="12.472493"
+ x2="52.5"
+ y2="-4.6213989"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ inkscape:window-y="98"
+ inkscape:window-x="341"
+ inkscape:window-height="872"
+ inkscape:window-width="929"
+ inkscape:document-units="px"
+ inkscape:grid-bbox="false"
+ showgrid="false"
+ inkscape:current-layer="layer5"
+ inkscape:cy="24.835182"
+ inkscape:cx="30.254653"
+ inkscape:zoom="1"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0"
+ borderopacity="1"
+ bordercolor="#666666"
+ pagecolor="#b6b6b6"
+ id="base"
+ inkscape:showpageshadow="false"
+ showborder="false"
+ showguides="false"
+ inkscape:guide-bbox="true"
+ inkscape:grid-points="true"
+ gridspacingx="0.5px"
+ gridspacingy="0.5px"
+ gridempspacing="2"
+ fill="#729fcf"
+ stroke="#2e3436">
+ <sodipodi:guide
+ orientation="horizontal"
+ position="28"
+ id="guide1415" />
+ <sodipodi:guide
+ orientation="vertical"
+ position="19"
+ id="guide1417" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata4">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>Find</dc:title>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>document</rdf:li>
+ <rdf:li>search</rdf:li>
+ <rdf:li>find</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Lapo Calamandrei</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:source />
+ <dc:contributor>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:contributor>
+ <dc:date>2006-04-21</dc:date>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/SourceCode" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:groupmode="layer"
+ id="layer6"
+ inkscape:label="Shadow" />
+ <g
+ style="display:inline"
+ inkscape:groupmode="layer"
+ inkscape:label="Base"
+ id="layer1" />
+ <g
+ inkscape:groupmode="layer"
+ id="layer5"
+ inkscape:label="Text"
+ style="display:inline">
+ <g
+ transform="translate(-12.26513,47.49999)"
+ style="display:inline"
+ inkscape:label="base"
+ id="g2637" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.6;color:#000000;fill:url(#radialGradient4925);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path1425"
+ sodipodi:cx="17.5"
+ sodipodi:cy="18.25"
+ sodipodi:rx="13.5"
+ sodipodi:ry="13.75"
+ d="M 31 18.25 A 13.5 13.75 0 1 1 4,18.25 A 13.5 13.75 0 1 1 31 18.25 z"
+ transform="matrix(1.185185,0,0,1.163637,0.259261,-1.236368)" />
+ <path
+ style="opacity:0.5;color:#000000;fill:url(#radialGradient4960);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 20.430801,3.5 C 11.914639,3.824042 5.1019281,10.849356 5.1019281,19.444373 C 5.1019281,21.861291 6.5050447,24.166163 7.5932363,26.15625 C 7.1211653,20.728065 9.4598537,19.543069 11.012791,20.025177 C 15.724296,21.487861 23.900134,22.817382 32.299922,18.431707 C 35.244588,16.894246 36.961785,20.661175 36.844126,17.275469 C 35.904686,9.4808807 29.114153,3.5000001 21.046301,3.5 C 20.840021,3.5 20.635189,3.492223 20.430801,3.5 z "
+ id="path4939"
+ sodipodi:nodetypes="cscsscsc" />
+ <path
+ transform="matrix(1.6,0,0,1.6,-63,12.8)"
+ d="M 62.5 4.5 A 10 10 0 1 1 42.5,4.5 A 10 10 0 1 1 62.5 4.5 z"
+ sodipodi:ry="10"
+ sodipodi:rx="10"
+ sodipodi:cy="4.5"
+ sodipodi:cx="52.5"
+ id="path2607"
+ style="color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient1411);stroke-width:1.87499988;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.04705882;color:#000000;fill:url(#radialGradient23432);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path23418"
+ sodipodi:cx="28.284271"
+ sodipodi:cy="30.145554"
+ sodipodi:rx="13.258252"
+ sodipodi:ry="4.5078058"
+ d="M 41.542523 30.145554 A 13.258252 4.5078058 0 1 1 15.026019,30.145554 A 13.258252 4.5078058 0 1 1 41.542523 30.145554 z"
+ transform="matrix(0.98756,0.175983,-0.12162,0.682489,11.58742,17.92885)" />
+ <g
+ transform="matrix(1.544052,0,0,1.536016,-85.57756,-44.44515)"
+ id="g2708">
+ <path
+ style="color:#000000;fill:url(#linearGradient1421);fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient1423);stroke-width:0.67653471;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 76.796351,49.768459 L 77.443998,53.023634 L 82.625171,58.237128 C 82.817674,58.430832 83.596641,58.55743 84.56811,57.580878 C 85.53958,56.604326 85.463684,55.876998 85.215757,55.627773 L 80.034584,50.419494 L 76.796351,49.768459 z "
+ id="path2682"
+ sodipodi:nodetypes="cczzzcc" />
+ <path
+ style="opacity:0.19215686;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.99999964;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 79.567301,51.320041 C 79.564315,51.331245 79.861402,51.644359 79.32201,52.185023 C 78.782611,52.725686 78.314866,52.559011 78.328524,52.545282 L 78.059375,51.023705 L 79.567301,51.320041 z "
+ id="path2687"
+ sodipodi:nodetypes="csccc" />
+ </g>
+ <path
+ sodipodi:nodetypes="cczzzcc"
+ id="path17267"
+ d="M 34.284644,33.278595 L 34.90721,36.479814 L 42.406806,44.02859 C 42.77564,44.399843 43.340655,44.246496 44.274502,43.312648 C 45.208352,42.3788 45.449128,41.911353 44.985457,41.44495 L 37.485862,33.90116 L 34.284644,33.278595 z "
+ style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient19906);stroke-width:0.99999934;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ style="opacity:0.15294118;color:#000000;fill:url(#linearGradient19920);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.67653471;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 32.831928,31.491641 C 32.5721,31.57915 32.424582,31.851686 32.494166,32.115648 L 33.50745,37.1077 C 33.532728,37.199365 33.582796,37.282377 33.652205,37.347702 L 41.613723,45.363786 C 41.970537,45.720948 42.509181,45.825341 43.157775,45.699789 C 43.80637,45.574237 44.570165,45.162961 45.37735,44.355775 C 46.177873,43.555254 46.590458,42.839054 46.728396,42.195753 C 46.866334,41.552451 46.742411,40.963513 46.390634,40.611736 L 38.380865,32.643653 C 38.302123,32.566369 38.200751,32.515947 38.091355,32.499652 L 33.121437,31.491641 C 33.026862,31.464506 32.926503,31.464506 32.831928,31.491641 z "
+ id="path19908"
+ sodipodi:nodetypes="cccccsssccccc" />
+ <path
+ transform="matrix(1.65,0,0,1.65,-65.625,12.575)"
+ d="M 62.5 4.5 A 10 10 0 1 1 42.5,4.5 A 10 10 0 1 1 62.5 4.5 z"
+ sodipodi:ry="10"
+ sodipodi:rx="10"
+ sodipodi:cy="4.5"
+ sodipodi:cx="52.5"
+ id="path2605"
+ style="color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient1409);stroke-width:0.60606074;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc" />
+ <path
+ transform="matrix(1.75,0,0,1.75,-70.875,12.125)"
+ d="M 62.5 4.5 A 10 10 0 1 1 42.5,4.5 A 10 10 0 1 1 62.5 4.5 z"
+ sodipodi:ry="10"
+ sodipodi:rx="10"
+ sodipodi:cy="4.5"
+ sodipodi:cx="52.5"
+ id="path2599"
+ style="color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient23440);stroke-width:0.57142824;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc" />
+ <path
+ transform="matrix(1.453172,0,0,1.453175,-55.29154,13.46071)"
+ d="M 62.5 4.5 A 10 10 0 1 1 42.5,4.5 A 10 10 0 1 1 62.5 4.5 z"
+ sodipodi:ry="10"
+ sodipodi:rx="10"
+ sodipodi:cy="4.5"
+ sodipodi:cx="52.5"
+ id="path4927"
+ style="color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient4937);stroke-width:0.68814939;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.16078431;color:#000000;fill:url(#radialGradient11108);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path11092"
+ sodipodi:cx="12.375"
+ sodipodi:cy="12.9375"
+ sodipodi:rx="9.8125"
+ sodipodi:ry="9.8125"
+ d="M 22.1875 12.9375 A 9.8125 9.8125 0 1 1 2.5625,12.9375 A 9.8125 9.8125 0 1 1 22.1875 12.9375 z"
+ transform="matrix(1.324842,0,0,1.324842,4.605084,2.859861)" />
+ <g
+ id="g1399"
+ style="opacity:0.76078431"
+ transform="translate(-2.905726e-7,1)">
+ <path
+ sodipodi:nodetypes="ccccccccccccc"
+ id="rect8466"
+ d="M 18.5,10.5 L 18.5,16.5 L 12.5,16.5 L 12.5,21.5 L 18.5,21.5 L 18.5,27.5 L 23.5,27.5 L 23.5,21.5 L 29.5,21.5 L 29.5,16.5 L 23.5,16.5 L 23.5,10.5 L 18.5,10.5 z "
+ style="opacity:1;color:#000000;fill:url(#linearGradient17263);fill-opacity:1;fill-rule:nonzero;stroke:#3465a4;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ sodipodi:nodetypes="ccccccccccccc"
+ id="rect12861"
+ d="M 19.5,11.5 L 19.5,17.5 L 13.5,17.5 L 13.5,20.5 L 19.5,20.5 L 19.5,26.5 L 22.5,26.5 L 22.5,20.5 L 28.5,20.5 L 28.5,17.5 L 22.5,17.5 L 22.5,11.5 L 19.5,11.5 z "
+ style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.072;color:#000000;fill:url(#radialGradient23426);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path2970"
+ sodipodi:cx="28.284271"
+ sodipodi:cy="30.145554"
+ sodipodi:rx="13.258252"
+ sodipodi:ry="4.5078058"
+ d="M 41.542523 30.145554 A 13.258252 4.5078058 0 1 1 15.026019,30.145554 A 13.258252 4.5078058 0 1 1 41.542523 30.145554 z"
+ transform="matrix(1.585832,0,0,1.204644,-19.35411,4.31756)" />
+ </g>
+</svg>
diff --git a/xpm/gui_zoom_out.svg b/xpm/gui_zoom_out.svg
new file mode 100644
index 00000000..ff8c9f98
--- /dev/null
+++ b/xpm/gui_zoom_out.svg
@@ -0,0 +1,554 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ inkscape:export-ydpi="240.00000"
+ inkscape:export-xdpi="240.00000"
+ inkscape:export-filename="/home/jimmac/gfx/novell/pdes/trunk/docs/BIGmime-text.png"
+ sodipodi:docname="zoom-out.svg"
+ sodipodi:docbase="/home/lapo/Icone/cvs/gnome-icon-theme/scalable/actions"
+ inkscape:version="0.44"
+ sodipodi:version="0.32"
+ id="svg249"
+ height="48px"
+ width="48px"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3">
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient23434">
+ <stop
+ style="stop-color:#2e3436"
+ offset="0"
+ id="stop23436" />
+ <stop
+ style="stop-color:#555753"
+ offset="1"
+ id="stop23438" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient19914">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop19916" />
+ <stop
+ style="stop-color:#000000;stop-opacity:0;"
+ offset="1"
+ id="stop19918" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient19900">
+ <stop
+ style="stop-color:#888a85"
+ offset="0"
+ id="stop19902" />
+ <stop
+ style="stop-color:#d3d7cf"
+ offset="1"
+ id="stop19904" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient15493">
+ <stop
+ style="stop-color:#eeeeec;stop-opacity:1;"
+ offset="0"
+ id="stop15495" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="1"
+ id="stop15497" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient11102">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop11104" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop11106" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient4952">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop4954" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop4956" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient4931">
+ <stop
+ style="stop-color:#babdb6;stop-opacity:1;"
+ offset="0"
+ id="stop4933" />
+ <stop
+ style="stop-color:#888a85"
+ offset="1"
+ id="stop4935" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient4919">
+ <stop
+ style="stop-color:#429eff;stop-opacity:1;"
+ offset="0"
+ id="stop4921" />
+ <stop
+ style="stop-color:#0044a7;stop-opacity:1;"
+ offset="1"
+ id="stop4923" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient2980">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop2982" />
+ <stop
+ style="stop-color:#000000;stop-opacity:0;"
+ offset="1"
+ id="stop2984" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2609"
+ inkscape:collect="always">
+ <stop
+ id="stop2611"
+ offset="0"
+ style="stop-color:#ffffff;stop-opacity:1" />
+ <stop
+ id="stop2613"
+ offset="1"
+ style="stop-color:#eeeeec" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2617">
+ <stop
+ id="stop2619"
+ offset="0"
+ style="stop-color:#fbfbfa;stop-opacity:1;" />
+ <stop
+ id="stop2621"
+ offset="1"
+ style="stop-color:#d3d7cf" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2690"
+ inkscape:collect="always">
+ <stop
+ id="stop2692"
+ offset="0"
+ style="stop-color:#2e3436" />
+ <stop
+ id="stop2694"
+ offset="1"
+ style="stop-color:#555753" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2698">
+ <stop
+ id="stop2700"
+ offset="0"
+ style="stop-color:#555753" />
+ <stop
+ style="stop-color:#a3a5a2;stop-opacity:1;"
+ offset="0.70238096"
+ id="stop2706" />
+ <stop
+ id="stop2702"
+ offset="1"
+ style="stop-color:#888a85" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2609"
+ id="radialGradient1409"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(-3.294293e-16,1.143443,-1.247217,-1.248581e-6,41.735,-54.25682)"
+ cx="45.094624"
+ cy="-2.6936908"
+ fx="45.094624"
+ fy="-2.6936908"
+ r="10.498367" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2617"
+ id="radialGradient1411"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(4.928248e-11,-1.686609,1.66336,-1.770202e-15,41.65431,111.7396)"
+ cx="59.787472"
+ cy="10.901535"
+ fx="59.787472"
+ fy="10.901535"
+ r="10.55559" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2698"
+ id="linearGradient1421"
+ gradientUnits="userSpaceOnUse"
+ x1="81.332451"
+ y1="55.106758"
+ x2="82.919647"
+ y2="53.511261" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2690"
+ id="linearGradient1423"
+ gradientUnits="userSpaceOnUse"
+ x1="81.096306"
+ y1="57.148193"
+ x2="83.629295"
+ y2="54.615208" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4919"
+ id="radialGradient4925"
+ cx="17.062258"
+ cy="28.851427"
+ fx="17.062258"
+ fy="28.851427"
+ r="13.5"
+ gradientTransform="matrix(1.459545,-9.027299e-15,-5.118666e-17,1.345339,-7.403138,-10.82184)"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4931"
+ id="linearGradient4937"
+ x1="54.1129"
+ y1="12.846775"
+ x2="50.079948"
+ y2="-3.8813655"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4952"
+ id="radialGradient4960"
+ cx="16.829521"
+ cy="24.743624"
+ fx="16.829521"
+ fy="24.743624"
+ r="16.924615"
+ gradientTransform="matrix(2.231289,-0.597872,0.530253,1.979013,-30.74857,-16.49764)"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient11102"
+ id="radialGradient11108"
+ cx="8.0402098"
+ cy="9.5280285"
+ fx="8.0402098"
+ fy="9.5280285"
+ r="9.8125"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.946826,-1.897043e-16,1.897043e-16,0.946826,0.469351,0.499261)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient15493"
+ id="linearGradient17263"
+ gradientUnits="userSpaceOnUse"
+ x1="19"
+ y1="14.875"
+ x2="19.65625"
+ y2="29"
+ gradientTransform="translate(2,-1)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient19900"
+ id="linearGradient19906"
+ x1="40.25"
+ y1="41"
+ x2="43.0625"
+ y2="38.434578"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-1,0)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient19914"
+ id="linearGradient19920"
+ x1="33.985317"
+ y1="32.045906"
+ x2="37.211494"
+ y2="35.272079"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-1,0)" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2980"
+ id="radialGradient23426"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.34,1.362626e-15,19.89607)"
+ cx="28.284271"
+ cy="30.145554"
+ fx="28.284271"
+ fy="30.145554"
+ r="13.258252" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2980"
+ id="radialGradient23432"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,-4.196543e-16,-3.619011e-17,0.34,1.860387e-15,19.89607)"
+ cx="28.284271"
+ cy="30.145554"
+ fx="28.284271"
+ fy="30.145554"
+ r="13.258252" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient23434"
+ id="linearGradient23440"
+ x1="55.878288"
+ y1="12.472493"
+ x2="52.5"
+ y2="-4.6213989"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ inkscape:window-y="98"
+ inkscape:window-x="341"
+ inkscape:window-height="872"
+ inkscape:window-width="929"
+ inkscape:document-units="px"
+ inkscape:grid-bbox="false"
+ showgrid="false"
+ inkscape:current-layer="layer5"
+ inkscape:cy="25.783692"
+ inkscape:cx="32.387389"
+ inkscape:zoom="1"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0"
+ borderopacity="1"
+ bordercolor="#666666"
+ pagecolor="#b6b6b6"
+ id="base"
+ inkscape:showpageshadow="false"
+ showborder="false"
+ showguides="false"
+ inkscape:guide-bbox="true"
+ inkscape:grid-points="true"
+ gridspacingx="0.5px"
+ gridspacingy="0.5px"
+ gridempspacing="2"
+ fill="#729fcf"
+ stroke="#2e3436">
+ <sodipodi:guide
+ orientation="horizontal"
+ position="28"
+ id="guide1415" />
+ <sodipodi:guide
+ orientation="vertical"
+ position="19"
+ id="guide1417" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata4">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>Find</dc:title>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>document</rdf:li>
+ <rdf:li>search</rdf:li>
+ <rdf:li>find</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Lapo Calamandrei</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:source />
+ <dc:contributor>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:contributor>
+ <dc:date>2006-04-21</dc:date>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/SourceCode" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:groupmode="layer"
+ id="layer6"
+ inkscape:label="Shadow" />
+ <g
+ style="display:inline"
+ inkscape:groupmode="layer"
+ inkscape:label="Base"
+ id="layer1" />
+ <g
+ inkscape:groupmode="layer"
+ id="layer5"
+ inkscape:label="Text"
+ style="display:inline">
+ <g
+ transform="translate(-12.26513,47.49999)"
+ style="display:inline"
+ inkscape:label="base"
+ id="g2637" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.6;color:#000000;fill:url(#radialGradient4925);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path1425"
+ sodipodi:cx="17.5"
+ sodipodi:cy="18.25"
+ sodipodi:rx="13.5"
+ sodipodi:ry="13.75"
+ d="M 31 18.25 A 13.5 13.75 0 1 1 4,18.25 A 13.5 13.75 0 1 1 31 18.25 z"
+ transform="matrix(1.185185,0,0,1.163637,0.259261,-1.236368)" />
+ <path
+ style="opacity:0.5;color:#000000;fill:url(#radialGradient4960);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 20.430801,3.5 C 11.914639,3.824042 5.1019281,10.849356 5.1019281,19.444373 C 5.1019281,21.861291 6.5050447,24.166163 7.5932363,26.15625 C 7.1211653,20.728065 9.4598537,19.543069 11.012791,20.025177 C 15.724296,21.487861 23.900134,22.817382 32.299922,18.431707 C 35.244588,16.894246 36.961785,20.661175 36.844126,17.275469 C 35.904686,9.4808807 29.114153,3.5000001 21.046301,3.5 C 20.840021,3.5 20.635189,3.492223 20.430801,3.5 z "
+ id="path4939"
+ sodipodi:nodetypes="cscsscsc" />
+ <path
+ transform="matrix(1.6,0,0,1.6,-63,12.8)"
+ d="M 62.5 4.5 A 10 10 0 1 1 42.5,4.5 A 10 10 0 1 1 62.5 4.5 z"
+ sodipodi:ry="10"
+ sodipodi:rx="10"
+ sodipodi:cy="4.5"
+ sodipodi:cx="52.5"
+ id="path2607"
+ style="color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient1411);stroke-width:1.87499988;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.04705882;color:#000000;fill:url(#radialGradient23432);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path23418"
+ sodipodi:cx="28.284271"
+ sodipodi:cy="30.145554"
+ sodipodi:rx="13.258252"
+ sodipodi:ry="4.5078058"
+ d="M 41.542523 30.145554 A 13.258252 4.5078058 0 1 1 15.026019,30.145554 A 13.258252 4.5078058 0 1 1 41.542523 30.145554 z"
+ transform="matrix(0.98756,0.175983,-0.12162,0.682489,11.58742,17.92885)" />
+ <g
+ transform="matrix(1.544052,0,0,1.536016,-85.57756,-44.44515)"
+ id="g2708">
+ <path
+ style="color:#000000;fill:url(#linearGradient1421);fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient1423);stroke-width:0.67653471;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 76.796351,49.768459 L 77.443998,53.023634 L 82.625171,58.237128 C 82.817674,58.430832 83.596641,58.55743 84.56811,57.580878 C 85.53958,56.604326 85.463684,55.876998 85.215757,55.627773 L 80.034584,50.419494 L 76.796351,49.768459 z "
+ id="path2682"
+ sodipodi:nodetypes="cczzzcc" />
+ <path
+ style="opacity:0.19215686;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.99999964;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 79.567301,51.320041 C 79.564315,51.331245 79.861402,51.644359 79.32201,52.185023 C 78.782611,52.725686 78.314866,52.559011 78.328524,52.545282 L 78.059375,51.023705 L 79.567301,51.320041 z "
+ id="path2687"
+ sodipodi:nodetypes="csccc" />
+ </g>
+ <path
+ sodipodi:nodetypes="cczzzcc"
+ id="path17267"
+ d="M 34.284644,33.278595 L 34.90721,36.479814 L 42.406806,44.02859 C 42.77564,44.399843 43.340655,44.246496 44.274502,43.312648 C 45.208352,42.3788 45.449128,41.911353 44.985457,41.44495 L 37.485862,33.90116 L 34.284644,33.278595 z "
+ style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient19906);stroke-width:0.99999934;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ style="opacity:0.15294118;color:#000000;fill:url(#linearGradient19920);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.67653471;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 32.831928,31.491641 C 32.5721,31.57915 32.424582,31.851686 32.494166,32.115648 L 33.50745,37.1077 C 33.532728,37.199365 33.582796,37.282377 33.652205,37.347702 L 41.613723,45.363786 C 41.970537,45.720948 42.509181,45.825341 43.157775,45.699789 C 43.80637,45.574237 44.570165,45.162961 45.37735,44.355775 C 46.177873,43.555254 46.590458,42.839054 46.728396,42.195753 C 46.866334,41.552451 46.742411,40.963513 46.390634,40.611736 L 38.380865,32.643653 C 38.302123,32.566369 38.200751,32.515947 38.091355,32.499652 L 33.121437,31.491641 C 33.026862,31.464506 32.926503,31.464506 32.831928,31.491641 z "
+ id="path19908"
+ sodipodi:nodetypes="cccccsssccccc" />
+ <path
+ transform="matrix(1.65,0,0,1.65,-65.625,12.575)"
+ d="M 62.5 4.5 A 10 10 0 1 1 42.5,4.5 A 10 10 0 1 1 62.5 4.5 z"
+ sodipodi:ry="10"
+ sodipodi:rx="10"
+ sodipodi:cy="4.5"
+ sodipodi:cx="52.5"
+ id="path2605"
+ style="color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient1409);stroke-width:0.60606074;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc" />
+ <path
+ transform="matrix(1.75,0,0,1.75,-70.875,12.125)"
+ d="M 62.5 4.5 A 10 10 0 1 1 42.5,4.5 A 10 10 0 1 1 62.5 4.5 z"
+ sodipodi:ry="10"
+ sodipodi:rx="10"
+ sodipodi:cy="4.5"
+ sodipodi:cx="52.5"
+ id="path2599"
+ style="color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient23440);stroke-width:0.57142824;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc" />
+ <path
+ transform="matrix(1.453172,0,0,1.453175,-55.29154,13.46071)"
+ d="M 62.5 4.5 A 10 10 0 1 1 42.5,4.5 A 10 10 0 1 1 62.5 4.5 z"
+ sodipodi:ry="10"
+ sodipodi:rx="10"
+ sodipodi:cy="4.5"
+ sodipodi:cx="52.5"
+ id="path4927"
+ style="color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient4937);stroke-width:0.68814939;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.16078431;color:#000000;fill:url(#radialGradient11108);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path11092"
+ sodipodi:cx="12.375"
+ sodipodi:cy="12.9375"
+ sodipodi:rx="9.8125"
+ sodipodi:ry="9.8125"
+ d="M 22.1875 12.9375 A 9.8125 9.8125 0 1 1 2.5625,12.9375 A 9.8125 9.8125 0 1 1 22.1875 12.9375 z"
+ transform="matrix(1.324842,0,0,1.324842,4.605084,2.859861)" />
+ <g
+ id="g1399"
+ style="opacity:0.76078431"
+ transform="translate(-2.905726e-7,1)">
+ <path
+ sodipodi:nodetypes="ccccc"
+ id="rect8466"
+ d="M 12.5,16.5 L 12.5,21.5 L 29.5,21.5 L 29.5,16.5 L 12.5,16.5 z "
+ style="opacity:1;color:#000000;fill:url(#linearGradient17263);fill-opacity:1;fill-rule:nonzero;stroke:#3465a4;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ sodipodi:nodetypes="ccccc"
+ id="rect12861"
+ d="M 13.5,17.5 L 13.5,20.5 L 28.5,20.5 L 28.5,17.5 L 13.5,17.5 z "
+ style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.072;color:#000000;fill:url(#radialGradient23426);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path2970"
+ sodipodi:cx="28.284271"
+ sodipodi:cy="30.145554"
+ sodipodi:rx="13.258252"
+ sodipodi:ry="4.5078058"
+ d="M 41.542523 30.145554 A 13.258252 4.5078058 0 1 1 15.026019,30.145554 A 13.258252 4.5078058 0 1 1 41.542523 30.145554 z"
+ transform="matrix(1.585832,0,0,1.204644,-19.35411,4.31756)" />
+ </g>
+</svg>
diff --git a/xpm/heliport.xpm b/xpm/heliport.xpm
new file mode 100644
index 00000000..ebe4bb37
--- /dev/null
+++ b/xpm/heliport.xpm
@@ -0,0 +1,91 @@
+/* XPM */
+static char *dummy[]={
+"16 16 72 2",
+"Qt c None",
+".S c #000000",
+"#. c #030303",
+"#e c #040404",
+"#c c #060606",
+".R c #0a0a0a",
+"## c #0e0e0e",
+".I c #0f0f0f",
+"#a c #101010",
+".J c #171717",
+".H c #191919",
+".1 c #1b1b1b",
+"#d c #1c1c1c",
+".K c #1f1f1f",
+".2 c #202020",
+"#f c #232323",
+".k c #282828",
+".T c #292929",
+".j c #2d2d2d",
+".Q c #2e2e2e",
+".D c #2f2f54",
+".9 c #343434",
+".h c #373737",
+".l c #383838",
+".v c #3c3c3c",
+".c c #3f3f3f",
+".m c #3f3f93",
+".G c #414141",
+".0 c #434343",
+".M c #444444",
+".w c #464646",
+".E c #474747",
+".z c #484848",
+".i c #4d4d4d",
+".N c #4f4f4f",
+".F c #505050",
+".f c #535353",
+".L c #565656",
+".6 c #5a5a5a",
+".y c #5b5b5b",
+".C c #616161",
+".P c #686868",
+".8 c #6a6a6a",
+".t c #6b6b6b",
+".Y c #6c6c6c",
+".4 c #6f6f6f",
+".X c #727272",
+".5 c #737373",
+".n c #757575",
+"#b c #7c7c7c",
+".a c #7f7f7f",
+".e c #848484",
+".W c #868686",
+".V c #898989",
+".o c #8a8a8a",
+".q c #8f8f8f",
+".r c #909090",
+".g c #949494",
+".x c #9595b1",
+".O c #999999",
+".p c #9b9b9b",
+".3 c #9d9d9d",
+".B c #9e9e9e",
+".A c #9f9f9f",
+".b c #aaaaaa",
+".d c #aaaacf",
+".Z c #b1b1b1",
+".u c #b3b3b3",
+".s c #b8b8b8",
+".U c #cacaca",
+".7 c #ececec",
+".# c #ffffff",
+"Qt.#.#QtQtQt.aQtQtQtQtQtQtQtQtQt",
+".b.a.a.a.a.c.aQtQtQtQtQtQtQtQtQt",
+".dQtQt.e.f.f.g.h.i.c.j.k.k.lQtQt",
+".m.n.o.p.q.q.r.s.t.u.v.h.h.wQtQt",
+".x.y.z.o.A.A.A.B.C.D.E.FQtQtQtQt",
+".G.a.H.I.J.J.J.J.K.L.M.E.NQtQtQt",
+".O.P.Q.R.S.S.S.S.T.U.r.g.V.WQtQt",
+"Qt.X.Y.Z.0.1.S.S.2.3.4.5.r.6.7Qt",
+"QtQtQtQtQt.8.9.S#.##.R.R#a.J#bQt",
+"QtQtQtQtQtQt.f.S.S.S.S.S.S#c.QQt",
+"QtQtQtQtQtQtQt#d.S.S.S.S.S.kQtQt",
+"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt",
+"QtQtQtQtQtQt.9.S.S.S.S.S.S#e#fQt",
+"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt",
+"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt",
+"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt"};
diff --git a/navit/xpm/highway_exit.xpm b/xpm/highway_exit.xpm
index 7d433052..7d433052 100644
--- a/navit/xpm/highway_exit.xpm
+++ b/xpm/highway_exit.xpm
diff --git a/xpm/hospital.svg b/xpm/hospital.svg
new file mode 100644
index 00000000..2c01ea8a
--- /dev/null
+++ b/xpm/hospital.svg
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="hospital.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/navit/icons/png/hospital.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#f4ca00"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="1"
+ inkscape:pageshadow="2"
+ inkscape:zoom="7.919596"
+ inkscape:cx="18.168031"
+ inkscape:cy="13.483879"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:window-width="943"
+ inkscape:window-height="682"
+ inkscape:window-x="0"
+ inkscape:window-y="25">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2380"
+ visible="true"
+ enabled="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="opacity:1;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.98289609;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect2382"
+ width="21.088533"
+ height="21.088533"
+ x="0.49144801"
+ y="0.49144825" />
+ <rect
+ style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect2423"
+ width="3.9196427"
+ height="16.0625"
+ x="4.0267859"
+ y="3.0267856" />
+ <rect
+ style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect3195"
+ width="3.9196427"
+ height="16.0625"
+ x="14.080358"
+ y="3" />
+ <rect
+ style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect3197"
+ width="3.9732146"
+ height="11.821425"
+ x="8.9553576"
+ y="-16.848215"
+ transform="matrix(0,1,-1,0,0,0)" />
+ </g>
+</svg>
diff --git a/navit/xpm/hospital.xpm b/xpm/hospital.xpm
index 44ac2740..44ac2740 100644
--- a/navit/xpm/hospital.xpm
+++ b/xpm/hospital.xpm
diff --git a/navit/xpm/hotel.xpm b/xpm/hotel.xpm
index c371b95a..c371b95a 100644
--- a/navit/xpm/hotel.xpm
+++ b/xpm/hotel.xpm
diff --git a/xpm/hunting_stand.xpm b/xpm/hunting_stand.xpm
new file mode 100644
index 00000000..3707e2e1
--- /dev/null
+++ b/xpm/hunting_stand.xpm
@@ -0,0 +1,23 @@
+/* XPM */
+static char *dummy[]={
+"16 16 4 1",
+". c None",
+"a c #000000",
+"b c #808080",
+"# c #c0c0c0",
+".....#..........",
+".....aaab#......",
+".....aaaaaa.....",
+".....aa..aa.....",
+".....aaaaaa.....",
+".....aaaaaa.....",
+".....aaaaaa.....",
+".....aaaaaa.....",
+"....aaaaaaa.....",
+"....aa....a.....",
+"...a.a....a.....",
+"...a.a....a.....",
+"..a..a....a.....",
+"..a..a....a.....",
+".....a....a.....",
+"................"};
diff --git a/xpm/information.xpm b/xpm/information.xpm
new file mode 100644
index 00000000..990e6c21
--- /dev/null
+++ b/xpm/information.xpm
@@ -0,0 +1,36 @@
+/* XPM */
+static char *dummy[]={
+"16 16 17 1",
+". c None",
+"c c #0000f6",
+"a c #0909f6",
+"j c #0a0af6",
+"m c #0c0cf6",
+"k c #1f1ff7",
+"b c #3434f8",
+"d c #6060f9",
+"e c #8a8afb",
+"o c #9797fb",
+"g c #a7a7fc",
+"f c #adadfc",
+"# c #aeaefc",
+"h c #b2b2fc",
+"i c #bdbdfd",
+"l c #cacafd",
+"n c #cfcffd",
+"................",
+"................",
+"......#aa#......",
+"......bccb......",
+"......dccd......",
+".......ee.......",
+".....fgggh......",
+".....ijcck......",
+"......kcck......",
+"......kcck......",
+"......kcck......",
+"......kcck......",
+"......kcck......",
+".....lmccml.....",
+"....noooooon....",
+"................"};
diff --git a/navit/xpm/justice.xpm b/xpm/justice.xpm
index ad40bff7..ad40bff7 100644
--- a/navit/xpm/justice.xpm
+++ b/xpm/justice.xpm
diff --git a/xpm/level_crossing.xpm b/xpm/level_crossing.xpm
new file mode 100644
index 00000000..e01a4856
--- /dev/null
+++ b/xpm/level_crossing.xpm
@@ -0,0 +1,46 @@
+/* XPM */
+static char *dummy[]={
+"16 16 27 1",
+". c None",
+"a c #cb0000",
+"# c #cc0000",
+"w c #cf1818",
+"b c #d01a1a",
+"y c #d85151",
+"d c #db5656",
+"x c #df7676",
+"c c #e07b7b",
+"s c #e19090",
+"e c #e49898",
+"v c #ecb8b8",
+"j c #ecbcbc",
+"p c #f0f0f0",
+"r c #f4f4f4",
+"o c #f5f5f5",
+"q c #f6f6f6",
+"l c #f7f7f7",
+"h c #f8f8f8",
+"k c #f9f9f9",
+"t c #faefef",
+"u c #fbfbfb",
+"f c #fcf3f3",
+"g c #fcfcfc",
+"m c #fdfdfd",
+"n c #fefefe",
+"i c #ffffff",
+"....#......#....",
+"...a#.....###...",
+"...a##...###....",
+"....#bc..d##....",
+"....efg.hij.....",
+".....kilmno.....",
+"......niig......",
+"......gin.......",
+"......gin.......",
+".....pniih......",
+".....kiqgir.....",
+"....stu.hnv.....",
+"....#wx..ya#....",
+"...###...###....",
+"...##.....a##...",
+"....a......#...."};
diff --git a/navit/xpm/library.xpm b/xpm/library.xpm
index c9130631..c9130631 100644
--- a/navit/xpm/library.xpm
+++ b/xpm/library.xpm
diff --git a/xpm/memorial.xpm b/xpm/memorial.xpm
new file mode 100644
index 00000000..c05e0190
--- /dev/null
+++ b/xpm/memorial.xpm
@@ -0,0 +1,51 @@
+/* XPM */
+static char *dummy[]={
+"16 16 32 1",
+". c None",
+"m c #625112",
+"f c #646464",
+"a c #707070",
+"l c #736118",
+"i c #957d1d",
+"# c #999999",
+"b c #9c9b95",
+"e c #9f9c92",
+"h c #a08723",
+"o c #a5a08b",
+"r c #aaa386",
+"A c #aba384",
+"z c #aca383",
+"g c #afa580",
+"D c #b0a67e",
+"s c #b1a77e",
+"u c #b2a77d",
+"w c #b2a77e",
+"k c #b3a87c",
+"j c #b4a97b",
+"t c #b5a97a",
+"B c #b7aa77",
+"n c #b8ab76",
+"y c #baac74",
+"x c #c4b269",
+"C c #c5b368",
+"v c #c6b368",
+"q c #d9b830",
+"p c #dab934",
+"c c #ddc04e",
+"d c #e2c349",
+".......##.......",
+".....######.....",
+"....#######a....",
+"....##bcde#f....",
+"....##ghij#f....",
+"....##klmn#f....",
+"....##opqr#f....",
+"....###st##f....",
+"....#######f....",
+"....#uvwxyzf....",
+"....#######f....",
+"....#ABCDvtf....",
+"....#######f....",
+"....#######f....",
+"....#######f....",
+"....#######f...."};
diff --git a/xpm/menu.xpm b/xpm/menu.xpm
new file mode 100644
index 00000000..067a9077
--- /dev/null
+++ b/xpm/menu.xpm
@@ -0,0 +1,101 @@
+/* XPM */
+static char *dummy[]={
+"96 96 2 1",
+". c None",
+"# c #808080",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"...........................................####.................................................",
+"..........................................######................................................",
+"..........................................######................................................",
+"..........................................######................................................",
+"..........................................######................................................",
+"..........................................######................................................",
+"..........................................######................................................",
+"..........................................######................................................",
+"..........................................######................................................",
+"..........................................######................................................",
+"..........................................######................................................",
+"..........................................######................................................",
+"..........................................######................................................",
+"..........................................######................................................",
+"..........................................######................................................",
+"..........................................######................................................",
+"..........................................######................................................",
+"..........................######################................................................",
+".........................#######################................................................",
+".........................#######################................................................",
+".........................#######################................................................",
+".........................#######################................................................",
+"..........................######################................................................",
+"................................................######################..........................",
+"................................................#######################.........................",
+"................................................#######################.........................",
+"................................................#######################.........................",
+"................................................#######################.........................",
+"................................................######################..........................",
+"................................................######..........................................",
+"................................................######..........................................",
+"................................................######..........................................",
+"................................................######..........................................",
+"................................................######..........................................",
+"................................................######..........................................",
+"................................................######..........................................",
+"................................................######..........................................",
+"................................................######..........................................",
+"................................................######..........................................",
+"................................................######..........................................",
+"................................................######..........................................",
+"................................................######..........................................",
+"................................................######..........................................",
+"................................................######..........................................",
+"................................................######..........................................",
+".................................................####...........................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................"};
diff --git a/xpm/military.xpm b/xpm/military.xpm
new file mode 100644
index 00000000..ef9d6dc6
--- /dev/null
+++ b/xpm/military.xpm
@@ -0,0 +1,21 @@
+/* XPM */
+static char *dummy[]={
+"16 16 2 1",
+". c None",
+"# c #000000",
+"................",
+"................",
+"................",
+"................",
+".......#######..",
+".#####.#######..",
+".......#########",
+"..##############",
+".##############.",
+".########.###.##",
+"..###.#.#.#.###.",
+"...##########...",
+"................",
+"................",
+"................",
+"................"};
diff --git a/navit/xpm/mini_roundabout.xpm b/xpm/mini_roundabout.xpm
index 562b5e1d..562b5e1d 100644
--- a/navit/xpm/mini_roundabout.xpm
+++ b/xpm/mini_roundabout.xpm
diff --git a/navit/xpm/museum.xpm b/xpm/museum.xpm
index bf5b84cb..bf5b84cb 100644
--- a/navit/xpm/museum.xpm
+++ b/xpm/museum.xpm
diff --git a/xpm/nav_destination_bk.svg b/xpm/nav_destination_bk.svg
new file mode 100644
index 00000000..76e029f2
--- /dev/null
+++ b/xpm/nav_destination_bk.svg
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ version="1.0"
+ width="64"
+ height="64"
+ id="svg2">
+ <defs
+ id="defs11">
+ <marker
+ refX="0"
+ refY="0"
+ orient="auto"
+ style="overflow:visible"
+ id="DistanceIn">
+ <g
+ id="g2300">
+ <path
+ d="M 0,0 L 2,0"
+ style="fill:none;stroke:#ffffff;stroke-width:1.14999998;stroke-linecap:square"
+ id="path2306" />
+ <path
+ d="M 0,0 L 13,4 L 9,0 L 13,-4 L 0,0 z "
+ style="fill:#000000;fill-rule:evenodd;stroke:none"
+ id="path2302" />
+ <path
+ d="M 0,-4 L 0,40"
+ style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:square"
+ id="path2304" />
+ </g>
+ </marker>
+ <marker
+ refX="0"
+ refY="0"
+ orient="auto"
+ style="overflow:visible"
+ id="SemiCircleOut">
+ <path
+ d="M -2.5,-0.80913858 C -2.5,1.9508614 -4.74,4.1908614 -7.5,4.1908614 L -7.5,-5.8091386 C -4.74,-5.8091386 -2.5,-3.5691386 -2.5,-0.80913858 z "
+ transform="matrix(0.6,0,0,0.6,4.2752958,0.4580676)"
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none;marker-end:none"
+ id="path8204" />
+ </marker>
+ </defs>
+ <g
+ transform="matrix(1,0.1763263,0,1,6,1.0386167)"
+ id="g6126">
+ <g
+ transform="translate(3,0)"
+ id="g4172">
+ <rect
+ width="7"
+ height="7"
+ x="2"
+ y="3"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none"
+ id="rect4126" />
+ <rect
+ width="7"
+ height="7"
+ x="9"
+ y="10"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none"
+ id="rect4150" />
+ <rect
+ width="7"
+ height="7"
+ x="16"
+ y="17"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none"
+ id="rect4152" />
+ <rect
+ width="7"
+ height="7"
+ x="23"
+ y="24"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none"
+ id="rect4154" />
+ <rect
+ width="7"
+ height="7"
+ x="30"
+ y="17"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none"
+ id="rect4156" />
+ <rect
+ width="7"
+ height="7"
+ x="37"
+ y="10"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none"
+ id="rect4158" />
+ <rect
+ width="7"
+ height="7"
+ x="30"
+ y="3"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none"
+ id="rect4160" />
+ <rect
+ width="7"
+ height="7"
+ x="23"
+ y="10"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none"
+ id="rect4162" />
+ <rect
+ width="7"
+ height="7"
+ x="16"
+ y="3"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none"
+ id="rect4164" />
+ <rect
+ width="7"
+ height="7"
+ x="37"
+ y="24"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none"
+ id="rect4166" />
+ <rect
+ width="7"
+ height="7"
+ x="9"
+ y="24"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none"
+ id="rect4168" />
+ <rect
+ width="7"
+ height="7"
+ x="2"
+ y="17"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none"
+ id="rect4170" />
+ </g>
+ <path
+ d="M 4,2.2560781 L 48,2.0081033 L 48,32 L 4,32 L 4,2.2560781 z "
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path4186" />
+ </g>
+ <path
+ d="M 10,33.743922 L 10,62"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path6142" />
+</svg>
diff --git a/xpm/nav_destination_wh.svg b/xpm/nav_destination_wh.svg
new file mode 100644
index 00000000..ca2e2d66
--- /dev/null
+++ b/xpm/nav_destination_wh.svg
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ version="1.0"
+ width="64"
+ height="64"
+ id="svg2">
+ <defs
+ id="defs11">
+ <marker
+ refX="0"
+ refY="0"
+ orient="auto"
+ style="overflow:visible"
+ id="DistanceIn">
+ <g
+ id="g2300">
+ <path
+ d="M 0,0 L 2,0"
+ style="fill:none;stroke:#ffffff;stroke-width:1.14999998;stroke-linecap:square"
+ id="path2306" />
+ <path
+ d="M 0,0 L 13,4 L 9,0 L 13,-4 L 0,0 z "
+ style="fill:#ffffff;fill-rule:evenodd;stroke:none"
+ id="path2302" />
+ <path
+ d="M 0,-4 L 0,40"
+ style="fill:none;stroke:#ffffff;stroke-width:1;stroke-linecap:square"
+ id="path2304" />
+ </g>
+ </marker>
+ <marker
+ refX="0"
+ refY="0"
+ orient="auto"
+ style="overflow:visible"
+ id="SemiCircleOut">
+ <path
+ d="M -2.5,-0.80913858 C -2.5,1.9508614 -4.74,4.1908614 -7.5,4.1908614 L -7.5,-5.8091386 C -4.74,-5.8091386 -2.5,-3.5691386 -2.5,-0.80913858 z "
+ transform="matrix(0.6,0,0,0.6,4.2752958,0.4580676)"
+ style="fill-rule:evenodd;stroke:#ffffff;stroke-width:1pt;marker-start:none;marker-end:none"
+ id="path8204" />
+ </marker>
+ </defs>
+ <g
+ transform="matrix(1,0.1763263,0,1,6,1.0386167)"
+ id="g6126">
+ <g
+ transform="translate(3,0)"
+ id="g4172">
+ <rect
+ width="7"
+ height="7"
+ x="2"
+ y="3"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;fill:#ffffff"
+ id="rect4126" />
+ <rect
+ width="7"
+ height="7"
+ x="9"
+ y="10"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;fill:#ffffff"
+ id="rect4150" />
+ <rect
+ width="7"
+ height="7"
+ x="16"
+ y="17"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;fill:#ffffff"
+ id="rect4152" />
+ <rect
+ width="7"
+ height="7"
+ x="23"
+ y="24"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;fill:#ffffff"
+ id="rect4154" />
+ <rect
+ width="7"
+ height="7"
+ x="30"
+ y="17"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;fill:#ffffff"
+ id="rect4156" />
+ <rect
+ width="7"
+ height="7"
+ x="37"
+ y="10"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;fill:#ffffff"
+ id="rect4158" />
+ <rect
+ width="7"
+ height="7"
+ x="30"
+ y="3"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;fill:#ffffff"
+ id="rect4160" />
+ <rect
+ width="7"
+ height="7"
+ x="23"
+ y="10"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;fill:#ffffff"
+ id="rect4162" />
+ <rect
+ width="7"
+ height="7"
+ x="16"
+ y="3"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;fill:#ffffff"
+ id="rect4164" />
+ <rect
+ width="7"
+ height="7"
+ x="37"
+ y="24"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;fill:#ffffff"
+ id="rect4166" />
+ <rect
+ width="7"
+ height="7"
+ x="9"
+ y="24"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;fill:#ffffff"
+ id="rect4168" />
+ <rect
+ width="7"
+ height="7"
+ x="2"
+ y="17"
+ style="stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;fill:#ffffff"
+ id="rect4170" />
+ </g>
+ <path
+ d="M 4,2.2560781 L 48,2.0081033 L 48,32 L 4,32 L 4,2.2560781 z "
+ style="fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path4186" />
+ </g>
+ <path
+ d="M 10,33.743922 L 10,62"
+ style="fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path6142" />
+</svg>
diff --git a/navit/xpm/nav_left_1.xpm b/xpm/nav_left_1.xpm
index 18b9a771..18b9a771 100644
--- a/navit/xpm/nav_left_1.xpm
+++ b/xpm/nav_left_1.xpm
diff --git a/xpm/nav_left_1_32.xpm b/xpm/nav_left_1_32.xpm
new file mode 100644
index 00000000..2c23d7e8
--- /dev/null
+++ b/xpm/nav_left_1_32.xpm
@@ -0,0 +1,41 @@
+/* XPM */
+static char *noname[] = {
+/* width height ncolors chars_per_pixel */
+"32 32 2 1",
+/* colors */
+" c #ffffff",
+". c None",
+/* pixels */
+" .........................",
+". ..............",
+".. ...............",
+"... ................",
+".... .................",
+"..... ...............",
+"...... .............",
+"....... ............",
+"........ ...........",
+"......... .........",
+".......... .. .........",
+"........... .... ........",
+"............ ..... .......",
+"................... .......",
+"................... .......",
+".................... .......",
+".................... ......",
+".................... ......",
+".................... ......",
+".................... ......",
+".................... ......",
+".................... ......",
+".................... ......",
+".................... ......",
+".................... ......",
+".................... ......",
+".................... ......",
+".................... ......",
+".................... ......",
+".................... ......",
+".................... ......",
+".................... ......"
+};
diff --git a/xpm/nav_left_1_bk.svg b/xpm/nav_left_1_bk.svg
new file mode 100644
index 00000000..dd4461aa
--- /dev/null
+++ b/xpm/nav_left_1_bk.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 32,63 L 32,42 C 32,31 32,31 22,20"
+ style="fill:none;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(22,20) scale(3) rotate(315)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+
+ </g>
+</svg>
diff --git a/xpm/nav_left_1_wh.svg b/xpm/nav_left_1_wh.svg
new file mode 100644
index 00000000..7604bbd0
--- /dev/null
+++ b/xpm/nav_left_1_wh.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 32,63 L 32,42 C 32,31 32,31 22,20"
+ style="fill:none;stroke:#ffffff;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(22,20) scale(3) rotate(315)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+
+ </g>
+</svg>
diff --git a/navit/xpm/nav_left_2.xpm b/xpm/nav_left_2.xpm
index b5012f47..b5012f47 100644
--- a/navit/xpm/nav_left_2.xpm
+++ b/xpm/nav_left_2.xpm
diff --git a/xpm/nav_left_2_32.xpm b/xpm/nav_left_2_32.xpm
new file mode 100644
index 00000000..3de381a1
--- /dev/null
+++ b/xpm/nav_left_2_32.xpm
@@ -0,0 +1,41 @@
+/* XPM */
+static char *noname[] = {
+/* width height ncolors chars_per_pixel */
+"32 32 2 1",
+/* colors */
+" c #ffffff",
+". c None",
+/* pixels */
+"............... ................",
+"............. ................",
+".......... ................",
+"....... .................",
+"..... ...........",
+".. ........",
+". ......",
+".. .....",
+"..... ....",
+"........ . ...",
+"........... ...... ..",
+".............. ........ ..",
+"......................... ..",
+"......................... .",
+"......................... .",
+"......................... .",
+".......................... .",
+".......................... .",
+".......................... .",
+".......................... .",
+".......................... .",
+".......................... .",
+".......................... .",
+".......................... .",
+".......................... .",
+".......................... .",
+".......................... .",
+"......................... .",
+"......................... .",
+"......................... .",
+"......................... .",
+".......................... ."
+};
diff --git a/xpm/nav_left_2_bk.svg b/xpm/nav_left_2_bk.svg
new file mode 100644
index 00000000..4203de1c
--- /dev/null
+++ b/xpm/nav_left_2_bk.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 32,63 L 32,25 C 32,22 28,20 22,20"
+ style="fill:none;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(22,20) scale(3) rotate(270)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+
+ </g>
+</svg>
diff --git a/xpm/nav_left_2_wh.svg b/xpm/nav_left_2_wh.svg
new file mode 100644
index 00000000..82fe9931
--- /dev/null
+++ b/xpm/nav_left_2_wh.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 32,63 L 32,25 C 32,22 28,20 22,20"
+ style="fill:none;stroke:#ffffff;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(22,20) scale(3) rotate(270)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+
+ </g>
+</svg>
diff --git a/xpm/nav_left_3_bk.svg b/xpm/nav_left_3_bk.svg
new file mode 100644
index 00000000..4aa70dd9
--- /dev/null
+++ b/xpm/nav_left_3_bk.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 32,63 L 32,32 C 33.5,10 26,16 16,26"
+ style="fill:none;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(16,26) scale(3) rotate(225)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+
+ </g>
+</svg>
diff --git a/xpm/nav_left_3_wh.svg b/xpm/nav_left_3_wh.svg
new file mode 100644
index 00000000..52968273
--- /dev/null
+++ b/xpm/nav_left_3_wh.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 32,63 L 32,32 C 33.5,10 26,16 16,26"
+ style="fill:none;stroke:#ffffff;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(16,26) scale(3) rotate(225)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+
+ </g>
+</svg>
diff --git a/navit/xpm/nav_right_1.xpm b/xpm/nav_right_1.xpm
index bcf16278..bcf16278 100644
--- a/navit/xpm/nav_right_1.xpm
+++ b/xpm/nav_right_1.xpm
diff --git a/xpm/nav_right_1_32.xpm b/xpm/nav_right_1_32.xpm
new file mode 100644
index 00000000..2277040e
--- /dev/null
+++ b/xpm/nav_right_1_32.xpm
@@ -0,0 +1,41 @@
+/* XPM */
+static char *noname[] = {
+/* width height ncolors chars_per_pixel */
+"32 32 2 1",
+/* colors */
+" c #ffffff",
+". c None",
+/* pixels */
+".................. .......",
+"........ ........",
+"........ .........",
+".......... ..........",
+".......... ...........",
+"........ ............",
+"....... .............",
+"..... ..............",
+".... ...............",
+"... ................",
+".. .. .................",
+". .... ..................",
+". ..... ...................",
+". .........................",
+" ..........................",
+" ..........................",
+" ..........................",
+" ..........................",
+" ..........................",
+" ...........................",
+" ...........................",
+" ..........................",
+" ..........................",
+" ..........................",
+" ..........................",
+" ..........................",
+" ..........................",
+" ..........................",
+" ..........................",
+" ..........................",
+" ..........................",
+" .........................."
+};
diff --git a/xpm/nav_right_1_bk.svg b/xpm/nav_right_1_bk.svg
new file mode 100644
index 00000000..aa069a6d
--- /dev/null
+++ b/xpm/nav_right_1_bk.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 32,63 L 32,42 C 32,31 32,31 42,20"
+ style="fill:none;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(42,20) scale(3) rotate(45)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+
+ </g>
+</svg>
diff --git a/xpm/nav_right_1_wh.svg b/xpm/nav_right_1_wh.svg
new file mode 100644
index 00000000..8edb0e21
--- /dev/null
+++ b/xpm/nav_right_1_wh.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 32,63 L 32,42 C 32,31 32,31 42,20"
+ style="fill:none;stroke:#ffffff;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(42,20) scale(3) rotate(45)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+
+ </g>
+</svg>
diff --git a/navit/xpm/nav_right_2.xpm b/xpm/nav_right_2.xpm
index 5d3088a7..5d3088a7 100644
--- a/navit/xpm/nav_right_2.xpm
+++ b/xpm/nav_right_2.xpm
diff --git a/xpm/nav_right_2_32.xpm b/xpm/nav_right_2_32.xpm
new file mode 100644
index 00000000..42db0e3d
--- /dev/null
+++ b/xpm/nav_right_2_32.xpm
@@ -0,0 +1,41 @@
+/* XPM */
+static char *noname[] = {
+/* width height ncolors chars_per_pixel */
+"32 32 2 1",
+/* colors */
+" c #ffffff",
+". c None",
+/* pixels */
+"............... ................",
+"............... ..............",
+"............... ...........",
+"................ ........",
+".......... ......",
+"....... ...",
+"..... .",
+".... ...",
+"... ......",
+".. . .........",
+". ...... ............",
+". ........ ...............",
+". ..........................",
+" ..........................",
+" ..........................",
+" ..........................",
+" ...........................",
+" ...........................",
+" ...........................",
+" ...........................",
+" ...........................",
+" ...........................",
+" ...........................",
+" ...........................",
+" ...........................",
+" ...........................",
+" ...........................",
+" ...........................",
+" ...........................",
+" ...........................",
+" ...........................",
+" ..........................."
+};
diff --git a/xpm/nav_right_2_bk.svg b/xpm/nav_right_2_bk.svg
new file mode 100644
index 00000000..25edacf3
--- /dev/null
+++ b/xpm/nav_right_2_bk.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 32,63 L 32,25 C 32,22 36,20 42,20"
+ style="fill:none;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(42,20) scale(3) rotate(90)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+
+ </g>
+</svg>
diff --git a/xpm/nav_right_2_wh.svg b/xpm/nav_right_2_wh.svg
new file mode 100644
index 00000000..7cf15a1a
--- /dev/null
+++ b/xpm/nav_right_2_wh.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 32,63 L 32,25 C 32,22 36,20 42,20"
+ style="fill:none;stroke:#ffffff;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(42,20) scale(3) rotate(90)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+
+ </g>
+</svg>
diff --git a/xpm/nav_right_3_bk.svg b/xpm/nav_right_3_bk.svg
new file mode 100644
index 00000000..4c742387
--- /dev/null
+++ b/xpm/nav_right_3_bk.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 32,63 L 32,32 C 30.5,10 38,16 48,26"
+ style="fill:none;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(48,26) scale(3) rotate(135)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+
+ </g>
+</svg>
diff --git a/xpm/nav_right_3_wh.svg b/xpm/nav_right_3_wh.svg
new file mode 100644
index 00000000..8c3f08bf
--- /dev/null
+++ b/xpm/nav_right_3_wh.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 32,63 L 32,32 C 30.5,10 38,16 48,26"
+ style="fill:none;stroke:#ffffff;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(48,26) scale(3) rotate(135)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_l1_bk.svg b/xpm/nav_roundabout_l1_bk.svg
new file mode 100644
index 00000000..ff52db49
--- /dev/null
+++ b/xpm/nav_roundabout_l1_bk.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 23.54 40.46 A 12 12 0 1 1 32 44"
+ style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 0 1 23.54 40.46 L 19.3 44.7"
+ style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(19.3,44.7) scale(2) rotate(225)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_l1_wh.svg b/xpm/nav_roundabout_l1_wh.svg
new file mode 100644
index 00000000..f2a3b580
--- /dev/null
+++ b/xpm/nav_roundabout_l1_wh.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 23.54 40.46 A 12 12 0 1 1 32 44"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 0 1 23.54 40.46 L 19.3 44.7"
+ style="fill:none;stroke:#ffffff;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(19.3,44.7) scale(2) rotate(225)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_l2_bk.svg b/xpm/nav_roundabout_l2_bk.svg
new file mode 100644
index 00000000..a1c94a00
--- /dev/null
+++ b/xpm/nav_roundabout_l2_bk.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 20 32 A 12 12 0 1 1 32 44"
+ style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 0 1 20 32 L 14 32"
+ style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(14,32) scale(2) rotate(270)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_l2_wh.svg b/xpm/nav_roundabout_l2_wh.svg
new file mode 100644
index 00000000..d0c30de5
--- /dev/null
+++ b/xpm/nav_roundabout_l2_wh.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 20 32 A 12 12 0 1 1 32 44"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 0 1 20 32 L 14 32"
+ style="fill:none;stroke:#ffffff;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(14,32) scale(2) rotate(270)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_l3_bk.svg b/xpm/nav_roundabout_l3_bk.svg
new file mode 100644
index 00000000..3c609b2e
--- /dev/null
+++ b/xpm/nav_roundabout_l3_bk.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 23.54 23.54 A 12 12 0 1 1 32 44"
+ style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 0 1 23.54 23.54 L 19.3 19.3"
+ style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(19.3,19.3) scale(2) rotate(315)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_l3_wh.svg b/xpm/nav_roundabout_l3_wh.svg
new file mode 100644
index 00000000..a13af057
--- /dev/null
+++ b/xpm/nav_roundabout_l3_wh.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 23.54 23.54 A 12 12 0 1 1 32 44"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 0 1 23.54 23.54 L 19.3 19.3"
+ style="fill:none;stroke:#ffffff;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(19.3,19.3) scale(2) rotate(315)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_l4_bk.svg b/xpm/nav_roundabout_l4_bk.svg
new file mode 100644
index 00000000..0dd38594
--- /dev/null
+++ b/xpm/nav_roundabout_l4_bk.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 32 20 A 12 12 0 0 1 32 44"
+ style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 1 1 32 20 L 32 14"
+ style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(32,14) scale(2) rotate(0)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_l4_wh.svg b/xpm/nav_roundabout_l4_wh.svg
new file mode 100644
index 00000000..0faf9bc0
--- /dev/null
+++ b/xpm/nav_roundabout_l4_wh.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 32 20 A 12 12 0 0 1 32 44"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 1 1 32 20 L 32 14"
+ style="fill:none;stroke:#ffffff;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(32,14) scale(2) rotate(0)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_l5_bk.svg b/xpm/nav_roundabout_l5_bk.svg
new file mode 100644
index 00000000..f7122efc
--- /dev/null
+++ b/xpm/nav_roundabout_l5_bk.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 40.46 23.54 A 12 12 0 0 1 32 44"
+ style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 1 1 40.46 23.54 L 44.7 19.3"
+ style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(44.7,19.3) scale(2) rotate(45)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_l5_wh.svg b/xpm/nav_roundabout_l5_wh.svg
new file mode 100644
index 00000000..5bbbb38e
--- /dev/null
+++ b/xpm/nav_roundabout_l5_wh.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 40.46 23.54 A 12 12 0 0 1 32 44"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 1 1 40.46 23.54 L 44.7 19.3"
+ style="fill:none;stroke:#ffffff;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(44.7,19.3) scale(2) rotate(45)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_l6_bk.svg b/xpm/nav_roundabout_l6_bk.svg
new file mode 100644
index 00000000..fbf660b3
--- /dev/null
+++ b/xpm/nav_roundabout_l6_bk.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 44 32 A 12 12 0 0 1 32 44"
+ style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 1 1 44 32 L 50 32"
+ style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(50,32) scale(2) rotate(90)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_l6_wh.svg b/xpm/nav_roundabout_l6_wh.svg
new file mode 100644
index 00000000..91098222
--- /dev/null
+++ b/xpm/nav_roundabout_l6_wh.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 44 32 A 12 12 0 0 1 32 44"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 1 1 44 32 L 50 32"
+ style="fill:none;stroke:#ffffff;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(50,32) scale(2) rotate(90)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_l7_bk.svg b/xpm/nav_roundabout_l7_bk.svg
new file mode 100644
index 00000000..fc122cf9
--- /dev/null
+++ b/xpm/nav_roundabout_l7_bk.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 40.46 40.46 A 12 12 0 0 1 32 44"
+ style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 1 1 40.46 40.46 L 44.7 44.7"
+ style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(44.7,44.7) scale(2) rotate(135)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_l7_wh.svg b/xpm/nav_roundabout_l7_wh.svg
new file mode 100644
index 00000000..3adc2d7c
--- /dev/null
+++ b/xpm/nav_roundabout_l7_wh.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 40.46 40.46 A 12 12 0 0 1 32 44"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 1 1 40.46 40.46 L 44.7 44.7"
+ style="fill:none;stroke:#ffffff;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(44.7,44.7) scale(2) rotate(135)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_l8_bk.svg b/xpm/nav_roundabout_l8_bk.svg
new file mode 100644
index 00000000..de184a8c
--- /dev/null
+++ b/xpm/nav_roundabout_l8_bk.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 38 44 A 12 12 0 0 1 26 44"
+ style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 26,63 L 26,44 A 12 12 0 1 1 38 44 L 38 50"
+ style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(38,50) scale(2) rotate(180)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_l8_wh.svg b/xpm/nav_roundabout_l8_wh.svg
new file mode 100644
index 00000000..cc16f9c1
--- /dev/null
+++ b/xpm/nav_roundabout_l8_wh.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 38 44 A 12 12 0 0 1 26 44"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 26,63 L 26,44 A 12 12 0 1 1 38 44 L 38 50"
+ style="fill:none;stroke:#ffffff;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(38,50) scale(2) rotate(180)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_r1_bk.svg b/xpm/nav_roundabout_r1_bk.svg
new file mode 100644
index 00000000..7d89c9ec
--- /dev/null
+++ b/xpm/nav_roundabout_r1_bk.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 40.46 40.46 A 12 12 0 1 0 32 44"
+ style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 0 0 40.46 40.46 L 44.7 44.7"
+ style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(44.7,44.7) scale(2) rotate(135)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_r1_wh.svg b/xpm/nav_roundabout_r1_wh.svg
new file mode 100644
index 00000000..c9fe0b17
--- /dev/null
+++ b/xpm/nav_roundabout_r1_wh.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 40.46 40.46 A 12 12 0 1 0 32 44"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 0 0 40.46 40.46 L 44.7 44.7"
+ style="fill:none;stroke:#ffffff;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(44.7,44.7) scale(2) rotate(135)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_r2_bk.svg b/xpm/nav_roundabout_r2_bk.svg
new file mode 100644
index 00000000..a2285491
--- /dev/null
+++ b/xpm/nav_roundabout_r2_bk.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 44 32 A 12 12 0 1 0 32 44"
+ style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 0 0 44 32 L 50 32"
+ style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(50,32) scale(2) rotate(90)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_r2_wh.svg b/xpm/nav_roundabout_r2_wh.svg
new file mode 100644
index 00000000..94cb7cc8
--- /dev/null
+++ b/xpm/nav_roundabout_r2_wh.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 44 32 A 12 12 0 1 0 32 44"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 0 0 44 32 L 50 32"
+ style="fill:none;stroke:#ffffff;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(50,32) scale(2) rotate(90)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_r3_bk.svg b/xpm/nav_roundabout_r3_bk.svg
new file mode 100644
index 00000000..bbb2966c
--- /dev/null
+++ b/xpm/nav_roundabout_r3_bk.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 40.46 23.54 A 12 12 0 1 0 32 44"
+ style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 0 0 40.46 23.54 L 44.7 19.3"
+ style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(44.7,19.3) scale(2) rotate(45)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_r3_wh.svg b/xpm/nav_roundabout_r3_wh.svg
new file mode 100644
index 00000000..80f95926
--- /dev/null
+++ b/xpm/nav_roundabout_r3_wh.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 40.46 23.54 A 12 12 0 1 0 32 44"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 0 0 40.46 23.54 L 44.7 19.3"
+ style="fill:none;stroke:#ffffff;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(44.7,19.3) scale(2) rotate(45)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_r4_bk.svg b/xpm/nav_roundabout_r4_bk.svg
new file mode 100644
index 00000000..07e08259
--- /dev/null
+++ b/xpm/nav_roundabout_r4_bk.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 32 20 A 12 12 0 1 0 32 44"
+ style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 0 0 32 20 L 32 14"
+ style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(32,14) scale(2) rotate(0)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_r4_wh.svg b/xpm/nav_roundabout_r4_wh.svg
new file mode 100644
index 00000000..f2443388
--- /dev/null
+++ b/xpm/nav_roundabout_r4_wh.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 32 20 A 12 12 0 1 0 32 44"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 0 0 32 20 L 32 14"
+ style="fill:none;stroke:#ffffff;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(32,14) scale(2) rotate(0)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_r5_bk.svg b/xpm/nav_roundabout_r5_bk.svg
new file mode 100644
index 00000000..8afd2871
--- /dev/null
+++ b/xpm/nav_roundabout_r5_bk.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 23.54 23.54 A 12 12 0 0 0 32 44"
+ style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 1 0 23.54 23.54 L 19.3 19.3"
+ style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(19.3,19.3) scale(2) rotate(315)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_r5_wh.svg b/xpm/nav_roundabout_r5_wh.svg
new file mode 100644
index 00000000..98e8d375
--- /dev/null
+++ b/xpm/nav_roundabout_r5_wh.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 23.54 23.54 A 12 12 0 0 0 32 44"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 1 0 23.54 23.54 L 19.3 19.3"
+ style="fill:none;stroke:#ffffff;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(19.3,19.3) scale(2) rotate(315)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_r6_bk.svg b/xpm/nav_roundabout_r6_bk.svg
new file mode 100644
index 00000000..1b3d2050
--- /dev/null
+++ b/xpm/nav_roundabout_r6_bk.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 20 32 A 12 12 0 0 0 32 44"
+ style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 1 0 20 32 L 14 32"
+ style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(14,32) scale(2) rotate(270)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_r6_wh.svg b/xpm/nav_roundabout_r6_wh.svg
new file mode 100644
index 00000000..c2a516e7
--- /dev/null
+++ b/xpm/nav_roundabout_r6_wh.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 20 32 A 12 12 0 0 0 32 44"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 1 0 20 32 L 14 32"
+ style="fill:none;stroke:#ffffff;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(14,32) scale(2) rotate(270)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_r7_bk.svg b/xpm/nav_roundabout_r7_bk.svg
new file mode 100644
index 00000000..a7d42a64
--- /dev/null
+++ b/xpm/nav_roundabout_r7_bk.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 23.54 40.46 A 12 12 0 0 0 32 44"
+ style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 1 0 23.54 40.46 L 19.3 44.7"
+ style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(19.3,44.7) scale(2) rotate(225)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_r7_wh.svg b/xpm/nav_roundabout_r7_wh.svg
new file mode 100644
index 00000000..b27ab38e
--- /dev/null
+++ b/xpm/nav_roundabout_r7_wh.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 23.54 40.46 A 12 12 0 0 0 32 44"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 32,63 L 32,44 A 12 12 0 1 0 23.54 40.46 L 19.3 44.7"
+ style="fill:none;stroke:#ffffff;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(19.3,44.7) scale(2) rotate(225)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_r8_bk.svg b/xpm/nav_roundabout_r8_bk.svg
new file mode 100644
index 00000000..743cb2f0
--- /dev/null
+++ b/xpm/nav_roundabout_r8_bk.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 26 44 A 12 12 0 0 0 38 44"
+ style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 38,63 L 38,44 A 12 12 0 1 0 26 44 L 26 50"
+ style="fill:none;stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(26,50) scale(2) rotate(180)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/xpm/nav_roundabout_r8_wh.svg b/xpm/nav_roundabout_r8_wh.svg
new file mode 100644
index 00000000..d50e0c58
--- /dev/null
+++ b/xpm/nav_roundabout_r8_wh.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 26 44 A 12 12 0 0 0 38 44"
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:2,4" />
+ <path
+ d="M 38,63 L 38,44 A 12 12 0 1 0 26 44 L 26 50"
+ style="fill:none;stroke:#ffffff;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(26,50) scale(2) rotate(180)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+ </g>
+</svg>
diff --git a/navit/xpm/nav_straight.xpm b/xpm/nav_straight.xpm
index dbbfc0c2..dbbfc0c2 100644
--- a/navit/xpm/nav_straight.xpm
+++ b/xpm/nav_straight.xpm
diff --git a/xpm/nav_straight_32.xpm b/xpm/nav_straight_32.xpm
new file mode 100644
index 00000000..db07b571
--- /dev/null
+++ b/xpm/nav_straight_32.xpm
@@ -0,0 +1,41 @@
+/* XPM */
+static char *noname[] = {
+/* width height ncolors chars_per_pixel */
+"32 32 2 1",
+/* colors */
+" c #ffffff",
+". c None",
+/* pixels */
+"................................",
+"............... ................",
+".............. ................",
+".............. ...............",
+".............. ...............",
+"............. ...............",
+"............. ..............",
+"............ ..............",
+"............ .............",
+"............ .............",
+"........... .............",
+"........... ............",
+"........... ............",
+".......... ............",
+".......... ...........",
+".......... ...........",
+"......... ...........",
+"......... ..........",
+"........ ..........",
+"........ ... .. .........",
+"............ .............",
+"............ .............",
+"............ .............",
+"............ .............",
+"............ .............",
+"............ .............",
+"............ .............",
+"............ .............",
+"............ .............",
+"............ .............",
+"............ .............",
+"............ .............."
+};
diff --git a/xpm/nav_straight_bk.svg b/xpm/nav_straight_bk.svg
new file mode 100644
index 00000000..92fa2eae
--- /dev/null
+++ b/xpm/nav_straight_bk.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 32,63 L 32,32 C 32,10 32,16 32,26"
+ style="fill:none;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(32,26) scale(3) rotate(0)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+
+ </g>
+</svg>
diff --git a/xpm/nav_straight_wh.svg b/xpm/nav_straight_wh.svg
new file mode 100644
index 00000000..76ce34c2
--- /dev/null
+++ b/xpm/nav_straight_wh.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 32,63 L 32,32 C 32,10 32,16 32,26"
+ style="fill:none;stroke:#ffffff;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(32,26) scale(3) rotate(0)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+
+ </g>
+</svg>
diff --git a/xpm/nav_svg.html b/xpm/nav_svg.html
new file mode 100644
index 00000000..6125ba66
--- /dev/null
+++ b/xpm/nav_svg.html
@@ -0,0 +1,54 @@
+<body bgcolor="#7f7f7f">
+<embed src="nav_left_1_bk.svg" />
+<embed src="nav_left_1_wh.svg" />
+<embed src="nav_left_2_bk.svg" />
+<embed src="nav_left_2_wh.svg" />
+<embed src="nav_left_3_bk.svg" />
+<embed src="nav_left_3_wh.svg" />
+<embed src="nav_right_1_bk.svg" />
+<embed src="nav_right_1_wh.svg" />
+<embed src="nav_right_2_bk.svg" />
+<embed src="nav_right_2_wh.svg" />
+<embed src="nav_right_3_bk.svg" />
+<embed src="nav_right_3_wh.svg" />
+<embed src="nav_roundabout_l1_bk.svg" />
+<embed src="nav_roundabout_l1_wh.svg" />
+<embed src="nav_roundabout_l2_bk.svg" />
+<embed src="nav_roundabout_l2_wh.svg" />
+<embed src="nav_roundabout_l3_bk.svg" />
+<embed src="nav_roundabout_l3_wh.svg" />
+<embed src="nav_roundabout_l4_bk.svg" />
+<embed src="nav_roundabout_l4_wh.svg" />
+<embed src="nav_roundabout_l5_bk.svg" />
+<embed src="nav_roundabout_l5_wh.svg" />
+<embed src="nav_roundabout_l6_bk.svg" />
+<embed src="nav_roundabout_l6_wh.svg" />
+<embed src="nav_roundabout_l7_bk.svg" />
+<embed src="nav_roundabout_l7_wh.svg" />
+<embed src="nav_roundabout_l8_bk.svg" />
+<embed src="nav_roundabout_l8_wh.svg" />
+<embed src="nav_roundabout_r1_bk.svg" />
+<embed src="nav_roundabout_r1_wh.svg" />
+<embed src="nav_roundabout_r2_bk.svg" />
+<embed src="nav_roundabout_r2_wh.svg" />
+<embed src="nav_roundabout_r3_bk.svg" />
+<embed src="nav_roundabout_r3_wh.svg" />
+<embed src="nav_roundabout_r4_bk.svg" />
+<embed src="nav_roundabout_r4_wh.svg" />
+<embed src="nav_roundabout_r5_bk.svg" />
+<embed src="nav_roundabout_r5_wh.svg" />
+<embed src="nav_roundabout_r6_bk.svg" />
+<embed src="nav_roundabout_r6_wh.svg" />
+<embed src="nav_roundabout_r7_bk.svg" />
+<embed src="nav_roundabout_r7_wh.svg" />
+<embed src="nav_roundabout_r8_bk.svg" />
+<embed src="nav_roundabout_r8_wh.svg" />
+<embed src="nav_straight_bk.svg" />
+<embed src="nav_straight_wh.svg" />
+<embed src="nav_turnaround_left_bk.svg" />
+<embed src="nav_turnaround_left_wh.svg" />
+<embed src="nav_turnaround_right_bk.svg" />
+<embed src="nav_turnaround_right_wh.svg" />
+<embed src="nav_destination_bk.svg" />
+<embed src="nav_destination_wh.svg" />
+</body>
diff --git a/xpm/nav_turnaround_left_bk.svg b/xpm/nav_turnaround_left_bk.svg
new file mode 100644
index 00000000..dcaef8e2
--- /dev/null
+++ b/xpm/nav_turnaround_left_bk.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 48,63 L 48,20 C 48,0 22,0 22,20 L 22 35"
+ style="fill:none;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(22,35) scale(3) rotate(180)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+
+ </g>
+</svg>
diff --git a/xpm/nav_turnaround_left_wh.svg b/xpm/nav_turnaround_left_wh.svg
new file mode 100644
index 00000000..d7761f1c
--- /dev/null
+++ b/xpm/nav_turnaround_left_wh.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 48,63 L 48,20 C 48,0 22,0 22,20 L 22 35"
+ style="fill:none;stroke:#ffffff;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(22,35) scale(3) rotate(180)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+
+ </g>
+</svg>
diff --git a/xpm/nav_turnaround_right_bk.svg b/xpm/nav_turnaround_right_bk.svg
new file mode 100644
index 00000000..0b6759fe
--- /dev/null
+++ b/xpm/nav_turnaround_right_bk.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 16,63 L 16,20 C 16,0 42,0 42,20 L 42 35"
+ style="fill:none;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(42,35) scale(3) rotate(180)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#000000;stroke:#000000;stroke-linejoin:round"
+ />
+
+ </g>
+</svg>
diff --git a/xpm/nav_turnaround_right_wh.svg b/xpm/nav_turnaround_right_wh.svg
new file mode 100644
index 00000000..991009b8
--- /dev/null
+++ b/xpm/nav_turnaround_right_wh.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="64px"
+ height="64px">
+ <g>
+ <path
+ d="M 16,63 L 16,20 C 16,0 42,0 42,20 L 42 35"
+ style="fill:none;stroke:#ffffff;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
+ <path
+ transform="translate(42,35) scale(3) rotate(180)"
+ d="M -4,1 L 0,-7 L 4,1 C 2,-1 -2,-1 -4,1"
+ style="fill:#ffffff;stroke:#ffffff;stroke-linejoin:round"
+ />
+
+ </g>
+</svg>
diff --git a/xpm/navit_svg2png b/xpm/navit_svg2png
new file mode 100755
index 00000000..d71bc2d5
--- /dev/null
+++ b/xpm/navit_svg2png
@@ -0,0 +1,68 @@
+#! /bin/bash
+
+function svgtopng
+{
+ case $svgtopng in
+ *ksvgtopng|*ksvgtopng4)
+ $svgtopng $*
+ ;;
+ *rsvg-convert)
+ $svgtopng --width=$1 --height=$2 --output $4 $3
+ ;;
+ *inkscape)
+ $svgtopng --without-gui --export-width=$1 --export-height=$2 --export-png=$4 $3
+ ;;
+ *convert)
+ $svgtopng $3 -resize $1x$2 $4
+ ;;
+ esac
+}
+
+ulimit -t 5
+svgtopng=$1
+png=$2
+if [[ "$png" = *_[1-9]*_[1-9]*.png ]];
+then
+ svg=${png%_*_*.png};
+ h=${png##*_}
+ w=${png%_$h}
+ h=${h%.png}
+ w=${w##*_}
+else
+ svg=${png%.png}
+fi
+if [ ! -f $svg.svg -a ! -f $svg.svgz ]
+then
+ svg="$SRCDIR/$svg"
+fi
+if [ -f $png -a ! -f $svg.svg ]
+then
+ touch $png
+else
+ if [ -f $svg.svg ]
+ then
+ if [ -z "$w" ]
+ then
+ w=$(grep 'width="[0-9pxt.]*"' $svg.svg | head -n 1 | sed -e 's/.*width="//' -e 's/[pxt]*".*//')
+ fi
+ if [ -z "$h" ]
+ then
+ h=$(grep 'height="[0-9pxt.]*"' $svg.svg | head -n 1 | sed -e 's/.*height="//' -e 's/[pxt]*".*//')
+ fi
+ svgtopng $w $h $svg.svg $png
+ elif [ -f $svg.svgz ]
+ then
+ gzip -dc <$svg.svgz >$svg.svg
+ if [ -z "$w" ]
+ then
+ w=$(grep 'width="[0-9pxt.]*"' $svg.svg | head -n 1 | sed -e 's/.*width="//' -e 's/[pxt]*".*//')
+ fi
+ if [ -z "$h" ]
+ then
+ h=$(grep 'height="[0-9pxt.]*"' $svg.svg | head -n 1 | sed -e 's/.*height="//' -e 's/[pxt]*".*//')
+ fi
+ svgtopng $w $h $svg.svg $png
+ rm -f $svg.svg
+ fi
+fi
+exit 0
diff --git a/xpm/osd_minus.png b/xpm/osd_minus.png
new file mode 100644
index 00000000..4cde8ede
--- /dev/null
+++ b/xpm/osd_minus.png
Binary files differ
diff --git a/xpm/osd_plus.png b/xpm/osd_plus.png
new file mode 100644
index 00000000..de138e8c
--- /dev/null
+++ b/xpm/osd_plus.png
Binary files differ
diff --git a/navit/xpm/parking.xpm b/xpm/parking.xpm
index 505ac681..505ac681 100644
--- a/navit/xpm/parking.xpm
+++ b/xpm/parking.xpm
diff --git a/xpm/peak.svg b/xpm/peak.svg
new file mode 100644
index 00000000..a8c05231
--- /dev/null
+++ b/xpm/peak.svg
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="peak.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/projets/navit/icons/png/peak.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3156">
+ <stop
+ style="stop-color:#22a638;stop-opacity:1;"
+ offset="0"
+ id="stop3159" />
+ <stop
+ style="stop-color:#11571d;stop-opacity:1;"
+ offset="1"
+ id="stop3161" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3154">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop3156" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop3158" />
+ </linearGradient>
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3154"
+ id="linearGradient3160"
+ x1="12"
+ y1="7.5346489"
+ x2="12.048141"
+ y2="16.097149"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(0,-0.125)" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3156"
+ id="linearGradient3163"
+ x1="6.6808548"
+ y1="7.8981066"
+ x2="12.644531"
+ y2="8.9276867"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#f4ca00"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="8"
+ inkscape:cx="14.179676"
+ inkscape:cy="17.133893"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:window-width="943"
+ inkscape:window-height="682"
+ inkscape:window-x="-4"
+ inkscape:window-y="24">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2380"
+ visible="true"
+ enabled="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ transform="matrix(1.4115471,0,0,1.4839561,-0.8483516,-0.2482945)"
+ style="fill:url(#linearGradient3163);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.69094228999999996;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 1.8015623,13.384928 L 4.5242674,5.8854567 L 7.7319891,1.4762525 L 10.404453,5.4662229 L 12.508227,3.6366511 L 15.187234,13.291697 C 10.749842,15.038029 6.3562797,14.205412 1.8015623,13.384928 z"
+ id="path2383"
+ sodipodi:nodetypes="ccccccc" />
+ <path
+ style="fill:url(#linearGradient3160);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 5.6709911,9.720456 L 6.1042619,8.5740083 L 10,2.875 L 13.836782,8.5770705 L 16.535086,6.1186473 L 18.425291,13.623844 C 17.33201,14.07626 16.518773,10.986647 15.468751,10.771957 C 14.418728,10.557267 13.506921,12.030002 12.466501,11.482114 C 11.42608,10.934227 9.4445466,13.678217 8.3800711,13.13104 C 7.3155956,12.583862 6.7931784,9.933016 5.6709911,9.720456 z"
+ id="path3152"
+ sodipodi:nodetypes="ccccccsssc" />
+ </g>
+</svg>
diff --git a/navit/xpm/peak.xpm b/xpm/peak.xpm
index a95b6ffb..a95b6ffb 100644
--- a/navit/xpm/peak.xpm
+++ b/xpm/peak.xpm
diff --git a/navit/xpm/pharmacy.xpm b/xpm/pharmacy.xpm
index b5b1aa57..b5b1aa57 100644
--- a/navit/xpm/pharmacy.xpm
+++ b/xpm/pharmacy.xpm
diff --git a/xpm/picnic.xpm b/xpm/picnic.xpm
new file mode 100644
index 00000000..4546b649
--- /dev/null
+++ b/xpm/picnic.xpm
@@ -0,0 +1,38 @@
+/* XPM */
+static char *dummy[]={
+"16 15 20 1",
+". c None",
+"d c #020202",
+"e c #080808",
+"q c #0c0c0c",
+"n c #161616",
+"i c #212121",
+"o c #282828",
+"k c #2a2a2a",
+"m c #2d2d2d",
+"f c #393939",
+"# c #424242",
+"p c #474747",
+"g c #4c4c4c",
+"b c #555555",
+"l c #686868",
+"j c #6a6a6a",
+"c c #757575",
+"h c #808080",
+"r c #838383",
+"a c #9a9a9a",
+"................",
+"................",
+"..#abbbbbbbbb#..",
+"...cdddddddde...",
+".....fdggddh....",
+".....id..dd.....",
+"....jdk..ldi....",
+"..mmednkmndemm..",
+".odddddeddddddd.",
+"...pd#....#dd...",
+"...dq#.....mdl..",
+"..hdf......fdb..",
+"..rbc.......bb..",
+"................",
+"................"};
diff --git a/xpm/police.svg b/xpm/police.svg
new file mode 100644
index 00000000..f5af848e
--- /dev/null
+++ b/xpm/police.svg
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="police.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/projets/navit/icons/png/police.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#f4ca00"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="1"
+ inkscape:pageshadow="2"
+ inkscape:zoom="7.919596"
+ inkscape:cx="4.228318"
+ inkscape:cy="2.9575573"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:window-width="943"
+ inkscape:window-height="682"
+ inkscape:window-x="-4"
+ inkscape:window-y="24">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2380"
+ visible="true"
+ enabled="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="opacity:1;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.98289609;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect2382"
+ width="21.088533"
+ height="21.088533"
+ x="0.49144801"
+ y="0.49144825" />
+ <path
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 1.9642857,4.0446429 L 4.4955383,2.5580358 C 7.2473615,5.9567783 9.3016752,5.5646255 11.026791,3.0714286 C 13.727083,6.351945 15.740052,5.3710182 17.535719,2.5580386 L 20.044648,4.0446486 C 15.053284,7.0531313 22.014992,15.341425 10.892857,20.125006 C -0.39160289,14.860382 6.3806583,7.2279063 1.9642857,4.0446429 z"
+ id="rect2383"
+ sodipodi:nodetypes="ccccccc" />
+ <path
+ sodipodi:type="star"
+ style="opacity:1;fill:#f4f400;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.19999990000000001;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:0.40000001000000002;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3162"
+ sodipodi:sides="5"
+ sodipodi:cx="11.237947"
+ sodipodi:cy="10.067573"
+ sodipodi:r1="6.6567273"
+ sodipodi:r2="3.3283637"
+ sodipodi:arg1="0.95385444"
+ sodipodi:arg2="1.582173"
+ inkscape:flatsided="false"
+ inkscape:rounded="0"
+ inkscape:randomized="0"
+ d="M 15.089154,15.497142 L 11.200083,13.395721 L 7.264208,15.408117 L 8.0609895,11.060015 L 4.930835,7.9386407 L 9.3123443,7.3527877 L 11.313677,3.4112761 L 13.224817,7.3973005 L 17.591863,8.082687 L 14.391504,11.132039 L 15.089154,15.497142 z"
+ transform="translate(-0.3915037,1.0101525)" />
+ </g>
+</svg>
diff --git a/navit/xpm/police.xpm b/xpm/police.xpm
index c2ffb263..c2ffb263 100644
--- a/navit/xpm/police.xpm
+++ b/xpm/police.xpm
diff --git a/xpm/post.svg b/xpm/post.svg
new file mode 100644
index 00000000..437bd2a6
--- /dev/null
+++ b/xpm/post.svg
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="post.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/navit/icons/png/post.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#f4ca00"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="5.6568543"
+ inkscape:cx="12.393787"
+ inkscape:cy="25.782283"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:window-width="943"
+ inkscape:window-height="682"
+ inkscape:window-x="0"
+ inkscape:window-y="25">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2380"
+ visible="true"
+ enabled="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="opacity:1;fill:#d8d8d8;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect2381"
+ width="19"
+ height="13.0625"
+ x="1.5"
+ y="4.375" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#787878;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 2.5,16.4375 L 11.0625,9.625 L 19.4375,16.4375"
+ id="path3158"
+ sodipodi:nodetypes="ccc" />
+ <path
+ style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 1.5,4.375 L 20.5,4.375 L 11,12.625 L 1.5,4.375 z"
+ id="rect3153"
+ sodipodi:nodetypes="cccc" />
+ </g>
+</svg>
diff --git a/navit/xpm/post.xpm b/xpm/post.xpm
index 399e73ef..399e73ef 100644
--- a/navit/xpm/post.xpm
+++ b/xpm/post.xpm
diff --git a/xpm/potable_water.xpm b/xpm/potable_water.xpm
new file mode 100644
index 00000000..2d244490
--- /dev/null
+++ b/xpm/potable_water.xpm
@@ -0,0 +1,32 @@
+/* XPM */
+static char *dummy[]={
+"16 16 13 1",
+". c None",
+"# c #000000",
+"e c #0000a5",
+"h c #0000b2",
+"c c #0000cc",
+"d c #0000cd",
+"g c #0000d3",
+"b c #0000db",
+"k c #0000e8",
+"f c #0000e9",
+"j c #0000eb",
+"a c #0000ec",
+"i c #0000ff",
+"......####......",
+"........#.......",
+"...########.....",
+"...##########...",
+"...###########..",
+"............##..",
+"............##..",
+".....aaab...##..",
+"....caaad...##..",
+"....eaaaa...##..",
+".....faag.......",
+".....gaah....i..",
+".....gaa.....i..",
+"......jk........",
+"............ii..",
+"................"};
diff --git a/xpm/public_office.xpm b/xpm/public_office.xpm
new file mode 100644
index 00000000..da3554b2
--- /dev/null
+++ b/xpm/public_office.xpm
@@ -0,0 +1,32 @@
+/* XPM */
+static char * public_office_xpm[] = {
+"16 16 13 1",
+" c None",
+". c #888888",
+"+ c #FFFFFF",
+"@ c #D5D5D5",
+"# c #5A5A5A",
+"$ c #E4E4E4",
+"% c #676767",
+"& c #000000",
+"* c #737373",
+"= c #C4C4C4",
+"- c #555555",
+"; c #C9C9C9",
+"> c #C1C1C1",
+" . ",
+" .+. ",
+" .+++. ",
+" .+@#$+. ",
+" .+%&*+. ",
+" .+=-;+....",
+". . . .++++++++.",
+"..+.. .+>>>+>>+.",
+".+++. .+>>>+>>+.",
+".+>+. .++++++++.",
+".+>+...+>>>+>>+.",
+".++++++++++++++.",
+".+>>>>+>>>>+>>+.",
+".+>>>>+>>>>+>>+.",
+".+++++++++++>>+.",
+"................"};
diff --git a/navit/xpm/restaurant.xpm b/xpm/restaurant.xpm
index 730fcc94..730fcc94 100644
--- a/navit/xpm/restaurant.xpm
+++ b/xpm/restaurant.xpm
diff --git a/navit/xpm/restroom.xpm b/xpm/restroom.xpm
index 597c0d61..597c0d61 100644
--- a/navit/xpm/restroom.xpm
+++ b/xpm/restroom.xpm
diff --git a/xpm/ruins.xpm b/xpm/ruins.xpm
new file mode 100644
index 00000000..61b8f80e
--- /dev/null
+++ b/xpm/ruins.xpm
@@ -0,0 +1,22 @@
+/* XPM */
+static char *dummy[]={
+"16 16 3 1",
+". c None",
+"# c #000000",
+"a c #010101",
+"...........#.#.#",
+"...........#####",
+"..##.......#####",
+".###........###.",
+".###.#a##a#.###.",
+".##############.",
+".##############.",
+".##.########.##.",
+".#...######...#.",
+".#...######...#.",
+".######..######.",
+".#####a..a#####.",
+".#####....#####.",
+".#####....#####.",
+".#####....#####.",
+"................"};
diff --git a/xpm/school.xpm b/xpm/school.xpm
new file mode 100644
index 00000000..61486ae1
--- /dev/null
+++ b/xpm/school.xpm
@@ -0,0 +1,94 @@
+/* XPM */
+static char * school_xpm[] = {
+"16 16 75 1",
+" c None",
+". c #C06F2E",
+"+ c #583314",
+"@ c #603716",
+"# c #74431B",
+"$ c #BC6C2D",
+"% c #000000",
+"& c #2F662F",
+"* c #759975",
+"= c #5A855A",
+"- c #326832",
+"; c #7FA17F",
+"> c #9FB89F",
+", c #407240",
+"' c #8DAB8D",
+") c #528052",
+"! c #759A75",
+"~ c #A4BCA4",
+"{ c #F5F7F5",
+"] c #CDDACD",
+"^ c #B8CBB8",
+"/ c #729772",
+"( c #8CAA8C",
+"_ c #FFFFFF",
+": c #E5ECE5",
+"< c #A8BFA8",
+"[ c #195619",
+"} c #467746",
+"| c #BECFBE",
+"1 c #185618",
+"2 c #0E4E0E",
+"3 c #044704",
+"4 c #3F723F",
+"5 c #5F895F",
+"6 c #6F956F",
+"7 c #678F67",
+"8 c #E1E9E1",
+"9 c #699069",
+"0 c #ACC2AC",
+"a c #7A9D7A",
+"b c #668E66",
+"c c #5F8A5F",
+"d c #084908",
+"e c #245E24",
+"f c #0D4D0D",
+"g c #266026",
+"h c #386D38",
+"i c #5E895E",
+"j c #B6C9B6",
+"k c #BBCDBB",
+"l c #97B297",
+"m c #000400",
+"n c #ABC1AB",
+"o c #6E946E",
+"p c #2B632B",
+"q c #145314",
+"r c #004400",
+"s c #255F25",
+"t c #96B296",
+"u c #648D64",
+"v c #527F52",
+"w c #C6D4C6",
+"x c #BFD0BF",
+"y c #98B398",
+"z c #99B399",
+"A c #DEE7DE",
+"B c #6D3F1A",
+"C c #593315",
+"D c #955623",
+"E c #804A1E",
+"F c #7E491E",
+"G c #40250F",
+"H c #6F401A",
+"I c #5D3516",
+"J c #573214",
+" .+ ",
+" @#$ ",
+" %%%%%%%%%%%%%%%",
+" %&*==-;-;>,;')%",
+" %!~{{];^/(_:_<%",
+" %[};||12234456%",
+" %789}_0aab654c%",
+" %[defg)3hijkl,m",
+" %7nopqrrrrstu&%",
+" %rvwxyyyxyzA5r%",
+" %%%%%%%%%%%%%%%",
+" .B C. ",
+" +D EF ",
+".GH .G ",
+"GG. FH",
+"I. .J"};
diff --git a/xpm/shelter.xpm b/xpm/shelter.xpm
new file mode 100644
index 00000000..49637010
--- /dev/null
+++ b/xpm/shelter.xpm
@@ -0,0 +1,42 @@
+/* XPM */
+static char *dummy[]={
+"16 16 23 1",
+". c None",
+"g c #000000",
+"r c #010101",
+"f c #080808",
+"o c #0a0a0a",
+"p c #101010",
+"n c #111111",
+"j c #121212",
+"t c #202020",
+"u c #2e2e2e",
+"b c #303030",
+"s c #313131",
+"k c #333333",
+"e c #353535",
+"a c #373737",
+"q c #414141",
+"c c #444444",
+"m c #505050",
+"i c #525252",
+"h c #6c6c6c",
+"# c #6e6e6e",
+"l c #727272",
+"d c #7d7d7d",
+"................",
+"................",
+"................",
+"................",
+"................",
+"......#abc......",
+"....defggfeh....",
+"...ijggggggfkl..",
+".mnggopqqpprggs.",
+".tuagm.....faut.",
+"...mgm.....fm...",
+"...mgm.....fm...",
+"...mgm.....fm...",
+"...mgm.....fm...",
+"...mgm.....fm...",
+"................"};
diff --git a/xpm/shopping.svg b/xpm/shopping.svg
new file mode 100644
index 00000000..3d15dee4
--- /dev/null
+++ b/xpm/shopping.svg
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="shopping.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/projets/navit/icons/png/shopping.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3160">
+ <stop
+ style="stop-color:#208420;stop-opacity:1;"
+ offset="0"
+ id="stop3162" />
+ <stop
+ style="stop-color:#15d715;stop-opacity:1;"
+ offset="1"
+ id="stop3164" />
+ </linearGradient>
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ <inkscape:perspective
+ id="perspective2390"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3160"
+ id="linearGradient3166"
+ x1="13.520976"
+ y1="11.795792"
+ x2="5.2298675"
+ y2="4.3404341"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#22a638"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.979899"
+ inkscape:cx="4.8716811"
+ inkscape:cy="-23.42011"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:window-width="943"
+ inkscape:window-height="682"
+ inkscape:window-x="0"
+ inkscape:window-y="25">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2380"
+ visible="true"
+ enabled="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 2.2116381,2.1848051 C 2.2116381,2.1848051 4.4954762,3.2271654 4.3894012,4.2330193"
+ id="path2391" />
+ <path
+ style="fill:url(#linearGradient3166);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:bevel;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 3.6191906,3.60812 L 19.551296,3.5594758 L 19.51067,11.64703 L 5.2776197,14.674965 L 3.6191906,3.60812 z"
+ id="rect3166"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1"
+ d="M 18.069765,18.535714 L 6.4642857,18.580357 L 8.6302502,14.080397"
+ id="path3169"
+ sodipodi:nodetypes="ccc" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#262626;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:bevel;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3171"
+ sodipodi:cx="5.5357141"
+ sodipodi:cy="13.790178"
+ sodipodi:rx="1.0267857"
+ sodipodi:ry="1.0267857"
+ d="M 6.5624999,13.790178 A 1.0267857,1.0267857 0 1 1 4.5089284,13.790178 A 1.0267857,1.0267857 0 1 1 6.5624999,13.790178 z"
+ transform="matrix(1.1112769,0,0,1.1109318,1.4209457,4.3638057)" />
+ <path
+ style="opacity:0.5;fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 18,6.4984099 L 5.7632975,6.4984099"
+ id="path3175"
+ sodipodi:nodetypes="cc" />
+ <path
+ style="opacity:0.5;fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 16.079709,10.498797 L 7.2630748,10.498797"
+ id="path3177"
+ sodipodi:nodetypes="cc" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#262626;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:bevel;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3179"
+ sodipodi:cx="5.5357141"
+ sodipodi:cy="13.790178"
+ sodipodi:rx="0.67656642"
+ sodipodi:ry="0.67656642"
+ d="M 6.2122806,13.790178 A 0.67656642,0.67656642 0 1 1 4.8591477,13.790178 A 0.67656642,0.67656642 0 1 1 6.2122806,13.790178 z"
+ transform="matrix(1.5414449,0,0,1.5409662,-6.3819076,-19.044603)" />
+ <path
+ style="opacity:0.5;fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 17.734724,8.4285066 L 6.4795564,8.4285066"
+ id="path2389"
+ sodipodi:nodetypes="cc" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#262626;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:bevel;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path2393"
+ sodipodi:cx="5.5357141"
+ sodipodi:cy="13.790178"
+ sodipodi:rx="1.0267857"
+ sodipodi:ry="1.0267857"
+ d="M 6.5624999,13.790178 A 1.0267857,1.0267857 0 1 1 4.5089284,13.790178 A 1.0267857,1.0267857 0 1 1 6.5624999,13.790178 z"
+ transform="matrix(1.1112769,0,0,1.1109318,9.0253722,4.4717409)" />
+ </g>
+</svg>
diff --git a/navit/xpm/shopping.xpm b/xpm/shopping.xpm
index 7a892d36..7a892d36 100644
--- a/navit/xpm/shopping.xpm
+++ b/xpm/shopping.xpm
diff --git a/xpm/skiing.xpm b/xpm/skiing.xpm
new file mode 100644
index 00000000..b29be3c5
--- /dev/null
+++ b/xpm/skiing.xpm
@@ -0,0 +1,21 @@
+/* XPM */
+static char *dummy[]={
+"16 16 2 1",
+". c None",
+"# c #000000",
+"................",
+"................",
+".##.............",
+".##.###...##....",
+"...#######......",
+"....#####.......",
+"..####.##.......",
+"...#####........",
+".......##.....#.",
+"........##..##..",
+".........###....",
+".......##.......",
+"....###.........",
+".###............",
+"................",
+"................"};
diff --git a/xpm/sport.xpm b/xpm/sport.xpm
new file mode 100644
index 00000000..3d4f0694
--- /dev/null
+++ b/xpm/sport.xpm
@@ -0,0 +1,75 @@
+/* XPM */
+static char *dummy[]={
+"16 16 56 1",
+". c None",
+"v c #000000",
+"V c #0c0c0c",
+"o c #121212",
+"Y c #131313",
+"C c #141414",
+"u c #191919",
+"F c #1e1e1e",
+"D c #232323",
+"c c #292929",
+"T c #2b2b2b",
+"1 c #2d2d2d",
+"g c #2e2e2e",
+"b c #2f2f2f",
+"K c #303030",
+"y c #343434",
+"d c #363636",
+"a c #393939",
+"B c #3b3b3b",
+"L c #3d3d3d",
+"k c #404040",
+"m c #414141",
+"f c #444444",
+"p c #454545",
+"U c #474747",
+"t c #494949",
+"n c #4d4d4d",
+"J c #4e4e4e",
+"j c #525252",
+"e c #575757",
+"# c #5a5a5a",
+"E c #5b5b5b",
+"w c #5d5d5d",
+"l c #676767",
+"x c #6d6d6d",
+"z c #6f6f6f",
+"r c #757575",
+"O c #787878",
+"Q c #7f7f7f",
+"G c #808080",
+"N c #878787",
+"R c #888888",
+"Z c #8a8a8a",
+"X c #8c8c8c",
+"W c #a7a7a7",
+"H c #adadad",
+"0 c #b3b3b3",
+"h c #b6b6b6",
+"I c #c5c5c5",
+"P c #c8c8c8",
+"S c #d6d6d6",
+"M c #dadada",
+"A c #dfdfdf",
+"i c #e8e8e8",
+"s c #fcfcfc",
+"q c #fefefe",
+"................",
+"................",
+"................",
+".....#abcde.....",
+"....fghijklm....",
+"...nopqqrsqlt...",
+"...uvwxyvzABC...",
+"...DEqqFvvGxv...",
+"...HGqIJKLqMB...",
+"...NkBOqqOPQR...",
+"...BvvySspvTU...",
+"...#uVWhXvvY....",
+"....#LZ0hc1.....",
+"................",
+"................",
+"................"};
diff --git a/navit/xpm/swimming.xpm b/xpm/swimming.xpm
index 72f37159..72f37159 100644
--- a/navit/xpm/swimming.xpm
+++ b/xpm/swimming.xpm
diff --git a/xpm/tec_common.svg b/xpm/tec_common.svg
new file mode 100644
index 00000000..ff6017fc
--- /dev/null
+++ b/xpm/tec_common.svg
@@ -0,0 +1,2953 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.0"
+ width="48"
+ height="48"
+ id="svg1961"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docname="tec_common.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/nt/tec_common.png"
+ inkscape:export-xdpi="9.0592957"
+ inkscape:export-ydpi="9.0592957">
+ <metadata
+ id="metadata3253">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" />
+ <dc:contributor>
+ <cc:Agent>
+ <dc:title>traffic light by http://commons.wikimedia.org/wiki/User:Manuel_Strehl
+camera by KDE e.V.</dc:title>
+ </cc:Agent>
+ </dc:contributor>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/by-sa/3.0/">
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Reproduction" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#Distribution" />
+ <cc:requires
+ rdf:resource="http://creativecommons.org/ns#Notice" />
+ <cc:requires
+ rdf:resource="http://creativecommons.org/ns#Attribution" />
+ <cc:permits
+ rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://creativecommons.org/ns#ShareAlike" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <sodipodi:namedview
+ inkscape:window-height="742"
+ inkscape:window-width="1018"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ showgrid="false"
+ inkscape:zoom="11.313708"
+ inkscape:cx="34.58255"
+ inkscape:cy="29.410747"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:current-layer="svg1961" />
+ <defs
+ id="defs1963">
+ <linearGradient
+ id="linearGradient4522">
+ <stop
+ style="stop-color:#ffff00;stop-opacity:1;"
+ offset="0"
+ id="stop4524" />
+ <stop
+ style="stop-color:#ffff00;stop-opacity:0.67357516;"
+ offset="1"
+ id="stop4526" />
+ </linearGradient>
+ <linearGradient
+ y2="60.029999"
+ x2="77.031303"
+ y1="120.132"
+ x1="77.031303"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_37_">
+ <stop
+ id="stop2827"
+ style="stop-color:rgb(158,158,158)"
+ offset="0" />
+ <stop
+ id="stop2829"
+ style="stop-color:rgb(97,97,97)"
+ offset="1" />
+ <a:midPointStop
+ style="stop-color:#9E9E9E"
+ offset="0" />
+ <a:midPointStop
+ style="stop-color:#9E9E9E"
+ offset="0.5" />
+ <a:midPointStop
+ style="stop-color:#616161"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ y2="126.982"
+ x2="76.830101"
+ y1="57.847698"
+ x1="76.830101"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_36_">
+ <stop
+ id="stop2820"
+ style="stop-color:rgb(255,255,255)"
+ offset="4.02299%" />
+ <stop
+ id="stop2822"
+ style="stop-opacity:0;stop-color:rgb(255,255,255)"
+ offset="100%" />
+ </linearGradient>
+ <linearGradient
+ y2="130.181"
+ x2="120.423"
+ y1="68.1436"
+ x1="64.068398"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_35_">
+ <stop
+ id="stop2813"
+ style="stop-color:rgb(255,255,255)"
+ offset="0.0337" />
+ <stop
+ id="stop2815"
+ style="stop-color:rgb(135,135,135)"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ y2="82.084198"
+ x2="87.5625"
+ y1="75.327103"
+ x1="87.5625"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_34_">
+ <stop
+ id="stop2806"
+ style="stop-color:rgb(255,255,255)"
+ offset="7.47126%" />
+ <stop
+ id="stop2808"
+ style="stop-opacity:0;stop-color:rgb(255,255,255)"
+ offset="100%" />
+ </linearGradient>
+ <radialGradient
+ gradientUnits="userSpaceOnUse"
+ fy="88.976601"
+ fx="87.766602"
+ r="11.4148"
+ cy="88.976601"
+ cx="87.766602"
+ id="XMLID_33_">
+ <stop
+ id="stop2799"
+ style="stop-color:rgb(187,235,255)"
+ offset="0" />
+ <stop
+ id="stop2801"
+ style="stop-color:rgb(0,61,215)"
+ offset="1" />
+ <a:midPointStop
+ style="stop-color:#BBEBFF"
+ offset="0" />
+ <a:midPointStop
+ style="stop-color:#BBEBFF"
+ offset="0.5" />
+ <a:midPointStop
+ style="stop-color:#003DD7"
+ offset="1" />
+ </radialGradient>
+ <linearGradient
+ y2="84.349197"
+ x2="87.561501"
+ y1="97.340797"
+ x1="87.561501"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_32_">
+ <stop
+ id="stop2790"
+ style="stop-color:rgb(255,255,255)"
+ offset="4.5977%" />
+ <stop
+ id="stop2792"
+ style="stop-opacity:0;stop-color:rgb(255,255,255)"
+ offset="100%" />
+ </linearGradient>
+ <linearGradient
+ y2="84.569901"
+ x2="87.560501"
+ y1="98.801804"
+ x1="87.560501"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_31_">
+ <stop
+ id="stop2783"
+ style="stop-color:rgb(255,255,255)"
+ offset="0.1685" />
+ <stop
+ id="stop2785"
+ style="stop-color:rgb(54,54,54)"
+ offset="1" />
+ <a:midPointStop
+ style="stop-color:#FFFFFF"
+ offset="0.1685" />
+ <a:midPointStop
+ style="stop-color:#FFFFFF"
+ offset="0.5" />
+ <a:midPointStop
+ style="stop-color:#363636"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ y2="82.123001"
+ x2="105.431"
+ y1="81.969704"
+ x1="75.442398"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_30_">
+ <stop
+ id="stop2776"
+ style="stop-color:rgb(255,255,255)"
+ offset="0.0337" />
+ <stop
+ id="stop2778"
+ style="stop-color:rgb(171,171,171)"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ y2="80.375298"
+ x2="89.966499"
+ y1="95.804703"
+ x1="67.565399"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_29_">
+ <stop
+ id="stop2769"
+ style="stop-color:rgb(255,255,255)"
+ offset="0.0337" />
+ <stop
+ id="stop2771"
+ style="stop-color:rgb(153,153,153)"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ y2="69.688904"
+ x2="87.561501"
+ y1="102.759"
+ x1="87.561501"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_28_">
+ <stop
+ id="stop2762"
+ style="stop-color:rgb(158,158,158)"
+ offset="0" />
+ <stop
+ id="stop2764"
+ style="stop-color:rgb(97,97,97)"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ y2="82.155403"
+ x2="111.821"
+ y1="81.947304"
+ x1="71.107399"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_27_">
+ <stop
+ id="stop2755"
+ style="stop-color:rgb(255,255,255)"
+ offset="0.0337" />
+ <stop
+ id="stop2757"
+ style="stop-color:rgb(171,171,171)"
+ offset="1" />
+ <a:midPointStop
+ style="stop-color:#FFFFFF"
+ offset="0.0337" />
+ <a:midPointStop
+ style="stop-color:#FFFFFF"
+ offset="0.5" />
+ <a:midPointStop
+ style="stop-color:#ABABAB"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ y2="64.263496"
+ x2="87.561501"
+ y1="111.869"
+ x1="87.561501"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_26_">
+ <stop
+ id="stop2748"
+ style="stop-color:rgb(158,158,158)"
+ offset="0" />
+ <stop
+ id="stop2750"
+ style="stop-color:rgb(97,97,97)"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ y2="105.281"
+ x2="108.682"
+ y1="68.8125"
+ x1="75.553703"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_25_">
+ <stop
+ id="stop2741"
+ style="stop-color:rgb(255,255,255)"
+ offset="0.0337" />
+ <stop
+ id="stop2743"
+ style="stop-color:rgb(171,171,171)"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ gradientTransform="matrix(0,1,-1,0,-256.622,-352.346)"
+ y2="-326.67001"
+ x2="465.18799"
+ y1="-360.35999"
+ x1="431.49799"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_24_">
+ <stop
+ id="stop2732"
+ style="stop-color:rgb(158,158,158)"
+ offset="0" />
+ <stop
+ id="stop2734"
+ style="stop-color:rgb(97,97,97)"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ y2="90.118896"
+ x2="55.990799"
+ y1="77.249001"
+ x1="43.121101"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_23_">
+ <stop
+ id="stop2723"
+ style="stop-color:rgb(158,158,158)"
+ offset="0" />
+ <stop
+ id="stop2725"
+ style="stop-color:rgb(97,97,97)"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ y2="100.333"
+ x2="83.369102"
+ y1="54.6782"
+ x1="37.715302"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_22_">
+ <stop
+ id="stop2714"
+ style="stop-color:rgb(158,158,158)"
+ offset="0" />
+ <stop
+ id="stop2716"
+ style="stop-color:rgb(97,97,97)"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ y2="82.428001"
+ x2="101.62"
+ y1="82.064499"
+ x1="30.5054"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_21_">
+ <stop
+ id="stop2707"
+ style="stop-color:rgb(255,255,255)"
+ offset="0.0337" />
+ <stop
+ id="stop2709"
+ style="stop-color:rgb(171,171,171)"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ gradientTransform="translate(-780.801,1657.79)"
+ y2="-1597.9399"
+ x2="885.13098"
+ y1="-1599.67"
+ x1="885.13098"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_20_">
+ <stop
+ id="stop2700"
+ style="stop-color:rgb(255,255,255)"
+ offset="0" />
+ <stop
+ id="stop2702"
+ style="stop-color:rgb(207,207,207)"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ y2="57.958099"
+ x2="104.381"
+ y1="61.433601"
+ x1="104.381"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_19_">
+ <stop
+ id="stop2693"
+ style="stop-color:rgb(158,158,158)"
+ offset="0" />
+ <stop
+ id="stop2695"
+ style="stop-color:rgb(97,97,97)"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ gradientTransform="translate(-780.801,1657.79)"
+ y2="-1598.62"
+ x2="885.18103"
+ y1="-1596.5601"
+ x1="885.18103"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_18_">
+ <stop
+ id="stop2686"
+ style="stop-color:rgb(255,255,255)"
+ offset="0" />
+ <stop
+ id="stop2688"
+ style="stop-color:rgb(189,189,189)"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ gradientTransform="translate(1,15.5)"
+ y2="42.4576"
+ x2="103.381"
+ y1="45.933601"
+ x1="103.381"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_15_">
+ <stop
+ id="stop2673"
+ style="stop-color:rgb(158,158,158)"
+ offset="0" />
+ <stop
+ id="stop2675"
+ style="stop-color:rgb(97,97,97)"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ y2="57.596199"
+ x2="102.565"
+ y1="60.411098"
+ x1="105.643"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_14_">
+ <stop
+ id="stop2662"
+ style="stop-color:rgb(255,255,255)"
+ offset="0.0337" />
+ <stop
+ id="stop2664"
+ style="stop-color:rgb(171,171,171)"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ y2="62.2383"
+ x2="114.477"
+ y1="56.5625"
+ x1="114.477"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_13_">
+ <stop
+ id="stop2653"
+ style="stop-color:rgb(255,255,255)"
+ offset="0%" />
+ <stop
+ id="stop2655"
+ style="stop-opacity:0;stop-color:rgb(255,255,255)"
+ offset="100%" />
+ </linearGradient>
+ <radialGradient
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,1.0845,0,-75.5965)"
+ fy="129.33299"
+ fx="114.137"
+ r="6.4330001"
+ cy="129.33299"
+ cx="114.137"
+ id="XMLID_12_">
+ <stop
+ id="stop2646"
+ style="stop-color:rgb(133,202,255)"
+ offset="0" />
+ <stop
+ id="stop2648"
+ style="stop-color:rgb(0,61,169)"
+ offset="1" />
+ </radialGradient>
+ <linearGradient
+ y2="53.6199"
+ x2="108.185"
+ y1="63.373001"
+ x1="118.848"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_11_">
+ <stop
+ id="stop2639"
+ style="stop-color:rgb(255,255,255)"
+ offset="0.0337" />
+ <stop
+ id="stop2641"
+ style="stop-color:rgb(171,171,171)"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ y2="132.177"
+ x2="122.192"
+ y1="55.616199"
+ x1="52.644501"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_10_">
+ <stop
+ id="stop2630"
+ style="stop-color:rgb(255,255,255)"
+ offset="0.0337" />
+ <stop
+ id="stop2632"
+ style="stop-color:rgb(171,171,171)"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ y2="52.224201"
+ x2="45.014198"
+ y1="57.756302"
+ x1="45.014198"
+ gradientUnits="userSpaceOnUse"
+ id="XMLID_9_">
+ <stop
+ id="stop2623"
+ style="stop-color:rgb(158,158,158)"
+ offset="0" />
+ <stop
+ id="stop2625"
+ style="stop-color:rgb(97,97,97)"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ x1="0"
+ y1="0"
+ x2="0"
+ y2="1.05"
+ id="rg">
+ <stop
+ stop-color="#fff"
+ stop-opacity="0.9"
+ offset="0"
+ id="stop3387" />
+ <stop
+ stop-color="#fff"
+ stop-opacity="0.2"
+ offset="0.7"
+ id="stop3389" />
+ <stop
+ stop-color="#fff"
+ stop-opacity="0.3"
+ offset="1"
+ id="stop3391" />
+ </linearGradient>
+ <radialGradient
+ cx="65"
+ cy="265"
+ r="44"
+ fx="65"
+ fy="265"
+ id="g"
+ gradientUnits="userSpaceOnUse">
+ <stop
+ stop-color="#74fc94"
+ offset="0"
+ id="stop3373" />
+ <stop
+ stop-color="#3ad55e"
+ offset="0.7"
+ id="stop3375" />
+ <stop
+ stop-color="#00af29"
+ offset="1"
+ id="stop3377" />
+ </radialGradient>
+ <radialGradient
+ cx="65"
+ cy="165"
+ r="44"
+ fx="65"
+ fy="165"
+ id="y"
+ gradientUnits="userSpaceOnUse">
+ <stop
+ stop-color="#fcfc74"
+ offset="0"
+ id="stop3366" />
+ <stop
+ stop-color="#d4d53a"
+ offset="0.7"
+ id="stop3368" />
+ <stop
+ stop-color="#afa500"
+ offset="1"
+ id="stop3370" />
+ </radialGradient>
+ <radialGradient
+ cx="65"
+ cy="65"
+ r="44"
+ fx="65"
+ fy="65"
+ id="r"
+ gradientUnits="userSpaceOnUse">
+ <stop
+ stop-color="#fc7474"
+ offset="0"
+ id="stop3359" />
+ <stop
+ stop-color="#d53a3a"
+ offset="0.7"
+ id="stop3361" />
+ <stop
+ stop-color="#af0000"
+ offset="1"
+ id="stop3363" />
+ </radialGradient>
+ <linearGradient
+ id="back"
+ x1="0"
+ y1="0"
+ x2="82.849258"
+ y2="186.41083"
+ gradientTransform="matrix(0.6276459,0,0,1.593255,737.14592,106.67382)"
+ gradientUnits="userSpaceOnUse">
+ <stop
+ stop-color="#5c656c"
+ offset="0"
+ id="stop3354" />
+ <stop
+ stop-color="#aab2b7"
+ offset="1"
+ id="stop3356" />
+ </linearGradient>
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 300 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="600 : 300 : 1"
+ inkscape:persp3d-origin="300 : 200 : 1"
+ id="perspective3255" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#back"
+ id="linearGradient3454"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.6276459,0,0,1.593255,737.14592,106.67382)"
+ x1="0"
+ y1="0"
+ x2="82.849258"
+ y2="186.41083" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#r"
+ id="radialGradient3456"
+ gradientUnits="userSpaceOnUse"
+ cx="65"
+ cy="65"
+ fx="65"
+ fy="65"
+ r="44" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#y"
+ id="radialGradient3458"
+ gradientUnits="userSpaceOnUse"
+ cx="65"
+ cy="165"
+ fx="65"
+ fy="165"
+ r="44" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#g"
+ id="radialGradient3460"
+ gradientUnits="userSpaceOnUse"
+ cx="65"
+ cy="265"
+ fx="65"
+ fy="265"
+ r="44" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_9_"
+ id="linearGradient3692"
+ gradientUnits="userSpaceOnUse"
+ x1="45.014198"
+ y1="57.756302"
+ x2="45.014198"
+ y2="52.224201" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_10_"
+ id="linearGradient3694"
+ gradientUnits="userSpaceOnUse"
+ x1="52.644501"
+ y1="55.616199"
+ x2="122.192"
+ y2="132.177" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_11_"
+ id="linearGradient3696"
+ gradientUnits="userSpaceOnUse"
+ x1="118.848"
+ y1="63.373001"
+ x2="108.185"
+ y2="53.6199" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_12_"
+ id="radialGradient3698"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,1.0845,0,-75.5965)"
+ cx="114.137"
+ cy="129.33299"
+ fx="114.137"
+ fy="129.33299"
+ r="6.4330001" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_13_"
+ id="linearGradient3700"
+ gradientUnits="userSpaceOnUse"
+ x1="114.477"
+ y1="56.5625"
+ x2="114.477"
+ y2="62.2383" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_14_"
+ id="linearGradient3702"
+ gradientUnits="userSpaceOnUse"
+ x1="105.643"
+ y1="60.411098"
+ x2="102.565"
+ y2="57.596199" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_15_"
+ id="linearGradient3704"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(1,15.5)"
+ x1="103.381"
+ y1="45.933601"
+ x2="103.381"
+ y2="42.4576" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_15_"
+ id="linearGradient3706"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(1,15.5)"
+ x1="103.381"
+ y1="45.933601"
+ x2="103.381"
+ y2="42.4576" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_15_"
+ id="linearGradient3708"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(1,15.5)"
+ x1="103.381"
+ y1="45.933601"
+ x2="103.381"
+ y2="42.4576" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_18_"
+ id="linearGradient3710"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-780.801,1657.79)"
+ x1="885.18103"
+ y1="-1596.5601"
+ x2="885.18103"
+ y2="-1598.62" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_19_"
+ id="linearGradient3712"
+ gradientUnits="userSpaceOnUse"
+ x1="104.381"
+ y1="61.433601"
+ x2="104.381"
+ y2="57.958099" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_20_"
+ id="linearGradient3714"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-780.801,1657.79)"
+ x1="885.13098"
+ y1="-1599.67"
+ x2="885.13098"
+ y2="-1597.9399" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_21_"
+ id="linearGradient3716"
+ gradientUnits="userSpaceOnUse"
+ x1="30.5054"
+ y1="82.064499"
+ x2="101.62"
+ y2="82.428001" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_22_"
+ id="linearGradient3718"
+ gradientUnits="userSpaceOnUse"
+ x1="37.715302"
+ y1="54.6782"
+ x2="83.369102"
+ y2="100.333" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_23_"
+ id="linearGradient3720"
+ gradientUnits="userSpaceOnUse"
+ x1="43.121101"
+ y1="77.249001"
+ x2="55.990799"
+ y2="90.118896" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_24_"
+ id="linearGradient3722"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,1,-1,0,-256.622,-352.346)"
+ x1="431.49799"
+ y1="-360.35999"
+ x2="465.18799"
+ y2="-326.67001" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_25_"
+ id="linearGradient3724"
+ gradientUnits="userSpaceOnUse"
+ x1="75.553703"
+ y1="68.8125"
+ x2="108.682"
+ y2="105.281" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_26_"
+ id="linearGradient3726"
+ gradientUnits="userSpaceOnUse"
+ x1="87.561501"
+ y1="111.869"
+ x2="87.561501"
+ y2="64.263496" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_27_"
+ id="linearGradient3728"
+ gradientUnits="userSpaceOnUse"
+ x1="71.107399"
+ y1="81.947304"
+ x2="111.821"
+ y2="82.155403" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_28_"
+ id="linearGradient3730"
+ gradientUnits="userSpaceOnUse"
+ x1="87.561501"
+ y1="102.759"
+ x2="87.561501"
+ y2="69.688904" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_29_"
+ id="linearGradient3732"
+ gradientUnits="userSpaceOnUse"
+ x1="67.565399"
+ y1="95.804703"
+ x2="89.966499"
+ y2="80.375298" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_30_"
+ id="linearGradient3734"
+ gradientUnits="userSpaceOnUse"
+ x1="75.442398"
+ y1="81.969704"
+ x2="105.431"
+ y2="82.123001" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_31_"
+ id="linearGradient3736"
+ gradientUnits="userSpaceOnUse"
+ x1="87.560501"
+ y1="98.801804"
+ x2="87.560501"
+ y2="84.569901" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_32_"
+ id="linearGradient3738"
+ gradientUnits="userSpaceOnUse"
+ x1="87.561501"
+ y1="97.340797"
+ x2="87.561501"
+ y2="84.349197" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_33_"
+ id="radialGradient3740"
+ gradientUnits="userSpaceOnUse"
+ cx="87.766602"
+ cy="88.976601"
+ fx="87.766602"
+ fy="88.976601"
+ r="11.4148" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_34_"
+ id="linearGradient3742"
+ gradientUnits="userSpaceOnUse"
+ x1="87.5625"
+ y1="75.327103"
+ x2="87.5625"
+ y2="82.084198" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_35_"
+ id="linearGradient3744"
+ gradientUnits="userSpaceOnUse"
+ x1="64.068398"
+ y1="68.1436"
+ x2="120.423"
+ y2="130.181" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_36_"
+ id="linearGradient3746"
+ gradientUnits="userSpaceOnUse"
+ x1="76.830101"
+ y1="57.847698"
+ x2="76.830101"
+ y2="126.982" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_37_"
+ id="linearGradient3748"
+ gradientUnits="userSpaceOnUse"
+ x1="77.031303"
+ y1="120.132"
+ x2="77.031303"
+ y2="60.029999" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_9_"
+ id="linearGradient2781"
+ gradientUnits="userSpaceOnUse"
+ x1="45.014198"
+ y1="57.756302"
+ x2="45.014198"
+ y2="52.224201" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_10_"
+ id="linearGradient2783"
+ gradientUnits="userSpaceOnUse"
+ x1="52.644501"
+ y1="55.616199"
+ x2="122.192"
+ y2="132.177" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_11_"
+ id="linearGradient2785"
+ gradientUnits="userSpaceOnUse"
+ x1="118.848"
+ y1="63.373001"
+ x2="108.185"
+ y2="53.6199" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_12_"
+ id="radialGradient2787"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,1.0845,0,-75.5965)"
+ cx="114.137"
+ cy="129.33299"
+ fx="114.137"
+ fy="129.33299"
+ r="6.4330001" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_13_"
+ id="linearGradient2789"
+ gradientUnits="userSpaceOnUse"
+ x1="114.477"
+ y1="56.5625"
+ x2="114.477"
+ y2="62.2383" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_14_"
+ id="linearGradient2791"
+ gradientUnits="userSpaceOnUse"
+ x1="105.643"
+ y1="60.411098"
+ x2="102.565"
+ y2="57.596199" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_15_"
+ id="linearGradient2793"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(1,15.5)"
+ x1="103.381"
+ y1="45.933601"
+ x2="103.381"
+ y2="42.4576" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_15_"
+ id="linearGradient2795"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(1,15.5)"
+ x1="103.381"
+ y1="45.933601"
+ x2="103.381"
+ y2="42.4576" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_15_"
+ id="linearGradient2797"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(1,15.5)"
+ x1="103.381"
+ y1="45.933601"
+ x2="103.381"
+ y2="42.4576" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_18_"
+ id="linearGradient2799"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-780.801,1657.79)"
+ x1="885.18103"
+ y1="-1596.5601"
+ x2="885.18103"
+ y2="-1598.62" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_19_"
+ id="linearGradient2801"
+ gradientUnits="userSpaceOnUse"
+ x1="104.381"
+ y1="61.433601"
+ x2="104.381"
+ y2="57.958099" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_20_"
+ id="linearGradient2803"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-780.801,1657.79)"
+ x1="885.13098"
+ y1="-1599.67"
+ x2="885.13098"
+ y2="-1597.9399" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_21_"
+ id="linearGradient2805"
+ gradientUnits="userSpaceOnUse"
+ x1="30.5054"
+ y1="82.064499"
+ x2="101.62"
+ y2="82.428001" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_22_"
+ id="linearGradient2807"
+ gradientUnits="userSpaceOnUse"
+ x1="37.715302"
+ y1="54.6782"
+ x2="83.369102"
+ y2="100.333" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_23_"
+ id="linearGradient2809"
+ gradientUnits="userSpaceOnUse"
+ x1="43.121101"
+ y1="77.249001"
+ x2="55.990799"
+ y2="90.118896" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_24_"
+ id="linearGradient2811"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,1,-1,0,-256.622,-352.346)"
+ x1="431.49799"
+ y1="-360.35999"
+ x2="465.18799"
+ y2="-326.67001" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_25_"
+ id="linearGradient2813"
+ gradientUnits="userSpaceOnUse"
+ x1="75.553703"
+ y1="68.8125"
+ x2="108.682"
+ y2="105.281" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_26_"
+ id="linearGradient2815"
+ gradientUnits="userSpaceOnUse"
+ x1="87.561501"
+ y1="111.869"
+ x2="87.561501"
+ y2="64.263496" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_27_"
+ id="linearGradient2817"
+ gradientUnits="userSpaceOnUse"
+ x1="71.107399"
+ y1="81.947304"
+ x2="111.821"
+ y2="82.155403" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_28_"
+ id="linearGradient2819"
+ gradientUnits="userSpaceOnUse"
+ x1="87.561501"
+ y1="102.759"
+ x2="87.561501"
+ y2="69.688904" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_29_"
+ id="linearGradient2821"
+ gradientUnits="userSpaceOnUse"
+ x1="67.565399"
+ y1="95.804703"
+ x2="89.966499"
+ y2="80.375298" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_30_"
+ id="linearGradient2823"
+ gradientUnits="userSpaceOnUse"
+ x1="75.442398"
+ y1="81.969704"
+ x2="105.431"
+ y2="82.123001" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_31_"
+ id="linearGradient2825"
+ gradientUnits="userSpaceOnUse"
+ x1="87.560501"
+ y1="98.801804"
+ x2="87.560501"
+ y2="84.569901" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_32_"
+ id="linearGradient2827"
+ gradientUnits="userSpaceOnUse"
+ x1="87.561501"
+ y1="97.340797"
+ x2="87.561501"
+ y2="84.349197" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_33_"
+ id="radialGradient2829"
+ gradientUnits="userSpaceOnUse"
+ cx="87.766602"
+ cy="88.976601"
+ fx="87.766602"
+ fy="88.976601"
+ r="11.4148" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_34_"
+ id="linearGradient2831"
+ gradientUnits="userSpaceOnUse"
+ x1="87.5625"
+ y1="75.327103"
+ x2="87.5625"
+ y2="82.084198" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_35_"
+ id="linearGradient2833"
+ gradientUnits="userSpaceOnUse"
+ x1="64.068398"
+ y1="68.1436"
+ x2="120.423"
+ y2="130.181" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_36_"
+ id="linearGradient2835"
+ gradientUnits="userSpaceOnUse"
+ x1="76.830101"
+ y1="57.847698"
+ x2="76.830101"
+ y2="126.982" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_37_"
+ id="linearGradient2837"
+ gradientUnits="userSpaceOnUse"
+ x1="77.031303"
+ y1="120.132"
+ x2="77.031303"
+ y2="60.029999" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4522"
+ id="radialGradient2839"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.7696866,7.7890564e-2,-6.8035834e-2,1.5457853,-418.97793,-202.43104)"
+ cx="569.94421"
+ cy="289.56024"
+ fx="569.94421"
+ fy="289.56024"
+ r="130.18762" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#back"
+ id="linearGradient2938"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.6276459,0,0,1.593255,737.14592,106.67382)"
+ x1="0"
+ y1="0"
+ x2="82.849258"
+ y2="186.41083" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#r"
+ id="radialGradient2940"
+ gradientUnits="userSpaceOnUse"
+ cx="65"
+ cy="65"
+ fx="65"
+ fy="65"
+ r="44" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#y"
+ id="radialGradient2942"
+ gradientUnits="userSpaceOnUse"
+ cx="65"
+ cy="165"
+ fx="65"
+ fy="165"
+ r="44" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#g"
+ id="radialGradient2944"
+ gradientUnits="userSpaceOnUse"
+ cx="65"
+ cy="265"
+ fx="65"
+ fy="265"
+ r="44" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_9_"
+ id="linearGradient2946"
+ gradientUnits="userSpaceOnUse"
+ x1="45.014198"
+ y1="57.756302"
+ x2="45.014198"
+ y2="52.224201" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_10_"
+ id="linearGradient2948"
+ gradientUnits="userSpaceOnUse"
+ x1="52.644501"
+ y1="55.616199"
+ x2="122.192"
+ y2="132.177" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_11_"
+ id="linearGradient2950"
+ gradientUnits="userSpaceOnUse"
+ x1="118.848"
+ y1="63.373001"
+ x2="108.185"
+ y2="53.6199" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_12_"
+ id="radialGradient2952"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,1.0845,0,-75.5965)"
+ cx="114.137"
+ cy="129.33299"
+ fx="114.137"
+ fy="129.33299"
+ r="6.4330001" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_13_"
+ id="linearGradient2954"
+ gradientUnits="userSpaceOnUse"
+ x1="114.477"
+ y1="56.5625"
+ x2="114.477"
+ y2="62.2383" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_14_"
+ id="linearGradient2956"
+ gradientUnits="userSpaceOnUse"
+ x1="105.643"
+ y1="60.411098"
+ x2="102.565"
+ y2="57.596199" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_15_"
+ id="linearGradient2958"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(1,15.5)"
+ x1="103.381"
+ y1="45.933601"
+ x2="103.381"
+ y2="42.4576" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_15_"
+ id="linearGradient2960"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(1,15.5)"
+ x1="103.381"
+ y1="45.933601"
+ x2="103.381"
+ y2="42.4576" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_15_"
+ id="linearGradient2962"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(1,15.5)"
+ x1="103.381"
+ y1="45.933601"
+ x2="103.381"
+ y2="42.4576" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_18_"
+ id="linearGradient2964"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-780.801,1657.79)"
+ x1="885.18103"
+ y1="-1596.5601"
+ x2="885.18103"
+ y2="-1598.62" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_19_"
+ id="linearGradient2966"
+ gradientUnits="userSpaceOnUse"
+ x1="104.381"
+ y1="61.433601"
+ x2="104.381"
+ y2="57.958099" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_20_"
+ id="linearGradient2968"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-780.801,1657.79)"
+ x1="885.13098"
+ y1="-1599.67"
+ x2="885.13098"
+ y2="-1597.9399" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_21_"
+ id="linearGradient2970"
+ gradientUnits="userSpaceOnUse"
+ x1="30.5054"
+ y1="82.064499"
+ x2="101.62"
+ y2="82.428001" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_22_"
+ id="linearGradient2972"
+ gradientUnits="userSpaceOnUse"
+ x1="37.715302"
+ y1="54.6782"
+ x2="83.369102"
+ y2="100.333" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_23_"
+ id="linearGradient2974"
+ gradientUnits="userSpaceOnUse"
+ x1="43.121101"
+ y1="77.249001"
+ x2="55.990799"
+ y2="90.118896" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_24_"
+ id="linearGradient2976"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,1,-1,0,-256.622,-352.346)"
+ x1="431.49799"
+ y1="-360.35999"
+ x2="465.18799"
+ y2="-326.67001" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_25_"
+ id="linearGradient2978"
+ gradientUnits="userSpaceOnUse"
+ x1="75.553703"
+ y1="68.8125"
+ x2="108.682"
+ y2="105.281" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_26_"
+ id="linearGradient2980"
+ gradientUnits="userSpaceOnUse"
+ x1="87.561501"
+ y1="111.869"
+ x2="87.561501"
+ y2="64.263496" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_27_"
+ id="linearGradient2982"
+ gradientUnits="userSpaceOnUse"
+ x1="71.107399"
+ y1="81.947304"
+ x2="111.821"
+ y2="82.155403" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_28_"
+ id="linearGradient2984"
+ gradientUnits="userSpaceOnUse"
+ x1="87.561501"
+ y1="102.759"
+ x2="87.561501"
+ y2="69.688904" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_29_"
+ id="linearGradient2986"
+ gradientUnits="userSpaceOnUse"
+ x1="67.565399"
+ y1="95.804703"
+ x2="89.966499"
+ y2="80.375298" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_30_"
+ id="linearGradient2988"
+ gradientUnits="userSpaceOnUse"
+ x1="75.442398"
+ y1="81.969704"
+ x2="105.431"
+ y2="82.123001" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_31_"
+ id="linearGradient2990"
+ gradientUnits="userSpaceOnUse"
+ x1="87.560501"
+ y1="98.801804"
+ x2="87.560501"
+ y2="84.569901" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_32_"
+ id="linearGradient2992"
+ gradientUnits="userSpaceOnUse"
+ x1="87.561501"
+ y1="97.340797"
+ x2="87.561501"
+ y2="84.349197" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_33_"
+ id="radialGradient2994"
+ gradientUnits="userSpaceOnUse"
+ cx="87.766602"
+ cy="88.976601"
+ fx="87.766602"
+ fy="88.976601"
+ r="11.4148" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_34_"
+ id="linearGradient2996"
+ gradientUnits="userSpaceOnUse"
+ x1="87.5625"
+ y1="75.327103"
+ x2="87.5625"
+ y2="82.084198" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_35_"
+ id="linearGradient2998"
+ gradientUnits="userSpaceOnUse"
+ x1="64.068398"
+ y1="68.1436"
+ x2="120.423"
+ y2="130.181" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_36_"
+ id="linearGradient3000"
+ gradientUnits="userSpaceOnUse"
+ x1="76.830101"
+ y1="57.847698"
+ x2="76.830101"
+ y2="126.982" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_37_"
+ id="linearGradient3002"
+ gradientUnits="userSpaceOnUse"
+ x1="77.031303"
+ y1="120.132"
+ x2="77.031303"
+ y2="60.029999" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4522"
+ id="radialGradient3004"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.7696866,7.7890564e-2,-6.8035834e-2,1.5457853,-418.97793,-202.43104)"
+ cx="569.94421"
+ cy="289.56024"
+ fx="569.94421"
+ fy="289.56024"
+ r="130.18762" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#back"
+ id="linearGradient3807"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.6276459,0,0,1.593255,737.14592,106.67382)"
+ x1="0"
+ y1="0"
+ x2="82.849258"
+ y2="186.41083" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#r"
+ id="radialGradient3809"
+ gradientUnits="userSpaceOnUse"
+ cx="65"
+ cy="65"
+ fx="65"
+ fy="65"
+ r="44" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#y"
+ id="radialGradient3811"
+ gradientUnits="userSpaceOnUse"
+ cx="65"
+ cy="165"
+ fx="65"
+ fy="165"
+ r="44" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#g"
+ id="radialGradient3813"
+ gradientUnits="userSpaceOnUse"
+ cx="65"
+ cy="265"
+ fx="65"
+ fy="265"
+ r="44" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_9_"
+ id="linearGradient3815"
+ gradientUnits="userSpaceOnUse"
+ x1="45.014198"
+ y1="57.756302"
+ x2="45.014198"
+ y2="52.224201" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_10_"
+ id="linearGradient3817"
+ gradientUnits="userSpaceOnUse"
+ x1="52.644501"
+ y1="55.616199"
+ x2="122.192"
+ y2="132.177" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_11_"
+ id="linearGradient3819"
+ gradientUnits="userSpaceOnUse"
+ x1="118.848"
+ y1="63.373001"
+ x2="108.185"
+ y2="53.6199" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_12_"
+ id="radialGradient3821"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,1.0845,0,-75.5965)"
+ cx="114.137"
+ cy="129.33299"
+ fx="114.137"
+ fy="129.33299"
+ r="6.4330001" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_13_"
+ id="linearGradient3823"
+ gradientUnits="userSpaceOnUse"
+ x1="114.477"
+ y1="56.5625"
+ x2="114.477"
+ y2="62.2383" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_14_"
+ id="linearGradient3825"
+ gradientUnits="userSpaceOnUse"
+ x1="105.643"
+ y1="60.411098"
+ x2="102.565"
+ y2="57.596199" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_15_"
+ id="linearGradient3827"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(1,15.5)"
+ x1="103.381"
+ y1="45.933601"
+ x2="103.381"
+ y2="42.4576" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_15_"
+ id="linearGradient3829"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(1,15.5)"
+ x1="103.381"
+ y1="45.933601"
+ x2="103.381"
+ y2="42.4576" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_15_"
+ id="linearGradient3831"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(1,15.5)"
+ x1="103.381"
+ y1="45.933601"
+ x2="103.381"
+ y2="42.4576" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_18_"
+ id="linearGradient3833"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-780.801,1657.79)"
+ x1="885.18103"
+ y1="-1596.5601"
+ x2="885.18103"
+ y2="-1598.62" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_19_"
+ id="linearGradient3835"
+ gradientUnits="userSpaceOnUse"
+ x1="104.381"
+ y1="61.433601"
+ x2="104.381"
+ y2="57.958099" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_20_"
+ id="linearGradient3837"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-780.801,1657.79)"
+ x1="885.13098"
+ y1="-1599.67"
+ x2="885.13098"
+ y2="-1597.9399" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_21_"
+ id="linearGradient3839"
+ gradientUnits="userSpaceOnUse"
+ x1="30.5054"
+ y1="82.064499"
+ x2="101.62"
+ y2="82.428001" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_22_"
+ id="linearGradient3841"
+ gradientUnits="userSpaceOnUse"
+ x1="37.715302"
+ y1="54.6782"
+ x2="83.369102"
+ y2="100.333" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_23_"
+ id="linearGradient3843"
+ gradientUnits="userSpaceOnUse"
+ x1="43.121101"
+ y1="77.249001"
+ x2="55.990799"
+ y2="90.118896" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_24_"
+ id="linearGradient3845"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,1,-1,0,-256.622,-352.346)"
+ x1="431.49799"
+ y1="-360.35999"
+ x2="465.18799"
+ y2="-326.67001" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_25_"
+ id="linearGradient3847"
+ gradientUnits="userSpaceOnUse"
+ x1="75.553703"
+ y1="68.8125"
+ x2="108.682"
+ y2="105.281" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_26_"
+ id="linearGradient3849"
+ gradientUnits="userSpaceOnUse"
+ x1="87.561501"
+ y1="111.869"
+ x2="87.561501"
+ y2="64.263496" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_27_"
+ id="linearGradient3851"
+ gradientUnits="userSpaceOnUse"
+ x1="71.107399"
+ y1="81.947304"
+ x2="111.821"
+ y2="82.155403" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_28_"
+ id="linearGradient3853"
+ gradientUnits="userSpaceOnUse"
+ x1="87.561501"
+ y1="102.759"
+ x2="87.561501"
+ y2="69.688904" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_29_"
+ id="linearGradient3855"
+ gradientUnits="userSpaceOnUse"
+ x1="67.565399"
+ y1="95.804703"
+ x2="89.966499"
+ y2="80.375298" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_30_"
+ id="linearGradient3857"
+ gradientUnits="userSpaceOnUse"
+ x1="75.442398"
+ y1="81.969704"
+ x2="105.431"
+ y2="82.123001" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_31_"
+ id="linearGradient3859"
+ gradientUnits="userSpaceOnUse"
+ x1="87.560501"
+ y1="98.801804"
+ x2="87.560501"
+ y2="84.569901" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_32_"
+ id="linearGradient3861"
+ gradientUnits="userSpaceOnUse"
+ x1="87.561501"
+ y1="97.340797"
+ x2="87.561501"
+ y2="84.349197" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_33_"
+ id="radialGradient3863"
+ gradientUnits="userSpaceOnUse"
+ cx="87.766602"
+ cy="88.976601"
+ fx="87.766602"
+ fy="88.976601"
+ r="11.4148" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_34_"
+ id="linearGradient3865"
+ gradientUnits="userSpaceOnUse"
+ x1="87.5625"
+ y1="75.327103"
+ x2="87.5625"
+ y2="82.084198" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_35_"
+ id="linearGradient3867"
+ gradientUnits="userSpaceOnUse"
+ x1="64.068398"
+ y1="68.1436"
+ x2="120.423"
+ y2="130.181" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_36_"
+ id="linearGradient3869"
+ gradientUnits="userSpaceOnUse"
+ x1="76.830101"
+ y1="57.847698"
+ x2="76.830101"
+ y2="126.982" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_37_"
+ id="linearGradient3871"
+ gradientUnits="userSpaceOnUse"
+ x1="77.031303"
+ y1="120.132"
+ x2="77.031303"
+ y2="60.029999" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient4522"
+ id="radialGradient3873"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.7696866,7.7890564e-2,-6.8035834e-2,1.5457853,-418.97793,-202.43104)"
+ cx="569.94421"
+ cy="289.56024"
+ fx="569.94421"
+ fy="289.56024"
+ r="130.18762" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#back"
+ id="linearGradient4006"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.6276459,0,0,1.593255,737.14592,106.67382)"
+ x1="0"
+ y1="0"
+ x2="82.849258"
+ y2="186.41083" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#r"
+ id="radialGradient4008"
+ gradientUnits="userSpaceOnUse"
+ cx="65"
+ cy="65"
+ fx="65"
+ fy="65"
+ r="44" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#y"
+ id="radialGradient4010"
+ gradientUnits="userSpaceOnUse"
+ cx="65"
+ cy="165"
+ fx="65"
+ fy="165"
+ r="44" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#g"
+ id="radialGradient4012"
+ gradientUnits="userSpaceOnUse"
+ cx="65"
+ cy="265"
+ fx="65"
+ fy="265"
+ r="44" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_9_"
+ id="linearGradient4014"
+ gradientUnits="userSpaceOnUse"
+ x1="45.014198"
+ y1="57.756302"
+ x2="45.014198"
+ y2="52.224201" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_10_"
+ id="linearGradient4016"
+ gradientUnits="userSpaceOnUse"
+ x1="52.644501"
+ y1="55.616199"
+ x2="122.192"
+ y2="132.177" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_11_"
+ id="linearGradient4018"
+ gradientUnits="userSpaceOnUse"
+ x1="118.848"
+ y1="63.373001"
+ x2="108.185"
+ y2="53.6199" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_12_"
+ id="radialGradient4020"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,1.0845,0,-75.5965)"
+ cx="114.137"
+ cy="129.33299"
+ fx="114.137"
+ fy="129.33299"
+ r="6.4330001" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_13_"
+ id="linearGradient4022"
+ gradientUnits="userSpaceOnUse"
+ x1="114.477"
+ y1="56.5625"
+ x2="114.477"
+ y2="62.2383" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_14_"
+ id="linearGradient4024"
+ gradientUnits="userSpaceOnUse"
+ x1="105.643"
+ y1="60.411098"
+ x2="102.565"
+ y2="57.596199" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_15_"
+ id="linearGradient4026"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(1,15.5)"
+ x1="103.381"
+ y1="45.933601"
+ x2="103.381"
+ y2="42.4576" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_15_"
+ id="linearGradient4028"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(1,15.5)"
+ x1="103.381"
+ y1="45.933601"
+ x2="103.381"
+ y2="42.4576" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_15_"
+ id="linearGradient4030"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(1,15.5)"
+ x1="103.381"
+ y1="45.933601"
+ x2="103.381"
+ y2="42.4576" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_18_"
+ id="linearGradient4032"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-780.801,1657.79)"
+ x1="885.18103"
+ y1="-1596.5601"
+ x2="885.18103"
+ y2="-1598.62" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_19_"
+ id="linearGradient4034"
+ gradientUnits="userSpaceOnUse"
+ x1="104.381"
+ y1="61.433601"
+ x2="104.381"
+ y2="57.958099" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_20_"
+ id="linearGradient4036"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(-780.801,1657.79)"
+ x1="885.13098"
+ y1="-1599.67"
+ x2="885.13098"
+ y2="-1597.9399" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_21_"
+ id="linearGradient4038"
+ gradientUnits="userSpaceOnUse"
+ x1="30.5054"
+ y1="82.064499"
+ x2="101.62"
+ y2="82.428001" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_22_"
+ id="linearGradient4040"
+ gradientUnits="userSpaceOnUse"
+ x1="37.715302"
+ y1="54.6782"
+ x2="83.369102"
+ y2="100.333" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_23_"
+ id="linearGradient4042"
+ gradientUnits="userSpaceOnUse"
+ x1="43.121101"
+ y1="77.249001"
+ x2="55.990799"
+ y2="90.118896" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_24_"
+ id="linearGradient4044"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0,1,-1,0,-256.622,-352.346)"
+ x1="431.49799"
+ y1="-360.35999"
+ x2="465.18799"
+ y2="-326.67001" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_25_"
+ id="linearGradient4046"
+ gradientUnits="userSpaceOnUse"
+ x1="75.553703"
+ y1="68.8125"
+ x2="108.682"
+ y2="105.281" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_26_"
+ id="linearGradient4048"
+ gradientUnits="userSpaceOnUse"
+ x1="87.561501"
+ y1="111.869"
+ x2="87.561501"
+ y2="64.263496" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_27_"
+ id="linearGradient4050"
+ gradientUnits="userSpaceOnUse"
+ x1="71.107399"
+ y1="81.947304"
+ x2="111.821"
+ y2="82.155403" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_28_"
+ id="linearGradient4052"
+ gradientUnits="userSpaceOnUse"
+ x1="87.561501"
+ y1="102.759"
+ x2="87.561501"
+ y2="69.688904" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_29_"
+ id="linearGradient4054"
+ gradientUnits="userSpaceOnUse"
+ x1="67.565399"
+ y1="95.804703"
+ x2="89.966499"
+ y2="80.375298" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_30_"
+ id="linearGradient4056"
+ gradientUnits="userSpaceOnUse"
+ x1="75.442398"
+ y1="81.969704"
+ x2="105.431"
+ y2="82.123001" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_31_"
+ id="linearGradient4058"
+ gradientUnits="userSpaceOnUse"
+ x1="87.560501"
+ y1="98.801804"
+ x2="87.560501"
+ y2="84.569901" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_32_"
+ id="linearGradient4060"
+ gradientUnits="userSpaceOnUse"
+ x1="87.561501"
+ y1="97.340797"
+ x2="87.561501"
+ y2="84.349197" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_33_"
+ id="radialGradient4062"
+ gradientUnits="userSpaceOnUse"
+ cx="87.766602"
+ cy="88.976601"
+ fx="87.766602"
+ fy="88.976601"
+ r="11.4148" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_34_"
+ id="linearGradient4064"
+ gradientUnits="userSpaceOnUse"
+ x1="87.5625"
+ y1="75.327103"
+ x2="87.5625"
+ y2="82.084198" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_35_"
+ id="linearGradient4066"
+ gradientUnits="userSpaceOnUse"
+ x1="64.068398"
+ y1="68.1436"
+ x2="120.423"
+ y2="130.181" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_36_"
+ id="linearGradient4068"
+ gradientUnits="userSpaceOnUse"
+ x1="76.830101"
+ y1="57.847698"
+ x2="76.830101"
+ y2="126.982" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_37_"
+ id="linearGradient4070"
+ gradientUnits="userSpaceOnUse"
+ x1="77.031303"
+ y1="120.132"
+ x2="77.031303"
+ y2="60.029999" />
+ </defs>
+ <g
+ id="g4074">
+ <use
+ height="600"
+ width="600"
+ y="0"
+ x="0"
+ transform="matrix(0.8331005,0,0,0.8331005,614.11663,-360.69592)"
+ id="use3399"
+ xlink:href="#reflex" />
+ <use
+ height="600"
+ width="600"
+ y="0"
+ x="0"
+ id="use3401"
+ transform="matrix(0.8331005,0,0,0.8331005,614.11663,-277.38587)"
+ xlink:href="#reflex" />
+ <use
+ height="600"
+ width="600"
+ y="0"
+ x="0"
+ id="use3403"
+ transform="matrix(0.8331005,0,0,0.8331005,614.11663,-194.07582)"
+ xlink:href="#reflex" />
+ <g
+ transform="matrix(7.0344526e-2,0,0,7.0344526e-2,-0.2582579,2.8565392)"
+ id="g4538">
+ <path
+ id="path16"
+ style="fill:#cc0000;fill-opacity:1;fill-rule:evenodd;stroke:none"
+ d="M 112.60846,250.59757 C 112.19594,124.33283 206.65435,17.92223 331.72332,2.0110029 C 474.76675,-16.138613 604.57352,90.733 613.07847,234.94719 C 622.43271,379.23416 507.44593,501.2648 363.02544,501.00397 C 225.13231,501.4104 112.04429,388.588 112.60846,250.59757" />
+ <path
+ id="path18"
+ style="fill:#fffefe;fill-rule:evenodd;stroke:none"
+ d="M 178.5674,250.52998 C 178.28835,157.95605 248.14182,78.466576 340.17371,67.456704 C 445.3998,53.91728 541.01081,133.02461 547.2773,238.88318 C 553.98057,345.65772 469.7014,434.54957 363.10433,435.05912 C 260.7112,434.24626 179.0345,353.31308 178.5674,250.52998" />
+ <path
+ id="path20"
+ style="fill:#000000;fill-rule:evenodd;stroke:none"
+ d="M 291.59905,142.76359 L 326.17699,142.76359 L 279.95176,234.84617 C 304.33223,225.82596 328.93108,234.06364 342.55601,256.31995 C 354.99192,279.21929 352.01944,325.58208 329.81677,343.30707 C 302.80353,367.88063 263.93065,365.10844 239.91416,337.84764 C 228.15766,322.57333 225.10632,307.88137 226.08298,289.07662 L 226.08298,286.16492 L 226.44697,280.34151 L 227.5389,274.88207 L 228.99481,269.42261 L 231.17868,263.96318 L 232.27061,261.41544 L 291.59905,142.76359 z M 256.65715,289.07662 C 251.14896,339.18824 315.86427,342.37896 318.16946,298.53965 C 324.29643,247.65159 258.87742,245.20698 256.65715,289.07662 z M 376.04199,298.53965 C 382.47227,240.46332 350.17528,157.09158 429.91078,141.30772 C 466.40564,136.95837 499.30321,165.37781 499.06663,202.45348 C 492.65454,261.30019 524.93335,343.26461 445.19786,359.6854 C 408.15094,363.85277 376.0784,336.05813 376.04199,298.53965 z M 406.61616,298.53965 L 406.61616,202.45348 L 406.98015,200.2697 L 407.34411,196.63007 L 408.07209,192.99044 L 409.52798,189.35082 L 411.34787,185.71118 C 417.62651,177.61301 423.24997,173.5427 433.55055,171.8806 C 452.2833,169.50877 468.16487,183.67906 468.12847,202.45348 L 468.12847,300.35947 L 467.7645,304.36306 L 466.67256,308.00268 L 465.21665,311.64231 L 463.39677,314.91797 C 458.7985,322.81597 450.11762,327.86899 441.1941,329.11252 C 432.24023,330.03456 422.86173,327.18352 416.44357,320.74137 C 408.65444,313.29835 407.73237,308.62749 406.61616,298.53965" />
+ </g>
+ <g
+ transform="matrix(-0.1271574,0,0,0.1259947,110.2611,-10.872392)"
+ id="g3448">
+ <rect
+ style="fill:url(#linearGradient4006);stroke:#000000;stroke-width:10"
+ width="120"
+ height="320"
+ x="742.14594"
+ y="111.67382"
+ id="rect3394" />
+ <circle
+ style="fill:url(#radialGradient4008);stroke:#000000;stroke-width:8"
+ cx="65"
+ cy="65"
+ r="40"
+ id="redlight"
+ sodipodi:cx="65"
+ sodipodi:cy="65"
+ sodipodi:rx="40"
+ sodipodi:ry="40"
+ transform="translate(737.14592,106.67382)" />
+ <circle
+ style="fill:url(#radialGradient4010);stroke:#000000;stroke-width:8"
+ cx="65"
+ cy="165"
+ r="40"
+ id="yellight"
+ sodipodi:cx="65"
+ sodipodi:cy="165"
+ sodipodi:rx="40"
+ sodipodi:ry="40"
+ transform="translate(737.14592,106.67382)" />
+ <circle
+ style="fill:url(#radialGradient4012);stroke:#000000;stroke-width:8"
+ cx="65"
+ cy="265"
+ r="40"
+ id="grelight"
+ sodipodi:cx="65"
+ sodipodi:cy="265"
+ sodipodi:rx="40"
+ sodipodi:ry="40"
+ transform="translate(737.14592,106.67382)" />
+ </g>
+ <g
+ transform="matrix(7.2472377e-2,0,0,7.2472377e-2,-3.1185958,3.3125023)"
+ id="g2682">
+ <g
+ transform="matrix(5.4017057,0,0,5.4017057,-34.965592,-27.802653)"
+ id="g2620">
+ <linearGradient
+ y2="52.224201"
+ x2="45.014198"
+ y1="57.756302"
+ x1="45.014198"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3492">
+ <stop
+ id="stop3494"
+ style="stop-color:rgb(158,158,158)"
+ offset="0" />
+ <stop
+ id="stop3496"
+ style="stop-color:rgb(97,97,97)"
+ offset="1" />
+ </linearGradient>
+ <path
+ id="path2627"
+ style="fill:url(#linearGradient4014)"
+ d="M 45.014,57.186 C 40.658,57.186 37.126,55.889 37.126,54.29 C 37.126,52.69 40.658,51.393 45.014,51.393 C 49.371,51.393 52.903,52.69 52.903,54.29 C 52.902,55.888 49.371,57.186 45.014,57.186 z" />
+ <linearGradient
+ y2="132.177"
+ x2="122.192"
+ y1="55.616199"
+ x1="52.644501"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3499">
+ <stop
+ id="stop3501"
+ style="stop-color:rgb(255,255,255)"
+ offset="0.0337" />
+ <stop
+ id="stop3503"
+ style="stop-color:rgb(171,171,171)"
+ offset="1" />
+ </linearGradient>
+ <path
+ id="path2634"
+ style="fill:url(#linearGradient4016)"
+ d="M 119.951,51.413 L 80.573,51.413 C 78.465,51.413 76.706,52.81 76.113,54.723 L 34.111,54.723 C 31.52,54.723 29.42,56.824 29.42,59.415 L 29.42,108.819 C 29.42,111.411 31.52,113.51 34.111,113.51 L 119.951,113.51 C 122.544,113.51 124.643,111.41 124.643,108.819 L 124.643,56.104 C 124.644,53.514 122.544,51.413 119.951,51.413 z" />
+ <g
+ id="g2636">
+ <linearGradient
+ y2="53.6199"
+ x2="108.185"
+ y1="63.373001"
+ x1="118.848"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3507">
+ <stop
+ id="stop3509"
+ style="stop-color:rgb(255,255,255)"
+ offset="0.0337" />
+ <stop
+ id="stop3511"
+ style="stop-color:rgb(171,171,171)"
+ offset="1" />
+ </linearGradient>
+ <path
+ id="path2643"
+ style="fill:url(#linearGradient4018)"
+ d="M 119.698,62.499 C 119.698,62.89 119.406,63.206 119.046,63.206 L 109.905,63.206 C 109.544,63.206 109.253,62.89 109.253,62.499 L 109.253,56.25 C 109.253,55.859 109.544,55.542 109.905,55.542 L 119.046,55.542 C 119.406,55.542 119.698,55.858 119.698,56.25 L 119.698,62.499 z" />
+ <radialGradient
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,1.0845,0,-75.5965)"
+ fy="129.33299"
+ fx="114.137"
+ r="6.4330001"
+ cy="129.33299"
+ cx="114.137"
+ id="radialGradient3514">
+ <stop
+ id="stop3516"
+ style="stop-color:rgb(133,202,255)"
+ offset="0" />
+ <stop
+ id="stop3518"
+ style="stop-color:rgb(0,61,169)"
+ offset="1" />
+ </radialGradient>
+ <path
+ id="path2650"
+ style="fill:url(#radialGradient4020)"
+ d="M 119.306,62.263 C 119.306,62.626 119.036,62.918 118.703,62.918 L 110.249,62.918 C 109.916,62.918 109.645,62.626 109.645,62.263 L 109.645,56.487 C 109.645,56.125 109.916,55.832 110.249,55.832 L 118.703,55.832 C 119.036,55.832 119.306,56.124 119.306,56.487 L 119.306,62.263 z" />
+ <linearGradient
+ y2="62.2383"
+ x2="114.477"
+ y1="56.5625"
+ x1="114.477"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3521">
+ <stop
+ id="stop3523"
+ style="stop-color:rgb(255,255,255)"
+ offset="0%" />
+ <stop
+ id="stop3525"
+ style="stop-opacity:0;stop-color:rgb(255,255,255)"
+ offset="100%" />
+ </linearGradient>
+ <path
+ id="path2657"
+ style="fill:url(#linearGradient4022)"
+ d="M 118.389,56.034 L 110.564,56.034 C 110.253,56.034 110.004,56.306 110.004,56.639 L 110.004,61.098 C 110.974,61.205 112.679,61.119 114.407,59.707 C 116.304,58.16 118.09,57.596 118.948,57.402 L 118.948,56.64 C 118.948,56.306 118.698,56.034 118.389,56.034 z"
+ a:adobe-blending-mode="screen" />
+ </g>
+ <g
+ id="g2659">
+ <linearGradient
+ y2="57.596199"
+ x2="102.565"
+ y1="60.411098"
+ x1="105.643"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3529">
+ <stop
+ id="stop3531"
+ style="stop-color:rgb(255,255,255)"
+ offset="0.0337" />
+ <stop
+ id="stop3533"
+ style="stop-color:rgb(171,171,171)"
+ offset="1" />
+ </linearGradient>
+ <path
+ id="path2666"
+ style="fill:url(#linearGradient4024)"
+ d="M 104.38,57.077 C 103.094,57.077 102.049,58.055 102.049,59.257 C 102.049,60.459 103.094,61.435 104.38,61.435 C 105.667,61.435 106.714,60.458 106.714,59.257 C 106.714,58.056 105.667,57.077 104.38,57.077 z" />
+ <g
+ id="g2668">
+ <g
+ id="g2670">
+ <linearGradient
+ gradientTransform="translate(1,15.5)"
+ y2="42.4576"
+ x2="103.381"
+ y1="45.933601"
+ x1="103.381"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3538">
+ <stop
+ id="stop3540"
+ style="stop-color:rgb(158,158,158)"
+ offset="0" />
+ <stop
+ id="stop3542"
+ style="stop-color:rgb(97,97,97)"
+ offset="1" />
+ </linearGradient>
+ <path
+ id="path2677"
+ style="fill:url(#linearGradient4026)"
+ d="M 106.24,59.256 C 106.24,60.215 105.406,60.993 104.38,60.993 C 103.355,60.993 102.522,60.216 102.522,59.256 C 102.522,58.296 103.355,57.519 104.38,57.52 C 105.407,57.52 106.24,58.296 106.24,59.256 z" />
+ <path
+ id="path2679"
+ style="fill:url(#linearGradient4028)"
+ d="M 102.435,59.256 C 102.435,60.259 103.308,61.075 104.38,61.075 C 105.455,61.075 106.329,60.26 106.328,59.256 C 106.329,58.253 105.455,57.435 104.38,57.435 C 103.308,57.435 102.434,58.253 102.435,59.256 z M 102.61,59.256 C 102.61,58.344 103.404,57.601 104.38,57.601 C 105.358,57.601 106.151,58.344 106.151,59.255 C 106.151,60.167 105.358,60.909 104.38,60.909 C 103.404,60.909 102.61,60.167 102.61,59.256 z" />
+ <path
+ id="path2681"
+ style="fill:url(#linearGradient4030)"
+ d="M 104.389,59.305 C 105.036,58.858 105.643,58.707 105.911,58.658 C 105.654,58.117 105.075,57.741 104.401,57.741 C 103.488,57.741 102.749,58.432 102.749,59.283 C 102.749,59.417 102.767,59.546 102.8,59.671 C 103.068,59.718 103.724,59.765 104.389,59.305 z" />
+ </g>
+ <g
+ id="g2683">
+ <linearGradient
+ gradientTransform="translate(-780.801,1657.79)"
+ y2="-1598.62"
+ x2="885.18103"
+ y1="-1596.5601"
+ x1="885.18103"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3548">
+ <stop
+ id="stop3550"
+ style="stop-color:rgb(255,255,255)"
+ offset="0" />
+ <stop
+ id="stop3552"
+ style="stop-color:rgb(189,189,189)"
+ offset="1" />
+ </linearGradient>
+ <path
+ id="path2690"
+ style="fill:url(#linearGradient4032)"
+ d="M 106.24,59.256 C 106.24,60.215 105.406,60.993 104.38,60.993 C 103.355,60.993 102.522,60.216 102.522,59.256 C 102.522,58.296 103.355,57.519 104.38,57.52 C 105.407,57.52 106.24,58.296 106.24,59.256 z" />
+ <linearGradient
+ y2="57.958099"
+ x2="104.381"
+ y1="61.433601"
+ x1="104.381"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3555">
+ <stop
+ id="stop3557"
+ style="stop-color:rgb(158,158,158)"
+ offset="0" />
+ <stop
+ id="stop3559"
+ style="stop-color:rgb(97,97,97)"
+ offset="1" />
+ </linearGradient>
+ <path
+ id="path2697"
+ style="fill:url(#linearGradient4034)"
+ d="M 102.435,59.256 C 102.435,60.259 103.308,61.075 104.38,61.075 C 105.455,61.075 106.329,60.26 106.328,59.256 C 106.329,58.253 105.455,57.435 104.38,57.435 C 103.308,57.435 102.434,58.253 102.435,59.256 z M 102.61,59.256 C 102.61,58.344 103.404,57.601 104.38,57.601 C 105.358,57.601 106.151,58.344 106.151,59.255 C 106.151,60.167 105.358,60.909 104.38,60.909 C 103.404,60.909 102.61,60.167 102.61,59.256 z" />
+ <linearGradient
+ gradientTransform="translate(-780.801,1657.79)"
+ y2="-1597.9399"
+ x2="885.13098"
+ y1="-1599.67"
+ x1="885.13098"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3562">
+ <stop
+ id="stop3564"
+ style="stop-color:rgb(255,255,255)"
+ offset="0" />
+ <stop
+ id="stop3566"
+ style="stop-color:rgb(207,207,207)"
+ offset="1" />
+ </linearGradient>
+ <path
+ id="path2704"
+ style="fill:url(#linearGradient4036)"
+ d="M 104.389,59.305 C 105.036,58.858 105.643,58.707 105.911,58.658 C 105.654,58.117 105.075,57.741 104.401,57.741 C 103.488,57.741 102.749,58.432 102.749,59.283 C 102.749,59.417 102.767,59.546 102.8,59.671 C 103.068,59.718 103.724,59.765 104.389,59.305 z" />
+ </g>
+ </g>
+ </g>
+ <linearGradient
+ y2="82.428001"
+ x2="101.62"
+ y1="82.064499"
+ x1="30.5054"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3569">
+ <stop
+ id="stop3571"
+ style="stop-color:rgb(255,255,255)"
+ offset="0.0337" />
+ <stop
+ id="stop3573"
+ style="stop-color:rgb(171,171,171)"
+ offset="1" />
+ </linearGradient>
+ <path
+ id="path2711"
+ style="fill:url(#linearGradient4038)"
+ d="M 29.458,106.97 L 89.032,106.97 L 89.032,57.453 L 29.458,57.453 L 29.458,106.97 z" />
+ <linearGradient
+ y2="100.333"
+ x2="83.369102"
+ y1="54.6782"
+ x1="37.715302"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3576">
+ <stop
+ id="stop3578"
+ style="stop-color:rgb(158,158,158)"
+ offset="0" />
+ <stop
+ id="stop3580"
+ style="stop-color:rgb(97,97,97)"
+ offset="1" />
+ </linearGradient>
+ <path
+ id="path2718"
+ style="opacity:0.7;fill:url(#linearGradient4040)"
+ d="M 87.977,82.43 L 87.977,69.531 L 29.804,69.531 L 29.804,105.445 L 124.144,105.445 L 124.144,82.43 L 87.977,82.43 z" />
+ <path
+ id="path2720"
+ style="opacity:0.5;fill:#ffffff"
+ d="M 54.489,69.416 L 53.752,69.416 L 53.752,105.397 L 54.489,105.397 L 54.489,69.416 z" />
+ <linearGradient
+ y2="90.118896"
+ x2="55.990799"
+ y1="77.249001"
+ x1="43.121101"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3584">
+ <stop
+ id="stop3586"
+ style="stop-color:rgb(158,158,158)"
+ offset="0" />
+ <stop
+ id="stop3588"
+ style="stop-color:rgb(97,97,97)"
+ offset="1" />
+ </linearGradient>
+ <path
+ id="path2727"
+ style="opacity:0.7;fill:url(#linearGradient4042)"
+ d="M 53.647,69.416 L 52.91,69.416 L 52.91,105.397 L 53.647,105.397 L 53.647,69.416 z" />
+ <path
+ id="path2729"
+ style="opacity:0.5;fill:#ffffff"
+ d="M 124.837,106.955 L 124.837,106.218 L 29.455,106.218 L 29.455,106.955 L 124.837,106.955 z" />
+ <linearGradient
+ gradientTransform="matrix(0,1,-1,0,-256.622,-352.346)"
+ y2="-326.67001"
+ x2="465.18799"
+ y1="-360.35999"
+ x1="431.49799"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3592">
+ <stop
+ id="stop3594"
+ style="stop-color:rgb(158,158,158)"
+ offset="0" />
+ <stop
+ id="stop3596"
+ style="stop-color:rgb(97,97,97)"
+ offset="1" />
+ </linearGradient>
+ <path
+ id="path2736"
+ style="opacity:0.7;fill:url(#linearGradient4044)"
+ d="M 124.837,106.112 L 124.837,105.375 L 29.455,105.375 L 29.455,106.112 L 124.837,106.112 z" />
+ <g
+ id="g2738">
+ <linearGradient
+ y2="105.281"
+ x2="108.682"
+ y1="68.8125"
+ x1="75.553703"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3600">
+ <stop
+ id="stop3602"
+ style="stop-color:rgb(255,255,255)"
+ offset="0.0337" />
+ <stop
+ id="stop3604"
+ style="stop-color:rgb(171,171,171)"
+ offset="1" />
+ </linearGradient>
+ <path
+ id="path2745"
+ style="fill:url(#linearGradient4046)"
+ d="M 112.278,82.032 C 112.278,95.682 101.214,106.749 87.561,106.749 C 73.911,106.749 62.845,95.683 62.845,82.032 C 62.845,68.381 73.911,57.314 87.561,57.314 C 101.214,57.314 112.278,68.381 112.278,82.032 z" />
+ <linearGradient
+ y2="64.263496"
+ x2="87.561501"
+ y1="111.869"
+ x1="87.561501"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3607">
+ <stop
+ id="stop3609"
+ style="stop-color:rgb(158,158,158)"
+ offset="0" />
+ <stop
+ id="stop3611"
+ style="stop-color:rgb(97,97,97)"
+ offset="1" />
+ </linearGradient>
+ <path
+ id="path2752"
+ style="fill:url(#linearGradient4048)"
+ d="M 62.635,82.032 C 62.635,95.776 73.817,106.959 87.562,106.959 C 101.306,106.959 112.489,95.776 112.489,82.032 C 112.489,68.287 101.306,57.104 87.562,57.104 C 73.816,57.104 62.635,68.287 62.635,82.032 z M 63.056,82.032 C 63.056,68.518 74.049,57.525 87.562,57.525 C 101.075,57.525 112.068,68.519 112.068,82.032 C 112.068,95.545 101.075,106.538 87.562,106.538 C 74.049,106.538 63.056,95.545 63.056,82.032 z" />
+ <linearGradient
+ y2="82.155403"
+ x2="111.821"
+ y1="81.947304"
+ x1="71.107399"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3614">
+ <stop
+ id="stop3616"
+ style="stop-color:rgb(255,255,255)"
+ offset="0.0337" />
+ <stop
+ id="stop3618"
+ style="stop-color:rgb(171,171,171)"
+ offset="1" />
+ <a:midPointStop
+ style="stop-color:#FFFFFF"
+ offset="0.0337" />
+ <a:midPointStop
+ style="stop-color:#FFFFFF"
+ offset="0.5" />
+ <a:midPointStop
+ style="stop-color:#ABABAB"
+ offset="1" />
+ </linearGradient>
+ <path
+ id="path2759"
+ style="fill:url(#linearGradient4050)"
+ d="M 104.687,82.032 C 104.687,91.49 97.02,99.156 87.562,99.156 C 78.104,99.156 70.436,91.49 70.436,82.032 C 70.436,72.573 78.104,64.907 87.562,64.907 C 97.02,64.907 104.687,72.573 104.687,82.032 z" />
+ <linearGradient
+ y2="69.688904"
+ x2="87.561501"
+ y1="102.759"
+ x1="87.561501"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3621">
+ <stop
+ id="stop3623"
+ style="stop-color:rgb(158,158,158)"
+ offset="0" />
+ <stop
+ id="stop3625"
+ style="stop-color:rgb(97,97,97)"
+ offset="1" />
+ </linearGradient>
+ <path
+ id="path2766"
+ style="fill:url(#linearGradient4052)"
+ d="M 70.246,82.032 C 70.246,91.58 78.014,99.347 87.561,99.347 C 97.11,99.347 104.876,91.579 104.876,82.032 C 104.876,72.483 97.109,64.716 87.561,64.716 C 78.014,64.716 70.246,72.483 70.246,82.032 z M 70.628,82.032 C 70.628,72.694 78.225,65.096 87.562,65.096 C 96.9,65.096 104.496,72.694 104.496,82.032 C 104.496,91.37 96.9,98.966 87.562,98.966 C 78.225,98.966 70.628,91.37 70.628,82.032 z" />
+ <linearGradient
+ y2="80.375298"
+ x2="89.966499"
+ y1="95.804703"
+ x1="67.565399"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3628">
+ <stop
+ id="stop3630"
+ style="stop-color:rgb(255,255,255)"
+ offset="0.0337" />
+ <stop
+ id="stop3632"
+ style="stop-color:rgb(153,153,153)"
+ offset="1" />
+ </linearGradient>
+ <path
+ id="path2773"
+ style="fill:url(#linearGradient4054)"
+ d="M 102.649,82.032 C 102.649,90.365 95.894,97.119 87.561,97.119 C 79.228,97.119 72.474,90.365 72.474,82.032 C 72.474,73.698 79.228,66.944 87.561,66.944 C 95.894,66.944 102.649,73.698 102.649,82.032 z" />
+ <linearGradient
+ y2="82.123001"
+ x2="105.431"
+ y1="81.969704"
+ x1="75.442398"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3635">
+ <stop
+ id="stop3637"
+ style="stop-color:rgb(255,255,255)"
+ offset="0.0337" />
+ <stop
+ id="stop3639"
+ style="stop-color:rgb(171,171,171)"
+ offset="1" />
+ </linearGradient>
+ <path
+ id="path2780"
+ style="fill:url(#linearGradient4056)"
+ d="M 100.176,82.032 C 100.176,88.999 94.529,94.646 87.562,94.646 C 80.596,94.646 74.948,88.999 74.948,82.032 C 74.948,75.065 80.596,69.417 87.562,69.417 C 94.528,69.417 100.176,75.065 100.176,82.032 z" />
+ <linearGradient
+ y2="84.569901"
+ x2="87.560501"
+ y1="98.801804"
+ x1="87.560501"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3642">
+ <stop
+ id="stop3644"
+ style="stop-color:rgb(255,255,255)"
+ offset="0.1685" />
+ <stop
+ id="stop3646"
+ style="stop-color:rgb(54,54,54)"
+ offset="1" />
+ <a:midPointStop
+ style="stop-color:#FFFFFF"
+ offset="0.1685" />
+ <a:midPointStop
+ style="stop-color:#FFFFFF"
+ offset="0.5" />
+ <a:midPointStop
+ style="stop-color:#363636"
+ offset="1" />
+ </linearGradient>
+ <path
+ id="path2787"
+ style="fill:url(#linearGradient4058)"
+ d="M 97.999,82.032 C 97.999,87.798 93.328,92.47 87.561,92.47 C 81.795,92.47 77.123,87.798 77.123,82.032 C 77.123,76.266 81.796,71.593 87.561,71.593 C 93.328,71.593 97.999,76.267 97.999,82.032 z" />
+ <linearGradient
+ y2="84.349197"
+ x2="87.561501"
+ y1="97.340797"
+ x1="87.561501"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3649">
+ <stop
+ id="stop3651"
+ style="stop-color:rgb(255,255,255)"
+ offset="4.5977%" />
+ <stop
+ id="stop3653"
+ style="stop-opacity:0;stop-color:rgb(255,255,255)"
+ offset="100%" />
+ </linearGradient>
+ <path
+ id="path2794"
+ style="fill:url(#linearGradient4060)"
+ d="M 97.09,82.032 C 97.09,87.295 92.826,91.56 87.562,91.56 C 82.298,91.56 78.034,87.294 78.034,82.032 C 78.034,76.768 82.299,72.503 87.562,72.503 C 92.826,72.503 97.09,76.769 97.09,82.032 z" />
+ <g
+ id="g2796">
+ <radialGradient
+ gradientUnits="userSpaceOnUse"
+ fy="88.976601"
+ fx="87.766602"
+ r="11.4148"
+ cy="88.976601"
+ cx="87.766602"
+ id="radialGradient3657">
+ <stop
+ id="stop3659"
+ style="stop-color:rgb(187,235,255)"
+ offset="0" />
+ <stop
+ id="stop3661"
+ style="stop-color:rgb(0,61,215)"
+ offset="1" />
+ <a:midPointStop
+ style="stop-color:#BBEBFF"
+ offset="0" />
+ <a:midPointStop
+ style="stop-color:#BBEBFF"
+ offset="0.5" />
+ <a:midPointStop
+ style="stop-color:#003DD7"
+ offset="1" />
+ </radialGradient>
+ <path
+ id="path2803"
+ style="fill:url(#radialGradient4062)"
+ d="M 93.685,82.032 C 93.685,85.414 90.944,88.155 87.561,88.155 C 84.181,88.155 81.437,85.414 81.437,82.032 C 81.437,78.649 84.181,75.908 87.561,75.908 C 90.943,75.908 93.685,78.649 93.685,82.032 z" />
+ <linearGradient
+ y2="82.084198"
+ x2="87.5625"
+ y1="75.327103"
+ x1="87.5625"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3664">
+ <stop
+ id="stop3666"
+ style="stop-color:rgb(255,255,255)"
+ offset="7.47126%" />
+ <stop
+ id="stop3668"
+ style="stop-opacity:0;stop-color:rgb(255,255,255)"
+ offset="100%" />
+ </linearGradient>
+ <path
+ id="path2810"
+ style="fill:url(#linearGradient4064)"
+ d="M 92.081,79.905 C 92.081,81.911 90.057,83.537 87.56,83.537 C 85.065,83.537 83.042,81.911 83.042,79.905 C 83.042,77.898 85.064,76.271 87.56,76.271 C 90.057,76.271 92.081,77.898 92.081,79.905 z"
+ a:adobe-blending-mode="screen" />
+ </g>
+ </g>
+ <linearGradient
+ y2="130.181"
+ x2="120.423"
+ y1="68.1436"
+ x1="64.068398"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3671">
+ <stop
+ id="stop3673"
+ style="stop-color:rgb(255,255,255)"
+ offset="0.0337" />
+ <stop
+ id="stop3675"
+ style="stop-color:rgb(135,135,135)"
+ offset="1" />
+ </linearGradient>
+ <path
+ id="path2817"
+ style="opacity:0.5;fill:url(#linearGradient4066)"
+ d="M 121.345,51.624 C 121.482,52.064 121.556,52.531 121.556,53.018 L 121.556,105.733 C 121.556,108.324 119.456,110.424 116.865,110.424 L 31.022,110.424 C 30.537,110.424 30.07,110.35 29.629,110.214 C 30.223,112.124 32.004,113.511 34.11,113.511 L 119.95,113.511 C 122.543,113.511 124.642,111.411 124.642,108.82 L 124.642,56.104 C 124.644,53.999 123.257,52.216 121.345,51.624 z"
+ a:adobe-blending-mode="multiply" />
+ <linearGradient
+ y2="126.982"
+ x2="76.830101"
+ y1="57.847698"
+ x1="76.830101"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3678">
+ <stop
+ id="stop3680"
+ style="stop-color:rgb(255,255,255)"
+ offset="4.02299%" />
+ <stop
+ id="stop3682"
+ style="stop-opacity:0;stop-color:rgb(255,255,255)"
+ offset="100%" />
+ </linearGradient>
+ <path
+ id="path2824"
+ style="fill:url(#linearGradient4068)"
+ d="M 31.807,61.8 C 31.807,59.21 33.907,57.109 36.498,57.109 L 78.5,57.109 C 79.092,55.197 80.853,53.8 82.96,53.8 L 122.339,53.8 C 123.016,53.8 123.657,53.945 124.239,54.203 C 123.51,52.561 121.866,51.413 119.951,51.413 L 80.573,51.413 C 78.465,51.413 76.706,52.81 76.113,54.723 L 34.111,54.723 C 31.52,54.723 29.42,56.824 29.42,59.415 L 29.42,108.819 C 29.42,110.734 30.568,112.378 32.212,113.106 C 31.953,112.525 31.807,111.882 31.807,111.207 L 31.807,61.8 z"
+ a:adobe-blending-mode="screen" />
+ <linearGradient
+ y2="60.029999"
+ x2="77.031303"
+ y1="120.132"
+ x1="77.031303"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient3685">
+ <stop
+ id="stop3687"
+ style="stop-color:rgb(158,158,158)"
+ offset="0" />
+ <stop
+ id="stop3689"
+ style="stop-color:rgb(97,97,97)"
+ offset="1" />
+ <a:midPointStop
+ style="stop-color:#9E9E9E"
+ offset="0" />
+ <a:midPointStop
+ style="stop-color:#9E9E9E"
+ offset="0.5" />
+ <a:midPointStop
+ style="stop-color:#616161"
+ offset="1" />
+ </linearGradient>
+ <path
+ id="path2831"
+ style="fill:url(#linearGradient4070)"
+ d="M 80.573,50.992 C 78.445,50.992 76.612,52.323 75.857,54.302 C 75.351,54.302 34.11,54.302 34.11,54.302 C 31.292,54.302 28.998,56.595 28.998,59.416 L 28.998,108.82 C 28.998,111.64 31.291,113.933 34.11,113.933 L 119.95,113.933 C 122.77,113.933 125.063,111.64 125.063,108.82 L 125.063,56.104 C 125.063,53.285 122.77,50.992 119.95,50.992 L 80.573,50.992 z M 29.841,108.819 L 29.841,59.415 C 29.841,57.06 31.757,55.144 34.111,55.144 L 76.425,55.144 L 76.517,54.848 C 77.075,53.046 78.705,51.834 80.574,51.834 L 119.952,51.834 C 122.308,51.834 124.223,53.751 124.223,56.105 L 124.223,108.82 C 124.223,111.175 122.309,113.091 119.952,113.091 L 34.112,113.091 C 31.757,113.091 29.841,111.175 29.841,108.819 z" />
+ </g>
+ <path
+ sodipodi:type="star"
+ style="fill:#ffff00;fill-opacity:0.87121217;stroke:none;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path3750"
+ sodipodi:sides="5"
+ sodipodi:cx="581.24176"
+ sodipodi:cy="291.70145"
+ sodipodi:r1="139.80701"
+ sodipodi:r2="72.924916"
+ sodipodi:arg1="0.67790049"
+ sodipodi:arg2="1.306219"
+ inkscape:flatsided="false"
+ inkscape:rounded="0"
+ inkscape:randomized="0"
+ d="M 690.1362,379.38269 L 600.31172,362.08881 L 531.50218,422.36121 L 520.19235,331.58895 L 441.60657,284.77238 L 524.44119,245.96592 L 544.68205,156.75929 L 607.18649,223.54783 L 698.28181,215.23167 L 654.07706,295.31573 L 690.1362,379.38269 z"
+ transform="translate(7.0710115,-4.2372125e-6)" />
+ </g>
+ </g>
+</svg>
diff --git a/navit/xpm/telephone.xpm b/xpm/telephone.xpm
index c788ef8c..c788ef8c 100644
--- a/navit/xpm/telephone.xpm
+++ b/xpm/telephone.xpm
diff --git a/navit/xpm/theater.xpm b/xpm/theater.xpm
index 9581bc70..9581bc70 100644
--- a/navit/xpm/theater.xpm
+++ b/xpm/theater.xpm
diff --git a/xpm/toggle_fullscreen.xpm b/xpm/toggle_fullscreen.xpm
new file mode 100644
index 00000000..9860e2a1
--- /dev/null
+++ b/xpm/toggle_fullscreen.xpm
@@ -0,0 +1,101 @@
+/* XPM */
+static char *dummy[]={
+"96 96 2 1",
+". c None",
+"# c #808080",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"........................######################..................................................",
+"........................#######################.................................................",
+"........................#######################.................................................",
+"........................#######################.................................................",
+"........................#######################.................................................",
+"........................######################..................................................",
+"........................######..................................................................",
+"........................######..................................................................",
+"........................######..................................................................",
+"........................######..................................................................",
+"........................######..................................................................",
+"........................######..................................................................",
+"........................######..................................................................",
+"........................######..................................................................",
+"........................######..................................................................",
+"........................######..................................................................",
+"........................######..................................................................",
+"........................######..................................................................",
+"........................######..................................................................",
+"........................######..................................................................",
+"........................######..................................................................",
+"........................######..................................................................",
+".........................####...................................................................",
+"................................................................................................",
+"................................................................................................",
+"...................................................................####.........................",
+"..................................................................######........................",
+"..................................................................######........................",
+"..................................................................######........................",
+"..................................................................######........................",
+"..................................................................######........................",
+"..................................................................######........................",
+"..................................................................######........................",
+"..................................................................######........................",
+"..................................................................######........................",
+"..................................................................######........................",
+"..................................................................######........................",
+"..................................................................######........................",
+"..................................................................######........................",
+"..................................................................######........................",
+"..................................................................######........................",
+"..................................................................######........................",
+"..................................................######################........................",
+".................................................#######################........................",
+".................................................#######################........................",
+".................................................#######################........................",
+".................................................#######################........................",
+"..................................................######################........................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................"};
diff --git a/xpm/toilets.xpm b/xpm/toilets.xpm
new file mode 100644
index 00000000..4bad2151
--- /dev/null
+++ b/xpm/toilets.xpm
@@ -0,0 +1,21 @@
+/* XPM */
+static char *dummy[]={
+"16 16 2 1",
+". c None",
+"# c #000000",
+"................",
+"...#...##...#...",
+"..###..##..###..",
+"...#...##...#...",
+"..###..##.####..",
+".#####.##.#####.",
+".#####.##.#####.",
+".#####.##.#####.",
+"#########.#####.",
+".#####.##..###..",
+"..###..##..###..",
+"..###..##..###..",
+"..###..##..###..",
+"..###..##..###..",
+".......##..#....",
+"................"};
diff --git a/navit/xpm/tower.xpm b/xpm/tower.xpm
index 2bf27687..2bf27687 100644
--- a/navit/xpm/tower.xpm
+++ b/xpm/tower.xpm
diff --git a/navit/xpm/townhall.xpm b/xpm/townhall.xpm
index 150b26f9..150b26f9 100644
--- a/navit/xpm/townhall.xpm
+++ b/xpm/townhall.xpm
diff --git a/xpm/traffic_signals.svg b/xpm/traffic_signals.svg
new file mode 100644
index 00000000..35124e9a
--- /dev/null
+++ b/xpm/traffic_signals.svg
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="22"
+ height="22"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ version="1.0"
+ sodipodi:docname="traffic_signals.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/jeff/navit/icons/png/traffic_signals.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#f4ca00"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="11.313709"
+ inkscape:cx="6.2037362"
+ inkscape:cy="9.8911434"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:window-width="1024"
+ inkscape:window-height="699"
+ inkscape:window-x="0"
+ inkscape:window-y="25">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2380"
+ visible="true"
+ enabled="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="M 4.901204,4 L 17.098796,3.9133216 L 15.452349,8.2443505 L 6.4592622,8.3327388 L 4.901204,4 z"
+ id="rect3158"
+ sodipodi:nodetypes="ccccc" />
+ <rect
+ style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect2386"
+ width="9.1039991"
+ height="19.003494"
+ x="6.4480004"
+ y="2.1126227"
+ rx="2"
+ ry="2" />
+ <use
+ x="0"
+ y="0"
+ xlink:href="#rect3158"
+ id="use3161"
+ transform="translate(0,5)"
+ width="22"
+ height="22" />
+ <use
+ x="0"
+ y="0"
+ xlink:href="#use3161"
+ id="use3163"
+ transform="translate(0,5.1438447)"
+ width="22"
+ height="22" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#f30000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3169"
+ sodipodi:cx="11.004349"
+ sodipodi:cy="7.4601173"
+ sodipodi:rx="2.8726211"
+ sodipodi:ry="2.8726211"
+ d="M 13.87697,7.4601173 A 2.8726211,2.8726211 0 1 1 8.1317277,7.4601173 A 2.8726211,2.8726211 0 1 1 13.87697,7.4601173 z"
+ transform="matrix(0.9692308,0,0,0.9692308,0.3342463,-0.7427297)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#f3ea00;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3175"
+ sodipodi:cx="11.004349"
+ sodipodi:cy="7.4601173"
+ sodipodi:rx="2.8726211"
+ sodipodi:ry="2.8726211"
+ d="M 13.87697,7.4601173 A 2.8726211,2.8726211 0 1 1 8.1317277,7.4601173 A 2.8726211,2.8726211 0 1 1 13.87697,7.4601173 z"
+ transform="matrix(0.9692308,0,0,0.9692308,0.3342463,4.8153286)" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#47b400;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="path3177"
+ sodipodi:cx="11.004349"
+ sodipodi:cy="7.4601173"
+ sodipodi:rx="2.8726211"
+ sodipodi:ry="2.8726211"
+ d="M 13.87697,7.4601173 A 2.8726211,2.8726211 0 1 1 8.1317277,7.4601173 A 2.8726211,2.8726211 0 1 1 13.87697,7.4601173 z"
+ transform="matrix(0.9692308,0,0,0.9692308,0.3342463,10.373387)" />
+ </g>
+</svg>
diff --git a/navit/xpm/traffic_signals.xpm b/xpm/traffic_signals.xpm
index e9856795..e9856795 100644
--- a/navit/xpm/traffic_signals.xpm
+++ b/xpm/traffic_signals.xpm
diff --git a/navit/xpm/trailerpark.xpm b/xpm/trailerpark.xpm
index 6864ea8f..6864ea8f 100644
--- a/navit/xpm/trailerpark.xpm
+++ b/xpm/trailerpark.xpm
diff --git a/navit/xpm/unknown.xpm b/xpm/unknown.xpm
index 8f6835f2..8f6835f2 100644
--- a/navit/xpm/unknown.xpm
+++ b/xpm/unknown.xpm
diff --git a/xpm/viewpoint.xpm b/xpm/viewpoint.xpm
new file mode 100644
index 00000000..5a872197
--- /dev/null
+++ b/xpm/viewpoint.xpm
@@ -0,0 +1,21 @@
+/* XPM */
+static char *dummy[]={
+"16 16 2 1",
+". c None",
+"# c #0000ff",
+"..#...####...#..",
+".###..####..###.",
+"####...##...####",
+".####..##..####.",
+"...###.##.###...",
+"....##....##....",
+"##............##",
+"#####......#####",
+"#####......#####",
+"##............##",
+"....##....##....",
+"...###.##.###...",
+".####..##..####.",
+"####...##...####",
+".###..####..###.",
+"..#...####...#.."};
diff --git a/xpm/wifi.xpm b/xpm/wifi.xpm
new file mode 100644
index 00000000..63be9bcd
--- /dev/null
+++ b/xpm/wifi.xpm
@@ -0,0 +1,21 @@
+/* XPM */
+static char * wifi_xpm[] = {
+"13 15 3 1",
+" c None",
+". c #0000FF",
+"+ c #000000",
+" ..... ",
+" . . ",
+" . ... . ",
+" . . . . ",
+". . . .",
+". . +++ . .",
+". . +++ . .",
+". . +++ . .",
+". . + . .",
+" . . + . ..",
+" . + . ",
+" .. + .. ",
+" + ",
+" + ",
+" "};
diff --git a/xpm/zoo.xpm b/xpm/zoo.xpm
new file mode 100644
index 00000000..27d72601
--- /dev/null
+++ b/xpm/zoo.xpm
@@ -0,0 +1,83 @@
+/* XPM */
+static char *dummy[]={
+"16 16 64 1",
+". c None",
+"h c #000000",
+"n c #010101",
+"V c #020202",
+"r c #040404",
+"b c #050505",
+"P c #060606",
+"j c #070707",
+"0 c #080808",
+"s c #1b1b1b",
+"4 c #1e1e1e",
+"3 c #202020",
+"x c #262626",
+"# c #272727",
+"N c #292929",
+"M c #313131",
+"o c #343434",
+"8 c #373737",
+"W c #383838",
+"i c #434343",
+"A c #484848",
+"Q c #515151",
+"G c #535353",
+"6 c #555555",
+"H c #585858",
+"t c #5d5d5d",
+"2 c #5f5f5f",
+"y c #606060",
+"g c #6a6a6a",
+"L c #6e6e6e",
+"X c #707070",
+"c c #717171",
+"J c #7b7b7b",
+"Z c #7c7c7c",
+"1 c #808080",
+"7 c #838383",
+"5 c #848484",
+"q c #8c8c8c",
+"l c #949494",
+"m c #969696",
+"z c #9a9a9a",
+"K c #9c9c9c",
+"E c #9f9f9f",
+"u c #a2a2a2",
+"I c #a3a3a3",
+"D c #acacac",
+"B c #b6b6b6",
+"9 c #bfbfbf",
+"d c #c7c7c7",
+"O c #c9c9c9",
+"w c #cdcdcd",
+"U c #d3d3d3",
+"Y c #d4d4d4",
+"S c #d8d8d8",
+"F c #e6e6e6",
+"T c #f0f0f0",
+"C c #f4f4f4",
+"a c #f5f5f5",
+"p c #f6f6f6",
+"v c #f7f7f7",
+"k c #fbfbfb",
+"f c #fdfdfd",
+"R c #fefefe",
+"e c #ffffff",
+"................",
+".....#a.........",
+"....bcdeeef.....",
+"...ghijkeelh....",
+"..mnhmopeeqrs...",
+"..thhuveeefwx...",
+"..yhhzeeeeeeA...",
+"..yhhBCDeEFeG...",
+"..HhhIJDeKLeMN..",
+"..OPhQRaSTRUVh..",
+"...WhhXYZTm0hh..",
+"..12hhh3ccNhhhh.",
+"..h4hhhnlR5hhh..",
+"..hhhhh6.78hhh..",
+"...9hhhh.hhhhh..",
+"....hhhh........"};
diff --git a/xpm/zoom_in.svg b/xpm/zoom_in.svg
new file mode 100644
index 00000000..694b0784
--- /dev/null
+++ b/xpm/zoom_in.svg
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48"
+ height="48"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="/home/ce/Desktop/NavitIcons"
+ sodipodi:docname="zoom_in.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/ce/Desktop/NavitIcons/bench.png"
+ inkscape:export-xdpi="40.180466"
+ inkscape:export-ydpi="40.180466"
+ version="1.0">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="7.919596"
+ inkscape:cx="52.343367"
+ inkscape:cy="14.64192"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:window-width="1680"
+ inkscape:window-height="968"
+ inkscape:window-x="0"
+ inkscape:window-y="25"
+ width="48px"
+ height="48px"
+ showguides="true" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ id="path2178"
+ style="fill:none;fill-rule:evenodd;stroke:#808080;stroke-width:6.81732273;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:0.50196081;marker-start:none"
+ d="M 4.9419638,23.809848 C 43.591118,23.809848 43.591118,23.809848 43.591118,23.809848M 24.027063,43.134425 L 24.027063,4.4852709" />
+ </g>
+</svg>
diff --git a/xpm/zoom_in.xpm b/xpm/zoom_in.xpm
new file mode 100644
index 00000000..87d09b89
--- /dev/null
+++ b/xpm/zoom_in.xpm
@@ -0,0 +1,102 @@
+/* XPM */
+static char *dummy[]={
+"96 96 3 1",
+"# c None",
+". c #0000ff",
+"a c #808080",
+".###############################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"##############################################aaaa##############################################",
+"#############################################aaaaa##############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"##########################aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa##########################",
+"#########################aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa#########################",
+"#########################aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa#########################",
+"#########################aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa#########################",
+"#########################aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa#########################",
+"##########################aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa##########################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaaa#############################################",
+"#############################################aaaaa##############################################",
+"##############################################aaaa##############################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################",
+"################################################################################################"};
diff --git a/xpm/zoom_out.svg b/xpm/zoom_out.svg
new file mode 100644
index 00000000..e9f5a635
--- /dev/null
+++ b/xpm/zoom_out.svg
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48"
+ height="48"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="/home/ce/Desktop/NavitIcons"
+ sodipodi:docname="zoom_out.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/ce/Desktop/NavitIcons/bench.png"
+ inkscape:export-xdpi="40.180466"
+ inkscape:export-ydpi="40.180466"
+ version="1.0">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="7.919596"
+ inkscape:cx="52.343367"
+ inkscape:cy="14.64192"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:window-width="1680"
+ inkscape:window-height="968"
+ inkscape:window-x="0"
+ inkscape:window-y="25"
+ width="48px"
+ height="48px"
+ showguides="true" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#808080;stroke-width:6.77128935;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.50196078"
+ d="M 5.2261304,23.757614 L 41.745663,23.757614"
+ id="path2158" />
+ </g>
+</svg>
diff --git a/xpm/zoom_out.xpm b/xpm/zoom_out.xpm
new file mode 100644
index 00000000..a333d39f
--- /dev/null
+++ b/xpm/zoom_out.xpm
@@ -0,0 +1,101 @@
+/* XPM */
+static char *dummy[]={
+"96 96 2 1",
+". c None",
+"# c #808080",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"..........................############################################..........................",
+".........................##############################################.........................",
+".........................##############################################.........................",
+".........................##############################################.........................",
+".........................##############################################.........................",
+"..........................############################################..........................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................",
+"................................................................................................"};
diff --git a/zipfile.h b/zipfile.h
new file mode 100644
index 00000000..288d6834
--- /dev/null
+++ b/zipfile.h
@@ -0,0 +1,89 @@
+/**
+ * Navit, a modular navigation system.
+ * Copyright (C) 2005-2008 Navit Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __ZIPFILE_H__
+#ifdef HAVE_API_WIN32_CE
+#warning OK
+/* cegcc doesn't honor the __attribute__(packed) need pragma to work */
+#pragma pack(push)
+#pragma pack(1)
+#endif
+
+#define zip_lfh_sig 0x04034b50
+
+struct zip_lfh {
+ int ziplocsig;
+ short zipver;
+ short zipgenfld;
+ short zipmthd;
+ short ziptime;
+ short zipdate;
+ int zipcrc;
+ unsigned int zipsize;
+ unsigned int zipuncmp;
+ unsigned short zipfnln;
+ unsigned short zipxtraln;
+ char zipname[0];
+} __attribute__ ((packed));
+
+#define zip_cd_sig 0x02014b50
+
+struct zip_cd {
+ int zipcensig;
+ char zipcver;
+ char zipcos;
+ char zipcvxt;
+ char zipcexos;
+ short zipcflg;
+ short zipcmthd;
+ short ziptim;
+ short zipdat;
+ int zipccrc;
+ unsigned int zipcsiz;
+ unsigned int zipcunc;
+ unsigned short zipcfnl;
+ unsigned short zipcxtl;
+ unsigned short zipccml;
+ unsigned short zipdsk;
+ unsigned short zipint;
+ unsigned int zipext;
+ unsigned int zipofst;
+ char zipcfn[0];
+} __attribute__ ((packed));
+
+#define zip_eoc_sig 0x6054b50
+
+struct zip_eoc {
+ int zipesig;
+ unsigned short zipedsk;
+ unsigned short zipecen;
+ unsigned short zipenum;
+ unsigned short zipecenn;
+ unsigned int zipecsz;
+ unsigned int zipeofst;
+ short zipecoml;
+ char zipecom[0];
+} __attribute__ ((packed));
+
+#define __ZIPFILE_H__
+#ifdef __CEGCC__
+#pragma pack(pop)
+#endif
+
+#endif