Fix:projs/CodeBlocks:update project files
authorafaber <afaber@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 24 Jan 2008 20:45:26 +0000 (20:45 +0000)
committerafaber <afaber@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 24 Jan 2008 20:45:26 +0000 (20:45 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@806 ffa7fe5e-494d-0410-b361-a75ebd5db220

16 files changed:
navit/projs/CodeBlocks/Navit.cbp
navit/projs/CodeBlocks/Navit.workspace
navit/projs/CodeBlocks/NavitCore.cbp [new file with mode: 0644]
navit/projs/CodeBlocks/Osm2Navit.cbp
navit/projs/CodeBlocks/Win32Extra/builtin.c
navit/projs/CodeBlocks/binfile.cbp
navit/projs/CodeBlocks/data_garmin.cbp
navit/projs/CodeBlocks/data_garmin_img.cbp
navit/projs/CodeBlocks/data_mg.cbp
navit/projs/CodeBlocks/data_poi_geodownload.cbp
navit/projs/CodeBlocks/vehicle_demo.cbp
navit/projs/CodeBlocks/vehicle_file.cbp
navit/projs/CodeBlocks/win32gui/win32_graphics.c [new file with mode: 0644]
navit/projs/CodeBlocks/win32gui/win32_gui.c [new file with mode: 0644]
navit/projs/CodeBlocks/win32gui/win32_gui.h [new file with mode: 0644]
navit/projs/CodeBlocks/win32gui/window.c [new file with mode: 0644]

index 926ce91..5c3812c 100644 (file)
@@ -9,6 +9,7 @@
                        <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" />
                                <Option type="1" />
                                <Option compiler="gcc" />
                                <Option use_console_runner="0" />
                                        <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" />
@@ -68,6 +71,7 @@
                                        <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" />
                </Compiler>
                <Linker>
                        <Add directory="%GTK_DIR%\lib" />
-                       <Add directory="D:\msys\1.10\freetype-2.3.5\objs\.libs" />
                </Linker>
                <Unit filename="Win32Extra\builtin.c">
                        <Option compilerVar="CC" />
index 5c086d4..0ef7ec3 100644 (file)
@@ -1,38 +1,42 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
 <CodeBlocks_workspace_file>
        <Workspace title="Navit">
+               <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="gtk_gui.cbp" />
+               <Project filename="gtk_graphics.cbp" />
+               <Project filename="gtk_gl_ext.cbp" />
+               <Project filename="vehicle_file.cbp" />
+               <Project filename="vehicle_demo.cbp" />
+               <Project filename="speech_speech_dispatcher.cbp" />
                <Project filename="binfile.cbp" />
-               <Project filename="data_mg.cbp" />
+               <Project filename="data_poi_geodownload.cbp" />
                <Project filename="data_garmin.cbp">
                        <Depends filename="gentypes.cbp" />
                </Project>
-               <Project filename="mdb.cbp" />
-               <Project filename="data_poi_geodownload.cbp" />
-               <Project filename="vehicle_demo.cbp" />
-               <Project filename="vehicle_file.cbp" />
-               <Project filename="gtk_gui.cbp" />
-               <Project filename="gtk_graphics.cbp" />
                <Project filename="Navit.cbp" active="1">
+                       <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="binfile.cbp" />
-                       <Depends filename="data_mg.cbp" />
-                       <Depends filename="data_garmin.cbp" />
                        <Depends filename="mdb.cbp" />
-                       <Depends filename="data_poi_geodownload.cbp" />
-                       <Depends filename="vehicle_demo.cbp" />
-                       <Depends filename="vehicle_file.cbp" />
                        <Depends filename="gtk_gui.cbp" />
                        <Depends filename="gtk_graphics.cbp" />
+                       <Depends filename="gtk_gl_ext.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_garmin.cbp" />
+                       <Depends filename="data_mg.cbp" />
                </Project>
-               <Project filename="speech_speech_dispatcher.cbp" />
+               <Project filename="data_mg.cbp" />
        </Workspace>
 </CodeBlocks_workspace_file>
diff --git a/navit/projs/CodeBlocks/NavitCore.cbp b/navit/projs/CodeBlocks/NavitCore.cbp
new file mode 100644 (file)
index 0000000..26da9b3
--- /dev/null
@@ -0,0 +1,238 @@
+<?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>
+               </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="..\..\src" />
+                       <Add directory="Win32Extra" />
+                       <Add directory="..\..\src\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="..\..\src\Makefile" />
+               <Unit filename="..\..\src\Makefile.am" />
+               <Unit filename="..\..\src\Makefile.in" />
+               <Unit filename="..\..\src\attr.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\attr.h" />
+               <Unit filename="..\..\src\attr_def.h" />
+               <Unit filename="..\..\src\callback.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\callback.h" />
+               <Unit filename="..\..\src\color.h" />
+               <Unit filename="..\..\src\compass.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\compass.h" />
+               <Unit filename="..\..\src\coord.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\coord.h" />
+               <Unit filename="..\..\src\country.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\country.h" />
+               <Unit filename="..\..\src\cursor.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\cursor.h" />
+               <Unit filename="..\..\src\data.h" />
+               <Unit filename="..\..\src\data_window.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\data_window.h" />
+               <Unit filename="..\..\src\data_window_int.h" />
+               <Unit filename="..\..\src\debug.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\debug.h" />
+               <Unit filename="..\..\src\destination.h" />
+               <Unit filename="..\..\src\draw_info.h" />
+               <Unit filename="..\..\src\file.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\file.h" />
+               <Unit filename="..\..\src\graphics.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\graphics.h" />
+               <Unit filename="..\..\src\gtkext.h" />
+               <Unit filename="..\..\src\gui.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\gui.h" />
+               <Unit filename="..\..\src\gui\gtk\gui_gtk.h" />
+               <Unit filename="..\..\src\item.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\item.h" />
+               <Unit filename="..\..\src\item_def.h" />
+               <Unit filename="..\..\src\layer.h" />
+               <Unit filename="..\..\src\layout.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\layout.h" />
+               <Unit filename="..\..\src\log.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\log.h" />
+               <Unit filename="..\..\src\main.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\main.h" />
+               <Unit filename="..\..\src\map-share.h" />
+               <Unit filename="..\..\src\map.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\map.h" />
+               <Unit filename="..\..\src\map_data.h" />
+               <Unit filename="..\..\src\mapset.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\mapset.h" />
+               <Unit filename="..\..\src\maptype.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\maptype.h" />
+               <Unit filename="..\..\src\menu.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\menu.h" />
+               <Unit filename="..\..\src\navigation.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\navigation.h" />
+               <Unit filename="..\..\src\navit.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\navit.h" />
+               <Unit filename="..\..\src\navit.xml" />
+               <Unit filename="..\..\src\osd.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\osd.h" />
+               <Unit filename="..\..\src\param.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\param.h" />
+               <Unit filename="..\..\src\phrase.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\phrase.h" />
+               <Unit filename="..\..\src\plugin.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\plugin.h" />
+               <Unit filename="..\..\src\plugin_def.h" />
+               <Unit filename="..\..\src\point.h" />
+               <Unit filename="..\..\src\popup.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\popup.h" />
+               <Unit filename="..\..\src\profile.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\profile.h" />
+               <Unit filename="..\..\src\projection.h" />
+               <Unit filename="..\..\src\route.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\route.h" />
+               <Unit filename="..\..\src\search.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\search.h" />
+               <Unit filename="..\..\src\speech.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\speech.h" />
+               <Unit filename="..\..\src\statusbar.h" />
+               <Unit filename="..\..\src\track.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\track.h" />
+               <Unit filename="..\..\src\transform.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\transform.h" />
+               <Unit filename="..\..\src\util.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\util.h" />
+               <Unit filename="..\..\src\vehicle.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\vehicle.h" />
+               <Unit filename="..\..\src\xmlconfig.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="..\..\src\xmlconfig.h" />
+               <Unit filename="..\..\src\zipfile.h" />
+               <Extensions>
+                       <code_completion />
+                       <envvars />
+                       <debugger />
+               </Extensions>
+       </Project>
+</CodeBlocks_project_file>
index e9a00f4..6e6ca03 100644 (file)
@@ -13,7 +13,7 @@
                                <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" />
+                               <Option parameters="--input-file=d:\josm\nld_zuid.osm --attr-debug-level=0 -k ehv3.bin" />
                                <Compiler>
                                        <Add option="-g" />
                                </Compiler>
@@ -50,7 +50,6 @@
                        <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" />
index c2aa095..f2883c7 100644 (file)
@@ -7,12 +7,14 @@ 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();
index ce2afb3..e7a7873 100644 (file)
@@ -45,9 +45,6 @@
                        <Add option="-DMODULE=data_binfile" />
                        <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="..\..\src" />
                </Compiler>
index 016125b..48a233f 100644 (file)
@@ -45,9 +45,6 @@
                        <Add option="-DMODULE=data_garmin" />
                        <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="..\..\src" />
                        <Add directory="." />
index 51baa39..52c5b61 100644 (file)
@@ -45,9 +45,6 @@
                        <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="..\..\" />
-                       <Add directory="..\" />
-                       <Add directory="D:\CB_Projects\Navit\src\" />
                        <Add directory="Win32Extra" />
                        <Add directory="..\..\src" />
                </Compiler>
index edda03a..4db54a5 100644 (file)
                        <Add option="-DMODULE=data_mg" />
                        <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="..\..\src" />
+                       <Add directory="Win32Extra" />
                </Compiler>
                <Linker>
                        <Add library="NavitCommonLib" />
index 5f6ec58..0c6673d 100644 (file)
@@ -45,9 +45,6 @@
                        <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="..\..\" />
-                       <Add directory="..\" />
-                       <Add directory="D:\CB_Projects\Navit\src\" />
                        <Add directory="Win32Extra" />
                        <Add directory="..\..\src" />
                        <Add directory="..\..\src\data\poi_geodownload\libmdb\include" />
index 6700652..fc4ae95 100644 (file)
@@ -45,9 +45,6 @@
                        <Add option="-DMODULE=vehicle_demo" />
                        <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="..\..\src" />
                </Compiler>
index 55c3d04..11d548c 100644 (file)
@@ -45,9 +45,6 @@
                        <Add option="-DMODULE=vehicle_file" />
                        <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="..\..\src" />
                </Compiler>
diff --git a/navit/projs/CodeBlocks/win32gui/win32_graphics.c b/navit/projs/CodeBlocks/win32gui/win32_graphics.c
new file mode 100644 (file)
index 0000000..96eed5c
--- /dev/null
@@ -0,0 +1,414 @@
+#include <windows.h>
+#include <wingdi.h>
+#include <glib.h>
+
+#include "config.h"
+#include "debug.h"
+#include "point.h"
+#include "graphics.h"
+#include "color.h"
+#include "plugin.h"
+
+
+
+
+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 );
+
+    // Display the error message and exit the process
+
+    lpDisplayBuf = (LPVOID)LocalAlloc(LMEM_ZEROINIT,
+        (lstrlen((LPCTSTR)lpMsgBuf)+lstrlen((LPCTSTR)lpszFunction)+40)*sizeof(TCHAR));
+    sprintf((LPTSTR)lpDisplayBuf, TEXT("%s failed with error %d: %s"), lpszFunction, dw, lpMsgBuf);
+
+    printf( "%s\n", lpDisplayBuf );
+    MessageBox(NULL, (LPCTSTR)lpDisplayBuf, TEXT("Error"), MB_OK);
+
+    LocalFree(lpMsgBuf);
+    LocalFree(lpDisplayBuf);
+    ExitProcess(dw);
+}
+
+
+struct graphics_priv {
+       struct point p;
+       int width;
+       int height;
+       int library_init;
+       int visible;
+       HANDLE wnd_parent_handle;
+       HANDLE wnd_handle;
+
+       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 *g_gra;
+
+
+static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
+{
+       switch(Message)
+       {
+               case WM_CREATE:
+               {
+                               g_gra->wnd_handle = hwnd;
+                               //if (g_gra->resize_callback)
+                               //      (*g_gra->resize_callback)(g_gra->resize_callback_data, g_gra->width, g_gra->height);
+                               //MoveWindow( hwnd, 0,0, 780, 680, TRUE );
+               }
+               break;
+               case WM_COMMAND:
+                       switch(LOWORD(wParam))
+                       {
+                       }
+               break;
+               case WM_CLOSE:
+                       DestroyWindow(hwnd);
+               break;
+               case WM_LBUTTONDBLCLK:
+                               if (g_gra->resize_callback)
+                                       (*g_gra->resize_callback)(g_gra->resize_callback_data, g_gra->width, g_gra->height);
+               break;
+               case WM_SIZE:
+                       {
+                               //graphics = GetWindowLong( hwnd, DWL_USER, 0 );
+
+                               g_gra->width = LOWORD( lParam );
+                               g_gra->height  = HIWORD( lParam );
+
+                       }
+               break;
+               case WM_DESTROY:
+                       PostQuitMessage(0);
+               break;
+               default:
+                       return DefWindowProc(hwnd, Message, wParam, lParam);
+       }
+       return 0;
+}
+
+
+static const char g_szClassName[] = "NAVGRA";
+
+void CreateGraphicsWindows( struct graphics_priv* gr )
+{
+       WNDCLASSEX wc;
+       HWND hwnd;
+       MSG Msg;
+    RECT rcParent;
+
+       wc.cbSize                = sizeof(WNDCLASSEX);
+       wc.style                 = 0;
+       wc.lpfnWndProc   = WndProc;
+       wc.cbClsExtra    = 0;
+       wc.cbWndExtra    = 0;
+       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;
+
+
+HANDLE hdl = gr->wnd_parent_handle;
+       GetWindowRect( gr->wnd_parent_handle,&rcParent);
+
+       if(!RegisterClassEx(&wc))
+       {
+               ErrorExit( "Window Registration Failed!" );
+               return 0;
+       }
+
+                               g_gra->width = rcParent.right - rcParent.left;
+                               g_gra->height  = rcParent.bottom - rcParent.top;
+
+
+       hwnd = CreateWindow(    g_szClassName,
+                                                       "",
+                                                       WS_CHILD  ,
+                                                       0,
+                                                       0,
+                                                       g_gra->width,
+                                                       g_gra->height,
+                                                       gr->wnd_parent_handle,
+                                                       NULL,
+                                                       NULL,
+                                                       NULL);
+
+       if(hwnd == NULL)
+       {
+               ErrorExit( "Window Creation Failed!" );
+               return 0;
+       }
+
+       ShowWindow(hwnd, TRUE);
+       UpdateWindow(hwnd);
+       gr->wnd_handle = hwnd;
+}
+
+
+
+static void
+graphics_destroy(struct graphics_priv *gr)
+{
+}
+
+
+static void
+gc_destroy(struct graphics_gc_priv *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, 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)
+{
+//     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 NULL;
+}
+
+
+static void draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
+{
+
+       int i;
+       HANDLE hndl = gr->wnd_handle;
+
+       HDC dc = GetDC( gr->wnd_handle );
+
+       int first = 1;
+       for ( i = 0; i< count; i++ )
+       {
+               if ( first )
+               {
+                       first = 0;
+                       MoveToEx( dc, p[0].x, p[0].y, NULL );
+               }
+               else
+               {
+                       LineTo( dc, p[i].x, p[i].y );
+               }
+       }
+       ReleaseDC( gr->wnd_handle, dc );
+}
+
+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 draw_restore(struct graphics_priv *gr, struct point *p, int w, int h)
+{
+       printf( "restore\n");
+}
+
+static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
+{
+       if ( mode == draw_mode_begin )
+       {
+               if ( gr->wnd_handle == NULL )
+                       CreateGraphicsWindows( gr );
+
+               HDC hdcScreen = GetDC( gr->wnd_handle );
+/*
+               hbmScreen = CreateCompatibleBitmap(hdcScreen,
+                     GetDeviceCaps(hdcScreen, HORZRES),
+                     GetDeviceCaps(hdcScreen, VERTRES));
+                     */
+
+       }
+
+       // force paint
+       if (mode == draw_mode_end && gr->mode == draw_mode_begin)
+       {
+       }
+
+       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)
+{
+//     gr->background_gc=gc;
+}
+
+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 struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, int size)
+{
+       meth = NULL;
+       return NULL;
+}
+
+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)
+{
+       return NULL;
+}
+
+
+static struct graphics_methods graphics_methods = {
+       graphics_destroy,
+       draw_mode,
+       draw_lines,
+       draw_polygon,
+       draw_rectangle,
+       draw_circle,
+       draw_text,
+       NULL, // 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;
+       g_gra = this_;
+       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/navit/projs/CodeBlocks/win32gui/win32_gui.c b/navit/projs/CodeBlocks/win32gui/win32_gui.c
new file mode 100644 (file)
index 0000000..0cd210e
--- /dev/null
@@ -0,0 +1,240 @@
+#include <stdlib.h>
+#include <process.h>
+#include <windows.h>
+#include <glib.h>
+#include "config.h"
+#include "plugin.h"
+#include "gui.h"
+#include "win32_gui.h"
+#include "point.h"
+
+#define ID_FILE_EXIT 9001
+#define ID_STUFF_GO 9002
+
+const char g_szClassName[] = "myWindowClass";
+
+
+gboolean message_pump( gpointer data )
+{
+    MSG messages;            /* Here messages to the application are saved */
+    if (GetMessage (&messages, NULL, 0, 0))
+    {
+        /* Translate virtual-key messages into character messages */
+        TranslateMessage(&messages);
+        /* Send message to WindowProcedure */
+        DispatchMessage(&messages);
+    }
+    else{
+       exit( 0 );
+    }
+    return TRUE;
+}
+
+
+
+struct gui_priv *g_this_;
+
+
+struct graphics_priv {
+       struct point p;
+       int width;
+       int height;
+       int library_init;
+       int visible;
+       HANDLE wnd_parent_handle;
+       HANDLE wnd_handle;
+
+       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;
+       // AF FIXenum draw_mode_num mode;
+};
+
+
+extern struct graphics_priv *g_gra;
+
+
+
+static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
+{
+       switch(Message)
+       {
+               case WM_CREATE:
+               {
+                       HMENU hMenu, hSubMenu;
+                       HICON hIcon, hIconSm;
+
+                       hMenu = CreateMenu();
+                       g_this_->hwnd = hwnd;
+
+                       hSubMenu = CreatePopupMenu();
+                       AppendMenu(hSubMenu, MF_STRING, ID_FILE_EXIT, "E&xit");
+                       AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, "&File");
+
+                       hSubMenu = CreatePopupMenu();
+                       AppendMenu(hSubMenu, MF_STRING, ID_STUFF_GO, "&Go");
+                       AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, "&Stuff");
+
+                       SetMenu(hwnd, hMenu);
+
+#if 0
+                       hIcon = LoadImage(NULL, "menu_two.ico", IMAGE_ICON, 32, 32, LR_LOADFROMFILE);
+                       if(hIcon)
+                               SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
+                       else
+                               MessageBox(hwnd, "Could not load large icon!", "Error", MB_OK | MB_ICONERROR);
+
+                       hIconSm = LoadImage(NULL, "menu_two.ico", IMAGE_ICON, 16, 16, LR_LOADFROMFILE);
+                       if(hIconSm)
+                               SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
+                       else
+                               MessageBox(hwnd, "Could not load small icon!", "Error", MB_OK | MB_ICONERROR);
+
+#endif
+
+               }
+               break;
+               case WM_COMMAND:
+                       switch(LOWORD(wParam))
+                       {
+                               case ID_FILE_EXIT:
+                                       PostMessage(hwnd, WM_CLOSE, 0, 0);
+                               break;
+                               case ID_STUFF_GO:
+                                                                       (*g_gra->resize_callback)(g_gra->resize_callback_data, g_gra->width, g_gra->height);
+
+//                                     navit_draw(g_this_->nav);
+                                       // MessageBox(hwnd, "You clicked Go!", "Woo!", MB_OK);
+                               break;
+                       }
+               break;
+               case WM_CLOSE:
+                       DestroyWindow(hwnd);
+               break;
+               case WM_DESTROY:
+                       PostQuitMessage(0);
+               break;
+               default:
+                       return DefWindowProc(hwnd, Message, wParam, lParam);
+       }
+       return 0;
+}
+
+int Win32Init( void )
+{
+       WNDCLASSEX wc;
+       HWND hwnd;
+       MSG Msg;
+
+       wc.cbSize                = sizeof(WNDCLASSEX);
+       wc.style                 = 0;
+       wc.lpfnWndProc   = WndProc;
+       wc.cbClsExtra    = 0;
+       wc.cbWndExtra    = 0;
+       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;
+
+       if(!RegisterClassEx(&wc))
+       {
+               MessageBox(NULL, "Window Registration Failed!", "Error!",
+                       MB_ICONEXCLAMATION | MB_OK);
+               return 0;
+       }
+
+       hwnd = CreateWindowEx(
+               WS_EX_CLIENTEDGE,
+               g_szClassName,
+               "A Menu #2",
+               WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
+               CW_USEDEFAULT, CW_USEDEFAULT, 800, 600,
+               NULL, NULL, NULL, NULL);
+
+       if(hwnd == NULL)
+       {
+               MessageBox(NULL, "Window Creation Failed!", "Error!",
+                       MB_ICONEXCLAMATION | MB_OK);
+               return 0;
+       }
+
+       ShowWindow(hwnd, TRUE);
+       UpdateWindow(hwnd);
+
+       g_idle_add (message_pump, NULL);
+
+       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;
+}
+
+
+struct gui_methods win32_gui_methods = {
+       NULL, // win32_gui_menubar_new,
+       NULL, // win32_gui_toolbar_new,
+       NULL, // win32_gui_statusbar_new,
+       NULL, // 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_;
+       int w=792, h=547;
+       unsigned xid = 0;
+
+       *meth=win32_gui_methods;
+
+       this_=g_new0(struct gui_priv, 1);
+       this_->nav=nav;
+
+       g_this_ = this_;
+
+       Win32Init();
+
+
+//     navit_zoom_out(this_->nav, 2, NULL);
+
+       return this_;
+}
+
+extern struct graphics_priv* win32_graphics_new( struct graphics_methods *meth, struct attr **attrs);
+
+
+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/projs/CodeBlocks/win32gui/win32_gui.h b/navit/projs/CodeBlocks/win32gui/win32_gui.h
new file mode 100644 (file)
index 0000000..269a73c
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef WIN32_GUI_INCLUDED
+#define WIN32_GUI_INCLUDED
+
+#include "coord.h"
+
+struct statusbar_methods;
+struct menu_methods;
+struct datawindow_methods;
+struct navit;
+struct callback;
+
+struct gui_priv {
+       struct navit *nav;
+       HANDLE  hwnd;
+};
+
+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);
+
+#endif
diff --git a/navit/projs/CodeBlocks/win32gui/window.c b/navit/projs/CodeBlocks/win32gui/window.c
new file mode 100644 (file)
index 0000000..58569b4
--- /dev/null
@@ -0,0 +1,149 @@
+#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);
+}
+*/