Fix:projs/CodeBlocks:update project files, more work on native win32 gui/graphics
authorafaber <afaber@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 4 Feb 2008 00:46:04 +0000 (00:46 +0000)
committerafaber <afaber@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 4 Feb 2008 00:46:04 +0000 (00:46 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit@839 ffa7fe5e-494d-0410-b361-a75ebd5db220

12 files changed:
projs/CodeBlocks/Navit.workspace
projs/CodeBlocks/NavitCore.cbp
projs/CodeBlocks/Navit_gtk.cbp [new file with mode: 0644]
projs/CodeBlocks/Navit_win32.cbp [new file with mode: 0644]
projs/CodeBlocks/Win32Extra/navit_gtk.c [new file with mode: 0644]
projs/CodeBlocks/Win32Extra/navit_win32.c [new file with mode: 0644]
projs/CodeBlocks/data_garmin.cbp
projs/CodeBlocks/speech_speech_dispatcher.cbp [new file with mode: 0644]
projs/CodeBlocks/win32_gui.cbp [new file with mode: 0644]
projs/CodeBlocks/win32gui/win32_graphics.c
projs/CodeBlocks/win32gui/win32_gui.c
projs/CodeBlocks/win32gui/win32_gui.h

index fc79297..716ba31 100644 (file)
@@ -1,6 +1,7 @@
 <?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" />
                        <Depends filename="gentypes.cbp" />
                </Project>
                <Project filename="data_mg.cbp" />
-               <Project filename="Navit.cbp" active="1">
+               <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="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="Navit_gtk.cbp">
+                       <Depends filename="NavitCore.cbp" />
                        <Depends filename="win32_gui.cbp" />
                        <Depends filename="fib-1.1.cbp" />
                        <Depends filename="Osm2Navit.cbp" />
index 26da9b3..bc3c466 100644 (file)
@@ -48,9 +48,6 @@
                <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" />
diff --git a/projs/CodeBlocks/Navit_gtk.cbp b/projs/CodeBlocks/Navit_gtk.cbp
new file mode 100644 (file)
index 0000000..0a9bbb9
--- /dev/null
@@ -0,0 +1,123 @@
+<?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 use_console_runner="0" />
+                               <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\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\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 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="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="..\..\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\navit_gtk.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
new file mode 100644 (file)
index 0000000..b29ecad
--- /dev/null
@@ -0,0 +1,116 @@
+<?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 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" />
+                               <Option use_console_runner="0" />
+                               <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\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="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 directory="bin\Debug" />
+                                       <Add directory="." />
+                                       <Add directory="Win32Extra\libgarmin" />
+                               </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" />
+                               <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="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 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="..\..\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\navit_win32.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Extensions>
+                       <code_completion />
+                       <envvars />
+                       <debugger />
+               </Extensions>
+       </Project>
+</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/Win32Extra/navit_gtk.c b/projs/CodeBlocks/Win32Extra/navit_gtk.c
new file mode 100644 (file)
index 0000000..c2aa095
--- /dev/null
@@ -0,0 +1,23 @@
+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
new file mode 100644 (file)
index 0000000..054d402
--- /dev/null
@@ -0,0 +1,17 @@
+
+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_vehicle_demo_init();
+       module_vehicle_file_init();
+       module_speech_speech_dispatcher_init();
+}
index 48a233f..c3b4906 100644 (file)
@@ -65,9 +65,6 @@
                        <Option compilerVar="CC" />
                </Unit>
                <Unit filename="..\..\src\data\garmin\garmin.h" />
-               <Unit filename="..\..\src\data\garmin\gentypes.c">
-                       <Option compilerVar="CC" />
-               </Unit>
                <Extensions>
                        <code_completion />
                        <envvars />
diff --git a/projs/CodeBlocks/speech_speech_dispatcher.cbp b/projs/CodeBlocks/speech_speech_dispatcher.cbp
new file mode 100644 (file)
index 0000000..228c621
--- /dev/null
@@ -0,0 +1,72 @@
+<?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="..\..\src" />
+                       <Add directory="." />
+                       <Add directory="Win32Extra\libgarmin" />
+                       <Add directory="C:\Program Files\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="..\..\src\data\garmin\garmin.h" />
+               <Extensions>
+                       <code_completion />
+                       <envvars />
+                       <debugger />
+               </Extensions>
+       </Project>
+</CodeBlocks_project_file>
diff --git a/projs/CodeBlocks/win32_gui.cbp b/projs/CodeBlocks/win32_gui.cbp
new file mode 100644 (file)
index 0000000..91b2571
--- /dev/null
@@ -0,0 +1,62 @@
+<?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>
+               </Build>
+               <Compiler>
+                       <Add option="-Wall" />
+                       <Add option="-mms-bitfields" />
+                       <Add option="-DMODULE=win32_gui" />
+                       <Add directory="%GTK_DIR%\include\glib-2.0" />
+                       <Add directory="%GTK_DIR%\lib\glib-2.0\include" />
+                       <Add directory="..\..\src" />
+                       <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\xpm2bmp.c">
+                       <Option compilerVar="CC" />
+               </Unit>
+               <Unit filename="win32gui\xpm2bmp.h" />
+               <Extensions>
+                       <code_completion />
+                       <envvars />
+                       <debugger />
+               </Extensions>
+       </Project>
+</CodeBlocks_project_file>
index b7d24cd..6483b46 100644 (file)
@@ -8,14 +8,92 @@
 #include "graphics.h"
 #include "color.h"
 #include "plugin.h"
+#include "win32_gui.h"
 
-#define ID_CHILD_GFX 2000
 #include "xpm2bmp.h";
 
 #ifndef GET_WHEEL_DELTA_WPARAM
        #define GET_WHEEL_DELTA_WPARAM(wParam)  ((short)HIWORD(wParam))
 #endif
 
+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) ;
+
+     SetGraphicsMode (hdc, GM_ADVANCED) ;
+     ModifyWorldTransform (hdc, NULL, MWT_IDENTITY) ;
+     SetViewportOrgEx (hdc, 0, 0, NULL) ;
+     SetWindowOrgEx   (hdc, 0, 0, NULL) ;
+
+     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) ;
+
+     DPtoLP (hdc, &pt, 1) ;
+     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;
 };
@@ -52,23 +130,6 @@ void ErrorExit(LPTSTR lpszFunction)
 }
 
 
-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_gc_priv {
        HWND hwnd;
@@ -118,11 +179,23 @@ static void MakeMemoryDC(HANDLE hWnd, HDC hdc )
        }
 }
 
+static void HandleButtonClick( int updown, int button, long lParam )
+{
+       int xPos = LOWORD(lParam);
+       int yPos = HIWORD(lParam);
+       // printf( "WM_LBUTTONDOWN: %d %d \n", xPos, yPos );
+       if (g_gra->button_callback )
+       {
+               struct point pt = {xPos, yPos};
+               (*g_gra->button_callback)(g_gra->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 );
+//if ( Message != 15 )
+       // printf( "CHILD %d %d %d \n", Message, wParam, lParam );
        switch(Message)
        {
                case WM_CREATE:
@@ -151,10 +224,6 @@ if ( Message != 15 )
                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 );
@@ -193,39 +262,23 @@ if ( Message != 15 )
                        int yPos = HIWORD(lParam);
                        struct point pt = {xPos, yPos};
 
-                       printf( "WM_MOUSEMOVE: %d %d \n", xPos, yPos );
+                       // printf( "WM_MOUSEMOVE: %d %d \n", xPos, yPos );
                        (*g_gra->motion_callback)(g_gra->motion_callback_data, &pt);
                }
 
                break;
-               case WM_LBUTTONUP:
-               {
-                       int xPos = LOWORD(lParam);
-                       int yPos = HIWORD(lParam);
-
-                       struct point pt = { xPos, yPos };
-
-                       printf( "WM_LBUTTONUP: %d %d \n", xPos, yPos );
-                       if (g_gra->button_callback )
-                       {
-                               struct point pt = {xPos, yPos};
-                               (*g_gra->button_callback)(g_gra->button_callback_data, 0, 1, &pt);
-                       }
-
-               }
-               break;
 
                case WM_LBUTTONDOWN:
-               {
-                       int xPos = LOWORD(lParam);
-                       int yPos = HIWORD(lParam);
-                       printf( "WM_LBUTTONDOWN: %d %d \n", xPos, yPos );
-                       if (g_gra->button_callback )
-                       {
-                               struct point pt = {xPos, yPos};
-                               (*g_gra->button_callback)(g_gra->button_callback_data, 1, 1, &pt);
-                       }
-               }
+                       HandleButtonClick( 1, 1,lParam );
+               break;
+               case WM_LBUTTONUP:
+                       HandleButtonClick( 0, 1,lParam );
+               break;
+               case WM_RBUTTONDOWN:
+                       HandleButtonClick( 1, 3,lParam );
+               break;
+               case WM_RBUTTONUP:
+                       HandleButtonClick( 0, 3,lParam );
                break;
 
                case WM_HSCROLL:
@@ -275,17 +328,16 @@ void CreateGraphicsWindows( struct graphics_priv* gr )
                return NULL;
        }
 
-       g_gra->width = rcParent.right - rcParent.left;
-       g_gra->height  = rcParent.bottom - rcParent.top;
-
+       gr->width = rcParent.right - rcParent.left;
+       gr->height  = rcParent.bottom - rcParent.top;
 
        hwnd = CreateWindow(    g_szClassName,
                                                        "",
                                                        WS_CHILD  ,
                                                        0,
                                                        0,
-                                                       g_gra->width,
-                                                       g_gra->height,
+                                                       gr->width,
+                                                       gr->height,
                                                        gr->wnd_parent_handle,
                                                        (HMENU)ID_CHILD_GFX,
                                                        NULL,
@@ -404,6 +456,7 @@ static void draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, st
 
 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;
@@ -459,15 +512,12 @@ static void draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, s
 
 static void draw_restore(struct graphics_priv *gr, struct point *p, int w, int h)
 {
-       // AF TODO
-       printf( "draw restore \n" );
-
-       InvalidateRect( gr->wnd_handle, NULL, FALSE );
+       InvalidateRect( gr->wnd_handle, NULL, TRUE );
 }
 
 static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
 {
-       printf( "set draw_mode to %d\n", (int)mode );
+       // printf( "set draw_mode to %d\n", (int)mode );
 
        if ( mode == draw_mode_begin )
        {
@@ -475,6 +525,17 @@ static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
                {
                        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
@@ -523,17 +584,102 @@ static void register_button_callback(struct graphics_priv *this_, void (*callbac
 
 static void background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
 {
-//     gr->background_gc=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 )
+       {
+               int size = font->size;
+               long lfHeight = -MulDiv(font->size, GetDeviceCaps(hMemDC, LOGPIXELSY), 72);
+
+               font->hfont = EzCreateFont (hMemDC, TEXT ("Arial"), size/2, 0, 0, TRUE) ;
+               GetObject ( font->hfont, sizeof (LOGFONT), &font->lf) ;
+
+/*
+               font->hfont = CreateFont(       lfHeight,
+                                                                       0,
+                                                                       0,
+                                                                       0,
+                                                                       0,
+                                                                       TRUE,
+                                                                       0,
+                                                                       0,
+                                                                       DEFAULT_CHARSET,
+                                                                       0,
+                                                                       0,
+                                                                       0,
+                                                                       0,
+                                                                       "Arial");
+                                                                       */
+       }
+
+
+//     RECT rc = { p->x, p->y, 800, 800 };
+//     DrawText(hMemDC, text, -1, &rc, DT_NOCLIP | DT_CALCRECT| DT_SINGLELINE);
+       double angle = -atan2( dy, dx ) * 180 / 3.14159 ;
+// printf( "dx %d , dy %d angle %6.3f %s\n", dx, dy, angle, text);
+       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 );
+
+       TextOut(hMemDC, 0,0, text, strlen( text ) );
+
+       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)
 {
-       meth = NULL;
-       return NULL;
+       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 struct graphics_image_priv *image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h, struct point *hot)
@@ -583,6 +729,7 @@ static struct graphics_priv * graphics_win32_drawing_area_new_helper(struct grap
        struct graphics_priv *this_=g_new0(struct graphics_priv,1);
        *meth=graphics_methods;
        g_gra = this_;
+       this_->mode = -1;
        return this_;
 }
 
index d8bef94..2e4456f 100644 (file)
@@ -7,64 +7,33 @@
 #include "gui.h"
 #include "win32_gui.h"
 #include "point.h"
+#include "menu.h"
 
-#define ID_DISPLAY_ZOOMIN 8000
-#define ID_DISPLAY_ZOOMOUT 8001
 
-#define ID_FILE_EXIT 9001
-#define ID_STUFF_GO 9002
+const char g_szClassName[] = "navit_gui_class";
 
-const char g_szClassName[] = "myWindowClass";
 
-#define ID_CHILD_GFX 2000
-#define ID_CHILD_1 2001
-#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 _(text) gettext(text)
+static menu_id = 0;
+static POINT menu_pt;
 
 gboolean message_pump( gpointer data )
 {
-       Sleep( 100 );
-       printf( "pump\n" );
+    MSG messages;
 
-    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;
+       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;
-//     enum draw_mode_num mode;
-};
 
 
 extern struct graphics_priv *g_gra;
@@ -95,7 +64,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
 {
     RECT rcClient;
 
-       printf( "PARENT %d %d %d \n", Message, wParam, lParam );
+       //printf( "PARENT %d %d %d \n", Message, wParam, lParam );
 
        switch(Message)
        {
@@ -105,7 +74,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
                        HICON hIcon, hIconSm;
 
                        hMenu = CreateMenu();
-                       g_this_->hwnd = hwnd;
+                       // g_this_->hwnd = hwnd;
 
                        hSubMenu = CreatePopupMenu();
 
@@ -151,18 +120,28 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
                }
                break;
                case WM_COMMAND:
+               {
+                       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);
+                               break;
+                               case ID_DISPLAY_ZOOMOUT:
+                                               navit_zoom_out(gui->nav, 2, NULL);
+                               break;
                                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);
+//                                     navit_draw(gui->nav);
                                        // MessageBox(hwnd, "You clicked Go!", "Woo!", MB_OK);
                                break;
                        }
+               }
                break;
                case WM_USER+ 1:
                        printf( "wm_user \n" );
@@ -182,17 +161,18 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
                        PostQuitMessage(0);
                break;
 
+
                case WM_MOUSEWHEEL:
                {
-                       struct gui_priv * priv = GetWindowLongPtr( hwnd, DWLP_USER );
+                       struct gui_priv* gui = (struct gui_priv*)GetWindowLongPtr( hwnd , DWLP_USER );
 
                        short delta = GET_WHEEL_DELTA_WPARAM( wParam );
                        if ( delta > 0 )
                        {
-                               navit_zoom_in(g_this_->nav, 2, NULL);
+                               navit_zoom_in(gui->nav, 2, NULL);
                        }
                        else{
-                               navit_zoom_out(g_this_->nav, 2, NULL);
+                               navit_zoom_out(gui->nav, 2, NULL);
                        }
                }
                break;
@@ -203,7 +183,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
        return 0;
 }
 
-HANDLE Win32Init( void )
+HANDLE CreateWin32Window( void )
 {
        WNDCLASSEX wc;
        HWND hwnd;
@@ -213,7 +193,7 @@ HANDLE Win32Init( void )
        wc.style                 = 0;
        wc.lpfnWndProc   = WndProc;
        wc.cbClsExtra    = 0;
-       wc.cbWndExtra    = 0;
+       wc.cbWndExtra    = 32;
        wc.hInstance     = NULL;
        wc.hIcon                 = NULL;
        wc.hCursor               = LoadCursor(NULL, IDC_ARROW);
@@ -224,8 +204,7 @@ HANDLE Win32Init( void )
 
        if(!RegisterClassEx(&wc))
        {
-               MessageBox(NULL, "Window Registration Failed!", "Error!",
-                       MB_ICONEXCLAMATION | MB_OK);
+               MessageBox(NULL, "Window Registration Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK);
                return 0;
        }
 
@@ -239,8 +218,7 @@ HANDLE Win32Init( void )
 
        if(hwnd == NULL)
        {
-               MessageBox(NULL, "Window Creation Failed!", "Error!",
-                       MB_ICONEXCLAMATION | MB_OK);
+               MessageBox(NULL, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK);
                return 0;
        }
 
@@ -256,9 +234,7 @@ HANDLE Win32Init( void )
 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;
 }
@@ -275,12 +251,97 @@ static int win32_gui_add_bookmark(struct gui_priv *gui, struct pcoord *c, char *
        return 1;
 }
 
+struct menu_priv {
+       HWND wnd_handle;
+       HMENU hMenu;
+};
+
+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;
+
+       if ( type == menu_type_submenu )
+       {
+               HMENU hSubMenu = NULL;
+               hSubMenu = CreatePopupMenu();
+               AppendMenu(menu->hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, name );
+               ret->hMenu = hSubMenu;
+       }
+       else
+       {
+               AppendMenu( menu->hMenu, MF_STRING, menu_id, name );
+       }
+       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 menu_pt = { 200,200 };
+       POINT pnt = menu_pt;
+
+       ClientToScreen(menu->wnd_handle, (LPPOINT) &pnt);
+
+       if (menu->hMenu)
+       {
+               TrackPopupMenu (menu->hMenu, 0, pnt.x, pnt.y, 0, menu->wnd_handle, NULL);
+       }
+}
+
+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 = 4000;
+
+       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,
        NULL, // win32_gui_toolbar_new,
        NULL, // win32_gui_statusbar_new,
-       NULL, // win32_gui_popup_new,
+       win32_gui_popup_new,
        win32_gui_set_graphics,
        NULL,
        NULL, // win32_gui_datawindow_new,
@@ -292,28 +353,18 @@ struct gui_methods win32_gui_methods = {
 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_;
-
-       this_->hwnd = Win32Init();
+       this_->hwnd = CreateWin32Window();
        SetWindowLongPtr( this_->hwnd , DWLP_USER, this_ );
 
-
-//     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);
index 269a73c..8c763b1 100644 (file)
@@ -2,6 +2,22 @@
 #define WIN32_GUI_INCLUDED
 
 #include "coord.h"
+#include "point.h"
+#include "graphics.h"
+
+#define ID_CHILD_GFX 2000
+#define ID_CHILD_1 2001
+#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 8000
+#define ID_DISPLAY_ZOOMOUT 8001
+
+#define ID_FILE_EXIT 9001
+#define ID_STUFF_GO 9002
+
+#define _(text) gettext(text)
+
 
 struct statusbar_methods;
 struct menu_methods;
@@ -14,10 +30,33 @@ struct gui_priv {
        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 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 graphics_methods *meth, struct attr **attrs);
+
 #endif